From 9c8d9ee063a5cb0c738a24d4735230aebc4c2824 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Tue, 3 Jan 2023 13:45:45 +0530 Subject: [PATCH 1/2] Removed all __future__ imports. Signed-off-by: Jay --- src/fetchcode/commoncode_datautils.py | 3 --- src/fetchcode/packagedcode_models.py | 3 --- src/fetchcode/vcs/pip/__main__.py | 1 - src/fetchcode/vcs/pip/_internal/cli/base_command.py | 1 - src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py | 1 - src/fetchcode/vcs/pip/_internal/cli/main.py | 1 - src/fetchcode/vcs/pip/_internal/cli/parser.py | 1 - src/fetchcode/vcs/pip/_internal/cli/progress_bars.py | 1 - src/fetchcode/vcs/pip/_internal/cli/spinners.py | 1 - src/fetchcode/vcs/pip/_internal/cli/status_codes.py | 1 - src/fetchcode/vcs/pip/_internal/commands/__init__.py | 1 - src/fetchcode/vcs/pip/_internal/commands/cache.py | 1 - src/fetchcode/vcs/pip/_internal/commands/completion.py | 1 - src/fetchcode/vcs/pip/_internal/commands/debug.py | 1 - src/fetchcode/vcs/pip/_internal/commands/download.py | 1 - src/fetchcode/vcs/pip/_internal/commands/freeze.py | 1 - src/fetchcode/vcs/pip/_internal/commands/hash.py | 1 - src/fetchcode/vcs/pip/_internal/commands/help.py | 1 - src/fetchcode/vcs/pip/_internal/commands/install.py | 1 - src/fetchcode/vcs/pip/_internal/commands/list.py | 1 - src/fetchcode/vcs/pip/_internal/commands/search.py | 1 - src/fetchcode/vcs/pip/_internal/commands/show.py | 1 - src/fetchcode/vcs/pip/_internal/commands/uninstall.py | 1 - src/fetchcode/vcs/pip/_internal/commands/wheel.py | 1 - src/fetchcode/vcs/pip/_internal/exceptions.py | 1 - src/fetchcode/vcs/pip/_internal/index/package_finder.py | 1 - src/fetchcode/vcs/pip/_internal/locations.py | 1 - src/fetchcode/vcs/pip/_internal/operations/freeze.py | 1 - src/fetchcode/vcs/pip/_internal/operations/install/wheel.py | 1 - src/fetchcode/vcs/pip/_internal/pyproject.py | 1 - src/fetchcode/vcs/pip/_internal/req/__init__.py | 1 - src/fetchcode/vcs/pip/_internal/req/req_file.py | 1 - src/fetchcode/vcs/pip/_internal/req/req_install.py | 1 - src/fetchcode/vcs/pip/_internal/req/req_set.py | 1 - src/fetchcode/vcs/pip/_internal/req/req_tracker.py | 1 - src/fetchcode/vcs/pip/_internal/req/req_uninstall.py | 1 - src/fetchcode/vcs/pip/_internal/self_outdated_check.py | 1 - src/fetchcode/vcs/pip/_internal/utils/appdirs.py | 1 - src/fetchcode/vcs/pip/_internal/utils/compat.py | 1 - src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py | 1 - src/fetchcode/vcs/pip/_internal/utils/deprecation.py | 1 - src/fetchcode/vcs/pip/_internal/utils/glibc.py | 1 - src/fetchcode/vcs/pip/_internal/utils/hashes.py | 1 - src/fetchcode/vcs/pip/_internal/utils/logging.py | 1 - src/fetchcode/vcs/pip/_internal/utils/misc.py | 1 - src/fetchcode/vcs/pip/_internal/utils/packaging.py | 1 - src/fetchcode/vcs/pip/_internal/utils/subprocess.py | 1 - src/fetchcode/vcs/pip/_internal/utils/temp_dir.py | 1 - src/fetchcode/vcs/pip/_internal/utils/unpacking.py | 1 - src/fetchcode/vcs/pip/_internal/utils/virtualenv.py | 1 - src/fetchcode/vcs/pip/_internal/utils/wheel.py | 1 - src/fetchcode/vcs/pip/_internal/vcs/bazaar.py | 1 - src/fetchcode/vcs/pip/_internal/vcs/git.py | 1 - src/fetchcode/vcs/pip/_internal/vcs/mercurial.py | 1 - src/fetchcode/vcs/pip/_internal/vcs/subversion.py | 1 - src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py | 1 - src/fetchcode/vcs/pip/_vendor/__init__.py | 1 - .../vcs/pip/_vendor/cachecontrol/caches/redis_cache.py | 1 - src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py | 1 - src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py | 1 - src/fetchcode/vcs/pip/_vendor/distlib/compat.py | 1 - src/fetchcode/vcs/pip/_vendor/distlib/database.py | 1 - src/fetchcode/vcs/pip/_vendor/distlib/metadata.py | 1 - src/fetchcode/vcs/pip/_vendor/distlib/resources.py | 1 - src/fetchcode/vcs/pip/_vendor/distlib/wheel.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/_tokenizer.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/_trie/py.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/constants.py | 1 - .../vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py | 1 - .../vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/serializer.py | 1 - .../vcs/pip/_vendor/html5lib/treeadapters/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/genshi.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/sax.py | 1 - .../vcs/pip/_vendor/html5lib/treebuilders/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/base.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/dom.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree.py | 1 - .../vcs/pip/_vendor/html5lib/treebuilders/etree_lxml.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/base.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/dom.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree.py | 1 - .../vcs/pip/_vendor/html5lib/treewalkers/etree_lxml.py | 1 - src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/genshi.py | 1 - src/fetchcode/vcs/pip/_vendor/ipaddress.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/__about__.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/_compat.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/_structures.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/markers.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/requirements.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/specifiers.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/tags.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/utils.py | 1 - src/fetchcode/vcs/pip/_vendor/packaging/version.py | 1 - src/fetchcode/vcs/pip/_vendor/pkg_resources/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/progress/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/progress/bar.py | 1 - src/fetchcode/vcs/pip/_vendor/progress/counter.py | 1 - src/fetchcode/vcs/pip/_vendor/progress/spinner.py | 1 - src/fetchcode/vcs/pip/_vendor/requests/help.py | 1 - src/fetchcode/vcs/pip/_vendor/six.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/_collections.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/connection.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/connectionpool.py | 1 - .../pip/_vendor/urllib3/contrib/_securetransport/bindings.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/contrib/appengine.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/contrib/ntlmpool.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/contrib/pyopenssl.py | 1 - .../vcs/pip/_vendor/urllib3/contrib/securetransport.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/contrib/socks.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/exceptions.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/fields.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/filepost.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/packages/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/packages/six.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/poolmanager.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/request.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/response.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/util/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/util/connection.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/util/request.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/util/response.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/util/retry.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/util/ssl_.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/util/timeout.py | 1 - src/fetchcode/vcs/pip/_vendor/urllib3/util/url.py | 1 - src/fetchcode/vcs/pip/_vendor/webencodings/__init__.py | 1 - src/fetchcode/vcs/pip/_vendor/webencodings/tests.py | 1 - src/fetchcode/vcs/pip/_vendor/webencodings/x_user_defined.py | 1 - 145 files changed, 149 deletions(-) diff --git a/src/fetchcode/commoncode_datautils.py b/src/fetchcode/commoncode_datautils.py index 4822fbeb..82650ab1 100644 --- a/src/fetchcode/commoncode_datautils.py +++ b/src/fetchcode/commoncode_datautils.py @@ -23,9 +23,6 @@ # ScanCode is a free software code scanning tool from nexB Inc. and others. # Visit https://github.com/nexB/scancode-toolkit/ for support and download. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals from collections import OrderedDict diff --git a/src/fetchcode/packagedcode_models.py b/src/fetchcode/packagedcode_models.py index c0b59592..c19150ac 100644 --- a/src/fetchcode/packagedcode_models.py +++ b/src/fetchcode/packagedcode_models.py @@ -23,9 +23,6 @@ # ScanCode is a free software code scanning tool from nexB Inc. and others. # Visit https://github.com/nexB/scancode-toolkit/ for support and download. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals from collections import OrderedDict import logging diff --git a/src/fetchcode/vcs/pip/__main__.py b/src/fetchcode/vcs/pip/__main__.py index 8bdcf48b..af23e468 100644 --- a/src/fetchcode/vcs/pip/__main__.py +++ b/src/fetchcode/vcs/pip/__main__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import os import sys diff --git a/src/fetchcode/vcs/pip/_internal/cli/base_command.py b/src/fetchcode/vcs/pip/_internal/cli/base_command.py index 576fc4b0..c9360abc 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/base_command.py +++ b/src/fetchcode/vcs/pip/_internal/cli/base_command.py @@ -1,6 +1,5 @@ """Base Command class, and related routines""" -from __future__ import absolute_import, print_function import logging import logging.config diff --git a/src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py b/src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py index 039b6836..e626a006 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py +++ b/src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py @@ -10,7 +10,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/cli/main.py b/src/fetchcode/vcs/pip/_internal/cli/main.py index 2adc761c..1a73fa15 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/main.py +++ b/src/fetchcode/vcs/pip/_internal/cli/main.py @@ -1,6 +1,5 @@ """Primary application entrypoint. """ -from __future__ import absolute_import import locale import logging diff --git a/src/fetchcode/vcs/pip/_internal/cli/parser.py b/src/fetchcode/vcs/pip/_internal/cli/parser.py index 49d03fcc..7fe79864 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/parser.py +++ b/src/fetchcode/vcs/pip/_internal/cli/parser.py @@ -3,7 +3,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import optparse diff --git a/src/fetchcode/vcs/pip/_internal/cli/progress_bars.py b/src/fetchcode/vcs/pip/_internal/cli/progress_bars.py index fed44847..9fe7a2a8 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/progress_bars.py +++ b/src/fetchcode/vcs/pip/_internal/cli/progress_bars.py @@ -1,4 +1,3 @@ -from __future__ import division import itertools import sys diff --git a/src/fetchcode/vcs/pip/_internal/cli/spinners.py b/src/fetchcode/vcs/pip/_internal/cli/spinners.py index 57e30a7b..69fe6639 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/spinners.py +++ b/src/fetchcode/vcs/pip/_internal/cli/spinners.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division import contextlib import itertools diff --git a/src/fetchcode/vcs/pip/_internal/cli/status_codes.py b/src/fetchcode/vcs/pip/_internal/cli/status_codes.py index 275360a3..f8da982b 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/status_codes.py +++ b/src/fetchcode/vcs/pip/_internal/cli/status_codes.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import SUCCESS = 0 ERROR = 1 diff --git a/src/fetchcode/vcs/pip/_internal/commands/__init__.py b/src/fetchcode/vcs/pip/_internal/commands/__init__.py index 317cf671..5635b74f 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/__init__.py +++ b/src/fetchcode/vcs/pip/_internal/commands/__init__.py @@ -9,7 +9,6 @@ # return type of difflib.get_close_matches to be reported # as List[Sequence[str]] whereas it should have been List[str] -from __future__ import absolute_import import importlib from collections import OrderedDict, namedtuple diff --git a/src/fetchcode/vcs/pip/_internal/commands/cache.py b/src/fetchcode/vcs/pip/_internal/commands/cache.py index b0a8926e..7724ae77 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/cache.py +++ b/src/fetchcode/vcs/pip/_internal/commands/cache.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/commands/completion.py b/src/fetchcode/vcs/pip/_internal/commands/completion.py index a3c04ab9..755fcf7d 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/completion.py +++ b/src/fetchcode/vcs/pip/_internal/commands/completion.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import sys import textwrap diff --git a/src/fetchcode/vcs/pip/_internal/commands/debug.py b/src/fetchcode/vcs/pip/_internal/commands/debug.py index 4ccff438..a70f3b47 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/debug.py +++ b/src/fetchcode/vcs/pip/_internal/commands/debug.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import locale import logging diff --git a/src/fetchcode/vcs/pip/_internal/commands/download.py b/src/fetchcode/vcs/pip/_internal/commands/download.py index 5c2f19c2..f73770b4 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/download.py +++ b/src/fetchcode/vcs/pip/_internal/commands/download.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/commands/freeze.py b/src/fetchcode/vcs/pip/_internal/commands/freeze.py index c7f07cc8..c20b796d 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/freeze.py +++ b/src/fetchcode/vcs/pip/_internal/commands/freeze.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import sys diff --git a/src/fetchcode/vcs/pip/_internal/commands/hash.py b/src/fetchcode/vcs/pip/_internal/commands/hash.py index fd49bf45..e18d3262 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/hash.py +++ b/src/fetchcode/vcs/pip/_internal/commands/hash.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import hashlib import logging diff --git a/src/fetchcode/vcs/pip/_internal/commands/help.py b/src/fetchcode/vcs/pip/_internal/commands/help.py index fc6288bc..fee8ce4b 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/help.py +++ b/src/fetchcode/vcs/pip/_internal/commands/help.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import from fetchcode.vcs.pip._internal.cli.base_command import Command from fetchcode.vcs.pip._internal.cli.status_codes import SUCCESS diff --git a/src/fetchcode/vcs/pip/_internal/commands/install.py b/src/fetchcode/vcs/pip/_internal/commands/install.py index 9225cdd0..c759938f 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/install.py +++ b/src/fetchcode/vcs/pip/_internal/commands/install.py @@ -5,7 +5,6 @@ # mypy: strict-optional=False # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import errno import logging diff --git a/src/fetchcode/vcs/pip/_internal/commands/list.py b/src/fetchcode/vcs/pip/_internal/commands/list.py index fe1ee21e..07db45c2 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/list.py +++ b/src/fetchcode/vcs/pip/_internal/commands/list.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import json import logging diff --git a/src/fetchcode/vcs/pip/_internal/commands/search.py b/src/fetchcode/vcs/pip/_internal/commands/search.py index 5ccbcd13..7e929765 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/search.py +++ b/src/fetchcode/vcs/pip/_internal/commands/search.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import sys diff --git a/src/fetchcode/vcs/pip/_internal/commands/show.py b/src/fetchcode/vcs/pip/_internal/commands/show.py index 2ccfbe9b..b61bcbb1 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/show.py +++ b/src/fetchcode/vcs/pip/_internal/commands/show.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/commands/uninstall.py b/src/fetchcode/vcs/pip/_internal/commands/uninstall.py index adbd9a97..4511744e 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/uninstall.py +++ b/src/fetchcode/vcs/pip/_internal/commands/uninstall.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import from fetchcode.vcs.pip._vendor.packaging.utils import canonicalize_name diff --git a/src/fetchcode/vcs/pip/_internal/commands/wheel.py b/src/fetchcode/vcs/pip/_internal/commands/wheel.py index cfd5d9a6..efd849a1 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/wheel.py +++ b/src/fetchcode/vcs/pip/_internal/commands/wheel.py @@ -3,7 +3,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/exceptions.py b/src/fetchcode/vcs/pip/_internal/exceptions.py index d1b8f6c3..69b22b6a 100644 --- a/src/fetchcode/vcs/pip/_internal/exceptions.py +++ b/src/fetchcode/vcs/pip/_internal/exceptions.py @@ -3,7 +3,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import from itertools import chain, groupby, repeat diff --git a/src/fetchcode/vcs/pip/_internal/index/package_finder.py b/src/fetchcode/vcs/pip/_internal/index/package_finder.py index 58e09b4f..af768e54 100644 --- a/src/fetchcode/vcs/pip/_internal/index/package_finder.py +++ b/src/fetchcode/vcs/pip/_internal/index/package_finder.py @@ -3,7 +3,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import logging import re diff --git a/src/fetchcode/vcs/pip/_internal/locations.py b/src/fetchcode/vcs/pip/_internal/locations.py index 1ae96343..fda7f02a 100644 --- a/src/fetchcode/vcs/pip/_internal/locations.py +++ b/src/fetchcode/vcs/pip/_internal/locations.py @@ -3,7 +3,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import os import os.path diff --git a/src/fetchcode/vcs/pip/_internal/operations/freeze.py b/src/fetchcode/vcs/pip/_internal/operations/freeze.py index da3247c2..74bfffbc 100644 --- a/src/fetchcode/vcs/pip/_internal/operations/freeze.py +++ b/src/fetchcode/vcs/pip/_internal/operations/freeze.py @@ -2,7 +2,6 @@ # mypy: strict-optional=False # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import collections import logging diff --git a/src/fetchcode/vcs/pip/_internal/operations/install/wheel.py b/src/fetchcode/vcs/pip/_internal/operations/install/wheel.py index b9ac38b9..24c2ed1f 100644 --- a/src/fetchcode/vcs/pip/_internal/operations/install/wheel.py +++ b/src/fetchcode/vcs/pip/_internal/operations/install/wheel.py @@ -4,7 +4,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import collections import compileall diff --git a/src/fetchcode/vcs/pip/_internal/pyproject.py b/src/fetchcode/vcs/pip/_internal/pyproject.py index bf76be2d..8aadc240 100644 --- a/src/fetchcode/vcs/pip/_internal/pyproject.py +++ b/src/fetchcode/vcs/pip/_internal/pyproject.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import io import os diff --git a/src/fetchcode/vcs/pip/_internal/req/__init__.py b/src/fetchcode/vcs/pip/_internal/req/__init__.py index ceb8f927..1649984f 100644 --- a/src/fetchcode/vcs/pip/_internal/req/__init__.py +++ b/src/fetchcode/vcs/pip/_internal/req/__init__.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import logging diff --git a/src/fetchcode/vcs/pip/_internal/req/req_file.py b/src/fetchcode/vcs/pip/_internal/req/req_file.py index 2fafcff3..8d396642 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_file.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_file.py @@ -5,7 +5,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import optparse import os diff --git a/src/fetchcode/vcs/pip/_internal/req/req_install.py b/src/fetchcode/vcs/pip/_internal/req/req_install.py index 2b4d76de..d5f1728a 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_install.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_install.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/req/req_set.py b/src/fetchcode/vcs/pip/_internal/req/req_set.py index 1e84be3e..3a385566 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_set.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_set.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import logging from collections import OrderedDict diff --git a/src/fetchcode/vcs/pip/_internal/req/req_tracker.py b/src/fetchcode/vcs/pip/_internal/req/req_tracker.py index 83cb32d1..4188492f 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_tracker.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_tracker.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import contextlib import errno diff --git a/src/fetchcode/vcs/pip/_internal/req/req_uninstall.py b/src/fetchcode/vcs/pip/_internal/req/req_uninstall.py index b10dc398..580c81e2 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_uninstall.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_uninstall.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import csv import functools diff --git a/src/fetchcode/vcs/pip/_internal/self_outdated_check.py b/src/fetchcode/vcs/pip/_internal/self_outdated_check.py index fc15eeea..a4989dac 100644 --- a/src/fetchcode/vcs/pip/_internal/self_outdated_check.py +++ b/src/fetchcode/vcs/pip/_internal/self_outdated_check.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import datetime import hashlib diff --git a/src/fetchcode/vcs/pip/_internal/utils/appdirs.py b/src/fetchcode/vcs/pip/_internal/utils/appdirs.py index 9b3bb4ea..60f59604 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/appdirs.py +++ b/src/fetchcode/vcs/pip/_internal/utils/appdirs.py @@ -6,7 +6,6 @@ and eventually drop this after all usages are changed. """ -from __future__ import absolute_import import os diff --git a/src/fetchcode/vcs/pip/_internal/utils/compat.py b/src/fetchcode/vcs/pip/_internal/utils/compat.py index b8e234c4..30f6a62d 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/compat.py +++ b/src/fetchcode/vcs/pip/_internal/utils/compat.py @@ -4,7 +4,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import, division import codecs import locale diff --git a/src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py b/src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py index 4fb79742..44b707c3 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py +++ b/src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py @@ -1,7 +1,6 @@ """Generate and work with PEP 425 Compatibility Tags. """ -from __future__ import absolute_import import logging import re diff --git a/src/fetchcode/vcs/pip/_internal/utils/deprecation.py b/src/fetchcode/vcs/pip/_internal/utils/deprecation.py index 399ef02a..4567bcdc 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/deprecation.py +++ b/src/fetchcode/vcs/pip/_internal/utils/deprecation.py @@ -5,7 +5,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import warnings diff --git a/src/fetchcode/vcs/pip/_internal/utils/glibc.py b/src/fetchcode/vcs/pip/_internal/utils/glibc.py index 2bccd69a..866328fa 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/glibc.py +++ b/src/fetchcode/vcs/pip/_internal/utils/glibc.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import os import sys diff --git a/src/fetchcode/vcs/pip/_internal/utils/hashes.py b/src/fetchcode/vcs/pip/_internal/utils/hashes.py index d7995948..bf859e9b 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/hashes.py +++ b/src/fetchcode/vcs/pip/_internal/utils/hashes.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import hashlib diff --git a/src/fetchcode/vcs/pip/_internal/utils/logging.py b/src/fetchcode/vcs/pip/_internal/utils/logging.py index 3926bdf7..a450c220 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/logging.py +++ b/src/fetchcode/vcs/pip/_internal/utils/logging.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import contextlib import errno diff --git a/src/fetchcode/vcs/pip/_internal/utils/misc.py b/src/fetchcode/vcs/pip/_internal/utils/misc.py index 142632e0..f2038555 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/misc.py +++ b/src/fetchcode/vcs/pip/_internal/utils/misc.py @@ -2,7 +2,6 @@ # mypy: strict-optional=False # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import contextlib import errno diff --git a/src/fetchcode/vcs/pip/_internal/utils/packaging.py b/src/fetchcode/vcs/pip/_internal/utils/packaging.py index 41681f44..0a74af0a 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/packaging.py +++ b/src/fetchcode/vcs/pip/_internal/utils/packaging.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import logging from email.parser import FeedParser diff --git a/src/fetchcode/vcs/pip/_internal/utils/subprocess.py b/src/fetchcode/vcs/pip/_internal/utils/subprocess.py index 32cf4e8f..4850576b 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/subprocess.py +++ b/src/fetchcode/vcs/pip/_internal/utils/subprocess.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: strict-optional=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/utils/temp_dir.py b/src/fetchcode/vcs/pip/_internal/utils/temp_dir.py index beca877d..42abdefa 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/temp_dir.py +++ b/src/fetchcode/vcs/pip/_internal/utils/temp_dir.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import errno import itertools diff --git a/src/fetchcode/vcs/pip/_internal/utils/unpacking.py b/src/fetchcode/vcs/pip/_internal/utils/unpacking.py index 0452bbbc..3794e0f2 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/unpacking.py +++ b/src/fetchcode/vcs/pip/_internal/utils/unpacking.py @@ -5,7 +5,6 @@ # mypy: strict-optional=False # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/utils/virtualenv.py b/src/fetchcode/vcs/pip/_internal/utils/virtualenv.py index 95a37514..e819329f 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/virtualenv.py +++ b/src/fetchcode/vcs/pip/_internal/utils/virtualenv.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/utils/wheel.py b/src/fetchcode/vcs/pip/_internal/utils/wheel.py index ad7df75b..3544c6a9 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/wheel.py +++ b/src/fetchcode/vcs/pip/_internal/utils/wheel.py @@ -1,7 +1,6 @@ """Support functions for working with wheel files. """ -from __future__ import absolute_import import logging from email.parser import Parser diff --git a/src/fetchcode/vcs/pip/_internal/vcs/bazaar.py b/src/fetchcode/vcs/pip/_internal/vcs/bazaar.py index 28686245..bd761bc7 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/bazaar.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/bazaar.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/vcs/git.py b/src/fetchcode/vcs/pip/_internal/vcs/git.py index 9f8ce125..ed3228e4 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/git.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/git.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import os.path diff --git a/src/fetchcode/vcs/pip/_internal/vcs/mercurial.py b/src/fetchcode/vcs/pip/_internal/vcs/mercurial.py index e41f2155..cff64fa3 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/mercurial.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/mercurial.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/vcs/subversion.py b/src/fetchcode/vcs/pip/_internal/vcs/subversion.py index e6eabbd0..50169616 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/subversion.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/subversion.py @@ -1,7 +1,6 @@ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False -from __future__ import absolute_import import logging import os diff --git a/src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py b/src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py index ee93b49a..09474710 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py @@ -1,6 +1,5 @@ """Handles all VCS (version control) support""" -from __future__ import absolute_import import errno import logging diff --git a/src/fetchcode/vcs/pip/_vendor/__init__.py b/src/fetchcode/vcs/pip/_vendor/__init__.py index 8a3471b6..1ae96108 100644 --- a/src/fetchcode/vcs/pip/_vendor/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/__init__.py @@ -5,7 +5,6 @@ Files inside of pip._vendor should be considered immutable and should only be updated to versions from upstream. """ -from __future__ import absolute_import import glob import os.path diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/redis_cache.py b/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/redis_cache.py index 60b13244..eedf9fcd 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/redis_cache.py +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/redis_cache.py @@ -1,4 +1,3 @@ -from __future__ import division from datetime import datetime from fetchcode.vcs.pip._vendor.cachecontrol.cache import BaseCache diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py b/src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py index 1679e38f..23ea2f49 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py @@ -13,7 +13,6 @@ """ -from __future__ import absolute_import, print_function, unicode_literals import argparse import sys diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py index d66d8566..7d4223f8 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py @@ -25,7 +25,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # -from __future__ import print_function """Read from and write to tar format archives. """ diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/compat.py b/src/fetchcode/vcs/pip/_vendor/distlib/compat.py index ff328c8e..085b8255 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/compat.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/compat.py @@ -4,7 +4,6 @@ # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # -from __future__ import absolute_import import os import re diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/database.py b/src/fetchcode/vcs/pip/_vendor/distlib/database.py index c16c0c8d..1b23f648 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/database.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/database.py @@ -5,7 +5,6 @@ # """PEP 376 implementation.""" -from __future__ import unicode_literals import base64 import codecs diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/metadata.py b/src/fetchcode/vcs/pip/_vendor/distlib/metadata.py index 2d61378e..1061c32d 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/metadata.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/metadata.py @@ -7,7 +7,6 @@ Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental). """ -from __future__ import unicode_literals import codecs from email import message_from_file diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/resources.py b/src/fetchcode/vcs/pip/_vendor/distlib/resources.py index 18840167..5ced830a 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/resources.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/resources.py @@ -4,7 +4,6 @@ # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # -from __future__ import unicode_literals import bisect import io diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/wheel.py b/src/fetchcode/vcs/pip/_vendor/distlib/wheel.py index bd179383..d966bf3a 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/wheel.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/wheel.py @@ -4,7 +4,6 @@ # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # -from __future__ import unicode_literals import base64 import codecs diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py b/src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py index 315c9dec..f63fe8fc 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py @@ -20,7 +20,6 @@ * :func:`~.serializer.serialize` """ -from __future__ import absolute_import, division, unicode_literals from .html5parser import HTMLParser, parse, parseFragment from .treebuilders import getTreeBuilder diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py index 4c77717b..02753db7 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals import re import warnings diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py index 6ec50d2f..0960243f 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from fetchcode.vcs.pip._vendor.six import text_type, binary_type from fetchcode.vcs.pip._vendor.six.moves import http_client, urllib diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_tokenizer.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_tokenizer.py index 26553180..e5e9d9ce 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_tokenizer.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_tokenizer.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from fetchcode.vcs.pip._vendor.six import unichr as chr diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py index a5ba4bf1..2f709100 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from .py import Trie as PyTrie diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py index 6b71975f..43f682ea 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals try: from collections.abc import Mapping diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py index 0237622b..3912058b 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from datrie import Trie as DATrie from fetchcode.vcs.pip._vendor.six import text_type diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/py.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/py.py index b256949f..8bd10f58 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/py.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/py.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from fetchcode.vcs.pip._vendor.six import text_type from bisect import bisect_left diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py index 46ff3468..b9052ac6 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from types import ModuleType diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/constants.py b/src/fetchcode/vcs/pip/_vendor/html5lib/constants.py index 1ff80419..5f752698 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/constants.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/constants.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals import string diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py index 5ba926e3..c0be95b2 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from . import base diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py index c7dbaed0..acd8d5c3 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals class Filter(object): diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py index aefb5c84..c8dc57b8 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from . import base diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py index 11947354..acf4bc0a 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from fetchcode.vcs.pip._vendor.six import text_type diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py index 4a865012..a44b2a00 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from . import base diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py index 4a8bc3c8..6c269e1a 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals import re from xml.sax.saxutils import escape, unescape diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py index 0d12584b..ab40ef5a 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals import re diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py b/src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py index 8f691e58..3f9e02c3 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from fetchcode.vcs.pip._vendor.six import with_metaclass, viewkeys import types diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/serializer.py b/src/fetchcode/vcs/pip/_vendor/html5lib/serializer.py index fa8c4511..94edb63e 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/serializer.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/serializer.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from fetchcode.vcs.pip._vendor.six import text_type import re diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/__init__.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/__init__.py index 90fc40c1..f27f2405 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/__init__.py @@ -16,7 +16,6 @@ genshi_tree = genshi.to_genshi(TreeWalker(tree)) """ -from __future__ import absolute_import, division, unicode_literals from . import sax diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/genshi.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/genshi.py index 61d5fb6a..b0b29ed3 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/genshi.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/genshi.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from genshi.core import QName, Attrs from genshi.core import START, END, TEXT, COMMENT, DOCTYPE diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/sax.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/sax.py index f4ccea5a..ead1a5c4 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/sax.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treeadapters/sax.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from xml.sax.xmlreader import AttributesNSImpl diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/__init__.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/__init__.py index d44447ea..90aad5fb 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/__init__.py @@ -29,7 +29,6 @@ """ -from __future__ import absolute_import, division, unicode_literals from .._utils import default_etree diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/base.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/base.py index 41227413..032f204d 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/base.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/base.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from fetchcode.vcs.pip._vendor.six import text_type from ..constants import scopingElements, tableInsertModeElements, namespaces diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/dom.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/dom.py index d8b53004..32883e22 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/dom.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/dom.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals try: diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree.py index 518d9c50..87beed7a 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals # pylint:disable=protected-access from fetchcode.vcs.pip._vendor.six import text_type diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree_lxml.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree_lxml.py index ca12a99c..ab3e1192 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree_lxml.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treebuilders/etree_lxml.py @@ -9,7 +9,6 @@ When any of these things occur, we emit a DataLossWarning """ -from __future__ import absolute_import, division, unicode_literals # pylint:disable=protected-access import warnings diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/__init__.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/__init__.py index 9bec2076..7c45aac8 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/__init__.py @@ -8,7 +8,6 @@ returning an iterator generating tokens. """ -from __future__ import absolute_import, division, unicode_literals from .. import constants from .._utils import default_etree diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/base.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/base.py index 80c474c4..d249de58 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/base.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/base.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from xml.dom import Node from ..constants import namespaces, voidElements, spaceCharacters diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/dom.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/dom.py index b0c89b00..85e12505 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/dom.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/dom.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from xml.dom import Node diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree.py index a049dcf7..cc1ebc9a 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from collections import OrderedDict import re diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree_lxml.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree_lxml.py index 9fc105cd..0961cfbd 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree_lxml.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/etree_lxml.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from fetchcode.vcs.pip._vendor.six import text_type from lxml import etree diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/genshi.py b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/genshi.py index 7483be27..78f22fd3 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/genshi.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/treewalkers/genshi.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, division, unicode_literals from genshi.core import QName from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT diff --git a/src/fetchcode/vcs/pip/_vendor/ipaddress.py b/src/fetchcode/vcs/pip/_vendor/ipaddress.py index 3e6f9e49..f1ef6f79 100644 --- a/src/fetchcode/vcs/pip/_vendor/ipaddress.py +++ b/src/fetchcode/vcs/pip/_vendor/ipaddress.py @@ -8,7 +8,6 @@ """ -from __future__ import unicode_literals import itertools diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/__about__.py b/src/fetchcode/vcs/pip/_vendor/packaging/__about__.py index 5161d141..7d23f4b0 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/__about__.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/__about__.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function __all__ = [ "__title__", diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/__init__.py b/src/fetchcode/vcs/pip/_vendor/packaging/__init__.py index a0cf67df..3c50c5dc 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/__init__.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function from .__about__ import ( __author__, diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/_compat.py b/src/fetchcode/vcs/pip/_vendor/packaging/_compat.py index a145f7ee..79d76ebe 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/_compat.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/_compat.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function import sys diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/_structures.py b/src/fetchcode/vcs/pip/_vendor/packaging/_structures.py index 800d5c55..65a5e232 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/_structures.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/_structures.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function class InfinityType(object): diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/markers.py b/src/fetchcode/vcs/pip/_vendor/packaging/markers.py index bf1b9124..f6717313 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/markers.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/markers.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function import operator import os diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/requirements.py b/src/fetchcode/vcs/pip/_vendor/packaging/requirements.py index 1d27fcd5..8335a067 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/requirements.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/requirements.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function import string import re diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/specifiers.py b/src/fetchcode/vcs/pip/_vendor/packaging/specifiers.py index 94987486..3e8d3f05 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/specifiers.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/specifiers.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function import abc import functools diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/tags.py b/src/fetchcode/vcs/pip/_vendor/packaging/tags.py index 300faab8..054195fb 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/tags.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/tags.py @@ -2,7 +2,6 @@ # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import import distutils.util diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/utils.py b/src/fetchcode/vcs/pip/_vendor/packaging/utils.py index 44f1bf98..261e1f20 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/utils.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/utils.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function import re diff --git a/src/fetchcode/vcs/pip/_vendor/packaging/version.py b/src/fetchcode/vcs/pip/_vendor/packaging/version.py index f39a2a12..4591c65f 100644 --- a/src/fetchcode/vcs/pip/_vendor/packaging/version.py +++ b/src/fetchcode/vcs/pip/_vendor/packaging/version.py @@ -1,7 +1,6 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -from __future__ import absolute_import, division, print_function import collections import itertools diff --git a/src/fetchcode/vcs/pip/_vendor/pkg_resources/__init__.py b/src/fetchcode/vcs/pip/_vendor/pkg_resources/__init__.py index 59294295..1b63be3d 100644 --- a/src/fetchcode/vcs/pip/_vendor/pkg_resources/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/pkg_resources/__init__.py @@ -15,7 +15,6 @@ method. """ -from __future__ import absolute_import import sys import os diff --git a/src/fetchcode/vcs/pip/_vendor/progress/__init__.py b/src/fetchcode/vcs/pip/_vendor/progress/__init__.py index e434c257..49144a66 100644 --- a/src/fetchcode/vcs/pip/_vendor/progress/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/progress/__init__.py @@ -12,7 +12,6 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -from __future__ import division, print_function from collections import deque from datetime import timedelta diff --git a/src/fetchcode/vcs/pip/_vendor/progress/bar.py b/src/fetchcode/vcs/pip/_vendor/progress/bar.py index 8819efda..42a20c24 100644 --- a/src/fetchcode/vcs/pip/_vendor/progress/bar.py +++ b/src/fetchcode/vcs/pip/_vendor/progress/bar.py @@ -14,7 +14,6 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -from __future__ import unicode_literals import sys diff --git a/src/fetchcode/vcs/pip/_vendor/progress/counter.py b/src/fetchcode/vcs/pip/_vendor/progress/counter.py index d955ca47..6595eae7 100644 --- a/src/fetchcode/vcs/pip/_vendor/progress/counter.py +++ b/src/fetchcode/vcs/pip/_vendor/progress/counter.py @@ -14,7 +14,6 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -from __future__ import unicode_literals from . import Infinite, Progress diff --git a/src/fetchcode/vcs/pip/_vendor/progress/spinner.py b/src/fetchcode/vcs/pip/_vendor/progress/spinner.py index 4e100cab..6c904e60 100644 --- a/src/fetchcode/vcs/pip/_vendor/progress/spinner.py +++ b/src/fetchcode/vcs/pip/_vendor/progress/spinner.py @@ -14,7 +14,6 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -from __future__ import unicode_literals from . import Infinite diff --git a/src/fetchcode/vcs/pip/_vendor/requests/help.py b/src/fetchcode/vcs/pip/_vendor/requests/help.py index 19e9edd4..3f326468 100644 --- a/src/fetchcode/vcs/pip/_vendor/requests/help.py +++ b/src/fetchcode/vcs/pip/_vendor/requests/help.py @@ -1,5 +1,4 @@ """Module containing bug report helper(s).""" -from __future__ import print_function import json import platform diff --git a/src/fetchcode/vcs/pip/_vendor/six.py b/src/fetchcode/vcs/pip/_vendor/six.py index 5fe9f8e1..27673dbf 100644 --- a/src/fetchcode/vcs/pip/_vendor/six.py +++ b/src/fetchcode/vcs/pip/_vendor/six.py @@ -20,7 +20,6 @@ """Utilities for writing code that runs on Python 2 and 3""" -from __future__ import absolute_import import functools import itertools diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/__init__.py b/src/fetchcode/vcs/pip/_vendor/urllib3/__init__.py index 9bd8323f..12213911 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/__init__.py @@ -1,7 +1,6 @@ """ urllib3 - Thread-safe connection pooling and re-using. """ -from __future__ import absolute_import import warnings from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/_collections.py b/src/fetchcode/vcs/pip/_vendor/urllib3/_collections.py index 019d1511..dd8ae253 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/_collections.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/_collections.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import try: from collections.abc import Mapping, MutableMapping diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/connection.py b/src/fetchcode/vcs/pip/_vendor/urllib3/connection.py index 71e6790b..7dea3e01 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/connection.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/connection.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import datetime import logging import os diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/connectionpool.py b/src/fetchcode/vcs/pip/_vendor/urllib3/connectionpool.py index d42eb7be..ab199b97 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/connectionpool.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/connectionpool.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import errno import logging import sys diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/_securetransport/bindings.py b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/_securetransport/bindings.py index d9b67333..4a7ba44e 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/_securetransport/bindings.py @@ -29,7 +29,6 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from __future__ import absolute_import import platform from ctypes.util import find_library diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/appengine.py b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/appengine.py index cbb7b31f..86dce741 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/appengine.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/appengine.py @@ -38,7 +38,6 @@ :class:`PoolManager` without any configuration or special environment variables. """ -from __future__ import absolute_import import io import logging import warnings diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/ntlmpool.py b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/ntlmpool.py index 1fd242a6..b6b56b90 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/ntlmpool.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/ntlmpool.py @@ -3,7 +3,6 @@ Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10 """ -from __future__ import absolute_import from logging import getLogger from ntlm import ntlm diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/pyopenssl.py b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/pyopenssl.py index ac6a4dae..a596e1f1 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/pyopenssl.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/pyopenssl.py @@ -41,7 +41,6 @@ .. _sni: https://en.wikipedia.org/wiki/Server_Name_Indication .. _crime attack: https://en.wikipedia.org/wiki/CRIME_(security_exploit) """ -from __future__ import absolute_import import OpenSSL.SSL from cryptography import x509 diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/securetransport.py b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/securetransport.py index 87d844af..85b0cdd4 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/securetransport.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/securetransport.py @@ -49,7 +49,6 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from __future__ import absolute_import import contextlib import ctypes diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/socks.py b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/socks.py index 9e97f7aa..ffe4a220 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/socks.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/contrib/socks.py @@ -34,7 +34,6 @@ proxy_url="socks5h://:@proxy-host" """ -from __future__ import absolute_import try: import socks diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/exceptions.py b/src/fetchcode/vcs/pip/_vendor/urllib3/exceptions.py index 0a74c79b..a5611109 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/exceptions.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead # Base Exceptions diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/fields.py b/src/fetchcode/vcs/pip/_vendor/urllib3/fields.py index 8715b220..c3a760a2 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/fields.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/fields.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import email.utils import mimetypes import re diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/filepost.py b/src/fetchcode/vcs/pip/_vendor/urllib3/filepost.py index b7b00992..7aef6244 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/filepost.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/filepost.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import binascii import codecs import os diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/packages/__init__.py b/src/fetchcode/vcs/pip/_vendor/urllib3/packages/__init__.py index fce4caa6..4fdb17a0 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/packages/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/packages/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from . import ssl_match_hostname diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/packages/six.py b/src/fetchcode/vcs/pip/_vendor/urllib3/packages/six.py index 31442409..33eb0c71 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/packages/six.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/packages/six.py @@ -20,7 +20,6 @@ """Utilities for writing code that runs on Python 2 and 3""" -from __future__ import absolute_import import functools import itertools diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/poolmanager.py b/src/fetchcode/vcs/pip/_vendor/urllib3/poolmanager.py index 242a2f82..d697aa04 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/poolmanager.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/poolmanager.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import collections import functools import logging diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/request.py b/src/fetchcode/vcs/pip/_vendor/urllib3/request.py index 55f160bb..7f15d528 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/request.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/request.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from .filepost import encode_multipart_formdata from .packages.six.moves.urllib.parse import urlencode diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/response.py b/src/fetchcode/vcs/pip/_vendor/urllib3/response.py index 6090a735..2d63bdd4 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/response.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/response.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from contextlib import contextmanager import zlib import io diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/util/__init__.py b/src/fetchcode/vcs/pip/_vendor/urllib3/util/__init__.py index a96c73a9..b82bddd7 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/util/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/util/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import # For backwards compatibility, provide imports that used to be here. from .connection import is_connection_dropped diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/util/connection.py b/src/fetchcode/vcs/pip/_vendor/urllib3/util/connection.py index 86f0a3b0..71880398 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/util/connection.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/util/connection.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import socket from .wait import NoWayToWaitForSocketError, wait_for_read from ..contrib import _appengine_environ diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/util/request.py b/src/fetchcode/vcs/pip/_vendor/urllib3/util/request.py index 3b7bb54d..7cb48e04 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/util/request.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/util/request.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from base64 import b64encode from ..packages.six import b, integer_types diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/util/response.py b/src/fetchcode/vcs/pip/_vendor/urllib3/util/response.py index 715868dd..cf4e084b 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/util/response.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/util/response.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from ..packages.six.moves import http_client as httplib from ..exceptions import HeaderParsingError diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/util/retry.py b/src/fetchcode/vcs/pip/_vendor/urllib3/util/retry.py index 5a049fe6..b91b0da2 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/util/retry.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/util/retry.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import time import logging from collections import namedtuple diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/util/ssl_.py b/src/fetchcode/vcs/pip/_vendor/urllib3/util/ssl_.py index 6387eb9f..64812ce3 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/util/ssl_.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/util/ssl_.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import errno import warnings import hmac diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/util/timeout.py b/src/fetchcode/vcs/pip/_vendor/urllib3/util/timeout.py index 98837005..f65436d3 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/util/timeout.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/util/timeout.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import # The default socket timeout, used by httplib to indicate that no timeout was # specified by the user diff --git a/src/fetchcode/vcs/pip/_vendor/urllib3/util/url.py b/src/fetchcode/vcs/pip/_vendor/urllib3/util/url.py index a040a984..83699f01 100644 --- a/src/fetchcode/vcs/pip/_vendor/urllib3/util/url.py +++ b/src/fetchcode/vcs/pip/_vendor/urllib3/util/url.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import re from collections import namedtuple diff --git a/src/fetchcode/vcs/pip/_vendor/webencodings/__init__.py b/src/fetchcode/vcs/pip/_vendor/webencodings/__init__.py index d21d697c..706cb39e 100644 --- a/src/fetchcode/vcs/pip/_vendor/webencodings/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/webencodings/__init__.py @@ -12,7 +12,6 @@ """ -from __future__ import unicode_literals import codecs diff --git a/src/fetchcode/vcs/pip/_vendor/webencodings/tests.py b/src/fetchcode/vcs/pip/_vendor/webencodings/tests.py index e12c10d0..8049e796 100644 --- a/src/fetchcode/vcs/pip/_vendor/webencodings/tests.py +++ b/src/fetchcode/vcs/pip/_vendor/webencodings/tests.py @@ -11,7 +11,6 @@ """ -from __future__ import unicode_literals from . import (lookup, LABELS, decode, encode, iter_decode, iter_encode, IncrementalDecoder, IncrementalEncoder, UTF8) diff --git a/src/fetchcode/vcs/pip/_vendor/webencodings/x_user_defined.py b/src/fetchcode/vcs/pip/_vendor/webencodings/x_user_defined.py index d16e3260..82d0ccd7 100644 --- a/src/fetchcode/vcs/pip/_vendor/webencodings/x_user_defined.py +++ b/src/fetchcode/vcs/pip/_vendor/webencodings/x_user_defined.py @@ -11,7 +11,6 @@ """ -from __future__ import unicode_literals import codecs From ca2744370dcb76547031cfd18bc8a416e65d9660 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Tue, 3 Jan 2023 14:05:47 +0530 Subject: [PATCH 2/2] Reformatted files in src using black. Signed-off-by: Jay --- src/fetchcode/__init__.py | 18 +- src/fetchcode/commoncode_datautils.py | 126 +- src/fetchcode/packagedcode_models.py | 542 +- src/fetchcode/vcs/pip/__main__.py | 7 +- src/fetchcode/vcs/pip/_internal/build_env.py | 112 +- src/fetchcode/vcs/pip/_internal/cache.py | 69 +- .../vcs/pip/_internal/cli/autocompletion.py | 58 +- .../vcs/pip/_internal/cli/base_command.py | 56 +- .../vcs/pip/_internal/cli/cmdoptions.py | 621 +- .../vcs/pip/_internal/cli/command_context.py | 2 +- src/fetchcode/vcs/pip/_internal/cli/main.py | 3 +- .../vcs/pip/_internal/cli/main_parser.py | 23 +- src/fetchcode/vcs/pip/_internal/cli/parser.py | 72 +- .../vcs/pip/_internal/cli/progress_bars.py | 69 +- .../vcs/pip/_internal/cli/req_command.py | 104 +- .../vcs/pip/_internal/cli/spinners.py | 15 +- .../vcs/pip/_internal/cli/status_codes.py | 1 - .../vcs/pip/_internal/commands/__init__.py | 188 +- .../vcs/pip/_internal/commands/cache.py | 62 +- .../vcs/pip/_internal/commands/check.py | 10 +- .../vcs/pip/_internal/commands/completion.py | 49 +- .../pip/_internal/commands/configuration.py | 67 +- .../vcs/pip/_internal/commands/debug.py | 100 +- .../vcs/pip/_internal/commands/download.py | 34 +- .../vcs/pip/_internal/commands/freeze.py | 72 +- .../vcs/pip/_internal/commands/hash.py | 22 +- .../vcs/pip/_internal/commands/help.py | 6 +- .../vcs/pip/_internal/commands/install.py | 258 +- .../vcs/pip/_internal/commands/list.py | 140 +- .../vcs/pip/_internal/commands/search.py | 73 +- .../vcs/pip/_internal/commands/show.py | 114 +- .../vcs/pip/_internal/commands/uninstall.py | 43 +- .../vcs/pip/_internal/commands/wheel.py | 63 +- .../vcs/pip/_internal/configuration.py | 77 +- .../pip/_internal/distributions/__init__.py | 3 +- .../vcs/pip/_internal/distributions/sdist.py | 21 +- src/fetchcode/vcs/pip/_internal/exceptions.py | 101 +- .../vcs/pip/_internal/index/collector.py | 132 +- .../vcs/pip/_internal/index/package_finder.py | 248 +- src/fetchcode/vcs/pip/_internal/locations.py | 49 +- .../vcs/pip/_internal/models/candidate.py | 15 +- .../vcs/pip/_internal/models/direct_url.py | 15 +- .../pip/_internal/models/format_control.py | 37 +- .../vcs/pip/_internal/models/index.py | 13 +- .../vcs/pip/_internal/models/link.py | 41 +- .../vcs/pip/_internal/models/scheme.py | 1 + .../vcs/pip/_internal/models/search_scope.py | 33 +- .../pip/_internal/models/selection_prefs.py | 4 +- .../vcs/pip/_internal/models/target_python.py | 17 +- .../vcs/pip/_internal/models/wheel.py | 17 +- .../vcs/pip/_internal/network/auth.py | 25 +- .../vcs/pip/_internal/network/cache.py | 2 +- .../vcs/pip/_internal/network/download.py | 20 +- .../vcs/pip/_internal/network/session.py | 111 +- .../vcs/pip/_internal/network/utils.py | 3 +- .../vcs/pip/_internal/network/xmlrpc.py | 11 +- .../vcs/pip/_internal/operations/check.py | 17 +- .../vcs/pip/_internal/operations/freeze.py | 125 +- .../operations/install/editable_legacy.py | 6 +- .../_internal/operations/install/legacy.py | 24 +- .../pip/_internal/operations/install/wheel.py | 136 +- .../vcs/pip/_internal/operations/prepare.py | 147 +- src/fetchcode/vcs/pip/_internal/pyproject.py | 46 +- .../vcs/pip/_internal/req/__init__.py | 29 +- .../vcs/pip/_internal/req/constructors.py | 131 +- .../vcs/pip/_internal/req/req_file.py | 101 +- .../vcs/pip/_internal/req/req_install.py | 226 +- .../vcs/pip/_internal/req/req_set.py | 60 +- .../vcs/pip/_internal/req/req_tracker.py | 24 +- .../vcs/pip/_internal/req/req_uninstall.py | 218 +- .../vcs/pip/_internal/resolution/base.py | 4 +- .../_internal/resolution/legacy/resolver.py | 79 +- .../resolution/resolvelib/candidates.py | 56 +- .../resolution/resolvelib/factory.py | 36 +- .../resolution/resolvelib/provider.py | 2 +- .../resolution/resolvelib/requirements.py | 12 +- .../resolution/resolvelib/resolver.py | 19 +- .../vcs/pip/_internal/self_outdated_check.py | 20 +- .../vcs/pip/_internal/utils/appdirs.py | 4 +- .../vcs/pip/_internal/utils/compat.py | 58 +- .../pip/_internal/utils/compatibility_tags.py | 28 +- .../vcs/pip/_internal/utils/deprecation.py | 25 +- .../pip/_internal/utils/direct_url_helpers.py | 10 +- .../vcs/pip/_internal/utils/encoding.py | 24 +- .../vcs/pip/_internal/utils/filesystem.py | 20 +- .../vcs/pip/_internal/utils/filetypes.py | 21 +- .../vcs/pip/_internal/utils/hashes.py | 20 +- .../_internal/utils/inject_securetransport.py | 2 +- .../vcs/pip/_internal/utils/logging.py | 186 +- src/fetchcode/vcs/pip/_internal/utils/misc.py | 228 +- .../vcs/pip/_internal/utils/models.py | 3 +- .../vcs/pip/_internal/utils/packaging.py | 24 +- .../vcs/pip/_internal/utils/pkg_resources.py | 4 +- .../pip/_internal/utils/setuptools_build.py | 18 +- .../vcs/pip/_internal/utils/subprocess.py | 80 +- .../vcs/pip/_internal/utils/temp_dir.py | 39 +- .../vcs/pip/_internal/utils/unpacking.py | 112 +- src/fetchcode/vcs/pip/_internal/utils/urls.py | 25 +- .../vcs/pip/_internal/utils/virtualenv.py | 16 +- .../vcs/pip/_internal/utils/wheel.py | 35 +- src/fetchcode/vcs/pip/_internal/vcs/bazaar.py | 46 +- src/fetchcode/vcs/pip/_internal/vcs/git.py | 161 +- .../vcs/pip/_internal/vcs/mercurial.py | 65 +- .../vcs/pip/_internal/vcs/subversion.py | 97 +- .../vcs/pip/_internal/vcs/versioncontrol.py | 125 +- .../vcs/pip/_internal/wheel_builder.py | 82 +- src/fetchcode/vcs/pip/_vendor/__init__.py | 3 +- src/fetchcode/vcs/pip/_vendor/appdirs.py | 143 +- .../vcs/pip/_vendor/cachecontrol.pyi | 2 +- .../vcs/pip/_vendor/cachecontrol/cache.py | 2 - .../_vendor/cachecontrol/caches/file_cache.py | 1 - .../cachecontrol/caches/redis_cache.py | 2 - .../vcs/pip/_vendor/cachecontrol/compat.py | 4 +- .../pip/_vendor/cachecontrol/controller.py | 5 +- .../pip/_vendor/cachecontrol/heuristics.py | 14 +- .../vcs/pip/_vendor/cachecontrol/serialize.py | 25 +- src/fetchcode/vcs/pip/_vendor/certifi.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/chardet.pyi | 2 +- .../vcs/pip/_vendor/chardet/__init__.py | 6 +- .../vcs/pip/_vendor/chardet/big5freq.py | 5715 +++++- .../pip/_vendor/chardet/chardistribution.py | 42 +- .../pip/_vendor/chardet/charsetgroupprober.py | 6 +- .../vcs/pip/_vendor/chardet/charsetprober.py | 19 +- .../vcs/pip/_vendor/chardet/cli/chardetect.py | 47 +- .../pip/_vendor/chardet/codingstatemachine.py | 14 +- .../vcs/pip/_vendor/chardet/enums.py | 6 + .../vcs/pip/_vendor/chardet/escprober.py | 8 +- .../vcs/pip/_vendor/chardet/escsm.py | 1462 +- .../vcs/pip/_vendor/chardet/eucjpprober.py | 19 +- .../vcs/pip/_vendor/chardet/euckrfreq.py | 2500 ++- .../vcs/pip/_vendor/chardet/euctwfreq.py | 5713 +++++- .../vcs/pip/_vendor/chardet/euctwprober.py | 1 + .../vcs/pip/_vendor/chardet/gb2312freq.py | 3996 +++- .../vcs/pip/_vendor/chardet/gb2312prober.py | 1 + .../vcs/pip/_vendor/chardet/hebrewprober.py | 60 +- .../vcs/pip/_vendor/chardet/jisfreq.py | 4643 ++++- .../vcs/pip/_vendor/chardet/jpcntx.py | 7145 ++++++- .../pip/_vendor/chardet/langbulgarianmodel.py | 4792 ++++- .../pip/_vendor/chardet/langcyrillicmodel.py | 5928 +++++- .../vcs/pip/_vendor/chardet/langgreekmodel.py | 4792 ++++- .../pip/_vendor/chardet/langhebrewmodel.py | 4508 ++++- .../pip/_vendor/chardet/langhungarianmodel.py | 4792 ++++- .../vcs/pip/_vendor/chardet/langthaimodel.py | 4508 ++++- .../pip/_vendor/chardet/langturkishmodel.py | 4508 ++++- .../vcs/pip/_vendor/chardet/latin1prober.py | 368 +- .../pip/_vendor/chardet/mbcharsetprober.py | 16 +- .../pip/_vendor/chardet/mbcsgroupprober.py | 2 +- .../vcs/pip/_vendor/chardet/mbcssm.py | 3659 +++- .../pip/_vendor/chardet/sbcharsetprober.py | 36 +- .../pip/_vendor/chardet/sbcsgroupprober.py | 27 +- .../vcs/pip/_vendor/chardet/sjisprober.py | 26 +- .../pip/_vendor/chardet/universaldetector.py | 139 +- .../vcs/pip/_vendor/chardet/utf8prober.py | 3 +- .../vcs/pip/_vendor/chardet/version.py | 2 +- src/fetchcode/vcs/pip/_vendor/colorama.pyi | 2 +- .../vcs/pip/_vendor/colorama/__init__.py | 2 +- .../vcs/pip/_vendor/colorama/ansi.py | 114 +- .../vcs/pip/_vendor/colorama/ansitowin32.py | 83 +- .../vcs/pip/_vendor/colorama/initialise.py | 17 +- .../vcs/pip/_vendor/colorama/win32.py | 44 +- .../vcs/pip/_vendor/colorama/winterm.py | 39 +- src/fetchcode/vcs/pip/_vendor/contextlib2.py | 56 +- src/fetchcode/vcs/pip/_vendor/distlib.pyi | 2 +- .../vcs/pip/_vendor/distlib/__init__.py | 19 +- .../vcs/pip/_vendor/distlib/_backport/misc.py | 9 +- .../pip/_vendor/distlib/_backport/shutil.py | 246 +- .../_vendor/distlib/_backport/sysconfig.py | 318 +- .../pip/_vendor/distlib/_backport/tarfile.py | 1077 +- .../vcs/pip/_vendor/distlib/compat.py | 450 +- .../vcs/pip/_vendor/distlib/database.py | 437 +- .../vcs/pip/_vendor/distlib/index.py | 252 +- .../vcs/pip/_vendor/distlib/locators.py | 529 +- .../vcs/pip/_vendor/distlib/manifest.py | 158 +- .../vcs/pip/_vendor/distlib/markers.py | 89 +- .../vcs/pip/_vendor/distlib/metadata.py | 814 +- .../vcs/pip/_vendor/distlib/resources.py | 75 +- .../vcs/pip/_vendor/distlib/scripts.py | 229 +- src/fetchcode/vcs/pip/_vendor/distlib/util.py | 729 +- .../vcs/pip/_vendor/distlib/version.py | 292 +- .../vcs/pip/_vendor/distlib/wheel.py | 572 +- src/fetchcode/vcs/pip/_vendor/distro.py | 293 +- src/fetchcode/vcs/pip/_vendor/distro.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/html5lib.pyi | 2 +- .../vcs/pip/_vendor/html5lib/__init__.py | 10 +- .../vcs/pip/_vendor/html5lib/_ihatexml.py | 58 +- .../vcs/pip/_vendor/html5lib/_inputstream.py | 190 +- .../vcs/pip/_vendor/html5lib/_tokenizer.py | 1160 +- .../pip/_vendor/html5lib/_trie/__init__.py | 1 - .../vcs/pip/_vendor/html5lib/_trie/_base.py | 1 - .../vcs/pip/_vendor/html5lib/_trie/datrie.py | 1 - .../vcs/pip/_vendor/html5lib/_utils.py | 27 +- .../vcs/pip/_vendor/html5lib/constants.py | 883 +- .../filters/alphabeticalattributes.py | 7 +- .../vcs/pip/_vendor/html5lib/filters/base.py | 2 - .../html5lib/filters/inject_meta_charset.py | 34 +- .../vcs/pip/_vendor/html5lib/filters/lint.py | 15 +- .../_vendor/html5lib/filters/optionaltags.py | 102 +- .../pip/_vendor/html5lib/filters/sanitizer.py | 1497 +- .../_vendor/html5lib/filters/whitespace.py | 10 +- .../vcs/pip/_vendor/html5lib/html5parser.py | 1694 +- .../vcs/pip/_vendor/html5lib/serializer.py | 86 +- .../_vendor/html5lib/treeadapters/genshi.py | 16 +- .../pip/_vendor/html5lib/treeadapters/sax.py | 16 +- .../_vendor/html5lib/treebuilders/__init__.py | 4 + .../pip/_vendor/html5lib/treebuilders/base.py | 67 +- .../pip/_vendor/html5lib/treebuilders/dom.py | 51 +- .../_vendor/html5lib/treebuilders/etree.py | 49 +- .../html5lib/treebuilders/etree_lxml.py | 83 +- .../_vendor/html5lib/treewalkers/__init__.py | 42 +- .../pip/_vendor/html5lib/treewalkers/base.py | 55 +- .../pip/_vendor/html5lib/treewalkers/dom.py | 10 +- .../pip/_vendor/html5lib/treewalkers/etree.py | 16 +- .../html5lib/treewalkers/etree_lxml.py | 37 +- .../_vendor/html5lib/treewalkers/genshi.py | 21 +- src/fetchcode/vcs/pip/_vendor/idna.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/idna/codec.py | 48 +- src/fetchcode/vcs/pip/_vendor/idna/compat.py | 4 +- src/fetchcode/vcs/pip/_vendor/idna/core.py | 261 +- .../vcs/pip/_vendor/idna/idnadata.py | 3188 ++-- .../vcs/pip/_vendor/idna/intranges.py | 11 +- .../vcs/pip/_vendor/idna/package_data.py | 3 +- .../vcs/pip/_vendor/idna/uts46data.py | 15898 ++++++++-------- src/fetchcode/vcs/pip/_vendor/ipaddress.py | 572 +- src/fetchcode/vcs/pip/_vendor/ipaddress.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/msgpack.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/msgpack/ext.py | 8 +- .../vcs/pip/_vendor/msgpack/fallback.py | 18 +- src/fetchcode/vcs/pip/_vendor/packaging.pyi | 2 +- .../vcs/pip/_vendor/packaging/markers.py | 7 +- .../vcs/pip/_vendor/packaging/requirements.py | 15 +- .../vcs/pip/_vendor/packaging/specifiers.py | 2 +- .../vcs/pip/_vendor/packaging/tags.py | 4 +- src/fetchcode/vcs/pip/_vendor/pep517.pyi | 2 +- .../vcs/pip/_vendor/pep517/__init__.py | 2 +- .../vcs/pip/_vendor/pep517/_in_process.py | 100 +- src/fetchcode/vcs/pip/_vendor/pep517/build.py | 60 +- src/fetchcode/vcs/pip/_vendor/pep517/check.py | 85 +- .../vcs/pip/_vendor/pep517/colorlog.py | 25 +- .../vcs/pip/_vendor/pep517/compat.py | 10 +- .../vcs/pip/_vendor/pep517/dirtools.py | 4 +- .../vcs/pip/_vendor/pep517/envbuild.py | 78 +- src/fetchcode/vcs/pip/_vendor/pep517/meta.py | 21 +- .../vcs/pip/_vendor/pep517/wrappers.py | 113 +- .../vcs/pip/_vendor/pkg_resources.pyi | 2 +- .../vcs/pip/_vendor/pkg_resources/__init__.py | 640 +- .../pip/_vendor/pkg_resources/py31compat.py | 5 +- src/fetchcode/vcs/pip/_vendor/progress.pyi | 2 +- .../vcs/pip/_vendor/progress/__init__.py | 30 +- src/fetchcode/vcs/pip/_vendor/progress/bar.py | 52 +- .../vcs/pip/_vendor/progress/counter.py | 4 +- .../vcs/pip/_vendor/progress/spinner.py | 10 +- src/fetchcode/vcs/pip/_vendor/pyparsing.py | 2205 ++- src/fetchcode/vcs/pip/_vendor/pyparsing.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/requests.pyi | 2 +- .../vcs/pip/_vendor/requests/__init__.py | 43 +- .../vcs/pip/_vendor/requests/__version__.py | 18 +- .../pip/_vendor/requests/_internal_utils.py | 4 +- .../vcs/pip/_vendor/requests/adapters.py | 162 +- src/fetchcode/vcs/pip/_vendor/requests/api.py | 20 +- .../vcs/pip/_vendor/requests/auth.py | 134 +- .../vcs/pip/_vendor/requests/certs.py | 2 +- .../vcs/pip/_vendor/requests/compat.py | 40 +- .../vcs/pip/_vendor/requests/cookies.py | 135 +- .../vcs/pip/_vendor/requests/exceptions.py | 11 +- .../vcs/pip/_vendor/requests/help.py | 80 +- .../vcs/pip/_vendor/requests/hooks.py | 5 +- .../vcs/pip/_vendor/requests/models.py | 291 +- .../vcs/pip/_vendor/requests/packages.py | 10 +- .../vcs/pip/_vendor/requests/sessions.py | 221 +- .../vcs/pip/_vendor/requests/status_codes.py | 167 +- .../vcs/pip/_vendor/requests/structures.py | 8 +- .../vcs/pip/_vendor/requests/utils.py | 300 +- src/fetchcode/vcs/pip/_vendor/resolvelib.pyi | 2 +- .../vcs/pip/_vendor/resolvelib/providers.py | 6 +- .../vcs/pip/_vendor/resolvelib/reporters.py | 18 +- .../vcs/pip/_vendor/resolvelib/resolvers.py | 27 +- .../vcs/pip/_vendor/resolvelib/structs.py | 12 +- src/fetchcode/vcs/pip/_vendor/retrying.py | 84 +- src/fetchcode/vcs/pip/_vendor/retrying.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/six.py | 230 +- .../vcs/pip/_vendor/six/__init__.pyi | 2 +- .../vcs/pip/_vendor/six/moves/__init__.pyi | 2 +- .../pip/_vendor/six/moves/configparser.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/toml.py | 426 +- src/fetchcode/vcs/pip/_vendor/toml.pyi | 2 +- src/fetchcode/vcs/pip/_vendor/toml/decoder.py | 462 +- src/fetchcode/vcs/pip/_vendor/toml/encoder.py | 46 +- src/fetchcode/vcs/pip/_vendor/toml/ordered.py | 2 - src/fetchcode/vcs/pip/_vendor/toml/tz.py | 2 +- src/fetchcode/vcs/pip/_vendor/urllib3.pyi | 2 +- .../vcs/pip/_vendor/urllib3/_collections.py | 3 +- .../vcs/pip/_vendor/urllib3/connection.py | 2 +- .../vcs/pip/_vendor/urllib3/connectionpool.py | 2 +- .../contrib/_securetransport/low_level.py | 4 +- .../pip/_vendor/urllib3/contrib/pyopenssl.py | 3 +- .../urllib3/contrib/securetransport.py | 1 - .../vcs/pip/_vendor/urllib3/exceptions.py | 4 +- .../vcs/pip/_vendor/urllib3/fields.py | 30 +- .../pip/_vendor/urllib3/packages/__init__.py | 1 - .../vcs/pip/_vendor/urllib3/packages/six.py | 2 - .../vcs/pip/_vendor/urllib3/request.py | 1 - .../vcs/pip/_vendor/urllib3/response.py | 2 +- .../vcs/pip/_vendor/urllib3/util/__init__.py | 1 - .../pip/_vendor/urllib3/util/connection.py | 2 +- .../vcs/pip/_vendor/urllib3/util/retry.py | 22 +- .../vcs/pip/_vendor/urllib3/util/timeout.py | 17 +- .../vcs/pip/_vendor/urllib3/util/url.py | 16 +- .../vcs/pip/_vendor/urllib3/util/wait.py | 5 +- .../vcs/pip/_vendor/webencodings.pyi | 2 +- .../vcs/pip/_vendor/webencodings/__init__.py | 60 +- .../vcs/pip/_vendor/webencodings/labels.py | 428 +- .../vcs/pip/_vendor/webencodings/mklabels.py | 30 +- .../vcs/pip/_vendor/webencodings/tests.py | 220 +- .../_vendor/webencodings/x_user_defined.py | 516 +- 314 files changed, 92248 insertions(+), 25788 deletions(-) diff --git a/src/fetchcode/__init__.py b/src/fetchcode/__init__.py index c573991f..d2e301cb 100644 --- a/src/fetchcode/__init__.py +++ b/src/fetchcode/__init__.py @@ -41,14 +41,14 @@ def __init__(self, location, content_type, size, url): def fetch_http(url, location): """ Return a `Response` object built from fetching the content at a HTTP/HTTPS based `url` URL string - saving the content in a file at `location` + saving the content in a file at `location` """ r = requests.get(url) - with open(location, 'wb') as f: + with open(location, "wb") as f: f.write(r.content) - content_type = r.headers.get('content-type') - size = r.headers.get('content-length') + content_type = r.headers.get("content-type") + size = r.headers.get("content-length") size = int(size) if size else None resp = Response(location=location, content_type=content_type, size=size, url=url) @@ -59,7 +59,7 @@ def fetch_http(url, location): def fetch_ftp(url, location): """ Return a `Response` object built from fetching the content at a FTP based `url` URL string - saving the content in a file at `location` + saving the content in a file at `location` """ url_parts = urlparse(url) @@ -79,8 +79,8 @@ def fetch_ftp(url, location): content_type = None ftp.cwd(dir) - file = 'RETR {}'.format(file) - with open(location, 'wb') as f: + file = "RETR {}".format(file) + with open(location, "wb") as f: ftp.retrbinary(file, f.write) ftp.close() @@ -99,9 +99,9 @@ def fetch(url): url_parts = urlparse(url) scheme = url_parts.scheme - fetchers = {'ftp': fetch_ftp, 'http': fetch_http, 'https': fetch_http} + fetchers = {"ftp": fetch_ftp, "http": fetch_http, "https": fetch_http} if scheme in fetchers: return fetchers.get(scheme)(url, location) - raise Exception('Not a supported/known scheme.') + raise Exception("Not a supported/known scheme.") diff --git a/src/fetchcode/commoncode_datautils.py b/src/fetchcode/commoncode_datautils.py index 82650ab1..993567c2 100644 --- a/src/fetchcode/commoncode_datautils.py +++ b/src/fetchcode/commoncode_datautils.py @@ -36,14 +36,23 @@ """ -HELP_METADATA = '__field_help' -LABEL_METADATA = '__field_label' +HELP_METADATA = "__field_help" +LABEL_METADATA = "__field_label" -def attribute(default=attr.NOTHING, validator=None, - repr=False, eq=True, order=True, # NOQA - init=True, type=None, converter=None, # NOQA - help=None, label=None, metadata=None,): # NOQA +def attribute( + default=attr.NOTHING, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + init=True, + type=None, + converter=None, # NOQA + help=None, + label=None, + metadata=None, +): # NOQA """ A generic attribute with help metadata and that is not included in the representation by default. @@ -64,12 +73,20 @@ def attribute(default=attr.NOTHING, validator=None, init=init, metadata=metadata, type=type, - converter=converter + converter=converter, ) -def Boolean(default=False, validator=None, repr=False, eq=True, order=True, # NOQA - converter=None, label=None, help=None,): # NOQA +def Boolean( + default=False, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + converter=None, + label=None, + help=None, +): # NOQA """ A boolean attribute. """ @@ -87,8 +104,16 @@ def Boolean(default=False, validator=None, repr=False, eq=True, order=True, # N ) -def TriBoolean(default=None, validator=None, repr=False, eq=True, order=True, # NOQA - converter=None, label=None, help=None,): # NOQA +def TriBoolean( + default=None, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + converter=None, + label=None, + help=None, +): # NOQA """ A tri-boolean attribute with possible values of None, True and False. """ @@ -106,8 +131,16 @@ def TriBoolean(default=None, validator=None, repr=False, eq=True, order=True, # ) -def String(default=None, validator=None, repr=False, eq=True, order=True, # NOQA - converter=None, label=None, help=None,): # NOQA +def String( + default=None, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + converter=None, + label=None, + help=None, +): # NOQA """ A string attribute. """ @@ -125,8 +158,16 @@ def String(default=None, validator=None, repr=False, eq=True, order=True, # NOQ ) -def Integer(default=0, validator=None, repr=False, eq=True, order=True, # NOQA - converter=None, label=None, help=None,): # NOQA +def Integer( + default=0, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + converter=None, + label=None, + help=None, +): # NOQA """ An integer attribute. """ @@ -145,8 +186,16 @@ def Integer(default=0, validator=None, repr=False, eq=True, order=True, # NOQA ) -def Float(default=0.0, validator=None, repr=False, eq=True, order=True, # NOQA - converter=None, label=None, help=None,): # NOQA +def Float( + default=0.0, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + converter=None, + label=None, + help=None, +): # NOQA """ A float attribute. """ @@ -164,9 +213,17 @@ def Float(default=0.0, validator=None, repr=False, eq=True, order=True, # NOQA ) -def List(item_type=typing.Any, default=attr.NOTHING, validator=None, - repr=False, eq=True, order=True, # NOQA - converter=None, label=None, help=None,): # NOQA +def List( + item_type=typing.Any, + default=attr.NOTHING, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + converter=None, + label=None, + help=None, +): # NOQA """ A list attribute: the optional item_type defines the type of items it stores. """ @@ -187,9 +244,17 @@ def List(item_type=typing.Any, default=attr.NOTHING, validator=None, ) -def Mapping(value_type=typing.Any, default=attr.NOTHING, validator=None, - repr=False, eq=True, order=True, # NOQA - converter=None, help=None, label=None): # NOQA +def Mapping( + value_type=typing.Any, + default=attr.NOTHING, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + converter=None, + help=None, + label=None, +): # NOQA """ A mapping attribute: the optional value_type defines the type of values it stores. The key is always a string. @@ -218,8 +283,17 @@ def Mapping(value_type=typing.Any, default=attr.NOTHING, validator=None, # FIXME: add proper support for dates!!! ################################################## -def Date(default=None, validator=None, repr=False, eq=True, order=True, # NOQA - converter=None, label=None, help=None,): # NOQA + +def Date( + default=None, + validator=None, + repr=False, + eq=True, + order=True, # NOQA + converter=None, + label=None, + help=None, +): # NOQA """ A date attribute. It always serializes to an ISO date string. Behavior is TBD and for now this is exactly a string. @@ -233,4 +307,4 @@ def Date(default=None, validator=None, repr=False, eq=True, order=True, # NOQA converter=converter, help=help, label=label, - ) \ No newline at end of file + ) diff --git a/src/fetchcode/packagedcode_models.py b/src/fetchcode/packagedcode_models.py index c19150ac..007a23fb 100644 --- a/src/fetchcode/packagedcode_models.py +++ b/src/fetchcode/packagedcode_models.py @@ -85,7 +85,7 @@ def logger_debug(*args): logger.setLevel(logging.DEBUG) def logger_debug(*args): - return logger.debug(' '.join(isinstance(a, str) and a or repr(a) for a in args)) + return logger.debug(" ".join(isinstance(a, str) and a or repr(a) for a in args)) class BaseModel(object): @@ -118,11 +118,11 @@ def fields(cls): return [a.name for a in attr.fields(cls)] -party_person = 'person' +party_person = "person" # often loosely defined -party_project = 'project' +party_project = "project" # more formally defined -party_org = 'organization' +party_org = "organization" PARTY_TYPES = ( None, party_person, @@ -139,27 +139,23 @@ class Party(BaseModel): type = String( validator=choices(PARTY_TYPES), - label='party type', - help='the type of this party: One of: ' - +', '.join(p for p in PARTY_TYPES if p)) + label="party type", + help="the type of this party: One of: " + + ", ".join(p for p in PARTY_TYPES if p), + ) role = String( - label='party role', - help='A role for this party. Something such as author, ' - 'maintainer, contributor, owner, packager, distributor, ' - 'vendor, developer, owner, etc.') + label="party role", + help="A role for this party. Something such as author, " + "maintainer, contributor, owner, packager, distributor, " + "vendor, developer, owner, etc.", + ) - name = String( - label='name', - help='Name of this party.') + name = String(label="name", help="Name of this party.") - email = String( - label='email', - help='Email for this party.') + email = String(label="email", help="Email for this party.") - url = String( - label='url', - help='URL to a primary web page for this party.') + url = String(label="url", help="URL to a primary web page for this party.") @attr.s() @@ -196,41 +192,43 @@ class BasePackage(BaseModel): type = String( repr=True, - label='package type', - help='Optional. A short code to identify what is the type of this ' - 'package. For instance gem for a Rubygem, docker for container, ' - 'pypi for Python Wheel or Egg, maven for a Maven Jar, ' - 'deb for a Debian package, etc.') + label="package type", + help="Optional. A short code to identify what is the type of this " + "package. For instance gem for a Rubygem, docker for container, " + "pypi for Python Wheel or Egg, maven for a Maven Jar, " + "deb for a Debian package, etc.", + ) namespace = String( repr=True, - label='package namespace', - help='Optional namespace for this package.') + label="package namespace", + help="Optional namespace for this package.", + ) - name = String( - repr=True, - label='package name', - help='Name of the package.') + name = String(repr=True, label="package name", help="Name of the package.") version = String( repr=True, - label='package version', - help='Optional version of the package as a string.') + label="package version", + help="Optional version of the package as a string.", + ) qualifiers = Mapping( default=None, value_type=str, converter=lambda v: normalize_qualifiers(v, encode=False), - label='package qualifiers', - help='Optional mapping of key=value pairs qualifiers for this package') + label="package qualifiers", + help="Optional mapping of key=value pairs qualifiers for this package", + ) subpath = String( - label='extra package subpath', - help='Optional extra subpath inside a package and relative to the root ' - 'of this package') + label="extra package subpath", + help="Optional extra subpath inside a package and relative to the root " + "of this package", + ) def __attrs_post_init__(self, *args, **kwargs): - if not self.type and hasattr(self, 'default_type'): + if not self.type and hasattr(self, "default_type"): self.type = self.default_type @property @@ -241,8 +239,13 @@ def purl(self): if not self.name: return return PackageURL( - self.type, self.namespace, self.name, self.version, - self.qualifiers, self.subpath).to_string() + self.type, + self.namespace, + self.name, + self.version, + self.qualifiers, + self.subpath, + ).to_string() def repository_homepage_url(self, baseurl=default_web_baseurl): """ @@ -281,7 +284,7 @@ def set_purl(self, package_url): if not isinstance(package_url, PackageURL): package_url = PackageURL.from_string(package_url) - attribs = ['type', 'namespace', 'name', 'version', 'qualifiers', 'subpath'] + attribs = ["type", "namespace", "name", "version", "qualifiers", "subpath"] for att in attribs: self_val = getattr(self, att) purl_val = getattr(package_url, att) @@ -293,13 +296,13 @@ def to_dict(self, **kwargs): Return an OrderedDict of primitive Python types. """ mapping = attr.asdict(self, dict_factory=OrderedDict) - if not kwargs.get('exclude_properties'): - mapping['purl'] = self.purl - mapping['repository_homepage_url'] = self.repository_homepage_url() - mapping['repository_download_url'] = self.repository_download_url() - mapping['api_data_url'] = self.api_data_url() + if not kwargs.get("exclude_properties"): + mapping["purl"] = self.purl + mapping["repository_homepage_url"] = self.repository_homepage_url() + mapping["repository_download_url"] = self.repository_download_url() + mapping["api_data_url"] = self.api_data_url() if self.qualifiers: - mapping['qualifiers'] = normalize_qualifiers(self.qualifiers, encode=False) + mapping["qualifiers"] = normalize_qualifiers(self.qualifiers, encode=False) return mapping @classmethod @@ -309,6 +312,7 @@ def create(cls, ignore_unknown=True, **kwargs): Optionally `ignore_unknown` attributes provided in `kwargs`. """ from packagedcode import get_package_class + cls = get_package_class(kwargs, default=cls) return super(BasePackage, cls).create(ignore_unknown=ignore_unknown, **kwargs) @@ -321,37 +325,43 @@ class DependentPackage(BaseModel): purl = String( repr=True, - label='Dependent package URL', - help='A compact purl package URL. Typically when there is an unresolved requirement, there is no version. ' - 'If the dependency is resolved, the version should be added to the purl') + label="Dependent package URL", + help="A compact purl package URL. Typically when there is an unresolved requirement, there is no version. " + "If the dependency is resolved, the version should be added to the purl", + ) requirement = String( repr=True, - label='dependent package version requirement', - help='A string defining version(s)requirements. Package-type specific.') + label="dependent package version requirement", + help="A string defining version(s)requirements. Package-type specific.", + ) scope = String( repr=True, - label='dependency scope', - help='The scope of this dependency, such as runtime, install, etc. ' - 'This is package-type specific and is the original scope string.') + label="dependency scope", + help="The scope of this dependency, such as runtime, install, etc. " + "This is package-type specific and is the original scope string.", + ) is_runtime = Boolean( default=True, - label='is runtime flag', - help='True if this dependency is a runtime dependency.') + label="is runtime flag", + help="True if this dependency is a runtime dependency.", + ) is_optional = Boolean( default=False, - label='is optional flag', - help='True if this dependency is an optional dependency') + label="is optional flag", + help="True if this dependency is an optional dependency", + ) is_resolved = Boolean( default=False, - label='is resolved flag', - help='True if this dependency version requirement has ' - 'been resolved and this dependency url points to an ' - 'exact version.') + label="is resolved flag", + help="True if this dependency version requirement has " + "been resolved and this dependency url points to an " + "exact version.", + ) @attr.s() @@ -364,120 +374,122 @@ class Package(BasePackage): default_primary_language = None primary_language = String( - label='Primary programming language', - help='Primary programming language',) + label="Primary programming language", + help="Primary programming language", + ) description = String( - label='Description', - help='Description for this package. ' - 'By convention the first should be a summary when available.') + label="Description", + help="Description for this package. " + "By convention the first should be a summary when available.", + ) - release_date = Date( - label='release date', - help='Release date of the package') + release_date = Date(label="release date", help="Release date of the package") parties = List( item_type=Party, - label='parties', - help='A list of parties such as a person, project or organization.') + label="parties", + help="A list of parties such as a person, project or organization.", + ) - keywords = List( - item_type=str, - label='keywords', - help='A list of keywords.') + keywords = List(item_type=str, label="keywords", help="A list of keywords.") homepage_url = String( - label='homepage URL', - help='URL to the homepage for this package.') + label="homepage URL", help="URL to the homepage for this package." + ) - download_url = String( - label='Download URL', - help='A direct download URL.') + download_url = String(label="Download URL", help="A direct download URL.") - api_url = String( - label='API URL', - help='URL of API for this package.') + api_url = String(label="API URL", help="URL of API for this package.") size = Integer( default=None, - label='download size', - help='size of the package download in bytes') + label="download size", + help="size of the package download in bytes", + ) sha1 = String( - label='SHA1 checksum', - help='SHA1 checksum for this download in hexadecimal') + label="SHA1 checksum", help="SHA1 checksum for this download in hexadecimal" + ) md5 = String( - label='MD5 checksum', - help='MD5 checksum for this download in hexadecimal') + label="MD5 checksum", help="MD5 checksum for this download in hexadecimal" + ) sha256 = String( - label='SHA256 checksum', - help='SHA256 checksum for this download in hexadecimal') + label="SHA256 checksum", help="SHA256 checksum for this download in hexadecimal" + ) sha512 = String( - label='SHA512 checksum', - help='SHA512 checksum for this download in hexadecimal') + label="SHA512 checksum", help="SHA512 checksum for this download in hexadecimal" + ) bug_tracking_url = String( - label='bug tracking URL', - help='URL to the issue or bug tracker for this package') + label="bug tracking URL", + help="URL to the issue or bug tracker for this package", + ) code_view_url = String( - label='code view URL', - help='a URL where the code can be browsed online') + label="code view URL", help="a URL where the code can be browsed online" + ) vcs_url = String( - help='a URL to the VCS repository in the SPDX form of: ' - 'https://github.com/nexb/scancode-toolkit.git@405aaa4b3 ' - 'See SPDX specification "Package Download Location" ' - 'at https://spdx.org/spdx-specification-21-web-version#h.49x2ik5 ') + help="a URL to the VCS repository in the SPDX form of: " + "https://github.com/nexb/scancode-toolkit.git@405aaa4b3 " + 'See SPDX specification "Package Download Location" ' + "at https://spdx.org/spdx-specification-21-web-version#h.49x2ik5 " + ) copyright = String( - label='Copyright', - help='Copyright statements for this package. Typically one per line.') + label="Copyright", + help="Copyright statements for this package. Typically one per line.", + ) license_expression = String( - label='license expression', - help='The license expression for this package typically derived ' - 'from its declared license or .') + label="license expression", + help="The license expression for this package typically derived " + "from its declared license or .", + ) declared_license = String( - label='declared license', - help='The declared license mention, tag or text as found in a ' - 'package manifest.') + label="declared license", + help="The declared license mention, tag or text as found in a " + "package manifest.", + ) - notice_text = String( - label='notice text', - help='A notice text for this package.') + notice_text = String(label="notice text", help="A notice text for this package.") root_path = String( - label='package root path', - help='The path to the root of the package documented in this manifest ' - 'if any, such as a Maven .pom or a npm package.json parent directory.') + label="package root path", + help="The path to the root of the package documented in this manifest " + "if any, such as a Maven .pom or a npm package.json parent directory.", + ) dependencies = List( item_type=DependentPackage, - label='dependencies', - help='A list of DependentPackage for this package. ') + label="dependencies", + help="A list of DependentPackage for this package. ", + ) contains_source_code = TriBoolean( - label='contains source code', - help='Flag set to True if this package contains its own source code, None ' - 'if this is unknown, False if not.') + label="contains source code", + help="Flag set to True if this package contains its own source code, None " + "if this is unknown, False if not.", + ) source_packages = List( item_type=String, - label='List of related source code packages', + label="List of related source code packages", help='A list of related source code Package URLs (aka. "purl") for ' - 'this package. For instance an SRPM is the "source package" for a ' - 'binary RPM.') + 'this package. For instance an SRPM is the "source package" for a ' + "binary RPM.", + ) def __attrs_post_init__(self, *args, **kwargs): - if not self.type and hasattr(self, 'default_type'): + if not self.type and hasattr(self, "default_type"): self.type = self.default_type - if not self.primary_language and hasattr(self, 'default_primary_language'): + if not self.primary_language and hasattr(self, "default_primary_language"): self.primary_language = self.default_primary_language @classmethod @@ -516,7 +528,9 @@ def get_package_resources(cls, package_root, codebase): """ if not Package.is_ignored_package_resource(package_root, codebase): yield package_root - for resource in package_root.walk(codebase, topdown=True, ignored=Package.is_ignored_package_resource): + for resource in package_root.walk( + codebase, topdown=True, ignored=Package.is_ignored_package_resource + ): yield resource @classmethod @@ -529,6 +543,7 @@ def ignore_resource(cls, resource, codebase): @staticmethod def is_ignored_package_resource(resource, codebase): from packagedcode import PACKAGE_TYPES + return any(pt.ignore_resource(resource, codebase) for pt in PACKAGE_TYPES) def compute_normalized_license(self): @@ -587,12 +602,13 @@ def compute_normalized_license(declared_license): return from packagedcode import licensing + try: return licensing.get_normalized_expression(declared_license) except Exception: # FIXME: add logging # we never fail just for this - return 'unknown' + return "unknown" # Package types @@ -602,76 +618,99 @@ def compute_normalized_license(declared_license): @attr.s() class DebianPackage(Package): - metafiles = ('*.control',) - extensions = ('.deb',) - filetypes = ('debian binary package',) - mimetypes = ('application/x-archive', 'application/vnd.debian.binary-package',) - default_type = 'deb' + metafiles = ("*.control",) + extensions = (".deb",) + filetypes = ("debian binary package",) + mimetypes = ( + "application/x-archive", + "application/vnd.debian.binary-package", + ) + default_type = "deb" @attr.s() class JavaJar(Package): - metafiles = ('META-INF/MANIFEST.MF',) - extensions = ('.jar',) - filetypes = ('java archive ', 'zip archive',) - mimetypes = ('application/java-archive', 'application/zip',) - default_type = 'jar' - default_primary_language = 'Java' + metafiles = ("META-INF/MANIFEST.MF",) + extensions = (".jar",) + filetypes = ( + "java archive ", + "zip archive", + ) + mimetypes = ( + "application/java-archive", + "application/zip", + ) + default_type = "jar" + default_primary_language = "Java" @attr.s() class JavaWar(Package): - metafiles = ('WEB-INF/web.xml',) - extensions = ('.war',) - filetypes = ('java archive ', 'zip archive',) - mimetypes = ('application/java-archive', 'application/zip') - default_type = 'war' - default_primary_language = 'Java' + metafiles = ("WEB-INF/web.xml",) + extensions = (".war",) + filetypes = ( + "java archive ", + "zip archive", + ) + mimetypes = ("application/java-archive", "application/zip") + default_type = "war" + default_primary_language = "Java" @attr.s() class JavaEar(Package): - metafiles = ('META-INF/application.xml', 'META-INF/ejb-jar.xml') - extensions = ('.ear',) - filetypes = ('java archive ', 'zip archive',) - mimetypes = ('application/java-archive', 'application/zip') - default_type = 'ear' - default_primary_language = 'Java' + metafiles = ("META-INF/application.xml", "META-INF/ejb-jar.xml") + extensions = (".ear",) + filetypes = ( + "java archive ", + "zip archive", + ) + mimetypes = ("application/java-archive", "application/zip") + default_type = "ear" + default_primary_language = "Java" @attr.s() class Axis2Mar(Package): """Apache Axis2 module""" - metafiles = ('META-INF/module.xml',) - extensions = ('.mar',) - filetypes = ('java archive ', 'zip archive',) - mimetypes = ('application/java-archive', 'application/zip') - default_type = 'axis2' - default_primary_language = 'Java' + + metafiles = ("META-INF/module.xml",) + extensions = (".mar",) + filetypes = ( + "java archive ", + "zip archive", + ) + mimetypes = ("application/java-archive", "application/zip") + default_type = "axis2" + default_primary_language = "Java" @attr.s() class JBossSar(Package): - metafiles = ('META-INF/jboss-service.xml',) - extensions = ('.sar',) - filetypes = ('java archive ', 'zip archive',) - mimetypes = ('application/java-archive', 'application/zip') - default_type = 'jboss' - default_primary_language = 'Java' + metafiles = ("META-INF/jboss-service.xml",) + extensions = (".sar",) + filetypes = ( + "java archive ", + "zip archive", + ) + mimetypes = ("application/java-archive", "application/zip") + default_type = "jboss" + default_primary_language = "Java" @attr.s() class IvyJar(JavaJar): - metafiles = ('ivy.xml',) - default_type = 'ivy' - default_primary_language = 'Java' + metafiles = ("ivy.xml",) + default_type = "ivy" + default_primary_language = "Java" + # FIXME: move to bower.py @attr.s() class BowerPackage(Package): - metafiles = ('bower.json',) - default_type = 'bower' - default_primary_language = 'JavaScript' + metafiles = ("bower.json",) + default_type = "bower" + default_primary_language = "JavaScript" @classmethod def get_package_root(cls, manifest_resource, codebase): @@ -680,9 +719,9 @@ def get_package_root(cls, manifest_resource, codebase): @attr.s() class MeteorPackage(Package): - metafiles = ('package.js',) - default_type = 'meteor' - default_primary_language = 'JavaScript' + metafiles = ("package.js",) + default_type = "meteor" + default_primary_language = "JavaScript" @classmethod def get_package_root(cls, manifest_resource, codebase): @@ -692,27 +731,28 @@ def get_package_root(cls, manifest_resource, codebase): @attr.s() class CpanModule(Package): metafiles = ( - '*.pod', - '*.pm', - 'MANIFEST', - 'Makefile.PL', - 'META.yml', - 'META.json', - '*.meta', - 'dist.ini',) + "*.pod", + "*.pm", + "MANIFEST", + "Makefile.PL", + "META.yml", + "META.json", + "*.meta", + "dist.ini", + ) # TODO: refine me - extensions = ('.tar.gz',) - default_type = 'cpan' - default_primary_language = 'Perl' + extensions = (".tar.gz",) + default_type = "cpan" + default_primary_language = "Perl" # TODO: refine me: Go packages are a mess but something is emerging # TODO: move to and use godeps.py @attr.s() class Godep(Package): - metafiles = ('Godeps',) - default_type = 'golang' - default_primary_language = 'Go' + metafiles = ("Godeps",) + default_type = "golang" + default_primary_language = "Go" @classmethod def get_package_root(cls, manifest_resource, codebase): @@ -731,112 +771,126 @@ def get_package_root(cls, manifest_resource, codebase): @attr.s() class AndroidApp(Package): - filetypes = ('zip archive',) - mimetypes = ('application/zip',) - extensions = ('.apk',) - default_type = 'android' - default_primary_language = 'Java' + filetypes = ("zip archive",) + mimetypes = ("application/zip",) + extensions = (".apk",) + default_type = "android" + default_primary_language = "Java" # see http://tools.android.com/tech-docs/new-build-system/aar-formats @attr.s() class AndroidLibrary(Package): - filetypes = ('zip archive',) - mimetypes = ('application/zip',) + filetypes = ("zip archive",) + mimetypes = ("application/zip",) # note: Apache Axis also uses AAR extensions for plain Jars. # this could be decided based on internal structure - extensions = ('.aar',) - default_type = 'android-lib' - default_primary_language = 'Java' + extensions = (".aar",) + default_type = "android-lib" + default_primary_language = "Java" @attr.s() class MozillaExtension(Package): - filetypes = ('zip archive',) - mimetypes = ('application/zip',) - extensions = ('.xpi',) - default_type = 'mozilla' - default_primary_language = 'JavaScript' + filetypes = ("zip archive",) + mimetypes = ("application/zip",) + extensions = (".xpi",) + default_type = "mozilla" + default_primary_language = "JavaScript" @attr.s() class ChromeExtension(Package): - filetypes = ('data',) - mimetypes = ('application/octet-stream',) - extensions = ('.crx',) - default_type = 'chrome' - default_primary_language = 'JavaScript' + filetypes = ("data",) + mimetypes = ("application/octet-stream",) + extensions = (".crx",) + default_type = "chrome" + default_primary_language = "JavaScript" @attr.s() class IOSApp(Package): - filetypes = ('zip archive',) - mimetypes = ('application/zip',) - extensions = ('.ipa',) - default_type = 'ios' - default_primary_language = 'Objective-C' + filetypes = ("zip archive",) + mimetypes = ("application/zip",) + extensions = (".ipa",) + default_type = "ios" + default_primary_language = "Objective-C" @attr.s() class CabPackage(Package): - filetypes = ('microsoft cabinet',) - mimetypes = ('application/vnd.ms-cab-compressed',) - extensions = ('.cab',) - default_type = 'cab' + filetypes = ("microsoft cabinet",) + mimetypes = ("application/vnd.ms-cab-compressed",) + extensions = (".cab",) + default_type = "cab" @attr.s() class MsiInstallerPackage(Package): - filetypes = ('msi installer',) - mimetypes = ('application/x-msi',) - extensions = ('.msi',) - default_type = 'msi' + filetypes = ("msi installer",) + mimetypes = ("application/x-msi",) + extensions = (".msi",) + default_type = "msi" @attr.s() class InstallShieldPackage(Package): - filetypes = ('installshield',) - mimetypes = ('application/x-dosexec',) - extensions = ('.exe',) - default_type = 'installshield' + filetypes = ("installshield",) + mimetypes = ("application/x-dosexec",) + extensions = (".exe",) + default_type = "installshield" @attr.s() class NSISInstallerPackage(Package): - filetypes = ('nullsoft installer',) - mimetypes = ('application/x-dosexec',) - extensions = ('.exe',) - default_type = 'nsis' + filetypes = ("nullsoft installer",) + mimetypes = ("application/x-dosexec",) + extensions = (".exe",) + default_type = "nsis" @attr.s() class SharPackage(Package): - filetypes = ('posix shell script',) - mimetypes = ('text/x-shellscript',) - extensions = ('.sha', '.shar', '.bin',) - default_type = 'shar' + filetypes = ("posix shell script",) + mimetypes = ("text/x-shellscript",) + extensions = ( + ".sha", + ".shar", + ".bin", + ) + default_type = "shar" @attr.s() class AppleDmgPackage(Package): - filetypes = ('zlib compressed',) - mimetypes = ('application/zlib',) - extensions = ('.dmg', '.sparseimage',) - default_type = 'dmg' + filetypes = ("zlib compressed",) + mimetypes = ("application/zlib",) + extensions = ( + ".dmg", + ".sparseimage", + ) + default_type = "dmg" @attr.s() class IsoImagePackage(Package): - filetypes = ('iso 9660 cd-rom', 'high sierra cd-rom',) - mimetypes = ('application/x-iso9660-image',) - extensions = ('.iso', '.udf', '.img',) - default_type = 'iso' + filetypes = ( + "iso 9660 cd-rom", + "high sierra cd-rom", + ) + mimetypes = ("application/x-iso9660-image",) + extensions = ( + ".iso", + ".udf", + ".img", + ) + default_type = "iso" @attr.s() class SquashfsPackage(Package): - filetypes = ('squashfs',) - default_type = 'squashfs' + filetypes = ("squashfs",) + default_type = "squashfs" -# TODO: Add VM images formats(VMDK, OVA, OVF, VDI, etc) and Docker/other containers \ No newline at end of file +# TODO: Add VM images formats(VMDK, OVA, OVF, VDI, etc) and Docker/other containers diff --git a/src/fetchcode/vcs/pip/__main__.py b/src/fetchcode/vcs/pip/__main__.py index af23e468..e962d8c0 100644 --- a/src/fetchcode/vcs/pip/__main__.py +++ b/src/fetchcode/vcs/pip/__main__.py @@ -1,4 +1,3 @@ - import os import sys @@ -6,12 +5,12 @@ # of sys.path, if present to avoid using current directory # in pip commands check, freeze, install, list and show, # when invoked as python -m pip -if sys.path[0] in ('', os.getcwd()): +if sys.path[0] in ("", os.getcwd()): sys.path.pop(0) # If we are running from a wheel, add the wheel to sys.path # This allows the usage python pip-*.whl/pip install pip-*.whl -if __package__ == '': +if __package__ == "": # __file__ is pip-*.whl/pip/__main__.py # first dirname call strips of '/__main__.py', second strips off '/pip' # Resulting path is the name of the wheel itself @@ -21,5 +20,5 @@ from fetchcode.vcs.pip._internal.cli.main import main as _main # isort:skip # noqa -if __name__ == '__main__': +if __name__ == "__main__": sys.exit(_main()) diff --git a/src/fetchcode/vcs/pip/_internal/build_env.py b/src/fetchcode/vcs/pip/_internal/build_env.py index e777f9a5..bf39e77a 100644 --- a/src/fetchcode/vcs/pip/_internal/build_env.py +++ b/src/fetchcode/vcs/pip/_internal/build_env.py @@ -13,7 +13,11 @@ from distutils.sysconfig import get_python_lib from sysconfig import get_paths -from fetchcode.vcs.pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet +from fetchcode.vcs.pip._vendor.pkg_resources import ( + Requirement, + VersionConflict, + WorkingSet, +) from pip import __file__ as pip_location from fetchcode.vcs.pip._internal.cli.spinners import open_spinner @@ -29,15 +33,14 @@ class _Prefix: - def __init__(self, path): # type: (str) -> None self.path = path self.setup = False self.bin_dir = get_paths( - 'nt' if os.name == 'nt' else 'posix_prefix', - vars={'base': path, 'platbase': path} - )['scripts'] + "nt" if os.name == "nt" else "posix_prefix", + vars={"base": path, "platbase": path}, + )["scripts"] # Note: prefer distutils' sysconfig to get the # library paths so PyPy is correctly supported. purelib = get_python_lib(plat_specific=False, prefix=path) @@ -49,19 +52,18 @@ def __init__(self, path): class BuildEnvironment(object): - """Creates and manages an isolated environment to install build deps - """ + """Creates and manages an isolated environment to install build deps""" def __init__(self): # type: () -> None - temp_dir = TempDirectory( - kind=tempdir_kinds.BUILD_ENV, globally_managed=True - ) + temp_dir = TempDirectory(kind=tempdir_kinds.BUILD_ENV, globally_managed=True) - self._prefixes = OrderedDict(( - (name, _Prefix(os.path.join(temp_dir.path, name))) - for name in ('normal', 'overlay') - )) + self._prefixes = OrderedDict( + ( + (name, _Prefix(os.path.join(temp_dir.path, name))) + for name in ("normal", "overlay") + ) + ) self._bin_dirs = [] # type: List[str] self._lib_dirs = [] # type: List[str] @@ -73,17 +75,19 @@ def __init__(self): # - ensure .pth files are honored # - prevent access to system site packages system_sites = { - os.path.normcase(site) for site in ( + os.path.normcase(site) + for site in ( get_python_lib(plat_specific=False), get_python_lib(plat_specific=True), ) } - self._site_dir = os.path.join(temp_dir.path, 'site') + self._site_dir = os.path.join(temp_dir.path, "site") if not os.path.exists(self._site_dir): os.mkdir(self._site_dir) - with open(os.path.join(self._site_dir, 'sitecustomize.py'), 'w') as fp: - fp.write(textwrap.dedent( - ''' + with open(os.path.join(self._site_dir, "sitecustomize.py"), "w") as fp: + fp.write( + textwrap.dedent( + """ import os, site, sys # First, drop system-sites related paths. @@ -106,27 +110,30 @@ def __init__(self): for path in {lib_dirs!r}: assert not path in sys.path site.addsitedir(path) - ''' - ).format(system_sites=system_sites, lib_dirs=self._lib_dirs)) + """ + ).format(system_sites=system_sites, lib_dirs=self._lib_dirs) + ) def __enter__(self): self._save_env = { name: os.environ.get(name, None) - for name in ('PATH', 'PYTHONNOUSERSITE', 'PYTHONPATH') + for name in ("PATH", "PYTHONNOUSERSITE", "PYTHONPATH") } path = self._bin_dirs[:] - old_path = self._save_env['PATH'] + old_path = self._save_env["PATH"] if old_path: path.extend(old_path.split(os.pathsep)) pythonpath = [self._site_dir] - os.environ.update({ - 'PATH': os.pathsep.join(path), - 'PYTHONNOUSERSITE': '1', - 'PYTHONPATH': os.pathsep.join(pythonpath), - }) + os.environ.update( + { + "PATH": os.pathsep.join(path), + "PYTHONNOUSERSITE": "1", + "PYTHONPATH": os.pathsep.join(pythonpath), + } + ) def __exit__(self, exc_type, exc_val, exc_tb): for varname, old_value in self._save_env.items(): @@ -138,8 +145,8 @@ def __exit__(self, exc_type, exc_val, exc_tb): def check_requirements(self, reqs): # type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]] """Return 2 sets: - - conflicting requirements: set of (installed, wanted) reqs tuples - - missing requirements: set of reqs + - conflicting requirements: set of (installed, wanted) reqs tuples + - missing requirements: set of reqs """ missing = set() conflicting = set() @@ -150,8 +157,7 @@ def check_requirements(self, reqs): if ws.find(Requirement.parse(req)) is None: missing.add(req) except VersionConflict as e: - conflicting.add((str(e.args[0].as_requirement()), - str(e.args[1]))) + conflicting.add((str(e.args[0].as_requirement()), str(e.args[1]))) return conflicting, missing def install_requirements( @@ -159,7 +165,7 @@ def install_requirements( finder, # type: PackageFinder requirements, # type: Iterable[str] prefix_as_string, # type: str - message # type: Optional[str] + message, # type: Optional[str] ): # type: (...) -> None prefix = self._prefixes[prefix_as_string] @@ -168,40 +174,48 @@ def install_requirements( if not requirements: return args = [ - sys.executable, os.path.dirname(pip_location), 'install', - '--ignore-installed', '--no-user', '--prefix', prefix.path, - '--no-warn-script-location', + sys.executable, + os.path.dirname(pip_location), + "install", + "--ignore-installed", + "--no-user", + "--prefix", + prefix.path, + "--no-warn-script-location", ] # type: List[str] if logger.getEffectiveLevel() <= logging.DEBUG: - args.append('-v') - for format_control in ('no_binary', 'only_binary'): + args.append("-v") + for format_control in ("no_binary", "only_binary"): formats = getattr(finder.format_control, format_control) - args.extend(('--' + format_control.replace('_', '-'), - ','.join(sorted(formats or {':none:'})))) + args.extend( + ( + "--" + format_control.replace("_", "-"), + ",".join(sorted(formats or {":none:"})), + ) + ) index_urls = finder.index_urls if index_urls: - args.extend(['-i', index_urls[0]]) + args.extend(["-i", index_urls[0]]) for extra_index in index_urls[1:]: - args.extend(['--extra-index-url', extra_index]) + args.extend(["--extra-index-url", extra_index]) else: - args.append('--no-index') + args.append("--no-index") for link in finder.find_links: - args.extend(['--find-links', link]) + args.extend(["--find-links", link]) for host in finder.trusted_hosts: - args.extend(['--trusted-host', host]) + args.extend(["--trusted-host", host]) if finder.allow_all_prereleases: - args.append('--pre') - args.append('--') + args.append("--pre") + args.append("--") args.extend(requirements) with open_spinner(message) as spinner: call_subprocess(args, spinner=spinner) class NoOpBuildEnvironment(BuildEnvironment): - """A no-op drop-in replacement for BuildEnvironment - """ + """A no-op drop-in replacement for BuildEnvironment""" def __init__(self): pass diff --git a/src/fetchcode/vcs/pip/_internal/cache.py b/src/fetchcode/vcs/pip/_internal/cache.py index 37c6198e..d78f7ee3 100644 --- a/src/fetchcode/vcs/pip/_internal/cache.py +++ b/src/fetchcode/vcs/pip/_internal/cache.py @@ -9,7 +9,10 @@ import logging import os -from fetchcode.vcs.pip._vendor.packaging.tags import interpreter_name, interpreter_version +from fetchcode.vcs.pip._vendor.packaging.tags import ( + interpreter_name, + interpreter_version, +) from fetchcode.vcs.pip._vendor.packaging.utils import canonicalize_name from fetchcode.vcs.pip._internal.exceptions import InvalidWheelFilename @@ -40,11 +43,11 @@ class Cache(object): """An abstract class - provides cache directories for data from links - :param cache_dir: The root of the cache. - :param format_control: An object of FormatControl class to limit - binaries being read from the cache. - :param allowed_formats: which formats of files the cache should store. - ('binary' and 'source' are the only allowed values) + :param cache_dir: The root of the cache. + :param format_control: An object of FormatControl class to limit + binaries being read from the cache. + :param allowed_formats: which formats of files the cache should store. + ('binary' and 'source' are the only allowed values) """ def __init__(self, cache_dir, format_control, allowed_formats): @@ -88,8 +91,7 @@ def _get_cache_path_parts_legacy(self, link): def _get_cache_path_parts(self, link): # type: (Link) -> List[str] - """Get parts of part that must be os.path.joined with cache_dir - """ + """Get parts of part that must be os.path.joined with cache_dir""" # We want to generate an url to use as our cache key, we don't want to # just re-use the URL because it might have other items in the fragment @@ -123,17 +125,11 @@ def _get_cache_path_parts(self, link): def _get_candidates(self, link, canonical_package_name): # type: (Link, Optional[str]) -> List[Any] - can_not_cache = ( - not self.cache_dir or - not canonical_package_name or - not link - ) + can_not_cache = not self.cache_dir or not canonical_package_name or not link if can_not_cache: return [] - formats = self.format_control.get_allowed_formats( - canonical_package_name - ) + formats = self.format_control.get_allowed_formats(canonical_package_name) if not self.allowed_formats.intersection(formats): return [] @@ -155,14 +151,13 @@ def get_path_for_link_legacy(self, link): def get_path_for_link(self, link): # type: (Link) -> str - """Return a directory to store cached items in for link. - """ + """Return a directory to store cached items in for link.""" raise NotImplementedError() def get( self, - link, # type: Link - package_name, # type: Optional[str] + link, # type: Link + package_name, # type: Optional[str] supported_tags, # type: List[Tag] ): # type: (...) -> Link @@ -173,14 +168,11 @@ def get( class SimpleWheelCache(Cache): - """A cache of wheels for future installs. - """ + """A cache of wheels for future installs.""" def __init__(self, cache_dir, format_control): # type: (str, FormatControl) -> None - super(SimpleWheelCache, self).__init__( - cache_dir, format_control, {"binary"} - ) + super(SimpleWheelCache, self).__init__(cache_dir, format_control, {"binary"}) def get_path_for_link_legacy(self, link): # type: (Link) -> str @@ -210,8 +202,8 @@ def get_path_for_link(self, link): def get( self, - link, # type: Link - package_name, # type: Optional[str] + link, # type: Link + package_name, # type: Optional[str] supported_tags, # type: List[Tag] ): # type: (...) -> Link @@ -221,9 +213,7 @@ def get( return link canonical_package_name = canonicalize_name(package_name) - for wheel_name, wheel_dir in self._get_candidates( - link, canonical_package_name - ): + for wheel_name, wheel_dir in self._get_candidates(link, canonical_package_name): try: wheel = Wheel(wheel_name) except InvalidWheelFilename: @@ -255,8 +245,7 @@ def get( class EphemWheelCache(SimpleWheelCache): - """A SimpleWheelCache that creates it's own temporary cache directory - """ + """A SimpleWheelCache that creates it's own temporary cache directory""" def __init__(self, format_control): # type: (FormatControl) -> None @@ -265,9 +254,7 @@ def __init__(self, format_control): globally_managed=True, ) - super(EphemWheelCache, self).__init__( - self._temp_dir.path, format_control - ) + super(EphemWheelCache, self).__init__(self._temp_dir.path, format_control) class CacheEntry(object): @@ -289,9 +276,7 @@ class WheelCache(Cache): def __init__(self, cache_dir, format_control): # type: (str, FormatControl) -> None - super(WheelCache, self).__init__( - cache_dir, format_control, {'binary'} - ) + super(WheelCache, self).__init__(cache_dir, format_control, {"binary"}) self._wheel_cache = SimpleWheelCache(cache_dir, format_control) self._ephem_cache = EphemWheelCache(format_control) @@ -309,8 +294,8 @@ def get_ephem_path_for_link(self, link): def get( self, - link, # type: Link - package_name, # type: Optional[str] + link, # type: Link + package_name, # type: Optional[str] supported_tags, # type: List[Tag] ): # type: (...) -> Link @@ -321,8 +306,8 @@ def get( def get_cache_entry( self, - link, # type: Link - package_name, # type: Optional[str] + link, # type: Link + package_name, # type: Optional[str] supported_tags, # type: List[Tag] ): # type: (...) -> Optional[CacheEntry] diff --git a/src/fetchcode/vcs/pip/_internal/cli/autocompletion.py b/src/fetchcode/vcs/pip/_internal/cli/autocompletion.py index bc26912a..37e999b3 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/autocompletion.py +++ b/src/fetchcode/vcs/pip/_internal/cli/autocompletion.py @@ -17,17 +17,16 @@ def autocomplete(): # type: () -> None - """Entry Point for completion of main and subcommand options. - """ + """Entry Point for completion of main and subcommand options.""" # Don't complete if user hasn't sourced bash_completion file. - if 'PIP_AUTO_COMPLETE' not in os.environ: + if "PIP_AUTO_COMPLETE" not in os.environ: return - cwords = os.environ['COMP_WORDS'].split()[1:] - cword = int(os.environ['COMP_CWORD']) + cwords = os.environ["COMP_WORDS"].split()[1:] + cword = int(os.environ["COMP_CWORD"]) try: current = cwords[cword - 1] except IndexError: - current = '' + current = "" parser = create_main_parser() subcommands = list(commands_dict) @@ -42,13 +41,13 @@ def autocomplete(): # subcommand options if subcommand_name is not None: # special case: 'help' subcommand has no options - if subcommand_name == 'help': + if subcommand_name == "help": sys.exit(1) # special case: list locally installed dists for show and uninstall - should_list_installed = ( - subcommand_name in ['show', 'uninstall'] and - not current.startswith('-') - ) + should_list_installed = subcommand_name in [ + "show", + "uninstall", + ] and not current.startswith("-") if should_list_installed: installed = [] lc = current.lower() @@ -69,13 +68,15 @@ def autocomplete(): options.append((opt_str, opt.nargs)) # filter out previously specified options from available options - prev_opts = [x.split('=')[0] for x in cwords[1:cword - 1]] + prev_opts = [x.split("=")[0] for x in cwords[1 : cword - 1]] options = [(x, v) for (x, v) in options if x not in prev_opts] # filter options by current input options = [(k, v) for k, v in options if k.startswith(current)] # get completion type given cwords and available subcommand options completion_type = get_path_completion_type( - cwords, cword, subcommand.parser.option_list_all, + cwords, + cword, + subcommand.parser.option_list_all, ) # get completion files and directories if ``completion_type`` is # ````, ```` or ```` @@ -86,7 +87,7 @@ def autocomplete(): opt_label = option[0] # append '=' to options which require args if option[1] and option[0][:2] == "--": - opt_label += '=' + opt_label += "=" print(opt_label) else: # show main parser options only when necessary @@ -94,19 +95,17 @@ def autocomplete(): opts = [i.option_list for i in parser.option_groups] opts.append(parser.option_list) flattened_opts = chain.from_iterable(opts) - if current.startswith('-'): + if current.startswith("-"): for opt in flattened_opts: if opt.help != optparse.SUPPRESS_HELP: subcommands += opt._long_opts + opt._short_opts else: # get completion type given cwords and all available options - completion_type = get_path_completion_type(cwords, cword, - flattened_opts) + completion_type = get_path_completion_type(cwords, cword, flattened_opts) if completion_type: - subcommands = list(auto_complete_paths(current, - completion_type)) + subcommands = list(auto_complete_paths(current, completion_type)) - print(' '.join([x for x in subcommands if x.startswith(current)])) + print(" ".join([x for x in subcommands if x.startswith(current)])) sys.exit(1) @@ -119,16 +118,16 @@ def get_path_completion_type(cwords, cword, opts): :param opts: The available options to check :return: path completion type (``file``, ``dir``, ``path`` or None) """ - if cword < 2 or not cwords[cword - 2].startswith('-'): + if cword < 2 or not cwords[cword - 2].startswith("-"): return None for opt in opts: if opt.help == optparse.SUPPRESS_HELP: continue - for o in str(opt).split('/'): - if cwords[cword - 2].split('=')[0] == o: + for o in str(opt).split("/"): + if cwords[cword - 2].split("=")[0] == o: if not opt.metavar or any( - x in ('path', 'file', 'dir') - for x in opt.metavar.split('/')): + x in ("path", "file", "dir") for x in opt.metavar.split("/") + ): return opt.metavar return None @@ -150,15 +149,16 @@ def auto_complete_paths(current, completion_type): return filename = os.path.normcase(filename) # list all files that start with ``filename`` - file_list = (x for x in os.listdir(current_path) - if os.path.normcase(x).startswith(filename)) + file_list = ( + x for x in os.listdir(current_path) if os.path.normcase(x).startswith(filename) + ) for f in file_list: opt = os.path.join(current_path, f) comp_file = os.path.normcase(os.path.join(directory, f)) # complete regular files when there is not ```` after option # complete directories when there is ````, ```` or # ````after option - if completion_type != 'dir' and os.path.isfile(opt): + if completion_type != "dir" and os.path.isfile(opt): yield comp_file elif os.path.isdir(opt): - yield os.path.join(comp_file, '') + yield os.path.join(comp_file, "") diff --git a/src/fetchcode/vcs/pip/_internal/cli/base_command.py b/src/fetchcode/vcs/pip/_internal/cli/base_command.py index c9360abc..ef9ffa6b 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/base_command.py +++ b/src/fetchcode/vcs/pip/_internal/cli/base_command.py @@ -31,7 +31,10 @@ ) from fetchcode.vcs.pip._internal.utils.deprecation import deprecated from fetchcode.vcs.pip._internal.utils.filesystem import check_path_owner -from fetchcode.vcs.pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging +from fetchcode.vcs.pip._internal.utils.logging import ( + BrokenStdoutLoggingError, + setup_logging, +) from fetchcode.vcs.pip._internal.utils.misc import get_prog, normalize_path from fetchcode.vcs.pip._internal.utils.temp_dir import ( global_tempdir_manager, @@ -45,10 +48,10 @@ from optparse import Values from fetchcode.vcs.pip._internal.utils.temp_dir import ( - TempDirectoryTypeRegistry as TempDirRegistry + TempDirectoryTypeRegistry as TempDirRegistry, ) -__all__ = ['Command'] +__all__ = ["Command"] logger = logging.getLogger(__name__) @@ -61,13 +64,13 @@ def __init__(self, name, summary, isolated=False): # type: (str, str, bool) -> None super(Command, self).__init__() parser_kw = { - 'usage': self.usage, - 'prog': '{} {}'.format(get_prog(), name), - 'formatter': UpdatingDefaultsHelpFormatter(), - 'add_help_option': False, - 'name': name, - 'description': self.__doc__, - 'isolated': isolated, + "usage": self.usage, + "prog": "{} {}".format(get_prog(), name), + "formatter": UpdatingDefaultsHelpFormatter(), + "add_help_option": False, + "name": name, + "description": self.__doc__, + "isolated": isolated, } self.name = name @@ -77,7 +80,7 @@ def __init__(self, name, summary, isolated=False): self.tempdir_registry = None # type: Optional[TempDirRegistry] # Commands should add options to this option group - optgroup_name = '{} Options'.format(self.name.capitalize()) + optgroup_name = "{} Options".format(self.name.capitalize()) self.cmd_opts = optparse.OptionGroup(self.parser, optgroup_name) # Add the general options @@ -95,7 +98,7 @@ def handle_pip_version_check(self, options): """ # Make sure we do the pip version check if the index_group options # are present. - assert not hasattr(options, 'no_index') + assert not hasattr(options, "no_index") def run(self, options, args): # type: (Values, List[Any]) -> Any @@ -135,10 +138,7 @@ def _main(self, args): user_log_file=options.log, ) - if ( - sys.version_info[:2] == (2, 7) and - not options.no_python_version_warning - ): + if sys.version_info[:2] == (2, 7) and not options.no_python_version_warning: message = ( "pip 21.0 will drop support for Python 2.7 in January 2021. " "More details about Python 2 support in pip, can be found at " @@ -157,17 +157,15 @@ def _main(self, args): # This also affects isolated builds and it should. if options.no_input: - os.environ['PIP_NO_INPUT'] = '1' + os.environ["PIP_NO_INPUT"] = "1" if options.exists_action: - os.environ['PIP_EXISTS_ACTION'] = ' '.join(options.exists_action) + os.environ["PIP_EXISTS_ACTION"] = " ".join(options.exists_action) if options.require_venv and not self.ignore_require_venv: # If a venv is required check if it can really be found if not running_under_virtualenv(): - logger.critical( - 'Could not find an activated virtualenv (required).' - ) + logger.critical("Could not find an activated virtualenv (required).") sys.exit(VIRTUALENV_NOT_FOUND) if options.cache_dir: @@ -191,34 +189,34 @@ def _main(self, args): return status except PreviousBuildDirError as exc: logger.critical(str(exc)) - logger.debug('Exception information:', exc_info=True) + logger.debug("Exception information:", exc_info=True) return PREVIOUS_BUILD_DIR_ERROR except (InstallationError, UninstallationError, BadCommand) as exc: logger.critical(str(exc)) - logger.debug('Exception information:', exc_info=True) + logger.debug("Exception information:", exc_info=True) return ERROR except CommandError as exc: - logger.critical('%s', exc) - logger.debug('Exception information:', exc_info=True) + logger.critical("%s", exc) + logger.debug("Exception information:", exc_info=True) return ERROR except BrokenStdoutLoggingError: # Bypass our logger and write any remaining messages to stderr # because stdout no longer works. - print('ERROR: Pipe to stdout was broken', file=sys.stderr) + print("ERROR: Pipe to stdout was broken", file=sys.stderr) if level_number <= logging.DEBUG: traceback.print_exc(file=sys.stderr) return ERROR except KeyboardInterrupt: - logger.critical('Operation cancelled by user') - logger.debug('Exception information:', exc_info=True) + logger.critical("Operation cancelled by user") + logger.debug("Exception information:", exc_info=True) return ERROR except BaseException: - logger.critical('Exception:', exc_info=True) + logger.critical("Exception:", exc_info=True) return UNKNOWN_ERROR finally: diff --git a/src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py b/src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py index e626a006..57c1e5af 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py +++ b/src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py @@ -47,8 +47,8 @@ def raise_option_error(parser, option, msg): option: an Option instance. msg: the error text. """ - msg = '{} error: {}'.format(option, msg) - msg = textwrap.fill(' '.join(msg.split())) + msg = "{} error: {}".format(option, msg) + msg = textwrap.fill(" ".join(msg.split())) parser.error(msg) @@ -59,8 +59,8 @@ def make_option_group(group, parser): group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser """ - option_group = OptionGroup(parser, group['name']) - for option in group['options']: + option_group = OptionGroup(parser, group["name"]) + for option in group["options"]: option_group.add_option(option()) return option_group @@ -79,13 +79,15 @@ def check_install_build_global(options, check_options=None): def getname(n): # type: (str) -> Optional[Any] return getattr(check_options, n, None) + names = ["build_options", "global_options", "install_options"] if any(map(getname, names)): control = options.format_control control.disallow_binaries() warnings.warn( - 'Disabling all use of wheels due to the use of --build-option ' - '/ --global-option / --install-option.', stacklevel=2, + "Disabling all use of wheels due to the use of --build-option " + "/ --global-option / --install-option.", + stacklevel=2, ) @@ -96,17 +98,18 @@ def check_dist_restriction(options, check_target=False): :param options: The OptionParser options. :param check_target: Whether or not to check if --target is being used. """ - dist_restriction_set = any([ - options.python_version, - options.platform, - options.abi, - options.implementation, - ]) - - binary_only = FormatControl(set(), {':all:'}) + dist_restriction_set = any( + [ + options.python_version, + options.platform, + options.abi, + options.implementation, + ] + ) + + binary_only = FormatControl(set(), {":all:"}) sdist_dependencies_allowed = ( - options.format_control != binary_only and - not options.ignore_dependencies + options.format_control != binary_only and not options.ignore_dependencies ) # Installations or downloads using dist restrictions must not combine @@ -146,10 +149,11 @@ class PipOption(Option): help_ = partial( Option, - '-h', '--help', - dest='help', - action='help', - help='Show help.', + "-h", + "--help", + dest="help", + action="help", + help="Show help.", ) # type: Callable[..., Option] isolated_mode = partial( @@ -167,111 +171,119 @@ class PipOption(Option): require_virtualenv = partial( Option, # Run only if inside a virtualenv, bail if not. - '--require-virtualenv', '--require-venv', - dest='require_venv', - action='store_true', + "--require-virtualenv", + "--require-venv", + dest="require_venv", + action="store_true", default=False, - help=SUPPRESS_HELP + help=SUPPRESS_HELP, ) # type: Callable[..., Option] verbose = partial( Option, - '-v', '--verbose', - dest='verbose', - action='count', + "-v", + "--verbose", + dest="verbose", + action="count", default=0, - help='Give more output. Option is additive, and can be used up to 3 times.' + help="Give more output. Option is additive, and can be used up to 3 times.", ) # type: Callable[..., Option] no_color = partial( Option, - '--no-color', - dest='no_color', - action='store_true', + "--no-color", + dest="no_color", + action="store_true", default=False, help="Suppress colored output", ) # type: Callable[..., Option] version = partial( Option, - '-V', '--version', - dest='version', - action='store_true', - help='Show version and exit.', + "-V", + "--version", + dest="version", + action="store_true", + help="Show version and exit.", ) # type: Callable[..., Option] quiet = partial( Option, - '-q', '--quiet', - dest='quiet', - action='count', + "-q", + "--quiet", + dest="quiet", + action="count", default=0, help=( - 'Give less output. Option is additive, and can be used up to 3' - ' times (corresponding to WARNING, ERROR, and CRITICAL logging' - ' levels).' + "Give less output. Option is additive, and can be used up to 3" + " times (corresponding to WARNING, ERROR, and CRITICAL logging" + " levels)." ), ) # type: Callable[..., Option] progress_bar = partial( Option, - '--progress-bar', - dest='progress_bar', - type='choice', + "--progress-bar", + dest="progress_bar", + type="choice", choices=list(BAR_TYPES.keys()), - default='on', + default="on", help=( - 'Specify type of progress to be displayed [' + - '|'.join(BAR_TYPES.keys()) + '] (default: %default)' + "Specify type of progress to be displayed [" + + "|".join(BAR_TYPES.keys()) + + "] (default: %default)" ), ) # type: Callable[..., Option] log = partial( PipOption, - "--log", "--log-file", "--local-log", + "--log", + "--log-file", + "--local-log", dest="log", metavar="path", type="path", - help="Path to a verbose appending log." + help="Path to a verbose appending log.", ) # type: Callable[..., Option] no_input = partial( Option, # Don't ask for input - '--no-input', - dest='no_input', - action='store_true', + "--no-input", + dest="no_input", + action="store_true", default=False, - help=SUPPRESS_HELP + help=SUPPRESS_HELP, ) # type: Callable[..., Option] proxy = partial( Option, - '--proxy', - dest='proxy', - type='str', - default='', - help="Specify a proxy in the form [user:passwd@]proxy.server:port." + "--proxy", + dest="proxy", + type="str", + default="", + help="Specify a proxy in the form [user:passwd@]proxy.server:port.", ) # type: Callable[..., Option] retries = partial( Option, - '--retries', - dest='retries', - type='int', + "--retries", + dest="retries", + type="int", default=5, help="Maximum number of retries each connection should attempt " - "(default %default times).", + "(default %default times).", ) # type: Callable[..., Option] timeout = partial( Option, - '--timeout', '--default-timeout', - metavar='sec', - dest='timeout', - type='float', + "--timeout", + "--default-timeout", + metavar="sec", + dest="timeout", + type="float", default=15, - help='Set the socket timeout (default %default seconds).', + help="Set the socket timeout (default %default seconds).", ) # type: Callable[..., Option] @@ -279,88 +291,91 @@ def exists_action(): # type: () -> Option return Option( # Option when path already exist - '--exists-action', - dest='exists_action', - type='choice', - choices=['s', 'i', 'w', 'b', 'a'], + "--exists-action", + dest="exists_action", + type="choice", + choices=["s", "i", "w", "b", "a"], default=[], - action='append', - metavar='action', + action="append", + metavar="action", help="Default action when a path already exists: " - "(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.", + "(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.", ) cert = partial( PipOption, - '--cert', - dest='cert', - type='path', - metavar='path', + "--cert", + dest="cert", + type="path", + metavar="path", help="Path to alternate CA bundle.", ) # type: Callable[..., Option] client_cert = partial( PipOption, - '--client-cert', - dest='client_cert', - type='path', + "--client-cert", + dest="client_cert", + type="path", default=None, - metavar='path', + metavar="path", help="Path to SSL client certificate, a single file containing the " - "private key and the certificate in PEM format.", + "private key and the certificate in PEM format.", ) # type: Callable[..., Option] index_url = partial( Option, - '-i', '--index-url', '--pypi-url', - dest='index_url', - metavar='URL', + "-i", + "--index-url", + "--pypi-url", + dest="index_url", + metavar="URL", default=PyPI.simple_url, help="Base URL of the Python Package Index (default %default). " - "This should point to a repository compliant with PEP 503 " - "(the simple repository API) or a local directory laid out " - "in the same format.", + "This should point to a repository compliant with PEP 503 " + "(the simple repository API) or a local directory laid out " + "in the same format.", ) # type: Callable[..., Option] def extra_index_url(): # type: () -> Option return Option( - '--extra-index-url', - dest='extra_index_urls', - metavar='URL', - action='append', + "--extra-index-url", + dest="extra_index_urls", + metavar="URL", + action="append", default=[], help="Extra URLs of package indexes to use in addition to " - "--index-url. Should follow the same rules as " - "--index-url.", + "--index-url. Should follow the same rules as " + "--index-url.", ) no_index = partial( Option, - '--no-index', - dest='no_index', - action='store_true', + "--no-index", + dest="no_index", + action="store_true", default=False, - help='Ignore package index (only looking at --find-links URLs instead).', + help="Ignore package index (only looking at --find-links URLs instead).", ) # type: Callable[..., Option] def find_links(): # type: () -> Option return Option( - '-f', '--find-links', - dest='find_links', - action='append', + "-f", + "--find-links", + dest="find_links", + action="append", default=[], - metavar='url', + metavar="url", help="If a URL or path to an html file, then parse for links to " - "archives such as sdist (.tar.gz) or wheel (.whl) files. " - "If a local path or file:// URL that's a directory, " - "then look for archives in the directory listing. " - "Links to VCS project URLs are not supported.", + "archives such as sdist (.tar.gz) or wheel (.whl) files. " + "If a local path or file:// URL that's a directory, " + "then look for archives in the directory listing. " + "Links to VCS project URLs are not supported.", ) @@ -373,46 +388,51 @@ def trusted_host(): metavar="HOSTNAME", default=[], help="Mark this host or host:port pair as trusted, even though it " - "does not have valid or any HTTPS.", + "does not have valid or any HTTPS.", ) def constraints(): # type: () -> Option return Option( - '-c', '--constraint', - dest='constraints', - action='append', + "-c", + "--constraint", + dest="constraints", + action="append", default=[], - metavar='file', - help='Constrain versions using the given constraints file. ' - 'This option can be used multiple times.' + metavar="file", + help="Constrain versions using the given constraints file. " + "This option can be used multiple times.", ) def requirements(): # type: () -> Option return Option( - '-r', '--requirement', - dest='requirements', - action='append', + "-r", + "--requirement", + dest="requirements", + action="append", default=[], - metavar='file', - help='Install from the given requirements file. ' - 'This option can be used multiple times.' + metavar="file", + help="Install from the given requirements file. " + "This option can be used multiple times.", ) def editable(): # type: () -> Option return Option( - '-e', '--editable', - dest='editables', - action='append', + "-e", + "--editable", + dest="editables", + action="append", default=[], - metavar='path/url', - help=('Install a project in editable mode (i.e. setuptools ' - '"develop mode") from a local project path or a VCS url.'), + metavar="path/url", + help=( + "Install a project in editable mode (i.e. setuptools " + '"develop mode") from a local project path or a VCS url.' + ), ) @@ -424,16 +444,19 @@ def _handle_src(option, opt_str, value, parser): src = partial( PipOption, - '--src', '--source', '--source-dir', '--source-directory', - dest='src_dir', - type='path', - metavar='dir', + "--src", + "--source", + "--source-dir", + "--source-directory", + dest="src_dir", + type="path", + metavar="dir", default=get_src_prefix(), - action='callback', + action="callback", callback=_handle_src, - help='Directory to check out editable projects into. ' + help="Directory to check out editable projects into. " 'The default in a virtualenv is "/src". ' - 'The default for global installs is "/src".' + 'The default for global installs is "/src".', ) # type: Callable[..., Option] @@ -447,7 +470,9 @@ def _handle_no_binary(option, opt_str, value, parser): # type: (Option, str, str, OptionParser) -> None existing = _get_format_control(parser.values, option) FormatControl.handle_mutual_excludes( - value, existing.no_binary, existing.only_binary, + value, + existing.no_binary, + existing.only_binary, ) @@ -455,7 +480,9 @@ def _handle_only_binary(option, opt_str, value, parser): # type: (Option, str, str, OptionParser) -> None existing = _get_format_control(parser.values, option) FormatControl.handle_mutual_excludes( - value, existing.only_binary, existing.no_binary, + value, + existing.only_binary, + existing.no_binary, ) @@ -463,15 +490,18 @@ def no_binary(): # type: () -> Option format_control = FormatControl(set(), set()) return Option( - "--no-binary", dest="format_control", action="callback", - callback=_handle_no_binary, type="str", + "--no-binary", + dest="format_control", + action="callback", + callback=_handle_no_binary, + type="str", default=format_control, - help='Do not use binary packages. Can be supplied multiple times, and ' - 'each time adds to the existing value. Accepts either ":all:" to ' - 'disable all binary packages, ":none:" to empty the set (notice ' - 'the colons), or one or more package names with commas between ' - 'them (no colons). Note that some packages are tricky to compile ' - 'and may fail to install when this option is used on them.', + help="Do not use binary packages. Can be supplied multiple times, and " + 'each time adds to the existing value. Accepts either ":all:" to ' + 'disable all binary packages, ":none:" to empty the set (notice ' + "the colons), or one or more package names with commas between " + "them (no colons). Note that some packages are tricky to compile " + "and may fail to install when this option is used on them.", ) @@ -479,26 +509,31 @@ def only_binary(): # type: () -> Option format_control = FormatControl(set(), set()) return Option( - "--only-binary", dest="format_control", action="callback", - callback=_handle_only_binary, type="str", + "--only-binary", + dest="format_control", + action="callback", + callback=_handle_only_binary, + type="str", default=format_control, - help='Do not use source packages. Can be supplied multiple times, and ' - 'each time adds to the existing value. Accepts either ":all:" to ' - 'disable all source packages, ":none:" to empty the set, or one ' - 'or more package names with commas between them. Packages ' - 'without binary distributions will fail to install when this ' - 'option is used on them.', + help="Do not use source packages. Can be supplied multiple times, and " + 'each time adds to the existing value. Accepts either ":all:" to ' + 'disable all source packages, ":none:" to empty the set, or one ' + "or more package names with commas between them. Packages " + "without binary distributions will fail to install when this " + "option is used on them.", ) platform = partial( Option, - '--platform', - dest='platform', - metavar='platform', + "--platform", + dest="platform", + metavar="platform", default=None, - help=("Only use wheels compatible with . " - "Defaults to the platform of the running system."), + help=( + "Only use wheels compatible with . " + "Defaults to the platform of the running system." + ), ) # type: Callable[..., Option] @@ -515,9 +550,9 @@ def _convert_python_version(value): # The empty string is the same as not providing a value. return (None, None) - parts = value.split('.') + parts = value.split(".") if len(parts) > 3: - return ((), 'at most three version parts are allowed') + return ((), "at most three version parts are allowed") if len(parts) == 1: # Then we are in the case of "3" or "37". @@ -528,7 +563,7 @@ def _convert_python_version(value): try: version_info = tuple(int(part) for part in parts) except ValueError: - return ((), 'each version part must be an integer') + return ((), "each version part must be an integer") return (version_info, None) @@ -540,10 +575,9 @@ def _handle_python_version(option, opt_str, value, parser): """ version_info, error_msg = _convert_python_version(value) if error_msg is not None: - msg = ( - 'invalid --python-version value: {!r}: {}'.format( - value, error_msg, - ) + msg = "invalid --python-version value: {!r}: {}".format( + value, + error_msg, ) raise_option_error(parser, option=option, msg=msg) @@ -552,48 +586,55 @@ def _handle_python_version(option, opt_str, value, parser): python_version = partial( Option, - '--python-version', - dest='python_version', - metavar='python_version', - action='callback', - callback=_handle_python_version, type='str', + "--python-version", + dest="python_version", + metavar="python_version", + action="callback", + callback=_handle_python_version, + type="str", default=None, - help=dedent("""\ + help=dedent( + """\ The Python interpreter version to use for wheel and "Requires-Python" compatibility checks. Defaults to a version derived from the running interpreter. The version can be specified using up to three dot-separated integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor version can also be given as a string without dots (e.g. "37" for 3.7.0). - """), + """ + ), ) # type: Callable[..., Option] implementation = partial( Option, - '--implementation', - dest='implementation', - metavar='implementation', + "--implementation", + dest="implementation", + metavar="implementation", default=None, - help=("Only use wheels compatible with Python " - "implementation , e.g. 'pp', 'jy', 'cp', " - " or 'ip'. If not specified, then the current " - "interpreter implementation is used. Use 'py' to force " - "implementation-agnostic wheels."), + help=( + "Only use wheels compatible with Python " + "implementation , e.g. 'pp', 'jy', 'cp', " + " or 'ip'. If not specified, then the current " + "interpreter implementation is used. Use 'py' to force " + "implementation-agnostic wheels." + ), ) # type: Callable[..., Option] abi = partial( Option, - '--abi', - dest='abi', - metavar='abi', + "--abi", + dest="abi", + metavar="abi", default=None, - help=("Only use wheels compatible with Python " - "abi , e.g. 'pypy_41'. If not specified, then the " - "current interpreter abi tag is used. Generally " - "you will need to specify --implementation, " - "--platform, and --python-version when using " - "this option."), + help=( + "Only use wheels compatible with Python " + "abi , e.g. 'pypy_41'. If not specified, then the " + "current interpreter abi tag is used. Generally " + "you will need to specify --implementation, " + "--platform, and --python-version when using " + "this option." + ), ) # type: Callable[..., Option] @@ -624,7 +665,7 @@ def prefer_binary(): dest="prefer_binary", action="store_true", default=False, - help="Prefer older binary packages over newer source packages." + help="Prefer older binary packages over newer source packages.", ) @@ -634,8 +675,8 @@ def prefer_binary(): dest="cache_dir", default=USER_CACHE_DIR, metavar="dir", - type='path', - help="Store the cache data in ." + type="path", + help="Store the cache data in .", ) # type: Callable[..., Option] @@ -678,9 +719,10 @@ def _handle_no_cache_dir(option, opt, value, parser): no_deps = partial( Option, - '--no-deps', '--no-dependencies', - dest='ignore_dependencies', - action='store_true', + "--no-deps", + "--no-dependencies", + dest="ignore_dependencies", + action="store_true", default=False, help="Don't install package dependencies.", ) # type: Callable[..., Option] @@ -695,36 +737,39 @@ def _handle_build_dir(option, opt, value, parser): build_dir = partial( PipOption, - '-b', '--build', '--build-dir', '--build-directory', - dest='build_dir', - type='path', - metavar='dir', - action='callback', + "-b", + "--build", + "--build-dir", + "--build-directory", + dest="build_dir", + type="path", + metavar="dir", + action="callback", callback=_handle_build_dir, - help='Directory to unpack packages into and build in. Note that ' - 'an initial build still takes place in a temporary directory. ' - 'The location of temporary directories can be controlled by setting ' - 'the TMPDIR environment variable (TEMP on Windows) appropriately. ' - 'When passed, build directories are not cleaned in case of failures.' + help="Directory to unpack packages into and build in. Note that " + "an initial build still takes place in a temporary directory. " + "The location of temporary directories can be controlled by setting " + "the TMPDIR environment variable (TEMP on Windows) appropriately. " + "When passed, build directories are not cleaned in case of failures.", ) # type: Callable[..., Option] ignore_requires_python = partial( Option, - '--ignore-requires-python', - dest='ignore_requires_python', - action='store_true', - help='Ignore the Requires-Python information.' + "--ignore-requires-python", + dest="ignore_requires_python", + action="store_true", + help="Ignore the Requires-Python information.", ) # type: Callable[..., Option] no_build_isolation = partial( Option, - '--no-build-isolation', - dest='build_isolation', - action='store_false', + "--no-build-isolation", + dest="build_isolation", + action="store_false", default=True, - help='Disable isolation when building a modern source distribution. ' - 'Build dependencies specified by PEP 518 must be already installed ' - 'if this option is used.' + help="Disable isolation when building a modern source distribution. " + "Build dependencies specified by PEP 518 must be already installed " + "if this option is used.", ) # type: Callable[..., Option] @@ -754,62 +799,62 @@ def _handle_no_use_pep517(option, opt, value, parser): use_pep517 = partial( Option, - '--use-pep517', - dest='use_pep517', - action='store_true', + "--use-pep517", + dest="use_pep517", + action="store_true", default=None, - help='Use PEP 517 for building source distributions ' - '(use --no-use-pep517 to force legacy behaviour).' + help="Use PEP 517 for building source distributions " + "(use --no-use-pep517 to force legacy behaviour).", ) # type: Any no_use_pep517 = partial( Option, - '--no-use-pep517', - dest='use_pep517', - action='callback', + "--no-use-pep517", + dest="use_pep517", + action="callback", callback=_handle_no_use_pep517, default=None, - help=SUPPRESS_HELP + help=SUPPRESS_HELP, ) # type: Any install_options = partial( Option, - '--install-option', - dest='install_options', - action='append', - metavar='options', + "--install-option", + dest="install_options", + action="append", + metavar="options", help="Extra arguments to be supplied to the setup.py install " - "command (use like --install-option=\"--install-scripts=/usr/local/" - "bin\"). Use multiple --install-option options to pass multiple " - "options to setup.py install. If you are using an option with a " - "directory path, be sure to use absolute path.", + 'command (use like --install-option="--install-scripts=/usr/local/' + 'bin"). Use multiple --install-option options to pass multiple ' + "options to setup.py install. If you are using an option with a " + "directory path, be sure to use absolute path.", ) # type: Callable[..., Option] global_options = partial( Option, - '--global-option', - dest='global_options', - action='append', - metavar='options', + "--global-option", + dest="global_options", + action="append", + metavar="options", help="Extra global options to be supplied to the setup.py " - "call before the install command.", + "call before the install command.", ) # type: Callable[..., Option] no_clean = partial( Option, - '--no-clean', - action='store_true', + "--no-clean", + action="store_true", default=False, - help="Don't clean up build directories." + help="Don't clean up build directories.", ) # type: Callable[..., Option] pre = partial( Option, - '--pre', - action='store_true', + "--pre", + action="store_true", default=False, help="Include pre-release and development versions. By default, " - "pip only finds stable versions.", + "pip only finds stable versions.", ) # type: Callable[..., Option] disable_pip_version_check = partial( @@ -819,16 +864,17 @@ def _handle_no_use_pep517(option, opt, value, parser): action="store_true", default=False, help="Don't periodically check PyPI to determine whether a new version " - "of pip is available for download. Implied with --no-index.", + "of pip is available for download. Implied with --no-index.", ) # type: Callable[..., Option] # Deprecated, Remove later always_unzip = partial( Option, - '-Z', '--always-unzip', - dest='always_unzip', - action='store_true', + "-Z", + "--always-unzip", + dest="always_unzip", + action="store_true", help=SUPPRESS_HELP, ) # type: Callable[..., Option] @@ -840,80 +886,83 @@ def _handle_merge_hash(option, opt_str, value, parser): if not parser.values.hashes: parser.values.hashes = {} try: - algo, digest = value.split(':', 1) + algo, digest = value.split(":", 1) except ValueError: - parser.error('Arguments to {} must be a hash name ' - 'followed by a value, like --hash=sha256:' - 'abcde...'.format(opt_str)) + parser.error( + "Arguments to {} must be a hash name " + "followed by a value, like --hash=sha256:" + "abcde...".format(opt_str) + ) if algo not in STRONG_HASHES: - parser.error('Allowed hash algorithms for {} are {}.'.format( - opt_str, ', '.join(STRONG_HASHES))) + parser.error( + "Allowed hash algorithms for {} are {}.".format( + opt_str, ", ".join(STRONG_HASHES) + ) + ) parser.values.hashes.setdefault(algo, []).append(digest) hash = partial( Option, - '--hash', + "--hash", # Hash values eventually end up in InstallRequirement.hashes due to # __dict__ copying in process_line(). - dest='hashes', - action='callback', + dest="hashes", + action="callback", callback=_handle_merge_hash, - type='string', + type="string", help="Verify that the package's archive matches this " - 'hash before installing. Example: --hash=sha256:abcdef...', + "hash before installing. Example: --hash=sha256:abcdef...", ) # type: Callable[..., Option] require_hashes = partial( Option, - '--require-hashes', - dest='require_hashes', - action='store_true', + "--require-hashes", + dest="require_hashes", + action="store_true", default=False, - help='Require a hash to check each requirement against, for ' - 'repeatable installs. This option is implied when any package in a ' - 'requirements file has a --hash option.', + help="Require a hash to check each requirement against, for " + "repeatable installs. This option is implied when any package in a " + "requirements file has a --hash option.", ) # type: Callable[..., Option] list_path = partial( PipOption, - '--path', - dest='path', - type='path', - action='append', - help='Restrict to the specified installation path for listing ' - 'packages (can be used multiple times).' + "--path", + dest="path", + type="path", + action="append", + help="Restrict to the specified installation path for listing " + "packages (can be used multiple times).", ) # type: Callable[..., Option] def check_list_path_option(options): # type: (Values) -> None if options.path and (options.user or options.local): - raise CommandError( - "Cannot combine '--path' with '--user' or '--local'" - ) + raise CommandError("Cannot combine '--path' with '--user' or '--local'") no_python_version_warning = partial( Option, - '--no-python-version-warning', - dest='no_python_version_warning', - action='store_true', + "--no-python-version-warning", + dest="no_python_version_warning", + action="store_true", default=False, - help='Silence deprecation warnings for upcoming unsupported Pythons.', + help="Silence deprecation warnings for upcoming unsupported Pythons.", ) # type: Callable[..., Option] unstable_feature = partial( Option, - '--unstable-feature', - dest='unstable_features', - metavar='feature', - action='append', + "--unstable-feature", + dest="unstable_features", + metavar="feature", + action="append", default=[], - choices=['resolver'], + choices=["resolver"], help=SUPPRESS_HELP, # TODO: Enable this when the resolver actually works. # help='Enable unstable feature(s) that may be backward incompatible.', ) # type: Callable[..., Option] @@ -924,8 +973,8 @@ def check_list_path_option(options): ########## general_group = { - 'name': 'General Options', - 'options': [ + "name": "General Options", + "options": [ help_, isolated_mode, require_virtualenv, @@ -947,15 +996,15 @@ def check_list_path_option(options): no_color, no_python_version_warning, unstable_feature, - ] + ], } # type: Dict[str, Any] index_group = { - 'name': 'Package Index Options', - 'options': [ + "name": "Package Index Options", + "options": [ index_url, extra_index_url, no_index, find_links, - ] + ], } # type: Dict[str, Any] diff --git a/src/fetchcode/vcs/pip/_internal/cli/command_context.py b/src/fetchcode/vcs/pip/_internal/cli/command_context.py index 2cd6e8db..72ef202f 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/command_context.py +++ b/src/fetchcode/vcs/pip/_internal/cli/command_context.py @@ -7,7 +7,7 @@ if MYPY_CHECK_RUNNING: from typing import Iterator, ContextManager, TypeVar - _T = TypeVar('_T', covariant=True) + _T = TypeVar("_T", covariant=True) class CommandContextMixIn(object): diff --git a/src/fetchcode/vcs/pip/_internal/cli/main.py b/src/fetchcode/vcs/pip/_internal/cli/main.py index 1a73fa15..0d1b709e 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/main.py +++ b/src/fetchcode/vcs/pip/_internal/cli/main.py @@ -45,6 +45,7 @@ # call to main. As it is not safe to do any processing after calling # main, this should not be an issue in practice. + def main(args=None): # type: (Optional[List[str]]) -> int if args is None: @@ -65,7 +66,7 @@ def main(args=None): # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: - locale.setlocale(locale.LC_ALL, '') + locale.setlocale(locale.LC_ALL, "") except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) diff --git a/src/fetchcode/vcs/pip/_internal/cli/main_parser.py b/src/fetchcode/vcs/pip/_internal/cli/main_parser.py index b464f43e..874b4ea5 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/main_parser.py +++ b/src/fetchcode/vcs/pip/_internal/cli/main_parser.py @@ -23,15 +23,14 @@ def create_main_parser(): # type: () -> ConfigOptionParser - """Creates and returns the main parser for pip's CLI - """ + """Creates and returns the main parser for pip's CLI""" parser_kw = { - 'usage': '\n%prog [options]', - 'add_help_option': False, - 'formatter': UpdatingDefaultsHelpFormatter(), - 'name': 'global', - 'prog': get_prog(), + "usage": "\n%prog [options]", + "add_help_option": False, + "formatter": UpdatingDefaultsHelpFormatter(), + "name": "global", + "prog": get_prog(), } parser = ConfigOptionParser(**parser_kw) @@ -47,11 +46,11 @@ def create_main_parser(): parser.main = True # type: ignore # create command listing for description - description = [''] + [ - '{name:27} {command_info.summary}'.format(**locals()) + description = [""] + [ + "{name:27} {command_info.summary}".format(**locals()) for name, command_info in commands_dict.items() ] - parser.description = '\n'.join(description) + parser.description = "\n".join(description) return parser @@ -76,7 +75,7 @@ def parse_command(args): sys.exit() # pip || pip help -> print_help() - if not args_else or (args_else[0] == 'help' and len(args_else) == 1): + if not args_else or (args_else[0] == "help" and len(args_else) == 1): parser.print_help() sys.exit() @@ -90,7 +89,7 @@ def parse_command(args): if guess: msg.append('maybe you meant "{}"'.format(guess)) - raise CommandError(' - '.join(msg)) + raise CommandError(" - ".join(msg)) # all the args without the subcommand cmd_args = args[:] diff --git a/src/fetchcode/vcs/pip/_internal/cli/parser.py b/src/fetchcode/vcs/pip/_internal/cli/parser.py index 7fe79864..c49c40fd 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/parser.py +++ b/src/fetchcode/vcs/pip/_internal/cli/parser.py @@ -24,15 +24,15 @@ class PrettyHelpFormatter(optparse.IndentedHelpFormatter): def __init__(self, *args, **kwargs): # help position must be aligned with __init__.parseopts.description - kwargs['max_help_position'] = 30 - kwargs['indent_increment'] = 1 - kwargs['width'] = get_terminal_size()[0] - 2 + kwargs["max_help_position"] = 30 + kwargs["indent_increment"] = 1 + kwargs["width"] = get_terminal_size()[0] - 2 optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) def format_option_strings(self, option): return self._format_option_strings(option) - def _format_option_strings(self, option, mvarfmt=' <{}>', optsep=', '): + def _format_option_strings(self, option, mvarfmt=" <{}>", optsep=", "): """ Return a comma-separated list of option strings and metavars. @@ -53,49 +53,48 @@ def _format_option_strings(self, option, mvarfmt=' <{}>', optsep=', '): metavar = option.metavar or option.dest.lower() opts.append(mvarfmt.format(metavar.lower())) - return ''.join(opts) + return "".join(opts) def format_heading(self, heading): - if heading == 'Options': - return '' - return heading + ':\n' + if heading == "Options": + return "" + return heading + ":\n" def format_usage(self, usage): """ Ensure there is only one newline between usage and the first heading if there is no description. """ - msg = '\nUsage: {}\n'.format( - self.indent_lines(textwrap.dedent(usage), " ")) + msg = "\nUsage: {}\n".format(self.indent_lines(textwrap.dedent(usage), " ")) return msg def format_description(self, description): # leave full control over description to us if description: - if hasattr(self.parser, 'main'): - label = 'Commands' + if hasattr(self.parser, "main"): + label = "Commands" else: - label = 'Description' + label = "Description" # some doc strings have initial newlines, some don't - description = description.lstrip('\n') + description = description.lstrip("\n") # some doc strings have final newlines and spaces, some don't description = description.rstrip() # dedent, then reindent description = self.indent_lines(textwrap.dedent(description), " ") - description = '{}:\n{}\n'.format(label, description) + description = "{}:\n{}\n".format(label, description) return description else: - return '' + return "" def format_epilog(self, epilog): # leave full control over epilog to us if epilog: return epilog else: - return '' + return "" def indent_lines(self, text, indent): - new_lines = [indent + line for line in text.split('\n')] + new_lines = [indent + line for line in text.split("\n")] return "\n".join(new_lines) @@ -113,7 +112,6 @@ def expand_default(self, option): class CustomOptionParser(optparse.OptionParser): - def insert_option_group(self, idx, *args, **kwargs): """Insert an OptionGroup at a given position.""" group = self.add_option_group(*args, **kwargs) @@ -138,7 +136,7 @@ class ConfigOptionParser(CustomOptionParser): configuration files and environmental variables""" def __init__(self, *args, **kwargs): - self.name = kwargs.pop('name') + self.name = kwargs.pop("name") isolated = kwargs.pop("isolated", False) self.config = Configuration(isolated) @@ -164,7 +162,7 @@ def _get_ordered_configuration_items(self): if not val: logger.debug( "Ignoring configuration key '%s' as it's value is empty.", - section_key + section_key, ) continue @@ -188,7 +186,7 @@ def _update_defaults(self, defaults): # Then set the options with those values for key, val in self._get_ordered_configuration_items(): # '--' because configuration supports only long names - option = self.get_option('--' + key) + option = self.get_option("--" + key) # Ignore options not present in this parser. E.g. non-globals put # in [global] by users that want them to apply to all applicable @@ -196,19 +194,17 @@ def _update_defaults(self, defaults): if option is None: continue - if option.action in ('store_true', 'store_false', 'count'): + if option.action in ("store_true", "store_false", "count"): try: val = strtobool(val) except ValueError: - error_msg = invalid_config_error_message( - option.action, key, val - ) + error_msg = invalid_config_error_message(option.action, key, val) self.error(error_msg) - elif option.action == 'append': + elif option.action == "append": val = val.split() val = [self.check_default(option, key, v) for v in val] - elif option.action == 'callback': + elif option.action == "callback": late_eval.add(option.dest) opt_str = option.get_opt_string() val = option.convert_value(opt_str, val) @@ -255,11 +251,15 @@ def error(self, msg): def invalid_config_error_message(action, key, val): """Returns a better error message when invalid configuration option is provided.""" - if action in ('store_true', 'store_false'): - return ("{0} is not a valid value for {1} option, " - "please specify a boolean value like yes/no, " - "true/false or 1/0 instead.").format(val, key) - - return ("{0} is not a valid value for {1} option, " - "please specify a numerical value like 1/0 " - "instead.").format(val, key) + if action in ("store_true", "store_false"): + return ( + "{0} is not a valid value for {1} option, " + "please specify a boolean value like yes/no, " + "true/false or 1/0 instead." + ).format(val, key) + + return ( + "{0} is not a valid value for {1} option, " + "please specify a numerical value like 1/0 " + "instead." + ).format(val, key) diff --git a/src/fetchcode/vcs/pip/_internal/cli/progress_bars.py b/src/fetchcode/vcs/pip/_internal/cli/progress_bars.py index 9fe7a2a8..1a0df77f 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/progress_bars.py +++ b/src/fetchcode/vcs/pip/_internal/cli/progress_bars.py @@ -1,10 +1,13 @@ - import itertools import sys from signal import SIGINT, default_int_handler, signal from fetchcode.vcs.pip._vendor import six -from fetchcode.vcs.pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar +from fetchcode.vcs.pip._vendor.progress.bar import ( + Bar, + FillingCirclesBar, + IncrementalBar, +) from fetchcode.vcs.pip._vendor.progress.spinner import Spinner from fetchcode.vcs.pip._internal.utils.compat import WINDOWS @@ -77,10 +80,7 @@ def __init__(self, *args, **kwargs): """ Save the original SIGINT handler for later. """ - super(InterruptibleMixin, self).__init__( # type: ignore - *args, - **kwargs - ) + super(InterruptibleMixin, self).__init__(*args, **kwargs) # type: ignore self.original_handler = signal(SIGINT, self.handle_sigint) @@ -115,7 +115,6 @@ def handle_sigint(self, signum, frame): # type: ignore class SilentBar(Bar): - def update(self): # type: () -> None pass @@ -126,20 +125,14 @@ class BlueEmojiBar(IncrementalBar): suffix = "%(percent)d%%" bar_prefix = " " bar_suffix = " " - phases = (u"\U0001F539", u"\U0001F537", u"\U0001F535") # type: Any + phases = ("\U0001F539", "\U0001F537", "\U0001F535") # type: Any class DownloadProgressMixin(object): - def __init__(self, *args, **kwargs): # type: (List[Any], Dict[Any, Any]) -> None - super(DownloadProgressMixin, self).__init__( # type: ignore - *args, - **kwargs - ) - self.message = (" " * ( - get_indentation() + 2 - )) + self.message # type: str + super(DownloadProgressMixin, self).__init__(*args, **kwargs) # type: ignore + self.message = (" " * (get_indentation() + 2)) + self.message # type: str @property def downloaded(self): @@ -169,7 +162,6 @@ def iter(self, it): # type: ignore class WindowsMixin(object): - def __init__(self, *args, **kwargs): # type: (List[Any], Dict[Any, Any]) -> None # The Windows terminal does not support the hide/show cursor ANSI codes @@ -198,19 +190,18 @@ def __init__(self, *args, **kwargs): self.file.flush = lambda: self.file.wrapped.flush() -class BaseDownloadProgressBar(WindowsMixin, InterruptibleMixin, - DownloadProgressMixin): +class BaseDownloadProgressBar(WindowsMixin, InterruptibleMixin, DownloadProgressMixin): file = sys.stdout message = "%(percent)d%%" suffix = "%(downloaded)s %(download_speed)s %(pretty_eta)s" + # NOTE: The "type: ignore" comments on the following classes are there to # work around https://github.com/python/typing/issues/241 -class DefaultDownloadProgressBar(BaseDownloadProgressBar, - _BaseBar): +class DefaultDownloadProgressBar(BaseDownloadProgressBar, _BaseBar): pass @@ -218,23 +209,25 @@ class DownloadSilentBar(BaseDownloadProgressBar, SilentBar): # type: ignore pass -class DownloadBar(BaseDownloadProgressBar, # type: ignore - Bar): +class DownloadBar(BaseDownloadProgressBar, Bar): # type: ignore pass -class DownloadFillingCirclesBar(BaseDownloadProgressBar, # type: ignore - FillingCirclesBar): +class DownloadFillingCirclesBar( + BaseDownloadProgressBar, FillingCirclesBar # type: ignore +): pass -class DownloadBlueEmojiProgressBar(BaseDownloadProgressBar, # type: ignore - BlueEmojiBar): +class DownloadBlueEmojiProgressBar( + BaseDownloadProgressBar, BlueEmojiBar # type: ignore +): pass -class DownloadProgressSpinner(WindowsMixin, InterruptibleMixin, - DownloadProgressMixin, Spinner): +class DownloadProgressSpinner( + WindowsMixin, InterruptibleMixin, DownloadProgressMixin, Spinner +): file = sys.stdout suffix = "%(downloaded)s %(download_speed)s" @@ -249,13 +242,15 @@ def update(self): message = self.message % self phase = self.next_phase() suffix = self.suffix % self - line = ''.join([ - message, - " " if message else "", - phase, - " " if suffix else "", - suffix, - ]) + line = "".join( + [ + message, + " " if message else "", + phase, + " " if suffix else "", + suffix, + ] + ) self.writeln(line) @@ -265,7 +260,7 @@ def update(self): "on": (DefaultDownloadProgressBar, DownloadProgressSpinner), "ascii": (DownloadBar, DownloadProgressSpinner), "pretty": (DownloadFillingCirclesBar, DownloadProgressSpinner), - "emoji": (DownloadBlueEmojiProgressBar, DownloadProgressSpinner) + "emoji": (DownloadBlueEmojiProgressBar, DownloadProgressSpinner), } diff --git a/src/fetchcode/vcs/pip/_internal/cli/req_command.py b/src/fetchcode/vcs/pip/_internal/cli/req_command.py index f442ed8e..a75c586b 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/req_command.py +++ b/src/fetchcode/vcs/pip/_internal/cli/req_command.py @@ -56,6 +56,7 @@ class SessionCommandMixin(CommandContextMixIn): """ A class mixin for command classes needing _build_session(). """ + def __init__(self): # type: () -> None super(SessionCommandMixin, self).__init__() @@ -92,8 +93,7 @@ def _build_session(self, options, retries=None, timeout=None): assert not options.cache_dir or os.path.isabs(options.cache_dir) session = PipSession( cache=( - os.path.join(options.cache_dir, "http") - if options.cache_dir else None + os.path.join(options.cache_dir, "http") if options.cache_dir else None ), retries=retries if retries is not None else options.retries, trusted_hosts=options.trusted_hosts, @@ -110,9 +110,7 @@ def _build_session(self, options, retries=None, timeout=None): # Handle timeouts if options.timeout or timeout: - session.timeout = ( - timeout if timeout is not None else options.timeout - ) + session.timeout = timeout if timeout is not None else options.timeout # Handle configured proxies if options.proxy: @@ -143,16 +141,14 @@ def handle_pip_version_check(self, options): This overrides the default behavior of not doing the check. """ # Make sure the index_group options are present. - assert hasattr(options, 'no_index') + assert hasattr(options, "no_index") if options.disable_pip_version_check or options.no_index: return # Otherwise, check if we're using the latest version of pip available. session = self._build_session( - options, - retries=0, - timeout=min(5, options.timeout) + options, retries=0, timeout=min(5, options.timeout) ) with session: pip_self_version_check(session, options) @@ -170,6 +166,7 @@ def with_cleanup(func): """Decorator for common logic related to managing temporary directories. """ + def configure_tempdir_registry(registry): # type: (TempDirectoryTypeRegistry) -> None for t in KEEPABLE_TEMPDIR_TYPES: @@ -194,7 +191,6 @@ def wrapper(self, options, args): class RequirementCommand(IndexGroupCommand): - def __init__(self, *args, **kw): # type: (Any, Any) -> None super(RequirementCommand, self).__init__(*args, **kw) @@ -203,13 +199,13 @@ def __init__(self, *args, **kw): @staticmethod def make_requirement_preparer( - temp_build_dir, # type: TempDirectory - options, # type: Values - req_tracker, # type: RequirementTracker - session, # type: PipSession - finder, # type: PackageFinder - use_user_site, # type: bool - download_dir=None, # type: str + temp_build_dir, # type: TempDirectory + options, # type: Values + req_tracker, # type: RequirementTracker + session, # type: PipSession + finder, # type: PackageFinder + use_user_site, # type: bool + download_dir=None, # type: str wheel_download_dir=None, # type: str ): # type: (...) -> RequirementPreparer @@ -236,17 +232,17 @@ def make_requirement_preparer( @staticmethod def make_resolver( - preparer, # type: RequirementPreparer - finder, # type: PackageFinder - options, # type: Values - wheel_cache=None, # type: Optional[WheelCache] - use_user_site=False, # type: bool - ignore_installed=True, # type: bool - ignore_requires_python=False, # type: bool - force_reinstall=False, # type: bool + preparer, # type: RequirementPreparer + finder, # type: PackageFinder + options, # type: Values + wheel_cache=None, # type: Optional[WheelCache] + use_user_site=False, # type: bool + ignore_installed=True, # type: bool + ignore_requires_python=False, # type: bool + force_reinstall=False, # type: bool upgrade_strategy="to-satisfy-only", # type: str - use_pep517=None, # type: Optional[bool] - py_version_info=None # type: Optional[Tuple[int, ...]] + use_pep517=None, # type: Optional[bool] + py_version_info=None, # type: Optional[Tuple[int, ...]] ): # type: (...) -> BaseResolver """ @@ -260,8 +256,9 @@ def make_resolver( # The long import name and duplicated invocation is needed to convince # Mypy into correctly typechecking. Otherwise it would complain the # "Resolver" class being redefined. - if 'resolver' in options.unstable_features: + if "resolver" in options.unstable_features: import fetchcode.vcs.pip._internal.resolution.resolvelib.resolver + return pip._internal.resolution.resolvelib.resolver.Resolver( preparer=preparer, finder=finder, @@ -276,6 +273,7 @@ def make_resolver( py_version_info=py_version_info, ) import fetchcode.vcs.pip._internal.resolution.legacy.resolver + return pip._internal.resolution.legacy.resolver.Resolver( preparer=preparer, finder=finder, @@ -292,24 +290,25 @@ def make_resolver( def get_requirements( self, - args, # type: List[str] - options, # type: Values - finder, # type: PackageFinder - session, # type: PipSession + args, # type: List[str] + options, # type: Values + finder, # type: PackageFinder + session, # type: PipSession check_supported_wheels=True, # type: bool ): # type: (...) -> List[InstallRequirement] """ Parse command-line arguments into the corresponding requirements. """ - requirement_set = RequirementSet( - check_supported_wheels=check_supported_wheels - ) + requirement_set = RequirementSet(check_supported_wheels=check_supported_wheels) for filename in options.constraints: for parsed_req in parse_requirements( - filename, - constraint=True, finder=finder, options=options, - session=session): + filename, + constraint=True, + finder=finder, + options=options, + session=session, + ): req_to_add = install_req_from_parsed_requirement( parsed_req, isolated=options.isolated_mode, @@ -319,7 +318,9 @@ def get_requirements( for req in args: req_to_add = install_req_from_line( - req, None, isolated=options.isolated_mode, + req, + None, + isolated=options.isolated_mode, use_pep517=options.use_pep517, ) req_to_add.is_direct = True @@ -337,12 +338,12 @@ def get_requirements( # NOTE: options.require_hashes may be set if --require-hashes is True for filename in options.requirements: for parsed_req in parse_requirements( - filename, - finder=finder, options=options, session=session): + filename, finder=finder, options=options, session=session + ): req_to_add = install_req_from_parsed_requirement( parsed_req, isolated=options.isolated_mode, - use_pep517=options.use_pep517 + use_pep517=options.use_pep517, ) req_to_add.is_direct = True requirement_set.add_requirement(req_to_add) @@ -353,16 +354,19 @@ def get_requirements( options.require_hashes = True if not (args or options.editables or options.requirements): - opts = {'name': self.name} + opts = {"name": self.name} if options.find_links: raise CommandError( - 'You must give at least one requirement to {name} ' + "You must give at least one requirement to {name} " '(maybe you meant "pip {name} {links}"?)'.format( - **dict(opts, links=' '.join(options.find_links)))) + **dict(opts, links=" ".join(options.find_links)) + ) + ) else: raise CommandError( - 'You must give at least one requirement to {name} ' - '(see "pip help {name}")'.format(**opts)) + "You must give at least one requirement to {name} " + '(see "pip help {name}")'.format(**opts) + ) return requirements @@ -380,9 +384,9 @@ def trace_basic_info(finder): def _build_package_finder( self, - options, # type: Values - session, # type: PipSession - target_python=None, # type: Optional[TargetPython] + options, # type: Values + session, # type: PipSession + target_python=None, # type: Optional[TargetPython] ignore_requires_python=None, # type: Optional[bool] ): # type: (...) -> PackageFinder diff --git a/src/fetchcode/vcs/pip/_internal/cli/spinners.py b/src/fetchcode/vcs/pip/_internal/cli/spinners.py index 69fe6639..a093ec59 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/spinners.py +++ b/src/fetchcode/vcs/pip/_internal/cli/spinners.py @@ -1,4 +1,3 @@ - import contextlib import itertools import logging @@ -28,9 +27,14 @@ def finish(self, final_status): class InteractiveSpinner(SpinnerInterface): - def __init__(self, message, file=None, spin_chars="-\\|/", - # Empirically, 8 updates/second looks nice - min_update_interval_seconds=0.125): + def __init__( + self, + message, + file=None, + spin_chars="-\\|/", + # Empirically, 8 updates/second looks nice + min_update_interval_seconds=0.125, + ): # type: (str, IO[str], str, float) -> None self._message = message if file is None: @@ -105,8 +109,7 @@ def finish(self, final_status): # type: (str) -> None if self._finished: return - self._update( - "finished with status '{final_status}'".format(**locals())) + self._update("finished with status '{final_status}'".format(**locals())) self._finished = True diff --git a/src/fetchcode/vcs/pip/_internal/cli/status_codes.py b/src/fetchcode/vcs/pip/_internal/cli/status_codes.py index f8da982b..5e29502c 100644 --- a/src/fetchcode/vcs/pip/_internal/cli/status_codes.py +++ b/src/fetchcode/vcs/pip/_internal/cli/status_codes.py @@ -1,4 +1,3 @@ - SUCCESS = 0 ERROR = 1 UNKNOWN_ERROR = 2 diff --git a/src/fetchcode/vcs/pip/_internal/commands/__init__.py b/src/fetchcode/vcs/pip/_internal/commands/__init__.py index 5635b74f..283483a5 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/__init__.py +++ b/src/fetchcode/vcs/pip/_internal/commands/__init__.py @@ -20,7 +20,7 @@ from fetchcode.vcs.pip._internal.cli.base_command import Command -CommandInfo = namedtuple('CommandInfo', 'module_path, class_name, summary') +CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary") # The ordering matters for help display. # Also, even though the module path starts with the same @@ -30,68 +30,130 @@ # in a test-related module). # Finally, we need to pass an iterable of pairs here rather than a dict # so that the ordering won't be lost when using Python 2.7. -commands_dict = OrderedDict([ - ('install', CommandInfo( - 'pip._internal.commands.install', 'InstallCommand', - 'Install packages.', - )), - ('download', CommandInfo( - 'pip._internal.commands.download', 'DownloadCommand', - 'Download packages.', - )), - ('uninstall', CommandInfo( - 'pip._internal.commands.uninstall', 'UninstallCommand', - 'Uninstall packages.', - )), - ('freeze', CommandInfo( - 'pip._internal.commands.freeze', 'FreezeCommand', - 'Output installed packages in requirements format.', - )), - ('list', CommandInfo( - 'pip._internal.commands.list', 'ListCommand', - 'List installed packages.', - )), - ('show', CommandInfo( - 'pip._internal.commands.show', 'ShowCommand', - 'Show information about installed packages.', - )), - ('check', CommandInfo( - 'pip._internal.commands.check', 'CheckCommand', - 'Verify installed packages have compatible dependencies.', - )), - ('config', CommandInfo( - 'pip._internal.commands.configuration', 'ConfigurationCommand', - 'Manage local and global configuration.', - )), - ('search', CommandInfo( - 'pip._internal.commands.search', 'SearchCommand', - 'Search PyPI for packages.', - )), - ('cache', CommandInfo( - 'pip._internal.commands.cache', 'CacheCommand', - "Inspect and manage pip's wheel cache.", - )), - ('wheel', CommandInfo( - 'pip._internal.commands.wheel', 'WheelCommand', - 'Build wheels from your requirements.', - )), - ('hash', CommandInfo( - 'pip._internal.commands.hash', 'HashCommand', - 'Compute hashes of package archives.', - )), - ('completion', CommandInfo( - 'pip._internal.commands.completion', 'CompletionCommand', - 'A helper command used for command completion.', - )), - ('debug', CommandInfo( - 'pip._internal.commands.debug', 'DebugCommand', - 'Show information useful for debugging.', - )), - ('help', CommandInfo( - 'pip._internal.commands.help', 'HelpCommand', - 'Show help for commands.', - )), -]) # type: OrderedDict[str, CommandInfo] +commands_dict = OrderedDict( + [ + ( + "install", + CommandInfo( + "pip._internal.commands.install", + "InstallCommand", + "Install packages.", + ), + ), + ( + "download", + CommandInfo( + "pip._internal.commands.download", + "DownloadCommand", + "Download packages.", + ), + ), + ( + "uninstall", + CommandInfo( + "pip._internal.commands.uninstall", + "UninstallCommand", + "Uninstall packages.", + ), + ), + ( + "freeze", + CommandInfo( + "pip._internal.commands.freeze", + "FreezeCommand", + "Output installed packages in requirements format.", + ), + ), + ( + "list", + CommandInfo( + "pip._internal.commands.list", + "ListCommand", + "List installed packages.", + ), + ), + ( + "show", + CommandInfo( + "pip._internal.commands.show", + "ShowCommand", + "Show information about installed packages.", + ), + ), + ( + "check", + CommandInfo( + "pip._internal.commands.check", + "CheckCommand", + "Verify installed packages have compatible dependencies.", + ), + ), + ( + "config", + CommandInfo( + "pip._internal.commands.configuration", + "ConfigurationCommand", + "Manage local and global configuration.", + ), + ), + ( + "search", + CommandInfo( + "pip._internal.commands.search", + "SearchCommand", + "Search PyPI for packages.", + ), + ), + ( + "cache", + CommandInfo( + "pip._internal.commands.cache", + "CacheCommand", + "Inspect and manage pip's wheel cache.", + ), + ), + ( + "wheel", + CommandInfo( + "pip._internal.commands.wheel", + "WheelCommand", + "Build wheels from your requirements.", + ), + ), + ( + "hash", + CommandInfo( + "pip._internal.commands.hash", + "HashCommand", + "Compute hashes of package archives.", + ), + ), + ( + "completion", + CommandInfo( + "pip._internal.commands.completion", + "CompletionCommand", + "A helper command used for command completion.", + ), + ), + ( + "debug", + CommandInfo( + "pip._internal.commands.debug", + "DebugCommand", + "Show information useful for debugging.", + ), + ), + ( + "help", + CommandInfo( + "pip._internal.commands.help", + "HelpCommand", + "Show help for commands.", + ), + ), + ] +) # type: OrderedDict[str, CommandInfo] def create_command(name, **kwargs): diff --git a/src/fetchcode/vcs/pip/_internal/commands/cache.py b/src/fetchcode/vcs/pip/_internal/commands/cache.py index 7724ae77..e7197001 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/cache.py +++ b/src/fetchcode/vcs/pip/_internal/commands/cache.py @@ -1,4 +1,3 @@ - import logging import os import textwrap @@ -52,14 +51,15 @@ def run(self, options, args): } if not options.cache_dir: - logger.error("pip cache commands can not " - "function since cache is disabled.") + logger.error( + "pip cache commands can not " "function since cache is disabled." + ) return ERROR # Determine action if not args or args[0] not in handlers: - logger.error("Need an action ({}) to perform.".format( - ", ".join(sorted(handlers))) + logger.error( + "Need an action ({}) to perform.".format(", ".join(sorted(handlers))) ) return ERROR @@ -77,83 +77,89 @@ def run(self, options, args): def get_cache_dir(self, options, args): # type: (Values, List[Any]) -> None if args: - raise CommandError('Too many arguments') + raise CommandError("Too many arguments") logger.info(options.cache_dir) def get_cache_info(self, options, args): # type: (Values, List[Any]) -> None if args: - raise CommandError('Too many arguments') + raise CommandError("Too many arguments") - num_packages = len(self._find_wheels(options, '*')) + num_packages = len(self._find_wheels(options, "*")) cache_location = self._wheels_cache_dir(options) cache_size = filesystem.format_directory_size(cache_location) - message = textwrap.dedent(""" + message = ( + textwrap.dedent( + """ Location: {location} Size: {size} Number of wheels: {package_count} - """).format( - location=cache_location, - package_count=num_packages, - size=cache_size, - ).strip() + """ + ) + .format( + location=cache_location, + package_count=num_packages, + size=cache_size, + ) + .strip() + ) logger.info(message) def list_cache_items(self, options, args): # type: (Values, List[Any]) -> None if len(args) > 1: - raise CommandError('Too many arguments') + raise CommandError("Too many arguments") if args: pattern = args[0] else: - pattern = '*' + pattern = "*" files = self._find_wheels(options, pattern) if not files: - logger.info('Nothing cached.') + logger.info("Nothing cached.") return results = [] for filename in files: wheel = os.path.basename(filename) size = filesystem.format_file_size(filename) - results.append(' - {} ({})'.format(wheel, size)) - logger.info('Cache contents:\n') - logger.info('\n'.join(sorted(results))) + results.append(" - {} ({})".format(wheel, size)) + logger.info("Cache contents:\n") + logger.info("\n".join(sorted(results))) def remove_cache_items(self, options, args): # type: (Values, List[Any]) -> None if len(args) > 1: - raise CommandError('Too many arguments') + raise CommandError("Too many arguments") if not args: - raise CommandError('Please provide a pattern') + raise CommandError("Please provide a pattern") files = self._find_wheels(options, args[0]) if not files: - raise CommandError('No matching packages') + raise CommandError("No matching packages") for filename in files: os.unlink(filename) - logger.debug('Removed %s', filename) - logger.info('Files removed: %s', len(files)) + logger.debug("Removed %s", filename) + logger.info("Files removed: %s", len(files)) def purge_cache(self, options, args): # type: (Values, List[Any]) -> None if args: - raise CommandError('Too many arguments') + raise CommandError("Too many arguments") - return self.remove_cache_items(options, ['*']) + return self.remove_cache_items(options, ["*"]) def _wheels_cache_dir(self, options): # type: (Values) -> str - return os.path.join(options.cache_dir, 'wheels') + return os.path.join(options.cache_dir, "wheels") def _find_wheels(self, options, pattern): # type: (Values, str) -> List[str] diff --git a/src/fetchcode/vcs/pip/_internal/commands/check.py b/src/fetchcode/vcs/pip/_internal/commands/check.py index 35af06da..356f18dd 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/check.py +++ b/src/fetchcode/vcs/pip/_internal/commands/check.py @@ -33,7 +33,9 @@ def run(self, options, args): for dependency in missing[project_name]: write_output( "%s %s requires %s, which is not installed.", - project_name, version, dependency[0], + project_name, + version, + dependency[0], ) for project_name in conflicting: @@ -41,7 +43,11 @@ def run(self, options, args): for dep_name, dep_version, req in conflicting[project_name]: write_output( "%s %s has requirement %s, but you have %s %s.", - project_name, version, req, dep_name, dep_version, + project_name, + version, + req, + dep_name, + dep_version, ) if missing or conflicting or parsing_probs: diff --git a/src/fetchcode/vcs/pip/_internal/commands/completion.py b/src/fetchcode/vcs/pip/_internal/commands/completion.py index 755fcf7d..a26ea869 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/completion.py +++ b/src/fetchcode/vcs/pip/_internal/commands/completion.py @@ -13,7 +13,7 @@ """ COMPLETION_SCRIPTS = { - 'bash': """ + "bash": """ _pip_completion() {{ COMPREPLY=( $( COMP_WORDS="${{COMP_WORDS[*]}}" \\ @@ -22,7 +22,7 @@ }} complete -o default -F _pip_completion {prog} """, - 'zsh': """ + "zsh": """ function _pip_completion {{ local words cword read -Ac words @@ -33,7 +33,7 @@ }} compctl -K _pip_completion {prog} """, - 'fish': """ + "fish": """ function __fish_complete_pip set -lx COMP_WORDS (commandline -o) "" set -lx COMP_CWORD ( \\ @@ -58,37 +58,42 @@ def __init__(self, *args, **kw): cmd_opts = self.cmd_opts cmd_opts.add_option( - '--bash', '-b', - action='store_const', - const='bash', - dest='shell', - help='Emit completion code for bash') + "--bash", + "-b", + action="store_const", + const="bash", + dest="shell", + help="Emit completion code for bash", + ) cmd_opts.add_option( - '--zsh', '-z', - action='store_const', - const='zsh', - dest='shell', - help='Emit completion code for zsh') + "--zsh", + "-z", + action="store_const", + const="zsh", + dest="shell", + help="Emit completion code for zsh", + ) cmd_opts.add_option( - '--fish', '-f', - action='store_const', - const='fish', - dest='shell', - help='Emit completion code for fish') + "--fish", + "-f", + action="store_const", + const="fish", + dest="shell", + help="Emit completion code for fish", + ) self.parser.insert_option_group(0, cmd_opts) def run(self, options, args): """Prints the completion code of the given shell""" shells = COMPLETION_SCRIPTS.keys() - shell_options = ['--' + shell for shell in sorted(shells)] + shell_options = ["--" + shell for shell in sorted(shells)] if options.shell in shells: script = textwrap.dedent( - COMPLETION_SCRIPTS.get(options.shell, '').format( - prog=get_prog()) + COMPLETION_SCRIPTS.get(options.shell, "").format(prog=get_prog()) ) print(BASE_COMPLETION.format(script=script, shell=options.shell)) else: sys.stderr.write( - 'ERROR: You must pass {}\n' .format(' or '.join(shell_options)) + "ERROR: You must pass {}\n".format(" or ".join(shell_options)) ) diff --git a/src/fetchcode/vcs/pip/_internal/commands/configuration.py b/src/fetchcode/vcs/pip/_internal/commands/configuration.py index 8371cfe6..694990c4 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/configuration.py +++ b/src/fetchcode/vcs/pip/_internal/commands/configuration.py @@ -51,38 +51,38 @@ def __init__(self, *args, **kwargs): self.configuration = None self.cmd_opts.add_option( - '--editor', - dest='editor', - action='store', + "--editor", + dest="editor", + action="store", default=None, help=( - 'Editor to use to edit the file. Uses VISUAL or EDITOR ' - 'environment variables if not provided.' - ) + "Editor to use to edit the file. Uses VISUAL or EDITOR " + "environment variables if not provided." + ), ) self.cmd_opts.add_option( - '--global', - dest='global_file', - action='store_true', + "--global", + dest="global_file", + action="store_true", default=False, - help='Use the system-wide configuration file only' + help="Use the system-wide configuration file only", ) self.cmd_opts.add_option( - '--user', - dest='user_file', - action='store_true', + "--user", + dest="user_file", + action="store_true", default=False, - help='Use the user configuration file only' + help="Use the user configuration file only", ) self.cmd_opts.add_option( - '--site', - dest='site_file', - action='store_true', + "--site", + dest="site_file", + action="store_true", default=False, - help='Use the current environment configuration file only' + help="Use the current environment configuration file only", ) self.parser.insert_option_group(0, self.cmd_opts) @@ -93,13 +93,13 @@ def run(self, options, args): "edit": self.open_in_editor, "get": self.get_name, "set": self.set_name_value, - "unset": self.unset_name + "unset": self.unset_name, } # Determine action if not args or args[0] not in handlers: - logger.error("Need an action ({}) to perform.".format( - ", ".join(sorted(handlers))) + logger.error( + "Need an action ({}) to perform.".format(", ".join(sorted(handlers))) ) return ERROR @@ -131,11 +131,15 @@ def run(self, options, args): return SUCCESS def _determine_file(self, options, need_value): - file_options = [key for key, value in ( - (kinds.USER, options.user_file), - (kinds.GLOBAL, options.global_file), - (kinds.SITE, options.site_file), - ) if value] + file_options = [ + key + for key, value in ( + (kinds.USER, options.user_file), + (kinds.GLOBAL, options.global_file), + (kinds.SITE, options.site_file), + ) + if value + ] if not file_options: if not need_value: @@ -191,16 +195,14 @@ def open_in_editor(self, options, args): subprocess.check_call([editor, fname]) except subprocess.CalledProcessError as e: raise PipError( - "Editor Subprocess exited with exit code {}" - .format(e.returncode) + "Editor Subprocess exited with exit code {}".format(e.returncode) ) def _get_n_args(self, args, example, n): - """Helper to make sure the command got the right number of arguments - """ + """Helper to make sure the command got the right number of arguments""" if len(args) != n: msg = ( - 'Got unexpected number of arguments, expected {}. ' + "Got unexpected number of arguments, expected {}. " '(example: "{} config {}")' ).format(n, get_prog(), example) raise PipError(msg) @@ -217,8 +219,7 @@ def _save_configuration(self): self.configuration.save() except Exception: logger.error( - "Unable to save configuration. Please report this as a bug.", - exc_info=1 + "Unable to save configuration. Please report this as a bug.", exc_info=1 ) raise PipError("Internal Error.") diff --git a/src/fetchcode/vcs/pip/_internal/commands/debug.py b/src/fetchcode/vcs/pip/_internal/commands/debug.py index a70f3b47..0235c4be 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/debug.py +++ b/src/fetchcode/vcs/pip/_internal/commands/debug.py @@ -30,38 +30,37 @@ def show_value(name, value): # type: (str, Optional[str]) -> None - logger.info('{}: {}'.format(name, value)) + logger.info("{}: {}".format(name, value)) def show_sys_implementation(): # type: () -> None - logger.info('sys.implementation:') - if hasattr(sys, 'implementation'): + logger.info("sys.implementation:") + if hasattr(sys, "implementation"): implementation = sys.implementation # type: ignore implementation_name = implementation.name else: - implementation_name = '' + implementation_name = "" with indent_log(): - show_value('name', implementation_name) + show_value("name", implementation_name) def create_vendor_txt_map(): # type: () -> Dict[str, str] vendor_txt_path = os.path.join( - os.path.dirname(pip_location), - '_vendor', - 'vendor.txt' + os.path.dirname(pip_location), "_vendor", "vendor.txt" ) with open(vendor_txt_path) as f: # Purge non version specifying lines. # Also, remove any space prefix or suffixes (including comments). - lines = [line.strip().split(' ', 1)[0] - for line in f.readlines() if '==' in line] + lines = [ + line.strip().split(" ", 1)[0] for line in f.readlines() if "==" in line + ] # Transform into "module" -> version dict. - return dict(line.split('==', 1) for line in lines) # type: ignore + return dict(line.split("==", 1) for line in lines) # type: ignore def get_module_from_module_name(module_name): @@ -70,15 +69,10 @@ def get_module_from_module_name(module_name): # Module name can be uppercase in vendor.txt for some reason... module_name = module_name.lower() # PATCH: setuptools is actually only pkg_resources. - if module_name == 'setuptools': - module_name = 'pkg_resources' - - __import__( - 'pip._vendor.{}'.format(module_name), - globals(), - locals(), - level=0 - ) + if module_name == "setuptools": + module_name = "pkg_resources" + + __import__("pip._vendor.{}".format(module_name), globals(), locals(), level=0) return getattr(pip._vendor, module_name) @@ -86,15 +80,15 @@ def get_vendor_version_from_module(module_name): # type: (str) -> str module = get_module_from_module_name(module_name) - version = getattr(module, '__version__', None) + version = getattr(module, "__version__", None) if not version: # Try to find version in debundled module info pkg_set = pkg_resources.WorkingSet( - [os.path.dirname(getattr(module, '__file__'))] + [os.path.dirname(getattr(module, "__file__"))] ) package = pkg_set.find(pkg_resources.Requirement.parse(module_name)) - version = getattr(package, 'version', None) + version = getattr(package, "version", None) return version @@ -105,28 +99,30 @@ def show_actual_vendor_versions(vendor_txt_versions): # if there is a conflict or if the actual version could not be imported. for module_name, expected_version in vendor_txt_versions.items(): - extra_message = '' + extra_message = "" actual_version = get_vendor_version_from_module(module_name) if not actual_version: - extra_message = ' (Unable to locate actual module version, using'\ - ' vendor.txt specified version)' + extra_message = ( + " (Unable to locate actual module version, using" + " vendor.txt specified version)" + ) actual_version = expected_version elif actual_version != expected_version: - extra_message = ' (CONFLICT: vendor.txt suggests version should'\ - ' be {})'.format(expected_version) + extra_message = ( + " (CONFLICT: vendor.txt suggests version should" + " be {})".format(expected_version) + ) logger.info( - '{name}=={actual}{extra}'.format( - name=module_name, - actual=actual_version, - extra=extra_message + "{name}=={actual}{extra}".format( + name=module_name, actual=actual_version, extra=extra_message ) ) def show_vendor_versions(): # type: () -> None - logger.info('vendored library versions:') + logger.info("vendored library versions:") vendor_txt_versions = create_vendor_txt_map() with indent_log(): @@ -142,11 +138,11 @@ def show_tags(options): # Display the target options that were explicitly provided. formatted_target = target_python.format_given() - suffix = '' + suffix = "" if formatted_target: - suffix = ' (target: {})'.format(formatted_target) + suffix = " (target: {})".format(formatted_target) - msg = 'Compatible tags: {}{}'.format(len(tags), suffix) + msg = "Compatible tags: {}{}".format(len(tags), suffix) logger.info(msg) if options.verbose < 1 and len(tags) > tag_limit: @@ -161,8 +157,7 @@ def show_tags(options): if tags_limited: msg = ( - '...\n' - '[First {tag_limit} tags shown. Pass --verbose to show all.]' + "...\n" "[First {tag_limit} tags shown. Pass --verbose to show all.]" ).format(tag_limit=tag_limit) logger.info(msg) @@ -170,20 +165,20 @@ def show_tags(options): def ca_bundle_info(config): levels = set() for key, value in config.items(): - levels.add(key.split('.')[0]) + levels.add(key.split(".")[0]) if not levels: return "Not specified" - levels_that_override_global = ['install', 'wheel', 'download'] + levels_that_override_global = ["install", "wheel", "download"] global_overriding_level = [ level for level in levels if level in levels_that_override_global ] if not global_overriding_level: - return 'global' + return "global" - if 'global' in levels: - levels.remove('global') + if "global" in levels: + levels.remove("global") return ", ".join(levels) @@ -212,20 +207,21 @@ def run(self, options, args): "details, since the output and options of this command may " "change without notice." ) - show_value('pip version', get_pip_version()) - show_value('sys.version', sys.version) - show_value('sys.executable', sys.executable) - show_value('sys.getdefaultencoding', sys.getdefaultencoding()) - show_value('sys.getfilesystemencoding', sys.getfilesystemencoding()) + show_value("pip version", get_pip_version()) + show_value("sys.version", sys.version) + show_value("sys.executable", sys.executable) + show_value("sys.getdefaultencoding", sys.getdefaultencoding()) + show_value("sys.getfilesystemencoding", sys.getfilesystemencoding()) show_value( - 'locale.getpreferredencoding', locale.getpreferredencoding(), + "locale.getpreferredencoding", + locale.getpreferredencoding(), ) - show_value('sys.platform', sys.platform) + show_value("sys.platform", sys.platform) show_sys_implementation() show_value("'cert' config value", ca_bundle_info(self.parser.config)) - show_value("REQUESTS_CA_BUNDLE", os.environ.get('REQUESTS_CA_BUNDLE')) - show_value("CURL_CA_BUNDLE", os.environ.get('CURL_CA_BUNDLE')) + show_value("REQUESTS_CA_BUNDLE", os.environ.get("REQUESTS_CA_BUNDLE")) + show_value("CURL_CA_BUNDLE", os.environ.get("CURL_CA_BUNDLE")) show_value("pip._vendor.certifi.where()", where()) show_value("pip._vendor.DEBUNDLED", pip._vendor.DEBUNDLED) diff --git a/src/fetchcode/vcs/pip/_internal/commands/download.py b/src/fetchcode/vcs/pip/_internal/commands/download.py index f73770b4..ff0138ac 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/download.py +++ b/src/fetchcode/vcs/pip/_internal/commands/download.py @@ -9,7 +9,11 @@ from fetchcode.vcs.pip._internal.cli.cmdoptions import make_target_python from fetchcode.vcs.pip._internal.cli.req_command import RequirementCommand, with_cleanup from fetchcode.vcs.pip._internal.req.req_tracker import get_requirement_tracker -from fetchcode.vcs.pip._internal.utils.misc import ensure_dir, normalize_path, write_output +from fetchcode.vcs.pip._internal.utils.misc import ( + ensure_dir, + normalize_path, + write_output, +) from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) @@ -57,9 +61,12 @@ def __init__(self, *args, **kw): cmd_opts.add_option(cmdoptions.no_use_pep517()) cmd_opts.add_option( - '-d', '--dest', '--destination-dir', '--destination-directory', - dest='download_dir', - metavar='dir', + "-d", + "--dest", + "--destination-dir", + "--destination-directory", + dest="download_dir", + metavar="dir", default=os.curdir, help=("Download packages into ."), ) @@ -95,7 +102,7 @@ def run(self, options, args): session=session, target_python=target_python, ) - build_delete = (not (options.no_clean or options.build_dir)) + build_delete = not (options.no_clean or options.build_dir) req_tracker = self.enter_context(get_requirement_tracker()) @@ -127,15 +134,16 @@ def run(self, options, args): self.trace_basic_info(finder) - requirement_set = resolver.resolve( - reqs, check_supported_wheels=True - ) + requirement_set = resolver.resolve(reqs, check_supported_wheels=True) - downloaded = ' '.join([ - req.name for req in requirement_set.requirements.values() - if req.successfully_downloaded - ]) + downloaded = " ".join( + [ + req.name + for req in requirement_set.requirements.values() + if req.successfully_downloaded + ] + ) if downloaded: - write_output('Successfully downloaded %s', downloaded) + write_output("Successfully downloaded %s", downloaded) return requirement_set diff --git a/src/fetchcode/vcs/pip/_internal/commands/freeze.py b/src/fetchcode/vcs/pip/_internal/commands/freeze.py index c20b796d..e55919c4 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/freeze.py +++ b/src/fetchcode/vcs/pip/_internal/commands/freeze.py @@ -11,7 +11,7 @@ from fetchcode.vcs.pip._internal.operations.freeze import freeze from fetchcode.vcs.pip._internal.utils.compat import stdlib_pkgs -DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'} +DEV_PKGS = {"pip", "setuptools", "distribute", "wheel"} class FreezeCommand(Command): @@ -29,47 +29,55 @@ def __init__(self, *args, **kw): super(FreezeCommand, self).__init__(*args, **kw) self.cmd_opts.add_option( - '-r', '--requirement', - dest='requirements', - action='append', + "-r", + "--requirement", + dest="requirements", + action="append", default=[], - metavar='file', + metavar="file", help="Use the order in the given requirements file and its " - "comments when generating output. This option can be " - "used multiple times.") + "comments when generating output. This option can be " + "used multiple times.", + ) self.cmd_opts.add_option( - '-f', '--find-links', - dest='find_links', - action='append', + "-f", + "--find-links", + dest="find_links", + action="append", default=[], - metavar='URL', - help='URL for finding packages, which will be added to the ' - 'output.') + metavar="URL", + help="URL for finding packages, which will be added to the " "output.", + ) self.cmd_opts.add_option( - '-l', '--local', - dest='local', - action='store_true', + "-l", + "--local", + dest="local", + action="store_true", default=False, - help='If in a virtualenv that has global access, do not output ' - 'globally-installed packages.') + help="If in a virtualenv that has global access, do not output " + "globally-installed packages.", + ) self.cmd_opts.add_option( - '--user', - dest='user', - action='store_true', + "--user", + dest="user", + action="store_true", default=False, - help='Only output packages installed in user-site.') + help="Only output packages installed in user-site.", + ) self.cmd_opts.add_option(cmdoptions.list_path()) self.cmd_opts.add_option( - '--all', - dest='freeze_all', - action='store_true', - help='Do not skip these packages in the output:' - ' {}'.format(', '.join(DEV_PKGS))) + "--all", + dest="freeze_all", + action="store_true", + help="Do not skip these packages in the output:" + " {}".format(", ".join(DEV_PKGS)), + ) self.cmd_opts.add_option( - '--exclude-editable', - dest='exclude_editable', - action='store_true', - help='Exclude editable package from output.') + "--exclude-editable", + dest="exclude_editable", + action="store_true", + help="Exclude editable package from output.", + ) self.parser.insert_option_group(0, self.cmd_opts) @@ -95,4 +103,4 @@ def run(self, options, args): ) for line in freeze(**freeze_kwargs): - sys.stdout.write(line + '\n') + sys.stdout.write(line + "\n") diff --git a/src/fetchcode/vcs/pip/_internal/commands/hash.py b/src/fetchcode/vcs/pip/_internal/commands/hash.py index e18d3262..f51e782f 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/hash.py +++ b/src/fetchcode/vcs/pip/_internal/commands/hash.py @@ -22,19 +22,22 @@ class HashCommand(Command): installs. """ - usage = '%prog [options] ...' + usage = "%prog [options] ..." ignore_require_venv = True def __init__(self, *args, **kw): super(HashCommand, self).__init__(*args, **kw) self.cmd_opts.add_option( - '-a', '--algorithm', - dest='algorithm', + "-a", + "--algorithm", + dest="algorithm", choices=STRONG_HASHES, - action='store', + action="store", default=FAVORITE_HASH, - help='The hash algorithm to use: one of {}'.format( - ', '.join(STRONG_HASHES))) + help="The hash algorithm to use: one of {}".format( + ", ".join(STRONG_HASHES) + ), + ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options, args): @@ -44,13 +47,14 @@ def run(self, options, args): algorithm = options.algorithm for path in args: - write_output('%s:\n--hash=%s:%s', - path, algorithm, _hash_of_file(path, algorithm)) + write_output( + "%s:\n--hash=%s:%s", path, algorithm, _hash_of_file(path, algorithm) + ) def _hash_of_file(path, algorithm): """Return the hash digest of a file.""" - with open(path, 'rb') as archive: + with open(path, "rb") as archive: hash = hashlib.new(algorithm) for chunk in read_chunks(archive): hash.update(chunk) diff --git a/src/fetchcode/vcs/pip/_internal/commands/help.py b/src/fetchcode/vcs/pip/_internal/commands/help.py index fee8ce4b..3f6ab173 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/help.py +++ b/src/fetchcode/vcs/pip/_internal/commands/help.py @@ -16,7 +16,9 @@ class HelpCommand(Command): def run(self, options, args): from fetchcode.vcs.pip._internal.commands import ( - commands_dict, create_command, get_similar_commands, + commands_dict, + create_command, + get_similar_commands, ) try: @@ -32,7 +34,7 @@ def run(self, options, args): if guess: msg.append('maybe you meant "{}"'.format(guess)) - raise CommandError(' - '.join(msg)) + raise CommandError(" - ".join(msg)) command = create_command(cmd_name) command.parser.print_help() diff --git a/src/fetchcode/vcs/pip/_internal/commands/install.py b/src/fetchcode/vcs/pip/_internal/commands/install.py index c759938f..e726f50f 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/install.py +++ b/src/fetchcode/vcs/pip/_internal/commands/install.py @@ -39,7 +39,10 @@ from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectory from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING from fetchcode.vcs.pip._internal.utils.virtualenv import virtualenv_no_global -from fetchcode.vcs.pip._internal.wheel_builder import build, should_build_for_install_command +from fetchcode.vcs.pip._internal.wheel_builder import ( + build, + should_build_for_install_command, +) if MYPY_CHECK_RUNNING: from optparse import Values @@ -98,87 +101,90 @@ def __init__(self, *args, **kw): cmd_opts.add_option(cmdoptions.editable()) cmd_opts.add_option( - '-t', '--target', - dest='target_dir', - metavar='dir', + "-t", + "--target", + dest="target_dir", + metavar="dir", default=None, - help='Install packages into . ' - 'By default this will not replace existing files/folders in ' - '. Use --upgrade to replace existing packages in ' - 'with new versions.' + help="Install packages into . " + "By default this will not replace existing files/folders in " + ". Use --upgrade to replace existing packages in " + "with new versions.", ) cmdoptions.add_target_python_options(cmd_opts) cmd_opts.add_option( - '--user', - dest='use_user_site', - action='store_true', + "--user", + dest="use_user_site", + action="store_true", help="Install to the Python user install directory for your " - "platform. Typically ~/.local/, or %APPDATA%\\Python on " - "Windows. (See the Python documentation for site.USER_BASE " - "for full details.)") + "platform. Typically ~/.local/, or %APPDATA%\\Python on " + "Windows. (See the Python documentation for site.USER_BASE " + "for full details.)", + ) cmd_opts.add_option( - '--no-user', - dest='use_user_site', - action='store_false', - help=SUPPRESS_HELP) + "--no-user", dest="use_user_site", action="store_false", help=SUPPRESS_HELP + ) cmd_opts.add_option( - '--root', - dest='root_path', - metavar='dir', + "--root", + dest="root_path", + metavar="dir", default=None, - help="Install everything relative to this alternate root " - "directory.") + help="Install everything relative to this alternate root " "directory.", + ) cmd_opts.add_option( - '--prefix', - dest='prefix_path', - metavar='dir', + "--prefix", + dest="prefix_path", + metavar="dir", default=None, help="Installation prefix where lib, bin and other top-level " - "folders are placed") + "folders are placed", + ) cmd_opts.add_option(cmdoptions.build_dir()) cmd_opts.add_option(cmdoptions.src()) cmd_opts.add_option( - '-U', '--upgrade', - dest='upgrade', - action='store_true', - help='Upgrade all specified packages to the newest available ' - 'version. The handling of dependencies depends on the ' - 'upgrade-strategy used.' + "-U", + "--upgrade", + dest="upgrade", + action="store_true", + help="Upgrade all specified packages to the newest available " + "version. The handling of dependencies depends on the " + "upgrade-strategy used.", ) cmd_opts.add_option( - '--upgrade-strategy', - dest='upgrade_strategy', - default='only-if-needed', - choices=['only-if-needed', 'eager'], - help='Determines how dependency upgrading should be handled ' - '[default: %default]. ' - '"eager" - dependencies are upgraded regardless of ' - 'whether the currently installed version satisfies the ' - 'requirements of the upgraded package(s). ' - '"only-if-needed" - are upgraded only when they do not ' - 'satisfy the requirements of the upgraded package(s).' + "--upgrade-strategy", + dest="upgrade_strategy", + default="only-if-needed", + choices=["only-if-needed", "eager"], + help="Determines how dependency upgrading should be handled " + "[default: %default]. " + '"eager" - dependencies are upgraded regardless of ' + "whether the currently installed version satisfies the " + "requirements of the upgraded package(s). " + '"only-if-needed" - are upgraded only when they do not ' + "satisfy the requirements of the upgraded package(s).", ) cmd_opts.add_option( - '--force-reinstall', - dest='force_reinstall', - action='store_true', - help='Reinstall all packages even if they are already ' - 'up-to-date.') + "--force-reinstall", + dest="force_reinstall", + action="store_true", + help="Reinstall all packages even if they are already " "up-to-date.", + ) cmd_opts.add_option( - '-I', '--ignore-installed', - dest='ignore_installed', - action='store_true', - help='Ignore the installed packages, overwriting them. ' - 'This can break your system if the existing package ' - 'is of a different version or was installed ' - 'with a different package manager!' + "-I", + "--ignore-installed", + dest="ignore_installed", + action="store_true", + help="Ignore the installed packages, overwriting them. " + "This can break your system if the existing package " + "is of a different version or was installed " + "with a different package manager!", ) cmd_opts.add_option(cmdoptions.ignore_requires_python()) @@ -261,11 +267,11 @@ def run(self, options, args): if options.target_dir: options.ignore_installed = True options.target_dir = os.path.abspath(options.target_dir) - if (os.path.exists(options.target_dir) and not - os.path.isdir(options.target_dir)): + if os.path.exists(options.target_dir) and not os.path.isdir( + options.target_dir + ): raise CommandError( - "Target path exists but is not a directory, will not " - "continue." + "Target path exists but is not a directory, will not " "continue." ) # Create a target directory for using with the target option @@ -283,7 +289,7 @@ def run(self, options, args): target_python=target_python, ignore_requires_python=options.ignore_requires_python, ) - build_delete = (not (options.no_clean or options.build_dir)) + build_delete = not (options.no_clean or options.build_dir) wheel_cache = WheelCache(options.cache_dir, options.format_control) req_tracker = self.enter_context(get_requirement_tracker()) @@ -297,13 +303,14 @@ def run(self, options, args): try: reqs = self.get_requirements( - args, options, finder, session, + args, + options, + finder, + session, check_supported_wheels=not options.target_dir, ) - warn_deprecated_install_options( - reqs, options.install_options - ) + warn_deprecated_install_options(reqs, options.install_options) preparer = self.make_requirement_preparer( temp_build_dir=directory, @@ -340,19 +347,14 @@ def run(self, options, args): # If we're not replacing an already installed pip, # we're not modifying it. modifying_pip = pip_req.satisfied_by is None - protect_pip_from_modification_on_windows( - modifying_pip=modifying_pip - ) + protect_pip_from_modification_on_windows(modifying_pip=modifying_pip) - check_binary_allowed = get_check_binary_allowed( - finder.format_control - ) + check_binary_allowed = get_check_binary_allowed(finder.format_control) reqs_to_build = [ - r for r in requirement_set.requirements.values() - if should_build_for_install_command( - r, check_binary_allowed - ) + r + for r in requirement_set.requirements.values() + if should_build_for_install_command(r, check_binary_allowed) ] _, build_failures = build( @@ -367,23 +369,20 @@ def run(self, options, args): # We don't care about failures building legacy # requirements, as we'll fall through to a direct # install for those. - pep517_build_failures = [ - r for r in build_failures if r.use_pep517 - ] + pep517_build_failures = [r for r in build_failures if r.use_pep517] if pep517_build_failures: raise InstallationError( "Could not build wheels for {} which use" " PEP 517 and cannot be installed directly".format( - ", ".join(r.name for r in pep517_build_failures))) + ", ".join(r.name for r in pep517_build_failures) + ) + ) - to_install = resolver.get_installation_order( - requirement_set - ) + to_install = resolver.get_installation_order(requirement_set) # Consistency Checking of the package set we're installing. should_warn_about_conflicts = ( - not options.ignore_dependencies and - options.warn_about_conflicts + not options.ignore_dependencies and options.warn_about_conflicts ) if should_warn_about_conflicts: self._warn_about_conflicts(to_install) @@ -415,7 +414,7 @@ def run(self, options, args): ) working_set = pkg_resources.WorkingSet(lib_locations) - installed.sort(key=operator.attrgetter('name')) + installed.sort(key=operator.attrgetter("name")) items = [] for result in installed: item = result.name @@ -424,20 +423,23 @@ def run(self, options, args): result.name, working_set=working_set ) if installed_version: - item += '-' + installed_version + item += "-" + installed_version except Exception: pass items.append(item) - installed_desc = ' '.join(items) + installed_desc = " ".join(items) if installed_desc: write_output( - 'Successfully installed %s', installed_desc, + "Successfully installed %s", + installed_desc, ) except EnvironmentError as error: - show_traceback = (self.verbosity >= 1) + show_traceback = self.verbosity >= 1 message = create_env_error_message( - error, show_traceback, options.use_user_site, + error, + show_traceback, + options.use_user_site, ) logger.error(message, exc_info=show_traceback) @@ -460,10 +462,10 @@ def _handle_target_dir(self, target_dir, target_temp_dir, upgrade): with target_temp_dir: # Checking both purelib and platlib directories for installed # packages to be moved to target directory - scheme = distutils_scheme('', home=target_temp_dir.path) - purelib_dir = scheme['purelib'] - platlib_dir = scheme['platlib'] - data_dir = scheme['data'] + scheme = distutils_scheme("", home=target_temp_dir.path) + purelib_dir = scheme["purelib"] + platlib_dir = scheme["platlib"] + data_dir = scheme["data"] if os.path.exists(purelib_dir): lib_dir_list.append(purelib_dir) @@ -482,18 +484,18 @@ def _handle_target_dir(self, target_dir, target_temp_dir, upgrade): if os.path.exists(target_item_dir): if not upgrade: logger.warning( - 'Target directory %s already exists. Specify ' - '--upgrade to force replacement.', - target_item_dir + "Target directory %s already exists. Specify " + "--upgrade to force replacement.", + target_item_dir, ) continue if os.path.islink(target_item_dir): logger.warning( - 'Target directory %s already exists and is ' - 'a link. pip will not automatically replace ' - 'links, please remove if replacement is ' - 'desired.', - target_item_dir + "Target directory %s already exists and is " + "a link. pip will not automatically replace " + "links, please remove if replacement is " + "desired.", + target_item_dir, ) continue if os.path.isdir(target_item_dir): @@ -501,10 +503,7 @@ def _handle_target_dir(self, target_dir, target_temp_dir, upgrade): else: os.remove(target_item_dir) - shutil.move( - os.path.join(lib_dir, item), - target_item_dir - ) + shutil.move(os.path.join(lib_dir, item), target_item_dir) def _warn_about_conflicts(self, to_install): try: @@ -520,7 +519,9 @@ def _warn_about_conflicts(self, to_install): for dependency in missing[project_name]: logger.critical( "%s %s requires %s, which is not installed.", - project_name, version, dependency[1], + project_name, + version, + dependency[1], ) for project_name in conflicting: @@ -529,19 +530,21 @@ def _warn_about_conflicts(self, to_install): logger.critical( "%s %s has requirement %s, but you'll have %s %s which is " "incompatible.", - project_name, version, req, dep_name, dep_version, + project_name, + version, + req, + dep_name, + dep_version, ) def get_lib_location_guesses(*args, **kwargs): - scheme = distutils_scheme('', *args, **kwargs) - return [scheme['purelib'], scheme['platlib']] + scheme = distutils_scheme("", *args, **kwargs) + return [scheme["purelib"], scheme["platlib"]] def site_packages_writable(**kwargs): - return all( - test_writable_dir(d) for d in set(get_lib_location_guesses(**kwargs)) - ) + return all(test_writable_dir(d) for d in set(get_lib_location_guesses(**kwargs))) def decide_user_install( @@ -599,8 +602,10 @@ def decide_user_install( logger.debug("Non-user install because site-packages writeable") return False - logger.info("Defaulting to user installation because normal site-packages " - "is not writeable") + logger.info( + "Defaulting to user installation because normal site-packages " + "is not writeable" + ) return True @@ -609,6 +614,7 @@ def warn_deprecated_install_options(requirements, options): """If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. """ + def format_options(option_names): # type: (Iterable[str]) -> List[str] return ["--{}".format(name.replace("_", "-")) for name in option_names] @@ -629,9 +635,7 @@ def format_options(option_names): location_options = parse_distutils_args(options) if location_options: offenders.append( - "{!r} from command line".format( - format_options(location_options.keys()) - ) + "{!r} from command line".format(format_options(location_options.keys())) ) if not offenders: @@ -641,13 +645,10 @@ def format_options(option_names): reason=( "Location-changing options found in --install-option: {}. " "This configuration may cause unexpected behavior and is " - "unsupported.".format( - "; ".join(offenders) - ) + "unsupported.".format("; ".join(offenders)) ), replacement=( - "using pip-level options like --user, --prefix, --root, and " - "--target" + "using pip-level options like --user, --prefix, --root, and " "--target" ), gone_in="20.2", issue=7309, @@ -679,10 +680,13 @@ def create_env_error_message(error, show_traceback, using_user_site): permissions_part = "Check the permissions" if not using_user_site: - parts.extend([ - user_option_part, " or ", - permissions_part.lower(), - ]) + parts.extend( + [ + user_option_part, + " or ", + permissions_part.lower(), + ] + ) else: parts.append(permissions_part) parts.append(".\n") diff --git a/src/fetchcode/vcs/pip/_internal/commands/list.py b/src/fetchcode/vcs/pip/_internal/commands/list.py index 07db45c2..dcb30dd9 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/list.py +++ b/src/fetchcode/vcs/pip/_internal/commands/list.py @@ -40,76 +40,85 @@ def __init__(self, *args, **kw): cmd_opts = self.cmd_opts cmd_opts.add_option( - '-o', '--outdated', - action='store_true', + "-o", + "--outdated", + action="store_true", default=False, - help='List outdated packages') + help="List outdated packages", + ) cmd_opts.add_option( - '-u', '--uptodate', - action='store_true', + "-u", + "--uptodate", + action="store_true", default=False, - help='List uptodate packages') + help="List uptodate packages", + ) cmd_opts.add_option( - '-e', '--editable', - action='store_true', + "-e", + "--editable", + action="store_true", default=False, - help='List editable projects.') + help="List editable projects.", + ) cmd_opts.add_option( - '-l', '--local', - action='store_true', + "-l", + "--local", + action="store_true", default=False, - help=('If in a virtualenv that has global access, do not list ' - 'globally-installed packages.'), + help=( + "If in a virtualenv that has global access, do not list " + "globally-installed packages." + ), ) self.cmd_opts.add_option( - '--user', - dest='user', - action='store_true', + "--user", + dest="user", + action="store_true", default=False, - help='Only output packages installed in user-site.') + help="Only output packages installed in user-site.", + ) cmd_opts.add_option(cmdoptions.list_path()) cmd_opts.add_option( - '--pre', - action='store_true', + "--pre", + action="store_true", default=False, - help=("Include pre-release and development versions. By default, " - "pip only finds stable versions."), + help=( + "Include pre-release and development versions. By default, " + "pip only finds stable versions." + ), ) cmd_opts.add_option( - '--format', - action='store', - dest='list_format', + "--format", + action="store", + dest="list_format", default="columns", - choices=('columns', 'freeze', 'json'), + choices=("columns", "freeze", "json"), help="Select the output format among: columns (default), freeze, " - "or json", + "or json", ) cmd_opts.add_option( - '--not-required', - action='store_true', - dest='not_required', - help="List packages that are not dependencies of " - "installed packages.", + "--not-required", + action="store_true", + dest="not_required", + help="List packages that are not dependencies of " "installed packages.", ) cmd_opts.add_option( - '--exclude-editable', - action='store_false', - dest='include_editable', - help='Exclude editable package from output.', + "--exclude-editable", + action="store_false", + dest="include_editable", + help="Exclude editable package from output.", ) cmd_opts.add_option( - '--include-editable', - action='store_true', - dest='include_editable', - help='Include editable package from output.', + "--include-editable", + action="store_true", + dest="include_editable", + help="Include editable package from output.", default=True, ) - index_opts = cmdoptions.make_option_group( - cmdoptions.index_group, self.parser - ) + index_opts = cmdoptions.make_option_group(cmdoptions.index_group, self.parser) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, cmd_opts) @@ -133,8 +142,7 @@ def _build_package_finder(self, options, session): def run(self, options, args): if options.outdated and options.uptodate: - raise CommandError( - "Options --outdated and --uptodate cannot be combined.") + raise CommandError("Options --outdated and --uptodate cannot be combined.") cmdoptions.check_list_path_option(options) @@ -162,13 +170,15 @@ def run(self, options, args): def get_outdated(self, packages, options): return [ - dist for dist in self.iter_packages_latest_infos(packages, options) + dist + for dist in self.iter_packages_latest_infos(packages, options) if dist.latest_version > dist.parsed_version ] def get_uptodate(self, packages, options): return [ - dist for dist in self.iter_packages_latest_infos(packages, options) + dist + for dist in self.iter_packages_latest_infos(packages, options) if dist.latest_version == dist.parsed_version ] @@ -183,12 +193,15 @@ def iter_packages_latest_infos(self, packages, options): finder = self._build_package_finder(options, session) def latest_info(dist): - typ = 'unknown' + typ = "unknown" all_candidates = finder.find_all_candidates(dist.key) if not options.pre: # Remove prereleases - all_candidates = [candidate for candidate in all_candidates - if not candidate.version.is_prerelease] + all_candidates = [ + candidate + for candidate in all_candidates + if not candidate.version.is_prerelease + ] evaluator = finder.make_candidate_evaluator( project_name=dist.project_name, @@ -199,9 +212,9 @@ def latest_info(dist): remote_version = best_candidate.version if best_candidate.link.is_wheel: - typ = 'wheel' + typ = "wheel" else: - typ = 'sdist' + typ = "sdist" # This is dirty but makes the rest of the code much cleaner dist.latest_version = remote_version dist.latest_filetype = typ @@ -216,17 +229,18 @@ def output_package_listing(self, packages, options): packages, key=lambda dist: dist.project_name.lower(), ) - if options.list_format == 'columns' and packages: + if options.list_format == "columns" and packages: data, header = format_for_columns(packages, options) self.output_package_listing_columns(data, header) - elif options.list_format == 'freeze': + elif options.list_format == "freeze": for dist in packages: if options.verbose >= 1: - write_output("%s==%s (%s)", dist.project_name, - dist.version, dist.location) + write_output( + "%s==%s (%s)", dist.project_name, dist.version, dist.location + ) else: write_output("%s==%s", dist.project_name, dist.version) - elif options.list_format == 'json': + elif options.list_format == "json": write_output(format_for_json(packages, options)) def output_package_listing_columns(self, data, header): @@ -238,7 +252,7 @@ def output_package_listing_columns(self, data, header): # Create and add a separator. if len(data) > 0: - pkg_strings.insert(1, " ".join(map(lambda x: '-' * x, sizes))) + pkg_strings.insert(1, " ".join(map(lambda x: "-" * x, sizes))) for val in pkg_strings: write_output(val) @@ -285,14 +299,14 @@ def format_for_json(packages, options): data = [] for dist in packages: info = { - 'name': dist.project_name, - 'version': six.text_type(dist.version), + "name": dist.project_name, + "version": six.text_type(dist.version), } if options.verbose >= 1: - info['location'] = dist.location - info['installer'] = get_installer(dist) + info["location"] = dist.location + info["installer"] = get_installer(dist) if options.outdated: - info['latest_version'] = six.text_type(dist.latest_version) - info['latest_filetype'] = dist.latest_filetype + info["latest_version"] = six.text_type(dist.latest_version) + info["latest_filetype"] = dist.latest_filetype data.append(info) return json.dumps(data) diff --git a/src/fetchcode/vcs/pip/_internal/commands/search.py b/src/fetchcode/vcs/pip/_internal/commands/search.py index 7e929765..6ec81e5f 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/search.py +++ b/src/fetchcode/vcs/pip/_internal/commands/search.py @@ -9,6 +9,7 @@ from fetchcode.vcs.pip._vendor import pkg_resources from fetchcode.vcs.pip._vendor.packaging.version import parse as parse_version + # NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is # why we ignore the type on this import from fetchcode.vcs.pip._vendor.six.moves import xmlrpc_client # type: ignore @@ -36,17 +37,19 @@ class SearchCommand(Command, SessionCommandMixin): def __init__(self, *args, **kw): super(SearchCommand, self).__init__(*args, **kw) self.cmd_opts.add_option( - '-i', '--index', - dest='index', - metavar='URL', + "-i", + "--index", + dest="index", + metavar="URL", default=PyPI.pypi_url, - help='Base URL of Python Package Index (default %default)') + help="Base URL of Python Package Index (default %default)", + ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options, args): if not args: - raise CommandError('Missing required argument (search query).') + raise CommandError("Missing required argument (search query).") query = args pypi_hits = self.search(query, options) hits = transform_hits(pypi_hits) @@ -67,7 +70,7 @@ def search(self, query, options): transport = PipXmlrpcTransport(index_url, session) pypi = xmlrpc_client.ServerProxy(index_url, transport) - hits = pypi.search({'name': query, 'summary': query}, 'or') + hits = pypi.search({"name": query, "summary": query}, "or") return hits @@ -79,22 +82,22 @@ def transform_hits(hits): """ packages = OrderedDict() for hit in hits: - name = hit['name'] - summary = hit['summary'] - version = hit['version'] + name = hit["name"] + summary = hit["summary"] + version = hit["version"] if name not in packages.keys(): packages[name] = { - 'name': name, - 'summary': summary, - 'versions': [version], + "name": name, + "summary": summary, + "versions": [version], } else: - packages[name]['versions'].append(version) + packages[name]["versions"].append(version) # if this is the highest version, replace summary and score - if version == highest_version(packages[name]['versions']): - packages[name]['summary'] = summary + if version == highest_version(packages[name]["versions"]): + packages[name]["summary"] = summary return list(packages.values()) @@ -103,40 +106,48 @@ def print_results(hits, name_column_width=None, terminal_width=None): if not hits: return if name_column_width is None: - name_column_width = max([ - len(hit['name']) + len(highest_version(hit.get('versions', ['-']))) - for hit in hits - ]) + 4 + name_column_width = ( + max( + [ + len(hit["name"]) + len(highest_version(hit.get("versions", ["-"]))) + for hit in hits + ] + ) + + 4 + ) installed_packages = [p.project_name for p in pkg_resources.working_set] for hit in hits: - name = hit['name'] - summary = hit['summary'] or '' - latest = highest_version(hit.get('versions', ['-'])) + name = hit["name"] + summary = hit["summary"] or "" + latest = highest_version(hit.get("versions", ["-"])) if terminal_width is not None: target_width = terminal_width - name_column_width - 5 if target_width > 10: # wrap and indent summary to fit terminal summary = textwrap.wrap(summary, target_width) - summary = ('\n' + ' ' * (name_column_width + 3)).join(summary) + summary = ("\n" + " " * (name_column_width + 3)).join(summary) - line = '{name_latest:{name_column_width}} - {summary}'.format( - name_latest='{name} ({latest})'.format(**locals()), - **locals()) + line = "{name_latest:{name_column_width}} - {summary}".format( + name_latest="{name} ({latest})".format(**locals()), **locals() + ) try: write_output(line) if name in installed_packages: dist = pkg_resources.get_distribution(name) with indent_log(): if dist.version == latest: - write_output('INSTALLED: %s (latest)', dist.version) + write_output("INSTALLED: %s (latest)", dist.version) else: - write_output('INSTALLED: %s', dist.version) + write_output("INSTALLED: %s", dist.version) if parse_version(latest).pre: - write_output('LATEST: %s (pre-release; install' - ' with "pip install --pre")', latest) + write_output( + "LATEST: %s (pre-release; install" + ' with "pip install --pre")', + latest, + ) else: - write_output('LATEST: %s', latest) + write_output("LATEST: %s", latest) except UnicodeEncodeError: pass diff --git a/src/fetchcode/vcs/pip/_internal/commands/show.py b/src/fetchcode/vcs/pip/_internal/commands/show.py index b61bcbb1..e4bc1e64 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/show.py +++ b/src/fetchcode/vcs/pip/_internal/commands/show.py @@ -30,23 +30,26 @@ class ShowCommand(Command): def __init__(self, *args, **kw): super(ShowCommand, self).__init__(*args, **kw) self.cmd_opts.add_option( - '-f', '--files', - dest='files', - action='store_true', + "-f", + "--files", + dest="files", + action="store_true", default=False, - help='Show the full list of installed files for each package.') + help="Show the full list of installed files for each package.", + ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options, args): if not args: - logger.warning('ERROR: Please provide a package name or names.') + logger.warning("ERROR: Please provide a package name or names.") return ERROR query = args results = search_packages_info(query) if not print_results( - results, list_files=options.files, verbose=options.verbose): + results, list_files=options.files, verbose=options.verbose + ): return ERROR return SUCCESS @@ -67,55 +70,55 @@ def search_packages_info(query): [name for name, pkg in zip(query, query_names) if pkg not in installed] ) if missing: - logger.warning('Package(s) not found: %s', ', '.join(missing)) + logger.warning("Package(s) not found: %s", ", ".join(missing)) def get_requiring_packages(package_name): canonical_name = canonicalize_name(package_name) return [ - pkg.project_name for pkg in pkg_resources.working_set - if canonical_name in - [canonicalize_name(required.name) for required in - pkg.requires()] + pkg.project_name + for pkg in pkg_resources.working_set + if canonical_name + in [canonicalize_name(required.name) for required in pkg.requires()] ] for dist in [installed[pkg] for pkg in query_names if pkg in installed]: package = { - 'name': dist.project_name, - 'version': dist.version, - 'location': dist.location, - 'requires': [dep.project_name for dep in dist.requires()], - 'required_by': get_requiring_packages(dist.project_name) + "name": dist.project_name, + "version": dist.version, + "location": dist.location, + "requires": [dep.project_name for dep in dist.requires()], + "required_by": get_requiring_packages(dist.project_name), } file_list = None metadata = None if isinstance(dist, pkg_resources.DistInfoDistribution): # RECORDs should be part of .dist-info metadatas - if dist.has_metadata('RECORD'): - lines = dist.get_metadata_lines('RECORD') - paths = [l.split(',')[0] for l in lines] + if dist.has_metadata("RECORD"): + lines = dist.get_metadata_lines("RECORD") + paths = [l.split(",")[0] for l in lines] paths = [os.path.join(dist.location, p) for p in paths] file_list = [os.path.relpath(p, dist.location) for p in paths] - if dist.has_metadata('METADATA'): - metadata = dist.get_metadata('METADATA') + if dist.has_metadata("METADATA"): + metadata = dist.get_metadata("METADATA") else: # Otherwise use pip's log for .egg-info's - if dist.has_metadata('installed-files.txt'): - paths = dist.get_metadata_lines('installed-files.txt') + if dist.has_metadata("installed-files.txt"): + paths = dist.get_metadata_lines("installed-files.txt") paths = [os.path.join(dist.egg_info, p) for p in paths] file_list = [os.path.relpath(p, dist.location) for p in paths] - if dist.has_metadata('PKG-INFO'): - metadata = dist.get_metadata('PKG-INFO') + if dist.has_metadata("PKG-INFO"): + metadata = dist.get_metadata("PKG-INFO") - if dist.has_metadata('entry_points.txt'): - entry_points = dist.get_metadata_lines('entry_points.txt') - package['entry_points'] = entry_points + if dist.has_metadata("entry_points.txt"): + entry_points = dist.get_metadata_lines("entry_points.txt") + package["entry_points"] = entry_points - if dist.has_metadata('INSTALLER'): - for line in dist.get_metadata_lines('INSTALLER'): + if dist.has_metadata("INSTALLER"): + for line in dist.get_metadata_lines("INSTALLER"): if line.strip(): - package['installer'] = line.strip() + package["installer"] = line.strip() break # @todo: Should pkg_resources.Distribution have a @@ -123,19 +126,25 @@ def get_requiring_packages(package_name): feed_parser = FeedParser() feed_parser.feed(metadata) pkg_info_dict = feed_parser.close() - for key in ('metadata-version', 'summary', - 'home-page', 'author', 'author-email', 'license'): + for key in ( + "metadata-version", + "summary", + "home-page", + "author", + "author-email", + "license", + ): package[key] = pkg_info_dict.get(key) # It looks like FeedParser cannot deal with repeated headers classifiers = [] for line in metadata.splitlines(): - if line.startswith('Classifier: '): - classifiers.append(line[len('Classifier: '):]) - package['classifiers'] = classifiers + if line.startswith("Classifier: "): + classifiers.append(line[len("Classifier: ") :]) + package["classifiers"] = classifiers if file_list: - package['files'] = sorted(file_list) + package["files"] = sorted(file_list) yield package @@ -149,30 +158,29 @@ def print_results(distributions, list_files=False, verbose=False): if i > 0: write_output("---") - write_output("Name: %s", dist.get('name', '')) - write_output("Version: %s", dist.get('version', '')) - write_output("Summary: %s", dist.get('summary', '')) - write_output("Home-page: %s", dist.get('home-page', '')) - write_output("Author: %s", dist.get('author', '')) - write_output("Author-email: %s", dist.get('author-email', '')) - write_output("License: %s", dist.get('license', '')) - write_output("Location: %s", dist.get('location', '')) - write_output("Requires: %s", ', '.join(dist.get('requires', []))) - write_output("Required-by: %s", ', '.join(dist.get('required_by', []))) + write_output("Name: %s", dist.get("name", "")) + write_output("Version: %s", dist.get("version", "")) + write_output("Summary: %s", dist.get("summary", "")) + write_output("Home-page: %s", dist.get("home-page", "")) + write_output("Author: %s", dist.get("author", "")) + write_output("Author-email: %s", dist.get("author-email", "")) + write_output("License: %s", dist.get("license", "")) + write_output("Location: %s", dist.get("location", "")) + write_output("Requires: %s", ", ".join(dist.get("requires", []))) + write_output("Required-by: %s", ", ".join(dist.get("required_by", []))) if verbose: - write_output("Metadata-Version: %s", - dist.get('metadata-version', '')) - write_output("Installer: %s", dist.get('installer', '')) + write_output("Metadata-Version: %s", dist.get("metadata-version", "")) + write_output("Installer: %s", dist.get("installer", "")) write_output("Classifiers:") - for classifier in dist.get('classifiers', []): + for classifier in dist.get("classifiers", []): write_output(" %s", classifier) write_output("Entry-points:") - for entry in dist.get('entry_points', []): + for entry in dist.get("entry_points", []): write_output(" %s", entry.strip()) if list_files: write_output("Files:") - for line in dist.get('files', []): + for line in dist.get("files", []): write_output(" %s", line.strip()) if "files" not in dist: write_output("Cannot locate installed-files.txt") diff --git a/src/fetchcode/vcs/pip/_internal/commands/uninstall.py b/src/fetchcode/vcs/pip/_internal/commands/uninstall.py index 4511744e..eb6ec0f5 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/uninstall.py +++ b/src/fetchcode/vcs/pip/_internal/commands/uninstall.py @@ -12,7 +12,9 @@ install_req_from_line, install_req_from_parsed_requirement, ) -from fetchcode.vcs.pip._internal.utils.misc import protect_pip_from_modification_on_windows +from fetchcode.vcs.pip._internal.utils.misc import ( + protect_pip_from_modification_on_windows, +) class UninstallCommand(Command, SessionCommandMixin): @@ -33,19 +35,22 @@ class UninstallCommand(Command, SessionCommandMixin): def __init__(self, *args, **kw): super(UninstallCommand, self).__init__(*args, **kw) self.cmd_opts.add_option( - '-r', '--requirement', - dest='requirements', - action='append', + "-r", + "--requirement", + dest="requirements", + action="append", default=[], - metavar='file', - help='Uninstall all the packages listed in the given requirements ' - 'file. This option can be used multiple times.', + metavar="file", + help="Uninstall all the packages listed in the given requirements " + "file. This option can be used multiple times.", ) self.cmd_opts.add_option( - '-y', '--yes', - dest='yes', - action='store_true', - help="Don't ask for confirmation of uninstall deletions.") + "-y", + "--yes", + dest="yes", + action="store_true", + help="Don't ask for confirmation of uninstall deletions.", + ) self.parser.insert_option_group(0, self.cmd_opts) @@ -55,24 +60,23 @@ def run(self, options, args): reqs_to_uninstall = {} for name in args: req = install_req_from_line( - name, isolated=options.isolated_mode, + name, + isolated=options.isolated_mode, ) if req.name: reqs_to_uninstall[canonicalize_name(req.name)] = req for filename in options.requirements: for parsed_req in parse_requirements( - filename, - options=options, - session=session): + filename, options=options, session=session + ): req = install_req_from_parsed_requirement( - parsed_req, - isolated=options.isolated_mode + parsed_req, isolated=options.isolated_mode ) if req.name: reqs_to_uninstall[canonicalize_name(req.name)] = req if not reqs_to_uninstall: raise InstallationError( - 'You must give at least one requirement to {self.name} (see ' + "You must give at least one requirement to {self.name} (see " '"pip help {self.name}")'.format(**locals()) ) @@ -82,7 +86,8 @@ def run(self, options, args): for req in reqs_to_uninstall.values(): uninstall_pathset = req.uninstall( - auto_confirm=options.yes, verbose=self.verbosity > 0, + auto_confirm=options.yes, + verbose=self.verbosity > 0, ) if uninstall_pathset: uninstall_pathset.commit() diff --git a/src/fetchcode/vcs/pip/_internal/commands/wheel.py b/src/fetchcode/vcs/pip/_internal/commands/wheel.py index efd849a1..df699170 100644 --- a/src/fetchcode/vcs/pip/_internal/commands/wheel.py +++ b/src/fetchcode/vcs/pip/_internal/commands/wheel.py @@ -16,7 +16,10 @@ from fetchcode.vcs.pip._internal.utils.misc import ensure_dir, normalize_path from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectory from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING -from fetchcode.vcs.pip._internal.wheel_builder import build, should_build_for_wheel_command +from fetchcode.vcs.pip._internal.wheel_builder import ( + build, + should_build_for_wheel_command, +) if MYPY_CHECK_RUNNING: from optparse import Values @@ -54,21 +57,24 @@ def __init__(self, *args, **kw): cmd_opts = self.cmd_opts cmd_opts.add_option( - '-w', '--wheel-dir', - dest='wheel_dir', - metavar='dir', + "-w", + "--wheel-dir", + dest="wheel_dir", + metavar="dir", default=os.curdir, - help=("Build wheels into , where the default is the " - "current working directory."), + help=( + "Build wheels into , where the default is the " + "current working directory." + ), ) cmd_opts.add_option(cmdoptions.no_binary()) cmd_opts.add_option(cmdoptions.only_binary()) cmd_opts.add_option(cmdoptions.prefer_binary()) cmd_opts.add_option( - '--build-option', - dest='build_options', - metavar='options', - action='append', + "--build-option", + dest="build_options", + metavar="options", + action="append", help="Extra arguments to be supplied to 'setup.py bdist_wheel'.", ) cmd_opts.add_option(cmdoptions.no_build_isolation()) @@ -84,19 +90,22 @@ def __init__(self, *args, **kw): cmd_opts.add_option(cmdoptions.progress_bar()) cmd_opts.add_option( - '--global-option', - dest='global_options', - action='append', - metavar='options', + "--global-option", + dest="global_options", + action="append", + metavar="options", help="Extra global options to be supplied to the setup.py " - "call before the 'bdist_wheel' command.") + "call before the 'bdist_wheel' command.", + ) cmd_opts.add_option( - '--pre', - action='store_true', + "--pre", + action="store_true", default=False, - help=("Include pre-release and development versions. By default, " - "pip only finds stable versions."), + help=( + "Include pre-release and development versions. By default, " + "pip only finds stable versions." + ), ) cmd_opts.add_option(cmdoptions.require_hashes()) @@ -117,7 +126,7 @@ def run(self, options, args): session = self.get_default_session(options) finder = self._build_package_finder(options, session) - build_delete = (not (options.no_clean or options.build_dir)) + build_delete = not (options.no_clean or options.build_dir) wheel_cache = WheelCache(options.cache_dir, options.format_control) options.wheel_dir = normalize_path(options.wheel_dir) @@ -155,12 +164,11 @@ def run(self, options, args): self.trace_basic_info(finder) - requirement_set = resolver.resolve( - reqs, check_supported_wheels=True - ) + requirement_set = resolver.resolve(reqs, check_supported_wheels=True) reqs_to_build = [ - r for r in requirement_set.requirements.values() + r + for r in requirement_set.requirements.values() if should_build_for_wheel_command(r) ] @@ -180,10 +188,9 @@ def run(self, options, args): except OSError as e: logger.warning( "Building wheel for %s failed: %s", - req.name, e, + req.name, + e, ) build_failures.append(req) if len(build_failures) != 0: - raise CommandError( - "Failed to build one or more wheels" - ) + raise CommandError("Failed to build one or more wheels") diff --git a/src/fetchcode/vcs/pip/_internal/configuration.py b/src/fetchcode/vcs/pip/_internal/configuration.py index 58e00015..6d62e4b7 100644 --- a/src/fetchcode/vcs/pip/_internal/configuration.py +++ b/src/fetchcode/vcs/pip/_internal/configuration.py @@ -31,9 +31,7 @@ from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: - from typing import ( - Any, Dict, Iterable, List, NewType, Optional, Tuple - ) + from typing import Any, Dict, Iterable, List, NewType, Optional, Tuple RawConfigParser = configparser.RawConfigParser # Shorthand Kind = NewType("Kind", str) @@ -44,10 +42,9 @@ # NOTE: Maybe use the optionx attribute to normalize keynames. def _normalize_name(name): # type: (str) -> str - """Make a name consistent regardless of source (environment or file) - """ - name = name.lower().replace('_', '-') - if name.startswith('--'): + """Make a name consistent regardless of source (environment or file)""" + name = name.lower().replace("_", "-") + if name.startswith("--"): name = name[2:] # only prefer long opts return name @@ -65,33 +62,30 @@ def _disassemble_key(name): # The kinds of configurations there are. kinds = enum( - USER="user", # User Specific - GLOBAL="global", # System Wide - SITE="site", # [Virtual] Environment Specific - ENV="env", # from PIP_CONFIG_FILE + USER="user", # User Specific + GLOBAL="global", # System Wide + SITE="site", # [Virtual] Environment Specific + ENV="env", # from PIP_CONFIG_FILE ENV_VAR="env-var", # from Environment Variables ) -CONFIG_BASENAME = 'pip.ini' if WINDOWS else 'pip.conf' +CONFIG_BASENAME = "pip.ini" if WINDOWS else "pip.conf" def get_configuration_files(): # type: () -> Dict[Kind, List[str]] global_config_files = [ - os.path.join(path, CONFIG_BASENAME) - for path in appdirs.site_config_dirs('pip') + os.path.join(path, CONFIG_BASENAME) for path in appdirs.site_config_dirs("pip") ] site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME) legacy_config_file = os.path.join( - expanduser('~'), - 'pip' if WINDOWS else '.pip', + expanduser("~"), + "pip" if WINDOWS else ".pip", CONFIG_BASENAME, ) - new_config_file = os.path.join( - appdirs.user_config_dir("pip"), CONFIG_BASENAME - ) + new_config_file = os.path.join(appdirs.user_config_dir("pip"), CONFIG_BASENAME) return { kinds.GLOBAL: global_config_files, kinds.SITE: [site_config_file], @@ -129,7 +123,11 @@ def __init__(self, isolated, load_only=None): # The order here determines the override order. self._override_order = [ - kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR + kinds.GLOBAL, + kinds.USER, + kinds.SITE, + kinds.ENV, + kinds.ENV_VAR, ] self._ignore_env_names = ["version", "help"] @@ -145,18 +143,15 @@ def __init__(self, isolated, load_only=None): def load(self): # type: () -> None - """Loads configuration from configuration files and environment - """ + """Loads configuration from configuration files and environment""" self._load_config_files() if not self.isolated: self._load_environment_vars() def get_file_to_edit(self): # type: () -> Optional[str] - """Returns the file with highest priority in configuration - """ - assert self.load_only is not None, \ - "Need to be specified a file to be editing" + """Returns the file with highest priority in configuration""" + assert self.load_only is not None, "Need to be specified a file to be editing" try: return self._get_parser_to_modify()[0] @@ -172,8 +167,7 @@ def items(self): def get_value(self, key): # type: (str) -> Any - """Get a value from the configuration. - """ + """Get a value from the configuration.""" try: return self._dictionary[key] except KeyError: @@ -181,8 +175,7 @@ def get_value(self, key): def set_value(self, key, value): # type: (str, Any) -> None - """Modify a value in the configuration. - """ + """Modify a value in the configuration.""" self._ensure_have_load_only() fname, parser = self._get_parser_to_modify() @@ -200,8 +193,7 @@ def set_value(self, key, value): def unset_value(self, key): # type: (str) -> None - """Unset a value in the configuration. - """ + """Unset a value in the configuration.""" self._ensure_have_load_only() if key not in self._config[self.load_only]: @@ -239,8 +231,7 @@ def unset_value(self, key): def save(self): # type: () -> None - """Save the current in-memory state. - """ + """Save the current in-memory state.""" self._ensure_have_load_only() for fname, parser in self._modified_parsers: @@ -265,8 +256,7 @@ def _ensure_have_load_only(self): @property def _dictionary(self): # type: () -> Dict[str, Any] - """A dictionary representing the loaded configuration. - """ + """A dictionary representing the loaded configuration.""" # NOTE: Dictionaries are not populated if not loaded. So, conditionals # are not needed here. retval = {} @@ -278,8 +268,7 @@ def _dictionary(self): def _load_config_files(self): # type: () -> None - """Loads configuration from configuration files - """ + """Loads configuration from configuration files""" config_files = dict(self._iter_config_files()) if config_files[kinds.ENV][0:1] == [os.devnull]: logger.debug( @@ -293,9 +282,7 @@ def _load_config_files(self): # If there's specific variant set in `load_only`, load only # that variant, not the others. if self.load_only is not None and variant != self.load_only: - logger.debug( - "Skipping file '%s' (variant: %s)", fname, variant - ) + logger.debug("Skipping file '%s' (variant: %s)", fname, variant) continue parser = self._load_file(variant, fname) @@ -339,8 +326,7 @@ def _construct_parser(self, fname): def _load_environment_vars(self): # type: () -> None - """Loads configuration from environment variables - """ + """Loads configuration from environment variables""" self._config[kinds.ENV_VAR].update( self._normalized_keys(":env:", self._get_environ_vars()) ) @@ -363,8 +349,7 @@ def _get_environ_vars(self): """Returns a generator with all environmental vars with prefix PIP_""" for key, val in os.environ.items(): should_be_yielded = ( - key.startswith("PIP_") and - key[4:].lower() not in self._ignore_env_names + key.startswith("PIP_") and key[4:].lower() not in self._ignore_env_names ) if should_be_yielded: yield key[4:].lower(), val @@ -379,7 +364,7 @@ def _iter_config_files(self): # SMELL: Move the conditions out of this function # environment variables have the lowest priority - config_file = os.environ.get('PIP_CONFIG_FILE', None) + config_file = os.environ.get("PIP_CONFIG_FILE", None) if config_file is not None: yield kinds.ENV, [config_file] else: diff --git a/src/fetchcode/vcs/pip/_internal/distributions/__init__.py b/src/fetchcode/vcs/pip/_internal/distributions/__init__.py index 3a02295c..68e5e92c 100644 --- a/src/fetchcode/vcs/pip/_internal/distributions/__init__.py +++ b/src/fetchcode/vcs/pip/_internal/distributions/__init__.py @@ -9,8 +9,7 @@ def make_distribution_for_install_requirement(install_req): # type: (InstallRequirement) -> AbstractDistribution - """Returns a Distribution for the given InstallRequirement - """ + """Returns a Distribution for the given InstallRequirement""" # Editable requirements will always be source distributions. They use the # legacy logic until we create a modern standard for them. if install_req.editable: diff --git a/src/fetchcode/vcs/pip/_internal/distributions/sdist.py b/src/fetchcode/vcs/pip/_internal/distributions/sdist.py index af05dfb5..866b3430 100644 --- a/src/fetchcode/vcs/pip/_internal/distributions/sdist.py +++ b/src/fetchcode/vcs/pip/_internal/distributions/sdist.py @@ -50,10 +50,10 @@ def _raise_conflicts(conflicting_with, conflicting_reqs): error_message = format_string.format( requirement=self.req, conflicting_with=conflicting_with, - description=', '.join( - '{} is incompatible with {}'.format(installed, wanted) + description=", ".join( + "{} is incompatible with {}".format(installed, wanted) for installed, wanted in sorted(conflicting) - ) + ), ) raise InstallationError(error_message) @@ -64,15 +64,13 @@ def _raise_conflicts(conflicting_with, conflicting_reqs): self.req.build_env = BuildEnvironment() self.req.build_env.install_requirements( - finder, pyproject_requires, 'overlay', - "Installing build dependencies" + finder, pyproject_requires, "overlay", "Installing build dependencies" ) conflicting, missing = self.req.build_env.check_requirements( self.req.requirements_to_check ) if conflicting: - _raise_conflicts("PEP 517/518 supported requirements", - conflicting) + _raise_conflicts("PEP 517/518 supported requirements", conflicting) if missing: logger.warning( "Missing build requirements in pyproject.toml for %s.", @@ -81,15 +79,13 @@ def _raise_conflicts(conflicting_with, conflicting_reqs): logger.warning( "The project does not specify a build backend, and " "pip cannot fall back to setuptools without %s.", - " and ".join(map(repr, sorted(missing))) + " and ".join(map(repr, sorted(missing))), ) # Install any extra build dependencies that the backend requests. # This must be done in a second pass, as the pyproject.toml # dependencies must be installed before we can call the backend. with self.req.build_env: - runner = runner_with_spinner_message( - "Getting requirements to build wheel" - ) + runner = runner_with_spinner_message("Getting requirements to build wheel") backend = self.req.pep517_backend assert backend is not None with backend.subprocess_runner(runner): @@ -99,6 +95,5 @@ def _raise_conflicts(conflicting_with, conflicting_reqs): if conflicting: _raise_conflicts("the backend dependencies", conflicting) self.req.build_env.install_requirements( - finder, missing, 'normal', - "Installing backend dependencies" + finder, missing, "normal", "Installing backend dependencies" ) diff --git a/src/fetchcode/vcs/pip/_internal/exceptions.py b/src/fetchcode/vcs/pip/_internal/exceptions.py index 69b22b6a..ead253f5 100644 --- a/src/fetchcode/vcs/pip/_internal/exceptions.py +++ b/src/fetchcode/vcs/pip/_internal/exceptions.py @@ -55,10 +55,9 @@ def __str__(self): # type: () -> str # Use `dist` in the error message because its stringification # includes more information, like the version and location. - return ( - 'None {} metadata found for distribution: {}'.format( - self.metadata_name, self.dist, - ) + return "None {} metadata found for distribution: {}".format( + self.metadata_name, + self.dist, ) @@ -111,7 +110,7 @@ def __str__(self): lines.append(cls.head) lines.extend(e.body() for e in errors_of_cls) if lines: - return '\n'.join(lines) + return "\n".join(lines) def __nonzero__(self): return bool(self.errors) @@ -136,8 +135,9 @@ class HashError(InstallationError): typically available earlier. """ + req = None # type: Optional[InstallRequirement] - head = '' + head = "" def body(self): """Return a summary of me for display under the heading. @@ -149,10 +149,10 @@ def body(self): its link already populated by the resolver's _populate_link(). """ - return ' {}'.format(self._requirement_name()) + return " {}".format(self._requirement_name()) def __str__(self): - return '{}\n{}'.format(self.head, self.body()) + return "{}\n{}".format(self.head, self.body()) def _requirement_name(self): """Return a description of the requirement that triggered me. @@ -161,7 +161,7 @@ def _requirement_name(self): line numbers """ - return str(self.req) if self.req else 'unknown package' + return str(self.req) if self.req else "unknown package" class VcsHashUnsupported(HashError): @@ -169,8 +169,10 @@ class VcsHashUnsupported(HashError): we don't have a method for hashing those.""" order = 0 - head = ("Can't verify hashes for these requirements because we don't " - "have a way to hash version control repositories:") + head = ( + "Can't verify hashes for these requirements because we don't " + "have a way to hash version control repositories:" + ) class DirectoryUrlHashUnsupported(HashError): @@ -178,21 +180,25 @@ class DirectoryUrlHashUnsupported(HashError): we don't have a method for hashing those.""" order = 1 - head = ("Can't verify hashes for these file:// requirements because they " - "point to directories:") + head = ( + "Can't verify hashes for these file:// requirements because they " + "point to directories:" + ) class HashMissing(HashError): """A hash was needed for a requirement but is absent.""" order = 2 - head = ('Hashes are required in --require-hashes mode, but they are ' - 'missing from some requirements. Here is a list of those ' - 'requirements along with the hashes their downloaded archives ' - 'actually had. Add lines like these to your requirements files to ' - 'prevent tampering. (If you did not enable --require-hashes ' - 'manually, note that it turns on automatically when any package ' - 'has a hash.)') + head = ( + "Hashes are required in --require-hashes mode, but they are " + "missing from some requirements. Here is a list of those " + "requirements along with the hashes their downloaded archives " + "actually had. Add lines like these to your requirements files to " + "prevent tampering. (If you did not enable --require-hashes " + "manually, note that it turns on automatically when any package " + "has a hash.)" + ) def __init__(self, gotten_hash): """ @@ -210,13 +216,16 @@ def body(self): # In the case of URL-based requirements, display the original URL # seen in the requirements file rather than the package name, # so the output can be directly copied into the requirements file. - package = (self.req.original_link if self.req.original_link - # In case someone feeds something downright stupid - # to InstallRequirement's constructor. - else getattr(self.req, 'req', None)) - return ' {} --hash={}:{}'.format(package or 'unknown package', - FAVORITE_HASH, - self.gotten_hash) + package = ( + self.req.original_link + if self.req.original_link + # In case someone feeds something downright stupid + # to InstallRequirement's constructor. + else getattr(self.req, "req", None) + ) + return " {} --hash={}:{}".format( + package or "unknown package", FAVORITE_HASH, self.gotten_hash + ) class HashUnpinned(HashError): @@ -224,8 +233,10 @@ class HashUnpinned(HashError): version.""" order = 3 - head = ('In --require-hashes mode, all requirements must have their ' - 'versions pinned with ==. These do not:') + head = ( + "In --require-hashes mode, all requirements must have their " + "versions pinned with ==. These do not:" + ) class HashMismatch(HashError): @@ -237,11 +248,14 @@ class HashMismatch(HashError): improve its error message. """ + order = 4 - head = ('THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS ' - 'FILE. If you have updated the package versions, please update ' - 'the hashes. Otherwise, examine the package contents carefully; ' - 'someone may have tampered with them.') + head = ( + "THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS " + "FILE. If you have updated the package versions, please update " + "the hashes. Otherwise, examine the package contents carefully; " + "someone may have tampered with them." + ) def __init__(self, allowed, gots): """ @@ -254,8 +268,7 @@ def __init__(self, allowed, gots): self.gots = gots def body(self): - return ' {}:\n{}'.format(self._requirement_name(), - self._hash_comparison()) + return " {}:\n{}".format(self._requirement_name(), self._hash_comparison()) def _hash_comparison(self): """ @@ -268,19 +281,22 @@ def _hash_comparison(self): Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef """ + def hash_then_or(hash_name): # For now, all the decent hashes have 6-char names, so we can get # away with hard-coding space literals. - return chain([hash_name], repeat(' or')) + return chain([hash_name], repeat(" or")) lines = [] for hash_name, expecteds in iteritems(self.allowed): prefix = hash_then_or(hash_name) - lines.extend((' Expected {} {}'.format(next(prefix), e)) - for e in expecteds) - lines.append(' Got {}\n'.format( - self.gots[hash_name].hexdigest())) - return '\n'.join(lines) + lines.extend( + (" Expected {} {}".format(next(prefix), e)) for e in expecteds + ) + lines.append( + " Got {}\n".format(self.gots[hash_name].hexdigest()) + ) + return "\n".join(lines) class UnsupportedPythonVersion(InstallationError): @@ -289,8 +305,7 @@ class UnsupportedPythonVersion(InstallationError): class ConfigurationFileCouldNotBeLoaded(ConfigurationError): - """When there are errors while loading a configuration file - """ + """When there are errors while loading a configuration file""" def __init__(self, reason="could not be loaded", fname=None, error=None): super(ConfigurationFileCouldNotBeLoaded, self).__init__(error) diff --git a/src/fetchcode/vcs/pip/_internal/index/collector.py b/src/fetchcode/vcs/pip/_internal/index/collector.py index 23365621..949832ac 100644 --- a/src/fetchcode/vcs/pip/_internal/index/collector.py +++ b/src/fetchcode/vcs/pip/_internal/index/collector.py @@ -13,7 +13,11 @@ from fetchcode.vcs.pip._vendor import html5lib, requests from fetchcode.vcs.pip._vendor.distlib.compat import unescape -from fetchcode.vcs.pip._vendor.requests.exceptions import HTTPError, RetryError, SSLError +from fetchcode.vcs.pip._vendor.requests.exceptions import ( + HTTPError, + RetryError, + SSLError, +) from fetchcode.vcs.pip._vendor.six.moves.urllib import parse as urllib_parse from fetchcode.vcs.pip._vendor.six.moves.urllib import request as urllib_request @@ -26,8 +30,16 @@ if MYPY_CHECK_RUNNING: from typing import ( - Callable, Iterable, List, MutableMapping, Optional, - Protocol, Sequence, Tuple, TypeVar, Union, + Callable, + Iterable, + List, + MutableMapping, + Optional, + Protocol, + Sequence, + Tuple, + TypeVar, + Union, ) import xml.etree.ElementTree @@ -40,7 +52,7 @@ ResponseHeaders = MutableMapping[str, str] # Used in the @lru_cache polyfill. - F = TypeVar('F') + F = TypeVar("F") class LruCache(Protocol): def __call__(self, maxsize=None): @@ -58,6 +70,7 @@ def noop_lru_cache(maxsize=None): def _wrapper(f): # type: (F) -> F return f + return _wrapper @@ -71,15 +84,14 @@ def _match_vcs_scheme(url): Returns the matched VCS scheme, or None if there's no match. """ for scheme in vcs.schemes: - if url.lower().startswith(scheme) and url[len(scheme)] in '+:': + if url.lower().startswith(scheme) and url[len(scheme)] in "+:": return scheme return None def _is_url_like_archive(url): # type: (str) -> bool - """Return whether the URL looks like an archive. - """ + """Return whether the URL looks like an archive.""" filename = Link(url).filename for bad_ext in ARCHIVE_EXTENSIONS: if filename.endswith(bad_ext): @@ -118,7 +130,7 @@ def _ensure_html_response(url, session): `_NotHTML` if the content type is not text/html. """ scheme, netloc, path, query, fragment = urllib_parse.urlsplit(url) - if scheme not in {'http', 'https'}: + if scheme not in {"http", "https"}: raise _NotHTTP() resp = session.head(url, allow_redirects=True) @@ -144,7 +156,7 @@ def _get_html_response(url, session): if _is_url_like_archive(url): _ensure_html_response(url, session=session) - logger.debug('Getting page %s', redact_auth_from_url(url)) + logger.debug("Getting page %s", redact_auth_from_url(url)) resp = session.get( url, @@ -180,12 +192,11 @@ def _get_html_response(url, session): def _get_encoding_from_headers(headers): # type: (ResponseHeaders) -> Optional[str] - """Determine if we have any encoding information in our headers. - """ + """Determine if we have any encoding information in our headers.""" if headers and "Content-Type" in headers: content_type, params = cgi.parse_header(headers["Content-Type"]) if "charset" in params: - return params['charset'] + return params["charset"] return None @@ -233,7 +244,7 @@ def _clean_file_url_path(part): # percent-encoded: / -_reserved_chars_re = re.compile('(@|%2F)', re.IGNORECASE) +_reserved_chars_re = re.compile("(@|%2F)", re.IGNORECASE) def _clean_url_path(path, is_local_path): @@ -251,12 +262,12 @@ def _clean_url_path(path, is_local_path): parts = _reserved_chars_re.split(path) cleaned_parts = [] - for to_clean, reserved in pairwise(itertools.chain(parts, [''])): + for to_clean, reserved in pairwise(itertools.chain(parts, [""])): cleaned_parts.append(clean_func(to_clean)) # Normalize %xx escapes (e.g. %2f -> %2F) cleaned_parts.append(reserved.upper()) - return ''.join(cleaned_parts) + return "".join(cleaned_parts) def _clean_link(url): @@ -276,7 +287,7 @@ def _clean_link(url): def _create_link_from_element( - anchor, # type: HTMLElement + anchor, # type: HTMLElement page_url, # type: str base_url, # type: str ): @@ -289,10 +300,10 @@ def _create_link_from_element( return None url = _clean_link(urllib_parse.urljoin(base_url, href)) - pyrequire = anchor.get('data-requires-python') + pyrequire = anchor.get("data-requires-python") pyrequire = unescape(pyrequire) if pyrequire else None - yanked_reason = anchor.get('data-yanked') + yanked_reason = anchor.get("data-yanked") if yanked_reason: # This is a unicode string in Python 2 (and 3). yanked_reason = unescape(yanked_reason) @@ -315,8 +326,7 @@ def __init__(self, page): def __eq__(self, other): # type: (object) -> bool - return (isinstance(other, type(self)) and - self.page.url == other.page.url) + return isinstance(other, type(self)) and self.page.url == other.page.url def __hash__(self): # type: () -> int @@ -324,7 +334,7 @@ def __hash__(self): def with_cached_html_pages( - fn, # type: Callable[[HTMLPage], Iterable[Link]] + fn, # type: Callable[[HTMLPage], Iterable[Link]] ): # type: (...) -> Callable[[HTMLPage], List[Link]] """ @@ -378,9 +388,9 @@ class HTMLPage(object): def __init__( self, - content, # type: bytes - encoding, # type: Optional[str] - url, # type: str + content, # type: bytes + encoding, # type: Optional[str] + url, # type: str cache_link_parsing=True, # type: bool ): # type: (...) -> None @@ -404,7 +414,7 @@ def __str__(self): def _handle_get_page_fail( link, # type: Link reason, # type: Union[str, Exception] - meth=None # type: Optional[Callable[..., None]] + meth=None, # type: Optional[Callable[..., None]] ): # type: (...) -> None if meth is None: @@ -419,7 +429,8 @@ def _make_html_page(response, cache_link_parsing=True): response.content, encoding=encoding, url=response.url, - cache_link_parsing=cache_link_parsing) + cache_link_parsing=cache_link_parsing, + ) def _get_html_page(link, session=None): @@ -429,35 +440,38 @@ def _get_html_page(link, session=None): "_get_html_page() missing 1 required keyword argument: 'session'" ) - url = link.url.split('#', 1)[0] + url = link.url.split("#", 1)[0] # Check for VCS schemes that do not support lookup as web pages. vcs_scheme = _match_vcs_scheme(url) if vcs_scheme: - logger.debug('Cannot look at %s URL %s', vcs_scheme, link) + logger.debug("Cannot look at %s URL %s", vcs_scheme, link) return None # Tack index.html onto file:// URLs that point to directories scheme, _, path, _, _, _ = urllib_parse.urlparse(url) - if (scheme == 'file' and os.path.isdir(urllib_request.url2pathname(path))): + if scheme == "file" and os.path.isdir(urllib_request.url2pathname(path)): # add trailing slash if not present so urljoin doesn't trim # final segment - if not url.endswith('/'): - url += '/' - url = urllib_parse.urljoin(url, 'index.html') - logger.debug(' file: URL is directory, getting %s', url) + if not url.endswith("/"): + url += "/" + url = urllib_parse.urljoin(url, "index.html") + logger.debug(" file: URL is directory, getting %s", url) try: resp = _get_html_response(url, session=session) except _NotHTTP: logger.debug( - 'Skipping page %s because it looks like an archive, and cannot ' - 'be checked by HEAD.', link, + "Skipping page %s because it looks like an archive, and cannot " + "be checked by HEAD.", + link, ) except _NotHTML as exc: logger.debug( - 'Skipping page %s because the %s request got Content-Type: %s', - link, exc.request_desc, exc.content_type, + "Skipping page %s because the %s request got Content-Type: %s", + link, + exc.request_desc, + exc.content_type, ) except HTTPError as exc: _handle_get_page_fail(link, exc) @@ -472,8 +486,7 @@ def _get_html_page(link, session=None): except requests.Timeout: _handle_get_page_fail(link, "timed out") else: - return _make_html_page(resp, - cache_link_parsing=link.cache_link_parsing) + return _make_html_page(resp, cache_link_parsing=link.cache_link_parsing) return None @@ -500,7 +513,7 @@ def group_locations(locations, expand_dir=False): def sort_path(path): # type: (str) -> None url = path_to_url(path) - if mimetypes.guess_type(url, strict=False)[0] == 'text/html': + if mimetypes.guess_type(url, strict=False)[0] == "text/html": urls.append(url) else: files.append(url) @@ -508,7 +521,7 @@ def sort_path(path): for url in locations: is_local_path = os.path.exists(url) - is_file_url = url.startswith('file:') + is_file_url = url.startswith("file:") if is_local_path or is_file_url: if is_local_path: @@ -524,15 +537,14 @@ def sort_path(path): urls.append(url) else: logger.warning( - "Path '{0}' is ignored: " - "it is a directory.".format(path), + "Path '{0}' is ignored: " "it is a directory.".format(path), ) elif os.path.isfile(path): sort_path(path) else: logger.warning( - "Url '%s' is ignored: it is neither a file " - "nor a directory.", url, + "Url '%s' is ignored: it is neither a file " "nor a directory.", + url, ) elif is_url(url): # Only add url with clear scheme @@ -540,7 +552,8 @@ def sort_path(path): else: logger.warning( "Url '%s' is ignored. It is either a non-existing " - "path or lacks a specific scheme.", url, + "path or lacks a specific scheme.", + url, ) return files, urls @@ -565,8 +578,8 @@ class CollectedLinks(object): def __init__( self, - files, # type: List[Link] - find_links, # type: List[Link] + files, # type: List[Link] + find_links, # type: List[Link] project_urls, # type: List[Link] ): # type: (...) -> None @@ -592,7 +605,7 @@ class LinkCollector(object): def __init__( self, - session, # type: PipSession + session, # type: PipSession search_scope, # type: SearchScope ): # type: (...) -> None @@ -621,21 +634,21 @@ def collect_links(self, project_name): index_locations = search_scope.get_index_urls_locations(project_name) index_file_loc, index_url_loc = group_locations(index_locations) fl_file_loc, fl_url_loc = group_locations( - self.find_links, expand_dir=True, + self.find_links, + expand_dir=True, ) - file_links = [ - Link(url) for url in itertools.chain(index_file_loc, fl_file_loc) - ] + file_links = [Link(url) for url in itertools.chain(index_file_loc, fl_file_loc)] # We trust every directly linked archive in find_links - find_link_links = [Link(url, '-f') for url in self.find_links] + find_link_links = [Link(url, "-f") for url in self.find_links] # We trust every url that the user has given us whether it was given # via --index-url or --find-links. # We want to filter out anything that does not have a secure origin. url_locations = [ - link for link in itertools.chain( + link + for link in itertools.chain( # Mark PyPI indices as "cache_link_parsing == False" -- this # will avoid caching the result of parsing the page for links. (Link(url, cache_link_parsing=False) for url in index_url_loc), @@ -646,13 +659,14 @@ def collect_links(self, project_name): url_locations = _remove_duplicate_links(url_locations) lines = [ - '{} location(s) to search for versions of {}:'.format( - len(url_locations), project_name, + "{} location(s) to search for versions of {}:".format( + len(url_locations), + project_name, ), ] for link in url_locations: - lines.append('* {}'.format(link)) - logger.debug('\n'.join(lines)) + lines.append("* {}".format(link)) + logger.debug("\n".join(lines)) return CollectedLinks( files=file_links, diff --git a/src/fetchcode/vcs/pip/_internal/index/package_finder.py b/src/fetchcode/vcs/pip/_internal/index/package_finder.py index af768e54..0907eb18 100644 --- a/src/fetchcode/vcs/pip/_internal/index/package_finder.py +++ b/src/fetchcode/vcs/pip/_internal/index/package_finder.py @@ -34,7 +34,14 @@ if MYPY_CHECK_RUNNING: from typing import ( - FrozenSet, Iterable, List, Optional, Set, Text, Tuple, Union, + FrozenSet, + Iterable, + List, + Optional, + Set, + Text, + Tuple, + Union, ) from fetchcode.vcs.pip._vendor.packaging.tags import Tag @@ -46,12 +53,10 @@ from fetchcode.vcs.pip._internal.utils.hashes import Hashes BuildTag = Union[Tuple[()], Tuple[int, str]] - CandidateSortingKey = ( - Tuple[int, int, int, _BaseVersion, BuildTag, Optional[int]] - ) + CandidateSortingKey = Tuple[int, int, int, _BaseVersion, BuildTag, Optional[int]] -__all__ = ['FormatControl', 'BestCandidateResult', 'PackageFinder'] +__all__ = ["FormatControl", "BestCandidateResult", "PackageFinder"] logger = logging.getLogger(__name__) @@ -74,27 +79,32 @@ def _check_link_requires_python( """ try: is_compatible = check_requires_python( - link.requires_python, version_info=version_info, + link.requires_python, + version_info=version_info, ) except specifiers.InvalidSpecifier: logger.debug( "Ignoring invalid Requires-Python (%r) for link: %s", - link.requires_python, link, + link.requires_python, + link, ) else: if not is_compatible: - version = '.'.join(map(str, version_info)) + version = ".".join(map(str, version_info)) if not ignore_requires_python: logger.debug( - 'Link requires a different Python (%s not in: %r): %s', - version, link.requires_python, link, + "Link requires a different Python (%s not in: %r): %s", + version, + link.requires_python, + link, ) return False logger.debug( - 'Ignoring failed Requires-Python check (%s not in: %r) ' - 'for link: %s', - version, link.requires_python, link, + "Ignoring failed Requires-Python check (%s not in: %r) " "for link: %s", + version, + link.requires_python, + link, ) return True @@ -106,7 +116,7 @@ class LinkEvaluator(object): Responsible for evaluating links for a particular project. """ - _py_version_re = re.compile(r'-py([123]\.?[0-9]?)$') + _py_version_re = re.compile(r"-py([123]\.?[0-9]?)$") # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes @@ -114,11 +124,11 @@ class LinkEvaluator(object): # people when reading the code. def __init__( self, - project_name, # type: str + project_name, # type: str canonical_name, # type: str - formats, # type: FrozenSet[str] - target_python, # type: TargetPython - allow_yanked, # type: bool + formats, # type: FrozenSet[str] + target_python, # type: TargetPython + allow_yanked, # type: bool ignore_requires_python=None, # type: Optional[bool] ): # type: (...) -> None @@ -162,11 +172,11 @@ def evaluate_link(self, link): """ version = None if link.is_yanked and not self._allow_yanked: - reason = link.yanked_reason or '' + reason = link.yanked_reason or "" # Mark this as a unicode string to prevent "UnicodeEncodeError: # 'ascii' codec can't encode character" in Python 2 when # the reason contains non-ascii characters. - return (False, u'yanked for reason: {}'.format(reason)) + return (False, "yanked for reason: {}".format(reason)) if link.egg_fragment: egg_info = link.egg_fragment @@ -174,23 +184,21 @@ def evaluate_link(self, link): else: egg_info, ext = link.splitext() if not ext: - return (False, 'not a file') + return (False, "not a file") if ext not in SUPPORTED_EXTENSIONS: - return (False, 'unsupported archive format: {}'.format(ext)) + return (False, "unsupported archive format: {}".format(ext)) if "binary" not in self._formats and ext == WHEEL_EXTENSION: - reason = 'No binaries permitted for {}'.format( - self.project_name) + reason = "No binaries permitted for {}".format(self.project_name) return (False, reason) - if "macosx10" in link.path and ext == '.zip': - return (False, 'macosx10 one') + if "macosx10" in link.path and ext == ".zip": + return (False, "macosx10 one") if ext == WHEEL_EXTENSION: try: wheel = Wheel(link.filename) except InvalidWheelFilename: - return (False, 'invalid wheel filename') + return (False, "invalid wheel filename") if canonicalize_name(wheel.name) != self._canonical_name: - reason = 'wrong project name (not {})'.format( - self.project_name) + reason = "wrong project name (not {})".format(self.project_name) return (False, reason) supported_tags = self._target_python.get_tags() @@ -198,10 +206,8 @@ def evaluate_link(self, link): # Include the wheel's tags in the reason string to # simplify troubleshooting compatibility issues. file_tags = wheel.get_formatted_file_tags() - reason = ( - "none of the wheel's tags match: {}".format( - ', '.join(file_tags) - ) + reason = "none of the wheel's tags match: {}".format( + ", ".join(file_tags) ) return (False, reason) @@ -209,26 +215,28 @@ def evaluate_link(self, link): # This should be up by the self.ok_binary check, but see issue 2700. if "source" not in self._formats and ext != WHEEL_EXTENSION: - reason = 'No sources permitted for {}'.format(self.project_name) + reason = "No sources permitted for {}".format(self.project_name) return (False, reason) if not version: version = _extract_version_from_fragment( - egg_info, self._canonical_name, + egg_info, + self._canonical_name, ) if not version: - reason = 'Missing project version for {}'.format(self.project_name) + reason = "Missing project version for {}".format(self.project_name) return (False, reason) match = self._py_version_re.search(version) if match: - version = version[:match.start()] + version = version[: match.start()] py_version = match.group(1) if py_version != self._target_python.py_version: - return (False, 'Python version is incorrect') + return (False, "Python version is incorrect") supports_python = _check_link_requires_python( - link, version_info=self._target_python.py_version_info, + link, + version_info=self._target_python.py_version_info, ignore_requires_python=self._ignore_requires_python, ) if not supports_python: @@ -236,14 +244,14 @@ def evaluate_link(self, link): # _log_skipped_link(). return (False, None) - logger.debug('Found link %s, version: %s', link, version) + logger.debug("Found link %s, version: %s", link, version) return (True, version) def filter_unallowed_hashes( - candidates, # type: List[InstallationCandidate] - hashes, # type: Hashes + candidates, # type: List[InstallationCandidate] + hashes, # type: Hashes project_name, # type: str ): # type: (...) -> List[InstallationCandidate] @@ -264,8 +272,8 @@ def filter_unallowed_hashes( """ if not hashes: logger.debug( - 'Given no hashes to check %s links for project %r: ' - 'discarding no candidates', + "Given no hashes to check %s links for project %r: " + "discarding no candidates", len(candidates), project_name, ) @@ -295,22 +303,22 @@ def filter_unallowed_hashes( filtered = list(candidates) if len(filtered) == len(candidates): - discard_message = 'discarding no candidates' + discard_message = "discarding no candidates" else: - discard_message = 'discarding {} non-matches:\n {}'.format( + discard_message = "discarding {} non-matches:\n {}".format( len(non_matches), - '\n '.join(str(candidate.link) for candidate in non_matches) + "\n ".join(str(candidate.link) for candidate in non_matches), ) logger.debug( - 'Checked %s links for project %r against %s hashes ' - '(%s matches, %s no digest): %s', + "Checked %s links for project %r against %s hashes " + "(%s matches, %s no digest): %s", len(candidates), project_name, hashes.digest_count, match_count, len(matches_or_no_digest) - match_count, - discard_message + discard_message, ) return filtered @@ -345,9 +353,9 @@ class BestCandidateResult(object): def __init__( self, - candidates, # type: List[InstallationCandidate] + candidates, # type: List[InstallationCandidate] applicable_candidates, # type: List[InstallationCandidate] - best_candidate, # type: Optional[InstallationCandidate] + best_candidate, # type: Optional[InstallationCandidate] ): # type: (...) -> None """ @@ -370,14 +378,12 @@ def __init__( def iter_all(self): # type: () -> Iterable[InstallationCandidate] - """Iterate through all candidates. - """ + """Iterate through all candidates.""" return iter(self._candidates) def iter_applicable(self): # type: () -> Iterable[InstallationCandidate] - """Iterate through the applicable candidates. - """ + """Iterate through the applicable candidates.""" return iter(self._applicable_candidates) @@ -391,12 +397,12 @@ class CandidateEvaluator(object): @classmethod def create( cls, - project_name, # type: str - target_python=None, # type: Optional[TargetPython] + project_name, # type: str + target_python=None, # type: Optional[TargetPython] prefer_binary=False, # type: bool allow_all_prereleases=False, # type: bool - specifier=None, # type: Optional[specifiers.BaseSpecifier] - hashes=None, # type: Optional[Hashes] + specifier=None, # type: Optional[specifiers.BaseSpecifier] + hashes=None, # type: Optional[Hashes] ): # type: (...) -> CandidateEvaluator """Create a CandidateEvaluator object. @@ -427,12 +433,12 @@ def create( def __init__( self, - project_name, # type: str - supported_tags, # type: List[Tag] - specifier, # type: specifiers.BaseSpecifier + project_name, # type: str + supported_tags, # type: List[Tag] + specifier, # type: specifiers.BaseSpecifier prefer_binary=False, # type: bool allow_all_prereleases=False, # type: bool - hashes=None, # type: Optional[Hashes] + hashes=None, # type: Optional[Hashes] ): # type: (...) -> None """ @@ -458,7 +464,8 @@ def get_applicable_candidates( allow_prereleases = self._allow_all_prereleases or None specifier = self._specifier versions = { - str(v) for v in specifier.filter( + str(v) + for v in specifier.filter( # We turn the version object into a str here because otherwise # when we're debundled but setuptools isn't, Python will see # packaging.version.Version and @@ -472,9 +479,7 @@ def get_applicable_candidates( } # Again, converting version to str to deal with debundling. - applicable_candidates = [ - c for c in candidates if str(c.version) in versions - ] + applicable_candidates = [c for c in candidates if str(c.version) in versions] filtered_applicable_candidates = filter_unallowed_hashes( candidates=applicable_candidates, @@ -532,7 +537,7 @@ def _sort_key(self, candidate): binary_preference = 1 pri = -(wheel.support_index_min(valid_tags)) if wheel.build_tag is not None: - match = re.match(r'^(\d+)(.*)$', wheel.build_tag) + match = re.match(r"^(\d+)(.*)$", wheel.build_tag) build_tag_groups = match.groups() build_tag = (int(build_tag_groups[0]), build_tag_groups[1]) else: # sdist @@ -540,13 +545,17 @@ def _sort_key(self, candidate): has_allowed_hash = int(link.is_hash_allowed(self._hashes)) yank_value = -1 * int(link.is_yanked) # -1 for yanked. return ( - has_allowed_hash, yank_value, binary_preference, candidate.version, - build_tag, pri, + has_allowed_hash, + yank_value, + binary_preference, + candidate.version, + build_tag, + pri, ) def sort_best_candidate( self, - candidates, # type: List[InstallationCandidate] + candidates, # type: List[InstallationCandidate] ): # type: (...) -> Optional[InstallationCandidate] """ @@ -561,14 +570,14 @@ def sort_best_candidate( # Log a warning per PEP 592 if necessary before returning. link = best_candidate.link if link.is_yanked: - reason = link.yanked_reason or '' + reason = link.yanked_reason or "" msg = ( # Mark this as a unicode string to prevent # "UnicodeEncodeError: 'ascii' codec can't encode character" # in Python 2 when the reason contains non-ascii characters. - u'The candidate selected for download or install is a ' - 'yanked version: {candidate}\n' - 'Reason for being yanked: {reason}' + "The candidate selected for download or install is a " + "yanked version: {candidate}\n" + "Reason for being yanked: {reason}" ).format(candidate=best_candidate, reason=reason) logger.warning(msg) @@ -576,7 +585,7 @@ def sort_best_candidate( def compute_best_candidate( self, - candidates, # type: List[InstallationCandidate] + candidates, # type: List[InstallationCandidate] ): # type: (...) -> BestCandidateResult """ @@ -602,11 +611,11 @@ class PackageFinder(object): def __init__( self, - link_collector, # type: LinkCollector - target_python, # type: TargetPython - allow_yanked, # type: bool + link_collector, # type: LinkCollector + target_python, # type: TargetPython + allow_yanked, # type: bool format_control=None, # type: Optional[FormatControl] - candidate_prefs=None, # type: CandidatePreferences + candidate_prefs=None, # type: CandidatePreferences ignore_requires_python=None, # type: Optional[bool] ): # type: (...) -> None @@ -643,8 +652,8 @@ def __init__( @classmethod def create( cls, - link_collector, # type: LinkCollector - selection_prefs, # type: SelectionPreferences + link_collector, # type: LinkCollector + selection_prefs, # type: SelectionPreferences target_python=None, # type: Optional[TargetPython] ): # type: (...) -> PackageFinder @@ -747,7 +756,7 @@ def _log_skipped_link(self, link, reason): # the reason contains non-ascii characters. # Also, put the link at the end so the reason is more visible # and because the link string is usually very long. - logger.debug(u'Skipping link: %s: %s', reason, link) + logger.debug("Skipping link: %s: %s", reason, link) self._logged_links.add(link) def get_install_candidate(self, link_evaluator, link): @@ -786,7 +795,8 @@ def evaluate_links(self, link_evaluator, links): def process_project_url(self, project_url, link_evaluator): # type: (Link, LinkEvaluator) -> List[InstallationCandidate] logger.debug( - 'Fetching project page and analyzing links: %s', project_url, + "Fetching project page and analyzing links: %s", + project_url, ) html_page = self._link_collector.fetch_page(project_url) if html_page is None: @@ -824,7 +834,8 @@ def find_all_candidates(self, project_name): page_versions = [] for project_url in collected_links.project_urls: package_links = self.process_project_url( - project_url, link_evaluator=link_evaluator, + project_url, + link_evaluator=link_evaluator, ) page_versions.extend(package_links) @@ -835,11 +846,10 @@ def find_all_candidates(self, project_name): if file_versions: file_versions.sort(reverse=True) logger.debug( - 'Local files found: %s', - ', '.join([ - url_to_path(candidate.link.url) - for candidate in file_versions - ]) + "Local files found: %s", + ", ".join( + [url_to_path(candidate.link.url) for candidate in file_versions] + ), ) # This is an intentional priority ordering @@ -847,13 +857,12 @@ def find_all_candidates(self, project_name): def make_candidate_evaluator( self, - project_name, # type: str + project_name, # type: str specifier=None, # type: Optional[specifiers.BaseSpecifier] - hashes=None, # type: Optional[Hashes] + hashes=None, # type: Optional[Hashes] ): # type: (...) -> CandidateEvaluator - """Create a CandidateEvaluator object to use. - """ + """Create a CandidateEvaluator object to use.""" candidate_prefs = self._candidate_prefs return CandidateEvaluator.create( project_name=project_name, @@ -866,9 +875,9 @@ def make_candidate_evaluator( def find_best_candidate( self, - project_name, # type: str - specifier=None, # type: Optional[specifiers.BaseSpecifier] - hashes=None, # type: Optional[Hashes] + project_name, # type: str + specifier=None, # type: Optional[specifiers.BaseSpecifier] + hashes=None, # type: Optional[Hashes] ): # type: (...) -> BestCandidateResult """Find matches for the given project and specifier. @@ -897,11 +906,13 @@ def find_requirement(self, req, upgrade): """ hashes = req.hashes(trust_internet=False) best_candidate_result = self.find_best_candidate( - req.name, specifier=req.specifier, hashes=hashes, + req.name, + specifier=req.specifier, + hashes=hashes, ) best_candidate = best_candidate_result.best_candidate - installed_version = None # type: Optional[_BaseVersion] + installed_version = None # type: Optional[_BaseVersion] if req.satisfied_by is not None: installed_version = parse_version(req.satisfied_by.version) @@ -911,41 +922,45 @@ def _format_versions(cand_iter): # handle different vendoring sources from pip and pkg_resources. # If we stop using the pkg_resources provided specifier and start # using our own, we can drop the cast to str(). - return ", ".join(sorted( - {str(c.version) for c in cand_iter}, - key=parse_version, - )) or "none" + return ( + ", ".join( + sorted( + {str(c.version) for c in cand_iter}, + key=parse_version, + ) + ) + or "none" + ) if installed_version is None and best_candidate is None: logger.critical( - 'Could not find a version that satisfies the requirement %s ' - '(from versions: %s)', + "Could not find a version that satisfies the requirement %s " + "(from versions: %s)", req, _format_versions(best_candidate_result.iter_all()), ) raise DistributionNotFound( - 'No matching distribution found for {}'.format( - req) + "No matching distribution found for {}".format(req) ) best_installed = False if installed_version and ( - best_candidate is None or - best_candidate.version <= installed_version): + best_candidate is None or best_candidate.version <= installed_version + ): best_installed = True if not upgrade and installed_version is not None: if best_installed: logger.debug( - 'Existing installed version (%s) is most up-to-date and ' - 'satisfies requirement', + "Existing installed version (%s) is most up-to-date and " + "satisfies requirement", installed_version, ) else: logger.debug( - 'Existing installed version (%s) satisfies requirement ' - '(most up-to-date version is %s)', + "Existing installed version (%s) satisfies requirement " + "(most up-to-date version is %s)", installed_version, best_candidate.version, ) @@ -954,15 +969,14 @@ def _format_versions(cand_iter): if best_installed: # We have an existing version, and its the best version logger.debug( - 'Installed version (%s) is most up-to-date (past versions: ' - '%s)', + "Installed version (%s) is most up-to-date (past versions: " "%s)", installed_version, _format_versions(best_candidate_result.iter_applicable()), ) raise BestVersionAlreadyInstalled logger.debug( - 'Using version %s (newest of versions: %s)', + "Using version %s (newest of versions: %s)", best_candidate.version, _format_versions(best_candidate_result.iter_applicable()), ) diff --git a/src/fetchcode/vcs/pip/_internal/locations.py b/src/fetchcode/vcs/pip/_internal/locations.py index fda7f02a..84e680c7 100644 --- a/src/fetchcode/vcs/pip/_internal/locations.py +++ b/src/fetchcode/vcs/pip/_internal/locations.py @@ -36,22 +36,20 @@ def get_major_minor_version(): Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". """ - return '{}.{}'.format(*sys.version_info) + return "{}.{}".format(*sys.version_info) def get_src_prefix(): # type: () -> str if running_under_virtualenv(): - src_prefix = os.path.join(sys.prefix, 'src') + src_prefix = os.path.join(sys.prefix, "src") else: # FIXME: keep src in cwd for now (it is not a temporary folder) try: - src_prefix = os.path.join(os.getcwd(), 'src') + src_prefix = os.path.join(os.getcwd(), "src") except OSError: # In case the current working directory has been renamed or deleted - sys.exit( - "The folder you are executing pip from can no longer be found." - ) + sys.exit("The folder you are executing pip from can no longer be found.") # under macOS + virtualenv sys.prefix is not properly resolved # it is something like /path/to/python/bin/.. @@ -75,20 +73,20 @@ def get_src_prefix(): user_site = site.USER_SITE if WINDOWS: - bin_py = os.path.join(sys.prefix, 'Scripts') - bin_user = os.path.join(user_site, 'Scripts') + bin_py = os.path.join(sys.prefix, "Scripts") + bin_user = os.path.join(user_site, "Scripts") # buildout uses 'bin' on Windows too? if not os.path.exists(bin_py): - bin_py = os.path.join(sys.prefix, 'bin') - bin_user = os.path.join(user_site, 'bin') + bin_py = os.path.join(sys.prefix, "bin") + bin_user = os.path.join(user_site, "bin") else: - bin_py = os.path.join(sys.prefix, 'bin') - bin_user = os.path.join(user_site, 'bin') + bin_py = os.path.join(sys.prefix, "bin") + bin_user = os.path.join(user_site, "bin") # Forcing to use /usr/local/bin for standard macOS framework installs # Also log to ~/Library/Logs/ for use with the Console.app log viewer - if sys.platform[:6] == 'darwin' and sys.prefix[:16] == '/System/Library/': - bin_py = '/usr/local/bin' + if sys.platform[:6] == "darwin" and sys.prefix[:16] == "/System/Library/": + bin_py = "/usr/local/bin" def distutils_scheme( @@ -100,14 +98,14 @@ def distutils_scheme( """ from distutils.dist import Distribution - dist_args = {'name': dist_name} # type: Dict[str, Union[str, List[str]]] + dist_args = {"name": dist_name} # type: Dict[str, Union[str, List[str]]] if isolated: dist_args["script_args"] = ["--no-user-cfg"] d = Distribution(dist_args) d.parse_config_files() obj = None # type: Optional[DistutilsCommand] - obj = d.get_command_obj('install', create=True) + obj = d.get_command_obj("install", create=True) assert obj is not None i = cast(distutils_install_command, obj) # NOTE: setting user or home has the side-effect of creating the home dir @@ -125,28 +123,27 @@ def distutils_scheme( scheme = {} for key in SCHEME_KEYS: - scheme[key] = getattr(i, 'install_' + key) + scheme[key] = getattr(i, "install_" + key) # install_lib specified in setup.cfg should install *everything* # into there (i.e. it takes precedence over both purelib and # platlib). Note, i.install_lib is *always* set after # finalize_options(); we only want to override here if the user # has explicitly requested it hence going back to the config - if 'install_lib' in d.get_option_dict('install'): + if "install_lib" in d.get_option_dict("install"): scheme.update(dict(purelib=i.install_lib, platlib=i.install_lib)) if running_under_virtualenv(): - scheme['headers'] = os.path.join( + scheme["headers"] = os.path.join( sys.prefix, - 'include', - 'site', - 'python{}'.format(get_major_minor_version()), + "include", + "site", + "python{}".format(get_major_minor_version()), dist_name, ) if root is not None: - path_no_drive = os.path.splitdrive( - os.path.abspath(scheme["headers"]))[1] + path_no_drive = os.path.splitdrive(os.path.abspath(scheme["headers"]))[1] scheme["headers"] = os.path.join( root, path_no_drive[1:], @@ -181,9 +178,7 @@ def get_scheme( :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same """ - scheme = distutils_scheme( - dist_name, user, home, root, isolated, prefix - ) + scheme = distutils_scheme(dist_name, user, home, root, isolated, prefix) return Scheme( platlib=scheme["platlib"], purelib=scheme["purelib"], diff --git a/src/fetchcode/vcs/pip/_internal/models/candidate.py b/src/fetchcode/vcs/pip/_internal/models/candidate.py index f643d2d3..829e0d6c 100644 --- a/src/fetchcode/vcs/pip/_internal/models/candidate.py +++ b/src/fetchcode/vcs/pip/_internal/models/candidate.py @@ -9,8 +9,7 @@ class InstallationCandidate(KeyBasedCompareMixin): - """Represents a potential "candidate" for installation. - """ + """Represents a potential "candidate" for installation.""" def __init__(self, name, version, link): # type: (str, str, Link) -> None @@ -20,17 +19,21 @@ def __init__(self, name, version, link): super(InstallationCandidate, self).__init__( key=(self.name, self.version, self.link), - defining_class=InstallationCandidate + defining_class=InstallationCandidate, ) def __repr__(self): # type: () -> str return "".format( - self.name, self.version, self.link, + self.name, + self.version, + self.link, ) def __str__(self): # type: () -> str - return '{!r} candidate (version {} at {})'.format( - self.name, self.version, self.link, + return "{!r} candidate (version {} at {})".format( + self.name, + self.version, + self.link, ) diff --git a/src/fetchcode/vcs/pip/_internal/models/direct_url.py b/src/fetchcode/vcs/pip/_internal/models/direct_url.py index 3030f9d1..8f3ba2b3 100644 --- a/src/fetchcode/vcs/pip/_internal/models/direct_url.py +++ b/src/fetchcode/vcs/pip/_internal/models/direct_url.py @@ -8,9 +8,7 @@ from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: - from typing import ( - Any, Dict, Iterable, Optional, Type, TypeVar, Union - ) + from typing import Any, Dict, Iterable, Optional, Type, TypeVar, Union T = TypeVar("T") @@ -153,9 +151,7 @@ def _from_dict(cls, d): # type: (Optional[Dict[str, Any]]) -> Optional[DirInfo] if d is None: return None - return cls( - editable=_get_required(d, bool, "editable", default=False) - ) + return cls(editable=_get_required(d, bool, "editable", default=False)) def _to_dict(self): # type: () -> Dict[str, Any] @@ -167,7 +163,6 @@ def _to_dict(self): class DirectUrl(object): - def __init__( self, url, # type: str @@ -184,9 +179,9 @@ def _remove_auth_from_netloc(self, netloc): return netloc user_pass, netloc_no_user_pass = netloc.split("@", 1) if ( - isinstance(self.info, VcsInfo) and - self.info.vcs == "git" and - user_pass == "git" + isinstance(self.info, VcsInfo) + and self.info.vcs == "git" + and user_pass == "git" ): return netloc if ENV_VAR_RE.match(user_pass): diff --git a/src/fetchcode/vcs/pip/_internal/models/format_control.py b/src/fetchcode/vcs/pip/_internal/models/format_control.py index 1db1130b..6b201231 100644 --- a/src/fetchcode/vcs/pip/_internal/models/format_control.py +++ b/src/fetchcode/vcs/pip/_internal/models/format_control.py @@ -11,8 +11,7 @@ class FormatControl(object): - """Helper for managing formats from which a package can be installed. - """ + """Helper for managing formats from which a package can be installed.""" def __init__(self, no_binary=None, only_binary=None): # type: (Optional[Set[str]], Optional[Set[str]]) -> None @@ -35,29 +34,27 @@ def __ne__(self, other): def __repr__(self): # type: () -> str return "{}({}, {})".format( - self.__class__.__name__, - self.no_binary, - self.only_binary + self.__class__.__name__, self.no_binary, self.only_binary ) @staticmethod def handle_mutual_excludes(value, target, other): # type: (str, Optional[Set[str]], Optional[Set[str]]) -> None - if value.startswith('-'): + if value.startswith("-"): raise CommandError( "--no-binary / --only-binary option requires 1 argument." ) - new = value.split(',') - while ':all:' in new: + new = value.split(",") + while ":all:" in new: other.clear() target.clear() - target.add(':all:') - del new[:new.index(':all:') + 1] + target.add(":all:") + del new[: new.index(":all:") + 1] # Without a none, we want to discard everything as :all: covers it - if ':none:' not in new: + if ":none:" not in new: return for name in new: - if name == ':none:': + if name == ":none:": target.clear() continue name = canonicalize_name(name) @@ -68,17 +65,19 @@ def get_allowed_formats(self, canonical_name): # type: (str) -> FrozenSet[str] result = {"binary", "source"} if canonical_name in self.only_binary: - result.discard('source') + result.discard("source") elif canonical_name in self.no_binary: - result.discard('binary') - elif ':all:' in self.only_binary: - result.discard('source') - elif ':all:' in self.no_binary: - result.discard('binary') + result.discard("binary") + elif ":all:" in self.only_binary: + result.discard("source") + elif ":all:" in self.no_binary: + result.discard("binary") return frozenset(result) def disallow_binaries(self): # type: () -> None self.handle_mutual_excludes( - ':all:', self.no_binary, self.only_binary, + ":all:", + self.no_binary, + self.only_binary, ) diff --git a/src/fetchcode/vcs/pip/_internal/models/index.py b/src/fetchcode/vcs/pip/_internal/models/index.py index 845ac017..24a63096 100644 --- a/src/fetchcode/vcs/pip/_internal/models/index.py +++ b/src/fetchcode/vcs/pip/_internal/models/index.py @@ -2,16 +2,15 @@ class PackageIndex(object): - """Represents a Package Index and provides easier access to endpoints - """ + """Represents a Package Index and provides easier access to endpoints""" def __init__(self, url, file_storage_domain): # type: (str, str) -> None super(PackageIndex, self).__init__() self.url = url self.netloc = urllib_parse.urlsplit(url).netloc - self.simple_url = self._url_for_path('simple') - self.pypi_url = self._url_for_path('pypi') + self.simple_url = self._url_for_path("simple") + self.pypi_url = self._url_for_path("pypi") # This is part of a temporary hack used to block installs of PyPI # packages which depend on external urls only necessary until PyPI can @@ -23,9 +22,7 @@ def _url_for_path(self, path): return urllib_parse.urljoin(self.url, path) -PyPI = PackageIndex( - 'https://pypi.org/', file_storage_domain='files.pythonhosted.org' -) +PyPI = PackageIndex("https://pypi.org/", file_storage_domain="files.pythonhosted.org") TestPyPI = PackageIndex( - 'https://test.pypi.org/', file_storage_domain='test-files.pythonhosted.org' + "https://test.pypi.org/", file_storage_domain="test-files.pythonhosted.org" ) diff --git a/src/fetchcode/vcs/pip/_internal/models/link.py b/src/fetchcode/vcs/pip/_internal/models/link.py index 5ded7ae6..7d248c28 100644 --- a/src/fetchcode/vcs/pip/_internal/models/link.py +++ b/src/fetchcode/vcs/pip/_internal/models/link.py @@ -21,15 +21,14 @@ class Link(KeyBasedCompareMixin): - """Represents a parsed link from a Package Index's simple URL - """ + """Represents a parsed link from a Package Index's simple URL""" def __init__( self, - url, # type: str - comes_from=None, # type: Optional[Union[str, HTMLPage]] + url, # type: str + comes_from=None, # type: Optional[Union[str, HTMLPage]] requires_python=None, # type: Optional[str] - yanked_reason=None, # type: Optional[Text] + yanked_reason=None, # type: Optional[Text] cache_link_parsing=True, # type: bool ): # type: (...) -> None @@ -55,7 +54,7 @@ def __init__( """ # url can be a UNC windows share - if url.startswith('\\\\'): + if url.startswith("\\\\"): url = path_to_url(url) self._parsed_url = urllib_parse.urlsplit(url) @@ -74,18 +73,19 @@ def __init__( def __str__(self): # type: () -> str if self.requires_python: - rp = ' (requires-python:{})'.format(self.requires_python) + rp = " (requires-python:{})".format(self.requires_python) else: - rp = '' + rp = "" if self.comes_from: - return '{} (from {}){}'.format( - redact_auth_from_url(self._url), self.comes_from, rp) + return "{} (from {}){}".format( + redact_auth_from_url(self._url), self.comes_from, rp + ) else: return redact_auth_from_url(str(self._url)) def __repr__(self): # type: () -> str - return ''.format(self) + return "".format(self) @property def url(self): @@ -95,7 +95,7 @@ def url(self): @property def filename(self): # type: () -> str - path = self.path.rstrip('/') + path = self.path.rstrip("/") name = posixpath.basename(path) if not name: # Make sure we don't leak auth information if the netloc @@ -104,8 +104,7 @@ def filename(self): return netloc name = urllib_parse.unquote(name) - assert name, ( - 'URL {self._url!r} produced no filename'.format(**locals())) + assert name, "URL {self._url!r} produced no filename".format(**locals()) return name @property @@ -133,7 +132,7 @@ def path(self): def splitext(self): # type: () -> Tuple[str, str] - return splitext(posixpath.basename(self.path.rstrip('/'))) + return splitext(posixpath.basename(self.path.rstrip("/"))) @property def ext(self): @@ -146,7 +145,7 @@ def url_without_fragment(self): scheme, netloc, path, query, fragment = self._parsed_url return urllib_parse.urlunsplit((scheme, netloc, path, query, None)) - _egg_fragment_re = re.compile(r'[#&]egg=([^&]*)') + _egg_fragment_re = re.compile(r"[#&]egg=([^&]*)") @property def egg_fragment(self): @@ -156,7 +155,7 @@ def egg_fragment(self): return None return match.group(1) - _subdirectory_fragment_re = re.compile(r'[#&]subdirectory=([^&]*)') + _subdirectory_fragment_re = re.compile(r"[#&]subdirectory=([^&]*)") @property def subdirectory_fragment(self): @@ -166,9 +165,7 @@ def subdirectory_fragment(self): return None return match.group(1) - _hash_re = re.compile( - r'(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)' - ) + _hash_re = re.compile(r"(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)") @property def hash(self): @@ -189,12 +186,12 @@ def hash_name(self): @property def show_url(self): # type: () -> str - return posixpath.basename(self._url.split('#', 1)[0].split('?', 1)[0]) + return posixpath.basename(self._url.split("#", 1)[0].split("?", 1)[0]) @property def is_file(self): # type: () -> bool - return self.scheme == 'file' + return self.scheme == "file" def is_existing_dir(self): # type: () -> bool diff --git a/src/fetchcode/vcs/pip/_internal/models/scheme.py b/src/fetchcode/vcs/pip/_internal/models/scheme.py index af07b407..1539c720 100644 --- a/src/fetchcode/vcs/pip/_internal/models/scheme.py +++ b/src/fetchcode/vcs/pip/_internal/models/scheme.py @@ -10,6 +10,7 @@ class Scheme(object): """A Scheme holds paths which are used as the base directories for artifacts associated with a Python package. """ + def __init__( self, platlib, # type: str diff --git a/src/fetchcode/vcs/pip/_internal/models/search_scope.py b/src/fetchcode/vcs/pip/_internal/models/search_scope.py index df32a080..afc8b74f 100644 --- a/src/fetchcode/vcs/pip/_internal/models/search_scope.py +++ b/src/fetchcode/vcs/pip/_internal/models/search_scope.py @@ -41,7 +41,7 @@ def create( # blindly normalize anything starting with a ~... built_find_links = [] # type: List[str] for link in find_links: - if link.startswith('~'): + if link.startswith("~"): new_link = normalize_path(link) if os.path.exists(new_link): link = new_link @@ -52,11 +52,11 @@ def create( if not has_tls(): for link in itertools.chain(index_urls, built_find_links): parsed = urllib_parse.urlparse(link) - if parsed.scheme == 'https': + if parsed.scheme == "https": logger.warning( - 'pip is configured with locations that require ' - 'TLS/SSL, however the ssl module in Python is not ' - 'available.' + "pip is configured with locations that require " + "TLS/SSL, however the ssl module in Python is not " + "available." ) break @@ -94,19 +94,22 @@ def get_formatted_locations(self): if not purl.scheme and not purl.netloc: logger.warning( 'The index url "{}" seems invalid, ' - 'please provide a scheme.'.format(redacted_index_url)) + "please provide a scheme.".format(redacted_index_url) + ) redacted_index_urls.append(redacted_index_url) - lines.append('Looking in indexes: {}'.format( - ', '.join(redacted_index_urls))) + lines.append( + "Looking in indexes: {}".format(", ".join(redacted_index_urls)) + ) if self.find_links: lines.append( - 'Looking in links: {}'.format(', '.join( - redact_auth_from_url(url) for url in self.find_links)) + "Looking in links: {}".format( + ", ".join(redact_auth_from_url(url) for url in self.find_links) + ) ) - return '\n'.join(lines) + return "\n".join(lines) def get_index_urls_locations(self, project_name): # type: (str) -> List[str] @@ -119,15 +122,15 @@ def get_index_urls_locations(self, project_name): def mkurl_pypi_url(url): # type: (str) -> str loc = posixpath.join( - url, - urllib_parse.quote(canonicalize_name(project_name))) + url, urllib_parse.quote(canonicalize_name(project_name)) + ) # For maximum compatibility with easy_install, ensure the path # ends in a trailing slash. Although this isn't in the spec # (and PyPI can handle it without the slash) some other index # implementations might break if they relied on easy_install's # behavior. - if not loc.endswith('/'): - loc = loc + '/' + if not loc.endswith("/"): + loc = loc + "/" return loc return [mkurl_pypi_url(url) for url in self.index_urls] diff --git a/src/fetchcode/vcs/pip/_internal/models/selection_prefs.py b/src/fetchcode/vcs/pip/_internal/models/selection_prefs.py index 87ff0f18..a2cd774f 100644 --- a/src/fetchcode/vcs/pip/_internal/models/selection_prefs.py +++ b/src/fetchcode/vcs/pip/_internal/models/selection_prefs.py @@ -20,8 +20,8 @@ def __init__( self, allow_yanked, # type: bool allow_all_prereleases=False, # type: bool - format_control=None, # type: Optional[FormatControl] - prefer_binary=False, # type: bool + format_control=None, # type: Optional[FormatControl] + prefer_binary=False, # type: bool ignore_requires_python=None, # type: Optional[bool] ): # type: (...) -> None diff --git a/src/fetchcode/vcs/pip/_internal/models/target_python.py b/src/fetchcode/vcs/pip/_internal/models/target_python.py index 30a8e67d..98cf7ad6 100644 --- a/src/fetchcode/vcs/pip/_internal/models/target_python.py +++ b/src/fetchcode/vcs/pip/_internal/models/target_python.py @@ -50,7 +50,7 @@ def __init__( else: py_version_info = normalize_version_info(py_version_info) - py_version = '.'.join(map(str, py_version_info[:2])) + py_version = ".".join(map(str, py_version_info[:2])) self.abi = abi self.implementation = implementation @@ -68,18 +68,19 @@ def format_given(self): """ display_version = None if self._given_py_version_info is not None: - display_version = '.'.join( + display_version = ".".join( str(part) for part in self._given_py_version_info ) key_values = [ - ('platform', self.platform), - ('version_info', display_version), - ('abi', self.abi), - ('implementation', self.implementation), + ("platform", self.platform), + ("version_info", display_version), + ("abi", self.abi), + ("implementation", self.implementation), ] - return ' '.join( - '{}={!r}'.format(key, value) for key, value in key_values + return " ".join( + "{}={!r}".format(key, value) + for key, value in key_values if value is not None ) diff --git a/src/fetchcode/vcs/pip/_internal/models/wheel.py b/src/fetchcode/vcs/pip/_internal/models/wheel.py index 2bfbfb4c..748e14dd 100644 --- a/src/fetchcode/vcs/pip/_internal/models/wheel.py +++ b/src/fetchcode/vcs/pip/_internal/models/wheel.py @@ -19,7 +19,7 @@ class Wheel(object): r"""^(?P(?P.+?)-(?P.*?)) ((-(?P\d[^-]*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$""", - re.VERBOSE + re.VERBOSE, ) def __init__(self, filename): @@ -33,19 +33,18 @@ def __init__(self, filename): "{} is not a valid wheel filename.".format(filename) ) self.filename = filename - self.name = wheel_info.group('name').replace('_', '-') + self.name = wheel_info.group("name").replace("_", "-") # we'll assume "_" means "-" due to wheel naming scheme # (https://github.com/pypa/pip/issues/1150) - self.version = wheel_info.group('ver').replace('_', '-') - self.build_tag = wheel_info.group('build') - self.pyversions = wheel_info.group('pyver').split('.') - self.abis = wheel_info.group('abi').split('.') - self.plats = wheel_info.group('plat').split('.') + self.version = wheel_info.group("ver").replace("_", "-") + self.build_tag = wheel_info.group("build") + self.pyversions = wheel_info.group("pyver").split(".") + self.abis = wheel_info.group("abi").split(".") + self.plats = wheel_info.group("plat").split(".") # All the tag combinations from this file self.file_tags = { - Tag(x, y, z) for x in self.pyversions - for y in self.abis for z in self.plats + Tag(x, y, z) for x in self.pyversions for y in self.abis for z in self.plats } def get_formatted_file_tags(self): diff --git a/src/fetchcode/vcs/pip/_internal/network/auth.py b/src/fetchcode/vcs/pip/_internal/network/auth.py index 4b0a88e2..84ef0521 100644 --- a/src/fetchcode/vcs/pip/_internal/network/auth.py +++ b/src/fetchcode/vcs/pip/_internal/network/auth.py @@ -38,7 +38,8 @@ keyring = None except Exception as exc: logger.warning( - "Keyring is skipped due to an exception: %s", str(exc), + "Keyring is skipped due to an exception: %s", + str(exc), ) keyring = None @@ -68,12 +69,12 @@ def get_keyring_auth(url, username): except Exception as exc: logger.warning( - "Keyring is skipped due to an exception: %s", str(exc), + "Keyring is skipped due to an exception: %s", + str(exc), ) class MultiDomainBasicAuth(AuthBase): - def __init__(self, prompting=True, index_urls=None): # type: (bool, Optional[Values]) -> None self.prompting = prompting @@ -107,8 +108,7 @@ def _get_index_url(self, url): if url.startswith(prefix): return u - def _get_new_credentials(self, original_url, allow_netrc=True, - allow_keyring=True): + def _get_new_credentials(self, original_url, allow_netrc=True, allow_keyring=True): """Find and return credentials for the specified URL.""" # Split the credentials and netloc from the url. url, netloc, url_user_password = split_auth_netloc_from_url( @@ -147,9 +147,8 @@ def _get_new_credentials(self, original_url, allow_netrc=True, # If we don't have a password and keyring is available, use it. if allow_keyring: # The index url is more specific than the netloc, so try it first - kr_auth = ( - get_keyring_auth(index_url, username) or - get_keyring_auth(netloc, username) + kr_auth = get_keyring_auth(index_url, username) or get_keyring_auth( + netloc, username ) if kr_auth: logger.debug("Found credentials in keyring for %s", netloc) @@ -190,7 +189,8 @@ def _get_url_and_credentials(self, original_url): assert ( # Credentials were found - (username is not None and password is not None) or + (username is not None and password is not None) + or # Credentials were not found (username is None and password is None) ), "Could not load credentials from url: {}".format(original_url) @@ -279,7 +279,8 @@ def warn_on_401(self, resp, **kwargs): """Response callback to warn about incorrect credentials.""" if resp.status_code == 401: logger.warning( - '401 Error, Credentials not correct for %s', resp.request.url, + "401 Error, Credentials not correct for %s", + resp.request.url, ) def save_credentials(self, resp, **kwargs): @@ -292,7 +293,7 @@ def save_credentials(self, resp, **kwargs): self._credentials_to_save = None if creds and resp.status_code < 400: try: - logger.info('Saving credentials to keyring') + logger.info("Saving credentials to keyring") keyring.set_password(*creds) except Exception: - logger.exception('Failed to save credentials') + logger.exception("Failed to save credentials") diff --git a/src/fetchcode/vcs/pip/_internal/network/cache.py b/src/fetchcode/vcs/pip/_internal/network/cache.py index a5b1f4ef..c744ea22 100644 --- a/src/fetchcode/vcs/pip/_internal/network/cache.py +++ b/src/fetchcode/vcs/pip/_internal/network/cache.py @@ -60,7 +60,7 @@ def get(self, key): # type: (str) -> Optional[bytes] path = self._get_cache_path(key) with suppressed_cache_errors(): - with open(path, 'rb') as f: + with open(path, "rb") as f: return f.read() def set(self, key, value): diff --git a/src/fetchcode/vcs/pip/_internal/network/download.py b/src/fetchcode/vcs/pip/_internal/network/download.py index 937078f5..c4291a08 100644 --- a/src/fetchcode/vcs/pip/_internal/network/download.py +++ b/src/fetchcode/vcs/pip/_internal/network/download.py @@ -33,7 +33,7 @@ def _get_http_response_size(resp): # type: (Response) -> Optional[int] try: - return int(resp.headers['content-length']) + return int(resp.headers["content-length"]) except (ValueError, KeyError, TypeError): return None @@ -41,7 +41,7 @@ def _get_http_response_size(resp): def _prepare_download( resp, # type: Response link, # type: Link - progress_bar # type: str + progress_bar, # type: str ): # type: (...) -> Iterable[bytes] total_length = _get_http_response_size(resp) @@ -54,7 +54,7 @@ def _prepare_download( logged_url = redact_auth_from_url(url) if total_length: - logged_url = '{} ({})'.format(logged_url, format_size(total_length)) + logged_url = "{} ({})".format(logged_url, format_size(total_length)) if is_from_cache(resp): logger.info("Using cached %s", logged_url) @@ -77,9 +77,7 @@ def _prepare_download( if not show_progress: return chunks - return DownloadProgressProvider( - progress_bar, max=total_length - )(chunks) + return DownloadProgressProvider(progress_bar, max=total_length)(chunks) def sanitize_content_filename(filename): @@ -97,7 +95,7 @@ def parse_content_disposition(content_disposition, default_filename): return the default filename if the result is empty. """ _type, params = cgi.parse_header(content_disposition) - filename = params.get('filename') + filename = params.get("filename") if filename: # We need to sanitize the filename to prevent directory traversal # in case the filename contains ".." path parts. @@ -112,14 +110,12 @@ def _get_http_response_filename(resp, link): """ filename = link.filename # fallback # Have a look at the Content-Disposition header for a better guess - content_disposition = resp.headers.get('content-disposition') + content_disposition = resp.headers.get("content-disposition") if content_disposition: filename = parse_content_disposition(content_disposition, filename) ext = splitext(filename)[1] # type: Optional[str] if not ext: - ext = mimetypes.guess_extension( - resp.headers.get('content-type', '') - ) + ext = mimetypes.guess_extension(resp.headers.get("content-type", "")) if ext: filename += ext if not ext and link.url != resp.url: @@ -131,7 +127,7 @@ def _get_http_response_filename(resp, link): def _http_get_download(session, link): # type: (PipSession, Link) -> Response - target_url = link.url.split('#', 1)[0] + target_url = link.url.split("#", 1)[0] resp = session.get( target_url, # We use Accept-Encoding: identity here because requests diff --git a/src/fetchcode/vcs/pip/_internal/network/session.py b/src/fetchcode/vcs/pip/_internal/network/session.py index e1702092..e040ad99 100644 --- a/src/fetchcode/vcs/pip/_internal/network/session.py +++ b/src/fetchcode/vcs/pip/_internal/network/session.py @@ -25,6 +25,7 @@ from pip import __version__ from fetchcode.vcs.pip._internal.network.auth import MultiDomainBasicAuth from fetchcode.vcs.pip._internal.network.cache import SafeFileCache + # Import ssl from compat so the initial import occurs in only one place. from fetchcode.vcs.pip._internal.utils.compat import has_tls, ipaddress from fetchcode.vcs.pip._internal.utils.glibc import libc_ver @@ -38,7 +39,11 @@ if MYPY_CHECK_RUNNING: from typing import ( - Iterator, List, Optional, Tuple, Union, + Iterator, + List, + Optional, + Tuple, + Union, ) from fetchcode.vcs.pip._internal.models.link import Link @@ -75,13 +80,13 @@ # For more background, see: https://github.com/pypa/pip/issues/5499 CI_ENVIRONMENT_VARIABLES = ( # Azure Pipelines - 'BUILD_BUILDID', + "BUILD_BUILDID", # Jenkins - 'BUILD_ID', + "BUILD_ID", # AppVeyor, CircleCI, Codeship, Gitlab CI, Shippable, Travis CI - 'CI', + "CI", # Explicit environment variable. - 'PIP_IS_CI', + "PIP_IS_CI", ) @@ -108,33 +113,38 @@ def user_agent(): }, } - if data["implementation"]["name"] == 'CPython': + if data["implementation"]["name"] == "CPython": data["implementation"]["version"] = platform.python_version() - elif data["implementation"]["name"] == 'PyPy': - if sys.pypy_version_info.releaselevel == 'final': + elif data["implementation"]["name"] == "PyPy": + if sys.pypy_version_info.releaselevel == "final": pypy_version_info = sys.pypy_version_info[:3] else: pypy_version_info = sys.pypy_version_info data["implementation"]["version"] = ".".join( [str(x) for x in pypy_version_info] ) - elif data["implementation"]["name"] == 'Jython': + elif data["implementation"]["name"] == "Jython": # Complete Guess data["implementation"]["version"] = platform.python_version() - elif data["implementation"]["name"] == 'IronPython': + elif data["implementation"]["name"] == "IronPython": # Complete Guess data["implementation"]["version"] = platform.python_version() if sys.platform.startswith("linux"): from fetchcode.vcs.pip._vendor import distro - distro_infos = dict(filter( - lambda x: x[1], - zip(["name", "version", "id"], distro.linux_distribution()), - )) - libc = dict(filter( - lambda x: x[1], - zip(["lib", "version"], libc_ver()), - )) + + distro_infos = dict( + filter( + lambda x: x[1], + zip(["name", "version", "id"], distro.linux_distribution()), + ) + ) + libc = dict( + filter( + lambda x: x[1], + zip(["lib", "version"], libc_ver()), + ) + ) if libc: distro_infos["libc"] = libc if distro_infos: @@ -154,6 +164,7 @@ def user_agent(): if has_tls(): import _ssl as ssl + data["openssl_version"] = ssl.OPENSSL_VERSION setuptools_version = get_installed_version("setuptools") @@ -177,9 +188,9 @@ def user_agent(): class LocalFSAdapter(BaseAdapter): - - def send(self, request, stream=None, timeout=None, verify=None, cert=None, - proxies=None): + def send( + self, request, stream=None, timeout=None, verify=None, cert=None, proxies=None + ): pathname = url_to_path(request.url) resp = Response() @@ -194,11 +205,13 @@ def send(self, request, stream=None, timeout=None, verify=None, cert=None, else: modified = email.utils.formatdate(stats.st_mtime, usegmt=True) content_type = mimetypes.guess_type(pathname)[0] or "text/plain" - resp.headers = CaseInsensitiveDict({ - "Content-Type": content_type, - "Content-Length": stats.st_size, - "Last-Modified": modified, - }) + resp.headers = CaseInsensitiveDict( + { + "Content-Type": content_type, + "Content-Length": stats.st_size, + "Last-Modified": modified, + } + ) resp.raw = open(pathname, "rb") resp.close = resp.raw.close @@ -210,7 +223,6 @@ def close(self): class InsecureHTTPAdapter(HTTPAdapter): - def cert_verify(self, conn, url, verify, cert): super(InsecureHTTPAdapter, self).cert_verify( conn=conn, url=url, verify=False, cert=cert @@ -218,7 +230,6 @@ def cert_verify(self, conn, url, verify, cert): class InsecureCacheControlAdapter(CacheControlAdapter): - def cert_verify(self, conn, url, verify, cert): super(InsecureCacheControlAdapter, self).cert_verify( conn=conn, url=url, verify=False, cert=cert @@ -257,7 +268,6 @@ def __init__(self, *args, **kwargs): # Set the total number of retries that a particular request can # have. total=retries, - # A 503 error from PyPI typically means that the Fastly -> Origin # connection got interrupted in some way. A 503 error in general # is typically considered a transient error so we'll go ahead and @@ -265,7 +275,6 @@ def __init__(self, *args, **kwargs): # A 500 may indicate transient error in Amazon S3 # A 520 or 527 - may indicate transient error in CloudFlare status_forcelist=[500, 503, 520, 527], - # Add a small amount of back off between failed requests in # order to prevent hammering the service. backoff_factor=0.25, @@ -314,46 +323,42 @@ def add_trusted_host(self, host, source=None, suppress_logging=False): string came from. """ if not suppress_logging: - msg = 'adding trusted host: {!r}'.format(host) + msg = "adding trusted host: {!r}".format(host) if source is not None: - msg += ' (from {})'.format(source) + msg += " (from {})".format(source) logger.info(msg) host_port = parse_netloc(host) if host_port not in self.pip_trusted_origins: self.pip_trusted_origins.append(host_port) - self.mount( - build_url_from_netloc(host) + '/', - self._trusted_host_adapter - ) + self.mount(build_url_from_netloc(host) + "/", self._trusted_host_adapter) if not host_port[1]: # Mount wildcard ports for the same host. - self.mount( - build_url_from_netloc(host) + ':', - self._trusted_host_adapter - ) + self.mount(build_url_from_netloc(host) + ":", self._trusted_host_adapter) def iter_secure_origins(self): # type: () -> Iterator[SecureOrigin] for secure_origin in SECURE_ORIGINS: yield secure_origin for host, port in self.pip_trusted_origins: - yield ('*', host, '*' if port is None else port) + yield ("*", host, "*" if port is None else port) def is_secure_origin(self, location): # type: (Link) -> bool # Determine if this url used a secure transport mechanism parsed = urllib_parse.urlparse(str(location)) origin_protocol, origin_host, origin_port = ( - parsed.scheme, parsed.hostname, parsed.port, + parsed.scheme, + parsed.hostname, + parsed.port, ) # The protocol to use to see if the protocol matches. # Don't count the repository type as part of the protocol: in # cases such as "git+ssh", only use "ssh". (I.e., Only verify against # the last scheme.) - origin_protocol = origin_protocol.rsplit('+', 1)[-1] + origin_protocol = origin_protocol.rsplit("+", 1)[-1] # Determine if our origin is a secure origin by looking through our # hardcoded list of secure origins, as well as any additional ones @@ -365,20 +370,16 @@ def is_secure_origin(self, location): try: addr = ipaddress.ip_address( - None - if origin_host is None - else six.ensure_text(origin_host) - ) - network = ipaddress.ip_network( - six.ensure_text(secure_host) + None if origin_host is None else six.ensure_text(origin_host) ) + network = ipaddress.ip_network(six.ensure_text(secure_host)) except ValueError: # We don't have both a valid address or a valid network, so # we'll check this origin against hostnames. if ( - origin_host and - origin_host.lower() != secure_host.lower() and - secure_host != "*" + origin_host + and origin_host.lower() != secure_host.lower() + and secure_host != "*" ): continue else: @@ -389,9 +390,9 @@ def is_secure_origin(self, location): # Check to see if the port matches. if ( - origin_port != secure_port and - secure_port != "*" and - secure_port is not None + origin_port != secure_port + and secure_port != "*" + and secure_port is not None ): continue diff --git a/src/fetchcode/vcs/pip/_internal/network/utils.py b/src/fetchcode/vcs/pip/_internal/network/utils.py index 05f8b1a0..84b98930 100644 --- a/src/fetchcode/vcs/pip/_internal/network/utils.py +++ b/src/fetchcode/vcs/pip/_internal/network/utils.py @@ -8,8 +8,7 @@ def response_chunks(response, chunk_size=CONTENT_CHUNK_SIZE): # type: (Response, int) -> Iterator[bytes] - """Given a requests Response, provide the data chunks. - """ + """Given a requests Response, provide the data chunks.""" try: # Special case for urllib3. for chunk in response.raw.stream( diff --git a/src/fetchcode/vcs/pip/_internal/network/xmlrpc.py b/src/fetchcode/vcs/pip/_internal/network/xmlrpc.py index 1b43a594..bd2994b8 100644 --- a/src/fetchcode/vcs/pip/_internal/network/xmlrpc.py +++ b/src/fetchcode/vcs/pip/_internal/network/xmlrpc.py @@ -7,6 +7,7 @@ import logging from fetchcode.vcs.pip._vendor import requests + # NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is # why we ignore the type on this import from fetchcode.vcs.pip._vendor.six.moves import xmlrpc_client # type: ignore @@ -30,15 +31,17 @@ def request(self, host, handler, request_body, verbose=False): parts = (self._scheme, host, handler, None, None, None) url = urllib_parse.urlunparse(parts) try: - headers = {'Content-Type': 'text/xml'} - response = self._session.post(url, data=request_body, - headers=headers, stream=True) + headers = {"Content-Type": "text/xml"} + response = self._session.post( + url, data=request_body, headers=headers, stream=True + ) response.raise_for_status() self.verbose = verbose return self.parse_response(response.raw) except requests.HTTPError as exc: logger.critical( "HTTP error %s while getting %s", - exc.response.status_code, url, + exc.response.status_code, + url, ) raise diff --git a/src/fetchcode/vcs/pip/_internal/operations/check.py b/src/fetchcode/vcs/pip/_internal/operations/check.py index b9425d79..f2eed27e 100644 --- a/src/fetchcode/vcs/pip/_internal/operations/check.py +++ b/src/fetchcode/vcs/pip/_internal/operations/check.py @@ -21,12 +21,10 @@ if MYPY_CHECK_RUNNING: from fetchcode.vcs.pip._internal.req.req_install import InstallRequirement - from typing import ( - Any, Callable, Dict, Optional, Set, Tuple, List - ) + from typing import Any, Callable, Dict, Optional, Set, Tuple, List # Shorthands - PackageSet = Dict[str, 'PackageDetails'] + PackageSet = Dict[str, "PackageDetails"] Missing = Tuple[str, Any] Conflicting = Tuple[str, str, Any] @@ -34,13 +32,12 @@ ConflictingDict = Dict[str, List[Conflicting]] CheckResult = Tuple[MissingDict, ConflictingDict] -PackageDetails = namedtuple('PackageDetails', ['version', 'requires']) +PackageDetails = namedtuple("PackageDetails", ["version", "requires"]) def create_package_set_from_installed(**kwargs): # type: (**Any) -> Tuple[PackageSet, bool] - """Converts a list of distributions into a PackageSet. - """ + """Converts a list of distributions into a PackageSet.""" # Default to using all packages installed on the system if kwargs == {}: kwargs = {"local_only": False, "skip": ()} @@ -66,6 +63,7 @@ def check_package_set(package_set, should_ignore=None): package name and returns a boolean. """ if should_ignore is None: + def should_ignore(name): return False @@ -122,14 +120,13 @@ def check_install_conflicts(to_install): package_set, check_package_set( package_set, should_ignore=lambda name: name not in whitelist - ) + ), ) def _simulate_installation_of(to_install, package_set): # type: (List[InstallRequirement], PackageSet) -> Set[str] - """Computes the version of packages after installing to_install. - """ + """Computes the version of packages after installing to_install.""" # Keep track of packages that were installed installed = set() diff --git a/src/fetchcode/vcs/pip/_internal/operations/freeze.py b/src/fetchcode/vcs/pip/_internal/operations/freeze.py index 74bfffbc..7cbf31a9 100644 --- a/src/fetchcode/vcs/pip/_internal/operations/freeze.py +++ b/src/fetchcode/vcs/pip/_internal/operations/freeze.py @@ -29,12 +29,18 @@ if MYPY_CHECK_RUNNING: from typing import ( - Iterator, Optional, List, Container, Set, Dict, Tuple, Iterable, Union + Iterator, + Optional, + List, + Container, + Set, + Dict, + Tuple, + Iterable, + Union, ) from fetchcode.vcs.pip._internal.cache import WheelCache - from fetchcode.vcs.pip._vendor.pkg_resources import ( - Distribution, Requirement - ) + from fetchcode.vcs.pip._vendor.pkg_resources import Distribution, Requirement RequirementInfo = Tuple[Optional[Union[str, Requirement]], bool, List[str]] @@ -51,18 +57,17 @@ def freeze( isolated=False, # type: bool wheel_cache=None, # type: Optional[WheelCache] exclude_editable=False, # type: bool - skip=() # type: Container[str] + skip=(), # type: Container[str] ): # type: (...) -> Iterator[str] find_links = find_links or [] for link in find_links: - yield '-f {}'.format(link) + yield "-f {}".format(link) installations = {} # type: Dict[str, FrozenRequirement] - for dist in get_installed_distributions(local_only=local_only, - skip=(), - user_only=user_only, - paths=paths): + for dist in get_installed_distributions( + local_only=local_only, skip=(), user_only=user_only, paths=paths + ): try: req = FrozenRequirement.from_dist(dist) except RequirementParseError as exc: @@ -71,8 +76,7 @@ def freeze( # location. We also include the exception message to aid # troubleshooting. logger.warning( - 'Could not generate requirement for distribution %r: %s', - dist, exc + "Could not generate requirement for distribution %r: %s", dist, exc ) continue if exclude_editable and req.editable: @@ -91,35 +95,44 @@ def freeze( for req_file_path in requirement: with open(req_file_path) as req_file: for line in req_file: - if (not line.strip() or - line.strip().startswith('#') or - line.startswith(( - '-r', '--requirement', - '-Z', '--always-unzip', - '-f', '--find-links', - '-i', '--index-url', - '--pre', - '--trusted-host', - '--process-dependency-links', - '--extra-index-url'))): + if ( + not line.strip() + or line.strip().startswith("#") + or line.startswith( + ( + "-r", + "--requirement", + "-Z", + "--always-unzip", + "-f", + "--find-links", + "-i", + "--index-url", + "--pre", + "--trusted-host", + "--process-dependency-links", + "--extra-index-url", + ) + ) + ): line = line.rstrip() if line not in emitted_options: emitted_options.add(line) yield line continue - if line.startswith('-e') or line.startswith('--editable'): - if line.startswith('-e'): + if line.startswith("-e") or line.startswith("--editable"): + if line.startswith("-e"): line = line[2:].strip() else: - line = line[len('--editable'):].strip().lstrip('=') + line = line[len("--editable") :].strip().lstrip("=") line_req = install_req_from_editable( line, isolated=isolated, ) else: line_req = install_req_from_line( - COMMENT_RE.sub('', line).strip(), + COMMENT_RE.sub("", line).strip(), isolated=isolated, ) @@ -127,15 +140,15 @@ def freeze( logger.info( "Skipping line in requirement file [%s] because " "it's not clear what it would install: %s", - req_file_path, line.strip(), + req_file_path, + line.strip(), ) logger.info( " (add #egg=PackageName to the URL to avoid" " this warning)" ) else: - line_req_canonical_name = canonicalize_name( - line_req.name) + line_req_canonical_name = canonicalize_name(line_req.name) if line_req_canonical_name not in installations: # either it's not installed, or it is installed # but has been processed already @@ -144,14 +157,13 @@ def freeze( "Requirement file [%s] contains %s, but " "package %r is not installed", req_file_path, - COMMENT_RE.sub('', line).strip(), - line_req.name + COMMENT_RE.sub("", line).strip(), + line_req.name, ) else: req_files[line_req.name].append(req_file_path) else: - yield str(installations[ - line_req_canonical_name]).rstrip() + yield str(installations[line_req_canonical_name]).rstrip() del installations[line_req_canonical_name] req_files[line_req.name].append(req_file_path) @@ -159,15 +171,14 @@ def freeze( # single requirements file or in different requirements files). for name, files in six.iteritems(req_files): if len(files) > 1: - logger.warning("Requirement %s included multiple times [%s]", - name, ', '.join(sorted(set(files)))) + logger.warning( + "Requirement %s included multiple times [%s]", + name, + ", ".join(sorted(set(files))), + ) - yield( - '## The following requirements were added by ' - 'pip freeze:' - ) - for installation in sorted( - installations.values(), key=lambda x: x.name.lower()): + yield ("## The following requirements were added by " "pip freeze:") + for installation in sorted(installations.values(), key=lambda x: x.name.lower()): if installation.canonical_name not in skip: yield str(installation).rstrip() @@ -184,17 +195,17 @@ def get_requirement_info(dist): location = os.path.normcase(os.path.abspath(dist.location)) from fetchcode.vcs.pip._internal.vcs import vcs, RemoteNotFoundError + vcs_backend = vcs.get_backend_for_dir(location) if vcs_backend is None: req = dist.as_requirement() logger.debug( - 'No VCS found for editable requirement "%s" in: %r', req, + 'No VCS found for editable requirement "%s" in: %r', + req, location, ) - comments = [ - '# Editable install with no version control ({})'.format(req) - ] + comments = ["# Editable install with no version control ({})".format(req)] return (location, True, comments) try: @@ -202,16 +213,17 @@ def get_requirement_info(dist): except RemoteNotFoundError: req = dist.as_requirement() comments = [ - '# Editable {} install with no remote ({})'.format( - type(vcs_backend).__name__, req, + "# Editable {} install with no remote ({})".format( + type(vcs_backend).__name__, + req, ) ] return (location, True, comments) except BadCommand: logger.warning( - 'cannot determine version of editable source in %s ' - '(%s command not found in path)', + "cannot determine version of editable source in %s " + "(%s command not found in path)", location, vcs_backend.name, ) @@ -220,16 +232,15 @@ def get_requirement_info(dist): except InstallationError as exc: logger.warning( "Error when trying to get requirement for VCS system %s, " - "falling back to uneditable format", exc + "falling back to uneditable format", + exc, ) else: if req is not None: return (req, True, []) - logger.warning( - 'Could not determine repository location of %s', location - ) - comments = ['## !! Could not determine repository location'] + logger.warning("Could not determine repository location of %s", location) + comments = ["## !! Could not determine repository location"] return (None, False, comments) @@ -267,5 +278,5 @@ def from_dist(cls, dist): def __str__(self): req = self.req if self.editable: - req = '-e {}'.format(req) - return '\n'.join(list(self.comments) + [str(req)]) + '\n' + req = "-e {}".format(req) + return "\n".join(list(self.comments) + [str(req)]) + "\n" diff --git a/src/fetchcode/vcs/pip/_internal/operations/install/editable_legacy.py b/src/fetchcode/vcs/pip/_internal/operations/install/editable_legacy.py index c24c7e1c..66ec1e62 100644 --- a/src/fetchcode/vcs/pip/_internal/operations/install/editable_legacy.py +++ b/src/fetchcode/vcs/pip/_internal/operations/install/editable_legacy.py @@ -3,7 +3,9 @@ import logging from fetchcode.vcs.pip._internal.utils.logging import indent_log -from fetchcode.vcs.pip._internal.utils.setuptools_build import make_setuptools_develop_args +from fetchcode.vcs.pip._internal.utils.setuptools_build import ( + make_setuptools_develop_args, +) from fetchcode.vcs.pip._internal.utils.subprocess import call_subprocess from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING @@ -32,7 +34,7 @@ def install_editable( """Install a package in editable mode. Most arguments are pass-through to setuptools. """ - logger.info('Running setup.py develop for %s', name) + logger.info("Running setup.py develop for %s", name) args = make_setuptools_develop_args( setup_py_path, diff --git a/src/fetchcode/vcs/pip/_internal/operations/install/legacy.py b/src/fetchcode/vcs/pip/_internal/operations/install/legacy.py index a899ec72..e8dfc979 100644 --- a/src/fetchcode/vcs/pip/_internal/operations/install/legacy.py +++ b/src/fetchcode/vcs/pip/_internal/operations/install/legacy.py @@ -9,7 +9,9 @@ from fetchcode.vcs.pip._internal.utils.deprecation import deprecated from fetchcode.vcs.pip._internal.utils.logging import indent_log from fetchcode.vcs.pip._internal.utils.misc import ensure_dir -from fetchcode.vcs.pip._internal.utils.setuptools_build import make_setuptools_install_args +from fetchcode.vcs.pip._internal.utils.setuptools_build import ( + make_setuptools_install_args, +) from fetchcode.vcs.pip._internal.utils.subprocess import runner_with_spinner_message from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectory from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING @@ -52,7 +54,7 @@ def install( with TempDirectory(kind="record") as temp_dir: try: - record_filename = os.path.join(temp_dir.path, 'install-record.txt') + record_filename = os.path.join(temp_dir.path, "install-record.txt") install_args = make_setuptools_install_args( setup_py_path, global_options=global_options, @@ -77,7 +79,7 @@ def install( ) if not os.path.exists(record_filename): - logger.debug('Record file %s not found', record_filename) + logger.debug("Record file %s not found", record_filename) # Signal to the caller that we didn't install the new package return False @@ -102,7 +104,7 @@ def prepend_root(path): for line in record_lines: directory = os.path.dirname(line) - if directory.endswith('.egg-info'): + if directory.endswith(".egg-info"): egg_info_dir = prepend_root(directory) break else: @@ -115,9 +117,7 @@ def prepend_root(path): replacement=( "for maintainers: updating the setup.py of {0}. " "For users: contact the maintainers of {0} to let " - "them know to update their setup.py.".format( - req_name - ) + "them know to update their setup.py.".format(req_name) ), gone_in="20.2", issue=6998, @@ -130,13 +130,11 @@ def prepend_root(path): filename = line.strip() if os.path.isdir(filename): filename += os.path.sep - new_lines.append( - os.path.relpath(prepend_root(filename), egg_info_dir) - ) + new_lines.append(os.path.relpath(prepend_root(filename), egg_info_dir)) new_lines.sort() ensure_dir(egg_info_dir) - inst_files_path = os.path.join(egg_info_dir, 'installed-files.txt') - with open(inst_files_path, 'w') as f: - f.write('\n'.join(new_lines) + '\n') + inst_files_path = os.path.join(egg_info_dir, "installed-files.txt") + with open(inst_files_path, "w") as f: + f.write("\n".join(new_lines) + "\n") return True diff --git a/src/fetchcode/vcs/pip/_internal/operations/install/wheel.py b/src/fetchcode/vcs/pip/_internal/operations/install/wheel.py index 24c2ed1f..43188566 100644 --- a/src/fetchcode/vcs/pip/_internal/operations/install/wheel.py +++ b/src/fetchcode/vcs/pip/_internal/operations/install/wheel.py @@ -27,9 +27,16 @@ from fetchcode.vcs.pip._internal.exceptions import InstallationError from fetchcode.vcs.pip._internal.locations import get_major_minor_version -from fetchcode.vcs.pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl +from fetchcode.vcs.pip._internal.models.direct_url import ( + DIRECT_URL_METADATA_NAME, + DirectUrl, +) from fetchcode.vcs.pip._internal.utils.filesystem import adjacent_tmp_file, replace -from fetchcode.vcs.pip._internal.utils.misc import captured_stdout, ensure_dir, hash_file +from fetchcode.vcs.pip._internal.utils.misc import ( + captured_stdout, + ensure_dir, + hash_file, +) from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectory from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING from fetchcode.vcs.pip._internal.utils.unpacking import current_umask, unpack_file @@ -38,8 +45,16 @@ if MYPY_CHECK_RUNNING: from email.message import Message from typing import ( - Dict, List, Optional, Sequence, Tuple, Any, - Iterable, Iterator, Callable, Set, + Dict, + List, + Optional, + Sequence, + Tuple, + Any, + Iterable, + Iterator, + Callable, + Set, ) from fetchcode.vcs.pip._internal.models.scheme import Scheme @@ -53,16 +68,14 @@ def normpath(src, p): # type: (str, str) -> str - return os.path.relpath(src, p).replace(os.path.sep, '/') + return os.path.relpath(src, p).replace(os.path.sep, "/") def rehash(path, blocksize=1 << 20): # type: (str, int) -> Tuple[str, str] """Return (encoded_digest, length) for path using hashlib.sha256()""" h, length = hash_file(path, blocksize) - digest = 'sha256=' + urlsafe_b64encode( - h.digest() - ).decode('latin1').rstrip('=') + digest = "sha256=" + urlsafe_b64encode(h.digest()).decode("latin1").rstrip("=") # unicode/str python2 issues return (digest, str(length)) # type: ignore @@ -73,9 +86,9 @@ def csv_io_kwargs(mode): in the given mode. """ if sys.version_info.major < 3: - return {'mode': '{}b'.format(mode)} + return {"mode": "{}b".format(mode)} else: - return {'mode': mode, 'newline': ''} + return {"mode": mode, "newline": ""} def fix_script(path): @@ -85,14 +98,14 @@ def fix_script(path): """ # XXX RECORD hashes will need to be updated if os.path.isfile(path): - with open(path, 'rb') as script: + with open(path, "rb") as script: firstline = script.readline() - if not firstline.startswith(b'#!python'): + if not firstline.startswith(b"#!python"): return False exename = sys.executable.encode(sys.getfilesystemencoding()) - firstline = b'#!' + exename + os.linesep.encode("ascii") + firstline = b"#!" + exename + os.linesep.encode("ascii") rest = script.read() - with open(path, 'wb') as script: + with open(path, "wb") as script: script.write(firstline) script.write(rest) return True @@ -122,8 +135,8 @@ def get_entrypoints(filename): # get the entry points and then the script names entry_points = pkg_resources.EntryPoint.parse_map(data) - console = entry_points.get('console_scripts', {}) - gui = entry_points.get('gui_scripts', {}) + console = entry_points.get("console_scripts", {}) + gui = entry_points.get("gui_scripts", {}) def _split_ep(s): # type: (pkg_resources.EntryPoint) -> Tuple[str, str] @@ -157,14 +170,15 @@ def message_about_scripts_not_on_PATH(scripts): # We don't want to warn for directories that are on PATH. not_warn_dirs = [ - os.path.normcase(i).rstrip(os.sep) for i in - os.environ.get("PATH", "").split(os.pathsep) + os.path.normcase(i).rstrip(os.sep) + for i in os.environ.get("PATH", "").split(os.pathsep) ] # If an executable sits with sys.executable, we don't warn for it. # This covers the case of venv invocations without activating the venv. not_warn_dirs.append(os.path.normcase(os.path.dirname(sys.executable))) warn_for = { - parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items() + parent_dir: scripts + for parent_dir, scripts in grouped_by_dir.items() if os.path.normcase(parent_dir) not in not_warn_dirs } # type: Dict[str, Set[str]] if not warn_for: @@ -182,8 +196,9 @@ def message_about_scripts_not_on_PATH(scripts): ) msg_lines.append( - "The {} installed in '{}' which is not on PATH." - .format(start_text, parent_dir) + "The {} installed in '{}' which is not on PATH.".format( + start_text, parent_dir + ) ) last_line_fmt = ( @@ -245,9 +260,7 @@ def get_csv_rows_for_installed( installed_rows = [] # type: List[InstalledCSVRow] for row in old_csv_rows: if len(row) > 3: - logger.warning( - 'RECORD line has more than three elements: {}'.format(row) - ) + logger.warning("RECORD line has more than three elements: {}".format(row)) # Make a copy because we are mutating the row. row = list(row) old_path = row[0] @@ -262,7 +275,7 @@ def get_csv_rows_for_installed( digest, length = rehash(f) installed_rows.append((normpath(f, lib_dir), digest, str(length))) for f in installed: - installed_rows.append((installed[f], '', '')) + installed_rows.append((installed[f], "", "")) return installed_rows @@ -325,7 +338,7 @@ def install_unpacked_wheel( lib_dir = scheme.platlib subdirs = os.listdir(source) - data_dirs = [s for s in subdirs if s.endswith('.data')] + data_dirs = [s for s in subdirs if s.endswith(".data")] # Record details of the files moved # installed = files copied from the wheel to the destination @@ -339,7 +352,7 @@ def install_unpacked_wheel( if pycompile: with captured_stdout() as stdout: with warnings.catch_warnings(): - warnings.filterwarnings('ignore') + warnings.filterwarnings("ignore") compileall.compile_dir(source, force=True, quiet=True) logger.debug(stdout.getvalue()) @@ -353,20 +366,20 @@ def record_installed(srcfile, destfile, modified=False): changed.add(destfile) def clobber( - source, # type: str - dest, # type: str - is_base, # type: bool - fixer=None, # type: Optional[Callable[[str], Any]] - filter=None # type: Optional[Callable[[str], bool]] + source, # type: str + dest, # type: str + is_base, # type: bool + fixer=None, # type: Optional[Callable[[str], Any]] + filter=None, # type: Optional[Callable[[str], bool]] ): # type: (...) -> None ensure_dir(dest) # common for the 'include' path for dir, subdirs, files in os.walk(source): - basedir = dir[len(source):].lstrip(os.path.sep) + basedir = dir[len(source) :].lstrip(os.path.sep) destdir = os.path.join(dest, basedir) - if is_base and basedir == '': - subdirs[:] = [s for s in subdirs if not s.endswith('.data')] + if is_base and basedir == "": + subdirs[:] = [s for s in subdirs if not s.endswith(".data")] for f in files: # Skip unwanted files if filter and filter(f): @@ -421,30 +434,30 @@ def clobber( dest_info_dir = os.path.join(lib_dir, info_dir) # Get the defined entry points - ep_file = os.path.join(dest_info_dir, 'entry_points.txt') + ep_file = os.path.join(dest_info_dir, "entry_points.txt") console, gui = get_entrypoints(ep_file) def is_entrypoint_wrapper(name): # type: (str) -> bool # EP, EP.exe and EP-script.py are scripts generated for # entry point EP by setuptools - if name.lower().endswith('.exe'): + if name.lower().endswith(".exe"): matchname = name[:-4] - elif name.lower().endswith('-script.py'): + elif name.lower().endswith("-script.py"): matchname = name[:-10] elif name.lower().endswith(".pya"): matchname = name[:-4] else: matchname = name # Ignore setuptools-generated scripts - return (matchname in console or matchname in gui) + return matchname in console or matchname in gui for datadir in data_dirs: fixer = None filter = None for subdir in os.listdir(os.path.join(wheeldir, datadir)): fixer = None - if subdir == 'scripts': + if subdir == "scripts": fixer = fix_script filter = is_entrypoint_wrapper source = os.path.join(wheeldir, datadir, subdir) @@ -460,7 +473,7 @@ def is_entrypoint_wrapper(name): # Ensure we don't generate any variants for scripts because this is almost # never what somebody wants. # See https://bitbucket.org/pypa/distlib/issue/35/ - maker.variants = {''} + maker.variants = {""} # This is required because otherwise distlib creates scripts that are not # executable. @@ -502,46 +515,44 @@ def is_entrypoint_wrapper(name): # DEFAULT # - The default behavior is to install pip, pipX, pipX.Y, easy_install # and easy_install-X.Y. - pip_script = console.pop('pip', None) + pip_script = console.pop("pip", None) if pip_script: if "ENSUREPIP_OPTIONS" not in os.environ: - scripts_to_generate.append('pip = ' + pip_script) + scripts_to_generate.append("pip = " + pip_script) if os.environ.get("ENSUREPIP_OPTIONS", "") != "altinstall": scripts_to_generate.append( - 'pip{} = {}'.format(sys.version_info[0], pip_script) + "pip{} = {}".format(sys.version_info[0], pip_script) ) scripts_to_generate.append( - 'pip{} = {}'.format(get_major_minor_version(), pip_script) + "pip{} = {}".format(get_major_minor_version(), pip_script) ) # Delete any other versioned pip entry points - pip_ep = [k for k in console if re.match(r'pip(\d(\.\d)?)?$', k)] + pip_ep = [k for k in console if re.match(r"pip(\d(\.\d)?)?$", k)] for k in pip_ep: del console[k] - easy_install_script = console.pop('easy_install', None) + easy_install_script = console.pop("easy_install", None) if easy_install_script: if "ENSUREPIP_OPTIONS" not in os.environ: - scripts_to_generate.append( - 'easy_install = ' + easy_install_script - ) + scripts_to_generate.append("easy_install = " + easy_install_script) scripts_to_generate.append( - 'easy_install-{} = {}'.format( + "easy_install-{} = {}".format( get_major_minor_version(), easy_install_script ) ) # Delete any other versioned easy_install entry points easy_install_ep = [ - k for k in console if re.match(r'easy_install(-\d\.\d)?$', k) + k for k in console if re.match(r"easy_install(-\d\.\d)?$", k) ] for k in easy_install_ep: del console[k] # Generate the console and GUI entry points specified in the wheel - scripts_to_generate.extend(starmap('{} = {}'.format, console.items())) + scripts_to_generate.extend(starmap("{} = {}".format, console.items())) - gui_scripts_to_generate = list(starmap('{} = {}'.format, gui.items())) + gui_scripts_to_generate = list(starmap("{} = {}".format, gui.items())) generated_console_scripts = [] # type: List[str] @@ -549,9 +560,7 @@ def is_entrypoint_wrapper(name): generated_console_scripts = maker.make_multiple(scripts_to_generate) generated.extend(generated_console_scripts) - generated.extend( - maker.make_multiple(gui_scripts_to_generate, {'gui': True}) - ) + generated.extend(maker.make_multiple(gui_scripts_to_generate, {"gui": True})) except MissingCallableSuffix as e: entry = e.args[0] raise InstallationError( @@ -577,9 +586,9 @@ def _generate_file(path, **kwargs): replace(f.name, path) # Record pip as the installer - installer_path = os.path.join(dest_info_dir, 'INSTALLER') + installer_path = os.path.join(dest_info_dir, "INSTALLER") with _generate_file(installer_path) as installer_file: - installer_file.write(b'pip\n') + installer_file.write(b"pip\n") generated.append(installer_path) # Record the PEP 610 direct URL reference @@ -590,15 +599,16 @@ def _generate_file(path, **kwargs): generated.append(direct_url_path) # Record details of all files installed - record_path = os.path.join(dest_info_dir, 'RECORD') - with open(record_path, **csv_io_kwargs('r')) as record_file: + record_path = os.path.join(dest_info_dir, "RECORD") + with open(record_path, **csv_io_kwargs("r")) as record_file: rows = get_csv_rows_for_installed( csv.reader(record_file), installed=installed, changed=changed, generated=generated, - lib_dir=lib_dir) - with _generate_file(record_path, **csv_io_kwargs('w')) as record_file: + lib_dir=lib_dir, + ) + with _generate_file(record_path, **csv_io_kwargs("w")) as record_file: writer = csv.writer(record_file) writer.writerows(sorted_outrows(rows)) # sort to simplify testing diff --git a/src/fetchcode/vcs/pip/_internal/operations/prepare.py b/src/fetchcode/vcs/pip/_internal/operations/prepare.py index fd48606e..f82b5ad0 100644 --- a/src/fetchcode/vcs/pip/_internal/operations/prepare.py +++ b/src/fetchcode/vcs/pip/_internal/operations/prepare.py @@ -40,7 +40,10 @@ if MYPY_CHECK_RUNNING: from typing import ( - Callable, List, Optional, Tuple, + Callable, + List, + Optional, + Tuple, ) from mypy_extensions import TypedDict @@ -55,21 +58,21 @@ if PY2: CopytreeKwargs = TypedDict( - 'CopytreeKwargs', + "CopytreeKwargs", { - 'ignore': Callable[[str, List[str]], List[str]], - 'symlinks': bool, + "ignore": Callable[[str, List[str]], List[str]], + "symlinks": bool, }, total=False, ) else: CopytreeKwargs = TypedDict( - 'CopytreeKwargs', + "CopytreeKwargs", { - 'copy_function': Callable[[str, str], None], - 'ignore': Callable[[str, List[str]], List[str]], - 'ignore_dangling_symlinks': bool, - 'symlinks': bool, + "copy_function": Callable[[str, str], None], + "ignore": Callable[[str, List[str]], List[str]], + "ignore_dangling_symlinks": bool, + "symlinks": bool, }, total=False, ) @@ -78,14 +81,13 @@ def _get_prepared_distribution( - req, # type: InstallRequirement - req_tracker, # type: RequirementTracker - finder, # type: PackageFinder - build_isolation # type: bool + req, # type: InstallRequirement + req_tracker, # type: RequirementTracker + finder, # type: PackageFinder + build_isolation, # type: bool ): # type: (...) -> AbstractDistribution - """Prepare a distribution for installation. - """ + """Prepare a distribution for installation.""" abstract_dist = make_distribution_for_install_requirement(req) with req_tracker.track(req): abstract_dist.prepare_distribution_metadata(finder, build_isolation) @@ -117,9 +119,7 @@ def get_http_url( # If a download dir is specified, is the file already downloaded there? already_downloaded_path = None if download_dir: - already_downloaded_path = _check_download_dir( - link, download_dir, hashes - ) + already_downloaded_path = _check_download_dir(link, download_dir, hashes) if already_downloaded_path: from_path = already_downloaded_path @@ -168,7 +168,7 @@ def ignore(d, names): # exclude the following directories if they appear in the top # level dir (and only it). # See discussion at https://github.com/pypa/pip/pull/6770 - skipped += ['.tox', '.nox'] + skipped += [".tox", ".nox"] if os.path.abspath(d) == target_dirname: # Prevent an infinite recursion if the target is in source. # This can happen when TMPDIR is set to ${PWD}/... @@ -181,7 +181,7 @@ def ignore(d, names): if not PY2: # Python 2 does not support copy_function, so we only ignore # errors on special file copy in Python 3. - kwargs['copy_function'] = _copy2_ignoring_special_files + kwargs["copy_function"] = _copy2_ignoring_special_files shutil.copytree(source, target, **kwargs) @@ -189,17 +189,14 @@ def ignore(d, names): def get_file_url( link, # type: Link download_dir=None, # type: Optional[str] - hashes=None # type: Optional[Hashes] + hashes=None, # type: Optional[Hashes] ): # type: (...) -> File - """Get file and optionally check its hash. - """ + """Get file and optionally check its hash.""" # If a download dir is specified, is the file already there and valid? already_downloaded_path = None if download_dir: - already_downloaded_path = _check_download_dir( - link, download_dir, hashes - ) + already_downloaded_path = _check_download_dir(link, download_dir, hashes) if already_downloaded_path: from_path = already_downloaded_path @@ -277,20 +274,20 @@ def _download_http_url( download = downloader(link) file_path = os.path.join(temp_dir, download.filename) - with open(file_path, 'wb') as content_file: + with open(file_path, "wb") as content_file: for chunk in download.chunks: content_file.write(chunk) if hashes: hashes.check_against_path(file_path) - return file_path, download.response.headers.get('content-type', '') + return file_path, download.response.headers.get("content-type", "") def _check_download_dir(link, download_dir, hashes): # type: (Link, str, Optional[Hashes]) -> Optional[str] - """ Check download_dir for previously downloaded file with correct hash - If a correct file is found return its path else None + """Check download_dir for previously downloaded file with correct hash + If a correct file is found return its path else None """ download_path = os.path.join(download_dir, link.filename) @@ -298,15 +295,14 @@ def _check_download_dir(link, download_dir, hashes): return None # If already downloaded, does its hash match? - logger.info('File was already downloaded %s', download_path) + logger.info("File was already downloaded %s", download_path) if hashes: try: hashes.check_against_path(download_path) except HashMismatch: logger.warning( - 'Previously-downloaded file %s has bad hash. ' - 'Re-downloading.', - download_path + "Previously-downloaded file %s has bad hash. " "Re-downloading.", + download_path, ) os.unlink(download_path) return None @@ -314,8 +310,7 @@ def _check_download_dir(link, download_dir, hashes): class RequirementPreparer(object): - """Prepares a Requirement - """ + """Prepares a Requirement""" def __init__( self, @@ -371,27 +366,26 @@ def _download_should_save(self): if os.path.exists(self.download_dir): return True - logger.critical('Could not find download directory') + logger.critical("Could not find download directory") raise InstallationError( - "Could not find or access download directory '{}'" - .format(self.download_dir)) + "Could not find or access download directory '{}'".format(self.download_dir) + ) def prepare_linked_requirement( self, req, # type: InstallRequirement ): # type: (...) -> AbstractDistribution - """Prepare a requirement that would be obtained from req.link - """ + """Prepare a requirement that would be obtained from req.link""" assert req.link link = req.link # TODO: Breakup into smaller functions - if link.scheme == 'file': + if link.scheme == "file": path = link.file_path - logger.info('Processing %s', display_path(path)) + logger.info("Processing %s", display_path(path)) else: - logger.info('Collecting %s', req.req or req) + logger.info("Collecting %s", req.req or req) download_dir = self.download_dir if link.is_wheel and self.wheel_download_dir: @@ -421,14 +415,15 @@ def prepare_linked_requirement( # installation. # FIXME: this won't upgrade when there's an existing # package unpacked in `req.source_dir` - if os.path.exists(os.path.join(req.source_dir, 'setup.py')): + if os.path.exists(os.path.join(req.source_dir, "setup.py")): raise PreviousBuildDirError( "pip can't proceed with requirements '{}' due to a" " pre-existing build directory ({}). This is " "likely due to a previous installation that failed" ". pip is being responsible and not assuming it " - "can delete this. Please delete it and try again." - .format(req, req.source_dir) + "can delete this. Please delete it and try again.".format( + req, req.source_dir + ) ) # Now that we have the real link, we can tell what kind of @@ -465,18 +460,21 @@ def prepare_linked_requirement( try: local_file = unpack_url( - link, req.source_dir, self.downloader, download_dir, + link, + req.source_dir, + self.downloader, + download_dir, hashes=hashes, ) except requests.HTTPError as exc: logger.critical( - 'Could not install requirement %s because of error %s', + "Could not install requirement %s because of error %s", req, exc, ) raise InstallationError( - 'Could not install requirement {} because of HTTP ' - 'error {} for URL {}'.format(req, exc, link) + "Could not install requirement {} because of HTTP " + "error {} for URL {}".format(req, exc, link) ) # For use in later processing, preserve the file path on the @@ -485,21 +483,20 @@ def prepare_linked_requirement( req.local_file_path = local_file.path abstract_dist = _get_prepared_distribution( - req, self.req_tracker, self.finder, self.build_isolation, + req, + self.req_tracker, + self.finder, + self.build_isolation, ) if download_dir: if link.is_existing_dir(): - logger.info('Link is a directory, ignoring download_dir') + logger.info("Link is a directory, ignoring download_dir") elif local_file: - download_location = os.path.join( - download_dir, link.filename - ) + download_location = os.path.join(download_dir, link.filename) if not os.path.exists(download_location): shutil.copy(local_file.path, download_location) - logger.info( - 'Saved %s', display_path(download_location) - ) + logger.info("Saved %s", display_path(download_location)) if self._download_should_save: # Make a .zip of the source_dir we already created. @@ -512,24 +509,26 @@ def prepare_editable_requirement( req, # type: InstallRequirement ): # type: (...) -> AbstractDistribution - """Prepare an editable requirement - """ + """Prepare an editable requirement""" assert req.editable, "cannot prepare a non-editable req as editable" - logger.info('Obtaining %s', req) + logger.info("Obtaining %s", req) with indent_log(): if self.require_hashes: raise InstallationError( - 'The editable requirement {} cannot be installed when ' - 'requiring hashes, because there is no single file to ' - 'hash.'.format(req) + "The editable requirement {} cannot be installed when " + "requiring hashes, because there is no single file to " + "hash.".format(req) ) req.ensure_has_source_dir(self.src_dir) req.update_editable(not self._download_should_save) abstract_dist = _get_prepared_distribution( - req, self.req_tracker, self.finder, self.build_isolation, + req, + self.req_tracker, + self.finder, + self.build_isolation, ) if self._download_should_save: @@ -541,27 +540,25 @@ def prepare_editable_requirement( def prepare_installed_requirement( self, req, # type: InstallRequirement - skip_reason # type: str + skip_reason, # type: str ): # type: (...) -> AbstractDistribution - """Prepare an already-installed requirement - """ + """Prepare an already-installed requirement""" assert req.satisfied_by, "req should have been satisfied but isn't" assert skip_reason is not None, ( "did not get skip reason skipped but req.satisfied_by " "is set to {}".format(req.satisfied_by) ) logger.info( - 'Requirement %s: %s (%s)', - skip_reason, req, req.satisfied_by.version + "Requirement %s: %s (%s)", skip_reason, req, req.satisfied_by.version ) with indent_log(): if self.require_hashes: logger.debug( - 'Since it is already installed, we are trusting this ' - 'package without checking its hash. To ensure a ' - 'completely repeatable environment, install into an ' - 'empty virtualenv.' + "Since it is already installed, we are trusting this " + "package without checking its hash. To ensure a " + "completely repeatable environment, install into an " + "empty virtualenv." ) abstract_dist = InstalledDistribution(req) diff --git a/src/fetchcode/vcs/pip/_internal/pyproject.py b/src/fetchcode/vcs/pip/_internal/pyproject.py index 8aadc240..e478a457 100644 --- a/src/fetchcode/vcs/pip/_internal/pyproject.py +++ b/src/fetchcode/vcs/pip/_internal/pyproject.py @@ -1,11 +1,13 @@ - import io import os import sys from collections import namedtuple from fetchcode.vcs.pip._vendor import six, toml -from fetchcode.vcs.pip._vendor.packaging.requirements import InvalidRequirement, Requirement +from fetchcode.vcs.pip._vendor.packaging.requirements import ( + InvalidRequirement, + Requirement, +) from fetchcode.vcs.pip._internal.exceptions import InstallationError from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING @@ -16,15 +18,14 @@ def _is_list_of_str(obj): # type: (Any) -> bool - return ( - isinstance(obj, list) and - all(isinstance(item, six.string_types) for item in obj) + return isinstance(obj, list) and all( + isinstance(item, six.string_types) for item in obj ) def make_pyproject_path(unpacked_source_directory): # type: (str) -> str - path = os.path.join(unpacked_source_directory, 'pyproject.toml') + path = os.path.join(unpacked_source_directory, "pyproject.toml") # Python2 __file__ should not be unicode if six.PY2 and isinstance(path, six.text_type): @@ -33,16 +34,16 @@ def make_pyproject_path(unpacked_source_directory): return path -BuildSystemDetails = namedtuple('BuildSystemDetails', [ - 'requires', 'backend', 'check', 'backend_path' -]) +BuildSystemDetails = namedtuple( + "BuildSystemDetails", ["requires", "backend", "check", "backend_path"] +) def load_pyproject_toml( use_pep517, # type: Optional[bool] pyproject_toml, # type: str setup_py, # type: str - req_name # type: str + req_name, # type: str ): # type: (...) -> Optional[BuildSystemDetails] """Load the pyproject.toml file. @@ -94,9 +95,7 @@ def load_pyproject_toml( raise InstallationError( "Disabling PEP 517 processing is invalid: " "project specifies a build backend of {} " - "in pyproject.toml".format( - build_system["build-backend"] - ) + "in pyproject.toml".format(build_system["build-backend"]) ) use_pep517 = True @@ -144,19 +143,24 @@ def load_pyproject_toml( # Specifying the build-system table but not the requires key is invalid if "requires" not in build_system: raise InstallationError( - error_template.format(package=req_name, reason=( - "it has a 'build-system' table but not " - "'build-system.requires' which is mandatory in the table" - )) + error_template.format( + package=req_name, + reason=( + "it has a 'build-system' table but not " + "'build-system.requires' which is mandatory in the table" + ), + ) ) # Error out if requires is not a list of strings requires = build_system["requires"] if not _is_list_of_str(requires): - raise InstallationError(error_template.format( - package=req_name, - reason="'build-system.requires' is not a list of strings.", - )) + raise InstallationError( + error_template.format( + package=req_name, + reason="'build-system.requires' is not a list of strings.", + ) + ) # Each requirement must be valid as per PEP 508 for requirement in requires: diff --git a/src/fetchcode/vcs/pip/_internal/req/__init__.py b/src/fetchcode/vcs/pip/_internal/req/__init__.py index 1649984f..8d1cea1a 100644 --- a/src/fetchcode/vcs/pip/_internal/req/__init__.py +++ b/src/fetchcode/vcs/pip/_internal/req/__init__.py @@ -15,8 +15,10 @@ from typing import Any, List, Sequence __all__ = [ - "RequirementSet", "InstallRequirement", - "parse_requirements", "install_given_reqs", + "RequirementSet", + "InstallRequirement", + "parse_requirements", + "install_given_reqs", ] logger = logging.getLogger(__name__) @@ -48,8 +50,8 @@ def install_given_reqs( if to_install: logger.info( - 'Installing collected packages: %s', - ', '.join([req.name for req in to_install]), + "Installing collected packages: %s", + ", ".join([req.name for req in to_install]), ) installed = [] @@ -57,22 +59,14 @@ def install_given_reqs( with indent_log(): for requirement in to_install: if requirement.should_reinstall: - logger.info('Attempting uninstall: %s', requirement.name) + logger.info("Attempting uninstall: %s", requirement.name) with indent_log(): - uninstalled_pathset = requirement.uninstall( - auto_confirm=True - ) + uninstalled_pathset = requirement.uninstall(auto_confirm=True) try: - requirement.install( - install_options, - global_options, - *args, - **kwargs - ) + requirement.install(install_options, global_options, *args, **kwargs) except Exception: should_rollback = ( - requirement.should_reinstall and - not requirement.install_succeeded + requirement.should_reinstall and not requirement.install_succeeded ) # if install did not succeed, rollback previous uninstall if should_rollback: @@ -80,8 +74,7 @@ def install_given_reqs( raise else: should_commit = ( - requirement.should_reinstall and - requirement.install_succeeded + requirement.should_reinstall and requirement.install_succeeded ) if should_commit: uninstalled_pathset.commit() diff --git a/src/fetchcode/vcs/pip/_internal/req/constructors.py b/src/fetchcode/vcs/pip/_internal/req/constructors.py index 644e3c0a..e90902b1 100644 --- a/src/fetchcode/vcs/pip/_internal/req/constructors.py +++ b/src/fetchcode/vcs/pip/_internal/req/constructors.py @@ -16,9 +16,15 @@ import re from fetchcode.vcs.pip._vendor.packaging.markers import Marker -from fetchcode.vcs.pip._vendor.packaging.requirements import InvalidRequirement, Requirement +from fetchcode.vcs.pip._vendor.packaging.requirements import ( + InvalidRequirement, + Requirement, +) from fetchcode.vcs.pip._vendor.packaging.specifiers import Specifier -from fetchcode.vcs.pip._vendor.pkg_resources import RequirementParseError, parse_requirements +from fetchcode.vcs.pip._vendor.pkg_resources import ( + RequirementParseError, + parse_requirements, +) from fetchcode.vcs.pip._internal.exceptions import InstallationError from fetchcode.vcs.pip._internal.models.index import PyPI, TestPyPI @@ -34,15 +40,17 @@ if MYPY_CHECK_RUNNING: from typing import ( - Any, Dict, Optional, Set, Tuple, Union, + Any, + Dict, + Optional, + Set, + Tuple, + Union, ) from fetchcode.vcs.pip._internal.req.req_file import ParsedRequirement -__all__ = [ - "install_req_from_editable", "install_req_from_line", - "parse_editable" -] +__all__ = ["install_req_from_editable", "install_req_from_line", "parse_editable"] logger = logging.getLogger(__name__) operators = Specifier._operators.keys() @@ -59,7 +67,7 @@ def is_archive_file(name): def _strip_extras(path): # type: (str) -> Tuple[str, Optional[str]] - m = re.match(r'^(.+)(\[[^\]]+\])$', path) + m = re.match(r"^(.+)(\[[^\]]+\])$", path) extras = None if m: path_no_extras = m.group(1) @@ -95,23 +103,23 @@ def parse_editable(editable_req): url_no_extras, extras = _strip_extras(url) if os.path.isdir(url_no_extras): - if not os.path.exists(os.path.join(url_no_extras, 'setup.py')): + if not os.path.exists(os.path.join(url_no_extras, "setup.py")): msg = ( 'File "setup.py" not found. Directory cannot be installed ' - 'in editable mode: {}'.format(os.path.abspath(url_no_extras)) + "in editable mode: {}".format(os.path.abspath(url_no_extras)) ) pyproject_path = make_pyproject_path(url_no_extras) if os.path.isfile(pyproject_path): msg += ( '\n(A "pyproject.toml" file was found, but editable ' - 'mode currently requires a setup.py based build.)' + "mode currently requires a setup.py based build.)" ) raise InstallationError(msg) # Treating it as code that has already been checked out url_no_extras = path_to_url(url_no_extras) - if url_no_extras.lower().startswith('file:'): + if url_no_extras.lower().startswith("file:"): package_name = Link(url_no_extras).egg_fragment if extras: return ( @@ -123,24 +131,24 @@ def parse_editable(editable_req): return package_name, url_no_extras, None for version_control in vcs: - if url.lower().startswith('{}:'.format(version_control)): - url = '{}+{}'.format(version_control, url) + if url.lower().startswith("{}:".format(version_control)): + url = "{}+{}".format(version_control, url) break - if '+' not in url: + if "+" not in url: raise InstallationError( - '{} is not a valid editable requirement. ' - 'It should either be a path to a local project or a VCS URL ' - '(beginning with svn+, git+, hg+, or bzr+).'.format(editable_req) + "{} is not a valid editable requirement. " + "It should either be a path to a local project or a VCS URL " + "(beginning with svn+, git+, hg+, or bzr+).".format(editable_req) ) - vc_type = url.split('+', 1)[0].lower() + vc_type = url.split("+", 1)[0].lower() if not vcs.get_backend(vc_type): - backends = ", ".join([bends.name + '+URL' for bends in vcs.backends]) - error_message = "For --editable={}, " \ - "only {} are currently supported".format( - editable_req, backends) + backends = ", ".join([bends.name + "+URL" for bends in vcs.backends]) + error_message = "For --editable={}, " "only {} are currently supported".format( + editable_req, backends + ) raise InstallationError(error_message) package_name = Link(url).egg_fragment @@ -164,7 +172,7 @@ def deduce_helpful_msg(req): msg = " It does exist." # Try to parse and check if it is a requirements file. try: - with open(req, 'r') as fp: + with open(req, "r") as fp: # parse first line only next(parse_requirements(fp.read())) msg += ( @@ -175,8 +183,13 @@ def deduce_helpful_msg(req): " the packages specified within it." ).format(req) except RequirementParseError: - logger.debug("Cannot parse '{}' as requirements \ - file".format(req), exc_info=True) + logger.debug( + "Cannot parse '{}' as requirements \ + file".format( + req + ), + exc_info=True, + ) else: msg += " File '{}' does not exist.".format(req) return msg @@ -184,11 +197,11 @@ def deduce_helpful_msg(req): class RequirementParts(object): def __init__( - self, - requirement, # type: Optional[Requirement] - link, # type: Optional[Link] - markers, # type: Optional[Marker] - extras, # type: Set[str] + self, + requirement, # type: Optional[Requirement] + link, # type: Optional[Link] + markers, # type: Optional[Marker] + extras, # type: Set[str] ): self.requirement = requirement self.link = link @@ -222,7 +235,7 @@ def install_req_from_editable( use_pep517=None, # type: Optional[bool] isolated=False, # type: bool options=None, # type: Optional[Dict[str, Any]] - constraint=False # type: bool + constraint=False, # type: bool ): # type: (...) -> InstallRequirement @@ -284,15 +297,13 @@ def _get_url_from_path(path, name): return None if os.path.isfile(path): return path_to_url(path) - urlreq_parts = name.split('@', 1) + urlreq_parts = name.split("@", 1) if len(urlreq_parts) >= 2 and not _looks_like_path(urlreq_parts[0]): # If the path contains '@' and the part before it does not look # like a path, try to treat it as a PEP 440 URL req instead. return None logger.warning( - 'Requirement %r looks like a filename, but the ' - 'file does not exist', - name + "Requirement %r looks like a filename, but the " "file does not exist", name ) return path_to_url(path) @@ -300,9 +311,9 @@ def _get_url_from_path(path, name): def parse_req_from_line(name, line_source): # type: (str, Optional[str]) -> RequirementParts if is_url(name): - marker_sep = '; ' + marker_sep = "; " else: - marker_sep = ';' + marker_sep = ";" if marker_sep in name: name, markers_as_string = name.split(marker_sep, 1) markers_as_string = markers_as_string.strip() @@ -329,9 +340,8 @@ def parse_req_from_line(name, line_source): # it's a local file, dir, or url if link: # Handle relative file URLs - if link.scheme == 'file' and re.search(r'\.\./', link.url): - link = Link( - path_to_url(os.path.normpath(os.path.abspath(link.path)))) + if link.scheme == "file" and re.search(r"\.\./", link.url): + link = Link(path_to_url(os.path.normpath(os.path.abspath(link.path)))) # wheel file if link.is_wheel: wheel = Wheel(link.filename) # can raise InvalidWheelFilename @@ -351,7 +361,7 @@ def with_source(text): # type: (str) -> str if not line_source: return text - return '{} (from {})'.format(text, line_source) + return "{} (from {})".format(text, line_source) if req_as_string is not None: try: @@ -360,16 +370,15 @@ def with_source(text): if os.path.sep in req_as_string: add_msg = "It looks like a path." add_msg += deduce_helpful_msg(req_as_string) - elif ('=' in req_as_string and - not any(op in req_as_string for op in operators)): + elif "=" in req_as_string and not any( + op in req_as_string for op in operators + ): add_msg = "= is not a valid operator. Did you mean == ?" else: - add_msg = '' - msg = with_source( - 'Invalid requirement: {!r}'.format(req_as_string) - ) + add_msg = "" + msg = with_source("Invalid requirement: {!r}".format(req_as_string)) if add_msg: - msg += '\nHint: {}'.format(add_msg) + msg += "\nHint: {}".format(add_msg) raise InstallationError(msg) else: req = None @@ -396,8 +405,12 @@ def install_req_from_line( parts = parse_req_from_line(name, line_source) return InstallRequirement( - parts.requirement, comes_from, link=parts.link, markers=parts.markers, - use_pep517=use_pep517, isolated=isolated, + parts.requirement, + comes_from, + link=parts.link, + markers=parts.markers, + use_pep517=use_pep517, + isolated=isolated, install_options=options.get("install_options", []) if options else [], global_options=options.get("global_options", []) if options else [], hash_options=options.get("hashes", {}) if options else {}, @@ -410,7 +423,7 @@ def install_req_from_req_string( req_string, # type: str comes_from=None, # type: Optional[InstallRequirement] isolated=False, # type: bool - use_pep517=None # type: Optional[bool] + use_pep517=None, # type: Optional[bool] ): # type: (...) -> InstallRequirement try: @@ -422,8 +435,12 @@ def install_req_from_req_string( PyPI.file_storage_domain, TestPyPI.file_storage_domain, ] - if (req.url and comes_from and comes_from.link and - comes_from.link.netloc in domains_not_allowed): + if ( + req.url + and comes_from + and comes_from.link + and comes_from.link.netloc in domains_not_allowed + ): # Explicitly disallow pypi packages that depend on external urls raise InstallationError( "Packages installed from PyPI cannot depend on packages " @@ -431,15 +448,13 @@ def install_req_from_req_string( "{} depends on {} ".format(comes_from.name, req) ) - return InstallRequirement( - req, comes_from, isolated=isolated, use_pep517=use_pep517 - ) + return InstallRequirement(req, comes_from, isolated=isolated, use_pep517=use_pep517) def install_req_from_parsed_requirement( parsed_req, # type: ParsedRequirement isolated=False, # type: bool - use_pep517=None # type: Optional[bool] + use_pep517=None, # type: Optional[bool] ): # type: (...) -> InstallRequirement if parsed_req.is_editable: diff --git a/src/fetchcode/vcs/pip/_internal/req/req_file.py b/src/fetchcode/vcs/pip/_internal/req/req_file.py index 8d396642..4d594a4a 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_file.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_file.py @@ -27,7 +27,15 @@ if MYPY_CHECK_RUNNING: from optparse import Values from typing import ( - Any, Callable, Dict, Iterator, List, NoReturn, Optional, Text, Tuple, + Any, + Callable, + Dict, + Iterator, + List, + NoReturn, + Optional, + Text, + Tuple, ) from fetchcode.vcs.pip._internal.index.package_finder import PackageFinder @@ -38,16 +46,16 @@ LineParser = Callable[[Text], Tuple[str, Values]] -__all__ = ['parse_requirements'] +__all__ = ["parse_requirements"] -SCHEME_RE = re.compile(r'^(http|https|file):', re.I) -COMMENT_RE = re.compile(r'(^|\s+)#.*$') +SCHEME_RE = re.compile(r"^(http|https|file):", re.I) +COMMENT_RE = re.compile(r"(^|\s+)#.*$") # Matches environment variable-style values in '${MY_VARIABLE_1}' with the # variable name consisting of only uppercase letters, digits or the '_' # (underscore). This follows the POSIX standard defined in IEEE Std 1003.1, # 2013 Edition. -ENV_VAR_RE = re.compile(r'(?P\$\{(?P[A-Z0-9_]+)\})') +ENV_VAR_RE = re.compile(r"(?P\$\{(?P[A-Z0-9_]+)\})") SUPPORTED_OPTIONS = [ cmdoptions.index_url, @@ -149,10 +157,7 @@ def parse_requirements( for parsed_line in parser.parse(filename, constraint): parsed_req = handle_line( - parsed_line, - options=options, - finder=finder, - session=session + parsed_line, options=options, finder=finder, session=session ) if parsed_req is not None: yield parsed_req @@ -178,8 +183,10 @@ def handle_requirement_line( # type: (...) -> ParsedRequirement # preserve for the nested code path - line_comes_from = '{} {} (line {})'.format( - '-c' if line.constraint else '-r', line.filename, line.lineno, + line_comes_from = "{} {} (line {})".format( + "-c" if line.constraint else "-r", + line.filename, + line.lineno, ) assert line.is_requirement @@ -204,7 +211,7 @@ def handle_requirement_line( if dest in line.opts.__dict__ and line.opts.__dict__[dest]: req_options[dest] = line.opts.__dict__[dest] - line_source = 'line {} of {}'.format(line.lineno, line.filename) + line_source = "line {} of {}".format(line.lineno, line.filename) return ParsedRequirement( requirement=line.requirement, is_editable=line.is_editable, @@ -261,7 +268,7 @@ def handle_option_line( if session: for host in opts.trusted_hosts or []: - source = 'line {} of {}'.format(lineno, filename) + source = "line {} of {}".format(lineno, filename) session.add_trusted_host(host, source=source) @@ -324,17 +331,15 @@ def __init__( def parse(self, filename, constraint): # type: (str, bool) -> Iterator[ParsedLine] - """Parse a given file, yielding parsed lines. - """ + """Parse a given file, yielding parsed lines.""" for line in self._parse_and_recurse(filename, constraint): yield line def _parse_and_recurse(self, filename, constraint): # type: (str, bool) -> Iterator[ParsedLine] for line in self._parse_file(filename, constraint): - if ( - not line.is_requirement and - (line.opts.requirements or line.opts.constraints) + if not line.is_requirement and ( + line.opts.requirements or line.opts.constraints ): # parse a nested requirements file if line.opts.requirements: @@ -352,11 +357,13 @@ def _parse_and_recurse(self, filename, constraint): elif not SCHEME_RE.search(req_path): # do a join so relative paths work req_path = os.path.join( - os.path.dirname(filename), req_path, + os.path.dirname(filename), + req_path, ) for inner_line in self._parse_and_recurse( - req_path, nested_constraint, + req_path, + nested_constraint, ): yield inner_line else: @@ -375,7 +382,7 @@ def _parse_file(self, filename, constraint): args_str, opts = self._line_parser(line) except OptionParsingError as e: # add offending line - msg = 'Invalid requirement: {}\n{}'.format(line, e.msg) + msg = "Invalid requirement: {}\n{}".format(line, e.msg) raise RequirementsFileParseError(msg) yield ParsedLine( @@ -404,11 +411,10 @@ def parse_line(line): # Prior to 2.7.3, shlex cannot deal with unicode entries if sys.version_info < (2, 7, 3): # https://github.com/python/mypy/issues/1174 - options_str = options_str.encode('utf8') # type: ignore + options_str = options_str.encode("utf8") # type: ignore # https://github.com/python/mypy/issues/1174 - opts, _ = parser.parse_args( - shlex.split(options_str), defaults) # type: ignore + opts, _ = parser.parse_args(shlex.split(options_str), defaults) # type: ignore return args_str, opts @@ -421,16 +427,16 @@ def break_args_options(line): (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex. """ - tokens = line.split(' ') + tokens = line.split(" ") args = [] options = tokens[:] for token in tokens: - if token.startswith('-') or token.startswith('--'): + if token.startswith("-") or token.startswith("--"): break else: args.append(token) options.pop(0) - return ' '.join(args), ' '.join(options) # type: ignore + return " ".join(args), " ".join(options) # type: ignore class OptionParsingError(Exception): @@ -456,6 +462,7 @@ def build_parser(): def parser_exit(self, msg): # type: (Any, str) -> NoReturn raise OptionParsingError(msg) + # NOTE: mypy disallows assigning to a method # https://github.com/python/mypy/issues/2427 parser.exit = parser_exit # type: ignore @@ -471,24 +478,24 @@ def join_lines(lines_enum): primary_line_number = None new_line = [] # type: List[Text] for line_number, line in lines_enum: - if not line.endswith('\\') or COMMENT_RE.match(line): + if not line.endswith("\\") or COMMENT_RE.match(line): if COMMENT_RE.match(line): # this ensures comments are always matched later - line = ' ' + line + line = " " + line if new_line: new_line.append(line) - yield primary_line_number, ''.join(new_line) + yield primary_line_number, "".join(new_line) new_line = [] else: yield line_number, line else: if not new_line: primary_line_number = line_number - new_line.append(line.strip('\\')) + new_line.append(line.strip("\\")) # last line contains \ if new_line: - yield primary_line_number, ''.join(new_line) + yield primary_line_number, "".join(new_line) # TODO: handle space after '\'. @@ -499,7 +506,7 @@ def ignore_comments(lines_enum): Strips comments and filter empty lines. """ for line_number, line in lines_enum: - line = COMMENT_RE.sub('', line) + line = COMMENT_RE.sub("", line) line = line.strip() if line: yield line_number, line @@ -545,37 +552,35 @@ def get_file_content(url, session, comes_from=None): """ scheme = get_url_scheme(url) - if scheme in ['http', 'https']: + if scheme in ["http", "https"]: # FIXME: catch some errors resp = session.get(url) resp.raise_for_status() return resp.url, resp.text - elif scheme == 'file': - if comes_from and comes_from.startswith('http'): + elif scheme == "file": + if comes_from and comes_from.startswith("http"): raise InstallationError( - 'Requirements file {} references URL {}, ' - 'which is local'.format(comes_from, url) + "Requirements file {} references URL {}, " + "which is local".format(comes_from, url) ) - path = url.split(':', 1)[1] - path = path.replace('\\', '/') + path = url.split(":", 1)[1] + path = path.replace("\\", "/") match = _url_slash_drive_re.match(path) if match: - path = match.group(1) + ':' + path.split('|', 1)[1] + path = match.group(1) + ":" + path.split("|", 1)[1] path = urllib_parse.unquote(path) - if path.startswith('/'): - path = '/' + path.lstrip('/') + if path.startswith("/"): + path = "/" + path.lstrip("/") url = path try: - with open(url, 'rb') as f: + with open(url, "rb") as f: content = auto_decode(f.read()) except IOError as exc: - raise InstallationError( - 'Could not open requirements file: {}'.format(exc) - ) + raise InstallationError("Could not open requirements file: {}".format(exc)) return url, content -_url_slash_drive_re = re.compile(r'/*([a-z])\|', re.I) +_url_slash_drive_re = re.compile(r"/*([a-z])\|", re.I) diff --git a/src/fetchcode/vcs/pip/_internal/req/req_install.py b/src/fetchcode/vcs/pip/_internal/req/req_install.py index d5f1728a..d1d9c616 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_install.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_install.py @@ -20,14 +20,21 @@ from fetchcode.vcs.pip._internal.locations import get_scheme from fetchcode.vcs.pip._internal.models.link import Link from fetchcode.vcs.pip._internal.operations.build.metadata import generate_metadata -from fetchcode.vcs.pip._internal.operations.build.metadata_legacy import \ - generate_metadata as generate_metadata_legacy -from fetchcode.vcs.pip._internal.operations.install.editable_legacy import \ - install_editable as install_editable_legacy +from fetchcode.vcs.pip._internal.operations.build.metadata_legacy import ( + generate_metadata as generate_metadata_legacy, +) +from fetchcode.vcs.pip._internal.operations.install.editable_legacy import ( + install_editable as install_editable_legacy, +) from fetchcode.vcs.pip._internal.operations.install.legacy import LegacyInstallFailure -from fetchcode.vcs.pip._internal.operations.install.legacy import install as install_legacy +from fetchcode.vcs.pip._internal.operations.install.legacy import ( + install as install_legacy, +) from fetchcode.vcs.pip._internal.operations.install.wheel import install_wheel -from fetchcode.vcs.pip._internal.pyproject import load_pyproject_toml, make_pyproject_path +from fetchcode.vcs.pip._internal.pyproject import ( + load_pyproject_toml, + make_pyproject_path, +) from fetchcode.vcs.pip._internal.req.req_uninstall import UninstallPathSet from fetchcode.vcs.pip._internal.utils.deprecation import deprecated from fetchcode.vcs.pip._internal.utils.direct_url_helpers import direct_url_from_link @@ -51,7 +58,13 @@ if MYPY_CHECK_RUNNING: from typing import ( - Any, Dict, Iterable, List, Optional, Sequence, Union, + Any, + Dict, + Iterable, + List, + Optional, + Sequence, + Union, ) from fetchcode.vcs.pip._internal.build_env import BuildEnvironment from fetchcode.vcs.pip._vendor.pkg_resources import Distribution @@ -109,7 +122,7 @@ def __init__( global_options=None, # type: Optional[List[str]] hash_options=None, # type: Optional[Dict[str, List[str]]] constraint=False, # type: bool - extras=() # type: Iterable[str] + extras=(), # type: Iterable[str] ): # type: (...) -> None assert req is None or isinstance(req, Requirement), req @@ -127,9 +140,7 @@ def __init__( if self.editable: assert link if link.is_file: - self.source_dir = os.path.normpath( - os.path.abspath(link.file_path) - ) + self.source_dir = os.path.normpath(os.path.abspath(link.file_path)) if link is None and req and req.url: # PEP 508 URL requirement @@ -145,9 +156,7 @@ def __init__( if extras: self.extras = extras elif req: - self.extras = { - pkg_resources.safe_extra(extra) for extra in req.extras - } + self.extras = {pkg_resources.safe_extra(extra) for extra in req.extras} else: self.extras = set() if markers is None and req: @@ -211,38 +220,36 @@ def __str__(self): if self.req: s = str(self.req) if self.link: - s += ' from {}'.format(redact_auth_from_url(self.link.url)) + s += " from {}".format(redact_auth_from_url(self.link.url)) elif self.link: s = redact_auth_from_url(self.link.url) else: - s = '' + s = "" if self.satisfied_by is not None: - s += ' in {}'.format(display_path(self.satisfied_by.location)) + s += " in {}".format(display_path(self.satisfied_by.location)) if self.comes_from: if isinstance(self.comes_from, six.string_types): comes_from = self.comes_from # type: Optional[str] else: comes_from = self.comes_from.from_path() if comes_from: - s += ' (from {})'.format(comes_from) + s += " (from {})".format(comes_from) return s def __repr__(self): # type: () -> str - return '<{} object: {} editable={!r}>'.format( - self.__class__.__name__, str(self), self.editable) + return "<{} object: {} editable={!r}>".format( + self.__class__.__name__, str(self), self.editable + ) def format_debug(self): # type: () -> str - """An un-tested helper for getting state, for debugging. - """ + """An un-tested helper for getting state, for debugging.""" attributes = vars(self) names = sorted(attributes) - state = ( - "{}={!r}".format(attr, attributes[attr]) for attr in sorted(names) - ) - return '<{name} object: {{{state}}}>'.format( + state = ("{}={!r}".format(attr, attributes[attr]) for attr in sorted(names)) + return "<{name} object: {{{state}}}>".format( name=self.__class__.__name__, state=", ".join(state), ) @@ -268,8 +275,7 @@ def is_pinned(self): For example, some-package==1.2 is pinned; some-package>1.2 is not. """ specifiers = self.specifier - return (len(specifiers) == 1 and - next(iter(specifiers)).operator in {'==', '==='}) + return len(specifiers) == 1 and next(iter(specifiers)).operator in {"==", "==="} @property def installed_version(self): @@ -281,11 +287,11 @@ def match_markers(self, extras_requested=None): if not extras_requested: # Provide an extra to safely evaluate the markers # without matching any extra - extras_requested = ('',) + extras_requested = ("",) if self.markers is not None: return any( - self.markers.evaluate({'extra': extra}) - for extra in extras_requested) + self.markers.evaluate({"extra": extra}) for extra in extras_requested + ) else: return True @@ -324,8 +330,7 @@ def hashes(self, trust_internet=True): def from_path(self): # type: () -> Optional[str] - """Format a nice indicator to show where this "comes from" - """ + """Format a nice indicator to show where this "comes from" """ if self.req is None: return None s = str(self.req) @@ -335,7 +340,7 @@ def from_path(self): else: comes_from = self.comes_from.from_path() if comes_from: - s += '->' + comes_from + s += "->" + comes_from return s def ensure_build_location(self, build_dir, autodelete): @@ -360,7 +365,7 @@ def ensure_build_location(self, build_dir, autodelete): # FIXME: Is there a better place to create the build_dir? (hg and bzr # need this) if not os.path.exists(build_dir): - logger.debug('Creating directory %s', build_dir) + logger.debug("Creating directory %s", build_dir) os.makedirs(build_dir) actual_build_dir = os.path.join(build_dir, name) # `None` indicates that we respect the globally-configured deletion @@ -375,8 +380,7 @@ def ensure_build_location(self, build_dir, autodelete): def _set_requirement(self): # type: () -> None - """Set requirement after generating metadata. - """ + """Set requirement after generating metadata.""" assert self.req is None assert self.metadata is not None assert self.source_dir is not None @@ -388,11 +392,13 @@ def _set_requirement(self): op = "===" self.req = Requirement( - "".join([ - self.metadata["Name"], - op, - self.metadata["Version"], - ]) + "".join( + [ + self.metadata["Name"], + op, + self.metadata["Version"], + ] + ) ) def warn_on_mismatching_name(self): @@ -404,10 +410,12 @@ def warn_on_mismatching_name(self): # If we're here, there's a mismatch. Log a warning about it. logger.warning( - 'Generating metadata for package %s ' - 'produced metadata for project name %s. Fix your ' - '#egg=%s fragments.', - self.name, metadata_name, self.name + "Generating metadata for package %s " + "produced metadata for project name %s. Fix your " + "#egg=%s fragments.", + self.name, + metadata_name, + self.name, ) self.req = Requirement(metadata_name) @@ -430,18 +438,18 @@ def check_if_exists(self, use_user_site): except pkg_resources.DistributionNotFound: return except pkg_resources.VersionConflict: - existing_dist = pkg_resources.get_distribution( - self.req.name - ) + existing_dist = pkg_resources.get_distribution(self.req.name) if use_user_site: if dist_in_usersite(existing_dist): self.should_reinstall = True - elif (running_under_virtualenv() and - dist_in_site_packages(existing_dist)): + elif running_under_virtualenv() and dist_in_site_packages( + existing_dist + ): raise InstallationError( "Will not install to the user site because it will " "lack sys.path precedence to {} in {}".format( - existing_dist.project_name, existing_dist.location) + existing_dist.project_name, existing_dist.location + ) ) else: self.should_reinstall = True @@ -465,14 +473,14 @@ def is_wheel(self): def unpacked_source_directory(self): # type: () -> str return os.path.join( - self.source_dir, - self.link and self.link.subdirectory_fragment or '') + self.source_dir, self.link and self.link.subdirectory_fragment or "" + ) @property def setup_py_path(self): # type: () -> str assert self.source_dir, "No source dir for {}".format(self) - setup_py = os.path.join(self.unpacked_source_directory, 'setup.py') + setup_py = os.path.join(self.unpacked_source_directory, "setup.py") # Python2 __file__ should not be unicode if six.PY2 and isinstance(setup_py, six.text_type): @@ -496,10 +504,7 @@ def load_pyproject_toml(self): follow the PEP 517 or legacy (setup.py) code path. """ pyproject_toml_data = load_pyproject_toml( - self.use_pep517, - self.pyproject_toml_path, - self.setup_py_path, - str(self) + self.use_pep517, self.pyproject_toml_path, self.setup_py_path, str(self) ) if pyproject_toml_data is None: @@ -511,13 +516,14 @@ def load_pyproject_toml(self): self.requirements_to_check = check self.pyproject_requires = requires self.pep517_backend = Pep517HookCaller( - self.unpacked_source_directory, backend, backend_path=backend_path, + self.unpacked_source_directory, + backend, + backend_path=backend_path, ) def _generate_metadata(self): # type: () -> str - """Invokes metadata generator functions, with the required arguments. - """ + """Invokes metadata generator functions, with the required arguments.""" if not self.use_pep517: assert self.unpacked_source_directory @@ -526,7 +532,7 @@ def _generate_metadata(self): setup_py_path=self.setup_py_path, source_dir=self.unpacked_source_directory, isolated=self.isolated, - details=self.name or "from {}".format(self.link) + details=self.name or "from {}".format(self.link), ) assert self.pep517_backend is not None @@ -559,7 +565,7 @@ def prepare_metadata(self): @property def metadata(self): # type: () -> Any - if not hasattr(self, '_metadata'): + if not hasattr(self, "_metadata"): self._metadata = get_metadata(self.get_dist()) return self._metadata @@ -571,16 +577,16 @@ def get_dist(self): def assert_source_matches_version(self): # type: () -> None assert self.source_dir - version = self.metadata['version'] + version = self.metadata["version"] if self.req.specifier and version not in self.req.specifier: logger.warning( - 'Requested %s, but installing version %s', + "Requested %s, but installing version %s", self, version, ) else: logger.debug( - 'Source in %s has version %s, which satisfies requirement %s', + "Source in %s has version %s, which satisfies requirement %s", display_path(self.source_dir), version, self, @@ -599,36 +605,30 @@ def ensure_has_source_dir(self, parent_dir, autodelete=False): :return: self.source_dir """ if self.source_dir is None: - self.source_dir = self.ensure_build_location( - parent_dir, autodelete - ) + self.source_dir = self.ensure_build_location(parent_dir, autodelete) # For editable installations def update_editable(self, obtain=True): # type: (bool) -> None if not self.link: logger.debug( - "Cannot update repository at %s; repository location is " - "unknown", + "Cannot update repository at %s; repository location is " "unknown", self.source_dir, ) return assert self.editable assert self.source_dir - if self.link.scheme == 'file': + if self.link.scheme == "file": # Static paths don't get updated return - assert '+' in self.link.url, \ - "bad url: {self.link.url!r}".format(**locals()) - vc_type, url = self.link.url.split('+', 1) + assert "+" in self.link.url, "bad url: {self.link.url!r}".format(**locals()) + vc_type, url = self.link.url.split("+", 1) vcs_backend = vcs.get_backend(vc_type) if vcs_backend: if not self.link.is_vcs: reason = ( "This form of VCS requirement is being deprecated: {}." - ).format( - self.link.url - ) + ).format(self.link.url) replacement = None if self.link.url.startswith("git+git@"): replacement = ( @@ -643,9 +643,9 @@ def update_editable(self, obtain=True): else: vcs_backend.export(self.source_dir, url=hidden_url) else: - assert 0, ( - 'Unexpected version control type (in {}): {}'.format( - self.link, vc_type)) + assert 0, "Unexpected version control type (in {}): {}".format( + self.link, vc_type + ) # Top-level Actions def uninstall(self, auto_confirm=False, verbose=False): @@ -669,7 +669,7 @@ def uninstall(self, auto_confirm=False, verbose=False): logger.warning("Skipping %s as it is not installed.", self.name) return None else: - logger.info('Found existing installation: %s', dist) + logger.info("Found existing installation: %s", dist) uninstalled_pathset = UninstallPathSet.from_dist(dist) uninstalled_pathset.remove(auto_confirm, verbose) @@ -680,17 +680,16 @@ def _get_archive_name(self, path, parentdir, rootdir): def _clean_zip_name(name, prefix): # type: (str, str) -> str - assert name.startswith(prefix + os.path.sep), ( - "name {name!r} doesn't start with prefix {prefix!r}" - .format(**locals()) - ) - name = name[len(prefix) + 1:] - name = name.replace(os.path.sep, '/') + assert name.startswith( + prefix + os.path.sep + ), "name {name!r} doesn't start with prefix {prefix!r}".format(**locals()) + name = name[len(prefix) + 1 :] + name = name.replace(os.path.sep, "/") return name path = os.path.join(parentdir, path) name = _clean_zip_name(path, rootdir) - return self.name + '/' + name + return self.name + "/" + name def archive(self, build_dir): # type: (str) -> None @@ -701,57 +700,62 @@ def archive(self, build_dir): assert self.source_dir create_archive = True - archive_name = '{}-{}.zip'.format(self.name, self.metadata["version"]) + archive_name = "{}-{}.zip".format(self.name, self.metadata["version"]) archive_path = os.path.join(build_dir, archive_name) if os.path.exists(archive_path): response = ask_path_exists( - 'The file {} exists. (i)gnore, (w)ipe, ' - '(b)ackup, (a)bort '.format( - display_path(archive_path)), - ('i', 'w', 'b', 'a')) - if response == 'i': + "The file {} exists. (i)gnore, (w)ipe, " + "(b)ackup, (a)bort ".format(display_path(archive_path)), + ("i", "w", "b", "a"), + ) + if response == "i": create_archive = False - elif response == 'w': - logger.warning('Deleting %s', display_path(archive_path)) + elif response == "w": + logger.warning("Deleting %s", display_path(archive_path)) os.remove(archive_path) - elif response == 'b': + elif response == "b": dest_file = backup_dir(archive_path) logger.warning( - 'Backing up %s to %s', + "Backing up %s to %s", display_path(archive_path), display_path(dest_file), ) shutil.move(archive_path, dest_file) - elif response == 'a': + elif response == "a": sys.exit(-1) if not create_archive: return zip_output = zipfile.ZipFile( - archive_path, 'w', zipfile.ZIP_DEFLATED, allowZip64=True, + archive_path, + "w", + zipfile.ZIP_DEFLATED, + allowZip64=True, ) with zip_output: - dir = os.path.normcase( - os.path.abspath(self.unpacked_source_directory) - ) + dir = os.path.normcase(os.path.abspath(self.unpacked_source_directory)) for dirpath, dirnames, filenames in os.walk(dir): for dirname in dirnames: dir_arcname = self._get_archive_name( - dirname, parentdir=dirpath, rootdir=dir, + dirname, + parentdir=dirpath, + rootdir=dir, ) - zipdir = zipfile.ZipInfo(dir_arcname + '/') + zipdir = zipfile.ZipInfo(dir_arcname + "/") zipdir.external_attr = 0x1ED << 16 # 0o755 - zip_output.writestr(zipdir, '') + zip_output.writestr(zipdir, "") for filename in filenames: file_arcname = self._get_archive_name( - filename, parentdir=dirpath, rootdir=dir, + filename, + parentdir=dirpath, + rootdir=dir, ) filename = os.path.join(dirpath, filename) zip_output.write(filename, file_arcname) - logger.info('Saved %s', display_path(archive_path)) + logger.info("Saved %s", display_path(archive_path)) def install( self, @@ -762,7 +766,7 @@ def install( prefix=None, # type: Optional[str] warn_script_location=True, # type: bool use_user_site=False, # type: bool - pycompile=True # type: bool + pycompile=True, # type: bool ): # type: (...) -> None scheme = get_scheme( diff --git a/src/fetchcode/vcs/pip/_internal/req/req_set.py b/src/fetchcode/vcs/pip/_internal/req/req_set.py index 3a385566..5025e263 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_set.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_set.py @@ -21,13 +21,13 @@ class RequirementSet(object): - def __init__(self, check_supported_wheels=True): # type: (bool) -> None - """Create a RequirementSet. - """ + """Create a RequirementSet.""" - self.requirements = OrderedDict() # type: Dict[str, InstallRequirement] # noqa: E501 + self.requirements = ( + OrderedDict() + ) # type: Dict[str, InstallRequirement] # noqa: E501 self.check_supported_wheels = check_supported_wheels self.unnamed_requirements = [] # type: List[InstallRequirement] @@ -38,7 +38,7 @@ def __str__(self): (req for req in self.requirements.values() if not req.comes_from), key=lambda req: canonicalize_name(req.name), ) - return ' '.join(str(req.req) for req in requirements) + return " ".join(str(req.req) for req in requirements) def __repr__(self): # type: () -> str @@ -47,11 +47,11 @@ def __repr__(self): key=lambda req: canonicalize_name(req.name), ) - format_string = '<{classname} object; {count} requirement(s): {reqs}>' + format_string = "<{classname} object; {count} requirement(s): {reqs}>" return format_string.format( classname=self.__class__.__name__, count=len(requirements), - reqs=', '.join(str(req.req) for req in requirements), + reqs=", ".join(str(req.req) for req in requirements), ) def add_unnamed_requirement(self, install_req): @@ -70,7 +70,7 @@ def add_requirement( self, install_req, # type: InstallRequirement parent_req_name=None, # type: Optional[str] - extras_requested=None # type: Optional[Iterable[str]] + extras_requested=None, # type: Optional[Iterable[str]] ): # type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501 """Add install_req as a requirement to install. @@ -91,7 +91,8 @@ def add_requirement( if not install_req.match_markers(extras_requested): logger.info( "Ignoring %s: markers '%s' don't match your environment", - install_req.name, install_req.markers, + install_req.name, + install_req.markers, ) return [], None @@ -102,10 +103,11 @@ def add_requirement( if install_req.link and install_req.link.is_wheel: wheel = Wheel(install_req.link.filename) tags = compatibility_tags.get_supported() - if (self.check_supported_wheels and not wheel.supported(tags)): + if self.check_supported_wheels and not wheel.supported(tags): raise InstallationError( "{} is not a supported wheel on this platform.".format( - wheel.filename) + wheel.filename + ) ) # This next bit is really a sanity check. @@ -126,16 +128,17 @@ def add_requirement( existing_req = None has_conflicting_requirement = ( - parent_req_name is None and - existing_req and - not existing_req.constraint and - existing_req.extras == install_req.extras and - existing_req.req.specifier != install_req.req.specifier + parent_req_name is None + and existing_req + and not existing_req.constraint + and existing_req.extras == install_req.extras + and existing_req.req.specifier != install_req.req.specifier ) if has_conflicting_requirement: raise InstallationError( - "Double requirement given: {} (already in {}, name={!r})" - .format(install_req, existing_req, install_req.name) + "Double requirement given: {} (already in {}, name={!r})".format( + install_req, existing_req, install_req.name + ) ) # When no existing requirement exists, add the requirement as a @@ -150,12 +153,8 @@ def add_requirement( if install_req.constraint or not existing_req.constraint: return [], existing_req - does_not_satisfy_constraint = ( - install_req.link and - not ( - existing_req.link and - install_req.link.path == existing_req.link.path - ) + does_not_satisfy_constraint = install_req.link and not ( + existing_req.link and install_req.link.path == existing_req.link.path ) if does_not_satisfy_constraint: raise InstallationError( @@ -166,12 +165,13 @@ def add_requirement( # If we're now installing a constraint, mark the existing # object for real installation. existing_req.constraint = False - existing_req.extras = tuple(sorted( - set(existing_req.extras) | set(install_req.extras) - )) + existing_req.extras = tuple( + sorted(set(existing_req.extras) | set(install_req.extras)) + ) logger.debug( "Setting %s extras to: %s", - existing_req, existing_req.extras, + existing_req, + existing_req.extras, ) # Return the existing requirement for addition to the parent and # scanning again. @@ -182,8 +182,8 @@ def has_requirement(self, name): project_name = canonicalize_name(name) return ( - project_name in self.requirements and - not self.requirements[project_name].constraint + project_name in self.requirements + and not self.requirements[project_name].constraint ) def get_requirement(self, name): diff --git a/src/fetchcode/vcs/pip/_internal/req/req_tracker.py b/src/fetchcode/vcs/pip/_internal/req/req_tracker.py index 4188492f..8d41a2e7 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_tracker.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_tracker.py @@ -52,12 +52,10 @@ def update_env_context_manager(**changes): @contextlib.contextmanager def get_requirement_tracker(): # type: () -> Iterator[RequirementTracker] - root = os.environ.get('PIP_REQ_TRACKER') + root = os.environ.get("PIP_REQ_TRACKER") with contextlib2.ExitStack() as ctx: if root is None: - root = ctx.enter_context( - TempDirectory(kind='req-tracker') - ).path + root = ctx.enter_context(TempDirectory(kind="req-tracker")).path ctx.enter_context(update_env_context_manager(PIP_REQ_TRACKER=root)) logger.debug("Initialized build tracking at %s", root) @@ -66,7 +64,6 @@ def get_requirement_tracker(): class RequirementTracker(object): - def __init__(self, root): # type: (str) -> None self._root = root @@ -82,7 +79,7 @@ def __exit__( self, exc_type, # type: Optional[Type[BaseException]] exc_val, # type: Optional[BaseException] - exc_tb # type: Optional[TracebackType] + exc_tb, # type: Optional[TracebackType] ): # type: (...) -> None self.cleanup() @@ -94,8 +91,7 @@ def _entry_path(self, link): def add(self, req): # type: (InstallRequirement) -> None - """Add an InstallRequirement to build tracking. - """ + """Add an InstallRequirement to build tracking.""" # Get the file to write information about this requirement. entry_path = self._entry_path(req.link) @@ -110,30 +106,28 @@ def add(self, req): if e.errno != errno.ENOENT: raise else: - message = '{} is already being built: {}'.format( - req.link, contents) + message = "{} is already being built: {}".format(req.link, contents) raise LookupError(message) # If we're here, req should really not be building already. assert req not in self._entries # Start tracking this requirement. - with open(entry_path, 'w') as fp: + with open(entry_path, "w") as fp: fp.write(str(req)) self._entries.add(req) - logger.debug('Added %s to build tracker %r', req, self._root) + logger.debug("Added %s to build tracker %r", req, self._root) def remove(self, req): # type: (InstallRequirement) -> None - """Remove an InstallRequirement from build tracking. - """ + """Remove an InstallRequirement from build tracking.""" # Delete the created file and the corresponding entries. os.unlink(self._entry_path(req.link)) self._entries.remove(req) - logger.debug('Removed %s from build tracker %r', req, self._root) + logger.debug("Removed %s from build tracker %r", req, self._root) def cleanup(self): # type: () -> None diff --git a/src/fetchcode/vcs/pip/_internal/req/req_uninstall.py b/src/fetchcode/vcs/pip/_internal/req/req_uninstall.py index 580c81e2..d29e9b56 100644 --- a/src/fetchcode/vcs/pip/_internal/req/req_uninstall.py +++ b/src/fetchcode/vcs/pip/_internal/req/req_uninstall.py @@ -1,4 +1,3 @@ - import csv import functools import logging @@ -10,7 +9,11 @@ from fetchcode.vcs.pip._internal.exceptions import UninstallationError from fetchcode.vcs.pip._internal.locations import bin_py, bin_user -from fetchcode.vcs.pip._internal.utils.compat import WINDOWS, cache_from_source, uses_pycache +from fetchcode.vcs.pip._internal.utils.compat import ( + WINDOWS, + cache_from_source, + uses_pycache, +) from fetchcode.vcs.pip._internal.utils.logging import indent_log from fetchcode.vcs.pip._internal.utils.misc import ( FakeFile, @@ -23,12 +26,23 @@ renames, rmtree, ) -from fetchcode.vcs.pip._internal.utils.temp_dir import AdjacentTempDirectory, TempDirectory +from fetchcode.vcs.pip._internal.utils.temp_dir import ( + AdjacentTempDirectory, + TempDirectory, +) from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import ( - Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple, + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + Optional, + Set, + Tuple, ) from fetchcode.vcs.pip._vendor.pkg_resources import Distribution @@ -48,12 +62,12 @@ def _script_names(dist, script_name, is_gui): exe_name = os.path.join(bin_dir, script_name) paths_to_remove = [exe_name] if WINDOWS: - paths_to_remove.append(exe_name + '.exe') - paths_to_remove.append(exe_name + '.exe.manifest') + paths_to_remove.append(exe_name + ".exe") + paths_to_remove.append(exe_name + ".exe.manifest") if is_gui: - paths_to_remove.append(exe_name + '-script.pyw') + paths_to_remove.append(exe_name + "-script.pyw") else: - paths_to_remove.append(exe_name + '-script.py') + paths_to_remove.append(exe_name + "-script.py") return paths_to_remove @@ -67,6 +81,7 @@ def unique(*args, **kw): if item not in seen: seen.add(item) yield item + return unique @@ -81,16 +96,16 @@ def uninstallation_paths(dist): UninstallPathSet.add() takes care of the __pycache__ .py[co]. """ - r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD'))) + r = csv.reader(FakeFile(dist.get_metadata_lines("RECORD"))) for row in r: path = os.path.join(dist.location, row[0]) yield path - if path.endswith('.py'): + if path.endswith(".py"): dn, fn = os.path.split(path) base = fn[:-3] - path = os.path.join(dn, base + '.pyc') + path = os.path.join(dn, base + ".pyc") yield path - path = os.path.join(dn, base + '.pyo') + path = os.path.join(dn, base + ".pyo") yield path @@ -105,8 +120,8 @@ def compact(paths): short_paths = set() # type: Set[str] for path in sorted(paths, key=len): should_skip = any( - path.startswith(shortpath.rstrip("*")) and - path[len(shortpath.rstrip("*").rstrip(sep))] == sep + path.startswith(shortpath.rstrip("*")) + and path[len(shortpath.rstrip("*").rstrip(sep))] == sep for shortpath in short_paths ) if not should_skip: @@ -123,8 +138,7 @@ def compress_for_rename(paths): """ case_map = dict((os.path.normcase(p), p) for p in paths) remaining = set(case_map) - unchecked = sorted(set(os.path.split(p)[0] - for p in case_map.values()), key=len) + unchecked = sorted(set(os.path.split(p)[0] for p in case_map.values()), key=len) wildcards = set() # type: Set[str] def norm_join(*a): @@ -132,18 +146,15 @@ def norm_join(*a): return os.path.normcase(os.path.join(*a)) for root in unchecked: - if any(os.path.normcase(root).startswith(w) - for w in wildcards): + if any(os.path.normcase(root).startswith(w) for w in wildcards): # This directory has already been handled. continue all_files = set() # type: Set[str] all_subdirs = set() # type: Set[str] for dirname, subdirs, files in os.walk(root): - all_subdirs.update(norm_join(root, dirname, d) - for d in subdirs) - all_files.update(norm_join(root, dirname, f) - for f in files) + all_subdirs.update(norm_join(root, dirname, d) for d in subdirs) + all_files.update(norm_join(root, dirname, f) for f in files) # If all the files we found are in our remaining set of files to # remove, then remove them from the latter set and add a wildcard # for the directory. @@ -193,14 +204,14 @@ def compress_for_output_listing(paths): continue file_ = os.path.join(dirpath, fname) - if (os.path.isfile(file_) and - os.path.normcase(file_) not in _normcased_files): + if ( + os.path.isfile(file_) + and os.path.normcase(file_) not in _normcased_files + ): # We are skipping this file. Add it to the set. will_skip.add(file_) - will_remove = files | { - os.path.join(folder, "*") for folder in folders - } + will_remove = files | {os.path.join(folder, "*") for folder in folders} return will_remove, will_skip @@ -208,6 +219,7 @@ def compress_for_output_listing(paths): class StashedUninstallPathSet(object): """A set of file rename operations to stash files while tentatively uninstalling them.""" + def __init__(self): # type: () -> None # Mapping from source file root to [Adjacent]TempDirectory @@ -252,7 +264,7 @@ def _get_file_stash(self, path): else: # Did not find any suitable root head = os.path.dirname(path) - save_dir = TempDirectory(kind='uninstall') + save_dir = TempDirectory(kind="uninstall") self._save_dirs[head] = save_dir relpath = os.path.relpath(path, head) @@ -272,7 +284,7 @@ def stash(self, path): new_path = self._get_file_stash(path) self._moves.append((path, new_path)) - if (path_is_dir and os.path.isdir(new_path)): + if path_is_dir and os.path.isdir(new_path): # If we're moving a directory, we need to # remove the destination first or else it will be # moved to inside the existing directory. @@ -298,7 +310,7 @@ def rollback(self): for new_path, path in self._moves: try: - logger.debug('Replacing %s from %s', new_path, path) + logger.debug("Replacing %s from %s", new_path, path) if os.path.isfile(new_path) or os.path.islink(new_path): os.unlink(new_path) elif os.path.isdir(new_path): @@ -319,6 +331,7 @@ def can_rollback(self): class UninstallPathSet(object): """A set of file paths to be removed in the uninstallation of a requirement.""" + def __init__(self, dist): # type: (Distribution) -> None self.paths = set() # type: Set[str] @@ -353,7 +366,7 @@ def add(self, path): # __pycache__ files can show up after 'installed-files.txt' is created, # due to imports - if os.path.splitext(path)[1] == '.py' and uses_pycache: + if os.path.splitext(path)[1] == ".py" and uses_pycache: self.add(cache_from_source(path)) def add_pth(self, pth_file, entry): @@ -378,10 +391,8 @@ def remove(self, auto_confirm=False, verbose=False): ) return - dist_name_version = ( - self.dist.project_name + "-" + self.dist.version - ) - logger.info('Uninstalling %s:', dist_name_version) + dist_name_version = self.dist.project_name + "-" + self.dist.version + logger.info("Uninstalling %s:", dist_name_version) with indent_log(): if auto_confirm or self._allowed_to_proceed(verbose): @@ -391,17 +402,16 @@ def remove(self, auto_confirm=False, verbose=False): for path in sorted(compact(for_rename)): moved.stash(path) - logger.debug('Removing file or directory %s', path) + logger.debug("Removing file or directory %s", path) for pth in self.pth.values(): pth.remove() - logger.info('Successfully uninstalled %s', dist_name_version) + logger.info("Successfully uninstalled %s", dist_name_version) def _allowed_to_proceed(self, verbose): # type: (bool) -> bool - """Display which files would be deleted and prompt for confirmation - """ + """Display which files would be deleted and prompt for confirmation""" def _display(msg, paths): # type: (str, Iterable[str]) -> None @@ -421,13 +431,13 @@ def _display(msg, paths): will_remove = set(self.paths) will_skip = set() - _display('Would remove:', will_remove) - _display('Would not remove (might be manually added):', will_skip) - _display('Would not remove (outside of prefix):', self._refuse) + _display("Would remove:", will_remove) + _display("Would not remove (might be manually added):", will_skip) + _display("Would not remove (outside of prefix):", self._refuse) if verbose: - _display('Will actually move:', compress_for_rename(self.paths)) + _display("Will actually move:", compress_for_rename(self.paths)) - return ask('Proceed (y/n)? ', ('y', 'n')) == 'y' + return ask("Proceed (y/n)? ", ("y", "n")) == "y" def rollback(self): # type: () -> None @@ -438,7 +448,7 @@ def rollback(self): self.dist.project_name, ) return - logger.info('Rolling back uninstall of %s', self.dist.project_name) + logger.info("Rolling back uninstall of %s", self.dist.project_name) self._moved_paths.rollback() for pth in self.pth.values(): pth.rollback() @@ -461,9 +471,11 @@ def from_dist(cls, dist): ) return cls(dist) - if dist_path in {p for p in {sysconfig.get_path("stdlib"), - sysconfig.get_path("platstdlib")} - if p}: + if dist_path in { + p + for p in {sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib")} + if p + }: logger.info( "Not uninstalling %s at %s, as it is in the standard library.", dist.key, @@ -473,43 +485,47 @@ def from_dist(cls, dist): paths_to_remove = cls(dist) develop_egg_link = egg_link_path(dist) - develop_egg_link_egg_info = '{}.egg-info'.format( - pkg_resources.to_filename(dist.project_name)) + develop_egg_link_egg_info = "{}.egg-info".format( + pkg_resources.to_filename(dist.project_name) + ) egg_info_exists = dist.egg_info and os.path.exists(dist.egg_info) # Special case for distutils installed package - distutils_egg_info = getattr(dist._provider, 'path', None) + distutils_egg_info = getattr(dist._provider, "path", None) # Uninstall cases order do matter as in the case of 2 installs of the # same package, pip needs to uninstall the currently detected version - if (egg_info_exists and dist.egg_info.endswith('.egg-info') and - not dist.egg_info.endswith(develop_egg_link_egg_info)): + if ( + egg_info_exists + and dist.egg_info.endswith(".egg-info") + and not dist.egg_info.endswith(develop_egg_link_egg_info) + ): # if dist.egg_info.endswith(develop_egg_link_egg_info), we # are in fact in the develop_egg_link case paths_to_remove.add(dist.egg_info) - if dist.has_metadata('installed-files.txt'): + if dist.has_metadata("installed-files.txt"): for installed_file in dist.get_metadata( - 'installed-files.txt').splitlines(): - path = os.path.normpath( - os.path.join(dist.egg_info, installed_file) - ) + "installed-files.txt" + ).splitlines(): + path = os.path.normpath(os.path.join(dist.egg_info, installed_file)) paths_to_remove.add(path) # FIXME: need a test for this elif block # occurs with --single-version-externally-managed/--record outside # of pip - elif dist.has_metadata('top_level.txt'): - if dist.has_metadata('namespace_packages.txt'): - namespaces = dist.get_metadata('namespace_packages.txt') + elif dist.has_metadata("top_level.txt"): + if dist.has_metadata("namespace_packages.txt"): + namespaces = dist.get_metadata("namespace_packages.txt") else: namespaces = [] for top_level_pkg in [ - p for p - in dist.get_metadata('top_level.txt').splitlines() - if p and p not in namespaces]: + p + for p in dist.get_metadata("top_level.txt").splitlines() + if p and p not in namespaces + ]: path = os.path.join(dist.location, top_level_pkg) paths_to_remove.add(path) - paths_to_remove.add(path + '.py') - paths_to_remove.add(path + '.pyc') - paths_to_remove.add(path + '.pyo') + paths_to_remove.add(path + ".py") + paths_to_remove.add(path + ".pyc") + paths_to_remove.add(path + ".pyo") elif distutils_egg_info: raise UninstallationError( @@ -520,58 +536,61 @@ def from_dist(cls, dist): ) ) - elif dist.location.endswith('.egg'): + elif dist.location.endswith(".egg"): # package installed by easy_install # We cannot match on dist.egg_name because it can slightly vary # i.e. setuptools-0.6c11-py2.6.egg vs setuptools-0.6rc11-py2.6.egg paths_to_remove.add(dist.location) easy_install_egg = os.path.split(dist.location)[1] - easy_install_pth = os.path.join(os.path.dirname(dist.location), - 'easy-install.pth') - paths_to_remove.add_pth(easy_install_pth, './' + easy_install_egg) + easy_install_pth = os.path.join( + os.path.dirname(dist.location), "easy-install.pth" + ) + paths_to_remove.add_pth(easy_install_pth, "./" + easy_install_egg) - elif egg_info_exists and dist.egg_info.endswith('.dist-info'): + elif egg_info_exists and dist.egg_info.endswith(".dist-info"): for path in uninstallation_paths(dist): paths_to_remove.add(path) elif develop_egg_link: # develop egg - with open(develop_egg_link, 'r') as fh: + with open(develop_egg_link, "r") as fh: link_pointer = os.path.normcase(fh.readline().strip()) - assert (link_pointer == dist.location), ( - 'Egg-link {} does not match installed location of {} ' - '(at {})'.format( - link_pointer, dist.project_name, dist.location) + assert ( + link_pointer == dist.location + ), "Egg-link {} does not match installed location of {} " "(at {})".format( + link_pointer, dist.project_name, dist.location ) paths_to_remove.add(develop_egg_link) - easy_install_pth = os.path.join(os.path.dirname(develop_egg_link), - 'easy-install.pth') + easy_install_pth = os.path.join( + os.path.dirname(develop_egg_link), "easy-install.pth" + ) paths_to_remove.add_pth(easy_install_pth, dist.location) else: logger.debug( - 'Not sure how to uninstall: %s - Check: %s', - dist, dist.location, + "Not sure how to uninstall: %s - Check: %s", + dist, + dist.location, ) # find distutils scripts= scripts - if dist.has_metadata('scripts') and dist.metadata_isdir('scripts'): - for script in dist.metadata_listdir('scripts'): + if dist.has_metadata("scripts") and dist.metadata_isdir("scripts"): + for script in dist.metadata_listdir("scripts"): if dist_in_usersite(dist): bin_dir = bin_user else: bin_dir = bin_py paths_to_remove.add(os.path.join(bin_dir, script)) if WINDOWS: - paths_to_remove.add(os.path.join(bin_dir, script) + '.bat') + paths_to_remove.add(os.path.join(bin_dir, script) + ".bat") # find console_scripts _scripts_to_remove = [] - console_scripts = dist.get_entry_map(group='console_scripts') + console_scripts = dist.get_entry_map(group="console_scripts") for name in console_scripts.keys(): _scripts_to_remove.extend(_script_names(dist, name, False)) # find gui_scripts - gui_scripts = dist.get_entry_map(group='gui_scripts') + gui_scripts = dist.get_entry_map(group="gui_scripts") for name in gui_scripts.keys(): _scripts_to_remove.extend(_script_names(dist, name, True)) @@ -601,48 +620,45 @@ def add(self, entry): # have more than "\\sever\share". Valid examples: "\\server\share\" or # "\\server\share\folder". Python 2.7.8+ support UNC in splitdrive. if WINDOWS and not os.path.splitdrive(entry)[0]: - entry = entry.replace('\\', '/') + entry = entry.replace("\\", "/") self.entries.add(entry) def remove(self): # type: () -> None - logger.debug('Removing pth entries from %s:', self.file) + logger.debug("Removing pth entries from %s:", self.file) # If the file doesn't exist, log a warning and return if not os.path.isfile(self.file): logger.warning( - "Cannot remove entries from nonexistent file {}".format( - self.file) + "Cannot remove entries from nonexistent file {}".format(self.file) ) return - with open(self.file, 'rb') as fh: + with open(self.file, "rb") as fh: # windows uses '\r\n' with py3k, but uses '\n' with py2.x lines = fh.readlines() self._saved_lines = lines - if any(b'\r\n' in line for line in lines): - endline = '\r\n' + if any(b"\r\n" in line for line in lines): + endline = "\r\n" else: - endline = '\n' + endline = "\n" # handle missing trailing newline if lines and not lines[-1].endswith(endline.encode("utf-8")): lines[-1] = lines[-1] + endline.encode("utf-8") for entry in self.entries: try: - logger.debug('Removing entry: %s', entry) + logger.debug("Removing entry: %s", entry) lines.remove((entry + endline).encode("utf-8")) except ValueError: pass - with open(self.file, 'wb') as fh: + with open(self.file, "wb") as fh: fh.writelines(lines) def rollback(self): # type: () -> bool if self._saved_lines is None: - logger.error( - 'Cannot roll back changes to %s, none were made', self.file - ) + logger.error("Cannot roll back changes to %s, none were made", self.file) return False - logger.debug('Rolling %s back to previous state', self.file) - with open(self.file, 'wb') as fh: + logger.debug("Rolling %s back to previous state", self.file) + with open(self.file, "wb") as fh: fh.writelines(self._saved_lines) return True diff --git a/src/fetchcode/vcs/pip/_internal/resolution/base.py b/src/fetchcode/vcs/pip/_internal/resolution/base.py index a7585397..a2275833 100644 --- a/src/fetchcode/vcs/pip/_internal/resolution/base.py +++ b/src/fetchcode/vcs/pip/_internal/resolution/base.py @@ -5,9 +5,7 @@ from fetchcode.vcs.pip._internal.req.req_install import InstallRequirement from fetchcode.vcs.pip._internal.req.req_set import RequirementSet - InstallRequirementProvider = Callable[ - [str, InstallRequirement], InstallRequirement - ] + InstallRequirementProvider = Callable[[str, InstallRequirement], InstallRequirement] class BaseResolver(object): diff --git a/src/fetchcode/vcs/pip/_internal/resolution/legacy/resolver.py b/src/fetchcode/vcs/pip/_internal/resolution/legacy/resolver.py index 5f6ca236..7d90a82a 100644 --- a/src/fetchcode/vcs/pip/_internal/resolution/legacy/resolver.py +++ b/src/fetchcode/vcs/pip/_internal/resolution/legacy/resolver.py @@ -32,7 +32,10 @@ from fetchcode.vcs.pip._internal.resolution.base import BaseResolver from fetchcode.vcs.pip._internal.utils.compatibility_tags import get_supported from fetchcode.vcs.pip._internal.utils.logging import indent_log -from fetchcode.vcs.pip._internal.utils.misc import dist_in_usersite, normalize_version_info +from fetchcode.vcs.pip._internal.utils.misc import ( + dist_in_usersite, + normalize_version_info, +) from fetchcode.vcs.pip._internal.utils.packaging import ( check_requires_python, get_requires_python, @@ -76,31 +79,37 @@ def _check_dist_requires_python( requires_python = get_requires_python(dist) try: is_compatible = check_requires_python( - requires_python, version_info=version_info, + requires_python, + version_info=version_info, ) except specifiers.InvalidSpecifier as exc: logger.warning( "Package %r has an invalid Requires-Python: %s", - dist.project_name, exc, + dist.project_name, + exc, ) return if is_compatible: return - version = '.'.join(map(str, version_info)) + version = ".".join(map(str, version_info)) if ignore_requires_python: logger.debug( - 'Ignoring failed Requires-Python check for package %r: ' - '%s not in %r', - dist.project_name, version, requires_python, + "Ignoring failed Requires-Python check for package %r: " "%s not in %r", + dist.project_name, + version, + requires_python, ) return raise UnsupportedPythonVersion( - 'Package {!r} requires a different Python: {} not in {!r}'.format( - dist.project_name, version, requires_python, - )) + "Package {!r} requires a different Python: {} not in {!r}".format( + dist.project_name, + version, + requires_python, + ) + ) class Resolver(BaseResolver): @@ -147,8 +156,9 @@ def __init__( self.use_user_site = use_user_site self._make_install_req = make_install_req - self._discovered_dependencies = \ - defaultdict(list) # type: DiscoveredDependencies + self._discovered_dependencies = defaultdict( + list + ) # type: DiscoveredDependencies def resolve(self, root_reqs, check_supported_wheels): # type: (List[InstallRequirement], bool) -> RequirementSet @@ -162,9 +172,7 @@ def resolve(self, root_reqs, check_supported_wheels): possible to move the preparation to become a step separated from dependency resolution. """ - requirement_set = RequirementSet( - check_supported_wheels=check_supported_wheels - ) + requirement_set = RequirementSet(check_supported_wheels=check_supported_wheels) for req in root_reqs: requirement_set.add_requirement(req) @@ -239,8 +247,8 @@ def _check_skip_installed(self, req_to_install): if not self._is_upgrade_allowed(req_to_install): if self.upgrade_strategy == "only-if-needed": - return 'already satisfied, skipping upgrade' - return 'already satisfied' + return "already satisfied, skipping upgrade" + return "already satisfied" # Check for the possibility of an upgrade. For link-based # requirements we have to pull the tree down and inspect to assess @@ -250,7 +258,7 @@ def _check_skip_installed(self, req_to_install): self.finder.find_requirement(req_to_install, upgrade=True) except BestVersionAlreadyInstalled: # Then the best version is installed. - return 'already up-to-date' + return "already up-to-date" except DistributionNotFound: # No distribution found, so we squash the error. It will # be raised later when we re-try later to do the install. @@ -286,7 +294,7 @@ def _populate_link(self, req): supported_tags=get_supported(), ) if cache_entry is not None: - logger.debug('Using cached wheel link: %s', cache_entry.link) + logger.debug("Using cached wheel link: %s", cache_entry.link) if req.link is req.original_link and cache_entry.persistent: req.original_link_is_in_wheel_cache = True req.link = cache_entry.link @@ -305,9 +313,7 @@ def _get_abstract_dist_for(self, req): skip_reason = self._check_skip_installed(req) if req.satisfied_by: - return self.preparer.prepare_installed_requirement( - req, skip_reason - ) + return self.preparer.prepare_installed_requirement(req, skip_reason) # We eagerly populate the link, since that's our "legacy" behavior. self._populate_link(req) @@ -326,17 +332,17 @@ def _get_abstract_dist_for(self, req): if req.satisfied_by: should_modify = ( - self.upgrade_strategy != "to-satisfy-only" or - self.force_reinstall or - self.ignore_installed or - req.link.scheme == 'file' + self.upgrade_strategy != "to-satisfy-only" + or self.force_reinstall + or self.ignore_installed + or req.link.scheme == "file" ) if should_modify: self._set_req_to_reinstall(req) else: logger.info( - 'Requirement already satisfied (use --upgrade to upgrade):' - ' %s', req, + "Requirement already satisfied (use --upgrade to upgrade):" " %s", + req, ) return abstract_dist @@ -366,7 +372,8 @@ def _resolve_one( # This will raise UnsupportedPythonVersion if the given Python # version isn't compatible with the distribution's Requires-Python. _check_dist_requires_python( - dist, version_info=self._py_version_info, + dist, + version_info=self._py_version_info, ignore_requires_python=self.ignore_requires_python, ) @@ -384,9 +391,7 @@ def add_req(subreq, extras_requested): extras_requested=extras_requested, ) if parent_req_name and add_to_parent: - self._discovered_dependencies[parent_req_name].append( - add_to_parent - ) + self._discovered_dependencies[parent_req_name].append(add_to_parent) more_reqs.extend(to_scan_again) with indent_log(): @@ -398,23 +403,21 @@ def add_req(subreq, extras_requested): # provided by the user. assert req_to_install.is_direct requirement_set.add_requirement( - req_to_install, parent_req_name=None, + req_to_install, + parent_req_name=None, ) if not self.ignore_dependencies: if req_to_install.extras: logger.debug( "Installing extra requirements: %r", - ','.join(req_to_install.extras), + ",".join(req_to_install.extras), ) missing_requested = sorted( set(req_to_install.extras) - set(dist.extras) ) for missing in missing_requested: - logger.warning( - '%s does not provide the extra \'%s\'', - dist, missing - ) + logger.warning("%s does not provide the extra '%s'", dist, missing) available_requested = sorted( set(dist.extras) & set(req_to_install.extras) diff --git a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/candidates.py b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/candidates.py index 98c896e9..e3d8272c 100644 --- a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/candidates.py +++ b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/candidates.py @@ -1,7 +1,10 @@ import logging import sys -from fetchcode.vcs.pip._vendor.packaging.specifiers import InvalidSpecifier, SpecifierSet +from fetchcode.vcs.pip._vendor.packaging.specifiers import ( + InvalidSpecifier, + SpecifierSet, +) from fetchcode.vcs.pip._vendor.packaging.utils import canonicalize_name from fetchcode.vcs.pip._vendor.packaging.version import Version @@ -50,7 +53,7 @@ def make_install_req_from_link(link, parent): options=dict( install_options=parent.install_options, global_options=parent.global_options, - hashes=parent.hash_options + hashes=parent.hash_options, ), ) @@ -67,7 +70,7 @@ def make_install_req_from_editable(link, parent): options=dict( install_options=parent.install_options, global_options=parent.global_options, - hashes=parent.hash_options + hashes=parent.hash_options, ), ) @@ -86,7 +89,7 @@ def make_install_req_from_dist(dist, parent): options=dict( install_options=parent.install_options, global_options=parent.global_options, - hashes=parent.hash_options + hashes=parent.hash_options, ), ) ireq.satisfied_by = dist @@ -96,10 +99,10 @@ def make_install_req_from_dist(dist, parent): class _InstallRequirementBackedCandidate(Candidate): def __init__( self, - link, # type: Link - ireq, # type: InstallRequirement - factory, # type: Factory - name=None, # type: Optional[str] + link, # type: Link + ireq, # type: InstallRequirement + factory, # type: Factory + name=None, # type: Optional[str] version=None, # type: Optional[_BaseVersion] ): # type: (...) -> None @@ -164,17 +167,17 @@ def _prepare(self): # These should be "proper" errors, not just asserts, as they # can result from user errors like a requirement "foo @ URL" # when the project at URL has a name of "bar" in its metadata. - assert ( - self._name is None or - self._name == canonicalize_name(self._dist.project_name) + assert self._name is None or self._name == canonicalize_name( + self._dist.project_name ), "Name mismatch: {!r} vs {!r}".format( - self._name, canonicalize_name(self._dist.project_name), + self._name, + canonicalize_name(self._dist.project_name), ) assert ( - self._version is None or - self._version == self._dist.parsed_version + self._version is None or self._version == self._dist.parsed_version ), "Version mismatch: {!r} vs {!r}".format( - self._version, self._dist.parsed_version, + self._version, + self._dist.parsed_version, ) @property @@ -192,7 +195,9 @@ def _get_requires_python_specifier(self): spec = SpecifierSet(requires_python) except InvalidSpecifier as e: logger.warning( - "Package %r has an invalid Requires-Python: %s", self.name, e, + "Package %r has an invalid Requires-Python: %s", + self.name, + e, ) return None return spec @@ -219,10 +224,10 @@ def get_install_requirement(self): class LinkCandidate(_InstallRequirementBackedCandidate): def __init__( self, - link, # type: Link - parent, # type: InstallRequirement - factory, # type: Factory - name=None, # type: Optional[str] + link, # type: Link + parent, # type: InstallRequirement + factory, # type: Factory + name=None, # type: Optional[str] version=None, # type: Optional[_BaseVersion] ): # type: (...) -> None @@ -242,10 +247,10 @@ def _prepare_abstract_distribution(self): class EditableCandidate(_InstallRequirementBackedCandidate): def __init__( self, - link, # type: Link - parent, # type: InstallRequirement - factory, # type: Factory - name=None, # type: Optional[str] + link, # type: Link + parent, # type: InstallRequirement + factory, # type: Factory + name=None, # type: Optional[str] version=None, # type: Optional[_BaseVersion] ): # type: (...) -> None @@ -345,6 +350,7 @@ class ExtrasCandidate(Candidate): version 2.0. Having those candidates depend on foo=1.0 and foo=2.0 respectively forces the resolver to recognise that this is a conflict. """ + def __init__( self, base, # type: BaseCandidate @@ -396,7 +402,7 @@ def get_dependencies(self): logger.warning( "Invalid extras specified in %s: %s", self.name, - ','.join(sorted(invalid_extras)) + ",".join(sorted(invalid_extras)), ) deps = [ diff --git a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/factory.py b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/factory.py index 799458ac..4e378e34 100644 --- a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/factory.py +++ b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/factory.py @@ -85,10 +85,10 @@ def _make_candidate_from_dist( def _make_candidate_from_link( self, - link, # type: Link - extras, # type: Set[str] - parent, # type: InstallRequirement - name=None, # type: Optional[str] + link, # type: Link + extras, # type: Set[str] + parent, # type: InstallRequirement + name=None, # type: Optional[str] version=None, # type: Optional[_BaseVersion] ): # type: (...) -> Candidate @@ -97,13 +97,21 @@ def _make_candidate_from_link( if parent.editable: if link not in self._editable_candidate_cache: self._editable_candidate_cache[link] = EditableCandidate( - link, parent, factory=self, name=name, version=version, + link, + parent, + factory=self, + name=name, + version=version, ) base = self._editable_candidate_cache[link] # type: BaseCandidate else: if link not in self._link_candidate_cache: self._link_candidate_cache[link] = LinkCandidate( - link, parent, factory=self, name=name, version=version, + link, + parent, + factory=self, + name=name, + version=version, ) base = self._link_candidate_cache[link] if extras: @@ -124,8 +132,10 @@ def iter_found_candidates(self, ireq, extras): hashes=ireq.hashes(trust_internet=False), ) for ican in found.iter_applicable(): - if (installed_dist is not None and - installed_dist.parsed_version == ican.version): + if ( + installed_dist is not None + and installed_dist.parsed_version == ican.version + ): continue yield self._make_candidate_from_link( link=ican.link, @@ -137,8 +147,10 @@ def iter_found_candidates(self, ireq, extras): # Return installed distribution if it matches the specifier. This is # done last so the resolver will prefer it over downloading links. - if (installed_dist is not None and - installed_dist.parsed_version in ireq.req.specifier): + if ( + installed_dist is not None + and installed_dist.parsed_version in ireq.req.specifier + ): yield self._make_candidate_from_dist( dist=installed_dist, extras=extras, @@ -152,7 +164,9 @@ def make_requirement_from_install_req(self, ireq): # Specifically, this might be needed in "name @ URL" # syntax - need to check where that syntax is handled. cand = self._make_candidate_from_link( - ireq.link, extras=set(), parent=ireq, + ireq.link, + extras=set(), + parent=ireq, ) return ExplicitRequirement(cand) return SpecifierRequirement(ireq, factory=self) diff --git a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/provider.py b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/provider.py index dc9e0cca..4e5bfc6b 100644 --- a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/provider.py +++ b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/provider.py @@ -33,7 +33,7 @@ def get_preference( self, resolution, # type: Optional[Candidate] candidates, # type: Sequence[Candidate] - information # type: Sequence[Tuple[Requirement, Candidate]] + information, # type: Sequence[Tuple[Requirement, Candidate]] ): # type: (...) -> Any # Use the "usual" value for now diff --git a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/requirements.py b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/requirements.py index 0d216b8d..e0711899 100644 --- a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/requirements.py +++ b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/requirements.py @@ -74,9 +74,11 @@ def find_matches(self): def is_satisfied_by(self, candidate): # type: (Candidate) -> bool - assert candidate.name == self.name, \ - "Internal issue: Candidate is not for this requirement " \ - " {} vs {}".format(candidate.name, self.name) + assert ( + candidate.name == self.name + ), "Internal issue: Candidate is not for this requirement " " {} vs {}".format( + candidate.name, self.name + ) # We can safely always allow prereleases here since PackageFinder # already implements the prerelease logic, and would have filtered out # prerelease candidates if the user does not expect them. @@ -85,8 +87,8 @@ def is_satisfied_by(self, candidate): class RequiresPythonRequirement(Requirement): - """A requirement representing Requires-Python metadata. - """ + """A requirement representing Requires-Python metadata.""" + def __init__(self, specifier, match): # type: (SpecifierSet, Candidate) -> None self.specifier = specifier diff --git a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/resolver.py b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/resolver.py index 55de61cd..dab2f3e1 100644 --- a/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/resolver.py +++ b/src/fetchcode/vcs/pip/_internal/resolution/resolvelib/resolver.py @@ -72,8 +72,7 @@ def resolve(self, root_reqs, check_supported_wheels): resolver = RLResolver(provider, reporter) requirements = [ - self.factory.make_requirement_from_install_req(r) - for r in root_reqs + self.factory.make_requirement_from_install_req(r) for r in root_reqs ] try: @@ -88,16 +87,14 @@ def resolve(self, root_reqs, check_supported_wheels): # using here. for req, parent in e.causes: logger.critical( - "Could not find a version that satisfies " + - "the requirement " + - str(req) + - ("" if parent is None else " (from {})".format( - parent.name - )) + "Could not find a version that satisfies " + + "the requirement " + + str(req) + + ("" if parent is None else " (from {})".format(parent.name)) ) raise InstallationError( - "No matching distribution found for " + - ", ".join([r.name for r, _ in e.causes]) + "No matching distribution found for " + + ", ".join([r.name for r, _ in e.causes]) ) raise six.raise_from(error, e) @@ -160,7 +157,7 @@ def get_installation_order(self, req_set): def _req_set_item_sorter( - item, # type: Tuple[str, InstallRequirement] + item, # type: Tuple[str, InstallRequirement] weights, # type: Dict[Optional[str], int] ): # type: (...) -> Tuple[int, str] diff --git a/src/fetchcode/vcs/pip/_internal/self_outdated_check.py b/src/fetchcode/vcs/pip/_internal/self_outdated_check.py index a4989dac..adb8b5e5 100644 --- a/src/fetchcode/vcs/pip/_internal/self_outdated_check.py +++ b/src/fetchcode/vcs/pip/_internal/self_outdated_check.py @@ -58,8 +58,8 @@ def make_link_collector( index_urls = [options.index_url] + options.extra_index_urls if options.no_index and not suppress_no_index: logger.debug( - 'Ignoring indexes: %s', - ','.join(redact_auth_from_url(url) for url in index_urls), + "Ignoring indexes: %s", + ",".join(redact_auth_from_url(url) for url in index_urls), ) index_urls = [] @@ -67,7 +67,8 @@ def make_link_collector( find_links = options.find_links or [] search_scope = SearchScope.create( - find_links=find_links, index_urls=index_urls, + find_links=find_links, + index_urls=index_urls, ) link_collector = LinkCollector(session=session, search_scope=search_scope) @@ -177,8 +178,7 @@ def pip_self_version_check(session, options): # Determine if we need to refresh the state if "last_check" in state.state and "pypi_version" in state.state: last_check = datetime.datetime.strptime( - state.state["last_check"], - SELFCHECK_DATE_FMT + state.state["last_check"], SELFCHECK_DATE_FMT ) if (current_time - last_check).total_seconds() < 7 * 24 * 60 * 60: pypi_version = state.state["pypi_version"] @@ -214,9 +214,9 @@ def pip_self_version_check(session, options): remote_version = packaging_version.parse(pypi_version) local_version_is_older = ( - pip_version < remote_version and - pip_version.base_version != remote_version.base_version and - was_installed_by_pip('pip') + pip_version < remote_version + and pip_version.base_version != remote_version.base_version + and was_installed_by_pip("pip") ) # Determine if our pypi_version is older @@ -232,7 +232,9 @@ def pip_self_version_check(session, options): "You are using pip version %s; however, version %s is " "available.\nYou should consider upgrading via the " "'%s install --upgrade pip' command.", - pip_version, pypi_version, pip_cmd + pip_version, + pypi_version, + pip_cmd, ) except Exception: logger.debug( diff --git a/src/fetchcode/vcs/pip/_internal/utils/appdirs.py b/src/fetchcode/vcs/pip/_internal/utils/appdirs.py index 60f59604..8df82f56 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/appdirs.py +++ b/src/fetchcode/vcs/pip/_internal/utils/appdirs.py @@ -26,7 +26,7 @@ def user_config_dir(appname, roaming=True): # type: (str, bool) -> str path = _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming) if _appdirs.system == "darwin" and not os.path.isdir(path): - path = os.path.expanduser('~/.config/') + path = os.path.expanduser("~/.config/") if appname: path = os.path.join(path, appname) return path @@ -39,5 +39,5 @@ def site_config_dirs(appname): dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True) if _appdirs.system not in ["win32", "darwin"]: # always look in /etc directly as well - return dirval.split(os.pathsep) + ['/etc'] + return dirval.split(os.pathsep) + ["/etc"] return [dirval] diff --git a/src/fetchcode/vcs/pip/_internal/utils/compat.py b/src/fetchcode/vcs/pip/_internal/utils/compat.py index 30f6a62d..35f3b637 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/compat.py +++ b/src/fetchcode/vcs/pip/_internal/utils/compat.py @@ -26,13 +26,20 @@ from fetchcode.vcs.pip._vendor import ipaddress # type: ignore except ImportError: import ipaddr as ipaddress # type: ignore + ipaddress.ip_address = ipaddress.IPAddress # type: ignore ipaddress.ip_network = ipaddress.IPNetwork # type: ignore __all__ = [ - "ipaddress", "uses_pycache", "console_to_str", - "get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile", "get_terminal_size", + "ipaddress", + "uses_pycache", + "console_to_str", + "get_path_uid", + "stdlib_pkgs", + "WINDOWS", + "samefile", + "get_terminal_size", ] @@ -63,7 +70,8 @@ def backslashreplace_decode_fn(err): raw_bytes = (err.object[i] for i in range(err.start, err.end)) # Python 2 gave us characters - convert to numeric bytes raw_bytes = (ord(b) for b in raw_bytes) - return u"".join(map(u"\\x{:x}".format, raw_bytes)), err.end + return "".join(map("\\x{:x}".format, raw_bytes)), err.end + codecs.register_error( "backslashreplace_decode", backslashreplace_decode_fn, @@ -77,11 +85,13 @@ def has_tls(): # type: () -> bool try: import _ssl # noqa: F401 # ignore unused + return True except ImportError: pass from fetchcode.vcs.pip._vendor.urllib3.util import IS_PYOPENSSL + return IS_PYOPENSSL @@ -121,8 +131,8 @@ def str_to_display(data, desc=None): decoded_data = data.decode(encoding) except UnicodeDecodeError: if desc is None: - desc = 'Bytes object' - msg_format = '{} does not appear to be encoded as %s'.format(desc) + desc = "Bytes object" + msg_format = "{} does not appear to be encoded as %s".format(desc) logger.warning(msg_format, encoding) decoded_data = data.decode(encoding, errors=backslashreplace_decode) @@ -138,14 +148,10 @@ def str_to_display(data, desc=None): # or doesn't have an encoding attribute. Neither of these cases # should occur in normal pip use, but there's no harm in checking # in case people use pip in (unsupported) unusual situations. - output_encoding = getattr(getattr(sys, "__stderr__", None), - "encoding", None) + output_encoding = getattr(getattr(sys, "__stderr__", None), "encoding", None) if output_encoding: - output_encoded = decoded_data.encode( - output_encoding, - errors="backslashreplace" - ) + output_encoded = decoded_data.encode(output_encoding, errors="backslashreplace") decoded_data = output_encoded.decode(output_encoding) return decoded_data @@ -153,9 +159,8 @@ def str_to_display(data, desc=None): def console_to_str(data): # type: (bytes) -> Text - """Return a string, safe for output, of subprocess output. - """ - return str_to_display(data, desc='Subprocess output') + """Return a string, safe for output, of subprocess output.""" + return str_to_display(data, desc="Subprocess output") def get_path_uid(path): @@ -171,7 +176,7 @@ def get_path_uid(path): :raises OSError: When path is a symlink or can't be read. """ - if hasattr(os, 'O_NOFOLLOW'): + if hasattr(os, "O_NOFOLLOW"): fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW) file_uid = os.fstat(fd).st_uid os.close(fd) @@ -183,8 +188,7 @@ def get_path_uid(path): else: # raise OSError for parity with os.O_NOFOLLOW above raise OSError( - "{} is a symlink; Will not return uid for symlinks".format( - path) + "{} is a symlink; Will not return uid for symlinks".format(path) ) return file_uid @@ -197,7 +201,7 @@ def expanduser(path): Includes a workaround for https://bugs.python.org/issue14768 """ expanded = os.path.expanduser(path) - if path.startswith('~/') and expanded.startswith('//'): + if path.startswith("~/") and expanded.startswith("//"): expanded = expanded[1:] return expanded @@ -211,14 +215,13 @@ def expanduser(path): # windows detection, covers cpython and ironpython -WINDOWS = (sys.platform.startswith("win") or - (sys.platform == 'cli' and os.name == 'nt')) +WINDOWS = sys.platform.startswith("win") or (sys.platform == "cli" and os.name == "nt") def samefile(file1, file2): # type: (str, str) -> bool """Provide an alternative for os.path.samefile on Windows/Python2""" - if hasattr(os.path, 'samefile'): + if hasattr(os.path, "samefile"): return os.path.samefile(file1, file2) else: path1 = os.path.normcase(os.path.abspath(file1)) @@ -226,7 +229,8 @@ def samefile(file1, file2): return path1 == path2 -if hasattr(shutil, 'get_terminal_size'): +if hasattr(shutil, "get_terminal_size"): + def get_terminal_size(): # type: () -> Tuple[int, int] """ @@ -234,27 +238,31 @@ def get_terminal_size(): in characters of the terminal window. """ return tuple(shutil.get_terminal_size()) # type: ignore + else: + def get_terminal_size(): # type: () -> Tuple[int, int] """ Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. """ + def ioctl_GWINSZ(fd): try: import fcntl import termios import struct + cr = struct.unpack_from( - 'hh', - fcntl.ioctl(fd, termios.TIOCGWINSZ, '12345678') + "hh", fcntl.ioctl(fd, termios.TIOCGWINSZ, "12345678") ) except Exception: return None if cr == (0, 0): return None return cr + cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2) if not cr: if sys.platform != "win32": @@ -265,5 +273,5 @@ def ioctl_GWINSZ(fd): except Exception: pass if not cr: - cr = (os.environ.get('LINES', 25), os.environ.get('COLUMNS', 80)) + cr = (os.environ.get("LINES", 25), os.environ.get("COLUMNS", 80)) return int(cr[1]), int(cr[0]) diff --git a/src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py b/src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py index 44b707c3..a9af731c 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py +++ b/src/fetchcode/vcs/pip/_internal/utils/compatibility_tags.py @@ -24,13 +24,13 @@ logger = logging.getLogger(__name__) -_osx_arch_pat = re.compile(r'(.+)_(\d+)_(\d+)_(.+)') +_osx_arch_pat = re.compile(r"(.+)_(\d+)_(\d+)_(.+)") def version_info_to_nodot(version_info): # type: (Tuple[int, ...]) -> str # Only use up to the first two numbers. - return ''.join(map(str, version_info[:2])) + return "".join(map(str, version_info[:2])) def _mac_platforms(arch): @@ -45,7 +45,7 @@ def _mac_platforms(arch): # actual prefix provided by the user in case they provided # something like "macosxcustom_". It may be good to remove # this as undocumented or deprecate it in the future. - '{}_{}'.format(name, arch[len('macosx_'):]) + "{}_{}".format(name, arch[len("macosx_") :]) for arch in mac_platforms(mac_version, actual_arch) ] else: @@ -57,31 +57,31 @@ def _mac_platforms(arch): def _custom_manylinux_platforms(arch): # type: (str) -> List[str] arches = [arch] - arch_prefix, arch_sep, arch_suffix = arch.partition('_') - if arch_prefix == 'manylinux2014': + arch_prefix, arch_sep, arch_suffix = arch.partition("_") + if arch_prefix == "manylinux2014": # manylinux1/manylinux2010 wheels run on most manylinux2014 systems # with the exception of wheels depending on ncurses. PEP 599 states # manylinux1/manylinux2010 wheels should be considered # manylinux2014 wheels: # https://www.python.org/dev/peps/pep-0599/#backwards-compatibility-with-manylinux2010-wheels - if arch_suffix in {'i686', 'x86_64'}: - arches.append('manylinux2010' + arch_sep + arch_suffix) - arches.append('manylinux1' + arch_sep + arch_suffix) - elif arch_prefix == 'manylinux2010': + if arch_suffix in {"i686", "x86_64"}: + arches.append("manylinux2010" + arch_sep + arch_suffix) + arches.append("manylinux1" + arch_sep + arch_suffix) + elif arch_prefix == "manylinux2010": # manylinux1 wheels run on most manylinux2010 systems with the # exception of wheels depending on ncurses. PEP 571 states # manylinux1 wheels should be considered manylinux2010 wheels: # https://www.python.org/dev/peps/pep-0571/#backwards-compatibility-with-manylinux1-wheels - arches.append('manylinux1' + arch_sep + arch_suffix) + arches.append("manylinux1" + arch_sep + arch_suffix) return arches def _get_custom_platforms(arch): # type: (str) -> List[str] - arch_prefix, arch_sep, arch_suffix = arch.partition('_') - if arch.startswith('macosx'): + arch_prefix, arch_sep, arch_suffix = arch.partition("_") + if arch.startswith("macosx"): arches = _mac_platforms(arch) - elif arch_prefix in ['manylinux2014', 'manylinux2010']: + elif arch_prefix in ["manylinux2014", "manylinux2010"]: arches = _custom_manylinux_platforms(arch) else: arches = [arch] @@ -109,7 +109,7 @@ def get_supported( version=None, # type: Optional[str] platform=None, # type: Optional[str] impl=None, # type: Optional[str] - abi=None # type: Optional[str] + abi=None, # type: Optional[str] ): # type: (...) -> List[Tag] """Return a list of supported tags for each version specified in diff --git a/src/fetchcode/vcs/pip/_internal/utils/deprecation.py b/src/fetchcode/vcs/pip/_internal/utils/deprecation.py index 4567bcdc..3f12d0a6 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/deprecation.py +++ b/src/fetchcode/vcs/pip/_internal/utils/deprecation.py @@ -33,7 +33,12 @@ def _showwarning(message, category, filename, lineno, file=None, line=None): if file is not None: if _original_showwarning is not None: _original_showwarning( - message, category, filename, lineno, file, line, + message, + category, + filename, + lineno, + file, + line, ) elif issubclass(category, PipDeprecationWarning): # We use a specially named logger which will handle all of the @@ -42,7 +47,12 @@ def _showwarning(message, category, filename, lineno, file=None, line=None): logger.warning(message) else: _original_showwarning( - message, category, filename, lineno, file, line, + message, + category, + filename, + lineno, + file, + line, ) @@ -87,10 +97,13 @@ def deprecated(reason, replacement, gone_in, issue=None): (reason, DEPRECATION_MSG_PREFIX + "{}"), (gone_in, "pip {} will remove support for this functionality."), (replacement, "A possible replacement is {}."), - (issue, ( - "You can find discussion regarding this at " - "https://github.com/pypa/pip/issues/{}." - )), + ( + issue, + ( + "You can find discussion regarding this at " + "https://github.com/pypa/pip/issues/{}." + ), + ), ] message = " ".join( template.format(val) for val, template in sentences if val is not None diff --git a/src/fetchcode/vcs/pip/_internal/utils/direct_url_helpers.py b/src/fetchcode/vcs/pip/_internal/utils/direct_url_helpers.py index 79be568d..e3e3f5e9 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/direct_url_helpers.py +++ b/src/fetchcode/vcs/pip/_internal/utils/direct_url_helpers.py @@ -60,8 +60,8 @@ def direct_url_from_link(link, source_dir=None, link_is_in_wheel_cache=False): if link.is_vcs: vcs_backend = vcs.get_backend_for_scheme(link.scheme) assert vcs_backend - url, requested_revision, _ = ( - vcs_backend.get_url_rev_and_auth(link.url_without_fragment) + url, requested_revision, _ = vcs_backend.get_url_rev_and_auth( + link.url_without_fragment ) # For VCS links, we need to find out and add commit_id. if link_is_in_wheel_cache: @@ -116,11 +116,7 @@ def dist_get_direct_url(dist): return None try: return DirectUrl.from_json(dist.get_metadata(DIRECT_URL_METADATA_NAME)) - except ( - DirectUrlValidationError, - JSONDecodeError, - UnicodeDecodeError - ) as e: + except (DirectUrlValidationError, JSONDecodeError, UnicodeDecodeError) as e: logger.warning( "Error parsing %s for %s: %s", DIRECT_URL_METADATA_NAME, diff --git a/src/fetchcode/vcs/pip/_internal/utils/encoding.py b/src/fetchcode/vcs/pip/_internal/utils/encoding.py index f4b972a1..ad0b726f 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/encoding.py +++ b/src/fetchcode/vcs/pip/_internal/utils/encoding.py @@ -12,16 +12,16 @@ from typing import List, Tuple, Text BOMS = [ - (codecs.BOM_UTF8, 'utf-8'), - (codecs.BOM_UTF16, 'utf-16'), - (codecs.BOM_UTF16_BE, 'utf-16-be'), - (codecs.BOM_UTF16_LE, 'utf-16-le'), - (codecs.BOM_UTF32, 'utf-32'), - (codecs.BOM_UTF32_BE, 'utf-32-be'), - (codecs.BOM_UTF32_LE, 'utf-32-le'), + (codecs.BOM_UTF8, "utf-8"), + (codecs.BOM_UTF16, "utf-16"), + (codecs.BOM_UTF16_BE, "utf-16-be"), + (codecs.BOM_UTF16_LE, "utf-16-le"), + (codecs.BOM_UTF32, "utf-32"), + (codecs.BOM_UTF32_BE, "utf-32-be"), + (codecs.BOM_UTF32_LE, "utf-32-le"), ] # type: List[Tuple[bytes, Text]] -ENCODING_RE = re.compile(br'coding[:=]\s*([-\w.]+)') +ENCODING_RE = re.compile(rb"coding[:=]\s*([-\w.]+)") def auto_decode(data): @@ -31,11 +31,11 @@ def auto_decode(data): Fallback to locale.getpreferredencoding(False) like open() on Python3""" for bom, encoding in BOMS: if data.startswith(bom): - return data[len(bom):].decode(encoding) + return data[len(bom) :].decode(encoding) # Lets check the first two lines as in PEP263 - for line in data.split(b'\n')[:2]: - if line[0:1] == b'#' and ENCODING_RE.search(line): - encoding = ENCODING_RE.search(line).groups()[0].decode('ascii') + for line in data.split(b"\n")[:2]: + if line[0:1] == b"#" and ENCODING_RE.search(line): + encoding = ENCODING_RE.search(line).groups()[0].decode("ascii") return data.decode(encoding) return data.decode( locale.getpreferredencoding(False) or sys.getdefaultencoding(), diff --git a/src/fetchcode/vcs/pip/_internal/utils/filesystem.py b/src/fetchcode/vcs/pip/_internal/utils/filesystem.py index afd9d215..8f2a0f16 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/filesystem.py +++ b/src/fetchcode/vcs/pip/_internal/utils/filesystem.py @@ -76,7 +76,8 @@ def copy2_fixed(src, dest): else: if is_socket_file: raise shutil.SpecialFileError( - "`{f}` is a socket".format(**locals())) + "`{f}` is a socket".format(**locals()) + ) raise @@ -101,10 +102,10 @@ def adjacent_tmp_file(path, **kwargs): delete=False, dir=os.path.dirname(path), prefix=os.path.basename(path), - suffix='.tmp', + suffix=".tmp", **kwargs ) as f: - result = cast('NamedTemporaryFileResult', f) + result = cast("NamedTemporaryFileResult", f) try: yield result finally: @@ -115,6 +116,7 @@ def adjacent_tmp_file(path, **kwargs): _replace_retry = retry(stop_max_delay=1000, wait_fixed=250) if PY2: + @_replace_retry def replace(src, dest): # type: (str, str) -> None @@ -143,7 +145,7 @@ def test_writable_dir(path): break # Should never get here, but infinite loops are bad path = parent - if os.name == 'posix': + if os.name == "posix": return os.access(path, os.W_OK) return _test_writable_dir_win(path) @@ -153,10 +155,10 @@ def _test_writable_dir_win(path): # type: (str) -> bool # os.access doesn't work on Windows: http://bugs.python.org/issue2528 # and we can't use tempfile: http://bugs.python.org/issue22107 - basename = 'accesstest_deleteme_fishfingers_custard_' - alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789' + basename = "accesstest_deleteme_fishfingers_custard_" + alphabet = "abcdefghijklmnopqrstuvwxyz0123456789" for i in range(10): - name = basename + ''.join(random.choice(alphabet) for _ in range(6)) + name = basename + "".join(random.choice(alphabet) for _ in range(6)) file = os.path.join(path, name) try: fd = os.open(file, os.O_RDWR | os.O_CREAT | os.O_EXCL) @@ -178,9 +180,7 @@ def _test_writable_dir_win(path): return True # This should never be reached - raise EnvironmentError( - 'Unexpected condition testing for writable directory' - ) + raise EnvironmentError("Unexpected condition testing for writable directory") def find_files(path, pattern): diff --git a/src/fetchcode/vcs/pip/_internal/utils/filetypes.py b/src/fetchcode/vcs/pip/_internal/utils/filetypes.py index cc9341e7..34bb434a 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/filetypes.py +++ b/src/fetchcode/vcs/pip/_internal/utils/filetypes.py @@ -5,12 +5,15 @@ if MYPY_CHECK_RUNNING: from typing import Tuple -WHEEL_EXTENSION = '.whl' -BZ2_EXTENSIONS = ('.tar.bz2', '.tbz') # type: Tuple[str, ...] -XZ_EXTENSIONS = ('.tar.xz', '.txz', '.tlz', - '.tar.lz', '.tar.lzma') # type: Tuple[str, ...] -ZIP_EXTENSIONS = ('.zip', WHEEL_EXTENSION) # type: Tuple[str, ...] -TAR_EXTENSIONS = ('.tar.gz', '.tgz', '.tar') # type: Tuple[str, ...] -ARCHIVE_EXTENSIONS = ( - ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS -) +WHEEL_EXTENSION = ".whl" +BZ2_EXTENSIONS = (".tar.bz2", ".tbz") # type: Tuple[str, ...] +XZ_EXTENSIONS = ( + ".tar.xz", + ".txz", + ".tlz", + ".tar.lz", + ".tar.lzma", +) # type: Tuple[str, ...] +ZIP_EXTENSIONS = (".zip", WHEEL_EXTENSION) # type: Tuple[str, ...] +TAR_EXTENSIONS = (".tar.gz", ".tgz", ".tar") # type: Tuple[str, ...] +ARCHIVE_EXTENSIONS = ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS diff --git a/src/fetchcode/vcs/pip/_internal/utils/hashes.py b/src/fetchcode/vcs/pip/_internal/utils/hashes.py index bf859e9b..62e3ac7a 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/hashes.py +++ b/src/fetchcode/vcs/pip/_internal/utils/hashes.py @@ -1,4 +1,3 @@ - import hashlib from fetchcode.vcs.pip._vendor.six import iteritems, iterkeys, itervalues @@ -12,10 +11,9 @@ from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: - from typing import ( - Dict, List, BinaryIO, NoReturn, Iterator - ) + from typing import Dict, List, BinaryIO, NoReturn, Iterator from fetchcode.vcs.pip._vendor.six import PY3 + if PY3: from hashlib import _Hash else: @@ -24,12 +22,12 @@ # The recommended hash algo of the moment. Change this whenever the state of # the art changes; it won't hurt backward compatibility. -FAVORITE_HASH = 'sha256' +FAVORITE_HASH = "sha256" # Names of hashlib algorithms allowed by the --hash option and ``pip hash`` # Currently, those are the ones at least as collision-resistant as sha256. -STRONG_HASHES = ['sha256', 'sha384', 'sha512'] +STRONG_HASHES = ["sha256", "sha384", "sha512"] class Hashes(object): @@ -37,6 +35,7 @@ class Hashes(object): known-good values """ + def __init__(self, hashes=None): # type: (Dict[str, List[str]]) -> None """ @@ -52,7 +51,7 @@ def digest_count(self): def is_hash_allowed( self, - hash_name, # type: str + hash_name, # type: str hex_digest, # type: str ): # type: (...) -> bool @@ -72,9 +71,7 @@ def check_against_chunks(self, chunks): try: gots[hash_name] = hashlib.new(hash_name) except (ValueError, TypeError): - raise InstallationError( - 'Unknown hash name: {}'.format(hash_name) - ) + raise InstallationError("Unknown hash name: {}".format(hash_name)) for chunk in chunks: for hash in itervalues(gots): @@ -100,7 +97,7 @@ def check_against_file(self, file): def check_against_path(self, path): # type: (str) -> None - with open(path, 'rb') as file: + with open(path, "rb") as file: return self.check_against_file(file) def __nonzero__(self): @@ -120,6 +117,7 @@ class MissingHashes(Hashes): exception showing it to the user. """ + def __init__(self): # type: () -> None """Don't offer the ``hashes`` kwarg.""" diff --git a/src/fetchcode/vcs/pip/_internal/utils/inject_securetransport.py b/src/fetchcode/vcs/pip/_internal/utils/inject_securetransport.py index 328754c7..9688d795 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/inject_securetransport.py +++ b/src/fetchcode/vcs/pip/_internal/utils/inject_securetransport.py @@ -22,7 +22,7 @@ def inject_securetransport(): return # Checks for OpenSSL 1.0.1 - if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100f: + if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100F: return try: diff --git a/src/fetchcode/vcs/pip/_internal/utils/logging.py b/src/fetchcode/vcs/pip/_internal/utils/logging.py index a450c220..1416622a 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/logging.py +++ b/src/fetchcode/vcs/pip/_internal/utils/logging.py @@ -51,13 +51,14 @@ _log_state = threading.local() -subprocess_logger = getLogger('fetchcode.vcs.pip.subprocessor') +subprocess_logger = getLogger("fetchcode.vcs.pip.subprocessor") class BrokenStdoutLoggingError(Exception): """ Raised if BrokenPipeError occurs for the stdout stream while logging. """ + pass @@ -68,21 +69,25 @@ class BrokenStdoutLoggingError(Exception): # https://bugs.python.org/issue19612 # https://bugs.python.org/issue30418 if PY2: + def _is_broken_pipe_error(exc_class, exc): """See the docstring for non-Windows Python 3 below.""" - return (exc_class is IOError and - exc.errno in (errno.EINVAL, errno.EPIPE)) + return exc_class is IOError and exc.errno in (errno.EINVAL, errno.EPIPE) + else: # In Windows, a broken pipe IOError became OSError in Python 3. def _is_broken_pipe_error(exc_class, exc): """See the docstring for non-Windows Python 3 below.""" - return ((exc_class is BrokenPipeError) or # noqa: F821 - (exc_class is OSError and - exc.errno in (errno.EINVAL, errno.EPIPE))) + return (exc_class is BrokenPipeError) or ( # noqa: F821 + exc_class is OSError and exc.errno in (errno.EINVAL, errno.EPIPE) + ) + elif PY2: + def _is_broken_pipe_error(exc_class, exc): """See the docstring for non-Windows Python 3 below.""" - return (exc_class is IOError and exc.errno == errno.EPIPE) + return exc_class is IOError and exc.errno == errno.EPIPE + else: # Then we are in the non-Windows Python 3 case. def _is_broken_pipe_error(exc_class, exc): @@ -93,7 +98,7 @@ def _is_broken_pipe_error(exc_class, exc): exc_class: an exception class. exc: an exception instance. """ - return (exc_class is BrokenPipeError) # noqa: F821 + return exc_class is BrokenPipeError # noqa: F821 @contextlib.contextmanager @@ -112,11 +117,10 @@ def indent_log(num=2): def get_indentation(): - return getattr(_log_state, 'indentation', 0) + return getattr(_log_state, "indentation", 0) class IndentingFormatter(logging.Formatter): - def __init__(self, *args, **kwargs): """ A logging.Formatter that obeys the indent_log() context manager. @@ -133,15 +137,15 @@ def get_message_start(self, formatted, levelno): prefix to add to each line). """ if levelno < logging.WARNING: - return '' + return "" if formatted.startswith(DEPRECATION_MSG_PREFIX): # Then the message already has a prefix. We don't want it to # look like "WARNING: DEPRECATION: ...." - return '' + return "" if levelno < logging.ERROR: - return 'WARNING: ' + return "WARNING: " - return 'ERROR: ' + return "ERROR: " def format(self, record): """ @@ -152,22 +156,20 @@ def format(self, record): message_start = self.get_message_start(formatted, record.levelno) formatted = message_start + formatted - prefix = '' + prefix = "" if self.add_timestamp: # TODO: Use Formatter.default_time_format after dropping PY2. t = self.formatTime(record, "%Y-%m-%dT%H:%M:%S") - prefix = '{t},{record.msecs:03.0f} '.format(**locals()) + prefix = "{t},{record.msecs:03.0f} ".format(**locals()) prefix += " " * get_indentation() - formatted = "".join([ - prefix + line - for line in formatted.splitlines(True) - ]) + formatted = "".join([prefix + line for line in formatted.splitlines(True)]) return formatted def _color_wrap(*colors): def wrapped(inp): return "".join(list(colors) + [inp, colorama.Style.RESET_ALL]) + return wrapped @@ -206,7 +208,8 @@ def should_color(self): return False real_stream = ( - self.stream if not isinstance(self.stream, colorama.AnsiToWin32) + self.stream + if not isinstance(self.stream, colorama.AnsiToWin32) else self.stream.wrapped ) @@ -239,22 +242,19 @@ def handleError(self, record): # stdout stream in logging's Handler.emit(), then raise our special # exception so we can handle it in main() instead of logging the # broken pipe error and continuing. - if (exc_class and self._using_stdout() and - _is_broken_pipe_error(exc_class, exc)): + if exc_class and self._using_stdout() and _is_broken_pipe_error(exc_class, exc): raise BrokenStdoutLoggingError() return super(ColorizedStreamHandler, self).handleError(record) class BetterRotatingFileHandler(logging.handlers.RotatingFileHandler): - def _open(self): ensure_dir(os.path.dirname(self.baseFilename)) return logging.handlers.RotatingFileHandler._open(self) class MaxLevelFilter(Filter): - def __init__(self, level): self.level = level @@ -321,78 +321,76 @@ def setup_logging(verbosity, no_color, user_log_file): ["user_log"] if include_user_log else [] ) - logging.config.dictConfig({ - "version": 1, - "disable_existing_loggers": False, - "filters": { - "exclude_warnings": { - "()": "pip._internal.utils.logging.MaxLevelFilter", - "level": logging.WARNING, - }, - "restrict_to_subprocess": { - "()": "logging.Filter", - "name": subprocess_logger.name, - }, - "exclude_subprocess": { - "()": "pip._internal.utils.logging.ExcludeLoggerFilter", - "name": subprocess_logger.name, + logging.config.dictConfig( + { + "version": 1, + "disable_existing_loggers": False, + "filters": { + "exclude_warnings": { + "()": "pip._internal.utils.logging.MaxLevelFilter", + "level": logging.WARNING, + }, + "restrict_to_subprocess": { + "()": "logging.Filter", + "name": subprocess_logger.name, + }, + "exclude_subprocess": { + "()": "pip._internal.utils.logging.ExcludeLoggerFilter", + "name": subprocess_logger.name, + }, }, - }, - "formatters": { - "indent": { - "()": IndentingFormatter, - "format": "%(message)s", + "formatters": { + "indent": { + "()": IndentingFormatter, + "format": "%(message)s", + }, + "indent_with_timestamp": { + "()": IndentingFormatter, + "format": "%(message)s", + "add_timestamp": True, + }, }, - "indent_with_timestamp": { - "()": IndentingFormatter, - "format": "%(message)s", - "add_timestamp": True, + "handlers": { + "console": { + "level": level, + "class": handler_classes["stream"], + "no_color": no_color, + "stream": log_streams["stdout"], + "filters": ["exclude_subprocess", "exclude_warnings"], + "formatter": "indent", + }, + "console_errors": { + "level": "WARNING", + "class": handler_classes["stream"], + "no_color": no_color, + "stream": log_streams["stderr"], + "filters": ["exclude_subprocess"], + "formatter": "indent", + }, + # A handler responsible for logging to the console messages + # from the "subprocessor" logger. + "console_subprocess": { + "level": level, + "class": handler_classes["stream"], + "no_color": no_color, + "stream": log_streams["stderr"], + "filters": ["restrict_to_subprocess"], + "formatter": "indent", + }, + "user_log": { + "level": "DEBUG", + "class": handler_classes["file"], + "filename": additional_log_file, + "delay": True, + "formatter": "indent_with_timestamp", + }, }, - }, - "handlers": { - "console": { - "level": level, - "class": handler_classes["stream"], - "no_color": no_color, - "stream": log_streams["stdout"], - "filters": ["exclude_subprocess", "exclude_warnings"], - "formatter": "indent", + "root": { + "level": root_level, + "handlers": handlers, }, - "console_errors": { - "level": "WARNING", - "class": handler_classes["stream"], - "no_color": no_color, - "stream": log_streams["stderr"], - "filters": ["exclude_subprocess"], - "formatter": "indent", - }, - # A handler responsible for logging to the console messages - # from the "subprocessor" logger. - "console_subprocess": { - "level": level, - "class": handler_classes["stream"], - "no_color": no_color, - "stream": log_streams["stderr"], - "filters": ["restrict_to_subprocess"], - "formatter": "indent", - }, - "user_log": { - "level": "DEBUG", - "class": handler_classes["file"], - "filename": additional_log_file, - "delay": True, - "formatter": "indent_with_timestamp", - }, - }, - "root": { - "level": root_level, - "handlers": handlers, - }, - "loggers": { - "pip._vendor": { - "level": vendored_log_level - } - }, - }) + "loggers": {"pip._vendor": {"level": vendored_log_level}}, + } + ) return level_number diff --git a/src/fetchcode/vcs/pip/_internal/utils/misc.py b/src/fetchcode/vcs/pip/_internal/utils/misc.py index f2038555..bd89ad90 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/misc.py +++ b/src/fetchcode/vcs/pip/_internal/utils/misc.py @@ -17,6 +17,7 @@ from collections import deque from fetchcode.vcs.pip._vendor import pkg_resources + # NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is # why we ignore the type on this import. from fetchcode.vcs.pip._vendor.retrying import retry # type: ignore @@ -51,21 +52,38 @@ if MYPY_CHECK_RUNNING: from typing import ( - Any, AnyStr, Container, Iterable, Iterator, List, Optional, Text, - Tuple, Union, + Any, + AnyStr, + Container, + Iterable, + Iterator, + List, + Optional, + Text, + Tuple, + Union, ) from fetchcode.vcs.pip._vendor.pkg_resources import Distribution VersionInfo = Tuple[int, int, int] -__all__ = ['rmtree', 'display_path', 'backup_dir', - 'ask', 'splitext', - 'format_size', 'is_installable_dir', - 'normalize_path', - 'renames', 'get_prog', - 'captured_stdout', 'ensure_dir', - 'get_installed_version', 'remove_auth_from_url'] +__all__ = [ + "rmtree", + "display_path", + "backup_dir", + "ask", + "splitext", + "format_size", + "is_installable_dir", + "normalize_path", + "renames", + "get_prog", + "captured_stdout", + "ensure_dir", + "get_installed_version", + "remove_auth_from_url", +] logger = logging.getLogger(__name__) @@ -76,10 +94,10 @@ def get_pip_version(): pip_pkg_dir = os.path.join(os.path.dirname(__file__), "..", "..") pip_pkg_dir = os.path.abspath(pip_pkg_dir) - return ( - 'pip {} from {} (python {})'.format( - __version__, pip_pkg_dir, get_major_minor_version(), - ) + return "pip {} from {} (python {})".format( + __version__, + pip_pkg_dir, + get_major_minor_version(), ) @@ -100,7 +118,7 @@ def normalize_version_info(py_version_info): elif len(py_version_info) > 3: py_version_info = py_version_info[:3] - return cast('VersionInfo', py_version_info) + return cast("VersionInfo", py_version_info) def ensure_dir(path): @@ -118,21 +136,20 @@ def get_prog(): # type: () -> str try: prog = os.path.basename(sys.argv[0]) - if prog in ('__main__.py', '-c'): + if prog in ("__main__.py", "-c"): return "{} -m pip".format(sys.executable) else: return prog except (AttributeError, TypeError, IndexError): pass - return 'pip' + return "pip" # Retry every half second for up to 3 seconds @retry(stop_max_delay=3000, wait_fixed=500) def rmtree(dir, ignore_errors=False): # type: (str, bool) -> None - shutil.rmtree(dir, ignore_errors=ignore_errors, - onerror=rmtree_errorhandler) + shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler) def rmtree_errorhandler(func, path, exc_info): @@ -170,7 +187,7 @@ def path_to_display(path): return path # Otherwise, path is a bytes object (str in Python 2). try: - display_path = path.decode(sys.getfilesystemencoding(), 'strict') + display_path = path.decode(sys.getfilesystemencoding(), "strict") except UnicodeDecodeError: # Include the full bytes to make troubleshooting easier, even though # it may not be very human readable. @@ -180,7 +197,7 @@ def path_to_display(path): # Also, we add the prefix "b" to the repr() return value both # to make the Python 2 output look like the Python 3 output, and # to signal to the user that this is a bytes representation. - display_path = str_to_display('b{!r}'.format(path)) + display_path = str_to_display("b{!r}".format(path)) else: # Silence the "F821 undefined name 'ascii'" flake8 error since # in Python 3 ascii() is a built-in. @@ -195,14 +212,14 @@ def display_path(path): if possible.""" path = os.path.normcase(os.path.abspath(path)) if sys.version_info[0] == 2: - path = path.decode(sys.getfilesystemencoding(), 'replace') - path = path.encode(sys.getdefaultencoding(), 'replace') + path = path.decode(sys.getfilesystemencoding(), "replace") + path = path.encode(sys.getdefaultencoding(), "replace") if path.startswith(os.getcwd() + os.path.sep): - path = '.' + path[len(os.getcwd()):] + path = "." + path[len(os.getcwd()) :] return path -def backup_dir(dir, ext='.bak'): +def backup_dir(dir, ext=".bak"): # type: (str, str) -> str """Figure out the name of a directory to back up the given dir to (adding .bak, .bak2, etc)""" @@ -216,7 +233,7 @@ def backup_dir(dir, ext='.bak'): def ask_path_exists(message, options): # type: (str, Iterable[str]) -> str - for action in os.environ.get('PIP_EXISTS_ACTION', '').split(): + for action in os.environ.get("PIP_EXISTS_ACTION", "").split(): if action in options: return action return ask(message, options) @@ -225,10 +242,9 @@ def ask_path_exists(message, options): def _check_no_input(message): # type: (str) -> None """Raise an error if no input is allowed.""" - if os.environ.get('PIP_NO_INPUT'): + if os.environ.get("PIP_NO_INPUT"): raise Exception( - 'No input was expected ($PIP_NO_INPUT set); question: {}'.format( - message) + "No input was expected ($PIP_NO_INPUT set); question: {}".format(message) ) @@ -241,8 +257,8 @@ def ask(message, options): response = response.strip().lower() if response not in options: print( - 'Your response ({!r}) was not one of the expected responses: ' - '{}'.format(response, ', '.join(options)) + "Your response ({!r}) was not one of the expected responses: " + "{}".format(response, ", ".join(options)) ) else: return response @@ -265,13 +281,13 @@ def ask_password(message): def format_size(bytes): # type: (float) -> str if bytes > 1000 * 1000: - return '{:.1f} MB'.format(bytes / 1000.0 / 1000) + return "{:.1f} MB".format(bytes / 1000.0 / 1000) elif bytes > 10 * 1000: - return '{} kB'.format(int(bytes / 1000)) + return "{} kB".format(int(bytes / 1000)) elif bytes > 1000: - return '{:.1f} kB'.format(bytes / 1000.0) + return "{:.1f} kB".format(bytes / 1000.0) else: - return '{} bytes'.format(int(bytes)) + return "{} bytes".format(int(bytes)) def tabulate(rows): @@ -284,21 +300,20 @@ def tabulate(rows): (['foobar 2000', '3735928559'], [10, 4]) """ rows = [tuple(map(str, row)) for row in rows] - sizes = [max(map(len, col)) for col in zip_longest(*rows, fillvalue='')] + sizes = [max(map(len, col)) for col in zip_longest(*rows, fillvalue="")] table = [" ".join(map(str.ljust, row, sizes)).rstrip() for row in rows] return table, sizes def is_installable_dir(path): # type: (str) -> bool - """Is path is a directory containing setup.py or pyproject.toml? - """ + """Is path is a directory containing setup.py or pyproject.toml?""" if not os.path.isdir(path): return False - setup_py = os.path.join(path, 'setup.py') + setup_py = os.path.join(path, "setup.py") if os.path.isfile(setup_py): return True - pyproject_toml = os.path.join(path, 'pyproject.toml') + pyproject_toml = os.path.join(path, "pyproject.toml") if os.path.isfile(pyproject_toml): return True return False @@ -331,7 +346,7 @@ def splitext(path): # type: (str) -> Tuple[str, str] """Like os.path.splitext, but take off .tar too""" base, ext = posixpath.splitext(path) - if base.lower().endswith('.tar'): + if base.lower().endswith(".tar"): ext = base[-4:] + ext base = base[:-4] return base, ext @@ -405,19 +420,19 @@ def dist_is_editable(dist): Return True if given Distribution is an editable install. """ for path_item in sys.path: - egg_link = os.path.join(path_item, dist.project_name + '.egg-link') + egg_link = os.path.join(path_item, dist.project_name + ".egg-link") if os.path.isfile(egg_link): return True return False def get_installed_distributions( - local_only=True, # type: bool - skip=stdlib_pkgs, # type: Container[str] - include_editables=True, # type: bool - editables_only=False, # type: bool - user_only=False, # type: bool - paths=None # type: Optional[List[str]] + local_only=True, # type: bool + skip=stdlib_pkgs, # type: Container[str] + include_editables=True, # type: bool + editables_only=False, # type: bool + user_only=False, # type: bool + paths=None, # type: Optional[List[str]] ): # type: (...) -> List[Distribution] """ @@ -447,36 +462,46 @@ def get_installed_distributions( if local_only: local_test = dist_is_local else: + def local_test(d): return True if include_editables: + def editable_test(d): return True + else: + def editable_test(d): return not dist_is_editable(d) if editables_only: + def editables_only_test(d): return dist_is_editable(d) + else: + def editables_only_test(d): return True if user_only: user_test = dist_in_usersite else: + def user_test(d): return True - return [d for d in working_set - if local_test(d) and - d.key not in skip and - editable_test(d) and - editables_only_test(d) and - user_test(d) - ] + return [ + d + for d in working_set + if local_test(d) + and d.key not in skip + and editable_test(d) + and editables_only_test(d) + and user_test(d) + ] def egg_link_path(dist): @@ -509,7 +534,7 @@ def egg_link_path(dist): sites.append(site_packages) for site in sites: - egglink = os.path.join(site, dist.project_name) + '.egg-link' + egglink = os.path.join(site, dist.project_name) + ".egg-link" if os.path.isfile(egglink): return egglink return None @@ -539,6 +564,7 @@ def write_output(msg, *args): class FakeFile(object): """Wrap a list of lines in an object with readline() to make ConfigParser happy.""" + def __init__(self, lines): self._gen = (l for l in lines) @@ -549,14 +575,13 @@ def readline(self): except NameError: return self._gen.next() except StopIteration: - return '' + return "" def __iter__(self): return self._gen class StreamWrapper(StringIO): - @classmethod def from_stream(cls, orig_stream): cls.orig_stream = orig_stream @@ -592,26 +617,26 @@ def captured_stdout(): Taken from Lib/support/__init__.py in the CPython repo. """ - return captured_output('stdout') + return captured_output("stdout") def captured_stderr(): """ See captured_stdout(). """ - return captured_output('stderr') + return captured_output("stderr") class cached_property(object): """A property that is only computed once per instance and then replaces - itself with an ordinary attribute. Deleting the attribute resets the - property. + itself with an ordinary attribute. Deleting the attribute resets the + property. - Source: https://github.com/bottlepy/bottle/blob/0.11.5/bottle.py#L175 + Source: https://github.com/bottlepy/bottle/blob/0.11.5/bottle.py#L175 """ def __init__(self, func): - self.__doc__ = getattr(func, '__doc__') + self.__doc__ = getattr(func, "__doc__") self.func = func def __get__(self, obj, cls): @@ -649,8 +674,8 @@ def consume(iterator): def enum(*sequential, **named): enums = dict(zip(sequential, range(len(sequential))), **named) reverse = {value: key for key, value in enums.items()} - enums['reverse_mapping'] = reverse - return type('Enum', (), enums) + enums["reverse_mapping"] = reverse + return type("Enum", (), enums) def build_netloc(host, port): @@ -660,21 +685,21 @@ def build_netloc(host, port): """ if port is None: return host - if ':' in host: + if ":" in host: # Only wrap host with square brackets when it is IPv6 - host = '[{}]'.format(host) - return '{}:{}'.format(host, port) + host = "[{}]".format(host) + return "{}:{}".format(host, port) -def build_url_from_netloc(netloc, scheme='https'): +def build_url_from_netloc(netloc, scheme="https"): # type: (str, str) -> str """ Build a full URL from a netloc. """ - if netloc.count(':') >= 2 and '@' not in netloc and '[' not in netloc: + if netloc.count(":") >= 2 and "@" not in netloc and "[" not in netloc: # It must be a bare IPv6 address, so wrap it with brackets. - netloc = '[{}]'.format(netloc) - return '{}://{}'.format(scheme, netloc) + netloc = "[{}]".format(netloc) + return "{}://{}".format(scheme, netloc) def parse_netloc(netloc): @@ -693,24 +718,22 @@ def split_auth_from_netloc(netloc): Returns: (netloc, (username, password)). """ - if '@' not in netloc: + if "@" not in netloc: return netloc, (None, None) # Split from the right because that's how urllib.parse.urlsplit() # behaves if more than one @ is present (which can be checked using # the password attribute of urlsplit()'s return value). - auth, netloc = netloc.rsplit('@', 1) - if ':' in auth: + auth, netloc = netloc.rsplit("@", 1) + if ":" in auth: # Split from the left because that's how urllib.parse.urlsplit() # behaves if more than one : is present (which again can be checked # using the password attribute of the return value) - user_pass = auth.split(':', 1) + user_pass = auth.split(":", 1) else: user_pass = auth, None - user_pass = tuple( - None if x is None else urllib_unquote(x) for x in user_pass - ) + user_pass = tuple(None if x is None else urllib_unquote(x) for x in user_pass) return netloc, user_pass @@ -728,14 +751,14 @@ def redact_netloc(netloc): if user is None: return netloc if password is None: - user = '****' - password = '' + user = "****" + password = "" else: user = urllib_parse.quote(user) - password = ':****' - return '{user}{password}@{netloc}'.format(user=user, - password=password, - netloc=netloc) + password = ":****" + return "{user}{password}@{netloc}".format( + user=user, password=password, netloc=netloc + ) def _transform_url(url, transform_netloc): @@ -751,9 +774,7 @@ def _transform_url(url, transform_netloc): purl = urllib_parse.urlsplit(url) netloc_tuple = transform_netloc(purl.netloc) # stripped url - url_pieces = ( - purl.scheme, netloc_tuple[0], purl.path, purl.query, purl.fragment - ) + url_pieces = (purl.scheme, netloc_tuple[0], purl.path, purl.query, purl.fragment) surl = urllib_parse.urlunsplit(url_pieces) return surl, netloc_tuple @@ -794,7 +815,7 @@ def redact_auth_from_url(url): class HiddenText(object): def __init__( self, - secret, # type: str + secret, # type: str redacted, # type: str ): # type: (...) -> None @@ -803,7 +824,7 @@ def __init__( def __repr__(self): # type: (...) -> str - return ''.format(str(self)) + return "".format(str(self)) def __str__(self): # type: (...) -> str @@ -817,7 +838,7 @@ def __eq__(self, other): # The string being used for redaction doesn't also have to match, # just the raw, original string. - return (self.secret == other.secret) + return self.secret == other.secret # We need to provide an explicit __ne__ implementation for Python 2. # TODO: remove this when we drop PY2 support. @@ -828,7 +849,7 @@ def __ne__(self, other): def hide_value(value): # type: (str) -> HiddenText - return HiddenText(value, redacted='****') + return HiddenText(value, redacted="****") def hide_url(url): @@ -847,41 +868,36 @@ def protect_pip_from_modification_on_windows(modifying_pip): pip_names = [ "pip.exe", "pip{}.exe".format(sys.version_info[0]), - "pip{}.{}.exe".format(*sys.version_info[:2]) + "pip{}.{}.exe".format(*sys.version_info[:2]), ] # See https://github.com/pypa/pip/issues/1299 for more discussion should_show_use_python_msg = ( - modifying_pip and - WINDOWS and - os.path.basename(sys.argv[0]) in pip_names + modifying_pip and WINDOWS and os.path.basename(sys.argv[0]) in pip_names ) if should_show_use_python_msg: - new_command = [ - sys.executable, "-m", "pip" - ] + sys.argv[1:] + new_command = [sys.executable, "-m", "pip"] + sys.argv[1:] raise CommandError( - 'To modify pip, please run the following command:\n{}' - .format(" ".join(new_command)) + "To modify pip, please run the following command:\n{}".format( + " ".join(new_command) + ) ) def is_console_interactive(): # type: () -> bool - """Is this console interactive? - """ + """Is this console interactive?""" return sys.stdin is not None and sys.stdin.isatty() def hash_file(path, blocksize=1 << 20): # type: (str, int) -> Tuple[Any, int] - """Return (hash, length) for path using hashlib.sha256() - """ + """Return (hash, length) for path using hashlib.sha256()""" h = hashlib.sha256() length = 0 - with open(path, 'rb') as f: + with open(path, "rb") as f: for block in read_chunks(f, size=blocksize): length += len(block) h.update(block) diff --git a/src/fetchcode/vcs/pip/_internal/utils/models.py b/src/fetchcode/vcs/pip/_internal/utils/models.py index 29e14411..0904bb9a 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/models.py +++ b/src/fetchcode/vcs/pip/_internal/utils/models.py @@ -7,8 +7,7 @@ class KeyBasedCompareMixin(object): - """Provides comparison capabilities that is based on a key - """ + """Provides comparison capabilities that is based on a key""" def __init__(self, key, defining_class): self._compare_key = key diff --git a/src/fetchcode/vcs/pip/_internal/utils/packaging.py b/src/fetchcode/vcs/pip/_internal/utils/packaging.py index 0a74af0a..c4b14be7 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/packaging.py +++ b/src/fetchcode/vcs/pip/_internal/utils/packaging.py @@ -1,4 +1,3 @@ - import logging from email.parser import FeedParser @@ -36,7 +35,7 @@ def check_requires_python(requires_python, version_info): return True requires_python_specifier = specifiers.SpecifierSet(requires_python) - python_version = version.parse('.'.join(map(str, version_info))) + python_version = version.parse(".".join(map(str, version_info))) return python_version in requires_python_specifier @@ -46,16 +45,17 @@ def get_metadata(dist): :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. """ - metadata_name = 'METADATA' - if (isinstance(dist, pkg_resources.DistInfoDistribution) and - dist.has_metadata(metadata_name)): + metadata_name = "METADATA" + if isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata( + metadata_name + ): metadata = dist.get_metadata(metadata_name) - elif dist.has_metadata('PKG-INFO'): - metadata_name = 'PKG-INFO' + elif dist.has_metadata("PKG-INFO"): + metadata_name = "PKG-INFO" metadata = dist.get_metadata(metadata_name) else: logger.warning("No metadata found in %s", display_path(dist.location)) - metadata = '' + metadata = "" if metadata is None: raise NoneMetadataError(dist, metadata_name) @@ -74,7 +74,7 @@ def get_requires_python(dist): if not present. """ pkg_info_dict = get_metadata(dist) - requires_python = pkg_info_dict.get('Requires-Python') + requires_python = pkg_info_dict.get("Requires-Python") if requires_python is not None: # Convert to a str to satisfy the type checker, since requires_python @@ -86,8 +86,8 @@ def get_requires_python(dist): def get_installer(dist): # type: (Distribution) -> str - if dist.has_metadata('INSTALLER'): - for line in dist.get_metadata_lines('INSTALLER'): + if dist.has_metadata("INSTALLER"): + for line in dist.get_metadata_lines("INSTALLER"): if line.strip(): return line.strip() - return '' + return "" diff --git a/src/fetchcode/vcs/pip/_internal/utils/pkg_resources.py b/src/fetchcode/vcs/pip/_internal/utils/pkg_resources.py index f72fb778..bcc4e08e 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/pkg_resources.py +++ b/src/fetchcode/vcs/pip/_internal/utils/pkg_resources.py @@ -8,8 +8,8 @@ class DictMetadata(object): - """IMetadataProvider that reads metadata files from a dictionary. - """ + """IMetadataProvider that reads metadata files from a dictionary.""" + def __init__(self, metadata): # type: (Dict[str, bytes]) -> None self._metadata = metadata diff --git a/src/fetchcode/vcs/pip/_internal/utils/setuptools_build.py b/src/fetchcode/vcs/pip/_internal/utils/setuptools_build.py index 8338e3bc..6af1ee20 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/setuptools_build.py +++ b/src/fetchcode/vcs/pip/_internal/utils/setuptools_build.py @@ -24,7 +24,7 @@ def make_setuptools_shim_args( setup_py_path, # type: str global_options=None, # type: Sequence[str] no_user_config=False, # type: bool - unbuffered_output=False # type: bool + unbuffered_output=False, # type: bool ): # type: (...) -> List[str] """ @@ -59,9 +59,7 @@ def make_setuptools_bdist_wheel_args( # relies on site.py to find parts of the standard library outside the # virtualenv. args = make_setuptools_shim_args( - setup_py_path, - global_options=global_options, - unbuffered_output=True + setup_py_path, global_options=global_options, unbuffered_output=True ) args += ["bdist_wheel", "-d", destination_dir] args += build_options @@ -74,9 +72,7 @@ def make_setuptools_clean_args( ): # type: (...) -> List[str] args = make_setuptools_shim_args( - setup_py_path, - global_options=global_options, - unbuffered_output=True + setup_py_path, global_options=global_options, unbuffered_output=True ) args += ["clean", "--all"] return args @@ -121,9 +117,7 @@ def make_setuptools_egg_info_args( no_user_config, # type: bool ): # type: (...) -> List[str] - args = make_setuptools_shim_args( - setup_py_path, no_user_config=no_user_config - ) + args = make_setuptools_shim_args(setup_py_path, no_user_config=no_user_config) args += ["egg_info"] @@ -144,7 +138,7 @@ def make_setuptools_install_args( home, # type: Optional[str] use_user_site, # type: bool no_user_config, # type: bool - pycompile # type: bool + pycompile, # type: bool ): # type: (...) -> List[str] assert not (use_user_site and prefix) @@ -154,7 +148,7 @@ def make_setuptools_install_args( setup_py_path, global_options=global_options, no_user_config=no_user_config, - unbuffered_output=True + unbuffered_output=True, ) args += ["install", "--record", record_filename] args += ["--single-version-externally-managed"] diff --git a/src/fetchcode/vcs/pip/_internal/utils/subprocess.py b/src/fetchcode/vcs/pip/_internal/utils/subprocess.py index 4850576b..4f9dcebf 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/subprocess.py +++ b/src/fetchcode/vcs/pip/_internal/utils/subprocess.py @@ -17,13 +17,20 @@ if MYPY_CHECK_RUNNING: from typing import ( - Any, Callable, Iterable, List, Mapping, Optional, Text, Union, + Any, + Callable, + Iterable, + List, + Mapping, + Optional, + Text, + Union, ) CommandArgs = List[Union[str, HiddenText]] -LOG_DIVIDER = '----------------------------------------' +LOG_DIVIDER = "----------------------------------------" def make_command(*args): @@ -54,9 +61,9 @@ def format_command_args(args): # this can trigger a UnicodeDecodeError in Python 2 if the argument # has type unicode and includes a non-ascii character. (The type # checker doesn't ensure the annotations are correct in all cases.) - return ' '.join( - shlex_quote(str(arg)) if isinstance(arg, HiddenText) - else shlex_quote(arg) for arg in args + return " ".join( + shlex_quote(str(arg)) if isinstance(arg, HiddenText) else shlex_quote(arg) + for arg in args ) @@ -65,15 +72,13 @@ def reveal_command_args(args): """ Return the arguments in their raw, unredacted form. """ - return [ - arg.secret if isinstance(arg, HiddenText) else arg for arg in args - ] + return [arg.secret if isinstance(arg, HiddenText) else arg for arg in args] def make_subprocess_output_error( - cmd_args, # type: Union[List[str], CommandArgs] - cwd, # type: Optional[str] - lines, # type: List[Text] + cmd_args, # type: Union[List[str], CommandArgs] + cwd, # type: Optional[str] + lines, # type: List[Text] exit_status, # type: int ): # type: (...) -> Text @@ -88,19 +93,19 @@ def make_subprocess_output_error( # them as arguments in the unicode format string below. This avoids # "UnicodeDecodeError: 'ascii' codec can't decode byte ..." in Python 2 # if either contains a non-ascii character. - command_display = str_to_display(command, desc='command bytes') + command_display = str_to_display(command, desc="command bytes") cwd_display = path_to_display(cwd) # We know the joined output value ends in a newline. - output = ''.join(lines) + output = "".join(lines) msg = ( # Use a unicode string to avoid "UnicodeEncodeError: 'ascii' # codec can't encode character ..." in Python 2 when a format # argument (e.g. `output`) has a non-ascii character. - u'Command errored out with exit status {exit_status}:\n' - ' command: {command_display}\n' - ' cwd: {cwd_display}\n' - 'Complete output ({line_count} lines):\n{output}{divider}' + "Command errored out with exit status {exit_status}:\n" + " command: {command_display}\n" + " cwd: {cwd_display}\n" + "Complete output ({line_count} lines):\n{output}{divider}" ).format( exit_status=exit_status, command_display=command_display, @@ -116,13 +121,13 @@ def call_subprocess( cmd, # type: Union[List[str], CommandArgs] show_stdout=False, # type: bool cwd=None, # type: Optional[str] - on_returncode='raise', # type: str + on_returncode="raise", # type: str extra_ok_returncodes=None, # type: Optional[Iterable[int]] command_desc=None, # type: Optional[str] extra_environ=None, # type: Optional[Mapping[str, Any]] unset_environ=None, # type: Optional[Iterable[str]] spinner=None, # type: Optional[SpinnerInterface] - log_failed_cmd=True # type: Optional[bool] + log_failed_cmd=True, # type: Optional[bool] ): # type: (...) -> Text """ @@ -184,14 +189,19 @@ def call_subprocess( proc = subprocess.Popen( # Convert HiddenText objects to the underlying str. reveal_command_args(cmd), - stderr=subprocess.STDOUT, stdin=subprocess.PIPE, - stdout=subprocess.PIPE, cwd=cwd, env=env, + stderr=subprocess.STDOUT, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + cwd=cwd, + env=env, ) proc.stdin.close() except Exception as exc: if log_failed_cmd: subprocess_logger.critical( - "Error %s while executing command %s", exc, command_desc, + "Error %s while executing command %s", + exc, + command_desc, ) raise all_output = [] @@ -201,7 +211,7 @@ def call_subprocess( if not line: break line = line.rstrip() - all_output.append(line + '\n') + all_output.append(line + "\n") # Show the line immediately. log_subprocess(line) @@ -213,16 +223,14 @@ def call_subprocess( finally: if proc.stdout: proc.stdout.close() - proc_had_error = ( - proc.returncode and proc.returncode not in extra_ok_returncodes - ) + proc_had_error = proc.returncode and proc.returncode not in extra_ok_returncodes if use_spinner: if proc_had_error: spinner.finish("error") else: spinner.finish("done") if proc_had_error: - if on_returncode == 'raise': + if on_returncode == "raise": if not showing_subprocess and log_failed_cmd: # Then the subprocess streams haven't been logged to the # console yet. @@ -234,21 +242,21 @@ def call_subprocess( ) subprocess_logger.error(msg) exc_msg = ( - 'Command errored out with exit status {}: {} ' - 'Check the logs for full command output.' + "Command errored out with exit status {}: {} " + "Check the logs for full command output." ).format(proc.returncode, command_desc) raise InstallationError(exc_msg) - elif on_returncode == 'warn': + elif on_returncode == "warn": subprocess_logger.warning( 'Command "{}" had error code {} in {}'.format( - command_desc, proc.returncode, cwd) + command_desc, proc.returncode, cwd + ) ) - elif on_returncode == 'ignore': + elif on_returncode == "ignore": pass else: - raise ValueError('Invalid value: on_returncode={!r}'.format( - on_returncode)) - return ''.join(all_output) + raise ValueError("Invalid value: on_returncode={!r}".format(on_returncode)) + return "".join(all_output) def runner_with_spinner_message(message): @@ -262,7 +270,7 @@ def runner_with_spinner_message(message): def runner( cmd, # type: List[str] cwd=None, # type: Optional[str] - extra_environ=None # type: Optional[Mapping[str, Any]] + extra_environ=None, # type: Optional[Mapping[str, Any]] ): # type: (...) -> None with open_spinner(message) as spinner: diff --git a/src/fetchcode/vcs/pip/_internal/utils/temp_dir.py b/src/fetchcode/vcs/pip/_internal/utils/temp_dir.py index 42abdefa..a8732943 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/temp_dir.py +++ b/src/fetchcode/vcs/pip/_internal/utils/temp_dir.py @@ -1,4 +1,3 @@ - import errno import itertools import logging @@ -14,7 +13,7 @@ if MYPY_CHECK_RUNNING: from typing import Any, Dict, Iterator, Optional, TypeVar, Union - _T = TypeVar('_T', bound='TempDirectory') + _T = TypeVar("_T", bound="TempDirectory") logger = logging.getLogger(__name__) @@ -45,8 +44,7 @@ def global_tempdir_manager(): class TempDirectoryTypeRegistry(object): - """Manages temp directory behavior - """ + """Manages temp directory behavior""" def __init__(self): # type: () -> None @@ -115,7 +113,7 @@ class TempDirectory(object): def __init__( self, - path=None, # type: Optional[str] + path=None, # type: Optional[str] delete=_default, # type: Union[bool, None, _Default] kind="temp", # type: str globally_managed=False, # type: bool @@ -147,8 +145,8 @@ def __init__( @property def path(self): # type: () -> str - assert not self._deleted, ( - "Attempted to access deleted path: {}".format(self._path) + assert not self._deleted, "Attempted to access deleted path: {}".format( + self._path ) return self._path @@ -174,22 +172,18 @@ def __exit__(self, exc, value, tb): def _create(self, kind): # type: (str) -> str - """Create a temporary directory and store its path in self.path - """ + """Create a temporary directory and store its path in self.path""" # We realpath here because some systems have their default tmpdir # symlinked to another directory. This tends to confuse build # scripts, so we canonicalize the path by traversing potential # symlinks here. - path = os.path.realpath( - tempfile.mkdtemp(prefix="pip-{}-".format(kind)) - ) + path = os.path.realpath(tempfile.mkdtemp(prefix="pip-{}-".format(kind))) logger.debug("Created temporary directory: {}".format(path)) return path def cleanup(self): # type: () -> None - """Remove the temporary directory created and reset state - """ + """Remove the temporary directory created and reset state""" self._deleted = True if os.path.exists(self._path): rmtree(self._path) @@ -209,6 +203,7 @@ class AdjacentTempDirectory(TempDirectory): (when used as a contextmanager) """ + # The characters that may be used to name the temp directory # We always prepend a ~ and then rotate through these until # a usable name is found. @@ -218,7 +213,7 @@ class AdjacentTempDirectory(TempDirectory): def __init__(self, original, delete=None): # type: (str, Optional[bool]) -> None - self.original = original.rstrip('/\\') + self.original = original.rstrip("/\\") super(AdjacentTempDirectory, self).__init__(delete=delete) @classmethod @@ -233,16 +228,18 @@ def _generate_names(cls, name): """ for i in range(1, len(name)): for candidate in itertools.combinations_with_replacement( - cls.LEADING_CHARS, i - 1): - new_name = '~' + ''.join(candidate) + name[i:] + cls.LEADING_CHARS, i - 1 + ): + new_name = "~" + "".join(candidate) + name[i:] if new_name != name: yield new_name # If we make it this far, we will have to make a longer name for i in range(len(cls.LEADING_CHARS)): for candidate in itertools.combinations_with_replacement( - cls.LEADING_CHARS, i): - new_name = '~' + ''.join(candidate) + name + cls.LEADING_CHARS, i + ): + new_name = "~" + "".join(candidate) + name if new_name != name: yield new_name @@ -262,9 +259,7 @@ def _create(self, kind): break else: # Final fallback on the default behavior. - path = os.path.realpath( - tempfile.mkdtemp(prefix="pip-{}-".format(kind)) - ) + path = os.path.realpath(tempfile.mkdtemp(prefix="pip-{}-".format(kind))) logger.debug("Created temporary directory: {}".format(path)) return path diff --git a/src/fetchcode/vcs/pip/_internal/utils/unpacking.py b/src/fetchcode/vcs/pip/_internal/utils/unpacking.py index 3794e0f2..d8df9f89 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/unpacking.py +++ b/src/fetchcode/vcs/pip/_internal/utils/unpacking.py @@ -34,16 +34,18 @@ try: import bz2 # noqa + SUPPORTED_EXTENSIONS += BZ2_EXTENSIONS except ImportError: - logger.debug('bz2 module is not available') + logger.debug("bz2 module is not available") try: # Only for Python 3.3+ import lzma # noqa + SUPPORTED_EXTENSIONS += XZ_EXTENSIONS except ImportError: - logger.debug('lzma module is not available') + logger.debug("lzma module is not available") def current_umask(): @@ -55,18 +57,15 @@ def current_umask(): def split_leading_dir(path): # type: (Union[str, Text]) -> List[Union[str, Text]] - path = path.lstrip('/').lstrip('\\') - if ( - '/' in path and ( - ('\\' in path and path.find('/') < path.find('\\')) or - '\\' not in path - ) + path = path.lstrip("/").lstrip("\\") + if "/" in path and ( + ("\\" in path and path.find("/") < path.find("\\")) or "\\" not in path ): - return path.split('/', 1) - elif '\\' in path: - return path.split('\\', 1) + return path.split("/", 1) + elif "\\" in path: + return path.split("\\", 1) else: - return [path, ''] + return [path, ""] def has_leading_dir(paths): @@ -108,7 +107,7 @@ def unzip_file(filename, location, flatten=True): no-ops per the python docs. """ ensure_dir(location) - zipfp = open(filename, 'rb') + zipfp = open(filename, "rb") try: zip = zipfile.ZipFile(zipfp, allowZip64=True) leading = has_leading_dir(zip.namelist()) and flatten @@ -121,11 +120,11 @@ def unzip_file(filename, location, flatten=True): dir = os.path.dirname(fn) if not is_within_directory(location, fn): message = ( - 'The zip file ({}) has a file ({}) trying to install ' - 'outside target directory ({})' + "The zip file ({}) has a file ({}) trying to install " + "outside target directory ({})" ) raise InstallationError(message.format(filename, fn, location)) - if fn.endswith('/') or fn.endswith('\\'): + if fn.endswith("/") or fn.endswith("\\"): # A directory ensure_dir(fn) else: @@ -134,7 +133,7 @@ def unzip_file(filename, location, flatten=True): # chunk of memory for the file's content fp = zip.open(name) try: - with open(fn, 'wb') as destfp: + with open(fn, "wb") as destfp: shutil.copyfileobj(fp, destfp) finally: fp.close() @@ -160,24 +159,23 @@ def untar_file(filename, location): no-ops per the python docs. """ ensure_dir(location) - if filename.lower().endswith('.gz') or filename.lower().endswith('.tgz'): - mode = 'r:gz' + if filename.lower().endswith(".gz") or filename.lower().endswith(".tgz"): + mode = "r:gz" elif filename.lower().endswith(BZ2_EXTENSIONS): - mode = 'r:bz2' + mode = "r:bz2" elif filename.lower().endswith(XZ_EXTENSIONS): - mode = 'r:xz' - elif filename.lower().endswith('.tar'): - mode = 'r' + mode = "r:xz" + elif filename.lower().endswith(".tar"): + mode = "r" else: logger.warning( - 'Cannot determine compression type for file %s', filename, + "Cannot determine compression type for file %s", + filename, ) - mode = 'r:*' + mode = "r:*" tar = tarfile.open(filename, mode) try: - leading = has_leading_dir([ - member.name for member in tar.getmembers() - ]) + leading = has_leading_dir([member.name for member in tar.getmembers()]) for member in tar.getmembers(): fn = member.name if leading: @@ -186,12 +184,10 @@ def untar_file(filename, location): path = os.path.join(location, fn) if not is_within_directory(location, path): message = ( - 'The tar file ({}) has a file ({}) trying to install ' - 'outside target directory ({})' - ) - raise InstallationError( - message.format(filename, path, location) + "The tar file ({}) has a file ({}) trying to install " + "outside target directory ({})" ) + raise InstallationError(message.format(filename, path, location)) if member.isdir(): ensure_dir(path) elif member.issym(): @@ -202,8 +198,10 @@ def untar_file(filename, location): # Some corrupt tar files seem to produce this # (specifically bad symlinks) logger.warning( - 'In the tar file %s the member %s is invalid: %s', - filename, member.name, exc, + "In the tar file %s the member %s is invalid: %s", + filename, + member.name, + exc, ) continue else: @@ -213,12 +211,14 @@ def untar_file(filename, location): # Some corrupt tar files seem to produce this # (specifically bad symlinks) logger.warning( - 'In the tar file %s the member %s is invalid: %s', - filename, member.name, exc, + "In the tar file %s the member %s is invalid: %s", + filename, + member.name, + exc, ) continue ensure_dir(os.path.dirname(path)) - with open(path, 'wb') as destfp: + with open(path, "wb") as destfp: shutil.copyfileobj(fp, destfp) fp.close() # Update the timestamp (useful for cython compiled files) @@ -234,38 +234,34 @@ def untar_file(filename, location): def unpack_file( - filename, # type: str - location, # type: str - content_type=None, # type: Optional[str] + filename, # type: str + location, # type: str + content_type=None, # type: Optional[str] ): # type: (...) -> None filename = os.path.realpath(filename) if ( - content_type == 'application/zip' or - filename.lower().endswith(ZIP_EXTENSIONS) or - zipfile.is_zipfile(filename) + content_type == "application/zip" + or filename.lower().endswith(ZIP_EXTENSIONS) + or zipfile.is_zipfile(filename) ): - unzip_file( - filename, - location, - flatten=not filename.endswith('.whl') - ) + unzip_file(filename, location, flatten=not filename.endswith(".whl")) elif ( - content_type == 'application/x-gzip' or - tarfile.is_tarfile(filename) or - filename.lower().endswith( - TAR_EXTENSIONS + BZ2_EXTENSIONS + XZ_EXTENSIONS - ) + content_type == "application/x-gzip" + or tarfile.is_tarfile(filename) + or filename.lower().endswith(TAR_EXTENSIONS + BZ2_EXTENSIONS + XZ_EXTENSIONS) ): untar_file(filename, location) else: # FIXME: handle? # FIXME: magic signatures? logger.critical( - 'Cannot unpack file %s (downloaded from %s, content-type: %s); ' - 'cannot detect archive format', - filename, location, content_type, + "Cannot unpack file %s (downloaded from %s, content-type: %s); " + "cannot detect archive format", + filename, + location, + content_type, ) raise InstallationError( - 'Cannot determine archive format of {}'.format(location) + "Cannot determine archive format of {}".format(location) ) diff --git a/src/fetchcode/vcs/pip/_internal/utils/urls.py b/src/fetchcode/vcs/pip/_internal/utils/urls.py index b2a452ab..efd96e80 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/urls.py +++ b/src/fetchcode/vcs/pip/_internal/utils/urls.py @@ -12,9 +12,9 @@ def get_url_scheme(url): # type: (Union[str, Text]) -> Optional[Text] - if ':' not in url: + if ":" not in url: return None - return url.split(':', 1)[0].lower() + return url.split(":", 1)[0].lower() def path_to_url(path): @@ -24,7 +24,7 @@ def path_to_url(path): quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) - url = urllib_parse.urljoin('file:', urllib_request.pathname2url(path)) + url = urllib_parse.urljoin("file:", urllib_request.pathname2url(path)) return url @@ -33,22 +33,23 @@ def url_to_path(url): """ Convert a file: URL to a path. """ - assert url.startswith('file:'), ( - "You can only turn file: urls into filenames (not {url!r})" - .format(**locals())) + assert url.startswith( + "file:" + ), "You can only turn file: urls into filenames (not {url!r})".format(**locals()) _, netloc, path, _, _ = urllib_parse.urlsplit(url) - if not netloc or netloc == 'localhost': + if not netloc or netloc == "localhost": # According to RFC 8089, same as empty authority. - netloc = '' - elif sys.platform == 'win32': + netloc = "" + elif sys.platform == "win32": # If we have a UNC path, prepend UNC share notation. - netloc = '\\\\' + netloc + netloc = "\\\\" + netloc else: raise ValueError( - 'non-local file URIs are not supported on this platform: {url!r}' - .format(**locals()) + "non-local file URIs are not supported on this platform: {url!r}".format( + **locals() + ) ) path = urllib_request.url2pathname(netloc + path) diff --git a/src/fetchcode/vcs/pip/_internal/utils/virtualenv.py b/src/fetchcode/vcs/pip/_internal/utils/virtualenv.py index e819329f..6e9dacd4 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/virtualenv.py +++ b/src/fetchcode/vcs/pip/_internal/utils/virtualenv.py @@ -1,4 +1,3 @@ - import logging import os import re @@ -32,13 +31,12 @@ def _running_under_regular_virtualenv(): This handles virtual environments created with pypa's virtualenv. """ # pypa/virtualenv case - return hasattr(sys, 'real_prefix') + return hasattr(sys, "real_prefix") def running_under_virtualenv(): # type: () -> bool - """Return True if we're running inside a virtualenv, False otherwise. - """ + """Return True if we're running inside a virtualenv, False otherwise.""" return _running_under_venv() or _running_under_regular_virtualenv() @@ -48,7 +46,7 @@ def _get_pyvenv_cfg_lines(): Returns None, if it could not read/access the file. """ - pyvenv_cfg_file = os.path.join(sys.prefix, 'pyvenv.cfg') + pyvenv_cfg_file = os.path.join(sys.prefix, "pyvenv.cfg") try: with open(pyvenv_cfg_file) as f: return f.read().splitlines() # avoids trailing newlines @@ -81,7 +79,7 @@ def _no_global_under_venv(): for line in cfg_lines: match = _INCLUDE_SYSTEM_SITE_PACKAGES_REGEX.match(line) - if match is not None and match.group('value') == 'false': + if match is not None and match.group("value") == "false": return True return False @@ -95,15 +93,15 @@ def _no_global_under_regular_virtualenv(): """ site_mod_dir = os.path.dirname(os.path.abspath(site.__file__)) no_global_site_packages_file = os.path.join( - site_mod_dir, 'no-global-site-packages.txt', + site_mod_dir, + "no-global-site-packages.txt", ) return os.path.exists(no_global_site_packages_file) def virtualenv_no_global(): # type: () -> bool - """Returns a boolean, whether running in venv with no system site-packages. - """ + """Returns a boolean, whether running in venv with no system site-packages.""" # PEP 405 compliance needs to be checked first since virtualenv >=20 would # return True for both checks, but is only able to use the PEP 405 config. if _running_under_venv(): diff --git a/src/fetchcode/vcs/pip/_internal/utils/wheel.py b/src/fetchcode/vcs/pip/_internal/utils/wheel.py index 3544c6a9..531442d1 100644 --- a/src/fetchcode/vcs/pip/_internal/utils/wheel.py +++ b/src/fetchcode/vcs/pip/_internal/utils/wheel.py @@ -36,6 +36,7 @@ class WheelMetadata(DictMetadata): """Metadata provider that maps metadata decoding exceptions to our internal exception type. """ + def __init__(self, metadata, wheel_name): # type: (Dict[str, bytes], str) -> None super(WheelMetadata, self).__init__(metadata) @@ -48,9 +49,7 @@ def get_metadata(self, name): except UnicodeDecodeError as e: # Augment the default error with the origin of the file. raise UnsupportedWheel( - "Error decoding metadata for {}: {}".format( - self._wheel_name, e - ) + "Error decoding metadata for {}: {}".format(self._wheel_name, e) ) @@ -80,15 +79,11 @@ def pkg_resources_distribution_for_wheel(wheel_zip, name, location): wheel_zip, full_path ) except UnsupportedWheel as e: - raise UnsupportedWheel( - "{} has an invalid wheel, {}".format(name, str(e)) - ) + raise UnsupportedWheel("{} has an invalid wheel, {}".format(name, str(e))) metadata = WheelMetadata(metadata_text, location) - return DistInfoDistribution( - location=location, metadata=metadata, project_name=name - ) + return DistInfoDistribution(location=location, metadata=metadata, project_name=name) def parse_wheel(wheel_zip, name): @@ -103,9 +98,7 @@ def parse_wheel(wheel_zip, name): metadata = wheel_metadata(wheel_zip, info_dir) version = wheel_version(metadata) except UnsupportedWheel as e: - raise UnsupportedWheel( - "{} has an invalid wheel, {}".format(name, str(e)) - ) + raise UnsupportedWheel("{} has an invalid wheel, {}".format(name, str(e))) check_compatibility(version, name) @@ -122,16 +115,14 @@ def wheel_dist_info_dir(source, name): # Zip file path separators must be / subdirs = list(set(p.split("/")[0] for p in source.namelist())) - info_dirs = [s for s in subdirs if s.endswith('.dist-info')] + info_dirs = [s for s in subdirs if s.endswith(".dist-info")] if not info_dirs: raise UnsupportedWheel(".dist-info directory not found") if len(info_dirs) > 1: raise UnsupportedWheel( - "multiple .dist-info directories found: {}".format( - ", ".join(info_dirs) - ) + "multiple .dist-info directories found: {}".format(", ".join(info_dirs)) ) info_dir = info_dirs[0] @@ -157,9 +148,7 @@ def read_wheel_metadata_file(source, path): # BadZipFile for general corruption, KeyError for missing entry, # and RuntimeError for password-protected files except (BadZipFile, KeyError, RuntimeError) as e: - raise UnsupportedWheel( - "could not read {!r} file: {!r}".format(path, e) - ) + raise UnsupportedWheel("could not read {!r} file: {!r}".format(path, e)) def wheel_metadata(source, dist_info_dir): @@ -194,7 +183,7 @@ def wheel_version(wheel_data): version = version_text.strip() try: - return tuple(map(int, version.split('.'))) + return tuple(map(int, version.split("."))) except ValueError: raise UnsupportedWheel("invalid Wheel-Version: {!r}".format(version)) @@ -215,10 +204,10 @@ def check_compatibility(version, name): if version[0] > VERSION_COMPATIBLE[0]: raise UnsupportedWheel( "{}'s Wheel-Version ({}) is not compatible with this version " - "of pip".format(name, '.'.join(map(str, version))) + "of pip".format(name, ".".join(map(str, version))) ) elif version > VERSION_COMPATIBLE: logger.warning( - 'Installing from a newer Wheel-Version (%s)', - '.'.join(map(str, version)), + "Installing from a newer Wheel-Version (%s)", + ".".join(map(str, version)), ) diff --git a/src/fetchcode/vcs/pip/_internal/vcs/bazaar.py b/src/fetchcode/vcs/pip/_internal/vcs/bazaar.py index bd761bc7..274b1c92 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/bazaar.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/bazaar.py @@ -23,24 +23,29 @@ class Bazaar(VersionControl): - name = 'bzr' - dirname = '.bzr' - repo_name = 'branch' + name = "bzr" + dirname = ".bzr" + repo_name = "branch" schemes = ( - 'bzr', 'bzr+http', 'bzr+https', 'bzr+ssh', 'bzr+sftp', 'bzr+ftp', - 'bzr+lp', + "bzr", + "bzr+http", + "bzr+https", + "bzr+ssh", + "bzr+sftp", + "bzr+ftp", + "bzr+lp", ) def __init__(self, *args, **kwargs): super(Bazaar, self).__init__(*args, **kwargs) # This is only needed for python <2.7.5 # Register lp but do not expose as a scheme to support bzr+lp. - if getattr(urllib_parse, 'uses_fragment', None): - urllib_parse.uses_fragment.extend(['lp']) + if getattr(urllib_parse, "uses_fragment", None): + urllib_parse.uses_fragment.extend(["lp"]) @staticmethod def get_base_rev_args(rev): - return ['-r', rev] + return ["-r", rev] def export(self, location, url): # type: (str, HiddenText) -> None @@ -53,7 +58,7 @@ def export(self, location, url): url, rev_options = self.get_url_rev_options(url) self.run_command( - make_command('export', location, url, rev_options.to_args()), + make_command("export", location, url, rev_options.to_args()), show_stdout=False, ) @@ -61,23 +66,21 @@ def fetch_new(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None rev_display = rev_options.to_display() logger.info( - 'Checking out %s%s to %s', + "Checking out %s%s to %s", url, rev_display, display_path(dest), ) - cmd_args = ( - make_command('branch', '-q', rev_options.to_args(), url, dest) - ) + cmd_args = make_command("branch", "-q", rev_options.to_args(), url, dest) self.run_command(cmd_args) def switch(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None - self.run_command(make_command('switch', url), cwd=dest) + self.run_command(make_command("switch", url), cwd=dest) def update(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None - cmd_args = make_command('pull', '-q', rev_options.to_args()) + cmd_args = make_command("pull", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) @classmethod @@ -85,17 +88,16 @@ def get_url_rev_and_auth(cls, url): # type: (str) -> Tuple[str, Optional[str], AuthInfo] # hotfix the URL scheme after removing bzr+ from bzr+ssh:// readd it url, rev, user_pass = super(Bazaar, cls).get_url_rev_and_auth(url) - if url.startswith('ssh://'): - url = 'bzr+' + url + if url.startswith("ssh://"): + url = "bzr+" + url return url, rev, user_pass @classmethod def get_remote_url(cls, location): - urls = cls.run_command(['info'], show_stdout=False, cwd=location) + urls = cls.run_command(["info"], show_stdout=False, cwd=location) for line in urls.splitlines(): line = line.strip() - for x in ('checkout of branch: ', - 'parent branch: '): + for x in ("checkout of branch: ", "parent branch: "): if line.startswith(x): repo = line.split(x)[1] if cls._is_local_repository(repo): @@ -106,7 +108,9 @@ def get_remote_url(cls, location): @classmethod def get_revision(cls, location): revision = cls.run_command( - ['revno'], show_stdout=False, cwd=location, + ["revno"], + show_stdout=False, + cwd=location, ) return revision.splitlines()[-1] diff --git a/src/fetchcode/vcs/pip/_internal/vcs/git.py b/src/fetchcode/vcs/pip/_internal/vcs/git.py index ed3228e4..d6240d9b 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/git.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/git.py @@ -35,7 +35,7 @@ logger = logging.getLogger(__name__) -HASH_REGEX = re.compile('^[a-fA-F0-9]{40}$') +HASH_REGEX = re.compile("^[a-fA-F0-9]{40}$") def looks_like_hash(sha): @@ -43,16 +43,21 @@ def looks_like_hash(sha): class Git(VersionControl): - name = 'git' - dirname = '.git' - repo_name = 'clone' + name = "git" + dirname = ".git" + repo_name = "clone" schemes = ( - 'git', 'git+http', 'git+https', 'git+ssh', 'git+git', 'git+file', + "git", + "git+http", + "git+https", + "git+ssh", + "git+git", + "git+file", ) # Prevent the user's environment variables from interfering with pip: # https://github.com/pypa/pip/issues/1130 - unset_environ = ('GIT_DIR', 'GIT_WORK_TREE') - default_arg_rev = 'HEAD' + unset_environ = ("GIT_DIR", "GIT_WORK_TREE") + default_arg_rev = "HEAD" @staticmethod def get_base_rev_args(rev): @@ -70,22 +75,20 @@ def is_immutable_rev_checkout(self, url, dest): # return False in the rare case rev is both a commit hash # and a tag or a branch; we don't want to cache in that case # because that branch/tag could point to something else in the future - is_tag_or_branch = bool( - self.get_revision_sha(dest, rev_options.rev)[0] - ) + is_tag_or_branch = bool(self.get_revision_sha(dest, rev_options.rev)[0]) return not is_tag_or_branch def get_git_version(self): - VERSION_PFX = 'git version ' - version = self.run_command(['version'], show_stdout=False) + VERSION_PFX = "git version " + version = self.run_command(["version"], show_stdout=False) if version.startswith(VERSION_PFX): - version = version[len(VERSION_PFX):].split()[0] + version = version[len(VERSION_PFX) :].split()[0] else: - version = '' + version = "" # get first 3 positions of the git version because # on windows it is x.y.z.windows.t, and this parses as # LegacyVersion which always smaller than a Version. - version = '.'.join(version.split('.')[:3]) + version = ".".join(version.split(".")[:3]) return parse_version(version) @classmethod @@ -98,28 +101,32 @@ def get_current_branch(cls, location): # HEAD rather than a symbolic ref. In addition, the -q causes the # command to exit with status code 1 instead of 128 in this case # and to suppress the message to stderr. - args = ['symbolic-ref', '-q', 'HEAD'] + args = ["symbolic-ref", "-q", "HEAD"] output = cls.run_command( - args, extra_ok_returncodes=(1, ), show_stdout=False, cwd=location, + args, + extra_ok_returncodes=(1,), + show_stdout=False, + cwd=location, ) ref = output.strip() - if ref.startswith('refs/heads/'): - return ref[len('refs/heads/'):] + if ref.startswith("refs/heads/"): + return ref[len("refs/heads/") :] return None def export(self, location, url): # type: (str, HiddenText) -> None """Export the Git repository at the url to the destination location""" - if not location.endswith('/'): - location = location + '/' + if not location.endswith("/"): + location = location + "/" with TempDirectory(kind="export") as temp_dir: self.unpack(temp_dir.path, url=url) self.run_command( - ['checkout-index', '-a', '-f', '--prefix', location], - show_stdout=False, cwd=temp_dir.path + ["checkout-index", "-a", "-f", "--prefix", location], + show_stdout=False, + cwd=temp_dir.path, ) @classmethod @@ -133,8 +140,9 @@ def get_revision_sha(cls, dest, rev): rev: the revision name. """ # Pass rev to pre-filter the list. - output = cls.run_command(['show-ref', rev], cwd=dest, - show_stdout=False, on_returncode='ignore') + output = cls.run_command( + ["show-ref", rev], cwd=dest, show_stdout=False, on_returncode="ignore" + ) refs = {} for line in output.strip().splitlines(): try: @@ -142,12 +150,12 @@ def get_revision_sha(cls, dest, rev): except ValueError: # Include the offending line to simplify troubleshooting if # this error ever occurs. - raise ValueError('unexpected show-ref line: {!r}'.format(line)) + raise ValueError("unexpected show-ref line: {!r}".format(line)) refs[ref] = sha - branch_ref = 'refs/remotes/origin/{}'.format(rev) - tag_ref = 'refs/tags/{}'.format(rev) + branch_ref = "refs/remotes/origin/{}".format(rev) + tag_ref = "refs/tags/{}".format(rev) sha = refs.get(branch_ref) if sha is not None: @@ -188,16 +196,16 @@ def resolve_revision(cls, dest, url, rev_options): rev, ) - if not rev.startswith('refs/'): + if not rev.startswith("refs/"): return rev_options # If it looks like a ref, we have to fetch it explicitly. cls.run_command( - make_command('fetch', '-q', url, rev_options.to_args()), + make_command("fetch", "-q", url, rev_options.to_args()), cwd=dest, ) # Change the revision to the SHA of the ref we fetched - sha = cls.get_revision(dest, rev='FETCH_HEAD') + sha = cls.get_revision(dest, rev="FETCH_HEAD") rev_options = rev_options.make_new(sha) return rev_options @@ -220,27 +228,33 @@ def is_commit_id_equal(cls, dest, name): def fetch_new(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None rev_display = rev_options.to_display() - logger.info('Cloning %s%s to %s', url, rev_display, display_path(dest)) - self.run_command(make_command('clone', '-q', url, dest)) + logger.info("Cloning %s%s to %s", url, rev_display, display_path(dest)) + self.run_command(make_command("clone", "-q", url, dest)) if rev_options.rev: # Then a specific revision was requested. rev_options = self.resolve_revision(dest, url, rev_options) - branch_name = getattr(rev_options, 'branch_name', None) + branch_name = getattr(rev_options, "branch_name", None) if branch_name is None: # Only do a checkout if the current commit id doesn't match # the requested revision. if not self.is_commit_id_equal(dest, rev_options.rev): cmd_args = make_command( - 'checkout', '-q', rev_options.to_args(), + "checkout", + "-q", + rev_options.to_args(), ) self.run_command(cmd_args, cwd=dest) elif self.get_current_branch(dest) != branch_name: # Then a specific branch was requested, and that branch # is not yet checked out. - track_branch = 'origin/{}'.format(branch_name) + track_branch = "origin/{}".format(branch_name) cmd_args = [ - 'checkout', '-b', branch_name, '--track', track_branch, + "checkout", + "-b", + branch_name, + "--track", + track_branch, ] self.run_command(cmd_args, cwd=dest) @@ -250,10 +264,10 @@ def fetch_new(self, dest, url, rev_options): def switch(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None self.run_command( - make_command('config', 'remote.origin.url', url), + make_command("config", "remote.origin.url", url), cwd=dest, ) - cmd_args = make_command('checkout', '-q', rev_options.to_args()) + cmd_args = make_command("checkout", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) self.update_submodules(dest) @@ -261,14 +275,14 @@ def switch(self, dest, url, rev_options): def update(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None # First fetch changes from the default remote - if self.get_git_version() >= parse_version('1.9.0'): + if self.get_git_version() >= parse_version("1.9.0"): # fetch tags in addition to everything else - self.run_command(['fetch', '-q', '--tags'], cwd=dest) + self.run_command(["fetch", "-q", "--tags"], cwd=dest) else: - self.run_command(['fetch', '-q'], cwd=dest) + self.run_command(["fetch", "-q"], cwd=dest) # Then reset to wanted revision (maybe even origin/master) rev_options = self.resolve_revision(dest, url, rev_options) - cmd_args = make_command('reset', '--hard', '-q', rev_options.to_args()) + cmd_args = make_command("reset", "--hard", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) #: update submodules self.update_submodules(dest) @@ -284,8 +298,10 @@ def get_remote_url(cls, location): # We need to pass 1 for extra_ok_returncodes since the command # exits with return code 1 if there are no matching lines. stdout = cls.run_command( - ['config', '--get-regexp', r'remote\..*\.url'], - extra_ok_returncodes=(1, ), show_stdout=False, cwd=location, + ["config", "--get-regexp", r"remote\..*\.url"], + extra_ok_returncodes=(1,), + show_stdout=False, + cwd=location, ) remotes = stdout.splitlines() try: @@ -294,18 +310,20 @@ def get_remote_url(cls, location): raise RemoteNotFoundError for remote in remotes: - if remote.startswith('remote.origin.url '): + if remote.startswith("remote.origin.url "): found_remote = remote break - url = found_remote.split(' ')[1] + url = found_remote.split(" ")[1] return url.strip() @classmethod def get_revision(cls, location, rev=None): if rev is None: - rev = 'HEAD' + rev = "HEAD" current_rev = cls.run_command( - ['rev-parse', rev], show_stdout=False, cwd=location, + ["rev-parse", rev], + show_stdout=False, + cwd=location, ) return current_rev.strip() @@ -317,11 +335,11 @@ def get_subdirectory(cls, location): """ # find the repo root git_dir = cls.run_command( - ['rev-parse', '--git-dir'], - show_stdout=False, cwd=location).strip() + ["rev-parse", "--git-dir"], show_stdout=False, cwd=location + ).strip() if not os.path.isabs(git_dir): git_dir = os.path.join(location, git_dir) - repo_root = os.path.abspath(os.path.join(git_dir, '..')) + repo_root = os.path.abspath(os.path.join(git_dir, "..")) return find_path_to_setup_from_repo_root(location, repo_root) @classmethod @@ -336,24 +354,22 @@ def get_url_rev_and_auth(cls, url): # Works around an apparent Git bug # (see https://article.gmane.org/gmane.comp.version-control.git/146500) scheme, netloc, path, query, fragment = urlsplit(url) - if scheme.endswith('file'): - initial_slashes = path[:-len(path.lstrip('/'))] - newpath = ( - initial_slashes + - urllib_request.url2pathname(path) - .replace('\\', '/').lstrip('/') - ) + if scheme.endswith("file"): + initial_slashes = path[: -len(path.lstrip("/"))] + newpath = initial_slashes + urllib_request.url2pathname(path).replace( + "\\", "/" + ).lstrip("/") url = urlunsplit((scheme, netloc, newpath, query, fragment)) - after_plus = scheme.find('+') + 1 + after_plus = scheme.find("+") + 1 url = scheme[:after_plus] + urlunsplit( (scheme[after_plus:], netloc, newpath, query, fragment), ) - if '://' not in url: - assert 'file:' not in url - url = url.replace('git+', 'git+ssh://') + if "://" not in url: + assert "file:" not in url + url = url.replace("git+", "git+ssh://") url, rev, user_pass = super(Git, cls).get_url_rev_and_auth(url) - url = url.replace('ssh://', '') + url = url.replace("ssh://", "") else: url, rev, user_pass = super(Git, cls).get_url_rev_and_auth(url) @@ -361,10 +377,10 @@ def get_url_rev_and_auth(cls, url): @classmethod def update_submodules(cls, location): - if not os.path.exists(os.path.join(location, '.gitmodules')): + if not os.path.exists(os.path.join(location, ".gitmodules")): return cls.run_command( - ['submodule', 'update', '--init', '--recursive', '-q'], + ["submodule", "update", "--init", "--recursive", "-q"], cwd=location, ) @@ -375,19 +391,22 @@ def get_repository_root(cls, location): return loc try: r = cls.run_command( - ['rev-parse', '--show-toplevel'], + ["rev-parse", "--show-toplevel"], cwd=location, show_stdout=False, - on_returncode='raise', + on_returncode="raise", log_failed_cmd=False, ) except BadCommand: - logger.debug("could not determine if %s is under git control " - "because git is not available", location) + logger.debug( + "could not determine if %s is under git control " + "because git is not available", + location, + ) return None except InstallationError: return None - return os.path.normpath(r.rstrip('\r\n')) + return os.path.normpath(r.rstrip("\r\n")) vcs.register(Git) diff --git a/src/fetchcode/vcs/pip/_internal/vcs/mercurial.py b/src/fetchcode/vcs/pip/_internal/vcs/mercurial.py index cff64fa3..a75631ff 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/mercurial.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/mercurial.py @@ -28,11 +28,16 @@ class Mercurial(VersionControl): - name = 'hg' - dirname = '.hg' - repo_name = 'clone' + name = "hg" + dirname = ".hg" + repo_name = "clone" schemes = ( - 'hg', 'hg+file', 'hg+http', 'hg+https', 'hg+ssh', 'hg+static-http', + "hg", + "hg+file", + "hg+http", + "hg+https", + "hg+ssh", + "hg+static-http", ) @staticmethod @@ -46,52 +51,54 @@ def export(self, location, url): self.unpack(temp_dir.path, url=url) self.run_command( - ['archive', location], show_stdout=False, cwd=temp_dir.path + ["archive", location], show_stdout=False, cwd=temp_dir.path ) def fetch_new(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None rev_display = rev_options.to_display() logger.info( - 'Cloning hg %s%s to %s', + "Cloning hg %s%s to %s", url, rev_display, display_path(dest), ) - self.run_command(make_command('clone', '--noupdate', '-q', url, dest)) + self.run_command(make_command("clone", "--noupdate", "-q", url, dest)) self.run_command( - make_command('update', '-q', rev_options.to_args()), + make_command("update", "-q", rev_options.to_args()), cwd=dest, ) def switch(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None - repo_config = os.path.join(dest, self.dirname, 'hgrc') + repo_config = os.path.join(dest, self.dirname, "hgrc") config = configparser.RawConfigParser() try: config.read(repo_config) - config.set('paths', 'default', url.secret) - with open(repo_config, 'w') as config_file: + config.set("paths", "default", url.secret) + with open(repo_config, "w") as config_file: config.write(config_file) except (OSError, configparser.NoSectionError) as exc: logger.warning( - 'Could not switch Mercurial repository to %s: %s', url, exc, + "Could not switch Mercurial repository to %s: %s", + url, + exc, ) else: - cmd_args = make_command('update', '-q', rev_options.to_args()) + cmd_args = make_command("update", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) def update(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None - self.run_command(['pull', '-q'], cwd=dest) - cmd_args = make_command('update', '-q', rev_options.to_args()) + self.run_command(["pull", "-q"], cwd=dest) + cmd_args = make_command("update", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) @classmethod def get_remote_url(cls, location): url = cls.run_command( - ['showconfig', 'paths.default'], - show_stdout=False, cwd=location).strip() + ["showconfig", "paths.default"], show_stdout=False, cwd=location + ).strip() if cls._is_local_repository(url): url = path_to_url(url) return url.strip() @@ -102,8 +109,8 @@ def get_revision(cls, location): Return the repository-local changeset revision number, as an integer. """ current_revision = cls.run_command( - ['parents', '--template={rev}'], - show_stdout=False, cwd=location).strip() + ["parents", "--template={rev}"], show_stdout=False, cwd=location + ).strip() return current_revision @classmethod @@ -113,8 +120,8 @@ def get_requirement_revision(cls, location): hexadecimal string """ current_rev_hash = cls.run_command( - ['parents', '--template={node}'], - show_stdout=False, cwd=location).strip() + ["parents", "--template={node}"], show_stdout=False, cwd=location + ).strip() return current_rev_hash @classmethod @@ -129,8 +136,7 @@ def get_subdirectory(cls, location): Return None if setup.py is in the repo root. """ # find the repo root - repo_root = cls.run_command( - ['root'], show_stdout=False, cwd=location).strip() + repo_root = cls.run_command(["root"], show_stdout=False, cwd=location).strip() if not os.path.isabs(repo_root): repo_root = os.path.abspath(os.path.join(location, repo_root)) return find_path_to_setup_from_repo_root(location, repo_root) @@ -142,19 +148,22 @@ def get_repository_root(cls, location): return loc try: r = cls.run_command( - ['root'], + ["root"], cwd=location, show_stdout=False, - on_returncode='raise', + on_returncode="raise", log_failed_cmd=False, ) except BadCommand: - logger.debug("could not determine if %s is under hg control " - "because hg is not available", location) + logger.debug( + "could not determine if %s is under hg control " + "because hg is not available", + location, + ) return None except InstallationError: return None - return os.path.normpath(r.rstrip('\r\n')) + return os.path.normpath(r.rstrip("\r\n")) vcs.register(Mercurial) diff --git a/src/fetchcode/vcs/pip/_internal/vcs/subversion.py b/src/fetchcode/vcs/pip/_internal/vcs/subversion.py index 50169616..3b702010 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/subversion.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/subversion.py @@ -20,7 +20,7 @@ _svn_xml_url_re = re.compile('url="([^"]+)"') _svn_rev_re = re.compile(r'committed-rev="(\d+)"') _svn_info_xml_rev_re = re.compile(r'\s*revision="(\d+)"') -_svn_info_xml_url_re = re.compile(r'(.*)') +_svn_info_xml_url_re = re.compile(r"(.*)") if MYPY_CHECK_RUNNING: @@ -34,10 +34,10 @@ class Subversion(VersionControl): - name = 'svn' - dirname = '.svn' - repo_name = 'checkout' - schemes = ('svn', 'svn+ssh', 'svn+http', 'svn+https', 'svn+svn') + name = "svn" + dirname = ".svn" + repo_name = "checkout" + schemes = ("svn", "svn+ssh", "svn+http", "svn+https", "svn+svn") @classmethod def should_add_vcs_url_prefix(cls, remote_url): @@ -45,7 +45,7 @@ def should_add_vcs_url_prefix(cls, remote_url): @staticmethod def get_base_rev_args(rev): - return ['-r', rev] + return ["-r", rev] @classmethod def get_revision(cls, location): @@ -58,9 +58,9 @@ def get_revision(cls, location): for base, dirs, files in os.walk(location): if cls.dirname not in dirs: dirs[:] = [] - continue # no sense walking uncontrolled subdirs + continue # no sense walking uncontrolled subdirs dirs.remove(cls.dirname) - entries_fn = os.path.join(base, cls.dirname, 'entries') + entries_fn = os.path.join(base, cls.dirname, "entries") if not os.path.exists(entries_fn): # FIXME: should we warn? continue @@ -68,10 +68,10 @@ def get_revision(cls, location): dirurl, localrev = cls._get_svn_url_rev(base) if base == location: - base = dirurl + '/' # save the root url + base = dirurl + "/" # save the root url elif not dirurl or not dirurl.startswith(base): dirs[:] = [] - continue # not part of the same svn tree, skip it + continue # not part of the same svn tree, skip it revision = max(revision, localrev) return revision @@ -81,7 +81,7 @@ def get_netloc_and_auth(cls, netloc, scheme): This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. """ - if scheme == 'ssh': + if scheme == "ssh": # The --username and --password options can't be used for # svn+ssh URLs, so keep the auth information in the URL. return super(Subversion, cls).get_netloc_and_auth(netloc, scheme) @@ -93,8 +93,8 @@ def get_url_rev_and_auth(cls, url): # type: (str) -> Tuple[str, Optional[str], AuthInfo] # hotfix the URL scheme after removing svn+ from svn+ssh:// readd it url, rev, user_pass = super(Subversion, cls).get_url_rev_and_auth(url) - if url.startswith('ssh://'): - url = 'svn+' + url + if url.startswith("ssh://"): + url = "svn+" + url return url, rev, user_pass @staticmethod @@ -102,9 +102,9 @@ def make_rev_args(username, password): # type: (Optional[str], Optional[HiddenText]) -> CommandArgs extra_args = [] # type: CommandArgs if username: - extra_args += ['--username', username] + extra_args += ["--username", username] if password: - extra_args += ['--password', password] + extra_args += ["--password", password] return extra_args @@ -114,7 +114,7 @@ def get_remote_url(cls, location): # setup.py we have to look up in the location until we find a real # setup.py orig_location = location - while not os.path.exists(os.path.join(location, 'setup.py')): + while not os.path.exists(os.path.join(location, "setup.py")): last_location = location location = os.path.dirname(location) if location == last_location: @@ -133,26 +133,23 @@ def get_remote_url(cls, location): def _get_svn_url_rev(cls, location): from fetchcode.vcs.pip._internal.exceptions import InstallationError - entries_path = os.path.join(location, cls.dirname, 'entries') + entries_path = os.path.join(location, cls.dirname, "entries") if os.path.exists(entries_path): with open(entries_path) as f: data = f.read() else: # subversion >= 1.7 does not have the 'entries' file - data = '' + data = "" - if (data.startswith('8') or - data.startswith('9') or - data.startswith('10')): - data = list(map(str.splitlines, data.split('\n\x0c\n'))) + if data.startswith("8") or data.startswith("9") or data.startswith("10"): + data = list(map(str.splitlines, data.split("\n\x0c\n"))) del data[0][0] # get rid of the '8' url = data[0][3] revs = [int(d[9]) for d in data if len(d) > 9 and d[9]] + [0] - elif data.startswith('= 1.8 runs in non-interactive mode if @@ -277,7 +272,7 @@ def get_remote_call_options(self): # SVN 1.7, pip should continue to support SVN 1.7. Therefore, pip # can't safely add the option if the SVN version is < 1.8 (or unknown). if svn_version >= (1, 8): - return ['--force-interactive'] + return ["--force-interactive"] return [] @@ -286,15 +281,18 @@ def export(self, location, url): """Export the svn repository at the url to the destination location""" url, rev_options = self.get_url_rev_options(url) - logger.info('Exporting svn repository %s to %s', url, location) + logger.info("Exporting svn repository %s to %s", url, location) with indent_log(): if os.path.exists(location): # Subversion doesn't like to check out over an existing # directory --force fixes this, but was only added in svn 1.5 rmtree(location) cmd_args = make_command( - 'export', self.get_remote_call_options(), - rev_options.to_args(), url, location, + "export", + self.get_remote_call_options(), + rev_options.to_args(), + url, + location, ) self.run_command(cmd_args, show_stdout=False) @@ -302,29 +300,38 @@ def fetch_new(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None rev_display = rev_options.to_display() logger.info( - 'Checking out %s%s to %s', + "Checking out %s%s to %s", url, rev_display, display_path(dest), ) cmd_args = make_command( - 'checkout', '-q', self.get_remote_call_options(), - rev_options.to_args(), url, dest, + "checkout", + "-q", + self.get_remote_call_options(), + rev_options.to_args(), + url, + dest, ) self.run_command(cmd_args) def switch(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None cmd_args = make_command( - 'switch', self.get_remote_call_options(), rev_options.to_args(), - url, dest, + "switch", + self.get_remote_call_options(), + rev_options.to_args(), + url, + dest, ) self.run_command(cmd_args) def update(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None cmd_args = make_command( - 'update', self.get_remote_call_options(), rev_options.to_args(), + "update", + self.get_remote_call_options(), + rev_options.to_args(), dest, ) self.run_command(cmd_args) diff --git a/src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py b/src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py index 09474710..4a0bbfec 100644 --- a/src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py +++ b/src/fetchcode/vcs/pip/_internal/vcs/versioncontrol.py @@ -26,8 +26,17 @@ if MYPY_CHECK_RUNNING: from typing import ( - Any, Dict, Iterable, Iterator, List, Mapping, Optional, Text, Tuple, - Type, Union + Any, + Dict, + Iterable, + Iterator, + List, + Mapping, + Optional, + Text, + Tuple, + Type, + Union, ) from fetchcode.vcs.pip._internal.cli.spinners import SpinnerInterface from fetchcode.vcs.pip._internal.utils.misc import HiddenText @@ -36,7 +45,7 @@ AuthInfo = Tuple[Optional[str], Optional[str]] -__all__ = ['vcs'] +__all__ = ["vcs"] logger = logging.getLogger(__name__) @@ -50,7 +59,7 @@ def is_url(name): scheme = get_url_scheme(name) if scheme is None: return False - return scheme in ['http', 'https', 'file', 'ftp'] + vcs.all_schemes + return scheme in ["http", "https", "file", "ftp"] + vcs.all_schemes def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None): @@ -63,9 +72,9 @@ def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None): project_name: the (unescaped) project name. """ egg_project_name = pkg_resources.to_filename(project_name) - req = '{}@{}#egg={}'.format(repo_url, rev, egg_project_name) + req = "{}@{}#egg={}".format(repo_url, rev, egg_project_name) if subdir: - req += '&subdirectory={}'.format(subdir) + req += "&subdirectory={}".format(subdir) return req @@ -79,7 +88,7 @@ def find_path_to_setup_from_repo_root(location, repo_root): """ # find setup.py orig_location = location - while not os.path.exists(os.path.join(location, 'setup.py')): + while not os.path.exists(os.path.join(location, "setup.py")): last_location = location location = os.path.dirname(location) if location == last_location: @@ -134,7 +143,7 @@ def __init__( def __repr__(self): # type: () -> str - return ''.format(self.vc_class.name, self.rev) + return "".format(self.vc_class.name, self.rev) @property def arg_rev(self): @@ -160,9 +169,9 @@ def to_args(self): def to_display(self): # type: () -> str if not self.rev: - return '' + return "" - return ' (to revision {})'.format(self.rev) + return " (to revision {})".format(self.rev) def make_new(self, rev): # type: (str) -> RevOptions @@ -177,7 +186,7 @@ def make_new(self, rev): class VcsSupport(object): _registry = {} # type: Dict[str, VersionControl] - schemes = ['ssh', 'git', 'hg', 'bzr', 'sftp', 'svn'] + schemes = ["ssh", "git", "hg", "bzr", "sftp", "svn"] def __init__(self): # type: () -> None @@ -185,7 +194,7 @@ def __init__(self): # systems urllib_parse.uses_netloc.extend(self.schemes) # Python >= 2.7.4, 3.3 doesn't have uses_fragment - if getattr(urllib_parse, 'uses_fragment', None): + if getattr(urllib_parse, "uses_fragment", None): urllib_parse.uses_fragment.extend(self.schemes) super(VcsSupport, self).__init__() @@ -213,12 +222,12 @@ def all_schemes(self): def register(self, cls): # type: (Type[VersionControl]) -> None - if not hasattr(cls, 'name'): - logger.warning('Cannot register VCS %s', cls.__name__) + if not hasattr(cls, "name"): + logger.warning("Cannot register VCS %s", cls.__name__) return if cls.name not in self._registry: self._registry[cls.name] = cls() - logger.debug('Registered VCS backend: %s', cls.name) + logger.debug("Registered VCS backend: %s", cls.name) def unregister(self, name): # type: (str) -> None @@ -236,8 +245,7 @@ def get_backend_for_dir(self, location): repo_path = vcs_backend.get_repository_root(location) if not repo_path: continue - logger.debug('Determine that %s uses VCS: %s', - location, vcs_backend.name) + logger.debug("Determine that %s uses VCS: %s", location, vcs_backend.name) vcs_backends[repo_path] = vcs_backend if not vcs_backends: @@ -273,9 +281,9 @@ def get_backend(self, name): class VersionControl(object): - name = '' - dirname = '' - repo_name = '' + name = "" + dirname = "" + repo_name = "" # List of supported schemes for this Version Control schemes = () # type: Tuple[str, ...] # Iterable of environment variable names to pass to call_subprocess(). @@ -289,7 +297,7 @@ def should_add_vcs_url_prefix(cls, remote_url): Return whether the vcs prefix (e.g. "git+") should be added to a repository's remote url when used in a requirement. """ - return not remote_url.lower().startswith('{}:'.format(cls.name)) + return not remote_url.lower().startswith("{}:".format(cls.name)) @classmethod def get_subdirectory(cls, location): @@ -327,12 +335,11 @@ def get_src_requirement(cls, repo_dir, project_name): return None if cls.should_add_vcs_url_prefix(repo_url): - repo_url = '{}+{}'.format(cls.name, repo_url) + repo_url = "{}+{}".format(cls.name, repo_url) revision = cls.get_requirement_revision(repo_dir) subdir = cls.get_subdirectory(repo_dir) - req = make_vcs_requirement_url(repo_url, revision, project_name, - subdir=subdir) + req = make_vcs_requirement_url(repo_url, revision, project_name, subdir=subdir) return req @@ -377,8 +384,8 @@ def make_rev_options(cls, rev=None, extra_args=None): def _is_local_repository(cls, repo): # type: (str) -> bool """ - posix absolute paths start with os.path.sep, - win32 ones start with drive (like c:\\folder) + posix absolute paths start with os.path.sep, + win32 ones start with drive (like c:\\folder) """ drive, tail = os.path.splitdrive(repo) return repo.startswith(os.path.sep) or bool(drive) @@ -423,25 +430,25 @@ def get_url_rev_and_auth(cls, url): Returns: (url, rev, (username, password)). """ scheme, netloc, path, query, frag = urllib_parse.urlsplit(url) - if '+' not in scheme: + if "+" not in scheme: raise ValueError( "Sorry, {!r} is a malformed VCS url. " "The format is +://, " "e.g. svn+http://myrepo/svn/MyApp#egg=MyApp".format(url) ) # Remove the vcs prefix. - scheme = scheme.split('+', 1)[1] + scheme = scheme.split("+", 1)[1] netloc, user_pass = cls.get_netloc_and_auth(netloc, scheme) rev = None - if '@' in path: - path, rev = path.rsplit('@', 1) + if "@" in path: + path, rev = path.rsplit("@", 1) if not rev: raise InstallationError( "The URL {!r} has an empty revision (after @) " "which is not supported. Include a revision after @ " "or remove @ from the URL.".format(url) ) - url = urllib_parse.urlunsplit((scheme, netloc, path, query, '')) + url = urllib_parse.urlunsplit((scheme, netloc, path, query, "")) return url, rev, user_pass @staticmethod @@ -475,7 +482,7 @@ def normalize_url(url): Normalize a URL for comparison by unquoting it and removing any trailing slash. """ - return urllib_parse.unquote(url).rstrip('/') + return urllib_parse.unquote(url).rstrip("/") @classmethod def compare_urls(cls, url1, url2): @@ -483,7 +490,7 @@ def compare_urls(cls, url1, url2): """ Compare two repo URLs for identity, ignoring incidental differences. """ - return (cls.normalize_url(url1) == cls.normalize_url(url2)) + return cls.normalize_url(url1) == cls.normalize_url(url2) def fetch_new(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None @@ -549,45 +556,43 @@ def obtain(self, dest, url): existing_url = self.get_remote_url(dest) if self.compare_urls(existing_url, url.secret): logger.debug( - '%s in %s exists, and has correct URL (%s)', + "%s in %s exists, and has correct URL (%s)", self.repo_name.title(), display_path(dest), url, ) if not self.is_commit_id_equal(dest, rev_options.rev): logger.info( - 'Updating %s %s%s', + "Updating %s %s%s", display_path(dest), self.repo_name, rev_display, ) self.update(dest, url, rev_options) else: - logger.info('Skipping because already up-to-date.') + logger.info("Skipping because already up-to-date.") return logger.warning( - '%s %s in %s exists with URL %s', + "%s %s in %s exists with URL %s", self.name, self.repo_name, display_path(dest), existing_url, ) - prompt = ('(s)witch, (i)gnore, (w)ipe, (b)ackup ', - ('s', 'i', 'w', 'b')) + prompt = ("(s)witch, (i)gnore, (w)ipe, (b)ackup ", ("s", "i", "w", "b")) else: logger.warning( - 'Directory %s already exists, and is not a %s %s.', + "Directory %s already exists, and is not a %s %s.", dest, self.name, self.repo_name, ) # https://github.com/python/mypy/issues/1174 - prompt = ('(i)gnore, (w)ipe, (b)ackup ', # type: ignore - ('i', 'w', 'b')) + prompt = ("(i)gnore, (w)ipe, (b)ackup ", ("i", "w", "b")) # type: ignore logger.warning( - 'The plan is to install the %s repository %s', + "The plan is to install the %s repository %s", self.name, url, ) @@ -660,12 +665,12 @@ def run_command( cmd, # type: Union[List[str], CommandArgs] show_stdout=True, # type: bool cwd=None, # type: Optional[str] - on_returncode='raise', # type: str + on_returncode="raise", # type: str extra_ok_returncodes=None, # type: Optional[Iterable[int]] command_desc=None, # type: Optional[str] extra_environ=None, # type: Optional[Mapping[str, Any]] spinner=None, # type: Optional[SpinnerInterface] - log_failed_cmd=True # type: bool + log_failed_cmd=True, # type: bool ): # type: (...) -> Text """ @@ -675,22 +680,27 @@ def run_command( """ cmd = make_command(cls.name, *cmd) try: - return call_subprocess(cmd, show_stdout, cwd, - on_returncode=on_returncode, - extra_ok_returncodes=extra_ok_returncodes, - command_desc=command_desc, - extra_environ=extra_environ, - unset_environ=cls.unset_environ, - spinner=spinner, - log_failed_cmd=log_failed_cmd) + return call_subprocess( + cmd, + show_stdout, + cwd, + on_returncode=on_returncode, + extra_ok_returncodes=extra_ok_returncodes, + command_desc=command_desc, + extra_environ=extra_environ, + unset_environ=cls.unset_environ, + spinner=spinner, + log_failed_cmd=log_failed_cmd, + ) except OSError as e: # errno.ENOENT = no such file or directory # In other words, the VCS executable isn't available if e.errno == errno.ENOENT: raise BadCommand( - 'Cannot find command {cls.name!r} - do you have ' - '{cls.name!r} installed and in your ' - 'PATH?'.format(**locals())) + "Cannot find command {cls.name!r} - do you have " + "{cls.name!r} installed and in your " + "PATH?".format(**locals()) + ) else: raise # re-raise exception if a different error occurred @@ -700,8 +710,7 @@ def is_repository_directory(cls, path): """ Return whether a directory path is a repository directory. """ - logger.debug('Checking in %s for %s (%s)...', - path, cls.dirname, cls.name) + logger.debug("Checking in %s for %s (%s)...", path, cls.dirname, cls.name) return os.path.exists(os.path.join(path, cls.dirname)) @classmethod diff --git a/src/fetchcode/vcs/pip/_internal/wheel_builder.py b/src/fetchcode/vcs/pip/_internal/wheel_builder.py index 329a9627..d2185f1f 100644 --- a/src/fetchcode/vcs/pip/_internal/wheel_builder.py +++ b/src/fetchcode/vcs/pip/_internal/wheel_builder.py @@ -13,8 +13,14 @@ from fetchcode.vcs.pip._internal.operations.build.wheel import build_wheel_pep517 from fetchcode.vcs.pip._internal.operations.build.wheel_legacy import build_wheel_legacy from fetchcode.vcs.pip._internal.utils.logging import indent_log -from fetchcode.vcs.pip._internal.utils.misc import ensure_dir, hash_file, is_wheel_installed -from fetchcode.vcs.pip._internal.utils.setuptools_build import make_setuptools_clean_args +from fetchcode.vcs.pip._internal.utils.misc import ( + ensure_dir, + hash_file, + is_wheel_installed, +) +from fetchcode.vcs.pip._internal.utils.setuptools_build import ( + make_setuptools_clean_args, +) from fetchcode.vcs.pip._internal.utils.subprocess import call_subprocess from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectory from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING @@ -23,7 +29,13 @@ if MYPY_CHECK_RUNNING: from typing import ( - Any, Callable, Iterable, List, Optional, Pattern, Tuple, + Any, + Callable, + Iterable, + List, + Optional, + Pattern, + Tuple, ) from fetchcode.vcs.pip._internal.cache import WheelCache @@ -36,7 +48,8 @@ def _contains_egg_info( - s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)): + s, _egg_info_re=re.compile(r"([a-z0-9_.]+)-([a-z0-9_.!+-]+)", re.I) +): # type: (str, Pattern[str]) -> bool """Determine whether the string looks like an egg_info. @@ -58,7 +71,8 @@ def _should_build( if req.is_wheel: if need_wheel: logger.info( - 'Skipping %s, due to already being wheel.', req.name, + "Skipping %s, due to already being wheel.", + req.name, ) return False @@ -74,8 +88,8 @@ def _should_build( if not check_binary_allowed(req): logger.info( - "Skipping wheel build for %s, due to binaries " - "being disabled for it.", req.name, + "Skipping wheel build for %s, due to binaries " "being disabled for it.", + req.name, ) return False @@ -83,7 +97,8 @@ def _should_build( # we don't build legacy requirements if wheel is not installed logger.info( "Using legacy setup.py install for %s, " - "since package 'wheel' is not installed.", req.name, + "since package 'wheel' is not installed.", + req.name, ) return False @@ -94,9 +109,7 @@ def should_build_for_wheel_command( req, # type: InstallRequirement ): # type: (...) -> bool - return _should_build( - req, need_wheel=True, check_binary_allowed=_always_true - ) + return _should_build(req, need_wheel=True, check_binary_allowed=_always_true) def should_build_for_install_command( @@ -118,9 +131,7 @@ def _should_cache( wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built. """ - if not should_build_for_install_command( - req, check_binary_allowed=_always_true - ): + if not should_build_for_install_command(req, check_binary_allowed=_always_true): # never cache if pip install would not have built # (editable mode, etc) return False @@ -181,15 +192,14 @@ def _build_one( except OSError as e: logger.warning( "Building wheel for %s failed: %s", - req.name, e, + req.name, + e, ) return None # Install build deps into temporary directory (PEP 518) with req.build_env: - return _build_one_inside_env( - req, output_dir, build_options, global_options - ) + return _build_one_inside_env(req, output_dir, build_options, global_options) def _build_one_inside_env( @@ -224,16 +234,20 @@ def _build_one_inside_env( try: wheel_hash, length = hash_file(wheel_path) shutil.move(wheel_path, dest_path) - logger.info('Created wheel for %s: ' - 'filename=%s size=%d sha256=%s', - req.name, wheel_name, length, - wheel_hash.hexdigest()) - logger.info('Stored in directory: %s', output_dir) + logger.info( + "Created wheel for %s: " "filename=%s size=%d sha256=%s", + req.name, + wheel_name, + length, + wheel_hash.hexdigest(), + ) + logger.info("Stored in directory: %s", output_dir) return dest_path except Exception as e: logger.warning( "Building wheel for %s failed: %s", - req.name, e, + req.name, + e, ) # Ignore return, we can't do anything else useful. if not req.use_pep517: @@ -248,12 +262,12 @@ def _clean_one_legacy(req, global_options): global_options=global_options, ) - logger.info('Running setup.py clean for %s', req.name) + logger.info("Running setup.py clean for %s", req.name) try: call_subprocess(clean_args, cwd=req.source_dir) return True except Exception: - logger.error('Failed cleaning build dir for %s', req.name) + logger.error("Failed cleaning build dir for %s", req.name) return False @@ -274,17 +288,15 @@ def build( # Build the wheels. logger.info( - 'Building wheels for collected packages: %s', - ', '.join(req.name for req in requirements), + "Building wheels for collected packages: %s", + ", ".join(req.name for req in requirements), ) with indent_log(): build_successes, build_failures = [], [] for req in requirements: cache_dir = _get_cache_dir(req, wheel_cache) - wheel_file = _build_one( - req, cache_dir, build_options, global_options - ) + wheel_file = _build_one(req, cache_dir, build_options, global_options) if wheel_file: # Update the link for this. req.link = Link(path_to_url(wheel_file)) @@ -297,13 +309,13 @@ def build( # notify success/failure if build_successes: logger.info( - 'Successfully built %s', - ' '.join([req.name for req in build_successes]), + "Successfully built %s", + " ".join([req.name for req in build_successes]), ) if build_failures: logger.info( - 'Failed to build %s', - ' '.join([req.name for req in build_failures]), + "Failed to build %s", + " ".join([req.name for req in build_failures]), ) # Return a list of requirements that failed to build return build_successes, build_failures diff --git a/src/fetchcode/vcs/pip/_vendor/__init__.py b/src/fetchcode/vcs/pip/_vendor/__init__.py index 1ae96108..b08dbc12 100644 --- a/src/fetchcode/vcs/pip/_vendor/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/__init__.py @@ -93,8 +93,7 @@ def vendored(modulename): vendored("requests.packages.urllib3.packages.ordered_dict") vendored("requests.packages.urllib3.packages.six") vendored("requests.packages.urllib3.packages.ssl_match_hostname") - vendored("requests.packages.urllib3.packages.ssl_match_hostname." - "_implementation") + vendored("requests.packages.urllib3.packages.ssl_match_hostname." "_implementation") vendored("requests.packages.urllib3.poolmanager") vendored("requests.packages.urllib3.request") vendored("requests.packages.urllib3.response") diff --git a/src/fetchcode/vcs/pip/_vendor/appdirs.py b/src/fetchcode/vcs/pip/_vendor/appdirs.py index 8bd9c9ca..3279d8c4 100644 --- a/src/fetchcode/vcs/pip/_vendor/appdirs.py +++ b/src/fetchcode/vcs/pip/_vendor/appdirs.py @@ -14,7 +14,7 @@ # - XDG spec for Un*x: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html __version_info__ = (1, 4, 3) -__version__ = '.'.join(map(str, __version_info__)) +__version__ = ".".join(map(str, __version_info__)) import sys @@ -25,27 +25,27 @@ if PY3: unicode = str -if sys.platform.startswith('java'): +if sys.platform.startswith("java"): import platform + os_name = platform.java_ver()[3][0] - if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc. - system = 'win32' - elif os_name.startswith('Mac'): # "Mac OS X", etc. - system = 'darwin' - else: # "Linux", "SunOS", "FreeBSD", etc. + if os_name.startswith("Windows"): # "Windows XP", "Windows 7", etc. + system = "win32" + elif os_name.startswith("Mac"): # "Mac OS X", etc. + system = "darwin" + else: # "Linux", "SunOS", "FreeBSD", etc. # Setting this to "linux2" is not ideal, but only Windows or Mac # are actually checked for and the rest of the module expects # *sys.platform* style strings. - system = 'linux2' -elif sys.platform == 'cli' and os.name == 'nt': + system = "linux2" +elif sys.platform == "cli" and os.name == "nt": # Detect Windows in IronPython to match pip._internal.utils.compat.WINDOWS # Discussion: - system = 'win32' + system = "win32" else: system = sys.platform - def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific data dir for this application. @@ -88,12 +88,12 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): path = os.path.join(path, appauthor, appname) else: path = os.path.join(path, appname) - elif system == 'darwin': - path = os.path.expanduser('~/Library/Application Support/') + elif system == "darwin": + path = os.path.expanduser("~/Library/Application Support/") if appname: path = os.path.join(path, appname) else: - path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share")) + path = os.getenv("XDG_DATA_HOME", os.path.expanduser("~/.local/share")) if appname: path = os.path.join(path, appname) if appname and version: @@ -141,16 +141,19 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): path = os.path.join(path, appauthor, appname) else: path = os.path.join(path, appname) - elif system == 'darwin': - path = os.path.expanduser('/Library/Application Support') + elif system == "darwin": + path = os.path.expanduser("/Library/Application Support") if appname: path = os.path.join(path, appname) else: # XDG default for $XDG_DATA_DIRS # only first, if multipath is False - path = os.getenv('XDG_DATA_DIRS', - os.pathsep.join(['/usr/local/share', '/usr/share'])) - pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep)] + path = os.getenv( + "XDG_DATA_DIRS", os.pathsep.join(["/usr/local/share", "/usr/share"]) + ) + pathlist = [ + os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep) + ] if appname: if version: appname = os.path.join(appname, version) @@ -199,7 +202,7 @@ def user_config_dir(appname=None, appauthor=None, version=None, roaming=False): if system in ["win32", "darwin"]: path = user_data_dir(appname, appauthor, None, roaming) else: - path = os.getenv('XDG_CONFIG_HOME', os.path.expanduser("~/.config")) + path = os.getenv("XDG_CONFIG_HOME", os.path.expanduser("~/.config")) if appname: path = os.path.join(path, appname) if appname and version: @@ -247,8 +250,10 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False) # XDG default for $XDG_CONFIG_DIRS (missing or empty) # see # only first, if multipath is False - path = os.getenv('XDG_CONFIG_DIRS') or '/etc/xdg' - pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep) if x] + path = os.getenv("XDG_CONFIG_DIRS") or "/etc/xdg" + pathlist = [ + os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep) if x + ] if appname: if version: appname = os.path.join(appname, version) @@ -309,12 +314,12 @@ def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True): path = os.path.join(path, appname) if opinion: path = os.path.join(path, "Cache") - elif system == 'darwin': - path = os.path.expanduser('~/Library/Caches') + elif system == "darwin": + path = os.path.expanduser("~/Library/Caches") if appname: path = os.path.join(path, appname) else: - path = os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache')) + path = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache")) if appname: path = os.path.join(path, appname) if appname and version: @@ -356,7 +361,7 @@ def user_state_dir(appname=None, appauthor=None, version=None, roaming=False): if system in ["win32", "darwin"]: path = user_data_dir(appname, appauthor, None, roaming) else: - path = os.getenv('XDG_STATE_HOME', os.path.expanduser("~/.local/state")) + path = os.getenv("XDG_STATE_HOME", os.path.expanduser("~/.local/state")) if appname: path = os.path.join(path, appname) if appname and version: @@ -397,9 +402,7 @@ def user_log_dir(appname=None, appauthor=None, version=None, opinion=True): This can be disabled with the `opinion=False` option. """ if system == "darwin": - path = os.path.join( - os.path.expanduser('~/Library/Logs'), - appname) + path = os.path.join(os.path.expanduser("~/Library/Logs"), appname) elif system == "win32": path = user_data_dir(appname, appauthor, version) version = False @@ -417,8 +420,10 @@ def user_log_dir(appname=None, appauthor=None, version=None, opinion=True): class AppDirs(object): """Convenience wrapper for getting application dirs.""" - def __init__(self, appname=None, appauthor=None, version=None, - roaming=False, multipath=False): + + def __init__( + self, appname=None, appauthor=None, version=None, roaming=False, multipath=False + ): self.appname = appname self.appauthor = appauthor self.version = version @@ -427,41 +432,43 @@ def __init__(self, appname=None, appauthor=None, version=None, @property def user_data_dir(self): - return user_data_dir(self.appname, self.appauthor, - version=self.version, roaming=self.roaming) + return user_data_dir( + self.appname, self.appauthor, version=self.version, roaming=self.roaming + ) @property def site_data_dir(self): - return site_data_dir(self.appname, self.appauthor, - version=self.version, multipath=self.multipath) + return site_data_dir( + self.appname, self.appauthor, version=self.version, multipath=self.multipath + ) @property def user_config_dir(self): - return user_config_dir(self.appname, self.appauthor, - version=self.version, roaming=self.roaming) + return user_config_dir( + self.appname, self.appauthor, version=self.version, roaming=self.roaming + ) @property def site_config_dir(self): - return site_config_dir(self.appname, self.appauthor, - version=self.version, multipath=self.multipath) + return site_config_dir( + self.appname, self.appauthor, version=self.version, multipath=self.multipath + ) @property def user_cache_dir(self): - return user_cache_dir(self.appname, self.appauthor, - version=self.version) + return user_cache_dir(self.appname, self.appauthor, version=self.version) @property def user_state_dir(self): - return user_state_dir(self.appname, self.appauthor, - version=self.version) + return user_state_dir(self.appname, self.appauthor, version=self.version) @property def user_log_dir(self): - return user_log_dir(self.appname, self.appauthor, - version=self.version) + return user_log_dir(self.appname, self.appauthor, version=self.version) -#---- internal support stuff +# ---- internal support stuff + def _get_win_folder_from_registry(csidl_name): """This is a fallback technique at best. I'm not sure if using the @@ -469,9 +476,9 @@ def _get_win_folder_from_registry(csidl_name): names. """ if PY3: - import winreg as _winreg + import winreg as _winreg else: - import _winreg + import _winreg shell_folder_name = { "CSIDL_APPDATA": "AppData", @@ -481,7 +488,7 @@ def _get_win_folder_from_registry(csidl_name): key = _winreg.OpenKey( _winreg.HKEY_CURRENT_USER, - r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" + r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", ) dir, type = _winreg.QueryValueEx(key, shell_folder_name) return dir @@ -489,6 +496,7 @@ def _get_win_folder_from_registry(csidl_name): def _get_win_folder_with_pywin32(csidl_name): from win32com.shell import shellcon, shell + dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0) # Try to make this a unicode path because SHGetFolderPath does # not return unicode strings when there is unicode data in the @@ -506,6 +514,7 @@ def _get_win_folder_with_pywin32(csidl_name): if has_high_char: try: import win32api + dir = win32api.GetShortPathName(dir) except ImportError: pass @@ -540,15 +549,22 @@ def _get_win_folder_with_ctypes(csidl_name): return buf.value + def _get_win_folder_with_jna(csidl_name): import array from com.sun import jna from com.sun.jna.platform import win32 buf_size = win32.WinDef.MAX_PATH * 2 - buf = array.zeros('c', buf_size) + buf = array.zeros("c", buf_size) shell = win32.Shell32.INSTANCE - shell.SHGetFolderPath(None, getattr(win32.ShlObj, csidl_name), None, win32.ShlObj.SHGFP_TYPE_CURRENT, buf) + shell.SHGetFolderPath( + None, + getattr(win32.ShlObj, csidl_name), + None, + win32.ShlObj.SHGFP_TYPE_CURRENT, + buf, + ) dir = jna.Native.toString(buf.tostring()).rstrip("\0") # Downgrade to short path name if have highbit chars. See @@ -559,20 +575,23 @@ def _get_win_folder_with_jna(csidl_name): has_high_char = True break if has_high_char: - buf = array.zeros('c', buf_size) + buf = array.zeros("c", buf_size) kernel = win32.Kernel32.INSTANCE if kernel.GetShortPathName(dir, buf, buf_size): dir = jna.Native.toString(buf.tostring()).rstrip("\0") return dir + if system == "win32": try: from ctypes import windll + _get_win_folder = _get_win_folder_with_ctypes except ImportError: try: import com.sun.jna + _get_win_folder = _get_win_folder_with_jna except ImportError: _get_win_folder = _get_win_folder_from_registry @@ -588,7 +607,7 @@ def _win_path_to_bytes(path): If encoding using ASCII and MBCS fails, return the original Unicode path. """ - for encoding in ('ASCII', 'MBCS'): + for encoding in ("ASCII", "MBCS"): try: return path.encode(encoding) except (UnicodeEncodeError, LookupError): @@ -596,19 +615,21 @@ def _win_path_to_bytes(path): return path -#---- self test code +# ---- self test code if __name__ == "__main__": appname = "MyApp" appauthor = "MyCompany" - props = ("user_data_dir", - "user_config_dir", - "user_cache_dir", - "user_state_dir", - "user_log_dir", - "site_data_dir", - "site_config_dir") + props = ( + "user_data_dir", + "user_config_dir", + "user_cache_dir", + "user_state_dir", + "user_log_dir", + "site_data_dir", + "site_config_dir", + ) print("-- app dirs %s --" % __version__) diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol.pyi b/src/fetchcode/vcs/pip/_vendor/cachecontrol.pyi index 636a66ba..a67aae6d 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol.pyi +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol.pyi @@ -1 +1 @@ -from cachecontrol import * \ No newline at end of file +from cachecontrol import * diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol/cache.py b/src/fetchcode/vcs/pip/_vendor/cachecontrol/cache.py index 94e07732..8d4cf192 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol/cache.py +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol/cache.py @@ -6,7 +6,6 @@ class BaseCache(object): - def get(self, key): raise NotImplementedError() @@ -21,7 +20,6 @@ def close(self): class DictCache(BaseCache): - def __init__(self, init_dict=None): self.lock = Lock() self.data = init_dict or {} diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/file_cache.py b/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/file_cache.py index 607b9452..169f3d45 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/file_cache.py +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/file_cache.py @@ -54,7 +54,6 @@ def _secure_open_write(filename, fmode): class FileCache(BaseCache): - def __init__( self, directory, diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/redis_cache.py b/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/redis_cache.py index eedf9fcd..2d19bf93 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/redis_cache.py +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol/caches/redis_cache.py @@ -1,10 +1,8 @@ - from datetime import datetime from fetchcode.vcs.pip._vendor.cachecontrol.cache import BaseCache class RedisCache(BaseCache): - def __init__(self, conn): self.conn = conn diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol/compat.py b/src/fetchcode/vcs/pip/_vendor/cachecontrol/compat.py index 3c8fd2b7..0fb65da9 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol/compat.py +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol/compat.py @@ -13,7 +13,9 @@ # Handle the case where the requests module has been patched to not have # urllib3 bundled as part of its source. try: - from fetchcode.vcs.pip._vendor.requests.packages.urllib3.response import HTTPResponse + from fetchcode.vcs.pip._vendor.requests.packages.urllib3.response import ( + HTTPResponse, + ) except ImportError: from fetchcode.vcs.pip._vendor.urllib3.response import HTTPResponse diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol/controller.py b/src/fetchcode/vcs/pip/_vendor/cachecontrol/controller.py index 1ecab2a0..46faaeb4 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol/controller.py +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol/controller.py @@ -21,15 +21,14 @@ def parse_uri(uri): """Parses a URI using the regex given in Appendix B of RFC 3986. - (scheme, authority, path, query, fragment) = parse_uri(uri) + (scheme, authority, path, query, fragment) = parse_uri(uri) """ groups = URI.match(uri).groups() return (groups[1], groups[3], groups[4], groups[6], groups[8]) class CacheController(object): - """An interface to see if request should cached or not. - """ + """An interface to see if request should cached or not.""" def __init__( self, cache=None, cache_etags=True, serializer=None, status_codes=None diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol/heuristics.py b/src/fetchcode/vcs/pip/_vendor/cachecontrol/heuristics.py index 6c0e9790..3846acf5 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol/heuristics.py +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol/heuristics.py @@ -18,7 +18,6 @@ def datetime_to_header(dt): class BaseHeuristic(object): - def warning(self, response): """ Return a valid 1xx warning header value describing the cache @@ -97,8 +96,19 @@ class LastModified(BaseHeuristic): http://lxr.mozilla.org/mozilla-release/source/netwerk/protocol/http/nsHttpResponseHead.cpp#397 Unlike mozilla we limit this to 24-hr. """ + cacheable_by_default_statuses = { - 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501 + 200, + 203, + 204, + 206, + 300, + 301, + 404, + 405, + 410, + 414, + 501, } def update_headers(self, resp): diff --git a/src/fetchcode/vcs/pip/_vendor/cachecontrol/serialize.py b/src/fetchcode/vcs/pip/_vendor/cachecontrol/serialize.py index cea1d0cc..28a8e5cb 100644 --- a/src/fetchcode/vcs/pip/_vendor/cachecontrol/serialize.py +++ b/src/fetchcode/vcs/pip/_vendor/cachecontrol/serialize.py @@ -18,7 +18,6 @@ def _b64_decode_str(s): class Serializer(object): - def dumps(self, request, response, body=None): response_headers = CaseInsensitiveDict(response.headers) @@ -45,29 +44,29 @@ def dumps(self, request, response, body=None): # doesn't know the difference. Forcing these to unicode will be # enough to have msgpack know the difference. data = { - u"response": { - u"body": body, - u"headers": dict( + "response": { + "body": body, + "headers": dict( (text_type(k), text_type(v)) for k, v in response.headers.items() ), - u"status": response.status, - u"version": response.version, - u"reason": text_type(response.reason), - u"strict": response.strict, - u"decode_content": response.decode_content, + "status": response.status, + "version": response.version, + "reason": text_type(response.reason), + "strict": response.strict, + "decode_content": response.decode_content, } } # Construct our vary headers - data[u"vary"] = {} - if u"vary" in response_headers: - varied_headers = response_headers[u"vary"].split(",") + data["vary"] = {} + if "vary" in response_headers: + varied_headers = response_headers["vary"].split(",") for header in varied_headers: header = text_type(header).strip() header_value = request.headers.get(header, None) if header_value is not None: header_value = text_type(header_value) - data[u"vary"][header] = header_value + data["vary"][header] = header_value return b",".join([b"cc=4", msgpack.dumps(data, use_bin_type=True)]) diff --git a/src/fetchcode/vcs/pip/_vendor/certifi.pyi b/src/fetchcode/vcs/pip/_vendor/certifi.pyi index e5c4d3d2..abcc74ec 100644 --- a/src/fetchcode/vcs/pip/_vendor/certifi.pyi +++ b/src/fetchcode/vcs/pip/_vendor/certifi.pyi @@ -1 +1 @@ -from certifi import * \ No newline at end of file +from certifi import * diff --git a/src/fetchcode/vcs/pip/_vendor/chardet.pyi b/src/fetchcode/vcs/pip/_vendor/chardet.pyi index 29e87e33..2ce13190 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet.pyi +++ b/src/fetchcode/vcs/pip/_vendor/chardet.pyi @@ -1 +1 @@ -from chardet import * \ No newline at end of file +from chardet import * diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/__init__.py b/src/fetchcode/vcs/pip/_vendor/chardet/__init__.py index 0f9f820e..f1571e5b 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/__init__.py @@ -30,8 +30,10 @@ def detect(byte_str): """ if not isinstance(byte_str, bytearray): if not isinstance(byte_str, bytes): - raise TypeError('Expected object of type bytes or bytearray, got: ' - '{0}'.format(type(byte_str))) + raise TypeError( + "Expected object of type bytes or bytearray, got: " + "{0}".format(type(byte_str)) + ) else: byte_str = bytearray(byte_str) detector = UniversalDetector() diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/big5freq.py b/src/fetchcode/vcs/pip/_vendor/chardet/big5freq.py index 38f32517..98e98a1b 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/big5freq.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/big5freq.py @@ -42,345 +42,5384 @@ BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75 -#Char to FreqOrder table +# Char to FreqOrder table BIG5_TABLE_SIZE = 5376 BIG5_CHAR_TO_FREQ_ORDER = ( - 1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, # 16 -3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, # 32 -1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, # 48 - 63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, # 64 -3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, # 80 -4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, # 96 -5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, # 112 - 630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, # 128 - 179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, # 144 - 995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, # 160 -2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, # 176 -1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, # 192 -3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, # 208 - 706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, # 224 -1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, # 240 -3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, # 256 -2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, # 272 - 437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, # 288 -3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, # 304 -1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, # 320 -5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, # 336 - 266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, # 352 -5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, # 368 -1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, # 384 - 32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, # 400 - 188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, # 416 -3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, # 432 -3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, # 448 - 324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, # 464 -2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, # 480 -2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, # 496 - 314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, # 512 - 287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, # 528 -3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, # 544 -1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, # 560 -1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, # 576 -1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, # 592 -2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, # 608 - 265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, # 624 -4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, # 640 -1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, # 656 -5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, # 672 -2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, # 688 - 383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, # 704 - 98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, # 720 - 523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, # 736 - 710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, # 752 -5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, # 768 - 379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, # 784 -1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, # 800 - 585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, # 816 - 690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, # 832 -5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, # 848 -1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, # 864 - 544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, # 880 -3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, # 896 -4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, # 912 -3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, # 928 - 279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, # 944 - 610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, # 960 -1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, # 976 -4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, # 992 -3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, # 1008 -3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, # 1024 -2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, # 1040 -5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, # 1056 -3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, # 1072 -5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, # 1088 -1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, # 1104 -2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, # 1120 -1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, # 1136 - 78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, # 1152 -1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, # 1168 -4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, # 1184 -3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, # 1200 - 534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, # 1216 - 165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, # 1232 - 626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, # 1248 -2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, # 1264 -5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, # 1280 -1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, # 1296 -2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, # 1312 -1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, # 1328 -1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, # 1344 -5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, # 1360 -5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, # 1376 -5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, # 1392 -3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, # 1408 -4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, # 1424 -4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, # 1440 -2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, # 1456 -5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, # 1472 -3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, # 1488 - 598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, # 1504 -5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, # 1520 -5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, # 1536 -1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, # 1552 -2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, # 1568 -3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, # 1584 -4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, # 1600 -5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, # 1616 -3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, # 1632 -4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, # 1648 -1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, # 1664 -1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, # 1680 -4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, # 1696 -1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, # 1712 - 240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, # 1728 -1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, # 1744 -1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, # 1760 -3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, # 1776 - 619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, # 1792 -5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, # 1808 -2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, # 1824 -1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, # 1840 -1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, # 1856 -5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, # 1872 - 829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, # 1888 -4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, # 1904 - 375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, # 1920 -2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, # 1936 - 444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, # 1952 -1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, # 1968 -1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, # 1984 - 730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, # 2000 -4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, # 2016 -4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, # 2032 -1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, # 2048 -3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, # 2064 -5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, # 2080 -5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, # 2096 -1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, # 2112 -2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, # 2128 -1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, # 2144 -3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, # 2160 -2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, # 2176 -3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, # 2192 -2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, # 2208 -4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, # 2224 -4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, # 2240 -3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, # 2256 - 97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, # 2272 -3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, # 2288 - 424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, # 2304 -3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, # 2320 -4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, # 2336 -3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, # 2352 -1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, # 2368 -5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, # 2384 - 199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, # 2400 -5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, # 2416 -1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, # 2432 - 391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, # 2448 -4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, # 2464 -4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, # 2480 - 397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, # 2496 -2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, # 2512 -2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, # 2528 -3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, # 2544 -1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, # 2560 -4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, # 2576 -2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, # 2592 -1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, # 2608 -1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, # 2624 -2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, # 2640 -3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, # 2656 -1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, # 2672 -5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, # 2688 -1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, # 2704 -4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, # 2720 -1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, # 2736 - 135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, # 2752 -1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, # 2768 -4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, # 2784 -4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, # 2800 -2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, # 2816 -1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, # 2832 -4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, # 2848 - 660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, # 2864 -5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, # 2880 -2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, # 2896 -3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, # 2912 -4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, # 2928 - 790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, # 2944 -5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, # 2960 -5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, # 2976 -1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, # 2992 -4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, # 3008 -4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, # 3024 -2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, # 3040 -3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, # 3056 -3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, # 3072 -2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, # 3088 -1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, # 3104 -4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, # 3120 -3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, # 3136 -3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, # 3152 -2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, # 3168 -4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, # 3184 -5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, # 3200 -3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, # 3216 -2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, # 3232 -3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, # 3248 -1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, # 3264 -2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, # 3280 -3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, # 3296 -4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, # 3312 -2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, # 3328 -2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, # 3344 -5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, # 3360 -1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, # 3376 -2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, # 3392 -1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, # 3408 -3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, # 3424 -4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, # 3440 -2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, # 3456 -3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, # 3472 -3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, # 3488 -2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, # 3504 -4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, # 3520 -2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, # 3536 -3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, # 3552 -4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, # 3568 -5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, # 3584 -3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, # 3600 - 194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, # 3616 -1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, # 3632 -4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, # 3648 -1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, # 3664 -4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, # 3680 -5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, # 3696 - 510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, # 3712 -5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, # 3728 -5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, # 3744 -2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, # 3760 -3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, # 3776 -2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, # 3792 -2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, # 3808 - 681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, # 3824 -1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, # 3840 -4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, # 3856 -3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, # 3872 -3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, # 3888 - 838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, # 3904 -2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, # 3920 - 625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, # 3936 -2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, # 3952 -4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, # 3968 -1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, # 3984 -4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, # 4000 -1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, # 4016 -3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, # 4032 - 574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, # 4048 -3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, # 4064 -5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, # 4080 -5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, # 4096 -3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, # 4112 -3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, # 4128 -1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, # 4144 -2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, # 4160 -5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, # 4176 -1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, # 4192 -1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, # 4208 -3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, # 4224 - 919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, # 4240 -1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, # 4256 -4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, # 4272 -5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, # 4288 -2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, # 4304 -3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, # 4320 - 516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, # 4336 -1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, # 4352 -2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, # 4368 -2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, # 4384 -5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, # 4400 -5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, # 4416 -5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, # 4432 -2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, # 4448 -2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, # 4464 -1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, # 4480 -4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, # 4496 -3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, # 4512 -3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, # 4528 -4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, # 4544 -4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, # 4560 -2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, # 4576 -2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, # 4592 -5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, # 4608 -4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, # 4624 -5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, # 4640 -4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, # 4656 - 502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, # 4672 - 121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, # 4688 -1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, # 4704 -3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, # 4720 -4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, # 4736 -1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, # 4752 -5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, # 4768 -2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, # 4784 -2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, # 4800 -3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, # 4816 -5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, # 4832 -1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, # 4848 -3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, # 4864 -5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, # 4880 -1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, # 4896 -5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, # 4912 -2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, # 4928 -3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, # 4944 -2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, # 4960 -3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, # 4976 -3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, # 4992 -3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, # 5008 -4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, # 5024 - 803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, # 5040 -2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, # 5056 -4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, # 5072 -3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, # 5088 -5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, # 5104 -1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, # 5120 -5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, # 5136 - 425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, # 5152 -1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, # 5168 - 479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, # 5184 -4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, # 5200 -1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, # 5216 -4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, # 5232 -1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, # 5248 - 433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, # 5264 -3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, # 5280 -4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, # 5296 -5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, # 5312 - 938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, # 5328 -3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, # 5344 - 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360 -2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376 + 1, + 1801, + 1506, + 255, + 1431, + 198, + 9, + 82, + 6, + 5008, + 177, + 202, + 3681, + 1256, + 2821, + 110, # 16 + 3814, + 33, + 3274, + 261, + 76, + 44, + 2114, + 16, + 2946, + 2187, + 1176, + 659, + 3971, + 26, + 3451, + 2653, # 32 + 1198, + 3972, + 3350, + 4202, + 410, + 2215, + 302, + 590, + 361, + 1964, + 8, + 204, + 58, + 4510, + 5009, + 1932, # 48 + 63, + 5010, + 5011, + 317, + 1614, + 75, + 222, + 159, + 4203, + 2417, + 1480, + 5012, + 3555, + 3091, + 224, + 2822, # 64 + 3682, + 3, + 10, + 3973, + 1471, + 29, + 2787, + 1135, + 2866, + 1940, + 873, + 130, + 3275, + 1123, + 312, + 5013, # 80 + 4511, + 2052, + 507, + 252, + 682, + 5014, + 142, + 1915, + 124, + 206, + 2947, + 34, + 3556, + 3204, + 64, + 604, # 96 + 5015, + 2501, + 1977, + 1978, + 155, + 1991, + 645, + 641, + 1606, + 5016, + 3452, + 337, + 72, + 406, + 5017, + 80, # 112 + 630, + 238, + 3205, + 1509, + 263, + 939, + 1092, + 2654, + 756, + 1440, + 1094, + 3453, + 449, + 69, + 2987, + 591, # 128 + 179, + 2096, + 471, + 115, + 2035, + 1844, + 60, + 50, + 2988, + 134, + 806, + 1869, + 734, + 2036, + 3454, + 180, # 144 + 995, + 1607, + 156, + 537, + 2907, + 688, + 5018, + 319, + 1305, + 779, + 2145, + 514, + 2379, + 298, + 4512, + 359, # 160 + 2502, + 90, + 2716, + 1338, + 663, + 11, + 906, + 1099, + 2553, + 20, + 2441, + 182, + 532, + 1716, + 5019, + 732, # 176 + 1376, + 4204, + 1311, + 1420, + 3206, + 25, + 2317, + 1056, + 113, + 399, + 382, + 1950, + 242, + 3455, + 2474, + 529, # 192 + 3276, + 475, + 1447, + 3683, + 5020, + 117, + 21, + 656, + 810, + 1297, + 2300, + 2334, + 3557, + 5021, + 126, + 4205, # 208 + 706, + 456, + 150, + 613, + 4513, + 71, + 1118, + 2037, + 4206, + 145, + 3092, + 85, + 835, + 486, + 2115, + 1246, # 224 + 1426, + 428, + 727, + 1285, + 1015, + 800, + 106, + 623, + 303, + 1281, + 5022, + 2128, + 2359, + 347, + 3815, + 221, # 240 + 3558, + 3135, + 5023, + 1956, + 1153, + 4207, + 83, + 296, + 1199, + 3093, + 192, + 624, + 93, + 5024, + 822, + 1898, # 256 + 2823, + 3136, + 795, + 2065, + 991, + 1554, + 1542, + 1592, + 27, + 43, + 2867, + 859, + 139, + 1456, + 860, + 4514, # 272 + 437, + 712, + 3974, + 164, + 2397, + 3137, + 695, + 211, + 3037, + 2097, + 195, + 3975, + 1608, + 3559, + 3560, + 3684, # 288 + 3976, + 234, + 811, + 2989, + 2098, + 3977, + 2233, + 1441, + 3561, + 1615, + 2380, + 668, + 2077, + 1638, + 305, + 228, # 304 + 1664, + 4515, + 467, + 415, + 5025, + 262, + 2099, + 1593, + 239, + 108, + 300, + 200, + 1033, + 512, + 1247, + 2078, # 320 + 5026, + 5027, + 2176, + 3207, + 3685, + 2682, + 593, + 845, + 1062, + 3277, + 88, + 1723, + 2038, + 3978, + 1951, + 212, # 336 + 266, + 152, + 149, + 468, + 1899, + 4208, + 4516, + 77, + 187, + 5028, + 3038, + 37, + 5, + 2990, + 5029, + 3979, # 352 + 5030, + 5031, + 39, + 2524, + 4517, + 2908, + 3208, + 2079, + 55, + 148, + 74, + 4518, + 545, + 483, + 1474, + 1029, # 368 + 1665, + 217, + 1870, + 1531, + 3138, + 1104, + 2655, + 4209, + 24, + 172, + 3562, + 900, + 3980, + 3563, + 3564, + 4519, # 384 + 32, + 1408, + 2824, + 1312, + 329, + 487, + 2360, + 2251, + 2717, + 784, + 2683, + 4, + 3039, + 3351, + 1427, + 1789, # 400 + 188, + 109, + 499, + 5032, + 3686, + 1717, + 1790, + 888, + 1217, + 3040, + 4520, + 5033, + 3565, + 5034, + 3352, + 1520, # 416 + 3687, + 3981, + 196, + 1034, + 775, + 5035, + 5036, + 929, + 1816, + 249, + 439, + 38, + 5037, + 1063, + 5038, + 794, # 432 + 3982, + 1435, + 2301, + 46, + 178, + 3278, + 2066, + 5039, + 2381, + 5040, + 214, + 1709, + 4521, + 804, + 35, + 707, # 448 + 324, + 3688, + 1601, + 2554, + 140, + 459, + 4210, + 5041, + 5042, + 1365, + 839, + 272, + 978, + 2262, + 2580, + 3456, # 464 + 2129, + 1363, + 3689, + 1423, + 697, + 100, + 3094, + 48, + 70, + 1231, + 495, + 3139, + 2196, + 5043, + 1294, + 5044, # 480 + 2080, + 462, + 586, + 1042, + 3279, + 853, + 256, + 988, + 185, + 2382, + 3457, + 1698, + 434, + 1084, + 5045, + 3458, # 496 + 314, + 2625, + 2788, + 4522, + 2335, + 2336, + 569, + 2285, + 637, + 1817, + 2525, + 757, + 1162, + 1879, + 1616, + 3459, # 512 + 287, + 1577, + 2116, + 768, + 4523, + 1671, + 2868, + 3566, + 2526, + 1321, + 3816, + 909, + 2418, + 5046, + 4211, + 933, # 528 + 3817, + 4212, + 2053, + 2361, + 1222, + 4524, + 765, + 2419, + 1322, + 786, + 4525, + 5047, + 1920, + 1462, + 1677, + 2909, # 544 + 1699, + 5048, + 4526, + 1424, + 2442, + 3140, + 3690, + 2600, + 3353, + 1775, + 1941, + 3460, + 3983, + 4213, + 309, + 1369, # 560 + 1130, + 2825, + 364, + 2234, + 1653, + 1299, + 3984, + 3567, + 3985, + 3986, + 2656, + 525, + 1085, + 3041, + 902, + 2001, # 576 + 1475, + 964, + 4527, + 421, + 1845, + 1415, + 1057, + 2286, + 940, + 1364, + 3141, + 376, + 4528, + 4529, + 1381, + 7, # 592 + 2527, + 983, + 2383, + 336, + 1710, + 2684, + 1846, + 321, + 3461, + 559, + 1131, + 3042, + 2752, + 1809, + 1132, + 1313, # 608 + 265, + 1481, + 1858, + 5049, + 352, + 1203, + 2826, + 3280, + 167, + 1089, + 420, + 2827, + 776, + 792, + 1724, + 3568, # 624 + 4214, + 2443, + 3281, + 5050, + 4215, + 5051, + 446, + 229, + 333, + 2753, + 901, + 3818, + 1200, + 1557, + 4530, + 2657, # 640 + 1921, + 395, + 2754, + 2685, + 3819, + 4216, + 1836, + 125, + 916, + 3209, + 2626, + 4531, + 5052, + 5053, + 3820, + 5054, # 656 + 5055, + 5056, + 4532, + 3142, + 3691, + 1133, + 2555, + 1757, + 3462, + 1510, + 2318, + 1409, + 3569, + 5057, + 2146, + 438, # 672 + 2601, + 2910, + 2384, + 3354, + 1068, + 958, + 3043, + 461, + 311, + 2869, + 2686, + 4217, + 1916, + 3210, + 4218, + 1979, # 688 + 383, + 750, + 2755, + 2627, + 4219, + 274, + 539, + 385, + 1278, + 1442, + 5058, + 1154, + 1965, + 384, + 561, + 210, # 704 + 98, + 1295, + 2556, + 3570, + 5059, + 1711, + 2420, + 1482, + 3463, + 3987, + 2911, + 1257, + 129, + 5060, + 3821, + 642, # 720 + 523, + 2789, + 2790, + 2658, + 5061, + 141, + 2235, + 1333, + 68, + 176, + 441, + 876, + 907, + 4220, + 603, + 2602, # 736 + 710, + 171, + 3464, + 404, + 549, + 18, + 3143, + 2398, + 1410, + 3692, + 1666, + 5062, + 3571, + 4533, + 2912, + 4534, # 752 + 5063, + 2991, + 368, + 5064, + 146, + 366, + 99, + 871, + 3693, + 1543, + 748, + 807, + 1586, + 1185, + 22, + 2263, # 768 + 379, + 3822, + 3211, + 5065, + 3212, + 505, + 1942, + 2628, + 1992, + 1382, + 2319, + 5066, + 380, + 2362, + 218, + 702, # 784 + 1818, + 1248, + 3465, + 3044, + 3572, + 3355, + 3282, + 5067, + 2992, + 3694, + 930, + 3283, + 3823, + 5068, + 59, + 5069, # 800 + 585, + 601, + 4221, + 497, + 3466, + 1112, + 1314, + 4535, + 1802, + 5070, + 1223, + 1472, + 2177, + 5071, + 749, + 1837, # 816 + 690, + 1900, + 3824, + 1773, + 3988, + 1476, + 429, + 1043, + 1791, + 2236, + 2117, + 917, + 4222, + 447, + 1086, + 1629, # 832 + 5072, + 556, + 5073, + 5074, + 2021, + 1654, + 844, + 1090, + 105, + 550, + 966, + 1758, + 2828, + 1008, + 1783, + 686, # 848 + 1095, + 5075, + 2287, + 793, + 1602, + 5076, + 3573, + 2603, + 4536, + 4223, + 2948, + 2302, + 4537, + 3825, + 980, + 2503, # 864 + 544, + 353, + 527, + 4538, + 908, + 2687, + 2913, + 5077, + 381, + 2629, + 1943, + 1348, + 5078, + 1341, + 1252, + 560, # 880 + 3095, + 5079, + 3467, + 2870, + 5080, + 2054, + 973, + 886, + 2081, + 143, + 4539, + 5081, + 5082, + 157, + 3989, + 496, # 896 + 4224, + 57, + 840, + 540, + 2039, + 4540, + 4541, + 3468, + 2118, + 1445, + 970, + 2264, + 1748, + 1966, + 2082, + 4225, # 912 + 3144, + 1234, + 1776, + 3284, + 2829, + 3695, + 773, + 1206, + 2130, + 1066, + 2040, + 1326, + 3990, + 1738, + 1725, + 4226, # 928 + 279, + 3145, + 51, + 1544, + 2604, + 423, + 1578, + 2131, + 2067, + 173, + 4542, + 1880, + 5083, + 5084, + 1583, + 264, # 944 + 610, + 3696, + 4543, + 2444, + 280, + 154, + 5085, + 5086, + 5087, + 1739, + 338, + 1282, + 3096, + 693, + 2871, + 1411, # 960 + 1074, + 3826, + 2445, + 5088, + 4544, + 5089, + 5090, + 1240, + 952, + 2399, + 5091, + 2914, + 1538, + 2688, + 685, + 1483, # 976 + 4227, + 2475, + 1436, + 953, + 4228, + 2055, + 4545, + 671, + 2400, + 79, + 4229, + 2446, + 3285, + 608, + 567, + 2689, # 992 + 3469, + 4230, + 4231, + 1691, + 393, + 1261, + 1792, + 2401, + 5092, + 4546, + 5093, + 5094, + 5095, + 5096, + 1383, + 1672, # 1008 + 3827, + 3213, + 1464, + 522, + 1119, + 661, + 1150, + 216, + 675, + 4547, + 3991, + 1432, + 3574, + 609, + 4548, + 2690, # 1024 + 2402, + 5097, + 5098, + 5099, + 4232, + 3045, + 0, + 5100, + 2476, + 315, + 231, + 2447, + 301, + 3356, + 4549, + 2385, # 1040 + 5101, + 233, + 4233, + 3697, + 1819, + 4550, + 4551, + 5102, + 96, + 1777, + 1315, + 2083, + 5103, + 257, + 5104, + 1810, # 1056 + 3698, + 2718, + 1139, + 1820, + 4234, + 2022, + 1124, + 2164, + 2791, + 1778, + 2659, + 5105, + 3097, + 363, + 1655, + 3214, # 1072 + 5106, + 2993, + 5107, + 5108, + 5109, + 3992, + 1567, + 3993, + 718, + 103, + 3215, + 849, + 1443, + 341, + 3357, + 2949, # 1088 + 1484, + 5110, + 1712, + 127, + 67, + 339, + 4235, + 2403, + 679, + 1412, + 821, + 5111, + 5112, + 834, + 738, + 351, # 1104 + 2994, + 2147, + 846, + 235, + 1497, + 1881, + 418, + 1993, + 3828, + 2719, + 186, + 1100, + 2148, + 2756, + 3575, + 1545, # 1120 + 1355, + 2950, + 2872, + 1377, + 583, + 3994, + 4236, + 2581, + 2995, + 5113, + 1298, + 3699, + 1078, + 2557, + 3700, + 2363, # 1136 + 78, + 3829, + 3830, + 267, + 1289, + 2100, + 2002, + 1594, + 4237, + 348, + 369, + 1274, + 2197, + 2178, + 1838, + 4552, # 1152 + 1821, + 2830, + 3701, + 2757, + 2288, + 2003, + 4553, + 2951, + 2758, + 144, + 3358, + 882, + 4554, + 3995, + 2759, + 3470, # 1168 + 4555, + 2915, + 5114, + 4238, + 1726, + 320, + 5115, + 3996, + 3046, + 788, + 2996, + 5116, + 2831, + 1774, + 1327, + 2873, # 1184 + 3997, + 2832, + 5117, + 1306, + 4556, + 2004, + 1700, + 3831, + 3576, + 2364, + 2660, + 787, + 2023, + 506, + 824, + 3702, # 1200 + 534, + 323, + 4557, + 1044, + 3359, + 2024, + 1901, + 946, + 3471, + 5118, + 1779, + 1500, + 1678, + 5119, + 1882, + 4558, # 1216 + 165, + 243, + 4559, + 3703, + 2528, + 123, + 683, + 4239, + 764, + 4560, + 36, + 3998, + 1793, + 589, + 2916, + 816, # 1232 + 626, + 1667, + 3047, + 2237, + 1639, + 1555, + 1622, + 3832, + 3999, + 5120, + 4000, + 2874, + 1370, + 1228, + 1933, + 891, # 1248 + 2084, + 2917, + 304, + 4240, + 5121, + 292, + 2997, + 2720, + 3577, + 691, + 2101, + 4241, + 1115, + 4561, + 118, + 662, # 1264 + 5122, + 611, + 1156, + 854, + 2386, + 1316, + 2875, + 2, + 386, + 515, + 2918, + 5123, + 5124, + 3286, + 868, + 2238, # 1280 + 1486, + 855, + 2661, + 785, + 2216, + 3048, + 5125, + 1040, + 3216, + 3578, + 5126, + 3146, + 448, + 5127, + 1525, + 5128, # 1296 + 2165, + 4562, + 5129, + 3833, + 5130, + 4242, + 2833, + 3579, + 3147, + 503, + 818, + 4001, + 3148, + 1568, + 814, + 676, # 1312 + 1444, + 306, + 1749, + 5131, + 3834, + 1416, + 1030, + 197, + 1428, + 805, + 2834, + 1501, + 4563, + 5132, + 5133, + 5134, # 1328 + 1994, + 5135, + 4564, + 5136, + 5137, + 2198, + 13, + 2792, + 3704, + 2998, + 3149, + 1229, + 1917, + 5138, + 3835, + 2132, # 1344 + 5139, + 4243, + 4565, + 2404, + 3580, + 5140, + 2217, + 1511, + 1727, + 1120, + 5141, + 5142, + 646, + 3836, + 2448, + 307, # 1360 + 5143, + 5144, + 1595, + 3217, + 5145, + 5146, + 5147, + 3705, + 1113, + 1356, + 4002, + 1465, + 2529, + 2530, + 5148, + 519, # 1376 + 5149, + 128, + 2133, + 92, + 2289, + 1980, + 5150, + 4003, + 1512, + 342, + 3150, + 2199, + 5151, + 2793, + 2218, + 1981, # 1392 + 3360, + 4244, + 290, + 1656, + 1317, + 789, + 827, + 2365, + 5152, + 3837, + 4566, + 562, + 581, + 4004, + 5153, + 401, # 1408 + 4567, + 2252, + 94, + 4568, + 5154, + 1399, + 2794, + 5155, + 1463, + 2025, + 4569, + 3218, + 1944, + 5156, + 828, + 1105, # 1424 + 4245, + 1262, + 1394, + 5157, + 4246, + 605, + 4570, + 5158, + 1784, + 2876, + 5159, + 2835, + 819, + 2102, + 578, + 2200, # 1440 + 2952, + 5160, + 1502, + 436, + 3287, + 4247, + 3288, + 2836, + 4005, + 2919, + 3472, + 3473, + 5161, + 2721, + 2320, + 5162, # 1456 + 5163, + 2337, + 2068, + 23, + 4571, + 193, + 826, + 3838, + 2103, + 699, + 1630, + 4248, + 3098, + 390, + 1794, + 1064, # 1472 + 3581, + 5164, + 1579, + 3099, + 3100, + 1400, + 5165, + 4249, + 1839, + 1640, + 2877, + 5166, + 4572, + 4573, + 137, + 4250, # 1488 + 598, + 3101, + 1967, + 780, + 104, + 974, + 2953, + 5167, + 278, + 899, + 253, + 402, + 572, + 504, + 493, + 1339, # 1504 + 5168, + 4006, + 1275, + 4574, + 2582, + 2558, + 5169, + 3706, + 3049, + 3102, + 2253, + 565, + 1334, + 2722, + 863, + 41, # 1520 + 5170, + 5171, + 4575, + 5172, + 1657, + 2338, + 19, + 463, + 2760, + 4251, + 606, + 5173, + 2999, + 3289, + 1087, + 2085, # 1536 + 1323, + 2662, + 3000, + 5174, + 1631, + 1623, + 1750, + 4252, + 2691, + 5175, + 2878, + 791, + 2723, + 2663, + 2339, + 232, # 1552 + 2421, + 5176, + 3001, + 1498, + 5177, + 2664, + 2630, + 755, + 1366, + 3707, + 3290, + 3151, + 2026, + 1609, + 119, + 1918, # 1568 + 3474, + 862, + 1026, + 4253, + 5178, + 4007, + 3839, + 4576, + 4008, + 4577, + 2265, + 1952, + 2477, + 5179, + 1125, + 817, # 1584 + 4254, + 4255, + 4009, + 1513, + 1766, + 2041, + 1487, + 4256, + 3050, + 3291, + 2837, + 3840, + 3152, + 5180, + 5181, + 1507, # 1600 + 5182, + 2692, + 733, + 40, + 1632, + 1106, + 2879, + 345, + 4257, + 841, + 2531, + 230, + 4578, + 3002, + 1847, + 3292, # 1616 + 3475, + 5183, + 1263, + 986, + 3476, + 5184, + 735, + 879, + 254, + 1137, + 857, + 622, + 1300, + 1180, + 1388, + 1562, # 1632 + 4010, + 4011, + 2954, + 967, + 2761, + 2665, + 1349, + 592, + 2134, + 1692, + 3361, + 3003, + 1995, + 4258, + 1679, + 4012, # 1648 + 1902, + 2188, + 5185, + 739, + 3708, + 2724, + 1296, + 1290, + 5186, + 4259, + 2201, + 2202, + 1922, + 1563, + 2605, + 2559, # 1664 + 1871, + 2762, + 3004, + 5187, + 435, + 5188, + 343, + 1108, + 596, + 17, + 1751, + 4579, + 2239, + 3477, + 3709, + 5189, # 1680 + 4580, + 294, + 3582, + 2955, + 1693, + 477, + 979, + 281, + 2042, + 3583, + 643, + 2043, + 3710, + 2631, + 2795, + 2266, # 1696 + 1031, + 2340, + 2135, + 2303, + 3584, + 4581, + 367, + 1249, + 2560, + 5190, + 3585, + 5191, + 4582, + 1283, + 3362, + 2005, # 1712 + 240, + 1762, + 3363, + 4583, + 4584, + 836, + 1069, + 3153, + 474, + 5192, + 2149, + 2532, + 268, + 3586, + 5193, + 3219, # 1728 + 1521, + 1284, + 5194, + 1658, + 1546, + 4260, + 5195, + 3587, + 3588, + 5196, + 4261, + 3364, + 2693, + 1685, + 4262, + 961, # 1744 + 1673, + 2632, + 190, + 2006, + 2203, + 3841, + 4585, + 4586, + 5197, + 570, + 2504, + 3711, + 1490, + 5198, + 4587, + 2633, # 1760 + 3293, + 1957, + 4588, + 584, + 1514, + 396, + 1045, + 1945, + 5199, + 4589, + 1968, + 2449, + 5200, + 5201, + 4590, + 4013, # 1776 + 619, + 5202, + 3154, + 3294, + 215, + 2007, + 2796, + 2561, + 3220, + 4591, + 3221, + 4592, + 763, + 4263, + 3842, + 4593, # 1792 + 5203, + 5204, + 1958, + 1767, + 2956, + 3365, + 3712, + 1174, + 452, + 1477, + 4594, + 3366, + 3155, + 5205, + 2838, + 1253, # 1808 + 2387, + 2189, + 1091, + 2290, + 4264, + 492, + 5206, + 638, + 1169, + 1825, + 2136, + 1752, + 4014, + 648, + 926, + 1021, # 1824 + 1324, + 4595, + 520, + 4596, + 997, + 847, + 1007, + 892, + 4597, + 3843, + 2267, + 1872, + 3713, + 2405, + 1785, + 4598, # 1840 + 1953, + 2957, + 3103, + 3222, + 1728, + 4265, + 2044, + 3714, + 4599, + 2008, + 1701, + 3156, + 1551, + 30, + 2268, + 4266, # 1856 + 5207, + 2027, + 4600, + 3589, + 5208, + 501, + 5209, + 4267, + 594, + 3478, + 2166, + 1822, + 3590, + 3479, + 3591, + 3223, # 1872 + 829, + 2839, + 4268, + 5210, + 1680, + 3157, + 1225, + 4269, + 5211, + 3295, + 4601, + 4270, + 3158, + 2341, + 5212, + 4602, # 1888 + 4271, + 5213, + 4015, + 4016, + 5214, + 1848, + 2388, + 2606, + 3367, + 5215, + 4603, + 374, + 4017, + 652, + 4272, + 4273, # 1904 + 375, + 1140, + 798, + 5216, + 5217, + 5218, + 2366, + 4604, + 2269, + 546, + 1659, + 138, + 3051, + 2450, + 4605, + 5219, # 1920 + 2254, + 612, + 1849, + 910, + 796, + 3844, + 1740, + 1371, + 825, + 3845, + 3846, + 5220, + 2920, + 2562, + 5221, + 692, # 1936 + 444, + 3052, + 2634, + 801, + 4606, + 4274, + 5222, + 1491, + 244, + 1053, + 3053, + 4275, + 4276, + 340, + 5223, + 4018, # 1952 + 1041, + 3005, + 293, + 1168, + 87, + 1357, + 5224, + 1539, + 959, + 5225, + 2240, + 721, + 694, + 4277, + 3847, + 219, # 1968 + 1478, + 644, + 1417, + 3368, + 2666, + 1413, + 1401, + 1335, + 1389, + 4019, + 5226, + 5227, + 3006, + 2367, + 3159, + 1826, # 1984 + 730, + 1515, + 184, + 2840, + 66, + 4607, + 5228, + 1660, + 2958, + 246, + 3369, + 378, + 1457, + 226, + 3480, + 975, # 2000 + 4020, + 2959, + 1264, + 3592, + 674, + 696, + 5229, + 163, + 5230, + 1141, + 2422, + 2167, + 713, + 3593, + 3370, + 4608, # 2016 + 4021, + 5231, + 5232, + 1186, + 15, + 5233, + 1079, + 1070, + 5234, + 1522, + 3224, + 3594, + 276, + 1050, + 2725, + 758, # 2032 + 1126, + 653, + 2960, + 3296, + 5235, + 2342, + 889, + 3595, + 4022, + 3104, + 3007, + 903, + 1250, + 4609, + 4023, + 3481, # 2048 + 3596, + 1342, + 1681, + 1718, + 766, + 3297, + 286, + 89, + 2961, + 3715, + 5236, + 1713, + 5237, + 2607, + 3371, + 3008, # 2064 + 5238, + 2962, + 2219, + 3225, + 2880, + 5239, + 4610, + 2505, + 2533, + 181, + 387, + 1075, + 4024, + 731, + 2190, + 3372, # 2080 + 5240, + 3298, + 310, + 313, + 3482, + 2304, + 770, + 4278, + 54, + 3054, + 189, + 4611, + 3105, + 3848, + 4025, + 5241, # 2096 + 1230, + 1617, + 1850, + 355, + 3597, + 4279, + 4612, + 3373, + 111, + 4280, + 3716, + 1350, + 3160, + 3483, + 3055, + 4281, # 2112 + 2150, + 3299, + 3598, + 5242, + 2797, + 4026, + 4027, + 3009, + 722, + 2009, + 5243, + 1071, + 247, + 1207, + 2343, + 2478, # 2128 + 1378, + 4613, + 2010, + 864, + 1437, + 1214, + 4614, + 373, + 3849, + 1142, + 2220, + 667, + 4615, + 442, + 2763, + 2563, # 2144 + 3850, + 4028, + 1969, + 4282, + 3300, + 1840, + 837, + 170, + 1107, + 934, + 1336, + 1883, + 5244, + 5245, + 2119, + 4283, # 2160 + 2841, + 743, + 1569, + 5246, + 4616, + 4284, + 582, + 2389, + 1418, + 3484, + 5247, + 1803, + 5248, + 357, + 1395, + 1729, # 2176 + 3717, + 3301, + 2423, + 1564, + 2241, + 5249, + 3106, + 3851, + 1633, + 4617, + 1114, + 2086, + 4285, + 1532, + 5250, + 482, # 2192 + 2451, + 4618, + 5251, + 5252, + 1492, + 833, + 1466, + 5253, + 2726, + 3599, + 1641, + 2842, + 5254, + 1526, + 1272, + 3718, # 2208 + 4286, + 1686, + 1795, + 416, + 2564, + 1903, + 1954, + 1804, + 5255, + 3852, + 2798, + 3853, + 1159, + 2321, + 5256, + 2881, # 2224 + 4619, + 1610, + 1584, + 3056, + 2424, + 2764, + 443, + 3302, + 1163, + 3161, + 5257, + 5258, + 4029, + 5259, + 4287, + 2506, # 2240 + 3057, + 4620, + 4030, + 3162, + 2104, + 1647, + 3600, + 2011, + 1873, + 4288, + 5260, + 4289, + 431, + 3485, + 5261, + 250, # 2256 + 97, + 81, + 4290, + 5262, + 1648, + 1851, + 1558, + 160, + 848, + 5263, + 866, + 740, + 1694, + 5264, + 2204, + 2843, # 2272 + 3226, + 4291, + 4621, + 3719, + 1687, + 950, + 2479, + 426, + 469, + 3227, + 3720, + 3721, + 4031, + 5265, + 5266, + 1188, # 2288 + 424, + 1996, + 861, + 3601, + 4292, + 3854, + 2205, + 2694, + 168, + 1235, + 3602, + 4293, + 5267, + 2087, + 1674, + 4622, # 2304 + 3374, + 3303, + 220, + 2565, + 1009, + 5268, + 3855, + 670, + 3010, + 332, + 1208, + 717, + 5269, + 5270, + 3603, + 2452, # 2320 + 4032, + 3375, + 5271, + 513, + 5272, + 1209, + 2882, + 3376, + 3163, + 4623, + 1080, + 5273, + 5274, + 5275, + 5276, + 2534, # 2336 + 3722, + 3604, + 815, + 1587, + 4033, + 4034, + 5277, + 3605, + 3486, + 3856, + 1254, + 4624, + 1328, + 3058, + 1390, + 4035, # 2352 + 1741, + 4036, + 3857, + 4037, + 5278, + 236, + 3858, + 2453, + 3304, + 5279, + 5280, + 3723, + 3859, + 1273, + 3860, + 4625, # 2368 + 5281, + 308, + 5282, + 4626, + 245, + 4627, + 1852, + 2480, + 1307, + 2583, + 430, + 715, + 2137, + 2454, + 5283, + 270, # 2384 + 199, + 2883, + 4038, + 5284, + 3606, + 2727, + 1753, + 761, + 1754, + 725, + 1661, + 1841, + 4628, + 3487, + 3724, + 5285, # 2400 + 5286, + 587, + 14, + 3305, + 227, + 2608, + 326, + 480, + 2270, + 943, + 2765, + 3607, + 291, + 650, + 1884, + 5287, # 2416 + 1702, + 1226, + 102, + 1547, + 62, + 3488, + 904, + 4629, + 3489, + 1164, + 4294, + 5288, + 5289, + 1224, + 1548, + 2766, # 2432 + 391, + 498, + 1493, + 5290, + 1386, + 1419, + 5291, + 2056, + 1177, + 4630, + 813, + 880, + 1081, + 2368, + 566, + 1145, # 2448 + 4631, + 2291, + 1001, + 1035, + 2566, + 2609, + 2242, + 394, + 1286, + 5292, + 5293, + 2069, + 5294, + 86, + 1494, + 1730, # 2464 + 4039, + 491, + 1588, + 745, + 897, + 2963, + 843, + 3377, + 4040, + 2767, + 2884, + 3306, + 1768, + 998, + 2221, + 2070, # 2480 + 397, + 1827, + 1195, + 1970, + 3725, + 3011, + 3378, + 284, + 5295, + 3861, + 2507, + 2138, + 2120, + 1904, + 5296, + 4041, # 2496 + 2151, + 4042, + 4295, + 1036, + 3490, + 1905, + 114, + 2567, + 4296, + 209, + 1527, + 5297, + 5298, + 2964, + 2844, + 2635, # 2512 + 2390, + 2728, + 3164, + 812, + 2568, + 5299, + 3307, + 5300, + 1559, + 737, + 1885, + 3726, + 1210, + 885, + 28, + 2695, # 2528 + 3608, + 3862, + 5301, + 4297, + 1004, + 1780, + 4632, + 5302, + 346, + 1982, + 2222, + 2696, + 4633, + 3863, + 1742, + 797, # 2544 + 1642, + 4043, + 1934, + 1072, + 1384, + 2152, + 896, + 4044, + 3308, + 3727, + 3228, + 2885, + 3609, + 5303, + 2569, + 1959, # 2560 + 4634, + 2455, + 1786, + 5304, + 5305, + 5306, + 4045, + 4298, + 1005, + 1308, + 3728, + 4299, + 2729, + 4635, + 4636, + 1528, # 2576 + 2610, + 161, + 1178, + 4300, + 1983, + 987, + 4637, + 1101, + 4301, + 631, + 4046, + 1157, + 3229, + 2425, + 1343, + 1241, # 2592 + 1016, + 2243, + 2570, + 372, + 877, + 2344, + 2508, + 1160, + 555, + 1935, + 911, + 4047, + 5307, + 466, + 1170, + 169, # 2608 + 1051, + 2921, + 2697, + 3729, + 2481, + 3012, + 1182, + 2012, + 2571, + 1251, + 2636, + 5308, + 992, + 2345, + 3491, + 1540, # 2624 + 2730, + 1201, + 2071, + 2406, + 1997, + 2482, + 5309, + 4638, + 528, + 1923, + 2191, + 1503, + 1874, + 1570, + 2369, + 3379, # 2640 + 3309, + 5310, + 557, + 1073, + 5311, + 1828, + 3492, + 2088, + 2271, + 3165, + 3059, + 3107, + 767, + 3108, + 2799, + 4639, # 2656 + 1006, + 4302, + 4640, + 2346, + 1267, + 2179, + 3730, + 3230, + 778, + 4048, + 3231, + 2731, + 1597, + 2667, + 5312, + 4641, # 2672 + 5313, + 3493, + 5314, + 5315, + 5316, + 3310, + 2698, + 1433, + 3311, + 131, + 95, + 1504, + 4049, + 723, + 4303, + 3166, # 2688 + 1842, + 3610, + 2768, + 2192, + 4050, + 2028, + 2105, + 3731, + 5317, + 3013, + 4051, + 1218, + 5318, + 3380, + 3232, + 4052, # 2704 + 4304, + 2584, + 248, + 1634, + 3864, + 912, + 5319, + 2845, + 3732, + 3060, + 3865, + 654, + 53, + 5320, + 3014, + 5321, # 2720 + 1688, + 4642, + 777, + 3494, + 1032, + 4053, + 1425, + 5322, + 191, + 820, + 2121, + 2846, + 971, + 4643, + 931, + 3233, # 2736 + 135, + 664, + 783, + 3866, + 1998, + 772, + 2922, + 1936, + 4054, + 3867, + 4644, + 2923, + 3234, + 282, + 2732, + 640, # 2752 + 1372, + 3495, + 1127, + 922, + 325, + 3381, + 5323, + 5324, + 711, + 2045, + 5325, + 5326, + 4055, + 2223, + 2800, + 1937, # 2768 + 4056, + 3382, + 2224, + 2255, + 3868, + 2305, + 5327, + 4645, + 3869, + 1258, + 3312, + 4057, + 3235, + 2139, + 2965, + 4058, # 2784 + 4059, + 5328, + 2225, + 258, + 3236, + 4646, + 101, + 1227, + 5329, + 3313, + 1755, + 5330, + 1391, + 3314, + 5331, + 2924, # 2800 + 2057, + 893, + 5332, + 5333, + 5334, + 1402, + 4305, + 2347, + 5335, + 5336, + 3237, + 3611, + 5337, + 5338, + 878, + 1325, # 2816 + 1781, + 2801, + 4647, + 259, + 1385, + 2585, + 744, + 1183, + 2272, + 4648, + 5339, + 4060, + 2509, + 5340, + 684, + 1024, # 2832 + 4306, + 5341, + 472, + 3612, + 3496, + 1165, + 3315, + 4061, + 4062, + 322, + 2153, + 881, + 455, + 1695, + 1152, + 1340, # 2848 + 660, + 554, + 2154, + 4649, + 1058, + 4650, + 4307, + 830, + 1065, + 3383, + 4063, + 4651, + 1924, + 5342, + 1703, + 1919, # 2864 + 5343, + 932, + 2273, + 122, + 5344, + 4652, + 947, + 677, + 5345, + 3870, + 2637, + 297, + 1906, + 1925, + 2274, + 4653, # 2880 + 2322, + 3316, + 5346, + 5347, + 4308, + 5348, + 4309, + 84, + 4310, + 112, + 989, + 5349, + 547, + 1059, + 4064, + 701, # 2896 + 3613, + 1019, + 5350, + 4311, + 5351, + 3497, + 942, + 639, + 457, + 2306, + 2456, + 993, + 2966, + 407, + 851, + 494, # 2912 + 4654, + 3384, + 927, + 5352, + 1237, + 5353, + 2426, + 3385, + 573, + 4312, + 680, + 921, + 2925, + 1279, + 1875, + 285, # 2928 + 790, + 1448, + 1984, + 719, + 2168, + 5354, + 5355, + 4655, + 4065, + 4066, + 1649, + 5356, + 1541, + 563, + 5357, + 1077, # 2944 + 5358, + 3386, + 3061, + 3498, + 511, + 3015, + 4067, + 4068, + 3733, + 4069, + 1268, + 2572, + 3387, + 3238, + 4656, + 4657, # 2960 + 5359, + 535, + 1048, + 1276, + 1189, + 2926, + 2029, + 3167, + 1438, + 1373, + 2847, + 2967, + 1134, + 2013, + 5360, + 4313, # 2976 + 1238, + 2586, + 3109, + 1259, + 5361, + 700, + 5362, + 2968, + 3168, + 3734, + 4314, + 5363, + 4315, + 1146, + 1876, + 1907, # 2992 + 4658, + 2611, + 4070, + 781, + 2427, + 132, + 1589, + 203, + 147, + 273, + 2802, + 2407, + 898, + 1787, + 2155, + 4071, # 3008 + 4072, + 5364, + 3871, + 2803, + 5365, + 5366, + 4659, + 4660, + 5367, + 3239, + 5368, + 1635, + 3872, + 965, + 5369, + 1805, # 3024 + 2699, + 1516, + 3614, + 1121, + 1082, + 1329, + 3317, + 4073, + 1449, + 3873, + 65, + 1128, + 2848, + 2927, + 2769, + 1590, # 3040 + 3874, + 5370, + 5371, + 12, + 2668, + 45, + 976, + 2587, + 3169, + 4661, + 517, + 2535, + 1013, + 1037, + 3240, + 5372, # 3056 + 3875, + 2849, + 5373, + 3876, + 5374, + 3499, + 5375, + 2612, + 614, + 1999, + 2323, + 3877, + 3110, + 2733, + 2638, + 5376, # 3072 + 2588, + 4316, + 599, + 1269, + 5377, + 1811, + 3735, + 5378, + 2700, + 3111, + 759, + 1060, + 489, + 1806, + 3388, + 3318, # 3088 + 1358, + 5379, + 5380, + 2391, + 1387, + 1215, + 2639, + 2256, + 490, + 5381, + 5382, + 4317, + 1759, + 2392, + 2348, + 5383, # 3104 + 4662, + 3878, + 1908, + 4074, + 2640, + 1807, + 3241, + 4663, + 3500, + 3319, + 2770, + 2349, + 874, + 5384, + 5385, + 3501, # 3120 + 3736, + 1859, + 91, + 2928, + 3737, + 3062, + 3879, + 4664, + 5386, + 3170, + 4075, + 2669, + 5387, + 3502, + 1202, + 1403, # 3136 + 3880, + 2969, + 2536, + 1517, + 2510, + 4665, + 3503, + 2511, + 5388, + 4666, + 5389, + 2701, + 1886, + 1495, + 1731, + 4076, # 3152 + 2370, + 4667, + 5390, + 2030, + 5391, + 5392, + 4077, + 2702, + 1216, + 237, + 2589, + 4318, + 2324, + 4078, + 3881, + 4668, # 3168 + 4669, + 2703, + 3615, + 3504, + 445, + 4670, + 5393, + 5394, + 5395, + 5396, + 2771, + 61, + 4079, + 3738, + 1823, + 4080, # 3184 + 5397, + 687, + 2046, + 935, + 925, + 405, + 2670, + 703, + 1096, + 1860, + 2734, + 4671, + 4081, + 1877, + 1367, + 2704, # 3200 + 3389, + 918, + 2106, + 1782, + 2483, + 334, + 3320, + 1611, + 1093, + 4672, + 564, + 3171, + 3505, + 3739, + 3390, + 945, # 3216 + 2641, + 2058, + 4673, + 5398, + 1926, + 872, + 4319, + 5399, + 3506, + 2705, + 3112, + 349, + 4320, + 3740, + 4082, + 4674, # 3232 + 3882, + 4321, + 3741, + 2156, + 4083, + 4675, + 4676, + 4322, + 4677, + 2408, + 2047, + 782, + 4084, + 400, + 251, + 4323, # 3248 + 1624, + 5400, + 5401, + 277, + 3742, + 299, + 1265, + 476, + 1191, + 3883, + 2122, + 4324, + 4325, + 1109, + 205, + 5402, # 3264 + 2590, + 1000, + 2157, + 3616, + 1861, + 5403, + 5404, + 5405, + 4678, + 5406, + 4679, + 2573, + 107, + 2484, + 2158, + 4085, # 3280 + 3507, + 3172, + 5407, + 1533, + 541, + 1301, + 158, + 753, + 4326, + 2886, + 3617, + 5408, + 1696, + 370, + 1088, + 4327, # 3296 + 4680, + 3618, + 579, + 327, + 440, + 162, + 2244, + 269, + 1938, + 1374, + 3508, + 968, + 3063, + 56, + 1396, + 3113, # 3312 + 2107, + 3321, + 3391, + 5409, + 1927, + 2159, + 4681, + 3016, + 5410, + 3619, + 5411, + 5412, + 3743, + 4682, + 2485, + 5413, # 3328 + 2804, + 5414, + 1650, + 4683, + 5415, + 2613, + 5416, + 5417, + 4086, + 2671, + 3392, + 1149, + 3393, + 4087, + 3884, + 4088, # 3344 + 5418, + 1076, + 49, + 5419, + 951, + 3242, + 3322, + 3323, + 450, + 2850, + 920, + 5420, + 1812, + 2805, + 2371, + 4328, # 3360 + 1909, + 1138, + 2372, + 3885, + 3509, + 5421, + 3243, + 4684, + 1910, + 1147, + 1518, + 2428, + 4685, + 3886, + 5422, + 4686, # 3376 + 2393, + 2614, + 260, + 1796, + 3244, + 5423, + 5424, + 3887, + 3324, + 708, + 5425, + 3620, + 1704, + 5426, + 3621, + 1351, # 3392 + 1618, + 3394, + 3017, + 1887, + 944, + 4329, + 3395, + 4330, + 3064, + 3396, + 4331, + 5427, + 3744, + 422, + 413, + 1714, # 3408 + 3325, + 500, + 2059, + 2350, + 4332, + 2486, + 5428, + 1344, + 1911, + 954, + 5429, + 1668, + 5430, + 5431, + 4089, + 2409, # 3424 + 4333, + 3622, + 3888, + 4334, + 5432, + 2307, + 1318, + 2512, + 3114, + 133, + 3115, + 2887, + 4687, + 629, + 31, + 2851, # 3440 + 2706, + 3889, + 4688, + 850, + 949, + 4689, + 4090, + 2970, + 1732, + 2089, + 4335, + 1496, + 1853, + 5433, + 4091, + 620, # 3456 + 3245, + 981, + 1242, + 3745, + 3397, + 1619, + 3746, + 1643, + 3326, + 2140, + 2457, + 1971, + 1719, + 3510, + 2169, + 5434, # 3472 + 3246, + 5435, + 5436, + 3398, + 1829, + 5437, + 1277, + 4690, + 1565, + 2048, + 5438, + 1636, + 3623, + 3116, + 5439, + 869, # 3488 + 2852, + 655, + 3890, + 3891, + 3117, + 4092, + 3018, + 3892, + 1310, + 3624, + 4691, + 5440, + 5441, + 5442, + 1733, + 558, # 3504 + 4692, + 3747, + 335, + 1549, + 3065, + 1756, + 4336, + 3748, + 1946, + 3511, + 1830, + 1291, + 1192, + 470, + 2735, + 2108, # 3520 + 2806, + 913, + 1054, + 4093, + 5443, + 1027, + 5444, + 3066, + 4094, + 4693, + 982, + 2672, + 3399, + 3173, + 3512, + 3247, # 3536 + 3248, + 1947, + 2807, + 5445, + 571, + 4694, + 5446, + 1831, + 5447, + 3625, + 2591, + 1523, + 2429, + 5448, + 2090, + 984, # 3552 + 4695, + 3749, + 1960, + 5449, + 3750, + 852, + 923, + 2808, + 3513, + 3751, + 969, + 1519, + 999, + 2049, + 2325, + 1705, # 3568 + 5450, + 3118, + 615, + 1662, + 151, + 597, + 4095, + 2410, + 2326, + 1049, + 275, + 4696, + 3752, + 4337, + 568, + 3753, # 3584 + 3626, + 2487, + 4338, + 3754, + 5451, + 2430, + 2275, + 409, + 3249, + 5452, + 1566, + 2888, + 3514, + 1002, + 769, + 2853, # 3600 + 194, + 2091, + 3174, + 3755, + 2226, + 3327, + 4339, + 628, + 1505, + 5453, + 5454, + 1763, + 2180, + 3019, + 4096, + 521, # 3616 + 1161, + 2592, + 1788, + 2206, + 2411, + 4697, + 4097, + 1625, + 4340, + 4341, + 412, + 42, + 3119, + 464, + 5455, + 2642, # 3632 + 4698, + 3400, + 1760, + 1571, + 2889, + 3515, + 2537, + 1219, + 2207, + 3893, + 2643, + 2141, + 2373, + 4699, + 4700, + 3328, # 3648 + 1651, + 3401, + 3627, + 5456, + 5457, + 3628, + 2488, + 3516, + 5458, + 3756, + 5459, + 5460, + 2276, + 2092, + 460, + 5461, # 3664 + 4701, + 5462, + 3020, + 962, + 588, + 3629, + 289, + 3250, + 2644, + 1116, + 52, + 5463, + 3067, + 1797, + 5464, + 5465, # 3680 + 5466, + 1467, + 5467, + 1598, + 1143, + 3757, + 4342, + 1985, + 1734, + 1067, + 4702, + 1280, + 3402, + 465, + 4703, + 1572, # 3696 + 510, + 5468, + 1928, + 2245, + 1813, + 1644, + 3630, + 5469, + 4704, + 3758, + 5470, + 5471, + 2673, + 1573, + 1534, + 5472, # 3712 + 5473, + 536, + 1808, + 1761, + 3517, + 3894, + 3175, + 2645, + 5474, + 5475, + 5476, + 4705, + 3518, + 2929, + 1912, + 2809, # 3728 + 5477, + 3329, + 1122, + 377, + 3251, + 5478, + 360, + 5479, + 5480, + 4343, + 1529, + 551, + 5481, + 2060, + 3759, + 1769, # 3744 + 2431, + 5482, + 2930, + 4344, + 3330, + 3120, + 2327, + 2109, + 2031, + 4706, + 1404, + 136, + 1468, + 1479, + 672, + 1171, # 3760 + 3252, + 2308, + 271, + 3176, + 5483, + 2772, + 5484, + 2050, + 678, + 2736, + 865, + 1948, + 4707, + 5485, + 2014, + 4098, # 3776 + 2971, + 5486, + 2737, + 2227, + 1397, + 3068, + 3760, + 4708, + 4709, + 1735, + 2931, + 3403, + 3631, + 5487, + 3895, + 509, # 3792 + 2854, + 2458, + 2890, + 3896, + 5488, + 5489, + 3177, + 3178, + 4710, + 4345, + 2538, + 4711, + 2309, + 1166, + 1010, + 552, # 3808 + 681, + 1888, + 5490, + 5491, + 2972, + 2973, + 4099, + 1287, + 1596, + 1862, + 3179, + 358, + 453, + 736, + 175, + 478, # 3824 + 1117, + 905, + 1167, + 1097, + 5492, + 1854, + 1530, + 5493, + 1706, + 5494, + 2181, + 3519, + 2292, + 3761, + 3520, + 3632, # 3840 + 4346, + 2093, + 4347, + 5495, + 3404, + 1193, + 2489, + 4348, + 1458, + 2193, + 2208, + 1863, + 1889, + 1421, + 3331, + 2932, # 3856 + 3069, + 2182, + 3521, + 595, + 2123, + 5496, + 4100, + 5497, + 5498, + 4349, + 1707, + 2646, + 223, + 3762, + 1359, + 751, # 3872 + 3121, + 183, + 3522, + 5499, + 2810, + 3021, + 419, + 2374, + 633, + 704, + 3897, + 2394, + 241, + 5500, + 5501, + 5502, # 3888 + 838, + 3022, + 3763, + 2277, + 2773, + 2459, + 3898, + 1939, + 2051, + 4101, + 1309, + 3122, + 2246, + 1181, + 5503, + 1136, # 3904 + 2209, + 3899, + 2375, + 1446, + 4350, + 2310, + 4712, + 5504, + 5505, + 4351, + 1055, + 2615, + 484, + 3764, + 5506, + 4102, # 3920 + 625, + 4352, + 2278, + 3405, + 1499, + 4353, + 4103, + 5507, + 4104, + 4354, + 3253, + 2279, + 2280, + 3523, + 5508, + 5509, # 3936 + 2774, + 808, + 2616, + 3765, + 3406, + 4105, + 4355, + 3123, + 2539, + 526, + 3407, + 3900, + 4356, + 955, + 5510, + 1620, # 3952 + 4357, + 2647, + 2432, + 5511, + 1429, + 3766, + 1669, + 1832, + 994, + 928, + 5512, + 3633, + 1260, + 5513, + 5514, + 5515, # 3968 + 1949, + 2293, + 741, + 2933, + 1626, + 4358, + 2738, + 2460, + 867, + 1184, + 362, + 3408, + 1392, + 5516, + 5517, + 4106, # 3984 + 4359, + 1770, + 1736, + 3254, + 2934, + 4713, + 4714, + 1929, + 2707, + 1459, + 1158, + 5518, + 3070, + 3409, + 2891, + 1292, # 4000 + 1930, + 2513, + 2855, + 3767, + 1986, + 1187, + 2072, + 2015, + 2617, + 4360, + 5519, + 2574, + 2514, + 2170, + 3768, + 2490, # 4016 + 3332, + 5520, + 3769, + 4715, + 5521, + 5522, + 666, + 1003, + 3023, + 1022, + 3634, + 4361, + 5523, + 4716, + 1814, + 2257, # 4032 + 574, + 3901, + 1603, + 295, + 1535, + 705, + 3902, + 4362, + 283, + 858, + 417, + 5524, + 5525, + 3255, + 4717, + 4718, # 4048 + 3071, + 1220, + 1890, + 1046, + 2281, + 2461, + 4107, + 1393, + 1599, + 689, + 2575, + 388, + 4363, + 5526, + 2491, + 802, # 4064 + 5527, + 2811, + 3903, + 2061, + 1405, + 2258, + 5528, + 4719, + 3904, + 2110, + 1052, + 1345, + 3256, + 1585, + 5529, + 809, # 4080 + 5530, + 5531, + 5532, + 575, + 2739, + 3524, + 956, + 1552, + 1469, + 1144, + 2328, + 5533, + 2329, + 1560, + 2462, + 3635, # 4096 + 3257, + 4108, + 616, + 2210, + 4364, + 3180, + 2183, + 2294, + 5534, + 1833, + 5535, + 3525, + 4720, + 5536, + 1319, + 3770, # 4112 + 3771, + 1211, + 3636, + 1023, + 3258, + 1293, + 2812, + 5537, + 5538, + 5539, + 3905, + 607, + 2311, + 3906, + 762, + 2892, # 4128 + 1439, + 4365, + 1360, + 4721, + 1485, + 3072, + 5540, + 4722, + 1038, + 4366, + 1450, + 2062, + 2648, + 4367, + 1379, + 4723, # 4144 + 2593, + 5541, + 5542, + 4368, + 1352, + 1414, + 2330, + 2935, + 1172, + 5543, + 5544, + 3907, + 3908, + 4724, + 1798, + 1451, # 4160 + 5545, + 5546, + 5547, + 5548, + 2936, + 4109, + 4110, + 2492, + 2351, + 411, + 4111, + 4112, + 3637, + 3333, + 3124, + 4725, # 4176 + 1561, + 2674, + 1452, + 4113, + 1375, + 5549, + 5550, + 47, + 2974, + 316, + 5551, + 1406, + 1591, + 2937, + 3181, + 5552, # 4192 + 1025, + 2142, + 3125, + 3182, + 354, + 2740, + 884, + 2228, + 4369, + 2412, + 508, + 3772, + 726, + 3638, + 996, + 2433, # 4208 + 3639, + 729, + 5553, + 392, + 2194, + 1453, + 4114, + 4726, + 3773, + 5554, + 5555, + 2463, + 3640, + 2618, + 1675, + 2813, # 4224 + 919, + 2352, + 2975, + 2353, + 1270, + 4727, + 4115, + 73, + 5556, + 5557, + 647, + 5558, + 3259, + 2856, + 2259, + 1550, # 4240 + 1346, + 3024, + 5559, + 1332, + 883, + 3526, + 5560, + 5561, + 5562, + 5563, + 3334, + 2775, + 5564, + 1212, + 831, + 1347, # 4256 + 4370, + 4728, + 2331, + 3909, + 1864, + 3073, + 720, + 3910, + 4729, + 4730, + 3911, + 5565, + 4371, + 5566, + 5567, + 4731, # 4272 + 5568, + 5569, + 1799, + 4732, + 3774, + 2619, + 4733, + 3641, + 1645, + 2376, + 4734, + 5570, + 2938, + 669, + 2211, + 2675, # 4288 + 2434, + 5571, + 2893, + 5572, + 5573, + 1028, + 3260, + 5574, + 4372, + 2413, + 5575, + 2260, + 1353, + 5576, + 5577, + 4735, # 4304 + 3183, + 518, + 5578, + 4116, + 5579, + 4373, + 1961, + 5580, + 2143, + 4374, + 5581, + 5582, + 3025, + 2354, + 2355, + 3912, # 4320 + 516, + 1834, + 1454, + 4117, + 2708, + 4375, + 4736, + 2229, + 2620, + 1972, + 1129, + 3642, + 5583, + 2776, + 5584, + 2976, # 4336 + 1422, + 577, + 1470, + 3026, + 1524, + 3410, + 5585, + 5586, + 432, + 4376, + 3074, + 3527, + 5587, + 2594, + 1455, + 2515, # 4352 + 2230, + 1973, + 1175, + 5588, + 1020, + 2741, + 4118, + 3528, + 4737, + 5589, + 2742, + 5590, + 1743, + 1361, + 3075, + 3529, # 4368 + 2649, + 4119, + 4377, + 4738, + 2295, + 895, + 924, + 4378, + 2171, + 331, + 2247, + 3076, + 166, + 1627, + 3077, + 1098, # 4384 + 5591, + 1232, + 2894, + 2231, + 3411, + 4739, + 657, + 403, + 1196, + 2377, + 542, + 3775, + 3412, + 1600, + 4379, + 3530, # 4400 + 5592, + 4740, + 2777, + 3261, + 576, + 530, + 1362, + 4741, + 4742, + 2540, + 2676, + 3776, + 4120, + 5593, + 842, + 3913, # 4416 + 5594, + 2814, + 2032, + 1014, + 4121, + 213, + 2709, + 3413, + 665, + 621, + 4380, + 5595, + 3777, + 2939, + 2435, + 5596, # 4432 + 2436, + 3335, + 3643, + 3414, + 4743, + 4381, + 2541, + 4382, + 4744, + 3644, + 1682, + 4383, + 3531, + 1380, + 5597, + 724, # 4448 + 2282, + 600, + 1670, + 5598, + 1337, + 1233, + 4745, + 3126, + 2248, + 5599, + 1621, + 4746, + 5600, + 651, + 4384, + 5601, # 4464 + 1612, + 4385, + 2621, + 5602, + 2857, + 5603, + 2743, + 2312, + 3078, + 5604, + 716, + 2464, + 3079, + 174, + 1255, + 2710, # 4480 + 4122, + 3645, + 548, + 1320, + 1398, + 728, + 4123, + 1574, + 5605, + 1891, + 1197, + 3080, + 4124, + 5606, + 3081, + 3082, # 4496 + 3778, + 3646, + 3779, + 747, + 5607, + 635, + 4386, + 4747, + 5608, + 5609, + 5610, + 4387, + 5611, + 5612, + 4748, + 5613, # 4512 + 3415, + 4749, + 2437, + 451, + 5614, + 3780, + 2542, + 2073, + 4388, + 2744, + 4389, + 4125, + 5615, + 1764, + 4750, + 5616, # 4528 + 4390, + 350, + 4751, + 2283, + 2395, + 2493, + 5617, + 4391, + 4126, + 2249, + 1434, + 4127, + 488, + 4752, + 458, + 4392, # 4544 + 4128, + 3781, + 771, + 1330, + 2396, + 3914, + 2576, + 3184, + 2160, + 2414, + 1553, + 2677, + 3185, + 4393, + 5618, + 2494, # 4560 + 2895, + 2622, + 1720, + 2711, + 4394, + 3416, + 4753, + 5619, + 2543, + 4395, + 5620, + 3262, + 4396, + 2778, + 5621, + 2016, # 4576 + 2745, + 5622, + 1155, + 1017, + 3782, + 3915, + 5623, + 3336, + 2313, + 201, + 1865, + 4397, + 1430, + 5624, + 4129, + 5625, # 4592 + 5626, + 5627, + 5628, + 5629, + 4398, + 1604, + 5630, + 414, + 1866, + 371, + 2595, + 4754, + 4755, + 3532, + 2017, + 3127, # 4608 + 4756, + 1708, + 960, + 4399, + 887, + 389, + 2172, + 1536, + 1663, + 1721, + 5631, + 2232, + 4130, + 2356, + 2940, + 1580, # 4624 + 5632, + 5633, + 1744, + 4757, + 2544, + 4758, + 4759, + 5634, + 4760, + 5635, + 2074, + 5636, + 4761, + 3647, + 3417, + 2896, # 4640 + 4400, + 5637, + 4401, + 2650, + 3418, + 2815, + 673, + 2712, + 2465, + 709, + 3533, + 4131, + 3648, + 4402, + 5638, + 1148, # 4656 + 502, + 634, + 5639, + 5640, + 1204, + 4762, + 3649, + 1575, + 4763, + 2623, + 3783, + 5641, + 3784, + 3128, + 948, + 3263, # 4672 + 121, + 1745, + 3916, + 1110, + 5642, + 4403, + 3083, + 2516, + 3027, + 4132, + 3785, + 1151, + 1771, + 3917, + 1488, + 4133, # 4688 + 1987, + 5643, + 2438, + 3534, + 5644, + 5645, + 2094, + 5646, + 4404, + 3918, + 1213, + 1407, + 2816, + 531, + 2746, + 2545, # 4704 + 3264, + 1011, + 1537, + 4764, + 2779, + 4405, + 3129, + 1061, + 5647, + 3786, + 3787, + 1867, + 2897, + 5648, + 2018, + 120, # 4720 + 4406, + 4407, + 2063, + 3650, + 3265, + 2314, + 3919, + 2678, + 3419, + 1955, + 4765, + 4134, + 5649, + 3535, + 1047, + 2713, # 4736 + 1266, + 5650, + 1368, + 4766, + 2858, + 649, + 3420, + 3920, + 2546, + 2747, + 1102, + 2859, + 2679, + 5651, + 5652, + 2000, # 4752 + 5653, + 1111, + 3651, + 2977, + 5654, + 2495, + 3921, + 3652, + 2817, + 1855, + 3421, + 3788, + 5655, + 5656, + 3422, + 2415, # 4768 + 2898, + 3337, + 3266, + 3653, + 5657, + 2577, + 5658, + 3654, + 2818, + 4135, + 1460, + 856, + 5659, + 3655, + 5660, + 2899, # 4784 + 2978, + 5661, + 2900, + 3922, + 5662, + 4408, + 632, + 2517, + 875, + 3923, + 1697, + 3924, + 2296, + 5663, + 5664, + 4767, # 4800 + 3028, + 1239, + 580, + 4768, + 4409, + 5665, + 914, + 936, + 2075, + 1190, + 4136, + 1039, + 2124, + 5666, + 5667, + 5668, # 4816 + 5669, + 3423, + 1473, + 5670, + 1354, + 4410, + 3925, + 4769, + 2173, + 3084, + 4137, + 915, + 3338, + 4411, + 4412, + 3339, # 4832 + 1605, + 1835, + 5671, + 2748, + 398, + 3656, + 4413, + 3926, + 4138, + 328, + 1913, + 2860, + 4139, + 3927, + 1331, + 4414, # 4848 + 3029, + 937, + 4415, + 5672, + 3657, + 4140, + 4141, + 3424, + 2161, + 4770, + 3425, + 524, + 742, + 538, + 3085, + 1012, # 4864 + 5673, + 5674, + 3928, + 2466, + 5675, + 658, + 1103, + 225, + 3929, + 5676, + 5677, + 4771, + 5678, + 4772, + 5679, + 3267, # 4880 + 1243, + 5680, + 4142, + 963, + 2250, + 4773, + 5681, + 2714, + 3658, + 3186, + 5682, + 5683, + 2596, + 2332, + 5684, + 4774, # 4896 + 5685, + 5686, + 5687, + 3536, + 957, + 3426, + 2547, + 2033, + 1931, + 2941, + 2467, + 870, + 2019, + 3659, + 1746, + 2780, # 4912 + 2781, + 2439, + 2468, + 5688, + 3930, + 5689, + 3789, + 3130, + 3790, + 3537, + 3427, + 3791, + 5690, + 1179, + 3086, + 5691, # 4928 + 3187, + 2378, + 4416, + 3792, + 2548, + 3188, + 3131, + 2749, + 4143, + 5692, + 3428, + 1556, + 2549, + 2297, + 977, + 2901, # 4944 + 2034, + 4144, + 1205, + 3429, + 5693, + 1765, + 3430, + 3189, + 2125, + 1271, + 714, + 1689, + 4775, + 3538, + 5694, + 2333, # 4960 + 3931, + 533, + 4417, + 3660, + 2184, + 617, + 5695, + 2469, + 3340, + 3539, + 2315, + 5696, + 5697, + 3190, + 5698, + 5699, # 4976 + 3932, + 1988, + 618, + 427, + 2651, + 3540, + 3431, + 5700, + 5701, + 1244, + 1690, + 5702, + 2819, + 4418, + 4776, + 5703, # 4992 + 3541, + 4777, + 5704, + 2284, + 1576, + 473, + 3661, + 4419, + 3432, + 972, + 5705, + 3662, + 5706, + 3087, + 5707, + 5708, # 5008 + 4778, + 4779, + 5709, + 3793, + 4145, + 4146, + 5710, + 153, + 4780, + 356, + 5711, + 1892, + 2902, + 4420, + 2144, + 408, # 5024 + 803, + 2357, + 5712, + 3933, + 5713, + 4421, + 1646, + 2578, + 2518, + 4781, + 4782, + 3934, + 5714, + 3935, + 4422, + 5715, # 5040 + 2416, + 3433, + 752, + 5716, + 5717, + 1962, + 3341, + 2979, + 5718, + 746, + 3030, + 2470, + 4783, + 4423, + 3794, + 698, # 5056 + 4784, + 1893, + 4424, + 3663, + 2550, + 4785, + 3664, + 3936, + 5719, + 3191, + 3434, + 5720, + 1824, + 1302, + 4147, + 2715, # 5072 + 3937, + 1974, + 4425, + 5721, + 4426, + 3192, + 823, + 1303, + 1288, + 1236, + 2861, + 3542, + 4148, + 3435, + 774, + 3938, # 5088 + 5722, + 1581, + 4786, + 1304, + 2862, + 3939, + 4787, + 5723, + 2440, + 2162, + 1083, + 3268, + 4427, + 4149, + 4428, + 344, # 5104 + 1173, + 288, + 2316, + 454, + 1683, + 5724, + 5725, + 1461, + 4788, + 4150, + 2597, + 5726, + 5727, + 4789, + 985, + 894, # 5120 + 5728, + 3436, + 3193, + 5729, + 1914, + 2942, + 3795, + 1989, + 5730, + 2111, + 1975, + 5731, + 4151, + 5732, + 2579, + 1194, # 5136 + 425, + 5733, + 4790, + 3194, + 1245, + 3796, + 4429, + 5734, + 5735, + 2863, + 5736, + 636, + 4791, + 1856, + 3940, + 760, # 5152 + 1800, + 5737, + 4430, + 2212, + 1508, + 4792, + 4152, + 1894, + 1684, + 2298, + 5738, + 5739, + 4793, + 4431, + 4432, + 2213, # 5168 + 479, + 5740, + 5741, + 832, + 5742, + 4153, + 2496, + 5743, + 2980, + 2497, + 3797, + 990, + 3132, + 627, + 1815, + 2652, # 5184 + 4433, + 1582, + 4434, + 2126, + 2112, + 3543, + 4794, + 5744, + 799, + 4435, + 3195, + 5745, + 4795, + 2113, + 1737, + 3031, # 5200 + 1018, + 543, + 754, + 4436, + 3342, + 1676, + 4796, + 4797, + 4154, + 4798, + 1489, + 5746, + 3544, + 5747, + 2624, + 2903, # 5216 + 4155, + 5748, + 5749, + 2981, + 5750, + 5751, + 5752, + 5753, + 3196, + 4799, + 4800, + 2185, + 1722, + 5754, + 3269, + 3270, # 5232 + 1843, + 3665, + 1715, + 481, + 365, + 1976, + 1857, + 5755, + 5756, + 1963, + 2498, + 4801, + 5757, + 2127, + 3666, + 3271, # 5248 + 433, + 1895, + 2064, + 2076, + 5758, + 602, + 2750, + 5759, + 5760, + 5761, + 5762, + 5763, + 3032, + 1628, + 3437, + 5764, # 5264 + 3197, + 4802, + 4156, + 2904, + 4803, + 2519, + 5765, + 2551, + 2782, + 5766, + 5767, + 5768, + 3343, + 4804, + 2905, + 5769, # 5280 + 4805, + 5770, + 2864, + 4806, + 4807, + 1221, + 2982, + 4157, + 2520, + 5771, + 5772, + 5773, + 1868, + 1990, + 5774, + 5775, # 5296 + 5776, + 1896, + 5777, + 5778, + 4808, + 1897, + 4158, + 318, + 5779, + 2095, + 4159, + 4437, + 5780, + 5781, + 485, + 5782, # 5312 + 938, + 3941, + 553, + 2680, + 116, + 5783, + 3942, + 3667, + 5784, + 3545, + 2681, + 2783, + 3438, + 3344, + 2820, + 5785, # 5328 + 3668, + 2943, + 4160, + 1747, + 2944, + 2983, + 5786, + 5787, + 207, + 5788, + 4809, + 5789, + 4810, + 2521, + 5790, + 3033, # 5344 + 890, + 3669, + 3943, + 5791, + 1878, + 3798, + 3439, + 5792, + 2186, + 2358, + 3440, + 1652, + 5793, + 5794, + 5795, + 941, # 5360 + 2299, + 208, + 3546, + 4161, + 2020, + 330, + 4438, + 3944, + 2906, + 2499, + 3799, + 4439, + 4811, + 5796, + 5797, + 5798, # 5376 ) - diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/chardistribution.py b/src/fetchcode/vcs/pip/_vendor/chardet/chardistribution.py index c0395f4a..25e2b289 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/chardistribution.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/chardistribution.py @@ -25,16 +25,31 @@ # 02110-1301 USA ######################### END LICENSE BLOCK ######################### -from .euctwfreq import (EUCTW_CHAR_TO_FREQ_ORDER, EUCTW_TABLE_SIZE, - EUCTW_TYPICAL_DISTRIBUTION_RATIO) -from .euckrfreq import (EUCKR_CHAR_TO_FREQ_ORDER, EUCKR_TABLE_SIZE, - EUCKR_TYPICAL_DISTRIBUTION_RATIO) -from .gb2312freq import (GB2312_CHAR_TO_FREQ_ORDER, GB2312_TABLE_SIZE, - GB2312_TYPICAL_DISTRIBUTION_RATIO) -from .big5freq import (BIG5_CHAR_TO_FREQ_ORDER, BIG5_TABLE_SIZE, - BIG5_TYPICAL_DISTRIBUTION_RATIO) -from .jisfreq import (JIS_CHAR_TO_FREQ_ORDER, JIS_TABLE_SIZE, - JIS_TYPICAL_DISTRIBUTION_RATIO) +from .euctwfreq import ( + EUCTW_CHAR_TO_FREQ_ORDER, + EUCTW_TABLE_SIZE, + EUCTW_TYPICAL_DISTRIBUTION_RATIO, +) +from .euckrfreq import ( + EUCKR_CHAR_TO_FREQ_ORDER, + EUCKR_TABLE_SIZE, + EUCKR_TYPICAL_DISTRIBUTION_RATIO, +) +from .gb2312freq import ( + GB2312_CHAR_TO_FREQ_ORDER, + GB2312_TABLE_SIZE, + GB2312_TYPICAL_DISTRIBUTION_RATIO, +) +from .big5freq import ( + BIG5_CHAR_TO_FREQ_ORDER, + BIG5_TABLE_SIZE, + BIG5_TYPICAL_DISTRIBUTION_RATIO, +) +from .jisfreq import ( + JIS_CHAR_TO_FREQ_ORDER, + JIS_TABLE_SIZE, + JIS_TYPICAL_DISTRIBUTION_RATIO, +) class CharDistributionAnalysis(object): @@ -89,8 +104,9 @@ def get_confidence(self): return self.SURE_NO if self._total_chars != self._freq_chars: - r = (self._freq_chars / ((self._total_chars - self._freq_chars) - * self.typical_distribution_ratio)) + r = self._freq_chars / ( + (self._total_chars - self._freq_chars) * self.typical_distribution_ratio + ) if r < self.SURE_YES: return r @@ -228,6 +244,6 @@ def get_order(self, byte_str): # no validation needed here. State machine has done that char = byte_str[0] if char >= 0xA0: - return 94 * (char - 0xA1) + byte_str[1] - 0xa1 + return 94 * (char - 0xA1) + byte_str[1] - 0xA1 else: return -1 diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/charsetgroupprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/charsetgroupprober.py index 8b3738ef..241c2937 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/charsetgroupprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/charsetgroupprober.py @@ -94,10 +94,12 @@ def get_confidence(self): if not prober: continue if not prober.active: - self.logger.debug('%s not active', prober.charset_name) + self.logger.debug("%s not active", prober.charset_name) continue conf = prober.get_confidence() - self.logger.debug('%s %s confidence = %s', prober.charset_name, prober.language, conf) + self.logger.debug( + "%s %s confidence = %s", prober.charset_name, prober.language, conf + ) if best_conf < conf: best_conf = conf self._best_guess_prober = prober diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/charsetprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/charsetprober.py index eac4e598..4a646a75 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/charsetprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/charsetprober.py @@ -60,7 +60,7 @@ def get_confidence(self): @staticmethod def filter_high_byte_only(buf): - buf = re.sub(b'([\x00-\x7F])+', b' ', buf) + buf = re.sub(b"([\x00-\x7F])+", b" ", buf) return buf @staticmethod @@ -83,8 +83,7 @@ def filter_international_words(buf): # This regex expression filters out only words that have at-least one # international character. The word may include one marker character at # the end. - words = re.findall(b'[a-zA-Z]*[\x80-\xFF]+[a-zA-Z]*[^a-zA-Z\x80-\xFF]?', - buf) + words = re.findall(b"[a-zA-Z]*[\x80-\xFF]+[a-zA-Z]*[^a-zA-Z\x80-\xFF]?", buf) for word in words: filtered.extend(word[:-1]) @@ -94,8 +93,8 @@ def filter_international_words(buf): # similarly across all languages and may thus have similar # frequencies). last_char = word[-1:] - if not last_char.isalpha() and last_char < b'\x80': - last_char = b' ' + if not last_char.isalpha() and last_char < b"\x80": + last_char = b" " filtered.extend(last_char) return filtered @@ -118,22 +117,22 @@ def filter_with_english_letters(buf): for curr in range(len(buf)): # Slice here to get bytes instead of an int with Python 3 - buf_char = buf[curr:curr + 1] + buf_char = buf[curr : curr + 1] # Check if we're coming out of or entering an HTML tag - if buf_char == b'>': + if buf_char == b">": in_tag = False - elif buf_char == b'<': + elif buf_char == b"<": in_tag = True # If current character is not extended-ASCII and not alphabetic... - if buf_char < b'\x80' and not buf_char.isalpha(): + if buf_char < b"\x80" and not buf_char.isalpha(): # ...and we're not in a tag if curr > prev and not in_tag: # Keep everything after last non-extended-ASCII, # non-alphabetic character filtered.extend(buf[prev:curr]) # Output a space to delimit stretch we kept - filtered.extend(b' ') + filtered.extend(b" ") prev = curr + 1 # If we're not in a tag... diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py b/src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py index 23ea2f49..33bd2e8d 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/cli/chardetect.py @@ -22,7 +22,7 @@ from fetchcode.vcs.pip._vendor.chardet.universaldetector import UniversalDetector -def description_of(lines, name='stdin'): +def description_of(lines, name="stdin"): """ Return a string describing the probable encoding of a file or list of strings. @@ -42,12 +42,13 @@ def description_of(lines, name='stdin'): u.close() result = u.result if PY2: - name = name.decode(sys.getfilesystemencoding(), 'ignore') - if result['encoding']: - return '{0}: {1} with confidence {2}'.format(name, result['encoding'], - result['confidence']) + name = name.decode(sys.getfilesystemencoding(), "ignore") + if result["encoding"]: + return "{0}: {1} with confidence {2}".format( + name, result["encoding"], result["confidence"] + ) else: - return '{0}: no result'.format(name) + return "{0}: no result".format(name) def main(argv=None): @@ -61,24 +62,32 @@ def main(argv=None): # Get command line arguments parser = argparse.ArgumentParser( description="Takes one or more file paths and reports their detected \ - encodings") - parser.add_argument('input', - help='File whose encoding we would like to determine. \ - (default: stdin)', - type=argparse.FileType('rb'), nargs='*', - default=[sys.stdin if PY2 else sys.stdin.buffer]) - parser.add_argument('--version', action='version', - version='%(prog)s {0}'.format(__version__)) + encodings" + ) + parser.add_argument( + "input", + help="File whose encoding we would like to determine. \ + (default: stdin)", + type=argparse.FileType("rb"), + nargs="*", + default=[sys.stdin if PY2 else sys.stdin.buffer], + ) + parser.add_argument( + "--version", action="version", version="%(prog)s {0}".format(__version__) + ) args = parser.parse_args(argv) for f in args.input: if f.isatty(): - print("You are running chardetect interactively. Press " + - "CTRL-D twice at the start of a blank line to signal the " + - "end of your input. If you want help, run chardetect " + - "--help\n", file=sys.stderr) + print( + "You are running chardetect interactively. Press " + + "CTRL-D twice at the start of a blank line to signal the " + + "end of your input. If you want help, run chardetect " + + "--help\n", + file=sys.stderr, + ) print(description_of(f, f.name)) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/codingstatemachine.py b/src/fetchcode/vcs/pip/_vendor/chardet/codingstatemachine.py index 68fba44f..46245933 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/codingstatemachine.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/codingstatemachine.py @@ -52,6 +52,7 @@ class CodingStateMachine(object): negative answer for this encoding. Detector will exclude this encoding from consideration from here on. """ + def __init__(self, sm): self._model = sm self._curr_byte_pos = 0 @@ -66,14 +67,13 @@ def reset(self): def next_state(self, c): # for each byte we get its class # if it is first byte, we also get byte length - byte_class = self._model['class_table'][c] + byte_class = self._model["class_table"][c] if self._curr_state == MachineState.START: self._curr_byte_pos = 0 - self._curr_char_len = self._model['char_len_table'][byte_class] + self._curr_char_len = self._model["char_len_table"][byte_class] # from byte's class and state_table, we get its next state - curr_state = (self._curr_state * self._model['class_factor'] - + byte_class) - self._curr_state = self._model['state_table'][curr_state] + curr_state = self._curr_state * self._model["class_factor"] + byte_class + self._curr_state = self._model["state_table"][curr_state] self._curr_byte_pos += 1 return self._curr_state @@ -81,8 +81,8 @@ def get_current_charlen(self): return self._curr_char_len def get_coding_state_machine(self): - return self._model['name'] + return self._model["name"] @property def language(self): - return self._model['language'] + return self._model["language"] diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/enums.py b/src/fetchcode/vcs/pip/_vendor/chardet/enums.py index 04512072..2b01a12a 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/enums.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/enums.py @@ -9,6 +9,7 @@ class InputState(object): """ This enum represents the different states a universal detector can be in. """ + PURE_ASCII = 0 ESC_ASCII = 1 HIGH_BYTE = 2 @@ -19,6 +20,7 @@ class LanguageFilter(object): This enum represents the different language filters we can apply to a ``UniversalDetector``. """ + CHINESE_SIMPLIFIED = 0x01 CHINESE_TRADITIONAL = 0x02 JAPANESE = 0x04 @@ -33,6 +35,7 @@ class ProbingState(object): """ This enum represents the different states a prober can be in. """ + DETECTING = 0 FOUND_IT = 1 NOT_ME = 2 @@ -42,6 +45,7 @@ class MachineState(object): """ This enum represents the different states a state machine can be in. """ + START = 0 ERROR = 1 ITS_ME = 2 @@ -51,6 +55,7 @@ class SequenceLikelihood(object): """ This enum represents the likelihood of a character following the previous one. """ + NEGATIVE = 0 UNLIKELY = 1 LIKELY = 2 @@ -69,6 +74,7 @@ class CharacterCategory(object): Anything less than CONTROL is considered a letter. """ + UNDEFINED = 255 LINE_BREAK = 254 SYMBOL = 253 diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/escprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/escprober.py index c70493f2..c98c83c9 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/escprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/escprober.py @@ -28,8 +28,12 @@ from .charsetprober import CharSetProber from .codingstatemachine import CodingStateMachine from .enums import LanguageFilter, ProbingState, MachineState -from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL, - ISO2022KR_SM_MODEL) +from .escsm import ( + HZ_SM_MODEL, + ISO2022CN_SM_MODEL, + ISO2022JP_SM_MODEL, + ISO2022KR_SM_MODEL, +) class EscCharSetProber(CharSetProber): diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/escsm.py b/src/fetchcode/vcs/pip/_vendor/chardet/escsm.py index 0069523a..106e8859 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/escsm.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/escsm.py @@ -28,219 +28,1317 @@ from .enums import MachineState HZ_CLS = ( -1,0,0,0,0,0,0,0, # 00 - 07 -0,0,0,0,0,0,0,0, # 08 - 0f -0,0,0,0,0,0,0,0, # 10 - 17 -0,0,0,1,0,0,0,0, # 18 - 1f -0,0,0,0,0,0,0,0, # 20 - 27 -0,0,0,0,0,0,0,0, # 28 - 2f -0,0,0,0,0,0,0,0, # 30 - 37 -0,0,0,0,0,0,0,0, # 38 - 3f -0,0,0,0,0,0,0,0, # 40 - 47 -0,0,0,0,0,0,0,0, # 48 - 4f -0,0,0,0,0,0,0,0, # 50 - 57 -0,0,0,0,0,0,0,0, # 58 - 5f -0,0,0,0,0,0,0,0, # 60 - 67 -0,0,0,0,0,0,0,0, # 68 - 6f -0,0,0,0,0,0,0,0, # 70 - 77 -0,0,0,4,0,5,2,0, # 78 - 7f -1,1,1,1,1,1,1,1, # 80 - 87 -1,1,1,1,1,1,1,1, # 88 - 8f -1,1,1,1,1,1,1,1, # 90 - 97 -1,1,1,1,1,1,1,1, # 98 - 9f -1,1,1,1,1,1,1,1, # a0 - a7 -1,1,1,1,1,1,1,1, # a8 - af -1,1,1,1,1,1,1,1, # b0 - b7 -1,1,1,1,1,1,1,1, # b8 - bf -1,1,1,1,1,1,1,1, # c0 - c7 -1,1,1,1,1,1,1,1, # c8 - cf -1,1,1,1,1,1,1,1, # d0 - d7 -1,1,1,1,1,1,1,1, # d8 - df -1,1,1,1,1,1,1,1, # e0 - e7 -1,1,1,1,1,1,1,1, # e8 - ef -1,1,1,1,1,1,1,1, # f0 - f7 -1,1,1,1,1,1,1,1, # f8 - ff + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 00 - 07 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 08 - 0f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 10 - 17 + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, # 18 - 1f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 20 - 27 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 28 - 2f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 30 - 37 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 38 - 3f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 40 - 47 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 48 - 4f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 50 - 57 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 58 - 5f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 60 - 67 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 68 - 6f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 70 - 77 + 0, + 0, + 0, + 4, + 0, + 5, + 2, + 0, # 78 - 7f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 80 - 87 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 88 - 8f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 90 - 97 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 98 - 9f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # a0 - a7 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # a8 - af + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # b0 - b7 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # b8 - bf + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # c0 - c7 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # c8 - cf + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # d0 - d7 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # d8 - df + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # e0 - e7 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # e8 - ef + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # f0 - f7 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # f8 - ff ) HZ_ST = ( -MachineState.START,MachineState.ERROR, 3,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,# 00-07 -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 08-0f -MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START, 4,MachineState.ERROR,# 10-17 - 5,MachineState.ERROR, 6,MachineState.ERROR, 5, 5, 4,MachineState.ERROR,# 18-1f - 4,MachineState.ERROR, 4, 4, 4,MachineState.ERROR, 4,MachineState.ERROR,# 20-27 - 4,MachineState.ITS_ME,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 28-2f + MachineState.START, + MachineState.ERROR, + 3, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 08-0f + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + 4, + MachineState.ERROR, # 10-17 + 5, + MachineState.ERROR, + 6, + MachineState.ERROR, + 5, + 5, + 4, + MachineState.ERROR, # 18-1f + 4, + MachineState.ERROR, + 4, + 4, + 4, + MachineState.ERROR, + 4, + MachineState.ERROR, # 20-27 + 4, + MachineState.ITS_ME, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 28-2f ) HZ_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0) -HZ_SM_MODEL = {'class_table': HZ_CLS, - 'class_factor': 6, - 'state_table': HZ_ST, - 'char_len_table': HZ_CHAR_LEN_TABLE, - 'name': "HZ-GB-2312", - 'language': 'Chinese'} +HZ_SM_MODEL = { + "class_table": HZ_CLS, + "class_factor": 6, + "state_table": HZ_ST, + "char_len_table": HZ_CHAR_LEN_TABLE, + "name": "HZ-GB-2312", + "language": "Chinese", +} ISO2022CN_CLS = ( -2,0,0,0,0,0,0,0, # 00 - 07 -0,0,0,0,0,0,0,0, # 08 - 0f -0,0,0,0,0,0,0,0, # 10 - 17 -0,0,0,1,0,0,0,0, # 18 - 1f -0,0,0,0,0,0,0,0, # 20 - 27 -0,3,0,0,0,0,0,0, # 28 - 2f -0,0,0,0,0,0,0,0, # 30 - 37 -0,0,0,0,0,0,0,0, # 38 - 3f -0,0,0,4,0,0,0,0, # 40 - 47 -0,0,0,0,0,0,0,0, # 48 - 4f -0,0,0,0,0,0,0,0, # 50 - 57 -0,0,0,0,0,0,0,0, # 58 - 5f -0,0,0,0,0,0,0,0, # 60 - 67 -0,0,0,0,0,0,0,0, # 68 - 6f -0,0,0,0,0,0,0,0, # 70 - 77 -0,0,0,0,0,0,0,0, # 78 - 7f -2,2,2,2,2,2,2,2, # 80 - 87 -2,2,2,2,2,2,2,2, # 88 - 8f -2,2,2,2,2,2,2,2, # 90 - 97 -2,2,2,2,2,2,2,2, # 98 - 9f -2,2,2,2,2,2,2,2, # a0 - a7 -2,2,2,2,2,2,2,2, # a8 - af -2,2,2,2,2,2,2,2, # b0 - b7 -2,2,2,2,2,2,2,2, # b8 - bf -2,2,2,2,2,2,2,2, # c0 - c7 -2,2,2,2,2,2,2,2, # c8 - cf -2,2,2,2,2,2,2,2, # d0 - d7 -2,2,2,2,2,2,2,2, # d8 - df -2,2,2,2,2,2,2,2, # e0 - e7 -2,2,2,2,2,2,2,2, # e8 - ef -2,2,2,2,2,2,2,2, # f0 - f7 -2,2,2,2,2,2,2,2, # f8 - ff + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 00 - 07 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 08 - 0f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 10 - 17 + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, # 18 - 1f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 20 - 27 + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, # 28 - 2f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 30 - 37 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 38 - 3f + 0, + 0, + 0, + 4, + 0, + 0, + 0, + 0, # 40 - 47 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 48 - 4f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 50 - 57 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 58 - 5f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 60 - 67 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 68 - 6f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 70 - 77 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 78 - 7f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 80 - 87 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 88 - 8f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 90 - 97 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 98 - 9f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a0 - a7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a8 - af + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b0 - b7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b8 - bf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c0 - c7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c8 - cf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d0 - d7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d8 - df + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e0 - e7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e8 - ef + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # f0 - f7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # f8 - ff ) ISO2022CN_ST = ( -MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 00-07 -MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 08-0f -MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 10-17 -MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,# 18-1f -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 20-27 - 5, 6,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 28-2f -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 30-37 -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,# 38-3f + MachineState.START, + 3, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 00-07 + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 08-0f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 10-17 + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 4, + MachineState.ERROR, # 18-1f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 20-27 + 5, + 6, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 28-2f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 30-37 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.START, # 38-3f ) ISO2022CN_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0, 0, 0, 0) -ISO2022CN_SM_MODEL = {'class_table': ISO2022CN_CLS, - 'class_factor': 9, - 'state_table': ISO2022CN_ST, - 'char_len_table': ISO2022CN_CHAR_LEN_TABLE, - 'name': "ISO-2022-CN", - 'language': 'Chinese'} +ISO2022CN_SM_MODEL = { + "class_table": ISO2022CN_CLS, + "class_factor": 9, + "state_table": ISO2022CN_ST, + "char_len_table": ISO2022CN_CHAR_LEN_TABLE, + "name": "ISO-2022-CN", + "language": "Chinese", +} ISO2022JP_CLS = ( -2,0,0,0,0,0,0,0, # 00 - 07 -0,0,0,0,0,0,2,2, # 08 - 0f -0,0,0,0,0,0,0,0, # 10 - 17 -0,0,0,1,0,0,0,0, # 18 - 1f -0,0,0,0,7,0,0,0, # 20 - 27 -3,0,0,0,0,0,0,0, # 28 - 2f -0,0,0,0,0,0,0,0, # 30 - 37 -0,0,0,0,0,0,0,0, # 38 - 3f -6,0,4,0,8,0,0,0, # 40 - 47 -0,9,5,0,0,0,0,0, # 48 - 4f -0,0,0,0,0,0,0,0, # 50 - 57 -0,0,0,0,0,0,0,0, # 58 - 5f -0,0,0,0,0,0,0,0, # 60 - 67 -0,0,0,0,0,0,0,0, # 68 - 6f -0,0,0,0,0,0,0,0, # 70 - 77 -0,0,0,0,0,0,0,0, # 78 - 7f -2,2,2,2,2,2,2,2, # 80 - 87 -2,2,2,2,2,2,2,2, # 88 - 8f -2,2,2,2,2,2,2,2, # 90 - 97 -2,2,2,2,2,2,2,2, # 98 - 9f -2,2,2,2,2,2,2,2, # a0 - a7 -2,2,2,2,2,2,2,2, # a8 - af -2,2,2,2,2,2,2,2, # b0 - b7 -2,2,2,2,2,2,2,2, # b8 - bf -2,2,2,2,2,2,2,2, # c0 - c7 -2,2,2,2,2,2,2,2, # c8 - cf -2,2,2,2,2,2,2,2, # d0 - d7 -2,2,2,2,2,2,2,2, # d8 - df -2,2,2,2,2,2,2,2, # e0 - e7 -2,2,2,2,2,2,2,2, # e8 - ef -2,2,2,2,2,2,2,2, # f0 - f7 -2,2,2,2,2,2,2,2, # f8 - ff + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 00 - 07 + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, # 08 - 0f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 10 - 17 + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, # 18 - 1f + 0, + 0, + 0, + 0, + 7, + 0, + 0, + 0, # 20 - 27 + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 28 - 2f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 30 - 37 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 38 - 3f + 6, + 0, + 4, + 0, + 8, + 0, + 0, + 0, # 40 - 47 + 0, + 9, + 5, + 0, + 0, + 0, + 0, + 0, # 48 - 4f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 50 - 57 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 58 - 5f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 60 - 67 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 68 - 6f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 70 - 77 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 78 - 7f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 80 - 87 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 88 - 8f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 90 - 97 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 98 - 9f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a0 - a7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a8 - af + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b0 - b7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b8 - bf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c0 - c7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c8 - cf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d0 - d7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d8 - df + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e0 - e7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e8 - ef + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # f0 - f7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # f8 - ff ) ISO2022JP_ST = ( -MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 00-07 -MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 08-0f -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 10-17 -MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,# 18-1f -MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,MachineState.ERROR,# 20-27 -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 6,MachineState.ITS_ME,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,# 28-2f -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,# 30-37 -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 38-3f -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,MachineState.START,# 40-47 + MachineState.START, + 3, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 00-07 + MachineState.START, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 08-0f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 10-17 + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, # 18-1f + MachineState.ERROR, + 5, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 4, + MachineState.ERROR, + MachineState.ERROR, # 20-27 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 6, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ERROR, # 28-2f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, # 30-37 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 38-3f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.START, + MachineState.START, # 40-47 ) ISO2022JP_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0) -ISO2022JP_SM_MODEL = {'class_table': ISO2022JP_CLS, - 'class_factor': 10, - 'state_table': ISO2022JP_ST, - 'char_len_table': ISO2022JP_CHAR_LEN_TABLE, - 'name': "ISO-2022-JP", - 'language': 'Japanese'} +ISO2022JP_SM_MODEL = { + "class_table": ISO2022JP_CLS, + "class_factor": 10, + "state_table": ISO2022JP_ST, + "char_len_table": ISO2022JP_CHAR_LEN_TABLE, + "name": "ISO-2022-JP", + "language": "Japanese", +} ISO2022KR_CLS = ( -2,0,0,0,0,0,0,0, # 00 - 07 -0,0,0,0,0,0,0,0, # 08 - 0f -0,0,0,0,0,0,0,0, # 10 - 17 -0,0,0,1,0,0,0,0, # 18 - 1f -0,0,0,0,3,0,0,0, # 20 - 27 -0,4,0,0,0,0,0,0, # 28 - 2f -0,0,0,0,0,0,0,0, # 30 - 37 -0,0,0,0,0,0,0,0, # 38 - 3f -0,0,0,5,0,0,0,0, # 40 - 47 -0,0,0,0,0,0,0,0, # 48 - 4f -0,0,0,0,0,0,0,0, # 50 - 57 -0,0,0,0,0,0,0,0, # 58 - 5f -0,0,0,0,0,0,0,0, # 60 - 67 -0,0,0,0,0,0,0,0, # 68 - 6f -0,0,0,0,0,0,0,0, # 70 - 77 -0,0,0,0,0,0,0,0, # 78 - 7f -2,2,2,2,2,2,2,2, # 80 - 87 -2,2,2,2,2,2,2,2, # 88 - 8f -2,2,2,2,2,2,2,2, # 90 - 97 -2,2,2,2,2,2,2,2, # 98 - 9f -2,2,2,2,2,2,2,2, # a0 - a7 -2,2,2,2,2,2,2,2, # a8 - af -2,2,2,2,2,2,2,2, # b0 - b7 -2,2,2,2,2,2,2,2, # b8 - bf -2,2,2,2,2,2,2,2, # c0 - c7 -2,2,2,2,2,2,2,2, # c8 - cf -2,2,2,2,2,2,2,2, # d0 - d7 -2,2,2,2,2,2,2,2, # d8 - df -2,2,2,2,2,2,2,2, # e0 - e7 -2,2,2,2,2,2,2,2, # e8 - ef -2,2,2,2,2,2,2,2, # f0 - f7 -2,2,2,2,2,2,2,2, # f8 - ff + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 00 - 07 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 08 - 0f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 10 - 17 + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, # 18 - 1f + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, # 20 - 27 + 0, + 4, + 0, + 0, + 0, + 0, + 0, + 0, # 28 - 2f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 30 - 37 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 38 - 3f + 0, + 0, + 0, + 5, + 0, + 0, + 0, + 0, # 40 - 47 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 48 - 4f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 50 - 57 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 58 - 5f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 60 - 67 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 68 - 6f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 70 - 77 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 78 - 7f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 80 - 87 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 88 - 8f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 90 - 97 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 98 - 9f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a0 - a7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a8 - af + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b0 - b7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b8 - bf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c0 - c7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c8 - cf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d0 - d7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d8 - df + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e0 - e7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e8 - ef + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # f0 - f7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # f8 - ff ) ISO2022KR_ST = ( -MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,# 00-07 -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,# 08-0f -MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 4,MachineState.ERROR,MachineState.ERROR,# 10-17 -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,# 18-1f -MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.START,MachineState.START,MachineState.START,MachineState.START,# 20-27 + MachineState.START, + 3, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 08-0f + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 4, + MachineState.ERROR, + MachineState.ERROR, # 10-17 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 5, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 18-1f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 20-27 ) ISO2022KR_CHAR_LEN_TABLE = (0, 0, 0, 0, 0, 0) -ISO2022KR_SM_MODEL = {'class_table': ISO2022KR_CLS, - 'class_factor': 6, - 'state_table': ISO2022KR_ST, - 'char_len_table': ISO2022KR_CHAR_LEN_TABLE, - 'name': "ISO-2022-KR", - 'language': 'Korean'} - - +ISO2022KR_SM_MODEL = { + "class_table": ISO2022KR_CLS, + "class_factor": 6, + "state_table": ISO2022KR_ST, + "char_len_table": ISO2022KR_CHAR_LEN_TABLE, + "name": "ISO-2022-KR", + "language": "Korean", +} diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/eucjpprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/eucjpprober.py index 20ce8f7d..08698d4e 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/eucjpprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/eucjpprober.py @@ -58,8 +58,12 @@ def feed(self, byte_str): # PY3K: byte_str is a byte array, so byte_str[i] is an int, not a byte coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: - self.logger.debug('%s %s prober hit error at byte %s', - self.charset_name, self.language, i) + self.logger.debug( + "%s %s prober hit error at byte %s", + self.charset_name, + self.language, + i, + ) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: @@ -72,16 +76,15 @@ def feed(self, byte_str): self.context_analyzer.feed(self._last_char, char_len) self.distribution_analyzer.feed(self._last_char, char_len) else: - self.context_analyzer.feed(byte_str[i - 1:i + 1], - char_len) - self.distribution_analyzer.feed(byte_str[i - 1:i + 1], - char_len) + self.context_analyzer.feed(byte_str[i - 1 : i + 1], char_len) + self.distribution_analyzer.feed(byte_str[i - 1 : i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: - if (self.context_analyzer.got_enough_data() and - (self.get_confidence() > self.SHORTCUT_THRESHOLD)): + if self.context_analyzer.got_enough_data() and ( + self.get_confidence() > self.SHORTCUT_THRESHOLD + ): self._state = ProbingState.FOUND_IT return self.state diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/euckrfreq.py b/src/fetchcode/vcs/pip/_vendor/chardet/euckrfreq.py index b68078cb..1851e413 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/euckrfreq.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/euckrfreq.py @@ -44,152 +44,2356 @@ # Char to FreqOrder table , EUCKR_CHAR_TO_FREQ_ORDER = ( - 13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87, -1397,1723, 104, 536,1117,1203,1724,1267, 685,1268, 508,1725,1726,1727,1728,1398, -1399,1729,1730,1731, 141, 621, 326,1057, 368,1732, 267, 488, 20,1733,1269,1734, - 945,1400,1735, 47, 904,1270,1736,1737, 773, 248,1738, 409, 313, 786, 429,1739, - 116, 987, 813,1401, 683, 75,1204, 145,1740,1741,1742,1743, 16, 847, 667, 622, - 708,1744,1745,1746, 966, 787, 304, 129,1747, 60, 820, 123, 676,1748,1749,1750, -1751, 617,1752, 626,1753,1754,1755,1756, 653,1757,1758,1759,1760,1761,1762, 856, - 344,1763,1764,1765,1766, 89, 401, 418, 806, 905, 848,1767,1768,1769, 946,1205, - 709,1770,1118,1771, 241,1772,1773,1774,1271,1775, 569,1776, 999,1777,1778,1779, -1780, 337, 751,1058, 28, 628, 254,1781, 177, 906, 270, 349, 891,1079,1782, 19, -1783, 379,1784, 315,1785, 629, 754,1402, 559,1786, 636, 203,1206,1787, 710, 567, -1788, 935, 814,1789,1790,1207, 766, 528,1791,1792,1208,1793,1794,1795,1796,1797, -1403,1798,1799, 533,1059,1404,1405,1156,1406, 936, 884,1080,1800, 351,1801,1802, -1803,1804,1805, 801,1806,1807,1808,1119,1809,1157, 714, 474,1407,1810, 298, 899, - 885,1811,1120, 802,1158,1812, 892,1813,1814,1408, 659,1815,1816,1121,1817,1818, -1819,1820,1821,1822, 319,1823, 594, 545,1824, 815, 937,1209,1825,1826, 573,1409, -1022,1827,1210,1828,1829,1830,1831,1832,1833, 556, 722, 807,1122,1060,1834, 697, -1835, 900, 557, 715,1836,1410, 540,1411, 752,1159, 294, 597,1211, 976, 803, 770, -1412,1837,1838, 39, 794,1413, 358,1839, 371, 925,1840, 453, 661, 788, 531, 723, - 544,1023,1081, 869, 91,1841, 392, 430, 790, 602,1414, 677,1082, 457,1415,1416, -1842,1843, 475, 327,1024,1417, 795, 121,1844, 733, 403,1418,1845,1846,1847, 300, - 119, 711,1212, 627,1848,1272, 207,1849,1850, 796,1213, 382,1851, 519,1852,1083, - 893,1853,1854,1855, 367, 809, 487, 671,1856, 663,1857,1858, 956, 471, 306, 857, -1859,1860,1160,1084,1861,1862,1863,1864,1865,1061,1866,1867,1868,1869,1870,1871, - 282, 96, 574,1872, 502,1085,1873,1214,1874, 907,1875,1876, 827, 977,1419,1420, -1421, 268,1877,1422,1878,1879,1880, 308,1881, 2, 537,1882,1883,1215,1884,1885, - 127, 791,1886,1273,1423,1887, 34, 336, 404, 643,1888, 571, 654, 894, 840,1889, - 0, 886,1274, 122, 575, 260, 908, 938,1890,1275, 410, 316,1891,1892, 100,1893, -1894,1123, 48,1161,1124,1025,1895, 633, 901,1276,1896,1897, 115, 816,1898, 317, -1899, 694,1900, 909, 734,1424, 572, 866,1425, 691, 85, 524,1010, 543, 394, 841, -1901,1902,1903,1026,1904,1905,1906,1907,1908,1909, 30, 451, 651, 988, 310,1910, -1911,1426, 810,1216, 93,1912,1913,1277,1217,1914, 858, 759, 45, 58, 181, 610, - 269,1915,1916, 131,1062, 551, 443,1000, 821,1427, 957, 895,1086,1917,1918, 375, -1919, 359,1920, 687,1921, 822,1922, 293,1923,1924, 40, 662, 118, 692, 29, 939, - 887, 640, 482, 174,1925, 69,1162, 728,1428, 910,1926,1278,1218,1279, 386, 870, - 217, 854,1163, 823,1927,1928,1929,1930, 834,1931, 78,1932, 859,1933,1063,1934, -1935,1936,1937, 438,1164, 208, 595,1938,1939,1940,1941,1219,1125,1942, 280, 888, -1429,1430,1220,1431,1943,1944,1945,1946,1947,1280, 150, 510,1432,1948,1949,1950, -1951,1952,1953,1954,1011,1087,1955,1433,1043,1956, 881,1957, 614, 958,1064,1065, -1221,1958, 638,1001, 860, 967, 896,1434, 989, 492, 553,1281,1165,1959,1282,1002, -1283,1222,1960,1961,1962,1963, 36, 383, 228, 753, 247, 454,1964, 876, 678,1965, -1966,1284, 126, 464, 490, 835, 136, 672, 529, 940,1088,1435, 473,1967,1968, 467, - 50, 390, 227, 587, 279, 378, 598, 792, 968, 240, 151, 160, 849, 882,1126,1285, - 639,1044, 133, 140, 288, 360, 811, 563,1027, 561, 142, 523,1969,1970,1971, 7, - 103, 296, 439, 407, 506, 634, 990,1972,1973,1974,1975, 645,1976,1977,1978,1979, -1980,1981, 236,1982,1436,1983,1984,1089, 192, 828, 618, 518,1166, 333,1127,1985, - 818,1223,1986,1987,1988,1989,1990,1991,1992,1993, 342,1128,1286, 746, 842,1994, -1995, 560, 223,1287, 98, 8, 189, 650, 978,1288,1996,1437,1997, 17, 345, 250, - 423, 277, 234, 512, 226, 97, 289, 42, 167,1998, 201,1999,2000, 843, 836, 824, - 532, 338, 783,1090, 182, 576, 436,1438,1439, 527, 500,2001, 947, 889,2002,2003, -2004,2005, 262, 600, 314, 447,2006, 547,2007, 693, 738,1129,2008, 71,1440, 745, - 619, 688,2009, 829,2010,2011, 147,2012, 33, 948,2013,2014, 74, 224,2015, 61, - 191, 918, 399, 637,2016,1028,1130, 257, 902,2017,2018,2019,2020,2021,2022,2023, -2024,2025,2026, 837,2027,2028,2029,2030, 179, 874, 591, 52, 724, 246,2031,2032, -2033,2034,1167, 969,2035,1289, 630, 605, 911,1091,1168,2036,2037,2038,1441, 912, -2039, 623,2040,2041, 253,1169,1290,2042,1442, 146, 620, 611, 577, 433,2043,1224, - 719,1170, 959, 440, 437, 534, 84, 388, 480,1131, 159, 220, 198, 679,2044,1012, - 819,1066,1443, 113,1225, 194, 318,1003,1029,2045,2046,2047,2048,1067,2049,2050, -2051,2052,2053, 59, 913, 112,2054, 632,2055, 455, 144, 739,1291,2056, 273, 681, - 499,2057, 448,2058,2059, 760,2060,2061, 970, 384, 169, 245,1132,2062,2063, 414, -1444,2064,2065, 41, 235,2066, 157, 252, 877, 568, 919, 789, 580,2067, 725,2068, -2069,1292,2070,2071,1445,2072,1446,2073,2074, 55, 588, 66,1447, 271,1092,2075, -1226,2076, 960,1013, 372,2077,2078,2079,2080,2081,1293,2082,2083,2084,2085, 850, -2086,2087,2088,2089,2090, 186,2091,1068, 180,2092,2093,2094, 109,1227, 522, 606, -2095, 867,1448,1093, 991,1171, 926, 353,1133,2096, 581,2097,2098,2099,1294,1449, -1450,2100, 596,1172,1014,1228,2101,1451,1295,1173,1229,2102,2103,1296,1134,1452, - 949,1135,2104,2105,1094,1453,1454,1455,2106,1095,2107,2108,2109,2110,2111,2112, -2113,2114,2115,2116,2117, 804,2118,2119,1230,1231, 805,1456, 405,1136,2120,2121, -2122,2123,2124, 720, 701,1297, 992,1457, 927,1004,2125,2126,2127,2128,2129,2130, - 22, 417,2131, 303,2132, 385,2133, 971, 520, 513,2134,1174, 73,1096, 231, 274, - 962,1458, 673,2135,1459,2136, 152,1137,2137,2138,2139,2140,1005,1138,1460,1139, -2141,2142,2143,2144, 11, 374, 844,2145, 154,1232, 46,1461,2146, 838, 830, 721, -1233, 106,2147, 90, 428, 462, 578, 566,1175, 352,2148,2149, 538,1234, 124,1298, -2150,1462, 761, 565,2151, 686,2152, 649,2153, 72, 173,2154, 460, 415,2155,1463, -2156,1235, 305,2157,2158,2159,2160,2161,2162, 579,2163,2164,2165,2166,2167, 747, -2168,2169,2170,2171,1464, 669,2172,2173,2174,2175,2176,1465,2177, 23, 530, 285, -2178, 335, 729,2179, 397,2180,2181,2182,1030,2183,2184, 698,2185,2186, 325,2187, -2188, 369,2189, 799,1097,1015, 348,2190,1069, 680,2191, 851,1466,2192,2193, 10, -2194, 613, 424,2195, 979, 108, 449, 589, 27, 172, 81,1031, 80, 774, 281, 350, -1032, 525, 301, 582,1176,2196, 674,1045,2197,2198,1467, 730, 762,2199,2200,2201, -2202,1468,2203, 993,2204,2205, 266,1070, 963,1140,2206,2207,2208, 664,1098, 972, -2209,2210,2211,1177,1469,1470, 871,2212,2213,2214,2215,2216,1471,2217,2218,2219, -2220,2221,2222,2223,2224,2225,2226,2227,1472,1236,2228,2229,2230,2231,2232,2233, -2234,2235,1299,2236,2237, 200,2238, 477, 373,2239,2240, 731, 825, 777,2241,2242, -2243, 521, 486, 548,2244,2245,2246,1473,1300, 53, 549, 137, 875, 76, 158,2247, -1301,1474, 469, 396,1016, 278, 712,2248, 321, 442, 503, 767, 744, 941,1237,1178, -1475,2249, 82, 178,1141,1179, 973,2250,1302,2251, 297,2252,2253, 570,2254,2255, -2256, 18, 450, 206,2257, 290, 292,1142,2258, 511, 162, 99, 346, 164, 735,2259, -1476,1477, 4, 554, 343, 798,1099,2260,1100,2261, 43, 171,1303, 139, 215,2262, -2263, 717, 775,2264,1033, 322, 216,2265, 831,2266, 149,2267,1304,2268,2269, 702, -1238, 135, 845, 347, 309,2270, 484,2271, 878, 655, 238,1006,1478,2272, 67,2273, - 295,2274,2275, 461,2276, 478, 942, 412,2277,1034,2278,2279,2280, 265,2281, 541, -2282,2283,2284,2285,2286, 70, 852,1071,2287,2288,2289,2290, 21, 56, 509, 117, - 432,2291,2292, 331, 980, 552,1101, 148, 284, 105, 393,1180,1239, 755,2293, 187, -2294,1046,1479,2295, 340,2296, 63,1047, 230,2297,2298,1305, 763,1306, 101, 800, - 808, 494,2299,2300,2301, 903,2302, 37,1072, 14, 5,2303, 79, 675,2304, 312, -2305,2306,2307,2308,2309,1480, 6,1307,2310,2311,2312, 1, 470, 35, 24, 229, -2313, 695, 210, 86, 778, 15, 784, 592, 779, 32, 77, 855, 964,2314, 259,2315, - 501, 380,2316,2317, 83, 981, 153, 689,1308,1481,1482,1483,2318,2319, 716,1484, -2320,2321,2322,2323,2324,2325,1485,2326,2327, 128, 57, 68, 261,1048, 211, 170, -1240, 31,2328, 51, 435, 742,2329,2330,2331, 635,2332, 264, 456,2333,2334,2335, - 425,2336,1486, 143, 507, 263, 943,2337, 363, 920,1487, 256,1488,1102, 243, 601, -1489,2338,2339,2340,2341,2342,2343,2344, 861,2345,2346,2347,2348,2349,2350, 395, -2351,1490,1491, 62, 535, 166, 225,2352,2353, 668, 419,1241, 138, 604, 928,2354, -1181,2355,1492,1493,2356,2357,2358,1143,2359, 696,2360, 387, 307,1309, 682, 476, -2361,2362, 332, 12, 222, 156,2363, 232,2364, 641, 276, 656, 517,1494,1495,1035, - 416, 736,1496,2365,1017, 586,2366,2367,2368,1497,2369, 242,2370,2371,2372,1498, -2373, 965, 713,2374,2375,2376,2377, 740, 982,1499, 944,1500,1007,2378,2379,1310, -1501,2380,2381,2382, 785, 329,2383,2384,1502,2385,2386,2387, 932,2388,1503,2389, -2390,2391,2392,1242,2393,2394,2395,2396,2397, 994, 950,2398,2399,2400,2401,1504, -1311,2402,2403,2404,2405,1049, 749,2406,2407, 853, 718,1144,1312,2408,1182,1505, -2409,2410, 255, 516, 479, 564, 550, 214,1506,1507,1313, 413, 239, 444, 339,1145, -1036,1508,1509,1314,1037,1510,1315,2411,1511,2412,2413,2414, 176, 703, 497, 624, - 593, 921, 302,2415, 341, 165,1103,1512,2416,1513,2417,2418,2419, 376,2420, 700, -2421,2422,2423, 258, 768,1316,2424,1183,2425, 995, 608,2426,2427,2428,2429, 221, -2430,2431,2432,2433,2434,2435,2436,2437, 195, 323, 726, 188, 897, 983,1317, 377, - 644,1050, 879,2438, 452,2439,2440,2441,2442,2443,2444, 914,2445,2446,2447,2448, - 915, 489,2449,1514,1184,2450,2451, 515, 64, 427, 495,2452, 583,2453, 483, 485, -1038, 562, 213,1515, 748, 666,2454,2455,2456,2457, 334,2458, 780, 996,1008, 705, -1243,2459,2460,2461,2462,2463, 114,2464, 493,1146, 366, 163,1516, 961,1104,2465, - 291,2466,1318,1105,2467,1517, 365,2468, 355, 951,1244,2469,1319,2470, 631,2471, -2472, 218,1320, 364, 320, 756,1518,1519,1321,1520,1322,2473,2474,2475,2476, 997, -2477,2478,2479,2480, 665,1185,2481, 916,1521,2482,2483,2484, 584, 684,2485,2486, - 797,2487,1051,1186,2488,2489,2490,1522,2491,2492, 370,2493,1039,1187, 65,2494, - 434, 205, 463,1188,2495, 125, 812, 391, 402, 826, 699, 286, 398, 155, 781, 771, - 585,2496, 590, 505,1073,2497, 599, 244, 219, 917,1018, 952, 646,1523,2498,1323, -2499,2500, 49, 984, 354, 741,2501, 625,2502,1324,2503,1019, 190, 357, 757, 491, - 95, 782, 868,2504,2505,2506,2507,2508,2509, 134,1524,1074, 422,1525, 898,2510, - 161,2511,2512,2513,2514, 769,2515,1526,2516,2517, 411,1325,2518, 472,1527,2519, -2520,2521,2522,2523,2524, 985,2525,2526,2527,2528,2529,2530, 764,2531,1245,2532, -2533, 25, 204, 311,2534, 496,2535,1052,2536,2537,2538,2539,2540,2541,2542, 199, - 704, 504, 468, 758, 657,1528, 196, 44, 839,1246, 272, 750,2543, 765, 862,2544, -2545,1326,2546, 132, 615, 933,2547, 732,2548,2549,2550,1189,1529,2551, 283,1247, -1053, 607, 929,2552,2553,2554, 930, 183, 872, 616,1040,1147,2555,1148,1020, 441, - 249,1075,2556,2557,2558, 466, 743,2559,2560,2561, 92, 514, 426, 420, 526,2562, -2563,2564,2565,2566,2567,2568, 185,2569,2570,2571,2572, 776,1530, 658,2573, 362, -2574, 361, 922,1076, 793,2575,2576,2577,2578,2579,2580,1531, 251,2581,2582,2583, -2584,1532, 54, 612, 237,1327,2585,2586, 275, 408, 647, 111,2587,1533,1106, 465, - 3, 458, 9, 38,2588, 107, 110, 890, 209, 26, 737, 498,2589,1534,2590, 431, - 202, 88,1535, 356, 287,1107, 660,1149,2591, 381,1536, 986,1150, 445,1248,1151, - 974,2592,2593, 846,2594, 446, 953, 184,1249,1250, 727,2595, 923, 193, 883,2596, -2597,2598, 102, 324, 539, 817,2599, 421,1041,2600, 832,2601, 94, 175, 197, 406, -2602, 459,2603,2604,2605,2606,2607, 330, 555,2608,2609,2610, 706,1108, 389,2611, -2612,2613,2614, 233,2615, 833, 558, 931, 954,1251,2616,2617,1537, 546,2618,2619, -1009,2620,2621,2622,1538, 690,1328,2623, 955,2624,1539,2625,2626, 772,2627,2628, -2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042, - 670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, # 512, 256 + 13, + 130, + 120, + 1396, + 481, + 1719, + 1720, + 328, + 609, + 212, + 1721, + 707, + 400, + 299, + 1722, + 87, + 1397, + 1723, + 104, + 536, + 1117, + 1203, + 1724, + 1267, + 685, + 1268, + 508, + 1725, + 1726, + 1727, + 1728, + 1398, + 1399, + 1729, + 1730, + 1731, + 141, + 621, + 326, + 1057, + 368, + 1732, + 267, + 488, + 20, + 1733, + 1269, + 1734, + 945, + 1400, + 1735, + 47, + 904, + 1270, + 1736, + 1737, + 773, + 248, + 1738, + 409, + 313, + 786, + 429, + 1739, + 116, + 987, + 813, + 1401, + 683, + 75, + 1204, + 145, + 1740, + 1741, + 1742, + 1743, + 16, + 847, + 667, + 622, + 708, + 1744, + 1745, + 1746, + 966, + 787, + 304, + 129, + 1747, + 60, + 820, + 123, + 676, + 1748, + 1749, + 1750, + 1751, + 617, + 1752, + 626, + 1753, + 1754, + 1755, + 1756, + 653, + 1757, + 1758, + 1759, + 1760, + 1761, + 1762, + 856, + 344, + 1763, + 1764, + 1765, + 1766, + 89, + 401, + 418, + 806, + 905, + 848, + 1767, + 1768, + 1769, + 946, + 1205, + 709, + 1770, + 1118, + 1771, + 241, + 1772, + 1773, + 1774, + 1271, + 1775, + 569, + 1776, + 999, + 1777, + 1778, + 1779, + 1780, + 337, + 751, + 1058, + 28, + 628, + 254, + 1781, + 177, + 906, + 270, + 349, + 891, + 1079, + 1782, + 19, + 1783, + 379, + 1784, + 315, + 1785, + 629, + 754, + 1402, + 559, + 1786, + 636, + 203, + 1206, + 1787, + 710, + 567, + 1788, + 935, + 814, + 1789, + 1790, + 1207, + 766, + 528, + 1791, + 1792, + 1208, + 1793, + 1794, + 1795, + 1796, + 1797, + 1403, + 1798, + 1799, + 533, + 1059, + 1404, + 1405, + 1156, + 1406, + 936, + 884, + 1080, + 1800, + 351, + 1801, + 1802, + 1803, + 1804, + 1805, + 801, + 1806, + 1807, + 1808, + 1119, + 1809, + 1157, + 714, + 474, + 1407, + 1810, + 298, + 899, + 885, + 1811, + 1120, + 802, + 1158, + 1812, + 892, + 1813, + 1814, + 1408, + 659, + 1815, + 1816, + 1121, + 1817, + 1818, + 1819, + 1820, + 1821, + 1822, + 319, + 1823, + 594, + 545, + 1824, + 815, + 937, + 1209, + 1825, + 1826, + 573, + 1409, + 1022, + 1827, + 1210, + 1828, + 1829, + 1830, + 1831, + 1832, + 1833, + 556, + 722, + 807, + 1122, + 1060, + 1834, + 697, + 1835, + 900, + 557, + 715, + 1836, + 1410, + 540, + 1411, + 752, + 1159, + 294, + 597, + 1211, + 976, + 803, + 770, + 1412, + 1837, + 1838, + 39, + 794, + 1413, + 358, + 1839, + 371, + 925, + 1840, + 453, + 661, + 788, + 531, + 723, + 544, + 1023, + 1081, + 869, + 91, + 1841, + 392, + 430, + 790, + 602, + 1414, + 677, + 1082, + 457, + 1415, + 1416, + 1842, + 1843, + 475, + 327, + 1024, + 1417, + 795, + 121, + 1844, + 733, + 403, + 1418, + 1845, + 1846, + 1847, + 300, + 119, + 711, + 1212, + 627, + 1848, + 1272, + 207, + 1849, + 1850, + 796, + 1213, + 382, + 1851, + 519, + 1852, + 1083, + 893, + 1853, + 1854, + 1855, + 367, + 809, + 487, + 671, + 1856, + 663, + 1857, + 1858, + 956, + 471, + 306, + 857, + 1859, + 1860, + 1160, + 1084, + 1861, + 1862, + 1863, + 1864, + 1865, + 1061, + 1866, + 1867, + 1868, + 1869, + 1870, + 1871, + 282, + 96, + 574, + 1872, + 502, + 1085, + 1873, + 1214, + 1874, + 907, + 1875, + 1876, + 827, + 977, + 1419, + 1420, + 1421, + 268, + 1877, + 1422, + 1878, + 1879, + 1880, + 308, + 1881, + 2, + 537, + 1882, + 1883, + 1215, + 1884, + 1885, + 127, + 791, + 1886, + 1273, + 1423, + 1887, + 34, + 336, + 404, + 643, + 1888, + 571, + 654, + 894, + 840, + 1889, + 0, + 886, + 1274, + 122, + 575, + 260, + 908, + 938, + 1890, + 1275, + 410, + 316, + 1891, + 1892, + 100, + 1893, + 1894, + 1123, + 48, + 1161, + 1124, + 1025, + 1895, + 633, + 901, + 1276, + 1896, + 1897, + 115, + 816, + 1898, + 317, + 1899, + 694, + 1900, + 909, + 734, + 1424, + 572, + 866, + 1425, + 691, + 85, + 524, + 1010, + 543, + 394, + 841, + 1901, + 1902, + 1903, + 1026, + 1904, + 1905, + 1906, + 1907, + 1908, + 1909, + 30, + 451, + 651, + 988, + 310, + 1910, + 1911, + 1426, + 810, + 1216, + 93, + 1912, + 1913, + 1277, + 1217, + 1914, + 858, + 759, + 45, + 58, + 181, + 610, + 269, + 1915, + 1916, + 131, + 1062, + 551, + 443, + 1000, + 821, + 1427, + 957, + 895, + 1086, + 1917, + 1918, + 375, + 1919, + 359, + 1920, + 687, + 1921, + 822, + 1922, + 293, + 1923, + 1924, + 40, + 662, + 118, + 692, + 29, + 939, + 887, + 640, + 482, + 174, + 1925, + 69, + 1162, + 728, + 1428, + 910, + 1926, + 1278, + 1218, + 1279, + 386, + 870, + 217, + 854, + 1163, + 823, + 1927, + 1928, + 1929, + 1930, + 834, + 1931, + 78, + 1932, + 859, + 1933, + 1063, + 1934, + 1935, + 1936, + 1937, + 438, + 1164, + 208, + 595, + 1938, + 1939, + 1940, + 1941, + 1219, + 1125, + 1942, + 280, + 888, + 1429, + 1430, + 1220, + 1431, + 1943, + 1944, + 1945, + 1946, + 1947, + 1280, + 150, + 510, + 1432, + 1948, + 1949, + 1950, + 1951, + 1952, + 1953, + 1954, + 1011, + 1087, + 1955, + 1433, + 1043, + 1956, + 881, + 1957, + 614, + 958, + 1064, + 1065, + 1221, + 1958, + 638, + 1001, + 860, + 967, + 896, + 1434, + 989, + 492, + 553, + 1281, + 1165, + 1959, + 1282, + 1002, + 1283, + 1222, + 1960, + 1961, + 1962, + 1963, + 36, + 383, + 228, + 753, + 247, + 454, + 1964, + 876, + 678, + 1965, + 1966, + 1284, + 126, + 464, + 490, + 835, + 136, + 672, + 529, + 940, + 1088, + 1435, + 473, + 1967, + 1968, + 467, + 50, + 390, + 227, + 587, + 279, + 378, + 598, + 792, + 968, + 240, + 151, + 160, + 849, + 882, + 1126, + 1285, + 639, + 1044, + 133, + 140, + 288, + 360, + 811, + 563, + 1027, + 561, + 142, + 523, + 1969, + 1970, + 1971, + 7, + 103, + 296, + 439, + 407, + 506, + 634, + 990, + 1972, + 1973, + 1974, + 1975, + 645, + 1976, + 1977, + 1978, + 1979, + 1980, + 1981, + 236, + 1982, + 1436, + 1983, + 1984, + 1089, + 192, + 828, + 618, + 518, + 1166, + 333, + 1127, + 1985, + 818, + 1223, + 1986, + 1987, + 1988, + 1989, + 1990, + 1991, + 1992, + 1993, + 342, + 1128, + 1286, + 746, + 842, + 1994, + 1995, + 560, + 223, + 1287, + 98, + 8, + 189, + 650, + 978, + 1288, + 1996, + 1437, + 1997, + 17, + 345, + 250, + 423, + 277, + 234, + 512, + 226, + 97, + 289, + 42, + 167, + 1998, + 201, + 1999, + 2000, + 843, + 836, + 824, + 532, + 338, + 783, + 1090, + 182, + 576, + 436, + 1438, + 1439, + 527, + 500, + 2001, + 947, + 889, + 2002, + 2003, + 2004, + 2005, + 262, + 600, + 314, + 447, + 2006, + 547, + 2007, + 693, + 738, + 1129, + 2008, + 71, + 1440, + 745, + 619, + 688, + 2009, + 829, + 2010, + 2011, + 147, + 2012, + 33, + 948, + 2013, + 2014, + 74, + 224, + 2015, + 61, + 191, + 918, + 399, + 637, + 2016, + 1028, + 1130, + 257, + 902, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023, + 2024, + 2025, + 2026, + 837, + 2027, + 2028, + 2029, + 2030, + 179, + 874, + 591, + 52, + 724, + 246, + 2031, + 2032, + 2033, + 2034, + 1167, + 969, + 2035, + 1289, + 630, + 605, + 911, + 1091, + 1168, + 2036, + 2037, + 2038, + 1441, + 912, + 2039, + 623, + 2040, + 2041, + 253, + 1169, + 1290, + 2042, + 1442, + 146, + 620, + 611, + 577, + 433, + 2043, + 1224, + 719, + 1170, + 959, + 440, + 437, + 534, + 84, + 388, + 480, + 1131, + 159, + 220, + 198, + 679, + 2044, + 1012, + 819, + 1066, + 1443, + 113, + 1225, + 194, + 318, + 1003, + 1029, + 2045, + 2046, + 2047, + 2048, + 1067, + 2049, + 2050, + 2051, + 2052, + 2053, + 59, + 913, + 112, + 2054, + 632, + 2055, + 455, + 144, + 739, + 1291, + 2056, + 273, + 681, + 499, + 2057, + 448, + 2058, + 2059, + 760, + 2060, + 2061, + 970, + 384, + 169, + 245, + 1132, + 2062, + 2063, + 414, + 1444, + 2064, + 2065, + 41, + 235, + 2066, + 157, + 252, + 877, + 568, + 919, + 789, + 580, + 2067, + 725, + 2068, + 2069, + 1292, + 2070, + 2071, + 1445, + 2072, + 1446, + 2073, + 2074, + 55, + 588, + 66, + 1447, + 271, + 1092, + 2075, + 1226, + 2076, + 960, + 1013, + 372, + 2077, + 2078, + 2079, + 2080, + 2081, + 1293, + 2082, + 2083, + 2084, + 2085, + 850, + 2086, + 2087, + 2088, + 2089, + 2090, + 186, + 2091, + 1068, + 180, + 2092, + 2093, + 2094, + 109, + 1227, + 522, + 606, + 2095, + 867, + 1448, + 1093, + 991, + 1171, + 926, + 353, + 1133, + 2096, + 581, + 2097, + 2098, + 2099, + 1294, + 1449, + 1450, + 2100, + 596, + 1172, + 1014, + 1228, + 2101, + 1451, + 1295, + 1173, + 1229, + 2102, + 2103, + 1296, + 1134, + 1452, + 949, + 1135, + 2104, + 2105, + 1094, + 1453, + 1454, + 1455, + 2106, + 1095, + 2107, + 2108, + 2109, + 2110, + 2111, + 2112, + 2113, + 2114, + 2115, + 2116, + 2117, + 804, + 2118, + 2119, + 1230, + 1231, + 805, + 1456, + 405, + 1136, + 2120, + 2121, + 2122, + 2123, + 2124, + 720, + 701, + 1297, + 992, + 1457, + 927, + 1004, + 2125, + 2126, + 2127, + 2128, + 2129, + 2130, + 22, + 417, + 2131, + 303, + 2132, + 385, + 2133, + 971, + 520, + 513, + 2134, + 1174, + 73, + 1096, + 231, + 274, + 962, + 1458, + 673, + 2135, + 1459, + 2136, + 152, + 1137, + 2137, + 2138, + 2139, + 2140, + 1005, + 1138, + 1460, + 1139, + 2141, + 2142, + 2143, + 2144, + 11, + 374, + 844, + 2145, + 154, + 1232, + 46, + 1461, + 2146, + 838, + 830, + 721, + 1233, + 106, + 2147, + 90, + 428, + 462, + 578, + 566, + 1175, + 352, + 2148, + 2149, + 538, + 1234, + 124, + 1298, + 2150, + 1462, + 761, + 565, + 2151, + 686, + 2152, + 649, + 2153, + 72, + 173, + 2154, + 460, + 415, + 2155, + 1463, + 2156, + 1235, + 305, + 2157, + 2158, + 2159, + 2160, + 2161, + 2162, + 579, + 2163, + 2164, + 2165, + 2166, + 2167, + 747, + 2168, + 2169, + 2170, + 2171, + 1464, + 669, + 2172, + 2173, + 2174, + 2175, + 2176, + 1465, + 2177, + 23, + 530, + 285, + 2178, + 335, + 729, + 2179, + 397, + 2180, + 2181, + 2182, + 1030, + 2183, + 2184, + 698, + 2185, + 2186, + 325, + 2187, + 2188, + 369, + 2189, + 799, + 1097, + 1015, + 348, + 2190, + 1069, + 680, + 2191, + 851, + 1466, + 2192, + 2193, + 10, + 2194, + 613, + 424, + 2195, + 979, + 108, + 449, + 589, + 27, + 172, + 81, + 1031, + 80, + 774, + 281, + 350, + 1032, + 525, + 301, + 582, + 1176, + 2196, + 674, + 1045, + 2197, + 2198, + 1467, + 730, + 762, + 2199, + 2200, + 2201, + 2202, + 1468, + 2203, + 993, + 2204, + 2205, + 266, + 1070, + 963, + 1140, + 2206, + 2207, + 2208, + 664, + 1098, + 972, + 2209, + 2210, + 2211, + 1177, + 1469, + 1470, + 871, + 2212, + 2213, + 2214, + 2215, + 2216, + 1471, + 2217, + 2218, + 2219, + 2220, + 2221, + 2222, + 2223, + 2224, + 2225, + 2226, + 2227, + 1472, + 1236, + 2228, + 2229, + 2230, + 2231, + 2232, + 2233, + 2234, + 2235, + 1299, + 2236, + 2237, + 200, + 2238, + 477, + 373, + 2239, + 2240, + 731, + 825, + 777, + 2241, + 2242, + 2243, + 521, + 486, + 548, + 2244, + 2245, + 2246, + 1473, + 1300, + 53, + 549, + 137, + 875, + 76, + 158, + 2247, + 1301, + 1474, + 469, + 396, + 1016, + 278, + 712, + 2248, + 321, + 442, + 503, + 767, + 744, + 941, + 1237, + 1178, + 1475, + 2249, + 82, + 178, + 1141, + 1179, + 973, + 2250, + 1302, + 2251, + 297, + 2252, + 2253, + 570, + 2254, + 2255, + 2256, + 18, + 450, + 206, + 2257, + 290, + 292, + 1142, + 2258, + 511, + 162, + 99, + 346, + 164, + 735, + 2259, + 1476, + 1477, + 4, + 554, + 343, + 798, + 1099, + 2260, + 1100, + 2261, + 43, + 171, + 1303, + 139, + 215, + 2262, + 2263, + 717, + 775, + 2264, + 1033, + 322, + 216, + 2265, + 831, + 2266, + 149, + 2267, + 1304, + 2268, + 2269, + 702, + 1238, + 135, + 845, + 347, + 309, + 2270, + 484, + 2271, + 878, + 655, + 238, + 1006, + 1478, + 2272, + 67, + 2273, + 295, + 2274, + 2275, + 461, + 2276, + 478, + 942, + 412, + 2277, + 1034, + 2278, + 2279, + 2280, + 265, + 2281, + 541, + 2282, + 2283, + 2284, + 2285, + 2286, + 70, + 852, + 1071, + 2287, + 2288, + 2289, + 2290, + 21, + 56, + 509, + 117, + 432, + 2291, + 2292, + 331, + 980, + 552, + 1101, + 148, + 284, + 105, + 393, + 1180, + 1239, + 755, + 2293, + 187, + 2294, + 1046, + 1479, + 2295, + 340, + 2296, + 63, + 1047, + 230, + 2297, + 2298, + 1305, + 763, + 1306, + 101, + 800, + 808, + 494, + 2299, + 2300, + 2301, + 903, + 2302, + 37, + 1072, + 14, + 5, + 2303, + 79, + 675, + 2304, + 312, + 2305, + 2306, + 2307, + 2308, + 2309, + 1480, + 6, + 1307, + 2310, + 2311, + 2312, + 1, + 470, + 35, + 24, + 229, + 2313, + 695, + 210, + 86, + 778, + 15, + 784, + 592, + 779, + 32, + 77, + 855, + 964, + 2314, + 259, + 2315, + 501, + 380, + 2316, + 2317, + 83, + 981, + 153, + 689, + 1308, + 1481, + 1482, + 1483, + 2318, + 2319, + 716, + 1484, + 2320, + 2321, + 2322, + 2323, + 2324, + 2325, + 1485, + 2326, + 2327, + 128, + 57, + 68, + 261, + 1048, + 211, + 170, + 1240, + 31, + 2328, + 51, + 435, + 742, + 2329, + 2330, + 2331, + 635, + 2332, + 264, + 456, + 2333, + 2334, + 2335, + 425, + 2336, + 1486, + 143, + 507, + 263, + 943, + 2337, + 363, + 920, + 1487, + 256, + 1488, + 1102, + 243, + 601, + 1489, + 2338, + 2339, + 2340, + 2341, + 2342, + 2343, + 2344, + 861, + 2345, + 2346, + 2347, + 2348, + 2349, + 2350, + 395, + 2351, + 1490, + 1491, + 62, + 535, + 166, + 225, + 2352, + 2353, + 668, + 419, + 1241, + 138, + 604, + 928, + 2354, + 1181, + 2355, + 1492, + 1493, + 2356, + 2357, + 2358, + 1143, + 2359, + 696, + 2360, + 387, + 307, + 1309, + 682, + 476, + 2361, + 2362, + 332, + 12, + 222, + 156, + 2363, + 232, + 2364, + 641, + 276, + 656, + 517, + 1494, + 1495, + 1035, + 416, + 736, + 1496, + 2365, + 1017, + 586, + 2366, + 2367, + 2368, + 1497, + 2369, + 242, + 2370, + 2371, + 2372, + 1498, + 2373, + 965, + 713, + 2374, + 2375, + 2376, + 2377, + 740, + 982, + 1499, + 944, + 1500, + 1007, + 2378, + 2379, + 1310, + 1501, + 2380, + 2381, + 2382, + 785, + 329, + 2383, + 2384, + 1502, + 2385, + 2386, + 2387, + 932, + 2388, + 1503, + 2389, + 2390, + 2391, + 2392, + 1242, + 2393, + 2394, + 2395, + 2396, + 2397, + 994, + 950, + 2398, + 2399, + 2400, + 2401, + 1504, + 1311, + 2402, + 2403, + 2404, + 2405, + 1049, + 749, + 2406, + 2407, + 853, + 718, + 1144, + 1312, + 2408, + 1182, + 1505, + 2409, + 2410, + 255, + 516, + 479, + 564, + 550, + 214, + 1506, + 1507, + 1313, + 413, + 239, + 444, + 339, + 1145, + 1036, + 1508, + 1509, + 1314, + 1037, + 1510, + 1315, + 2411, + 1511, + 2412, + 2413, + 2414, + 176, + 703, + 497, + 624, + 593, + 921, + 302, + 2415, + 341, + 165, + 1103, + 1512, + 2416, + 1513, + 2417, + 2418, + 2419, + 376, + 2420, + 700, + 2421, + 2422, + 2423, + 258, + 768, + 1316, + 2424, + 1183, + 2425, + 995, + 608, + 2426, + 2427, + 2428, + 2429, + 221, + 2430, + 2431, + 2432, + 2433, + 2434, + 2435, + 2436, + 2437, + 195, + 323, + 726, + 188, + 897, + 983, + 1317, + 377, + 644, + 1050, + 879, + 2438, + 452, + 2439, + 2440, + 2441, + 2442, + 2443, + 2444, + 914, + 2445, + 2446, + 2447, + 2448, + 915, + 489, + 2449, + 1514, + 1184, + 2450, + 2451, + 515, + 64, + 427, + 495, + 2452, + 583, + 2453, + 483, + 485, + 1038, + 562, + 213, + 1515, + 748, + 666, + 2454, + 2455, + 2456, + 2457, + 334, + 2458, + 780, + 996, + 1008, + 705, + 1243, + 2459, + 2460, + 2461, + 2462, + 2463, + 114, + 2464, + 493, + 1146, + 366, + 163, + 1516, + 961, + 1104, + 2465, + 291, + 2466, + 1318, + 1105, + 2467, + 1517, + 365, + 2468, + 355, + 951, + 1244, + 2469, + 1319, + 2470, + 631, + 2471, + 2472, + 218, + 1320, + 364, + 320, + 756, + 1518, + 1519, + 1321, + 1520, + 1322, + 2473, + 2474, + 2475, + 2476, + 997, + 2477, + 2478, + 2479, + 2480, + 665, + 1185, + 2481, + 916, + 1521, + 2482, + 2483, + 2484, + 584, + 684, + 2485, + 2486, + 797, + 2487, + 1051, + 1186, + 2488, + 2489, + 2490, + 1522, + 2491, + 2492, + 370, + 2493, + 1039, + 1187, + 65, + 2494, + 434, + 205, + 463, + 1188, + 2495, + 125, + 812, + 391, + 402, + 826, + 699, + 286, + 398, + 155, + 781, + 771, + 585, + 2496, + 590, + 505, + 1073, + 2497, + 599, + 244, + 219, + 917, + 1018, + 952, + 646, + 1523, + 2498, + 1323, + 2499, + 2500, + 49, + 984, + 354, + 741, + 2501, + 625, + 2502, + 1324, + 2503, + 1019, + 190, + 357, + 757, + 491, + 95, + 782, + 868, + 2504, + 2505, + 2506, + 2507, + 2508, + 2509, + 134, + 1524, + 1074, + 422, + 1525, + 898, + 2510, + 161, + 2511, + 2512, + 2513, + 2514, + 769, + 2515, + 1526, + 2516, + 2517, + 411, + 1325, + 2518, + 472, + 1527, + 2519, + 2520, + 2521, + 2522, + 2523, + 2524, + 985, + 2525, + 2526, + 2527, + 2528, + 2529, + 2530, + 764, + 2531, + 1245, + 2532, + 2533, + 25, + 204, + 311, + 2534, + 496, + 2535, + 1052, + 2536, + 2537, + 2538, + 2539, + 2540, + 2541, + 2542, + 199, + 704, + 504, + 468, + 758, + 657, + 1528, + 196, + 44, + 839, + 1246, + 272, + 750, + 2543, + 765, + 862, + 2544, + 2545, + 1326, + 2546, + 132, + 615, + 933, + 2547, + 732, + 2548, + 2549, + 2550, + 1189, + 1529, + 2551, + 283, + 1247, + 1053, + 607, + 929, + 2552, + 2553, + 2554, + 930, + 183, + 872, + 616, + 1040, + 1147, + 2555, + 1148, + 1020, + 441, + 249, + 1075, + 2556, + 2557, + 2558, + 466, + 743, + 2559, + 2560, + 2561, + 92, + 514, + 426, + 420, + 526, + 2562, + 2563, + 2564, + 2565, + 2566, + 2567, + 2568, + 185, + 2569, + 2570, + 2571, + 2572, + 776, + 1530, + 658, + 2573, + 362, + 2574, + 361, + 922, + 1076, + 793, + 2575, + 2576, + 2577, + 2578, + 2579, + 2580, + 1531, + 251, + 2581, + 2582, + 2583, + 2584, + 1532, + 54, + 612, + 237, + 1327, + 2585, + 2586, + 275, + 408, + 647, + 111, + 2587, + 1533, + 1106, + 465, + 3, + 458, + 9, + 38, + 2588, + 107, + 110, + 890, + 209, + 26, + 737, + 498, + 2589, + 1534, + 2590, + 431, + 202, + 88, + 1535, + 356, + 287, + 1107, + 660, + 1149, + 2591, + 381, + 1536, + 986, + 1150, + 445, + 1248, + 1151, + 974, + 2592, + 2593, + 846, + 2594, + 446, + 953, + 184, + 1249, + 1250, + 727, + 2595, + 923, + 193, + 883, + 2596, + 2597, + 2598, + 102, + 324, + 539, + 817, + 2599, + 421, + 1041, + 2600, + 832, + 2601, + 94, + 175, + 197, + 406, + 2602, + 459, + 2603, + 2604, + 2605, + 2606, + 2607, + 330, + 555, + 2608, + 2609, + 2610, + 706, + 1108, + 389, + 2611, + 2612, + 2613, + 2614, + 233, + 2615, + 833, + 558, + 931, + 954, + 1251, + 2616, + 2617, + 1537, + 546, + 2618, + 2619, + 1009, + 2620, + 2621, + 2622, + 1538, + 690, + 1328, + 2623, + 955, + 2624, + 1539, + 2625, + 2626, + 772, + 2627, + 2628, + 2629, + 2630, + 2631, + 924, + 648, + 863, + 603, + 2632, + 2633, + 934, + 1540, + 864, + 865, + 2634, + 642, + 1042, + 670, + 1190, + 2635, + 2636, + 2637, + 2638, + 168, + 2639, + 652, + 873, + 542, + 1054, + 1541, + 2640, + 2641, + 2642, # 512, 256 ) - diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/euctwfreq.py b/src/fetchcode/vcs/pip/_vendor/chardet/euctwfreq.py index ed7a995a..7c385186 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/euctwfreq.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/euctwfreq.py @@ -47,341 +47,5380 @@ EUCTW_TABLE_SIZE = 5376 EUCTW_CHAR_TO_FREQ_ORDER = ( - 1,1800,1506, 255,1431, 198, 9, 82, 6,7310, 177, 202,3615,1256,2808, 110, # 2742 -3735, 33,3241, 261, 76, 44,2113, 16,2931,2184,1176, 659,3868, 26,3404,2643, # 2758 -1198,3869,3313,4060, 410,2211, 302, 590, 361,1963, 8, 204, 58,4296,7311,1931, # 2774 - 63,7312,7313, 317,1614, 75, 222, 159,4061,2412,1480,7314,3500,3068, 224,2809, # 2790 -3616, 3, 10,3870,1471, 29,2774,1135,2852,1939, 873, 130,3242,1123, 312,7315, # 2806 -4297,2051, 507, 252, 682,7316, 142,1914, 124, 206,2932, 34,3501,3173, 64, 604, # 2822 -7317,2494,1976,1977, 155,1990, 645, 641,1606,7318,3405, 337, 72, 406,7319, 80, # 2838 - 630, 238,3174,1509, 263, 939,1092,2644, 756,1440,1094,3406, 449, 69,2969, 591, # 2854 - 179,2095, 471, 115,2034,1843, 60, 50,2970, 134, 806,1868, 734,2035,3407, 180, # 2870 - 995,1607, 156, 537,2893, 688,7320, 319,1305, 779,2144, 514,2374, 298,4298, 359, # 2886 -2495, 90,2707,1338, 663, 11, 906,1099,2545, 20,2436, 182, 532,1716,7321, 732, # 2902 -1376,4062,1311,1420,3175, 25,2312,1056, 113, 399, 382,1949, 242,3408,2467, 529, # 2918 -3243, 475,1447,3617,7322, 117, 21, 656, 810,1297,2295,2329,3502,7323, 126,4063, # 2934 - 706, 456, 150, 613,4299, 71,1118,2036,4064, 145,3069, 85, 835, 486,2114,1246, # 2950 -1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,7324,2127,2354, 347,3736, 221, # 2966 -3503,3110,7325,1955,1153,4065, 83, 296,1199,3070, 192, 624, 93,7326, 822,1897, # 2982 -2810,3111, 795,2064, 991,1554,1542,1592, 27, 43,2853, 859, 139,1456, 860,4300, # 2998 - 437, 712,3871, 164,2392,3112, 695, 211,3017,2096, 195,3872,1608,3504,3505,3618, # 3014 -3873, 234, 811,2971,2097,3874,2229,1441,3506,1615,2375, 668,2076,1638, 305, 228, # 3030 -1664,4301, 467, 415,7327, 262,2098,1593, 239, 108, 300, 200,1033, 512,1247,2077, # 3046 -7328,7329,2173,3176,3619,2673, 593, 845,1062,3244, 88,1723,2037,3875,1950, 212, # 3062 - 266, 152, 149, 468,1898,4066,4302, 77, 187,7330,3018, 37, 5,2972,7331,3876, # 3078 -7332,7333, 39,2517,4303,2894,3177,2078, 55, 148, 74,4304, 545, 483,1474,1029, # 3094 -1665, 217,1869,1531,3113,1104,2645,4067, 24, 172,3507, 900,3877,3508,3509,4305, # 3110 - 32,1408,2811,1312, 329, 487,2355,2247,2708, 784,2674, 4,3019,3314,1427,1788, # 3126 - 188, 109, 499,7334,3620,1717,1789, 888,1217,3020,4306,7335,3510,7336,3315,1520, # 3142 -3621,3878, 196,1034, 775,7337,7338, 929,1815, 249, 439, 38,7339,1063,7340, 794, # 3158 -3879,1435,2296, 46, 178,3245,2065,7341,2376,7342, 214,1709,4307, 804, 35, 707, # 3174 - 324,3622,1601,2546, 140, 459,4068,7343,7344,1365, 839, 272, 978,2257,2572,3409, # 3190 -2128,1363,3623,1423, 697, 100,3071, 48, 70,1231, 495,3114,2193,7345,1294,7346, # 3206 -2079, 462, 586,1042,3246, 853, 256, 988, 185,2377,3410,1698, 434,1084,7347,3411, # 3222 - 314,2615,2775,4308,2330,2331, 569,2280, 637,1816,2518, 757,1162,1878,1616,3412, # 3238 - 287,1577,2115, 768,4309,1671,2854,3511,2519,1321,3737, 909,2413,7348,4069, 933, # 3254 -3738,7349,2052,2356,1222,4310, 765,2414,1322, 786,4311,7350,1919,1462,1677,2895, # 3270 -1699,7351,4312,1424,2437,3115,3624,2590,3316,1774,1940,3413,3880,4070, 309,1369, # 3286 -1130,2812, 364,2230,1653,1299,3881,3512,3882,3883,2646, 525,1085,3021, 902,2000, # 3302 -1475, 964,4313, 421,1844,1415,1057,2281, 940,1364,3116, 376,4314,4315,1381, 7, # 3318 -2520, 983,2378, 336,1710,2675,1845, 321,3414, 559,1131,3022,2742,1808,1132,1313, # 3334 - 265,1481,1857,7352, 352,1203,2813,3247, 167,1089, 420,2814, 776, 792,1724,3513, # 3350 -4071,2438,3248,7353,4072,7354, 446, 229, 333,2743, 901,3739,1200,1557,4316,2647, # 3366 -1920, 395,2744,2676,3740,4073,1835, 125, 916,3178,2616,4317,7355,7356,3741,7357, # 3382 -7358,7359,4318,3117,3625,1133,2547,1757,3415,1510,2313,1409,3514,7360,2145, 438, # 3398 -2591,2896,2379,3317,1068, 958,3023, 461, 311,2855,2677,4074,1915,3179,4075,1978, # 3414 - 383, 750,2745,2617,4076, 274, 539, 385,1278,1442,7361,1154,1964, 384, 561, 210, # 3430 - 98,1295,2548,3515,7362,1711,2415,1482,3416,3884,2897,1257, 129,7363,3742, 642, # 3446 - 523,2776,2777,2648,7364, 141,2231,1333, 68, 176, 441, 876, 907,4077, 603,2592, # 3462 - 710, 171,3417, 404, 549, 18,3118,2393,1410,3626,1666,7365,3516,4319,2898,4320, # 3478 -7366,2973, 368,7367, 146, 366, 99, 871,3627,1543, 748, 807,1586,1185, 22,2258, # 3494 - 379,3743,3180,7368,3181, 505,1941,2618,1991,1382,2314,7369, 380,2357, 218, 702, # 3510 -1817,1248,3418,3024,3517,3318,3249,7370,2974,3628, 930,3250,3744,7371, 59,7372, # 3526 - 585, 601,4078, 497,3419,1112,1314,4321,1801,7373,1223,1472,2174,7374, 749,1836, # 3542 - 690,1899,3745,1772,3885,1476, 429,1043,1790,2232,2116, 917,4079, 447,1086,1629, # 3558 -7375, 556,7376,7377,2020,1654, 844,1090, 105, 550, 966,1758,2815,1008,1782, 686, # 3574 -1095,7378,2282, 793,1602,7379,3518,2593,4322,4080,2933,2297,4323,3746, 980,2496, # 3590 - 544, 353, 527,4324, 908,2678,2899,7380, 381,2619,1942,1348,7381,1341,1252, 560, # 3606 -3072,7382,3420,2856,7383,2053, 973, 886,2080, 143,4325,7384,7385, 157,3886, 496, # 3622 -4081, 57, 840, 540,2038,4326,4327,3421,2117,1445, 970,2259,1748,1965,2081,4082, # 3638 -3119,1234,1775,3251,2816,3629, 773,1206,2129,1066,2039,1326,3887,1738,1725,4083, # 3654 - 279,3120, 51,1544,2594, 423,1578,2130,2066, 173,4328,1879,7386,7387,1583, 264, # 3670 - 610,3630,4329,2439, 280, 154,7388,7389,7390,1739, 338,1282,3073, 693,2857,1411, # 3686 -1074,3747,2440,7391,4330,7392,7393,1240, 952,2394,7394,2900,1538,2679, 685,1483, # 3702 -4084,2468,1436, 953,4085,2054,4331, 671,2395, 79,4086,2441,3252, 608, 567,2680, # 3718 -3422,4087,4088,1691, 393,1261,1791,2396,7395,4332,7396,7397,7398,7399,1383,1672, # 3734 -3748,3182,1464, 522,1119, 661,1150, 216, 675,4333,3888,1432,3519, 609,4334,2681, # 3750 -2397,7400,7401,7402,4089,3025, 0,7403,2469, 315, 231,2442, 301,3319,4335,2380, # 3766 -7404, 233,4090,3631,1818,4336,4337,7405, 96,1776,1315,2082,7406, 257,7407,1809, # 3782 -3632,2709,1139,1819,4091,2021,1124,2163,2778,1777,2649,7408,3074, 363,1655,3183, # 3798 -7409,2975,7410,7411,7412,3889,1567,3890, 718, 103,3184, 849,1443, 341,3320,2934, # 3814 -1484,7413,1712, 127, 67, 339,4092,2398, 679,1412, 821,7414,7415, 834, 738, 351, # 3830 -2976,2146, 846, 235,1497,1880, 418,1992,3749,2710, 186,1100,2147,2746,3520,1545, # 3846 -1355,2935,2858,1377, 583,3891,4093,2573,2977,7416,1298,3633,1078,2549,3634,2358, # 3862 - 78,3750,3751, 267,1289,2099,2001,1594,4094, 348, 369,1274,2194,2175,1837,4338, # 3878 -1820,2817,3635,2747,2283,2002,4339,2936,2748, 144,3321, 882,4340,3892,2749,3423, # 3894 -4341,2901,7417,4095,1726, 320,7418,3893,3026, 788,2978,7419,2818,1773,1327,2859, # 3910 -3894,2819,7420,1306,4342,2003,1700,3752,3521,2359,2650, 787,2022, 506, 824,3636, # 3926 - 534, 323,4343,1044,3322,2023,1900, 946,3424,7421,1778,1500,1678,7422,1881,4344, # 3942 - 165, 243,4345,3637,2521, 123, 683,4096, 764,4346, 36,3895,1792, 589,2902, 816, # 3958 - 626,1667,3027,2233,1639,1555,1622,3753,3896,7423,3897,2860,1370,1228,1932, 891, # 3974 -2083,2903, 304,4097,7424, 292,2979,2711,3522, 691,2100,4098,1115,4347, 118, 662, # 3990 -7425, 611,1156, 854,2381,1316,2861, 2, 386, 515,2904,7426,7427,3253, 868,2234, # 4006 -1486, 855,2651, 785,2212,3028,7428,1040,3185,3523,7429,3121, 448,7430,1525,7431, # 4022 -2164,4348,7432,3754,7433,4099,2820,3524,3122, 503, 818,3898,3123,1568, 814, 676, # 4038 -1444, 306,1749,7434,3755,1416,1030, 197,1428, 805,2821,1501,4349,7435,7436,7437, # 4054 -1993,7438,4350,7439,7440,2195, 13,2779,3638,2980,3124,1229,1916,7441,3756,2131, # 4070 -7442,4100,4351,2399,3525,7443,2213,1511,1727,1120,7444,7445, 646,3757,2443, 307, # 4086 -7446,7447,1595,3186,7448,7449,7450,3639,1113,1356,3899,1465,2522,2523,7451, 519, # 4102 -7452, 128,2132, 92,2284,1979,7453,3900,1512, 342,3125,2196,7454,2780,2214,1980, # 4118 -3323,7455, 290,1656,1317, 789, 827,2360,7456,3758,4352, 562, 581,3901,7457, 401, # 4134 -4353,2248, 94,4354,1399,2781,7458,1463,2024,4355,3187,1943,7459, 828,1105,4101, # 4150 -1262,1394,7460,4102, 605,4356,7461,1783,2862,7462,2822, 819,2101, 578,2197,2937, # 4166 -7463,1502, 436,3254,4103,3255,2823,3902,2905,3425,3426,7464,2712,2315,7465,7466, # 4182 -2332,2067, 23,4357, 193, 826,3759,2102, 699,1630,4104,3075, 390,1793,1064,3526, # 4198 -7467,1579,3076,3077,1400,7468,4105,1838,1640,2863,7469,4358,4359, 137,4106, 598, # 4214 -3078,1966, 780, 104, 974,2938,7470, 278, 899, 253, 402, 572, 504, 493,1339,7471, # 4230 -3903,1275,4360,2574,2550,7472,3640,3029,3079,2249, 565,1334,2713, 863, 41,7473, # 4246 -7474,4361,7475,1657,2333, 19, 463,2750,4107, 606,7476,2981,3256,1087,2084,1323, # 4262 -2652,2982,7477,1631,1623,1750,4108,2682,7478,2864, 791,2714,2653,2334, 232,2416, # 4278 -7479,2983,1498,7480,2654,2620, 755,1366,3641,3257,3126,2025,1609, 119,1917,3427, # 4294 - 862,1026,4109,7481,3904,3760,4362,3905,4363,2260,1951,2470,7482,1125, 817,4110, # 4310 -4111,3906,1513,1766,2040,1487,4112,3030,3258,2824,3761,3127,7483,7484,1507,7485, # 4326 -2683, 733, 40,1632,1106,2865, 345,4113, 841,2524, 230,4364,2984,1846,3259,3428, # 4342 -7486,1263, 986,3429,7487, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562,3907, # 4358 -3908,2939, 967,2751,2655,1349, 592,2133,1692,3324,2985,1994,4114,1679,3909,1901, # 4374 -2185,7488, 739,3642,2715,1296,1290,7489,4115,2198,2199,1921,1563,2595,2551,1870, # 4390 -2752,2986,7490, 435,7491, 343,1108, 596, 17,1751,4365,2235,3430,3643,7492,4366, # 4406 - 294,3527,2940,1693, 477, 979, 281,2041,3528, 643,2042,3644,2621,2782,2261,1031, # 4422 -2335,2134,2298,3529,4367, 367,1249,2552,7493,3530,7494,4368,1283,3325,2004, 240, # 4438 -1762,3326,4369,4370, 836,1069,3128, 474,7495,2148,2525, 268,3531,7496,3188,1521, # 4454 -1284,7497,1658,1546,4116,7498,3532,3533,7499,4117,3327,2684,1685,4118, 961,1673, # 4470 -2622, 190,2005,2200,3762,4371,4372,7500, 570,2497,3645,1490,7501,4373,2623,3260, # 4486 -1956,4374, 584,1514, 396,1045,1944,7502,4375,1967,2444,7503,7504,4376,3910, 619, # 4502 -7505,3129,3261, 215,2006,2783,2553,3189,4377,3190,4378, 763,4119,3763,4379,7506, # 4518 -7507,1957,1767,2941,3328,3646,1174, 452,1477,4380,3329,3130,7508,2825,1253,2382, # 4534 -2186,1091,2285,4120, 492,7509, 638,1169,1824,2135,1752,3911, 648, 926,1021,1324, # 4550 -4381, 520,4382, 997, 847,1007, 892,4383,3764,2262,1871,3647,7510,2400,1784,4384, # 4566 -1952,2942,3080,3191,1728,4121,2043,3648,4385,2007,1701,3131,1551, 30,2263,4122, # 4582 -7511,2026,4386,3534,7512, 501,7513,4123, 594,3431,2165,1821,3535,3432,3536,3192, # 4598 - 829,2826,4124,7514,1680,3132,1225,4125,7515,3262,4387,4126,3133,2336,7516,4388, # 4614 -4127,7517,3912,3913,7518,1847,2383,2596,3330,7519,4389, 374,3914, 652,4128,4129, # 4630 - 375,1140, 798,7520,7521,7522,2361,4390,2264, 546,1659, 138,3031,2445,4391,7523, # 4646 -2250, 612,1848, 910, 796,3765,1740,1371, 825,3766,3767,7524,2906,2554,7525, 692, # 4662 - 444,3032,2624, 801,4392,4130,7526,1491, 244,1053,3033,4131,4132, 340,7527,3915, # 4678 -1041,2987, 293,1168, 87,1357,7528,1539, 959,7529,2236, 721, 694,4133,3768, 219, # 4694 -1478, 644,1417,3331,2656,1413,1401,1335,1389,3916,7530,7531,2988,2362,3134,1825, # 4710 - 730,1515, 184,2827, 66,4393,7532,1660,2943, 246,3332, 378,1457, 226,3433, 975, # 4726 -3917,2944,1264,3537, 674, 696,7533, 163,7534,1141,2417,2166, 713,3538,3333,4394, # 4742 -3918,7535,7536,1186, 15,7537,1079,1070,7538,1522,3193,3539, 276,1050,2716, 758, # 4758 -1126, 653,2945,3263,7539,2337, 889,3540,3919,3081,2989, 903,1250,4395,3920,3434, # 4774 -3541,1342,1681,1718, 766,3264, 286, 89,2946,3649,7540,1713,7541,2597,3334,2990, # 4790 -7542,2947,2215,3194,2866,7543,4396,2498,2526, 181, 387,1075,3921, 731,2187,3335, # 4806 -7544,3265, 310, 313,3435,2299, 770,4134, 54,3034, 189,4397,3082,3769,3922,7545, # 4822 -1230,1617,1849, 355,3542,4135,4398,3336, 111,4136,3650,1350,3135,3436,3035,4137, # 4838 -2149,3266,3543,7546,2784,3923,3924,2991, 722,2008,7547,1071, 247,1207,2338,2471, # 4854 -1378,4399,2009, 864,1437,1214,4400, 373,3770,1142,2216, 667,4401, 442,2753,2555, # 4870 -3771,3925,1968,4138,3267,1839, 837, 170,1107, 934,1336,1882,7548,7549,2118,4139, # 4886 -2828, 743,1569,7550,4402,4140, 582,2384,1418,3437,7551,1802,7552, 357,1395,1729, # 4902 -3651,3268,2418,1564,2237,7553,3083,3772,1633,4403,1114,2085,4141,1532,7554, 482, # 4918 -2446,4404,7555,7556,1492, 833,1466,7557,2717,3544,1641,2829,7558,1526,1272,3652, # 4934 -4142,1686,1794, 416,2556,1902,1953,1803,7559,3773,2785,3774,1159,2316,7560,2867, # 4950 -4405,1610,1584,3036,2419,2754, 443,3269,1163,3136,7561,7562,3926,7563,4143,2499, # 4966 -3037,4406,3927,3137,2103,1647,3545,2010,1872,4144,7564,4145, 431,3438,7565, 250, # 4982 - 97, 81,4146,7566,1648,1850,1558, 160, 848,7567, 866, 740,1694,7568,2201,2830, # 4998 -3195,4147,4407,3653,1687, 950,2472, 426, 469,3196,3654,3655,3928,7569,7570,1188, # 5014 - 424,1995, 861,3546,4148,3775,2202,2685, 168,1235,3547,4149,7571,2086,1674,4408, # 5030 -3337,3270, 220,2557,1009,7572,3776, 670,2992, 332,1208, 717,7573,7574,3548,2447, # 5046 -3929,3338,7575, 513,7576,1209,2868,3339,3138,4409,1080,7577,7578,7579,7580,2527, # 5062 -3656,3549, 815,1587,3930,3931,7581,3550,3439,3777,1254,4410,1328,3038,1390,3932, # 5078 -1741,3933,3778,3934,7582, 236,3779,2448,3271,7583,7584,3657,3780,1273,3781,4411, # 5094 -7585, 308,7586,4412, 245,4413,1851,2473,1307,2575, 430, 715,2136,2449,7587, 270, # 5110 - 199,2869,3935,7588,3551,2718,1753, 761,1754, 725,1661,1840,4414,3440,3658,7589, # 5126 -7590, 587, 14,3272, 227,2598, 326, 480,2265, 943,2755,3552, 291, 650,1883,7591, # 5142 -1702,1226, 102,1547, 62,3441, 904,4415,3442,1164,4150,7592,7593,1224,1548,2756, # 5158 - 391, 498,1493,7594,1386,1419,7595,2055,1177,4416, 813, 880,1081,2363, 566,1145, # 5174 -4417,2286,1001,1035,2558,2599,2238, 394,1286,7596,7597,2068,7598, 86,1494,1730, # 5190 -3936, 491,1588, 745, 897,2948, 843,3340,3937,2757,2870,3273,1768, 998,2217,2069, # 5206 - 397,1826,1195,1969,3659,2993,3341, 284,7599,3782,2500,2137,2119,1903,7600,3938, # 5222 -2150,3939,4151,1036,3443,1904, 114,2559,4152, 209,1527,7601,7602,2949,2831,2625, # 5238 -2385,2719,3139, 812,2560,7603,3274,7604,1559, 737,1884,3660,1210, 885, 28,2686, # 5254 -3553,3783,7605,4153,1004,1779,4418,7606, 346,1981,2218,2687,4419,3784,1742, 797, # 5270 -1642,3940,1933,1072,1384,2151, 896,3941,3275,3661,3197,2871,3554,7607,2561,1958, # 5286 -4420,2450,1785,7608,7609,7610,3942,4154,1005,1308,3662,4155,2720,4421,4422,1528, # 5302 -2600, 161,1178,4156,1982, 987,4423,1101,4157, 631,3943,1157,3198,2420,1343,1241, # 5318 -1016,2239,2562, 372, 877,2339,2501,1160, 555,1934, 911,3944,7611, 466,1170, 169, # 5334 -1051,2907,2688,3663,2474,2994,1182,2011,2563,1251,2626,7612, 992,2340,3444,1540, # 5350 -2721,1201,2070,2401,1996,2475,7613,4424, 528,1922,2188,1503,1873,1570,2364,3342, # 5366 -3276,7614, 557,1073,7615,1827,3445,2087,2266,3140,3039,3084, 767,3085,2786,4425, # 5382 -1006,4158,4426,2341,1267,2176,3664,3199, 778,3945,3200,2722,1597,2657,7616,4427, # 5398 -7617,3446,7618,7619,7620,3277,2689,1433,3278, 131, 95,1504,3946, 723,4159,3141, # 5414 -1841,3555,2758,2189,3947,2027,2104,3665,7621,2995,3948,1218,7622,3343,3201,3949, # 5430 -4160,2576, 248,1634,3785, 912,7623,2832,3666,3040,3786, 654, 53,7624,2996,7625, # 5446 -1688,4428, 777,3447,1032,3950,1425,7626, 191, 820,2120,2833, 971,4429, 931,3202, # 5462 - 135, 664, 783,3787,1997, 772,2908,1935,3951,3788,4430,2909,3203, 282,2723, 640, # 5478 -1372,3448,1127, 922, 325,3344,7627,7628, 711,2044,7629,7630,3952,2219,2787,1936, # 5494 -3953,3345,2220,2251,3789,2300,7631,4431,3790,1258,3279,3954,3204,2138,2950,3955, # 5510 -3956,7632,2221, 258,3205,4432, 101,1227,7633,3280,1755,7634,1391,3281,7635,2910, # 5526 -2056, 893,7636,7637,7638,1402,4161,2342,7639,7640,3206,3556,7641,7642, 878,1325, # 5542 -1780,2788,4433, 259,1385,2577, 744,1183,2267,4434,7643,3957,2502,7644, 684,1024, # 5558 -4162,7645, 472,3557,3449,1165,3282,3958,3959, 322,2152, 881, 455,1695,1152,1340, # 5574 - 660, 554,2153,4435,1058,4436,4163, 830,1065,3346,3960,4437,1923,7646,1703,1918, # 5590 -7647, 932,2268, 122,7648,4438, 947, 677,7649,3791,2627, 297,1905,1924,2269,4439, # 5606 -2317,3283,7650,7651,4164,7652,4165, 84,4166, 112, 989,7653, 547,1059,3961, 701, # 5622 -3558,1019,7654,4167,7655,3450, 942, 639, 457,2301,2451, 993,2951, 407, 851, 494, # 5638 -4440,3347, 927,7656,1237,7657,2421,3348, 573,4168, 680, 921,2911,1279,1874, 285, # 5654 - 790,1448,1983, 719,2167,7658,7659,4441,3962,3963,1649,7660,1541, 563,7661,1077, # 5670 -7662,3349,3041,3451, 511,2997,3964,3965,3667,3966,1268,2564,3350,3207,4442,4443, # 5686 -7663, 535,1048,1276,1189,2912,2028,3142,1438,1373,2834,2952,1134,2012,7664,4169, # 5702 -1238,2578,3086,1259,7665, 700,7666,2953,3143,3668,4170,7667,4171,1146,1875,1906, # 5718 -4444,2601,3967, 781,2422, 132,1589, 203, 147, 273,2789,2402, 898,1786,2154,3968, # 5734 -3969,7668,3792,2790,7669,7670,4445,4446,7671,3208,7672,1635,3793, 965,7673,1804, # 5750 -2690,1516,3559,1121,1082,1329,3284,3970,1449,3794, 65,1128,2835,2913,2759,1590, # 5766 -3795,7674,7675, 12,2658, 45, 976,2579,3144,4447, 517,2528,1013,1037,3209,7676, # 5782 -3796,2836,7677,3797,7678,3452,7679,2602, 614,1998,2318,3798,3087,2724,2628,7680, # 5798 -2580,4172, 599,1269,7681,1810,3669,7682,2691,3088, 759,1060, 489,1805,3351,3285, # 5814 -1358,7683,7684,2386,1387,1215,2629,2252, 490,7685,7686,4173,1759,2387,2343,7687, # 5830 -4448,3799,1907,3971,2630,1806,3210,4449,3453,3286,2760,2344, 874,7688,7689,3454, # 5846 -3670,1858, 91,2914,3671,3042,3800,4450,7690,3145,3972,2659,7691,3455,1202,1403, # 5862 -3801,2954,2529,1517,2503,4451,3456,2504,7692,4452,7693,2692,1885,1495,1731,3973, # 5878 -2365,4453,7694,2029,7695,7696,3974,2693,1216, 237,2581,4174,2319,3975,3802,4454, # 5894 -4455,2694,3560,3457, 445,4456,7697,7698,7699,7700,2761, 61,3976,3672,1822,3977, # 5910 -7701, 687,2045, 935, 925, 405,2660, 703,1096,1859,2725,4457,3978,1876,1367,2695, # 5926 -3352, 918,2105,1781,2476, 334,3287,1611,1093,4458, 564,3146,3458,3673,3353, 945, # 5942 -2631,2057,4459,7702,1925, 872,4175,7703,3459,2696,3089, 349,4176,3674,3979,4460, # 5958 -3803,4177,3675,2155,3980,4461,4462,4178,4463,2403,2046, 782,3981, 400, 251,4179, # 5974 -1624,7704,7705, 277,3676, 299,1265, 476,1191,3804,2121,4180,4181,1109, 205,7706, # 5990 -2582,1000,2156,3561,1860,7707,7708,7709,4464,7710,4465,2565, 107,2477,2157,3982, # 6006 -3460,3147,7711,1533, 541,1301, 158, 753,4182,2872,3562,7712,1696, 370,1088,4183, # 6022 -4466,3563, 579, 327, 440, 162,2240, 269,1937,1374,3461, 968,3043, 56,1396,3090, # 6038 -2106,3288,3354,7713,1926,2158,4467,2998,7714,3564,7715,7716,3677,4468,2478,7717, # 6054 -2791,7718,1650,4469,7719,2603,7720,7721,3983,2661,3355,1149,3356,3984,3805,3985, # 6070 -7722,1076, 49,7723, 951,3211,3289,3290, 450,2837, 920,7724,1811,2792,2366,4184, # 6086 -1908,1138,2367,3806,3462,7725,3212,4470,1909,1147,1518,2423,4471,3807,7726,4472, # 6102 -2388,2604, 260,1795,3213,7727,7728,3808,3291, 708,7729,3565,1704,7730,3566,1351, # 6118 -1618,3357,2999,1886, 944,4185,3358,4186,3044,3359,4187,7731,3678, 422, 413,1714, # 6134 -3292, 500,2058,2345,4188,2479,7732,1344,1910, 954,7733,1668,7734,7735,3986,2404, # 6150 -4189,3567,3809,4190,7736,2302,1318,2505,3091, 133,3092,2873,4473, 629, 31,2838, # 6166 -2697,3810,4474, 850, 949,4475,3987,2955,1732,2088,4191,1496,1852,7737,3988, 620, # 6182 -3214, 981,1242,3679,3360,1619,3680,1643,3293,2139,2452,1970,1719,3463,2168,7738, # 6198 -3215,7739,7740,3361,1828,7741,1277,4476,1565,2047,7742,1636,3568,3093,7743, 869, # 6214 -2839, 655,3811,3812,3094,3989,3000,3813,1310,3569,4477,7744,7745,7746,1733, 558, # 6230 -4478,3681, 335,1549,3045,1756,4192,3682,1945,3464,1829,1291,1192, 470,2726,2107, # 6246 -2793, 913,1054,3990,7747,1027,7748,3046,3991,4479, 982,2662,3362,3148,3465,3216, # 6262 -3217,1946,2794,7749, 571,4480,7750,1830,7751,3570,2583,1523,2424,7752,2089, 984, # 6278 -4481,3683,1959,7753,3684, 852, 923,2795,3466,3685, 969,1519, 999,2048,2320,1705, # 6294 -7754,3095, 615,1662, 151, 597,3992,2405,2321,1049, 275,4482,3686,4193, 568,3687, # 6310 -3571,2480,4194,3688,7755,2425,2270, 409,3218,7756,1566,2874,3467,1002, 769,2840, # 6326 - 194,2090,3149,3689,2222,3294,4195, 628,1505,7757,7758,1763,2177,3001,3993, 521, # 6342 -1161,2584,1787,2203,2406,4483,3994,1625,4196,4197, 412, 42,3096, 464,7759,2632, # 6358 -4484,3363,1760,1571,2875,3468,2530,1219,2204,3814,2633,2140,2368,4485,4486,3295, # 6374 -1651,3364,3572,7760,7761,3573,2481,3469,7762,3690,7763,7764,2271,2091, 460,7765, # 6390 -4487,7766,3002, 962, 588,3574, 289,3219,2634,1116, 52,7767,3047,1796,7768,7769, # 6406 -7770,1467,7771,1598,1143,3691,4198,1984,1734,1067,4488,1280,3365, 465,4489,1572, # 6422 - 510,7772,1927,2241,1812,1644,3575,7773,4490,3692,7774,7775,2663,1573,1534,7776, # 6438 -7777,4199, 536,1807,1761,3470,3815,3150,2635,7778,7779,7780,4491,3471,2915,1911, # 6454 -2796,7781,3296,1122, 377,3220,7782, 360,7783,7784,4200,1529, 551,7785,2059,3693, # 6470 -1769,2426,7786,2916,4201,3297,3097,2322,2108,2030,4492,1404, 136,1468,1479, 672, # 6486 -1171,3221,2303, 271,3151,7787,2762,7788,2049, 678,2727, 865,1947,4493,7789,2013, # 6502 -3995,2956,7790,2728,2223,1397,3048,3694,4494,4495,1735,2917,3366,3576,7791,3816, # 6518 - 509,2841,2453,2876,3817,7792,7793,3152,3153,4496,4202,2531,4497,2304,1166,1010, # 6534 - 552, 681,1887,7794,7795,2957,2958,3996,1287,1596,1861,3154, 358, 453, 736, 175, # 6550 - 478,1117, 905,1167,1097,7796,1853,1530,7797,1706,7798,2178,3472,2287,3695,3473, # 6566 -3577,4203,2092,4204,7799,3367,1193,2482,4205,1458,2190,2205,1862,1888,1421,3298, # 6582 -2918,3049,2179,3474, 595,2122,7800,3997,7801,7802,4206,1707,2636, 223,3696,1359, # 6598 - 751,3098, 183,3475,7803,2797,3003, 419,2369, 633, 704,3818,2389, 241,7804,7805, # 6614 -7806, 838,3004,3697,2272,2763,2454,3819,1938,2050,3998,1309,3099,2242,1181,7807, # 6630 -1136,2206,3820,2370,1446,4207,2305,4498,7808,7809,4208,1055,2605, 484,3698,7810, # 6646 -3999, 625,4209,2273,3368,1499,4210,4000,7811,4001,4211,3222,2274,2275,3476,7812, # 6662 -7813,2764, 808,2606,3699,3369,4002,4212,3100,2532, 526,3370,3821,4213, 955,7814, # 6678 -1620,4214,2637,2427,7815,1429,3700,1669,1831, 994, 928,7816,3578,1260,7817,7818, # 6694 -7819,1948,2288, 741,2919,1626,4215,2729,2455, 867,1184, 362,3371,1392,7820,7821, # 6710 -4003,4216,1770,1736,3223,2920,4499,4500,1928,2698,1459,1158,7822,3050,3372,2877, # 6726 -1292,1929,2506,2842,3701,1985,1187,2071,2014,2607,4217,7823,2566,2507,2169,3702, # 6742 -2483,3299,7824,3703,4501,7825,7826, 666,1003,3005,1022,3579,4218,7827,4502,1813, # 6758 -2253, 574,3822,1603, 295,1535, 705,3823,4219, 283, 858, 417,7828,7829,3224,4503, # 6774 -4504,3051,1220,1889,1046,2276,2456,4004,1393,1599, 689,2567, 388,4220,7830,2484, # 6790 - 802,7831,2798,3824,2060,1405,2254,7832,4505,3825,2109,1052,1345,3225,1585,7833, # 6806 - 809,7834,7835,7836, 575,2730,3477, 956,1552,1469,1144,2323,7837,2324,1560,2457, # 6822 -3580,3226,4005, 616,2207,3155,2180,2289,7838,1832,7839,3478,4506,7840,1319,3704, # 6838 -3705,1211,3581,1023,3227,1293,2799,7841,7842,7843,3826, 607,2306,3827, 762,2878, # 6854 -1439,4221,1360,7844,1485,3052,7845,4507,1038,4222,1450,2061,2638,4223,1379,4508, # 6870 -2585,7846,7847,4224,1352,1414,2325,2921,1172,7848,7849,3828,3829,7850,1797,1451, # 6886 -7851,7852,7853,7854,2922,4006,4007,2485,2346, 411,4008,4009,3582,3300,3101,4509, # 6902 -1561,2664,1452,4010,1375,7855,7856, 47,2959, 316,7857,1406,1591,2923,3156,7858, # 6918 -1025,2141,3102,3157, 354,2731, 884,2224,4225,2407, 508,3706, 726,3583, 996,2428, # 6934 -3584, 729,7859, 392,2191,1453,4011,4510,3707,7860,7861,2458,3585,2608,1675,2800, # 6950 - 919,2347,2960,2348,1270,4511,4012, 73,7862,7863, 647,7864,3228,2843,2255,1550, # 6966 -1346,3006,7865,1332, 883,3479,7866,7867,7868,7869,3301,2765,7870,1212, 831,1347, # 6982 -4226,4512,2326,3830,1863,3053, 720,3831,4513,4514,3832,7871,4227,7872,7873,4515, # 6998 -7874,7875,1798,4516,3708,2609,4517,3586,1645,2371,7876,7877,2924, 669,2208,2665, # 7014 -2429,7878,2879,7879,7880,1028,3229,7881,4228,2408,7882,2256,1353,7883,7884,4518, # 7030 -3158, 518,7885,4013,7886,4229,1960,7887,2142,4230,7888,7889,3007,2349,2350,3833, # 7046 - 516,1833,1454,4014,2699,4231,4519,2225,2610,1971,1129,3587,7890,2766,7891,2961, # 7062 -1422, 577,1470,3008,1524,3373,7892,7893, 432,4232,3054,3480,7894,2586,1455,2508, # 7078 -2226,1972,1175,7895,1020,2732,4015,3481,4520,7896,2733,7897,1743,1361,3055,3482, # 7094 -2639,4016,4233,4521,2290, 895, 924,4234,2170, 331,2243,3056, 166,1627,3057,1098, # 7110 -7898,1232,2880,2227,3374,4522, 657, 403,1196,2372, 542,3709,3375,1600,4235,3483, # 7126 -7899,4523,2767,3230, 576, 530,1362,7900,4524,2533,2666,3710,4017,7901, 842,3834, # 7142 -7902,2801,2031,1014,4018, 213,2700,3376, 665, 621,4236,7903,3711,2925,2430,7904, # 7158 -2431,3302,3588,3377,7905,4237,2534,4238,4525,3589,1682,4239,3484,1380,7906, 724, # 7174 -2277, 600,1670,7907,1337,1233,4526,3103,2244,7908,1621,4527,7909, 651,4240,7910, # 7190 -1612,4241,2611,7911,2844,7912,2734,2307,3058,7913, 716,2459,3059, 174,1255,2701, # 7206 -4019,3590, 548,1320,1398, 728,4020,1574,7914,1890,1197,3060,4021,7915,3061,3062, # 7222 -3712,3591,3713, 747,7916, 635,4242,4528,7917,7918,7919,4243,7920,7921,4529,7922, # 7238 -3378,4530,2432, 451,7923,3714,2535,2072,4244,2735,4245,4022,7924,1764,4531,7925, # 7254 -4246, 350,7926,2278,2390,2486,7927,4247,4023,2245,1434,4024, 488,4532, 458,4248, # 7270 -4025,3715, 771,1330,2391,3835,2568,3159,2159,2409,1553,2667,3160,4249,7928,2487, # 7286 -2881,2612,1720,2702,4250,3379,4533,7929,2536,4251,7930,3231,4252,2768,7931,2015, # 7302 -2736,7932,1155,1017,3716,3836,7933,3303,2308, 201,1864,4253,1430,7934,4026,7935, # 7318 -7936,7937,7938,7939,4254,1604,7940, 414,1865, 371,2587,4534,4535,3485,2016,3104, # 7334 -4536,1708, 960,4255, 887, 389,2171,1536,1663,1721,7941,2228,4027,2351,2926,1580, # 7350 -7942,7943,7944,1744,7945,2537,4537,4538,7946,4539,7947,2073,7948,7949,3592,3380, # 7366 -2882,4256,7950,4257,2640,3381,2802, 673,2703,2460, 709,3486,4028,3593,4258,7951, # 7382 -1148, 502, 634,7952,7953,1204,4540,3594,1575,4541,2613,3717,7954,3718,3105, 948, # 7398 -3232, 121,1745,3837,1110,7955,4259,3063,2509,3009,4029,3719,1151,1771,3838,1488, # 7414 -4030,1986,7956,2433,3487,7957,7958,2093,7959,4260,3839,1213,1407,2803, 531,2737, # 7430 -2538,3233,1011,1537,7960,2769,4261,3106,1061,7961,3720,3721,1866,2883,7962,2017, # 7446 - 120,4262,4263,2062,3595,3234,2309,3840,2668,3382,1954,4542,7963,7964,3488,1047, # 7462 -2704,1266,7965,1368,4543,2845, 649,3383,3841,2539,2738,1102,2846,2669,7966,7967, # 7478 -1999,7968,1111,3596,2962,7969,2488,3842,3597,2804,1854,3384,3722,7970,7971,3385, # 7494 -2410,2884,3304,3235,3598,7972,2569,7973,3599,2805,4031,1460, 856,7974,3600,7975, # 7510 -2885,2963,7976,2886,3843,7977,4264, 632,2510, 875,3844,1697,3845,2291,7978,7979, # 7526 -4544,3010,1239, 580,4545,4265,7980, 914, 936,2074,1190,4032,1039,2123,7981,7982, # 7542 -7983,3386,1473,7984,1354,4266,3846,7985,2172,3064,4033, 915,3305,4267,4268,3306, # 7558 -1605,1834,7986,2739, 398,3601,4269,3847,4034, 328,1912,2847,4035,3848,1331,4270, # 7574 -3011, 937,4271,7987,3602,4036,4037,3387,2160,4546,3388, 524, 742, 538,3065,1012, # 7590 -7988,7989,3849,2461,7990, 658,1103, 225,3850,7991,7992,4547,7993,4548,7994,3236, # 7606 -1243,7995,4038, 963,2246,4549,7996,2705,3603,3161,7997,7998,2588,2327,7999,4550, # 7622 -8000,8001,8002,3489,3307, 957,3389,2540,2032,1930,2927,2462, 870,2018,3604,1746, # 7638 -2770,2771,2434,2463,8003,3851,8004,3723,3107,3724,3490,3390,3725,8005,1179,3066, # 7654 -8006,3162,2373,4272,3726,2541,3163,3108,2740,4039,8007,3391,1556,2542,2292, 977, # 7670 -2887,2033,4040,1205,3392,8008,1765,3393,3164,2124,1271,1689, 714,4551,3491,8009, # 7686 -2328,3852, 533,4273,3605,2181, 617,8010,2464,3308,3492,2310,8011,8012,3165,8013, # 7702 -8014,3853,1987, 618, 427,2641,3493,3394,8015,8016,1244,1690,8017,2806,4274,4552, # 7718 -8018,3494,8019,8020,2279,1576, 473,3606,4275,3395, 972,8021,3607,8022,3067,8023, # 7734 -8024,4553,4554,8025,3727,4041,4042,8026, 153,4555, 356,8027,1891,2888,4276,2143, # 7750 - 408, 803,2352,8028,3854,8029,4277,1646,2570,2511,4556,4557,3855,8030,3856,4278, # 7766 -8031,2411,3396, 752,8032,8033,1961,2964,8034, 746,3012,2465,8035,4279,3728, 698, # 7782 -4558,1892,4280,3608,2543,4559,3609,3857,8036,3166,3397,8037,1823,1302,4043,2706, # 7798 -3858,1973,4281,8038,4282,3167, 823,1303,1288,1236,2848,3495,4044,3398, 774,3859, # 7814 -8039,1581,4560,1304,2849,3860,4561,8040,2435,2161,1083,3237,4283,4045,4284, 344, # 7830 -1173, 288,2311, 454,1683,8041,8042,1461,4562,4046,2589,8043,8044,4563, 985, 894, # 7846 -8045,3399,3168,8046,1913,2928,3729,1988,8047,2110,1974,8048,4047,8049,2571,1194, # 7862 - 425,8050,4564,3169,1245,3730,4285,8051,8052,2850,8053, 636,4565,1855,3861, 760, # 7878 -1799,8054,4286,2209,1508,4566,4048,1893,1684,2293,8055,8056,8057,4287,4288,2210, # 7894 - 479,8058,8059, 832,8060,4049,2489,8061,2965,2490,3731, 990,3109, 627,1814,2642, # 7910 -4289,1582,4290,2125,2111,3496,4567,8062, 799,4291,3170,8063,4568,2112,1737,3013, # 7926 -1018, 543, 754,4292,3309,1676,4569,4570,4050,8064,1489,8065,3497,8066,2614,2889, # 7942 -4051,8067,8068,2966,8069,8070,8071,8072,3171,4571,4572,2182,1722,8073,3238,3239, # 7958 -1842,3610,1715, 481, 365,1975,1856,8074,8075,1962,2491,4573,8076,2126,3611,3240, # 7974 - 433,1894,2063,2075,8077, 602,2741,8078,8079,8080,8081,8082,3014,1628,3400,8083, # 7990 -3172,4574,4052,2890,4575,2512,8084,2544,2772,8085,8086,8087,3310,4576,2891,8088, # 8006 -4577,8089,2851,4578,4579,1221,2967,4053,2513,8090,8091,8092,1867,1989,8093,8094, # 8022 -8095,1895,8096,8097,4580,1896,4054, 318,8098,2094,4055,4293,8099,8100, 485,8101, # 8038 - 938,3862, 553,2670, 116,8102,3863,3612,8103,3498,2671,2773,3401,3311,2807,8104, # 8054 -3613,2929,4056,1747,2930,2968,8105,8106, 207,8107,8108,2672,4581,2514,8109,3015, # 8070 - 890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, # 8086 -2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, # 8102 + 1, + 1800, + 1506, + 255, + 1431, + 198, + 9, + 82, + 6, + 7310, + 177, + 202, + 3615, + 1256, + 2808, + 110, # 2742 + 3735, + 33, + 3241, + 261, + 76, + 44, + 2113, + 16, + 2931, + 2184, + 1176, + 659, + 3868, + 26, + 3404, + 2643, # 2758 + 1198, + 3869, + 3313, + 4060, + 410, + 2211, + 302, + 590, + 361, + 1963, + 8, + 204, + 58, + 4296, + 7311, + 1931, # 2774 + 63, + 7312, + 7313, + 317, + 1614, + 75, + 222, + 159, + 4061, + 2412, + 1480, + 7314, + 3500, + 3068, + 224, + 2809, # 2790 + 3616, + 3, + 10, + 3870, + 1471, + 29, + 2774, + 1135, + 2852, + 1939, + 873, + 130, + 3242, + 1123, + 312, + 7315, # 2806 + 4297, + 2051, + 507, + 252, + 682, + 7316, + 142, + 1914, + 124, + 206, + 2932, + 34, + 3501, + 3173, + 64, + 604, # 2822 + 7317, + 2494, + 1976, + 1977, + 155, + 1990, + 645, + 641, + 1606, + 7318, + 3405, + 337, + 72, + 406, + 7319, + 80, # 2838 + 630, + 238, + 3174, + 1509, + 263, + 939, + 1092, + 2644, + 756, + 1440, + 1094, + 3406, + 449, + 69, + 2969, + 591, # 2854 + 179, + 2095, + 471, + 115, + 2034, + 1843, + 60, + 50, + 2970, + 134, + 806, + 1868, + 734, + 2035, + 3407, + 180, # 2870 + 995, + 1607, + 156, + 537, + 2893, + 688, + 7320, + 319, + 1305, + 779, + 2144, + 514, + 2374, + 298, + 4298, + 359, # 2886 + 2495, + 90, + 2707, + 1338, + 663, + 11, + 906, + 1099, + 2545, + 20, + 2436, + 182, + 532, + 1716, + 7321, + 732, # 2902 + 1376, + 4062, + 1311, + 1420, + 3175, + 25, + 2312, + 1056, + 113, + 399, + 382, + 1949, + 242, + 3408, + 2467, + 529, # 2918 + 3243, + 475, + 1447, + 3617, + 7322, + 117, + 21, + 656, + 810, + 1297, + 2295, + 2329, + 3502, + 7323, + 126, + 4063, # 2934 + 706, + 456, + 150, + 613, + 4299, + 71, + 1118, + 2036, + 4064, + 145, + 3069, + 85, + 835, + 486, + 2114, + 1246, # 2950 + 1426, + 428, + 727, + 1285, + 1015, + 800, + 106, + 623, + 303, + 1281, + 7324, + 2127, + 2354, + 347, + 3736, + 221, # 2966 + 3503, + 3110, + 7325, + 1955, + 1153, + 4065, + 83, + 296, + 1199, + 3070, + 192, + 624, + 93, + 7326, + 822, + 1897, # 2982 + 2810, + 3111, + 795, + 2064, + 991, + 1554, + 1542, + 1592, + 27, + 43, + 2853, + 859, + 139, + 1456, + 860, + 4300, # 2998 + 437, + 712, + 3871, + 164, + 2392, + 3112, + 695, + 211, + 3017, + 2096, + 195, + 3872, + 1608, + 3504, + 3505, + 3618, # 3014 + 3873, + 234, + 811, + 2971, + 2097, + 3874, + 2229, + 1441, + 3506, + 1615, + 2375, + 668, + 2076, + 1638, + 305, + 228, # 3030 + 1664, + 4301, + 467, + 415, + 7327, + 262, + 2098, + 1593, + 239, + 108, + 300, + 200, + 1033, + 512, + 1247, + 2077, # 3046 + 7328, + 7329, + 2173, + 3176, + 3619, + 2673, + 593, + 845, + 1062, + 3244, + 88, + 1723, + 2037, + 3875, + 1950, + 212, # 3062 + 266, + 152, + 149, + 468, + 1898, + 4066, + 4302, + 77, + 187, + 7330, + 3018, + 37, + 5, + 2972, + 7331, + 3876, # 3078 + 7332, + 7333, + 39, + 2517, + 4303, + 2894, + 3177, + 2078, + 55, + 148, + 74, + 4304, + 545, + 483, + 1474, + 1029, # 3094 + 1665, + 217, + 1869, + 1531, + 3113, + 1104, + 2645, + 4067, + 24, + 172, + 3507, + 900, + 3877, + 3508, + 3509, + 4305, # 3110 + 32, + 1408, + 2811, + 1312, + 329, + 487, + 2355, + 2247, + 2708, + 784, + 2674, + 4, + 3019, + 3314, + 1427, + 1788, # 3126 + 188, + 109, + 499, + 7334, + 3620, + 1717, + 1789, + 888, + 1217, + 3020, + 4306, + 7335, + 3510, + 7336, + 3315, + 1520, # 3142 + 3621, + 3878, + 196, + 1034, + 775, + 7337, + 7338, + 929, + 1815, + 249, + 439, + 38, + 7339, + 1063, + 7340, + 794, # 3158 + 3879, + 1435, + 2296, + 46, + 178, + 3245, + 2065, + 7341, + 2376, + 7342, + 214, + 1709, + 4307, + 804, + 35, + 707, # 3174 + 324, + 3622, + 1601, + 2546, + 140, + 459, + 4068, + 7343, + 7344, + 1365, + 839, + 272, + 978, + 2257, + 2572, + 3409, # 3190 + 2128, + 1363, + 3623, + 1423, + 697, + 100, + 3071, + 48, + 70, + 1231, + 495, + 3114, + 2193, + 7345, + 1294, + 7346, # 3206 + 2079, + 462, + 586, + 1042, + 3246, + 853, + 256, + 988, + 185, + 2377, + 3410, + 1698, + 434, + 1084, + 7347, + 3411, # 3222 + 314, + 2615, + 2775, + 4308, + 2330, + 2331, + 569, + 2280, + 637, + 1816, + 2518, + 757, + 1162, + 1878, + 1616, + 3412, # 3238 + 287, + 1577, + 2115, + 768, + 4309, + 1671, + 2854, + 3511, + 2519, + 1321, + 3737, + 909, + 2413, + 7348, + 4069, + 933, # 3254 + 3738, + 7349, + 2052, + 2356, + 1222, + 4310, + 765, + 2414, + 1322, + 786, + 4311, + 7350, + 1919, + 1462, + 1677, + 2895, # 3270 + 1699, + 7351, + 4312, + 1424, + 2437, + 3115, + 3624, + 2590, + 3316, + 1774, + 1940, + 3413, + 3880, + 4070, + 309, + 1369, # 3286 + 1130, + 2812, + 364, + 2230, + 1653, + 1299, + 3881, + 3512, + 3882, + 3883, + 2646, + 525, + 1085, + 3021, + 902, + 2000, # 3302 + 1475, + 964, + 4313, + 421, + 1844, + 1415, + 1057, + 2281, + 940, + 1364, + 3116, + 376, + 4314, + 4315, + 1381, + 7, # 3318 + 2520, + 983, + 2378, + 336, + 1710, + 2675, + 1845, + 321, + 3414, + 559, + 1131, + 3022, + 2742, + 1808, + 1132, + 1313, # 3334 + 265, + 1481, + 1857, + 7352, + 352, + 1203, + 2813, + 3247, + 167, + 1089, + 420, + 2814, + 776, + 792, + 1724, + 3513, # 3350 + 4071, + 2438, + 3248, + 7353, + 4072, + 7354, + 446, + 229, + 333, + 2743, + 901, + 3739, + 1200, + 1557, + 4316, + 2647, # 3366 + 1920, + 395, + 2744, + 2676, + 3740, + 4073, + 1835, + 125, + 916, + 3178, + 2616, + 4317, + 7355, + 7356, + 3741, + 7357, # 3382 + 7358, + 7359, + 4318, + 3117, + 3625, + 1133, + 2547, + 1757, + 3415, + 1510, + 2313, + 1409, + 3514, + 7360, + 2145, + 438, # 3398 + 2591, + 2896, + 2379, + 3317, + 1068, + 958, + 3023, + 461, + 311, + 2855, + 2677, + 4074, + 1915, + 3179, + 4075, + 1978, # 3414 + 383, + 750, + 2745, + 2617, + 4076, + 274, + 539, + 385, + 1278, + 1442, + 7361, + 1154, + 1964, + 384, + 561, + 210, # 3430 + 98, + 1295, + 2548, + 3515, + 7362, + 1711, + 2415, + 1482, + 3416, + 3884, + 2897, + 1257, + 129, + 7363, + 3742, + 642, # 3446 + 523, + 2776, + 2777, + 2648, + 7364, + 141, + 2231, + 1333, + 68, + 176, + 441, + 876, + 907, + 4077, + 603, + 2592, # 3462 + 710, + 171, + 3417, + 404, + 549, + 18, + 3118, + 2393, + 1410, + 3626, + 1666, + 7365, + 3516, + 4319, + 2898, + 4320, # 3478 + 7366, + 2973, + 368, + 7367, + 146, + 366, + 99, + 871, + 3627, + 1543, + 748, + 807, + 1586, + 1185, + 22, + 2258, # 3494 + 379, + 3743, + 3180, + 7368, + 3181, + 505, + 1941, + 2618, + 1991, + 1382, + 2314, + 7369, + 380, + 2357, + 218, + 702, # 3510 + 1817, + 1248, + 3418, + 3024, + 3517, + 3318, + 3249, + 7370, + 2974, + 3628, + 930, + 3250, + 3744, + 7371, + 59, + 7372, # 3526 + 585, + 601, + 4078, + 497, + 3419, + 1112, + 1314, + 4321, + 1801, + 7373, + 1223, + 1472, + 2174, + 7374, + 749, + 1836, # 3542 + 690, + 1899, + 3745, + 1772, + 3885, + 1476, + 429, + 1043, + 1790, + 2232, + 2116, + 917, + 4079, + 447, + 1086, + 1629, # 3558 + 7375, + 556, + 7376, + 7377, + 2020, + 1654, + 844, + 1090, + 105, + 550, + 966, + 1758, + 2815, + 1008, + 1782, + 686, # 3574 + 1095, + 7378, + 2282, + 793, + 1602, + 7379, + 3518, + 2593, + 4322, + 4080, + 2933, + 2297, + 4323, + 3746, + 980, + 2496, # 3590 + 544, + 353, + 527, + 4324, + 908, + 2678, + 2899, + 7380, + 381, + 2619, + 1942, + 1348, + 7381, + 1341, + 1252, + 560, # 3606 + 3072, + 7382, + 3420, + 2856, + 7383, + 2053, + 973, + 886, + 2080, + 143, + 4325, + 7384, + 7385, + 157, + 3886, + 496, # 3622 + 4081, + 57, + 840, + 540, + 2038, + 4326, + 4327, + 3421, + 2117, + 1445, + 970, + 2259, + 1748, + 1965, + 2081, + 4082, # 3638 + 3119, + 1234, + 1775, + 3251, + 2816, + 3629, + 773, + 1206, + 2129, + 1066, + 2039, + 1326, + 3887, + 1738, + 1725, + 4083, # 3654 + 279, + 3120, + 51, + 1544, + 2594, + 423, + 1578, + 2130, + 2066, + 173, + 4328, + 1879, + 7386, + 7387, + 1583, + 264, # 3670 + 610, + 3630, + 4329, + 2439, + 280, + 154, + 7388, + 7389, + 7390, + 1739, + 338, + 1282, + 3073, + 693, + 2857, + 1411, # 3686 + 1074, + 3747, + 2440, + 7391, + 4330, + 7392, + 7393, + 1240, + 952, + 2394, + 7394, + 2900, + 1538, + 2679, + 685, + 1483, # 3702 + 4084, + 2468, + 1436, + 953, + 4085, + 2054, + 4331, + 671, + 2395, + 79, + 4086, + 2441, + 3252, + 608, + 567, + 2680, # 3718 + 3422, + 4087, + 4088, + 1691, + 393, + 1261, + 1791, + 2396, + 7395, + 4332, + 7396, + 7397, + 7398, + 7399, + 1383, + 1672, # 3734 + 3748, + 3182, + 1464, + 522, + 1119, + 661, + 1150, + 216, + 675, + 4333, + 3888, + 1432, + 3519, + 609, + 4334, + 2681, # 3750 + 2397, + 7400, + 7401, + 7402, + 4089, + 3025, + 0, + 7403, + 2469, + 315, + 231, + 2442, + 301, + 3319, + 4335, + 2380, # 3766 + 7404, + 233, + 4090, + 3631, + 1818, + 4336, + 4337, + 7405, + 96, + 1776, + 1315, + 2082, + 7406, + 257, + 7407, + 1809, # 3782 + 3632, + 2709, + 1139, + 1819, + 4091, + 2021, + 1124, + 2163, + 2778, + 1777, + 2649, + 7408, + 3074, + 363, + 1655, + 3183, # 3798 + 7409, + 2975, + 7410, + 7411, + 7412, + 3889, + 1567, + 3890, + 718, + 103, + 3184, + 849, + 1443, + 341, + 3320, + 2934, # 3814 + 1484, + 7413, + 1712, + 127, + 67, + 339, + 4092, + 2398, + 679, + 1412, + 821, + 7414, + 7415, + 834, + 738, + 351, # 3830 + 2976, + 2146, + 846, + 235, + 1497, + 1880, + 418, + 1992, + 3749, + 2710, + 186, + 1100, + 2147, + 2746, + 3520, + 1545, # 3846 + 1355, + 2935, + 2858, + 1377, + 583, + 3891, + 4093, + 2573, + 2977, + 7416, + 1298, + 3633, + 1078, + 2549, + 3634, + 2358, # 3862 + 78, + 3750, + 3751, + 267, + 1289, + 2099, + 2001, + 1594, + 4094, + 348, + 369, + 1274, + 2194, + 2175, + 1837, + 4338, # 3878 + 1820, + 2817, + 3635, + 2747, + 2283, + 2002, + 4339, + 2936, + 2748, + 144, + 3321, + 882, + 4340, + 3892, + 2749, + 3423, # 3894 + 4341, + 2901, + 7417, + 4095, + 1726, + 320, + 7418, + 3893, + 3026, + 788, + 2978, + 7419, + 2818, + 1773, + 1327, + 2859, # 3910 + 3894, + 2819, + 7420, + 1306, + 4342, + 2003, + 1700, + 3752, + 3521, + 2359, + 2650, + 787, + 2022, + 506, + 824, + 3636, # 3926 + 534, + 323, + 4343, + 1044, + 3322, + 2023, + 1900, + 946, + 3424, + 7421, + 1778, + 1500, + 1678, + 7422, + 1881, + 4344, # 3942 + 165, + 243, + 4345, + 3637, + 2521, + 123, + 683, + 4096, + 764, + 4346, + 36, + 3895, + 1792, + 589, + 2902, + 816, # 3958 + 626, + 1667, + 3027, + 2233, + 1639, + 1555, + 1622, + 3753, + 3896, + 7423, + 3897, + 2860, + 1370, + 1228, + 1932, + 891, # 3974 + 2083, + 2903, + 304, + 4097, + 7424, + 292, + 2979, + 2711, + 3522, + 691, + 2100, + 4098, + 1115, + 4347, + 118, + 662, # 3990 + 7425, + 611, + 1156, + 854, + 2381, + 1316, + 2861, + 2, + 386, + 515, + 2904, + 7426, + 7427, + 3253, + 868, + 2234, # 4006 + 1486, + 855, + 2651, + 785, + 2212, + 3028, + 7428, + 1040, + 3185, + 3523, + 7429, + 3121, + 448, + 7430, + 1525, + 7431, # 4022 + 2164, + 4348, + 7432, + 3754, + 7433, + 4099, + 2820, + 3524, + 3122, + 503, + 818, + 3898, + 3123, + 1568, + 814, + 676, # 4038 + 1444, + 306, + 1749, + 7434, + 3755, + 1416, + 1030, + 197, + 1428, + 805, + 2821, + 1501, + 4349, + 7435, + 7436, + 7437, # 4054 + 1993, + 7438, + 4350, + 7439, + 7440, + 2195, + 13, + 2779, + 3638, + 2980, + 3124, + 1229, + 1916, + 7441, + 3756, + 2131, # 4070 + 7442, + 4100, + 4351, + 2399, + 3525, + 7443, + 2213, + 1511, + 1727, + 1120, + 7444, + 7445, + 646, + 3757, + 2443, + 307, # 4086 + 7446, + 7447, + 1595, + 3186, + 7448, + 7449, + 7450, + 3639, + 1113, + 1356, + 3899, + 1465, + 2522, + 2523, + 7451, + 519, # 4102 + 7452, + 128, + 2132, + 92, + 2284, + 1979, + 7453, + 3900, + 1512, + 342, + 3125, + 2196, + 7454, + 2780, + 2214, + 1980, # 4118 + 3323, + 7455, + 290, + 1656, + 1317, + 789, + 827, + 2360, + 7456, + 3758, + 4352, + 562, + 581, + 3901, + 7457, + 401, # 4134 + 4353, + 2248, + 94, + 4354, + 1399, + 2781, + 7458, + 1463, + 2024, + 4355, + 3187, + 1943, + 7459, + 828, + 1105, + 4101, # 4150 + 1262, + 1394, + 7460, + 4102, + 605, + 4356, + 7461, + 1783, + 2862, + 7462, + 2822, + 819, + 2101, + 578, + 2197, + 2937, # 4166 + 7463, + 1502, + 436, + 3254, + 4103, + 3255, + 2823, + 3902, + 2905, + 3425, + 3426, + 7464, + 2712, + 2315, + 7465, + 7466, # 4182 + 2332, + 2067, + 23, + 4357, + 193, + 826, + 3759, + 2102, + 699, + 1630, + 4104, + 3075, + 390, + 1793, + 1064, + 3526, # 4198 + 7467, + 1579, + 3076, + 3077, + 1400, + 7468, + 4105, + 1838, + 1640, + 2863, + 7469, + 4358, + 4359, + 137, + 4106, + 598, # 4214 + 3078, + 1966, + 780, + 104, + 974, + 2938, + 7470, + 278, + 899, + 253, + 402, + 572, + 504, + 493, + 1339, + 7471, # 4230 + 3903, + 1275, + 4360, + 2574, + 2550, + 7472, + 3640, + 3029, + 3079, + 2249, + 565, + 1334, + 2713, + 863, + 41, + 7473, # 4246 + 7474, + 4361, + 7475, + 1657, + 2333, + 19, + 463, + 2750, + 4107, + 606, + 7476, + 2981, + 3256, + 1087, + 2084, + 1323, # 4262 + 2652, + 2982, + 7477, + 1631, + 1623, + 1750, + 4108, + 2682, + 7478, + 2864, + 791, + 2714, + 2653, + 2334, + 232, + 2416, # 4278 + 7479, + 2983, + 1498, + 7480, + 2654, + 2620, + 755, + 1366, + 3641, + 3257, + 3126, + 2025, + 1609, + 119, + 1917, + 3427, # 4294 + 862, + 1026, + 4109, + 7481, + 3904, + 3760, + 4362, + 3905, + 4363, + 2260, + 1951, + 2470, + 7482, + 1125, + 817, + 4110, # 4310 + 4111, + 3906, + 1513, + 1766, + 2040, + 1487, + 4112, + 3030, + 3258, + 2824, + 3761, + 3127, + 7483, + 7484, + 1507, + 7485, # 4326 + 2683, + 733, + 40, + 1632, + 1106, + 2865, + 345, + 4113, + 841, + 2524, + 230, + 4364, + 2984, + 1846, + 3259, + 3428, # 4342 + 7486, + 1263, + 986, + 3429, + 7487, + 735, + 879, + 254, + 1137, + 857, + 622, + 1300, + 1180, + 1388, + 1562, + 3907, # 4358 + 3908, + 2939, + 967, + 2751, + 2655, + 1349, + 592, + 2133, + 1692, + 3324, + 2985, + 1994, + 4114, + 1679, + 3909, + 1901, # 4374 + 2185, + 7488, + 739, + 3642, + 2715, + 1296, + 1290, + 7489, + 4115, + 2198, + 2199, + 1921, + 1563, + 2595, + 2551, + 1870, # 4390 + 2752, + 2986, + 7490, + 435, + 7491, + 343, + 1108, + 596, + 17, + 1751, + 4365, + 2235, + 3430, + 3643, + 7492, + 4366, # 4406 + 294, + 3527, + 2940, + 1693, + 477, + 979, + 281, + 2041, + 3528, + 643, + 2042, + 3644, + 2621, + 2782, + 2261, + 1031, # 4422 + 2335, + 2134, + 2298, + 3529, + 4367, + 367, + 1249, + 2552, + 7493, + 3530, + 7494, + 4368, + 1283, + 3325, + 2004, + 240, # 4438 + 1762, + 3326, + 4369, + 4370, + 836, + 1069, + 3128, + 474, + 7495, + 2148, + 2525, + 268, + 3531, + 7496, + 3188, + 1521, # 4454 + 1284, + 7497, + 1658, + 1546, + 4116, + 7498, + 3532, + 3533, + 7499, + 4117, + 3327, + 2684, + 1685, + 4118, + 961, + 1673, # 4470 + 2622, + 190, + 2005, + 2200, + 3762, + 4371, + 4372, + 7500, + 570, + 2497, + 3645, + 1490, + 7501, + 4373, + 2623, + 3260, # 4486 + 1956, + 4374, + 584, + 1514, + 396, + 1045, + 1944, + 7502, + 4375, + 1967, + 2444, + 7503, + 7504, + 4376, + 3910, + 619, # 4502 + 7505, + 3129, + 3261, + 215, + 2006, + 2783, + 2553, + 3189, + 4377, + 3190, + 4378, + 763, + 4119, + 3763, + 4379, + 7506, # 4518 + 7507, + 1957, + 1767, + 2941, + 3328, + 3646, + 1174, + 452, + 1477, + 4380, + 3329, + 3130, + 7508, + 2825, + 1253, + 2382, # 4534 + 2186, + 1091, + 2285, + 4120, + 492, + 7509, + 638, + 1169, + 1824, + 2135, + 1752, + 3911, + 648, + 926, + 1021, + 1324, # 4550 + 4381, + 520, + 4382, + 997, + 847, + 1007, + 892, + 4383, + 3764, + 2262, + 1871, + 3647, + 7510, + 2400, + 1784, + 4384, # 4566 + 1952, + 2942, + 3080, + 3191, + 1728, + 4121, + 2043, + 3648, + 4385, + 2007, + 1701, + 3131, + 1551, + 30, + 2263, + 4122, # 4582 + 7511, + 2026, + 4386, + 3534, + 7512, + 501, + 7513, + 4123, + 594, + 3431, + 2165, + 1821, + 3535, + 3432, + 3536, + 3192, # 4598 + 829, + 2826, + 4124, + 7514, + 1680, + 3132, + 1225, + 4125, + 7515, + 3262, + 4387, + 4126, + 3133, + 2336, + 7516, + 4388, # 4614 + 4127, + 7517, + 3912, + 3913, + 7518, + 1847, + 2383, + 2596, + 3330, + 7519, + 4389, + 374, + 3914, + 652, + 4128, + 4129, # 4630 + 375, + 1140, + 798, + 7520, + 7521, + 7522, + 2361, + 4390, + 2264, + 546, + 1659, + 138, + 3031, + 2445, + 4391, + 7523, # 4646 + 2250, + 612, + 1848, + 910, + 796, + 3765, + 1740, + 1371, + 825, + 3766, + 3767, + 7524, + 2906, + 2554, + 7525, + 692, # 4662 + 444, + 3032, + 2624, + 801, + 4392, + 4130, + 7526, + 1491, + 244, + 1053, + 3033, + 4131, + 4132, + 340, + 7527, + 3915, # 4678 + 1041, + 2987, + 293, + 1168, + 87, + 1357, + 7528, + 1539, + 959, + 7529, + 2236, + 721, + 694, + 4133, + 3768, + 219, # 4694 + 1478, + 644, + 1417, + 3331, + 2656, + 1413, + 1401, + 1335, + 1389, + 3916, + 7530, + 7531, + 2988, + 2362, + 3134, + 1825, # 4710 + 730, + 1515, + 184, + 2827, + 66, + 4393, + 7532, + 1660, + 2943, + 246, + 3332, + 378, + 1457, + 226, + 3433, + 975, # 4726 + 3917, + 2944, + 1264, + 3537, + 674, + 696, + 7533, + 163, + 7534, + 1141, + 2417, + 2166, + 713, + 3538, + 3333, + 4394, # 4742 + 3918, + 7535, + 7536, + 1186, + 15, + 7537, + 1079, + 1070, + 7538, + 1522, + 3193, + 3539, + 276, + 1050, + 2716, + 758, # 4758 + 1126, + 653, + 2945, + 3263, + 7539, + 2337, + 889, + 3540, + 3919, + 3081, + 2989, + 903, + 1250, + 4395, + 3920, + 3434, # 4774 + 3541, + 1342, + 1681, + 1718, + 766, + 3264, + 286, + 89, + 2946, + 3649, + 7540, + 1713, + 7541, + 2597, + 3334, + 2990, # 4790 + 7542, + 2947, + 2215, + 3194, + 2866, + 7543, + 4396, + 2498, + 2526, + 181, + 387, + 1075, + 3921, + 731, + 2187, + 3335, # 4806 + 7544, + 3265, + 310, + 313, + 3435, + 2299, + 770, + 4134, + 54, + 3034, + 189, + 4397, + 3082, + 3769, + 3922, + 7545, # 4822 + 1230, + 1617, + 1849, + 355, + 3542, + 4135, + 4398, + 3336, + 111, + 4136, + 3650, + 1350, + 3135, + 3436, + 3035, + 4137, # 4838 + 2149, + 3266, + 3543, + 7546, + 2784, + 3923, + 3924, + 2991, + 722, + 2008, + 7547, + 1071, + 247, + 1207, + 2338, + 2471, # 4854 + 1378, + 4399, + 2009, + 864, + 1437, + 1214, + 4400, + 373, + 3770, + 1142, + 2216, + 667, + 4401, + 442, + 2753, + 2555, # 4870 + 3771, + 3925, + 1968, + 4138, + 3267, + 1839, + 837, + 170, + 1107, + 934, + 1336, + 1882, + 7548, + 7549, + 2118, + 4139, # 4886 + 2828, + 743, + 1569, + 7550, + 4402, + 4140, + 582, + 2384, + 1418, + 3437, + 7551, + 1802, + 7552, + 357, + 1395, + 1729, # 4902 + 3651, + 3268, + 2418, + 1564, + 2237, + 7553, + 3083, + 3772, + 1633, + 4403, + 1114, + 2085, + 4141, + 1532, + 7554, + 482, # 4918 + 2446, + 4404, + 7555, + 7556, + 1492, + 833, + 1466, + 7557, + 2717, + 3544, + 1641, + 2829, + 7558, + 1526, + 1272, + 3652, # 4934 + 4142, + 1686, + 1794, + 416, + 2556, + 1902, + 1953, + 1803, + 7559, + 3773, + 2785, + 3774, + 1159, + 2316, + 7560, + 2867, # 4950 + 4405, + 1610, + 1584, + 3036, + 2419, + 2754, + 443, + 3269, + 1163, + 3136, + 7561, + 7562, + 3926, + 7563, + 4143, + 2499, # 4966 + 3037, + 4406, + 3927, + 3137, + 2103, + 1647, + 3545, + 2010, + 1872, + 4144, + 7564, + 4145, + 431, + 3438, + 7565, + 250, # 4982 + 97, + 81, + 4146, + 7566, + 1648, + 1850, + 1558, + 160, + 848, + 7567, + 866, + 740, + 1694, + 7568, + 2201, + 2830, # 4998 + 3195, + 4147, + 4407, + 3653, + 1687, + 950, + 2472, + 426, + 469, + 3196, + 3654, + 3655, + 3928, + 7569, + 7570, + 1188, # 5014 + 424, + 1995, + 861, + 3546, + 4148, + 3775, + 2202, + 2685, + 168, + 1235, + 3547, + 4149, + 7571, + 2086, + 1674, + 4408, # 5030 + 3337, + 3270, + 220, + 2557, + 1009, + 7572, + 3776, + 670, + 2992, + 332, + 1208, + 717, + 7573, + 7574, + 3548, + 2447, # 5046 + 3929, + 3338, + 7575, + 513, + 7576, + 1209, + 2868, + 3339, + 3138, + 4409, + 1080, + 7577, + 7578, + 7579, + 7580, + 2527, # 5062 + 3656, + 3549, + 815, + 1587, + 3930, + 3931, + 7581, + 3550, + 3439, + 3777, + 1254, + 4410, + 1328, + 3038, + 1390, + 3932, # 5078 + 1741, + 3933, + 3778, + 3934, + 7582, + 236, + 3779, + 2448, + 3271, + 7583, + 7584, + 3657, + 3780, + 1273, + 3781, + 4411, # 5094 + 7585, + 308, + 7586, + 4412, + 245, + 4413, + 1851, + 2473, + 1307, + 2575, + 430, + 715, + 2136, + 2449, + 7587, + 270, # 5110 + 199, + 2869, + 3935, + 7588, + 3551, + 2718, + 1753, + 761, + 1754, + 725, + 1661, + 1840, + 4414, + 3440, + 3658, + 7589, # 5126 + 7590, + 587, + 14, + 3272, + 227, + 2598, + 326, + 480, + 2265, + 943, + 2755, + 3552, + 291, + 650, + 1883, + 7591, # 5142 + 1702, + 1226, + 102, + 1547, + 62, + 3441, + 904, + 4415, + 3442, + 1164, + 4150, + 7592, + 7593, + 1224, + 1548, + 2756, # 5158 + 391, + 498, + 1493, + 7594, + 1386, + 1419, + 7595, + 2055, + 1177, + 4416, + 813, + 880, + 1081, + 2363, + 566, + 1145, # 5174 + 4417, + 2286, + 1001, + 1035, + 2558, + 2599, + 2238, + 394, + 1286, + 7596, + 7597, + 2068, + 7598, + 86, + 1494, + 1730, # 5190 + 3936, + 491, + 1588, + 745, + 897, + 2948, + 843, + 3340, + 3937, + 2757, + 2870, + 3273, + 1768, + 998, + 2217, + 2069, # 5206 + 397, + 1826, + 1195, + 1969, + 3659, + 2993, + 3341, + 284, + 7599, + 3782, + 2500, + 2137, + 2119, + 1903, + 7600, + 3938, # 5222 + 2150, + 3939, + 4151, + 1036, + 3443, + 1904, + 114, + 2559, + 4152, + 209, + 1527, + 7601, + 7602, + 2949, + 2831, + 2625, # 5238 + 2385, + 2719, + 3139, + 812, + 2560, + 7603, + 3274, + 7604, + 1559, + 737, + 1884, + 3660, + 1210, + 885, + 28, + 2686, # 5254 + 3553, + 3783, + 7605, + 4153, + 1004, + 1779, + 4418, + 7606, + 346, + 1981, + 2218, + 2687, + 4419, + 3784, + 1742, + 797, # 5270 + 1642, + 3940, + 1933, + 1072, + 1384, + 2151, + 896, + 3941, + 3275, + 3661, + 3197, + 2871, + 3554, + 7607, + 2561, + 1958, # 5286 + 4420, + 2450, + 1785, + 7608, + 7609, + 7610, + 3942, + 4154, + 1005, + 1308, + 3662, + 4155, + 2720, + 4421, + 4422, + 1528, # 5302 + 2600, + 161, + 1178, + 4156, + 1982, + 987, + 4423, + 1101, + 4157, + 631, + 3943, + 1157, + 3198, + 2420, + 1343, + 1241, # 5318 + 1016, + 2239, + 2562, + 372, + 877, + 2339, + 2501, + 1160, + 555, + 1934, + 911, + 3944, + 7611, + 466, + 1170, + 169, # 5334 + 1051, + 2907, + 2688, + 3663, + 2474, + 2994, + 1182, + 2011, + 2563, + 1251, + 2626, + 7612, + 992, + 2340, + 3444, + 1540, # 5350 + 2721, + 1201, + 2070, + 2401, + 1996, + 2475, + 7613, + 4424, + 528, + 1922, + 2188, + 1503, + 1873, + 1570, + 2364, + 3342, # 5366 + 3276, + 7614, + 557, + 1073, + 7615, + 1827, + 3445, + 2087, + 2266, + 3140, + 3039, + 3084, + 767, + 3085, + 2786, + 4425, # 5382 + 1006, + 4158, + 4426, + 2341, + 1267, + 2176, + 3664, + 3199, + 778, + 3945, + 3200, + 2722, + 1597, + 2657, + 7616, + 4427, # 5398 + 7617, + 3446, + 7618, + 7619, + 7620, + 3277, + 2689, + 1433, + 3278, + 131, + 95, + 1504, + 3946, + 723, + 4159, + 3141, # 5414 + 1841, + 3555, + 2758, + 2189, + 3947, + 2027, + 2104, + 3665, + 7621, + 2995, + 3948, + 1218, + 7622, + 3343, + 3201, + 3949, # 5430 + 4160, + 2576, + 248, + 1634, + 3785, + 912, + 7623, + 2832, + 3666, + 3040, + 3786, + 654, + 53, + 7624, + 2996, + 7625, # 5446 + 1688, + 4428, + 777, + 3447, + 1032, + 3950, + 1425, + 7626, + 191, + 820, + 2120, + 2833, + 971, + 4429, + 931, + 3202, # 5462 + 135, + 664, + 783, + 3787, + 1997, + 772, + 2908, + 1935, + 3951, + 3788, + 4430, + 2909, + 3203, + 282, + 2723, + 640, # 5478 + 1372, + 3448, + 1127, + 922, + 325, + 3344, + 7627, + 7628, + 711, + 2044, + 7629, + 7630, + 3952, + 2219, + 2787, + 1936, # 5494 + 3953, + 3345, + 2220, + 2251, + 3789, + 2300, + 7631, + 4431, + 3790, + 1258, + 3279, + 3954, + 3204, + 2138, + 2950, + 3955, # 5510 + 3956, + 7632, + 2221, + 258, + 3205, + 4432, + 101, + 1227, + 7633, + 3280, + 1755, + 7634, + 1391, + 3281, + 7635, + 2910, # 5526 + 2056, + 893, + 7636, + 7637, + 7638, + 1402, + 4161, + 2342, + 7639, + 7640, + 3206, + 3556, + 7641, + 7642, + 878, + 1325, # 5542 + 1780, + 2788, + 4433, + 259, + 1385, + 2577, + 744, + 1183, + 2267, + 4434, + 7643, + 3957, + 2502, + 7644, + 684, + 1024, # 5558 + 4162, + 7645, + 472, + 3557, + 3449, + 1165, + 3282, + 3958, + 3959, + 322, + 2152, + 881, + 455, + 1695, + 1152, + 1340, # 5574 + 660, + 554, + 2153, + 4435, + 1058, + 4436, + 4163, + 830, + 1065, + 3346, + 3960, + 4437, + 1923, + 7646, + 1703, + 1918, # 5590 + 7647, + 932, + 2268, + 122, + 7648, + 4438, + 947, + 677, + 7649, + 3791, + 2627, + 297, + 1905, + 1924, + 2269, + 4439, # 5606 + 2317, + 3283, + 7650, + 7651, + 4164, + 7652, + 4165, + 84, + 4166, + 112, + 989, + 7653, + 547, + 1059, + 3961, + 701, # 5622 + 3558, + 1019, + 7654, + 4167, + 7655, + 3450, + 942, + 639, + 457, + 2301, + 2451, + 993, + 2951, + 407, + 851, + 494, # 5638 + 4440, + 3347, + 927, + 7656, + 1237, + 7657, + 2421, + 3348, + 573, + 4168, + 680, + 921, + 2911, + 1279, + 1874, + 285, # 5654 + 790, + 1448, + 1983, + 719, + 2167, + 7658, + 7659, + 4441, + 3962, + 3963, + 1649, + 7660, + 1541, + 563, + 7661, + 1077, # 5670 + 7662, + 3349, + 3041, + 3451, + 511, + 2997, + 3964, + 3965, + 3667, + 3966, + 1268, + 2564, + 3350, + 3207, + 4442, + 4443, # 5686 + 7663, + 535, + 1048, + 1276, + 1189, + 2912, + 2028, + 3142, + 1438, + 1373, + 2834, + 2952, + 1134, + 2012, + 7664, + 4169, # 5702 + 1238, + 2578, + 3086, + 1259, + 7665, + 700, + 7666, + 2953, + 3143, + 3668, + 4170, + 7667, + 4171, + 1146, + 1875, + 1906, # 5718 + 4444, + 2601, + 3967, + 781, + 2422, + 132, + 1589, + 203, + 147, + 273, + 2789, + 2402, + 898, + 1786, + 2154, + 3968, # 5734 + 3969, + 7668, + 3792, + 2790, + 7669, + 7670, + 4445, + 4446, + 7671, + 3208, + 7672, + 1635, + 3793, + 965, + 7673, + 1804, # 5750 + 2690, + 1516, + 3559, + 1121, + 1082, + 1329, + 3284, + 3970, + 1449, + 3794, + 65, + 1128, + 2835, + 2913, + 2759, + 1590, # 5766 + 3795, + 7674, + 7675, + 12, + 2658, + 45, + 976, + 2579, + 3144, + 4447, + 517, + 2528, + 1013, + 1037, + 3209, + 7676, # 5782 + 3796, + 2836, + 7677, + 3797, + 7678, + 3452, + 7679, + 2602, + 614, + 1998, + 2318, + 3798, + 3087, + 2724, + 2628, + 7680, # 5798 + 2580, + 4172, + 599, + 1269, + 7681, + 1810, + 3669, + 7682, + 2691, + 3088, + 759, + 1060, + 489, + 1805, + 3351, + 3285, # 5814 + 1358, + 7683, + 7684, + 2386, + 1387, + 1215, + 2629, + 2252, + 490, + 7685, + 7686, + 4173, + 1759, + 2387, + 2343, + 7687, # 5830 + 4448, + 3799, + 1907, + 3971, + 2630, + 1806, + 3210, + 4449, + 3453, + 3286, + 2760, + 2344, + 874, + 7688, + 7689, + 3454, # 5846 + 3670, + 1858, + 91, + 2914, + 3671, + 3042, + 3800, + 4450, + 7690, + 3145, + 3972, + 2659, + 7691, + 3455, + 1202, + 1403, # 5862 + 3801, + 2954, + 2529, + 1517, + 2503, + 4451, + 3456, + 2504, + 7692, + 4452, + 7693, + 2692, + 1885, + 1495, + 1731, + 3973, # 5878 + 2365, + 4453, + 7694, + 2029, + 7695, + 7696, + 3974, + 2693, + 1216, + 237, + 2581, + 4174, + 2319, + 3975, + 3802, + 4454, # 5894 + 4455, + 2694, + 3560, + 3457, + 445, + 4456, + 7697, + 7698, + 7699, + 7700, + 2761, + 61, + 3976, + 3672, + 1822, + 3977, # 5910 + 7701, + 687, + 2045, + 935, + 925, + 405, + 2660, + 703, + 1096, + 1859, + 2725, + 4457, + 3978, + 1876, + 1367, + 2695, # 5926 + 3352, + 918, + 2105, + 1781, + 2476, + 334, + 3287, + 1611, + 1093, + 4458, + 564, + 3146, + 3458, + 3673, + 3353, + 945, # 5942 + 2631, + 2057, + 4459, + 7702, + 1925, + 872, + 4175, + 7703, + 3459, + 2696, + 3089, + 349, + 4176, + 3674, + 3979, + 4460, # 5958 + 3803, + 4177, + 3675, + 2155, + 3980, + 4461, + 4462, + 4178, + 4463, + 2403, + 2046, + 782, + 3981, + 400, + 251, + 4179, # 5974 + 1624, + 7704, + 7705, + 277, + 3676, + 299, + 1265, + 476, + 1191, + 3804, + 2121, + 4180, + 4181, + 1109, + 205, + 7706, # 5990 + 2582, + 1000, + 2156, + 3561, + 1860, + 7707, + 7708, + 7709, + 4464, + 7710, + 4465, + 2565, + 107, + 2477, + 2157, + 3982, # 6006 + 3460, + 3147, + 7711, + 1533, + 541, + 1301, + 158, + 753, + 4182, + 2872, + 3562, + 7712, + 1696, + 370, + 1088, + 4183, # 6022 + 4466, + 3563, + 579, + 327, + 440, + 162, + 2240, + 269, + 1937, + 1374, + 3461, + 968, + 3043, + 56, + 1396, + 3090, # 6038 + 2106, + 3288, + 3354, + 7713, + 1926, + 2158, + 4467, + 2998, + 7714, + 3564, + 7715, + 7716, + 3677, + 4468, + 2478, + 7717, # 6054 + 2791, + 7718, + 1650, + 4469, + 7719, + 2603, + 7720, + 7721, + 3983, + 2661, + 3355, + 1149, + 3356, + 3984, + 3805, + 3985, # 6070 + 7722, + 1076, + 49, + 7723, + 951, + 3211, + 3289, + 3290, + 450, + 2837, + 920, + 7724, + 1811, + 2792, + 2366, + 4184, # 6086 + 1908, + 1138, + 2367, + 3806, + 3462, + 7725, + 3212, + 4470, + 1909, + 1147, + 1518, + 2423, + 4471, + 3807, + 7726, + 4472, # 6102 + 2388, + 2604, + 260, + 1795, + 3213, + 7727, + 7728, + 3808, + 3291, + 708, + 7729, + 3565, + 1704, + 7730, + 3566, + 1351, # 6118 + 1618, + 3357, + 2999, + 1886, + 944, + 4185, + 3358, + 4186, + 3044, + 3359, + 4187, + 7731, + 3678, + 422, + 413, + 1714, # 6134 + 3292, + 500, + 2058, + 2345, + 4188, + 2479, + 7732, + 1344, + 1910, + 954, + 7733, + 1668, + 7734, + 7735, + 3986, + 2404, # 6150 + 4189, + 3567, + 3809, + 4190, + 7736, + 2302, + 1318, + 2505, + 3091, + 133, + 3092, + 2873, + 4473, + 629, + 31, + 2838, # 6166 + 2697, + 3810, + 4474, + 850, + 949, + 4475, + 3987, + 2955, + 1732, + 2088, + 4191, + 1496, + 1852, + 7737, + 3988, + 620, # 6182 + 3214, + 981, + 1242, + 3679, + 3360, + 1619, + 3680, + 1643, + 3293, + 2139, + 2452, + 1970, + 1719, + 3463, + 2168, + 7738, # 6198 + 3215, + 7739, + 7740, + 3361, + 1828, + 7741, + 1277, + 4476, + 1565, + 2047, + 7742, + 1636, + 3568, + 3093, + 7743, + 869, # 6214 + 2839, + 655, + 3811, + 3812, + 3094, + 3989, + 3000, + 3813, + 1310, + 3569, + 4477, + 7744, + 7745, + 7746, + 1733, + 558, # 6230 + 4478, + 3681, + 335, + 1549, + 3045, + 1756, + 4192, + 3682, + 1945, + 3464, + 1829, + 1291, + 1192, + 470, + 2726, + 2107, # 6246 + 2793, + 913, + 1054, + 3990, + 7747, + 1027, + 7748, + 3046, + 3991, + 4479, + 982, + 2662, + 3362, + 3148, + 3465, + 3216, # 6262 + 3217, + 1946, + 2794, + 7749, + 571, + 4480, + 7750, + 1830, + 7751, + 3570, + 2583, + 1523, + 2424, + 7752, + 2089, + 984, # 6278 + 4481, + 3683, + 1959, + 7753, + 3684, + 852, + 923, + 2795, + 3466, + 3685, + 969, + 1519, + 999, + 2048, + 2320, + 1705, # 6294 + 7754, + 3095, + 615, + 1662, + 151, + 597, + 3992, + 2405, + 2321, + 1049, + 275, + 4482, + 3686, + 4193, + 568, + 3687, # 6310 + 3571, + 2480, + 4194, + 3688, + 7755, + 2425, + 2270, + 409, + 3218, + 7756, + 1566, + 2874, + 3467, + 1002, + 769, + 2840, # 6326 + 194, + 2090, + 3149, + 3689, + 2222, + 3294, + 4195, + 628, + 1505, + 7757, + 7758, + 1763, + 2177, + 3001, + 3993, + 521, # 6342 + 1161, + 2584, + 1787, + 2203, + 2406, + 4483, + 3994, + 1625, + 4196, + 4197, + 412, + 42, + 3096, + 464, + 7759, + 2632, # 6358 + 4484, + 3363, + 1760, + 1571, + 2875, + 3468, + 2530, + 1219, + 2204, + 3814, + 2633, + 2140, + 2368, + 4485, + 4486, + 3295, # 6374 + 1651, + 3364, + 3572, + 7760, + 7761, + 3573, + 2481, + 3469, + 7762, + 3690, + 7763, + 7764, + 2271, + 2091, + 460, + 7765, # 6390 + 4487, + 7766, + 3002, + 962, + 588, + 3574, + 289, + 3219, + 2634, + 1116, + 52, + 7767, + 3047, + 1796, + 7768, + 7769, # 6406 + 7770, + 1467, + 7771, + 1598, + 1143, + 3691, + 4198, + 1984, + 1734, + 1067, + 4488, + 1280, + 3365, + 465, + 4489, + 1572, # 6422 + 510, + 7772, + 1927, + 2241, + 1812, + 1644, + 3575, + 7773, + 4490, + 3692, + 7774, + 7775, + 2663, + 1573, + 1534, + 7776, # 6438 + 7777, + 4199, + 536, + 1807, + 1761, + 3470, + 3815, + 3150, + 2635, + 7778, + 7779, + 7780, + 4491, + 3471, + 2915, + 1911, # 6454 + 2796, + 7781, + 3296, + 1122, + 377, + 3220, + 7782, + 360, + 7783, + 7784, + 4200, + 1529, + 551, + 7785, + 2059, + 3693, # 6470 + 1769, + 2426, + 7786, + 2916, + 4201, + 3297, + 3097, + 2322, + 2108, + 2030, + 4492, + 1404, + 136, + 1468, + 1479, + 672, # 6486 + 1171, + 3221, + 2303, + 271, + 3151, + 7787, + 2762, + 7788, + 2049, + 678, + 2727, + 865, + 1947, + 4493, + 7789, + 2013, # 6502 + 3995, + 2956, + 7790, + 2728, + 2223, + 1397, + 3048, + 3694, + 4494, + 4495, + 1735, + 2917, + 3366, + 3576, + 7791, + 3816, # 6518 + 509, + 2841, + 2453, + 2876, + 3817, + 7792, + 7793, + 3152, + 3153, + 4496, + 4202, + 2531, + 4497, + 2304, + 1166, + 1010, # 6534 + 552, + 681, + 1887, + 7794, + 7795, + 2957, + 2958, + 3996, + 1287, + 1596, + 1861, + 3154, + 358, + 453, + 736, + 175, # 6550 + 478, + 1117, + 905, + 1167, + 1097, + 7796, + 1853, + 1530, + 7797, + 1706, + 7798, + 2178, + 3472, + 2287, + 3695, + 3473, # 6566 + 3577, + 4203, + 2092, + 4204, + 7799, + 3367, + 1193, + 2482, + 4205, + 1458, + 2190, + 2205, + 1862, + 1888, + 1421, + 3298, # 6582 + 2918, + 3049, + 2179, + 3474, + 595, + 2122, + 7800, + 3997, + 7801, + 7802, + 4206, + 1707, + 2636, + 223, + 3696, + 1359, # 6598 + 751, + 3098, + 183, + 3475, + 7803, + 2797, + 3003, + 419, + 2369, + 633, + 704, + 3818, + 2389, + 241, + 7804, + 7805, # 6614 + 7806, + 838, + 3004, + 3697, + 2272, + 2763, + 2454, + 3819, + 1938, + 2050, + 3998, + 1309, + 3099, + 2242, + 1181, + 7807, # 6630 + 1136, + 2206, + 3820, + 2370, + 1446, + 4207, + 2305, + 4498, + 7808, + 7809, + 4208, + 1055, + 2605, + 484, + 3698, + 7810, # 6646 + 3999, + 625, + 4209, + 2273, + 3368, + 1499, + 4210, + 4000, + 7811, + 4001, + 4211, + 3222, + 2274, + 2275, + 3476, + 7812, # 6662 + 7813, + 2764, + 808, + 2606, + 3699, + 3369, + 4002, + 4212, + 3100, + 2532, + 526, + 3370, + 3821, + 4213, + 955, + 7814, # 6678 + 1620, + 4214, + 2637, + 2427, + 7815, + 1429, + 3700, + 1669, + 1831, + 994, + 928, + 7816, + 3578, + 1260, + 7817, + 7818, # 6694 + 7819, + 1948, + 2288, + 741, + 2919, + 1626, + 4215, + 2729, + 2455, + 867, + 1184, + 362, + 3371, + 1392, + 7820, + 7821, # 6710 + 4003, + 4216, + 1770, + 1736, + 3223, + 2920, + 4499, + 4500, + 1928, + 2698, + 1459, + 1158, + 7822, + 3050, + 3372, + 2877, # 6726 + 1292, + 1929, + 2506, + 2842, + 3701, + 1985, + 1187, + 2071, + 2014, + 2607, + 4217, + 7823, + 2566, + 2507, + 2169, + 3702, # 6742 + 2483, + 3299, + 7824, + 3703, + 4501, + 7825, + 7826, + 666, + 1003, + 3005, + 1022, + 3579, + 4218, + 7827, + 4502, + 1813, # 6758 + 2253, + 574, + 3822, + 1603, + 295, + 1535, + 705, + 3823, + 4219, + 283, + 858, + 417, + 7828, + 7829, + 3224, + 4503, # 6774 + 4504, + 3051, + 1220, + 1889, + 1046, + 2276, + 2456, + 4004, + 1393, + 1599, + 689, + 2567, + 388, + 4220, + 7830, + 2484, # 6790 + 802, + 7831, + 2798, + 3824, + 2060, + 1405, + 2254, + 7832, + 4505, + 3825, + 2109, + 1052, + 1345, + 3225, + 1585, + 7833, # 6806 + 809, + 7834, + 7835, + 7836, + 575, + 2730, + 3477, + 956, + 1552, + 1469, + 1144, + 2323, + 7837, + 2324, + 1560, + 2457, # 6822 + 3580, + 3226, + 4005, + 616, + 2207, + 3155, + 2180, + 2289, + 7838, + 1832, + 7839, + 3478, + 4506, + 7840, + 1319, + 3704, # 6838 + 3705, + 1211, + 3581, + 1023, + 3227, + 1293, + 2799, + 7841, + 7842, + 7843, + 3826, + 607, + 2306, + 3827, + 762, + 2878, # 6854 + 1439, + 4221, + 1360, + 7844, + 1485, + 3052, + 7845, + 4507, + 1038, + 4222, + 1450, + 2061, + 2638, + 4223, + 1379, + 4508, # 6870 + 2585, + 7846, + 7847, + 4224, + 1352, + 1414, + 2325, + 2921, + 1172, + 7848, + 7849, + 3828, + 3829, + 7850, + 1797, + 1451, # 6886 + 7851, + 7852, + 7853, + 7854, + 2922, + 4006, + 4007, + 2485, + 2346, + 411, + 4008, + 4009, + 3582, + 3300, + 3101, + 4509, # 6902 + 1561, + 2664, + 1452, + 4010, + 1375, + 7855, + 7856, + 47, + 2959, + 316, + 7857, + 1406, + 1591, + 2923, + 3156, + 7858, # 6918 + 1025, + 2141, + 3102, + 3157, + 354, + 2731, + 884, + 2224, + 4225, + 2407, + 508, + 3706, + 726, + 3583, + 996, + 2428, # 6934 + 3584, + 729, + 7859, + 392, + 2191, + 1453, + 4011, + 4510, + 3707, + 7860, + 7861, + 2458, + 3585, + 2608, + 1675, + 2800, # 6950 + 919, + 2347, + 2960, + 2348, + 1270, + 4511, + 4012, + 73, + 7862, + 7863, + 647, + 7864, + 3228, + 2843, + 2255, + 1550, # 6966 + 1346, + 3006, + 7865, + 1332, + 883, + 3479, + 7866, + 7867, + 7868, + 7869, + 3301, + 2765, + 7870, + 1212, + 831, + 1347, # 6982 + 4226, + 4512, + 2326, + 3830, + 1863, + 3053, + 720, + 3831, + 4513, + 4514, + 3832, + 7871, + 4227, + 7872, + 7873, + 4515, # 6998 + 7874, + 7875, + 1798, + 4516, + 3708, + 2609, + 4517, + 3586, + 1645, + 2371, + 7876, + 7877, + 2924, + 669, + 2208, + 2665, # 7014 + 2429, + 7878, + 2879, + 7879, + 7880, + 1028, + 3229, + 7881, + 4228, + 2408, + 7882, + 2256, + 1353, + 7883, + 7884, + 4518, # 7030 + 3158, + 518, + 7885, + 4013, + 7886, + 4229, + 1960, + 7887, + 2142, + 4230, + 7888, + 7889, + 3007, + 2349, + 2350, + 3833, # 7046 + 516, + 1833, + 1454, + 4014, + 2699, + 4231, + 4519, + 2225, + 2610, + 1971, + 1129, + 3587, + 7890, + 2766, + 7891, + 2961, # 7062 + 1422, + 577, + 1470, + 3008, + 1524, + 3373, + 7892, + 7893, + 432, + 4232, + 3054, + 3480, + 7894, + 2586, + 1455, + 2508, # 7078 + 2226, + 1972, + 1175, + 7895, + 1020, + 2732, + 4015, + 3481, + 4520, + 7896, + 2733, + 7897, + 1743, + 1361, + 3055, + 3482, # 7094 + 2639, + 4016, + 4233, + 4521, + 2290, + 895, + 924, + 4234, + 2170, + 331, + 2243, + 3056, + 166, + 1627, + 3057, + 1098, # 7110 + 7898, + 1232, + 2880, + 2227, + 3374, + 4522, + 657, + 403, + 1196, + 2372, + 542, + 3709, + 3375, + 1600, + 4235, + 3483, # 7126 + 7899, + 4523, + 2767, + 3230, + 576, + 530, + 1362, + 7900, + 4524, + 2533, + 2666, + 3710, + 4017, + 7901, + 842, + 3834, # 7142 + 7902, + 2801, + 2031, + 1014, + 4018, + 213, + 2700, + 3376, + 665, + 621, + 4236, + 7903, + 3711, + 2925, + 2430, + 7904, # 7158 + 2431, + 3302, + 3588, + 3377, + 7905, + 4237, + 2534, + 4238, + 4525, + 3589, + 1682, + 4239, + 3484, + 1380, + 7906, + 724, # 7174 + 2277, + 600, + 1670, + 7907, + 1337, + 1233, + 4526, + 3103, + 2244, + 7908, + 1621, + 4527, + 7909, + 651, + 4240, + 7910, # 7190 + 1612, + 4241, + 2611, + 7911, + 2844, + 7912, + 2734, + 2307, + 3058, + 7913, + 716, + 2459, + 3059, + 174, + 1255, + 2701, # 7206 + 4019, + 3590, + 548, + 1320, + 1398, + 728, + 4020, + 1574, + 7914, + 1890, + 1197, + 3060, + 4021, + 7915, + 3061, + 3062, # 7222 + 3712, + 3591, + 3713, + 747, + 7916, + 635, + 4242, + 4528, + 7917, + 7918, + 7919, + 4243, + 7920, + 7921, + 4529, + 7922, # 7238 + 3378, + 4530, + 2432, + 451, + 7923, + 3714, + 2535, + 2072, + 4244, + 2735, + 4245, + 4022, + 7924, + 1764, + 4531, + 7925, # 7254 + 4246, + 350, + 7926, + 2278, + 2390, + 2486, + 7927, + 4247, + 4023, + 2245, + 1434, + 4024, + 488, + 4532, + 458, + 4248, # 7270 + 4025, + 3715, + 771, + 1330, + 2391, + 3835, + 2568, + 3159, + 2159, + 2409, + 1553, + 2667, + 3160, + 4249, + 7928, + 2487, # 7286 + 2881, + 2612, + 1720, + 2702, + 4250, + 3379, + 4533, + 7929, + 2536, + 4251, + 7930, + 3231, + 4252, + 2768, + 7931, + 2015, # 7302 + 2736, + 7932, + 1155, + 1017, + 3716, + 3836, + 7933, + 3303, + 2308, + 201, + 1864, + 4253, + 1430, + 7934, + 4026, + 7935, # 7318 + 7936, + 7937, + 7938, + 7939, + 4254, + 1604, + 7940, + 414, + 1865, + 371, + 2587, + 4534, + 4535, + 3485, + 2016, + 3104, # 7334 + 4536, + 1708, + 960, + 4255, + 887, + 389, + 2171, + 1536, + 1663, + 1721, + 7941, + 2228, + 4027, + 2351, + 2926, + 1580, # 7350 + 7942, + 7943, + 7944, + 1744, + 7945, + 2537, + 4537, + 4538, + 7946, + 4539, + 7947, + 2073, + 7948, + 7949, + 3592, + 3380, # 7366 + 2882, + 4256, + 7950, + 4257, + 2640, + 3381, + 2802, + 673, + 2703, + 2460, + 709, + 3486, + 4028, + 3593, + 4258, + 7951, # 7382 + 1148, + 502, + 634, + 7952, + 7953, + 1204, + 4540, + 3594, + 1575, + 4541, + 2613, + 3717, + 7954, + 3718, + 3105, + 948, # 7398 + 3232, + 121, + 1745, + 3837, + 1110, + 7955, + 4259, + 3063, + 2509, + 3009, + 4029, + 3719, + 1151, + 1771, + 3838, + 1488, # 7414 + 4030, + 1986, + 7956, + 2433, + 3487, + 7957, + 7958, + 2093, + 7959, + 4260, + 3839, + 1213, + 1407, + 2803, + 531, + 2737, # 7430 + 2538, + 3233, + 1011, + 1537, + 7960, + 2769, + 4261, + 3106, + 1061, + 7961, + 3720, + 3721, + 1866, + 2883, + 7962, + 2017, # 7446 + 120, + 4262, + 4263, + 2062, + 3595, + 3234, + 2309, + 3840, + 2668, + 3382, + 1954, + 4542, + 7963, + 7964, + 3488, + 1047, # 7462 + 2704, + 1266, + 7965, + 1368, + 4543, + 2845, + 649, + 3383, + 3841, + 2539, + 2738, + 1102, + 2846, + 2669, + 7966, + 7967, # 7478 + 1999, + 7968, + 1111, + 3596, + 2962, + 7969, + 2488, + 3842, + 3597, + 2804, + 1854, + 3384, + 3722, + 7970, + 7971, + 3385, # 7494 + 2410, + 2884, + 3304, + 3235, + 3598, + 7972, + 2569, + 7973, + 3599, + 2805, + 4031, + 1460, + 856, + 7974, + 3600, + 7975, # 7510 + 2885, + 2963, + 7976, + 2886, + 3843, + 7977, + 4264, + 632, + 2510, + 875, + 3844, + 1697, + 3845, + 2291, + 7978, + 7979, # 7526 + 4544, + 3010, + 1239, + 580, + 4545, + 4265, + 7980, + 914, + 936, + 2074, + 1190, + 4032, + 1039, + 2123, + 7981, + 7982, # 7542 + 7983, + 3386, + 1473, + 7984, + 1354, + 4266, + 3846, + 7985, + 2172, + 3064, + 4033, + 915, + 3305, + 4267, + 4268, + 3306, # 7558 + 1605, + 1834, + 7986, + 2739, + 398, + 3601, + 4269, + 3847, + 4034, + 328, + 1912, + 2847, + 4035, + 3848, + 1331, + 4270, # 7574 + 3011, + 937, + 4271, + 7987, + 3602, + 4036, + 4037, + 3387, + 2160, + 4546, + 3388, + 524, + 742, + 538, + 3065, + 1012, # 7590 + 7988, + 7989, + 3849, + 2461, + 7990, + 658, + 1103, + 225, + 3850, + 7991, + 7992, + 4547, + 7993, + 4548, + 7994, + 3236, # 7606 + 1243, + 7995, + 4038, + 963, + 2246, + 4549, + 7996, + 2705, + 3603, + 3161, + 7997, + 7998, + 2588, + 2327, + 7999, + 4550, # 7622 + 8000, + 8001, + 8002, + 3489, + 3307, + 957, + 3389, + 2540, + 2032, + 1930, + 2927, + 2462, + 870, + 2018, + 3604, + 1746, # 7638 + 2770, + 2771, + 2434, + 2463, + 8003, + 3851, + 8004, + 3723, + 3107, + 3724, + 3490, + 3390, + 3725, + 8005, + 1179, + 3066, # 7654 + 8006, + 3162, + 2373, + 4272, + 3726, + 2541, + 3163, + 3108, + 2740, + 4039, + 8007, + 3391, + 1556, + 2542, + 2292, + 977, # 7670 + 2887, + 2033, + 4040, + 1205, + 3392, + 8008, + 1765, + 3393, + 3164, + 2124, + 1271, + 1689, + 714, + 4551, + 3491, + 8009, # 7686 + 2328, + 3852, + 533, + 4273, + 3605, + 2181, + 617, + 8010, + 2464, + 3308, + 3492, + 2310, + 8011, + 8012, + 3165, + 8013, # 7702 + 8014, + 3853, + 1987, + 618, + 427, + 2641, + 3493, + 3394, + 8015, + 8016, + 1244, + 1690, + 8017, + 2806, + 4274, + 4552, # 7718 + 8018, + 3494, + 8019, + 8020, + 2279, + 1576, + 473, + 3606, + 4275, + 3395, + 972, + 8021, + 3607, + 8022, + 3067, + 8023, # 7734 + 8024, + 4553, + 4554, + 8025, + 3727, + 4041, + 4042, + 8026, + 153, + 4555, + 356, + 8027, + 1891, + 2888, + 4276, + 2143, # 7750 + 408, + 803, + 2352, + 8028, + 3854, + 8029, + 4277, + 1646, + 2570, + 2511, + 4556, + 4557, + 3855, + 8030, + 3856, + 4278, # 7766 + 8031, + 2411, + 3396, + 752, + 8032, + 8033, + 1961, + 2964, + 8034, + 746, + 3012, + 2465, + 8035, + 4279, + 3728, + 698, # 7782 + 4558, + 1892, + 4280, + 3608, + 2543, + 4559, + 3609, + 3857, + 8036, + 3166, + 3397, + 8037, + 1823, + 1302, + 4043, + 2706, # 7798 + 3858, + 1973, + 4281, + 8038, + 4282, + 3167, + 823, + 1303, + 1288, + 1236, + 2848, + 3495, + 4044, + 3398, + 774, + 3859, # 7814 + 8039, + 1581, + 4560, + 1304, + 2849, + 3860, + 4561, + 8040, + 2435, + 2161, + 1083, + 3237, + 4283, + 4045, + 4284, + 344, # 7830 + 1173, + 288, + 2311, + 454, + 1683, + 8041, + 8042, + 1461, + 4562, + 4046, + 2589, + 8043, + 8044, + 4563, + 985, + 894, # 7846 + 8045, + 3399, + 3168, + 8046, + 1913, + 2928, + 3729, + 1988, + 8047, + 2110, + 1974, + 8048, + 4047, + 8049, + 2571, + 1194, # 7862 + 425, + 8050, + 4564, + 3169, + 1245, + 3730, + 4285, + 8051, + 8052, + 2850, + 8053, + 636, + 4565, + 1855, + 3861, + 760, # 7878 + 1799, + 8054, + 4286, + 2209, + 1508, + 4566, + 4048, + 1893, + 1684, + 2293, + 8055, + 8056, + 8057, + 4287, + 4288, + 2210, # 7894 + 479, + 8058, + 8059, + 832, + 8060, + 4049, + 2489, + 8061, + 2965, + 2490, + 3731, + 990, + 3109, + 627, + 1814, + 2642, # 7910 + 4289, + 1582, + 4290, + 2125, + 2111, + 3496, + 4567, + 8062, + 799, + 4291, + 3170, + 8063, + 4568, + 2112, + 1737, + 3013, # 7926 + 1018, + 543, + 754, + 4292, + 3309, + 1676, + 4569, + 4570, + 4050, + 8064, + 1489, + 8065, + 3497, + 8066, + 2614, + 2889, # 7942 + 4051, + 8067, + 8068, + 2966, + 8069, + 8070, + 8071, + 8072, + 3171, + 4571, + 4572, + 2182, + 1722, + 8073, + 3238, + 3239, # 7958 + 1842, + 3610, + 1715, + 481, + 365, + 1975, + 1856, + 8074, + 8075, + 1962, + 2491, + 4573, + 8076, + 2126, + 3611, + 3240, # 7974 + 433, + 1894, + 2063, + 2075, + 8077, + 602, + 2741, + 8078, + 8079, + 8080, + 8081, + 8082, + 3014, + 1628, + 3400, + 8083, # 7990 + 3172, + 4574, + 4052, + 2890, + 4575, + 2512, + 8084, + 2544, + 2772, + 8085, + 8086, + 8087, + 3310, + 4576, + 2891, + 8088, # 8006 + 4577, + 8089, + 2851, + 4578, + 4579, + 1221, + 2967, + 4053, + 2513, + 8090, + 8091, + 8092, + 1867, + 1989, + 8093, + 8094, # 8022 + 8095, + 1895, + 8096, + 8097, + 4580, + 1896, + 4054, + 318, + 8098, + 2094, + 4055, + 4293, + 8099, + 8100, + 485, + 8101, # 8038 + 938, + 3862, + 553, + 2670, + 116, + 8102, + 3863, + 3612, + 8103, + 3498, + 2671, + 2773, + 3401, + 3311, + 2807, + 8104, # 8054 + 3613, + 2929, + 4056, + 1747, + 2930, + 2968, + 8105, + 8106, + 207, + 8107, + 8108, + 2672, + 4581, + 2514, + 8109, + 3015, # 8070 + 890, + 3614, + 3864, + 8110, + 1877, + 3732, + 3402, + 8111, + 2183, + 2353, + 3403, + 1652, + 8112, + 8113, + 8114, + 941, # 8086 + 2294, + 208, + 3499, + 4057, + 2019, + 330, + 4294, + 3865, + 2892, + 2492, + 3733, + 4295, + 8115, + 8116, + 8117, + 8118, # 8102 ) - diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/euctwprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/euctwprober.py index 35669cc4..fc497dc4 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/euctwprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/euctwprober.py @@ -30,6 +30,7 @@ from .chardistribution import EUCTWDistributionAnalysis from .mbcssm import EUCTW_SM_MODEL + class EUCTWProber(MultiByteCharSetProber): def __init__(self): super(EUCTWProber, self).__init__() diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/gb2312freq.py b/src/fetchcode/vcs/pip/_vendor/chardet/gb2312freq.py index 697837bd..650ddc0f 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/gb2312freq.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/gb2312freq.py @@ -44,240 +44,3764 @@ GB2312_TABLE_SIZE = 3760 GB2312_CHAR_TO_FREQ_ORDER = ( -1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205, -2361, 224,2558, 479,1711, 963,3162, 440,4060,1905,2966,2947,3580,2647,3961,3842, -2204, 869,4207, 970,2678,5626,2944,2956,1479,4048, 514,3595, 588,1346,2820,3409, - 249,4088,1746,1873,2047,1774, 581,1813, 358,1174,3590,1014,1561,4844,2245, 670, -1636,3112, 889,1286, 953, 556,2327,3060,1290,3141, 613, 185,3477,1367, 850,3820, -1715,2428,2642,2303,2732,3041,2562,2648,3566,3946,1349, 388,3098,2091,1360,3585, - 152,1687,1539, 738,1559, 59,1232,2925,2267,1388,1249,1741,1679,2960, 151,1566, -1125,1352,4271, 924,4296, 385,3166,4459, 310,1245,2850, 70,3285,2729,3534,3575, -2398,3298,3466,1960,2265, 217,3647, 864,1909,2084,4401,2773,1010,3269,5152, 853, -3051,3121,1244,4251,1895, 364,1499,1540,2313,1180,3655,2268, 562, 715,2417,3061, - 544, 336,3768,2380,1752,4075, 950, 280,2425,4382, 183,2759,3272, 333,4297,2155, -1688,2356,1444,1039,4540, 736,1177,3349,2443,2368,2144,2225, 565, 196,1482,3406, - 927,1335,4147, 692, 878,1311,1653,3911,3622,1378,4200,1840,2969,3149,2126,1816, -2534,1546,2393,2760, 737,2494, 13, 447, 245,2747, 38,2765,2129,2589,1079, 606, - 360, 471,3755,2890, 404, 848, 699,1785,1236, 370,2221,1023,3746,2074,2026,2023, -2388,1581,2119, 812,1141,3091,2536,1519, 804,2053, 406,1596,1090, 784, 548,4414, -1806,2264,2936,1100, 343,4114,5096, 622,3358, 743,3668,1510,1626,5020,3567,2513, -3195,4115,5627,2489,2991, 24,2065,2697,1087,2719, 48,1634, 315, 68, 985,2052, - 198,2239,1347,1107,1439, 597,2366,2172, 871,3307, 919,2487,2790,1867, 236,2570, -1413,3794, 906,3365,3381,1701,1982,1818,1524,2924,1205, 616,2586,2072,2004, 575, - 253,3099, 32,1365,1182, 197,1714,2454,1201, 554,3388,3224,2748, 756,2587, 250, -2567,1507,1517,3529,1922,2761,2337,3416,1961,1677,2452,2238,3153, 615, 911,1506, -1474,2495,1265,1906,2749,3756,3280,2161, 898,2714,1759,3450,2243,2444, 563, 26, -3286,2266,3769,3344,2707,3677, 611,1402, 531,1028,2871,4548,1375, 261,2948, 835, -1190,4134, 353, 840,2684,1900,3082,1435,2109,1207,1674, 329,1872,2781,4055,2686, -2104, 608,3318,2423,2957,2768,1108,3739,3512,3271,3985,2203,1771,3520,1418,2054, -1681,1153, 225,1627,2929, 162,2050,2511,3687,1954, 124,1859,2431,1684,3032,2894, - 585,4805,3969,2869,2704,2088,2032,2095,3656,2635,4362,2209, 256, 518,2042,2105, -3777,3657, 643,2298,1148,1779, 190, 989,3544, 414, 11,2135,2063,2979,1471, 403, -3678, 126, 770,1563, 671,2499,3216,2877, 600,1179, 307,2805,4937,1268,1297,2694, - 252,4032,1448,1494,1331,1394, 127,2256, 222,1647,1035,1481,3056,1915,1048, 873, -3651, 210, 33,1608,2516, 200,1520, 415, 102, 0,3389,1287, 817, 91,3299,2940, - 836,1814, 549,2197,1396,1669,2987,3582,2297,2848,4528,1070, 687, 20,1819, 121, -1552,1364,1461,1968,2617,3540,2824,2083, 177, 948,4938,2291, 110,4549,2066, 648, -3359,1755,2110,2114,4642,4845,1693,3937,3308,1257,1869,2123, 208,1804,3159,2992, -2531,2549,3361,2418,1350,2347,2800,2568,1291,2036,2680, 72, 842,1990, 212,1233, -1154,1586, 75,2027,3410,4900,1823,1337,2710,2676, 728,2810,1522,3026,4995, 157, - 755,1050,4022, 710, 785,1936,2194,2085,1406,2777,2400, 150,1250,4049,1206, 807, -1910, 534, 529,3309,1721,1660, 274, 39,2827, 661,2670,1578, 925,3248,3815,1094, -4278,4901,4252, 41,1150,3747,2572,2227,4501,3658,4902,3813,3357,3617,2884,2258, - 887, 538,4187,3199,1294,2439,3042,2329,2343,2497,1255, 107, 543,1527, 521,3478, -3568, 194,5062, 15, 961,3870,1241,1192,2664, 66,5215,3260,2111,1295,1127,2152, -3805,4135, 901,1164,1976, 398,1278, 530,1460, 748, 904,1054,1966,1426, 53,2909, - 509, 523,2279,1534, 536,1019, 239,1685, 460,2353, 673,1065,2401,3600,4298,2272, -1272,2363, 284,1753,3679,4064,1695, 81, 815,2677,2757,2731,1386, 859, 500,4221, -2190,2566, 757,1006,2519,2068,1166,1455, 337,2654,3203,1863,1682,1914,3025,1252, -1409,1366, 847, 714,2834,2038,3209, 964,2970,1901, 885,2553,1078,1756,3049, 301, -1572,3326, 688,2130,1996,2429,1805,1648,2930,3421,2750,3652,3088, 262,1158,1254, - 389,1641,1812, 526,1719, 923,2073,1073,1902, 468, 489,4625,1140, 857,2375,3070, -3319,2863, 380, 116,1328,2693,1161,2244, 273,1212,1884,2769,3011,1775,1142, 461, -3066,1200,2147,2212, 790, 702,2695,4222,1601,1058, 434,2338,5153,3640, 67,2360, -4099,2502, 618,3472,1329, 416,1132, 830,2782,1807,2653,3211,3510,1662, 192,2124, - 296,3979,1739,1611,3684, 23, 118, 324, 446,1239,1225, 293,2520,3814,3795,2535, -3116, 17,1074, 467,2692,2201, 387,2922, 45,1326,3055,1645,3659,2817, 958, 243, -1903,2320,1339,2825,1784,3289, 356, 576, 865,2315,2381,3377,3916,1088,3122,1713, -1655, 935, 628,4689,1034,1327, 441, 800, 720, 894,1979,2183,1528,5289,2702,1071, -4046,3572,2399,1571,3281, 79, 761,1103, 327, 134, 758,1899,1371,1615, 879, 442, - 215,2605,2579, 173,2048,2485,1057,2975,3317,1097,2253,3801,4263,1403,1650,2946, - 814,4968,3487,1548,2644,1567,1285, 2, 295,2636, 97, 946,3576, 832, 141,4257, -3273, 760,3821,3521,3156,2607, 949,1024,1733,1516,1803,1920,2125,2283,2665,3180, -1501,2064,3560,2171,1592, 803,3518,1416, 732,3897,4258,1363,1362,2458, 119,1427, - 602,1525,2608,1605,1639,3175, 694,3064, 10, 465, 76,2000,4846,4208, 444,3781, -1619,3353,2206,1273,3796, 740,2483, 320,1723,2377,3660,2619,1359,1137,1762,1724, -2345,2842,1850,1862, 912, 821,1866, 612,2625,1735,2573,3369,1093, 844, 89, 937, - 930,1424,3564,2413,2972,1004,3046,3019,2011, 711,3171,1452,4178, 428, 801,1943, - 432, 445,2811, 206,4136,1472, 730, 349, 73, 397,2802,2547, 998,1637,1167, 789, - 396,3217, 154,1218, 716,1120,1780,2819,4826,1931,3334,3762,2139,1215,2627, 552, -3664,3628,3232,1405,2383,3111,1356,2652,3577,3320,3101,1703, 640,1045,1370,1246, -4996, 371,1575,2436,1621,2210, 984,4033,1734,2638, 16,4529, 663,2755,3255,1451, -3917,2257,1253,1955,2234,1263,2951, 214,1229, 617, 485, 359,1831,1969, 473,2310, - 750,2058, 165, 80,2864,2419, 361,4344,2416,2479,1134, 796,3726,1266,2943, 860, -2715, 938, 390,2734,1313,1384, 248, 202, 877,1064,2854, 522,3907, 279,1602, 297, -2357, 395,3740, 137,2075, 944,4089,2584,1267,3802, 62,1533,2285, 178, 176, 780, -2440, 201,3707, 590, 478,1560,4354,2117,1075, 30, 74,4643,4004,1635,1441,2745, - 776,2596, 238,1077,1692,1912,2844, 605, 499,1742,3947, 241,3053, 980,1749, 936, -2640,4511,2582, 515,1543,2162,5322,2892,2993, 890,2148,1924, 665,1827,3581,1032, - 968,3163, 339,1044,1896, 270, 583,1791,1720,4367,1194,3488,3669, 43,2523,1657, - 163,2167, 290,1209,1622,3378, 550, 634,2508,2510, 695,2634,2384,2512,1476,1414, - 220,1469,2341,2138,2852,3183,2900,4939,2865,3502,1211,3680, 854,3227,1299,2976, -3172, 186,2998,1459, 443,1067,3251,1495, 321,1932,3054, 909, 753,1410,1828, 436, -2441,1119,1587,3164,2186,1258, 227, 231,1425,1890,3200,3942, 247, 959, 725,5254, -2741, 577,2158,2079, 929, 120, 174, 838,2813, 591,1115, 417,2024, 40,3240,1536, -1037, 291,4151,2354, 632,1298,2406,2500,3535,1825,1846,3451, 205,1171, 345,4238, - 18,1163, 811, 685,2208,1217, 425,1312,1508,1175,4308,2552,1033, 587,1381,3059, -2984,3482, 340,1316,4023,3972, 792,3176, 519, 777,4690, 918, 933,4130,2981,3741, - 90,3360,2911,2200,5184,4550, 609,3079,2030, 272,3379,2736, 363,3881,1130,1447, - 286, 779, 357,1169,3350,3137,1630,1220,2687,2391, 747,1277,3688,2618,2682,2601, -1156,3196,5290,4034,3102,1689,3596,3128, 874, 219,2783, 798, 508,1843,2461, 269, -1658,1776,1392,1913,2983,3287,2866,2159,2372, 829,4076, 46,4253,2873,1889,1894, - 915,1834,1631,2181,2318, 298, 664,2818,3555,2735, 954,3228,3117, 527,3511,2173, - 681,2712,3033,2247,2346,3467,1652, 155,2164,3382, 113,1994, 450, 899, 494, 994, -1237,2958,1875,2336,1926,3727, 545,1577,1550, 633,3473, 204,1305,3072,2410,1956, -2471, 707,2134, 841,2195,2196,2663,3843,1026,4940, 990,3252,4997, 368,1092, 437, -3212,3258,1933,1829, 675,2977,2893, 412, 943,3723,4644,3294,3283,2230,2373,5154, -2389,2241,2661,2323,1404,2524, 593, 787, 677,3008,1275,2059, 438,2709,2609,2240, -2269,2246,1446, 36,1568,1373,3892,1574,2301,1456,3962, 693,2276,5216,2035,1143, -2720,1919,1797,1811,2763,4137,2597,1830,1699,1488,1198,2090, 424,1694, 312,3634, -3390,4179,3335,2252,1214, 561,1059,3243,2295,2561, 975,5155,2321,2751,3772, 472, -1537,3282,3398,1047,2077,2348,2878,1323,3340,3076, 690,2906, 51, 369, 170,3541, -1060,2187,2688,3670,2541,1083,1683, 928,3918, 459, 109,4427, 599,3744,4286, 143, -2101,2730,2490, 82,1588,3036,2121, 281,1860, 477,4035,1238,2812,3020,2716,3312, -1530,2188,2055,1317, 843, 636,1808,1173,3495, 649, 181,1002, 147,3641,1159,2414, -3750,2289,2795, 813,3123,2610,1136,4368, 5,3391,4541,2174, 420, 429,1728, 754, -1228,2115,2219, 347,2223,2733, 735,1518,3003,2355,3134,1764,3948,3329,1888,2424, -1001,1234,1972,3321,3363,1672,1021,1450,1584, 226, 765, 655,2526,3404,3244,2302, -3665, 731, 594,2184, 319,1576, 621, 658,2656,4299,2099,3864,1279,2071,2598,2739, - 795,3086,3699,3908,1707,2352,2402,1382,3136,2475,1465,4847,3496,3865,1085,3004, -2591,1084, 213,2287,1963,3565,2250, 822, 793,4574,3187,1772,1789,3050, 595,1484, -1959,2770,1080,2650, 456, 422,2996, 940,3322,4328,4345,3092,2742, 965,2784, 739, -4124, 952,1358,2498,2949,2565, 332,2698,2378, 660,2260,2473,4194,3856,2919, 535, -1260,2651,1208,1428,1300,1949,1303,2942, 433,2455,2450,1251,1946, 614,1269, 641, -1306,1810,2737,3078,2912, 564,2365,1419,1415,1497,4460,2367,2185,1379,3005,1307, -3218,2175,1897,3063, 682,1157,4040,4005,1712,1160,1941,1399, 394, 402,2952,1573, -1151,2986,2404, 862, 299,2033,1489,3006, 346, 171,2886,3401,1726,2932, 168,2533, - 47,2507,1030,3735,1145,3370,1395,1318,1579,3609,4560,2857,4116,1457,2529,1965, - 504,1036,2690,2988,2405, 745,5871, 849,2397,2056,3081, 863,2359,3857,2096, 99, -1397,1769,2300,4428,1643,3455,1978,1757,3718,1440, 35,4879,3742,1296,4228,2280, - 160,5063,1599,2013, 166, 520,3479,1646,3345,3012, 490,1937,1545,1264,2182,2505, -1096,1188,1369,1436,2421,1667,2792,2460,1270,2122, 727,3167,2143, 806,1706,1012, -1800,3037, 960,2218,1882, 805, 139,2456,1139,1521, 851,1052,3093,3089, 342,2039, - 744,5097,1468,1502,1585,2087, 223, 939, 326,2140,2577, 892,2481,1623,4077, 982, -3708, 135,2131, 87,2503,3114,2326,1106, 876,1616, 547,2997,2831,2093,3441,4530, -4314, 9,3256,4229,4148, 659,1462,1986,1710,2046,2913,2231,4090,4880,5255,3392, -3274,1368,3689,4645,1477, 705,3384,3635,1068,1529,2941,1458,3782,1509, 100,1656, -2548, 718,2339, 408,1590,2780,3548,1838,4117,3719,1345,3530, 717,3442,2778,3220, -2898,1892,4590,3614,3371,2043,1998,1224,3483, 891, 635, 584,2559,3355, 733,1766, -1729,1172,3789,1891,2307, 781,2982,2271,1957,1580,5773,2633,2005,4195,3097,1535, -3213,1189,1934,5693,3262, 586,3118,1324,1598, 517,1564,2217,1868,1893,4445,3728, -2703,3139,1526,1787,1992,3882,2875,1549,1199,1056,2224,1904,2711,5098,4287, 338, -1993,3129,3489,2689,1809,2815,1997, 957,1855,3898,2550,3275,3057,1105,1319, 627, -1505,1911,1883,3526, 698,3629,3456,1833,1431, 746, 77,1261,2017,2296,1977,1885, - 125,1334,1600, 525,1798,1109,2222,1470,1945, 559,2236,1186,3443,2476,1929,1411, -2411,3135,1777,3372,2621,1841,1613,3229, 668,1430,1839,2643,2916, 195,1989,2671, -2358,1387, 629,3205,2293,5256,4439, 123,1310, 888,1879,4300,3021,3605,1003,1162, -3192,2910,2010, 140,2395,2859, 55,1082,2012,2901, 662, 419,2081,1438, 680,2774, -4654,3912,1620,1731,1625,5035,4065,2328, 512,1344, 802,5443,2163,2311,2537, 524, -3399, 98,1155,2103,1918,2606,3925,2816,1393,2465,1504,3773,2177,3963,1478,4346, - 180,1113,4655,3461,2028,1698, 833,2696,1235,1322,1594,4408,3623,3013,3225,2040, -3022, 541,2881, 607,3632,2029,1665,1219, 639,1385,1686,1099,2803,3231,1938,3188, -2858, 427, 676,2772,1168,2025, 454,3253,2486,3556, 230,1950, 580, 791,1991,1280, -1086,1974,2034, 630, 257,3338,2788,4903,1017, 86,4790, 966,2789,1995,1696,1131, - 259,3095,4188,1308, 179,1463,5257, 289,4107,1248, 42,3413,1725,2288, 896,1947, - 774,4474,4254, 604,3430,4264, 392,2514,2588, 452, 237,1408,3018, 988,4531,1970, -3034,3310, 540,2370,1562,1288,2990, 502,4765,1147, 4,1853,2708, 207, 294,2814, -4078,2902,2509, 684, 34,3105,3532,2551, 644, 709,2801,2344, 573,1727,3573,3557, -2021,1081,3100,4315,2100,3681, 199,2263,1837,2385, 146,3484,1195,2776,3949, 997, -1939,3973,1008,1091,1202,1962,1847,1149,4209,5444,1076, 493, 117,5400,2521, 972, -1490,2934,1796,4542,2374,1512,2933,2657, 413,2888,1135,2762,2314,2156,1355,2369, - 766,2007,2527,2170,3124,2491,2593,2632,4757,2437, 234,3125,3591,1898,1750,1376, -1942,3468,3138, 570,2127,2145,3276,4131, 962, 132,1445,4196, 19, 941,3624,3480, -3366,1973,1374,4461,3431,2629, 283,2415,2275, 808,2887,3620,2112,2563,1353,3610, - 955,1089,3103,1053, 96, 88,4097, 823,3808,1583, 399, 292,4091,3313, 421,1128, - 642,4006, 903,2539,1877,2082, 596, 29,4066,1790, 722,2157, 130, 995,1569, 769, -1485, 464, 513,2213, 288,1923,1101,2453,4316, 133, 486,2445, 50, 625, 487,2207, - 57, 423, 481,2962, 159,3729,1558, 491, 303, 482, 501, 240,2837, 112,3648,2392, -1783, 362, 8,3433,3422, 610,2793,3277,1390,1284,1654, 21,3823, 734, 367, 623, - 193, 287, 374,1009,1483, 816, 476, 313,2255,2340,1262,2150,2899,1146,2581, 782, -2116,1659,2018,1880, 255,3586,3314,1110,2867,2137,2564, 986,2767,5185,2006, 650, - 158, 926, 762, 881,3157,2717,2362,3587, 306,3690,3245,1542,3077,2427,1691,2478, -2118,2985,3490,2438, 539,2305, 983, 129,1754, 355,4201,2386, 827,2923, 104,1773, -2838,2771, 411,2905,3919, 376, 767, 122,1114, 828,2422,1817,3506, 266,3460,1007, -1609,4998, 945,2612,4429,2274, 726,1247,1964,2914,2199,2070,4002,4108, 657,3323, -1422, 579, 455,2764,4737,1222,2895,1670, 824,1223,1487,2525, 558, 861,3080, 598, -2659,2515,1967, 752,2583,2376,2214,4180, 977, 704,2464,4999,2622,4109,1210,2961, - 819,1541, 142,2284, 44, 418, 457,1126,3730,4347,4626,1644,1876,3671,1864, 302, -1063,5694, 624, 723,1984,3745,1314,1676,2488,1610,1449,3558,3569,2166,2098, 409, -1011,2325,3704,2306, 818,1732,1383,1824,1844,3757, 999,2705,3497,1216,1423,2683, -2426,2954,2501,2726,2229,1475,2554,5064,1971,1794,1666,2014,1343, 783, 724, 191, -2434,1354,2220,5065,1763,2752,2472,4152, 131, 175,2885,3434, 92,1466,4920,2616, -3871,3872,3866, 128,1551,1632, 669,1854,3682,4691,4125,1230, 188,2973,3290,1302, -1213, 560,3266, 917, 763,3909,3249,1760, 868,1958, 764,1782,2097, 145,2277,3774, -4462, 64,1491,3062, 971,2132,3606,2442, 221,1226,1617, 218, 323,1185,3207,3147, - 571, 619,1473,1005,1744,2281, 449,1887,2396,3685, 275, 375,3816,1743,3844,3731, - 845,1983,2350,4210,1377, 773, 967,3499,3052,3743,2725,4007,1697,1022,3943,1464, -3264,2855,2722,1952,1029,2839,2467, 84,4383,2215, 820,1391,2015,2448,3672, 377, -1948,2168, 797,2545,3536,2578,2645, 94,2874,1678, 405,1259,3071, 771, 546,1315, - 470,1243,3083, 895,2468, 981, 969,2037, 846,4181, 653,1276,2928, 14,2594, 557, -3007,2474, 156, 902,1338,1740,2574, 537,2518, 973,2282,2216,2433,1928, 138,2903, -1293,2631,1612, 646,3457, 839,2935, 111, 496,2191,2847, 589,3186, 149,3994,2060, -4031,2641,4067,3145,1870, 37,3597,2136,1025,2051,3009,3383,3549,1121,1016,3261, -1301, 251,2446,2599,2153, 872,3246, 637, 334,3705, 831, 884, 921,3065,3140,4092, -2198,1944, 246,2964, 108,2045,1152,1921,2308,1031, 203,3173,4170,1907,3890, 810, -1401,2003,1690, 506, 647,1242,2828,1761,1649,3208,2249,1589,3709,2931,5156,1708, - 498, 666,2613, 834,3817,1231, 184,2851,1124, 883,3197,2261,3710,1765,1553,2658, -1178,2639,2351, 93,1193, 942,2538,2141,4402, 235,1821, 870,1591,2192,1709,1871, -3341,1618,4126,2595,2334, 603, 651, 69, 701, 268,2662,3411,2555,1380,1606, 503, - 448, 254,2371,2646, 574,1187,2309,1770, 322,2235,1292,1801, 305, 566,1133, 229, -2067,2057, 706, 167, 483,2002,2672,3295,1820,3561,3067, 316, 378,2746,3452,1112, - 136,1981, 507,1651,2917,1117, 285,4591, 182,2580,3522,1304, 335,3303,1835,2504, -1795,1792,2248, 674,1018,2106,2449,1857,2292,2845, 976,3047,1781,2600,2727,1389, -1281, 52,3152, 153, 265,3950, 672,3485,3951,4463, 430,1183, 365, 278,2169, 27, -1407,1336,2304, 209,1340,1730,2202,1852,2403,2883, 979,1737,1062, 631,2829,2542, -3876,2592, 825,2086,2226,3048,3625, 352,1417,3724, 542, 991, 431,1351,3938,1861, -2294, 826,1361,2927,3142,3503,1738, 463,2462,2723, 582,1916,1595,2808, 400,3845, -3891,2868,3621,2254, 58,2492,1123, 910,2160,2614,1372,1603,1196,1072,3385,1700, -3267,1980, 696, 480,2430, 920, 799,1570,2920,1951,2041,4047,2540,1321,4223,2469, -3562,2228,1271,2602, 401,2833,3351,2575,5157, 907,2312,1256, 410, 263,3507,1582, - 996, 678,1849,2316,1480, 908,3545,2237, 703,2322, 667,1826,2849,1531,2604,2999, -2407,3146,2151,2630,1786,3711, 469,3542, 497,3899,2409, 858, 837,4446,3393,1274, - 786, 620,1845,2001,3311, 484, 308,3367,1204,1815,3691,2332,1532,2557,1842,2020, -2724,1927,2333,4440, 567, 22,1673,2728,4475,1987,1858,1144,1597, 101,1832,3601, - 12, 974,3783,4391, 951,1412, 1,3720, 453,4608,4041, 528,1041,1027,3230,2628, -1129, 875,1051,3291,1203,2262,1069,2860,2799,2149,2615,3278, 144,1758,3040, 31, - 475,1680, 366,2685,3184, 311,1642,4008,2466,5036,1593,1493,2809, 216,1420,1668, - 233, 304,2128,3284, 232,1429,1768,1040,2008,3407,2740,2967,2543, 242,2133, 778, -1565,2022,2620, 505,2189,2756,1098,2273, 372,1614, 708, 553,2846,2094,2278, 169, -3626,2835,4161, 228,2674,3165, 809,1454,1309, 466,1705,1095, 900,3423, 880,2667, -3751,5258,2317,3109,2571,4317,2766,1503,1342, 866,4447,1118, 63,2076, 314,1881, -1348,1061, 172, 978,3515,1747, 532, 511,3970, 6, 601, 905,2699,3300,1751, 276, -1467,3725,2668, 65,4239,2544,2779,2556,1604, 578,2451,1802, 992,2331,2624,1320, -3446, 713,1513,1013, 103,2786,2447,1661, 886,1702, 916, 654,3574,2031,1556, 751, -2178,2821,2179,1498,1538,2176, 271, 914,2251,2080,1325, 638,1953,2937,3877,2432, -2754, 95,3265,1716, 260,1227,4083, 775, 106,1357,3254, 426,1607, 555,2480, 772, -1985, 244,2546, 474, 495,1046,2611,1851,2061, 71,2089,1675,2590, 742,3758,2843, -3222,1433, 267,2180,2576,2826,2233,2092,3913,2435, 956,1745,3075, 856,2113,1116, - 451, 3,1988,2896,1398, 993,2463,1878,2049,1341,2718,2721,2870,2108, 712,2904, -4363,2753,2324, 277,2872,2349,2649, 384, 987, 435, 691,3000, 922, 164,3939, 652, -1500,1184,4153,2482,3373,2165,4848,2335,3775,3508,3154,2806,2830,1554,2102,1664, -2530,1434,2408, 893,1547,2623,3447,2832,2242,2532,3169,2856,3223,2078, 49,3770, -3469, 462, 318, 656,2259,3250,3069, 679,1629,2758, 344,1138,1104,3120,1836,1283, -3115,2154,1437,4448, 934, 759,1999, 794,2862,1038, 533,2560,1722,2342, 855,2626, -1197,1663,4476,3127, 85,4240,2528, 25,1111,1181,3673, 407,3470,4561,2679,2713, - 768,1925,2841,3986,1544,1165, 932, 373,1240,2146,1930,2673, 721,4766, 354,4333, - 391,2963, 187, 61,3364,1442,1102, 330,1940,1767, 341,3809,4118, 393,2496,2062, -2211, 105, 331, 300, 439, 913,1332, 626, 379,3304,1557, 328, 689,3952, 309,1555, - 931, 317,2517,3027, 325, 569, 686,2107,3084, 60,1042,1333,2794, 264,3177,4014, -1628, 258,3712, 7,4464,1176,1043,1778, 683, 114,1975, 78,1492, 383,1886, 510, - 386, 645,5291,2891,2069,3305,4138,3867,2939,2603,2493,1935,1066,1848,3588,1015, -1282,1289,4609, 697,1453,3044,2666,3611,1856,2412, 54, 719,1330, 568,3778,2459, -1748, 788, 492, 551,1191,1000, 488,3394,3763, 282,1799, 348,2016,1523,3155,2390, -1049, 382,2019,1788,1170, 729,2968,3523, 897,3926,2785,2938,3292, 350,2319,3238, -1718,1717,2655,3453,3143,4465, 161,2889,2980,2009,1421, 56,1908,1640,2387,2232, -1917,1874,2477,4921, 148, 83,3438, 592,4245,2882,1822,1055, 741, 115,1496,1624, - 381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189, - 852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, #last 512 + 1671, + 749, + 1443, + 2364, + 3924, + 3807, + 2330, + 3921, + 1704, + 3463, + 2691, + 1511, + 1515, + 572, + 3191, + 2205, + 2361, + 224, + 2558, + 479, + 1711, + 963, + 3162, + 440, + 4060, + 1905, + 2966, + 2947, + 3580, + 2647, + 3961, + 3842, + 2204, + 869, + 4207, + 970, + 2678, + 5626, + 2944, + 2956, + 1479, + 4048, + 514, + 3595, + 588, + 1346, + 2820, + 3409, + 249, + 4088, + 1746, + 1873, + 2047, + 1774, + 581, + 1813, + 358, + 1174, + 3590, + 1014, + 1561, + 4844, + 2245, + 670, + 1636, + 3112, + 889, + 1286, + 953, + 556, + 2327, + 3060, + 1290, + 3141, + 613, + 185, + 3477, + 1367, + 850, + 3820, + 1715, + 2428, + 2642, + 2303, + 2732, + 3041, + 2562, + 2648, + 3566, + 3946, + 1349, + 388, + 3098, + 2091, + 1360, + 3585, + 152, + 1687, + 1539, + 738, + 1559, + 59, + 1232, + 2925, + 2267, + 1388, + 1249, + 1741, + 1679, + 2960, + 151, + 1566, + 1125, + 1352, + 4271, + 924, + 4296, + 385, + 3166, + 4459, + 310, + 1245, + 2850, + 70, + 3285, + 2729, + 3534, + 3575, + 2398, + 3298, + 3466, + 1960, + 2265, + 217, + 3647, + 864, + 1909, + 2084, + 4401, + 2773, + 1010, + 3269, + 5152, + 853, + 3051, + 3121, + 1244, + 4251, + 1895, + 364, + 1499, + 1540, + 2313, + 1180, + 3655, + 2268, + 562, + 715, + 2417, + 3061, + 544, + 336, + 3768, + 2380, + 1752, + 4075, + 950, + 280, + 2425, + 4382, + 183, + 2759, + 3272, + 333, + 4297, + 2155, + 1688, + 2356, + 1444, + 1039, + 4540, + 736, + 1177, + 3349, + 2443, + 2368, + 2144, + 2225, + 565, + 196, + 1482, + 3406, + 927, + 1335, + 4147, + 692, + 878, + 1311, + 1653, + 3911, + 3622, + 1378, + 4200, + 1840, + 2969, + 3149, + 2126, + 1816, + 2534, + 1546, + 2393, + 2760, + 737, + 2494, + 13, + 447, + 245, + 2747, + 38, + 2765, + 2129, + 2589, + 1079, + 606, + 360, + 471, + 3755, + 2890, + 404, + 848, + 699, + 1785, + 1236, + 370, + 2221, + 1023, + 3746, + 2074, + 2026, + 2023, + 2388, + 1581, + 2119, + 812, + 1141, + 3091, + 2536, + 1519, + 804, + 2053, + 406, + 1596, + 1090, + 784, + 548, + 4414, + 1806, + 2264, + 2936, + 1100, + 343, + 4114, + 5096, + 622, + 3358, + 743, + 3668, + 1510, + 1626, + 5020, + 3567, + 2513, + 3195, + 4115, + 5627, + 2489, + 2991, + 24, + 2065, + 2697, + 1087, + 2719, + 48, + 1634, + 315, + 68, + 985, + 2052, + 198, + 2239, + 1347, + 1107, + 1439, + 597, + 2366, + 2172, + 871, + 3307, + 919, + 2487, + 2790, + 1867, + 236, + 2570, + 1413, + 3794, + 906, + 3365, + 3381, + 1701, + 1982, + 1818, + 1524, + 2924, + 1205, + 616, + 2586, + 2072, + 2004, + 575, + 253, + 3099, + 32, + 1365, + 1182, + 197, + 1714, + 2454, + 1201, + 554, + 3388, + 3224, + 2748, + 756, + 2587, + 250, + 2567, + 1507, + 1517, + 3529, + 1922, + 2761, + 2337, + 3416, + 1961, + 1677, + 2452, + 2238, + 3153, + 615, + 911, + 1506, + 1474, + 2495, + 1265, + 1906, + 2749, + 3756, + 3280, + 2161, + 898, + 2714, + 1759, + 3450, + 2243, + 2444, + 563, + 26, + 3286, + 2266, + 3769, + 3344, + 2707, + 3677, + 611, + 1402, + 531, + 1028, + 2871, + 4548, + 1375, + 261, + 2948, + 835, + 1190, + 4134, + 353, + 840, + 2684, + 1900, + 3082, + 1435, + 2109, + 1207, + 1674, + 329, + 1872, + 2781, + 4055, + 2686, + 2104, + 608, + 3318, + 2423, + 2957, + 2768, + 1108, + 3739, + 3512, + 3271, + 3985, + 2203, + 1771, + 3520, + 1418, + 2054, + 1681, + 1153, + 225, + 1627, + 2929, + 162, + 2050, + 2511, + 3687, + 1954, + 124, + 1859, + 2431, + 1684, + 3032, + 2894, + 585, + 4805, + 3969, + 2869, + 2704, + 2088, + 2032, + 2095, + 3656, + 2635, + 4362, + 2209, + 256, + 518, + 2042, + 2105, + 3777, + 3657, + 643, + 2298, + 1148, + 1779, + 190, + 989, + 3544, + 414, + 11, + 2135, + 2063, + 2979, + 1471, + 403, + 3678, + 126, + 770, + 1563, + 671, + 2499, + 3216, + 2877, + 600, + 1179, + 307, + 2805, + 4937, + 1268, + 1297, + 2694, + 252, + 4032, + 1448, + 1494, + 1331, + 1394, + 127, + 2256, + 222, + 1647, + 1035, + 1481, + 3056, + 1915, + 1048, + 873, + 3651, + 210, + 33, + 1608, + 2516, + 200, + 1520, + 415, + 102, + 0, + 3389, + 1287, + 817, + 91, + 3299, + 2940, + 836, + 1814, + 549, + 2197, + 1396, + 1669, + 2987, + 3582, + 2297, + 2848, + 4528, + 1070, + 687, + 20, + 1819, + 121, + 1552, + 1364, + 1461, + 1968, + 2617, + 3540, + 2824, + 2083, + 177, + 948, + 4938, + 2291, + 110, + 4549, + 2066, + 648, + 3359, + 1755, + 2110, + 2114, + 4642, + 4845, + 1693, + 3937, + 3308, + 1257, + 1869, + 2123, + 208, + 1804, + 3159, + 2992, + 2531, + 2549, + 3361, + 2418, + 1350, + 2347, + 2800, + 2568, + 1291, + 2036, + 2680, + 72, + 842, + 1990, + 212, + 1233, + 1154, + 1586, + 75, + 2027, + 3410, + 4900, + 1823, + 1337, + 2710, + 2676, + 728, + 2810, + 1522, + 3026, + 4995, + 157, + 755, + 1050, + 4022, + 710, + 785, + 1936, + 2194, + 2085, + 1406, + 2777, + 2400, + 150, + 1250, + 4049, + 1206, + 807, + 1910, + 534, + 529, + 3309, + 1721, + 1660, + 274, + 39, + 2827, + 661, + 2670, + 1578, + 925, + 3248, + 3815, + 1094, + 4278, + 4901, + 4252, + 41, + 1150, + 3747, + 2572, + 2227, + 4501, + 3658, + 4902, + 3813, + 3357, + 3617, + 2884, + 2258, + 887, + 538, + 4187, + 3199, + 1294, + 2439, + 3042, + 2329, + 2343, + 2497, + 1255, + 107, + 543, + 1527, + 521, + 3478, + 3568, + 194, + 5062, + 15, + 961, + 3870, + 1241, + 1192, + 2664, + 66, + 5215, + 3260, + 2111, + 1295, + 1127, + 2152, + 3805, + 4135, + 901, + 1164, + 1976, + 398, + 1278, + 530, + 1460, + 748, + 904, + 1054, + 1966, + 1426, + 53, + 2909, + 509, + 523, + 2279, + 1534, + 536, + 1019, + 239, + 1685, + 460, + 2353, + 673, + 1065, + 2401, + 3600, + 4298, + 2272, + 1272, + 2363, + 284, + 1753, + 3679, + 4064, + 1695, + 81, + 815, + 2677, + 2757, + 2731, + 1386, + 859, + 500, + 4221, + 2190, + 2566, + 757, + 1006, + 2519, + 2068, + 1166, + 1455, + 337, + 2654, + 3203, + 1863, + 1682, + 1914, + 3025, + 1252, + 1409, + 1366, + 847, + 714, + 2834, + 2038, + 3209, + 964, + 2970, + 1901, + 885, + 2553, + 1078, + 1756, + 3049, + 301, + 1572, + 3326, + 688, + 2130, + 1996, + 2429, + 1805, + 1648, + 2930, + 3421, + 2750, + 3652, + 3088, + 262, + 1158, + 1254, + 389, + 1641, + 1812, + 526, + 1719, + 923, + 2073, + 1073, + 1902, + 468, + 489, + 4625, + 1140, + 857, + 2375, + 3070, + 3319, + 2863, + 380, + 116, + 1328, + 2693, + 1161, + 2244, + 273, + 1212, + 1884, + 2769, + 3011, + 1775, + 1142, + 461, + 3066, + 1200, + 2147, + 2212, + 790, + 702, + 2695, + 4222, + 1601, + 1058, + 434, + 2338, + 5153, + 3640, + 67, + 2360, + 4099, + 2502, + 618, + 3472, + 1329, + 416, + 1132, + 830, + 2782, + 1807, + 2653, + 3211, + 3510, + 1662, + 192, + 2124, + 296, + 3979, + 1739, + 1611, + 3684, + 23, + 118, + 324, + 446, + 1239, + 1225, + 293, + 2520, + 3814, + 3795, + 2535, + 3116, + 17, + 1074, + 467, + 2692, + 2201, + 387, + 2922, + 45, + 1326, + 3055, + 1645, + 3659, + 2817, + 958, + 243, + 1903, + 2320, + 1339, + 2825, + 1784, + 3289, + 356, + 576, + 865, + 2315, + 2381, + 3377, + 3916, + 1088, + 3122, + 1713, + 1655, + 935, + 628, + 4689, + 1034, + 1327, + 441, + 800, + 720, + 894, + 1979, + 2183, + 1528, + 5289, + 2702, + 1071, + 4046, + 3572, + 2399, + 1571, + 3281, + 79, + 761, + 1103, + 327, + 134, + 758, + 1899, + 1371, + 1615, + 879, + 442, + 215, + 2605, + 2579, + 173, + 2048, + 2485, + 1057, + 2975, + 3317, + 1097, + 2253, + 3801, + 4263, + 1403, + 1650, + 2946, + 814, + 4968, + 3487, + 1548, + 2644, + 1567, + 1285, + 2, + 295, + 2636, + 97, + 946, + 3576, + 832, + 141, + 4257, + 3273, + 760, + 3821, + 3521, + 3156, + 2607, + 949, + 1024, + 1733, + 1516, + 1803, + 1920, + 2125, + 2283, + 2665, + 3180, + 1501, + 2064, + 3560, + 2171, + 1592, + 803, + 3518, + 1416, + 732, + 3897, + 4258, + 1363, + 1362, + 2458, + 119, + 1427, + 602, + 1525, + 2608, + 1605, + 1639, + 3175, + 694, + 3064, + 10, + 465, + 76, + 2000, + 4846, + 4208, + 444, + 3781, + 1619, + 3353, + 2206, + 1273, + 3796, + 740, + 2483, + 320, + 1723, + 2377, + 3660, + 2619, + 1359, + 1137, + 1762, + 1724, + 2345, + 2842, + 1850, + 1862, + 912, + 821, + 1866, + 612, + 2625, + 1735, + 2573, + 3369, + 1093, + 844, + 89, + 937, + 930, + 1424, + 3564, + 2413, + 2972, + 1004, + 3046, + 3019, + 2011, + 711, + 3171, + 1452, + 4178, + 428, + 801, + 1943, + 432, + 445, + 2811, + 206, + 4136, + 1472, + 730, + 349, + 73, + 397, + 2802, + 2547, + 998, + 1637, + 1167, + 789, + 396, + 3217, + 154, + 1218, + 716, + 1120, + 1780, + 2819, + 4826, + 1931, + 3334, + 3762, + 2139, + 1215, + 2627, + 552, + 3664, + 3628, + 3232, + 1405, + 2383, + 3111, + 1356, + 2652, + 3577, + 3320, + 3101, + 1703, + 640, + 1045, + 1370, + 1246, + 4996, + 371, + 1575, + 2436, + 1621, + 2210, + 984, + 4033, + 1734, + 2638, + 16, + 4529, + 663, + 2755, + 3255, + 1451, + 3917, + 2257, + 1253, + 1955, + 2234, + 1263, + 2951, + 214, + 1229, + 617, + 485, + 359, + 1831, + 1969, + 473, + 2310, + 750, + 2058, + 165, + 80, + 2864, + 2419, + 361, + 4344, + 2416, + 2479, + 1134, + 796, + 3726, + 1266, + 2943, + 860, + 2715, + 938, + 390, + 2734, + 1313, + 1384, + 248, + 202, + 877, + 1064, + 2854, + 522, + 3907, + 279, + 1602, + 297, + 2357, + 395, + 3740, + 137, + 2075, + 944, + 4089, + 2584, + 1267, + 3802, + 62, + 1533, + 2285, + 178, + 176, + 780, + 2440, + 201, + 3707, + 590, + 478, + 1560, + 4354, + 2117, + 1075, + 30, + 74, + 4643, + 4004, + 1635, + 1441, + 2745, + 776, + 2596, + 238, + 1077, + 1692, + 1912, + 2844, + 605, + 499, + 1742, + 3947, + 241, + 3053, + 980, + 1749, + 936, + 2640, + 4511, + 2582, + 515, + 1543, + 2162, + 5322, + 2892, + 2993, + 890, + 2148, + 1924, + 665, + 1827, + 3581, + 1032, + 968, + 3163, + 339, + 1044, + 1896, + 270, + 583, + 1791, + 1720, + 4367, + 1194, + 3488, + 3669, + 43, + 2523, + 1657, + 163, + 2167, + 290, + 1209, + 1622, + 3378, + 550, + 634, + 2508, + 2510, + 695, + 2634, + 2384, + 2512, + 1476, + 1414, + 220, + 1469, + 2341, + 2138, + 2852, + 3183, + 2900, + 4939, + 2865, + 3502, + 1211, + 3680, + 854, + 3227, + 1299, + 2976, + 3172, + 186, + 2998, + 1459, + 443, + 1067, + 3251, + 1495, + 321, + 1932, + 3054, + 909, + 753, + 1410, + 1828, + 436, + 2441, + 1119, + 1587, + 3164, + 2186, + 1258, + 227, + 231, + 1425, + 1890, + 3200, + 3942, + 247, + 959, + 725, + 5254, + 2741, + 577, + 2158, + 2079, + 929, + 120, + 174, + 838, + 2813, + 591, + 1115, + 417, + 2024, + 40, + 3240, + 1536, + 1037, + 291, + 4151, + 2354, + 632, + 1298, + 2406, + 2500, + 3535, + 1825, + 1846, + 3451, + 205, + 1171, + 345, + 4238, + 18, + 1163, + 811, + 685, + 2208, + 1217, + 425, + 1312, + 1508, + 1175, + 4308, + 2552, + 1033, + 587, + 1381, + 3059, + 2984, + 3482, + 340, + 1316, + 4023, + 3972, + 792, + 3176, + 519, + 777, + 4690, + 918, + 933, + 4130, + 2981, + 3741, + 90, + 3360, + 2911, + 2200, + 5184, + 4550, + 609, + 3079, + 2030, + 272, + 3379, + 2736, + 363, + 3881, + 1130, + 1447, + 286, + 779, + 357, + 1169, + 3350, + 3137, + 1630, + 1220, + 2687, + 2391, + 747, + 1277, + 3688, + 2618, + 2682, + 2601, + 1156, + 3196, + 5290, + 4034, + 3102, + 1689, + 3596, + 3128, + 874, + 219, + 2783, + 798, + 508, + 1843, + 2461, + 269, + 1658, + 1776, + 1392, + 1913, + 2983, + 3287, + 2866, + 2159, + 2372, + 829, + 4076, + 46, + 4253, + 2873, + 1889, + 1894, + 915, + 1834, + 1631, + 2181, + 2318, + 298, + 664, + 2818, + 3555, + 2735, + 954, + 3228, + 3117, + 527, + 3511, + 2173, + 681, + 2712, + 3033, + 2247, + 2346, + 3467, + 1652, + 155, + 2164, + 3382, + 113, + 1994, + 450, + 899, + 494, + 994, + 1237, + 2958, + 1875, + 2336, + 1926, + 3727, + 545, + 1577, + 1550, + 633, + 3473, + 204, + 1305, + 3072, + 2410, + 1956, + 2471, + 707, + 2134, + 841, + 2195, + 2196, + 2663, + 3843, + 1026, + 4940, + 990, + 3252, + 4997, + 368, + 1092, + 437, + 3212, + 3258, + 1933, + 1829, + 675, + 2977, + 2893, + 412, + 943, + 3723, + 4644, + 3294, + 3283, + 2230, + 2373, + 5154, + 2389, + 2241, + 2661, + 2323, + 1404, + 2524, + 593, + 787, + 677, + 3008, + 1275, + 2059, + 438, + 2709, + 2609, + 2240, + 2269, + 2246, + 1446, + 36, + 1568, + 1373, + 3892, + 1574, + 2301, + 1456, + 3962, + 693, + 2276, + 5216, + 2035, + 1143, + 2720, + 1919, + 1797, + 1811, + 2763, + 4137, + 2597, + 1830, + 1699, + 1488, + 1198, + 2090, + 424, + 1694, + 312, + 3634, + 3390, + 4179, + 3335, + 2252, + 1214, + 561, + 1059, + 3243, + 2295, + 2561, + 975, + 5155, + 2321, + 2751, + 3772, + 472, + 1537, + 3282, + 3398, + 1047, + 2077, + 2348, + 2878, + 1323, + 3340, + 3076, + 690, + 2906, + 51, + 369, + 170, + 3541, + 1060, + 2187, + 2688, + 3670, + 2541, + 1083, + 1683, + 928, + 3918, + 459, + 109, + 4427, + 599, + 3744, + 4286, + 143, + 2101, + 2730, + 2490, + 82, + 1588, + 3036, + 2121, + 281, + 1860, + 477, + 4035, + 1238, + 2812, + 3020, + 2716, + 3312, + 1530, + 2188, + 2055, + 1317, + 843, + 636, + 1808, + 1173, + 3495, + 649, + 181, + 1002, + 147, + 3641, + 1159, + 2414, + 3750, + 2289, + 2795, + 813, + 3123, + 2610, + 1136, + 4368, + 5, + 3391, + 4541, + 2174, + 420, + 429, + 1728, + 754, + 1228, + 2115, + 2219, + 347, + 2223, + 2733, + 735, + 1518, + 3003, + 2355, + 3134, + 1764, + 3948, + 3329, + 1888, + 2424, + 1001, + 1234, + 1972, + 3321, + 3363, + 1672, + 1021, + 1450, + 1584, + 226, + 765, + 655, + 2526, + 3404, + 3244, + 2302, + 3665, + 731, + 594, + 2184, + 319, + 1576, + 621, + 658, + 2656, + 4299, + 2099, + 3864, + 1279, + 2071, + 2598, + 2739, + 795, + 3086, + 3699, + 3908, + 1707, + 2352, + 2402, + 1382, + 3136, + 2475, + 1465, + 4847, + 3496, + 3865, + 1085, + 3004, + 2591, + 1084, + 213, + 2287, + 1963, + 3565, + 2250, + 822, + 793, + 4574, + 3187, + 1772, + 1789, + 3050, + 595, + 1484, + 1959, + 2770, + 1080, + 2650, + 456, + 422, + 2996, + 940, + 3322, + 4328, + 4345, + 3092, + 2742, + 965, + 2784, + 739, + 4124, + 952, + 1358, + 2498, + 2949, + 2565, + 332, + 2698, + 2378, + 660, + 2260, + 2473, + 4194, + 3856, + 2919, + 535, + 1260, + 2651, + 1208, + 1428, + 1300, + 1949, + 1303, + 2942, + 433, + 2455, + 2450, + 1251, + 1946, + 614, + 1269, + 641, + 1306, + 1810, + 2737, + 3078, + 2912, + 564, + 2365, + 1419, + 1415, + 1497, + 4460, + 2367, + 2185, + 1379, + 3005, + 1307, + 3218, + 2175, + 1897, + 3063, + 682, + 1157, + 4040, + 4005, + 1712, + 1160, + 1941, + 1399, + 394, + 402, + 2952, + 1573, + 1151, + 2986, + 2404, + 862, + 299, + 2033, + 1489, + 3006, + 346, + 171, + 2886, + 3401, + 1726, + 2932, + 168, + 2533, + 47, + 2507, + 1030, + 3735, + 1145, + 3370, + 1395, + 1318, + 1579, + 3609, + 4560, + 2857, + 4116, + 1457, + 2529, + 1965, + 504, + 1036, + 2690, + 2988, + 2405, + 745, + 5871, + 849, + 2397, + 2056, + 3081, + 863, + 2359, + 3857, + 2096, + 99, + 1397, + 1769, + 2300, + 4428, + 1643, + 3455, + 1978, + 1757, + 3718, + 1440, + 35, + 4879, + 3742, + 1296, + 4228, + 2280, + 160, + 5063, + 1599, + 2013, + 166, + 520, + 3479, + 1646, + 3345, + 3012, + 490, + 1937, + 1545, + 1264, + 2182, + 2505, + 1096, + 1188, + 1369, + 1436, + 2421, + 1667, + 2792, + 2460, + 1270, + 2122, + 727, + 3167, + 2143, + 806, + 1706, + 1012, + 1800, + 3037, + 960, + 2218, + 1882, + 805, + 139, + 2456, + 1139, + 1521, + 851, + 1052, + 3093, + 3089, + 342, + 2039, + 744, + 5097, + 1468, + 1502, + 1585, + 2087, + 223, + 939, + 326, + 2140, + 2577, + 892, + 2481, + 1623, + 4077, + 982, + 3708, + 135, + 2131, + 87, + 2503, + 3114, + 2326, + 1106, + 876, + 1616, + 547, + 2997, + 2831, + 2093, + 3441, + 4530, + 4314, + 9, + 3256, + 4229, + 4148, + 659, + 1462, + 1986, + 1710, + 2046, + 2913, + 2231, + 4090, + 4880, + 5255, + 3392, + 3274, + 1368, + 3689, + 4645, + 1477, + 705, + 3384, + 3635, + 1068, + 1529, + 2941, + 1458, + 3782, + 1509, + 100, + 1656, + 2548, + 718, + 2339, + 408, + 1590, + 2780, + 3548, + 1838, + 4117, + 3719, + 1345, + 3530, + 717, + 3442, + 2778, + 3220, + 2898, + 1892, + 4590, + 3614, + 3371, + 2043, + 1998, + 1224, + 3483, + 891, + 635, + 584, + 2559, + 3355, + 733, + 1766, + 1729, + 1172, + 3789, + 1891, + 2307, + 781, + 2982, + 2271, + 1957, + 1580, + 5773, + 2633, + 2005, + 4195, + 3097, + 1535, + 3213, + 1189, + 1934, + 5693, + 3262, + 586, + 3118, + 1324, + 1598, + 517, + 1564, + 2217, + 1868, + 1893, + 4445, + 3728, + 2703, + 3139, + 1526, + 1787, + 1992, + 3882, + 2875, + 1549, + 1199, + 1056, + 2224, + 1904, + 2711, + 5098, + 4287, + 338, + 1993, + 3129, + 3489, + 2689, + 1809, + 2815, + 1997, + 957, + 1855, + 3898, + 2550, + 3275, + 3057, + 1105, + 1319, + 627, + 1505, + 1911, + 1883, + 3526, + 698, + 3629, + 3456, + 1833, + 1431, + 746, + 77, + 1261, + 2017, + 2296, + 1977, + 1885, + 125, + 1334, + 1600, + 525, + 1798, + 1109, + 2222, + 1470, + 1945, + 559, + 2236, + 1186, + 3443, + 2476, + 1929, + 1411, + 2411, + 3135, + 1777, + 3372, + 2621, + 1841, + 1613, + 3229, + 668, + 1430, + 1839, + 2643, + 2916, + 195, + 1989, + 2671, + 2358, + 1387, + 629, + 3205, + 2293, + 5256, + 4439, + 123, + 1310, + 888, + 1879, + 4300, + 3021, + 3605, + 1003, + 1162, + 3192, + 2910, + 2010, + 140, + 2395, + 2859, + 55, + 1082, + 2012, + 2901, + 662, + 419, + 2081, + 1438, + 680, + 2774, + 4654, + 3912, + 1620, + 1731, + 1625, + 5035, + 4065, + 2328, + 512, + 1344, + 802, + 5443, + 2163, + 2311, + 2537, + 524, + 3399, + 98, + 1155, + 2103, + 1918, + 2606, + 3925, + 2816, + 1393, + 2465, + 1504, + 3773, + 2177, + 3963, + 1478, + 4346, + 180, + 1113, + 4655, + 3461, + 2028, + 1698, + 833, + 2696, + 1235, + 1322, + 1594, + 4408, + 3623, + 3013, + 3225, + 2040, + 3022, + 541, + 2881, + 607, + 3632, + 2029, + 1665, + 1219, + 639, + 1385, + 1686, + 1099, + 2803, + 3231, + 1938, + 3188, + 2858, + 427, + 676, + 2772, + 1168, + 2025, + 454, + 3253, + 2486, + 3556, + 230, + 1950, + 580, + 791, + 1991, + 1280, + 1086, + 1974, + 2034, + 630, + 257, + 3338, + 2788, + 4903, + 1017, + 86, + 4790, + 966, + 2789, + 1995, + 1696, + 1131, + 259, + 3095, + 4188, + 1308, + 179, + 1463, + 5257, + 289, + 4107, + 1248, + 42, + 3413, + 1725, + 2288, + 896, + 1947, + 774, + 4474, + 4254, + 604, + 3430, + 4264, + 392, + 2514, + 2588, + 452, + 237, + 1408, + 3018, + 988, + 4531, + 1970, + 3034, + 3310, + 540, + 2370, + 1562, + 1288, + 2990, + 502, + 4765, + 1147, + 4, + 1853, + 2708, + 207, + 294, + 2814, + 4078, + 2902, + 2509, + 684, + 34, + 3105, + 3532, + 2551, + 644, + 709, + 2801, + 2344, + 573, + 1727, + 3573, + 3557, + 2021, + 1081, + 3100, + 4315, + 2100, + 3681, + 199, + 2263, + 1837, + 2385, + 146, + 3484, + 1195, + 2776, + 3949, + 997, + 1939, + 3973, + 1008, + 1091, + 1202, + 1962, + 1847, + 1149, + 4209, + 5444, + 1076, + 493, + 117, + 5400, + 2521, + 972, + 1490, + 2934, + 1796, + 4542, + 2374, + 1512, + 2933, + 2657, + 413, + 2888, + 1135, + 2762, + 2314, + 2156, + 1355, + 2369, + 766, + 2007, + 2527, + 2170, + 3124, + 2491, + 2593, + 2632, + 4757, + 2437, + 234, + 3125, + 3591, + 1898, + 1750, + 1376, + 1942, + 3468, + 3138, + 570, + 2127, + 2145, + 3276, + 4131, + 962, + 132, + 1445, + 4196, + 19, + 941, + 3624, + 3480, + 3366, + 1973, + 1374, + 4461, + 3431, + 2629, + 283, + 2415, + 2275, + 808, + 2887, + 3620, + 2112, + 2563, + 1353, + 3610, + 955, + 1089, + 3103, + 1053, + 96, + 88, + 4097, + 823, + 3808, + 1583, + 399, + 292, + 4091, + 3313, + 421, + 1128, + 642, + 4006, + 903, + 2539, + 1877, + 2082, + 596, + 29, + 4066, + 1790, + 722, + 2157, + 130, + 995, + 1569, + 769, + 1485, + 464, + 513, + 2213, + 288, + 1923, + 1101, + 2453, + 4316, + 133, + 486, + 2445, + 50, + 625, + 487, + 2207, + 57, + 423, + 481, + 2962, + 159, + 3729, + 1558, + 491, + 303, + 482, + 501, + 240, + 2837, + 112, + 3648, + 2392, + 1783, + 362, + 8, + 3433, + 3422, + 610, + 2793, + 3277, + 1390, + 1284, + 1654, + 21, + 3823, + 734, + 367, + 623, + 193, + 287, + 374, + 1009, + 1483, + 816, + 476, + 313, + 2255, + 2340, + 1262, + 2150, + 2899, + 1146, + 2581, + 782, + 2116, + 1659, + 2018, + 1880, + 255, + 3586, + 3314, + 1110, + 2867, + 2137, + 2564, + 986, + 2767, + 5185, + 2006, + 650, + 158, + 926, + 762, + 881, + 3157, + 2717, + 2362, + 3587, + 306, + 3690, + 3245, + 1542, + 3077, + 2427, + 1691, + 2478, + 2118, + 2985, + 3490, + 2438, + 539, + 2305, + 983, + 129, + 1754, + 355, + 4201, + 2386, + 827, + 2923, + 104, + 1773, + 2838, + 2771, + 411, + 2905, + 3919, + 376, + 767, + 122, + 1114, + 828, + 2422, + 1817, + 3506, + 266, + 3460, + 1007, + 1609, + 4998, + 945, + 2612, + 4429, + 2274, + 726, + 1247, + 1964, + 2914, + 2199, + 2070, + 4002, + 4108, + 657, + 3323, + 1422, + 579, + 455, + 2764, + 4737, + 1222, + 2895, + 1670, + 824, + 1223, + 1487, + 2525, + 558, + 861, + 3080, + 598, + 2659, + 2515, + 1967, + 752, + 2583, + 2376, + 2214, + 4180, + 977, + 704, + 2464, + 4999, + 2622, + 4109, + 1210, + 2961, + 819, + 1541, + 142, + 2284, + 44, + 418, + 457, + 1126, + 3730, + 4347, + 4626, + 1644, + 1876, + 3671, + 1864, + 302, + 1063, + 5694, + 624, + 723, + 1984, + 3745, + 1314, + 1676, + 2488, + 1610, + 1449, + 3558, + 3569, + 2166, + 2098, + 409, + 1011, + 2325, + 3704, + 2306, + 818, + 1732, + 1383, + 1824, + 1844, + 3757, + 999, + 2705, + 3497, + 1216, + 1423, + 2683, + 2426, + 2954, + 2501, + 2726, + 2229, + 1475, + 2554, + 5064, + 1971, + 1794, + 1666, + 2014, + 1343, + 783, + 724, + 191, + 2434, + 1354, + 2220, + 5065, + 1763, + 2752, + 2472, + 4152, + 131, + 175, + 2885, + 3434, + 92, + 1466, + 4920, + 2616, + 3871, + 3872, + 3866, + 128, + 1551, + 1632, + 669, + 1854, + 3682, + 4691, + 4125, + 1230, + 188, + 2973, + 3290, + 1302, + 1213, + 560, + 3266, + 917, + 763, + 3909, + 3249, + 1760, + 868, + 1958, + 764, + 1782, + 2097, + 145, + 2277, + 3774, + 4462, + 64, + 1491, + 3062, + 971, + 2132, + 3606, + 2442, + 221, + 1226, + 1617, + 218, + 323, + 1185, + 3207, + 3147, + 571, + 619, + 1473, + 1005, + 1744, + 2281, + 449, + 1887, + 2396, + 3685, + 275, + 375, + 3816, + 1743, + 3844, + 3731, + 845, + 1983, + 2350, + 4210, + 1377, + 773, + 967, + 3499, + 3052, + 3743, + 2725, + 4007, + 1697, + 1022, + 3943, + 1464, + 3264, + 2855, + 2722, + 1952, + 1029, + 2839, + 2467, + 84, + 4383, + 2215, + 820, + 1391, + 2015, + 2448, + 3672, + 377, + 1948, + 2168, + 797, + 2545, + 3536, + 2578, + 2645, + 94, + 2874, + 1678, + 405, + 1259, + 3071, + 771, + 546, + 1315, + 470, + 1243, + 3083, + 895, + 2468, + 981, + 969, + 2037, + 846, + 4181, + 653, + 1276, + 2928, + 14, + 2594, + 557, + 3007, + 2474, + 156, + 902, + 1338, + 1740, + 2574, + 537, + 2518, + 973, + 2282, + 2216, + 2433, + 1928, + 138, + 2903, + 1293, + 2631, + 1612, + 646, + 3457, + 839, + 2935, + 111, + 496, + 2191, + 2847, + 589, + 3186, + 149, + 3994, + 2060, + 4031, + 2641, + 4067, + 3145, + 1870, + 37, + 3597, + 2136, + 1025, + 2051, + 3009, + 3383, + 3549, + 1121, + 1016, + 3261, + 1301, + 251, + 2446, + 2599, + 2153, + 872, + 3246, + 637, + 334, + 3705, + 831, + 884, + 921, + 3065, + 3140, + 4092, + 2198, + 1944, + 246, + 2964, + 108, + 2045, + 1152, + 1921, + 2308, + 1031, + 203, + 3173, + 4170, + 1907, + 3890, + 810, + 1401, + 2003, + 1690, + 506, + 647, + 1242, + 2828, + 1761, + 1649, + 3208, + 2249, + 1589, + 3709, + 2931, + 5156, + 1708, + 498, + 666, + 2613, + 834, + 3817, + 1231, + 184, + 2851, + 1124, + 883, + 3197, + 2261, + 3710, + 1765, + 1553, + 2658, + 1178, + 2639, + 2351, + 93, + 1193, + 942, + 2538, + 2141, + 4402, + 235, + 1821, + 870, + 1591, + 2192, + 1709, + 1871, + 3341, + 1618, + 4126, + 2595, + 2334, + 603, + 651, + 69, + 701, + 268, + 2662, + 3411, + 2555, + 1380, + 1606, + 503, + 448, + 254, + 2371, + 2646, + 574, + 1187, + 2309, + 1770, + 322, + 2235, + 1292, + 1801, + 305, + 566, + 1133, + 229, + 2067, + 2057, + 706, + 167, + 483, + 2002, + 2672, + 3295, + 1820, + 3561, + 3067, + 316, + 378, + 2746, + 3452, + 1112, + 136, + 1981, + 507, + 1651, + 2917, + 1117, + 285, + 4591, + 182, + 2580, + 3522, + 1304, + 335, + 3303, + 1835, + 2504, + 1795, + 1792, + 2248, + 674, + 1018, + 2106, + 2449, + 1857, + 2292, + 2845, + 976, + 3047, + 1781, + 2600, + 2727, + 1389, + 1281, + 52, + 3152, + 153, + 265, + 3950, + 672, + 3485, + 3951, + 4463, + 430, + 1183, + 365, + 278, + 2169, + 27, + 1407, + 1336, + 2304, + 209, + 1340, + 1730, + 2202, + 1852, + 2403, + 2883, + 979, + 1737, + 1062, + 631, + 2829, + 2542, + 3876, + 2592, + 825, + 2086, + 2226, + 3048, + 3625, + 352, + 1417, + 3724, + 542, + 991, + 431, + 1351, + 3938, + 1861, + 2294, + 826, + 1361, + 2927, + 3142, + 3503, + 1738, + 463, + 2462, + 2723, + 582, + 1916, + 1595, + 2808, + 400, + 3845, + 3891, + 2868, + 3621, + 2254, + 58, + 2492, + 1123, + 910, + 2160, + 2614, + 1372, + 1603, + 1196, + 1072, + 3385, + 1700, + 3267, + 1980, + 696, + 480, + 2430, + 920, + 799, + 1570, + 2920, + 1951, + 2041, + 4047, + 2540, + 1321, + 4223, + 2469, + 3562, + 2228, + 1271, + 2602, + 401, + 2833, + 3351, + 2575, + 5157, + 907, + 2312, + 1256, + 410, + 263, + 3507, + 1582, + 996, + 678, + 1849, + 2316, + 1480, + 908, + 3545, + 2237, + 703, + 2322, + 667, + 1826, + 2849, + 1531, + 2604, + 2999, + 2407, + 3146, + 2151, + 2630, + 1786, + 3711, + 469, + 3542, + 497, + 3899, + 2409, + 858, + 837, + 4446, + 3393, + 1274, + 786, + 620, + 1845, + 2001, + 3311, + 484, + 308, + 3367, + 1204, + 1815, + 3691, + 2332, + 1532, + 2557, + 1842, + 2020, + 2724, + 1927, + 2333, + 4440, + 567, + 22, + 1673, + 2728, + 4475, + 1987, + 1858, + 1144, + 1597, + 101, + 1832, + 3601, + 12, + 974, + 3783, + 4391, + 951, + 1412, + 1, + 3720, + 453, + 4608, + 4041, + 528, + 1041, + 1027, + 3230, + 2628, + 1129, + 875, + 1051, + 3291, + 1203, + 2262, + 1069, + 2860, + 2799, + 2149, + 2615, + 3278, + 144, + 1758, + 3040, + 31, + 475, + 1680, + 366, + 2685, + 3184, + 311, + 1642, + 4008, + 2466, + 5036, + 1593, + 1493, + 2809, + 216, + 1420, + 1668, + 233, + 304, + 2128, + 3284, + 232, + 1429, + 1768, + 1040, + 2008, + 3407, + 2740, + 2967, + 2543, + 242, + 2133, + 778, + 1565, + 2022, + 2620, + 505, + 2189, + 2756, + 1098, + 2273, + 372, + 1614, + 708, + 553, + 2846, + 2094, + 2278, + 169, + 3626, + 2835, + 4161, + 228, + 2674, + 3165, + 809, + 1454, + 1309, + 466, + 1705, + 1095, + 900, + 3423, + 880, + 2667, + 3751, + 5258, + 2317, + 3109, + 2571, + 4317, + 2766, + 1503, + 1342, + 866, + 4447, + 1118, + 63, + 2076, + 314, + 1881, + 1348, + 1061, + 172, + 978, + 3515, + 1747, + 532, + 511, + 3970, + 6, + 601, + 905, + 2699, + 3300, + 1751, + 276, + 1467, + 3725, + 2668, + 65, + 4239, + 2544, + 2779, + 2556, + 1604, + 578, + 2451, + 1802, + 992, + 2331, + 2624, + 1320, + 3446, + 713, + 1513, + 1013, + 103, + 2786, + 2447, + 1661, + 886, + 1702, + 916, + 654, + 3574, + 2031, + 1556, + 751, + 2178, + 2821, + 2179, + 1498, + 1538, + 2176, + 271, + 914, + 2251, + 2080, + 1325, + 638, + 1953, + 2937, + 3877, + 2432, + 2754, + 95, + 3265, + 1716, + 260, + 1227, + 4083, + 775, + 106, + 1357, + 3254, + 426, + 1607, + 555, + 2480, + 772, + 1985, + 244, + 2546, + 474, + 495, + 1046, + 2611, + 1851, + 2061, + 71, + 2089, + 1675, + 2590, + 742, + 3758, + 2843, + 3222, + 1433, + 267, + 2180, + 2576, + 2826, + 2233, + 2092, + 3913, + 2435, + 956, + 1745, + 3075, + 856, + 2113, + 1116, + 451, + 3, + 1988, + 2896, + 1398, + 993, + 2463, + 1878, + 2049, + 1341, + 2718, + 2721, + 2870, + 2108, + 712, + 2904, + 4363, + 2753, + 2324, + 277, + 2872, + 2349, + 2649, + 384, + 987, + 435, + 691, + 3000, + 922, + 164, + 3939, + 652, + 1500, + 1184, + 4153, + 2482, + 3373, + 2165, + 4848, + 2335, + 3775, + 3508, + 3154, + 2806, + 2830, + 1554, + 2102, + 1664, + 2530, + 1434, + 2408, + 893, + 1547, + 2623, + 3447, + 2832, + 2242, + 2532, + 3169, + 2856, + 3223, + 2078, + 49, + 3770, + 3469, + 462, + 318, + 656, + 2259, + 3250, + 3069, + 679, + 1629, + 2758, + 344, + 1138, + 1104, + 3120, + 1836, + 1283, + 3115, + 2154, + 1437, + 4448, + 934, + 759, + 1999, + 794, + 2862, + 1038, + 533, + 2560, + 1722, + 2342, + 855, + 2626, + 1197, + 1663, + 4476, + 3127, + 85, + 4240, + 2528, + 25, + 1111, + 1181, + 3673, + 407, + 3470, + 4561, + 2679, + 2713, + 768, + 1925, + 2841, + 3986, + 1544, + 1165, + 932, + 373, + 1240, + 2146, + 1930, + 2673, + 721, + 4766, + 354, + 4333, + 391, + 2963, + 187, + 61, + 3364, + 1442, + 1102, + 330, + 1940, + 1767, + 341, + 3809, + 4118, + 393, + 2496, + 2062, + 2211, + 105, + 331, + 300, + 439, + 913, + 1332, + 626, + 379, + 3304, + 1557, + 328, + 689, + 3952, + 309, + 1555, + 931, + 317, + 2517, + 3027, + 325, + 569, + 686, + 2107, + 3084, + 60, + 1042, + 1333, + 2794, + 264, + 3177, + 4014, + 1628, + 258, + 3712, + 7, + 4464, + 1176, + 1043, + 1778, + 683, + 114, + 1975, + 78, + 1492, + 383, + 1886, + 510, + 386, + 645, + 5291, + 2891, + 2069, + 3305, + 4138, + 3867, + 2939, + 2603, + 2493, + 1935, + 1066, + 1848, + 3588, + 1015, + 1282, + 1289, + 4609, + 697, + 1453, + 3044, + 2666, + 3611, + 1856, + 2412, + 54, + 719, + 1330, + 568, + 3778, + 2459, + 1748, + 788, + 492, + 551, + 1191, + 1000, + 488, + 3394, + 3763, + 282, + 1799, + 348, + 2016, + 1523, + 3155, + 2390, + 1049, + 382, + 2019, + 1788, + 1170, + 729, + 2968, + 3523, + 897, + 3926, + 2785, + 2938, + 3292, + 350, + 2319, + 3238, + 1718, + 1717, + 2655, + 3453, + 3143, + 4465, + 161, + 2889, + 2980, + 2009, + 1421, + 56, + 1908, + 1640, + 2387, + 2232, + 1917, + 1874, + 2477, + 4921, + 148, + 83, + 3438, + 592, + 4245, + 2882, + 1822, + 1055, + 741, + 115, + 1496, + 1624, + 381, + 1638, + 4592, + 1020, + 516, + 3214, + 458, + 947, + 4575, + 1432, + 211, + 1514, + 2926, + 1865, + 2142, + 189, + 852, + 1221, + 1400, + 1486, + 882, + 2299, + 4036, + 351, + 28, + 1122, + 700, + 6479, + 6480, + 6481, + 6482, + 6483, # last 512 ) - diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/gb2312prober.py b/src/fetchcode/vcs/pip/_vendor/chardet/gb2312prober.py index 8446d2dd..d1de5c6b 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/gb2312prober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/gb2312prober.py @@ -30,6 +30,7 @@ from .chardistribution import GB2312DistributionAnalysis from .mbcssm import GB2312_SM_MODEL + class GB2312Prober(MultiByteCharSetProber): def __init__(self): super(GB2312Prober, self).__init__() diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/hebrewprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/hebrewprober.py index b0e1bf49..1f5dfbe5 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/hebrewprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/hebrewprober.py @@ -125,18 +125,19 @@ # model probers scores. The answer is returned in the form of the name of the # charset identified, either "windows-1255" or "ISO-8859-8". + class HebrewProber(CharSetProber): # windows-1255 / ISO-8859-8 code points of interest - FINAL_KAF = 0xea - NORMAL_KAF = 0xeb - FINAL_MEM = 0xed - NORMAL_MEM = 0xee - FINAL_NUN = 0xef - NORMAL_NUN = 0xf0 - FINAL_PE = 0xf3 - NORMAL_PE = 0xf4 - FINAL_TSADI = 0xf5 - NORMAL_TSADI = 0xf6 + FINAL_KAF = 0xEA + NORMAL_KAF = 0xEB + FINAL_MEM = 0xED + NORMAL_MEM = 0xEE + FINAL_NUN = 0xEF + NORMAL_NUN = 0xF0 + FINAL_PE = 0xF3 + NORMAL_PE = 0xF4 + FINAL_TSADI = 0xF5 + NORMAL_TSADI = 0xF6 # Minimum Visual vs Logical final letter score difference. # If the difference is below this, don't rely solely on the final letter score @@ -167,8 +168,8 @@ def reset(self): # The two last characters seen in the previous buffer, # mPrev and mBeforePrev are initialized to space in order to simulate # a word delimiter at the beginning of the data - self._prev = ' ' - self._before_prev = ' ' + self._prev = " " + self._before_prev = " " # These probers are owned by the group prober. def set_model_probers(self, logicalProber, visualProber): @@ -176,8 +177,13 @@ def set_model_probers(self, logicalProber, visualProber): self._visual_prober = visualProber def is_final(self, c): - return c in [self.FINAL_KAF, self.FINAL_MEM, self.FINAL_NUN, - self.FINAL_PE, self.FINAL_TSADI] + return c in [ + self.FINAL_KAF, + self.FINAL_MEM, + self.FINAL_NUN, + self.FINAL_PE, + self.FINAL_TSADI, + ] def is_non_final(self, c): # The normal Tsadi is not a good Non-Final letter due to words like @@ -190,8 +196,7 @@ def is_non_final(self, c): # for example legally end with a Non-Final Pe or Kaf. However, the # benefit of these letters as Non-Final letters outweighs the damage # since these words are quite rare. - return c in [self.NORMAL_KAF, self.NORMAL_MEM, - self.NORMAL_NUN, self.NORMAL_PE] + return c in [self.NORMAL_KAF, self.NORMAL_MEM, self.NORMAL_NUN, self.NORMAL_PE] def feed(self, byte_str): # Final letter analysis for logical-visual decision. @@ -227,9 +232,9 @@ def feed(self, byte_str): byte_str = self.filter_high_byte_only(byte_str) for cur in byte_str: - if cur == ' ': + if cur == " ": # We stand on a space - a word just ended - if self._before_prev != ' ': + if self._before_prev != " ": # next-to-last char was not a space so self._prev is not a # 1 letter word if self.is_final(self._prev): @@ -241,8 +246,11 @@ def feed(self, byte_str): self._final_char_visual_score += 1 else: # Not standing on a space - if ((self._before_prev == ' ') and - (self.is_final(self._prev)) and (cur != ' ')): + if ( + (self._before_prev == " ") + and (self.is_final(self._prev)) + and (cur != " ") + ): # case (3) [-2:space][-1:final letter][cur:not space] self._final_char_visual_score += 1 self._before_prev = self._prev @@ -263,8 +271,9 @@ def charset_name(self): return self.VISUAL_HEBREW_NAME # It's not dominant enough, try to rely on the model scores instead. - modelsub = (self._logical_prober.get_confidence() - - self._visual_prober.get_confidence()) + modelsub = ( + self._logical_prober.get_confidence() - self._visual_prober.get_confidence() + ) if modelsub > self.MIN_MODEL_DISTANCE: return self.LOGICAL_HEBREW_NAME if modelsub < -self.MIN_MODEL_DISTANCE: @@ -281,12 +290,13 @@ def charset_name(self): @property def language(self): - return 'Hebrew' + return "Hebrew" @property def state(self): # Remain active as long as any of the model probers are active. - if (self._logical_prober.state == ProbingState.NOT_ME) and \ - (self._visual_prober.state == ProbingState.NOT_ME): + if (self._logical_prober.state == ProbingState.NOT_ME) and ( + self._visual_prober.state == ProbingState.NOT_ME + ): return ProbingState.NOT_ME return ProbingState.DETECTING diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/jisfreq.py b/src/fetchcode/vcs/pip/_vendor/chardet/jisfreq.py index 83fc082b..b8f815ae 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/jisfreq.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/jisfreq.py @@ -47,279 +47,4372 @@ JIS_TABLE_SIZE = 4368 JIS_CHAR_TO_FREQ_ORDER = ( - 40, 1, 6, 182, 152, 180, 295,2127, 285, 381,3295,4304,3068,4606,3165,3510, # 16 -3511,1822,2785,4607,1193,2226,5070,4608, 171,2996,1247, 18, 179,5071, 856,1661, # 32 -1262,5072, 619, 127,3431,3512,3230,1899,1700, 232, 228,1294,1298, 284, 283,2041, # 48 -2042,1061,1062, 48, 49, 44, 45, 433, 434,1040,1041, 996, 787,2997,1255,4305, # 64 -2108,4609,1684,1648,5073,5074,5075,5076,5077,5078,3687,5079,4610,5080,3927,3928, # 80 -5081,3296,3432, 290,2285,1471,2187,5082,2580,2825,1303,2140,1739,1445,2691,3375, # 96 -1691,3297,4306,4307,4611, 452,3376,1182,2713,3688,3069,4308,5083,5084,5085,5086, # 112 -5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102, # 128 -5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,4097,5113,5114,5115,5116,5117, # 144 -5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133, # 160 -5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149, # 176 -5150,5151,5152,4612,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164, # 192 -5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,1472, 598, 618, 820,1205, # 208 -1309,1412,1858,1307,1692,5176,5177,5178,5179,5180,5181,5182,1142,1452,1234,1172, # 224 -1875,2043,2149,1793,1382,2973, 925,2404,1067,1241, 960,1377,2935,1491, 919,1217, # 240 -1865,2030,1406,1499,2749,4098,5183,5184,5185,5186,5187,5188,2561,4099,3117,1804, # 256 -2049,3689,4309,3513,1663,5189,3166,3118,3298,1587,1561,3433,5190,3119,1625,2998, # 272 -3299,4613,1766,3690,2786,4614,5191,5192,5193,5194,2161, 26,3377, 2,3929, 20, # 288 -3691, 47,4100, 50, 17, 16, 35, 268, 27, 243, 42, 155, 24, 154, 29, 184, # 304 - 4, 91, 14, 92, 53, 396, 33, 289, 9, 37, 64, 620, 21, 39, 321, 5, # 320 - 12, 11, 52, 13, 3, 208, 138, 0, 7, 60, 526, 141, 151,1069, 181, 275, # 336 -1591, 83, 132,1475, 126, 331, 829, 15, 69, 160, 59, 22, 157, 55,1079, 312, # 352 - 109, 38, 23, 25, 10, 19, 79,5195, 61, 382,1124, 8, 30,5196,5197,5198, # 368 -5199,5200,5201,5202,5203,5204,5205,5206, 89, 62, 74, 34,2416, 112, 139, 196, # 384 - 271, 149, 84, 607, 131, 765, 46, 88, 153, 683, 76, 874, 101, 258, 57, 80, # 400 - 32, 364, 121,1508, 169,1547, 68, 235, 145,2999, 41, 360,3027, 70, 63, 31, # 416 - 43, 259, 262,1383, 99, 533, 194, 66, 93, 846, 217, 192, 56, 106, 58, 565, # 432 - 280, 272, 311, 256, 146, 82, 308, 71, 100, 128, 214, 655, 110, 261, 104,1140, # 448 - 54, 51, 36, 87, 67,3070, 185,2618,2936,2020, 28,1066,2390,2059,5207,5208, # 464 -5209,5210,5211,5212,5213,5214,5215,5216,4615,5217,5218,5219,5220,5221,5222,5223, # 480 -5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,3514,5237,5238, # 496 -5239,5240,5241,5242,5243,5244,2297,2031,4616,4310,3692,5245,3071,5246,3598,5247, # 512 -4617,3231,3515,5248,4101,4311,4618,3808,4312,4102,5249,4103,4104,3599,5250,5251, # 528 -5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267, # 544 -5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283, # 560 -5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299, # 576 -5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315, # 592 -5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331, # 608 -5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347, # 624 -5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363, # 640 -5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379, # 656 -5380,5381, 363, 642,2787,2878,2788,2789,2316,3232,2317,3434,2011, 165,1942,3930, # 672 -3931,3932,3933,5382,4619,5383,4620,5384,5385,5386,5387,5388,5389,5390,5391,5392, # 688 -5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408, # 704 -5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424, # 720 -5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440, # 736 -5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456, # 752 -5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472, # 768 -5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488, # 784 -5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504, # 800 -5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520, # 816 -5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536, # 832 -5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552, # 848 -5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568, # 864 -5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584, # 880 -5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600, # 896 -5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616, # 912 -5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632, # 928 -5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648, # 944 -5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664, # 960 -5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680, # 976 -5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696, # 992 -5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712, # 1008 -5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728, # 1024 -5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744, # 1040 -5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760, # 1056 -5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776, # 1072 -5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792, # 1088 -5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808, # 1104 -5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824, # 1120 -5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840, # 1136 -5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856, # 1152 -5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872, # 1168 -5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888, # 1184 -5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904, # 1200 -5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, # 1216 -5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936, # 1232 -5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952, # 1248 -5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968, # 1264 -5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984, # 1280 -5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000, # 1296 -6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016, # 1312 -6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032, # 1328 -6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048, # 1344 -6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064, # 1360 -6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080, # 1376 -6081,6082,6083,6084,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096, # 1392 -6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112, # 1408 -6113,6114,2044,2060,4621, 997,1235, 473,1186,4622, 920,3378,6115,6116, 379,1108, # 1424 -4313,2657,2735,3934,6117,3809, 636,3233, 573,1026,3693,3435,2974,3300,2298,4105, # 1440 - 854,2937,2463, 393,2581,2417, 539, 752,1280,2750,2480, 140,1161, 440, 708,1569, # 1456 - 665,2497,1746,1291,1523,3000, 164,1603, 847,1331, 537,1997, 486, 508,1693,2418, # 1472 -1970,2227, 878,1220, 299,1030, 969, 652,2751, 624,1137,3301,2619, 65,3302,2045, # 1488 -1761,1859,3120,1930,3694,3516, 663,1767, 852, 835,3695, 269, 767,2826,2339,1305, # 1504 - 896,1150, 770,1616,6118, 506,1502,2075,1012,2519, 775,2520,2975,2340,2938,4314, # 1520 -3028,2086,1224,1943,2286,6119,3072,4315,2240,1273,1987,3935,1557, 175, 597, 985, # 1536 -3517,2419,2521,1416,3029, 585, 938,1931,1007,1052,1932,1685,6120,3379,4316,4623, # 1552 - 804, 599,3121,1333,2128,2539,1159,1554,2032,3810, 687,2033,2904, 952, 675,1467, # 1568 -3436,6121,2241,1096,1786,2440,1543,1924, 980,1813,2228, 781,2692,1879, 728,1918, # 1584 -3696,4624, 548,1950,4625,1809,1088,1356,3303,2522,1944, 502, 972, 373, 513,2827, # 1600 - 586,2377,2391,1003,1976,1631,6122,2464,1084, 648,1776,4626,2141, 324, 962,2012, # 1616 -2177,2076,1384, 742,2178,1448,1173,1810, 222, 102, 301, 445, 125,2420, 662,2498, # 1632 - 277, 200,1476,1165,1068, 224,2562,1378,1446, 450,1880, 659, 791, 582,4627,2939, # 1648 -3936,1516,1274, 555,2099,3697,1020,1389,1526,3380,1762,1723,1787,2229, 412,2114, # 1664 -1900,2392,3518, 512,2597, 427,1925,2341,3122,1653,1686,2465,2499, 697, 330, 273, # 1680 - 380,2162, 951, 832, 780, 991,1301,3073, 965,2270,3519, 668,2523,2636,1286, 535, # 1696 -1407, 518, 671, 957,2658,2378, 267, 611,2197,3030,6123, 248,2299, 967,1799,2356, # 1712 - 850,1418,3437,1876,1256,1480,2828,1718,6124,6125,1755,1664,2405,6126,4628,2879, # 1728 -2829, 499,2179, 676,4629, 557,2329,2214,2090, 325,3234, 464, 811,3001, 992,2342, # 1744 -2481,1232,1469, 303,2242, 466,1070,2163, 603,1777,2091,4630,2752,4631,2714, 322, # 1760 -2659,1964,1768, 481,2188,1463,2330,2857,3600,2092,3031,2421,4632,2318,2070,1849, # 1776 -2598,4633,1302,2254,1668,1701,2422,3811,2905,3032,3123,2046,4106,1763,1694,4634, # 1792 -1604, 943,1724,1454, 917, 868,2215,1169,2940, 552,1145,1800,1228,1823,1955, 316, # 1808 -1080,2510, 361,1807,2830,4107,2660,3381,1346,1423,1134,4108,6127, 541,1263,1229, # 1824 -1148,2540, 545, 465,1833,2880,3438,1901,3074,2482, 816,3937, 713,1788,2500, 122, # 1840 -1575, 195,1451,2501,1111,6128, 859, 374,1225,2243,2483,4317, 390,1033,3439,3075, # 1856 -2524,1687, 266, 793,1440,2599, 946, 779, 802, 507, 897,1081, 528,2189,1292, 711, # 1872 -1866,1725,1167,1640, 753, 398,2661,1053, 246, 348,4318, 137,1024,3440,1600,2077, # 1888 -2129, 825,4319, 698, 238, 521, 187,2300,1157,2423,1641,1605,1464,1610,1097,2541, # 1904 -1260,1436, 759,2255,1814,2150, 705,3235, 409,2563,3304, 561,3033,2005,2564, 726, # 1920 -1956,2343,3698,4109, 949,3812,3813,3520,1669, 653,1379,2525, 881,2198, 632,2256, # 1936 -1027, 778,1074, 733,1957, 514,1481,2466, 554,2180, 702,3938,1606,1017,1398,6129, # 1952 -1380,3521, 921, 993,1313, 594, 449,1489,1617,1166, 768,1426,1360, 495,1794,3601, # 1968 -1177,3602,1170,4320,2344, 476, 425,3167,4635,3168,1424, 401,2662,1171,3382,1998, # 1984 -1089,4110, 477,3169, 474,6130,1909, 596,2831,1842, 494, 693,1051,1028,1207,3076, # 2000 - 606,2115, 727,2790,1473,1115, 743,3522, 630, 805,1532,4321,2021, 366,1057, 838, # 2016 - 684,1114,2142,4322,2050,1492,1892,1808,2271,3814,2424,1971,1447,1373,3305,1090, # 2032 -1536,3939,3523,3306,1455,2199, 336, 369,2331,1035, 584,2393, 902, 718,2600,6131, # 2048 -2753, 463,2151,1149,1611,2467, 715,1308,3124,1268, 343,1413,3236,1517,1347,2663, # 2064 -2093,3940,2022,1131,1553,2100,2941,1427,3441,2942,1323,2484,6132,1980, 872,2368, # 2080 -2441,2943, 320,2369,2116,1082, 679,1933,3941,2791,3815, 625,1143,2023, 422,2200, # 2096 -3816,6133, 730,1695, 356,2257,1626,2301,2858,2637,1627,1778, 937, 883,2906,2693, # 2112 -3002,1769,1086, 400,1063,1325,3307,2792,4111,3077, 456,2345,1046, 747,6134,1524, # 2128 - 884,1094,3383,1474,2164,1059, 974,1688,2181,2258,1047, 345,1665,1187, 358, 875, # 2144 -3170, 305, 660,3524,2190,1334,1135,3171,1540,1649,2542,1527, 927, 968,2793, 885, # 2160 -1972,1850, 482, 500,2638,1218,1109,1085,2543,1654,2034, 876, 78,2287,1482,1277, # 2176 - 861,1675,1083,1779, 724,2754, 454, 397,1132,1612,2332, 893, 672,1237, 257,2259, # 2192 -2370, 135,3384, 337,2244, 547, 352, 340, 709,2485,1400, 788,1138,2511, 540, 772, # 2208 -1682,2260,2272,2544,2013,1843,1902,4636,1999,1562,2288,4637,2201,1403,1533, 407, # 2224 - 576,3308,1254,2071, 978,3385, 170, 136,1201,3125,2664,3172,2394, 213, 912, 873, # 2240 -3603,1713,2202, 699,3604,3699, 813,3442, 493, 531,1054, 468,2907,1483, 304, 281, # 2256 -4112,1726,1252,2094, 339,2319,2130,2639, 756,1563,2944, 748, 571,2976,1588,2425, # 2272 -2715,1851,1460,2426,1528,1392,1973,3237, 288,3309, 685,3386, 296, 892,2716,2216, # 2288 -1570,2245, 722,1747,2217, 905,3238,1103,6135,1893,1441,1965, 251,1805,2371,3700, # 2304 -2601,1919,1078, 75,2182,1509,1592,1270,2640,4638,2152,6136,3310,3817, 524, 706, # 2320 -1075, 292,3818,1756,2602, 317, 98,3173,3605,3525,1844,2218,3819,2502, 814, 567, # 2336 - 385,2908,1534,6137, 534,1642,3239, 797,6138,1670,1529, 953,4323, 188,1071, 538, # 2352 - 178, 729,3240,2109,1226,1374,2000,2357,2977, 731,2468,1116,2014,2051,6139,1261, # 2368 -1593, 803,2859,2736,3443, 556, 682, 823,1541,6140,1369,2289,1706,2794, 845, 462, # 2384 -2603,2665,1361, 387, 162,2358,1740, 739,1770,1720,1304,1401,3241,1049, 627,1571, # 2400 -2427,3526,1877,3942,1852,1500, 431,1910,1503, 677, 297,2795, 286,1433,1038,1198, # 2416 -2290,1133,1596,4113,4639,2469,1510,1484,3943,6141,2442, 108, 712,4640,2372, 866, # 2432 -3701,2755,3242,1348, 834,1945,1408,3527,2395,3243,1811, 824, 994,1179,2110,1548, # 2448 -1453, 790,3003, 690,4324,4325,2832,2909,3820,1860,3821, 225,1748, 310, 346,1780, # 2464 -2470, 821,1993,2717,2796, 828, 877,3528,2860,2471,1702,2165,2910,2486,1789, 453, # 2480 - 359,2291,1676, 73,1164,1461,1127,3311, 421, 604, 314,1037, 589, 116,2487, 737, # 2496 - 837,1180, 111, 244, 735,6142,2261,1861,1362, 986, 523, 418, 581,2666,3822, 103, # 2512 - 855, 503,1414,1867,2488,1091, 657,1597, 979, 605,1316,4641,1021,2443,2078,2001, # 2528 -1209, 96, 587,2166,1032, 260,1072,2153, 173, 94, 226,3244, 819,2006,4642,4114, # 2544 -2203, 231,1744, 782, 97,2667, 786,3387, 887, 391, 442,2219,4326,1425,6143,2694, # 2560 - 633,1544,1202, 483,2015, 592,2052,1958,2472,1655, 419, 129,4327,3444,3312,1714, # 2576 -1257,3078,4328,1518,1098, 865,1310,1019,1885,1512,1734, 469,2444, 148, 773, 436, # 2592 -1815,1868,1128,1055,4329,1245,2756,3445,2154,1934,1039,4643, 579,1238, 932,2320, # 2608 - 353, 205, 801, 115,2428, 944,2321,1881, 399,2565,1211, 678, 766,3944, 335,2101, # 2624 -1459,1781,1402,3945,2737,2131,1010, 844, 981,1326,1013, 550,1816,1545,2620,1335, # 2640 -1008, 371,2881, 936,1419,1613,3529,1456,1395,2273,1834,2604,1317,2738,2503, 416, # 2656 -1643,4330, 806,1126, 229, 591,3946,1314,1981,1576,1837,1666, 347,1790, 977,3313, # 2672 - 764,2861,1853, 688,2429,1920,1462, 77, 595, 415,2002,3034, 798,1192,4115,6144, # 2688 -2978,4331,3035,2695,2582,2072,2566, 430,2430,1727, 842,1396,3947,3702, 613, 377, # 2704 - 278, 236,1417,3388,3314,3174, 757,1869, 107,3530,6145,1194, 623,2262, 207,1253, # 2720 -2167,3446,3948, 492,1117,1935, 536,1838,2757,1246,4332, 696,2095,2406,1393,1572, # 2736 -3175,1782, 583, 190, 253,1390,2230, 830,3126,3389, 934,3245,1703,1749,2979,1870, # 2752 -2545,1656,2204, 869,2346,4116,3176,1817, 496,1764,4644, 942,1504, 404,1903,1122, # 2768 -1580,3606,2945,1022, 515, 372,1735, 955,2431,3036,6146,2797,1110,2302,2798, 617, # 2784 -6147, 441, 762,1771,3447,3607,3608,1904, 840,3037, 86, 939,1385, 572,1370,2445, # 2800 -1336, 114,3703, 898, 294, 203,3315, 703,1583,2274, 429, 961,4333,1854,1951,3390, # 2816 -2373,3704,4334,1318,1381, 966,1911,2322,1006,1155, 309, 989, 458,2718,1795,1372, # 2832 -1203, 252,1689,1363,3177, 517,1936, 168,1490, 562, 193,3823,1042,4117,1835, 551, # 2848 - 470,4645, 395, 489,3448,1871,1465,2583,2641, 417,1493, 279,1295, 511,1236,1119, # 2864 - 72,1231,1982,1812,3004, 871,1564, 984,3449,1667,2696,2096,4646,2347,2833,1673, # 2880 -3609, 695,3246,2668, 807,1183,4647, 890, 388,2333,1801,1457,2911,1765,1477,1031, # 2896 -3316,3317,1278,3391,2799,2292,2526, 163,3450,4335,2669,1404,1802,6148,2323,2407, # 2912 -1584,1728,1494,1824,1269, 298, 909,3318,1034,1632, 375, 776,1683,2061, 291, 210, # 2928 -1123, 809,1249,1002,2642,3038, 206,1011,2132, 144, 975, 882,1565, 342, 667, 754, # 2944 -1442,2143,1299,2303,2062, 447, 626,2205,1221,2739,2912,1144,1214,2206,2584, 760, # 2960 -1715, 614, 950,1281,2670,2621, 810, 577,1287,2546,4648, 242,2168, 250,2643, 691, # 2976 - 123,2644, 647, 313,1029, 689,1357,2946,1650, 216, 771,1339,1306, 808,2063, 549, # 2992 - 913,1371,2913,2914,6149,1466,1092,1174,1196,1311,2605,2396,1783,1796,3079, 406, # 3008 -2671,2117,3949,4649, 487,1825,2220,6150,2915, 448,2348,1073,6151,2397,1707, 130, # 3024 - 900,1598, 329, 176,1959,2527,1620,6152,2275,4336,3319,1983,2191,3705,3610,2155, # 3040 -3706,1912,1513,1614,6153,1988, 646, 392,2304,1589,3320,3039,1826,1239,1352,1340, # 3056 -2916, 505,2567,1709,1437,2408,2547, 906,6154,2672, 384,1458,1594,1100,1329, 710, # 3072 - 423,3531,2064,2231,2622,1989,2673,1087,1882, 333, 841,3005,1296,2882,2379, 580, # 3088 -1937,1827,1293,2585, 601, 574, 249,1772,4118,2079,1120, 645, 901,1176,1690, 795, # 3104 -2207, 478,1434, 516,1190,1530, 761,2080, 930,1264, 355, 435,1552, 644,1791, 987, # 3120 - 220,1364,1163,1121,1538, 306,2169,1327,1222, 546,2645, 218, 241, 610,1704,3321, # 3136 -1984,1839,1966,2528, 451,6155,2586,3707,2568, 907,3178, 254,2947, 186,1845,4650, # 3152 - 745, 432,1757, 428,1633, 888,2246,2221,2489,3611,2118,1258,1265, 956,3127,1784, # 3168 -4337,2490, 319, 510, 119, 457,3612, 274,2035,2007,4651,1409,3128, 970,2758, 590, # 3184 -2800, 661,2247,4652,2008,3950,1420,1549,3080,3322,3951,1651,1375,2111, 485,2491, # 3200 -1429,1156,6156,2548,2183,1495, 831,1840,2529,2446, 501,1657, 307,1894,3247,1341, # 3216 - 666, 899,2156,1539,2549,1559, 886, 349,2208,3081,2305,1736,3824,2170,2759,1014, # 3232 -1913,1386, 542,1397,2948, 490, 368, 716, 362, 159, 282,2569,1129,1658,1288,1750, # 3248 -2674, 276, 649,2016, 751,1496, 658,1818,1284,1862,2209,2087,2512,3451, 622,2834, # 3264 - 376, 117,1060,2053,1208,1721,1101,1443, 247,1250,3179,1792,3952,2760,2398,3953, # 3280 -6157,2144,3708, 446,2432,1151,2570,3452,2447,2761,2835,1210,2448,3082, 424,2222, # 3296 -1251,2449,2119,2836, 504,1581,4338, 602, 817, 857,3825,2349,2306, 357,3826,1470, # 3312 -1883,2883, 255, 958, 929,2917,3248, 302,4653,1050,1271,1751,2307,1952,1430,2697, # 3328 -2719,2359, 354,3180, 777, 158,2036,4339,1659,4340,4654,2308,2949,2248,1146,2232, # 3344 -3532,2720,1696,2623,3827,6158,3129,1550,2698,1485,1297,1428, 637, 931,2721,2145, # 3360 - 914,2550,2587, 81,2450, 612, 827,2646,1242,4655,1118,2884, 472,1855,3181,3533, # 3376 -3534, 569,1353,2699,1244,1758,2588,4119,2009,2762,2171,3709,1312,1531,6159,1152, # 3392 -1938, 134,1830, 471,3710,2276,1112,1535,3323,3453,3535, 982,1337,2950, 488, 826, # 3408 - 674,1058,1628,4120,2017, 522,2399, 211, 568,1367,3454, 350, 293,1872,1139,3249, # 3424 -1399,1946,3006,1300,2360,3324, 588, 736,6160,2606, 744, 669,3536,3828,6161,1358, # 3440 - 199, 723, 848, 933, 851,1939,1505,1514,1338,1618,1831,4656,1634,3613, 443,2740, # 3456 -3829, 717,1947, 491,1914,6162,2551,1542,4121,1025,6163,1099,1223, 198,3040,2722, # 3472 - 370, 410,1905,2589, 998,1248,3182,2380, 519,1449,4122,1710, 947, 928,1153,4341, # 3488 -2277, 344,2624,1511, 615, 105, 161,1212,1076,1960,3130,2054,1926,1175,1906,2473, # 3504 - 414,1873,2801,6164,2309, 315,1319,3325, 318,2018,2146,2157, 963, 631, 223,4342, # 3520 -4343,2675, 479,3711,1197,2625,3712,2676,2361,6165,4344,4123,6166,2451,3183,1886, # 3536 -2184,1674,1330,1711,1635,1506, 799, 219,3250,3083,3954,1677,3713,3326,2081,3614, # 3552 -1652,2073,4657,1147,3041,1752, 643,1961, 147,1974,3955,6167,1716,2037, 918,3007, # 3568 -1994, 120,1537, 118, 609,3184,4345, 740,3455,1219, 332,1615,3830,6168,1621,2980, # 3584 -1582, 783, 212, 553,2350,3714,1349,2433,2082,4124, 889,6169,2310,1275,1410, 973, # 3600 - 166,1320,3456,1797,1215,3185,2885,1846,2590,2763,4658, 629, 822,3008, 763, 940, # 3616 -1990,2862, 439,2409,1566,1240,1622, 926,1282,1907,2764, 654,2210,1607, 327,1130, # 3632 -3956,1678,1623,6170,2434,2192, 686, 608,3831,3715, 903,3957,3042,6171,2741,1522, # 3648 -1915,1105,1555,2552,1359, 323,3251,4346,3457, 738,1354,2553,2311,2334,1828,2003, # 3664 -3832,1753,2351,1227,6172,1887,4125,1478,6173,2410,1874,1712,1847, 520,1204,2607, # 3680 - 264,4659, 836,2677,2102, 600,4660,3833,2278,3084,6174,4347,3615,1342, 640, 532, # 3696 - 543,2608,1888,2400,2591,1009,4348,1497, 341,1737,3616,2723,1394, 529,3252,1321, # 3712 - 983,4661,1515,2120, 971,2592, 924, 287,1662,3186,4349,2700,4350,1519, 908,1948, # 3728 -2452, 156, 796,1629,1486,2223,2055, 694,4126,1259,1036,3392,1213,2249,2742,1889, # 3744 -1230,3958,1015, 910, 408, 559,3617,4662, 746, 725, 935,4663,3959,3009,1289, 563, # 3760 - 867,4664,3960,1567,2981,2038,2626, 988,2263,2381,4351, 143,2374, 704,1895,6175, # 3776 -1188,3716,2088, 673,3085,2362,4352, 484,1608,1921,2765,2918, 215, 904,3618,3537, # 3792 - 894, 509, 976,3043,2701,3961,4353,2837,2982, 498,6176,6177,1102,3538,1332,3393, # 3808 -1487,1636,1637, 233, 245,3962, 383, 650, 995,3044, 460,1520,1206,2352, 749,3327, # 3824 - 530, 700, 389,1438,1560,1773,3963,2264, 719,2951,2724,3834, 870,1832,1644,1000, # 3840 - 839,2474,3717, 197,1630,3394, 365,2886,3964,1285,2133, 734, 922, 818,1106, 732, # 3856 - 480,2083,1774,3458, 923,2279,1350, 221,3086, 85,2233,2234,3835,1585,3010,2147, # 3872 -1387,1705,2382,1619,2475, 133, 239,2802,1991,1016,2084,2383, 411,2838,1113, 651, # 3888 -1985,1160,3328, 990,1863,3087,1048,1276,2647, 265,2627,1599,3253,2056, 150, 638, # 3904 -2019, 656, 853, 326,1479, 680,1439,4354,1001,1759, 413,3459,3395,2492,1431, 459, # 3920 -4355,1125,3329,2265,1953,1450,2065,2863, 849, 351,2678,3131,3254,3255,1104,1577, # 3936 - 227,1351,1645,2453,2193,1421,2887, 812,2121, 634, 95,2435, 201,2312,4665,1646, # 3952 -1671,2743,1601,2554,2702,2648,2280,1315,1366,2089,3132,1573,3718,3965,1729,1189, # 3968 - 328,2679,1077,1940,1136, 558,1283, 964,1195, 621,2074,1199,1743,3460,3619,1896, # 3984 -1916,1890,3836,2952,1154,2112,1064, 862, 378,3011,2066,2113,2803,1568,2839,6178, # 4000 -3088,2919,1941,1660,2004,1992,2194, 142, 707,1590,1708,1624,1922,1023,1836,1233, # 4016 -1004,2313, 789, 741,3620,6179,1609,2411,1200,4127,3719,3720,4666,2057,3721, 593, # 4032 -2840, 367,2920,1878,6180,3461,1521, 628,1168, 692,2211,2649, 300, 720,2067,2571, # 4048 -2953,3396, 959,2504,3966,3539,3462,1977, 701,6181, 954,1043, 800, 681, 183,3722, # 4064 -1803,1730,3540,4128,2103, 815,2314, 174, 467, 230,2454,1093,2134, 755,3541,3397, # 4080 -1141,1162,6182,1738,2039, 270,3256,2513,1005,1647,2185,3837, 858,1679,1897,1719, # 4096 -2954,2324,1806, 402, 670, 167,4129,1498,2158,2104, 750,6183, 915, 189,1680,1551, # 4112 - 455,4356,1501,2455, 405,1095,2955, 338,1586,1266,1819, 570, 641,1324, 237,1556, # 4128 -2650,1388,3723,6184,1368,2384,1343,1978,3089,2436, 879,3724, 792,1191, 758,3012, # 4144 -1411,2135,1322,4357, 240,4667,1848,3725,1574,6185, 420,3045,1546,1391, 714,4358, # 4160 -1967, 941,1864, 863, 664, 426, 560,1731,2680,1785,2864,1949,2363, 403,3330,1415, # 4176 -1279,2136,1697,2335, 204, 721,2097,3838, 90,6186,2085,2505, 191,3967, 124,2148, # 4192 -1376,1798,1178,1107,1898,1405, 860,4359,1243,1272,2375,2983,1558,2456,1638, 113, # 4208 -3621, 578,1923,2609, 880, 386,4130, 784,2186,2266,1422,2956,2172,1722, 497, 263, # 4224 -2514,1267,2412,2610, 177,2703,3542, 774,1927,1344, 616,1432,1595,1018, 172,4360, # 4240 -2325, 911,4361, 438,1468,3622, 794,3968,2024,2173,1681,1829,2957, 945, 895,3090, # 4256 - 575,2212,2476, 475,2401,2681, 785,2744,1745,2293,2555,1975,3133,2865, 394,4668, # 4272 -3839, 635,4131, 639, 202,1507,2195,2766,1345,1435,2572,3726,1908,1184,1181,2457, # 4288 -3727,3134,4362, 843,2611, 437, 916,4669, 234, 769,1884,3046,3047,3623, 833,6187, # 4304 -1639,2250,2402,1355,1185,2010,2047, 999, 525,1732,1290,1488,2612, 948,1578,3728, # 4320 -2413,2477,1216,2725,2159, 334,3840,1328,3624,2921,1525,4132, 564,1056, 891,4363, # 4336 -1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, # 4352 -2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, # 4368 #last 512 + 40, + 1, + 6, + 182, + 152, + 180, + 295, + 2127, + 285, + 381, + 3295, + 4304, + 3068, + 4606, + 3165, + 3510, # 16 + 3511, + 1822, + 2785, + 4607, + 1193, + 2226, + 5070, + 4608, + 171, + 2996, + 1247, + 18, + 179, + 5071, + 856, + 1661, # 32 + 1262, + 5072, + 619, + 127, + 3431, + 3512, + 3230, + 1899, + 1700, + 232, + 228, + 1294, + 1298, + 284, + 283, + 2041, # 48 + 2042, + 1061, + 1062, + 48, + 49, + 44, + 45, + 433, + 434, + 1040, + 1041, + 996, + 787, + 2997, + 1255, + 4305, # 64 + 2108, + 4609, + 1684, + 1648, + 5073, + 5074, + 5075, + 5076, + 5077, + 5078, + 3687, + 5079, + 4610, + 5080, + 3927, + 3928, # 80 + 5081, + 3296, + 3432, + 290, + 2285, + 1471, + 2187, + 5082, + 2580, + 2825, + 1303, + 2140, + 1739, + 1445, + 2691, + 3375, # 96 + 1691, + 3297, + 4306, + 4307, + 4611, + 452, + 3376, + 1182, + 2713, + 3688, + 3069, + 4308, + 5083, + 5084, + 5085, + 5086, # 112 + 5087, + 5088, + 5089, + 5090, + 5091, + 5092, + 5093, + 5094, + 5095, + 5096, + 5097, + 5098, + 5099, + 5100, + 5101, + 5102, # 128 + 5103, + 5104, + 5105, + 5106, + 5107, + 5108, + 5109, + 5110, + 5111, + 5112, + 4097, + 5113, + 5114, + 5115, + 5116, + 5117, # 144 + 5118, + 5119, + 5120, + 5121, + 5122, + 5123, + 5124, + 5125, + 5126, + 5127, + 5128, + 5129, + 5130, + 5131, + 5132, + 5133, # 160 + 5134, + 5135, + 5136, + 5137, + 5138, + 5139, + 5140, + 5141, + 5142, + 5143, + 5144, + 5145, + 5146, + 5147, + 5148, + 5149, # 176 + 5150, + 5151, + 5152, + 4612, + 5153, + 5154, + 5155, + 5156, + 5157, + 5158, + 5159, + 5160, + 5161, + 5162, + 5163, + 5164, # 192 + 5165, + 5166, + 5167, + 5168, + 5169, + 5170, + 5171, + 5172, + 5173, + 5174, + 5175, + 1472, + 598, + 618, + 820, + 1205, # 208 + 1309, + 1412, + 1858, + 1307, + 1692, + 5176, + 5177, + 5178, + 5179, + 5180, + 5181, + 5182, + 1142, + 1452, + 1234, + 1172, # 224 + 1875, + 2043, + 2149, + 1793, + 1382, + 2973, + 925, + 2404, + 1067, + 1241, + 960, + 1377, + 2935, + 1491, + 919, + 1217, # 240 + 1865, + 2030, + 1406, + 1499, + 2749, + 4098, + 5183, + 5184, + 5185, + 5186, + 5187, + 5188, + 2561, + 4099, + 3117, + 1804, # 256 + 2049, + 3689, + 4309, + 3513, + 1663, + 5189, + 3166, + 3118, + 3298, + 1587, + 1561, + 3433, + 5190, + 3119, + 1625, + 2998, # 272 + 3299, + 4613, + 1766, + 3690, + 2786, + 4614, + 5191, + 5192, + 5193, + 5194, + 2161, + 26, + 3377, + 2, + 3929, + 20, # 288 + 3691, + 47, + 4100, + 50, + 17, + 16, + 35, + 268, + 27, + 243, + 42, + 155, + 24, + 154, + 29, + 184, # 304 + 4, + 91, + 14, + 92, + 53, + 396, + 33, + 289, + 9, + 37, + 64, + 620, + 21, + 39, + 321, + 5, # 320 + 12, + 11, + 52, + 13, + 3, + 208, + 138, + 0, + 7, + 60, + 526, + 141, + 151, + 1069, + 181, + 275, # 336 + 1591, + 83, + 132, + 1475, + 126, + 331, + 829, + 15, + 69, + 160, + 59, + 22, + 157, + 55, + 1079, + 312, # 352 + 109, + 38, + 23, + 25, + 10, + 19, + 79, + 5195, + 61, + 382, + 1124, + 8, + 30, + 5196, + 5197, + 5198, # 368 + 5199, + 5200, + 5201, + 5202, + 5203, + 5204, + 5205, + 5206, + 89, + 62, + 74, + 34, + 2416, + 112, + 139, + 196, # 384 + 271, + 149, + 84, + 607, + 131, + 765, + 46, + 88, + 153, + 683, + 76, + 874, + 101, + 258, + 57, + 80, # 400 + 32, + 364, + 121, + 1508, + 169, + 1547, + 68, + 235, + 145, + 2999, + 41, + 360, + 3027, + 70, + 63, + 31, # 416 + 43, + 259, + 262, + 1383, + 99, + 533, + 194, + 66, + 93, + 846, + 217, + 192, + 56, + 106, + 58, + 565, # 432 + 280, + 272, + 311, + 256, + 146, + 82, + 308, + 71, + 100, + 128, + 214, + 655, + 110, + 261, + 104, + 1140, # 448 + 54, + 51, + 36, + 87, + 67, + 3070, + 185, + 2618, + 2936, + 2020, + 28, + 1066, + 2390, + 2059, + 5207, + 5208, # 464 + 5209, + 5210, + 5211, + 5212, + 5213, + 5214, + 5215, + 5216, + 4615, + 5217, + 5218, + 5219, + 5220, + 5221, + 5222, + 5223, # 480 + 5224, + 5225, + 5226, + 5227, + 5228, + 5229, + 5230, + 5231, + 5232, + 5233, + 5234, + 5235, + 5236, + 3514, + 5237, + 5238, # 496 + 5239, + 5240, + 5241, + 5242, + 5243, + 5244, + 2297, + 2031, + 4616, + 4310, + 3692, + 5245, + 3071, + 5246, + 3598, + 5247, # 512 + 4617, + 3231, + 3515, + 5248, + 4101, + 4311, + 4618, + 3808, + 4312, + 4102, + 5249, + 4103, + 4104, + 3599, + 5250, + 5251, # 528 + 5252, + 5253, + 5254, + 5255, + 5256, + 5257, + 5258, + 5259, + 5260, + 5261, + 5262, + 5263, + 5264, + 5265, + 5266, + 5267, # 544 + 5268, + 5269, + 5270, + 5271, + 5272, + 5273, + 5274, + 5275, + 5276, + 5277, + 5278, + 5279, + 5280, + 5281, + 5282, + 5283, # 560 + 5284, + 5285, + 5286, + 5287, + 5288, + 5289, + 5290, + 5291, + 5292, + 5293, + 5294, + 5295, + 5296, + 5297, + 5298, + 5299, # 576 + 5300, + 5301, + 5302, + 5303, + 5304, + 5305, + 5306, + 5307, + 5308, + 5309, + 5310, + 5311, + 5312, + 5313, + 5314, + 5315, # 592 + 5316, + 5317, + 5318, + 5319, + 5320, + 5321, + 5322, + 5323, + 5324, + 5325, + 5326, + 5327, + 5328, + 5329, + 5330, + 5331, # 608 + 5332, + 5333, + 5334, + 5335, + 5336, + 5337, + 5338, + 5339, + 5340, + 5341, + 5342, + 5343, + 5344, + 5345, + 5346, + 5347, # 624 + 5348, + 5349, + 5350, + 5351, + 5352, + 5353, + 5354, + 5355, + 5356, + 5357, + 5358, + 5359, + 5360, + 5361, + 5362, + 5363, # 640 + 5364, + 5365, + 5366, + 5367, + 5368, + 5369, + 5370, + 5371, + 5372, + 5373, + 5374, + 5375, + 5376, + 5377, + 5378, + 5379, # 656 + 5380, + 5381, + 363, + 642, + 2787, + 2878, + 2788, + 2789, + 2316, + 3232, + 2317, + 3434, + 2011, + 165, + 1942, + 3930, # 672 + 3931, + 3932, + 3933, + 5382, + 4619, + 5383, + 4620, + 5384, + 5385, + 5386, + 5387, + 5388, + 5389, + 5390, + 5391, + 5392, # 688 + 5393, + 5394, + 5395, + 5396, + 5397, + 5398, + 5399, + 5400, + 5401, + 5402, + 5403, + 5404, + 5405, + 5406, + 5407, + 5408, # 704 + 5409, + 5410, + 5411, + 5412, + 5413, + 5414, + 5415, + 5416, + 5417, + 5418, + 5419, + 5420, + 5421, + 5422, + 5423, + 5424, # 720 + 5425, + 5426, + 5427, + 5428, + 5429, + 5430, + 5431, + 5432, + 5433, + 5434, + 5435, + 5436, + 5437, + 5438, + 5439, + 5440, # 736 + 5441, + 5442, + 5443, + 5444, + 5445, + 5446, + 5447, + 5448, + 5449, + 5450, + 5451, + 5452, + 5453, + 5454, + 5455, + 5456, # 752 + 5457, + 5458, + 5459, + 5460, + 5461, + 5462, + 5463, + 5464, + 5465, + 5466, + 5467, + 5468, + 5469, + 5470, + 5471, + 5472, # 768 + 5473, + 5474, + 5475, + 5476, + 5477, + 5478, + 5479, + 5480, + 5481, + 5482, + 5483, + 5484, + 5485, + 5486, + 5487, + 5488, # 784 + 5489, + 5490, + 5491, + 5492, + 5493, + 5494, + 5495, + 5496, + 5497, + 5498, + 5499, + 5500, + 5501, + 5502, + 5503, + 5504, # 800 + 5505, + 5506, + 5507, + 5508, + 5509, + 5510, + 5511, + 5512, + 5513, + 5514, + 5515, + 5516, + 5517, + 5518, + 5519, + 5520, # 816 + 5521, + 5522, + 5523, + 5524, + 5525, + 5526, + 5527, + 5528, + 5529, + 5530, + 5531, + 5532, + 5533, + 5534, + 5535, + 5536, # 832 + 5537, + 5538, + 5539, + 5540, + 5541, + 5542, + 5543, + 5544, + 5545, + 5546, + 5547, + 5548, + 5549, + 5550, + 5551, + 5552, # 848 + 5553, + 5554, + 5555, + 5556, + 5557, + 5558, + 5559, + 5560, + 5561, + 5562, + 5563, + 5564, + 5565, + 5566, + 5567, + 5568, # 864 + 5569, + 5570, + 5571, + 5572, + 5573, + 5574, + 5575, + 5576, + 5577, + 5578, + 5579, + 5580, + 5581, + 5582, + 5583, + 5584, # 880 + 5585, + 5586, + 5587, + 5588, + 5589, + 5590, + 5591, + 5592, + 5593, + 5594, + 5595, + 5596, + 5597, + 5598, + 5599, + 5600, # 896 + 5601, + 5602, + 5603, + 5604, + 5605, + 5606, + 5607, + 5608, + 5609, + 5610, + 5611, + 5612, + 5613, + 5614, + 5615, + 5616, # 912 + 5617, + 5618, + 5619, + 5620, + 5621, + 5622, + 5623, + 5624, + 5625, + 5626, + 5627, + 5628, + 5629, + 5630, + 5631, + 5632, # 928 + 5633, + 5634, + 5635, + 5636, + 5637, + 5638, + 5639, + 5640, + 5641, + 5642, + 5643, + 5644, + 5645, + 5646, + 5647, + 5648, # 944 + 5649, + 5650, + 5651, + 5652, + 5653, + 5654, + 5655, + 5656, + 5657, + 5658, + 5659, + 5660, + 5661, + 5662, + 5663, + 5664, # 960 + 5665, + 5666, + 5667, + 5668, + 5669, + 5670, + 5671, + 5672, + 5673, + 5674, + 5675, + 5676, + 5677, + 5678, + 5679, + 5680, # 976 + 5681, + 5682, + 5683, + 5684, + 5685, + 5686, + 5687, + 5688, + 5689, + 5690, + 5691, + 5692, + 5693, + 5694, + 5695, + 5696, # 992 + 5697, + 5698, + 5699, + 5700, + 5701, + 5702, + 5703, + 5704, + 5705, + 5706, + 5707, + 5708, + 5709, + 5710, + 5711, + 5712, # 1008 + 5713, + 5714, + 5715, + 5716, + 5717, + 5718, + 5719, + 5720, + 5721, + 5722, + 5723, + 5724, + 5725, + 5726, + 5727, + 5728, # 1024 + 5729, + 5730, + 5731, + 5732, + 5733, + 5734, + 5735, + 5736, + 5737, + 5738, + 5739, + 5740, + 5741, + 5742, + 5743, + 5744, # 1040 + 5745, + 5746, + 5747, + 5748, + 5749, + 5750, + 5751, + 5752, + 5753, + 5754, + 5755, + 5756, + 5757, + 5758, + 5759, + 5760, # 1056 + 5761, + 5762, + 5763, + 5764, + 5765, + 5766, + 5767, + 5768, + 5769, + 5770, + 5771, + 5772, + 5773, + 5774, + 5775, + 5776, # 1072 + 5777, + 5778, + 5779, + 5780, + 5781, + 5782, + 5783, + 5784, + 5785, + 5786, + 5787, + 5788, + 5789, + 5790, + 5791, + 5792, # 1088 + 5793, + 5794, + 5795, + 5796, + 5797, + 5798, + 5799, + 5800, + 5801, + 5802, + 5803, + 5804, + 5805, + 5806, + 5807, + 5808, # 1104 + 5809, + 5810, + 5811, + 5812, + 5813, + 5814, + 5815, + 5816, + 5817, + 5818, + 5819, + 5820, + 5821, + 5822, + 5823, + 5824, # 1120 + 5825, + 5826, + 5827, + 5828, + 5829, + 5830, + 5831, + 5832, + 5833, + 5834, + 5835, + 5836, + 5837, + 5838, + 5839, + 5840, # 1136 + 5841, + 5842, + 5843, + 5844, + 5845, + 5846, + 5847, + 5848, + 5849, + 5850, + 5851, + 5852, + 5853, + 5854, + 5855, + 5856, # 1152 + 5857, + 5858, + 5859, + 5860, + 5861, + 5862, + 5863, + 5864, + 5865, + 5866, + 5867, + 5868, + 5869, + 5870, + 5871, + 5872, # 1168 + 5873, + 5874, + 5875, + 5876, + 5877, + 5878, + 5879, + 5880, + 5881, + 5882, + 5883, + 5884, + 5885, + 5886, + 5887, + 5888, # 1184 + 5889, + 5890, + 5891, + 5892, + 5893, + 5894, + 5895, + 5896, + 5897, + 5898, + 5899, + 5900, + 5901, + 5902, + 5903, + 5904, # 1200 + 5905, + 5906, + 5907, + 5908, + 5909, + 5910, + 5911, + 5912, + 5913, + 5914, + 5915, + 5916, + 5917, + 5918, + 5919, + 5920, # 1216 + 5921, + 5922, + 5923, + 5924, + 5925, + 5926, + 5927, + 5928, + 5929, + 5930, + 5931, + 5932, + 5933, + 5934, + 5935, + 5936, # 1232 + 5937, + 5938, + 5939, + 5940, + 5941, + 5942, + 5943, + 5944, + 5945, + 5946, + 5947, + 5948, + 5949, + 5950, + 5951, + 5952, # 1248 + 5953, + 5954, + 5955, + 5956, + 5957, + 5958, + 5959, + 5960, + 5961, + 5962, + 5963, + 5964, + 5965, + 5966, + 5967, + 5968, # 1264 + 5969, + 5970, + 5971, + 5972, + 5973, + 5974, + 5975, + 5976, + 5977, + 5978, + 5979, + 5980, + 5981, + 5982, + 5983, + 5984, # 1280 + 5985, + 5986, + 5987, + 5988, + 5989, + 5990, + 5991, + 5992, + 5993, + 5994, + 5995, + 5996, + 5997, + 5998, + 5999, + 6000, # 1296 + 6001, + 6002, + 6003, + 6004, + 6005, + 6006, + 6007, + 6008, + 6009, + 6010, + 6011, + 6012, + 6013, + 6014, + 6015, + 6016, # 1312 + 6017, + 6018, + 6019, + 6020, + 6021, + 6022, + 6023, + 6024, + 6025, + 6026, + 6027, + 6028, + 6029, + 6030, + 6031, + 6032, # 1328 + 6033, + 6034, + 6035, + 6036, + 6037, + 6038, + 6039, + 6040, + 6041, + 6042, + 6043, + 6044, + 6045, + 6046, + 6047, + 6048, # 1344 + 6049, + 6050, + 6051, + 6052, + 6053, + 6054, + 6055, + 6056, + 6057, + 6058, + 6059, + 6060, + 6061, + 6062, + 6063, + 6064, # 1360 + 6065, + 6066, + 6067, + 6068, + 6069, + 6070, + 6071, + 6072, + 6073, + 6074, + 6075, + 6076, + 6077, + 6078, + 6079, + 6080, # 1376 + 6081, + 6082, + 6083, + 6084, + 6085, + 6086, + 6087, + 6088, + 6089, + 6090, + 6091, + 6092, + 6093, + 6094, + 6095, + 6096, # 1392 + 6097, + 6098, + 6099, + 6100, + 6101, + 6102, + 6103, + 6104, + 6105, + 6106, + 6107, + 6108, + 6109, + 6110, + 6111, + 6112, # 1408 + 6113, + 6114, + 2044, + 2060, + 4621, + 997, + 1235, + 473, + 1186, + 4622, + 920, + 3378, + 6115, + 6116, + 379, + 1108, # 1424 + 4313, + 2657, + 2735, + 3934, + 6117, + 3809, + 636, + 3233, + 573, + 1026, + 3693, + 3435, + 2974, + 3300, + 2298, + 4105, # 1440 + 854, + 2937, + 2463, + 393, + 2581, + 2417, + 539, + 752, + 1280, + 2750, + 2480, + 140, + 1161, + 440, + 708, + 1569, # 1456 + 665, + 2497, + 1746, + 1291, + 1523, + 3000, + 164, + 1603, + 847, + 1331, + 537, + 1997, + 486, + 508, + 1693, + 2418, # 1472 + 1970, + 2227, + 878, + 1220, + 299, + 1030, + 969, + 652, + 2751, + 624, + 1137, + 3301, + 2619, + 65, + 3302, + 2045, # 1488 + 1761, + 1859, + 3120, + 1930, + 3694, + 3516, + 663, + 1767, + 852, + 835, + 3695, + 269, + 767, + 2826, + 2339, + 1305, # 1504 + 896, + 1150, + 770, + 1616, + 6118, + 506, + 1502, + 2075, + 1012, + 2519, + 775, + 2520, + 2975, + 2340, + 2938, + 4314, # 1520 + 3028, + 2086, + 1224, + 1943, + 2286, + 6119, + 3072, + 4315, + 2240, + 1273, + 1987, + 3935, + 1557, + 175, + 597, + 985, # 1536 + 3517, + 2419, + 2521, + 1416, + 3029, + 585, + 938, + 1931, + 1007, + 1052, + 1932, + 1685, + 6120, + 3379, + 4316, + 4623, # 1552 + 804, + 599, + 3121, + 1333, + 2128, + 2539, + 1159, + 1554, + 2032, + 3810, + 687, + 2033, + 2904, + 952, + 675, + 1467, # 1568 + 3436, + 6121, + 2241, + 1096, + 1786, + 2440, + 1543, + 1924, + 980, + 1813, + 2228, + 781, + 2692, + 1879, + 728, + 1918, # 1584 + 3696, + 4624, + 548, + 1950, + 4625, + 1809, + 1088, + 1356, + 3303, + 2522, + 1944, + 502, + 972, + 373, + 513, + 2827, # 1600 + 586, + 2377, + 2391, + 1003, + 1976, + 1631, + 6122, + 2464, + 1084, + 648, + 1776, + 4626, + 2141, + 324, + 962, + 2012, # 1616 + 2177, + 2076, + 1384, + 742, + 2178, + 1448, + 1173, + 1810, + 222, + 102, + 301, + 445, + 125, + 2420, + 662, + 2498, # 1632 + 277, + 200, + 1476, + 1165, + 1068, + 224, + 2562, + 1378, + 1446, + 450, + 1880, + 659, + 791, + 582, + 4627, + 2939, # 1648 + 3936, + 1516, + 1274, + 555, + 2099, + 3697, + 1020, + 1389, + 1526, + 3380, + 1762, + 1723, + 1787, + 2229, + 412, + 2114, # 1664 + 1900, + 2392, + 3518, + 512, + 2597, + 427, + 1925, + 2341, + 3122, + 1653, + 1686, + 2465, + 2499, + 697, + 330, + 273, # 1680 + 380, + 2162, + 951, + 832, + 780, + 991, + 1301, + 3073, + 965, + 2270, + 3519, + 668, + 2523, + 2636, + 1286, + 535, # 1696 + 1407, + 518, + 671, + 957, + 2658, + 2378, + 267, + 611, + 2197, + 3030, + 6123, + 248, + 2299, + 967, + 1799, + 2356, # 1712 + 850, + 1418, + 3437, + 1876, + 1256, + 1480, + 2828, + 1718, + 6124, + 6125, + 1755, + 1664, + 2405, + 6126, + 4628, + 2879, # 1728 + 2829, + 499, + 2179, + 676, + 4629, + 557, + 2329, + 2214, + 2090, + 325, + 3234, + 464, + 811, + 3001, + 992, + 2342, # 1744 + 2481, + 1232, + 1469, + 303, + 2242, + 466, + 1070, + 2163, + 603, + 1777, + 2091, + 4630, + 2752, + 4631, + 2714, + 322, # 1760 + 2659, + 1964, + 1768, + 481, + 2188, + 1463, + 2330, + 2857, + 3600, + 2092, + 3031, + 2421, + 4632, + 2318, + 2070, + 1849, # 1776 + 2598, + 4633, + 1302, + 2254, + 1668, + 1701, + 2422, + 3811, + 2905, + 3032, + 3123, + 2046, + 4106, + 1763, + 1694, + 4634, # 1792 + 1604, + 943, + 1724, + 1454, + 917, + 868, + 2215, + 1169, + 2940, + 552, + 1145, + 1800, + 1228, + 1823, + 1955, + 316, # 1808 + 1080, + 2510, + 361, + 1807, + 2830, + 4107, + 2660, + 3381, + 1346, + 1423, + 1134, + 4108, + 6127, + 541, + 1263, + 1229, # 1824 + 1148, + 2540, + 545, + 465, + 1833, + 2880, + 3438, + 1901, + 3074, + 2482, + 816, + 3937, + 713, + 1788, + 2500, + 122, # 1840 + 1575, + 195, + 1451, + 2501, + 1111, + 6128, + 859, + 374, + 1225, + 2243, + 2483, + 4317, + 390, + 1033, + 3439, + 3075, # 1856 + 2524, + 1687, + 266, + 793, + 1440, + 2599, + 946, + 779, + 802, + 507, + 897, + 1081, + 528, + 2189, + 1292, + 711, # 1872 + 1866, + 1725, + 1167, + 1640, + 753, + 398, + 2661, + 1053, + 246, + 348, + 4318, + 137, + 1024, + 3440, + 1600, + 2077, # 1888 + 2129, + 825, + 4319, + 698, + 238, + 521, + 187, + 2300, + 1157, + 2423, + 1641, + 1605, + 1464, + 1610, + 1097, + 2541, # 1904 + 1260, + 1436, + 759, + 2255, + 1814, + 2150, + 705, + 3235, + 409, + 2563, + 3304, + 561, + 3033, + 2005, + 2564, + 726, # 1920 + 1956, + 2343, + 3698, + 4109, + 949, + 3812, + 3813, + 3520, + 1669, + 653, + 1379, + 2525, + 881, + 2198, + 632, + 2256, # 1936 + 1027, + 778, + 1074, + 733, + 1957, + 514, + 1481, + 2466, + 554, + 2180, + 702, + 3938, + 1606, + 1017, + 1398, + 6129, # 1952 + 1380, + 3521, + 921, + 993, + 1313, + 594, + 449, + 1489, + 1617, + 1166, + 768, + 1426, + 1360, + 495, + 1794, + 3601, # 1968 + 1177, + 3602, + 1170, + 4320, + 2344, + 476, + 425, + 3167, + 4635, + 3168, + 1424, + 401, + 2662, + 1171, + 3382, + 1998, # 1984 + 1089, + 4110, + 477, + 3169, + 474, + 6130, + 1909, + 596, + 2831, + 1842, + 494, + 693, + 1051, + 1028, + 1207, + 3076, # 2000 + 606, + 2115, + 727, + 2790, + 1473, + 1115, + 743, + 3522, + 630, + 805, + 1532, + 4321, + 2021, + 366, + 1057, + 838, # 2016 + 684, + 1114, + 2142, + 4322, + 2050, + 1492, + 1892, + 1808, + 2271, + 3814, + 2424, + 1971, + 1447, + 1373, + 3305, + 1090, # 2032 + 1536, + 3939, + 3523, + 3306, + 1455, + 2199, + 336, + 369, + 2331, + 1035, + 584, + 2393, + 902, + 718, + 2600, + 6131, # 2048 + 2753, + 463, + 2151, + 1149, + 1611, + 2467, + 715, + 1308, + 3124, + 1268, + 343, + 1413, + 3236, + 1517, + 1347, + 2663, # 2064 + 2093, + 3940, + 2022, + 1131, + 1553, + 2100, + 2941, + 1427, + 3441, + 2942, + 1323, + 2484, + 6132, + 1980, + 872, + 2368, # 2080 + 2441, + 2943, + 320, + 2369, + 2116, + 1082, + 679, + 1933, + 3941, + 2791, + 3815, + 625, + 1143, + 2023, + 422, + 2200, # 2096 + 3816, + 6133, + 730, + 1695, + 356, + 2257, + 1626, + 2301, + 2858, + 2637, + 1627, + 1778, + 937, + 883, + 2906, + 2693, # 2112 + 3002, + 1769, + 1086, + 400, + 1063, + 1325, + 3307, + 2792, + 4111, + 3077, + 456, + 2345, + 1046, + 747, + 6134, + 1524, # 2128 + 884, + 1094, + 3383, + 1474, + 2164, + 1059, + 974, + 1688, + 2181, + 2258, + 1047, + 345, + 1665, + 1187, + 358, + 875, # 2144 + 3170, + 305, + 660, + 3524, + 2190, + 1334, + 1135, + 3171, + 1540, + 1649, + 2542, + 1527, + 927, + 968, + 2793, + 885, # 2160 + 1972, + 1850, + 482, + 500, + 2638, + 1218, + 1109, + 1085, + 2543, + 1654, + 2034, + 876, + 78, + 2287, + 1482, + 1277, # 2176 + 861, + 1675, + 1083, + 1779, + 724, + 2754, + 454, + 397, + 1132, + 1612, + 2332, + 893, + 672, + 1237, + 257, + 2259, # 2192 + 2370, + 135, + 3384, + 337, + 2244, + 547, + 352, + 340, + 709, + 2485, + 1400, + 788, + 1138, + 2511, + 540, + 772, # 2208 + 1682, + 2260, + 2272, + 2544, + 2013, + 1843, + 1902, + 4636, + 1999, + 1562, + 2288, + 4637, + 2201, + 1403, + 1533, + 407, # 2224 + 576, + 3308, + 1254, + 2071, + 978, + 3385, + 170, + 136, + 1201, + 3125, + 2664, + 3172, + 2394, + 213, + 912, + 873, # 2240 + 3603, + 1713, + 2202, + 699, + 3604, + 3699, + 813, + 3442, + 493, + 531, + 1054, + 468, + 2907, + 1483, + 304, + 281, # 2256 + 4112, + 1726, + 1252, + 2094, + 339, + 2319, + 2130, + 2639, + 756, + 1563, + 2944, + 748, + 571, + 2976, + 1588, + 2425, # 2272 + 2715, + 1851, + 1460, + 2426, + 1528, + 1392, + 1973, + 3237, + 288, + 3309, + 685, + 3386, + 296, + 892, + 2716, + 2216, # 2288 + 1570, + 2245, + 722, + 1747, + 2217, + 905, + 3238, + 1103, + 6135, + 1893, + 1441, + 1965, + 251, + 1805, + 2371, + 3700, # 2304 + 2601, + 1919, + 1078, + 75, + 2182, + 1509, + 1592, + 1270, + 2640, + 4638, + 2152, + 6136, + 3310, + 3817, + 524, + 706, # 2320 + 1075, + 292, + 3818, + 1756, + 2602, + 317, + 98, + 3173, + 3605, + 3525, + 1844, + 2218, + 3819, + 2502, + 814, + 567, # 2336 + 385, + 2908, + 1534, + 6137, + 534, + 1642, + 3239, + 797, + 6138, + 1670, + 1529, + 953, + 4323, + 188, + 1071, + 538, # 2352 + 178, + 729, + 3240, + 2109, + 1226, + 1374, + 2000, + 2357, + 2977, + 731, + 2468, + 1116, + 2014, + 2051, + 6139, + 1261, # 2368 + 1593, + 803, + 2859, + 2736, + 3443, + 556, + 682, + 823, + 1541, + 6140, + 1369, + 2289, + 1706, + 2794, + 845, + 462, # 2384 + 2603, + 2665, + 1361, + 387, + 162, + 2358, + 1740, + 739, + 1770, + 1720, + 1304, + 1401, + 3241, + 1049, + 627, + 1571, # 2400 + 2427, + 3526, + 1877, + 3942, + 1852, + 1500, + 431, + 1910, + 1503, + 677, + 297, + 2795, + 286, + 1433, + 1038, + 1198, # 2416 + 2290, + 1133, + 1596, + 4113, + 4639, + 2469, + 1510, + 1484, + 3943, + 6141, + 2442, + 108, + 712, + 4640, + 2372, + 866, # 2432 + 3701, + 2755, + 3242, + 1348, + 834, + 1945, + 1408, + 3527, + 2395, + 3243, + 1811, + 824, + 994, + 1179, + 2110, + 1548, # 2448 + 1453, + 790, + 3003, + 690, + 4324, + 4325, + 2832, + 2909, + 3820, + 1860, + 3821, + 225, + 1748, + 310, + 346, + 1780, # 2464 + 2470, + 821, + 1993, + 2717, + 2796, + 828, + 877, + 3528, + 2860, + 2471, + 1702, + 2165, + 2910, + 2486, + 1789, + 453, # 2480 + 359, + 2291, + 1676, + 73, + 1164, + 1461, + 1127, + 3311, + 421, + 604, + 314, + 1037, + 589, + 116, + 2487, + 737, # 2496 + 837, + 1180, + 111, + 244, + 735, + 6142, + 2261, + 1861, + 1362, + 986, + 523, + 418, + 581, + 2666, + 3822, + 103, # 2512 + 855, + 503, + 1414, + 1867, + 2488, + 1091, + 657, + 1597, + 979, + 605, + 1316, + 4641, + 1021, + 2443, + 2078, + 2001, # 2528 + 1209, + 96, + 587, + 2166, + 1032, + 260, + 1072, + 2153, + 173, + 94, + 226, + 3244, + 819, + 2006, + 4642, + 4114, # 2544 + 2203, + 231, + 1744, + 782, + 97, + 2667, + 786, + 3387, + 887, + 391, + 442, + 2219, + 4326, + 1425, + 6143, + 2694, # 2560 + 633, + 1544, + 1202, + 483, + 2015, + 592, + 2052, + 1958, + 2472, + 1655, + 419, + 129, + 4327, + 3444, + 3312, + 1714, # 2576 + 1257, + 3078, + 4328, + 1518, + 1098, + 865, + 1310, + 1019, + 1885, + 1512, + 1734, + 469, + 2444, + 148, + 773, + 436, # 2592 + 1815, + 1868, + 1128, + 1055, + 4329, + 1245, + 2756, + 3445, + 2154, + 1934, + 1039, + 4643, + 579, + 1238, + 932, + 2320, # 2608 + 353, + 205, + 801, + 115, + 2428, + 944, + 2321, + 1881, + 399, + 2565, + 1211, + 678, + 766, + 3944, + 335, + 2101, # 2624 + 1459, + 1781, + 1402, + 3945, + 2737, + 2131, + 1010, + 844, + 981, + 1326, + 1013, + 550, + 1816, + 1545, + 2620, + 1335, # 2640 + 1008, + 371, + 2881, + 936, + 1419, + 1613, + 3529, + 1456, + 1395, + 2273, + 1834, + 2604, + 1317, + 2738, + 2503, + 416, # 2656 + 1643, + 4330, + 806, + 1126, + 229, + 591, + 3946, + 1314, + 1981, + 1576, + 1837, + 1666, + 347, + 1790, + 977, + 3313, # 2672 + 764, + 2861, + 1853, + 688, + 2429, + 1920, + 1462, + 77, + 595, + 415, + 2002, + 3034, + 798, + 1192, + 4115, + 6144, # 2688 + 2978, + 4331, + 3035, + 2695, + 2582, + 2072, + 2566, + 430, + 2430, + 1727, + 842, + 1396, + 3947, + 3702, + 613, + 377, # 2704 + 278, + 236, + 1417, + 3388, + 3314, + 3174, + 757, + 1869, + 107, + 3530, + 6145, + 1194, + 623, + 2262, + 207, + 1253, # 2720 + 2167, + 3446, + 3948, + 492, + 1117, + 1935, + 536, + 1838, + 2757, + 1246, + 4332, + 696, + 2095, + 2406, + 1393, + 1572, # 2736 + 3175, + 1782, + 583, + 190, + 253, + 1390, + 2230, + 830, + 3126, + 3389, + 934, + 3245, + 1703, + 1749, + 2979, + 1870, # 2752 + 2545, + 1656, + 2204, + 869, + 2346, + 4116, + 3176, + 1817, + 496, + 1764, + 4644, + 942, + 1504, + 404, + 1903, + 1122, # 2768 + 1580, + 3606, + 2945, + 1022, + 515, + 372, + 1735, + 955, + 2431, + 3036, + 6146, + 2797, + 1110, + 2302, + 2798, + 617, # 2784 + 6147, + 441, + 762, + 1771, + 3447, + 3607, + 3608, + 1904, + 840, + 3037, + 86, + 939, + 1385, + 572, + 1370, + 2445, # 2800 + 1336, + 114, + 3703, + 898, + 294, + 203, + 3315, + 703, + 1583, + 2274, + 429, + 961, + 4333, + 1854, + 1951, + 3390, # 2816 + 2373, + 3704, + 4334, + 1318, + 1381, + 966, + 1911, + 2322, + 1006, + 1155, + 309, + 989, + 458, + 2718, + 1795, + 1372, # 2832 + 1203, + 252, + 1689, + 1363, + 3177, + 517, + 1936, + 168, + 1490, + 562, + 193, + 3823, + 1042, + 4117, + 1835, + 551, # 2848 + 470, + 4645, + 395, + 489, + 3448, + 1871, + 1465, + 2583, + 2641, + 417, + 1493, + 279, + 1295, + 511, + 1236, + 1119, # 2864 + 72, + 1231, + 1982, + 1812, + 3004, + 871, + 1564, + 984, + 3449, + 1667, + 2696, + 2096, + 4646, + 2347, + 2833, + 1673, # 2880 + 3609, + 695, + 3246, + 2668, + 807, + 1183, + 4647, + 890, + 388, + 2333, + 1801, + 1457, + 2911, + 1765, + 1477, + 1031, # 2896 + 3316, + 3317, + 1278, + 3391, + 2799, + 2292, + 2526, + 163, + 3450, + 4335, + 2669, + 1404, + 1802, + 6148, + 2323, + 2407, # 2912 + 1584, + 1728, + 1494, + 1824, + 1269, + 298, + 909, + 3318, + 1034, + 1632, + 375, + 776, + 1683, + 2061, + 291, + 210, # 2928 + 1123, + 809, + 1249, + 1002, + 2642, + 3038, + 206, + 1011, + 2132, + 144, + 975, + 882, + 1565, + 342, + 667, + 754, # 2944 + 1442, + 2143, + 1299, + 2303, + 2062, + 447, + 626, + 2205, + 1221, + 2739, + 2912, + 1144, + 1214, + 2206, + 2584, + 760, # 2960 + 1715, + 614, + 950, + 1281, + 2670, + 2621, + 810, + 577, + 1287, + 2546, + 4648, + 242, + 2168, + 250, + 2643, + 691, # 2976 + 123, + 2644, + 647, + 313, + 1029, + 689, + 1357, + 2946, + 1650, + 216, + 771, + 1339, + 1306, + 808, + 2063, + 549, # 2992 + 913, + 1371, + 2913, + 2914, + 6149, + 1466, + 1092, + 1174, + 1196, + 1311, + 2605, + 2396, + 1783, + 1796, + 3079, + 406, # 3008 + 2671, + 2117, + 3949, + 4649, + 487, + 1825, + 2220, + 6150, + 2915, + 448, + 2348, + 1073, + 6151, + 2397, + 1707, + 130, # 3024 + 900, + 1598, + 329, + 176, + 1959, + 2527, + 1620, + 6152, + 2275, + 4336, + 3319, + 1983, + 2191, + 3705, + 3610, + 2155, # 3040 + 3706, + 1912, + 1513, + 1614, + 6153, + 1988, + 646, + 392, + 2304, + 1589, + 3320, + 3039, + 1826, + 1239, + 1352, + 1340, # 3056 + 2916, + 505, + 2567, + 1709, + 1437, + 2408, + 2547, + 906, + 6154, + 2672, + 384, + 1458, + 1594, + 1100, + 1329, + 710, # 3072 + 423, + 3531, + 2064, + 2231, + 2622, + 1989, + 2673, + 1087, + 1882, + 333, + 841, + 3005, + 1296, + 2882, + 2379, + 580, # 3088 + 1937, + 1827, + 1293, + 2585, + 601, + 574, + 249, + 1772, + 4118, + 2079, + 1120, + 645, + 901, + 1176, + 1690, + 795, # 3104 + 2207, + 478, + 1434, + 516, + 1190, + 1530, + 761, + 2080, + 930, + 1264, + 355, + 435, + 1552, + 644, + 1791, + 987, # 3120 + 220, + 1364, + 1163, + 1121, + 1538, + 306, + 2169, + 1327, + 1222, + 546, + 2645, + 218, + 241, + 610, + 1704, + 3321, # 3136 + 1984, + 1839, + 1966, + 2528, + 451, + 6155, + 2586, + 3707, + 2568, + 907, + 3178, + 254, + 2947, + 186, + 1845, + 4650, # 3152 + 745, + 432, + 1757, + 428, + 1633, + 888, + 2246, + 2221, + 2489, + 3611, + 2118, + 1258, + 1265, + 956, + 3127, + 1784, # 3168 + 4337, + 2490, + 319, + 510, + 119, + 457, + 3612, + 274, + 2035, + 2007, + 4651, + 1409, + 3128, + 970, + 2758, + 590, # 3184 + 2800, + 661, + 2247, + 4652, + 2008, + 3950, + 1420, + 1549, + 3080, + 3322, + 3951, + 1651, + 1375, + 2111, + 485, + 2491, # 3200 + 1429, + 1156, + 6156, + 2548, + 2183, + 1495, + 831, + 1840, + 2529, + 2446, + 501, + 1657, + 307, + 1894, + 3247, + 1341, # 3216 + 666, + 899, + 2156, + 1539, + 2549, + 1559, + 886, + 349, + 2208, + 3081, + 2305, + 1736, + 3824, + 2170, + 2759, + 1014, # 3232 + 1913, + 1386, + 542, + 1397, + 2948, + 490, + 368, + 716, + 362, + 159, + 282, + 2569, + 1129, + 1658, + 1288, + 1750, # 3248 + 2674, + 276, + 649, + 2016, + 751, + 1496, + 658, + 1818, + 1284, + 1862, + 2209, + 2087, + 2512, + 3451, + 622, + 2834, # 3264 + 376, + 117, + 1060, + 2053, + 1208, + 1721, + 1101, + 1443, + 247, + 1250, + 3179, + 1792, + 3952, + 2760, + 2398, + 3953, # 3280 + 6157, + 2144, + 3708, + 446, + 2432, + 1151, + 2570, + 3452, + 2447, + 2761, + 2835, + 1210, + 2448, + 3082, + 424, + 2222, # 3296 + 1251, + 2449, + 2119, + 2836, + 504, + 1581, + 4338, + 602, + 817, + 857, + 3825, + 2349, + 2306, + 357, + 3826, + 1470, # 3312 + 1883, + 2883, + 255, + 958, + 929, + 2917, + 3248, + 302, + 4653, + 1050, + 1271, + 1751, + 2307, + 1952, + 1430, + 2697, # 3328 + 2719, + 2359, + 354, + 3180, + 777, + 158, + 2036, + 4339, + 1659, + 4340, + 4654, + 2308, + 2949, + 2248, + 1146, + 2232, # 3344 + 3532, + 2720, + 1696, + 2623, + 3827, + 6158, + 3129, + 1550, + 2698, + 1485, + 1297, + 1428, + 637, + 931, + 2721, + 2145, # 3360 + 914, + 2550, + 2587, + 81, + 2450, + 612, + 827, + 2646, + 1242, + 4655, + 1118, + 2884, + 472, + 1855, + 3181, + 3533, # 3376 + 3534, + 569, + 1353, + 2699, + 1244, + 1758, + 2588, + 4119, + 2009, + 2762, + 2171, + 3709, + 1312, + 1531, + 6159, + 1152, # 3392 + 1938, + 134, + 1830, + 471, + 3710, + 2276, + 1112, + 1535, + 3323, + 3453, + 3535, + 982, + 1337, + 2950, + 488, + 826, # 3408 + 674, + 1058, + 1628, + 4120, + 2017, + 522, + 2399, + 211, + 568, + 1367, + 3454, + 350, + 293, + 1872, + 1139, + 3249, # 3424 + 1399, + 1946, + 3006, + 1300, + 2360, + 3324, + 588, + 736, + 6160, + 2606, + 744, + 669, + 3536, + 3828, + 6161, + 1358, # 3440 + 199, + 723, + 848, + 933, + 851, + 1939, + 1505, + 1514, + 1338, + 1618, + 1831, + 4656, + 1634, + 3613, + 443, + 2740, # 3456 + 3829, + 717, + 1947, + 491, + 1914, + 6162, + 2551, + 1542, + 4121, + 1025, + 6163, + 1099, + 1223, + 198, + 3040, + 2722, # 3472 + 370, + 410, + 1905, + 2589, + 998, + 1248, + 3182, + 2380, + 519, + 1449, + 4122, + 1710, + 947, + 928, + 1153, + 4341, # 3488 + 2277, + 344, + 2624, + 1511, + 615, + 105, + 161, + 1212, + 1076, + 1960, + 3130, + 2054, + 1926, + 1175, + 1906, + 2473, # 3504 + 414, + 1873, + 2801, + 6164, + 2309, + 315, + 1319, + 3325, + 318, + 2018, + 2146, + 2157, + 963, + 631, + 223, + 4342, # 3520 + 4343, + 2675, + 479, + 3711, + 1197, + 2625, + 3712, + 2676, + 2361, + 6165, + 4344, + 4123, + 6166, + 2451, + 3183, + 1886, # 3536 + 2184, + 1674, + 1330, + 1711, + 1635, + 1506, + 799, + 219, + 3250, + 3083, + 3954, + 1677, + 3713, + 3326, + 2081, + 3614, # 3552 + 1652, + 2073, + 4657, + 1147, + 3041, + 1752, + 643, + 1961, + 147, + 1974, + 3955, + 6167, + 1716, + 2037, + 918, + 3007, # 3568 + 1994, + 120, + 1537, + 118, + 609, + 3184, + 4345, + 740, + 3455, + 1219, + 332, + 1615, + 3830, + 6168, + 1621, + 2980, # 3584 + 1582, + 783, + 212, + 553, + 2350, + 3714, + 1349, + 2433, + 2082, + 4124, + 889, + 6169, + 2310, + 1275, + 1410, + 973, # 3600 + 166, + 1320, + 3456, + 1797, + 1215, + 3185, + 2885, + 1846, + 2590, + 2763, + 4658, + 629, + 822, + 3008, + 763, + 940, # 3616 + 1990, + 2862, + 439, + 2409, + 1566, + 1240, + 1622, + 926, + 1282, + 1907, + 2764, + 654, + 2210, + 1607, + 327, + 1130, # 3632 + 3956, + 1678, + 1623, + 6170, + 2434, + 2192, + 686, + 608, + 3831, + 3715, + 903, + 3957, + 3042, + 6171, + 2741, + 1522, # 3648 + 1915, + 1105, + 1555, + 2552, + 1359, + 323, + 3251, + 4346, + 3457, + 738, + 1354, + 2553, + 2311, + 2334, + 1828, + 2003, # 3664 + 3832, + 1753, + 2351, + 1227, + 6172, + 1887, + 4125, + 1478, + 6173, + 2410, + 1874, + 1712, + 1847, + 520, + 1204, + 2607, # 3680 + 264, + 4659, + 836, + 2677, + 2102, + 600, + 4660, + 3833, + 2278, + 3084, + 6174, + 4347, + 3615, + 1342, + 640, + 532, # 3696 + 543, + 2608, + 1888, + 2400, + 2591, + 1009, + 4348, + 1497, + 341, + 1737, + 3616, + 2723, + 1394, + 529, + 3252, + 1321, # 3712 + 983, + 4661, + 1515, + 2120, + 971, + 2592, + 924, + 287, + 1662, + 3186, + 4349, + 2700, + 4350, + 1519, + 908, + 1948, # 3728 + 2452, + 156, + 796, + 1629, + 1486, + 2223, + 2055, + 694, + 4126, + 1259, + 1036, + 3392, + 1213, + 2249, + 2742, + 1889, # 3744 + 1230, + 3958, + 1015, + 910, + 408, + 559, + 3617, + 4662, + 746, + 725, + 935, + 4663, + 3959, + 3009, + 1289, + 563, # 3760 + 867, + 4664, + 3960, + 1567, + 2981, + 2038, + 2626, + 988, + 2263, + 2381, + 4351, + 143, + 2374, + 704, + 1895, + 6175, # 3776 + 1188, + 3716, + 2088, + 673, + 3085, + 2362, + 4352, + 484, + 1608, + 1921, + 2765, + 2918, + 215, + 904, + 3618, + 3537, # 3792 + 894, + 509, + 976, + 3043, + 2701, + 3961, + 4353, + 2837, + 2982, + 498, + 6176, + 6177, + 1102, + 3538, + 1332, + 3393, # 3808 + 1487, + 1636, + 1637, + 233, + 245, + 3962, + 383, + 650, + 995, + 3044, + 460, + 1520, + 1206, + 2352, + 749, + 3327, # 3824 + 530, + 700, + 389, + 1438, + 1560, + 1773, + 3963, + 2264, + 719, + 2951, + 2724, + 3834, + 870, + 1832, + 1644, + 1000, # 3840 + 839, + 2474, + 3717, + 197, + 1630, + 3394, + 365, + 2886, + 3964, + 1285, + 2133, + 734, + 922, + 818, + 1106, + 732, # 3856 + 480, + 2083, + 1774, + 3458, + 923, + 2279, + 1350, + 221, + 3086, + 85, + 2233, + 2234, + 3835, + 1585, + 3010, + 2147, # 3872 + 1387, + 1705, + 2382, + 1619, + 2475, + 133, + 239, + 2802, + 1991, + 1016, + 2084, + 2383, + 411, + 2838, + 1113, + 651, # 3888 + 1985, + 1160, + 3328, + 990, + 1863, + 3087, + 1048, + 1276, + 2647, + 265, + 2627, + 1599, + 3253, + 2056, + 150, + 638, # 3904 + 2019, + 656, + 853, + 326, + 1479, + 680, + 1439, + 4354, + 1001, + 1759, + 413, + 3459, + 3395, + 2492, + 1431, + 459, # 3920 + 4355, + 1125, + 3329, + 2265, + 1953, + 1450, + 2065, + 2863, + 849, + 351, + 2678, + 3131, + 3254, + 3255, + 1104, + 1577, # 3936 + 227, + 1351, + 1645, + 2453, + 2193, + 1421, + 2887, + 812, + 2121, + 634, + 95, + 2435, + 201, + 2312, + 4665, + 1646, # 3952 + 1671, + 2743, + 1601, + 2554, + 2702, + 2648, + 2280, + 1315, + 1366, + 2089, + 3132, + 1573, + 3718, + 3965, + 1729, + 1189, # 3968 + 328, + 2679, + 1077, + 1940, + 1136, + 558, + 1283, + 964, + 1195, + 621, + 2074, + 1199, + 1743, + 3460, + 3619, + 1896, # 3984 + 1916, + 1890, + 3836, + 2952, + 1154, + 2112, + 1064, + 862, + 378, + 3011, + 2066, + 2113, + 2803, + 1568, + 2839, + 6178, # 4000 + 3088, + 2919, + 1941, + 1660, + 2004, + 1992, + 2194, + 142, + 707, + 1590, + 1708, + 1624, + 1922, + 1023, + 1836, + 1233, # 4016 + 1004, + 2313, + 789, + 741, + 3620, + 6179, + 1609, + 2411, + 1200, + 4127, + 3719, + 3720, + 4666, + 2057, + 3721, + 593, # 4032 + 2840, + 367, + 2920, + 1878, + 6180, + 3461, + 1521, + 628, + 1168, + 692, + 2211, + 2649, + 300, + 720, + 2067, + 2571, # 4048 + 2953, + 3396, + 959, + 2504, + 3966, + 3539, + 3462, + 1977, + 701, + 6181, + 954, + 1043, + 800, + 681, + 183, + 3722, # 4064 + 1803, + 1730, + 3540, + 4128, + 2103, + 815, + 2314, + 174, + 467, + 230, + 2454, + 1093, + 2134, + 755, + 3541, + 3397, # 4080 + 1141, + 1162, + 6182, + 1738, + 2039, + 270, + 3256, + 2513, + 1005, + 1647, + 2185, + 3837, + 858, + 1679, + 1897, + 1719, # 4096 + 2954, + 2324, + 1806, + 402, + 670, + 167, + 4129, + 1498, + 2158, + 2104, + 750, + 6183, + 915, + 189, + 1680, + 1551, # 4112 + 455, + 4356, + 1501, + 2455, + 405, + 1095, + 2955, + 338, + 1586, + 1266, + 1819, + 570, + 641, + 1324, + 237, + 1556, # 4128 + 2650, + 1388, + 3723, + 6184, + 1368, + 2384, + 1343, + 1978, + 3089, + 2436, + 879, + 3724, + 792, + 1191, + 758, + 3012, # 4144 + 1411, + 2135, + 1322, + 4357, + 240, + 4667, + 1848, + 3725, + 1574, + 6185, + 420, + 3045, + 1546, + 1391, + 714, + 4358, # 4160 + 1967, + 941, + 1864, + 863, + 664, + 426, + 560, + 1731, + 2680, + 1785, + 2864, + 1949, + 2363, + 403, + 3330, + 1415, # 4176 + 1279, + 2136, + 1697, + 2335, + 204, + 721, + 2097, + 3838, + 90, + 6186, + 2085, + 2505, + 191, + 3967, + 124, + 2148, # 4192 + 1376, + 1798, + 1178, + 1107, + 1898, + 1405, + 860, + 4359, + 1243, + 1272, + 2375, + 2983, + 1558, + 2456, + 1638, + 113, # 4208 + 3621, + 578, + 1923, + 2609, + 880, + 386, + 4130, + 784, + 2186, + 2266, + 1422, + 2956, + 2172, + 1722, + 497, + 263, # 4224 + 2514, + 1267, + 2412, + 2610, + 177, + 2703, + 3542, + 774, + 1927, + 1344, + 616, + 1432, + 1595, + 1018, + 172, + 4360, # 4240 + 2325, + 911, + 4361, + 438, + 1468, + 3622, + 794, + 3968, + 2024, + 2173, + 1681, + 1829, + 2957, + 945, + 895, + 3090, # 4256 + 575, + 2212, + 2476, + 475, + 2401, + 2681, + 785, + 2744, + 1745, + 2293, + 2555, + 1975, + 3133, + 2865, + 394, + 4668, # 4272 + 3839, + 635, + 4131, + 639, + 202, + 1507, + 2195, + 2766, + 1345, + 1435, + 2572, + 3726, + 1908, + 1184, + 1181, + 2457, # 4288 + 3727, + 3134, + 4362, + 843, + 2611, + 437, + 916, + 4669, + 234, + 769, + 1884, + 3046, + 3047, + 3623, + 833, + 6187, # 4304 + 1639, + 2250, + 2402, + 1355, + 1185, + 2010, + 2047, + 999, + 525, + 1732, + 1290, + 1488, + 2612, + 948, + 1578, + 3728, # 4320 + 2413, + 2477, + 1216, + 2725, + 2159, + 334, + 3840, + 1328, + 3624, + 2921, + 1525, + 4132, + 564, + 1056, + 891, + 4363, # 4336 + 1444, + 1698, + 2385, + 2251, + 3729, + 1365, + 2281, + 2235, + 1717, + 6188, + 864, + 3841, + 2515, + 444, + 527, + 2767, # 4352 + 2922, + 3625, + 544, + 461, + 6189, + 566, + 209, + 2437, + 3398, + 2098, + 1065, + 2068, + 3331, + 3626, + 3257, + 2137, # 4368 #last 512 ) - - diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/jpcntx.py b/src/fetchcode/vcs/pip/_vendor/chardet/jpcntx.py index 20044e4b..c186c95c 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/jpcntx.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/jpcntx.py @@ -28,91 +28,7064 @@ # This is hiragana 2-char sequence table, the number in each cell represents its frequency category jp2CharContext = ( -(0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1), -(2,4,0,4,0,3,0,4,0,3,4,4,4,2,4,3,3,4,3,2,3,3,4,2,3,3,3,2,4,1,4,3,3,1,5,4,3,4,3,4,3,5,3,0,3,5,4,2,0,3,1,0,3,3,0,3,3,0,1,1,0,4,3,0,3,3,0,4,0,2,0,3,5,5,5,5,4,0,4,1,0,3,4), -(0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2), -(0,4,0,5,0,5,0,4,0,4,5,4,4,3,5,3,5,1,5,3,4,3,4,4,3,4,3,3,4,3,5,4,4,3,5,5,3,5,5,5,3,5,5,3,4,5,5,3,1,3,2,0,3,4,0,4,2,0,4,2,1,5,3,2,3,5,0,4,0,2,0,5,4,4,5,4,5,0,4,0,0,4,4), -(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), -(0,3,0,4,0,3,0,3,0,4,5,4,3,3,3,3,4,3,5,4,4,3,5,4,4,3,4,3,4,4,4,4,5,3,4,4,3,4,5,5,4,5,5,1,4,5,4,3,0,3,3,1,3,3,0,4,4,0,3,3,1,5,3,3,3,5,0,4,0,3,0,4,4,3,4,3,3,0,4,1,1,3,4), -(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), -(0,4,0,3,0,3,0,4,0,3,4,4,3,2,2,1,2,1,3,1,3,3,3,3,3,4,3,1,3,3,5,3,3,0,4,3,0,5,4,3,3,5,4,4,3,4,4,5,0,1,2,0,1,2,0,2,2,0,1,0,0,5,2,2,1,4,0,3,0,1,0,4,4,3,5,4,3,0,2,1,0,4,3), -(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), -(0,3,0,5,0,4,0,2,1,4,4,2,4,1,4,2,4,2,4,3,3,3,4,3,3,3,3,1,4,2,3,3,3,1,4,4,1,1,1,4,3,3,2,0,2,4,3,2,0,3,3,0,3,1,1,0,0,0,3,3,0,4,2,2,3,4,0,4,0,3,0,4,4,5,3,4,4,0,3,0,0,1,4), -(1,4,0,4,0,4,0,4,0,3,5,4,4,3,4,3,5,4,3,3,4,3,5,4,4,4,4,3,4,2,4,3,3,1,5,4,3,2,4,5,4,5,5,4,4,5,4,4,0,3,2,2,3,3,0,4,3,1,3,2,1,4,3,3,4,5,0,3,0,2,0,4,5,5,4,5,4,0,4,0,0,5,4), -(0,5,0,5,0,4,0,3,0,4,4,3,4,3,3,3,4,0,4,4,4,3,4,3,4,3,3,1,4,2,4,3,4,0,5,4,1,4,5,4,4,5,3,2,4,3,4,3,2,4,1,3,3,3,2,3,2,0,4,3,3,4,3,3,3,4,0,4,0,3,0,4,5,4,4,4,3,0,4,1,0,1,3), -(0,3,1,4,0,3,0,2,0,3,4,4,3,1,4,2,3,3,4,3,4,3,4,3,4,4,3,2,3,1,5,4,4,1,4,4,3,5,4,4,3,5,5,4,3,4,4,3,1,2,3,1,2,2,0,3,2,0,3,1,0,5,3,3,3,4,3,3,3,3,4,4,4,4,5,4,2,0,3,3,2,4,3), -(0,2,0,3,0,1,0,1,0,0,3,2,0,0,2,0,1,0,2,1,3,3,3,1,2,3,1,0,1,0,4,2,1,1,3,3,0,4,3,3,1,4,3,3,0,3,3,2,0,0,0,0,1,0,0,2,0,0,0,0,0,4,1,0,2,3,2,2,2,1,3,3,3,4,4,3,2,0,3,1,0,3,3), -(0,4,0,4,0,3,0,3,0,4,4,4,3,3,3,3,3,3,4,3,4,2,4,3,4,3,3,2,4,3,4,5,4,1,4,5,3,5,4,5,3,5,4,0,3,5,5,3,1,3,3,2,2,3,0,3,4,1,3,3,2,4,3,3,3,4,0,4,0,3,0,4,5,4,4,5,3,0,4,1,0,3,4), -(0,2,0,3,0,3,0,0,0,2,2,2,1,0,1,0,0,0,3,0,3,0,3,0,1,3,1,0,3,1,3,3,3,1,3,3,3,0,1,3,1,3,4,0,0,3,1,1,0,3,2,0,0,0,0,1,3,0,1,0,0,3,3,2,0,3,0,0,0,0,0,3,4,3,4,3,3,0,3,0,0,2,3), -(2,3,0,3,0,2,0,1,0,3,3,4,3,1,3,1,1,1,3,1,4,3,4,3,3,3,0,0,3,1,5,4,3,1,4,3,2,5,5,4,4,4,4,3,3,4,4,4,0,2,1,1,3,2,0,1,2,0,0,1,0,4,1,3,3,3,0,3,0,1,0,4,4,4,5,5,3,0,2,0,0,4,4), -(0,2,0,1,0,3,1,3,0,2,3,3,3,0,3,1,0,0,3,0,3,2,3,1,3,2,1,1,0,0,4,2,1,0,2,3,1,4,3,2,0,4,4,3,1,3,1,3,0,1,0,0,1,0,0,0,1,0,0,0,0,4,1,1,1,2,0,3,0,0,0,3,4,2,4,3,2,0,1,0,0,3,3), -(0,1,0,4,0,5,0,4,0,2,4,4,2,3,3,2,3,3,5,3,3,3,4,3,4,2,3,0,4,3,3,3,4,1,4,3,2,1,5,5,3,4,5,1,3,5,4,2,0,3,3,0,1,3,0,4,2,0,1,3,1,4,3,3,3,3,0,3,0,1,0,3,4,4,4,5,5,0,3,0,1,4,5), -(0,2,0,3,0,3,0,0,0,2,3,1,3,0,4,0,1,1,3,0,3,4,3,2,3,1,0,3,3,2,3,1,3,0,2,3,0,2,1,4,1,2,2,0,0,3,3,0,0,2,0,0,0,1,0,0,0,0,2,2,0,3,2,1,3,3,0,2,0,2,0,0,3,3,1,2,4,0,3,0,2,2,3), -(2,4,0,5,0,4,0,4,0,2,4,4,4,3,4,3,3,3,1,2,4,3,4,3,4,4,5,0,3,3,3,3,2,0,4,3,1,4,3,4,1,4,4,3,3,4,4,3,1,2,3,0,4,2,0,4,1,0,3,3,0,4,3,3,3,4,0,4,0,2,0,3,5,3,4,5,2,0,3,0,0,4,5), -(0,3,0,4,0,1,0,1,0,1,3,2,2,1,3,0,3,0,2,0,2,0,3,0,2,0,0,0,1,0,1,1,0,0,3,1,0,0,0,4,0,3,1,0,2,1,3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,4,2,2,3,1,0,3,0,0,0,1,4,4,4,3,0,0,4,0,0,1,4), -(1,4,1,5,0,3,0,3,0,4,5,4,4,3,5,3,3,4,4,3,4,1,3,3,3,3,2,1,4,1,5,4,3,1,4,4,3,5,4,4,3,5,4,3,3,4,4,4,0,3,3,1,2,3,0,3,1,0,3,3,0,5,4,4,4,4,4,4,3,3,5,4,4,3,3,5,4,0,3,2,0,4,4), -(0,2,0,3,0,1,0,0,0,1,3,3,3,2,4,1,3,0,3,1,3,0,2,2,1,1,0,0,2,0,4,3,1,0,4,3,0,4,4,4,1,4,3,1,1,3,3,1,0,2,0,0,1,3,0,0,0,0,2,0,0,4,3,2,4,3,5,4,3,3,3,4,3,3,4,3,3,0,2,1,0,3,3), -(0,2,0,4,0,3,0,2,0,2,5,5,3,4,4,4,4,1,4,3,3,0,4,3,4,3,1,3,3,2,4,3,0,3,4,3,0,3,4,4,2,4,4,0,4,5,3,3,2,2,1,1,1,2,0,1,5,0,3,3,2,4,3,3,3,4,0,3,0,2,0,4,4,3,5,5,0,0,3,0,2,3,3), -(0,3,0,4,0,3,0,1,0,3,4,3,3,1,3,3,3,0,3,1,3,0,4,3,3,1,1,0,3,0,3,3,0,0,4,4,0,1,5,4,3,3,5,0,3,3,4,3,0,2,0,1,1,1,0,1,3,0,1,2,1,3,3,2,3,3,0,3,0,1,0,1,3,3,4,4,1,0,1,2,2,1,3), -(0,1,0,4,0,4,0,3,0,1,3,3,3,2,3,1,1,0,3,0,3,3,4,3,2,4,2,0,1,0,4,3,2,0,4,3,0,5,3,3,2,4,4,4,3,3,3,4,0,1,3,0,0,1,0,0,1,0,0,0,0,4,2,3,3,3,0,3,0,0,0,4,4,4,5,3,2,0,3,3,0,3,5), -(0,2,0,3,0,0,0,3,0,1,3,0,2,0,0,0,1,0,3,1,1,3,3,0,0,3,0,0,3,0,2,3,1,0,3,1,0,3,3,2,0,4,2,2,0,2,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,2,1,2,0,1,0,1,0,0,0,1,3,1,2,0,0,0,1,0,0,1,4), -(0,3,0,3,0,5,0,1,0,2,4,3,1,3,3,2,1,1,5,2,1,0,5,1,2,0,0,0,3,3,2,2,3,2,4,3,0,0,3,3,1,3,3,0,2,5,3,4,0,3,3,0,1,2,0,2,2,0,3,2,0,2,2,3,3,3,0,2,0,1,0,3,4,4,2,5,4,0,3,0,0,3,5), -(0,3,0,3,0,3,0,1,0,3,3,3,3,0,3,0,2,0,2,1,1,0,2,0,1,0,0,0,2,1,0,0,1,0,3,2,0,0,3,3,1,2,3,1,0,3,3,0,0,1,0,0,0,0,0,2,0,0,0,0,0,2,3,1,2,3,0,3,0,1,0,3,2,1,0,4,3,0,1,1,0,3,3), -(0,4,0,5,0,3,0,3,0,4,5,5,4,3,5,3,4,3,5,3,3,2,5,3,4,4,4,3,4,3,4,5,5,3,4,4,3,4,4,5,4,4,4,3,4,5,5,4,2,3,4,2,3,4,0,3,3,1,4,3,2,4,3,3,5,5,0,3,0,3,0,5,5,5,5,4,4,0,4,0,1,4,4), -(0,4,0,4,0,3,0,3,0,3,5,4,4,2,3,2,5,1,3,2,5,1,4,2,3,2,3,3,4,3,3,3,3,2,5,4,1,3,3,5,3,4,4,0,4,4,3,1,1,3,1,0,2,3,0,2,3,0,3,0,0,4,3,1,3,4,0,3,0,2,0,4,4,4,3,4,5,0,4,0,0,3,4), -(0,3,0,3,0,3,1,2,0,3,4,4,3,3,3,0,2,2,4,3,3,1,3,3,3,1,1,0,3,1,4,3,2,3,4,4,2,4,4,4,3,4,4,3,2,4,4,3,1,3,3,1,3,3,0,4,1,0,2,2,1,4,3,2,3,3,5,4,3,3,5,4,4,3,3,0,4,0,3,2,2,4,4), -(0,2,0,1,0,0,0,0,0,1,2,1,3,0,0,0,0,0,2,0,1,2,1,0,0,1,0,0,0,0,3,0,0,1,0,1,1,3,1,0,0,0,1,1,0,1,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,1,2,2,0,3,4,0,0,0,1,1,0,0,1,0,0,0,0,0,1,1), -(0,1,0,0,0,1,0,0,0,0,4,0,4,1,4,0,3,0,4,0,3,0,4,0,3,0,3,0,4,1,5,1,4,0,0,3,0,5,0,5,2,0,1,0,0,0,2,1,4,0,1,3,0,0,3,0,0,3,1,1,4,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), -(1,4,0,5,0,3,0,2,0,3,5,4,4,3,4,3,5,3,4,3,3,0,4,3,3,3,3,3,3,2,4,4,3,1,3,4,4,5,4,4,3,4,4,1,3,5,4,3,3,3,1,2,2,3,3,1,3,1,3,3,3,5,3,3,4,5,0,3,0,3,0,3,4,3,4,4,3,0,3,0,2,4,3), -(0,1,0,4,0,0,0,0,0,1,4,0,4,1,4,2,4,0,3,0,1,0,1,0,0,0,0,0,2,0,3,1,1,1,0,3,0,0,0,1,2,1,0,0,1,1,1,1,0,1,0,0,0,1,0,0,3,0,0,0,0,3,2,0,2,2,0,1,0,0,0,2,3,2,3,3,0,0,0,0,2,1,0), -(0,5,1,5,0,3,0,3,0,5,4,4,5,1,5,3,3,0,4,3,4,3,5,3,4,3,3,2,4,3,4,3,3,0,3,3,1,4,4,3,4,4,4,3,4,5,5,3,2,3,1,1,3,3,1,3,1,1,3,3,2,4,5,3,3,5,0,4,0,3,0,4,4,3,5,3,3,0,3,4,0,4,3), -(0,5,0,5,0,3,0,2,0,4,4,3,5,2,4,3,3,3,4,4,4,3,5,3,5,3,3,1,4,0,4,3,3,0,3,3,0,4,4,4,4,5,4,3,3,5,5,3,2,3,1,2,3,2,0,1,0,0,3,2,2,4,4,3,1,5,0,4,0,3,0,4,3,1,3,2,1,0,3,3,0,3,3), -(0,4,0,5,0,5,0,4,0,4,5,5,5,3,4,3,3,2,5,4,4,3,5,3,5,3,4,0,4,3,4,4,3,2,4,4,3,4,5,4,4,5,5,0,3,5,5,4,1,3,3,2,3,3,1,3,1,0,4,3,1,4,4,3,4,5,0,4,0,2,0,4,3,4,4,3,3,0,4,0,0,5,5), -(0,4,0,4,0,5,0,1,1,3,3,4,4,3,4,1,3,0,5,1,3,0,3,1,3,1,1,0,3,0,3,3,4,0,4,3,0,4,4,4,3,4,4,0,3,5,4,1,0,3,0,0,2,3,0,3,1,0,3,1,0,3,2,1,3,5,0,3,0,1,0,3,2,3,3,4,4,0,2,2,0,4,4), -(2,4,0,5,0,4,0,3,0,4,5,5,4,3,5,3,5,3,5,3,5,2,5,3,4,3,3,4,3,4,5,3,2,1,5,4,3,2,3,4,5,3,4,1,2,5,4,3,0,3,3,0,3,2,0,2,3,0,4,1,0,3,4,3,3,5,0,3,0,1,0,4,5,5,5,4,3,0,4,2,0,3,5), -(0,5,0,4,0,4,0,2,0,5,4,3,4,3,4,3,3,3,4,3,4,2,5,3,5,3,4,1,4,3,4,4,4,0,3,5,0,4,4,4,4,5,3,1,3,4,5,3,3,3,3,3,3,3,0,2,2,0,3,3,2,4,3,3,3,5,3,4,1,3,3,5,3,2,0,0,0,0,4,3,1,3,3), -(0,1,0,3,0,3,0,1,0,1,3,3,3,2,3,3,3,0,3,0,0,0,3,1,3,0,0,0,2,2,2,3,0,0,3,2,0,1,2,4,1,3,3,0,0,3,3,3,0,1,0,0,2,1,0,0,3,0,3,1,0,3,0,0,1,3,0,2,0,1,0,3,3,1,3,3,0,0,1,1,0,3,3), -(0,2,0,3,0,2,1,4,0,2,2,3,1,1,3,1,1,0,2,0,3,1,2,3,1,3,0,0,1,0,4,3,2,3,3,3,1,4,2,3,3,3,3,1,0,3,1,4,0,1,1,0,1,2,0,1,1,0,1,1,0,3,1,3,2,2,0,1,0,0,0,2,3,3,3,1,0,0,0,0,0,2,3), -(0,5,0,4,0,5,0,2,0,4,5,5,3,3,4,3,3,1,5,4,4,2,4,4,4,3,4,2,4,3,5,5,4,3,3,4,3,3,5,5,4,5,5,1,3,4,5,3,1,4,3,1,3,3,0,3,3,1,4,3,1,4,5,3,3,5,0,4,0,3,0,5,3,3,1,4,3,0,4,0,1,5,3), -(0,5,0,5,0,4,0,2,0,4,4,3,4,3,3,3,3,3,5,4,4,4,4,4,4,5,3,3,5,2,4,4,4,3,4,4,3,3,4,4,5,5,3,3,4,3,4,3,3,4,3,3,3,3,1,2,2,1,4,3,3,5,4,4,3,4,0,4,0,3,0,4,4,4,4,4,1,0,4,2,0,2,4), -(0,4,0,4,0,3,0,1,0,3,5,2,3,0,3,0,2,1,4,2,3,3,4,1,4,3,3,2,4,1,3,3,3,0,3,3,0,0,3,3,3,5,3,3,3,3,3,2,0,2,0,0,2,0,0,2,0,0,1,0,0,3,1,2,2,3,0,3,0,2,0,4,4,3,3,4,1,0,3,0,0,2,4), -(0,0,0,4,0,0,0,0,0,0,1,0,1,0,2,0,0,0,0,0,1,0,2,0,1,0,0,0,0,0,3,1,3,0,3,2,0,0,0,1,0,3,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,2,0,0,0,0,0,0,2), -(0,2,1,3,0,2,0,2,0,3,3,3,3,1,3,1,3,3,3,3,3,3,4,2,2,1,2,1,4,0,4,3,1,3,3,3,2,4,3,5,4,3,3,3,3,3,3,3,0,1,3,0,2,0,0,1,0,0,1,0,0,4,2,0,2,3,0,3,3,0,3,3,4,2,3,1,4,0,1,2,0,2,3), -(0,3,0,3,0,1,0,3,0,2,3,3,3,0,3,1,2,0,3,3,2,3,3,2,3,2,3,1,3,0,4,3,2,0,3,3,1,4,3,3,2,3,4,3,1,3,3,1,1,0,1,1,0,1,0,1,0,1,0,0,0,4,1,1,0,3,0,3,1,0,2,3,3,3,3,3,1,0,0,2,0,3,3), -(0,0,0,0,0,0,0,0,0,0,3,0,2,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,3,0,3,0,3,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,2,3,0,0,0,0,0,0,0,0,3), -(0,2,0,3,1,3,0,3,0,2,3,3,3,1,3,1,3,1,3,1,3,3,3,1,3,0,2,3,1,1,4,3,3,2,3,3,1,2,2,4,1,3,3,0,1,4,2,3,0,1,3,0,3,0,0,1,3,0,2,0,0,3,3,2,1,3,0,3,0,2,0,3,4,4,4,3,1,0,3,0,0,3,3), -(0,2,0,1,0,2,0,0,0,1,3,2,2,1,3,0,1,1,3,0,3,2,3,1,2,0,2,0,1,1,3,3,3,0,3,3,1,1,2,3,2,3,3,1,2,3,2,0,0,1,0,0,0,0,0,0,3,0,1,0,0,2,1,2,1,3,0,3,0,0,0,3,4,4,4,3,2,0,2,0,0,2,4), -(0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,3,1,0,0,0,0,0,0,0,3), -(0,3,0,3,0,2,0,3,0,3,3,3,2,3,2,2,2,0,3,1,3,3,3,2,3,3,0,0,3,0,3,2,2,0,2,3,1,4,3,4,3,3,2,3,1,5,4,4,0,3,1,2,1,3,0,3,1,1,2,0,2,3,1,3,1,3,0,3,0,1,0,3,3,4,4,2,1,0,2,1,0,2,4), -(0,1,0,3,0,1,0,2,0,1,4,2,5,1,4,0,2,0,2,1,3,1,4,0,2,1,0,0,2,1,4,1,1,0,3,3,0,5,1,3,2,3,3,1,0,3,2,3,0,1,0,0,0,0,0,0,1,0,0,0,0,4,0,1,0,3,0,2,0,1,0,3,3,3,4,3,3,0,0,0,0,2,3), -(0,0,0,1,0,0,0,0,0,0,2,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,3), -(0,1,0,3,0,4,0,3,0,2,4,3,1,0,3,2,2,1,3,1,2,2,3,1,1,1,2,1,3,0,1,2,0,1,3,2,1,3,0,5,5,1,0,0,1,3,2,1,0,3,0,0,1,0,0,0,0,0,3,4,0,1,1,1,3,2,0,2,0,1,0,2,3,3,1,2,3,0,1,0,1,0,4), -(0,0,0,1,0,3,0,3,0,2,2,1,0,0,4,0,3,0,3,1,3,0,3,0,3,0,1,0,3,0,3,1,3,0,3,3,0,0,1,2,1,1,1,0,1,2,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,2,2,1,2,0,0,2,0,0,0,0,2,3,3,3,3,0,0,0,0,1,4), -(0,0,0,3,0,3,0,0,0,0,3,1,1,0,3,0,1,0,2,0,1,0,0,0,0,0,0,0,1,0,3,0,2,0,2,3,0,0,2,2,3,1,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0,2,3), -(2,4,0,5,0,5,0,4,0,3,4,3,3,3,4,3,3,3,4,3,4,4,5,4,5,5,5,2,3,0,5,5,4,1,5,4,3,1,5,4,3,4,4,3,3,4,3,3,0,3,2,0,2,3,0,3,0,0,3,3,0,5,3,2,3,3,0,3,0,3,0,3,4,5,4,5,3,0,4,3,0,3,4), -(0,3,0,3,0,3,0,3,0,3,3,4,3,2,3,2,3,0,4,3,3,3,3,3,3,3,3,0,3,2,4,3,3,1,3,4,3,4,4,4,3,4,4,3,2,4,4,1,0,2,0,0,1,1,0,2,0,0,3,1,0,5,3,2,1,3,0,3,0,1,2,4,3,2,4,3,3,0,3,2,0,4,4), -(0,3,0,3,0,1,0,0,0,1,4,3,3,2,3,1,3,1,4,2,3,2,4,2,3,4,3,0,2,2,3,3,3,0,3,3,3,0,3,4,1,3,3,0,3,4,3,3,0,1,1,0,1,0,0,0,4,0,3,0,0,3,1,2,1,3,0,4,0,1,0,4,3,3,4,3,3,0,2,0,0,3,3), -(0,3,0,4,0,1,0,3,0,3,4,3,3,0,3,3,3,1,3,1,3,3,4,3,3,3,0,0,3,1,5,3,3,1,3,3,2,5,4,3,3,4,5,3,2,5,3,4,0,1,0,0,0,0,0,2,0,0,1,1,0,4,2,2,1,3,0,3,0,2,0,4,4,3,5,3,2,0,1,1,0,3,4), -(0,5,0,4,0,5,0,2,0,4,4,3,3,2,3,3,3,1,4,3,4,1,5,3,4,3,4,0,4,2,4,3,4,1,5,4,0,4,4,4,4,5,4,1,3,5,4,2,1,4,1,1,3,2,0,3,1,0,3,2,1,4,3,3,3,4,0,4,0,3,0,4,4,4,3,3,3,0,4,2,0,3,4), -(1,4,0,4,0,3,0,1,0,3,3,3,1,1,3,3,2,2,3,3,1,0,3,2,2,1,2,0,3,1,2,1,2,0,3,2,0,2,2,3,3,4,3,0,3,3,1,2,0,1,1,3,1,2,0,0,3,0,1,1,0,3,2,2,3,3,0,3,0,0,0,2,3,3,4,3,3,0,1,0,0,1,4), -(0,4,0,4,0,4,0,0,0,3,4,4,3,1,4,2,3,2,3,3,3,1,4,3,4,0,3,0,4,2,3,3,2,2,5,4,2,1,3,4,3,4,3,1,3,3,4,2,0,2,1,0,3,3,0,0,2,0,3,1,0,4,4,3,4,3,0,4,0,1,0,2,4,4,4,4,4,0,3,2,0,3,3), -(0,0,0,1,0,4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,3,2,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2), -(0,2,0,3,0,4,0,4,0,1,3,3,3,0,4,0,2,1,2,1,1,1,2,0,3,1,1,0,1,0,3,1,0,0,3,3,2,0,1,1,0,0,0,0,0,1,0,2,0,2,2,0,3,1,0,0,1,0,1,1,0,1,2,0,3,0,0,0,0,1,0,0,3,3,4,3,1,0,1,0,3,0,2), -(0,0,0,3,0,5,0,0,0,0,1,0,2,0,3,1,0,1,3,0,0,0,2,0,0,0,1,0,0,0,1,1,0,0,4,0,0,0,2,3,0,1,4,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,3,0,0,0,0,0,3), -(0,2,0,5,0,5,0,1,0,2,4,3,3,2,5,1,3,2,3,3,3,0,4,1,2,0,3,0,4,0,2,2,1,1,5,3,0,0,1,4,2,3,2,0,3,3,3,2,0,2,4,1,1,2,0,1,1,0,3,1,0,1,3,1,2,3,0,2,0,0,0,1,3,5,4,4,4,0,3,0,0,1,3), -(0,4,0,5,0,4,0,4,0,4,5,4,3,3,4,3,3,3,4,3,4,4,5,3,4,5,4,2,4,2,3,4,3,1,4,4,1,3,5,4,4,5,5,4,4,5,5,5,2,3,3,1,4,3,1,3,3,0,3,3,1,4,3,4,4,4,0,3,0,4,0,3,3,4,4,5,0,0,4,3,0,4,5), -(0,4,0,4,0,3,0,3,0,3,4,4,4,3,3,2,4,3,4,3,4,3,5,3,4,3,2,1,4,2,4,4,3,1,3,4,2,4,5,5,3,4,5,4,1,5,4,3,0,3,2,2,3,2,1,3,1,0,3,3,3,5,3,3,3,5,4,4,2,3,3,4,3,3,3,2,1,0,3,2,1,4,3), -(0,4,0,5,0,4,0,3,0,3,5,5,3,2,4,3,4,0,5,4,4,1,4,4,4,3,3,3,4,3,5,5,2,3,3,4,1,2,5,5,3,5,5,2,3,5,5,4,0,3,2,0,3,3,1,1,5,1,4,1,0,4,3,2,3,5,0,4,0,3,0,5,4,3,4,3,0,0,4,1,0,4,4), -(1,3,0,4,0,2,0,2,0,2,5,5,3,3,3,3,3,0,4,2,3,4,4,4,3,4,0,0,3,4,5,4,3,3,3,3,2,5,5,4,5,5,5,4,3,5,5,5,1,3,1,0,1,0,0,3,2,0,4,2,0,5,2,3,2,4,1,3,0,3,0,4,5,4,5,4,3,0,4,2,0,5,4), -(0,3,0,4,0,5,0,3,0,3,4,4,3,2,3,2,3,3,3,3,3,2,4,3,3,2,2,0,3,3,3,3,3,1,3,3,3,0,4,4,3,4,4,1,1,4,4,2,0,3,1,0,1,1,0,4,1,0,2,3,1,3,3,1,3,4,0,3,0,1,0,3,1,3,0,0,1,0,2,0,0,4,4), -(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), -(0,3,0,3,0,2,0,3,0,1,5,4,3,3,3,1,4,2,1,2,3,4,4,2,4,4,5,0,3,1,4,3,4,0,4,3,3,3,2,3,2,5,3,4,3,2,2,3,0,0,3,0,2,1,0,1,2,0,0,0,0,2,1,1,3,1,0,2,0,4,0,3,4,4,4,5,2,0,2,0,0,1,3), -(0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,4,2,1,1,0,1,0,3,2,0,0,3,1,1,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,2,0,0,0,1,4,0,4,2,1,0,0,0,0,0,1), -(0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,3,1,0,0,0,2,0,2,1,0,0,1,2,1,0,1,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,1,3,1,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,2), -(0,4,0,4,0,4,0,3,0,4,4,3,4,2,4,3,2,0,4,4,4,3,5,3,5,3,3,2,4,2,4,3,4,3,1,4,0,2,3,4,4,4,3,3,3,4,4,4,3,4,1,3,4,3,2,1,2,1,3,3,3,4,4,3,3,5,0,4,0,3,0,4,3,3,3,2,1,0,3,0,0,3,3), -(0,4,0,3,0,3,0,3,0,3,5,5,3,3,3,3,4,3,4,3,3,3,4,4,4,3,3,3,3,4,3,5,3,3,1,3,2,4,5,5,5,5,4,3,4,5,5,3,2,2,3,3,3,3,2,3,3,1,2,3,2,4,3,3,3,4,0,4,0,2,0,4,3,2,2,1,2,0,3,0,0,4,1), + ( + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + ), + ( + 2, + 4, + 0, + 4, + 0, + 3, + 0, + 4, + 0, + 3, + 4, + 4, + 4, + 2, + 4, + 3, + 3, + 4, + 3, + 2, + 3, + 3, + 4, + 2, + 3, + 3, + 3, + 2, + 4, + 1, + 4, + 3, + 3, + 1, + 5, + 4, + 3, + 4, + 3, + 4, + 3, + 5, + 3, + 0, + 3, + 5, + 4, + 2, + 0, + 3, + 1, + 0, + 3, + 3, + 0, + 3, + 3, + 0, + 1, + 1, + 0, + 4, + 3, + 0, + 3, + 3, + 0, + 4, + 0, + 2, + 0, + 3, + 5, + 5, + 5, + 5, + 4, + 0, + 4, + 1, + 0, + 3, + 4, + ), + ( + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + ), + ( + 0, + 4, + 0, + 5, + 0, + 5, + 0, + 4, + 0, + 4, + 5, + 4, + 4, + 3, + 5, + 3, + 5, + 1, + 5, + 3, + 4, + 3, + 4, + 4, + 3, + 4, + 3, + 3, + 4, + 3, + 5, + 4, + 4, + 3, + 5, + 5, + 3, + 5, + 5, + 5, + 3, + 5, + 5, + 3, + 4, + 5, + 5, + 3, + 1, + 3, + 2, + 0, + 3, + 4, + 0, + 4, + 2, + 0, + 4, + 2, + 1, + 5, + 3, + 2, + 3, + 5, + 0, + 4, + 0, + 2, + 0, + 5, + 4, + 4, + 5, + 4, + 5, + 0, + 4, + 0, + 0, + 4, + 4, + ), + ( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ), + ( + 0, + 3, + 0, + 4, + 0, + 3, + 0, + 3, + 0, + 4, + 5, + 4, + 3, + 3, + 3, + 3, + 4, + 3, + 5, + 4, + 4, + 3, + 5, + 4, + 4, + 3, + 4, + 3, + 4, + 4, + 4, + 4, + 5, + 3, + 4, + 4, + 3, + 4, + 5, + 5, + 4, + 5, + 5, + 1, + 4, + 5, + 4, + 3, + 0, + 3, + 3, + 1, + 3, + 3, + 0, + 4, + 4, + 0, + 3, + 3, + 1, + 5, + 3, + 3, + 3, + 5, + 0, + 4, + 0, + 3, + 0, + 4, + 4, + 3, + 4, + 3, + 3, + 0, + 4, + 1, + 1, + 3, + 4, + ), + ( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ), + ( + 0, + 4, + 0, + 3, + 0, + 3, + 0, + 4, + 0, + 3, + 4, + 4, + 3, + 2, + 2, + 1, + 2, + 1, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 4, + 3, + 1, + 3, + 3, + 5, + 3, + 3, + 0, + 4, + 3, + 0, + 5, + 4, + 3, + 3, + 5, + 4, + 4, + 3, + 4, + 4, + 5, + 0, + 1, + 2, + 0, + 1, + 2, + 0, + 2, + 2, + 0, + 1, + 0, + 0, + 5, + 2, + 2, + 1, + 4, + 0, + 3, + 0, + 1, + 0, + 4, + 4, + 3, + 5, + 4, + 3, + 0, + 2, + 1, + 0, + 4, + 3, + ), + ( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ), + ( + 0, + 3, + 0, + 5, + 0, + 4, + 0, + 2, + 1, + 4, + 4, + 2, + 4, + 1, + 4, + 2, + 4, + 2, + 4, + 3, + 3, + 3, + 4, + 3, + 3, + 3, + 3, + 1, + 4, + 2, + 3, + 3, + 3, + 1, + 4, + 4, + 1, + 1, + 1, + 4, + 3, + 3, + 2, + 0, + 2, + 4, + 3, + 2, + 0, + 3, + 3, + 0, + 3, + 1, + 1, + 0, + 0, + 0, + 3, + 3, + 0, + 4, + 2, + 2, + 3, + 4, + 0, + 4, + 0, + 3, + 0, + 4, + 4, + 5, + 3, + 4, + 4, + 0, + 3, + 0, + 0, + 1, + 4, + ), + ( + 1, + 4, + 0, + 4, + 0, + 4, + 0, + 4, + 0, + 3, + 5, + 4, + 4, + 3, + 4, + 3, + 5, + 4, + 3, + 3, + 4, + 3, + 5, + 4, + 4, + 4, + 4, + 3, + 4, + 2, + 4, + 3, + 3, + 1, + 5, + 4, + 3, + 2, + 4, + 5, + 4, + 5, + 5, + 4, + 4, + 5, + 4, + 4, + 0, + 3, + 2, + 2, + 3, + 3, + 0, + 4, + 3, + 1, + 3, + 2, + 1, + 4, + 3, + 3, + 4, + 5, + 0, + 3, + 0, + 2, + 0, + 4, + 5, + 5, + 4, + 5, + 4, + 0, + 4, + 0, + 0, + 5, + 4, + ), + ( + 0, + 5, + 0, + 5, + 0, + 4, + 0, + 3, + 0, + 4, + 4, + 3, + 4, + 3, + 3, + 3, + 4, + 0, + 4, + 4, + 4, + 3, + 4, + 3, + 4, + 3, + 3, + 1, + 4, + 2, + 4, + 3, + 4, + 0, + 5, + 4, + 1, + 4, + 5, + 4, + 4, + 5, + 3, + 2, + 4, + 3, + 4, + 3, + 2, + 4, + 1, + 3, + 3, + 3, + 2, + 3, + 2, + 0, + 4, + 3, + 3, + 4, + 3, + 3, + 3, + 4, + 0, + 4, + 0, + 3, + 0, + 4, + 5, + 4, + 4, + 4, + 3, + 0, + 4, + 1, + 0, + 1, + 3, + ), + ( + 0, + 3, + 1, + 4, + 0, + 3, + 0, + 2, + 0, + 3, + 4, + 4, + 3, + 1, + 4, + 2, + 3, + 3, + 4, + 3, + 4, + 3, + 4, + 3, + 4, + 4, + 3, + 2, + 3, + 1, + 5, + 4, + 4, + 1, + 4, + 4, + 3, + 5, + 4, + 4, + 3, + 5, + 5, + 4, + 3, + 4, + 4, + 3, + 1, + 2, + 3, + 1, + 2, + 2, + 0, + 3, + 2, + 0, + 3, + 1, + 0, + 5, + 3, + 3, + 3, + 4, + 3, + 3, + 3, + 3, + 4, + 4, + 4, + 4, + 5, + 4, + 2, + 0, + 3, + 3, + 2, + 4, + 3, + ), + ( + 0, + 2, + 0, + 3, + 0, + 1, + 0, + 1, + 0, + 0, + 3, + 2, + 0, + 0, + 2, + 0, + 1, + 0, + 2, + 1, + 3, + 3, + 3, + 1, + 2, + 3, + 1, + 0, + 1, + 0, + 4, + 2, + 1, + 1, + 3, + 3, + 0, + 4, + 3, + 3, + 1, + 4, + 3, + 3, + 0, + 3, + 3, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 4, + 1, + 0, + 2, + 3, + 2, + 2, + 2, + 1, + 3, + 3, + 3, + 4, + 4, + 3, + 2, + 0, + 3, + 1, + 0, + 3, + 3, + ), + ( + 0, + 4, + 0, + 4, + 0, + 3, + 0, + 3, + 0, + 4, + 4, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 4, + 3, + 4, + 2, + 4, + 3, + 4, + 3, + 3, + 2, + 4, + 3, + 4, + 5, + 4, + 1, + 4, + 5, + 3, + 5, + 4, + 5, + 3, + 5, + 4, + 0, + 3, + 5, + 5, + 3, + 1, + 3, + 3, + 2, + 2, + 3, + 0, + 3, + 4, + 1, + 3, + 3, + 2, + 4, + 3, + 3, + 3, + 4, + 0, + 4, + 0, + 3, + 0, + 4, + 5, + 4, + 4, + 5, + 3, + 0, + 4, + 1, + 0, + 3, + 4, + ), + ( + 0, + 2, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 2, + 2, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 3, + 0, + 1, + 3, + 1, + 0, + 3, + 1, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 0, + 1, + 3, + 1, + 3, + 4, + 0, + 0, + 3, + 1, + 1, + 0, + 3, + 2, + 0, + 0, + 0, + 0, + 1, + 3, + 0, + 1, + 0, + 0, + 3, + 3, + 2, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 3, + 4, + 3, + 4, + 3, + 3, + 0, + 3, + 0, + 0, + 2, + 3, + ), + ( + 2, + 3, + 0, + 3, + 0, + 2, + 0, + 1, + 0, + 3, + 3, + 4, + 3, + 1, + 3, + 1, + 1, + 1, + 3, + 1, + 4, + 3, + 4, + 3, + 3, + 3, + 0, + 0, + 3, + 1, + 5, + 4, + 3, + 1, + 4, + 3, + 2, + 5, + 5, + 4, + 4, + 4, + 4, + 3, + 3, + 4, + 4, + 4, + 0, + 2, + 1, + 1, + 3, + 2, + 0, + 1, + 2, + 0, + 0, + 1, + 0, + 4, + 1, + 3, + 3, + 3, + 0, + 3, + 0, + 1, + 0, + 4, + 4, + 4, + 5, + 5, + 3, + 0, + 2, + 0, + 0, + 4, + 4, + ), + ( + 0, + 2, + 0, + 1, + 0, + 3, + 1, + 3, + 0, + 2, + 3, + 3, + 3, + 0, + 3, + 1, + 0, + 0, + 3, + 0, + 3, + 2, + 3, + 1, + 3, + 2, + 1, + 1, + 0, + 0, + 4, + 2, + 1, + 0, + 2, + 3, + 1, + 4, + 3, + 2, + 0, + 4, + 4, + 3, + 1, + 3, + 1, + 3, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 4, + 1, + 1, + 1, + 2, + 0, + 3, + 0, + 0, + 0, + 3, + 4, + 2, + 4, + 3, + 2, + 0, + 1, + 0, + 0, + 3, + 3, + ), + ( + 0, + 1, + 0, + 4, + 0, + 5, + 0, + 4, + 0, + 2, + 4, + 4, + 2, + 3, + 3, + 2, + 3, + 3, + 5, + 3, + 3, + 3, + 4, + 3, + 4, + 2, + 3, + 0, + 4, + 3, + 3, + 3, + 4, + 1, + 4, + 3, + 2, + 1, + 5, + 5, + 3, + 4, + 5, + 1, + 3, + 5, + 4, + 2, + 0, + 3, + 3, + 0, + 1, + 3, + 0, + 4, + 2, + 0, + 1, + 3, + 1, + 4, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 1, + 0, + 3, + 4, + 4, + 4, + 5, + 5, + 0, + 3, + 0, + 1, + 4, + 5, + ), + ( + 0, + 2, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 2, + 3, + 1, + 3, + 0, + 4, + 0, + 1, + 1, + 3, + 0, + 3, + 4, + 3, + 2, + 3, + 1, + 0, + 3, + 3, + 2, + 3, + 1, + 3, + 0, + 2, + 3, + 0, + 2, + 1, + 4, + 1, + 2, + 2, + 0, + 0, + 3, + 3, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 3, + 2, + 1, + 3, + 3, + 0, + 2, + 0, + 2, + 0, + 0, + 3, + 3, + 1, + 2, + 4, + 0, + 3, + 0, + 2, + 2, + 3, + ), + ( + 2, + 4, + 0, + 5, + 0, + 4, + 0, + 4, + 0, + 2, + 4, + 4, + 4, + 3, + 4, + 3, + 3, + 3, + 1, + 2, + 4, + 3, + 4, + 3, + 4, + 4, + 5, + 0, + 3, + 3, + 3, + 3, + 2, + 0, + 4, + 3, + 1, + 4, + 3, + 4, + 1, + 4, + 4, + 3, + 3, + 4, + 4, + 3, + 1, + 2, + 3, + 0, + 4, + 2, + 0, + 4, + 1, + 0, + 3, + 3, + 0, + 4, + 3, + 3, + 3, + 4, + 0, + 4, + 0, + 2, + 0, + 3, + 5, + 3, + 4, + 5, + 2, + 0, + 3, + 0, + 0, + 4, + 5, + ), + ( + 0, + 3, + 0, + 4, + 0, + 1, + 0, + 1, + 0, + 1, + 3, + 2, + 2, + 1, + 3, + 0, + 3, + 0, + 2, + 0, + 2, + 0, + 3, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 4, + 0, + 3, + 1, + 0, + 2, + 1, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 2, + 2, + 3, + 1, + 0, + 3, + 0, + 0, + 0, + 1, + 4, + 4, + 4, + 3, + 0, + 0, + 4, + 0, + 0, + 1, + 4, + ), + ( + 1, + 4, + 1, + 5, + 0, + 3, + 0, + 3, + 0, + 4, + 5, + 4, + 4, + 3, + 5, + 3, + 3, + 4, + 4, + 3, + 4, + 1, + 3, + 3, + 3, + 3, + 2, + 1, + 4, + 1, + 5, + 4, + 3, + 1, + 4, + 4, + 3, + 5, + 4, + 4, + 3, + 5, + 4, + 3, + 3, + 4, + 4, + 4, + 0, + 3, + 3, + 1, + 2, + 3, + 0, + 3, + 1, + 0, + 3, + 3, + 0, + 5, + 4, + 4, + 4, + 4, + 4, + 4, + 3, + 3, + 5, + 4, + 4, + 3, + 3, + 5, + 4, + 0, + 3, + 2, + 0, + 4, + 4, + ), + ( + 0, + 2, + 0, + 3, + 0, + 1, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 2, + 4, + 1, + 3, + 0, + 3, + 1, + 3, + 0, + 2, + 2, + 1, + 1, + 0, + 0, + 2, + 0, + 4, + 3, + 1, + 0, + 4, + 3, + 0, + 4, + 4, + 4, + 1, + 4, + 3, + 1, + 1, + 3, + 3, + 1, + 0, + 2, + 0, + 0, + 1, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 4, + 3, + 2, + 4, + 3, + 5, + 4, + 3, + 3, + 3, + 4, + 3, + 3, + 4, + 3, + 3, + 0, + 2, + 1, + 0, + 3, + 3, + ), + ( + 0, + 2, + 0, + 4, + 0, + 3, + 0, + 2, + 0, + 2, + 5, + 5, + 3, + 4, + 4, + 4, + 4, + 1, + 4, + 3, + 3, + 0, + 4, + 3, + 4, + 3, + 1, + 3, + 3, + 2, + 4, + 3, + 0, + 3, + 4, + 3, + 0, + 3, + 4, + 4, + 2, + 4, + 4, + 0, + 4, + 5, + 3, + 3, + 2, + 2, + 1, + 1, + 1, + 2, + 0, + 1, + 5, + 0, + 3, + 3, + 2, + 4, + 3, + 3, + 3, + 4, + 0, + 3, + 0, + 2, + 0, + 4, + 4, + 3, + 5, + 5, + 0, + 0, + 3, + 0, + 2, + 3, + 3, + ), + ( + 0, + 3, + 0, + 4, + 0, + 3, + 0, + 1, + 0, + 3, + 4, + 3, + 3, + 1, + 3, + 3, + 3, + 0, + 3, + 1, + 3, + 0, + 4, + 3, + 3, + 1, + 1, + 0, + 3, + 0, + 3, + 3, + 0, + 0, + 4, + 4, + 0, + 1, + 5, + 4, + 3, + 3, + 5, + 0, + 3, + 3, + 4, + 3, + 0, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 3, + 0, + 1, + 2, + 1, + 3, + 3, + 2, + 3, + 3, + 0, + 3, + 0, + 1, + 0, + 1, + 3, + 3, + 4, + 4, + 1, + 0, + 1, + 2, + 2, + 1, + 3, + ), + ( + 0, + 1, + 0, + 4, + 0, + 4, + 0, + 3, + 0, + 1, + 3, + 3, + 3, + 2, + 3, + 1, + 1, + 0, + 3, + 0, + 3, + 3, + 4, + 3, + 2, + 4, + 2, + 0, + 1, + 0, + 4, + 3, + 2, + 0, + 4, + 3, + 0, + 5, + 3, + 3, + 2, + 4, + 4, + 4, + 3, + 3, + 3, + 4, + 0, + 1, + 3, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 4, + 2, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 4, + 4, + 4, + 5, + 3, + 2, + 0, + 3, + 3, + 0, + 3, + 5, + ), + ( + 0, + 2, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 1, + 3, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 3, + 1, + 1, + 3, + 3, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 2, + 3, + 1, + 0, + 3, + 1, + 0, + 3, + 3, + 2, + 0, + 4, + 2, + 2, + 0, + 2, + 0, + 0, + 0, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 3, + 1, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 4, + ), + ( + 0, + 3, + 0, + 3, + 0, + 5, + 0, + 1, + 0, + 2, + 4, + 3, + 1, + 3, + 3, + 2, + 1, + 1, + 5, + 2, + 1, + 0, + 5, + 1, + 2, + 0, + 0, + 0, + 3, + 3, + 2, + 2, + 3, + 2, + 4, + 3, + 0, + 0, + 3, + 3, + 1, + 3, + 3, + 0, + 2, + 5, + 3, + 4, + 0, + 3, + 3, + 0, + 1, + 2, + 0, + 2, + 2, + 0, + 3, + 2, + 0, + 2, + 2, + 3, + 3, + 3, + 0, + 2, + 0, + 1, + 0, + 3, + 4, + 4, + 2, + 5, + 4, + 0, + 3, + 0, + 0, + 3, + 5, + ), + ( + 0, + 3, + 0, + 3, + 0, + 3, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 2, + 0, + 2, + 1, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 1, + 0, + 3, + 2, + 0, + 0, + 3, + 3, + 1, + 2, + 3, + 1, + 0, + 3, + 3, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 1, + 2, + 3, + 0, + 3, + 0, + 1, + 0, + 3, + 2, + 1, + 0, + 4, + 3, + 0, + 1, + 1, + 0, + 3, + 3, + ), + ( + 0, + 4, + 0, + 5, + 0, + 3, + 0, + 3, + 0, + 4, + 5, + 5, + 4, + 3, + 5, + 3, + 4, + 3, + 5, + 3, + 3, + 2, + 5, + 3, + 4, + 4, + 4, + 3, + 4, + 3, + 4, + 5, + 5, + 3, + 4, + 4, + 3, + 4, + 4, + 5, + 4, + 4, + 4, + 3, + 4, + 5, + 5, + 4, + 2, + 3, + 4, + 2, + 3, + 4, + 0, + 3, + 3, + 1, + 4, + 3, + 2, + 4, + 3, + 3, + 5, + 5, + 0, + 3, + 0, + 3, + 0, + 5, + 5, + 5, + 5, + 4, + 4, + 0, + 4, + 0, + 1, + 4, + 4, + ), + ( + 0, + 4, + 0, + 4, + 0, + 3, + 0, + 3, + 0, + 3, + 5, + 4, + 4, + 2, + 3, + 2, + 5, + 1, + 3, + 2, + 5, + 1, + 4, + 2, + 3, + 2, + 3, + 3, + 4, + 3, + 3, + 3, + 3, + 2, + 5, + 4, + 1, + 3, + 3, + 5, + 3, + 4, + 4, + 0, + 4, + 4, + 3, + 1, + 1, + 3, + 1, + 0, + 2, + 3, + 0, + 2, + 3, + 0, + 3, + 0, + 0, + 4, + 3, + 1, + 3, + 4, + 0, + 3, + 0, + 2, + 0, + 4, + 4, + 4, + 3, + 4, + 5, + 0, + 4, + 0, + 0, + 3, + 4, + ), + ( + 0, + 3, + 0, + 3, + 0, + 3, + 1, + 2, + 0, + 3, + 4, + 4, + 3, + 3, + 3, + 0, + 2, + 2, + 4, + 3, + 3, + 1, + 3, + 3, + 3, + 1, + 1, + 0, + 3, + 1, + 4, + 3, + 2, + 3, + 4, + 4, + 2, + 4, + 4, + 4, + 3, + 4, + 4, + 3, + 2, + 4, + 4, + 3, + 1, + 3, + 3, + 1, + 3, + 3, + 0, + 4, + 1, + 0, + 2, + 2, + 1, + 4, + 3, + 2, + 3, + 3, + 5, + 4, + 3, + 3, + 5, + 4, + 4, + 3, + 3, + 0, + 4, + 0, + 3, + 2, + 2, + 4, + 4, + ), + ( + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 3, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 1, + 0, + 1, + 1, + 3, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 2, + 0, + 3, + 4, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + ), + ( + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 4, + 0, + 4, + 1, + 4, + 0, + 3, + 0, + 4, + 0, + 3, + 0, + 4, + 0, + 3, + 0, + 3, + 0, + 4, + 1, + 5, + 1, + 4, + 0, + 0, + 3, + 0, + 5, + 0, + 5, + 2, + 0, + 1, + 0, + 0, + 0, + 2, + 1, + 4, + 0, + 1, + 3, + 0, + 0, + 3, + 0, + 0, + 3, + 1, + 1, + 4, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ), + ( + 1, + 4, + 0, + 5, + 0, + 3, + 0, + 2, + 0, + 3, + 5, + 4, + 4, + 3, + 4, + 3, + 5, + 3, + 4, + 3, + 3, + 0, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 4, + 4, + 3, + 1, + 3, + 4, + 4, + 5, + 4, + 4, + 3, + 4, + 4, + 1, + 3, + 5, + 4, + 3, + 3, + 3, + 1, + 2, + 2, + 3, + 3, + 1, + 3, + 1, + 3, + 3, + 3, + 5, + 3, + 3, + 4, + 5, + 0, + 3, + 0, + 3, + 0, + 3, + 4, + 3, + 4, + 4, + 3, + 0, + 3, + 0, + 2, + 4, + 3, + ), + ( + 0, + 1, + 0, + 4, + 0, + 0, + 0, + 0, + 0, + 1, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 0, + 3, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 3, + 1, + 1, + 1, + 0, + 3, + 0, + 0, + 0, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 2, + 0, + 2, + 2, + 0, + 1, + 0, + 0, + 0, + 2, + 3, + 2, + 3, + 3, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + ), + ( + 0, + 5, + 1, + 5, + 0, + 3, + 0, + 3, + 0, + 5, + 4, + 4, + 5, + 1, + 5, + 3, + 3, + 0, + 4, + 3, + 4, + 3, + 5, + 3, + 4, + 3, + 3, + 2, + 4, + 3, + 4, + 3, + 3, + 0, + 3, + 3, + 1, + 4, + 4, + 3, + 4, + 4, + 4, + 3, + 4, + 5, + 5, + 3, + 2, + 3, + 1, + 1, + 3, + 3, + 1, + 3, + 1, + 1, + 3, + 3, + 2, + 4, + 5, + 3, + 3, + 5, + 0, + 4, + 0, + 3, + 0, + 4, + 4, + 3, + 5, + 3, + 3, + 0, + 3, + 4, + 0, + 4, + 3, + ), + ( + 0, + 5, + 0, + 5, + 0, + 3, + 0, + 2, + 0, + 4, + 4, + 3, + 5, + 2, + 4, + 3, + 3, + 3, + 4, + 4, + 4, + 3, + 5, + 3, + 5, + 3, + 3, + 1, + 4, + 0, + 4, + 3, + 3, + 0, + 3, + 3, + 0, + 4, + 4, + 4, + 4, + 5, + 4, + 3, + 3, + 5, + 5, + 3, + 2, + 3, + 1, + 2, + 3, + 2, + 0, + 1, + 0, + 0, + 3, + 2, + 2, + 4, + 4, + 3, + 1, + 5, + 0, + 4, + 0, + 3, + 0, + 4, + 3, + 1, + 3, + 2, + 1, + 0, + 3, + 3, + 0, + 3, + 3, + ), + ( + 0, + 4, + 0, + 5, + 0, + 5, + 0, + 4, + 0, + 4, + 5, + 5, + 5, + 3, + 4, + 3, + 3, + 2, + 5, + 4, + 4, + 3, + 5, + 3, + 5, + 3, + 4, + 0, + 4, + 3, + 4, + 4, + 3, + 2, + 4, + 4, + 3, + 4, + 5, + 4, + 4, + 5, + 5, + 0, + 3, + 5, + 5, + 4, + 1, + 3, + 3, + 2, + 3, + 3, + 1, + 3, + 1, + 0, + 4, + 3, + 1, + 4, + 4, + 3, + 4, + 5, + 0, + 4, + 0, + 2, + 0, + 4, + 3, + 4, + 4, + 3, + 3, + 0, + 4, + 0, + 0, + 5, + 5, + ), + ( + 0, + 4, + 0, + 4, + 0, + 5, + 0, + 1, + 1, + 3, + 3, + 4, + 4, + 3, + 4, + 1, + 3, + 0, + 5, + 1, + 3, + 0, + 3, + 1, + 3, + 1, + 1, + 0, + 3, + 0, + 3, + 3, + 4, + 0, + 4, + 3, + 0, + 4, + 4, + 4, + 3, + 4, + 4, + 0, + 3, + 5, + 4, + 1, + 0, + 3, + 0, + 0, + 2, + 3, + 0, + 3, + 1, + 0, + 3, + 1, + 0, + 3, + 2, + 1, + 3, + 5, + 0, + 3, + 0, + 1, + 0, + 3, + 2, + 3, + 3, + 4, + 4, + 0, + 2, + 2, + 0, + 4, + 4, + ), + ( + 2, + 4, + 0, + 5, + 0, + 4, + 0, + 3, + 0, + 4, + 5, + 5, + 4, + 3, + 5, + 3, + 5, + 3, + 5, + 3, + 5, + 2, + 5, + 3, + 4, + 3, + 3, + 4, + 3, + 4, + 5, + 3, + 2, + 1, + 5, + 4, + 3, + 2, + 3, + 4, + 5, + 3, + 4, + 1, + 2, + 5, + 4, + 3, + 0, + 3, + 3, + 0, + 3, + 2, + 0, + 2, + 3, + 0, + 4, + 1, + 0, + 3, + 4, + 3, + 3, + 5, + 0, + 3, + 0, + 1, + 0, + 4, + 5, + 5, + 5, + 4, + 3, + 0, + 4, + 2, + 0, + 3, + 5, + ), + ( + 0, + 5, + 0, + 4, + 0, + 4, + 0, + 2, + 0, + 5, + 4, + 3, + 4, + 3, + 4, + 3, + 3, + 3, + 4, + 3, + 4, + 2, + 5, + 3, + 5, + 3, + 4, + 1, + 4, + 3, + 4, + 4, + 4, + 0, + 3, + 5, + 0, + 4, + 4, + 4, + 4, + 5, + 3, + 1, + 3, + 4, + 5, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 2, + 2, + 0, + 3, + 3, + 2, + 4, + 3, + 3, + 3, + 5, + 3, + 4, + 1, + 3, + 3, + 5, + 3, + 2, + 0, + 0, + 0, + 0, + 4, + 3, + 1, + 3, + 3, + ), + ( + 0, + 1, + 0, + 3, + 0, + 3, + 0, + 1, + 0, + 1, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 1, + 3, + 0, + 0, + 0, + 2, + 2, + 2, + 3, + 0, + 0, + 3, + 2, + 0, + 1, + 2, + 4, + 1, + 3, + 3, + 0, + 0, + 3, + 3, + 3, + 0, + 1, + 0, + 0, + 2, + 1, + 0, + 0, + 3, + 0, + 3, + 1, + 0, + 3, + 0, + 0, + 1, + 3, + 0, + 2, + 0, + 1, + 0, + 3, + 3, + 1, + 3, + 3, + 0, + 0, + 1, + 1, + 0, + 3, + 3, + ), + ( + 0, + 2, + 0, + 3, + 0, + 2, + 1, + 4, + 0, + 2, + 2, + 3, + 1, + 1, + 3, + 1, + 1, + 0, + 2, + 0, + 3, + 1, + 2, + 3, + 1, + 3, + 0, + 0, + 1, + 0, + 4, + 3, + 2, + 3, + 3, + 3, + 1, + 4, + 2, + 3, + 3, + 3, + 3, + 1, + 0, + 3, + 1, + 4, + 0, + 1, + 1, + 0, + 1, + 2, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 3, + 1, + 3, + 2, + 2, + 0, + 1, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + ), + ( + 0, + 5, + 0, + 4, + 0, + 5, + 0, + 2, + 0, + 4, + 5, + 5, + 3, + 3, + 4, + 3, + 3, + 1, + 5, + 4, + 4, + 2, + 4, + 4, + 4, + 3, + 4, + 2, + 4, + 3, + 5, + 5, + 4, + 3, + 3, + 4, + 3, + 3, + 5, + 5, + 4, + 5, + 5, + 1, + 3, + 4, + 5, + 3, + 1, + 4, + 3, + 1, + 3, + 3, + 0, + 3, + 3, + 1, + 4, + 3, + 1, + 4, + 5, + 3, + 3, + 5, + 0, + 4, + 0, + 3, + 0, + 5, + 3, + 3, + 1, + 4, + 3, + 0, + 4, + 0, + 1, + 5, + 3, + ), + ( + 0, + 5, + 0, + 5, + 0, + 4, + 0, + 2, + 0, + 4, + 4, + 3, + 4, + 3, + 3, + 3, + 3, + 3, + 5, + 4, + 4, + 4, + 4, + 4, + 4, + 5, + 3, + 3, + 5, + 2, + 4, + 4, + 4, + 3, + 4, + 4, + 3, + 3, + 4, + 4, + 5, + 5, + 3, + 3, + 4, + 3, + 4, + 3, + 3, + 4, + 3, + 3, + 3, + 3, + 1, + 2, + 2, + 1, + 4, + 3, + 3, + 5, + 4, + 4, + 3, + 4, + 0, + 4, + 0, + 3, + 0, + 4, + 4, + 4, + 4, + 4, + 1, + 0, + 4, + 2, + 0, + 2, + 4, + ), + ( + 0, + 4, + 0, + 4, + 0, + 3, + 0, + 1, + 0, + 3, + 5, + 2, + 3, + 0, + 3, + 0, + 2, + 1, + 4, + 2, + 3, + 3, + 4, + 1, + 4, + 3, + 3, + 2, + 4, + 1, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 0, + 3, + 3, + 3, + 5, + 3, + 3, + 3, + 3, + 3, + 2, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 3, + 1, + 2, + 2, + 3, + 0, + 3, + 0, + 2, + 0, + 4, + 4, + 3, + 3, + 4, + 1, + 0, + 3, + 0, + 0, + 2, + 4, + ), + ( + 0, + 0, + 0, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 3, + 0, + 3, + 2, + 0, + 0, + 0, + 1, + 0, + 3, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 4, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + ), + ( + 0, + 2, + 1, + 3, + 0, + 2, + 0, + 2, + 0, + 3, + 3, + 3, + 3, + 1, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 4, + 2, + 2, + 1, + 2, + 1, + 4, + 0, + 4, + 3, + 1, + 3, + 3, + 3, + 2, + 4, + 3, + 5, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 1, + 3, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 4, + 2, + 0, + 2, + 3, + 0, + 3, + 3, + 0, + 3, + 3, + 4, + 2, + 3, + 1, + 4, + 0, + 1, + 2, + 0, + 2, + 3, + ), + ( + 0, + 3, + 0, + 3, + 0, + 1, + 0, + 3, + 0, + 2, + 3, + 3, + 3, + 0, + 3, + 1, + 2, + 0, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 2, + 3, + 1, + 3, + 0, + 4, + 3, + 2, + 0, + 3, + 3, + 1, + 4, + 3, + 3, + 2, + 3, + 4, + 3, + 1, + 3, + 3, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 4, + 1, + 1, + 0, + 3, + 0, + 3, + 1, + 0, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 0, + 0, + 2, + 0, + 3, + 3, + ), + ( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 3, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 0, + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + ), + ( + 0, + 2, + 0, + 3, + 1, + 3, + 0, + 3, + 0, + 2, + 3, + 3, + 3, + 1, + 3, + 1, + 3, + 1, + 3, + 1, + 3, + 3, + 3, + 1, + 3, + 0, + 2, + 3, + 1, + 1, + 4, + 3, + 3, + 2, + 3, + 3, + 1, + 2, + 2, + 4, + 1, + 3, + 3, + 0, + 1, + 4, + 2, + 3, + 0, + 1, + 3, + 0, + 3, + 0, + 0, + 1, + 3, + 0, + 2, + 0, + 0, + 3, + 3, + 2, + 1, + 3, + 0, + 3, + 0, + 2, + 0, + 3, + 4, + 4, + 4, + 3, + 1, + 0, + 3, + 0, + 0, + 3, + 3, + ), + ( + 0, + 2, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 1, + 3, + 2, + 2, + 1, + 3, + 0, + 1, + 1, + 3, + 0, + 3, + 2, + 3, + 1, + 2, + 0, + 2, + 0, + 1, + 1, + 3, + 3, + 3, + 0, + 3, + 3, + 1, + 1, + 2, + 3, + 2, + 3, + 3, + 1, + 2, + 3, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 2, + 1, + 2, + 1, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 4, + 4, + 4, + 3, + 2, + 0, + 2, + 0, + 0, + 2, + 4, + ), + ( + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + ), + ( + 0, + 3, + 0, + 3, + 0, + 2, + 0, + 3, + 0, + 3, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 0, + 3, + 1, + 3, + 3, + 3, + 2, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 2, + 2, + 0, + 2, + 3, + 1, + 4, + 3, + 4, + 3, + 3, + 2, + 3, + 1, + 5, + 4, + 4, + 0, + 3, + 1, + 2, + 1, + 3, + 0, + 3, + 1, + 1, + 2, + 0, + 2, + 3, + 1, + 3, + 1, + 3, + 0, + 3, + 0, + 1, + 0, + 3, + 3, + 4, + 4, + 2, + 1, + 0, + 2, + 1, + 0, + 2, + 4, + ), + ( + 0, + 1, + 0, + 3, + 0, + 1, + 0, + 2, + 0, + 1, + 4, + 2, + 5, + 1, + 4, + 0, + 2, + 0, + 2, + 1, + 3, + 1, + 4, + 0, + 2, + 1, + 0, + 0, + 2, + 1, + 4, + 1, + 1, + 0, + 3, + 3, + 0, + 5, + 1, + 3, + 2, + 3, + 3, + 1, + 0, + 3, + 2, + 3, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 4, + 0, + 1, + 0, + 3, + 0, + 2, + 0, + 1, + 0, + 3, + 3, + 3, + 4, + 3, + 3, + 0, + 0, + 0, + 0, + 2, + 3, + ), + ( + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + ), + ( + 0, + 1, + 0, + 3, + 0, + 4, + 0, + 3, + 0, + 2, + 4, + 3, + 1, + 0, + 3, + 2, + 2, + 1, + 3, + 1, + 2, + 2, + 3, + 1, + 1, + 1, + 2, + 1, + 3, + 0, + 1, + 2, + 0, + 1, + 3, + 2, + 1, + 3, + 0, + 5, + 5, + 1, + 0, + 0, + 1, + 3, + 2, + 1, + 0, + 3, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 4, + 0, + 1, + 1, + 1, + 3, + 2, + 0, + 2, + 0, + 1, + 0, + 2, + 3, + 3, + 1, + 2, + 3, + 0, + 1, + 0, + 1, + 0, + 4, + ), + ( + 0, + 0, + 0, + 1, + 0, + 3, + 0, + 3, + 0, + 2, + 2, + 1, + 0, + 0, + 4, + 0, + 3, + 0, + 3, + 1, + 3, + 0, + 3, + 0, + 3, + 0, + 1, + 0, + 3, + 0, + 3, + 1, + 3, + 0, + 3, + 3, + 0, + 0, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 1, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 1, + 4, + ), + ( + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 0, + 3, + 0, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 0, + 2, + 0, + 2, + 3, + 0, + 0, + 2, + 2, + 3, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 3, + ), + ( + 2, + 4, + 0, + 5, + 0, + 5, + 0, + 4, + 0, + 3, + 4, + 3, + 3, + 3, + 4, + 3, + 3, + 3, + 4, + 3, + 4, + 4, + 5, + 4, + 5, + 5, + 5, + 2, + 3, + 0, + 5, + 5, + 4, + 1, + 5, + 4, + 3, + 1, + 5, + 4, + 3, + 4, + 4, + 3, + 3, + 4, + 3, + 3, + 0, + 3, + 2, + 0, + 2, + 3, + 0, + 3, + 0, + 0, + 3, + 3, + 0, + 5, + 3, + 2, + 3, + 3, + 0, + 3, + 0, + 3, + 0, + 3, + 4, + 5, + 4, + 5, + 3, + 0, + 4, + 3, + 0, + 3, + 4, + ), + ( + 0, + 3, + 0, + 3, + 0, + 3, + 0, + 3, + 0, + 3, + 3, + 4, + 3, + 2, + 3, + 2, + 3, + 0, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 2, + 4, + 3, + 3, + 1, + 3, + 4, + 3, + 4, + 4, + 4, + 3, + 4, + 4, + 3, + 2, + 4, + 4, + 1, + 0, + 2, + 0, + 0, + 1, + 1, + 0, + 2, + 0, + 0, + 3, + 1, + 0, + 5, + 3, + 2, + 1, + 3, + 0, + 3, + 0, + 1, + 2, + 4, + 3, + 2, + 4, + 3, + 3, + 0, + 3, + 2, + 0, + 4, + 4, + ), + ( + 0, + 3, + 0, + 3, + 0, + 1, + 0, + 0, + 0, + 1, + 4, + 3, + 3, + 2, + 3, + 1, + 3, + 1, + 4, + 2, + 3, + 2, + 4, + 2, + 3, + 4, + 3, + 0, + 2, + 2, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 0, + 3, + 4, + 1, + 3, + 3, + 0, + 3, + 4, + 3, + 3, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 4, + 0, + 3, + 0, + 0, + 3, + 1, + 2, + 1, + 3, + 0, + 4, + 0, + 1, + 0, + 4, + 3, + 3, + 4, + 3, + 3, + 0, + 2, + 0, + 0, + 3, + 3, + ), + ( + 0, + 3, + 0, + 4, + 0, + 1, + 0, + 3, + 0, + 3, + 4, + 3, + 3, + 0, + 3, + 3, + 3, + 1, + 3, + 1, + 3, + 3, + 4, + 3, + 3, + 3, + 0, + 0, + 3, + 1, + 5, + 3, + 3, + 1, + 3, + 3, + 2, + 5, + 4, + 3, + 3, + 4, + 5, + 3, + 2, + 5, + 3, + 4, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 0, + 4, + 2, + 2, + 1, + 3, + 0, + 3, + 0, + 2, + 0, + 4, + 4, + 3, + 5, + 3, + 2, + 0, + 1, + 1, + 0, + 3, + 4, + ), + ( + 0, + 5, + 0, + 4, + 0, + 5, + 0, + 2, + 0, + 4, + 4, + 3, + 3, + 2, + 3, + 3, + 3, + 1, + 4, + 3, + 4, + 1, + 5, + 3, + 4, + 3, + 4, + 0, + 4, + 2, + 4, + 3, + 4, + 1, + 5, + 4, + 0, + 4, + 4, + 4, + 4, + 5, + 4, + 1, + 3, + 5, + 4, + 2, + 1, + 4, + 1, + 1, + 3, + 2, + 0, + 3, + 1, + 0, + 3, + 2, + 1, + 4, + 3, + 3, + 3, + 4, + 0, + 4, + 0, + 3, + 0, + 4, + 4, + 4, + 3, + 3, + 3, + 0, + 4, + 2, + 0, + 3, + 4, + ), + ( + 1, + 4, + 0, + 4, + 0, + 3, + 0, + 1, + 0, + 3, + 3, + 3, + 1, + 1, + 3, + 3, + 2, + 2, + 3, + 3, + 1, + 0, + 3, + 2, + 2, + 1, + 2, + 0, + 3, + 1, + 2, + 1, + 2, + 0, + 3, + 2, + 0, + 2, + 2, + 3, + 3, + 4, + 3, + 0, + 3, + 3, + 1, + 2, + 0, + 1, + 1, + 3, + 1, + 2, + 0, + 0, + 3, + 0, + 1, + 1, + 0, + 3, + 2, + 2, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 2, + 3, + 3, + 4, + 3, + 3, + 0, + 1, + 0, + 0, + 1, + 4, + ), + ( + 0, + 4, + 0, + 4, + 0, + 4, + 0, + 0, + 0, + 3, + 4, + 4, + 3, + 1, + 4, + 2, + 3, + 2, + 3, + 3, + 3, + 1, + 4, + 3, + 4, + 0, + 3, + 0, + 4, + 2, + 3, + 3, + 2, + 2, + 5, + 4, + 2, + 1, + 3, + 4, + 3, + 4, + 3, + 1, + 3, + 3, + 4, + 2, + 0, + 2, + 1, + 0, + 3, + 3, + 0, + 0, + 2, + 0, + 3, + 1, + 0, + 4, + 4, + 3, + 4, + 3, + 0, + 4, + 0, + 1, + 0, + 2, + 4, + 4, + 4, + 4, + 4, + 0, + 3, + 2, + 0, + 3, + 3, + ), + ( + 0, + 0, + 0, + 1, + 0, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + ), + ( + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 4, + 0, + 1, + 3, + 3, + 3, + 0, + 4, + 0, + 2, + 1, + 2, + 1, + 1, + 1, + 2, + 0, + 3, + 1, + 1, + 0, + 1, + 0, + 3, + 1, + 0, + 0, + 3, + 3, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 2, + 2, + 0, + 3, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 2, + 0, + 3, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 4, + 3, + 1, + 0, + 1, + 0, + 3, + 0, + 2, + ), + ( + 0, + 0, + 0, + 3, + 0, + 5, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 1, + 0, + 1, + 3, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 4, + 0, + 0, + 0, + 2, + 3, + 0, + 1, + 4, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 3, + ), + ( + 0, + 2, + 0, + 5, + 0, + 5, + 0, + 1, + 0, + 2, + 4, + 3, + 3, + 2, + 5, + 1, + 3, + 2, + 3, + 3, + 3, + 0, + 4, + 1, + 2, + 0, + 3, + 0, + 4, + 0, + 2, + 2, + 1, + 1, + 5, + 3, + 0, + 0, + 1, + 4, + 2, + 3, + 2, + 0, + 3, + 3, + 3, + 2, + 0, + 2, + 4, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 3, + 1, + 0, + 1, + 3, + 1, + 2, + 3, + 0, + 2, + 0, + 0, + 0, + 1, + 3, + 5, + 4, + 4, + 4, + 0, + 3, + 0, + 0, + 1, + 3, + ), + ( + 0, + 4, + 0, + 5, + 0, + 4, + 0, + 4, + 0, + 4, + 5, + 4, + 3, + 3, + 4, + 3, + 3, + 3, + 4, + 3, + 4, + 4, + 5, + 3, + 4, + 5, + 4, + 2, + 4, + 2, + 3, + 4, + 3, + 1, + 4, + 4, + 1, + 3, + 5, + 4, + 4, + 5, + 5, + 4, + 4, + 5, + 5, + 5, + 2, + 3, + 3, + 1, + 4, + 3, + 1, + 3, + 3, + 0, + 3, + 3, + 1, + 4, + 3, + 4, + 4, + 4, + 0, + 3, + 0, + 4, + 0, + 3, + 3, + 4, + 4, + 5, + 0, + 0, + 4, + 3, + 0, + 4, + 5, + ), + ( + 0, + 4, + 0, + 4, + 0, + 3, + 0, + 3, + 0, + 3, + 4, + 4, + 4, + 3, + 3, + 2, + 4, + 3, + 4, + 3, + 4, + 3, + 5, + 3, + 4, + 3, + 2, + 1, + 4, + 2, + 4, + 4, + 3, + 1, + 3, + 4, + 2, + 4, + 5, + 5, + 3, + 4, + 5, + 4, + 1, + 5, + 4, + 3, + 0, + 3, + 2, + 2, + 3, + 2, + 1, + 3, + 1, + 0, + 3, + 3, + 3, + 5, + 3, + 3, + 3, + 5, + 4, + 4, + 2, + 3, + 3, + 4, + 3, + 3, + 3, + 2, + 1, + 0, + 3, + 2, + 1, + 4, + 3, + ), + ( + 0, + 4, + 0, + 5, + 0, + 4, + 0, + 3, + 0, + 3, + 5, + 5, + 3, + 2, + 4, + 3, + 4, + 0, + 5, + 4, + 4, + 1, + 4, + 4, + 4, + 3, + 3, + 3, + 4, + 3, + 5, + 5, + 2, + 3, + 3, + 4, + 1, + 2, + 5, + 5, + 3, + 5, + 5, + 2, + 3, + 5, + 5, + 4, + 0, + 3, + 2, + 0, + 3, + 3, + 1, + 1, + 5, + 1, + 4, + 1, + 0, + 4, + 3, + 2, + 3, + 5, + 0, + 4, + 0, + 3, + 0, + 5, + 4, + 3, + 4, + 3, + 0, + 0, + 4, + 1, + 0, + 4, + 4, + ), + ( + 1, + 3, + 0, + 4, + 0, + 2, + 0, + 2, + 0, + 2, + 5, + 5, + 3, + 3, + 3, + 3, + 3, + 0, + 4, + 2, + 3, + 4, + 4, + 4, + 3, + 4, + 0, + 0, + 3, + 4, + 5, + 4, + 3, + 3, + 3, + 3, + 2, + 5, + 5, + 4, + 5, + 5, + 5, + 4, + 3, + 5, + 5, + 5, + 1, + 3, + 1, + 0, + 1, + 0, + 0, + 3, + 2, + 0, + 4, + 2, + 0, + 5, + 2, + 3, + 2, + 4, + 1, + 3, + 0, + 3, + 0, + 4, + 5, + 4, + 5, + 4, + 3, + 0, + 4, + 2, + 0, + 5, + 4, + ), + ( + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 3, + 0, + 3, + 4, + 4, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 4, + 3, + 3, + 2, + 2, + 0, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 0, + 4, + 4, + 3, + 4, + 4, + 1, + 1, + 4, + 4, + 2, + 0, + 3, + 1, + 0, + 1, + 1, + 0, + 4, + 1, + 0, + 2, + 3, + 1, + 3, + 3, + 1, + 3, + 4, + 0, + 3, + 0, + 1, + 0, + 3, + 1, + 3, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 4, + 4, + ), + ( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ), + ( + 0, + 3, + 0, + 3, + 0, + 2, + 0, + 3, + 0, + 1, + 5, + 4, + 3, + 3, + 3, + 1, + 4, + 2, + 1, + 2, + 3, + 4, + 4, + 2, + 4, + 4, + 5, + 0, + 3, + 1, + 4, + 3, + 4, + 0, + 4, + 3, + 3, + 3, + 2, + 3, + 2, + 5, + 3, + 4, + 3, + 2, + 2, + 3, + 0, + 0, + 3, + 0, + 2, + 1, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 2, + 1, + 1, + 3, + 1, + 0, + 2, + 0, + 4, + 0, + 3, + 4, + 4, + 4, + 5, + 2, + 0, + 2, + 0, + 0, + 1, + 3, + ), + ( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 4, + 2, + 1, + 1, + 0, + 1, + 0, + 3, + 2, + 0, + 0, + 3, + 1, + 1, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 4, + 0, + 4, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + ), + ( + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 2, + 0, + 2, + 1, + 0, + 0, + 1, + 2, + 1, + 0, + 1, + 1, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + ), + ( + 0, + 4, + 0, + 4, + 0, + 4, + 0, + 3, + 0, + 4, + 4, + 3, + 4, + 2, + 4, + 3, + 2, + 0, + 4, + 4, + 4, + 3, + 5, + 3, + 5, + 3, + 3, + 2, + 4, + 2, + 4, + 3, + 4, + 3, + 1, + 4, + 0, + 2, + 3, + 4, + 4, + 4, + 3, + 3, + 3, + 4, + 4, + 4, + 3, + 4, + 1, + 3, + 4, + 3, + 2, + 1, + 2, + 1, + 3, + 3, + 3, + 4, + 4, + 3, + 3, + 5, + 0, + 4, + 0, + 3, + 0, + 4, + 3, + 3, + 3, + 2, + 1, + 0, + 3, + 0, + 0, + 3, + 3, + ), + ( + 0, + 4, + 0, + 3, + 0, + 3, + 0, + 3, + 0, + 3, + 5, + 5, + 3, + 3, + 3, + 3, + 4, + 3, + 4, + 3, + 3, + 3, + 4, + 4, + 4, + 3, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 3, + 1, + 3, + 2, + 4, + 5, + 5, + 5, + 5, + 4, + 3, + 4, + 5, + 5, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 1, + 2, + 3, + 2, + 4, + 3, + 3, + 3, + 4, + 0, + 4, + 0, + 2, + 0, + 4, + 3, + 2, + 2, + 1, + 2, + 0, + 3, + 0, + 0, + 4, + 1, + ), ) + class JapaneseContextAnalysis(object): NUM_OF_CATEGORY = 6 DONT_KNOW = -1 @@ -153,7 +7126,7 @@ def feed(self, byte_str, num_bytes): # this character will simply our logic and improve performance. i = self._need_to_skip_char_num while i < num_bytes: - order, char_len = self.get_order(byte_str[i:i + 2]) + order, char_len = self.get_order(byte_str[i : i + 2]) i += char_len if i > num_bytes: self._need_to_skip_char_num = i - num_bytes @@ -180,6 +7153,7 @@ def get_confidence(self): def get_order(self, byte_str): return -1, 1 + class SJISContextAnalysis(JapaneseContextAnalysis): def __init__(self): super(SJISContextAnalysis, self).__init__() @@ -209,6 +7183,7 @@ def get_order(self, byte_str): return -1, char_len + class EUCJPContextAnalysis(JapaneseContextAnalysis): def get_order(self, byte_str): if not byte_str: @@ -229,5 +7204,3 @@ def get_order(self, byte_str): return second_char - 0xA1, char_len return -1, char_len - - diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/langbulgarianmodel.py b/src/fetchcode/vcs/pip/_vendor/chardet/langbulgarianmodel.py index 2aa4fb2e..2d3cb552 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/langbulgarianmodel.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/langbulgarianmodel.py @@ -35,41 +35,521 @@ # only number <64 is sure valid Latin5_BulgarianCharToOrderMap = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, # 40 -110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, # 50 -253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, # 60 -116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, # 70 -194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209, # 80 -210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225, # 90 - 81,226,227,228,229,230,105,231,232,233,234,235,236, 45,237,238, # a0 - 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, # b0 - 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,239, 67,240, 60, 56, # c0 - 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, # d0 - 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,241, 42, 16, # e0 - 62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253, # f0 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 77, + 90, + 99, + 100, + 72, + 109, + 107, + 101, + 79, + 185, + 81, + 102, + 76, + 94, + 82, # 40 + 110, + 186, + 108, + 91, + 74, + 119, + 84, + 96, + 111, + 187, + 115, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 65, + 69, + 70, + 66, + 63, + 68, + 112, + 103, + 92, + 194, + 104, + 95, + 86, + 87, + 71, # 60 + 116, + 195, + 85, + 93, + 97, + 113, + 196, + 197, + 198, + 199, + 200, + 253, + 253, + 253, + 253, + 253, # 70 + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, # 80 + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, # 90 + 81, + 226, + 227, + 228, + 229, + 230, + 105, + 231, + 232, + 233, + 234, + 235, + 236, + 45, + 237, + 238, # a0 + 31, + 32, + 35, + 43, + 37, + 44, + 55, + 47, + 40, + 59, + 33, + 46, + 38, + 36, + 41, + 30, # b0 + 39, + 28, + 34, + 51, + 48, + 49, + 53, + 50, + 54, + 57, + 61, + 239, + 67, + 240, + 60, + 56, # c0 + 1, + 18, + 9, + 20, + 11, + 3, + 23, + 15, + 2, + 26, + 12, + 10, + 14, + 6, + 4, + 13, # d0 + 7, + 8, + 5, + 19, + 29, + 25, + 22, + 21, + 27, + 24, + 17, + 75, + 52, + 241, + 42, + 16, # e0 + 62, + 242, + 243, + 244, + 58, + 245, + 98, + 246, + 247, + 248, + 249, + 250, + 251, + 91, + 252, + 253, # f0 ) win1251BulgarianCharToOrderMap = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, # 40 -110,186,108, 91, 74,119, 84, 96,111,187,115,253,253,253,253,253, # 50 -253, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, # 60 -116,195, 85, 93, 97,113,196,197,198,199,200,253,253,253,253,253, # 70 -206,207,208,209,210,211,212,213,120,214,215,216,217,218,219,220, # 80 -221, 78, 64, 83,121, 98,117,105,222,223,224,225,226,227,228,229, # 90 - 88,230,231,232,233,122, 89,106,234,235,236,237,238, 45,239,240, # a0 - 73, 80,118,114,241,242,243,244,245, 62, 58,246,247,248,249,250, # b0 - 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, # c0 - 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,251, 67,252, 60, 56, # d0 - 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, # e0 - 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,253, 42, 16, # f0 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 77, + 90, + 99, + 100, + 72, + 109, + 107, + 101, + 79, + 185, + 81, + 102, + 76, + 94, + 82, # 40 + 110, + 186, + 108, + 91, + 74, + 119, + 84, + 96, + 111, + 187, + 115, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 65, + 69, + 70, + 66, + 63, + 68, + 112, + 103, + 92, + 194, + 104, + 95, + 86, + 87, + 71, # 60 + 116, + 195, + 85, + 93, + 97, + 113, + 196, + 197, + 198, + 199, + 200, + 253, + 253, + 253, + 253, + 253, # 70 + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 120, + 214, + 215, + 216, + 217, + 218, + 219, + 220, # 80 + 221, + 78, + 64, + 83, + 121, + 98, + 117, + 105, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, # 90 + 88, + 230, + 231, + 232, + 233, + 122, + 89, + 106, + 234, + 235, + 236, + 237, + 238, + 45, + 239, + 240, # a0 + 73, + 80, + 118, + 114, + 241, + 242, + 243, + 244, + 245, + 62, + 58, + 246, + 247, + 248, + 249, + 250, # b0 + 31, + 32, + 35, + 43, + 37, + 44, + 55, + 47, + 40, + 59, + 33, + 46, + 38, + 36, + 41, + 30, # c0 + 39, + 28, + 34, + 51, + 48, + 49, + 53, + 50, + 54, + 57, + 61, + 251, + 67, + 252, + 60, + 56, # d0 + 1, + 18, + 9, + 20, + 11, + 3, + 23, + 15, + 2, + 26, + 12, + 10, + 14, + 6, + 4, + 13, # e0 + 7, + 8, + 5, + 19, + 29, + 25, + 22, + 21, + 27, + 24, + 17, + 75, + 52, + 253, + 42, + 16, # f0 ) # Model Table: @@ -79,150 +559,4118 @@ # rest sequences: 0.2992% # negative sequences: 0.0020% BulgarianLangModel = ( -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,2,1,2,2, -3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,0,1, -0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,3,0,3,1,0, -0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,3,3,3,3,0,3,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,3,3,3,3,0,3,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,1,3,3,3,3,2,2,2,1,1,2,0,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,2,3,2,2,3,3,1,1,2,3,3,2,3,3,3,3,2,1,2,0,2,0,3,0,0, -0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,1,3,3,3,3,3,2,3,2,3,3,3,3,3,2,3,3,1,3,0,3,0,2,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,3,1,3,3,2,3,3,3,1,3,3,2,3,2,2,2,0,0,2,0,2,0,2,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,3,3,1,2,2,3,2,1,1,2,0,2,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,2,3,3,1,2,3,2,2,2,3,3,3,3,3,2,2,3,1,2,0,2,1,2,0,0, -0,0,0,0,0,0,0,0,0,0,3,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,1,3,3,3,3,3,2,3,3,3,2,3,3,2,3,2,2,2,3,1,2,0,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,3,3,3,3,1,1,1,2,2,1,3,1,3,2,2,3,0,0,1,0,1,0,1,0,0, -0,0,0,1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,2,2,3,2,2,3,1,2,1,1,1,2,3,1,3,1,2,2,0,1,1,1,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,1,3,2,2,3,3,1,2,3,1,1,3,3,3,3,1,2,2,1,1,1,0,2,0,2,0,1, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,2,2,3,3,3,2,2,1,1,2,0,2,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,0,1,2,1,3,3,2,3,3,3,3,3,2,3,2,1,0,3,1,2,1,2,1,2,3,2,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,1,1,2,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,1,3,3,2,3,3,2,2,2,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,3,3,3,3,0,3,3,3,3,3,2,1,1,2,1,3,3,0,3,1,1,1,1,3,2,0,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,1,1,3,1,3,3,2,3,2,2,2,3,0,2,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,2,3,3,2,2,3,2,1,1,1,1,1,3,1,3,1,1,0,0,0,1,0,0,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,2,3,2,0,3,2,0,3,0,2,0,0,2,1,3,1,0,0,1,0,0,0,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,2,1,1,1,1,2,1,1,2,1,1,1,2,2,1,2,1,1,1,0,1,1,0,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,2,1,3,1,1,2,1,3,2,1,1,0,1,2,3,2,1,1,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,3,3,3,3,2,2,1,0,1,0,0,1,0,0,0,2,1,0,3,0,0,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,2,3,2,3,3,1,3,2,1,1,1,2,1,1,2,1,3,0,1,0,0,0,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,1,1,2,2,3,3,2,3,2,2,2,3,1,2,2,1,1,2,1,1,2,2,0,1,1,0,1,0,2,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,2,1,3,1,0,2,2,1,3,2,1,0,0,2,0,2,0,1,0,0,0,0,0,0,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,3,1,2,0,2,3,1,2,3,2,0,1,3,1,2,1,1,1,0,0,1,0,0,2,2,2,3, -2,2,2,2,1,2,1,1,2,2,1,1,2,0,1,1,1,0,0,1,1,0,0,1,1,0,0,0,1,1,0,1, -3,3,3,3,3,2,1,2,2,1,2,0,2,0,1,0,1,2,1,2,1,1,0,0,0,1,0,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, -3,3,2,3,3,1,1,3,1,0,3,2,1,0,0,0,1,2,0,2,0,1,0,0,0,1,0,1,2,1,2,2, -1,1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1,0,1,2,1,1,1,0,0,0,0,0,1,1,0,0, -3,1,0,1,0,2,3,2,2,2,3,2,2,2,2,2,1,0,2,1,2,1,1,1,0,1,2,1,2,2,2,1, -1,1,2,2,2,2,1,2,1,1,0,1,2,1,2,2,2,1,1,1,0,1,1,1,1,2,0,1,0,0,0,0, -2,3,2,3,3,0,0,2,1,0,2,1,0,0,0,0,2,3,0,2,0,0,0,0,0,1,0,0,2,0,1,2, -2,1,2,1,2,2,1,1,1,2,1,1,1,0,1,2,2,1,1,1,1,1,0,1,1,1,0,0,1,2,0,0, -3,3,2,2,3,0,2,3,1,1,2,0,0,0,1,0,0,2,0,2,0,0,0,1,0,1,0,1,2,0,2,2, -1,1,1,1,2,1,0,1,2,2,2,1,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1,1,0,0, -2,3,2,3,3,0,0,3,0,1,1,0,1,0,0,0,2,2,1,2,0,0,0,0,0,0,0,0,2,0,1,2, -2,2,1,1,1,1,1,2,2,2,1,0,2,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0, -3,3,3,3,2,2,2,2,2,0,2,1,1,1,1,2,1,2,1,1,0,2,0,1,0,1,0,0,2,0,1,2, -1,1,1,1,1,1,1,2,2,1,1,0,2,0,1,0,2,0,0,1,1,1,0,0,2,0,0,0,1,1,0,0, -2,3,3,3,3,1,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0,0,0,1,2,0,1,2, -2,2,2,1,1,2,1,1,2,2,2,1,2,0,1,1,1,1,1,1,0,1,1,1,1,0,0,1,1,1,0,0, -2,3,3,3,3,0,2,2,0,2,1,0,0,0,1,1,1,2,0,2,0,0,0,3,0,0,0,0,2,0,2,2, -1,1,1,2,1,2,1,1,2,2,2,1,2,0,1,1,1,0,1,1,1,1,0,2,1,0,0,0,1,1,0,0, -2,3,3,3,3,0,2,1,0,0,2,0,0,0,0,0,1,2,0,2,0,0,0,0,0,0,0,0,2,0,1,2, -1,1,1,2,1,1,1,1,2,2,2,0,1,0,1,1,1,0,0,1,1,1,0,0,1,0,0,0,0,1,0,0, -3,3,2,2,3,0,1,0,1,0,0,0,0,0,0,0,1,1,0,3,0,0,0,0,0,0,0,0,1,0,2,2, -1,1,1,1,1,2,1,1,2,2,1,2,2,1,0,1,1,1,1,1,0,1,0,0,1,0,0,0,1,1,0,0, -3,1,0,1,0,2,2,2,2,3,2,1,1,1,2,3,0,0,1,0,2,1,1,0,1,1,1,1,2,1,1,1, -1,2,2,1,2,1,2,2,1,1,0,1,2,1,2,2,1,1,1,0,0,1,1,1,2,1,0,1,0,0,0,0, -2,1,0,1,0,3,1,2,2,2,2,1,2,2,1,1,1,0,2,1,2,2,1,1,2,1,1,0,2,1,1,1, -1,2,2,2,2,2,2,2,1,2,0,1,1,0,2,1,1,1,1,1,0,0,1,1,1,1,0,1,0,0,0,0, -2,1,1,1,1,2,2,2,2,1,2,2,2,1,2,2,1,1,2,1,2,3,2,2,1,1,1,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,3,2,0,1,2,0,1,2,1,1,0,1,0,1,2,1,2,0,0,0,1,1,0,0,0,1,0,0,2, -1,1,0,0,1,1,0,1,1,1,1,0,2,0,1,1,1,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0, -2,0,0,0,0,1,2,2,2,2,2,2,2,1,2,1,1,1,1,1,1,1,0,1,1,1,1,1,2,1,1,1, -1,2,2,2,2,1,1,2,1,2,1,1,1,0,2,1,2,1,1,1,0,2,1,1,1,1,0,1,0,0,0,0, -3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0, -1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,3,2,0,0,0,0,1,0,0,0,0,0,0,1,1,0,2,0,0,0,0,0,0,0,0,1,0,1,2, -1,1,1,1,1,1,0,0,2,2,2,2,2,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0,1,1,0,1, -2,3,1,2,1,0,1,1,0,2,2,2,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,1,0,1,2, -1,1,1,1,2,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0, -2,2,2,2,2,0,0,2,0,0,2,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,2,0,2,2, -1,1,1,1,1,0,0,1,2,1,1,0,1,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, -1,2,2,2,2,0,0,2,0,1,1,0,0,0,1,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,1,1, -0,0,0,1,1,1,1,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, -1,2,2,3,2,0,0,1,0,0,1,0,0,0,0,0,0,1,0,2,0,0,0,1,0,0,0,0,0,0,0,2, -1,1,0,0,1,0,0,0,1,1,0,0,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, -2,1,2,2,2,1,2,1,2,2,1,1,2,1,1,1,0,1,1,1,1,2,0,1,0,1,1,1,1,0,1,1, -1,1,2,1,1,1,1,1,1,0,0,1,2,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0, -1,0,0,1,3,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,2,1,0,0,1,0,2,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1, -0,2,0,1,0,0,1,1,2,0,1,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, -1,2,2,2,2,0,1,1,0,2,1,0,1,1,1,0,0,1,0,2,0,1,0,0,0,0,0,0,0,0,0,1, -0,1,0,0,1,0,0,0,1,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,2,2,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1, -0,1,0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, -2,0,1,0,0,1,2,1,1,1,1,1,1,2,2,1,0,0,1,0,1,0,0,0,0,1,1,1,1,0,0,0, -1,1,2,1,1,1,1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,2,1,2,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1, -0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0, -0,1,1,0,1,1,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0, -1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,2,0,0,2,0,1,0,0,1,0,0,1, -1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0, -1,1,1,1,1,1,1,2,0,0,0,0,0,0,2,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 2, + 2, + 3, + 2, + 2, + 1, + 2, + 2, + 3, + 1, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 2, + 1, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 1, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 2, + 3, + 3, + 1, + 1, + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 1, + 2, + 0, + 2, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 1, + 3, + 0, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 2, + 3, + 3, + 3, + 1, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 1, + 2, + 2, + 3, + 2, + 1, + 1, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 1, + 2, + 3, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 1, + 2, + 0, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 3, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 1, + 2, + 2, + 1, + 3, + 1, + 3, + 2, + 2, + 3, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 2, + 2, + 3, + 1, + 2, + 1, + 1, + 1, + 2, + 3, + 1, + 3, + 1, + 2, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 2, + 2, + 3, + 3, + 1, + 2, + 3, + 1, + 1, + 3, + 3, + 3, + 3, + 1, + 2, + 2, + 1, + 1, + 1, + 0, + 2, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 2, + 3, + 3, + 3, + 2, + 2, + 1, + 1, + 2, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 0, + 1, + 2, + 1, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 1, + 0, + 3, + 1, + 2, + 1, + 2, + 1, + 2, + 3, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 1, + 3, + 3, + 2, + 3, + 3, + 2, + 2, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 1, + 2, + 1, + 3, + 3, + 0, + 3, + 1, + 1, + 1, + 1, + 3, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 3, + 1, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 2, + 3, + 2, + 1, + 1, + 1, + 1, + 1, + 3, + 1, + 3, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 0, + 3, + 2, + 0, + 3, + 0, + 2, + 0, + 0, + 2, + 1, + 3, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 2, + 1, + 1, + 1, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 2, + 1, + 3, + 1, + 1, + 2, + 1, + 3, + 2, + 1, + 1, + 0, + 1, + 2, + 3, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 2, + 2, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 3, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 1, + 3, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 2, + 1, + 3, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 2, + 2, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 3, + 1, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 2, + 2, + 0, + 1, + 1, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 2, + 1, + 3, + 1, + 0, + 2, + 2, + 1, + 3, + 2, + 1, + 0, + 0, + 2, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 0, + 2, + 3, + 1, + 2, + 3, + 2, + 0, + 1, + 3, + 1, + 2, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 2, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + 2, + 2, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 2, + 2, + 1, + 2, + 0, + 2, + 0, + 1, + 0, + 1, + 2, + 1, + 2, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 2, + 3, + 3, + 1, + 1, + 3, + 1, + 0, + 3, + 2, + 1, + 0, + 0, + 0, + 1, + 2, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 3, + 1, + 0, + 1, + 0, + 2, + 3, + 2, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 1, + 0, + 2, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 2, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + 0, + 1, + 2, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 3, + 2, + 3, + 3, + 0, + 0, + 2, + 1, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 2, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 2, + 2, + 1, + 2, + 1, + 2, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 2, + 0, + 0, + 3, + 3, + 2, + 2, + 3, + 0, + 2, + 3, + 1, + 1, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 2, + 0, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 3, + 2, + 3, + 3, + 0, + 0, + 3, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 2, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 0, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 0, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 0, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 0, + 2, + 0, + 1, + 0, + 2, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 2, + 2, + 2, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 0, + 2, + 2, + 0, + 2, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 2, + 0, + 2, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 2, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 2, + 2, + 2, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 2, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 0, + 2, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 2, + 2, + 3, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 2, + 2, + 1, + 2, + 2, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 3, + 1, + 0, + 1, + 0, + 2, + 2, + 2, + 2, + 3, + 2, + 1, + 1, + 1, + 2, + 3, + 0, + 0, + 1, + 0, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 2, + 1, + 2, + 2, + 1, + 1, + 0, + 1, + 2, + 1, + 2, + 2, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 0, + 3, + 1, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 1, + 1, + 0, + 2, + 1, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 0, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 1, + 2, + 1, + 2, + 3, + 2, + 2, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 3, + 2, + 0, + 1, + 2, + 0, + 1, + 2, + 1, + 1, + 0, + 1, + 0, + 1, + 2, + 1, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 1, + 0, + 2, + 1, + 2, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 3, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 2, + 2, + 2, + 2, + 2, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 3, + 1, + 2, + 1, + 0, + 1, + 1, + 0, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 2, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 2, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 3, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 2, + 2, + 2, + 1, + 2, + 1, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 3, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 2, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 2, + 0, + 1, + 1, + 0, + 2, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 1, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, ) Latin5BulgarianModel = { - 'char_to_order_map': Latin5_BulgarianCharToOrderMap, - 'precedence_matrix': BulgarianLangModel, - 'typical_positive_ratio': 0.969392, - 'keep_english_letter': False, - 'charset_name': "ISO-8859-5", - 'language': 'Bulgairan', + "char_to_order_map": Latin5_BulgarianCharToOrderMap, + "precedence_matrix": BulgarianLangModel, + "typical_positive_ratio": 0.969392, + "keep_english_letter": False, + "charset_name": "ISO-8859-5", + "language": "Bulgairan", } Win1251BulgarianModel = { - 'char_to_order_map': win1251BulgarianCharToOrderMap, - 'precedence_matrix': BulgarianLangModel, - 'typical_positive_ratio': 0.969392, - 'keep_english_letter': False, - 'charset_name': "windows-1251", - 'language': 'Bulgarian', + "char_to_order_map": win1251BulgarianCharToOrderMap, + "precedence_matrix": BulgarianLangModel, + "typical_positive_ratio": 0.969392, + "keep_english_letter": False, + "charset_name": "windows-1251", + "language": "Bulgarian", } diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/langcyrillicmodel.py b/src/fetchcode/vcs/pip/_vendor/chardet/langcyrillicmodel.py index e5f9a1fd..d4b0662f 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/langcyrillicmodel.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/langcyrillicmodel.py @@ -28,117 +28,1557 @@ # KOI8-R language model # Character Mapping Table: KOI8R_char_to_order_map = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, # 80 -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, # 90 -223,224,225, 68,226,227,228,229,230,231,232,233,234,235,236,237, # a0 -238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253, # b0 - 27, 3, 21, 28, 13, 2, 39, 19, 26, 4, 23, 11, 8, 12, 5, 1, # c0 - 15, 16, 9, 7, 6, 14, 24, 10, 17, 18, 20, 25, 30, 29, 22, 54, # d0 - 59, 37, 44, 58, 41, 48, 53, 46, 55, 42, 60, 36, 49, 38, 31, 34, # e0 - 35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70, # f0 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 74, + 153, + 75, + 154, # 40 + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 71, + 172, + 66, + 173, + 65, + 174, + 76, + 175, + 64, + 176, + 177, + 77, + 72, + 178, + 69, # 60 + 67, + 179, + 78, + 73, + 180, + 181, + 79, + 182, + 183, + 184, + 185, + 253, + 253, + 253, + 253, + 253, # 70 + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, # 80 + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, # 90 + 223, + 224, + 225, + 68, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, # a0 + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 253, # b0 + 27, + 3, + 21, + 28, + 13, + 2, + 39, + 19, + 26, + 4, + 23, + 11, + 8, + 12, + 5, + 1, # c0 + 15, + 16, + 9, + 7, + 6, + 14, + 24, + 10, + 17, + 18, + 20, + 25, + 30, + 29, + 22, + 54, # d0 + 59, + 37, + 44, + 58, + 41, + 48, + 53, + 46, + 55, + 42, + 60, + 36, + 49, + 38, + 31, + 34, # e0 + 35, + 43, + 45, + 32, + 40, + 52, + 56, + 33, + 61, + 62, + 51, + 57, + 47, + 63, + 50, + 70, # f0 ) win1251_char_to_order_map = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, -239,240,241,242,243,244,245,246, 68,247,248,249,250,251,252,253, - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 74, + 153, + 75, + 154, # 40 + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 71, + 172, + 66, + 173, + 65, + 174, + 76, + 175, + 64, + 176, + 177, + 77, + 72, + 178, + 69, # 60 + 67, + 179, + 78, + 73, + 180, + 181, + 79, + 182, + 183, + 184, + 185, + 253, + 253, + 253, + 253, + 253, # 70 + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 68, + 247, + 248, + 249, + 250, + 251, + 252, + 253, + 37, + 44, + 33, + 46, + 41, + 48, + 56, + 51, + 42, + 60, + 36, + 49, + 38, + 31, + 34, + 35, + 45, + 32, + 40, + 52, + 53, + 55, + 58, + 50, + 57, + 63, + 70, + 62, + 61, + 47, + 59, + 43, + 3, + 21, + 10, + 19, + 13, + 2, + 24, + 20, + 4, + 23, + 11, + 8, + 12, + 5, + 1, + 15, + 9, + 7, + 6, + 14, + 39, + 26, + 28, + 22, + 25, + 29, + 54, + 18, + 17, + 30, + 27, + 16, ) latin5_char_to_order_map = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, -239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 74, + 153, + 75, + 154, # 40 + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 71, + 172, + 66, + 173, + 65, + 174, + 76, + 175, + 64, + 176, + 177, + 77, + 72, + 178, + 69, # 60 + 67, + 179, + 78, + 73, + 180, + 181, + 79, + 182, + 183, + 184, + 185, + 253, + 253, + 253, + 253, + 253, # 70 + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 37, + 44, + 33, + 46, + 41, + 48, + 56, + 51, + 42, + 60, + 36, + 49, + 38, + 31, + 34, + 35, + 45, + 32, + 40, + 52, + 53, + 55, + 58, + 50, + 57, + 63, + 70, + 62, + 61, + 47, + 59, + 43, + 3, + 21, + 10, + 19, + 13, + 2, + 24, + 20, + 4, + 23, + 11, + 8, + 12, + 5, + 1, + 15, + 9, + 7, + 6, + 14, + 39, + 26, + 28, + 22, + 25, + 29, + 54, + 18, + 17, + 30, + 27, + 16, + 239, + 68, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 255, ) macCyrillic_char_to_order_map = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, -239,240,241,242,243,244,245,246,247,248,249,250,251,252, 68, 16, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 74, + 153, + 75, + 154, # 40 + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 71, + 172, + 66, + 173, + 65, + 174, + 76, + 175, + 64, + 176, + 177, + 77, + 72, + 178, + 69, # 60 + 67, + 179, + 78, + 73, + 180, + 181, + 79, + 182, + 183, + 184, + 185, + 253, + 253, + 253, + 253, + 253, # 70 + 37, + 44, + 33, + 46, + 41, + 48, + 56, + 51, + 42, + 60, + 36, + 49, + 38, + 31, + 34, + 35, + 45, + 32, + 40, + 52, + 53, + 55, + 58, + 50, + 57, + 63, + 70, + 62, + 61, + 47, + 59, + 43, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 68, + 16, + 3, + 21, + 10, + 19, + 13, + 2, + 24, + 20, + 4, + 23, + 11, + 8, + 12, + 5, + 1, + 15, + 9, + 7, + 6, + 14, + 39, + 26, + 28, + 22, + 25, + 29, + 54, + 18, + 17, + 30, + 27, + 255, ) IBM855_char_to_order_map = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 -191,192,193,194, 68,195,196,197,198,199,200,201,202,203,204,205, -206,207,208,209,210,211,212,213,214,215,216,217, 27, 59, 54, 70, - 3, 37, 21, 44, 28, 58, 13, 41, 2, 48, 39, 53, 19, 46,218,219, -220,221,222,223,224, 26, 55, 4, 42,225,226,227,228, 23, 60,229, -230,231,232,233,234,235, 11, 36,236,237,238,239,240,241,242,243, - 8, 49, 12, 38, 5, 31, 1, 34, 15,244,245,246,247, 35, 16,248, - 43, 9, 45, 7, 32, 6, 40, 14, 52, 24, 56, 10, 33, 17, 61,249, -250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 74, + 153, + 75, + 154, # 40 + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 71, + 172, + 66, + 173, + 65, + 174, + 76, + 175, + 64, + 176, + 177, + 77, + 72, + 178, + 69, # 60 + 67, + 179, + 78, + 73, + 180, + 181, + 79, + 182, + 183, + 184, + 185, + 253, + 253, + 253, + 253, + 253, # 70 + 191, + 192, + 193, + 194, + 68, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 27, + 59, + 54, + 70, + 3, + 37, + 21, + 44, + 28, + 58, + 13, + 41, + 2, + 48, + 39, + 53, + 19, + 46, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 26, + 55, + 4, + 42, + 225, + 226, + 227, + 228, + 23, + 60, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 11, + 36, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 8, + 49, + 12, + 38, + 5, + 31, + 1, + 34, + 15, + 244, + 245, + 246, + 247, + 35, + 16, + 248, + 43, + 9, + 45, + 7, + 32, + 6, + 40, + 14, + 52, + 24, + 56, + 10, + 33, + 17, + 61, + 249, + 250, + 18, + 62, + 20, + 51, + 25, + 57, + 30, + 47, + 29, + 63, + 22, + 50, + 251, + 252, + 255, ) IBM866_char_to_order_map = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, # 40 -155,156,157,158,159,160,161,162,163,164,165,253,253,253,253,253, # 50 -253, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, # 60 - 67,179, 78, 73,180,181, 79,182,183,184,185,253,253,253,253,253, # 70 - 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, - 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, - 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, -191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, -207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, -223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, - 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, -239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 74, + 153, + 75, + 154, # 40 + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 71, + 172, + 66, + 173, + 65, + 174, + 76, + 175, + 64, + 176, + 177, + 77, + 72, + 178, + 69, # 60 + 67, + 179, + 78, + 73, + 180, + 181, + 79, + 182, + 183, + 184, + 185, + 253, + 253, + 253, + 253, + 253, # 70 + 37, + 44, + 33, + 46, + 41, + 48, + 56, + 51, + 42, + 60, + 36, + 49, + 38, + 31, + 34, + 35, + 45, + 32, + 40, + 52, + 53, + 55, + 58, + 50, + 57, + 63, + 70, + 62, + 61, + 47, + 59, + 43, + 3, + 21, + 10, + 19, + 13, + 2, + 24, + 20, + 4, + 23, + 11, + 8, + 12, + 5, + 1, + 15, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 9, + 7, + 6, + 14, + 39, + 26, + 28, + 22, + 25, + 29, + 54, + 18, + 17, + 30, + 27, + 16, + 239, + 68, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 255, ) # Model Table: @@ -148,186 +1588,4154 @@ # rest sequences: 0.1237% # negative sequences: 0.0009% RussianLangModel = ( -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,1,3,3,3,2,3,2,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,2,2,0,0,2, -3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,2,3,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,2,2,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,2,3,3,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, -0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, -0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,2,2,2,3,1,3,3,1,3,3,3,3,2,2,3,0,2,2,2,3,3,2,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,3,3,3,3,3,2,2,3,2,3,3,3,2,1,2,2,0,1,2,2,2,2,2,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,0,2,2,3,3,2,1,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,3,3,1,2,3,2,2,3,2,3,3,3,3,2,2,3,0,3,2,2,3,1,1,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,2,3,3,3,3,2,2,2,0,3,3,3,2,2,2,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,2,3,2,2,0,1,3,2,1,2,2,1,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,2,1,1,3,0,1,1,1,1,2,1,1,0,2,2,2,1,2,0,1,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,3,3,2,2,2,2,1,3,2,3,2,3,2,1,2,2,0,1,1,2,1,2,1,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,3,3,3,2,2,2,2,0,2,2,2,2,3,1,1,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -3,2,3,2,2,3,3,3,3,3,3,3,3,3,1,3,2,0,0,3,3,3,3,2,3,3,3,3,2,3,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,3,3,3,3,3,2,2,3,3,0,2,1,0,3,2,3,2,3,0,0,1,2,0,0,1,0,1,2,1,1,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,3,0,2,3,3,3,3,2,3,3,3,3,1,2,2,0,0,2,3,2,2,2,3,2,3,2,2,3,0,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,0,2,3,2,3,0,1,2,3,3,2,0,2,3,0,0,2,3,2,2,0,1,3,1,3,2,2,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,1,3,0,2,3,3,3,3,3,3,3,3,2,1,3,2,0,0,2,2,3,3,3,2,3,3,0,2,2,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,2,3,3,2,2,2,3,3,0,0,1,1,1,1,1,2,0,0,1,1,1,1,0,1,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,0,3,2,3,3,2,3,2,0,2,1,0,1,1,0,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,3,3,3,2,2,2,2,3,1,3,2,3,1,1,2,1,0,2,2,2,2,1,3,1,0, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -2,2,3,3,3,3,3,1,2,2,1,3,1,0,3,0,0,3,0,0,0,1,1,0,1,2,1,0,0,0,0,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,2,1,1,3,3,3,2,2,1,2,2,3,1,1,2,0,0,2,2,1,3,0,0,2,1,1,2,1,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,3,3,3,1,2,2,2,1,2,1,3,3,1,1,2,1,2,1,2,2,0,2,0,0,1,1,0,1,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,3,3,3,3,3,2,1,3,2,2,3,2,0,3,2,0,3,0,1,0,1,1,0,0,1,1,1,1,0,1,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,2,3,3,3,2,2,2,3,3,1,2,1,2,1,0,1,0,1,1,0,1,0,0,2,1,1,1,0,1,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -3,1,1,2,1,2,3,3,2,2,1,2,2,3,0,2,1,0,0,2,2,3,2,1,2,2,2,2,2,3,1,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,1,1,0,1,1,2,2,1,1,3,0,0,1,3,1,1,1,0,0,0,1,0,1,1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,1,3,3,3,2,0,0,0,2,1,0,1,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,1,0,0,2,3,2,2,2,1,2,2,2,1,2,1,0,0,1,1,1,0,2,0,1,1,1,0,0,1,1, -1,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, -2,3,3,3,3,0,0,0,0,1,0,0,0,0,3,0,1,2,1,0,0,0,0,0,0,0,1,1,0,0,1,1, -1,0,1,0,1,2,0,0,1,1,2,1,0,1,1,1,1,0,1,1,1,1,0,1,0,0,1,0,0,1,1,0, -2,2,3,2,2,2,3,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,0,1,0,1,1,1,0,2,1, -1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0, -3,3,3,2,2,2,2,3,2,2,1,1,2,2,2,2,1,1,3,1,2,1,2,0,0,1,1,0,1,0,2,1, -1,1,1,1,1,2,1,0,1,1,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,1,0, -2,0,0,1,0,3,2,2,2,2,1,2,1,2,1,2,0,0,0,2,1,2,2,1,1,2,2,0,1,1,0,2, -1,1,1,1,1,0,1,1,1,2,1,1,1,2,1,0,1,2,1,1,1,1,0,1,1,1,0,0,1,0,0,1, -1,3,2,2,2,1,1,1,2,3,0,0,0,0,2,0,2,2,1,0,0,0,0,0,0,1,0,0,0,0,1,1, -1,0,1,1,0,1,0,1,1,0,1,1,0,2,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0, -2,3,2,3,2,1,2,2,2,2,1,0,0,0,2,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,2,1, -1,1,2,1,0,2,0,0,1,0,1,0,0,1,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0, -3,0,0,1,0,2,2,2,3,2,2,2,2,2,2,2,0,0,0,2,1,2,1,1,1,2,2,0,0,0,1,2, -1,1,1,1,1,0,1,2,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,1, -2,3,2,3,3,2,0,1,1,1,0,0,1,0,2,0,1,1,3,1,0,0,0,0,0,0,0,1,0,0,2,1, -1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,0,1,1,0,1,0,0,0,0,0,0,1,0, -2,3,3,3,3,1,2,2,2,2,0,1,1,0,2,1,1,1,2,1,0,1,1,0,0,1,0,1,0,0,2,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,3,3,3,2,0,0,1,1,2,2,1,0,0,2,0,1,1,3,0,0,1,0,0,0,0,0,1,0,1,2,1, -1,1,2,0,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,0,1,0,0,0,0,0,0,1,0,1,1,0, -1,3,2,3,2,1,0,0,2,2,2,0,1,0,2,0,1,1,1,0,1,0,0,0,3,0,1,1,0,0,2,1, -1,1,1,0,1,1,0,0,0,0,1,1,0,1,0,0,2,1,1,0,1,0,0,0,1,0,1,0,0,1,1,0, -3,1,2,1,1,2,2,2,2,2,2,1,2,2,1,1,0,0,0,2,2,2,0,0,0,1,2,1,0,1,0,1, -2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,2,1,1,1,0,1,0,1,1,0,1,1,1,0,0,1, -3,0,0,0,0,2,0,1,1,1,1,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,1,0,0,1,0,1, -1,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1, -1,3,3,2,2,0,0,0,2,2,0,0,0,1,2,0,1,1,2,0,0,0,0,0,0,0,0,1,0,0,2,1, -0,1,1,0,0,1,1,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0, -2,3,2,3,2,0,0,0,0,1,1,0,0,0,2,0,2,0,2,0,0,0,0,0,1,0,0,1,0,0,1,1, -1,1,2,0,1,2,1,0,1,1,2,1,1,1,1,1,2,1,1,0,1,0,0,1,1,1,1,1,0,1,1,0, -1,3,2,2,2,1,0,0,2,2,1,0,1,2,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1, -0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,0,2,3,1,2,2,2,2,2,2,1,1,0,0,0,1,0,1,0,2,1,1,1,0,0,0,0,1, -1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0, -2,0,2,0,0,1,0,3,2,1,2,1,2,2,0,1,0,0,0,2,1,0,0,2,1,1,1,1,0,2,0,2, -2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,0,1,1,1,1,0,0,0,1,1,1,1,0,1,0,0,1, -1,2,2,2,2,1,0,0,1,0,0,0,0,0,2,0,1,1,1,1,0,0,0,0,1,0,1,2,0,0,2,0, -1,0,1,1,1,2,1,0,1,0,1,1,0,0,1,0,1,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0, -2,1,2,2,2,0,3,0,1,1,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -0,0,0,1,1,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0, -1,2,2,3,2,2,0,0,1,1,2,0,1,2,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1, -0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0, -2,2,1,1,2,1,2,2,2,2,2,1,2,2,0,1,0,0,0,1,2,2,2,1,2,1,1,1,1,1,2,1, -1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,1,1,1,0,0,0,0,1,1,1,0,1,1,0,0,1, -1,2,2,2,2,0,1,0,2,2,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0, -0,0,1,0,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,2,2,2,2,0,0,0,2,2,2,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1, -0,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,2,2,2,2,0,0,0,0,1,0,0,1,1,2,0,0,0,0,1,0,1,0,0,1,0,0,2,0,0,0,1, -0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, -1,2,2,2,1,1,2,0,2,1,1,1,1,0,2,2,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1, -0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, -1,0,2,1,2,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0, -0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0, -1,0,0,0,0,2,0,1,2,1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1, -0,0,0,0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1, -2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,1,1,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0, -0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 2, + 2, + 2, + 2, + 2, + 0, + 0, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 1, + 3, + 3, + 1, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 0, + 2, + 2, + 2, + 3, + 3, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 2, + 3, + 3, + 3, + 2, + 1, + 2, + 2, + 0, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 0, + 2, + 2, + 3, + 3, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 1, + 2, + 3, + 2, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 0, + 3, + 2, + 2, + 3, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 0, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 2, + 0, + 1, + 3, + 2, + 1, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 1, + 3, + 0, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 2, + 2, + 2, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 2, + 2, + 2, + 1, + 3, + 2, + 3, + 2, + 3, + 2, + 1, + 2, + 2, + 0, + 1, + 1, + 2, + 1, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 2, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 0, + 2, + 2, + 2, + 2, + 3, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 2, + 0, + 0, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 0, + 2, + 1, + 0, + 3, + 2, + 3, + 2, + 3, + 0, + 0, + 1, + 2, + 0, + 0, + 1, + 0, + 1, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 1, + 2, + 2, + 0, + 0, + 2, + 3, + 2, + 2, + 2, + 3, + 2, + 3, + 2, + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 0, + 2, + 3, + 2, + 3, + 0, + 1, + 2, + 3, + 3, + 2, + 0, + 2, + 3, + 0, + 0, + 2, + 3, + 2, + 2, + 0, + 1, + 3, + 1, + 3, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 3, + 0, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 3, + 2, + 0, + 0, + 2, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 2, + 2, + 2, + 3, + 3, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 2, + 3, + 3, + 2, + 3, + 2, + 0, + 2, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 1, + 3, + 2, + 3, + 1, + 1, + 2, + 1, + 0, + 2, + 2, + 2, + 2, + 1, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 2, + 1, + 3, + 1, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 2, + 1, + 1, + 3, + 3, + 3, + 2, + 2, + 1, + 2, + 2, + 3, + 1, + 1, + 2, + 0, + 0, + 2, + 2, + 1, + 3, + 0, + 0, + 2, + 1, + 1, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 3, + 3, + 3, + 1, + 2, + 2, + 2, + 1, + 2, + 1, + 3, + 3, + 1, + 1, + 2, + 1, + 2, + 1, + 2, + 2, + 0, + 2, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 3, + 2, + 2, + 3, + 2, + 0, + 3, + 2, + 0, + 3, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 3, + 1, + 2, + 1, + 2, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 2, + 1, + 2, + 3, + 3, + 2, + 2, + 1, + 2, + 2, + 3, + 0, + 2, + 1, + 0, + 0, + 2, + 2, + 3, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 0, + 1, + 1, + 2, + 2, + 1, + 1, + 3, + 0, + 0, + 1, + 3, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 3, + 3, + 3, + 2, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 3, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 2, + 0, + 0, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 2, + 2, + 3, + 2, + 2, + 2, + 3, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 2, + 2, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 3, + 1, + 2, + 1, + 2, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 2, + 0, + 0, + 1, + 0, + 3, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 2, + 1, + 2, + 0, + 0, + 0, + 2, + 1, + 2, + 2, + 1, + 1, + 2, + 2, + 0, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 3, + 2, + 2, + 2, + 1, + 1, + 1, + 2, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 2, + 3, + 2, + 3, + 2, + 1, + 2, + 2, + 2, + 2, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 0, + 2, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 2, + 1, + 2, + 1, + 1, + 1, + 2, + 2, + 0, + 0, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 2, + 3, + 2, + 3, + 3, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 1, + 1, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 3, + 3, + 3, + 3, + 1, + 2, + 2, + 2, + 2, + 0, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 2, + 0, + 0, + 1, + 1, + 2, + 2, + 1, + 0, + 0, + 2, + 0, + 1, + 1, + 3, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 3, + 2, + 3, + 2, + 1, + 0, + 0, + 2, + 2, + 2, + 0, + 1, + 0, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 3, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 3, + 1, + 2, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 1, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 1, + 2, + 1, + 0, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 3, + 3, + 2, + 2, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 1, + 2, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 3, + 2, + 3, + 2, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 2, + 1, + 0, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 3, + 2, + 2, + 2, + 1, + 0, + 0, + 2, + 2, + 1, + 0, + 1, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 3, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 1, + 0, + 3, + 2, + 1, + 2, + 1, + 2, + 2, + 0, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 0, + 2, + 0, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 0, + 0, + 2, + 0, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 2, + 1, + 2, + 2, + 2, + 0, + 3, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 2, + 2, + 3, + 2, + 2, + 0, + 0, + 1, + 1, + 2, + 0, + 1, + 2, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 2, + 2, + 1, + 1, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 2, + 2, + 2, + 2, + 0, + 1, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 1, + 1, + 2, + 0, + 2, + 1, + 1, + 1, + 1, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, ) Koi8rModel = { - 'char_to_order_map': KOI8R_char_to_order_map, - 'precedence_matrix': RussianLangModel, - 'typical_positive_ratio': 0.976601, - 'keep_english_letter': False, - 'charset_name': "KOI8-R", - 'language': 'Russian', + "char_to_order_map": KOI8R_char_to_order_map, + "precedence_matrix": RussianLangModel, + "typical_positive_ratio": 0.976601, + "keep_english_letter": False, + "charset_name": "KOI8-R", + "language": "Russian", } Win1251CyrillicModel = { - 'char_to_order_map': win1251_char_to_order_map, - 'precedence_matrix': RussianLangModel, - 'typical_positive_ratio': 0.976601, - 'keep_english_letter': False, - 'charset_name': "windows-1251", - 'language': 'Russian', + "char_to_order_map": win1251_char_to_order_map, + "precedence_matrix": RussianLangModel, + "typical_positive_ratio": 0.976601, + "keep_english_letter": False, + "charset_name": "windows-1251", + "language": "Russian", } Latin5CyrillicModel = { - 'char_to_order_map': latin5_char_to_order_map, - 'precedence_matrix': RussianLangModel, - 'typical_positive_ratio': 0.976601, - 'keep_english_letter': False, - 'charset_name': "ISO-8859-5", - 'language': 'Russian', + "char_to_order_map": latin5_char_to_order_map, + "precedence_matrix": RussianLangModel, + "typical_positive_ratio": 0.976601, + "keep_english_letter": False, + "charset_name": "ISO-8859-5", + "language": "Russian", } MacCyrillicModel = { - 'char_to_order_map': macCyrillic_char_to_order_map, - 'precedence_matrix': RussianLangModel, - 'typical_positive_ratio': 0.976601, - 'keep_english_letter': False, - 'charset_name': "MacCyrillic", - 'language': 'Russian', + "char_to_order_map": macCyrillic_char_to_order_map, + "precedence_matrix": RussianLangModel, + "typical_positive_ratio": 0.976601, + "keep_english_letter": False, + "charset_name": "MacCyrillic", + "language": "Russian", } Ibm866Model = { - 'char_to_order_map': IBM866_char_to_order_map, - 'precedence_matrix': RussianLangModel, - 'typical_positive_ratio': 0.976601, - 'keep_english_letter': False, - 'charset_name': "IBM866", - 'language': 'Russian', + "char_to_order_map": IBM866_char_to_order_map, + "precedence_matrix": RussianLangModel, + "typical_positive_ratio": 0.976601, + "keep_english_letter": False, + "charset_name": "IBM866", + "language": "Russian", } Ibm855Model = { - 'char_to_order_map': IBM855_char_to_order_map, - 'precedence_matrix': RussianLangModel, - 'typical_positive_ratio': 0.976601, - 'keep_english_letter': False, - 'charset_name': "IBM855", - 'language': 'Russian', + "char_to_order_map": IBM855_char_to_order_map, + "precedence_matrix": RussianLangModel, + "typical_positive_ratio": 0.976601, + "keep_english_letter": False, + "charset_name": "IBM855", + "language": "Russian", } diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/langgreekmodel.py b/src/fetchcode/vcs/pip/_vendor/chardet/langgreekmodel.py index 53322216..6f1bff7f 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/langgreekmodel.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/langgreekmodel.py @@ -32,41 +32,521 @@ # Character Mapping Table: Latin7_char_to_order_map = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, # 40 - 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, # 50 -253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, # 60 - 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, # 70 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 80 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 90 -253,233, 90,253,253,253,253,253,253,253,253,253,253, 74,253,253, # a0 -253,253,253,253,247,248, 61, 36, 46, 71, 73,253, 54,253,108,123, # b0 -110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, # c0 - 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, # d0 -124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, # e0 - 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, # f0 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 82, + 100, + 104, + 94, + 98, + 101, + 116, + 102, + 111, + 187, + 117, + 92, + 88, + 113, + 85, # 40 + 79, + 118, + 105, + 83, + 67, + 114, + 119, + 95, + 99, + 109, + 188, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 72, + 70, + 80, + 81, + 60, + 96, + 93, + 89, + 68, + 120, + 97, + 77, + 86, + 69, + 55, # 60 + 78, + 115, + 65, + 66, + 58, + 76, + 106, + 103, + 87, + 107, + 112, + 253, + 253, + 253, + 253, + 253, # 70 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 80 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 90 + 253, + 233, + 90, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 74, + 253, + 253, # a0 + 253, + 253, + 253, + 253, + 247, + 248, + 61, + 36, + 46, + 71, + 73, + 253, + 54, + 253, + 108, + 123, # b0 + 110, + 31, + 51, + 43, + 41, + 34, + 91, + 40, + 52, + 47, + 44, + 53, + 38, + 49, + 59, + 39, # c0 + 35, + 48, + 250, + 37, + 33, + 45, + 56, + 50, + 84, + 57, + 120, + 121, + 17, + 18, + 22, + 15, # d0 + 124, + 1, + 29, + 20, + 21, + 3, + 32, + 13, + 25, + 5, + 11, + 16, + 10, + 6, + 30, + 4, # e0 + 9, + 8, + 14, + 7, + 2, + 12, + 28, + 23, + 42, + 24, + 64, + 75, + 19, + 26, + 27, + 253, # f0 ) win1253_char_to_order_map = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253, 82,100,104, 94, 98,101,116,102,111,187,117, 92, 88,113, 85, # 40 - 79,118,105, 83, 67,114,119, 95, 99,109,188,253,253,253,253,253, # 50 -253, 72, 70, 80, 81, 60, 96, 93, 89, 68,120, 97, 77, 86, 69, 55, # 60 - 78,115, 65, 66, 58, 76,106,103, 87,107,112,253,253,253,253,253, # 70 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 80 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 90 -253,233, 61,253,253,253,253,253,253,253,253,253,253, 74,253,253, # a0 -253,253,253,253,247,253,253, 36, 46, 71, 73,253, 54,253,108,123, # b0 -110, 31, 51, 43, 41, 34, 91, 40, 52, 47, 44, 53, 38, 49, 59, 39, # c0 - 35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, # d0 -124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, # e0 - 9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, # f0 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 82, + 100, + 104, + 94, + 98, + 101, + 116, + 102, + 111, + 187, + 117, + 92, + 88, + 113, + 85, # 40 + 79, + 118, + 105, + 83, + 67, + 114, + 119, + 95, + 99, + 109, + 188, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 72, + 70, + 80, + 81, + 60, + 96, + 93, + 89, + 68, + 120, + 97, + 77, + 86, + 69, + 55, # 60 + 78, + 115, + 65, + 66, + 58, + 76, + 106, + 103, + 87, + 107, + 112, + 253, + 253, + 253, + 253, + 253, # 70 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 80 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 90 + 253, + 233, + 61, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 74, + 253, + 253, # a0 + 253, + 253, + 253, + 253, + 247, + 253, + 253, + 36, + 46, + 71, + 73, + 253, + 54, + 253, + 108, + 123, # b0 + 110, + 31, + 51, + 43, + 41, + 34, + 91, + 40, + 52, + 47, + 44, + 53, + 38, + 49, + 59, + 39, # c0 + 35, + 48, + 250, + 37, + 33, + 45, + 56, + 50, + 84, + 57, + 120, + 121, + 17, + 18, + 22, + 15, # d0 + 124, + 1, + 29, + 20, + 21, + 3, + 32, + 13, + 25, + 5, + 11, + 16, + 10, + 6, + 30, + 4, # e0 + 9, + 8, + 14, + 7, + 2, + 12, + 28, + 23, + 42, + 24, + 64, + 75, + 19, + 26, + 27, + 253, # f0 ) # Model Table: @@ -76,150 +556,4118 @@ # rest sequences: 0.0359% # negative sequences: 0.0148% GreekLangModel = ( -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,2,2,3,3,3,3,3,3,3,3,1,3,3,3,0,2,2,3,3,0,3,0,3,2,0,3,3,3,0, -3,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,0,3,3,0,3,2,3,3,0,3,2,3,3,3,0,0,3,0,3,0,3,3,2,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, -0,2,3,2,2,3,3,3,3,3,3,3,3,0,3,3,3,3,0,2,3,3,0,3,3,3,3,2,3,3,3,0, -2,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,2,1,3,3,3,3,2,3,3,2,3,3,2,0, -0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,0,3,3,3,3,3,3,0,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,2,3,3,0, -2,0,1,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,2,3,0,0,0,0,3,3,0,3,1,3,3,3,0,3,3,0,3,3,3,3,0,0,0,0, -2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,0,3,0,3,3,3,3,3,0,3,2,2,2,3,0,2,3,3,3,3,3,2,3,3,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,3,2,2,2,3,3,3,3,0,3,1,3,3,3,3,2,3,3,3,3,3,3,3,2,2,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,2,0,3,0,0,0,3,3,2,3,3,3,3,3,0,0,3,2,3,0,2,3,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,0,3,3,3,3,0,0,3,3,0,2,3,0,3,0,3,3,3,0,0,3,0,3,0,2,2,3,3,0,0, -0,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,2,0,3,2,3,3,3,3,0,3,3,3,3,3,0,3,3,2,3,2,3,3,2,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,2,3,2,3,3,3,3,3,3,0,2,3,2,3,2,2,2,3,2,3,3,2,3,0,2,2,2,3,0, -2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,0,0,0,3,3,3,2,3,3,0,0,3,0,3,0,0,0,3,2,0,3,0,3,0,0,2,0,2,0, -0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,0,3,3,3,3,3,3,0,3,3,0,3,0,0,0,3,3,0,3,3,3,0,0,1,2,3,0, -3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,2,0,0,3,2,2,3,3,0,3,3,3,3,3,2,1,3,0,3,2,3,3,2,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,3,0,2,3,3,3,3,3,3,0,0,3,0,3,0,0,0,3,3,0,3,2,3,0,0,3,3,3,0, -3,0,0,0,2,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,0,3,3,3,3,3,3,0,0,3,0,3,0,0,0,3,2,0,3,2,3,0,0,3,2,3,0, -2,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,1,2,2,3,3,3,3,3,3,0,2,3,0,3,0,0,0,3,3,0,3,0,2,0,0,2,3,1,0, -2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,0,3,3,3,3,0,3,0,3,3,2,3,0,3,3,3,3,3,3,0,3,3,3,0,2,3,0,0,3,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,0,3,3,3,0,0,3,0,0,0,3,3,0,3,0,2,3,3,0,0,3,0,3,0,3,3,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,0,0,0,3,3,3,3,3,3,0,0,3,0,2,0,0,0,3,3,0,3,0,3,0,0,2,0,2,0, -0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,3,0,3,0,2,0,3,2,0,3,2,3,2,3,0,0,3,2,3,2,3,3,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,0,0,2,3,3,3,3,3,0,0,0,3,0,2,1,0,0,3,2,2,2,0,3,0,0,2,2,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,0,3,3,3,2,0,3,0,3,0,3,3,0,2,1,2,3,3,0,0,3,0,3,0,3,3,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,3,3,3,0,3,3,3,3,3,3,0,2,3,0,3,0,0,0,2,1,0,2,2,3,0,0,2,2,2,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,3,0,0,2,3,3,3,2,3,0,0,1,3,0,2,0,0,0,0,3,0,1,0,2,0,0,1,1,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,3,1,0,3,0,0,0,3,2,0,3,2,3,3,3,0,0,3,0,3,2,2,2,1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,0,3,3,3,0,0,3,0,0,0,0,2,0,2,3,3,2,2,2,2,3,0,2,0,2,2,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,3,3,3,2,0,0,0,0,0,0,2,3,0,2,0,2,3,2,0,0,3,0,3,0,3,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,2,3,3,2,2,3,0,2,0,3,0,0,0,2,0,0,0,0,1,2,0,2,0,2,0, -0,2,0,2,0,2,2,0,0,1,0,2,2,2,0,2,2,2,0,2,2,2,0,0,2,0,0,1,0,0,0,0, -0,2,0,3,3,2,0,0,0,0,0,0,1,3,0,2,0,2,2,2,0,0,2,0,3,0,0,2,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,0,2,3,2,0,2,2,0,2,0,2,2,0,2,0,2,2,2,0,0,0,0,0,0,2,3,0,0,0,2, -0,1,2,0,0,0,0,2,2,0,0,0,2,1,0,2,2,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0, -0,0,2,1,0,2,3,2,2,3,2,3,2,0,0,3,3,3,0,0,3,2,0,0,0,1,1,0,2,0,2,2, -0,2,0,2,0,2,2,0,0,2,0,2,2,2,0,2,2,2,2,0,0,2,0,0,0,2,0,1,0,0,0,0, -0,3,0,3,3,2,2,0,3,0,0,0,2,2,0,2,2,2,1,2,0,0,1,2,2,0,0,3,0,0,0,2, -0,1,2,0,0,0,1,2,0,0,0,0,0,0,0,2,2,0,1,0,0,2,0,0,0,2,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,3,3,2,2,0,0,0,2,0,2,3,3,0,2,0,0,0,0,0,0,2,2,2,0,2,2,0,2,0,2, -0,2,2,0,0,2,2,2,2,1,0,0,2,2,0,2,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0, -0,2,0,3,2,3,0,0,0,3,0,0,2,2,0,2,0,2,2,2,0,0,2,0,0,0,0,0,0,0,0,2, -0,0,2,2,0,0,2,2,2,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,0,0,3,2,0,2,2,2,2,2,0,0,0,2,0,0,0,0,2,0,1,0,0,2,0,1,0,0,0, -0,2,2,2,0,2,2,0,1,2,0,2,2,2,0,2,2,2,2,1,2,2,0,0,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, -0,2,0,2,0,2,2,0,0,0,0,1,2,1,0,0,2,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,3,2,3,0,0,2,0,0,0,2,2,0,2,0,0,0,1,0,0,2,0,2,0,2,2,0,0,0,0, -0,0,2,0,0,0,0,2,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0, -0,2,2,3,2,2,0,0,0,0,0,0,1,3,0,2,0,2,2,0,0,0,1,0,2,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,0,2,0,3,2,0,2,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -0,0,2,0,0,0,0,1,1,0,0,2,1,2,0,2,2,0,1,0,0,1,0,0,0,2,0,0,0,0,0,0, -0,3,0,2,2,2,0,0,2,0,0,0,2,0,0,0,2,3,0,2,0,0,0,0,0,0,2,2,0,0,0,2, -0,1,2,0,0,0,1,2,2,1,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,1,2,0,2,2,0,2,0,0,2,0,0,0,0,1,2,1,0,2,1,0,0,0,0,0,0,0,0,0,0, -0,0,2,0,0,0,3,1,2,2,0,2,0,0,0,0,2,0,0,0,2,0,0,3,0,0,0,0,2,2,2,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,1,0,2,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,2, -0,2,2,0,0,2,2,2,2,2,0,1,2,0,0,0,2,2,0,1,0,2,0,0,2,2,0,0,0,0,0,0, -0,0,0,0,1,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,2, -0,1,2,0,0,0,0,2,2,1,0,1,0,1,0,2,2,2,1,0,0,0,0,0,0,1,0,0,0,0,0,0, -0,2,0,1,2,0,0,0,0,0,0,0,0,0,0,2,0,0,2,2,0,0,0,0,1,0,0,0,0,0,0,2, -0,2,2,0,0,0,0,2,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0, -0,2,2,2,2,0,0,0,3,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,1, -0,0,2,0,0,0,0,1,2,0,0,0,0,0,0,2,2,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0, -0,2,0,2,2,2,0,0,2,0,0,0,0,0,0,0,2,2,2,0,0,0,2,0,0,0,0,0,0,0,0,2, -0,0,1,0,0,0,0,2,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, -0,3,0,2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,2, -0,0,2,0,0,0,0,2,2,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2,0,2,2,1,0,0,0,0,0,0,2,0,0,2,0,2,2,2,0,0,0,0,0,0,2,0,0,0,0,2, -0,0,2,0,0,2,0,2,2,0,0,0,0,2,0,2,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0, -0,0,3,0,0,0,2,2,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0, -0,2,2,2,2,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1, -0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, -0,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,2,0,0,0, -0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,2,0,2,0,0,0, -0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,2,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 0, + 2, + 2, + 3, + 3, + 0, + 3, + 0, + 3, + 2, + 0, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 3, + 2, + 3, + 3, + 0, + 3, + 2, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 3, + 3, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 0, + 2, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 2, + 1, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 2, + 3, + 3, + 0, + 2, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 1, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 2, + 2, + 2, + 3, + 0, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 0, + 3, + 1, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 2, + 3, + 0, + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 3, + 0, + 2, + 3, + 0, + 3, + 0, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 2, + 2, + 3, + 3, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 0, + 3, + 2, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 2, + 3, + 2, + 3, + 2, + 2, + 2, + 3, + 2, + 3, + 3, + 2, + 3, + 0, + 2, + 2, + 2, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 2, + 0, + 3, + 0, + 3, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 3, + 3, + 0, + 0, + 1, + 2, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 0, + 0, + 3, + 2, + 2, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 3, + 0, + 3, + 2, + 3, + 3, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 2, + 3, + 0, + 0, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 2, + 0, + 3, + 2, + 3, + 0, + 0, + 3, + 2, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 2, + 3, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 0, + 2, + 0, + 0, + 2, + 3, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 3, + 3, + 2, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 0, + 2, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 0, + 2, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 2, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 0, + 3, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 2, + 0, + 3, + 2, + 0, + 3, + 2, + 3, + 2, + 3, + 0, + 0, + 3, + 2, + 3, + 2, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 2, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 2, + 1, + 0, + 0, + 3, + 2, + 2, + 2, + 0, + 3, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 2, + 0, + 3, + 0, + 3, + 0, + 3, + 3, + 0, + 2, + 1, + 2, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 0, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 2, + 3, + 0, + 3, + 0, + 0, + 0, + 2, + 1, + 0, + 2, + 2, + 3, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 2, + 3, + 3, + 3, + 2, + 3, + 0, + 0, + 1, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 0, + 2, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 1, + 0, + 3, + 0, + 0, + 0, + 3, + 2, + 0, + 3, + 2, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 2, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 0, + 2, + 0, + 2, + 3, + 2, + 0, + 0, + 3, + 0, + 3, + 0, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 3, + 2, + 2, + 3, + 0, + 2, + 0, + 3, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 2, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 3, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 3, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 3, + 2, + 0, + 2, + 2, + 0, + 2, + 0, + 2, + 2, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 2, + 1, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 2, + 3, + 2, + 2, + 3, + 2, + 3, + 2, + 0, + 0, + 3, + 3, + 3, + 0, + 0, + 3, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 2, + 0, + 2, + 2, + 0, + 2, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 3, + 2, + 2, + 0, + 3, + 0, + 0, + 0, + 2, + 2, + 0, + 2, + 2, + 2, + 1, + 2, + 0, + 0, + 1, + 2, + 2, + 0, + 0, + 3, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 2, + 2, + 0, + 0, + 0, + 2, + 0, + 2, + 3, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 0, + 2, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 2, + 2, + 2, + 2, + 1, + 0, + 0, + 2, + 2, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 3, + 2, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 2, + 2, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 2, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 3, + 2, + 0, + 2, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 0, + 1, + 2, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 0, + 0, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 2, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 3, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 3, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 2, + 0, + 2, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 1, + 2, + 2, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 2, + 0, + 2, + 2, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 3, + 1, + 2, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 2, + 2, + 2, + 2, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 2, + 2, + 0, + 1, + 0, + 2, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 2, + 2, + 1, + 0, + 1, + 0, + 1, + 0, + 2, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 2, + 2, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, ) Latin7GreekModel = { - 'char_to_order_map': Latin7_char_to_order_map, - 'precedence_matrix': GreekLangModel, - 'typical_positive_ratio': 0.982851, - 'keep_english_letter': False, - 'charset_name': "ISO-8859-7", - 'language': 'Greek', + "char_to_order_map": Latin7_char_to_order_map, + "precedence_matrix": GreekLangModel, + "typical_positive_ratio": 0.982851, + "keep_english_letter": False, + "charset_name": "ISO-8859-7", + "language": "Greek", } Win1253GreekModel = { - 'char_to_order_map': win1253_char_to_order_map, - 'precedence_matrix': GreekLangModel, - 'typical_positive_ratio': 0.982851, - 'keep_english_letter': False, - 'charset_name': "windows-1253", - 'language': 'Greek', + "char_to_order_map": win1253_char_to_order_map, + "precedence_matrix": GreekLangModel, + "typical_positive_ratio": 0.982851, + "keep_english_letter": False, + "charset_name": "windows-1253", + "language": "Greek", } diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/langhebrewmodel.py b/src/fetchcode/vcs/pip/_vendor/chardet/langhebrewmodel.py index 58f4c875..1a4141a9 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/langhebrewmodel.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/langhebrewmodel.py @@ -35,22 +35,262 @@ # Windows-1255 language model # Character Mapping Table: WIN1255_CHAR_TO_ORDER_MAP = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253, 69, 91, 79, 80, 92, 89, 97, 90, 68,111,112, 82, 73, 95, 85, # 40 - 78,121, 86, 71, 67,102,107, 84,114,103,115,253,253,253,253,253, # 50 -253, 50, 74, 60, 61, 42, 76, 70, 64, 53,105, 93, 56, 65, 54, 49, # 60 - 66,110, 51, 43, 44, 63, 81, 77, 98, 75,108,253,253,253,253,253, # 70 -124,202,203,204,205, 40, 58,206,207,208,209,210,211,212,213,214, -215, 83, 52, 47, 46, 72, 32, 94,216,113,217,109,218,219,220,221, - 34,116,222,118,100,223,224,117,119,104,125,225,226, 87, 99,227, -106,122,123,228, 55,229,230,101,231,232,120,233, 48, 39, 57,234, - 30, 59, 41, 88, 33, 37, 36, 31, 29, 35,235, 62, 28,236,126,237, -238, 38, 45,239,240,241,242,243,127,244,245,246,247,248,249,250, - 9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23, - 12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 69, + 91, + 79, + 80, + 92, + 89, + 97, + 90, + 68, + 111, + 112, + 82, + 73, + 95, + 85, # 40 + 78, + 121, + 86, + 71, + 67, + 102, + 107, + 84, + 114, + 103, + 115, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 50, + 74, + 60, + 61, + 42, + 76, + 70, + 64, + 53, + 105, + 93, + 56, + 65, + 54, + 49, # 60 + 66, + 110, + 51, + 43, + 44, + 63, + 81, + 77, + 98, + 75, + 108, + 253, + 253, + 253, + 253, + 253, # 70 + 124, + 202, + 203, + 204, + 205, + 40, + 58, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 83, + 52, + 47, + 46, + 72, + 32, + 94, + 216, + 113, + 217, + 109, + 218, + 219, + 220, + 221, + 34, + 116, + 222, + 118, + 100, + 223, + 224, + 117, + 119, + 104, + 125, + 225, + 226, + 87, + 99, + 227, + 106, + 122, + 123, + 228, + 55, + 229, + 230, + 101, + 231, + 232, + 120, + 233, + 48, + 39, + 57, + 234, + 30, + 59, + 41, + 88, + 33, + 37, + 36, + 31, + 29, + 35, + 235, + 62, + 28, + 236, + 126, + 237, + 238, + 38, + 45, + 239, + 240, + 241, + 242, + 243, + 127, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 9, + 8, + 20, + 16, + 3, + 2, + 24, + 14, + 22, + 1, + 25, + 15, + 4, + 11, + 6, + 23, + 12, + 19, + 13, + 26, + 18, + 27, + 21, + 17, + 7, + 10, + 5, + 251, + 252, + 128, + 96, + 253, ) # Model Table: @@ -60,141 +300,4109 @@ # rest sequences: 0.087% # negative sequences: 0.0015% HEBREW_LANG_MODEL = ( -0,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0, -3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2, -1,2,1,2,1,2,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2, -1,2,1,3,1,1,0,0,2,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,1,2,2,1,3, -1,2,1,1,2,2,0,0,2,2,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,2,2,3,2, -1,2,1,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,2,3,2,2,2,1,2,2,2,2, -1,2,1,1,2,2,0,1,2,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,2,2,2,2,2, -0,2,0,2,2,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,2,2, -0,2,1,2,2,2,0,0,2,1,0,0,0,0,1,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,3,2,2,2, -1,2,1,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0, -3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,2,0,2, -0,2,1,2,2,2,0,0,1,2,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,2,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,2,3,2,1,2,1,1,1, -0,1,1,1,1,1,3,0,1,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,0,0,1,0,0,1,0,0,0,0, -0,0,1,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2, -0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,2,3,3,3,2,1,2,3,3,2,3,3,3,3,2,3,2,1,2,0,2,1,2, -0,2,0,2,2,2,0,0,1,2,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0, -3,3,3,3,3,3,3,3,3,2,3,3,3,1,2,2,3,3,2,3,2,3,2,2,3,1,2,2,0,2,2,2, -0,2,1,2,2,2,0,0,1,2,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,2,2,2,3,3,3,3,1,3,2,2,2, -0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,2,3,2,2,2,1,2,2,0,2,2,2,2, -0,2,0,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,1,3,2,3,3,2,3,3,2,2,1,2,2,2,2,2,2, -0,2,1,2,1,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,2,3,2,3,3,2,3,3,3,3,2,3,2,3,3,3,3,3,2,2,2,2,2,2,2,1, -0,2,0,1,2,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,2,1,2,3,3,3,3,3,3,3,2,3,2,3,2,1,2,3,0,2,1,2,2, -0,2,1,1,2,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0, -3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,1,3,1,2,2,2,1,2,3,3,1,2,1,2,2,2,2, -0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,0,2,3,3,3,1,3,3,3,1,2,2,2,2,1,1,2,2,2,2,2,2, -0,2,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,2,3,3,3,2,2,3,3,3,2,1,2,3,2,3,2,2,2,2,1,2,1,1,1,2,2, -0,2,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,1,0,0,0,0,0, -1,0,1,0,0,0,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,2,3,3,2,3,1,2,2,2,2,3,2,3,1,1,2,2,1,2,2,1,1,0,2,2,2,2, -0,1,0,1,2,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, -3,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,0, -0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, -3,2,2,1,2,2,2,2,2,2,2,1,2,2,1,2,2,1,1,1,1,1,1,1,1,2,1,1,0,3,3,3, -0,3,0,2,2,2,2,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -2,2,2,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,2,2,2,1,1,1,2,0,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,0,2,2,0,0,0,0,0,0, -0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,3,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,0,2,1,0, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -0,3,1,1,2,2,2,2,2,1,2,2,2,1,1,2,2,2,2,2,2,2,1,2,2,1,0,1,1,1,1,0, -0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,2,1,1,1,1,2,1,1,2,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0, -0,0,2,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,0,0, -2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,1,2,1,2,1,1,1,1,0,0,0,0, -0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,2,1,2,2,2,2,2,2,2,2,2,2,1,2,1,2,1,1,2,1,1,1,2,1,2,1,2,0,1,0,1, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,3,1,2,2,2,1,2,2,2,2,2,2,2,2,1,2,1,1,1,1,1,1,2,1,2,1,1,0,1,0,1, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,1,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2, -0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,1,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,0,0, -0,1,1,1,2,1,2,2,2,0,2,0,2,0,1,1,2,1,1,1,1,2,1,0,1,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,1,0,0,0,0,0,1,0,1,2,2,0,1,0,0,1,1,2,2,1,2,0,2,0,0,0,1,2,0,1, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,0,2,1,2,0,2,0,0,1,1,1,1,1,1,0,1,0,0,0,1,0,0,1, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,0,0,0,0,0,1,0,2,1,1,0,1,0,0,1,1,1,2,2,0,0,1,0,0,0,1,0,0,1, -1,1,2,1,0,1,1,1,0,1,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,2,2,1, -0,2,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,1,0,0,1,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,1,1,1,1,1,1,1,1,2,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,1,1,0,1,0,0,0,1,1,0,1, -2,0,1,0,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1,2,1,1,2,0,1,0,0,0,1,1,0,1, -1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,0,0,2,1,1,2,0,2,0,0,0,1,1,0,1, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,2,1,1,0,1,0,0,2,2,1,2,1,1,0,1,0,0,0,1,1,0,1, -2,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,2,2,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,2,2,0,0,0,0,2,1,1,1,0,2,1,1,0,0,0,2,1,0,1, -1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,0,2,1,1,0,1,0,0,0,1,1,0,1, -2,2,1,1,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,2,1,1,0,1,0,0,1,1,0,1,2,1,0,2,0,0,0,1,1,0,1, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, -0,1,0,0,2,0,2,1,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,0,0,1, -1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,2,1,1,1,1,1,0,1,0,0,0,0,1,0,1, -0,1,1,1,2,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 1, + 2, + 0, + 1, + 0, + 0, + 3, + 0, + 3, + 1, + 0, + 0, + 1, + 3, + 2, + 0, + 1, + 1, + 2, + 0, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 2, + 0, + 0, + 2, + 2, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 2, + 1, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 1, + 2, + 1, + 3, + 1, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 0, + 1, + 2, + 2, + 1, + 3, + 1, + 2, + 1, + 1, + 2, + 2, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 2, + 1, + 2, + 1, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 2, + 2, + 3, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + 2, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 0, + 2, + 2, + 2, + 2, + 2, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 0, + 2, + 2, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 2, + 3, + 2, + 2, + 2, + 1, + 2, + 1, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 0, + 2, + 0, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 2, + 2, + 3, + 2, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 3, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 0, + 2, + 0, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 1, + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 1, + 2, + 0, + 2, + 1, + 2, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 1, + 2, + 2, + 3, + 3, + 2, + 3, + 2, + 3, + 2, + 2, + 3, + 1, + 2, + 2, + 0, + 2, + 2, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 1, + 3, + 2, + 2, + 2, + 0, + 2, + 0, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 1, + 2, + 2, + 0, + 2, + 2, + 2, + 2, + 0, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 1, + 3, + 2, + 3, + 3, + 2, + 3, + 3, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 0, + 2, + 1, + 2, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 0, + 2, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 2, + 1, + 2, + 3, + 0, + 2, + 1, + 2, + 2, + 0, + 2, + 1, + 1, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 1, + 3, + 1, + 2, + 2, + 2, + 1, + 2, + 3, + 3, + 1, + 2, + 1, + 2, + 2, + 2, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 2, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 0, + 2, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 2, + 1, + 2, + 3, + 2, + 3, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 2, + 2, + 0, + 2, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 1, + 2, + 2, + 2, + 2, + 3, + 2, + 3, + 1, + 1, + 2, + 2, + 1, + 2, + 2, + 1, + 1, + 0, + 2, + 2, + 2, + 2, + 0, + 1, + 0, + 1, + 2, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 3, + 3, + 3, + 0, + 3, + 0, + 2, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 2, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 2, + 1, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 2, + 0, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 2, + 1, + 2, + 2, + 2, + 0, + 2, + 0, + 2, + 0, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 2, + 0, + 1, + 0, + 0, + 1, + 1, + 2, + 2, + 1, + 2, + 0, + 2, + 0, + 0, + 0, + 1, + 2, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 1, + 2, + 0, + 2, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 1, + 0, + 2, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 2, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 1, + 1, + 2, + 0, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 2, + 2, + 1, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 2, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 1, + 0, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, ) Win1255HebrewModel = { - 'char_to_order_map': WIN1255_CHAR_TO_ORDER_MAP, - 'precedence_matrix': HEBREW_LANG_MODEL, - 'typical_positive_ratio': 0.984004, - 'keep_english_letter': False, - 'charset_name': "windows-1255", - 'language': 'Hebrew', + "char_to_order_map": WIN1255_CHAR_TO_ORDER_MAP, + "precedence_matrix": HEBREW_LANG_MODEL, + "typical_positive_ratio": 0.984004, + "keep_english_letter": False, + "charset_name": "windows-1255", + "language": "Hebrew", } diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/langhungarianmodel.py b/src/fetchcode/vcs/pip/_vendor/chardet/langhungarianmodel.py index bb7c095e..b9fbbf6f 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/langhungarianmodel.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/langhungarianmodel.py @@ -32,41 +32,521 @@ # Character Mapping Table: Latin2_HungarianCharToOrderMap = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, - 46, 71, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, -253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, - 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, -159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174, -175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190, -191,192,193,194,195,196,197, 75,198,199,200,201,202,203,204,205, - 79,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, -221, 51, 81,222, 78,223,224,225,226, 44,227,228,229, 61,230,231, -232,233,234, 58,235, 66, 59,236,237,238, 60, 69, 63,239,240,241, - 82, 14, 74,242, 70, 80,243, 72,244, 15, 83, 77, 84, 30, 76, 85, -245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 28, + 40, + 54, + 45, + 32, + 50, + 49, + 38, + 39, + 53, + 36, + 41, + 34, + 35, + 47, + 46, + 71, + 43, + 33, + 37, + 57, + 48, + 64, + 68, + 55, + 52, + 253, + 253, + 253, + 253, + 253, + 253, + 2, + 18, + 26, + 17, + 1, + 27, + 12, + 20, + 9, + 22, + 7, + 6, + 13, + 4, + 8, + 23, + 67, + 10, + 5, + 3, + 21, + 19, + 65, + 62, + 16, + 11, + 253, + 253, + 253, + 253, + 253, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 75, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 79, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 51, + 81, + 222, + 78, + 223, + 224, + 225, + 226, + 44, + 227, + 228, + 229, + 61, + 230, + 231, + 232, + 233, + 234, + 58, + 235, + 66, + 59, + 236, + 237, + 238, + 60, + 69, + 63, + 239, + 240, + 241, + 82, + 14, + 74, + 242, + 70, + 80, + 243, + 72, + 244, + 15, + 83, + 77, + 84, + 30, + 76, + 85, + 245, + 246, + 247, + 25, + 73, + 42, + 24, + 248, + 249, + 250, + 31, + 56, + 29, + 251, + 252, + 253, ) win1250HungarianCharToOrderMap = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253, 28, 40, 54, 45, 32, 50, 49, 38, 39, 53, 36, 41, 34, 35, 47, - 46, 72, 43, 33, 37, 57, 48, 64, 68, 55, 52,253,253,253,253,253, -253, 2, 18, 26, 17, 1, 27, 12, 20, 9, 22, 7, 6, 13, 4, 8, - 23, 67, 10, 5, 3, 21, 19, 65, 62, 16, 11,253,253,253,253,253, -161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176, -177,178,179,180, 78,181, 69,182,183,184,185,186,187,188,189,190, -191,192,193,194,195,196,197, 76,198,199,200,201,202,203,204,205, - 81,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, -221, 51, 83,222, 80,223,224,225,226, 44,227,228,229, 61,230,231, -232,233,234, 58,235, 66, 59,236,237,238, 60, 70, 63,239,240,241, - 84, 14, 75,242, 71, 82,243, 73,244, 15, 85, 79, 86, 30, 77, 87, -245,246,247, 25, 74, 42, 24,248,249,250, 31, 56, 29,251,252,253, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 28, + 40, + 54, + 45, + 32, + 50, + 49, + 38, + 39, + 53, + 36, + 41, + 34, + 35, + 47, + 46, + 72, + 43, + 33, + 37, + 57, + 48, + 64, + 68, + 55, + 52, + 253, + 253, + 253, + 253, + 253, + 253, + 2, + 18, + 26, + 17, + 1, + 27, + 12, + 20, + 9, + 22, + 7, + 6, + 13, + 4, + 8, + 23, + 67, + 10, + 5, + 3, + 21, + 19, + 65, + 62, + 16, + 11, + 253, + 253, + 253, + 253, + 253, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 176, + 177, + 178, + 179, + 180, + 78, + 181, + 69, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 194, + 195, + 196, + 197, + 76, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 81, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 51, + 83, + 222, + 80, + 223, + 224, + 225, + 226, + 44, + 227, + 228, + 229, + 61, + 230, + 231, + 232, + 233, + 234, + 58, + 235, + 66, + 59, + 236, + 237, + 238, + 60, + 70, + 63, + 239, + 240, + 241, + 84, + 14, + 75, + 242, + 71, + 82, + 243, + 73, + 244, + 15, + 85, + 79, + 86, + 30, + 77, + 87, + 245, + 246, + 247, + 25, + 74, + 42, + 24, + 248, + 249, + 250, + 31, + 56, + 29, + 251, + 252, + 253, ) # Model Table: @@ -76,150 +556,4118 @@ # rest sequences: 0.8894% # negative sequences: 0.0009% HungarianLangModel = ( -0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,1,1,2,2,2,2,2,1,2, -3,2,2,3,3,3,3,3,2,3,3,3,3,3,3,1,2,3,3,3,3,2,3,3,1,1,3,3,0,1,1,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0, -3,2,1,3,3,3,3,3,2,3,3,3,3,3,1,1,2,3,3,3,3,3,3,3,1,1,3,2,0,1,1,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,1,1,2,3,3,3,1,3,3,3,3,3,1,3,3,2,2,0,3,2,3, -0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,3,3,3,3,2,3,3,2,2,3,2,3,2,0,3,2,2, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0, -3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,1,2,3,2,2,3,1,2,3,3,2,2,0,3,3,3, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,2,3,3,3,3,2,3,3,3,3,0,2,3,2, -0,0,0,1,1,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,1,1,1,3,3,2,1,3,2,2,3,2,1,3,2,2,1,0,3,3,1, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,2,2,3,3,3,3,3,1,2,3,3,3,3,1,2,1,3,3,3,3,2,2,3,1,1,3,2,0,1,1,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,2,1,3,3,3,3,3,2,2,1,3,3,3,0,1,1,2, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,3,3,2,0,3,2,3, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0, -3,3,3,3,3,3,2,3,3,3,2,3,2,3,3,3,1,3,2,2,2,3,1,1,3,3,1,1,0,3,3,2, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,2,3,3,3,2,3,2,3,3,3,2,3,3,3,3,3,1,2,3,2,2,0,2,2,2, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,3,3,2,2,2,3,1,3,3,2,2,1,3,3,3,1,1,3,1,2,3,2,3,2,2,2,1,0,2,2,2, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, -3,1,1,3,3,3,3,3,1,2,3,3,3,3,1,2,1,3,3,3,2,2,3,2,1,0,3,2,0,1,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,1,1,3,3,3,3,3,1,2,3,3,3,3,1,1,0,3,3,3,3,0,2,3,0,0,2,1,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,2,2,3,3,2,2,2,2,3,3,0,1,2,3,2,3,2,2,3,2,1,2,0,2,2,2, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, -3,3,3,3,3,3,1,2,3,3,3,2,1,2,3,3,2,2,2,3,2,3,3,1,3,3,1,1,0,2,3,2, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,3,3,1,2,2,2,2,3,3,3,1,1,1,3,3,1,1,3,1,1,3,2,1,2,3,1,1,0,2,2,2, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,3,3,2,1,2,1,1,3,3,1,1,1,1,3,3,1,1,2,2,1,2,1,1,2,2,1,1,0,2,2,1, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,3,3,1,1,2,1,1,3,3,1,0,1,1,3,3,2,0,1,1,2,3,1,0,2,2,1,0,0,1,3,2, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,2,1,3,3,3,3,3,1,2,3,2,3,3,2,1,1,3,2,3,2,1,2,2,0,1,2,1,0,0,1,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, -3,3,3,3,2,2,2,2,3,1,2,2,1,1,3,3,0,3,2,1,2,3,2,1,3,3,1,1,0,2,1,3, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,3,3,2,2,2,3,2,3,3,3,2,1,1,3,3,1,1,1,2,2,3,2,3,2,2,2,1,0,2,2,1, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -1,0,0,3,3,3,3,3,0,0,3,3,2,3,0,0,0,2,3,3,1,0,1,2,0,0,1,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,1,2,3,3,3,3,3,1,2,3,3,2,2,1,1,0,3,3,2,2,1,2,2,1,0,2,2,0,1,1,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,2,2,1,3,1,2,3,3,2,2,1,1,2,2,1,1,1,1,3,2,1,1,1,1,2,1,0,1,2,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -2,3,3,1,1,1,1,1,3,3,3,0,1,1,3,3,1,1,1,1,1,2,2,0,3,1,1,2,0,2,1,1, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, -3,1,0,1,2,1,2,2,0,1,2,3,1,2,0,0,0,2,1,1,1,1,1,2,0,0,1,1,0,0,0,0, -1,2,1,2,2,2,1,2,1,2,0,2,0,2,2,1,1,2,1,1,2,1,1,1,0,1,0,0,0,1,1,0, -1,1,1,2,3,2,3,3,0,1,2,2,3,1,0,1,0,2,1,2,2,0,1,1,0,0,1,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,3,3,2,2,1,0,0,3,2,3,2,0,0,0,1,1,3,0,0,1,1,0,0,2,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,1,1,2,2,3,3,1,0,1,3,2,3,1,1,1,0,1,1,1,1,1,3,1,0,0,2,2,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,1,1,1,2,2,2,1,0,1,2,3,3,2,0,0,0,2,1,1,1,2,1,1,1,0,1,1,1,0,0,0, -1,2,2,2,2,2,1,1,1,2,0,2,1,1,1,1,1,2,1,1,1,1,1,1,0,1,1,1,0,0,1,1, -3,2,2,1,0,0,1,1,2,2,0,3,0,1,2,1,1,0,0,1,1,1,0,1,1,1,1,0,2,1,1,1, -2,2,1,1,1,2,1,2,1,1,1,1,1,1,1,2,1,1,1,2,3,1,1,1,1,1,1,1,1,1,0,1, -2,3,3,0,1,0,0,0,3,3,1,0,0,1,2,2,1,0,0,0,0,2,0,0,1,1,1,0,2,1,1,1, -2,1,1,1,1,1,1,2,1,1,0,1,1,0,1,1,1,0,1,2,1,1,0,1,1,1,1,1,1,1,0,1, -2,3,3,0,1,0,0,0,2,2,0,0,0,0,1,2,2,0,0,0,0,1,0,0,1,1,0,0,2,0,1,0, -2,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,0,1,1,1,1,1,0,1, -3,2,2,0,1,0,1,0,2,3,2,0,0,1,2,2,1,0,0,1,1,1,0,0,2,1,0,1,2,2,1,1, -2,1,1,1,1,1,1,2,1,1,1,1,1,1,0,2,1,0,1,1,0,1,1,1,0,1,1,2,1,1,0,1, -2,2,2,0,0,1,0,0,2,2,1,1,0,0,2,1,1,0,0,0,1,2,0,0,2,1,0,0,2,1,1,1, -2,1,1,1,1,2,1,2,1,1,1,2,2,1,1,2,1,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1, -1,2,3,0,0,0,1,0,3,2,1,0,0,1,2,1,1,0,0,0,0,2,1,0,1,1,0,0,2,1,2,1, -1,1,0,0,0,1,0,1,1,1,1,1,2,0,0,1,0,0,0,2,0,0,1,1,1,1,1,1,1,1,0,1, -3,0,0,2,1,2,2,1,0,0,2,1,2,2,0,0,0,2,1,1,1,0,1,1,0,0,1,1,2,0,0,0, -1,2,1,2,2,1,1,2,1,2,0,1,1,1,1,1,1,1,1,1,2,1,1,0,0,1,1,1,1,0,0,1, -1,3,2,0,0,0,1,0,2,2,2,0,0,0,2,2,1,0,0,0,0,3,1,1,1,1,0,0,2,1,1,1, -2,1,0,1,1,1,0,1,1,1,1,1,1,1,0,2,1,0,0,1,0,1,1,0,1,1,1,1,1,1,0,1, -2,3,2,0,0,0,1,0,2,2,0,0,0,0,2,1,1,0,0,0,0,2,1,0,1,1,0,0,2,1,1,0, -2,1,1,1,1,2,1,2,1,2,0,1,1,1,0,2,1,1,1,2,1,1,1,1,0,1,1,1,1,1,0,1, -3,1,1,2,2,2,3,2,1,1,2,2,1,1,0,1,0,2,2,1,1,1,1,1,0,0,1,1,0,1,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,0,0,0,0,0,2,2,0,0,0,0,2,2,1,0,0,0,1,1,0,0,1,2,0,0,2,1,1,1, -2,2,1,1,1,2,1,2,1,1,0,1,1,1,1,2,1,1,1,2,1,1,1,1,0,1,2,1,1,1,0,1, -1,0,0,1,2,3,2,1,0,0,2,0,1,1,0,0,0,1,1,1,1,0,1,1,0,0,1,0,0,0,0,0, -1,2,1,2,1,2,1,1,1,2,0,2,1,1,1,0,1,2,0,0,1,1,1,0,0,0,0,0,0,0,0,0, -2,3,2,0,0,0,0,0,1,1,2,1,0,0,1,1,1,0,0,0,0,2,0,0,1,1,0,0,2,1,1,1, -2,1,1,1,1,1,1,2,1,0,1,1,1,1,0,2,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1, -1,2,2,0,1,1,1,0,2,2,2,0,0,0,3,2,1,0,0,0,1,1,0,0,1,1,0,1,1,1,0,0, -1,1,0,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,0,0,1,1,1,0,1,0,1, -2,1,0,2,1,1,2,2,1,1,2,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1,0,0,0, -1,2,2,2,2,2,1,1,1,2,0,2,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,1,0, -1,2,3,0,0,0,1,0,2,2,0,0,0,0,2,2,0,0,0,0,0,1,0,0,1,0,0,0,2,0,1,0, -2,1,1,1,1,1,0,2,0,0,0,1,2,1,1,1,1,0,1,2,0,1,0,1,0,1,1,1,0,1,0,1, -2,2,2,0,0,0,1,0,2,1,2,0,0,0,1,1,2,0,0,0,0,1,0,0,1,1,0,0,2,1,0,1, -2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,1,1,1,1,1,0,1, -1,2,2,0,0,0,1,0,2,2,2,0,0,0,1,1,0,0,0,0,0,1,1,0,2,0,0,1,1,1,0,1, -1,0,1,1,1,1,1,1,0,1,1,1,1,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,0,0,1, -1,0,0,1,0,1,2,1,0,0,1,1,1,2,0,0,0,1,1,0,1,0,1,1,0,0,1,0,0,0,0,0, -0,2,1,2,1,1,1,1,1,2,0,2,0,1,1,0,1,2,1,0,1,1,1,0,0,0,0,0,0,1,0,0, -2,1,1,0,1,2,0,0,1,1,1,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,2,1,0,1, -2,2,1,1,1,1,1,2,1,1,0,1,1,1,1,2,1,1,1,2,1,1,0,1,0,1,1,1,1,1,0,1, -1,2,2,0,0,0,0,0,1,1,0,0,0,0,2,1,0,0,0,0,0,2,0,0,2,2,0,0,2,0,0,1, -2,1,1,1,1,1,1,1,0,1,1,0,1,1,0,1,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1, -1,1,2,0,0,3,1,0,2,1,1,1,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,0,1,0,1,0, -1,2,1,0,1,1,1,2,1,1,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,1,0,0,0,1,0,0, -2,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,2,0,0,0, -2,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,2,1,1,0,0,1,1,1,1,1,0,1, -2,1,1,1,2,1,1,1,0,1,1,2,1,0,0,0,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,1,0,1,1,1,1,1,0,0,1,1,2,1,0,0,0,1,1,0,0,0,1,1,0,0,1,0,1,0,0,0, -1,2,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0, -2,0,0,0,1,1,1,1,0,0,1,1,0,0,0,0,0,1,1,1,2,0,0,1,0,0,1,0,1,0,0,0, -0,1,1,1,1,1,1,1,1,2,0,1,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0, -1,0,0,1,1,1,1,1,0,0,2,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0, -0,1,1,1,1,1,1,0,1,1,0,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0, -1,0,0,1,1,1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -0,1,1,1,1,1,0,0,1,1,0,1,0,1,0,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0, -0,0,0,1,0,0,0,0,0,0,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,1,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0, -2,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,0,1,0,1,1,1,0,0,1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 1, + 1, + 3, + 3, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 3, + 2, + 1, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 3, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 2, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 2, + 2, + 0, + 3, + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 2, + 3, + 2, + 3, + 2, + 0, + 3, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 1, + 2, + 3, + 2, + 2, + 3, + 1, + 2, + 3, + 3, + 2, + 2, + 0, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 0, + 2, + 3, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 1, + 3, + 3, + 2, + 1, + 3, + 2, + 2, + 3, + 2, + 1, + 3, + 2, + 2, + 1, + 0, + 3, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 1, + 2, + 1, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 1, + 1, + 3, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 1, + 3, + 3, + 3, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 0, + 3, + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 1, + 3, + 2, + 2, + 2, + 3, + 1, + 1, + 3, + 3, + 1, + 1, + 0, + 3, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 2, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 1, + 3, + 3, + 2, + 2, + 1, + 3, + 3, + 3, + 1, + 1, + 3, + 1, + 2, + 3, + 2, + 3, + 2, + 2, + 2, + 1, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 1, + 2, + 1, + 3, + 3, + 3, + 2, + 2, + 3, + 2, + 1, + 0, + 3, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 1, + 1, + 0, + 3, + 3, + 3, + 3, + 0, + 2, + 3, + 0, + 0, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 3, + 0, + 1, + 2, + 3, + 2, + 3, + 2, + 2, + 3, + 2, + 1, + 2, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 2, + 1, + 2, + 3, + 3, + 2, + 2, + 2, + 3, + 2, + 3, + 3, + 1, + 3, + 3, + 1, + 1, + 0, + 2, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 1, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 1, + 1, + 1, + 3, + 3, + 1, + 1, + 3, + 1, + 1, + 3, + 2, + 1, + 2, + 3, + 1, + 1, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 1, + 2, + 1, + 1, + 3, + 3, + 1, + 1, + 1, + 1, + 3, + 3, + 1, + 1, + 2, + 2, + 1, + 2, + 1, + 1, + 2, + 2, + 1, + 1, + 0, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 1, + 1, + 2, + 1, + 1, + 3, + 3, + 1, + 0, + 1, + 1, + 3, + 3, + 2, + 0, + 1, + 1, + 2, + 3, + 1, + 0, + 2, + 2, + 1, + 0, + 0, + 1, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 1, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 2, + 3, + 3, + 2, + 1, + 1, + 3, + 2, + 3, + 2, + 1, + 2, + 2, + 0, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 1, + 2, + 2, + 1, + 1, + 3, + 3, + 0, + 3, + 2, + 1, + 2, + 3, + 2, + 1, + 3, + 3, + 1, + 1, + 0, + 2, + 1, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 2, + 3, + 3, + 3, + 2, + 1, + 1, + 3, + 3, + 1, + 1, + 1, + 2, + 2, + 3, + 2, + 3, + 2, + 2, + 2, + 1, + 0, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 3, + 2, + 3, + 0, + 0, + 0, + 2, + 3, + 3, + 1, + 0, + 1, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 3, + 2, + 2, + 1, + 1, + 0, + 3, + 3, + 2, + 2, + 1, + 2, + 2, + 1, + 0, + 2, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 2, + 1, + 3, + 1, + 2, + 3, + 3, + 2, + 2, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 3, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 1, + 1, + 1, + 1, + 1, + 3, + 3, + 3, + 0, + 1, + 1, + 3, + 3, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 0, + 3, + 1, + 1, + 2, + 0, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 0, + 1, + 2, + 1, + 2, + 2, + 0, + 1, + 2, + 3, + 1, + 2, + 0, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 2, + 2, + 2, + 1, + 2, + 1, + 2, + 0, + 2, + 0, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 2, + 3, + 2, + 3, + 3, + 0, + 1, + 2, + 2, + 3, + 1, + 0, + 1, + 0, + 2, + 1, + 2, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 2, + 2, + 1, + 0, + 0, + 3, + 2, + 3, + 2, + 0, + 0, + 0, + 1, + 1, + 3, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 2, + 2, + 3, + 3, + 1, + 0, + 1, + 3, + 2, + 3, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 3, + 1, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 0, + 1, + 2, + 3, + 3, + 2, + 0, + 0, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 2, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 3, + 2, + 2, + 1, + 0, + 0, + 1, + 1, + 2, + 2, + 0, + 3, + 0, + 1, + 2, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 2, + 3, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 3, + 3, + 0, + 1, + 0, + 0, + 0, + 3, + 3, + 1, + 0, + 0, + 1, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 3, + 3, + 0, + 1, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 3, + 2, + 2, + 0, + 1, + 0, + 1, + 0, + 2, + 3, + 2, + 0, + 0, + 1, + 2, + 2, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 2, + 1, + 0, + 1, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 2, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 2, + 1, + 1, + 0, + 1, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 2, + 1, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 2, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 2, + 3, + 0, + 0, + 0, + 1, + 0, + 3, + 2, + 1, + 0, + 0, + 1, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 3, + 0, + 0, + 2, + 1, + 2, + 2, + 1, + 0, + 0, + 2, + 1, + 2, + 2, + 0, + 0, + 0, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 1, + 2, + 1, + 2, + 2, + 1, + 1, + 2, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 3, + 2, + 0, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 1, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 2, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 3, + 2, + 0, + 0, + 0, + 1, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 3, + 1, + 1, + 2, + 2, + 2, + 3, + 2, + 1, + 1, + 2, + 2, + 1, + 1, + 0, + 1, + 0, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 2, + 2, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 2, + 0, + 0, + 2, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 2, + 3, + 2, + 1, + 0, + 0, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 2, + 1, + 2, + 1, + 1, + 1, + 2, + 0, + 2, + 1, + 1, + 1, + 0, + 1, + 2, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 2, + 2, + 0, + 1, + 1, + 1, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 3, + 2, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 2, + 1, + 0, + 2, + 1, + 1, + 2, + 2, + 1, + 1, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 2, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 3, + 0, + 0, + 0, + 1, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 2, + 0, + 0, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 2, + 2, + 2, + 0, + 0, + 0, + 1, + 0, + 2, + 1, + 2, + 0, + 0, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 2, + 2, + 0, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 2, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 1, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 0, + 2, + 0, + 1, + 1, + 0, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 1, + 2, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 2, + 0, + 0, + 3, + 1, + 0, + 2, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 2, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, ) Latin2HungarianModel = { - 'char_to_order_map': Latin2_HungarianCharToOrderMap, - 'precedence_matrix': HungarianLangModel, - 'typical_positive_ratio': 0.947368, - 'keep_english_letter': True, - 'charset_name': "ISO-8859-2", - 'language': 'Hungarian', + "char_to_order_map": Latin2_HungarianCharToOrderMap, + "precedence_matrix": HungarianLangModel, + "typical_positive_ratio": 0.947368, + "keep_english_letter": True, + "charset_name": "ISO-8859-2", + "language": "Hungarian", } Win1250HungarianModel = { - 'char_to_order_map': win1250HungarianCharToOrderMap, - 'precedence_matrix': HungarianLangModel, - 'typical_positive_ratio': 0.947368, - 'keep_english_letter': True, - 'charset_name': "windows-1250", - 'language': 'Hungarian', + "char_to_order_map": win1250HungarianCharToOrderMap, + "precedence_matrix": HungarianLangModel, + "typical_positive_ratio": 0.947368, + "keep_english_letter": True, + "charset_name": "windows-1250", + "language": "Hungarian", } diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/langthaimodel.py b/src/fetchcode/vcs/pip/_vendor/chardet/langthaimodel.py index 15f94c2d..ae2a2048 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/langthaimodel.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/langthaimodel.py @@ -34,22 +34,262 @@ # Character Mapping Table: TIS620CharToOrderMap = ( -255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00 -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10 -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20 -252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30 -253,182,106,107,100,183,184,185,101, 94,186,187,108,109,110,111, # 40 -188,189,190, 89, 95,112,113,191,192,193,194,253,253,253,253,253, # 50 -253, 64, 72, 73,114, 74,115,116,102, 81,201,117, 90,103, 78, 82, # 60 - 96,202, 91, 79, 84,104,105, 97, 98, 92,203,253,253,253,253,253, # 70 -209,210,211,212,213, 88,214,215,216,217,218,219,220,118,221,222, -223,224, 99, 85, 83,225,226,227,228,229,230,231,232,233,234,235, -236, 5, 30,237, 24,238, 75, 8, 26, 52, 34, 51,119, 47, 58, 57, - 49, 53, 55, 43, 20, 19, 44, 14, 48, 3, 17, 25, 39, 62, 31, 54, - 45, 9, 16, 2, 61, 15,239, 12, 42, 46, 18, 21, 76, 4, 66, 63, - 22, 10, 1, 36, 23, 13, 40, 27, 32, 35, 86,240,241,242,243,244, - 11, 28, 41, 29, 33,245, 50, 37, 6, 7, 67, 77, 38, 93,246,247, - 68, 56, 59, 65, 69, 60, 70, 80, 71, 87,248,249,250,251,252,253, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 254, + 255, + 255, + 254, + 255, + 255, # 00 + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, # 10 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, # 20 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, # 30 + 253, + 182, + 106, + 107, + 100, + 183, + 184, + 185, + 101, + 94, + 186, + 187, + 108, + 109, + 110, + 111, # 40 + 188, + 189, + 190, + 89, + 95, + 112, + 113, + 191, + 192, + 193, + 194, + 253, + 253, + 253, + 253, + 253, # 50 + 253, + 64, + 72, + 73, + 114, + 74, + 115, + 116, + 102, + 81, + 201, + 117, + 90, + 103, + 78, + 82, # 60 + 96, + 202, + 91, + 79, + 84, + 104, + 105, + 97, + 98, + 92, + 203, + 253, + 253, + 253, + 253, + 253, # 70 + 209, + 210, + 211, + 212, + 213, + 88, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 118, + 221, + 222, + 223, + 224, + 99, + 85, + 83, + 225, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 234, + 235, + 236, + 5, + 30, + 237, + 24, + 238, + 75, + 8, + 26, + 52, + 34, + 51, + 119, + 47, + 58, + 57, + 49, + 53, + 55, + 43, + 20, + 19, + 44, + 14, + 48, + 3, + 17, + 25, + 39, + 62, + 31, + 54, + 45, + 9, + 16, + 2, + 61, + 15, + 239, + 12, + 42, + 46, + 18, + 21, + 76, + 4, + 66, + 63, + 22, + 10, + 1, + 36, + 23, + 13, + 40, + 27, + 32, + 35, + 86, + 240, + 241, + 242, + 243, + 244, + 11, + 28, + 41, + 29, + 33, + 245, + 50, + 37, + 6, + 7, + 67, + 77, + 38, + 93, + 246, + 247, + 68, + 56, + 59, + 65, + 69, + 60, + 70, + 80, + 71, + 87, + 248, + 249, + 250, + 251, + 252, + 253, ) # Model Table: @@ -59,141 +299,4109 @@ # rest sequences: 1.0230% # negative sequences: 0.0436% ThaiLangModel = ( -0,1,3,3,3,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,3,3, -0,3,3,0,0,0,1,3,0,3,3,2,3,3,0,1,2,3,3,3,3,0,2,0,2,0,0,3,2,1,2,2, -3,0,3,3,2,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,3,0,3,2,3,0,2,2,2,3, -0,2,3,0,0,0,0,1,0,1,2,3,1,1,3,2,2,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1, -3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,3,3,2,3,2,3,3,2,2,2, -3,1,2,3,0,3,3,2,2,1,2,3,3,1,2,0,1,3,0,1,0,0,1,0,0,0,0,0,0,0,1,1, -3,3,2,2,3,3,3,3,1,2,3,3,3,3,3,2,2,2,2,3,3,2,2,3,3,2,2,3,2,3,2,2, -3,3,1,2,3,1,2,2,3,3,1,0,2,1,0,0,3,1,2,1,0,0,1,0,0,0,0,0,0,1,0,1, -3,3,3,3,3,3,2,2,3,3,3,3,2,3,2,2,3,3,2,2,3,2,2,2,2,1,1,3,1,2,1,1, -3,2,1,0,2,1,0,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0, -3,3,3,2,3,2,3,3,2,2,3,2,3,3,2,3,1,1,2,3,2,2,2,3,2,2,2,2,2,1,2,1, -2,2,1,1,3,3,2,1,0,1,2,2,0,1,3,0,0,0,1,1,0,0,0,0,0,2,3,0,0,2,1,1, -3,3,2,3,3,2,0,0,3,3,0,3,3,0,2,2,3,1,2,2,1,1,1,0,2,2,2,0,2,2,1,1, -0,2,1,0,2,0,0,2,0,1,0,0,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0, -3,3,2,3,3,2,0,0,3,3,0,2,3,0,2,1,2,2,2,2,1,2,0,0,2,2,2,0,2,2,1,1, -0,2,1,0,2,0,0,2,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0, -3,3,2,3,2,3,2,0,2,2,1,3,2,1,3,2,1,2,3,2,2,3,0,2,3,2,2,1,2,2,2,2, -1,2,2,0,0,0,0,2,0,1,2,0,1,1,1,0,1,0,3,1,1,0,0,0,0,0,0,0,0,0,1,0, -3,3,2,3,3,2,3,2,2,2,3,2,2,3,2,2,1,2,3,2,2,3,1,3,2,2,2,3,2,2,2,3, -3,2,1,3,0,1,1,1,0,2,1,1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,2,0,0, -1,0,0,3,0,3,3,3,3,3,0,0,3,0,2,2,3,3,3,3,3,0,0,0,1,1,3,0,0,0,0,2, -0,0,1,0,0,0,0,0,0,0,2,3,0,0,0,3,0,2,0,0,0,0,0,3,0,0,0,0,0,0,0,0, -2,0,3,3,3,3,0,0,2,3,0,0,3,0,3,3,2,3,3,3,3,3,0,0,3,3,3,0,0,0,3,3, -0,0,3,0,0,0,0,2,0,0,2,1,1,3,0,0,1,0,0,2,3,0,1,0,0,0,0,0,0,0,1,0, -3,3,3,3,2,3,3,3,3,3,3,3,1,2,1,3,3,2,2,1,2,2,2,3,1,1,2,0,2,1,2,1, -2,2,1,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0, -3,0,2,1,2,3,3,3,0,2,0,2,2,0,2,1,3,2,2,1,2,1,0,0,2,2,1,0,2,1,2,2, -0,1,1,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,2,1,3,3,1,1,3,0,2,3,1,1,3,2,1,1,2,0,2,2,3,2,1,1,1,1,1,2, -3,0,0,1,3,1,2,1,2,0,3,0,0,0,1,0,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, -3,3,1,1,3,2,3,3,3,1,3,2,1,3,2,1,3,2,2,2,2,1,3,3,1,2,1,3,1,2,3,0, -2,1,1,3,2,2,2,1,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, -3,3,2,3,2,3,3,2,3,2,3,2,3,3,2,1,0,3,2,2,2,1,2,2,2,1,2,2,1,2,1,1, -2,2,2,3,0,1,3,1,1,1,1,0,1,1,0,2,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,2,3,2,2,1,1,3,2,3,2,3,2,0,3,2,2,1,2,0,2,2,2,1,2,2,2,2,1, -3,2,1,2,2,1,0,2,0,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1, -3,3,3,3,3,2,3,1,2,3,3,2,2,3,0,1,1,2,0,3,3,2,2,3,0,1,1,3,0,0,0,0, -3,1,0,3,3,0,2,0,2,1,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,2,3,2,3,3,0,1,3,1,1,2,1,2,1,1,3,1,1,0,2,3,1,1,1,1,1,1,1,1, -3,1,1,2,2,2,2,1,1,1,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,2,2,1,1,2,1,3,3,2,3,2,2,3,2,2,3,1,2,2,1,2,0,3,2,1,2,2,2,2,2,1, -3,2,1,2,2,2,1,1,1,1,0,0,1,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,1,3,3,0,2,1,0,3,2,0,0,3,1,0,1,1,0,1,0,0,0,0,0,1, -1,0,0,1,0,3,2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,2,2,2,3,0,0,1,3,0,3,2,0,3,2,2,3,3,3,3,3,1,0,2,2,2,0,2,2,1,2, -0,2,3,0,0,0,0,1,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -3,0,2,3,1,3,3,2,3,3,0,3,3,0,3,2,2,3,2,3,3,3,0,0,2,2,3,0,1,1,1,3, -0,0,3,0,0,0,2,2,0,1,3,0,1,2,2,2,3,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1, -3,2,3,3,2,0,3,3,2,2,3,1,3,2,1,3,2,0,1,2,2,0,2,3,2,1,0,3,0,0,0,0, -3,0,0,2,3,1,3,0,0,3,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,1,3,2,2,2,1,2,0,1,3,1,1,3,1,3,0,0,2,1,1,1,1,2,1,1,1,0,2,1,0,1, -1,2,0,0,0,3,1,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,3,1,0,0,0,1,0, -3,3,3,3,2,2,2,2,2,1,3,1,1,1,2,0,1,1,2,1,2,1,3,2,0,0,3,1,1,1,1,1, -3,1,0,2,3,0,0,0,3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,2,3,0,3,3,0,2,0,0,0,0,0,0,0,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,3,1,3,0,0,1,2,0,0,2,0,3,3,2,3,3,3,2,3,0,0,2,2,2,0,0,0,2,2, -0,0,1,0,0,0,0,3,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -0,0,0,3,0,2,0,0,0,0,0,0,0,0,0,0,1,2,3,1,3,3,0,0,1,0,3,0,0,0,0,0, -0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,1,2,3,1,2,3,1,0,3,0,2,2,1,0,2,1,1,2,0,1,0,0,1,1,1,1,0,1,0,0, -1,0,0,0,0,1,1,0,3,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,2,1,0,1,1,1,3,1,2,2,2,2,2,2,1,1,1,1,0,3,1,0,1,3,1,1,1,1, -1,1,0,2,0,1,3,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1, -3,0,2,2,1,3,3,2,3,3,0,1,1,0,2,2,1,2,1,3,3,1,0,0,3,2,0,0,0,0,2,1, -0,1,0,0,0,0,1,2,0,1,1,3,1,1,2,2,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, -0,0,3,0,0,1,0,0,0,3,0,0,3,0,3,1,0,1,1,1,3,2,0,0,0,3,0,0,0,0,2,0, -0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0, -3,3,1,3,2,1,3,3,1,2,2,0,1,2,1,0,1,2,0,0,0,0,0,3,0,0,0,3,0,0,0,0, -3,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,1,2,0,3,3,3,2,2,0,1,1,0,1,3,0,0,0,2,2,0,0,0,0,3,1,0,1,0,0,0, -0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,2,3,1,2,0,0,2,1,0,3,1,0,1,2,0,1,1,1,1,3,0,0,3,1,1,0,2,2,1,1, -0,2,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,0,3,1,2,0,0,2,2,0,1,2,0,1,0,1,3,1,2,1,0,0,0,2,0,3,0,0,0,1,0, -0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,1,1,2,2,0,0,0,2,0,2,1,0,1,1,0,1,1,1,2,1,0,0,1,1,1,0,2,1,1,1, -0,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1, -0,0,0,2,0,1,3,1,1,1,1,0,0,0,0,3,2,0,1,0,0,0,1,2,0,0,0,1,0,0,0,0, -0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,3,3,3,3,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,2,3,2,2,0,0,0,1,0,0,0,0,2,3,2,1,2,2,3,0,0,0,2,3,1,0,0,0,1,1, -0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0, -3,3,2,2,0,1,0,0,0,0,2,0,2,0,1,0,0,0,1,1,0,0,0,2,1,0,1,0,1,1,0,0, -0,1,0,2,0,0,1,0,3,0,1,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,1,0,0,1,0,0,0,0,0,1,1,2,0,0,0,0,1,0,0,1,3,1,0,0,0,0,1,1,0,0, -0,1,0,0,0,0,3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0, -3,3,1,1,1,1,2,3,0,0,2,1,1,1,1,1,0,2,1,1,0,0,0,2,1,0,1,2,1,1,0,1, -2,1,0,3,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,3,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1, -0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,2,0,0,0,0,0,0,1,2,1,0,1,1,0,2,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,2,0,0,0,1,3,0,1,0,0,0,2,0,0,0,0,0,0,0,1,2,0,0,0,0,0, -3,3,0,0,1,1,2,0,0,1,2,1,0,1,1,1,0,1,1,0,0,2,1,1,0,1,0,0,1,1,1,0, -0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,1,0,0,0,0,1,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,3,0,0,1,1,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,1,0,1,2,0,1,2,0,0,1,1,0,2,0,1,0,0,1,0,0,0,0,1,0,0,0,2,0,0,0,0, -1,0,0,1,0,1,1,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,0,0,0,0,0,0,0,1,1,0,1,1,0,2,1,3,0,0,0,0,1,1,0,0,0,0,0,0,0,3, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,1,0,1,0,0,2,0,0,2,0,0,1,1,2,0,0,1,1,0,0,0,1,0,0,0,1,1,0,0,0, -1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, -1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,3,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0, -1,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,1,0,0,2,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0, + 1, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 3, + 0, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 0, + 0, + 1, + 3, + 0, + 3, + 3, + 2, + 3, + 3, + 0, + 1, + 2, + 3, + 3, + 3, + 3, + 0, + 2, + 0, + 2, + 0, + 0, + 3, + 2, + 1, + 2, + 2, + 3, + 0, + 3, + 3, + 2, + 3, + 0, + 0, + 3, + 3, + 0, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 2, + 3, + 0, + 2, + 2, + 2, + 3, + 0, + 2, + 3, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 3, + 1, + 1, + 3, + 2, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 2, + 2, + 2, + 3, + 1, + 2, + 3, + 0, + 3, + 3, + 2, + 2, + 1, + 2, + 3, + 3, + 1, + 2, + 0, + 1, + 3, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 3, + 2, + 2, + 3, + 3, + 2, + 2, + 3, + 2, + 3, + 2, + 2, + 3, + 3, + 1, + 2, + 3, + 1, + 2, + 2, + 3, + 3, + 1, + 0, + 2, + 1, + 0, + 0, + 3, + 1, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 2, + 3, + 3, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 1, + 1, + 3, + 1, + 2, + 1, + 1, + 3, + 2, + 1, + 0, + 2, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 2, + 2, + 3, + 2, + 3, + 3, + 2, + 3, + 1, + 1, + 2, + 3, + 2, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 2, + 2, + 1, + 1, + 3, + 3, + 2, + 1, + 0, + 1, + 2, + 2, + 0, + 1, + 3, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 0, + 0, + 2, + 1, + 1, + 3, + 3, + 2, + 3, + 3, + 2, + 0, + 0, + 3, + 3, + 0, + 3, + 3, + 0, + 2, + 2, + 3, + 1, + 2, + 2, + 1, + 1, + 1, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 1, + 1, + 0, + 2, + 1, + 0, + 2, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 2, + 3, + 3, + 2, + 0, + 0, + 3, + 3, + 0, + 2, + 3, + 0, + 2, + 1, + 2, + 2, + 2, + 2, + 1, + 2, + 0, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 1, + 1, + 0, + 2, + 1, + 0, + 2, + 0, + 0, + 2, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 3, + 2, + 3, + 2, + 0, + 2, + 2, + 1, + 3, + 2, + 1, + 3, + 2, + 1, + 2, + 3, + 2, + 2, + 3, + 0, + 2, + 3, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 2, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 3, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 3, + 2, + 2, + 3, + 2, + 2, + 1, + 2, + 3, + 2, + 2, + 3, + 1, + 3, + 2, + 2, + 2, + 3, + 2, + 2, + 2, + 3, + 3, + 2, + 1, + 3, + 0, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 1, + 1, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 0, + 0, + 0, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 3, + 3, + 3, + 3, + 0, + 0, + 2, + 3, + 0, + 0, + 3, + 0, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 1, + 1, + 3, + 0, + 0, + 1, + 0, + 0, + 2, + 3, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 1, + 3, + 3, + 2, + 2, + 1, + 2, + 2, + 2, + 3, + 1, + 1, + 2, + 0, + 2, + 1, + 2, + 1, + 2, + 2, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 1, + 2, + 3, + 3, + 3, + 0, + 2, + 0, + 2, + 2, + 0, + 2, + 1, + 3, + 2, + 2, + 1, + 2, + 1, + 0, + 0, + 2, + 2, + 1, + 0, + 2, + 1, + 2, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 2, + 1, + 3, + 3, + 1, + 1, + 3, + 0, + 2, + 3, + 1, + 1, + 3, + 2, + 1, + 1, + 2, + 0, + 2, + 2, + 3, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 3, + 0, + 0, + 1, + 3, + 1, + 2, + 1, + 2, + 0, + 3, + 0, + 0, + 0, + 1, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 1, + 1, + 3, + 2, + 3, + 3, + 3, + 1, + 3, + 2, + 1, + 3, + 2, + 1, + 3, + 2, + 2, + 2, + 2, + 1, + 3, + 3, + 1, + 2, + 1, + 3, + 1, + 2, + 3, + 0, + 2, + 1, + 1, + 3, + 2, + 2, + 2, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 2, + 3, + 2, + 3, + 2, + 3, + 3, + 2, + 1, + 0, + 3, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 2, + 1, + 1, + 2, + 2, + 2, + 3, + 0, + 1, + 3, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 2, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 2, + 1, + 1, + 3, + 2, + 3, + 2, + 3, + 2, + 0, + 3, + 2, + 2, + 1, + 2, + 0, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 1, + 3, + 2, + 1, + 2, + 2, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 1, + 2, + 3, + 3, + 2, + 2, + 3, + 0, + 1, + 1, + 2, + 0, + 3, + 3, + 2, + 2, + 3, + 0, + 1, + 1, + 3, + 0, + 0, + 0, + 0, + 3, + 1, + 0, + 3, + 3, + 0, + 2, + 0, + 2, + 1, + 0, + 0, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 0, + 1, + 3, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 3, + 1, + 1, + 0, + 2, + 3, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 3, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 2, + 2, + 1, + 1, + 2, + 1, + 3, + 3, + 2, + 3, + 2, + 2, + 3, + 2, + 2, + 3, + 1, + 2, + 2, + 1, + 2, + 0, + 3, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 3, + 2, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 0, + 2, + 1, + 0, + 3, + 2, + 0, + 0, + 3, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 2, + 2, + 3, + 0, + 0, + 1, + 3, + 0, + 3, + 2, + 0, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 0, + 2, + 2, + 2, + 0, + 2, + 2, + 1, + 2, + 0, + 2, + 3, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 0, + 2, + 3, + 1, + 3, + 3, + 2, + 3, + 3, + 0, + 3, + 3, + 0, + 3, + 2, + 2, + 3, + 2, + 3, + 3, + 3, + 0, + 0, + 2, + 2, + 3, + 0, + 1, + 1, + 1, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 2, + 2, + 0, + 1, + 3, + 0, + 1, + 2, + 2, + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 2, + 3, + 3, + 2, + 0, + 3, + 3, + 2, + 2, + 3, + 1, + 3, + 2, + 1, + 3, + 2, + 0, + 1, + 2, + 2, + 0, + 2, + 3, + 2, + 1, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 2, + 3, + 1, + 3, + 0, + 0, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 3, + 2, + 2, + 2, + 1, + 2, + 0, + 1, + 3, + 1, + 1, + 3, + 1, + 3, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 0, + 2, + 1, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 3, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 1, + 0, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 1, + 3, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 2, + 1, + 2, + 1, + 3, + 2, + 0, + 0, + 3, + 1, + 1, + 1, + 1, + 1, + 3, + 1, + 0, + 2, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 0, + 3, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 1, + 3, + 0, + 0, + 1, + 2, + 0, + 0, + 2, + 0, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 3, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 3, + 1, + 3, + 3, + 0, + 0, + 1, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 1, + 2, + 3, + 1, + 2, + 3, + 1, + 0, + 3, + 0, + 2, + 2, + 1, + 0, + 2, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 3, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 2, + 1, + 0, + 1, + 1, + 1, + 3, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 0, + 3, + 1, + 0, + 1, + 3, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 2, + 0, + 1, + 3, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 3, + 0, + 2, + 2, + 1, + 3, + 3, + 2, + 3, + 3, + 0, + 1, + 1, + 0, + 2, + 2, + 1, + 2, + 1, + 3, + 3, + 1, + 0, + 0, + 3, + 2, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 1, + 1, + 3, + 1, + 1, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 1, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 3, + 1, + 0, + 1, + 1, + 1, + 3, + 2, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 1, + 3, + 2, + 1, + 3, + 3, + 1, + 2, + 2, + 0, + 1, + 2, + 1, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 2, + 0, + 3, + 3, + 3, + 2, + 2, + 0, + 1, + 1, + 0, + 1, + 3, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 3, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 2, + 3, + 1, + 2, + 0, + 0, + 2, + 1, + 0, + 3, + 1, + 0, + 1, + 2, + 0, + 1, + 1, + 1, + 1, + 3, + 0, + 0, + 3, + 1, + 1, + 0, + 2, + 2, + 1, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 1, + 2, + 0, + 0, + 2, + 2, + 0, + 1, + 2, + 0, + 1, + 0, + 1, + 3, + 1, + 2, + 1, + 0, + 0, + 0, + 2, + 0, + 3, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 1, + 1, + 2, + 2, + 0, + 0, + 0, + 2, + 0, + 2, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 1, + 3, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 3, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 3, + 2, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 3, + 2, + 1, + 2, + 2, + 3, + 0, + 0, + 0, + 2, + 3, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 1, + 0, + 3, + 0, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 3, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 1, + 1, + 1, + 1, + 2, + 3, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 2, + 1, + 1, + 0, + 1, + 2, + 1, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 0, + 1, + 1, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 3, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 0, + 1, + 1, + 2, + 0, + 0, + 1, + 2, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 0, + 1, + 2, + 0, + 0, + 1, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 2, + 1, + 3, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 3, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, ) TIS620ThaiModel = { - 'char_to_order_map': TIS620CharToOrderMap, - 'precedence_matrix': ThaiLangModel, - 'typical_positive_ratio': 0.926386, - 'keep_english_letter': False, - 'charset_name': "TIS-620", - 'language': 'Thai', + "char_to_order_map": TIS620CharToOrderMap, + "precedence_matrix": ThaiLangModel, + "typical_positive_ratio": 0.926386, + "keep_english_letter": False, + "charset_name": "TIS-620", + "language": "Thai", } diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/langturkishmodel.py b/src/fetchcode/vcs/pip/_vendor/chardet/langturkishmodel.py index a427a457..cb533273 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/langturkishmodel.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/langturkishmodel.py @@ -34,160 +34,4368 @@ # Character Mapping Table: Latin5_TurkishCharToOrderMap = ( -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255, 23, 37, 47, 39, 29, 52, 36, 45, 53, 60, 16, 49, 20, 46, 42, - 48, 69, 44, 35, 31, 51, 38, 62, 65, 43, 56,255,255,255,255,255, -255, 1, 21, 28, 12, 2, 18, 27, 25, 3, 24, 10, 5, 13, 4, 15, - 26, 64, 7, 8, 9, 14, 32, 57, 58, 11, 22,255,255,255,255,255, -180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,165, -164,163,162,161,160,159,101,158,157,156,155,154,153,152,151,106, -150,149,148,147,146,145,144,100,143,142,141,140,139,138,137,136, - 94, 80, 93,135,105,134,133, 63,132,131,130,129,128,127,126,125, -124,104, 73, 99, 79, 85,123, 54,122, 98, 92,121,120, 91,103,119, - 68,118,117, 97,116,115, 50, 90,114,113,112,111, 55, 41, 40, 86, - 89, 70, 59, 78, 71, 82, 88, 33, 77, 66, 84, 83,110, 75, 61, 96, - 30, 67,109, 74, 87,102, 34, 95, 81,108, 76, 72, 17, 6, 19,107, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 23, + 37, + 47, + 39, + 29, + 52, + 36, + 45, + 53, + 60, + 16, + 49, + 20, + 46, + 42, + 48, + 69, + 44, + 35, + 31, + 51, + 38, + 62, + 65, + 43, + 56, + 255, + 255, + 255, + 255, + 255, + 255, + 1, + 21, + 28, + 12, + 2, + 18, + 27, + 25, + 3, + 24, + 10, + 5, + 13, + 4, + 15, + 26, + 64, + 7, + 8, + 9, + 14, + 32, + 57, + 58, + 11, + 22, + 255, + 255, + 255, + 255, + 255, + 180, + 179, + 178, + 177, + 176, + 175, + 174, + 173, + 172, + 171, + 170, + 169, + 168, + 167, + 166, + 165, + 164, + 163, + 162, + 161, + 160, + 159, + 101, + 158, + 157, + 156, + 155, + 154, + 153, + 152, + 151, + 106, + 150, + 149, + 148, + 147, + 146, + 145, + 144, + 100, + 143, + 142, + 141, + 140, + 139, + 138, + 137, + 136, + 94, + 80, + 93, + 135, + 105, + 134, + 133, + 63, + 132, + 131, + 130, + 129, + 128, + 127, + 126, + 125, + 124, + 104, + 73, + 99, + 79, + 85, + 123, + 54, + 122, + 98, + 92, + 121, + 120, + 91, + 103, + 119, + 68, + 118, + 117, + 97, + 116, + 115, + 50, + 90, + 114, + 113, + 112, + 111, + 55, + 41, + 40, + 86, + 89, + 70, + 59, + 78, + 71, + 82, + 88, + 33, + 77, + 66, + 84, + 83, + 110, + 75, + 61, + 96, + 30, + 67, + 109, + 74, + 87, + 102, + 34, + 95, + 81, + 108, + 76, + 72, + 17, + 6, + 19, + 107, ) TurkishLangModel = ( -3,2,3,3,3,1,3,3,3,3,3,3,3,3,2,1,1,3,3,1,3,3,0,3,3,3,3,3,0,3,1,3, -3,2,1,0,0,1,1,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,2,2,0,0,1,0,0,1, -3,2,2,3,3,0,3,3,3,3,3,3,3,2,3,1,0,3,3,1,3,3,0,3,3,3,3,3,0,3,0,3, -3,1,1,0,1,0,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,2,2,0,0,0,1,0,1, -3,3,2,3,3,0,3,3,3,3,3,3,3,2,3,1,1,3,3,0,3,3,1,2,3,3,3,3,0,3,0,3, -3,1,1,0,0,0,1,0,0,0,0,1,1,0,1,2,1,0,0,0,1,0,0,0,0,2,0,0,0,0,0,1, -3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,1,3,3,2,0,3,2,1,2,2,1,3,3,0,0,0,2, -2,2,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1, -3,3,3,2,3,3,1,2,3,3,3,3,3,3,3,1,3,2,1,0,3,2,0,1,2,3,3,2,1,0,0,2, -2,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0, -1,0,1,3,3,1,3,3,3,3,3,3,3,1,2,0,0,2,3,0,2,3,0,0,2,2,2,3,0,3,0,1, -2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,0,3,2,0,2,3,2,3,3,1,0,0,2, -3,2,0,0,1,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,2,0,0,1, -3,3,3,2,3,3,2,3,3,3,3,2,3,3,3,0,3,3,0,0,2,1,0,0,2,3,2,2,0,0,0,2, -2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,2,0,0,1, -3,3,3,2,3,3,3,3,3,3,3,2,3,3,3,0,3,2,0,1,3,2,1,1,3,2,3,2,1,0,0,2, -2,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, -3,3,3,2,3,3,3,3,3,3,3,2,3,3,3,0,3,2,2,0,2,3,0,0,2,2,2,2,0,0,0,2, -3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,1,0,0,0, -3,3,3,3,3,3,3,2,2,2,2,3,2,3,3,0,3,3,1,1,2,2,0,0,2,2,3,2,0,0,1,3, -0,3,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1, -3,3,3,2,3,3,3,2,1,2,2,3,2,3,3,0,3,2,0,0,1,1,0,1,1,2,1,2,0,0,0,1, -0,3,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0, -3,3,3,2,3,3,2,3,2,2,2,3,3,3,3,1,3,1,1,0,3,2,1,1,3,3,2,3,1,0,0,1, -1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,0,1, -3,2,2,3,3,0,3,3,3,3,3,3,3,2,2,1,0,3,3,1,3,3,0,1,3,3,2,3,0,3,0,3, -2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, -2,2,2,3,3,0,3,3,3,3,3,3,3,3,3,0,0,3,2,0,3,3,0,3,2,3,3,3,0,3,1,3, -2,0,0,0,0,0,0,0,0,0,0,1,0,1,2,0,1,0,0,0,0,0,0,0,2,2,0,0,1,0,0,1, -3,3,3,1,2,3,3,1,0,0,1,0,0,3,3,2,3,0,0,2,0,0,2,0,2,0,0,0,2,0,2,0, -0,3,1,0,1,0,0,0,2,2,1,0,1,1,2,1,2,2,2,0,2,1,1,0,0,0,2,0,0,0,0,0, -1,2,1,3,3,0,3,3,3,3,3,2,3,0,0,0,0,2,3,0,2,3,1,0,2,3,1,3,0,3,0,2, -3,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,1,3,3,2,2,3,2,2,0,1,2,3,0,1,2,1,0,1,0,0,0,1,0,2,2,0,0,0,1, -1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0, -3,3,3,1,3,3,1,1,3,3,1,1,3,3,1,0,2,1,2,0,2,1,0,0,1,1,2,1,0,0,0,2, -2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,1,0,2,1,3,0,0,2,0,0,3,3,0,3,0,0,1,0,1,2,0,0,1,1,2,2,0,1,0, -0,1,2,1,1,0,1,0,1,1,1,1,1,0,1,1,1,2,2,1,2,0,1,0,0,0,0,0,0,1,0,0, -3,3,3,2,3,2,3,3,0,2,2,2,3,3,3,0,3,0,0,0,2,2,0,1,2,1,1,1,0,0,0,1, -0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, -3,3,3,3,3,3,2,1,2,2,3,3,3,3,2,0,2,0,0,0,2,2,0,0,2,1,3,3,0,0,1,1, -1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0, -1,1,2,3,3,0,3,3,3,3,3,3,2,2,0,2,0,2,3,2,3,2,2,2,2,2,2,2,1,3,2,3, -2,0,2,1,2,2,2,2,1,1,2,2,1,2,2,1,2,0,0,2,1,1,0,2,1,0,0,1,0,0,0,1, -2,3,3,1,1,1,0,1,1,1,2,3,2,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0, -0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,2,2,2,3,2,3,2,2,1,3,3,3,0,2,1,2,0,2,1,0,0,1,1,1,1,1,0,0,1, -2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,2,0,1,0,0,0, -3,3,3,2,3,3,3,3,3,2,3,1,2,3,3,1,2,0,0,0,0,0,0,0,3,2,1,1,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, -3,3,3,2,2,3,3,2,1,1,1,1,1,3,3,0,3,1,0,0,1,1,0,0,3,1,2,1,0,0,0,0, -0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0, -3,3,3,2,2,3,2,2,2,3,2,1,1,3,3,0,3,0,0,0,0,1,0,0,3,1,1,2,0,0,0,1, -1,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,1,1,3,3,0,3,3,3,3,3,2,2,2,1,2,0,2,1,2,2,1,1,0,1,2,2,2,2,2,2,2, -0,0,2,1,2,1,2,1,0,1,1,3,1,2,1,1,2,0,0,2,0,1,0,1,0,1,0,0,0,1,0,1, -3,3,3,1,3,3,3,0,1,1,0,2,2,3,1,0,3,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,2,0,0,2,2,1,0,0,1,0,0,3,3,1,3,0,0,1,1,0,2,0,3,0,0,0,2,0,1,1, -0,1,2,0,1,2,2,0,2,2,2,2,1,0,2,1,1,0,2,0,2,1,2,0,0,0,0,0,0,0,0,0, -3,3,3,1,3,2,3,2,0,2,2,2,1,3,2,0,2,1,2,0,1,2,0,0,1,0,2,2,0,0,0,2, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0, -3,3,3,0,3,3,1,1,2,3,1,0,3,2,3,0,3,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0, -1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,3,3,0,3,3,2,3,3,2,2,0,0,0,0,1,2,0,1,3,0,0,0,3,1,1,0,3,0,2, -2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,1,2,2,1,0,3,1,1,1,1,3,3,2,3,0,0,1,0,1,2,0,2,2,0,2,2,0,2,1, -0,2,2,1,1,1,1,0,2,1,1,0,1,1,1,1,2,1,2,1,2,0,1,0,1,0,0,0,0,0,0,0, -3,3,3,0,1,1,3,0,0,1,1,0,0,2,2,0,3,0,0,1,1,0,1,0,0,0,0,0,2,0,0,0, -0,3,1,0,1,0,1,0,2,0,0,1,0,1,0,1,1,1,2,1,1,0,2,0,0,0,0,0,0,0,0,0, -3,3,3,0,2,0,2,0,1,1,1,0,0,3,3,0,2,0,0,1,0,0,2,1,1,0,1,0,1,0,1,0, -0,2,0,1,2,0,2,0,2,1,1,0,1,0,2,1,1,0,2,1,1,0,1,0,0,0,1,1,0,0,0,0, -3,2,3,0,1,0,0,0,0,0,0,0,0,1,2,0,1,0,0,1,0,0,1,0,0,0,0,0,2,0,0,0, -0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,2,1,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,0,0,2,3,0,0,1,0,1,0,2,3,2,3,0,0,1,3,0,2,1,0,0,0,0,2,0,1,0, -0,2,1,0,0,1,1,0,2,1,0,0,1,0,0,1,1,0,1,1,2,0,1,0,0,0,0,1,0,0,0,0, -3,2,2,0,0,1,1,0,0,0,0,0,0,3,1,1,1,0,0,0,0,0,1,0,0,0,0,0,2,0,1,0, -0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, -0,0,0,3,3,0,2,3,2,2,1,2,2,1,1,2,0,1,3,2,2,2,0,0,2,2,0,0,0,1,2,1, -3,0,2,1,1,0,1,1,1,0,1,2,2,2,1,1,2,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0, -0,1,1,2,3,0,3,3,3,2,2,2,2,1,0,1,0,1,0,1,2,2,0,0,2,2,1,3,1,1,2,1, -0,0,1,1,2,0,1,1,0,0,1,2,0,2,1,1,2,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0, -3,3,2,0,0,3,1,0,0,0,0,0,0,3,2,1,2,0,0,1,0,0,2,0,0,0,0,0,2,0,1,0, -0,2,1,1,0,0,1,0,1,2,0,0,1,1,0,0,2,1,1,1,1,0,2,0,0,0,0,0,0,0,0,0, -3,3,2,0,0,1,0,0,0,0,1,0,0,3,3,2,2,0,0,1,0,0,2,0,1,0,0,0,2,0,1,0, -0,0,1,1,0,0,2,0,2,1,0,0,1,1,2,1,2,0,2,1,2,1,1,1,0,0,1,1,0,0,0,0, -3,3,2,0,0,2,2,0,0,0,1,1,0,2,2,1,3,1,0,1,0,1,2,0,0,0,0,0,1,0,1,0, -0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,2,0,0,0,1,0,0,1,0,0,2,3,1,2,0,0,1,0,0,2,0,0,0,1,0,2,0,2,0, -0,1,1,2,2,1,2,0,2,1,1,0,0,1,1,0,1,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0, -3,3,3,0,2,1,2,1,0,0,1,1,0,3,3,1,2,0,0,1,0,0,2,0,2,0,1,1,2,0,0,0, -0,0,1,1,1,1,2,0,1,1,0,1,1,1,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,0,0,0, -3,3,3,0,2,2,3,2,0,0,1,0,0,2,3,1,0,0,0,0,0,0,2,0,2,0,0,0,2,0,0,0, -0,1,1,0,0,0,1,0,0,1,0,1,1,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0, -3,2,3,0,0,0,0,0,0,0,1,0,0,2,2,2,2,0,0,1,0,0,2,0,0,0,0,0,2,0,1,0, -0,0,2,1,1,0,1,0,2,1,1,0,0,1,1,2,1,0,2,0,2,0,1,0,0,0,2,0,0,0,0,0, -0,0,0,2,2,0,2,1,1,1,1,2,2,0,0,1,0,1,0,0,1,3,0,0,0,0,1,0,0,2,1,0, -0,0,1,0,1,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, -2,0,0,2,3,0,2,3,1,2,2,0,2,0,0,2,0,2,1,1,1,2,1,0,0,1,2,1,1,2,1,0, -1,0,2,0,1,0,1,1,0,0,2,2,1,2,1,1,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, -3,3,3,0,2,1,2,0,0,0,1,0,0,3,2,0,1,0,0,1,0,0,2,0,0,0,1,2,1,0,1,0, -0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0, -0,0,0,2,2,0,2,2,1,1,0,1,1,1,1,1,0,0,1,2,1,1,1,0,1,0,0,0,1,1,1,1, -0,0,2,1,0,1,1,1,0,1,1,2,1,2,1,1,2,0,1,1,2,1,0,2,0,0,0,0,0,0,0,0, -3,2,2,0,0,2,0,0,0,0,0,0,0,2,2,0,2,0,0,1,0,0,2,0,0,0,0,0,2,0,0,0, -0,2,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, -0,0,0,3,2,0,2,2,0,1,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0, -2,0,1,0,1,0,1,1,0,0,1,2,0,1,0,1,1,0,0,1,0,1,0,2,0,0,0,0,0,0,0,0, -2,2,2,0,1,1,0,0,0,1,0,0,0,1,2,0,1,0,0,1,0,0,1,0,0,0,0,1,2,0,1,0, -0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,2,1,0,1,1,1,0,0,0,0,1,2,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, -1,1,2,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,1, -0,0,1,2,2,0,2,1,2,1,1,2,2,0,0,0,0,1,0,0,1,1,0,0,2,0,0,0,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, -2,2,2,0,0,0,1,0,0,0,0,0,0,2,2,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,2,2,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 3, + 2, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 1, + 3, + 3, + 1, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 1, + 3, + 3, + 2, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 3, + 2, + 2, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 1, + 0, + 3, + 3, + 1, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 3, + 3, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 1, + 0, + 1, + 3, + 3, + 2, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 1, + 1, + 3, + 3, + 0, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 3, + 3, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3, + 2, + 0, + 3, + 2, + 1, + 2, + 2, + 1, + 3, + 3, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 3, + 3, + 3, + 2, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 2, + 1, + 0, + 3, + 2, + 0, + 1, + 2, + 3, + 3, + 2, + 1, + 0, + 0, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 1, + 3, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 2, + 0, + 0, + 2, + 3, + 0, + 2, + 3, + 0, + 0, + 2, + 2, + 2, + 3, + 0, + 3, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 0, + 3, + 2, + 0, + 2, + 3, + 2, + 3, + 3, + 1, + 0, + 0, + 2, + 3, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 2, + 0, + 0, + 1, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 0, + 2, + 1, + 0, + 0, + 2, + 3, + 2, + 2, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 2, + 0, + 0, + 1, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 0, + 3, + 2, + 0, + 1, + 3, + 2, + 1, + 1, + 3, + 2, + 3, + 2, + 1, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 0, + 3, + 2, + 2, + 0, + 2, + 3, + 0, + 0, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + 2, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 3, + 2, + 3, + 3, + 0, + 3, + 3, + 1, + 1, + 2, + 2, + 0, + 0, + 2, + 2, + 3, + 2, + 0, + 0, + 1, + 3, + 0, + 3, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 2, + 1, + 2, + 2, + 3, + 2, + 3, + 3, + 0, + 3, + 2, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 2, + 1, + 2, + 0, + 0, + 0, + 1, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 1, + 3, + 1, + 1, + 0, + 3, + 2, + 1, + 1, + 3, + 3, + 2, + 3, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 1, + 3, + 2, + 2, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 1, + 0, + 3, + 3, + 1, + 3, + 3, + 0, + 1, + 3, + 3, + 2, + 3, + 0, + 3, + 0, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 2, + 0, + 3, + 3, + 0, + 3, + 2, + 3, + 3, + 3, + 0, + 3, + 1, + 3, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 1, + 3, + 3, + 3, + 1, + 2, + 3, + 3, + 1, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 2, + 3, + 0, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 3, + 1, + 0, + 1, + 0, + 0, + 0, + 2, + 2, + 1, + 0, + 1, + 1, + 2, + 1, + 2, + 2, + 2, + 0, + 2, + 1, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 1, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 0, + 0, + 0, + 0, + 2, + 3, + 0, + 2, + 3, + 1, + 0, + 2, + 3, + 1, + 3, + 0, + 3, + 0, + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 1, + 3, + 3, + 2, + 2, + 3, + 2, + 2, + 0, + 1, + 2, + 3, + 0, + 1, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 2, + 2, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 3, + 3, + 3, + 1, + 3, + 3, + 1, + 1, + 3, + 3, + 1, + 1, + 3, + 3, + 1, + 0, + 2, + 1, + 2, + 0, + 2, + 1, + 0, + 0, + 1, + 1, + 2, + 1, + 0, + 0, + 0, + 2, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 1, + 0, + 2, + 1, + 3, + 0, + 0, + 2, + 0, + 0, + 3, + 3, + 0, + 3, + 0, + 0, + 1, + 0, + 1, + 2, + 0, + 0, + 1, + 1, + 2, + 2, + 0, + 1, + 0, + 0, + 1, + 2, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 2, + 2, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 3, + 2, + 3, + 2, + 3, + 3, + 0, + 2, + 2, + 2, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 2, + 2, + 0, + 1, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 2, + 2, + 3, + 3, + 3, + 3, + 2, + 0, + 2, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 2, + 1, + 3, + 3, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 2, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 0, + 2, + 0, + 2, + 3, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 3, + 2, + 3, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 2, + 2, + 1, + 2, + 2, + 1, + 2, + 0, + 0, + 2, + 1, + 1, + 0, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 2, + 3, + 3, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 2, + 3, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 2, + 2, + 3, + 2, + 3, + 2, + 2, + 1, + 3, + 3, + 3, + 0, + 2, + 1, + 2, + 0, + 2, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 1, + 2, + 3, + 3, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 2, + 1, + 1, + 1, + 1, + 1, + 3, + 3, + 0, + 3, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 3, + 1, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 2, + 3, + 2, + 2, + 2, + 3, + 2, + 1, + 1, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 1, + 1, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 2, + 1, + 2, + 0, + 2, + 1, + 2, + 2, + 1, + 1, + 0, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 0, + 0, + 2, + 1, + 2, + 1, + 2, + 1, + 0, + 1, + 1, + 3, + 1, + 2, + 1, + 1, + 2, + 0, + 0, + 2, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 3, + 3, + 3, + 1, + 3, + 3, + 3, + 0, + 1, + 1, + 0, + 2, + 2, + 3, + 1, + 0, + 3, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 0, + 0, + 2, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 1, + 3, + 0, + 0, + 1, + 1, + 0, + 2, + 0, + 3, + 0, + 0, + 0, + 2, + 0, + 1, + 1, + 0, + 1, + 2, + 0, + 1, + 2, + 2, + 0, + 2, + 2, + 2, + 2, + 1, + 0, + 2, + 1, + 1, + 0, + 2, + 0, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 1, + 3, + 2, + 3, + 2, + 0, + 2, + 2, + 2, + 1, + 3, + 2, + 0, + 2, + 1, + 2, + 0, + 1, + 2, + 0, + 0, + 1, + 0, + 2, + 2, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 3, + 3, + 1, + 1, + 2, + 3, + 1, + 0, + 3, + 2, + 3, + 0, + 3, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 3, + 2, + 3, + 3, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 1, + 3, + 0, + 0, + 0, + 3, + 1, + 1, + 0, + 3, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 1, + 2, + 2, + 1, + 0, + 3, + 1, + 1, + 1, + 1, + 3, + 3, + 2, + 3, + 0, + 0, + 1, + 0, + 1, + 2, + 0, + 2, + 2, + 0, + 2, + 2, + 0, + 2, + 1, + 0, + 2, + 2, + 1, + 1, + 1, + 1, + 0, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 1, + 1, + 3, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 2, + 0, + 3, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 3, + 1, + 0, + 1, + 0, + 1, + 0, + 2, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 2, + 0, + 2, + 0, + 1, + 1, + 1, + 0, + 0, + 3, + 3, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 2, + 0, + 2, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 2, + 1, + 1, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 0, + 2, + 3, + 0, + 0, + 1, + 0, + 1, + 0, + 2, + 3, + 2, + 3, + 0, + 0, + 1, + 3, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 1, + 0, + 0, + 1, + 1, + 0, + 2, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 2, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 2, + 3, + 2, + 2, + 1, + 2, + 2, + 1, + 1, + 2, + 0, + 1, + 3, + 2, + 2, + 2, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 1, + 2, + 1, + 3, + 0, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 2, + 2, + 2, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 3, + 0, + 3, + 3, + 3, + 2, + 2, + 2, + 2, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 2, + 2, + 0, + 0, + 2, + 2, + 1, + 3, + 1, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 0, + 1, + 2, + 0, + 2, + 1, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 0, + 0, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 2, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 2, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 1, + 1, + 1, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 3, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 0, + 2, + 1, + 0, + 0, + 1, + 1, + 2, + 1, + 2, + 0, + 2, + 1, + 2, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 1, + 1, + 0, + 2, + 2, + 1, + 3, + 1, + 0, + 1, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 2, + 3, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 2, + 0, + 0, + 1, + 1, + 2, + 2, + 1, + 2, + 0, + 2, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 2, + 1, + 2, + 1, + 0, + 0, + 1, + 1, + 0, + 3, + 3, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 2, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 2, + 2, + 3, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 2, + 2, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 2, + 1, + 1, + 0, + 1, + 0, + 2, + 1, + 1, + 0, + 0, + 1, + 1, + 2, + 1, + 0, + 2, + 0, + 2, + 0, + 1, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 3, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 2, + 3, + 0, + 2, + 3, + 1, + 2, + 2, + 0, + 2, + 0, + 0, + 2, + 0, + 2, + 1, + 1, + 1, + 2, + 1, + 0, + 0, + 1, + 2, + 1, + 1, + 2, + 1, + 0, + 1, + 0, + 2, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 2, + 2, + 1, + 2, + 1, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 2, + 1, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 1, + 2, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 2, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 2, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 2, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 2, + 1, + 2, + 1, + 1, + 2, + 0, + 1, + 1, + 2, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 2, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 2, + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 2, + 0, + 2, + 2, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 2, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 2, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 2, + 2, + 0, + 2, + 1, + 2, + 1, + 1, + 2, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 2, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 2, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, ) Latin5TurkishModel = { - 'char_to_order_map': Latin5_TurkishCharToOrderMap, - 'precedence_matrix': TurkishLangModel, - 'typical_positive_ratio': 0.970290, - 'keep_english_letter': True, - 'charset_name': "ISO-8859-9", - 'language': 'Turkish', + "char_to_order_map": Latin5_TurkishCharToOrderMap, + "precedence_matrix": TurkishLangModel, + "typical_positive_ratio": 0.970290, + "keep_english_letter": True, + "charset_name": "ISO-8859-9", + "language": "Turkish", } diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/latin1prober.py b/src/fetchcode/vcs/pip/_vendor/chardet/latin1prober.py index 7d1e8c20..a092bb8c 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/latin1prober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/latin1prober.py @@ -42,38 +42,262 @@ CLASS_NUM = 8 # total classes Latin1_CharToClass = ( - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 00 - 07 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 08 - 0F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 10 - 17 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 18 - 1F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 20 - 27 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 28 - 2F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 30 - 37 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 38 - 3F - OTH, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 40 - 47 - ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 48 - 4F - ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 50 - 57 - ASC, ASC, ASC, OTH, OTH, OTH, OTH, OTH, # 58 - 5F - OTH, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 60 - 67 - ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 68 - 6F - ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 70 - 77 - ASS, ASS, ASS, OTH, OTH, OTH, OTH, OTH, # 78 - 7F - OTH, UDF, OTH, ASO, OTH, OTH, OTH, OTH, # 80 - 87 - OTH, OTH, ACO, OTH, ACO, UDF, ACO, UDF, # 88 - 8F - UDF, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 90 - 97 - OTH, OTH, ASO, OTH, ASO, UDF, ASO, ACO, # 98 - 9F - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # A0 - A7 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # A8 - AF - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # B0 - B7 - OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # B8 - BF - ACV, ACV, ACV, ACV, ACV, ACV, ACO, ACO, # C0 - C7 - ACV, ACV, ACV, ACV, ACV, ACV, ACV, ACV, # C8 - CF - ACO, ACO, ACV, ACV, ACV, ACV, ACV, OTH, # D0 - D7 - ACV, ACV, ACV, ACV, ACV, ACO, ACO, ACO, # D8 - DF - ASV, ASV, ASV, ASV, ASV, ASV, ASO, ASO, # E0 - E7 - ASV, ASV, ASV, ASV, ASV, ASV, ASV, ASV, # E8 - EF - ASO, ASO, ASV, ASV, ASV, ASV, ASV, OTH, # F0 - F7 - ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO, # F8 - FF + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 00 - 07 + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 08 - 0F + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 10 - 17 + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 18 - 1F + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 20 - 27 + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 28 - 2F + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 30 - 37 + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 38 - 3F + OTH, + ASC, + ASC, + ASC, + ASC, + ASC, + ASC, + ASC, # 40 - 47 + ASC, + ASC, + ASC, + ASC, + ASC, + ASC, + ASC, + ASC, # 48 - 4F + ASC, + ASC, + ASC, + ASC, + ASC, + ASC, + ASC, + ASC, # 50 - 57 + ASC, + ASC, + ASC, + OTH, + OTH, + OTH, + OTH, + OTH, # 58 - 5F + OTH, + ASS, + ASS, + ASS, + ASS, + ASS, + ASS, + ASS, # 60 - 67 + ASS, + ASS, + ASS, + ASS, + ASS, + ASS, + ASS, + ASS, # 68 - 6F + ASS, + ASS, + ASS, + ASS, + ASS, + ASS, + ASS, + ASS, # 70 - 77 + ASS, + ASS, + ASS, + OTH, + OTH, + OTH, + OTH, + OTH, # 78 - 7F + OTH, + UDF, + OTH, + ASO, + OTH, + OTH, + OTH, + OTH, # 80 - 87 + OTH, + OTH, + ACO, + OTH, + ACO, + UDF, + ACO, + UDF, # 88 - 8F + UDF, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # 90 - 97 + OTH, + OTH, + ASO, + OTH, + ASO, + UDF, + ASO, + ACO, # 98 - 9F + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # A0 - A7 + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # A8 - AF + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # B0 - B7 + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, + OTH, # B8 - BF + ACV, + ACV, + ACV, + ACV, + ACV, + ACV, + ACO, + ACO, # C0 - C7 + ACV, + ACV, + ACV, + ACV, + ACV, + ACV, + ACV, + ACV, # C8 - CF + ACO, + ACO, + ACV, + ACV, + ACV, + ACV, + ACV, + OTH, # D0 - D7 + ACV, + ACV, + ACV, + ACV, + ACV, + ACO, + ACO, + ACO, # D8 - DF + ASV, + ASV, + ASV, + ASV, + ASV, + ASV, + ASO, + ASO, # E0 - E7 + ASV, + ASV, + ASV, + ASV, + ASV, + ASV, + ASV, + ASV, # E8 - EF + ASO, + ASO, + ASV, + ASV, + ASV, + ASV, + ASV, + OTH, # F0 - F7 + ASV, + ASV, + ASV, + ASV, + ASV, + ASO, + ASO, + ASO, # F8 - FF ) # 0 : illegal @@ -81,15 +305,71 @@ # 2 : normal # 3 : very likely Latin1ClassModel = ( -# UDF OTH ASC ASS ACV ACO ASV ASO - 0, 0, 0, 0, 0, 0, 0, 0, # UDF - 0, 3, 3, 3, 3, 3, 3, 3, # OTH - 0, 3, 3, 3, 3, 3, 3, 3, # ASC - 0, 3, 3, 3, 1, 1, 3, 3, # ASS - 0, 3, 3, 3, 1, 2, 1, 2, # ACV - 0, 3, 3, 3, 3, 3, 3, 3, # ACO - 0, 3, 1, 3, 1, 1, 1, 3, # ASV - 0, 3, 1, 3, 1, 1, 3, 3, # ASO + # UDF OTH ASC ASS ACV ACO ASV ASO + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # UDF + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # OTH + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # ASC + 0, + 3, + 3, + 3, + 1, + 1, + 3, + 3, # ASS + 0, + 3, + 3, + 3, + 1, + 2, + 1, + 2, # ACV + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # ACO + 0, + 3, + 1, + 3, + 1, + 1, + 1, + 3, # ASV + 0, + 3, + 1, + 3, + 1, + 1, + 3, + 3, # ASO ) @@ -117,8 +397,7 @@ def feed(self, byte_str): byte_str = self.filter_with_english_letters(byte_str) for c in byte_str: char_class = Latin1_CharToClass[c] - freq = Latin1ClassModel[(self._last_char_class * CLASS_NUM) - + char_class] + freq = Latin1ClassModel[(self._last_char_class * CLASS_NUM) + char_class] if freq == 0: self._state = ProbingState.NOT_ME break @@ -135,8 +414,7 @@ def get_confidence(self): if total < 0.01: confidence = 0.0 else: - confidence = ((self._freq_counter[3] - self._freq_counter[1] * 20.0) - / total) + confidence = (self._freq_counter[3] - self._freq_counter[1] * 20.0) / total if confidence < 0.0: confidence = 0.0 # lower the confidence of latin1 so that other more accurate diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/mbcharsetprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/mbcharsetprober.py index 6256ecfd..e78f3c03 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/mbcharsetprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/mbcharsetprober.py @@ -62,8 +62,12 @@ def feed(self, byte_str): for i in range(len(byte_str)): coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: - self.logger.debug('%s %s prober hit error at byte %s', - self.charset_name, self.language, i) + self.logger.debug( + "%s %s prober hit error at byte %s", + self.charset_name, + self.language, + i, + ) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: @@ -75,14 +79,14 @@ def feed(self, byte_str): self._last_char[1] = byte_str[0] self.distribution_analyzer.feed(self._last_char, char_len) else: - self.distribution_analyzer.feed(byte_str[i - 1:i + 1], - char_len) + self.distribution_analyzer.feed(byte_str[i - 1 : i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: - if (self.distribution_analyzer.got_enough_data() and - (self.get_confidence() > self.SHORTCUT_THRESHOLD)): + if self.distribution_analyzer.got_enough_data() and ( + self.get_confidence() > self.SHORTCUT_THRESHOLD + ): self._state = ProbingState.FOUND_IT return self.state diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/mbcsgroupprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/mbcsgroupprober.py index 530abe75..a43f0911 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/mbcsgroupprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/mbcsgroupprober.py @@ -49,6 +49,6 @@ def __init__(self, lang_filter=None): EUCKRProber(), CP949Prober(), Big5Prober(), - EUCTWProber() + EUCTWProber(), ] self.reset() diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/mbcssm.py b/src/fetchcode/vcs/pip/_vendor/chardet/mbcssm.py index 8360d0f2..0411bef7 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/mbcssm.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/mbcssm.py @@ -30,295 +30,1882 @@ # BIG5 BIG5_CLS = ( - 1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as legal value - 1,1,1,1,1,1,0,0, # 08 - 0f - 1,1,1,1,1,1,1,1, # 10 - 17 - 1,1,1,0,1,1,1,1, # 18 - 1f - 1,1,1,1,1,1,1,1, # 20 - 27 - 1,1,1,1,1,1,1,1, # 28 - 2f - 1,1,1,1,1,1,1,1, # 30 - 37 - 1,1,1,1,1,1,1,1, # 38 - 3f - 2,2,2,2,2,2,2,2, # 40 - 47 - 2,2,2,2,2,2,2,2, # 48 - 4f - 2,2,2,2,2,2,2,2, # 50 - 57 - 2,2,2,2,2,2,2,2, # 58 - 5f - 2,2,2,2,2,2,2,2, # 60 - 67 - 2,2,2,2,2,2,2,2, # 68 - 6f - 2,2,2,2,2,2,2,2, # 70 - 77 - 2,2,2,2,2,2,2,1, # 78 - 7f - 4,4,4,4,4,4,4,4, # 80 - 87 - 4,4,4,4,4,4,4,4, # 88 - 8f - 4,4,4,4,4,4,4,4, # 90 - 97 - 4,4,4,4,4,4,4,4, # 98 - 9f - 4,3,3,3,3,3,3,3, # a0 - a7 - 3,3,3,3,3,3,3,3, # a8 - af - 3,3,3,3,3,3,3,3, # b0 - b7 - 3,3,3,3,3,3,3,3, # b8 - bf - 3,3,3,3,3,3,3,3, # c0 - c7 - 3,3,3,3,3,3,3,3, # c8 - cf - 3,3,3,3,3,3,3,3, # d0 - d7 - 3,3,3,3,3,3,3,3, # d8 - df - 3,3,3,3,3,3,3,3, # e0 - e7 - 3,3,3,3,3,3,3,3, # e8 - ef - 3,3,3,3,3,3,3,3, # f0 - f7 - 3,3,3,3,3,3,3,0 # f8 - ff + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 00 - 07 #allow 0x00 as legal value + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, # 08 - 0f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 10 - 17 + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, # 18 - 1f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 20 - 27 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 28 - 2f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 30 - 37 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 38 - 3f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 40 - 47 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 48 - 4f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 50 - 57 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 58 - 5f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 60 - 67 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 68 - 6f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 70 - 77 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, # 78 - 7f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 80 - 87 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 88 - 8f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 90 - 97 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 98 - 9f + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # a0 - a7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # a8 - af + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # b0 - b7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # b8 - bf + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # c0 - c7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # c8 - cf + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # d0 - d7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # d8 - df + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # e0 - e7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # e8 - ef + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # f0 - f7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, # f8 - ff ) BIG5_ST = ( - MachineState.ERROR,MachineState.START,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 - MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,#08-0f - MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START#10-17 + MachineState.ERROR, + MachineState.START, + MachineState.START, + 3, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, # 08-0f + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 10-17 ) BIG5_CHAR_LEN_TABLE = (0, 1, 1, 2, 0) -BIG5_SM_MODEL = {'class_table': BIG5_CLS, - 'class_factor': 5, - 'state_table': BIG5_ST, - 'char_len_table': BIG5_CHAR_LEN_TABLE, - 'name': 'Big5'} +BIG5_SM_MODEL = { + "class_table": BIG5_CLS, + "class_factor": 5, + "state_table": BIG5_ST, + "char_len_table": BIG5_CHAR_LEN_TABLE, + "name": "Big5", +} # CP949 -CP949_CLS = ( - 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,0,0, # 00 - 0f - 1,1,1,1,1,1,1,1, 1,1,1,0,1,1,1,1, # 10 - 1f - 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, # 20 - 2f - 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, # 30 - 3f - 1,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4, # 40 - 4f - 4,4,5,5,5,5,5,5, 5,5,5,1,1,1,1,1, # 50 - 5f - 1,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5, # 60 - 6f - 5,5,5,5,5,5,5,5, 5,5,5,1,1,1,1,1, # 70 - 7f - 0,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, # 80 - 8f - 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, # 90 - 9f - 6,7,7,7,7,7,7,7, 7,7,7,7,7,8,8,8, # a0 - af - 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, # b0 - bf - 7,7,7,7,7,7,9,2, 2,3,2,2,2,2,2,2, # c0 - cf - 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, # d0 - df - 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, # e0 - ef - 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,0, # f0 - ff +CP949_CLS = ( + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, # 00 - 0f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, # 10 - 1f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 20 - 2f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 30 - 3f + 1, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 40 - 4f + 4, + 4, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, # 50 - 5f + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, # 60 - 6f + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, # 70 - 7f + 0, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # 80 - 8f + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # 90 - 9f + 6, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 8, + 8, # a0 - af + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, # b0 - bf + 7, + 7, + 7, + 7, + 7, + 7, + 9, + 2, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 2, # c0 - cf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d0 - df + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e0 - ef + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 0, # f0 - ff ) CP949_ST = ( -#cls= 0 1 2 3 4 5 6 7 8 9 # previous state = - MachineState.ERROR,MachineState.START, 3,MachineState.ERROR,MachineState.START,MachineState.START, 4, 5,MachineState.ERROR, 6, # MachineState.START - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, # MachineState.ERROR - MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME, # MachineState.ITS_ME - MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START, # 3 - MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, # 4 - MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, # 5 - MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START, # 6 + # cls= 0 1 2 3 4 5 6 7 8 9 # previous state = + MachineState.ERROR, + MachineState.START, + 3, + MachineState.ERROR, + MachineState.START, + MachineState.START, + 4, + 5, + MachineState.ERROR, + 6, # MachineState.START + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # MachineState.ERROR + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # MachineState.ITS_ME + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, # 3 + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 4 + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 5 + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, # 6 ) CP949_CHAR_LEN_TABLE = (0, 1, 2, 0, 1, 1, 2, 2, 0, 2) -CP949_SM_MODEL = {'class_table': CP949_CLS, - 'class_factor': 10, - 'state_table': CP949_ST, - 'char_len_table': CP949_CHAR_LEN_TABLE, - 'name': 'CP949'} +CP949_SM_MODEL = { + "class_table": CP949_CLS, + "class_factor": 10, + "state_table": CP949_ST, + "char_len_table": CP949_CHAR_LEN_TABLE, + "name": "CP949", +} # EUC-JP EUCJP_CLS = ( - 4,4,4,4,4,4,4,4, # 00 - 07 - 4,4,4,4,4,4,5,5, # 08 - 0f - 4,4,4,4,4,4,4,4, # 10 - 17 - 4,4,4,5,4,4,4,4, # 18 - 1f - 4,4,4,4,4,4,4,4, # 20 - 27 - 4,4,4,4,4,4,4,4, # 28 - 2f - 4,4,4,4,4,4,4,4, # 30 - 37 - 4,4,4,4,4,4,4,4, # 38 - 3f - 4,4,4,4,4,4,4,4, # 40 - 47 - 4,4,4,4,4,4,4,4, # 48 - 4f - 4,4,4,4,4,4,4,4, # 50 - 57 - 4,4,4,4,4,4,4,4, # 58 - 5f - 4,4,4,4,4,4,4,4, # 60 - 67 - 4,4,4,4,4,4,4,4, # 68 - 6f - 4,4,4,4,4,4,4,4, # 70 - 77 - 4,4,4,4,4,4,4,4, # 78 - 7f - 5,5,5,5,5,5,5,5, # 80 - 87 - 5,5,5,5,5,5,1,3, # 88 - 8f - 5,5,5,5,5,5,5,5, # 90 - 97 - 5,5,5,5,5,5,5,5, # 98 - 9f - 5,2,2,2,2,2,2,2, # a0 - a7 - 2,2,2,2,2,2,2,2, # a8 - af - 2,2,2,2,2,2,2,2, # b0 - b7 - 2,2,2,2,2,2,2,2, # b8 - bf - 2,2,2,2,2,2,2,2, # c0 - c7 - 2,2,2,2,2,2,2,2, # c8 - cf - 2,2,2,2,2,2,2,2, # d0 - d7 - 2,2,2,2,2,2,2,2, # d8 - df - 0,0,0,0,0,0,0,0, # e0 - e7 - 0,0,0,0,0,0,0,0, # e8 - ef - 0,0,0,0,0,0,0,0, # f0 - f7 - 0,0,0,0,0,0,0,5 # f8 - ff + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 00 - 07 + 4, + 4, + 4, + 4, + 4, + 4, + 5, + 5, # 08 - 0f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 10 - 17 + 4, + 4, + 4, + 5, + 4, + 4, + 4, + 4, # 18 - 1f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 20 - 27 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 28 - 2f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 30 - 37 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 38 - 3f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 40 - 47 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 48 - 4f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 50 - 57 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 58 - 5f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 60 - 67 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 68 - 6f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 70 - 77 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 78 - 7f + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, # 80 - 87 + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 3, # 88 - 8f + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, # 90 - 97 + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, # 98 - 9f + 5, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a0 - a7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a8 - af + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b0 - b7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b8 - bf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c0 - c7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c8 - cf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d0 - d7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d8 - df + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # e0 - e7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # e8 - ef + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # f0 - f7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, # f8 - ff ) EUCJP_ST = ( - 3, 4, 3, 5,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f - MachineState.ITS_ME,MachineState.ITS_ME,MachineState.START,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#10-17 - MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 3,MachineState.ERROR,#18-1f - 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START#20-27 + 3, + 4, + 3, + 5, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 08-0f + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.START, + MachineState.ERROR, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 10-17 + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 3, + MachineState.ERROR, # 18-1f + 3, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 20-27 ) EUCJP_CHAR_LEN_TABLE = (2, 2, 2, 3, 1, 0) -EUCJP_SM_MODEL = {'class_table': EUCJP_CLS, - 'class_factor': 6, - 'state_table': EUCJP_ST, - 'char_len_table': EUCJP_CHAR_LEN_TABLE, - 'name': 'EUC-JP'} +EUCJP_SM_MODEL = { + "class_table": EUCJP_CLS, + "class_factor": 6, + "state_table": EUCJP_ST, + "char_len_table": EUCJP_CHAR_LEN_TABLE, + "name": "EUC-JP", +} # EUC-KR -EUCKR_CLS = ( - 1,1,1,1,1,1,1,1, # 00 - 07 - 1,1,1,1,1,1,0,0, # 08 - 0f - 1,1,1,1,1,1,1,1, # 10 - 17 - 1,1,1,0,1,1,1,1, # 18 - 1f - 1,1,1,1,1,1,1,1, # 20 - 27 - 1,1,1,1,1,1,1,1, # 28 - 2f - 1,1,1,1,1,1,1,1, # 30 - 37 - 1,1,1,1,1,1,1,1, # 38 - 3f - 1,1,1,1,1,1,1,1, # 40 - 47 - 1,1,1,1,1,1,1,1, # 48 - 4f - 1,1,1,1,1,1,1,1, # 50 - 57 - 1,1,1,1,1,1,1,1, # 58 - 5f - 1,1,1,1,1,1,1,1, # 60 - 67 - 1,1,1,1,1,1,1,1, # 68 - 6f - 1,1,1,1,1,1,1,1, # 70 - 77 - 1,1,1,1,1,1,1,1, # 78 - 7f - 0,0,0,0,0,0,0,0, # 80 - 87 - 0,0,0,0,0,0,0,0, # 88 - 8f - 0,0,0,0,0,0,0,0, # 90 - 97 - 0,0,0,0,0,0,0,0, # 98 - 9f - 0,2,2,2,2,2,2,2, # a0 - a7 - 2,2,2,2,2,3,3,3, # a8 - af - 2,2,2,2,2,2,2,2, # b0 - b7 - 2,2,2,2,2,2,2,2, # b8 - bf - 2,2,2,2,2,2,2,2, # c0 - c7 - 2,3,2,2,2,2,2,2, # c8 - cf - 2,2,2,2,2,2,2,2, # d0 - d7 - 2,2,2,2,2,2,2,2, # d8 - df - 2,2,2,2,2,2,2,2, # e0 - e7 - 2,2,2,2,2,2,2,2, # e8 - ef - 2,2,2,2,2,2,2,2, # f0 - f7 - 2,2,2,2,2,2,2,0 # f8 - ff +EUCKR_CLS = ( + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 00 - 07 + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, # 08 - 0f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 10 - 17 + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, # 18 - 1f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 20 - 27 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 28 - 2f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 30 - 37 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 38 - 3f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 40 - 47 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 48 - 4f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 50 - 57 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 58 - 5f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 60 - 67 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 68 - 6f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 70 - 77 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 78 - 7f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 80 - 87 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 88 - 8f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 90 - 97 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 98 - 9f + 0, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a0 - a7 + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 3, # a8 - af + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b0 - b7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b8 - bf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c0 - c7 + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 2, # c8 - cf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d0 - d7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d8 - df + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e0 - e7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # e8 - ef + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # f0 - f7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 0, # f8 - ff ) EUCKR_ST = ( - MachineState.ERROR,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 - MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START #08-0f + MachineState.ERROR, + MachineState.START, + 3, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 00-07 + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, # 08-0f ) EUCKR_CHAR_LEN_TABLE = (0, 1, 2, 0) -EUCKR_SM_MODEL = {'class_table': EUCKR_CLS, - 'class_factor': 4, - 'state_table': EUCKR_ST, - 'char_len_table': EUCKR_CHAR_LEN_TABLE, - 'name': 'EUC-KR'} +EUCKR_SM_MODEL = { + "class_table": EUCKR_CLS, + "class_factor": 4, + "state_table": EUCKR_ST, + "char_len_table": EUCKR_CHAR_LEN_TABLE, + "name": "EUC-KR", +} # EUC-TW EUCTW_CLS = ( - 2,2,2,2,2,2,2,2, # 00 - 07 - 2,2,2,2,2,2,0,0, # 08 - 0f - 2,2,2,2,2,2,2,2, # 10 - 17 - 2,2,2,0,2,2,2,2, # 18 - 1f - 2,2,2,2,2,2,2,2, # 20 - 27 - 2,2,2,2,2,2,2,2, # 28 - 2f - 2,2,2,2,2,2,2,2, # 30 - 37 - 2,2,2,2,2,2,2,2, # 38 - 3f - 2,2,2,2,2,2,2,2, # 40 - 47 - 2,2,2,2,2,2,2,2, # 48 - 4f - 2,2,2,2,2,2,2,2, # 50 - 57 - 2,2,2,2,2,2,2,2, # 58 - 5f - 2,2,2,2,2,2,2,2, # 60 - 67 - 2,2,2,2,2,2,2,2, # 68 - 6f - 2,2,2,2,2,2,2,2, # 70 - 77 - 2,2,2,2,2,2,2,2, # 78 - 7f - 0,0,0,0,0,0,0,0, # 80 - 87 - 0,0,0,0,0,0,6,0, # 88 - 8f - 0,0,0,0,0,0,0,0, # 90 - 97 - 0,0,0,0,0,0,0,0, # 98 - 9f - 0,3,4,4,4,4,4,4, # a0 - a7 - 5,5,1,1,1,1,1,1, # a8 - af - 1,1,1,1,1,1,1,1, # b0 - b7 - 1,1,1,1,1,1,1,1, # b8 - bf - 1,1,3,1,3,3,3,3, # c0 - c7 - 3,3,3,3,3,3,3,3, # c8 - cf - 3,3,3,3,3,3,3,3, # d0 - d7 - 3,3,3,3,3,3,3,3, # d8 - df - 3,3,3,3,3,3,3,3, # e0 - e7 - 3,3,3,3,3,3,3,3, # e8 - ef - 3,3,3,3,3,3,3,3, # f0 - f7 - 3,3,3,3,3,3,3,0 # f8 - ff + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 00 - 07 + 2, + 2, + 2, + 2, + 2, + 2, + 0, + 0, # 08 - 0f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 10 - 17 + 2, + 2, + 2, + 0, + 2, + 2, + 2, + 2, # 18 - 1f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 20 - 27 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 28 - 2f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 30 - 37 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 38 - 3f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 40 - 47 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 48 - 4f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 50 - 57 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 58 - 5f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 60 - 67 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 68 - 6f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 70 - 77 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 78 - 7f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 80 - 87 + 0, + 0, + 0, + 0, + 0, + 0, + 6, + 0, # 88 - 8f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 90 - 97 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 98 - 9f + 0, + 3, + 4, + 4, + 4, + 4, + 4, + 4, # a0 - a7 + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, # a8 - af + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # b0 - b7 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # b8 - bf + 1, + 1, + 3, + 1, + 3, + 3, + 3, + 3, # c0 - c7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # c8 - cf + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # d0 - d7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # d8 - df + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # e0 - e7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # e8 - ef + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # f0 - f7 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, # f8 - ff ) EUCTW_ST = ( - MachineState.ERROR,MachineState.ERROR,MachineState.START, 3, 3, 3, 4,MachineState.ERROR,#00-07 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f - MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.START,MachineState.ERROR,#10-17 - MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f - 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.START,MachineState.START,#20-27 - MachineState.START,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START #28-2f + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + 3, + 3, + 3, + 4, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, # 08-0f + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.START, + MachineState.ERROR, # 10-17 + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 18-1f + 5, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.ERROR, + MachineState.START, + MachineState.START, # 20-27 + MachineState.START, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 28-2f ) EUCTW_CHAR_LEN_TABLE = (0, 0, 1, 2, 2, 2, 3) -EUCTW_SM_MODEL = {'class_table': EUCTW_CLS, - 'class_factor': 7, - 'state_table': EUCTW_ST, - 'char_len_table': EUCTW_CHAR_LEN_TABLE, - 'name': 'x-euc-tw'} +EUCTW_SM_MODEL = { + "class_table": EUCTW_CLS, + "class_factor": 7, + "state_table": EUCTW_ST, + "char_len_table": EUCTW_CHAR_LEN_TABLE, + "name": "x-euc-tw", +} # GB2312 GB2312_CLS = ( - 1,1,1,1,1,1,1,1, # 00 - 07 - 1,1,1,1,1,1,0,0, # 08 - 0f - 1,1,1,1,1,1,1,1, # 10 - 17 - 1,1,1,0,1,1,1,1, # 18 - 1f - 1,1,1,1,1,1,1,1, # 20 - 27 - 1,1,1,1,1,1,1,1, # 28 - 2f - 3,3,3,3,3,3,3,3, # 30 - 37 - 3,3,1,1,1,1,1,1, # 38 - 3f - 2,2,2,2,2,2,2,2, # 40 - 47 - 2,2,2,2,2,2,2,2, # 48 - 4f - 2,2,2,2,2,2,2,2, # 50 - 57 - 2,2,2,2,2,2,2,2, # 58 - 5f - 2,2,2,2,2,2,2,2, # 60 - 67 - 2,2,2,2,2,2,2,2, # 68 - 6f - 2,2,2,2,2,2,2,2, # 70 - 77 - 2,2,2,2,2,2,2,4, # 78 - 7f - 5,6,6,6,6,6,6,6, # 80 - 87 - 6,6,6,6,6,6,6,6, # 88 - 8f - 6,6,6,6,6,6,6,6, # 90 - 97 - 6,6,6,6,6,6,6,6, # 98 - 9f - 6,6,6,6,6,6,6,6, # a0 - a7 - 6,6,6,6,6,6,6,6, # a8 - af - 6,6,6,6,6,6,6,6, # b0 - b7 - 6,6,6,6,6,6,6,6, # b8 - bf - 6,6,6,6,6,6,6,6, # c0 - c7 - 6,6,6,6,6,6,6,6, # c8 - cf - 6,6,6,6,6,6,6,6, # d0 - d7 - 6,6,6,6,6,6,6,6, # d8 - df - 6,6,6,6,6,6,6,6, # e0 - e7 - 6,6,6,6,6,6,6,6, # e8 - ef - 6,6,6,6,6,6,6,6, # f0 - f7 - 6,6,6,6,6,6,6,0 # f8 - ff + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 00 - 07 + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, # 08 - 0f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 10 - 17 + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, # 18 - 1f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 20 - 27 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 28 - 2f + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # 30 - 37 + 3, + 3, + 1, + 1, + 1, + 1, + 1, + 1, # 38 - 3f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 40 - 47 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 48 - 4f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 50 - 57 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 58 - 5f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 60 - 67 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 68 - 6f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 70 - 77 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 4, # 78 - 7f + 5, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # 80 - 87 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # 88 - 8f + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # 90 - 97 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # 98 - 9f + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # a0 - a7 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # a8 - af + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # b0 - b7 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # b8 - bf + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # c0 - c7 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # c8 - cf + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # d0 - d7 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # d8 - df + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # e0 - e7 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # e8 - ef + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # f0 - f7 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 0, # f8 - ff ) GB2312_ST = ( - MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START, 3,MachineState.ERROR,#00-07 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f - MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,#10-17 - 4,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f - MachineState.ERROR,MachineState.ERROR, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,#20-27 - MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.START #28-2f + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + 3, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, # 08-0f + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, # 10-17 + 4, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 18-1f + MachineState.ERROR, + MachineState.ERROR, + 5, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ERROR, # 20-27 + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 28-2f ) # To be accurate, the length of class 6 can be either 2 or 4. @@ -328,245 +1915,1453 @@ # 2 here. GB2312_CHAR_LEN_TABLE = (0, 1, 1, 1, 1, 1, 2) -GB2312_SM_MODEL = {'class_table': GB2312_CLS, - 'class_factor': 7, - 'state_table': GB2312_ST, - 'char_len_table': GB2312_CHAR_LEN_TABLE, - 'name': 'GB2312'} +GB2312_SM_MODEL = { + "class_table": GB2312_CLS, + "class_factor": 7, + "state_table": GB2312_ST, + "char_len_table": GB2312_CHAR_LEN_TABLE, + "name": "GB2312", +} # Shift_JIS SJIS_CLS = ( - 1,1,1,1,1,1,1,1, # 00 - 07 - 1,1,1,1,1,1,0,0, # 08 - 0f - 1,1,1,1,1,1,1,1, # 10 - 17 - 1,1,1,0,1,1,1,1, # 18 - 1f - 1,1,1,1,1,1,1,1, # 20 - 27 - 1,1,1,1,1,1,1,1, # 28 - 2f - 1,1,1,1,1,1,1,1, # 30 - 37 - 1,1,1,1,1,1,1,1, # 38 - 3f - 2,2,2,2,2,2,2,2, # 40 - 47 - 2,2,2,2,2,2,2,2, # 48 - 4f - 2,2,2,2,2,2,2,2, # 50 - 57 - 2,2,2,2,2,2,2,2, # 58 - 5f - 2,2,2,2,2,2,2,2, # 60 - 67 - 2,2,2,2,2,2,2,2, # 68 - 6f - 2,2,2,2,2,2,2,2, # 70 - 77 - 2,2,2,2,2,2,2,1, # 78 - 7f - 3,3,3,3,3,2,2,3, # 80 - 87 - 3,3,3,3,3,3,3,3, # 88 - 8f - 3,3,3,3,3,3,3,3, # 90 - 97 - 3,3,3,3,3,3,3,3, # 98 - 9f - #0xa0 is illegal in sjis encoding, but some pages does - #contain such byte. We need to be more error forgiven. - 2,2,2,2,2,2,2,2, # a0 - a7 - 2,2,2,2,2,2,2,2, # a8 - af - 2,2,2,2,2,2,2,2, # b0 - b7 - 2,2,2,2,2,2,2,2, # b8 - bf - 2,2,2,2,2,2,2,2, # c0 - c7 - 2,2,2,2,2,2,2,2, # c8 - cf - 2,2,2,2,2,2,2,2, # d0 - d7 - 2,2,2,2,2,2,2,2, # d8 - df - 3,3,3,3,3,3,3,3, # e0 - e7 - 3,3,3,3,3,4,4,4, # e8 - ef - 3,3,3,3,3,3,3,3, # f0 - f7 - 3,3,3,3,3,0,0,0) # f8 - ff + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 00 - 07 + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, # 08 - 0f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 10 - 17 + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, # 18 - 1f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 20 - 27 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 28 - 2f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 30 - 37 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 38 - 3f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 40 - 47 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 48 - 4f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 50 - 57 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 58 - 5f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 60 - 67 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 68 - 6f + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # 70 - 77 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, # 78 - 7f + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, # 80 - 87 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # 88 - 8f + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # 90 - 97 + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # 98 - 9f + # 0xa0 is illegal in sjis encoding, but some pages does + # contain such byte. We need to be more error forgiven. + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a0 - a7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # a8 - af + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b0 - b7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # b8 - bf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c0 - c7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # c8 - cf + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d0 - d7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, # d8 - df + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # e0 - e7 + 3, + 3, + 3, + 3, + 3, + 4, + 4, + 4, # e8 - ef + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, # f0 - f7 + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, +) # f8 - ff SJIS_ST = ( - MachineState.ERROR,MachineState.START,MachineState.START, 3,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#00-07 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f - MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START #10-17 + MachineState.ERROR, + MachineState.START, + MachineState.START, + 3, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 08-0f + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, # 10-17 ) SJIS_CHAR_LEN_TABLE = (0, 1, 1, 2, 0, 0) -SJIS_SM_MODEL = {'class_table': SJIS_CLS, - 'class_factor': 6, - 'state_table': SJIS_ST, - 'char_len_table': SJIS_CHAR_LEN_TABLE, - 'name': 'Shift_JIS'} +SJIS_SM_MODEL = { + "class_table": SJIS_CLS, + "class_factor": 6, + "state_table": SJIS_ST, + "char_len_table": SJIS_CHAR_LEN_TABLE, + "name": "Shift_JIS", +} # UCS2-BE UCS2BE_CLS = ( - 0,0,0,0,0,0,0,0, # 00 - 07 - 0,0,1,0,0,2,0,0, # 08 - 0f - 0,0,0,0,0,0,0,0, # 10 - 17 - 0,0,0,3,0,0,0,0, # 18 - 1f - 0,0,0,0,0,0,0,0, # 20 - 27 - 0,3,3,3,3,3,0,0, # 28 - 2f - 0,0,0,0,0,0,0,0, # 30 - 37 - 0,0,0,0,0,0,0,0, # 38 - 3f - 0,0,0,0,0,0,0,0, # 40 - 47 - 0,0,0,0,0,0,0,0, # 48 - 4f - 0,0,0,0,0,0,0,0, # 50 - 57 - 0,0,0,0,0,0,0,0, # 58 - 5f - 0,0,0,0,0,0,0,0, # 60 - 67 - 0,0,0,0,0,0,0,0, # 68 - 6f - 0,0,0,0,0,0,0,0, # 70 - 77 - 0,0,0,0,0,0,0,0, # 78 - 7f - 0,0,0,0,0,0,0,0, # 80 - 87 - 0,0,0,0,0,0,0,0, # 88 - 8f - 0,0,0,0,0,0,0,0, # 90 - 97 - 0,0,0,0,0,0,0,0, # 98 - 9f - 0,0,0,0,0,0,0,0, # a0 - a7 - 0,0,0,0,0,0,0,0, # a8 - af - 0,0,0,0,0,0,0,0, # b0 - b7 - 0,0,0,0,0,0,0,0, # b8 - bf - 0,0,0,0,0,0,0,0, # c0 - c7 - 0,0,0,0,0,0,0,0, # c8 - cf - 0,0,0,0,0,0,0,0, # d0 - d7 - 0,0,0,0,0,0,0,0, # d8 - df - 0,0,0,0,0,0,0,0, # e0 - e7 - 0,0,0,0,0,0,0,0, # e8 - ef - 0,0,0,0,0,0,0,0, # f0 - f7 - 0,0,0,0,0,0,4,5 # f8 - ff + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 00 - 07 + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, # 08 - 0f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 10 - 17 + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, # 18 - 1f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 20 - 27 + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 0, # 28 - 2f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 30 - 37 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 38 - 3f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 40 - 47 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 48 - 4f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 50 - 57 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 58 - 5f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 60 - 67 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 68 - 6f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 70 - 77 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 78 - 7f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 80 - 87 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 88 - 8f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 90 - 97 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 98 - 9f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # a0 - a7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # a8 - af + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # b0 - b7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # b8 - bf + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # c0 - c7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # c8 - cf + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # d0 - d7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # d8 - df + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # e0 - e7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # e8 - ef + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # f0 - f7 + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 5, # f8 - ff ) -UCS2BE_ST = ( - 5, 7, 7,MachineState.ERROR, 4, 3,MachineState.ERROR,MachineState.ERROR,#00-07 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f - MachineState.ITS_ME,MachineState.ITS_ME, 6, 6, 6, 6,MachineState.ERROR,MachineState.ERROR,#10-17 - 6, 6, 6, 6, 6,MachineState.ITS_ME, 6, 6,#18-1f - 6, 6, 6, 6, 5, 7, 7,MachineState.ERROR,#20-27 - 5, 8, 6, 6,MachineState.ERROR, 6, 6, 6,#28-2f - 6, 6, 6, 6,MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START #30-37 +UCS2BE_ST = ( + 5, + 7, + 7, + MachineState.ERROR, + 4, + 3, + MachineState.ERROR, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 08-0f + MachineState.ITS_ME, + MachineState.ITS_ME, + 6, + 6, + 6, + 6, + MachineState.ERROR, + MachineState.ERROR, # 10-17 + 6, + 6, + 6, + 6, + 6, + MachineState.ITS_ME, + 6, + 6, # 18-1f + 6, + 6, + 6, + 6, + 5, + 7, + 7, + MachineState.ERROR, # 20-27 + 5, + 8, + 6, + 6, + MachineState.ERROR, + 6, + 6, + 6, # 28-2f + 6, + 6, + 6, + 6, + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, # 30-37 ) UCS2BE_CHAR_LEN_TABLE = (2, 2, 2, 0, 2, 2) -UCS2BE_SM_MODEL = {'class_table': UCS2BE_CLS, - 'class_factor': 6, - 'state_table': UCS2BE_ST, - 'char_len_table': UCS2BE_CHAR_LEN_TABLE, - 'name': 'UTF-16BE'} +UCS2BE_SM_MODEL = { + "class_table": UCS2BE_CLS, + "class_factor": 6, + "state_table": UCS2BE_ST, + "char_len_table": UCS2BE_CHAR_LEN_TABLE, + "name": "UTF-16BE", +} # UCS2-LE UCS2LE_CLS = ( - 0,0,0,0,0,0,0,0, # 00 - 07 - 0,0,1,0,0,2,0,0, # 08 - 0f - 0,0,0,0,0,0,0,0, # 10 - 17 - 0,0,0,3,0,0,0,0, # 18 - 1f - 0,0,0,0,0,0,0,0, # 20 - 27 - 0,3,3,3,3,3,0,0, # 28 - 2f - 0,0,0,0,0,0,0,0, # 30 - 37 - 0,0,0,0,0,0,0,0, # 38 - 3f - 0,0,0,0,0,0,0,0, # 40 - 47 - 0,0,0,0,0,0,0,0, # 48 - 4f - 0,0,0,0,0,0,0,0, # 50 - 57 - 0,0,0,0,0,0,0,0, # 58 - 5f - 0,0,0,0,0,0,0,0, # 60 - 67 - 0,0,0,0,0,0,0,0, # 68 - 6f - 0,0,0,0,0,0,0,0, # 70 - 77 - 0,0,0,0,0,0,0,0, # 78 - 7f - 0,0,0,0,0,0,0,0, # 80 - 87 - 0,0,0,0,0,0,0,0, # 88 - 8f - 0,0,0,0,0,0,0,0, # 90 - 97 - 0,0,0,0,0,0,0,0, # 98 - 9f - 0,0,0,0,0,0,0,0, # a0 - a7 - 0,0,0,0,0,0,0,0, # a8 - af - 0,0,0,0,0,0,0,0, # b0 - b7 - 0,0,0,0,0,0,0,0, # b8 - bf - 0,0,0,0,0,0,0,0, # c0 - c7 - 0,0,0,0,0,0,0,0, # c8 - cf - 0,0,0,0,0,0,0,0, # d0 - d7 - 0,0,0,0,0,0,0,0, # d8 - df - 0,0,0,0,0,0,0,0, # e0 - e7 - 0,0,0,0,0,0,0,0, # e8 - ef - 0,0,0,0,0,0,0,0, # f0 - f7 - 0,0,0,0,0,0,4,5 # f8 - ff + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 00 - 07 + 0, + 0, + 1, + 0, + 0, + 2, + 0, + 0, # 08 - 0f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 10 - 17 + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, # 18 - 1f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 20 - 27 + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 0, # 28 - 2f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 30 - 37 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 38 - 3f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 40 - 47 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 48 - 4f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 50 - 57 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 58 - 5f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 60 - 67 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 68 - 6f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 70 - 77 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 78 - 7f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 80 - 87 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 88 - 8f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 90 - 97 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # 98 - 9f + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # a0 - a7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # a8 - af + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # b0 - b7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # b8 - bf + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # c0 - c7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # c8 - cf + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # d0 - d7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # d8 - df + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # e0 - e7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # e8 - ef + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, # f0 - f7 + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 5, # f8 - ff ) UCS2LE_ST = ( - 6, 6, 7, 6, 4, 3,MachineState.ERROR,MachineState.ERROR,#00-07 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#08-0f - MachineState.ITS_ME,MachineState.ITS_ME, 5, 5, 5,MachineState.ERROR,MachineState.ITS_ME,MachineState.ERROR,#10-17 - 5, 5, 5,MachineState.ERROR, 5,MachineState.ERROR, 6, 6,#18-1f - 7, 6, 8, 8, 5, 5, 5,MachineState.ERROR,#20-27 - 5, 5, 5,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5, 5,#28-2f - 5, 5, 5,MachineState.ERROR, 5,MachineState.ERROR,MachineState.START,MachineState.START #30-37 + 6, + 6, + 7, + 6, + 4, + 3, + MachineState.ERROR, + MachineState.ERROR, # 00-07 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 08-0f + MachineState.ITS_ME, + MachineState.ITS_ME, + 5, + 5, + 5, + MachineState.ERROR, + MachineState.ITS_ME, + MachineState.ERROR, # 10-17 + 5, + 5, + 5, + MachineState.ERROR, + 5, + MachineState.ERROR, + 6, + 6, # 18-1f + 7, + 6, + 8, + 8, + 5, + 5, + 5, + MachineState.ERROR, # 20-27 + 5, + 5, + 5, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 5, + 5, # 28-2f + 5, + 5, + 5, + MachineState.ERROR, + 5, + MachineState.ERROR, + MachineState.START, + MachineState.START, # 30-37 ) UCS2LE_CHAR_LEN_TABLE = (2, 2, 2, 2, 2, 2) -UCS2LE_SM_MODEL = {'class_table': UCS2LE_CLS, - 'class_factor': 6, - 'state_table': UCS2LE_ST, - 'char_len_table': UCS2LE_CHAR_LEN_TABLE, - 'name': 'UTF-16LE'} +UCS2LE_SM_MODEL = { + "class_table": UCS2LE_CLS, + "class_factor": 6, + "state_table": UCS2LE_ST, + "char_len_table": UCS2LE_CHAR_LEN_TABLE, + "name": "UTF-16LE", +} # UTF-8 UTF8_CLS = ( - 1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as a legal value - 1,1,1,1,1,1,0,0, # 08 - 0f - 1,1,1,1,1,1,1,1, # 10 - 17 - 1,1,1,0,1,1,1,1, # 18 - 1f - 1,1,1,1,1,1,1,1, # 20 - 27 - 1,1,1,1,1,1,1,1, # 28 - 2f - 1,1,1,1,1,1,1,1, # 30 - 37 - 1,1,1,1,1,1,1,1, # 38 - 3f - 1,1,1,1,1,1,1,1, # 40 - 47 - 1,1,1,1,1,1,1,1, # 48 - 4f - 1,1,1,1,1,1,1,1, # 50 - 57 - 1,1,1,1,1,1,1,1, # 58 - 5f - 1,1,1,1,1,1,1,1, # 60 - 67 - 1,1,1,1,1,1,1,1, # 68 - 6f - 1,1,1,1,1,1,1,1, # 70 - 77 - 1,1,1,1,1,1,1,1, # 78 - 7f - 2,2,2,2,3,3,3,3, # 80 - 87 - 4,4,4,4,4,4,4,4, # 88 - 8f - 4,4,4,4,4,4,4,4, # 90 - 97 - 4,4,4,4,4,4,4,4, # 98 - 9f - 5,5,5,5,5,5,5,5, # a0 - a7 - 5,5,5,5,5,5,5,5, # a8 - af - 5,5,5,5,5,5,5,5, # b0 - b7 - 5,5,5,5,5,5,5,5, # b8 - bf - 0,0,6,6,6,6,6,6, # c0 - c7 - 6,6,6,6,6,6,6,6, # c8 - cf - 6,6,6,6,6,6,6,6, # d0 - d7 - 6,6,6,6,6,6,6,6, # d8 - df - 7,8,8,8,8,8,8,8, # e0 - e7 - 8,8,8,8,8,9,8,8, # e8 - ef - 10,11,11,11,11,11,11,11, # f0 - f7 - 12,13,13,13,14,15,0,0 # f8 - ff + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 00 - 07 #allow 0x00 as a legal value + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, # 08 - 0f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 10 - 17 + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, # 18 - 1f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 20 - 27 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 28 - 2f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 30 - 37 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 38 - 3f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 40 - 47 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 48 - 4f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 50 - 57 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 58 - 5f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 60 - 67 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 68 - 6f + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 70 - 77 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, # 78 - 7f + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, # 80 - 87 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 88 - 8f + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 90 - 97 + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, # 98 - 9f + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, # a0 - a7 + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, # a8 - af + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, # b0 - b7 + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, # b8 - bf + 0, + 0, + 6, + 6, + 6, + 6, + 6, + 6, # c0 - c7 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # c8 - cf + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # d0 - d7 + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, # d8 - df + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 8, # e0 - e7 + 8, + 8, + 8, + 8, + 8, + 9, + 8, + 8, # e8 - ef + 10, + 11, + 11, + 11, + 11, + 11, + 11, + 11, # f0 - f7 + 12, + 13, + 13, + 13, + 14, + 15, + 0, + 0, # f8 - ff ) UTF8_ST = ( - MachineState.ERROR,MachineState.START,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 12, 10,#00-07 - 9, 11, 8, 7, 6, 5, 4, 3,#08-0f - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#10-17 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#18-1f - MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#20-27 - MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,MachineState.ITS_ME,#28-2f - MachineState.ERROR,MachineState.ERROR, 5, 5, 5, 5,MachineState.ERROR,MachineState.ERROR,#30-37 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#38-3f - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 5, 5, 5,MachineState.ERROR,MachineState.ERROR,#40-47 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#48-4f - MachineState.ERROR,MachineState.ERROR, 7, 7, 7, 7,MachineState.ERROR,MachineState.ERROR,#50-57 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#58-5f - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 7, 7,MachineState.ERROR,MachineState.ERROR,#60-67 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#68-6f - MachineState.ERROR,MachineState.ERROR, 9, 9, 9, 9,MachineState.ERROR,MachineState.ERROR,#70-77 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#78-7f - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 9,MachineState.ERROR,MachineState.ERROR,#80-87 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#88-8f - MachineState.ERROR,MachineState.ERROR, 12, 12, 12, 12,MachineState.ERROR,MachineState.ERROR,#90-97 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#98-9f - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR, 12,MachineState.ERROR,MachineState.ERROR,#a0-a7 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#a8-af - MachineState.ERROR,MachineState.ERROR, 12, 12, 12,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#b0-b7 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,#b8-bf - MachineState.ERROR,MachineState.ERROR,MachineState.START,MachineState.START,MachineState.START,MachineState.START,MachineState.ERROR,MachineState.ERROR,#c0-c7 - MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR,MachineState.ERROR #c8-cf + MachineState.ERROR, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 12, + 10, # 00-07 + 9, + 11, + 8, + 7, + 6, + 5, + 4, + 3, # 08-0f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 10-17 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 18-1f + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 20-27 + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, + MachineState.ITS_ME, # 28-2f + MachineState.ERROR, + MachineState.ERROR, + 5, + 5, + 5, + 5, + MachineState.ERROR, + MachineState.ERROR, # 30-37 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 38-3f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 5, + 5, + 5, + MachineState.ERROR, + MachineState.ERROR, # 40-47 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 48-4f + MachineState.ERROR, + MachineState.ERROR, + 7, + 7, + 7, + 7, + MachineState.ERROR, + MachineState.ERROR, # 50-57 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 58-5f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 7, + 7, + MachineState.ERROR, + MachineState.ERROR, # 60-67 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 68-6f + MachineState.ERROR, + MachineState.ERROR, + 9, + 9, + 9, + 9, + MachineState.ERROR, + MachineState.ERROR, # 70-77 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 78-7f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 9, + MachineState.ERROR, + MachineState.ERROR, # 80-87 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 88-8f + MachineState.ERROR, + MachineState.ERROR, + 12, + 12, + 12, + 12, + MachineState.ERROR, + MachineState.ERROR, # 90-97 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # 98-9f + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + 12, + MachineState.ERROR, + MachineState.ERROR, # a0-a7 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # a8-af + MachineState.ERROR, + MachineState.ERROR, + 12, + 12, + 12, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # b0-b7 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # b8-bf + MachineState.ERROR, + MachineState.ERROR, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.START, + MachineState.ERROR, + MachineState.ERROR, # c0-c7 + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, + MachineState.ERROR, # c8-cf ) UTF8_CHAR_LEN_TABLE = (0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6) -UTF8_SM_MODEL = {'class_table': UTF8_CLS, - 'class_factor': 16, - 'state_table': UTF8_ST, - 'char_len_table': UTF8_CHAR_LEN_TABLE, - 'name': 'UTF-8'} +UTF8_SM_MODEL = { + "class_table": UTF8_CLS, + "class_factor": 16, + "state_table": UTF8_ST, + "char_len_table": UTF8_CHAR_LEN_TABLE, + "name": "UTF-8", +} diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/sbcharsetprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/sbcharsetprober.py index 0adb51de..3e8d49c1 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/sbcharsetprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/sbcharsetprober.py @@ -65,21 +65,21 @@ def charset_name(self): if self._name_prober: return self._name_prober.charset_name else: - return self._model['charset_name'] + return self._model["charset_name"] @property def language(self): if self._name_prober: return self._name_prober.language else: - return self._model.get('language') + return self._model.get("language") def feed(self, byte_str): - if not self._model['keep_english_letter']: + if not self._model["keep_english_letter"]: byte_str = self.filter_international_words(byte_str) if not byte_str: return self.state - char_to_order_map = self._model['char_to_order_map'] + char_to_order_map = self._model["char_to_order_map"] for i, c in enumerate(byte_str): # XXX: Order is in range 1-64, so one would think we want 0-63 here, # but that leads to 27 more test failures than before. @@ -97,26 +97,29 @@ def feed(self, byte_str): self._total_seqs += 1 if not self._reversed: i = (self._last_order * self.SAMPLE_SIZE) + order - model = self._model['precedence_matrix'][i] + model = self._model["precedence_matrix"][i] else: # reverse the order of the letters in the lookup i = (order * self.SAMPLE_SIZE) + self._last_order - model = self._model['precedence_matrix'][i] + model = self._model["precedence_matrix"][i] self._seq_counters[model] += 1 self._last_order = order - charset_name = self._model['charset_name'] + charset_name = self._model["charset_name"] if self.state == ProbingState.DETECTING: if self._total_seqs > self.SB_ENOUGH_REL_THRESHOLD: confidence = self.get_confidence() if confidence > self.POSITIVE_SHORTCUT_THRESHOLD: - self.logger.debug('%s confidence = %s, we have a winner', - charset_name, confidence) + self.logger.debug( + "%s confidence = %s, we have a winner", charset_name, confidence + ) self._state = ProbingState.FOUND_IT elif confidence < self.NEGATIVE_SHORTCUT_THRESHOLD: - self.logger.debug('%s confidence = %s, below negative ' - 'shortcut threshhold %s', charset_name, - confidence, - self.NEGATIVE_SHORTCUT_THRESHOLD) + self.logger.debug( + "%s confidence = %s, below negative " "shortcut threshhold %s", + charset_name, + confidence, + self.NEGATIVE_SHORTCUT_THRESHOLD, + ) self._state = ProbingState.NOT_ME return self.state @@ -124,8 +127,11 @@ def feed(self, byte_str): def get_confidence(self): r = 0.01 if self._total_seqs > 0: - r = ((1.0 * self._seq_counters[SequenceLikelihood.POSITIVE]) / - self._total_seqs / self._model['typical_positive_ratio']) + r = ( + (1.0 * self._seq_counters[SequenceLikelihood.POSITIVE]) + / self._total_seqs + / self._model["typical_positive_ratio"] + ) r = r * self._freq_char / self._total_char if r >= 1.0: r = 0.99 diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/sbcsgroupprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/sbcsgroupprober.py index 98e95dc1..cdc763b3 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/sbcsgroupprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/sbcsgroupprober.py @@ -28,11 +28,17 @@ from .charsetgroupprober import CharSetGroupProber from .sbcharsetprober import SingleByteCharSetProber -from .langcyrillicmodel import (Win1251CyrillicModel, Koi8rModel, - Latin5CyrillicModel, MacCyrillicModel, - Ibm866Model, Ibm855Model) +from .langcyrillicmodel import ( + Win1251CyrillicModel, + Koi8rModel, + Latin5CyrillicModel, + MacCyrillicModel, + Ibm866Model, + Ibm855Model, +) from .langgreekmodel import Latin7GreekModel, Win1253GreekModel from .langbulgarianmodel import Latin5BulgarianModel, Win1251BulgarianModel + # from .langhungarianmodel import Latin2HungarianModel, Win1250HungarianModel from .langthaimodel import TIS620ThaiModel from .langhebrewmodel import Win1255HebrewModel @@ -62,12 +68,15 @@ def __init__(self): SingleByteCharSetProber(Latin5TurkishModel), ] hebrew_prober = HebrewProber() - logical_hebrew_prober = SingleByteCharSetProber(Win1255HebrewModel, - False, hebrew_prober) - visual_hebrew_prober = SingleByteCharSetProber(Win1255HebrewModel, True, - hebrew_prober) + logical_hebrew_prober = SingleByteCharSetProber( + Win1255HebrewModel, False, hebrew_prober + ) + visual_hebrew_prober = SingleByteCharSetProber( + Win1255HebrewModel, True, hebrew_prober + ) hebrew_prober.set_model_probers(logical_hebrew_prober, visual_hebrew_prober) - self.probers.extend([hebrew_prober, logical_hebrew_prober, - visual_hebrew_prober]) + self.probers.extend( + [hebrew_prober, logical_hebrew_prober, visual_hebrew_prober] + ) self.reset() diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/sjisprober.py b/src/fetchcode/vcs/pip/_vendor/chardet/sjisprober.py index 9e29623b..e82f648b 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/sjisprober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/sjisprober.py @@ -57,8 +57,12 @@ def feed(self, byte_str): for i in range(len(byte_str)): coding_state = self.coding_sm.next_state(byte_str[i]) if coding_state == MachineState.ERROR: - self.logger.debug('%s %s prober hit error at byte %s', - self.charset_name, self.language, i) + self.logger.debug( + "%s %s prober hit error at byte %s", + self.charset_name, + self.language, + i, + ) self._state = ProbingState.NOT_ME break elif coding_state == MachineState.ITS_ME: @@ -68,20 +72,22 @@ def feed(self, byte_str): char_len = self.coding_sm.get_current_charlen() if i == 0: self._last_char[1] = byte_str[0] - self.context_analyzer.feed(self._last_char[2 - char_len:], - char_len) + self.context_analyzer.feed( + self._last_char[2 - char_len :], char_len + ) self.distribution_analyzer.feed(self._last_char, char_len) else: - self.context_analyzer.feed(byte_str[i + 1 - char_len:i + 3 - - char_len], char_len) - self.distribution_analyzer.feed(byte_str[i - 1:i + 1], - char_len) + self.context_analyzer.feed( + byte_str[i + 1 - char_len : i + 3 - char_len], char_len + ) + self.distribution_analyzer.feed(byte_str[i - 1 : i + 1], char_len) self._last_char[0] = byte_str[-1] if self.state == ProbingState.DETECTING: - if (self.context_analyzer.got_enough_data() and - (self.get_confidence() > self.SHORTCUT_THRESHOLD)): + if self.context_analyzer.got_enough_data() and ( + self.get_confidence() > self.SHORTCUT_THRESHOLD + ): self._state = ProbingState.FOUND_IT return self.state diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/universaldetector.py b/src/fetchcode/vcs/pip/_vendor/chardet/universaldetector.py index 7b4e92d6..8fb3e32b 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/universaldetector.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/universaldetector.py @@ -66,17 +66,19 @@ class UniversalDetector(object): """ MINIMUM_THRESHOLD = 0.20 - HIGH_BYTE_DETECTOR = re.compile(b'[\x80-\xFF]') - ESC_DETECTOR = re.compile(b'(\033|~{)') - WIN_BYTE_DETECTOR = re.compile(b'[\x80-\x9F]') - ISO_WIN_MAP = {'iso-8859-1': 'Windows-1252', - 'iso-8859-2': 'Windows-1250', - 'iso-8859-5': 'Windows-1251', - 'iso-8859-6': 'Windows-1256', - 'iso-8859-7': 'Windows-1253', - 'iso-8859-8': 'Windows-1255', - 'iso-8859-9': 'Windows-1254', - 'iso-8859-13': 'Windows-1257'} + HIGH_BYTE_DETECTOR = re.compile(b"[\x80-\xFF]") + ESC_DETECTOR = re.compile(b"(\033|~{)") + WIN_BYTE_DETECTOR = re.compile(b"[\x80-\x9F]") + ISO_WIN_MAP = { + "iso-8859-1": "Windows-1252", + "iso-8859-2": "Windows-1250", + "iso-8859-5": "Windows-1251", + "iso-8859-6": "Windows-1256", + "iso-8859-7": "Windows-1253", + "iso-8859-8": "Windows-1255", + "iso-8859-9": "Windows-1254", + "iso-8859-13": "Windows-1257", + } def __init__(self, lang_filter=LanguageFilter.ALL): self._esc_charset_prober = None @@ -97,12 +99,12 @@ def reset(self): initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. """ - self.result = {'encoding': None, 'confidence': 0.0, 'language': None} + self.result = {"encoding": None, "confidence": 0.0, "language": None} self.done = False self._got_data = False self._has_win_bytes = False self._input_state = InputState.PURE_ASCII - self._last_char = b'' + self._last_char = b"" if self._esc_charset_prober: self._esc_charset_prober.reset() for prober in self._charset_probers: @@ -136,35 +138,36 @@ def feed(self, byte_str): # If the data starts with BOM, we know it is UTF if byte_str.startswith(codecs.BOM_UTF8): # EF BB BF UTF-8 with BOM - self.result = {'encoding': "UTF-8-SIG", - 'confidence': 1.0, - 'language': ''} - elif byte_str.startswith((codecs.BOM_UTF32_LE, - codecs.BOM_UTF32_BE)): + self.result = { + "encoding": "UTF-8-SIG", + "confidence": 1.0, + "language": "", + } + elif byte_str.startswith((codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE)): # FF FE 00 00 UTF-32, little-endian BOM # 00 00 FE FF UTF-32, big-endian BOM - self.result = {'encoding': "UTF-32", - 'confidence': 1.0, - 'language': ''} - elif byte_str.startswith(b'\xFE\xFF\x00\x00'): + self.result = {"encoding": "UTF-32", "confidence": 1.0, "language": ""} + elif byte_str.startswith(b"\xFE\xFF\x00\x00"): # FE FF 00 00 UCS-4, unusual octet order BOM (3412) - self.result = {'encoding': "X-ISO-10646-UCS-4-3412", - 'confidence': 1.0, - 'language': ''} - elif byte_str.startswith(b'\x00\x00\xFF\xFE'): + self.result = { + "encoding": "X-ISO-10646-UCS-4-3412", + "confidence": 1.0, + "language": "", + } + elif byte_str.startswith(b"\x00\x00\xFF\xFE"): # 00 00 FF FE UCS-4, unusual octet order BOM (2143) - self.result = {'encoding': "X-ISO-10646-UCS-4-2143", - 'confidence': 1.0, - 'language': ''} + self.result = { + "encoding": "X-ISO-10646-UCS-4-2143", + "confidence": 1.0, + "language": "", + } elif byte_str.startswith((codecs.BOM_LE, codecs.BOM_BE)): # FF FE UTF-16, little endian BOM # FE FF UTF-16, big endian BOM - self.result = {'encoding': "UTF-16", - 'confidence': 1.0, - 'language': ''} + self.result = {"encoding": "UTF-16", "confidence": 1.0, "language": ""} self._got_data = True - if self.result['encoding'] is not None: + if self.result["encoding"] is not None: self.done = True return @@ -173,8 +176,10 @@ def feed(self, byte_str): if self._input_state == InputState.PURE_ASCII: if self.HIGH_BYTE_DETECTOR.search(byte_str): self._input_state = InputState.HIGH_BYTE - elif self._input_state == InputState.PURE_ASCII and \ - self.ESC_DETECTOR.search(self._last_char + byte_str): + elif ( + self._input_state == InputState.PURE_ASCII + and self.ESC_DETECTOR.search(self._last_char + byte_str) + ): self._input_state = InputState.ESC_ASCII self._last_char = byte_str[-1:] @@ -187,12 +192,11 @@ def feed(self, byte_str): if not self._esc_charset_prober: self._esc_charset_prober = EscCharSetProber(self.lang_filter) if self._esc_charset_prober.feed(byte_str) == ProbingState.FOUND_IT: - self.result = {'encoding': - self._esc_charset_prober.charset_name, - 'confidence': - self._esc_charset_prober.get_confidence(), - 'language': - self._esc_charset_prober.language} + self.result = { + "encoding": self._esc_charset_prober.charset_name, + "confidence": self._esc_charset_prober.get_confidence(), + "language": self._esc_charset_prober.language, + } self.done = True # If we've seen high bytes (i.e., those with values greater than 127), # we need to do more complicated checks using all our multi-byte and @@ -209,9 +213,11 @@ def feed(self, byte_str): self._charset_probers.append(Latin1Prober()) for prober in self._charset_probers: if prober.feed(byte_str) == ProbingState.FOUND_IT: - self.result = {'encoding': prober.charset_name, - 'confidence': prober.get_confidence(), - 'language': prober.language} + self.result = { + "encoding": prober.charset_name, + "confidence": prober.get_confidence(), + "language": prober.language, + } self.done = True break if self.WIN_BYTE_DETECTOR.search(byte_str): @@ -231,13 +237,11 @@ def close(self): self.done = True if not self._got_data: - self.logger.debug('no data received!') + self.logger.debug("no data received!") # Default to ASCII if it is all we've seen so far elif self._input_state == InputState.PURE_ASCII: - self.result = {'encoding': 'ascii', - 'confidence': 1.0, - 'language': ''} + self.result = {"encoding": "ascii", "confidence": 1.0, "language": ""} # If we have seen non-ASCII, return the best that met MINIMUM_THRESHOLD elif self._input_state == InputState.HIGH_BYTE: @@ -257,30 +261,37 @@ def close(self): confidence = max_prober.get_confidence() # Use Windows encoding name instead of ISO-8859 if we saw any # extra Windows-specific bytes - if lower_charset_name.startswith('iso-8859'): + if lower_charset_name.startswith("iso-8859"): if self._has_win_bytes: - charset_name = self.ISO_WIN_MAP.get(lower_charset_name, - charset_name) - self.result = {'encoding': charset_name, - 'confidence': confidence, - 'language': max_prober.language} + charset_name = self.ISO_WIN_MAP.get( + lower_charset_name, charset_name + ) + self.result = { + "encoding": charset_name, + "confidence": confidence, + "language": max_prober.language, + } # Log all prober confidences if none met MINIMUM_THRESHOLD if self.logger.getEffectiveLevel() == logging.DEBUG: - if self.result['encoding'] is None: - self.logger.debug('no probers hit minimum threshold') + if self.result["encoding"] is None: + self.logger.debug("no probers hit minimum threshold") for group_prober in self._charset_probers: if not group_prober: continue if isinstance(group_prober, CharSetGroupProber): for prober in group_prober.probers: - self.logger.debug('%s %s confidence = %s', - prober.charset_name, - prober.language, - prober.get_confidence()) + self.logger.debug( + "%s %s confidence = %s", + prober.charset_name, + prober.language, + prober.get_confidence(), + ) else: - self.logger.debug('%s %s confidence = %s', - prober.charset_name, - prober.language, - prober.get_confidence()) + self.logger.debug( + "%s %s confidence = %s", + prober.charset_name, + prober.language, + prober.get_confidence(), + ) return self.result diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/utf8prober.py b/src/fetchcode/vcs/pip/_vendor/chardet/utf8prober.py index 6c3196cc..e07ead9a 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/utf8prober.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/utf8prober.py @@ -31,7 +31,6 @@ from .mbcssm import UTF8_SM_MODEL - class UTF8Prober(CharSetProber): ONE_CHAR_PROB = 0.5 @@ -76,7 +75,7 @@ def feed(self, byte_str): def get_confidence(self): unlike = 0.99 if self._num_mb_chars < 6: - unlike *= self.ONE_CHAR_PROB ** self._num_mb_chars + unlike *= self.ONE_CHAR_PROB**self._num_mb_chars return 1.0 - unlike else: return unlike diff --git a/src/fetchcode/vcs/pip/_vendor/chardet/version.py b/src/fetchcode/vcs/pip/_vendor/chardet/version.py index bb2a34a7..01204e48 100644 --- a/src/fetchcode/vcs/pip/_vendor/chardet/version.py +++ b/src/fetchcode/vcs/pip/_vendor/chardet/version.py @@ -6,4 +6,4 @@ """ __version__ = "3.0.4" -VERSION = __version__.split('.') +VERSION = __version__.split(".") diff --git a/src/fetchcode/vcs/pip/_vendor/colorama.pyi b/src/fetchcode/vcs/pip/_vendor/colorama.pyi index 60a6c254..9058cbbb 100644 --- a/src/fetchcode/vcs/pip/_vendor/colorama.pyi +++ b/src/fetchcode/vcs/pip/_vendor/colorama.pyi @@ -1 +1 @@ -from colorama import * \ No newline at end of file +from colorama import * diff --git a/src/fetchcode/vcs/pip/_vendor/colorama/__init__.py b/src/fetchcode/vcs/pip/_vendor/colorama/__init__.py index 34c263cc..13b7bd60 100644 --- a/src/fetchcode/vcs/pip/_vendor/colorama/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/colorama/__init__.py @@ -3,4 +3,4 @@ from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 -__version__ = '0.4.3' +__version__ = "0.4.3" diff --git a/src/fetchcode/vcs/pip/_vendor/colorama/ansi.py b/src/fetchcode/vcs/pip/_vendor/colorama/ansi.py index 78776588..1da38979 100644 --- a/src/fetchcode/vcs/pip/_vendor/colorama/ansi.py +++ b/src/fetchcode/vcs/pip/_vendor/colorama/ansi.py @@ -1,25 +1,28 @@ # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. -''' +""" This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code -''' +""" -CSI = '\033[' -OSC = '\033]' -BEL = '\007' +CSI = "\033[" +OSC = "\033]" +BEL = "\007" def code_to_chars(code): - return CSI + str(code) + 'm' + return CSI + str(code) + "m" + def set_title(title): - return OSC + '2;' + title + BEL + return OSC + "2;" + title + BEL + def clear_screen(mode=2): - return CSI + str(mode) + 'J' + return CSI + str(mode) + "J" + def clear_line(mode=2): - return CSI + str(mode) + 'K' + return CSI + str(mode) + "K" class AnsiCodes(object): @@ -28,75 +31,80 @@ def __init__(self): # Upon instantiation we define instance attributes, which are the same # as the class attributes but wrapped with the ANSI escape sequence for name in dir(self): - if not name.startswith('_'): + if not name.startswith("_"): value = getattr(self, name) setattr(self, name, code_to_chars(value)) class AnsiCursor(object): def UP(self, n=1): - return CSI + str(n) + 'A' + return CSI + str(n) + "A" + def DOWN(self, n=1): - return CSI + str(n) + 'B' + return CSI + str(n) + "B" + def FORWARD(self, n=1): - return CSI + str(n) + 'C' + return CSI + str(n) + "C" + def BACK(self, n=1): - return CSI + str(n) + 'D' + return CSI + str(n) + "D" + def POS(self, x=1, y=1): - return CSI + str(y) + ';' + str(x) + 'H' + return CSI + str(y) + ";" + str(x) + "H" class AnsiFore(AnsiCodes): - BLACK = 30 - RED = 31 - GREEN = 32 - YELLOW = 33 - BLUE = 34 - MAGENTA = 35 - CYAN = 36 - WHITE = 37 - RESET = 39 + BLACK = 30 + RED = 31 + GREEN = 32 + YELLOW = 33 + BLUE = 34 + MAGENTA = 35 + CYAN = 36 + WHITE = 37 + RESET = 39 # These are fairly well supported, but not part of the standard. - LIGHTBLACK_EX = 90 - LIGHTRED_EX = 91 - LIGHTGREEN_EX = 92 - LIGHTYELLOW_EX = 93 - LIGHTBLUE_EX = 94 + LIGHTBLACK_EX = 90 + LIGHTRED_EX = 91 + LIGHTGREEN_EX = 92 + LIGHTYELLOW_EX = 93 + LIGHTBLUE_EX = 94 LIGHTMAGENTA_EX = 95 - LIGHTCYAN_EX = 96 - LIGHTWHITE_EX = 97 + LIGHTCYAN_EX = 96 + LIGHTWHITE_EX = 97 class AnsiBack(AnsiCodes): - BLACK = 40 - RED = 41 - GREEN = 42 - YELLOW = 43 - BLUE = 44 - MAGENTA = 45 - CYAN = 46 - WHITE = 47 - RESET = 49 + BLACK = 40 + RED = 41 + GREEN = 42 + YELLOW = 43 + BLUE = 44 + MAGENTA = 45 + CYAN = 46 + WHITE = 47 + RESET = 49 # These are fairly well supported, but not part of the standard. - LIGHTBLACK_EX = 100 - LIGHTRED_EX = 101 - LIGHTGREEN_EX = 102 - LIGHTYELLOW_EX = 103 - LIGHTBLUE_EX = 104 + LIGHTBLACK_EX = 100 + LIGHTRED_EX = 101 + LIGHTGREEN_EX = 102 + LIGHTYELLOW_EX = 103 + LIGHTBLUE_EX = 104 LIGHTMAGENTA_EX = 105 - LIGHTCYAN_EX = 106 - LIGHTWHITE_EX = 107 + LIGHTCYAN_EX = 106 + LIGHTWHITE_EX = 107 class AnsiStyle(AnsiCodes): - BRIGHT = 1 - DIM = 2 - NORMAL = 22 + BRIGHT = 1 + DIM = 2 + NORMAL = 22 RESET_ALL = 0 -Fore = AnsiFore() -Back = AnsiBack() -Style = AnsiStyle() + +Fore = AnsiFore() +Back = AnsiBack() +Style = AnsiStyle() Cursor = AnsiCursor() diff --git a/src/fetchcode/vcs/pip/_vendor/colorama/ansitowin32.py b/src/fetchcode/vcs/pip/_vendor/colorama/ansitowin32.py index 359c92be..80a83c16 100644 --- a/src/fetchcode/vcs/pip/_vendor/colorama/ansitowin32.py +++ b/src/fetchcode/vcs/pip/_vendor/colorama/ansitowin32.py @@ -14,11 +14,12 @@ class StreamWrapper(object): - ''' + """ Wraps a stream (such as stdout), acting as a transparent proxy for all attribute access apart from method 'write()', which is delegated to our Converter instance. - ''' + """ + def __init__(self, wrapped, converter): # double-underscore everything to prevent clashes with names of # attributes on the wrapped stream object. @@ -42,8 +43,10 @@ def write(self, text): def isatty(self): stream = self.__wrapped - if 'PYCHARM_HOSTED' in os.environ: - if stream is not None and (stream is sys.__stdout__ or stream is sys.__stderr__): + if "PYCHARM_HOSTED" in os.environ: + if stream is not None and ( + stream is sys.__stdout__ or stream is sys.__stderr__ + ): return True try: stream_isatty = stream.isatty @@ -62,13 +65,18 @@ def closed(self): class AnsiToWin32(object): - ''' + """ Implements a 'write()' method which, on Windows, will strip ANSI character sequences from the text, and if outputting to a tty, will convert them into win32 function calls. - ''' - ANSI_CSI_RE = re.compile('\001?\033\\[((?:\\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer - ANSI_OSC_RE = re.compile('\001?\033\\]((?:.|;)*?)(\x07)\002?') # Operating System Command + """ + + ANSI_CSI_RE = re.compile( + "\001?\033\\[((?:\\d|;)*)([a-zA-Z])\002?" + ) # Control Sequence Introducer + ANSI_OSC_RE = re.compile( + "\001?\033\\]((?:.|;)*?)(\x07)\002?" + ) # Operating System Command def __init__(self, wrapped, convert=None, strip=None, autoreset=False): # The wrapped stream (normally sys.stdout or sys.stderr) @@ -80,7 +88,7 @@ def __init__(self, wrapped, convert=None, strip=None, autoreset=False): # create the proxy wrapping our output stream self.stream = StreamWrapper(wrapped, self) - on_windows = os.name == 'nt' + on_windows = os.name == "nt" # We test if the WinAPI works, because even if we are on Windows # we may be using a terminal that doesn't support the WinAPI # (e.g. Cygwin Terminal). In this case it's up to the terminal @@ -89,12 +97,16 @@ def __init__(self, wrapped, convert=None, strip=None, autoreset=False): # should we strip ANSI sequences from our output? if strip is None: - strip = conversion_supported or (not self.stream.closed and not self.stream.isatty()) + strip = conversion_supported or ( + not self.stream.closed and not self.stream.isatty() + ) self.strip = strip # should we should convert ANSI sequences into win32 calls? if convert is None: - convert = conversion_supported and not self.stream.closed and self.stream.isatty() + convert = ( + conversion_supported and not self.stream.closed and self.stream.isatty() + ) self.convert = convert # dict of ansi codes to win32 functions and parameters @@ -104,19 +116,19 @@ def __init__(self, wrapped, convert=None, strip=None, autoreset=False): self.on_stderr = self.wrapped is sys.stderr def should_wrap(self): - ''' + """ True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requested using kwargs to init() - ''' + """ return self.convert or self.strip or self.autoreset def get_win32_calls(self): if self.convert and winterm: return { - AnsiStyle.RESET_ALL: (winterm.reset_all, ), + AnsiStyle.RESET_ALL: (winterm.reset_all,), AnsiStyle.BRIGHT: (winterm.style, WinStyle.BRIGHT), AnsiStyle.DIM: (winterm.style, WinStyle.NORMAL), AnsiStyle.NORMAL: (winterm.style, WinStyle.NORMAL), @@ -128,7 +140,7 @@ def get_win32_calls(self): AnsiFore.MAGENTA: (winterm.fore, WinColor.MAGENTA), AnsiFore.CYAN: (winterm.fore, WinColor.CYAN), AnsiFore.WHITE: (winterm.fore, WinColor.GREY), - AnsiFore.RESET: (winterm.fore, ), + AnsiFore.RESET: (winterm.fore,), AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True), AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True), AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True), @@ -145,7 +157,7 @@ def get_win32_calls(self): AnsiBack.MAGENTA: (winterm.back, WinColor.MAGENTA), AnsiBack.CYAN: (winterm.back, WinColor.CYAN), AnsiBack.WHITE: (winterm.back, WinColor.GREY), - AnsiBack.RESET: (winterm.back, ), + AnsiBack.RESET: (winterm.back,), AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True), AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True), AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True), @@ -166,20 +178,18 @@ def write(self, text): if self.autoreset: self.reset_all() - def reset_all(self): if self.convert: - self.call_win32('m', (0,)) + self.call_win32("m", (0,)) elif not self.strip and not self.stream.closed: self.wrapped.write(Style.RESET_ALL) - def write_and_convert(self, text): - ''' + """ Write the given text to our wrapped stream, stripping any ANSI sequences from the text, and optionally converting them into win32 calls. - ''' + """ cursor = 0 text = self.convert_osc(text) for match in self.ANSI_CSI_RE.finditer(text): @@ -189,39 +199,35 @@ def write_and_convert(self, text): cursor = end self.write_plain_text(text, cursor, len(text)) - def write_plain_text(self, text, start, end): if start < end: self.wrapped.write(text[start:end]) self.wrapped.flush() - def convert_ansi(self, paramstring, command): if self.convert: params = self.extract_params(command, paramstring) self.call_win32(command, params) - def extract_params(self, command, paramstring): - if command in 'Hf': - params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(';')) + if command in "Hf": + params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(";")) while len(params) < 2: # defaults: params = params + (1,) else: - params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0) + params = tuple(int(p) for p in paramstring.split(";") if len(p) != 0) if len(params) == 0: # defaults: - if command in 'JKm': + if command in "JKm": params = (0,) - elif command in 'ABCD': + elif command in "ABCD": params = (1,) return params - def call_win32(self, command, params): - if command == 'm': + if command == "m": for param in params: if param in self.win32_calls: func_args = self.win32_calls[param] @@ -229,29 +235,28 @@ def call_win32(self, command, params): args = func_args[1:] kwargs = dict(on_stderr=self.on_stderr) func(*args, **kwargs) - elif command in 'J': + elif command in "J": winterm.erase_screen(params[0], on_stderr=self.on_stderr) - elif command in 'K': + elif command in "K": winterm.erase_line(params[0], on_stderr=self.on_stderr) - elif command in 'Hf': # cursor position - absolute + elif command in "Hf": # cursor position - absolute winterm.set_cursor_position(params, on_stderr=self.on_stderr) - elif command in 'ABCD': # cursor position - relative + elif command in "ABCD": # cursor position - relative n = params[0] # A - up, B - down, C - forward, D - back - x, y = {'A': (0, -n), 'B': (0, n), 'C': (n, 0), 'D': (-n, 0)}[command] + x, y = {"A": (0, -n), "B": (0, n), "C": (n, 0), "D": (-n, 0)}[command] winterm.cursor_adjust(x, y, on_stderr=self.on_stderr) - def convert_osc(self, text): for match in self.ANSI_OSC_RE.finditer(text): start, end = match.span() text = text[:start] + text[end:] paramstring, command = match.groups() - if command in '\x07': # \x07 = BEL + if command in "\x07": # \x07 = BEL params = paramstring.split(";") # 0 - change title and icon (we will only change title) # 1 - change icon (we don't support this) # 2 - change title - if params[0] in '02': + if params[0] in "02": winterm.set_title(params[1]) return text diff --git a/src/fetchcode/vcs/pip/_vendor/colorama/initialise.py b/src/fetchcode/vcs/pip/_vendor/colorama/initialise.py index 430d0668..4ab14aed 100644 --- a/src/fetchcode/vcs/pip/_vendor/colorama/initialise.py +++ b/src/fetchcode/vcs/pip/_vendor/colorama/initialise.py @@ -16,14 +16,14 @@ def reset_all(): - if AnsiToWin32 is not None: # Issue #74: objects might become None at exit + if AnsiToWin32 is not None: # Issue #74: objects might become None at exit AnsiToWin32(orig_stdout).reset_all() def init(autoreset=False, convert=None, strip=None, wrap=True): if not wrap and any([autoreset, convert, strip]): - raise ValueError('wrap=False conflicts with any other arg=True') + raise ValueError("wrap=False conflicts with any other arg=True") global wrapped_stdout, wrapped_stderr global orig_stdout, orig_stderr @@ -34,13 +34,15 @@ def init(autoreset=False, convert=None, strip=None, wrap=True): if sys.stdout is None: wrapped_stdout = None else: - sys.stdout = wrapped_stdout = \ - wrap_stream(orig_stdout, convert, strip, autoreset, wrap) + sys.stdout = wrapped_stdout = wrap_stream( + orig_stdout, convert, strip, autoreset, wrap + ) if sys.stderr is None: wrapped_stderr = None else: - sys.stderr = wrapped_stderr = \ - wrap_stream(orig_stderr, convert, strip, autoreset, wrap) + sys.stderr = wrapped_stderr = wrap_stream( + orig_stderr, convert, strip, autoreset, wrap + ) global atexit_done if not atexit_done: @@ -73,8 +75,7 @@ def reinit(): def wrap_stream(stream, convert, strip, autoreset, wrap): if wrap: - wrapper = AnsiToWin32(stream, - convert=convert, strip=strip, autoreset=autoreset) + wrapper = AnsiToWin32(stream, convert=convert, strip=strip, autoreset=autoreset) if wrapper.should_wrap(): stream = wrapper.stream return stream diff --git a/src/fetchcode/vcs/pip/_vendor/colorama/win32.py b/src/fetchcode/vcs/pip/_vendor/colorama/win32.py index c2d83603..3f64749b 100644 --- a/src/fetchcode/vcs/pip/_vendor/colorama/win32.py +++ b/src/fetchcode/vcs/pip/_vendor/colorama/win32.py @@ -7,6 +7,7 @@ try: import ctypes from ctypes import LibraryLoader + windll = LibraryLoader(ctypes.WinDLL) from ctypes import wintypes except (AttributeError, ImportError): @@ -20,6 +21,7 @@ class CONSOLE_SCREEN_BUFFER_INFO(Structure): """struct in wincon.h.""" + _fields_ = [ ("dwSize", COORD), ("dwCursorPosition", COORD), @@ -27,13 +29,20 @@ class CONSOLE_SCREEN_BUFFER_INFO(Structure): ("srWindow", wintypes.SMALL_RECT), ("dwMaximumWindowSize", COORD), ] + def __str__(self): - return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % ( - self.dwSize.Y, self.dwSize.X - , self.dwCursorPosition.Y, self.dwCursorPosition.X - , self.wAttributes - , self.srWindow.Top, self.srWindow.Left, self.srWindow.Bottom, self.srWindow.Right - , self.dwMaximumWindowSize.Y, self.dwMaximumWindowSize.X + return "(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)" % ( + self.dwSize.Y, + self.dwSize.X, + self.dwCursorPosition.Y, + self.dwCursorPosition.X, + self.wAttributes, + self.srWindow.Top, + self.srWindow.Left, + self.srWindow.Bottom, + self.srWindow.Right, + self.dwMaximumWindowSize.Y, + self.dwMaximumWindowSize.X, ) _GetStdHandle = windll.kernel32.GetStdHandle @@ -84,26 +93,23 @@ def __str__(self): _FillConsoleOutputAttribute.restype = wintypes.BOOL _SetConsoleTitleW = windll.kernel32.SetConsoleTitleW - _SetConsoleTitleW.argtypes = [ - wintypes.LPCWSTR - ] + _SetConsoleTitleW.argtypes = [wintypes.LPCWSTR] _SetConsoleTitleW.restype = wintypes.BOOL def _winapi_test(handle): csbi = CONSOLE_SCREEN_BUFFER_INFO() - success = _GetConsoleScreenBufferInfo( - handle, byref(csbi)) + success = _GetConsoleScreenBufferInfo(handle, byref(csbi)) return bool(success) def winapi_test(): - return any(_winapi_test(h) for h in - (_GetStdHandle(STDOUT), _GetStdHandle(STDERR))) + return any( + _winapi_test(h) for h in (_GetStdHandle(STDOUT), _GetStdHandle(STDERR)) + ) def GetConsoleScreenBufferInfo(stream_id=STDOUT): handle = _GetStdHandle(stream_id) csbi = CONSOLE_SCREEN_BUFFER_INFO() - success = _GetConsoleScreenBufferInfo( - handle, byref(csbi)) + success = _GetConsoleScreenBufferInfo(handle, byref(csbi)) return csbi def SetConsoleTextAttribute(stream_id, attrs): @@ -135,18 +141,20 @@ def FillConsoleOutputCharacter(stream_id, char, length, start): num_written = wintypes.DWORD(0) # Note that this is hard-coded for ANSI (vs wide) bytes. success = _FillConsoleOutputCharacterA( - handle, char, length, start, byref(num_written)) + handle, char, length, start, byref(num_written) + ) return num_written.value def FillConsoleOutputAttribute(stream_id, attr, length, start): - ''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )''' + """FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )""" handle = _GetStdHandle(stream_id) attribute = wintypes.WORD(attr) length = wintypes.DWORD(length) num_written = wintypes.DWORD(0) # Note that this is hard-coded for ANSI (vs wide) bytes. return _FillConsoleOutputAttribute( - handle, attribute, length, start, byref(num_written)) + handle, attribute, length, start, byref(num_written) + ) def SetConsoleTitle(title): return _SetConsoleTitleW(title) diff --git a/src/fetchcode/vcs/pip/_vendor/colorama/winterm.py b/src/fetchcode/vcs/pip/_vendor/colorama/winterm.py index 0fdb4ec4..0c04371f 100644 --- a/src/fetchcode/vcs/pip/_vendor/colorama/winterm.py +++ b/src/fetchcode/vcs/pip/_vendor/colorama/winterm.py @@ -4,23 +4,24 @@ # from wincon.h class WinColor(object): - BLACK = 0 - BLUE = 1 - GREEN = 2 - CYAN = 3 - RED = 4 + BLACK = 0 + BLUE = 1 + GREEN = 2 + CYAN = 3 + RED = 4 MAGENTA = 5 - YELLOW = 6 - GREY = 7 + YELLOW = 6 + GREY = 7 + # from wincon.h class WinStyle(object): - NORMAL = 0x00 # dim text, dim background - BRIGHT = 0x08 # bright text, dim background - BRIGHT_BACKGROUND = 0x80 # dim text, bright background + NORMAL = 0x00 # dim text, dim background + BRIGHT = 0x08 # bright text, dim background + BRIGHT_BACKGROUND = 0x80 # dim text, bright background -class WinTerm(object): +class WinTerm(object): def __init__(self): self._default = win32.GetConsoleScreenBufferInfo(win32.STDOUT).wAttributes self.set_attrs(self._default) @@ -119,7 +120,9 @@ def erase_screen(self, mode=0, on_stderr=False): # get the number of character cells in the current buffer cells_in_screen = csbi.dwSize.X * csbi.dwSize.Y # get number of character cells before current cursor position - cells_before_cursor = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X + cells_before_cursor = ( + csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X + ) if mode == 0: from_coord = csbi.dwCursorPosition cells_to_erase = cells_in_screen - cells_before_cursor @@ -133,9 +136,11 @@ def erase_screen(self, mode=0, on_stderr=False): # invalid mode return # fill the entire screen with blanks - win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) + win32.FillConsoleOutputCharacter(handle, " ", cells_to_erase, from_coord) # now set the buffer's attributes accordingly - win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord) + win32.FillConsoleOutputAttribute( + handle, self.get_attrs(), cells_to_erase, from_coord + ) if mode == 2: # put the cursor where needed win32.SetConsoleCursorPosition(handle, (1, 1)) @@ -161,9 +166,11 @@ def erase_line(self, mode=0, on_stderr=False): # invalid mode return # fill the entire screen with blanks - win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) + win32.FillConsoleOutputCharacter(handle, " ", cells_to_erase, from_coord) # now set the buffer's attributes accordingly - win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord) + win32.FillConsoleOutputAttribute( + handle, self.get_attrs(), cells_to_erase, from_coord + ) def set_title(self, title): win32.SetConsoleTitle(title) diff --git a/src/fetchcode/vcs/pip/_vendor/contextlib2.py b/src/fetchcode/vcs/pip/_vendor/contextlib2.py index 3aae8f41..93a5ac93 100644 --- a/src/fetchcode/vcs/pip/_vendor/contextlib2.py +++ b/src/fetchcode/vcs/pip/_vendor/contextlib2.py @@ -6,10 +6,17 @@ from collections import deque from functools import wraps -__all__ = ["contextmanager", "closing", "nullcontext", - "AbstractContextManager", - "ContextDecorator", "ExitStack", - "redirect_stdout", "redirect_stderr", "suppress"] +__all__ = [ + "contextmanager", + "closing", + "nullcontext", + "AbstractContextManager", + "ContextDecorator", + "ExitStack", + "redirect_stdout", + "redirect_stderr", + "suppress", +] # Backwards compatibility __all__ += ["ContextStack"] @@ -19,7 +26,7 @@ if sys.version_info[:2] >= (3, 4): _abc_ABC = abc.ABC else: - _abc_ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()}) + _abc_ABC = abc.ABCMeta("ABC", (object,), {"__slots__": ()}) # Backport classic class MRO @@ -86,8 +93,9 @@ def refresh_cm(self): DEPRECATED: refresh_cm was never added to the standard library's ContextDecorator API """ - warnings.warn("refresh_cm was never added to the standard library", - DeprecationWarning) + warnings.warn( + "refresh_cm was never added to the standard library", DeprecationWarning + ) return self._recreate_cm() def _recreate_cm(self): @@ -107,6 +115,7 @@ def __call__(self, func): def inner(*args, **kwds): with self._recreate_cm(): return func(*args, **kwds) + return inner @@ -210,9 +219,11 @@ def some_generator(): """ + @wraps(func) def helper(*args, **kwds): return _GeneratorContextManager(func, args, kwds) + return helper @@ -233,6 +244,7 @@ class closing(object): f.close() """ + def __init__(self, thing): self.thing = thing @@ -264,14 +276,14 @@ def __exit__(self, exctype, excinst, exctb): class redirect_stdout(_RedirectStream): """Context manager for temporarily redirecting stdout to another file. - # How to send help() to stderr - with redirect_stdout(sys.stderr): - help(dir) + # How to send help() to stderr + with redirect_stdout(sys.stderr): + help(dir) - # How to write help() to a file - with open('help.txt', 'w') as f: - with redirect_stdout(f): - help(pow) + # How to write help() to a file + with open('help.txt', 'w') as f: + with redirect_stdout(f): + help(pow) """ _stream = "stdout" @@ -316,6 +328,7 @@ def __exit__(self, exctype, excinst, exctb): # Context manipulation is Python 3 only _HAVE_EXCEPTION_CHAINING = sys.version_info[0] >= 3 if _HAVE_EXCEPTION_CHAINING: + def _make_context_fixer(frame_exc): def _fix_exception_context(new_exc, old_exc): # Context may not be correct, so find the end of the chain @@ -330,6 +343,7 @@ def _fix_exception_context(new_exc, old_exc): # Change the end of the chain to point to the exception # we expect it to reference new_exc.__context__ = old_exc + return _fix_exception_context def _reraise_with_existing_context(exc_details): @@ -341,6 +355,7 @@ def _reraise_with_existing_context(exc_details): except BaseException: exc_details[1].__context__ = fixed_ctx raise + else: # No exception context in Python 2 def _make_context_fixer(frame_exc): @@ -352,6 +367,7 @@ def _reraise_with_existing_context(exc_details): exc_type, exc_value, exc_tb = exc_details exec("raise exc_type, exc_value, exc_tb") + # Handle old-style classes if they exist try: from types import InstanceType @@ -380,6 +396,7 @@ class ExitStack(object): # in the list raise an exception """ + def __init__(self): self._exit_callbacks = deque() @@ -392,8 +409,10 @@ def pop_all(self): def _push_cm_exit(self, cm, cm_exit): """Helper to correctly register callbacks to __exit__ methods""" + def _exit_wrapper(*exc_details): return cm_exit(cm, *exc_details) + _exit_wrapper.__self__ = cm self.push(_exit_wrapper) @@ -415,20 +434,22 @@ def push(self, exit): self._exit_callbacks.append(exit) else: self._push_cm_exit(exit, exit_method) - return exit # Allow use as a decorator + return exit # Allow use as a decorator def callback(self, callback, *args, **kwds): """Registers an arbitrary callback and arguments. Cannot suppress exceptions. """ + def _exit_wrapper(exc_type, exc, tb): callback(*args, **kwds) + # We changed the signature, so using @wraps is not appropriate, but # setting __wrapped__ may still help with introspection _exit_wrapper.__wrapped__ = callback self.push(_exit_wrapper) - return callback # Allow use as a decorator + return callback # Allow use as a decorator def enter_context(self, cm): """Enters the supplied context manager @@ -485,8 +506,7 @@ class ContextStack(ExitStack): """Backwards compatibility alias for ExitStack""" def __init__(self): - warnings.warn("ContextStack has been renamed to ExitStack", - DeprecationWarning) + warnings.warn("ContextStack has been renamed to ExitStack", DeprecationWarning) super(ContextStack, self).__init__() def register_exit(self, callback): diff --git a/src/fetchcode/vcs/pip/_vendor/distlib.pyi b/src/fetchcode/vcs/pip/_vendor/distlib.pyi index ea94b159..a8435de4 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib.pyi +++ b/src/fetchcode/vcs/pip/_vendor/distlib.pyi @@ -1 +1 @@ -from distlib import * \ No newline at end of file +from distlib import * diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/__init__.py b/src/fetchcode/vcs/pip/_vendor/distlib/__init__.py index e19aebdc..49ca70ff 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/__init__.py @@ -6,18 +6,27 @@ # import logging -__version__ = '0.3.0' +__version__ = "0.3.0" + class DistlibException(Exception): pass + try: from logging import NullHandler -except ImportError: # pragma: no cover +except ImportError: # pragma: no cover + class NullHandler(logging.Handler): - def handle(self, record): pass - def emit(self, record): pass - def createLock(self): self.lock = None + def handle(self, record): + pass + + def emit(self, record): + pass + + def createLock(self): + self.lock = None + logger = logging.getLogger(__name__) logger.addHandler(NullHandler()) diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/misc.py b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/misc.py index cfb318d3..1489837d 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/misc.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/misc.py @@ -8,14 +8,15 @@ import os import sys -__all__ = ['cache_from_source', 'callable', 'fsencode'] +__all__ = ["cache_from_source", "callable", "fsencode"] try: from imp import cache_from_source except ImportError: + def cache_from_source(py_file, debug=__debug__): - ext = debug and 'c' or 'o' + ext = debug and "c" or "o" return py_file + ext @@ -31,11 +32,11 @@ def callable(obj): try: fsencode = os.fsencode except AttributeError: + def fsencode(filename): if isinstance(filename, bytes): return filename elif isinstance(filename, str): return filename.encode(sys.getfilesystemencoding()) else: - raise TypeError("expect bytes or str, not %s" % - type(filename).__name__) + raise TypeError("expect bytes or str, not %s" % type(filename).__name__) diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/shutil.py b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/shutil.py index 159e49ee..dc568b93 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/shutil.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/shutil.py @@ -20,6 +20,7 @@ try: import bz2 + _BZ2_SUPPORTED = True except ImportError: _BZ2_SUPPORTED = False @@ -34,26 +35,48 @@ except ImportError: getgrnam = None -__all__ = ["copyfileobj", "copyfile", "copymode", "copystat", "copy", "copy2", - "copytree", "move", "rmtree", "Error", "SpecialFileError", - "ExecError", "make_archive", "get_archive_formats", - "register_archive_format", "unregister_archive_format", - "get_unpack_formats", "register_unpack_format", - "unregister_unpack_format", "unpack_archive", "ignore_patterns"] +__all__ = [ + "copyfileobj", + "copyfile", + "copymode", + "copystat", + "copy", + "copy2", + "copytree", + "move", + "rmtree", + "Error", + "SpecialFileError", + "ExecError", + "make_archive", + "get_archive_formats", + "register_archive_format", + "unregister_archive_format", + "get_unpack_formats", + "register_unpack_format", + "unregister_unpack_format", + "unpack_archive", + "ignore_patterns", +] + class Error(EnvironmentError): pass + class SpecialFileError(EnvironmentError): """Raised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)""" + class ExecError(EnvironmentError): """Raised when a command could not be executed""" + class ReadError(EnvironmentError): """Raised when an archive cannot be read""" + class RegistryError(Exception): """Raised when a registry operation with the archiving and unpacking registries fails""" @@ -64,7 +87,8 @@ class RegistryError(Exception): except NameError: WindowsError = None -def copyfileobj(fsrc, fdst, length=16*1024): + +def copyfileobj(fsrc, fdst, length=16 * 1024): """copy data from file-like object fsrc to file-like object fdst""" while 1: buf = fsrc.read(length) @@ -72,17 +96,20 @@ def copyfileobj(fsrc, fdst, length=16*1024): break fdst.write(buf) + def _samefile(src, dst): # Macintosh, Unix. - if hasattr(os.path, 'samefile'): + if hasattr(os.path, "samefile"): try: return os.path.samefile(src, dst) except OSError: return False # All other platforms: check for same pathname. - return (os.path.normcase(os.path.abspath(src)) == - os.path.normcase(os.path.abspath(dst))) + return os.path.normcase(os.path.abspath(src)) == os.path.normcase( + os.path.abspath(dst) + ) + def copyfile(src, dst): """Copy data from src to dst""" @@ -100,33 +127,35 @@ def copyfile(src, dst): if stat.S_ISFIFO(st.st_mode): raise SpecialFileError("`%s` is a named pipe" % fn) - with open(src, 'rb') as fsrc: - with open(dst, 'wb') as fdst: + with open(src, "rb") as fsrc: + with open(dst, "wb") as fdst: copyfileobj(fsrc, fdst) + def copymode(src, dst): """Copy mode bits from src to dst""" - if hasattr(os, 'chmod'): + if hasattr(os, "chmod"): st = os.stat(src) mode = stat.S_IMODE(st.st_mode) os.chmod(dst, mode) + def copystat(src, dst): """Copy all stat info (mode bits, atime, mtime, flags) from src to dst""" st = os.stat(src) mode = stat.S_IMODE(st.st_mode) - if hasattr(os, 'utime'): + if hasattr(os, "utime"): os.utime(dst, (st.st_atime, st.st_mtime)) - if hasattr(os, 'chmod'): + if hasattr(os, "chmod"): os.chmod(dst, mode) - if hasattr(os, 'chflags') and hasattr(st, 'st_flags'): + if hasattr(os, "chflags") and hasattr(st, "st_flags"): try: os.chflags(dst, st.st_flags) except OSError as why: - if (not hasattr(errno, 'EOPNOTSUPP') or - why.errno != errno.EOPNOTSUPP): + if not hasattr(errno, "EOPNOTSUPP") or why.errno != errno.EOPNOTSUPP: raise + def copy(src, dst): """Copy data and mode bits ("cp src dst"). @@ -138,6 +167,7 @@ def copy(src, dst): copyfile(src, dst) copymode(src, dst) + def copy2(src, dst): """Copy data and all stat info ("cp -p src dst"). @@ -149,20 +179,30 @@ def copy2(src, dst): copyfile(src, dst) copystat(src, dst) + def ignore_patterns(*patterns): """Function that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude files""" + def _ignore_patterns(path, names): ignored_names = [] for pattern in patterns: ignored_names.extend(fnmatch.filter(names, pattern)) return set(ignored_names) + return _ignore_patterns -def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, - ignore_dangling_symlinks=False): + +def copytree( + src, + dst, + symlinks=False, + ignore=None, + copy_function=copy2, + ignore_dangling_symlinks=False, +): """Recursively copy a directory tree. The destination directory must not already exist. @@ -243,6 +283,7 @@ def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, if errors: raise Error(errors) + def rmtree(path, ignore_errors=False, onerror=None): """Recursively delete a directory tree. @@ -255,11 +296,15 @@ def rmtree(path, ignore_errors=False, onerror=None): """ if ignore_errors: + def onerror(*args): pass + elif onerror is None: + def onerror(*args): raise + try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 @@ -297,6 +342,7 @@ def _basename(path): # Thus we always get the last component of the path, even for directories. return os.path.basename(path.rstrip(os.path.sep)) + def move(src, dst): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. @@ -330,13 +376,16 @@ def move(src, dst): except OSError: if os.path.isdir(src): if _destinsrc(src, dst): - raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst)) + raise Error( + "Cannot move a directory '%s' into itself '%s'." % (src, dst) + ) copytree(src, real_dst, symlinks=True) rmtree(src) else: copy2(src, real_dst) os.unlink(src) + def _destinsrc(src, dst): src = abspath(src) dst = abspath(dst) @@ -346,6 +395,7 @@ def _destinsrc(src, dst): dst += os.path.sep return dst.startswith(src) + def _get_gid(name): """Returns a gid, given a group name.""" if getgrnam is None or name is None: @@ -358,6 +408,7 @@ def _get_gid(name): return result[2] return None + def _get_uid(name): """Returns an uid, given a user name.""" if getpwnam is None or name is None: @@ -370,8 +421,17 @@ def _get_uid(name): return result[2] return None -def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, - owner=None, group=None, logger=None): + +def _make_tarball( + base_name, + base_dir, + compress="gzip", + verbose=0, + dry_run=0, + owner=None, + group=None, + logger=None, +): """Create a (possibly compressed) tar file from all the files under 'base_dir'. @@ -386,19 +446,21 @@ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, Returns the output filename. """ - tar_compression = {'gzip': 'gz', None: ''} - compress_ext = {'gzip': '.gz'} + tar_compression = {"gzip": "gz", None: ""} + compress_ext = {"gzip": ".gz"} if _BZ2_SUPPORTED: - tar_compression['bzip2'] = 'bz2' - compress_ext['bzip2'] = '.bz2' + tar_compression["bzip2"] = "bz2" + compress_ext["bzip2"] = ".bz2" # flags for compression program, each element of list will be an argument if compress is not None and compress not in compress_ext: - raise ValueError("bad value for 'compress', or compression format not " - "supported : {0}".format(compress)) + raise ValueError( + "bad value for 'compress', or compression format not " + "supported : {0}".format(compress) + ) - archive_name = base_name + '.tar' + compress_ext.get(compress, '') + archive_name = base_name + ".tar" + compress_ext.get(compress, "") archive_dir = os.path.dirname(archive_name) if not os.path.exists(archive_dir): @@ -409,7 +471,7 @@ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, # creating the tarball if logger is not None: - logger.info('Creating tar archive') + logger.info("Creating tar archive") uid = _get_uid(owner) gid = _get_gid(group) @@ -424,7 +486,7 @@ def _set_uid_gid(tarinfo): return tarinfo if not dry_run: - tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) + tar = tarfile.open(archive_name, "w|%s" % tar_compression[compress]) try: tar.add(base_dir, filter=_set_uid_gid) finally: @@ -432,6 +494,7 @@ def _set_uid_gid(tarinfo): return archive_name + def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False): # XXX see if we want to keep an external call here if verbose: @@ -440,14 +503,18 @@ def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False): zipoptions = "-rq" from distutils.errors import DistutilsExecError from distutils.spawn import spawn + try: spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed". - raise ExecError("unable to create zip file '%s': " + raise ExecError( + "unable to create zip file '%s': " "could neither import the 'zipfile' module nor " - "find a standalone zip utility") % zip_filename + "find a standalone zip utility" + ) % zip_filename + def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): """Create a zip file from all the files under 'base_dir'. @@ -478,12 +545,10 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): _call_external_zip(base_dir, zip_filename, verbose, dry_run) else: if logger is not None: - logger.info("creating '%s' and adding '%s' to it", - zip_filename, base_dir) + logger.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) if not dry_run: - zip = zipfile.ZipFile(zip_filename, "w", - compression=zipfile.ZIP_DEFLATED) + zip = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) for dirpath, dirnames, filenames in os.walk(base_dir): for name in filenames: @@ -496,28 +561,33 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): return zip_filename + _ARCHIVE_FORMATS = { - 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), - 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), - 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), - 'zip': (_make_zipfile, [], "ZIP file"), - } + "gztar": (_make_tarball, [("compress", "gzip")], "gzip'ed tar-file"), + "bztar": (_make_tarball, [("compress", "bzip2")], "bzip2'ed tar-file"), + "tar": (_make_tarball, [("compress", None)], "uncompressed tar file"), + "zip": (_make_zipfile, [], "ZIP file"), +} if _BZ2_SUPPORTED: - _ARCHIVE_FORMATS['bztar'] = (_make_tarball, [('compress', 'bzip2')], - "bzip2'ed tar-file") + _ARCHIVE_FORMATS["bztar"] = ( + _make_tarball, + [("compress", "bzip2")], + "bzip2'ed tar-file", + ) + def get_archive_formats(): """Returns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description) """ - formats = [(name, registry[2]) for name, registry in - _ARCHIVE_FORMATS.items()] + formats = [(name, registry[2]) for name, registry in _ARCHIVE_FORMATS.items()] formats.sort() return formats -def register_archive_format(name, function, extra_args=None, description=''): + +def register_archive_format(name, function, extra_args=None, description=""): """Registers an archive format. name is the name of the format. function is the callable that will be @@ -529,20 +599,31 @@ def register_archive_format(name, function, extra_args=None, description=''): if extra_args is None: extra_args = [] if not isinstance(function, collections.Callable): - raise TypeError('The %s object is not callable' % function) + raise TypeError("The %s object is not callable" % function) if not isinstance(extra_args, (tuple, list)): - raise TypeError('extra_args needs to be a sequence') + raise TypeError("extra_args needs to be a sequence") for element in extra_args: - if not isinstance(element, (tuple, list)) or len(element) !=2: - raise TypeError('extra_args elements are : (arg_name, value)') + if not isinstance(element, (tuple, list)) or len(element) != 2: + raise TypeError("extra_args elements are : (arg_name, value)") _ARCHIVE_FORMATS[name] = (function, extra_args, description) + def unregister_archive_format(name): del _ARCHIVE_FORMATS[name] -def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, - dry_run=0, owner=None, group=None, logger=None): + +def make_archive( + base_name, + format, + root_dir=None, + base_dir=None, + verbose=0, + dry_run=0, + owner=None, + group=None, + logger=None, +): """Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific @@ -570,7 +651,7 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, if base_dir is None: base_dir = os.curdir - kwargs = {'dry_run': dry_run, 'logger': logger} + kwargs = {"dry_run": dry_run, "logger": logger} try: format_info = _ARCHIVE_FORMATS[format] @@ -581,9 +662,9 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, for arg, val in format_info[1]: kwargs[arg] = val - if format != 'zip': - kwargs['owner'] = owner - kwargs['group'] = group + if format != "zip": + kwargs["owner"] = owner + kwargs["group"] = group try: filename = func(base_name, base_dir, **kwargs) @@ -602,11 +683,11 @@ def get_unpack_formats(): Each element of the returned sequence is a tuple (name, extensions, description) """ - formats = [(name, info[0], info[3]) for name, info in - _UNPACK_FORMATS.items()] + formats = [(name, info[0], info[3]) for name, info in _UNPACK_FORMATS.items()] formats.sort() return formats + def _check_unpack_options(extensions, function, extra_args): """Checks what gets registered as an unpacker.""" # first make sure no other unpacker is registered for this extension @@ -618,15 +699,13 @@ def _check_unpack_options(extensions, function, extra_args): for extension in extensions: if extension in existing_extensions: msg = '%s is already registered for "%s"' - raise RegistryError(msg % (extension, - existing_extensions[extension])) + raise RegistryError(msg % (extension, existing_extensions[extension])) if not isinstance(function, collections.Callable): - raise TypeError('The registered function must be a callable') + raise TypeError("The registered function must be a callable") -def register_unpack_format(name, extensions, function, extra_args=None, - description=''): +def register_unpack_format(name, extensions, function, extra_args=None, description=""): """Registers an unpack format. `name` is the name of the format. `extensions` is a list of extensions @@ -647,23 +726,25 @@ def register_unpack_format(name, extensions, function, extra_args=None, _check_unpack_options(extensions, function, extra_args) _UNPACK_FORMATS[name] = extensions, function, extra_args, description + def unregister_unpack_format(name): """Removes the pack format from the registry.""" del _UNPACK_FORMATS[name] + def _ensure_directory(path): """Ensure that the parent directory of `path` exists""" dirname = os.path.dirname(path) if not os.path.isdir(dirname): os.makedirs(dirname) + def _unpack_zipfile(filename, extract_dir): - """Unpack zip `filename` to `extract_dir` - """ + """Unpack zip `filename` to `extract_dir`""" try: import zipfile except ImportError: - raise ReadError('zlib not supported, cannot unpack this archive.') + raise ReadError("zlib not supported, cannot unpack this archive.") if not zipfile.is_zipfile(filename): raise ReadError("%s is not a zip file" % filename) @@ -674,18 +755,18 @@ def _unpack_zipfile(filename, extract_dir): name = info.filename # don't extract absolute paths or ones with .. in them - if name.startswith('/') or '..' in name: + if name.startswith("/") or ".." in name: continue - target = os.path.join(extract_dir, *name.split('/')) + target = os.path.join(extract_dir, *name.split("/")) if not target: continue _ensure_directory(target) - if not name.endswith('/'): + if not name.endswith("/"): # file data = zip.read(info.filename) - f = open(target, 'wb') + f = open(target, "wb") try: f.write(data) finally: @@ -694,28 +775,28 @@ def _unpack_zipfile(filename, extract_dir): finally: zip.close() + def _unpack_tarfile(filename, extract_dir): - """Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` - """ + """Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir`""" try: tarobj = tarfile.open(filename) except tarfile.TarError: - raise ReadError( - "%s is not a compressed or uncompressed tar file" % filename) + raise ReadError("%s is not a compressed or uncompressed tar file" % filename) try: tarobj.extractall(extract_dir) finally: tarobj.close() + _UNPACK_FORMATS = { - 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), - 'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"), - 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file") - } + "gztar": ([".tar.gz", ".tgz"], _unpack_tarfile, [], "gzip'ed tar-file"), + "tar": ([".tar"], _unpack_tarfile, [], "uncompressed tar file"), + "zip": ([".zip"], _unpack_zipfile, [], "ZIP file"), +} if _BZ2_SUPPORTED: - _UNPACK_FORMATS['bztar'] = (['.bz2'], _unpack_tarfile, [], - "bzip2'ed tar-file") + _UNPACK_FORMATS["bztar"] = ([".bz2"], _unpack_tarfile, [], "bzip2'ed tar-file") + def _find_unpack_format(filename): for name, info in _UNPACK_FORMATS.items(): @@ -724,6 +805,7 @@ def _find_unpack_format(filename): return name return None + def unpack_archive(filename, extract_dir=None, format=None): """Unpack an archive. diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/sysconfig.py b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/sysconfig.py index b470a373..d00ceffa 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/sysconfig.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/sysconfig.py @@ -10,6 +10,7 @@ import re import sys from os.path import pardir, realpath + try: import configparser except ImportError: @@ -17,17 +18,17 @@ __all__ = [ - 'get_config_h_filename', - 'get_config_var', - 'get_config_vars', - 'get_makefile_filename', - 'get_path', - 'get_path_names', - 'get_paths', - 'get_platform', - 'get_python_version', - 'get_scheme_names', - 'parse_config_h', + "get_config_h_filename", + "get_config_var", + "get_config_vars", + "get_makefile_filename", + "get_path", + "get_path_names", + "get_paths", + "get_platform", + "get_python_version", + "get_scheme_names", + "parse_config_h", ] @@ -61,47 +62,51 @@ def is_python_build(): return True return False + _PYTHON_BUILD = is_python_build() _cfg_read = False + def _ensure_cfg_read(): global _cfg_read if not _cfg_read: from ..resources import finder - backport_package = __name__.rsplit('.', 1)[0] + + backport_package = __name__.rsplit(".", 1)[0] _finder = finder(backport_package) - _cfgfile = _finder.find('sysconfig.cfg') - assert _cfgfile, 'sysconfig.cfg exists' + _cfgfile = _finder.find("sysconfig.cfg") + assert _cfgfile, "sysconfig.cfg exists" with _cfgfile.as_stream() as s: _SCHEMES.readfp(s) if _PYTHON_BUILD: - for scheme in ('posix_prefix', 'posix_home'): - _SCHEMES.set(scheme, 'include', '{srcdir}/Include') - _SCHEMES.set(scheme, 'platinclude', '{projectbase}/.') + for scheme in ("posix_prefix", "posix_home"): + _SCHEMES.set(scheme, "include", "{srcdir}/Include") + _SCHEMES.set(scheme, "platinclude", "{projectbase}/.") _cfg_read = True _SCHEMES = configparser.RawConfigParser() -_VAR_REPL = re.compile(r'\{([^{]*?)\}') +_VAR_REPL = re.compile(r"\{([^{]*?)\}") + def _expand_globals(config): _ensure_cfg_read() - if config.has_section('globals'): - globals = config.items('globals') + if config.has_section("globals"): + globals = config.items("globals") else: globals = tuple() sections = config.sections() for section in sections: - if section == 'globals': + if section == "globals": continue for option, value in globals: if config.has_option(section, option): continue config.set(section, option, value) - config.remove_section('globals') + config.remove_section("globals") # now expanding local variables defined in the cfg file # @@ -117,11 +122,12 @@ def _replacer(matchobj): for option, value in config.items(section): config.set(section, option, _VAR_REPL.sub(_replacer, value)) -#_expand_globals(_SCHEMES) -_PY_VERSION = '%s.%s.%s' % sys.version_info[:3] -_PY_VERSION_SHORT = '%s.%s' % sys.version_info[:2] -_PY_VERSION_SHORT_NO_DOT = '%s%s' % sys.version_info[:2] +# _expand_globals(_SCHEMES) + +_PY_VERSION = "%s.%s.%s" % sys.version_info[:3] +_PY_VERSION_SHORT = "%s.%s" % sys.version_info[:2] +_PY_VERSION_SHORT_NO_DOT = "%s%s" % sys.version_info[:2] _PREFIX = os.path.normpath(sys.prefix) _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) _CONFIG_VARS = None @@ -134,6 +140,7 @@ def _subst_vars(path, local_vars): If there is no corresponding value, leave the token unchanged. """ + def _replacer(matchobj): name = matchobj.group(1) if name in local_vars: @@ -141,6 +148,7 @@ def _replacer(matchobj): elif name in os.environ: return os.environ[name] return matchobj.group(0) + return _VAR_REPL.sub(_replacer, path) @@ -159,7 +167,7 @@ def _expand_vars(scheme, vars): _extend_dict(vars, get_config_vars()) for key, value in _SCHEMES.items(scheme): - if os.name in ('posix', 'nt'): + if os.name in ("posix", "nt"): value = os.path.expanduser(value) res[key] = os.path.normpath(_subst_vars(value, vars)) return res @@ -171,13 +179,14 @@ def _replacer(matchobj): if name in vars: return vars[name] return matchobj.group(0) + return _VAR_REPL.sub(_replacer, value) def _get_default_scheme(): - if os.name == 'posix': + if os.name == "posix": # the default scheme for posix is posix_prefix - return 'posix_prefix' + return "posix_prefix" return os.name @@ -201,8 +210,9 @@ def joinuser(*args): if env_base: return env_base else: - return joinuser("~", "Library", framework, "%d.%d" % - sys.version_info[:2]) + return joinuser( + "~", "Library", framework, "%d.%d" % sys.version_info[:2] + ) if env_base: return env_base @@ -228,18 +238,18 @@ def _parse_makefile(filename, vars=None): done = {} notdone = {} - with codecs.open(filename, encoding='utf-8', errors="surrogateescape") as f: + with codecs.open(filename, encoding="utf-8", errors="surrogateescape") as f: lines = f.readlines() for line in lines: - if line.startswith('#') or line.strip() == '': + if line.startswith("#") or line.strip() == "": continue m = _variable_rx.match(line) if m: n, v = m.group(1, 2) v = v.strip() # `$$' is a literal `$' in make - tmpv = v.replace('$$', '') + tmpv = v.replace("$$", "") if "$" in tmpv: notdone[n] = v @@ -248,7 +258,7 @@ def _parse_makefile(filename, vars=None): v = int(v) except ValueError: # insert literal `$' - done[n] = v.replace('$$', '$') + done[n] = v.replace("$$", "$") else: done[n] = v @@ -259,7 +269,7 @@ def _parse_makefile(filename, vars=None): # be made available without that prefix through sysconfig. # Special care is needed to ensure that variable expansion works, even # if the expansion uses the name without a prefix. - renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS') + renamed_variables = ("CFLAGS", "LDFLAGS", "CPPFLAGS") while len(variables) > 0: for name in tuple(variables): @@ -278,22 +288,21 @@ def _parse_makefile(filename, vars=None): item = os.environ[n] elif n in renamed_variables: - if (name.startswith('PY_') and - name[3:] in renamed_variables): + if name.startswith("PY_") and name[3:] in renamed_variables: item = "" - elif 'PY_' + n in notdone: + elif "PY_" + n in notdone: found = False else: - item = str(done['PY_' + n]) + item = str(done["PY_" + n]) else: done[n] = item = "" if found: - after = value[m.end():] - value = value[:m.start()] + item + after + after = value[m.end() :] + value = value[: m.start()] + item + after if "$" in after: notdone[name] = value else: @@ -305,8 +314,7 @@ def _parse_makefile(filename, vars=None): done[name] = value variables.remove(name) - if (name.startswith('PY_') and - name[3:] in renamed_variables): + if name.startswith("PY_") and name[3:] in renamed_variables: name = name[3:] if name not in done: @@ -332,11 +340,11 @@ def get_makefile_filename(): """Return the path of the Makefile.""" if _PYTHON_BUILD: return os.path.join(_PROJECT_BASE, "Makefile") - if hasattr(sys, 'abiflags'): - config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags) + if hasattr(sys, "abiflags"): + config_dir_name = "config-%s%s" % (_PY_VERSION_SHORT, sys.abiflags) else: - config_dir_name = 'config' - return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile') + config_dir_name = "config" + return os.path.join(get_path("stdlib"), config_dir_name, "Makefile") def _init_posix(vars): @@ -364,19 +372,20 @@ def _init_posix(vars): # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. if _PYTHON_BUILD: - vars['LDSHARED'] = vars['BLDSHARED'] + vars["LDSHARED"] = vars["BLDSHARED"] def _init_non_posix(vars): """Initialize the module as appropriate for NT""" # set basic install directories - vars['LIBDEST'] = get_path('stdlib') - vars['BINLIBDEST'] = get_path('platstdlib') - vars['INCLUDEPY'] = get_path('include') - vars['SO'] = '.pyd' - vars['EXE'] = '.exe' - vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT - vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) + vars["LIBDEST"] = get_path("stdlib") + vars["BINLIBDEST"] = get_path("platstdlib") + vars["INCLUDEPY"] = get_path("include") + vars["SO"] = ".pyd" + vars["EXE"] = ".exe" + vars["VERSION"] = _PY_VERSION_SHORT_NO_DOT + vars["BINDIR"] = os.path.dirname(_safe_realpath(sys.executable)) + # # public APIs @@ -422,8 +431,8 @@ def get_config_h_filename(): else: inc_dir = _PROJECT_BASE else: - inc_dir = get_path('platinclude') - return os.path.join(inc_dir, 'pyconfig.h') + inc_dir = get_path("platinclude") + return os.path.join(inc_dir, "pyconfig.h") def get_scheme_names(): @@ -434,7 +443,7 @@ def get_scheme_names(): def get_path_names(): """Return a tuple containing the paths names.""" # xxx see if we want a static list - return _SCHEMES.options('posix_prefix') + return _SCHEMES.options("posix_prefix") def get_paths(scheme=_get_default_scheme(), vars=None, expand=True): @@ -474,34 +483,34 @@ def get_config_vars(*args): # Normalized versions of prefix and exec_prefix are handy to have; # in fact, these are the standard versions used most places in the # distutils2 module. - _CONFIG_VARS['prefix'] = _PREFIX - _CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX - _CONFIG_VARS['py_version'] = _PY_VERSION - _CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT - _CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2] - _CONFIG_VARS['base'] = _PREFIX - _CONFIG_VARS['platbase'] = _EXEC_PREFIX - _CONFIG_VARS['projectbase'] = _PROJECT_BASE + _CONFIG_VARS["prefix"] = _PREFIX + _CONFIG_VARS["exec_prefix"] = _EXEC_PREFIX + _CONFIG_VARS["py_version"] = _PY_VERSION + _CONFIG_VARS["py_version_short"] = _PY_VERSION_SHORT + _CONFIG_VARS["py_version_nodot"] = _PY_VERSION[0] + _PY_VERSION[2] + _CONFIG_VARS["base"] = _PREFIX + _CONFIG_VARS["platbase"] = _EXEC_PREFIX + _CONFIG_VARS["projectbase"] = _PROJECT_BASE try: - _CONFIG_VARS['abiflags'] = sys.abiflags + _CONFIG_VARS["abiflags"] = sys.abiflags except AttributeError: # sys.abiflags may not be defined on all platforms. - _CONFIG_VARS['abiflags'] = '' + _CONFIG_VARS["abiflags"] = "" - if os.name in ('nt', 'os2'): + if os.name in ("nt", "os2"): _init_non_posix(_CONFIG_VARS) - if os.name == 'posix': + if os.name == "posix": _init_posix(_CONFIG_VARS) # Setting 'userbase' is done below the call to the # init function to enable using 'get_config_var' in # the init-function. - if sys.version >= '2.6': - _CONFIG_VARS['userbase'] = _getuserbase() + if sys.version >= "2.6": + _CONFIG_VARS["userbase"] = _getuserbase() - if 'srcdir' not in _CONFIG_VARS: - _CONFIG_VARS['srcdir'] = _PROJECT_BASE + if "srcdir" not in _CONFIG_VARS: + _CONFIG_VARS["srcdir"] = _PROJECT_BASE else: - _CONFIG_VARS['srcdir'] = _safe_realpath(_CONFIG_VARS['srcdir']) + _CONFIG_VARS["srcdir"] = _safe_realpath(_CONFIG_VARS["srcdir"]) # Convert srcdir into an absolute path if it appears necessary. # Normally it is relative to the build directory. However, during @@ -513,30 +522,34 @@ def get_config_vars(*args): cwd = os.getcwd() except OSError: cwd = None - if (not os.path.isabs(_CONFIG_VARS['srcdir']) and - base != cwd): + if not os.path.isabs(_CONFIG_VARS["srcdir"]) and base != cwd: # srcdir is relative and we are not in the same directory # as the executable. Assume executable is in the build # directory and make srcdir absolute. - srcdir = os.path.join(base, _CONFIG_VARS['srcdir']) - _CONFIG_VARS['srcdir'] = os.path.normpath(srcdir) + srcdir = os.path.join(base, _CONFIG_VARS["srcdir"]) + _CONFIG_VARS["srcdir"] = os.path.normpath(srcdir) - if sys.platform == 'darwin': + if sys.platform == "darwin": kernel_version = os.uname()[2] # Kernel version (8.4.3) - major_version = int(kernel_version.split('.')[0]) + major_version = int(kernel_version.split(".")[0]) if major_version < 8: # On Mac OS X before 10.4, check if -arch and -isysroot # are in CFLAGS or LDFLAGS and remove them if they are. # This is needed when building extensions on a 10.3 system # using a universal build of python. - for key in ('LDFLAGS', 'BASECFLAGS', - # a number of derived variables. These need to be - # patched up as well. - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + for key in ( + "LDFLAGS", + "BASECFLAGS", + # a number of derived variables. These need to be + # patched up as well. + "CFLAGS", + "PY_CFLAGS", + "BLDSHARED", + ): flags = _CONFIG_VARS[key] - flags = re.sub(r'-arch\s+\w+\s', ' ', flags) - flags = re.sub('-isysroot [^ \t]*', ' ', flags) + flags = re.sub(r"-arch\s+\w+\s", " ", flags) + flags = re.sub("-isysroot [^ \t]*", " ", flags) _CONFIG_VARS[key] = flags else: # Allow the user to override the architecture flags using @@ -544,16 +557,21 @@ def get_config_vars(*args): # NOTE: This name was introduced by Apple in OSX 10.5 and # is used by several scripting languages distributed with # that OS release. - if 'ARCHFLAGS' in os.environ: - arch = os.environ['ARCHFLAGS'] - for key in ('LDFLAGS', 'BASECFLAGS', + if "ARCHFLAGS" in os.environ: + arch = os.environ["ARCHFLAGS"] + for key in ( + "LDFLAGS", + "BASECFLAGS", # a number of derived variables. These need to be # patched up as well. - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + "CFLAGS", + "PY_CFLAGS", + "BLDSHARED", + ): flags = _CONFIG_VARS[key] - flags = re.sub(r'-arch\s+\w+\s', ' ', flags) - flags = flags + ' ' + arch + flags = re.sub(r"-arch\s+\w+\s", " ", flags) + flags = flags + " " + arch _CONFIG_VARS[key] = flags # If we're on OSX 10.5 or later and the user tries to @@ -566,18 +584,23 @@ def get_config_vars(*args): # the 10.4u SDK, but that SDK is not installed by default # when you install Xcode. # - CFLAGS = _CONFIG_VARS.get('CFLAGS', '') - m = re.search(r'-isysroot\s+(\S+)', CFLAGS) + CFLAGS = _CONFIG_VARS.get("CFLAGS", "") + m = re.search(r"-isysroot\s+(\S+)", CFLAGS) if m is not None: sdk = m.group(1) if not os.path.exists(sdk): - for key in ('LDFLAGS', 'BASECFLAGS', - # a number of derived variables. These need to be - # patched up as well. - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + for key in ( + "LDFLAGS", + "BASECFLAGS", + # a number of derived variables. These need to be + # patched up as well. + "CFLAGS", + "PY_CFLAGS", + "BLDSHARED", + ): flags = _CONFIG_VARS[key] - flags = re.sub(r'-isysroot\s+\S+(\s|$)', ' ', flags) + flags = re.sub(r"-isysroot\s+\S+(\s|$)", " ", flags) _CONFIG_VARS[key] = flags if args: @@ -623,21 +646,21 @@ def get_platform(): For other non-POSIX platforms, currently just returns 'sys.platform'. """ - if os.name == 'nt': + if os.name == "nt": # sniff sys.version for architecture. prefix = " bit (" i = sys.version.find(prefix) if i == -1: return sys.platform j = sys.version.find(")", i) - look = sys.version[i+len(prefix):j].lower() - if look == 'amd64': - return 'win-amd64' - if look == 'itanium': - return 'win-ia64' + look = sys.version[i + len(prefix) : j].lower() + if look == "amd64": + return "win-amd64" + if look == "itanium": + return "win-ia64" return sys.platform - if os.name != "posix" or not hasattr(os, 'uname'): + if os.name != "posix" or not hasattr(os, "uname"): # XXX what about the architecture? NT is Intel or Alpha, # Mac OS is M68k or PPC, etc. return sys.platform @@ -647,27 +670,27 @@ def get_platform(): # Convert the OS name to lowercase, remove '/' characters # (to accommodate BSD/OS), and translate spaces (for "Power Macintosh") - osname = osname.lower().replace('/', '') - machine = machine.replace(' ', '_') - machine = machine.replace('/', '-') + osname = osname.lower().replace("/", "") + machine = machine.replace(" ", "_") + machine = machine.replace("/", "-") if osname[:5] == "linux": # At least on Linux/Intel, 'machine' is the processor -- # i386, etc. # XXX what about Alpha, SPARC, etc? - return "%s-%s" % (osname, machine) + return "%s-%s" % (osname, machine) elif osname[:5] == "sunos": - if release[0] >= "5": # SunOS 5 == Solaris 2 + if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) # fall through to standard osname-release-machine representation - elif osname[:4] == "irix": # could be "irix64"! + elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) elif osname[:3] == "aix": return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": osname = "cygwin" - rel_re = re.compile(r'[\d.]+') + rel_re = re.compile(r"[\d.]+") m = rel_re.match(release) if m: release = m.group() @@ -679,7 +702,7 @@ def get_platform(): # machine is going to compile and link as if it were # MACOSX_DEPLOYMENT_TARGET. cfgvars = get_config_vars() - macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET') + macver = cfgvars.get("MACOSX_DEPLOYMENT_TARGET") if True: # Always calculate the release of the running machine, @@ -690,19 +713,22 @@ def get_platform(): # way to get the system version (see the documentation for # the Gestalt Manager) try: - f = open('/System/Library/CoreServices/SystemVersion.plist') + f = open("/System/Library/CoreServices/SystemVersion.plist") except IOError: # We're on a plain darwin box, fall back to the default # behaviour. pass else: try: - m = re.search(r'ProductUserVisibleVersion\s*' - r'(.*?)', f.read()) + m = re.search( + r"ProductUserVisibleVersion\s*" + r"(.*?)", + f.read(), + ) finally: f.close() if m is not None: - macrelease = '.'.join(m.group(1).split('.')[:2]) + macrelease = ".".join(m.group(1).split(".")[:2]) # else: fall back to the default behaviour if not macver: @@ -712,50 +738,50 @@ def get_platform(): release = macver osname = "macosx" - if ((macrelease + '.') >= '10.4.' and - '-arch' in get_config_vars().get('CFLAGS', '').strip()): + if (macrelease + ".") >= "10.4." and "-arch" in get_config_vars().get( + "CFLAGS", "" + ).strip(): # The universal build will build fat binaries, but not on # systems before 10.4 # # Try to detect 4-way universal builds, those have machine-type # 'universal' instead of 'fat'. - machine = 'fat' - cflags = get_config_vars().get('CFLAGS') + machine = "fat" + cflags = get_config_vars().get("CFLAGS") - archs = re.findall(r'-arch\s+(\S+)', cflags) + archs = re.findall(r"-arch\s+(\S+)", cflags) archs = tuple(sorted(set(archs))) if len(archs) == 1: machine = archs[0] - elif archs == ('i386', 'ppc'): - machine = 'fat' - elif archs == ('i386', 'x86_64'): - machine = 'intel' - elif archs == ('i386', 'ppc', 'x86_64'): - machine = 'fat3' - elif archs == ('ppc64', 'x86_64'): - machine = 'fat64' - elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'): - machine = 'universal' + elif archs == ("i386", "ppc"): + machine = "fat" + elif archs == ("i386", "x86_64"): + machine = "intel" + elif archs == ("i386", "ppc", "x86_64"): + machine = "fat3" + elif archs == ("ppc64", "x86_64"): + machine = "fat64" + elif archs == ("i386", "ppc", "ppc64", "x86_64"): + machine = "universal" else: - raise ValueError( - "Don't know machine value for archs=%r" % (archs,)) + raise ValueError("Don't know machine value for archs=%r" % (archs,)) - elif machine == 'i386': + elif machine == "i386": # On OSX the machine type returned by uname is always the # 32-bit variant, even if the executable architecture is # the 64-bit variant if sys.maxsize >= 2**32: - machine = 'x86_64' + machine = "x86_64" - elif machine in ('PowerPC', 'Power_Macintosh'): + elif machine in ("PowerPC", "Power_Macintosh"): # Pick a sane name for the PPC architecture. # See 'i386' case if sys.maxsize >= 2**32: - machine = 'ppc64' + machine = "ppc64" else: - machine = 'ppc' + machine = "ppc" return "%s-%s-%s" % (osname, release, machine) @@ -767,7 +793,7 @@ def get_python_version(): def _print_dict(title, data): for index, (key, value) in enumerate(sorted(data.items())): if index == 0: - print('%s: ' % (title)) + print("%s: " % (title)) print('\t%s = "%s"' % (key, value)) @@ -777,10 +803,10 @@ def _main(): print('Python version: "%s"' % get_python_version()) print('Current installation scheme: "%s"' % _get_default_scheme()) print() - _print_dict('Paths', get_paths()) + _print_dict("Paths", get_paths()) print() - _print_dict('Variables', get_config_vars()) + _print_dict("Variables", get_config_vars()) -if __name__ == '__main__': +if __name__ == "__main__": _main() diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py index 7d4223f8..142e7601 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/_backport/tarfile.py @@ -1,6 +1,6 @@ -#------------------------------------------------------------------- +# ------------------------------------------------------------------- # tarfile.py -#------------------------------------------------------------------- +# ------------------------------------------------------------------- # Copyright (C) 2002 Lars Gustaebel # All rights reserved. # @@ -31,15 +31,15 @@ __version__ = "$Revision$" -version = "0.9.0" -__author__ = "Lars Gust\u00e4bel (lars@gustaebel.de)" -__date__ = "$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $" -__cvsid__ = "$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $" +version = "0.9.0" +__author__ = "Lars Gust\u00e4bel (lars@gustaebel.de)" +__date__ = "$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $" +__cvsid__ = "$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $" __credits__ = "Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend." -#--------- +# --------- # Imports -#--------- +# --------- import sys import os import stat @@ -71,65 +71,71 @@ else: import builtins -_open = builtins.open # Since 'open' is TarFile.open +_open = builtins.open # Since 'open' is TarFile.open -#--------------------------------------------------------- +# --------------------------------------------------------- # tar constants -#--------------------------------------------------------- -NUL = b"\0" # the null character -BLOCKSIZE = 512 # length of processing blocks -RECORDSIZE = BLOCKSIZE * 20 # length of records -GNU_MAGIC = b"ustar \0" # magic gnu tar string -POSIX_MAGIC = b"ustar\x0000" # magic posix tar string - -LENGTH_NAME = 100 # maximum length of a filename -LENGTH_LINK = 100 # maximum length of a linkname -LENGTH_PREFIX = 155 # maximum length of the prefix field - -REGTYPE = b"0" # regular file -AREGTYPE = b"\0" # regular file -LNKTYPE = b"1" # link (inside tarfile) -SYMTYPE = b"2" # symbolic link -CHRTYPE = b"3" # character special device -BLKTYPE = b"4" # block special device -DIRTYPE = b"5" # directory -FIFOTYPE = b"6" # fifo special device -CONTTYPE = b"7" # contiguous file - -GNUTYPE_LONGNAME = b"L" # GNU tar longname -GNUTYPE_LONGLINK = b"K" # GNU tar longlink -GNUTYPE_SPARSE = b"S" # GNU tar sparse file - -XHDTYPE = b"x" # POSIX.1-2001 extended header -XGLTYPE = b"g" # POSIX.1-2001 global header -SOLARIS_XHDTYPE = b"X" # Solaris extended header - -USTAR_FORMAT = 0 # POSIX.1-1988 (ustar) format -GNU_FORMAT = 1 # GNU tar format -PAX_FORMAT = 2 # POSIX.1-2001 (pax) format +# --------------------------------------------------------- +NUL = b"\0" # the null character +BLOCKSIZE = 512 # length of processing blocks +RECORDSIZE = BLOCKSIZE * 20 # length of records +GNU_MAGIC = b"ustar \0" # magic gnu tar string +POSIX_MAGIC = b"ustar\x0000" # magic posix tar string + +LENGTH_NAME = 100 # maximum length of a filename +LENGTH_LINK = 100 # maximum length of a linkname +LENGTH_PREFIX = 155 # maximum length of the prefix field + +REGTYPE = b"0" # regular file +AREGTYPE = b"\0" # regular file +LNKTYPE = b"1" # link (inside tarfile) +SYMTYPE = b"2" # symbolic link +CHRTYPE = b"3" # character special device +BLKTYPE = b"4" # block special device +DIRTYPE = b"5" # directory +FIFOTYPE = b"6" # fifo special device +CONTTYPE = b"7" # contiguous file + +GNUTYPE_LONGNAME = b"L" # GNU tar longname +GNUTYPE_LONGLINK = b"K" # GNU tar longlink +GNUTYPE_SPARSE = b"S" # GNU tar sparse file + +XHDTYPE = b"x" # POSIX.1-2001 extended header +XGLTYPE = b"g" # POSIX.1-2001 global header +SOLARIS_XHDTYPE = b"X" # Solaris extended header + +USTAR_FORMAT = 0 # POSIX.1-1988 (ustar) format +GNU_FORMAT = 1 # GNU tar format +PAX_FORMAT = 2 # POSIX.1-2001 (pax) format DEFAULT_FORMAT = GNU_FORMAT -#--------------------------------------------------------- +# --------------------------------------------------------- # tarfile constants -#--------------------------------------------------------- +# --------------------------------------------------------- # File types that tarfile supports: -SUPPORTED_TYPES = (REGTYPE, AREGTYPE, LNKTYPE, - SYMTYPE, DIRTYPE, FIFOTYPE, - CONTTYPE, CHRTYPE, BLKTYPE, - GNUTYPE_LONGNAME, GNUTYPE_LONGLINK, - GNUTYPE_SPARSE) +SUPPORTED_TYPES = ( + REGTYPE, + AREGTYPE, + LNKTYPE, + SYMTYPE, + DIRTYPE, + FIFOTYPE, + CONTTYPE, + CHRTYPE, + BLKTYPE, + GNUTYPE_LONGNAME, + GNUTYPE_LONGLINK, + GNUTYPE_SPARSE, +) # File types that will be treated as a regular file. -REGULAR_TYPES = (REGTYPE, AREGTYPE, - CONTTYPE, GNUTYPE_SPARSE) +REGULAR_TYPES = (REGTYPE, AREGTYPE, CONTTYPE, GNUTYPE_SPARSE) # File types that are part of the GNU tar format. -GNU_TYPES = (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK, - GNUTYPE_SPARSE) +GNU_TYPES = (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK, GNUTYPE_SPARSE) # Fields from a pax header that override a TarInfo attribute. -PAX_FIELDS = ("path", "linkpath", "size", "mtime", - "uid", "gid", "uname", "gname") +PAX_FIELDS = ("path", "linkpath", "size", "mtime", "uid", "gid", "uname", "gname") # Fields from a pax header that are affected by hdrcharset. PAX_NAME_FIELDS = set(("path", "linkpath", "uname", "gname")) @@ -142,62 +148,62 @@ "mtime": float, "uid": int, "gid": int, - "size": int + "size": int, } -#--------------------------------------------------------- +# --------------------------------------------------------- # Bits used in the mode field, values in octal. -#--------------------------------------------------------- -S_IFLNK = 0o120000 # symbolic link -S_IFREG = 0o100000 # regular file -S_IFBLK = 0o060000 # block device -S_IFDIR = 0o040000 # directory -S_IFCHR = 0o020000 # character device -S_IFIFO = 0o010000 # fifo - -TSUID = 0o4000 # set UID on execution -TSGID = 0o2000 # set GID on execution -TSVTX = 0o1000 # reserved - -TUREAD = 0o400 # read by owner -TUWRITE = 0o200 # write by owner -TUEXEC = 0o100 # execute/search by owner -TGREAD = 0o040 # read by group -TGWRITE = 0o020 # write by group -TGEXEC = 0o010 # execute/search by group -TOREAD = 0o004 # read by other -TOWRITE = 0o002 # write by other -TOEXEC = 0o001 # execute/search by other - -#--------------------------------------------------------- +# --------------------------------------------------------- +S_IFLNK = 0o120000 # symbolic link +S_IFREG = 0o100000 # regular file +S_IFBLK = 0o060000 # block device +S_IFDIR = 0o040000 # directory +S_IFCHR = 0o020000 # character device +S_IFIFO = 0o010000 # fifo + +TSUID = 0o4000 # set UID on execution +TSGID = 0o2000 # set GID on execution +TSVTX = 0o1000 # reserved + +TUREAD = 0o400 # read by owner +TUWRITE = 0o200 # write by owner +TUEXEC = 0o100 # execute/search by owner +TGREAD = 0o040 # read by group +TGWRITE = 0o020 # write by group +TGEXEC = 0o010 # execute/search by group +TOREAD = 0o004 # read by other +TOWRITE = 0o002 # write by other +TOEXEC = 0o001 # execute/search by other + +# --------------------------------------------------------- # initialization -#--------------------------------------------------------- +# --------------------------------------------------------- if os.name in ("nt", "ce"): ENCODING = "utf-8" else: ENCODING = sys.getfilesystemencoding() -#--------------------------------------------------------- +# --------------------------------------------------------- # Some useful functions -#--------------------------------------------------------- +# --------------------------------------------------------- + def stn(s, length, encoding, errors): - """Convert a string to a null-terminated bytes object. - """ + """Convert a string to a null-terminated bytes object.""" s = s.encode(encoding, errors) return s[:length] + (length - len(s)) * NUL + def nts(s, encoding, errors): - """Convert a null-terminated bytes object to a string. - """ + """Convert a null-terminated bytes object to a string.""" p = s.find(b"\0") if p != -1: s = s[:p] return s.decode(encoding, errors) + def nti(s): - """Convert a number field to a python number. - """ + """Convert a number field to a python number.""" # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0o200): @@ -212,9 +218,9 @@ def nti(s): n += ord(s[i + 1]) return n + def itn(n, digits=8, format=DEFAULT_FORMAT): - """Convert a python number to a number field. - """ + """Convert a python number to a number field.""" # POSIX 1003.1-1988 requires numbers to be encoded as a string of # octal digits followed by a null-byte, this allows values up to # (8**(digits-1))-1. GNU tar allows storing numbers greater than @@ -239,28 +245,34 @@ def itn(n, digits=8, format=DEFAULT_FORMAT): s.insert(0, 0o200) return s + def calc_chksums(buf): """Calculate the checksum for a member's header by summing up all - characters except for the chksum field which is treated as if - it was filled with spaces. According to the GNU tar sources, - some tars (Sun and NeXT) calculate chksum with signed char, - which will be different if there are chars in the buffer with - the high bit set. So we calculate two checksums, unsigned and - signed. + characters except for the chksum field which is treated as if + it was filled with spaces. According to the GNU tar sources, + some tars (Sun and NeXT) calculate chksum with signed char, + which will be different if there are chars in the buffer with + the high bit set. So we calculate two checksums, unsigned and + signed. """ - unsigned_chksum = 256 + sum(struct.unpack("148B", buf[:148]) + struct.unpack("356B", buf[156:512])) - signed_chksum = 256 + sum(struct.unpack("148b", buf[:148]) + struct.unpack("356b", buf[156:512])) + unsigned_chksum = 256 + sum( + struct.unpack("148B", buf[:148]) + struct.unpack("356B", buf[156:512]) + ) + signed_chksum = 256 + sum( + struct.unpack("148b", buf[:148]) + struct.unpack("356b", buf[156:512]) + ) return unsigned_chksum, signed_chksum + def copyfileobj(src, dst, length=None): """Copy length bytes from fileobj src to fileobj dst. - If length is None, copy the entire content. + If length is None, copy the entire content. """ if length == 0: return if length is None: while True: - buf = src.read(16*1024) + buf = src.read(16 * 1024) if not buf: break dst.write(buf) @@ -281,37 +293,32 @@ def copyfileobj(src, dst, length=None): dst.write(buf) return + filemode_table = ( - ((S_IFLNK, "l"), - (S_IFREG, "-"), - (S_IFBLK, "b"), - (S_IFDIR, "d"), - (S_IFCHR, "c"), - (S_IFIFO, "p")), - - ((TUREAD, "r"),), - ((TUWRITE, "w"),), - ((TUEXEC|TSUID, "s"), - (TSUID, "S"), - (TUEXEC, "x")), - - ((TGREAD, "r"),), - ((TGWRITE, "w"),), - ((TGEXEC|TSGID, "s"), - (TSGID, "S"), - (TGEXEC, "x")), - - ((TOREAD, "r"),), - ((TOWRITE, "w"),), - ((TOEXEC|TSVTX, "t"), - (TSVTX, "T"), - (TOEXEC, "x")) + ( + (S_IFLNK, "l"), + (S_IFREG, "-"), + (S_IFBLK, "b"), + (S_IFDIR, "d"), + (S_IFCHR, "c"), + (S_IFIFO, "p"), + ), + ((TUREAD, "r"),), + ((TUWRITE, "w"),), + ((TUEXEC | TSUID, "s"), (TSUID, "S"), (TUEXEC, "x")), + ((TGREAD, "r"),), + ((TGWRITE, "w"),), + ((TGEXEC | TSGID, "s"), (TSGID, "S"), (TGEXEC, "x")), + ((TOREAD, "r"),), + ((TOWRITE, "w"),), + ((TOEXEC | TSVTX, "t"), (TSVTX, "T"), (TOEXEC, "x")), ) + def filemode(mode): """Convert a file's mode to a string of the form - -rwxrwxrwx. - Used by TarFile.list() + -rwxrwxrwx. + Used by TarFile.list() """ perm = [] for table in filemode_table: @@ -323,47 +330,80 @@ def filemode(mode): perm.append("-") return "".join(perm) + class TarError(Exception): """Base exception.""" + pass + + class ExtractError(TarError): """General exception for extract errors.""" + pass + + class ReadError(TarError): """Exception for unreadable tar archives.""" + pass + + class CompressionError(TarError): """Exception for unavailable compression methods.""" + pass + + class StreamError(TarError): """Exception for unsupported operations on stream-like TarFiles.""" + pass + + class HeaderError(TarError): """Base exception for header errors.""" + pass + + class EmptyHeaderError(HeaderError): """Exception for empty headers.""" + pass + + class TruncatedHeaderError(HeaderError): """Exception for truncated headers.""" + pass + + class EOFHeaderError(HeaderError): """Exception for end of file headers.""" + pass + + class InvalidHeaderError(HeaderError): """Exception for invalid headers.""" + pass + + class SubsequentHeaderError(HeaderError): """Exception for missing and invalid extended headers.""" + pass -#--------------------------- + +# --------------------------- # internal stream interface -#--------------------------- +# --------------------------- class _LowLevelFile(object): """Low-level file object. Supports reading and writing. - It is used instead of a regular file object for streaming - access. + It is used instead of a regular file object for streaming + access. """ def __init__(self, name, mode): @@ -384,39 +424,39 @@ def read(self, size): def write(self, s): os.write(self.fd, s) + class _Stream(object): """Class that serves as an adapter between TarFile and - a stream-like object. The stream-like object only - needs to have a read() or write() method and is accessed - blockwise. Use of gzip or bzip2 compression is possible. - A stream-like object could be for example: sys.stdin, - sys.stdout, a socket, a tape device etc. + a stream-like object. The stream-like object only + needs to have a read() or write() method and is accessed + blockwise. Use of gzip or bzip2 compression is possible. + A stream-like object could be for example: sys.stdin, + sys.stdout, a socket, a tape device etc. - _Stream is intended to be used only internally. + _Stream is intended to be used only internally. """ def __init__(self, name, mode, comptype, fileobj, bufsize): - """Construct a _Stream object. - """ + """Construct a _Stream object.""" self._extfileobj = True if fileobj is None: fileobj = _LowLevelFile(name, mode) self._extfileobj = False - if comptype == '*': + if comptype == "*": # Enable transparent compression detection for the # stream interface fileobj = _StreamProxy(fileobj) comptype = fileobj.getcomptype() - self.name = name or "" - self.mode = mode + self.name = name or "" + self.mode = mode self.comptype = comptype - self.fileobj = fileobj - self.bufsize = bufsize - self.buf = b"" - self.pos = 0 - self.closed = False + self.fileobj = fileobj + self.bufsize = bufsize + self.buf = b"" + self.pos = 0 + self.closed = False try: if comptype == "gz": @@ -452,12 +492,10 @@ def __del__(self): self.close() def _init_write_gz(self): - """Initialize for writing with gzip compression. - """ - self.cmp = self.zlib.compressobj(9, self.zlib.DEFLATED, - -self.zlib.MAX_WBITS, - self.zlib.DEF_MEM_LEVEL, - 0) + """Initialize for writing with gzip compression.""" + self.cmp = self.zlib.compressobj( + 9, self.zlib.DEFLATED, -self.zlib.MAX_WBITS, self.zlib.DEF_MEM_LEVEL, 0 + ) timestamp = struct.pack(" self.bufsize: - self.fileobj.write(self.buf[:self.bufsize]) - self.buf = self.buf[self.bufsize:] + self.fileobj.write(self.buf[: self.bufsize]) + self.buf = self.buf[self.bufsize :] def close(self): """Close the _Stream object. No operation should be - done on it afterwards. + done on it afterwards. """ if self.closed: return @@ -504,8 +541,8 @@ def close(self): # while the same crc on a 64-bit box may "look positive". # To avoid irksome warnings from the `struct` module, force # it to look positive on all boxes. - self.fileobj.write(struct.pack("= 0: blocks, remainder = divmod(pos - self.pos, self.bufsize) @@ -563,8 +598,8 @@ def seek(self, pos=0): def read(self, size=None): """Return the next size number of bytes from the stream. - If size is not defined, return all bytes of the stream - up to EOF. + If size is not defined, return all bytes of the stream + up to EOF. """ if size is None: t = [] @@ -580,8 +615,7 @@ def read(self, size=None): return buf def _read(self, size): - """Return size bytes from the stream. - """ + """Return size bytes from the stream.""" if self.comptype == "tar": return self.__read(size) @@ -602,7 +636,7 @@ def _read(self, size): def __read(self, size): """Return size bytes from stream. If internal buffer is empty, - read another block from the stream. + read another block from the stream. """ c = len(self.buf) while c < size: @@ -614,11 +648,14 @@ def __read(self, size): buf = self.buf[:size] self.buf = self.buf[size:] return buf + + # class _Stream + class _StreamProxy(object): """Small proxy class that enables transparent compression - detection for the Stream interface (mode 'r|*'). + detection for the Stream interface (mode 'r|*'). """ def __init__(self, fileobj): @@ -638,14 +675,17 @@ def getcomptype(self): def close(self): self.fileobj.close() + + # class StreamProxy + class _BZ2Proxy(object): """Small proxy class that enables external file object - support for "r:bz2" and "w:bz2" modes. This is actually - a workaround for a limitation in bz2 module's BZ2File - class which (unlike gzip.GzipFile) has no support for - a file object argument. + support for "r:bz2" and "w:bz2" modes. This is actually + a workaround for a limitation in bz2 module's BZ2File + class which (unlike gzip.GzipFile) has no support for + a file object argument. """ blocksize = 16 * 1024 @@ -658,6 +698,7 @@ def __init__(self, fileobj, mode): def init(self): import bz2 + self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() @@ -698,15 +739,17 @@ def close(self): if self.mode == "w": raw = self.bz2obj.flush() self.fileobj.write(raw) + + # class _BZ2Proxy -#------------------------ +# ------------------------ # Extraction file object -#------------------------ +# ------------------------ class _FileInFile(object): """A thin wrapper around an existing file object that - provides a part of its data as an individual file - object. + provides a part of its data as an individual file + object. """ def __init__(self, fileobj, offset, size, blockinfo=None): @@ -739,18 +782,15 @@ def seekable(self): return self.fileobj.seekable() def tell(self): - """Return the current file position. - """ + """Return the current file position.""" return self.position def seek(self, position): - """Seek to a position in the file. - """ + """Seek to a position in the file.""" self.position = position def read(self, size=None): - """Read data from the file. - """ + """Read data from the file.""" if size is None: size = self.size - self.position else: @@ -775,20 +815,22 @@ def read(self, size=None): size -= length self.position += length return buf -#class _FileInFile + + +# class _FileInFile class ExFileObject(object): """File-like object for reading an archive member. - Is returned by TarFile.extractfile(). + Is returned by TarFile.extractfile(). """ + blocksize = 1024 def __init__(self, tarfile, tarinfo): - self.fileobj = _FileInFile(tarfile.fileobj, - tarinfo.offset_data, - tarinfo.size, - tarinfo.sparse) + self.fileobj = _FileInFile( + tarfile.fileobj, tarinfo.offset_data, tarinfo.size, tarinfo.sparse + ) self.name = tarinfo.name self.mode = "r" self.closed = False @@ -808,7 +850,7 @@ def seekable(self): def read(self, size=None): """Read at most size bytes from the file. If size is not - present or None, read all data until EOF is reached. + present or None, read all data until EOF is reached. """ if self.closed: raise ValueError("I/O operation on closed file") @@ -835,8 +877,8 @@ def read(self, size=None): def readline(self, size=-1): """Read one entire line from the file. If size is present - and non-negative, return a string with at most that - size, which may be an incomplete line. + and non-negative, return a string with at most that + size, which may be an incomplete line. """ if self.closed: raise ValueError("I/O operation on closed file") @@ -863,26 +905,24 @@ def readline(self, size=-1): return buf def readlines(self): - """Return a list with all remaining lines. - """ + """Return a list with all remaining lines.""" result = [] while True: line = self.readline() - if not line: break + if not line: + break result.append(line) return result def tell(self): - """Return the current file position. - """ + """Return the current file position.""" if self.closed: raise ValueError("I/O operation on closed file") return self.position def seek(self, pos, whence=os.SEEK_SET): - """Seek to a position in the file. - """ + """Seek to a position in the file.""" if self.closed: raise ValueError("I/O operation on closed file") @@ -902,95 +942,115 @@ def seek(self, pos, whence=os.SEEK_SET): self.fileobj.seek(self.position) def close(self): - """Close the file object. - """ + """Close the file object.""" self.closed = True def __iter__(self): - """Get an iterator over the file's lines. - """ + """Get an iterator over the file's lines.""" while True: line = self.readline() if not line: break yield line -#class ExFileObject -#------------------ + +# class ExFileObject + +# ------------------ # Exported Classes -#------------------ +# ------------------ class TarInfo(object): """Informational class which holds the details about an - archive member given by a tar header block. - TarInfo objects are returned by TarFile.getmember(), - TarFile.getmembers() and TarFile.gettarinfo() and are - usually created internally. + archive member given by a tar header block. + TarInfo objects are returned by TarFile.getmember(), + TarFile.getmembers() and TarFile.gettarinfo() and are + usually created internally. """ - __slots__ = ("name", "mode", "uid", "gid", "size", "mtime", - "chksum", "type", "linkname", "uname", "gname", - "devmajor", "devminor", - "offset", "offset_data", "pax_headers", "sparse", - "tarfile", "_sparse_structs", "_link_target") + __slots__ = ( + "name", + "mode", + "uid", + "gid", + "size", + "mtime", + "chksum", + "type", + "linkname", + "uname", + "gname", + "devmajor", + "devminor", + "offset", + "offset_data", + "pax_headers", + "sparse", + "tarfile", + "_sparse_structs", + "_link_target", + ) def __init__(self, name=""): """Construct a TarInfo object. name is the optional name - of the member. - """ - self.name = name # member name - self.mode = 0o644 # file permissions - self.uid = 0 # user id - self.gid = 0 # group id - self.size = 0 # file size - self.mtime = 0 # modification time - self.chksum = 0 # header checksum - self.type = REGTYPE # member type - self.linkname = "" # link name - self.uname = "" # user name - self.gname = "" # group name - self.devmajor = 0 # device major number - self.devminor = 0 # device minor number - - self.offset = 0 # the tar header starts here - self.offset_data = 0 # the file's data starts here - - self.sparse = None # sparse member information - self.pax_headers = {} # pax header information + of the member. + """ + self.name = name # member name + self.mode = 0o644 # file permissions + self.uid = 0 # user id + self.gid = 0 # group id + self.size = 0 # file size + self.mtime = 0 # modification time + self.chksum = 0 # header checksum + self.type = REGTYPE # member type + self.linkname = "" # link name + self.uname = "" # user name + self.gname = "" # group name + self.devmajor = 0 # device major number + self.devminor = 0 # device minor number + + self.offset = 0 # the tar header starts here + self.offset_data = 0 # the file's data starts here + + self.sparse = None # sparse member information + self.pax_headers = {} # pax header information # In pax headers the "name" and "linkname" field are called # "path" and "linkpath". def _getpath(self): return self.name + def _setpath(self, name): self.name = name + path = property(_getpath, _setpath) def _getlinkpath(self): return self.linkname + def _setlinkpath(self, linkname): self.linkname = linkname + linkpath = property(_getlinkpath, _setlinkpath) def __repr__(self): - return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self)) + return "<%s %r at %#x>" % (self.__class__.__name__, self.name, id(self)) def get_info(self): - """Return the TarInfo's attributes as a dictionary. - """ + """Return the TarInfo's attributes as a dictionary.""" info = { - "name": self.name, - "mode": self.mode & 0o7777, - "uid": self.uid, - "gid": self.gid, - "size": self.size, - "mtime": self.mtime, - "chksum": self.chksum, - "type": self.type, + "name": self.name, + "mode": self.mode & 0o7777, + "uid": self.uid, + "gid": self.gid, + "size": self.size, + "mtime": self.mtime, + "chksum": self.chksum, + "type": self.type, "linkname": self.linkname, - "uname": self.uname, - "gname": self.gname, + "uname": self.uname, + "gname": self.gname, "devmajor": self.devmajor, - "devminor": self.devminor + "devminor": self.devminor, } if info["type"] == DIRTYPE and not info["name"].endswith("/"): @@ -999,8 +1059,7 @@ def get_info(self): return info def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape"): - """Return a tar header as a string of 512 byte blocks. - """ + """Return a tar header as a string of 512 byte blocks.""" info = self.get_info() if format == USTAR_FORMAT: @@ -1013,8 +1072,7 @@ def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescap raise ValueError("invalid format") def create_ustar_header(self, info, encoding, errors): - """Return the object as a ustar header block. - """ + """Return the object as a ustar header block.""" info["magic"] = POSIX_MAGIC if len(info["linkname"]) > LENGTH_LINK: @@ -1026,23 +1084,26 @@ def create_ustar_header(self, info, encoding, errors): return self._create_header(info, USTAR_FORMAT, encoding, errors) def create_gnu_header(self, info, encoding, errors): - """Return the object as a GNU header block sequence. - """ + """Return the object as a GNU header block sequence.""" info["magic"] = GNU_MAGIC buf = b"" if len(info["linkname"]) > LENGTH_LINK: - buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK, encoding, errors) + buf += self._create_gnu_long_header( + info["linkname"], GNUTYPE_LONGLINK, encoding, errors + ) if len(info["name"]) > LENGTH_NAME: - buf += self._create_gnu_long_header(info["name"], GNUTYPE_LONGNAME, encoding, errors) + buf += self._create_gnu_long_header( + info["name"], GNUTYPE_LONGNAME, encoding, errors + ) return buf + self._create_header(info, GNU_FORMAT, encoding, errors) def create_pax_header(self, info, encoding): """Return the object as a ustar header block. If it cannot be - represented this way, prepend a pax extended header sequence - with supplement information. + represented this way, prepend a pax extended header sequence + with supplement information. """ info["magic"] = POSIX_MAGIC pax_headers = self.pax_headers.copy() @@ -1050,8 +1111,11 @@ def create_pax_header(self, info, encoding): # Test string fields for values that exceed the field length or cannot # be represented in ASCII encoding. for name, hname, length in ( - ("name", "path", LENGTH_NAME), ("linkname", "linkpath", LENGTH_LINK), - ("uname", "uname", 32), ("gname", "gname", 32)): + ("name", "path", LENGTH_NAME), + ("linkname", "linkpath", LENGTH_LINK), + ("uname", "uname", 32), + ("gname", "gname", 32), + ): if hname in pax_headers: # The pax header has priority. @@ -1090,19 +1154,18 @@ def create_pax_header(self, info, encoding): @classmethod def create_pax_global_header(cls, pax_headers): - """Return the object as a pax global header block sequence. - """ + """Return the object as a pax global header block sequence.""" return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf8") def _posix_split_name(self, name): """Split a name longer than 100 chars into a prefix - and a name part. + and a name part. """ - prefix = name[:LENGTH_PREFIX + 1] + prefix = name[: LENGTH_PREFIX + 1] while prefix and prefix[-1] != "/": prefix = prefix[:-1] - name = name[len(prefix):] + name = name[len(prefix) :] prefix = prefix[:-1] if not prefix or len(name) > LENGTH_NAME: @@ -1112,7 +1175,7 @@ def _posix_split_name(self, name): @staticmethod def _create_header(info, format, encoding, errors): """Return a header block. info is a dictionary with file - information, format must be one of the *_FORMAT constants. + information, format must be one of the *_FORMAT constants. """ parts = [ stn(info.get("name", ""), 100, encoding, errors), @@ -1121,7 +1184,7 @@ def _create_header(info, format, encoding, errors): itn(info.get("gid", 0), 8, format), itn(info.get("size", 0), 12, format), itn(info.get("mtime", 0), 12, format), - b" ", # checksum field + b" ", # checksum field info.get("type", REGTYPE), stn(info.get("linkname", ""), 100, encoding, errors), info.get("magic", POSIX_MAGIC), @@ -1129,7 +1192,7 @@ def _create_header(info, format, encoding, errors): stn(info.get("gname", ""), 32, encoding, errors), itn(info.get("devmajor", 0), 8, format), itn(info.get("devminor", 0), 8, format), - stn(info.get("prefix", ""), 155, encoding, errors) + stn(info.get("prefix", ""), 155, encoding, errors), ] buf = struct.pack("%ds" % BLOCKSIZE, b"".join(parts)) @@ -1140,7 +1203,7 @@ def _create_header(info, format, encoding, errors): @staticmethod def _create_payload(payload): """Return the string payload filled with zero bytes - up to the next 512 byte border. + up to the next 512 byte border. """ blocks, remainder = divmod(len(payload), BLOCKSIZE) if remainder > 0: @@ -1150,7 +1213,7 @@ def _create_payload(payload): @classmethod def _create_gnu_long_header(cls, name, type, encoding, errors): """Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence - for name. + for name. """ name = name.encode(encoding, errors) + NUL @@ -1161,14 +1224,15 @@ def _create_gnu_long_header(cls, name, type, encoding, errors): info["magic"] = GNU_MAGIC # create extended header + name blocks. - return cls._create_header(info, USTAR_FORMAT, encoding, errors) + \ - cls._create_payload(name) + return cls._create_header( + info, USTAR_FORMAT, encoding, errors + ) + cls._create_payload(name) @classmethod def _create_pax_generic_header(cls, pax_headers, type, encoding): """Return a POSIX.1-2008 extended or global header sequence - that contains a list of keyword, value pairs. The values - must be strings. + that contains a list of keyword, value pairs. The values + must be strings. """ # Check if one of the fields contains surrogate characters and thereby # forces hdrcharset=BINARY, see _proc_pax() for more information. @@ -1194,7 +1258,7 @@ def _create_pax_generic_header(cls, pax_headers, type, encoding): else: value = value.encode("utf8") - l = len(keyword) + len(value) + 3 # ' ' + '=' + '\n' + l = len(keyword) + len(value) + 3 # ' ' + '=' + '\n' n = p = 0 while True: n = l + len(str(p)) @@ -1212,13 +1276,13 @@ def _create_pax_generic_header(cls, pax_headers, type, encoding): info["magic"] = POSIX_MAGIC # Create pax header + record blocks. - return cls._create_header(info, USTAR_FORMAT, "ascii", "replace") + \ - cls._create_payload(records) + return cls._create_header( + info, USTAR_FORMAT, "ascii", "replace" + ) + cls._create_payload(records) @classmethod def frombuf(cls, buf, encoding, errors): - """Construct a TarInfo object from a 512 byte bytes object. - """ + """Construct a TarInfo object from a 512 byte bytes object.""" if len(buf) == 0: raise EmptyHeaderError("empty header") if len(buf) != BLOCKSIZE: @@ -1259,8 +1323,8 @@ def frombuf(cls, buf, encoding, errors): structs = [] for i in range(4): try: - offset = nti(buf[pos:pos + 12]) - numbytes = nti(buf[pos + 12:pos + 24]) + offset = nti(buf[pos : pos + 12]) + numbytes = nti(buf[pos + 12 : pos + 24]) except ValueError: break structs.append((offset, numbytes)) @@ -1281,14 +1345,14 @@ def frombuf(cls, buf, encoding, errors): @classmethod def fromtarfile(cls, tarfile): """Return the next TarInfo object from TarFile object - tarfile. + tarfile. """ buf = tarfile.fileobj.read(BLOCKSIZE) obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors) obj.offset = tarfile.fileobj.tell() - BLOCKSIZE return obj._proc_member(tarfile) - #-------------------------------------------------------------------------- + # -------------------------------------------------------------------------- # The following are methods that are called depending on the type of a # member. The entry point is _proc_member() which can be overridden in a # subclass to add custom _proc_*() methods. A _proc_*() method MUST @@ -1301,7 +1365,7 @@ def fromtarfile(cls, tarfile): # 3. Return self or another valid TarInfo object. def _proc_member(self, tarfile): """Choose the right processing method depending on - the type and call it. + the type and call it. """ if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK): return self._proc_gnulong(tarfile) @@ -1314,7 +1378,7 @@ def _proc_member(self, tarfile): def _proc_builtin(self, tarfile): """Process a builtin type or an unknown type which - will be treated as a regular file. + will be treated as a regular file. """ self.offset_data = tarfile.fileobj.tell() offset = self.offset_data @@ -1331,7 +1395,7 @@ def _proc_builtin(self, tarfile): def _proc_gnulong(self, tarfile): """Process the blocks that hold a GNU longname - or longlink member. + or longlink member. """ buf = tarfile.fileobj.read(self._block(self.size)) @@ -1352,8 +1416,7 @@ def _proc_gnulong(self, tarfile): return next def _proc_sparse(self, tarfile): - """Process a GNU sparse header plus extra headers. - """ + """Process a GNU sparse header plus extra headers.""" # We already collected some sparse structures in frombuf(). structs, isextended, origsize = self._sparse_structs del self._sparse_structs @@ -1364,8 +1427,8 @@ def _proc_sparse(self, tarfile): pos = 0 for i in range(21): try: - offset = nti(buf[pos:pos + 12]) - numbytes = nti(buf[pos + 12:pos + 24]) + offset = nti(buf[pos : pos + 12]) + numbytes = nti(buf[pos + 12 : pos + 24]) except ValueError: break if offset and numbytes: @@ -1381,7 +1444,7 @@ def _proc_sparse(self, tarfile): def _proc_pax(self, tarfile): """Process an extended or global header as described in - POSIX.1-2008. + POSIX.1-2008. """ # Read the header information. buf = tarfile.fileobj.read(self._block(self.size)) @@ -1399,7 +1462,7 @@ def _proc_pax(self, tarfile): # these fields are UTF-8 encoded but since POSIX.1-2008 tar # implementations are allowed to store them as raw binary strings if # the translation to UTF-8 fails. - match = re.search(br"\d+ hdrcharset=([^\n]+)\n", buf) + match = re.search(rb"\d+ hdrcharset=([^\n]+)\n", buf) if match is not None: pax_headers["hdrcharset"] = match.group(1).decode("utf8") @@ -1416,7 +1479,7 @@ def _proc_pax(self, tarfile): # "%d %s=%s\n" % (length, keyword, value). length is the size # of the complete record including the length field itself and # the newline. keyword and value are both UTF-8 encoded strings. - regex = re.compile(br"(\d+) ([^=]+)=") + regex = re.compile(rb"(\d+) ([^=]+)=") pos = 0 while True: match = regex.match(buf, pos) @@ -1425,7 +1488,7 @@ def _proc_pax(self, tarfile): length, keyword = match.groups() length = int(length) - value = buf[match.end(2) + 1:match.start(1) + length - 1] + value = buf[match.end(2) + 1 : match.start(1) + length - 1] # Normally, we could just use "utf8" as the encoding and "strict" # as the error handler, but we better not take the risk. For @@ -1434,14 +1497,13 @@ def _proc_pax(self, tarfile): # hdrcharset=BINARY header). # We first try the strict standard encoding, and if that fails we # fall back on the user's encoding and error handler. - keyword = self._decode_pax_field(keyword, "utf8", "utf8", - tarfile.errors) + keyword = self._decode_pax_field(keyword, "utf8", "utf8", tarfile.errors) if keyword in PAX_NAME_FIELDS: - value = self._decode_pax_field(value, encoding, tarfile.encoding, - tarfile.errors) + value = self._decode_pax_field( + value, encoding, tarfile.encoding, tarfile.errors + ) else: - value = self._decode_pax_field(value, "utf8", "utf8", - tarfile.errors) + value = self._decode_pax_field(value, "utf8", "utf8", tarfile.errors) pax_headers[keyword] = value pos += length @@ -1461,7 +1523,10 @@ def _proc_pax(self, tarfile): # GNU extended sparse format version 0.0. self._proc_gnusparse_00(next, pax_headers, buf) - elif pax_headers.get("GNU.sparse.major") == "1" and pax_headers.get("GNU.sparse.minor") == "0": + elif ( + pax_headers.get("GNU.sparse.major") == "1" + and pax_headers.get("GNU.sparse.minor") == "0" + ): # GNU extended sparse format version 1.0. self._proc_gnusparse_10(next, pax_headers, tarfile) @@ -1482,25 +1547,22 @@ def _proc_pax(self, tarfile): return next def _proc_gnusparse_00(self, next, pax_headers, buf): - """Process a GNU tar extended sparse header, version 0.0. - """ + """Process a GNU tar extended sparse header, version 0.0.""" offsets = [] - for match in re.finditer(br"\d+ GNU.sparse.offset=(\d+)\n", buf): + for match in re.finditer(rb"\d+ GNU.sparse.offset=(\d+)\n", buf): offsets.append(int(match.group(1))) numbytes = [] - for match in re.finditer(br"\d+ GNU.sparse.numbytes=(\d+)\n", buf): + for match in re.finditer(rb"\d+ GNU.sparse.numbytes=(\d+)\n", buf): numbytes.append(int(match.group(1))) next.sparse = list(zip(offsets, numbytes)) def _proc_gnusparse_01(self, next, pax_headers): - """Process a GNU tar extended sparse header, version 0.1. - """ + """Process a GNU tar extended sparse header, version 0.1.""" sparse = [int(x) for x in pax_headers["GNU.sparse.map"].split(",")] next.sparse = list(zip(sparse[::2], sparse[1::2])) def _proc_gnusparse_10(self, next, pax_headers, tarfile): - """Process a GNU tar extended sparse header, version 1.0. - """ + """Process a GNU tar extended sparse header, version 1.0.""" fields = None sparse = [] buf = tarfile.fileobj.read(BLOCKSIZE) @@ -1516,7 +1578,7 @@ def _proc_gnusparse_10(self, next, pax_headers, tarfile): def _apply_pax_info(self, pax_headers, encoding, errors): """Replace fields with supplemental information from a previous - pax extended or global header. + pax extended or global header. """ for keyword, value in pax_headers.items(): if keyword == "GNU.sparse.name": @@ -1538,8 +1600,7 @@ def _apply_pax_info(self, pax_headers, encoding, errors): self.pax_headers = pax_headers.copy() def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors): - """Decode a single field from a pax record. - """ + """Decode a single field from a pax record.""" try: return value.decode(encoding, "strict") except UnicodeDecodeError: @@ -1547,7 +1608,7 @@ def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors) def _block(self, count): """Round up a byte count by BLOCKSIZE and return it, - e.g. _block(834) => 1024. + e.g. _block(834) => 1024. """ blocks, remainder = divmod(count, BLOCKSIZE) if remainder: @@ -1556,62 +1617,85 @@ def _block(self, count): def isreg(self): return self.type in REGULAR_TYPES + def isfile(self): return self.isreg() + def isdir(self): return self.type == DIRTYPE + def issym(self): return self.type == SYMTYPE + def islnk(self): return self.type == LNKTYPE + def ischr(self): return self.type == CHRTYPE + def isblk(self): return self.type == BLKTYPE + def isfifo(self): return self.type == FIFOTYPE + def issparse(self): return self.sparse is not None + def isdev(self): return self.type in (CHRTYPE, BLKTYPE, FIFOTYPE) + + # class TarInfo + class TarFile(object): - """The TarFile Class provides an interface to tar archives. - """ + """The TarFile Class provides an interface to tar archives.""" - debug = 0 # May be set from 0 (no msgs) to 3 (all msgs) + debug = 0 # May be set from 0 (no msgs) to 3 (all msgs) - dereference = False # If true, add content of linked file to the - # tar file, else the link. + dereference = False # If true, add content of linked file to the + # tar file, else the link. - ignore_zeros = False # If true, skips empty or invalid blocks and - # continues processing. + ignore_zeros = False # If true, skips empty or invalid blocks and + # continues processing. - errorlevel = 1 # If 0, fatal errors only appear in debug - # messages (if debug >= 0). If > 0, errors - # are passed to the caller as exceptions. + errorlevel = 1 # If 0, fatal errors only appear in debug + # messages (if debug >= 0). If > 0, errors + # are passed to the caller as exceptions. - format = DEFAULT_FORMAT # The format to use when creating an archive. + format = DEFAULT_FORMAT # The format to use when creating an archive. - encoding = ENCODING # Encoding for 8-bit character strings. + encoding = ENCODING # Encoding for 8-bit character strings. - errors = None # Error handler for unicode conversion. + errors = None # Error handler for unicode conversion. - tarinfo = TarInfo # The default TarInfo class to use. + tarinfo = TarInfo # The default TarInfo class to use. - fileobject = ExFileObject # The default ExFileObject class to use. + fileobject = ExFileObject # The default ExFileObject class to use. - def __init__(self, name=None, mode="r", fileobj=None, format=None, - tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, - errors="surrogateescape", pax_headers=None, debug=None, errorlevel=None): + def __init__( + self, + name=None, + mode="r", + fileobj=None, + format=None, + tarinfo=None, + dereference=None, + ignore_zeros=None, + encoding=None, + errors="surrogateescape", + pax_headers=None, + debug=None, + errorlevel=None, + ): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to - read from an existing archive, 'a' to append data to an existing - file or 'w' to create a new file overwriting an existing one. `mode' - defaults to 'r'. - If `fileobj' is given, it is used for reading or writing data. If it - can be determined, `mode' is overridden by `fileobj's mode. - `fileobj' is not closed, when TarFile is closed. + read from an existing archive, 'a' to append data to an existing + file or 'w' to create a new file overwriting an existing one. `mode' + defaults to 'r'. + If `fileobj' is given, it is used for reading or writing data. If it + can be determined, `mode' is overridden by `fileobj's mode. + `fileobj' is not closed, when TarFile is closed. """ if len(mode) > 1 or mode not in "raw": raise ValueError("mode must be 'r', 'a' or 'w'") @@ -1659,12 +1743,12 @@ def __init__(self, name=None, mode="r", fileobj=None, format=None, # Init datastructures. self.closed = False - self.members = [] # list of members as TarInfo objects - self._loaded = False # flag if all members have been read + self.members = [] # list of members as TarInfo objects + self._loaded = False # flag if all members have been read self.offset = self.fileobj.tell() - # current position in the archive file - self.inodes = {} # dictionary caching the inodes of - # archive members already added + # current position in the archive file + self.inodes = {} # dictionary caching the inodes of + # archive members already added try: if self.mode == "r": @@ -1698,7 +1782,7 @@ def __init__(self, name=None, mode="r", fileobj=None, format=None, self.closed = True raise - #-------------------------------------------------------------------------- + # -------------------------------------------------------------------------- # Below are the classmethods which act as alternate constructors to the # TarFile class. The open() method is the only one that is needed for # public use; it is the "super"-constructor and is able to select an @@ -1712,25 +1796,25 @@ def __init__(self, name=None, mode="r", fileobj=None, format=None, @classmethod def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs): """Open a tar archive for reading, writing or appending. Return - an appropriate TarFile class. - - mode: - 'r' or 'r:*' open for reading with transparent compression - 'r:' open for reading exclusively uncompressed - 'r:gz' open for reading with gzip compression - 'r:bz2' open for reading with bzip2 compression - 'a' or 'a:' open for appending, creating the file if necessary - 'w' or 'w:' open for writing without compression - 'w:gz' open for writing with gzip compression - 'w:bz2' open for writing with bzip2 compression - - 'r|*' open a stream of tar blocks with transparent compression - 'r|' open an uncompressed stream of tar blocks for reading - 'r|gz' open a gzip compressed stream of tar blocks - 'r|bz2' open a bzip2 compressed stream of tar blocks - 'w|' open an uncompressed stream for writing - 'w|gz' open a gzip compressed stream for writing - 'w|bz2' open a bzip2 compressed stream for writing + an appropriate TarFile class. + + mode: + 'r' or 'r:*' open for reading with transparent compression + 'r:' open for reading exclusively uncompressed + 'r:gz' open for reading with gzip compression + 'r:bz2' open for reading with bzip2 compression + 'a' or 'a:' open for appending, creating the file if necessary + 'w' or 'w:' open for writing without compression + 'w:gz' open for writing with gzip compression + 'w:bz2' open for writing with bzip2 compression + + 'r|*' open a stream of tar blocks with transparent compression + 'r|' open an uncompressed stream of tar blocks for reading + 'r|gz' open a gzip compressed stream of tar blocks + 'r|bz2' open a bzip2 compressed stream of tar blocks + 'w|' open an uncompressed stream for writing + 'w|gz' open a gzip compressed stream for writing + 'w|bz2' open a bzip2 compressed stream for writing """ if not name and not fileobj: @@ -1787,8 +1871,7 @@ def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs): @classmethod def taropen(cls, name, mode="r", fileobj=None, **kwargs): - """Open uncompressed tar archive name for reading or writing. - """ + """Open uncompressed tar archive name for reading or writing.""" if len(mode) > 1 or mode not in "raw": raise ValueError("mode must be 'r', 'a' or 'w'") return cls(name, mode, fileobj, **kwargs) @@ -1796,13 +1879,14 @@ def taropen(cls, name, mode="r", fileobj=None, **kwargs): @classmethod def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open gzip compressed tar archive name for reading or writing. - Appending is not allowed. + Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError("mode must be 'r' or 'w'") try: import gzip + gzip.GzipFile except (ImportError, AttributeError): raise CompressionError("gzip module is not available") @@ -1827,7 +1911,7 @@ def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): @classmethod def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open bzip2 compressed tar archive name for reading or writing. - Appending is not allowed. + Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError("mode must be 'r' or 'w'.") @@ -1852,24 +1936,24 @@ def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): # All *open() methods are registered here. OPEN_METH = { - "tar": "taropen", # uncompressed tar - "gz": "gzopen", # gzip compressed tar - "bz2": "bz2open" # bzip2 compressed tar + "tar": "taropen", # uncompressed tar + "gz": "gzopen", # gzip compressed tar + "bz2": "bz2open", # bzip2 compressed tar } - #-------------------------------------------------------------------------- + # -------------------------------------------------------------------------- # The public methods which TarFile provides: def close(self): """Close the TarFile. In write-mode, two finishing zero blocks are - appended to the archive. + appended to the archive. """ if self.closed: return if self.mode in "aw": self.fileobj.write(NUL * (BLOCKSIZE * 2)) - self.offset += (BLOCKSIZE * 2) + self.offset += BLOCKSIZE * 2 # fill up the end with zero-blocks # (like option -b20 for tar does) blocks, remainder = divmod(self.offset, RECORDSIZE) @@ -1882,9 +1966,9 @@ def close(self): def getmember(self, name): """Return a TarInfo object for member `name'. If `name' can not be - found in the archive, KeyError is raised. If a member occurs more - than once in the archive, its last occurrence is assumed to be the - most up-to-date version. + found in the archive, KeyError is raised. If a member occurs more + than once in the archive, its last occurrence is assumed to be the + most up-to-date version. """ tarinfo = self._getmember(name) if tarinfo is None: @@ -1893,26 +1977,26 @@ def getmember(self, name): def getmembers(self): """Return the members of the archive as a list of TarInfo objects. The - list has the same order as the members in the archive. + list has the same order as the members in the archive. """ self._check() - if not self._loaded: # if we want to obtain a list of - self._load() # all members, we first have to - # scan the whole archive. + if not self._loaded: # if we want to obtain a list of + self._load() # all members, we first have to + # scan the whole archive. return self.members def getnames(self): """Return the members of the archive as a list of their names. It has - the same order as the list returned by getmembers(). + the same order as the list returned by getmembers(). """ return [tarinfo.name for tarinfo in self.getmembers()] def gettarinfo(self, name=None, arcname=None, fileobj=None): """Create a TarInfo object for either the file `name' or the file - object `fileobj' (using os.fstat on its file descriptor). You can - modify some of the TarInfo's attributes before you add it using - addfile(). If given, `arcname' specifies an alternative name for the - file in the archive. + object `fileobj' (using os.fstat on its file descriptor). You can + modify some of the TarInfo's attributes before you add it using + addfile(). If given, `arcname' specifies an alternative name for the + file in the archive. """ self._check("aw") @@ -1949,8 +2033,12 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None): stmd = statres.st_mode if stat.S_ISREG(stmd): inode = (statres.st_ino, statres.st_dev) - if not self.dereference and statres.st_nlink > 1 and \ - inode in self.inodes and arcname != self.inodes[inode]: + if ( + not self.dereference + and statres.st_nlink > 1 + and inode in self.inodes + and arcname != self.inodes[inode] + ): # Is it a hardlink to an already # archived file? type = LNKTYPE @@ -2007,43 +2095,50 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None): def list(self, verbose=True): """Print a table of contents to sys.stdout. If `verbose' is False, only - the names of the members are printed. If it is True, an `ls -l'-like - output is produced. + the names of the members are printed. If it is True, an `ls -l'-like + output is produced. """ self._check() for tarinfo in self: if verbose: - print(filemode(tarinfo.mode), end=' ') - print("%s/%s" % (tarinfo.uname or tarinfo.uid, - tarinfo.gname or tarinfo.gid), end=' ') + print(filemode(tarinfo.mode), end=" ") + print( + "%s/%s" + % (tarinfo.uname or tarinfo.uid, tarinfo.gname or tarinfo.gid), + end=" ", + ) if tarinfo.ischr() or tarinfo.isblk(): - print("%10s" % ("%d,%d" \ - % (tarinfo.devmajor, tarinfo.devminor)), end=' ') + print( + "%10s" % ("%d,%d" % (tarinfo.devmajor, tarinfo.devminor)), + end=" ", + ) else: - print("%10d" % tarinfo.size, end=' ') - print("%d-%02d-%02d %02d:%02d:%02d" \ - % time.localtime(tarinfo.mtime)[:6], end=' ') + print("%10d" % tarinfo.size, end=" ") + print( + "%d-%02d-%02d %02d:%02d:%02d" % time.localtime(tarinfo.mtime)[:6], + end=" ", + ) - print(tarinfo.name + ("/" if tarinfo.isdir() else ""), end=' ') + print(tarinfo.name + ("/" if tarinfo.isdir() else ""), end=" ") if verbose: if tarinfo.issym(): - print("->", tarinfo.linkname, end=' ') + print("->", tarinfo.linkname, end=" ") if tarinfo.islnk(): - print("link to", tarinfo.linkname, end=' ') + print("link to", tarinfo.linkname, end=" ") print() def add(self, name, arcname=None, recursive=True, exclude=None, filter=None): """Add the file `name' to the archive. `name' may be any type of file - (directory, fifo, symbolic link, etc.). If given, `arcname' - specifies an alternative name for the file in the archive. - Directories are added recursively by default. This can be avoided by - setting `recursive' to False. `exclude' is a function that should - return True for each filename to be excluded. `filter' is a function - that expects a TarInfo object argument and returns the changed - TarInfo object, if it returns None the TarInfo object will be - excluded from the archive. + (directory, fifo, symbolic link, etc.). If given, `arcname' + specifies an alternative name for the file in the archive. + Directories are added recursively by default. This can be avoided by + setting `recursive' to False. `exclude' is a function that should + return True for each filename to be excluded. `filter' is a function + that expects a TarInfo object argument and returns the changed + TarInfo object, if it returns None the TarInfo object will be + excluded from the archive. """ self._check("aw") @@ -2053,8 +2148,8 @@ def add(self, name, arcname=None, recursive=True, exclude=None, filter=None): # Exclude pathnames. if exclude is not None: import warnings - warnings.warn("use the filter argument instead", - DeprecationWarning, 2) + + warnings.warn("use the filter argument instead", DeprecationWarning, 2) if exclude(name): self._dbg(2, "tarfile: Excluded %r" % name) return @@ -2090,18 +2185,23 @@ def add(self, name, arcname=None, recursive=True, exclude=None, filter=None): self.addfile(tarinfo) if recursive: for f in os.listdir(name): - self.add(os.path.join(name, f), os.path.join(arcname, f), - recursive, exclude, filter=filter) + self.add( + os.path.join(name, f), + os.path.join(arcname, f), + recursive, + exclude, + filter=filter, + ) else: self.addfile(tarinfo) def addfile(self, tarinfo, fileobj=None): """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is - given, tarinfo.size bytes are read from it and added to the archive. - You can create TarInfo objects using gettarinfo(). - On Windows platforms, `fileobj' should always be opened with mode - 'rb' to avoid irritation about the file size. + given, tarinfo.size bytes are read from it and added to the archive. + You can create TarInfo objects using gettarinfo(). + On Windows platforms, `fileobj' should always be opened with mode + 'rb' to avoid irritation about the file size. """ self._check("aw") @@ -2124,10 +2224,10 @@ def addfile(self, tarinfo, fileobj=None): def extractall(self, path=".", members=None): """Extract all members from the archive to the current working - directory and set owner, modification time and permissions on - directories afterwards. `path' specifies a different directory - to extract to. `members' is optional and must be a subset of the - list returned by getmembers(). + directory and set owner, modification time and permissions on + directories afterwards. `path' specifies a different directory + to extract to. `members' is optional and must be a subset of the + list returned by getmembers(). """ directories = [] @@ -2162,10 +2262,10 @@ def extractall(self, path=".", members=None): def extract(self, member, path="", set_attrs=True): """Extract a member from the archive to the current working directory, - using its full name. Its file information is extracted as accurately - as possible. `member' may be a filename or a TarInfo object. You can - specify a different directory using `path'. File attributes (owner, - mtime, mode) are set unless `set_attrs' is False. + using its full name. Its file information is extracted as accurately + as possible. `member' may be a filename or a TarInfo object. You can + specify a different directory using `path'. File attributes (owner, + mtime, mode) are set unless `set_attrs' is False. """ self._check("r") @@ -2179,8 +2279,9 @@ def extract(self, member, path="", set_attrs=True): tarinfo._link_target = os.path.join(path, tarinfo.linkname) try: - self._extract_member(tarinfo, os.path.join(path, tarinfo.name), - set_attrs=set_attrs) + self._extract_member( + tarinfo, os.path.join(path, tarinfo.name), set_attrs=set_attrs + ) except EnvironmentError as e: if self.errorlevel > 0: raise @@ -2197,12 +2298,12 @@ def extract(self, member, path="", set_attrs=True): def extractfile(self, member): """Extract a member from the archive as a file object. `member' may be - a filename or a TarInfo object. If `member' is a regular file, a - file-like object is returned. If `member' is a link, a file-like - object is constructed from the link's target. If `member' is none of - the above, None is returned. - The file-like object is read-only and provides the following - methods: read(), readline(), readlines(), seek() and tell() + a filename or a TarInfo object. If `member' is a regular file, a + file-like object is returned. If `member' is a link, a file-like + object is constructed from the link's target. If `member' is none of + the above, None is returned. + The file-like object is read-only and provides the following + methods: read(), readline(), readlines(), seek() and tell() """ self._check("r") @@ -2235,7 +2336,7 @@ def extractfile(self, member): def _extract_member(self, tarinfo, targetpath, set_attrs=True): """Extract the TarInfo object tarinfo to a physical - file called targetpath. + file called targetpath. """ # Fetch the TarInfo object for the given name # and build the destination pathname, replacing @@ -2276,14 +2377,13 @@ def _extract_member(self, tarinfo, targetpath, set_attrs=True): self.chmod(tarinfo, targetpath) self.utime(tarinfo, targetpath) - #-------------------------------------------------------------------------- + # -------------------------------------------------------------------------- # Below are the different file methods. They are called via # _extract_member() when extract() is called. They can be replaced in a # subclass to implement other functionality. def makedir(self, tarinfo, targetpath): - """Make a directory called targetpath. - """ + """Make a directory called targetpath.""" try: # Use a safe mode for the directory, the real mode is set # later in _extract_member(). @@ -2293,8 +2393,7 @@ def makedir(self, tarinfo, targetpath): raise def makefile(self, tarinfo, targetpath): - """Make a file called targetpath. - """ + """Make a file called targetpath.""" source = self.fileobj source.seek(tarinfo.offset_data) target = bltn_open(targetpath, "wb") @@ -2310,23 +2409,24 @@ def makefile(self, tarinfo, targetpath): def makeunknown(self, tarinfo, targetpath): """Make a file from a TarInfo object with an unknown type - at targetpath. + at targetpath. """ self.makefile(tarinfo, targetpath) - self._dbg(1, "tarfile: Unknown file type %r, " \ - "extracted as regular file." % tarinfo.type) + self._dbg( + 1, + "tarfile: Unknown file type %r, " + "extracted as regular file." % tarinfo.type, + ) def makefifo(self, tarinfo, targetpath): - """Make a fifo called targetpath. - """ + """Make a fifo called targetpath.""" if hasattr(os, "mkfifo"): os.mkfifo(targetpath) else: raise ExtractError("fifo not supported by system") def makedev(self, tarinfo, targetpath): - """Make a character or block device called targetpath. - """ + """Make a character or block device called targetpath.""" if not hasattr(os, "mknod") or not hasattr(os, "makedev"): raise ExtractError("special devices not supported by system") @@ -2336,13 +2436,12 @@ def makedev(self, tarinfo, targetpath): else: mode |= stat.S_IFCHR - os.mknod(targetpath, mode, - os.makedev(tarinfo.devmajor, tarinfo.devminor)) + os.mknod(targetpath, mode, os.makedev(tarinfo.devmajor, tarinfo.devminor)) def makelink(self, tarinfo, targetpath): """Make a (symbolic) link called targetpath. If it cannot be created - (platform limitation), we try to make a copy of the referenced file - instead of a link. + (platform limitation), we try to make a copy of the referenced file + instead of a link. """ try: # For systems that support symbolic and hard links. @@ -2353,24 +2452,20 @@ def makelink(self, tarinfo, targetpath): if os.path.exists(tarinfo._link_target): os.link(tarinfo._link_target, targetpath) else: - self._extract_member(self._find_link_target(tarinfo), - targetpath) + self._extract_member(self._find_link_target(tarinfo), targetpath) except symlink_exception: if tarinfo.issym(): - linkpath = os.path.join(os.path.dirname(tarinfo.name), - tarinfo.linkname) + linkpath = os.path.join(os.path.dirname(tarinfo.name), tarinfo.linkname) else: linkpath = tarinfo.linkname else: try: - self._extract_member(self._find_link_target(tarinfo), - targetpath) + self._extract_member(self._find_link_target(tarinfo), targetpath) except KeyError: raise ExtractError("unable to resolve link inside archive") def chown(self, tarinfo, targetpath): - """Set owner of targetpath according to tarinfo. - """ + """Set owner of targetpath according to tarinfo.""" if pwd and hasattr(os, "geteuid") and os.geteuid() == 0: # We have to be root to do so. try: @@ -2391,29 +2486,27 @@ def chown(self, tarinfo, targetpath): raise ExtractError("could not change owner") def chmod(self, tarinfo, targetpath): - """Set file permissions of targetpath according to tarinfo. - """ - if hasattr(os, 'chmod'): + """Set file permissions of targetpath according to tarinfo.""" + if hasattr(os, "chmod"): try: os.chmod(targetpath, tarinfo.mode) except EnvironmentError as e: raise ExtractError("could not change mode") def utime(self, tarinfo, targetpath): - """Set modification time of targetpath according to tarinfo. - """ - if not hasattr(os, 'utime'): + """Set modification time of targetpath according to tarinfo.""" + if not hasattr(os, "utime"): return try: os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime)) except EnvironmentError as e: raise ExtractError("could not change modification time") - #-------------------------------------------------------------------------- + # -------------------------------------------------------------------------- def next(self): """Return the next member of the archive as a TarInfo object, when - TarFile is opened for reading. Return None if there is no more - available. + TarFile is opened for reading. Return None if there is no more + available. """ self._check("ra") if self.firstmember is not None: @@ -2456,19 +2549,19 @@ def next(self): return tarinfo - #-------------------------------------------------------------------------- + # -------------------------------------------------------------------------- # Little helper methods: def _getmember(self, name, tarinfo=None, normalize=False): """Find an archive member by name from bottom to top. - If tarinfo is given, it is used as the starting point. + If tarinfo is given, it is used as the starting point. """ # Ensure that all members have been loaded. members = self.getmembers() # Limit the member search list up to tarinfo. if tarinfo is not None: - members = members[:members.index(tarinfo)] + members = members[: members.index(tarinfo)] if normalize: name = os.path.normpath(name) @@ -2484,7 +2577,7 @@ def _getmember(self, name, tarinfo=None, normalize=False): def _load(self): """Read through the entire archive file and look for readable - members. + members. """ while True: tarinfo = self.next() @@ -2494,7 +2587,7 @@ def _load(self): def _check(self, mode=None): """Check if TarFile is still open, and if the operation's mode - corresponds to TarFile's mode. + corresponds to TarFile's mode. """ if self.closed: raise IOError("%s is closed" % self.__class__.__name__) @@ -2503,7 +2596,7 @@ def _check(self, mode=None): def _find_link_target(self, tarinfo): """Find the target member of a symlink or hardlink member in the - archive. + archive. """ if tarinfo.issym(): # Always search the entire archive. @@ -2521,16 +2614,14 @@ def _find_link_target(self, tarinfo): return member def __iter__(self): - """Provide an iterator object. - """ + """Provide an iterator object.""" if self._loaded: return iter(self.members) else: return TarIter(self) def _dbg(self, level, msg): - """Write debugging output to sys.stderr. - """ + """Write debugging output to sys.stderr.""" if level <= self.debug: print(msg, file=sys.stderr) @@ -2547,28 +2638,30 @@ def __exit__(self, type, value, traceback): if not self._extfileobj: self.fileobj.close() self.closed = True + + # class TarFile + class TarIter(object): """Iterator Class. - for tarinfo in TarFile(...): - suite... + for tarinfo in TarFile(...): + suite... """ def __init__(self, tarfile): - """Construct a TarIter object. - """ + """Construct a TarIter object.""" self.tarfile = tarfile self.index = 0 + def __iter__(self): - """Return iterator object. - """ + """Return iterator object.""" return self def __next__(self): """Return the next item using TarFile's next() method. - When all members have been read, set TarFile as _loaded. + When all members have been read, set TarFile as _loaded. """ # Fix for SF #1100429: Under rare circumstances it can # happen that getmembers() is called during iteration, @@ -2586,14 +2679,15 @@ def __next__(self): self.index += 1 return tarinfo - next = __next__ # for Python 2.x + next = __next__ # for Python 2.x -#-------------------- + +# -------------------- # exported functions -#-------------------- +# -------------------- def is_tarfile(name): """Return True if name points to a tar archive that we - are able to handle, else return False. + are able to handle, else return False. """ try: t = open(name) @@ -2602,5 +2696,6 @@ def is_tarfile(name): except TarError: return False + bltn_open = open open = TarFile.open diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/compat.py b/src/fetchcode/vcs/pip/_vendor/distlib/compat.py index 085b8255..7fdc71d6 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/compat.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/compat.py @@ -16,26 +16,42 @@ if sys.version_info[0] < 3: # pragma: no cover from StringIO import StringIO - string_types = basestring, + + string_types = (basestring,) text_type = unicode from types import FileType as file_type import __builtin__ as builtins import ConfigParser as configparser from ._backport import shutil from urlparse import urlparse, urlunparse, urljoin, urlsplit, urlunsplit - from urllib import (urlretrieve, quote as _quote, unquote, url2pathname, - pathname2url, ContentTooShortError, splittype) + from urllib import ( + urlretrieve, + quote as _quote, + unquote, + url2pathname, + pathname2url, + ContentTooShortError, + splittype, + ) def quote(s): if isinstance(s, unicode): - s = s.encode('utf-8') + s = s.encode("utf-8") return _quote(s) import urllib2 - from urllib2 import (Request, urlopen, URLError, HTTPError, - HTTPBasicAuthHandler, HTTPPasswordMgr, - HTTPHandler, HTTPRedirectHandler, - build_opener) + from urllib2 import ( + Request, + urlopen, + URLError, + HTTPError, + HTTPBasicAuthHandler, + HTTPPasswordMgr, + HTTPHandler, + HTTPRedirectHandler, + build_opener, + ) + if ssl: from urllib2 import HTTPSHandler import httplib @@ -43,37 +59,59 @@ def quote(s): import Queue as queue from HTMLParser import HTMLParser import htmlentitydefs + raw_input = raw_input from itertools import ifilter as filter from itertools import ifilterfalse as filterfalse _userprog = None + def splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" global _userprog if _userprog is None: import re - _userprog = re.compile('^(.*)@(.*)$') + + _userprog = re.compile("^(.*)@(.*)$") match = _userprog.match(host) - if match: return match.group(1, 2) + if match: + return match.group(1, 2) return None, host else: # pragma: no cover from io import StringIO - string_types = str, + + string_types = (str,) text_type = str from io import TextIOWrapper as file_type import builtins import configparser import shutil - from urllib.parse import (urlparse, urlunparse, urljoin, splituser, quote, - unquote, urlsplit, urlunsplit, splittype) - from urllib.request import (urlopen, urlretrieve, Request, url2pathname, - pathname2url, - HTTPBasicAuthHandler, HTTPPasswordMgr, - HTTPHandler, HTTPRedirectHandler, - build_opener) + from urllib.parse import ( + urlparse, + urlunparse, + urljoin, + splituser, + quote, + unquote, + urlsplit, + urlunsplit, + splittype, + ) + from urllib.request import ( + urlopen, + urlretrieve, + Request, + url2pathname, + pathname2url, + HTTPBasicAuthHandler, + HTTPPasswordMgr, + HTTPHandler, + HTTPRedirectHandler, + build_opener, + ) + if ssl: from urllib.request import HTTPSHandler from urllib.error import HTTPError, URLError, ContentTooShortError @@ -83,17 +121,19 @@ def splituser(host): import queue from html.parser import HTMLParser import html.entities as htmlentitydefs + raw_input = input from itertools import filterfalse + filter = filter try: from ssl import match_hostname, CertificateError -except ImportError: # pragma: no cover +except ImportError: # pragma: no cover + class CertificateError(ValueError): pass - def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 @@ -103,17 +143,18 @@ def _dnsname_match(dn, hostname, max_wildcards=1): if not dn: return False - parts = dn.split('.') + parts = dn.split(".") leftmost, remainder = parts[0], parts[1:] - wildcards = leftmost.count('*') + wildcards = leftmost.count("*") if wildcards > max_wildcards: # Issue #17980: avoid denials of service by refusing more # than one wildcard per fragment. A survey of established # policy among SSL implementations showed it to be a # reasonable choice. raise CertificateError( - "too many wildcards in certificate DNS name: " + repr(dn)) + "too many wildcards in certificate DNS name: " + repr(dn) + ) # speed up common case w/o wildcards if not wildcards: @@ -122,11 +163,11 @@ def _dnsname_match(dn, hostname, max_wildcards=1): # RFC 6125, section 6.4.3, subitem 1. # The client SHOULD NOT attempt to match a presented identifier in which # the wildcard character comprises a label other than the left-most label. - if leftmost == '*': + if leftmost == "*": # When '*' is a fragment by itself, it matches a non-empty dotless # fragment. - pats.append('[^.]+') - elif leftmost.startswith('xn--') or hostname.startswith('xn--'): + pats.append("[^.]+") + elif leftmost.startswith("xn--") or hostname.startswith("xn--"): # RFC 6125, section 6.4.3, subitem 3. # The client SHOULD NOT attempt to match a presented identifier # where the wildcard character is embedded within an A-label or @@ -134,16 +175,15 @@ def _dnsname_match(dn, hostname, max_wildcards=1): pats.append(re.escape(leftmost)) else: # Otherwise, '*' matches any dotless string, e.g. www* - pats.append(re.escape(leftmost).replace(r'\*', '[^.]*')) + pats.append(re.escape(leftmost).replace(r"\*", "[^.]*")) # add the remaining fragments, ignore any wildcards for frag in remainder: pats.append(re.escape(frag)) - pat = re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE) + pat = re.compile(r"\A" + r"\.".join(pats) + r"\Z", re.IGNORECASE) return pat.match(hostname) - def match_hostname(cert, hostname): """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 @@ -153,47 +193,54 @@ def match_hostname(cert, hostname): returns nothing. """ if not cert: - raise ValueError("empty or no certificate, match_hostname needs a " - "SSL socket or SSL context with either " - "CERT_OPTIONAL or CERT_REQUIRED") + raise ValueError( + "empty or no certificate, match_hostname needs a " + "SSL socket or SSL context with either " + "CERT_OPTIONAL or CERT_REQUIRED" + ) dnsnames = [] - san = cert.get('subjectAltName', ()) + san = cert.get("subjectAltName", ()) for key, value in san: - if key == 'DNS': + if key == "DNS": if _dnsname_match(value, hostname): return dnsnames.append(value) if not dnsnames: # The subject is only checked when there is no dNSName entry # in subjectAltName - for sub in cert.get('subject', ()): + for sub in cert.get("subject", ()): for key, value in sub: # XXX according to RFC 2818, the most specific Common Name # must be used. - if key == 'commonName': + if key == "commonName": if _dnsname_match(value, hostname): return dnsnames.append(value) if len(dnsnames) > 1: - raise CertificateError("hostname %r " + raise CertificateError( + "hostname %r " "doesn't match either of %s" - % (hostname, ', '.join(map(repr, dnsnames)))) + % (hostname, ", ".join(map(repr, dnsnames))) + ) elif len(dnsnames) == 1: - raise CertificateError("hostname %r " - "doesn't match %r" - % (hostname, dnsnames[0])) + raise CertificateError( + "hostname %r " "doesn't match %r" % (hostname, dnsnames[0]) + ) else: - raise CertificateError("no appropriate commonName or " - "subjectAltName fields were found") + raise CertificateError( + "no appropriate commonName or " "subjectAltName fields were found" + ) try: from types import SimpleNamespace as Container except ImportError: # pragma: no cover + class Container(object): """ A generic container for when multiple values need to be returned """ + def __init__(self, **kwargs): self.__dict__.update(kwargs) @@ -216,8 +263,7 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None): # Additionally check that `file` is not a directory, as on Windows # directories pass the os.access check. def _access_check(fn, mode): - return (os.path.exists(fn) and os.access(fn, mode) - and not os.path.isdir(fn)) + return os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn) # If we're given a path with a directory part, look it up directly rather # than referring to PATH directories. This includes checking relative to the @@ -269,7 +315,7 @@ def _access_check(fn, mode): from zipfile import ZipFile as BaseZipFile -if hasattr(BaseZipFile, '__enter__'): # pragma: no cover +if hasattr(BaseZipFile, "__enter__"): # pragma: no cover ZipFile = BaseZipFile else: # pragma: no cover from zipfile import ZipExtFile as BaseZipExtFile @@ -297,27 +343,30 @@ def open(self, *args, **kwargs): base = BaseZipFile.open(self, *args, **kwargs) return ZipExtFile(base) + try: from platform import python_implementation -except ImportError: # pragma: no cover +except ImportError: # pragma: no cover + def python_implementation(): """Return a string identifying the Python implementation.""" - if 'PyPy' in sys.version: - return 'PyPy' - if os.name == 'java': - return 'Jython' - if sys.version.startswith('IronPython'): - return 'IronPython' - return 'CPython' + if "PyPy" in sys.version: + return "PyPy" + if os.name == "java": + return "Jython" + if sys.version.startswith("IronPython"): + return "IronPython" + return "CPython" + try: import sysconfig -except ImportError: # pragma: no cover +except ImportError: # pragma: no cover from ._backport import sysconfig try: callable = callable -except NameError: # pragma: no cover +except NameError: # pragma: no cover from collections import Callable def callable(obj): @@ -334,11 +383,11 @@ def callable(obj): # sys.getfilesystemencoding(): the return value is "the user’s preference # according to the result of nl_langinfo(CODESET), or None if the # nl_langinfo(CODESET) failed." - _fsencoding = sys.getfilesystemencoding() or 'utf-8' - if _fsencoding == 'mbcs': - _fserrors = 'strict' + _fsencoding = sys.getfilesystemencoding() or "utf-8" + if _fsencoding == "mbcs": + _fserrors = "strict" else: - _fserrors = 'surrogateescape' + _fserrors = "surrogateescape" def fsencode(filename): if isinstance(filename, bytes): @@ -346,8 +395,7 @@ def fsencode(filename): elif isinstance(filename, text_type): return filename.encode(_fsencoding, _fserrors) else: - raise TypeError("expect bytes or str, not %s" % - type(filename).__name__) + raise TypeError("expect bytes or str, not %s" % type(filename).__name__) def fsdecode(filename): if isinstance(filename, text_type): @@ -355,12 +403,12 @@ def fsdecode(filename): elif isinstance(filename, bytes): return filename.decode(_fsencoding, _fserrors) else: - raise TypeError("expect bytes or str, not %s" % - type(filename).__name__) + raise TypeError("expect bytes or str, not %s" % type(filename).__name__) + try: from tokenize import detect_encoding -except ImportError: # pragma: no cover +except ImportError: # pragma: no cover from codecs import BOM_UTF8, lookup import re @@ -372,8 +420,9 @@ def _get_normal_name(orig_enc): enc = orig_enc[:12].lower().replace("_", "-") if enc == "utf-8" or enc.startswith("utf-8-"): return "utf-8" - if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \ - enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")): + if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or enc.startswith( + ("latin-1-", "iso-8859-1-", "iso-latin-1-") + ): return "iso-8859-1" return orig_enc @@ -400,23 +449,24 @@ def detect_encoding(readline): filename = None bom_found = False encoding = None - default = 'utf-8' + default = "utf-8" + def read_or_stop(): try: return readline() except StopIteration: - return b'' + return b"" def find_cookie(line): try: # Decode as UTF-8. Either the line is an encoding declaration, # in which case it should be pure ASCII, or it must be UTF-8 # per default encoding. - line_string = line.decode('utf-8') + line_string = line.decode("utf-8") except UnicodeDecodeError: msg = "invalid or missing encoding declaration" if filename is not None: - msg = '{} for {!r}'.format(msg, filename) + msg = "{} for {!r}".format(msg, filename) raise SyntaxError(msg) matches = cookie_re.findall(line_string) @@ -430,26 +480,25 @@ def find_cookie(line): if filename is None: msg = "unknown encoding: " + encoding else: - msg = "unknown encoding for {!r}: {}".format(filename, - encoding) + msg = "unknown encoding for {!r}: {}".format(filename, encoding) raise SyntaxError(msg) if bom_found: - if codec.name != 'utf-8': + if codec.name != "utf-8": # This behaviour mimics the Python interpreter if filename is None: - msg = 'encoding problem: utf-8' + msg = "encoding problem: utf-8" else: - msg = 'encoding problem for {!r}: utf-8'.format(filename) + msg = "encoding problem for {!r}: utf-8".format(filename) raise SyntaxError(msg) - encoding += '-sig' + encoding += "-sig" return encoding first = read_or_stop() if first.startswith(BOM_UTF8): bom_found = True first = first[3:] - default = 'utf-8-sig' + default = "utf-8-sig" if not first: return default, [] @@ -467,6 +516,7 @@ def find_cookie(line): return default, [first, second] + # For converting & <-> & etc. try: from html import escape @@ -479,17 +529,18 @@ def find_cookie(line): try: from collections import ChainMap -except ImportError: # pragma: no cover +except ImportError: # pragma: no cover from collections import MutableMapping try: from reprlib import recursive_repr as _recursive_repr except ImportError: - def _recursive_repr(fillvalue='...'): - ''' + + def _recursive_repr(fillvalue="..."): + """ Decorator to make a repr function return fillvalue for a recursive call - ''' + """ def decorating_function(user_function): repr_running = set() @@ -506,16 +557,16 @@ def wrapper(self): return result # Can't use functools.wraps() here because of bootstrap issues - wrapper.__module__ = getattr(user_function, '__module__') - wrapper.__doc__ = getattr(user_function, '__doc__') - wrapper.__name__ = getattr(user_function, '__name__') - wrapper.__annotations__ = getattr(user_function, '__annotations__', {}) + wrapper.__module__ = getattr(user_function, "__module__") + wrapper.__doc__ = getattr(user_function, "__doc__") + wrapper.__name__ = getattr(user_function, "__name__") + wrapper.__annotations__ = getattr(user_function, "__annotations__", {}) return wrapper return decorating_function class ChainMap(MutableMapping): - ''' A ChainMap groups multiple dicts (or other mappings) together + """A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can @@ -525,14 +576,14 @@ class ChainMap(MutableMapping): In contrast, writes, updates, and deletions only operate on the first mapping. - ''' + """ def __init__(self, *maps): - '''Initialize a ChainMap by setting *maps* to the given mappings. + """Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. - ''' - self.maps = list(maps) or [{}] # always at least one map + """ + self.maps = list(maps) or [{}] # always at least one map def __missing__(self, key): raise KeyError(key) @@ -540,16 +591,16 @@ def __missing__(self, key): def __getitem__(self, key): for mapping in self.maps: try: - return mapping[key] # can't use 'key in mapping' with defaultdict + return mapping[key] # can't use 'key in mapping' with defaultdict except KeyError: pass - return self.__missing__(key) # support subclasses that define __missing__ + return self.__missing__(key) # support subclasses that define __missing__ def get(self, key, default=None): return self[key] if key in self else default def __len__(self): - return len(set().union(*self.maps)) # reuses stored hash values if possible + return len(set().union(*self.maps)) # reuses stored hash values if possible def __iter__(self): return iter(set().union(*self.maps)) @@ -562,27 +613,28 @@ def __bool__(self): @_recursive_repr() def __repr__(self): - return '{0.__class__.__name__}({1})'.format( - self, ', '.join(map(repr, self.maps))) + return "{0.__class__.__name__}({1})".format( + self, ", ".join(map(repr, self.maps)) + ) @classmethod def fromkeys(cls, iterable, *args): - 'Create a ChainMap with a single dict created from the iterable.' + "Create a ChainMap with a single dict created from the iterable." return cls(dict.fromkeys(iterable, *args)) def copy(self): - 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]' + "New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]" return self.__class__(self.maps[0].copy(), *self.maps[1:]) __copy__ = copy - def new_child(self): # like Django's Context.push() - 'New ChainMap with a new dict followed by all previous maps.' + def new_child(self): # like Django's Context.push() + "New ChainMap with a new dict followed by all previous maps." return self.__class__({}, *self.maps) @property - def parents(self): # like Django's Context.pop() - 'New ChainMap from maps[1:].' + def parents(self): # like Django's Context.pop() + "New ChainMap from maps[1:]." return self.__class__(*self.maps[1:]) def __setitem__(self, key, value): @@ -592,48 +644,51 @@ def __delitem__(self, key): try: del self.maps[0][key] except KeyError: - raise KeyError('Key not found in the first mapping: {!r}'.format(key)) + raise KeyError("Key not found in the first mapping: {!r}".format(key)) def popitem(self): - 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.' + "Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty." try: return self.maps[0].popitem() except KeyError: - raise KeyError('No keys found in the first mapping.') + raise KeyError("No keys found in the first mapping.") def pop(self, key, *args): - 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' + "Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0]." try: return self.maps[0].pop(key, *args) except KeyError: - raise KeyError('Key not found in the first mapping: {!r}'.format(key)) + raise KeyError("Key not found in the first mapping: {!r}".format(key)) def clear(self): - 'Clear maps[0], leaving maps[1:] intact.' + "Clear maps[0], leaving maps[1:] intact." self.maps[0].clear() + try: from importlib.util import cache_from_source # Python >= 3.4 except ImportError: # pragma: no cover try: from imp import cache_from_source except ImportError: # pragma: no cover + def cache_from_source(path, debug_override=None): - assert path.endswith('.py') + assert path.endswith(".py") if debug_override is None: debug_override = __debug__ if debug_override: - suffix = 'c' + suffix = "c" else: - suffix = 'o' + suffix = "o" return path + suffix + try: from collections import OrderedDict -except ImportError: # pragma: no cover -## {{{ http://code.activestate.com/recipes/576693/ (r9) -# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy. -# Passes Python2.7's test suite and incorporates all the latest updates. +except ImportError: # pragma: no cover + ## {{{ http://code.activestate.com/recipes/576693/ (r9) + # Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy. + # Passes Python2.7's test suite and incorporates all the latest updates. try: from thread import get_ident as _get_ident except ImportError: @@ -644,9 +699,8 @@ def cache_from_source(path, debug_override=None): except ImportError: pass - class OrderedDict(dict): - 'Dictionary that remembers insertion order' + "Dictionary that remembers insertion order" # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. @@ -658,23 +712,23 @@ class OrderedDict(dict): # Each link is stored as a list of length three: [PREV, NEXT, KEY]. def __init__(self, *args, **kwds): - '''Initialize an ordered dictionary. Signature is the same as for + """Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. - ''' + """ if len(args) > 1: - raise TypeError('expected at most 1 arguments, got %d' % len(args)) + raise TypeError("expected at most 1 arguments, got %d" % len(args)) try: self.__root except AttributeError: - self.__root = root = [] # sentinel node + self.__root = root = [] # sentinel node root[:] = [root, root, None] self.__map = {} self.__update(*args, **kwds) def __setitem__(self, key, value, dict_setitem=dict.__setitem__): - 'od.__setitem__(i, y) <==> od[i]=y' + "od.__setitem__(i, y) <==> od[i]=y" # Setting a new item creates a new link which goes at the end of the linked # list, and the inherited dictionary is updated with the new key/value pair. if key not in self: @@ -684,7 +738,7 @@ def __setitem__(self, key, value, dict_setitem=dict.__setitem__): dict_setitem(self, key, value) def __delitem__(self, key, dict_delitem=dict.__delitem__): - 'od.__delitem__(y) <==> del od[y]' + "od.__delitem__(y) <==> del od[y]" # Deleting an existing item uses self.__map to find the link which is # then removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) @@ -693,7 +747,7 @@ def __delitem__(self, key, dict_delitem=dict.__delitem__): link_next[0] = link_prev def __iter__(self): - 'od.__iter__() <==> iter(od)' + "od.__iter__() <==> iter(od)" root = self.__root curr = root[1] while curr is not root: @@ -701,7 +755,7 @@ def __iter__(self): curr = curr[1] def __reversed__(self): - 'od.__reversed__() <==> reversed(od)' + "od.__reversed__() <==> reversed(od)" root = self.__root curr = root[0] while curr is not root: @@ -709,7 +763,7 @@ def __reversed__(self): curr = curr[0] def clear(self): - 'od.clear() -> None. Remove all items from od.' + "od.clear() -> None. Remove all items from od." try: for node in self.__map.itervalues(): del node[:] @@ -721,12 +775,12 @@ def clear(self): dict.clear(self) def popitem(self, last=True): - '''od.popitem() -> (k, v), return and remove a (key, value) pair. + """od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. - ''' + """ if not self: - raise KeyError('dictionary is empty') + raise KeyError("dictionary is empty") root = self.__root if last: link = root[0] @@ -746,45 +800,47 @@ def popitem(self, last=True): # -- the following methods do not depend on the internal structure -- def keys(self): - 'od.keys() -> list of keys in od' + "od.keys() -> list of keys in od" return list(self) def values(self): - 'od.values() -> list of values in od' + "od.values() -> list of values in od" return [self[key] for key in self] def items(self): - 'od.items() -> list of (key, value) pairs in od' + "od.items() -> list of (key, value) pairs in od" return [(key, self[key]) for key in self] def iterkeys(self): - 'od.iterkeys() -> an iterator over the keys in od' + "od.iterkeys() -> an iterator over the keys in od" return iter(self) def itervalues(self): - 'od.itervalues -> an iterator over the values in od' + "od.itervalues -> an iterator over the values in od" for k in self: yield self[k] def iteritems(self): - 'od.iteritems -> an iterator over the (key, value) items in od' + "od.iteritems -> an iterator over the (key, value) items in od" for k in self: yield (k, self[k]) def update(*args, **kwds): - '''od.update(E, **F) -> None. Update od from dict/iterable E and F. + """od.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v - ''' + """ if len(args) > 2: - raise TypeError('update() takes at most 2 positional ' - 'arguments (%d given)' % (len(args),)) + raise TypeError( + "update() takes at most 2 positional " + "arguments (%d given)" % (len(args),) + ) elif not args: - raise TypeError('update() takes at least 1 argument (0 given)') + raise TypeError("update() takes at least 1 argument (0 given)") self = args[0] # Make progressively weaker assumptions about "other" other = () @@ -793,7 +849,7 @@ def update(*args, **kwds): if isinstance(other, dict): for key in other: self[key] = other[key] - elif hasattr(other, 'keys'): + elif hasattr(other, "keys"): for key in other.keys(): self[key] = other[key] else: @@ -807,10 +863,10 @@ def update(*args, **kwds): __marker = object() def pop(self, key, default=__marker): - '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. + """od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. - ''' + """ if key in self: result = self[key] del self[key] @@ -820,28 +876,29 @@ def pop(self, key, default=__marker): return default def setdefault(self, key, default=None): - 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' + "od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od" if key in self: return self[key] self[key] = default return default def __repr__(self, _repr_running=None): - 'od.__repr__() <==> repr(od)' - if not _repr_running: _repr_running = {} + "od.__repr__() <==> repr(od)" + if not _repr_running: + _repr_running = {} call_key = id(self), _get_ident() if call_key in _repr_running: - return '...' + return "..." _repr_running[call_key] = 1 try: if not self: - return '%s()' % (self.__class__.__name__,) - return '%s(%r)' % (self.__class__.__name__, self.items()) + return "%s()" % (self.__class__.__name__,) + return "%s(%r)" % (self.__class__.__name__, self.items()) finally: del _repr_running[call_key] def __reduce__(self): - 'Return state information for pickling' + "Return state information for pickling" items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): @@ -851,27 +908,27 @@ def __reduce__(self): return self.__class__, (items,) def copy(self): - 'od.copy() -> a shallow copy of od' + "od.copy() -> a shallow copy of od" return self.__class__(self) @classmethod def fromkeys(cls, iterable, value=None): - '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S + """OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). - ''' + """ d = cls() for key in iterable: d[key] = value return d def __eq__(self, other): - '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive + """od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. - ''' + """ if isinstance(other, OrderedDict): - return len(self)==len(other) and self.items() == other.items() + return len(self) == len(other) and self.items() == other.items() return dict.__eq__(self, other) def __ne__(self, other): @@ -891,19 +948,18 @@ def viewitems(self): "od.viewitems() -> a set-like object providing a view on od's items" return ItemsView(self) + try: from logging.config import BaseConfigurator, valid_ident -except ImportError: # pragma: no cover - IDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.I) - +except ImportError: # pragma: no cover + IDENTIFIER = re.compile("^[a-z_][a-z0-9_]*$", re.I) def valid_ident(s): m = IDENTIFIER.match(s) if not m: - raise ValueError('Not a valid Python identifier: %r' % s) + raise ValueError("Not a valid Python identifier: %r" % s) return True - # The ConvertingXXX classes are wrappers around standard Python containers, # and they serve to convert any suitable values in the container. The # conversion converts base dicts, lists and tuples to their wrapped @@ -919,11 +975,10 @@ class ConvertingDict(dict): def __getitem__(self, key): value = dict.__getitem__(self, key) result = self.configurator.convert(value) - #If the converted value is different, save for next time + # If the converted value is different, save for next time if value is not result: self[key] = result - if type(result) in (ConvertingDict, ConvertingList, - ConvertingTuple): + if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result @@ -931,11 +986,10 @@ def __getitem__(self, key): def get(self, key, default=None): value = dict.get(self, key, default) result = self.configurator.convert(value) - #If the converted value is different, save for next time + # If the converted value is different, save for next time if value is not result: self[key] = result - if type(result) in (ConvertingDict, ConvertingList, - ConvertingTuple): + if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result @@ -944,22 +998,21 @@ def pop(self, key, default=None): value = dict.pop(self, key, default) result = self.configurator.convert(value) if value is not result: - if type(result) in (ConvertingDict, ConvertingList, - ConvertingTuple): + if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result class ConvertingList(list): """A converting list wrapper.""" + def __getitem__(self, key): value = list.__getitem__(self, key) result = self.configurator.convert(value) - #If the converted value is different, save for next time + # If the converted value is different, save for next time if value is not result: self[key] = result - if type(result) in (ConvertingDict, ConvertingList, - ConvertingTuple): + if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result @@ -968,19 +1021,18 @@ def pop(self, idx=-1): value = list.pop(self, idx) result = self.configurator.convert(value) if value is not result: - if type(result) in (ConvertingDict, ConvertingList, - ConvertingTuple): + if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self return result class ConvertingTuple(tuple): """A converting tuple wrapper.""" + def __getitem__(self, key): value = tuple.__getitem__(self, key) result = self.configurator.convert(value) if value is not result: - if type(result) in (ConvertingDict, ConvertingList, - ConvertingTuple): + if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result @@ -990,16 +1042,16 @@ class BaseConfigurator(object): The configurator base class which defines some useful defaults. """ - CONVERT_PATTERN = re.compile(r'^(?P[a-z]+)://(?P.*)$') + CONVERT_PATTERN = re.compile(r"^(?P[a-z]+)://(?P.*)$") - WORD_PATTERN = re.compile(r'^\s*(\w+)\s*') - DOT_PATTERN = re.compile(r'^\.\s*(\w+)\s*') - INDEX_PATTERN = re.compile(r'^\[\s*(\w+)\s*\]\s*') - DIGIT_PATTERN = re.compile(r'^\d+$') + WORD_PATTERN = re.compile(r"^\s*(\w+)\s*") + DOT_PATTERN = re.compile(r"^\.\s*(\w+)\s*") + INDEX_PATTERN = re.compile(r"^\[\s*(\w+)\s*\]\s*") + DIGIT_PATTERN = re.compile(r"^\d+$") value_converters = { - 'ext' : 'ext_convert', - 'cfg' : 'cfg_convert', + "ext": "ext_convert", + "cfg": "cfg_convert", } # We might want to use a different one, e.g. importlib @@ -1014,12 +1066,12 @@ def resolve(self, s): Resolve strings to objects using standard import and attribute syntax. """ - name = s.split('.') + name = s.split(".") used = name.pop(0) try: found = self.importer(used) for frag in name: - used += '.' + frag + used += "." + frag try: found = getattr(found, frag) except AttributeError: @@ -1028,7 +1080,7 @@ def resolve(self, s): return found except ImportError: e, tb = sys.exc_info()[1:] - v = ValueError('Cannot resolve %r: %s' % (s, e)) + v = ValueError("Cannot resolve %r: %s" % (s, e)) v.__cause__, v.__traceback__ = e, tb raise v @@ -1043,9 +1095,9 @@ def cfg_convert(self, value): if m is None: raise ValueError("Unable to convert %r" % value) else: - rest = rest[m.end():] + rest = rest[m.end() :] d = self.config[m.groups()[0]] - #print d, rest + # print d, rest while rest: m = self.DOT_PATTERN.match(rest) if m: @@ -1058,16 +1110,17 @@ def cfg_convert(self, value): d = d[idx] else: try: - n = int(idx) # try as number first (most likely) + n = int(idx) # try as number first (most likely) d = d[n] except TypeError: d = d[idx] if m: - rest = rest[m.end():] + rest = rest[m.end() :] else: - raise ValueError('Unable to convert ' - '%r at %r' % (value, rest)) - #rest should be empty + raise ValueError( + "Unable to convert " "%r at %r" % (value, rest) + ) + # rest should be empty return d def convert(self, value): @@ -1082,28 +1135,27 @@ def convert(self, value): elif not isinstance(value, ConvertingList) and isinstance(value, list): value = ConvertingList(value) value.configurator = self - elif not isinstance(value, ConvertingTuple) and\ - isinstance(value, tuple): + elif not isinstance(value, ConvertingTuple) and isinstance(value, tuple): value = ConvertingTuple(value) value.configurator = self elif isinstance(value, string_types): m = self.CONVERT_PATTERN.match(value) if m: d = m.groupdict() - prefix = d['prefix'] + prefix = d["prefix"] converter = self.value_converters.get(prefix, None) if converter: - suffix = d['suffix'] + suffix = d["suffix"] converter = getattr(self, converter) value = converter(suffix) return value def configure_custom(self, config): """Configure an object with a user-supplied factory.""" - c = config.pop('()') + c = config.pop("()") if not callable(c): c = self.resolve(c) - props = config.pop('.', None) + props = config.pop(".", None) # Check for valid identifiers kwargs = dict([(k, config[k]) for k in config if valid_ident(k)]) result = c(**kwargs) diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/database.py b/src/fetchcode/vcs/pip/_vendor/distlib/database.py index 1b23f648..ff5b8135 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/database.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/database.py @@ -19,32 +19,55 @@ from . import DistlibException, resources from .compat import StringIO from .version import get_scheme, UnsupportedVersionError -from .metadata import (Metadata, METADATA_FILENAME, WHEEL_METADATA_FILENAME, - LEGACY_METADATA_FILENAME) -from .util import (parse_requirement, cached_property, parse_name_and_version, - read_exports, write_exports, CSVReader, CSVWriter) - - -__all__ = ['Distribution', 'BaseInstalledDistribution', - 'InstalledDistribution', 'EggInfoDistribution', - 'DistributionPath'] +from .metadata import ( + Metadata, + METADATA_FILENAME, + WHEEL_METADATA_FILENAME, + LEGACY_METADATA_FILENAME, +) +from .util import ( + parse_requirement, + cached_property, + parse_name_and_version, + read_exports, + write_exports, + CSVReader, + CSVWriter, +) + + +__all__ = [ + "Distribution", + "BaseInstalledDistribution", + "InstalledDistribution", + "EggInfoDistribution", + "DistributionPath", +] logger = logging.getLogger(__name__) -EXPORTS_FILENAME = 'pydist-exports.json' -COMMANDS_FILENAME = 'pydist-commands.json' +EXPORTS_FILENAME = "pydist-exports.json" +COMMANDS_FILENAME = "pydist-commands.json" -DIST_FILES = ('INSTALLER', METADATA_FILENAME, 'RECORD', 'REQUESTED', - 'RESOURCES', EXPORTS_FILENAME, 'SHARED') +DIST_FILES = ( + "INSTALLER", + METADATA_FILENAME, + "RECORD", + "REQUESTED", + "RESOURCES", + EXPORTS_FILENAME, + "SHARED", +) -DISTINFO_EXT = '.dist-info' +DISTINFO_EXT = ".dist-info" class _Cache(object): """ A simple cache mapping names and .dist-info paths to distributions """ + def __init__(self): """ Initialise an instance. There is normally one for each DistributionPath. @@ -75,6 +98,7 @@ class DistributionPath(object): """ Represents a set of distributions installed on a path (typically sys.path). """ + def __init__(self, path=None, include_egg=False): """ Create an instance from a path, optionally including legacy (distutils/ @@ -93,7 +117,7 @@ def __init__(self, path=None, include_egg=False): self._cache = _Cache() self._cache_egg = _Cache() self._cache_enabled = True - self._scheme = get_scheme('default') + self._scheme = get_scheme("default") def _get_cache_enabled(self): return self._cache_enabled @@ -110,7 +134,6 @@ def clear_cache(self): self._cache.clear() self._cache_egg.clear() - def _yield_distributions(self): """ Yield .dist-info and/or .egg(-info) distributions. @@ -123,7 +146,7 @@ def _yield_distributions(self): finder = resources.finder_for_path(path) if finder is None: continue - r = finder.find('') + r = finder.find("") if not r or not r.is_container: continue rset = sorted(r.resources) @@ -132,9 +155,11 @@ def _yield_distributions(self): if not r or r.path in seen: continue if self._include_dist and entry.endswith(DISTINFO_EXT): - possible_filenames = [METADATA_FILENAME, - WHEEL_METADATA_FILENAME, - LEGACY_METADATA_FILENAME] + possible_filenames = [ + METADATA_FILENAME, + WHEEL_METADATA_FILENAME, + LEGACY_METADATA_FILENAME, + ] for metadata_filename in possible_filenames: metadata_path = posixpath.join(entry, metadata_filename) pydist = finder.find(metadata_path) @@ -144,14 +169,12 @@ def _yield_distributions(self): continue with contextlib.closing(pydist.as_stream()) as stream: - metadata = Metadata(fileobj=stream, scheme='legacy') - logger.debug('Found %s', r.path) + metadata = Metadata(fileobj=stream, scheme="legacy") + logger.debug("Found %s", r.path) seen.add(r.path) - yield new_dist_class(r.path, metadata=metadata, - env=self) - elif self._include_egg and entry.endswith(('.egg-info', - '.egg')): - logger.debug('Found %s', r.path) + yield new_dist_class(r.path, metadata=metadata, env=self) + elif self._include_egg and entry.endswith((".egg-info", ".egg")): + logger.debug("Found %s", r.path) seen.add(r.path) yield old_dist_class(r.path, self) @@ -193,8 +216,8 @@ def distinfo_dirname(cls, name, version): :type version: string :returns: directory name :rtype: string""" - name = name.replace('-', '_') - return '-'.join([name, version]) + DISTINFO_EXT + name = name.replace("-", "_") + return "-".join([name, version]) + DISTINFO_EXT def get_distributions(self): """ @@ -261,15 +284,16 @@ def provides_distribution(self, name, version=None): matcher = None if version is not None: try: - matcher = self._scheme.matcher('%s (%s)' % (name, version)) + matcher = self._scheme.matcher("%s (%s)" % (name, version)) except ValueError: - raise DistlibException('invalid name or version: %r, %r' % - (name, version)) + raise DistlibException( + "invalid name or version: %r, %r" % (name, version) + ) for dist in self.get_distributions(): # We hit a problem on Travis where enum34 was installed and doesn't # have a provides attribute ... - if not hasattr(dist, 'provides'): + if not hasattr(dist, "provides"): logger.debug('No "provides": %s', dist) else: provided = dist.provides @@ -291,7 +315,7 @@ def get_file_path(self, name, relative_path): """ dist = self.get_distribution(name) if dist is None: - raise LookupError('no distribution named %r found' % name) + raise LookupError("no distribution named %r found" % name) return dist.get_resource_path(relative_path) def get_exported_entries(self, category, name=None): @@ -339,12 +363,12 @@ def __init__(self, metadata): """ self.metadata = metadata self.name = metadata.name - self.key = self.name.lower() # for case-insensitive comparisons + self.key = self.name.lower() # for case-insensitive comparisons self.version = metadata.version self.locator = None self.digest = None - self.extras = None # additional features requested - self.context = None # environment marker overrides + self.extras = None # additional features requested + self.context = None # environment marker overrides self.download_urls = set() self.digests = {} @@ -355,14 +379,14 @@ def source_url(self): """ return self.metadata.source_url - download_url = source_url # Backward compatibility + download_url = source_url # Backward compatibility @property def name_and_version(self): """ A utility property which displays the name and version in parentheses. """ - return '%s (%s)' % (self.name, self.version) + return "%s (%s)" % (self.name, self.version) @property def provides(self): @@ -371,37 +395,36 @@ def provides(self): :return: A set of "name (version)" strings. """ plist = self.metadata.provides - s = '%s (%s)' % (self.name, self.version) + s = "%s (%s)" % (self.name, self.version) if s not in plist: plist.append(s) return plist def _get_requirements(self, req_attr): md = self.metadata - logger.debug('Getting requirements from metadata %r', md.todict()) + logger.debug("Getting requirements from metadata %r", md.todict()) reqts = getattr(md, req_attr) - return set(md.get_requirements(reqts, extras=self.extras, - env=self.context)) + return set(md.get_requirements(reqts, extras=self.extras, env=self.context)) @property def run_requires(self): - return self._get_requirements('run_requires') + return self._get_requirements("run_requires") @property def meta_requires(self): - return self._get_requirements('meta_requires') + return self._get_requirements("meta_requires") @property def build_requires(self): - return self._get_requirements('build_requires') + return self._get_requirements("build_requires") @property def test_requires(self): - return self._get_requirements('test_requires') + return self._get_requirements("test_requires") @property def dev_requires(self): - return self._get_requirements('dev_requires') + return self._get_requirements("dev_requires") def matches_requirement(self, req): """ @@ -418,12 +441,11 @@ def matches_requirement(self, req): matcher = scheme.matcher(r.requirement) except UnsupportedVersionError: # XXX compat-mode if cannot read the version - logger.warning('could not read version %r - using name only', - req) + logger.warning("could not read version %r - using name only", req) name = req.split()[0] matcher = scheme.matcher(name) - name = matcher.key # case-insensitive + name = matcher.key # case-insensitive result = False for p in self.provides: @@ -442,10 +464,10 @@ def __repr__(self): Return a textual representation of this instance, """ if self.source_url: - suffix = ' [%s]' % self.source_url + suffix = " [%s]" % self.source_url else: - suffix = '' - return '' % (self.name, self.version, suffix) + suffix = "" + return "" % (self.name, self.version, suffix) def __eq__(self, other): """ @@ -458,9 +480,11 @@ def __eq__(self, other): if type(other) is not type(self): result = False else: - result = (self.name == other.name and - self.version == other.version and - self.source_url == other.source_url) + result = ( + self.name == other.name + and self.version == other.version + and self.source_url == other.source_url + ) return result def __hash__(self): @@ -516,13 +540,13 @@ def get_hash(self, data, hasher=None): hasher = self.hasher if hasher is None: hasher = hashlib.md5 - prefix = '' + prefix = "" else: hasher = getattr(hashlib, hasher) - prefix = '%s=' % self.hasher + prefix = "%s=" % self.hasher digest = hasher(data).digest() - digest = base64.urlsafe_b64encode(digest).rstrip(b'=').decode('ascii') - return '%s%s' % (prefix, digest) + digest = base64.urlsafe_b64encode(digest).rstrip(b"=").decode("ascii") + return "%s%s" % (prefix, digest) class InstalledDistribution(BaseInstalledDistribution): @@ -533,13 +557,13 @@ class InstalledDistribution(BaseInstalledDistribution): dry-run mode is being used). """ - hasher = 'sha256' + hasher = "sha256" def __init__(self, path, metadata=None, env=None): self.modules = [] self.finder = finder = resources.finder_for_path(path) if finder is None: - raise ValueError('finder unavailable for %s' % path) + raise ValueError("finder unavailable for %s" % path) if env and env._cache_enabled and path in env._cache.path: metadata = env._cache.path[path].metadata elif metadata is None: @@ -549,29 +573,31 @@ def __init__(self, path, metadata=None, env=None): r = finder.find(WHEEL_METADATA_FILENAME) # Temporary - for legacy support if r is None: - r = finder.find('METADATA') + r = finder.find("METADATA") if r is None: - raise ValueError('no %s found in %s' % (METADATA_FILENAME, - path)) + raise ValueError("no %s found in %s" % (METADATA_FILENAME, path)) with contextlib.closing(r.as_stream()) as stream: - metadata = Metadata(fileobj=stream, scheme='legacy') + metadata = Metadata(fileobj=stream, scheme="legacy") super(InstalledDistribution, self).__init__(metadata, path, env) if env and env._cache_enabled: env._cache.add(self) - r = finder.find('REQUESTED') + r = finder.find("REQUESTED") self.requested = r is not None - p = os.path.join(path, 'top_level.txt') + p = os.path.join(path, "top_level.txt") if os.path.exists(p): - with open(p, 'rb') as f: - data = f.read().decode('utf-8') + with open(p, "rb") as f: + data = f.read().decode("utf-8") self.modules = data.splitlines() def __repr__(self): - return '' % ( - self.name, self.version, self.path) + return "" % ( + self.name, + self.version, + self.path, + ) def __str__(self): return "%s %s" % (self.name, self.version) @@ -584,16 +610,16 @@ def _get_records(self): as stored in the file (which is as in PEP 376). """ results = [] - r = self.get_distinfo_resource('RECORD') + r = self.get_distinfo_resource("RECORD") with contextlib.closing(r.as_stream()) as stream: with CSVReader(stream=stream) as record_reader: # Base location is parent dir of .dist-info dir - #base_location = os.path.dirname(self.path) - #base_location = os.path.abspath(base_location) + # base_location = os.path.dirname(self.path) + # base_location = os.path.abspath(base_location) for row in record_reader: missing = [None for i in range(len(row), 3)] path, checksum, size = row + missing - #if not os.path.isabs(path): + # if not os.path.isabs(path): # path = path.replace('/', os.sep) # path = os.path.join(base_location, path) results.append((path, checksum, size)) @@ -636,7 +662,7 @@ def write_exports(self, exports): individual export entries. """ rf = self.get_distinfo_file(EXPORTS_FILENAME) - with open(rf, 'w') as f: + with open(rf, "w") as f: write_exports(exports, f) def get_resource_path(self, relative_path): @@ -650,14 +676,15 @@ def get_resource_path(self, relative_path): of interest. :return: The absolute path where the resource is to be found. """ - r = self.get_distinfo_resource('RESOURCES') + r = self.get_distinfo_resource("RESOURCES") with contextlib.closing(r.as_stream()) as stream: with CSVReader(stream=stream) as resources_reader: for relative, destination in resources_reader: if relative == relative_path: return destination - raise KeyError('no resource file with relative path %r ' - 'is installed' % relative_path) + raise KeyError( + "no resource file with relative path %r " "is installed" % relative_path + ) def list_installed_files(self): """ @@ -676,32 +703,33 @@ def write_installed_files(self, paths, prefix, dry_run=False): prefix is used to determine when to write absolute paths. """ - prefix = os.path.join(prefix, '') + prefix = os.path.join(prefix, "") base = os.path.dirname(self.path) base_under_prefix = base.startswith(prefix) - base = os.path.join(base, '') - record_path = self.get_distinfo_file('RECORD') - logger.info('creating %s', record_path) + base = os.path.join(base, "") + record_path = self.get_distinfo_file("RECORD") + logger.info("creating %s", record_path) if dry_run: return None with CSVWriter(record_path) as writer: for path in paths: - if os.path.isdir(path) or path.endswith(('.pyc', '.pyo')): + if os.path.isdir(path) or path.endswith((".pyc", ".pyo")): # do not put size and hash, as in PEP-376 - hash_value = size = '' + hash_value = size = "" else: - size = '%d' % os.path.getsize(path) - with open(path, 'rb') as fp: + size = "%d" % os.path.getsize(path) + with open(path, "rb") as fp: hash_value = self.get_hash(fp.read()) - if path.startswith(base) or (base_under_prefix and - path.startswith(prefix)): + if path.startswith(base) or ( + base_under_prefix and path.startswith(prefix) + ): path = os.path.relpath(path, base) writer.writerow((path, hash_value, size)) # add the RECORD file itself if record_path.startswith(base): record_path = os.path.relpath(record_path, base) - writer.writerow((record_path, '', '')) + writer.writerow((record_path, "", "")) return record_path def check_installed_files(self): @@ -715,28 +743,28 @@ def check_installed_files(self): """ mismatches = [] base = os.path.dirname(self.path) - record_path = self.get_distinfo_file('RECORD') + record_path = self.get_distinfo_file("RECORD") for path, hash_value, size in self.list_installed_files(): if not os.path.isabs(path): path = os.path.join(base, path) if path == record_path: continue if not os.path.exists(path): - mismatches.append((path, 'exists', True, False)) + mismatches.append((path, "exists", True, False)) elif os.path.isfile(path): actual_size = str(os.path.getsize(path)) if size and actual_size != size: - mismatches.append((path, 'size', size, actual_size)) + mismatches.append((path, "size", size, actual_size)) elif hash_value: - if '=' in hash_value: - hasher = hash_value.split('=', 1)[0] + if "=" in hash_value: + hasher = hash_value.split("=", 1)[0] else: hasher = None - with open(path, 'rb') as f: + with open(path, "rb") as f: actual_hash = self.get_hash(f.read(), hasher) if actual_hash != hash_value: - mismatches.append((path, 'hash', hash_value, actual_hash)) + mismatches.append((path, "hash", hash_value, actual_hash)) return mismatches @cached_property @@ -754,13 +782,13 @@ def shared_locations(self): read from the SHARED file in the .dist-info directory. """ result = {} - shared_path = os.path.join(self.path, 'SHARED') + shared_path = os.path.join(self.path, "SHARED") if os.path.isfile(shared_path): - with codecs.open(shared_path, 'r', encoding='utf-8') as f: + with codecs.open(shared_path, "r", encoding="utf-8") as f: lines = f.read().splitlines() for line in lines: - key, value = line.split('=', 1) - if key == 'namespace': + key, value = line.split("=", 1) + if key == "namespace": result.setdefault(key, []).append(value) else: result[key] = value @@ -775,29 +803,30 @@ def write_shared_locations(self, paths, dry_run=False): written. :return: The path of the file written to. """ - shared_path = os.path.join(self.path, 'SHARED') - logger.info('creating %s', shared_path) + shared_path = os.path.join(self.path, "SHARED") + logger.info("creating %s", shared_path) if dry_run: return None lines = [] - for key in ('prefix', 'lib', 'headers', 'scripts', 'data'): + for key in ("prefix", "lib", "headers", "scripts", "data"): path = paths[key] if os.path.isdir(paths[key]): - lines.append('%s=%s' % (key, path)) - for ns in paths.get('namespace', ()): - lines.append('namespace=%s' % ns) + lines.append("%s=%s" % (key, path)) + for ns in paths.get("namespace", ()): + lines.append("namespace=%s" % ns) - with codecs.open(shared_path, 'w', encoding='utf-8') as f: - f.write('\n'.join(lines)) + with codecs.open(shared_path, "w", encoding="utf-8") as f: + f.write("\n".join(lines)) return shared_path def get_distinfo_resource(self, path): if path not in DIST_FILES: - raise DistlibException('invalid path for a dist-info file: ' - '%r at %r' % (path, self.path)) + raise DistlibException( + "invalid path for a dist-info file: " "%r at %r" % (path, self.path) + ) finder = resources.finder_for_path(self.path) if finder is None: - raise DistlibException('Unable to get a finder for %s' % self.path) + raise DistlibException("Unable to get a finder for %s" % self.path) return finder.find(path) def get_distinfo_file(self, path): @@ -819,13 +848,15 @@ def get_distinfo_file(self, path): distinfo_dirname, path = path.split(os.sep)[-2:] if distinfo_dirname != self.path.split(os.sep)[-1]: raise DistlibException( - 'dist-info file %r does not belong to the %r %s ' - 'distribution' % (path, self.name, self.version)) + "dist-info file %r does not belong to the %r %s " + "distribution" % (path, self.name, self.version) + ) # The file must be relative if path not in DIST_FILES: - raise DistlibException('invalid path for a dist-info file: ' - '%r at %r' % (path, self.path)) + raise DistlibException( + "invalid path for a dist-info file: " "%r at %r" % (path, self.path) + ) return os.path.join(self.path, path) @@ -846,8 +877,7 @@ def list_distinfo_files(self): yield path def __eq__(self, other): - return (isinstance(other, InstalledDistribution) and - self.path == other.path) + return isinstance(other, InstalledDistribution) and self.path == other.path # See http://docs.python.org/reference/datamodel#object.__hash__ __hash__ = object.__hash__ @@ -859,13 +889,13 @@ class EggInfoDistribution(BaseInstalledDistribution): if the given path happens to be a directory, the metadata is read from the file ``PKG-INFO`` under that directory.""" - requested = True # as we have no way of knowing, assume it was + requested = True # as we have no way of knowing, assume it was shared_locations = {} def __init__(self, path, env=None): def set_name_and_version(s, n, v): s.name = n - s.key = n.lower() # for case-insensitive comparisons + s.key = n.lower() # for case-insensitive comparisons s.version = v self.path = path @@ -895,22 +925,24 @@ def parse_requires_data(data): lines = data.splitlines() for line in lines: line = line.strip() - if line.startswith('['): - logger.warning('Unexpected line: quitting requirement scan: %r', - line) + if line.startswith("["): + logger.warning( + "Unexpected line: quitting requirement scan: %r", line + ) break r = parse_requirement(line) if not r: - logger.warning('Not recognised as a requirement: %r', line) + logger.warning("Not recognised as a requirement: %r", line) continue if r.extras: - logger.warning('extra requirements in requires.txt are ' - 'not supported') + logger.warning( + "extra requirements in requires.txt are " "not supported" + ) if not r.constraints: reqs.append(r.name) else: - cons = ', '.join('%s%s' % c for c in r.constraints) - reqs.append('%s (%s)' % (r.name, cons)) + cons = ", ".join("%s%s" % c for c in r.constraints) + reqs.append("%s (%s)" % (r.name, cons)) return reqs def parse_requires_path(req_path): @@ -921,51 +953,51 @@ def parse_requires_path(req_path): reqs = [] try: - with codecs.open(req_path, 'r', 'utf-8') as fp: + with codecs.open(req_path, "r", "utf-8") as fp: reqs = parse_requires_data(fp.read()) except IOError: pass return reqs tl_path = tl_data = None - if path.endswith('.egg'): + if path.endswith(".egg"): if os.path.isdir(path): - p = os.path.join(path, 'EGG-INFO') - meta_path = os.path.join(p, 'PKG-INFO') - metadata = Metadata(path=meta_path, scheme='legacy') - req_path = os.path.join(p, 'requires.txt') - tl_path = os.path.join(p, 'top_level.txt') + p = os.path.join(path, "EGG-INFO") + meta_path = os.path.join(p, "PKG-INFO") + metadata = Metadata(path=meta_path, scheme="legacy") + req_path = os.path.join(p, "requires.txt") + tl_path = os.path.join(p, "top_level.txt") requires = parse_requires_path(req_path) else: # FIXME handle the case where zipfile is not available zipf = zipimport.zipimporter(path) - fileobj = StringIO( - zipf.get_data('EGG-INFO/PKG-INFO').decode('utf8')) - metadata = Metadata(fileobj=fileobj, scheme='legacy') + fileobj = StringIO(zipf.get_data("EGG-INFO/PKG-INFO").decode("utf8")) + metadata = Metadata(fileobj=fileobj, scheme="legacy") try: - data = zipf.get_data('EGG-INFO/requires.txt') - tl_data = zipf.get_data('EGG-INFO/top_level.txt').decode('utf-8') - requires = parse_requires_data(data.decode('utf-8')) + data = zipf.get_data("EGG-INFO/requires.txt") + tl_data = zipf.get_data("EGG-INFO/top_level.txt").decode("utf-8") + requires = parse_requires_data(data.decode("utf-8")) except IOError: requires = None - elif path.endswith('.egg-info'): + elif path.endswith(".egg-info"): if os.path.isdir(path): - req_path = os.path.join(path, 'requires.txt') + req_path = os.path.join(path, "requires.txt") requires = parse_requires_path(req_path) - path = os.path.join(path, 'PKG-INFO') - tl_path = os.path.join(path, 'top_level.txt') - metadata = Metadata(path=path, scheme='legacy') + path = os.path.join(path, "PKG-INFO") + tl_path = os.path.join(path, "top_level.txt") + metadata = Metadata(path=path, scheme="legacy") else: - raise DistlibException('path must end with .egg-info or .egg, ' - 'got %r' % path) + raise DistlibException( + "path must end with .egg-info or .egg, " "got %r" % path + ) if requires: metadata.add_requirements(requires) # look for top-level modules in top_level.txt, if present if tl_data is None: if tl_path is not None and os.path.exists(tl_path): - with open(tl_path, 'rb') as f: - tl_data = f.read().decode('utf-8') + with open(tl_path, "rb") as f: + tl_data = f.read().decode("utf-8") if not tl_data: tl_data = [] else: @@ -974,8 +1006,11 @@ def parse_requires_path(req_path): return metadata def __repr__(self): - return '' % ( - self.name, self.version, self.path) + return "" % ( + self.name, + self.version, + self.path, + ) def __str__(self): return "%s %s" % (self.name, self.version) @@ -990,13 +1025,13 @@ def check_installed_files(self): value and the actual value. """ mismatches = [] - record_path = os.path.join(self.path, 'installed-files.txt') + record_path = os.path.join(self.path, "installed-files.txt") if os.path.exists(record_path): for path, _, _ in self.list_installed_files(): if path == record_path: continue if not os.path.exists(path): - mismatches.append((path, 'exists', True, False)) + mismatches.append((path, "exists", True, False)) return mismatches def list_installed_files(self): @@ -1008,7 +1043,7 @@ def list_installed_files(self): """ def _md5(path): - f = open(path, 'rb') + f = open(path, "rb") try: content = f.read() finally: @@ -1018,20 +1053,20 @@ def _md5(path): def _size(path): return os.stat(path).st_size - record_path = os.path.join(self.path, 'installed-files.txt') + record_path = os.path.join(self.path, "installed-files.txt") result = [] if os.path.exists(record_path): - with codecs.open(record_path, 'r', encoding='utf-8') as f: + with codecs.open(record_path, "r", encoding="utf-8") as f: for line in f: line = line.strip() p = os.path.normpath(os.path.join(self.path, line)) # "./" is present as a marker between installed files # and installation metadata files if not os.path.exists(p): - logger.warning('Non-existent file: %s', p) - if p.endswith(('.pyc', '.pyo')): + logger.warning("Non-existent file: %s", p) + if p.endswith((".pyc", ".pyo")): continue - #otherwise fall through and fail + # otherwise fall through and fail if not os.path.isdir(p): result.append((p, _md5(p), _size(p))) result.append((record_path, None, None)) @@ -1049,13 +1084,13 @@ def list_distinfo_files(self, absolute=False): :type absolute: boolean :returns: iterator of paths """ - record_path = os.path.join(self.path, 'installed-files.txt') + record_path = os.path.join(self.path, "installed-files.txt") if os.path.exists(record_path): skip = True - with codecs.open(record_path, 'r', encoding='utf-8') as f: + with codecs.open(record_path, "r", encoding="utf-8") as f: for line in f: line = line.strip() - if line == './': + if line == "./": skip = False continue if not skip: @@ -1067,12 +1102,12 @@ def list_distinfo_files(self, absolute=False): yield line def __eq__(self, other): - return (isinstance(other, EggInfoDistribution) and - self.path == other.path) + return isinstance(other, EggInfoDistribution) and self.path == other.path # See http://docs.python.org/reference/datamodel#object.__hash__ __hash__ = object.__hash__ + new_dist_class = InstalledDistribution old_dist_class = EggInfoDistribution @@ -1106,7 +1141,7 @@ def add_distribution(self, distribution): """ self.adjacency_list[distribution] = [] self.reverse_list[distribution] = [] - #self.missing[distribution] = [] + # self.missing[distribution] = [] def add_edge(self, x, y, label=None): """Add an edge from distribution *x* to distribution *y* with the given @@ -1131,11 +1166,11 @@ def add_missing(self, distribution, requirement): or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str`` """ - logger.debug('%s missing %r', distribution, requirement) + logger.debug("%s missing %r", distribution, requirement) self.missing.setdefault(distribution, []).append(requirement) def _repr_dist(self, dist): - return '%s %s' % (dist.name, dist.version) + return "%s %s" % (dist.name, dist.version) def repr_node(self, dist, level=1): """Prints only a subgraph""" @@ -1143,12 +1178,12 @@ def repr_node(self, dist, level=1): for other, label in self.adjacency_list[dist]: dist = self._repr_dist(other) if label is not None: - dist = '%s [%s]' % (dist, label) - output.append(' ' * level + str(dist)) + dist = "%s [%s]" % (dist, label) + output.append(" " * level + str(dist)) suboutput = self.repr_node(other, level + 1) - subs = suboutput.split('\n') + subs = suboutput.split("\n") output.extend(subs[1:]) - return '\n'.join(output) + return "\n".join(output) def to_dot(self, f, skip_disconnected=True): """Writes a DOT output for the graph to the provided file *f*. @@ -1167,20 +1202,21 @@ def to_dot(self, f, skip_disconnected=True): disconnected.append(dist) for other, label in adjs: if not label is None: - f.write('"%s" -> "%s" [label="%s"]\n' % - (dist.name, other.name, label)) + f.write( + '"%s" -> "%s" [label="%s"]\n' % (dist.name, other.name, label) + ) else: f.write('"%s" -> "%s"\n' % (dist.name, other.name)) if not skip_disconnected and len(disconnected) > 0: - f.write('subgraph disconnected {\n') + f.write("subgraph disconnected {\n") f.write('label = "Disconnected"\n') - f.write('bgcolor = red\n') + f.write("bgcolor = red\n") for dist in disconnected: f.write('"%s"' % dist.name) - f.write('\n') - f.write('}\n') - f.write('}\n') + f.write("\n") + f.write("}\n") + f.write("}\n") def topological_sort(self): """ @@ -1208,8 +1244,10 @@ def topological_sort(self): # Remove from the adjacency list of others for k, v in alist.items(): alist[k] = [(d, r) for d, r in v if d not in to_remove] - logger.debug('Moving to result: %s', - ['%s (%s)' % (d.name, d.version) for d in to_remove]) + logger.debug( + "Moving to result: %s", + ["%s (%s)" % (d.name, d.version) for d in to_remove], + ) result.extend(to_remove) return result, list(alist.keys()) @@ -1218,10 +1256,10 @@ def __repr__(self): output = [] for dist, adjs in self.adjacency_list.items(): output.append(self.repr_node(dist)) - return '\n'.join(output) + return "\n".join(output) -def make_graph(dists, scheme='default'): +def make_graph(dists, scheme="default"): """Makes a dependency graph from the given distributions. :parameter dists: a list of distributions @@ -1239,24 +1277,27 @@ def make_graph(dists, scheme='default'): for p in dist.provides: name, version = parse_name_and_version(p) - logger.debug('Add to provided: %s, %s, %s', name, version, dist) + logger.debug("Add to provided: %s, %s, %s", name, version, dist) provided.setdefault(name, []).append((version, dist)) # now make the edges for dist in dists: - requires = (dist.run_requires | dist.meta_requires | - dist.build_requires | dist.dev_requires) + requires = ( + dist.run_requires + | dist.meta_requires + | dist.build_requires + | dist.dev_requires + ) for req in requires: try: matcher = scheme.matcher(req) except UnsupportedVersionError: # XXX compat-mode if cannot read the version - logger.warning('could not read version %r - using name only', - req) + logger.warning("could not read version %r - using name only", req) name = req.split()[0] matcher = scheme.matcher(name) - name = matcher.key # case-insensitive + name = matcher.key # case-insensitive matched = False if name in provided: @@ -1283,8 +1324,9 @@ def get_dependent_dists(dists, dist): :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: - raise DistlibException('given distribution %r is not a member ' - 'of the list' % dist.name) + raise DistlibException( + "given distribution %r is not a member " "of the list" % dist.name + ) graph = make_graph(dists) dep = [dist] # dependent distributions @@ -1309,8 +1351,9 @@ def get_required_dists(dists, dist): :param dist: a distribution, member of *dists* for which we are interested """ if dist not in dists: - raise DistlibException('given distribution %r is not a member ' - 'of the list' % dist.name) + raise DistlibException( + "given distribution %r is not a member " "of the list" % dist.name + ) graph = make_graph(dists) req = [] # required distributions @@ -1330,9 +1373,9 @@ def make_dist(name, version, **kwargs): """ A convenience method for making a dist given just a name and version. """ - summary = kwargs.pop('summary', 'Placeholder for summary') + summary = kwargs.pop("summary", "Placeholder for summary") md = Metadata(**kwargs) md.name = name md.version = version - md.summary = summary or 'Placeholder for summary' + md.summary = summary or "Placeholder for summary" return Distribution(md) diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/index.py b/src/fetchcode/vcs/pip/_vendor/distlib/index.py index 7a87cdcf..bb656670 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/index.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/index.py @@ -10,20 +10,28 @@ import shutil import subprocess import tempfile + try: from threading import Thread except ImportError: from dummy_threading import Thread from . import DistlibException -from .compat import (HTTPBasicAuthHandler, Request, HTTPPasswordMgr, - urlparse, build_opener, string_types) +from .compat import ( + HTTPBasicAuthHandler, + Request, + HTTPPasswordMgr, + urlparse, + build_opener, + string_types, +) from .util import cached_property, zip_dir, ServerProxy logger = logging.getLogger(__name__) -DEFAULT_INDEX = 'https://pypi.org/pypi' -DEFAULT_REALM = 'pypi' +DEFAULT_INDEX = "https://pypi.org/pypi" +DEFAULT_REALM = "pypi" + class PackageIndex(object): """ @@ -31,7 +39,7 @@ class PackageIndex(object): Package Index. """ - boundary = b'----------ThIs_Is_tHe_distlib_index_bouNdaRY_$' + boundary = b"----------ThIs_Is_tHe_distlib_index_bouNdaRY_$" def __init__(self, url=None): """ @@ -43,19 +51,20 @@ def __init__(self, url=None): self.url = url or DEFAULT_INDEX self.read_configuration() scheme, netloc, path, params, query, frag = urlparse(self.url) - if params or query or frag or scheme not in ('http', 'https'): - raise DistlibException('invalid repository: %s' % self.url) + if params or query or frag or scheme not in ("http", "https"): + raise DistlibException("invalid repository: %s" % self.url) self.password_handler = None self.ssl_verifier = None self.gpg = None self.gpg_home = None - with open(os.devnull, 'w') as sink: + with open(os.devnull, "w") as sink: # Use gpg by default rather than gpg2, as gpg2 insists on # prompting for passwords - for s in ('gpg', 'gpg2'): + for s in ("gpg", "gpg2"): try: - rc = subprocess.check_call([s, '--version'], stdout=sink, - stderr=sink) + rc = subprocess.check_call( + [s, "--version"], stdout=sink, stderr=sink + ) if rc == 0: self.gpg = s break @@ -69,6 +78,7 @@ def _get_pypirc_command(self): """ from distutils.core import Distribution from distutils.config import PyPIRCCommand + d = Distribution() return PyPIRCCommand(d) @@ -82,10 +92,10 @@ def read_configuration(self): c = self._get_pypirc_command() c.repository = self.url cfg = c._read_pypirc() - self.username = cfg.get('username') - self.password = cfg.get('password') - self.realm = cfg.get('realm', 'pypi') - self.url = cfg.get('repository', self.url) + self.username = cfg.get("username") + self.password = cfg.get("password") + self.realm = cfg.get("realm", "pypi") + self.url = cfg.get("repository", self.url) def save_configuration(self): """ @@ -105,7 +115,7 @@ def check_credentials(self): exception if not. """ if self.username is None or self.password is None: - raise DistlibException('username and password must be set') + raise DistlibException("username and password must be set") pm = HTTPPasswordMgr() _, netloc, _, _, _, _ = urlparse(self.url) pm.add_password(self.realm, netloc, self.username, self.password) @@ -124,10 +134,10 @@ def register(self, metadata): self.check_credentials() metadata.validate() d = metadata.todict() - d[':action'] = 'verify' + d[":action"] = "verify" request = self.encode_request(d.items(), []) response = self.send_request(request) - d[':action'] = 'submit' + d[":action"] = "submit" request = self.encode_request(d.items(), []) return self.send_request(request) @@ -144,13 +154,12 @@ def _reader(self, name, stream, outbuf): s = stream.readline() if not s: break - s = s.decode('utf-8').rstrip() + s = s.decode("utf-8").rstrip() outbuf.append(s) - logger.debug('%s: %s' % (name, s)) + logger.debug("%s: %s" % (name, s)) stream.close() - def get_sign_command(self, filename, signer, sign_password, - keystore=None): + def get_sign_command(self, filename, signer, sign_password, keystore=None): """ Return a suitable command for signing a file. @@ -164,18 +173,27 @@ def get_sign_command(self, filename, signer, sign_password, :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`. """ - cmd = [self.gpg, '--status-fd', '2', '--no-tty'] + cmd = [self.gpg, "--status-fd", "2", "--no-tty"] if keystore is None: keystore = self.gpg_home if keystore: - cmd.extend(['--homedir', keystore]) + cmd.extend(["--homedir", keystore]) if sign_password is not None: - cmd.extend(['--batch', '--passphrase-fd', '0']) + cmd.extend(["--batch", "--passphrase-fd", "0"]) td = tempfile.mkdtemp() - sf = os.path.join(td, os.path.basename(filename) + '.asc') - cmd.extend(['--detach-sign', '--armor', '--local-user', - signer, '--output', sf, filename]) - logger.debug('invoking: %s', ' '.join(cmd)) + sf = os.path.join(td, os.path.basename(filename) + ".asc") + cmd.extend( + [ + "--detach-sign", + "--armor", + "--local-user", + signer, + "--output", + sf, + filename, + ] + ) + logger.debug("invoking: %s", " ".join(cmd)) return cmd, sf def run_command(self, cmd, input_data=None): @@ -190,19 +208,19 @@ def run_command(self, cmd, input_data=None): lines read from the subprocess' ``stderr``. """ kwargs = { - 'stdout': subprocess.PIPE, - 'stderr': subprocess.PIPE, + "stdout": subprocess.PIPE, + "stderr": subprocess.PIPE, } if input_data is not None: - kwargs['stdin'] = subprocess.PIPE + kwargs["stdin"] = subprocess.PIPE stdout = [] stderr = [] p = subprocess.Popen(cmd, **kwargs) # We don't use communicate() here because we may need to # get clever with interacting with the command - t1 = Thread(target=self._reader, args=('stdout', p.stdout, stdout)) + t1 = Thread(target=self._reader, args=("stdout", p.stdout, stdout)) t1.start() - t2 = Thread(target=self._reader, args=('stderr', p.stderr, stderr)) + t2 = Thread(target=self._reader, args=("stderr", p.stderr, stderr)) t2.start() if input_data is not None: p.stdin.write(input_data) @@ -227,17 +245,22 @@ def sign_file(self, filename, signer, sign_password, keystore=None): :return: The absolute pathname of the file where the signature is stored. """ - cmd, sig_file = self.get_sign_command(filename, signer, sign_password, - keystore) - rc, stdout, stderr = self.run_command(cmd, - sign_password.encode('utf-8')) + cmd, sig_file = self.get_sign_command(filename, signer, sign_password, keystore) + rc, stdout, stderr = self.run_command(cmd, sign_password.encode("utf-8")) if rc != 0: - raise DistlibException('sign command failed with error ' - 'code %s' % rc) + raise DistlibException("sign command failed with error " "code %s" % rc) return sig_file - def upload_file(self, metadata, filename, signer=None, sign_password=None, - filetype='sdist', pyversion='source', keystore=None): + def upload_file( + self, + metadata, + filename, + signer=None, + sign_password=None, + filetype="sdist", + pyversion="source", + keystore=None, + ): """ Upload a release file to the index. @@ -261,34 +284,34 @@ def upload_file(self, metadata, filename, signer=None, sign_password=None, """ self.check_credentials() if not os.path.exists(filename): - raise DistlibException('not found: %s' % filename) + raise DistlibException("not found: %s" % filename) metadata.validate() d = metadata.todict() sig_file = None if signer: if not self.gpg: - logger.warning('no signing program available - not signed') + logger.warning("no signing program available - not signed") else: - sig_file = self.sign_file(filename, signer, sign_password, - keystore) - with open(filename, 'rb') as f: + sig_file = self.sign_file(filename, signer, sign_password, keystore) + with open(filename, "rb") as f: file_data = f.read() md5_digest = hashlib.md5(file_data).hexdigest() sha256_digest = hashlib.sha256(file_data).hexdigest() - d.update({ - ':action': 'file_upload', - 'protocol_version': '1', - 'filetype': filetype, - 'pyversion': pyversion, - 'md5_digest': md5_digest, - 'sha256_digest': sha256_digest, - }) - files = [('content', os.path.basename(filename), file_data)] + d.update( + { + ":action": "file_upload", + "protocol_version": "1", + "filetype": filetype, + "pyversion": pyversion, + "md5_digest": md5_digest, + "sha256_digest": sha256_digest, + } + ) + files = [("content", os.path.basename(filename), file_data)] if sig_file: - with open(sig_file, 'rb') as f: + with open(sig_file, "rb") as f: sig_data = f.read() - files.append(('gpg_signature', os.path.basename(sig_file), - sig_data)) + files.append(("gpg_signature", os.path.basename(sig_file), sig_data)) shutil.rmtree(os.path.dirname(sig_file)) request = self.encode_request(d.items(), files) return self.send_request(request) @@ -308,21 +331,19 @@ def upload_documentation(self, metadata, doc_dir): """ self.check_credentials() if not os.path.isdir(doc_dir): - raise DistlibException('not a directory: %r' % doc_dir) - fn = os.path.join(doc_dir, 'index.html') + raise DistlibException("not a directory: %r" % doc_dir) + fn = os.path.join(doc_dir, "index.html") if not os.path.exists(fn): - raise DistlibException('not found: %r' % fn) + raise DistlibException("not found: %r" % fn) metadata.validate() name, version = metadata.name, metadata.version zip_data = zip_dir(doc_dir).getvalue() - fields = [(':action', 'doc_upload'), - ('name', name), ('version', version)] - files = [('content', name, zip_data)] + fields = [(":action", "doc_upload"), ("name", name), ("version", version)] + files = [("content", name, zip_data)] request = self.encode_request(fields, files) return self.send_request(request) - def get_verify_command(self, signature_filename, data_filename, - keystore=None): + def get_verify_command(self, signature_filename, data_filename, keystore=None): """ Return a suitable command for verifying a file. @@ -336,17 +357,16 @@ def get_verify_command(self, signature_filename, data_filename, :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`. """ - cmd = [self.gpg, '--status-fd', '2', '--no-tty'] + cmd = [self.gpg, "--status-fd", "2", "--no-tty"] if keystore is None: keystore = self.gpg_home if keystore: - cmd.extend(['--homedir', keystore]) - cmd.extend(['--verify', signature_filename, data_filename]) - logger.debug('invoking: %s', ' '.join(cmd)) + cmd.extend(["--homedir", keystore]) + cmd.extend(["--verify", signature_filename, data_filename]) + logger.debug("invoking: %s", " ".join(cmd)) return cmd - def verify_signature(self, signature_filename, data_filename, - keystore=None): + def verify_signature(self, signature_filename, data_filename, keystore=None): """ Verify a signature for a file. @@ -360,14 +380,13 @@ def verify_signature(self, signature_filename, data_filename, :return: True if the signature was verified, else False. """ if not self.gpg: - raise DistlibException('verification unavailable because gpg ' - 'unavailable') - cmd = self.get_verify_command(signature_filename, data_filename, - keystore) + raise DistlibException( + "verification unavailable because gpg " "unavailable" + ) + cmd = self.get_verify_command(signature_filename, data_filename, keystore) rc, stdout, stderr = self.run_command(cmd) if rc not in (0, 1): - raise DistlibException('verify command failed with error ' - 'code %s' % rc) + raise DistlibException("verify command failed with error " "code %s" % rc) return rc == 0 def download_file(self, url, destfile, digest=None, reporthook=None): @@ -394,18 +413,18 @@ def download_file(self, url, destfile, digest=None, reporthook=None): """ if digest is None: digester = None - logger.debug('No digest specified') + logger.debug("No digest specified") else: if isinstance(digest, (list, tuple)): hasher, digest = digest else: - hasher = 'md5' + hasher = "md5" digester = getattr(hashlib, hasher)() - logger.debug('Digest specified: %s' % digest) + logger.debug("Digest specified: %s" % digest) # The following code is equivalent to urlretrieve. # We need to do it this way so that we can compute the # digest of the file as we go. - with open(destfile, 'wb') as dfp: + with open(destfile, "wb") as dfp: # addinfourl is not a context manager on 2.x # so we have to use try/finally sfp = self.send_request(Request(url)) @@ -436,16 +455,17 @@ def download_file(self, url, destfile, digest=None, reporthook=None): # check that we got the whole file, if we can if size >= 0 and read < size: raise DistlibException( - 'retrieval incomplete: got only %d out of %d bytes' - % (read, size)) + "retrieval incomplete: got only %d out of %d bytes" % (read, size) + ) # if we have a digest, it must match. if digester: actual = digester.hexdigest() if digest != actual: - raise DistlibException('%s digest mismatch for %s: expected ' - '%s, got %s' % (hasher, destfile, - digest, actual)) - logger.debug('Digest verified: %s', digest) + raise DistlibException( + "%s digest mismatch for %s: expected " + "%s, got %s" % (hasher, destfile, digest, actual) + ) + logger.debug("Digest verified: %s", digest) def send_request(self, req): """ @@ -482,35 +502,41 @@ def encode_request(self, fields, files): values = [values] for v in values: - parts.extend(( - b'--' + boundary, - ('Content-Disposition: form-data; name="%s"' % - k).encode('utf-8'), - b'', - v.encode('utf-8'))) + parts.extend( + ( + b"--" + boundary, + ('Content-Disposition: form-data; name="%s"' % k).encode( + "utf-8" + ), + b"", + v.encode("utf-8"), + ) + ) for key, filename, value in files: - parts.extend(( - b'--' + boundary, - ('Content-Disposition: form-data; name="%s"; filename="%s"' % - (key, filename)).encode('utf-8'), - b'', - value)) - - parts.extend((b'--' + boundary + b'--', b'')) - - body = b'\r\n'.join(parts) - ct = b'multipart/form-data; boundary=' + boundary - headers = { - 'Content-type': ct, - 'Content-length': str(len(body)) - } + parts.extend( + ( + b"--" + boundary, + ( + 'Content-Disposition: form-data; name="%s"; filename="%s"' + % (key, filename) + ).encode("utf-8"), + b"", + value, + ) + ) + + parts.extend((b"--" + boundary + b"--", b"")) + + body = b"\r\n".join(parts) + ct = b"multipart/form-data; boundary=" + boundary + headers = {"Content-type": ct, "Content-length": str(len(body))} return Request(self.url, body, headers) def search(self, terms, operator=None): if isinstance(terms, string_types): - terms = {'name': terms} + terms = {"name": terms} rpc_proxy = ServerProxy(self.url, timeout=3.0) try: - return rpc_proxy.search(terms, operator or 'and') + return rpc_proxy.search(terms, operator or "and") finally: - rpc_proxy('close')() + rpc_proxy("close")() diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/locators.py b/src/fetchcode/vcs/pip/_vendor/distlib/locators.py index 12a1d063..17ea4c99 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/locators.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/locators.py @@ -12,6 +12,7 @@ import os import posixpath import re + try: import threading except ImportError: # pragma: no cover @@ -19,24 +20,46 @@ import zlib from . import DistlibException -from .compat import (urljoin, urlparse, urlunparse, url2pathname, pathname2url, - queue, quote, unescape, string_types, build_opener, - HTTPRedirectHandler as BaseRedirectHandler, text_type, - Request, HTTPError, URLError) +from .compat import ( + urljoin, + urlparse, + urlunparse, + url2pathname, + pathname2url, + queue, + quote, + unescape, + string_types, + build_opener, + HTTPRedirectHandler as BaseRedirectHandler, + text_type, + Request, + HTTPError, + URLError, +) from .database import Distribution, DistributionPath, make_dist from .metadata import Metadata, MetadataInvalidError -from .util import (cached_property, parse_credentials, ensure_slash, - split_filename, get_project_data, parse_requirement, - parse_name_and_version, ServerProxy, normalize_name) +from .util import ( + cached_property, + parse_credentials, + ensure_slash, + split_filename, + get_project_data, + parse_requirement, + parse_name_and_version, + ServerProxy, + normalize_name, +) from .version import get_scheme, UnsupportedVersionError from .wheel import Wheel, is_compatible logger = logging.getLogger(__name__) -HASHER_HASH = re.compile(r'^(\w+)=([a-f0-9]+)') -CHARSET = re.compile(r';\s*charset\s*=\s*(.*)\s*$', re.I) -HTML_CONTENT_TYPE = re.compile('text/html|application/x(ht)?ml') -DEFAULT_INDEX = 'https://pypi.org/pypi' +HASHER_HASH = re.compile(r"^(\w+)=([a-f0-9]+)") +CHARSET = re.compile(r";\s*charset\s*=\s*(.*)\s*$", re.I) +HTML_CONTENT_TYPE = re.compile("text/html|application/x(ht)?ml") +DEFAULT_INDEX = "https://pypi.org/pypi" + def get_all_distribution_names(url=None): """ @@ -50,12 +73,14 @@ def get_all_distribution_names(url=None): try: return client.list_packages() finally: - client('close')() + client("close")() + class RedirectHandler(BaseRedirectHandler): """ A class to work around a bug in some Python 3.2.x releases. """ + # There's a bug in the base version for some 3.2.x # (e.g. 3.2.2 on Ubuntu Oneiric). If a Location header # returns e.g. /abc, it bails because it says the scheme '' @@ -65,31 +90,32 @@ def http_error_302(self, req, fp, code, msg, headers): # Some servers (incorrectly) return multiple Location headers # (so probably same goes for URI). Use first header. newurl = None - for key in ('location', 'uri'): + for key in ("location", "uri"): if key in headers: newurl = headers[key] break if newurl is None: # pragma: no cover return urlparts = urlparse(newurl) - if urlparts.scheme == '': + if urlparts.scheme == "": newurl = urljoin(req.get_full_url(), newurl) - if hasattr(headers, 'replace_header'): + if hasattr(headers, "replace_header"): headers.replace_header(key, newurl) else: headers[key] = newurl - return BaseRedirectHandler.http_error_302(self, req, fp, code, msg, - headers) + return BaseRedirectHandler.http_error_302(self, req, fp, code, msg, headers) http_error_301 = http_error_303 = http_error_307 = http_error_302 + class Locator(object): """ A base class for locators - things that locate distributions. """ - source_extensions = ('.tar.gz', '.tar.bz2', '.tar', '.zip', '.tgz', '.tbz') - binary_extensions = ('.egg', '.exe', '.whl') - excluded_extensions = ('.pdf',) + + source_extensions = (".tar.gz", ".tar.bz2", ".tar", ".zip", ".tgz", ".tbz") + binary_extensions = (".egg", ".exe", ".whl") + excluded_extensions = (".pdf",) # A list of tags indicating which wheels you want to match. The default # value of None matches against the tags compatible with the running @@ -97,9 +123,9 @@ class Locator(object): # instance to a list of tuples (pyver, abi, arch) which you want to match. wheel_tags = None - downloadable_extensions = source_extensions + ('.whl',) + downloadable_extensions = source_extensions + (".whl",) - def __init__(self, scheme='default'): + def __init__(self, scheme="default"): """ Initialise an instance. :param scheme: Because locators look for most recent versions, they @@ -160,13 +186,13 @@ def _get_project(self, name): If called from a locate() request, self.matcher will be set to a matcher for the requirement to satisfy, otherwise it will be None. """ - raise NotImplementedError('Please implement in the subclass') + raise NotImplementedError("Please implement in the subclass") def get_distribution_names(self): """ Return all the distribution names known to this locator. """ - raise NotImplementedError('Please implement in the subclass') + raise NotImplementedError("Please implement in the subclass") def get_project(self, name): """ @@ -193,12 +219,18 @@ def score_url(self, url): t = urlparse(url) basename = posixpath.basename(t.path) compatible = True - is_wheel = basename.endswith('.whl') + is_wheel = basename.endswith(".whl") is_downloadable = basename.endswith(self.downloadable_extensions) if is_wheel: compatible = is_compatible(Wheel(basename), self.wheel_tags) - return (t.scheme == 'https', 'pypi.org' in t.netloc, - is_downloadable, is_wheel, compatible, basename) + return ( + t.scheme == "https", + "pypi.org" in t.netloc, + is_downloadable, + is_wheel, + compatible, + basename, + ) def prefer_url(self, url1, url2): """ @@ -217,9 +249,9 @@ def prefer_url(self, url1, url2): if s1 > s2: result = url1 if result != url2: - logger.debug('Not replacing %r with %r', url1, url2) + logger.debug("Not replacing %r with %r", url1, url2) else: - logger.debug('Replacing %r with %r', url1, url2) + logger.debug("Replacing %r with %r", url1, url2) return result def split_filename(self, filename, project_name): @@ -236,27 +268,27 @@ def convert_url_to_download_info(self, url, project_name): If it is, a dictionary is returned with keys "name", "version", "filename" and "url"; otherwise, None is returned. """ + def same_project(name1, name2): return normalize_name(name1) == normalize_name(name2) result = None scheme, netloc, path, params, query, frag = urlparse(url) - if frag.lower().startswith('egg='): # pragma: no cover - logger.debug('%s: version hint in fragment: %r', - project_name, frag) + if frag.lower().startswith("egg="): # pragma: no cover + logger.debug("%s: version hint in fragment: %r", project_name, frag) m = HASHER_HASH.match(frag) if m: algo, digest = m.groups() else: algo, digest = None, None origpath = path - if path and path[-1] == '/': # pragma: no cover + if path and path[-1] == "/": # pragma: no cover path = path[:-1] - if path.endswith('.whl'): + if path.endswith(".whl"): try: wheel = Wheel(path) if not is_compatible(wheel, self.wheel_tags): - logger.debug('Wheel not compatible: %s', path) + logger.debug("Wheel not compatible: %s", path) else: if project_name is None: include = True @@ -264,42 +296,45 @@ def same_project(name1, name2): include = same_project(wheel.name, project_name) if include: result = { - 'name': wheel.name, - 'version': wheel.version, - 'filename': wheel.filename, - 'url': urlunparse((scheme, netloc, origpath, - params, query, '')), - 'python-version': ', '.join( - ['.'.join(list(v[2:])) for v in wheel.pyver]), + "name": wheel.name, + "version": wheel.version, + "filename": wheel.filename, + "url": urlunparse( + (scheme, netloc, origpath, params, query, "") + ), + "python-version": ", ".join( + [".".join(list(v[2:])) for v in wheel.pyver] + ), } except Exception as e: # pragma: no cover - logger.warning('invalid path for wheel: %s', path) + logger.warning("invalid path for wheel: %s", path) elif not path.endswith(self.downloadable_extensions): # pragma: no cover - logger.debug('Not downloadable: %s', path) + logger.debug("Not downloadable: %s", path) else: # downloadable extension path = filename = posixpath.basename(path) for ext in self.downloadable_extensions: if path.endswith(ext): - path = path[:-len(ext)] + path = path[: -len(ext)] t = self.split_filename(path, project_name) if not t: # pragma: no cover - logger.debug('No match for project/version: %s', path) + logger.debug("No match for project/version: %s", path) else: name, version, pyver = t if not project_name or same_project(project_name, name): result = { - 'name': name, - 'version': version, - 'filename': filename, - 'url': urlunparse((scheme, netloc, origpath, - params, query, '')), + "name": name, + "version": version, + "filename": filename, + "url": urlunparse( + (scheme, netloc, origpath, params, query, "") + ), #'packagetype': 'sdist', } if pyver: # pragma: no cover - result['python-version'] = pyver + result["python-version"] = pyver break if result and algo: - result['%s_digest' % algo] = digest + result["%s_digest" % algo] = digest return result def _get_digest(self, info): @@ -311,15 +346,15 @@ def _get_digest(self, info): looks only for SHA256, then MD5. """ result = None - if 'digests' in info: - digests = info['digests'] - for algo in ('sha256', 'md5'): + if "digests" in info: + digests = info["digests"] + for algo in ("sha256", "md5"): if algo in digests: result = (algo, digests[algo]) break if not result: - for algo in ('sha256', 'md5'): - key = '%s_digest' % algo + for algo in ("sha256", "md5"): + key = "%s_digest" % algo if key in info: result = (algo, info[key]) break @@ -331,8 +366,8 @@ def _update_version_data(self, result, info): dictionary for a specific version, which typically holds information gleaned from a filename or URL for an archive for the distribution. """ - name = info.pop('name') - version = info.pop('version') + name = info.pop("name") + version = info.pop("version") if version in result: dist = result[version] md = dist.metadata @@ -340,11 +375,11 @@ def _update_version_data(self, result, info): dist = make_dist(name, version, scheme=self.scheme) md = dist.metadata dist.digest = digest = self._get_digest(info) - url = info['url'] - result['digests'][url] = digest - if md.source_url != info['url']: + url = info["url"] + result["digests"][url] = digest + if md.source_url != info["url"]: md.source_url = self.prefer_url(md.source_url, url) - result['urls'].setdefault(version, set()).add(url) + result["urls"].setdefault(version, set()).add(url) dist.locator = self result[version] = dist @@ -364,42 +399,45 @@ def locate(self, requirement, prereleases=False): result = None r = parse_requirement(requirement) if r is None: # pragma: no cover - raise DistlibException('Not a valid requirement: %r' % requirement) + raise DistlibException("Not a valid requirement: %r" % requirement) scheme = get_scheme(self.scheme) self.matcher = matcher = scheme.matcher(r.requirement) - logger.debug('matcher: %s (%s)', matcher, type(matcher).__name__) + logger.debug("matcher: %s (%s)", matcher, type(matcher).__name__) versions = self.get_project(r.name) - if len(versions) > 2: # urls and digests keys are present + if len(versions) > 2: # urls and digests keys are present # sometimes, versions are invalid slist = [] vcls = matcher.version_class for k in versions: - if k in ('urls', 'digests'): + if k in ("urls", "digests"): continue try: if not matcher.match(k): - logger.debug('%s did not match %r', matcher, k) + logger.debug("%s did not match %r", matcher, k) else: if prereleases or not vcls(k).is_prerelease: slist.append(k) else: - logger.debug('skipping pre-release ' - 'version %s of %s', k, matcher.name) + logger.debug( + "skipping pre-release " "version %s of %s", + k, + matcher.name, + ) except Exception: # pragma: no cover - logger.warning('error matching %s with %r', matcher, k) - pass # slist.append(k) + logger.warning("error matching %s with %r", matcher, k) + pass # slist.append(k) if len(slist) > 1: slist = sorted(slist, key=scheme.key) if slist: - logger.debug('sorted list: %s', slist) + logger.debug("sorted list: %s", slist) version = slist[-1] result = versions[version] if result: if r.extras: result.extras = r.extras - result.download_urls = versions.get('urls', {}).get(version, set()) + result.download_urls = versions.get("urls", {}).get(version, set()) d = {} - sd = versions.get('digests', {}) + sd = versions.get("digests", {}) for url in result.download_urls: if url in sd: # pragma: no cover d[url] = sd[url] @@ -413,6 +451,7 @@ class PyPIRPCLocator(Locator): This locator uses XML-RPC to locate distributions. It therefore cannot be used with simple mirrors (that only mirror file content). """ + def __init__(self, url, **kwargs): """ Initialise an instance. @@ -431,36 +470,38 @@ def get_distribution_names(self): return set(self.client.list_packages()) def _get_project(self, name): - result = {'urls': {}, 'digests': {}} + result = {"urls": {}, "digests": {}} versions = self.client.package_releases(name, True) for v in versions: urls = self.client.release_urls(name, v) data = self.client.release_data(name, v) metadata = Metadata(scheme=self.scheme) - metadata.name = data['name'] - metadata.version = data['version'] - metadata.license = data.get('license') - metadata.keywords = data.get('keywords', []) - metadata.summary = data.get('summary') + metadata.name = data["name"] + metadata.version = data["version"] + metadata.license = data.get("license") + metadata.keywords = data.get("keywords", []) + metadata.summary = data.get("summary") dist = Distribution(metadata) if urls: info = urls[0] - metadata.source_url = info['url'] + metadata.source_url = info["url"] dist.digest = self._get_digest(info) dist.locator = self result[v] = dist for info in urls: - url = info['url'] + url = info["url"] digest = self._get_digest(info) - result['urls'].setdefault(v, set()).add(url) - result['digests'][url] = digest + result["urls"].setdefault(v, set()).add(url) + result["digests"][url] = digest return result + class PyPIJSONLocator(Locator): """ This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using. """ + def __init__(self, url, **kwargs): super(PyPIJSONLocator, self).__init__(**kwargs) self.base_url = ensure_slash(url) @@ -469,36 +510,36 @@ def get_distribution_names(self): """ Return all the distribution names known to this locator. """ - raise NotImplementedError('Not available from this locator') + raise NotImplementedError("Not available from this locator") def _get_project(self, name): - result = {'urls': {}, 'digests': {}} - url = urljoin(self.base_url, '%s/json' % quote(name)) + result = {"urls": {}, "digests": {}} + url = urljoin(self.base_url, "%s/json" % quote(name)) try: resp = self.opener.open(url) - data = resp.read().decode() # for now + data = resp.read().decode() # for now d = json.loads(data) md = Metadata(scheme=self.scheme) - data = d['info'] - md.name = data['name'] - md.version = data['version'] - md.license = data.get('license') - md.keywords = data.get('keywords', []) - md.summary = data.get('summary') + data = d["info"] + md.name = data["name"] + md.version = data["version"] + md.license = data.get("license") + md.keywords = data.get("keywords", []) + md.summary = data.get("summary") dist = Distribution(md) dist.locator = self - urls = d['urls'] + urls = d["urls"] result[md.version] = dist - for info in d['urls']: - url = info['url'] + for info in d["urls"]: + url = info["url"] dist.download_urls.add(url) dist.digests[url] = self._get_digest(info) - result['urls'].setdefault(md.version, set()).add(url) - result['digests'][url] = self._get_digest(info) + result["urls"].setdefault(md.version, set()).add(url) + result["digests"][url] = self._get_digest(info) # Now get other releases - for version, infos in d['releases'].items(): + for version, infos in d["releases"].items(): if version == md.version: - continue # already done + continue # already done omd = Metadata(scheme=self.scheme) omd.name = md.name omd.version = version @@ -506,22 +547,22 @@ def _get_project(self, name): odist.locator = self result[version] = odist for info in infos: - url = info['url'] + url = info["url"] odist.download_urls.add(url) odist.digests[url] = self._get_digest(info) - result['urls'].setdefault(version, set()).add(url) - result['digests'][url] = self._get_digest(info) -# for info in urls: -# md.source_url = info['url'] -# dist.digest = self._get_digest(info) -# dist.locator = self -# for info in urls: -# url = info['url'] -# result['urls'].setdefault(md.version, set()).add(url) -# result['digests'][url] = self._get_digest(info) + result["urls"].setdefault(version, set()).add(url) + result["digests"][url] = self._get_digest(info) + # for info in urls: + # md.source_url = info['url'] + # dist.digest = self._get_digest(info) + # dist.locator = self + # for info in urls: + # url = info['url'] + # result['urls'].setdefault(md.version, set()).add(url) + # result['digests'][url] = self._get_digest(info) except Exception as e: self.errors.put(text_type(e)) - logger.exception('JSON fetch failed: %s', e) + logger.exception("JSON fetch failed: %s", e) return result @@ -529,16 +570,20 @@ class Page(object): """ This class represents a scraped HTML page. """ + # The following slightly hairy-looking regex just looks for the contents of # an anchor link, which has an attribute "href" either immediately preceded # or immediately followed by a "rel" attribute. The attribute values can be # declared with double quotes, single quotes or no quotes - which leads to # the length of the expression. - _href = re.compile(""" + _href = re.compile( + """ (rel\\s*=\\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\\s\n]*))\\s+)? href\\s*=\\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\\s\n]*)) (\\s+rel\\s*=\\s*(?:"(?P[^"]*)"|'(?P[^']*)'|(?P[^>\\s\n]*)))? -""", re.I | re.S | re.X) +""", + re.I | re.S | re.X, + ) _base = re.compile(r"""]+)""", re.I | re.S) def __init__(self, data, url): @@ -552,7 +597,7 @@ def __init__(self, data, url): if m: self.base_url = m.group(1) - _clean_re = re.compile(r'[^a-z0-9$&+,/:;=?@.#%_\\|-]', re.I) + _clean_re = re.compile(r"[^a-z0-9$&+,/:;=?@.#%_\\|-]", re.I) @cached_property def links(self): @@ -561,21 +606,27 @@ def links(self): about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. """ + def clean(url): "Tidy up an URL." scheme, netloc, path, params, query, frag = urlparse(url) - return urlunparse((scheme, netloc, quote(path), - params, query, frag)) + return urlunparse((scheme, netloc, quote(path), params, query, frag)) result = set() for match in self._href.finditer(self.data): - d = match.groupdict('') - rel = (d['rel1'] or d['rel2'] or d['rel3'] or - d['rel4'] or d['rel5'] or d['rel6']) - url = d['url1'] or d['url2'] or d['url3'] + d = match.groupdict("") + rel = ( + d["rel1"] + or d["rel2"] + or d["rel3"] + or d["rel4"] + or d["rel5"] + or d["rel6"] + ) + url = d["url1"] or d["url2"] or d["url3"] url = urljoin(self.base_url, url) url = unescape(url) - url = self._clean_re.sub(lambda m: '%%%2x' % ord(m.group(0)), url) + url = self._clean_re.sub(lambda m: "%%%2x" % ord(m.group(0)), url) result.add((url, rel)) # We sort the result, hoping to bring the most recent versions # to the front @@ -592,9 +643,9 @@ class SimpleScrapingLocator(Locator): # These are used to deal with various Content-Encoding schemes. decoders = { - 'deflate': zlib.decompress, - 'gzip': lambda b: gzip.GzipFile(fileobj=BytesIO(d)).read(), - 'none': lambda b: b, + "deflate": zlib.decompress, + "gzip": lambda b: gzip.GzipFile(fileobj=BytesIO(d)).read(), + "none": lambda b: b, } def __init__(self, url, timeout=None, num_workers=10, **kwargs): @@ -645,22 +696,22 @@ def _wait_threads(self): # Note that you need two loops, since you can't say which # thread will get each sentinel for t in self._threads: - self._to_fetch.put(None) # sentinel + self._to_fetch.put(None) # sentinel for t in self._threads: t.join() self._threads = [] def _get_project(self, name): - result = {'urls': {}, 'digests': {}} + result = {"urls": {}, "digests": {}} with self._gplock: self.result = result self.project_name = name - url = urljoin(self.base_url, '%s/' % quote(name)) + url = urljoin(self.base_url, "%s/" % quote(name)) self._seen.clear() self._page_cache.clear() self._prepare_threads() try: - logger.debug('Queueing %s', url) + logger.debug("Queueing %s", url) self._to_fetch.put(url) self._to_fetch.join() finally: @@ -668,8 +719,9 @@ def _get_project(self, name): del self.result return result - platform_dependent = re.compile(r'\b(linux_(i\d86|x86_64|arm\w+)|' - r'win(32|_amd64)|macosx_?\d+)\b', re.I) + platform_dependent = re.compile( + r"\b(linux_(i\d86|x86_64|arm\w+)|" r"win(32|_amd64)|macosx_?\d+)\b", re.I + ) def _is_platform_dependent(self, url): """ @@ -691,9 +743,9 @@ def _process_download(self, url): info = None else: info = self.convert_url_to_download_info(url, self.project_name) - logger.debug('process_download: %s -> %s', url, info) + logger.debug("process_download: %s -> %s", url, info) if info: - with self._lock: # needed because self.result is shared + with self._lock: # needed because self.result is shared self._update_version_data(self.result, info) return info @@ -703,27 +755,27 @@ def _should_queue(self, link, referrer, rel): particular "rel" attribute should be queued for scraping. """ scheme, netloc, path, _, _, _ = urlparse(link) - if path.endswith(self.source_extensions + self.binary_extensions + - self.excluded_extensions): + if path.endswith( + self.source_extensions + self.binary_extensions + self.excluded_extensions + ): result = False elif self.skip_externals and not link.startswith(self.base_url): result = False elif not referrer.startswith(self.base_url): result = False - elif rel not in ('homepage', 'download'): + elif rel not in ("homepage", "download"): result = False - elif scheme not in ('http', 'https', 'ftp'): + elif scheme not in ("http", "https", "ftp"): result = False elif self._is_platform_dependent(link): result = False else: - host = netloc.split(':', 1)[0] - if host.lower() == 'localhost': + host = netloc.split(":", 1)[0] + if host.lower() == "localhost": result = False else: result = True - logger.debug('should_queue: %s (%s) from %s -> %s', link, rel, - referrer, result) + logger.debug("should_queue: %s (%s) from %s -> %s", link, rel, referrer, result) return result def _fetch(self): @@ -738,15 +790,16 @@ def _fetch(self): try: if url: page = self.get_page(url) - if page is None: # e.g. after an error + if page is None: # e.g. after an error continue for link, rel in page.links: if link not in self._seen: try: self._seen.add(link) - if (not self._process_download(link) and - self._should_queue(link, url, rel)): - logger.debug('Queueing %s from %s', link, url) + if not self._process_download( + link + ) and self._should_queue(link, url, rel): + logger.debug("Queueing %s from %s", link, url) self._to_fetch.put(link) except MetadataInvalidError: # e.g. invalid versions pass @@ -756,7 +809,7 @@ def _fetch(self): # always do this, to avoid hangs :-) self._to_fetch.task_done() if not url: - #logger.debug('Sentinel seen, quitting.') + # logger.debug('Sentinel seen, quitting.') break def get_page(self, url): @@ -769,56 +822,56 @@ def get_page(self, url): """ # http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api scheme, netloc, path, _, _, _ = urlparse(url) - if scheme == 'file' and os.path.isdir(url2pathname(path)): - url = urljoin(ensure_slash(url), 'index.html') + if scheme == "file" and os.path.isdir(url2pathname(path)): + url = urljoin(ensure_slash(url), "index.html") if url in self._page_cache: result = self._page_cache[url] - logger.debug('Returning %s from cache: %s', url, result) + logger.debug("Returning %s from cache: %s", url, result) else: - host = netloc.split(':', 1)[0] + host = netloc.split(":", 1)[0] result = None if host in self._bad_hosts: - logger.debug('Skipping %s due to bad host %s', url, host) + logger.debug("Skipping %s due to bad host %s", url, host) else: - req = Request(url, headers={'Accept-encoding': 'identity'}) + req = Request(url, headers={"Accept-encoding": "identity"}) try: - logger.debug('Fetching %s', url) + logger.debug("Fetching %s", url) resp = self.opener.open(req, timeout=self.timeout) - logger.debug('Fetched %s', url) + logger.debug("Fetched %s", url) headers = resp.info() - content_type = headers.get('Content-Type', '') + content_type = headers.get("Content-Type", "") if HTML_CONTENT_TYPE.match(content_type): final_url = resp.geturl() data = resp.read() - encoding = headers.get('Content-Encoding') + encoding = headers.get("Content-Encoding") if encoding: - decoder = self.decoders[encoding] # fail if not found + decoder = self.decoders[encoding] # fail if not found data = decoder(data) - encoding = 'utf-8' + encoding = "utf-8" m = CHARSET.search(content_type) if m: encoding = m.group(1) try: data = data.decode(encoding) except UnicodeError: # pragma: no cover - data = data.decode('latin-1') # fallback + data = data.decode("latin-1") # fallback result = Page(data, final_url) self._page_cache[final_url] = result except HTTPError as e: if e.code != 404: - logger.exception('Fetch failed: %s: %s', url, e) + logger.exception("Fetch failed: %s: %s", url, e) except URLError as e: # pragma: no cover - logger.exception('Fetch failed: %s: %s', url, e) + logger.exception("Fetch failed: %s: %s", url, e) with self._lock: self._bad_hosts.add(host) except Exception as e: # pragma: no cover - logger.exception('Fetch failed: %s: %s', url, e) + logger.exception("Fetch failed: %s: %s", url, e) finally: - self._page_cache[url] = result # even if None (failure) + self._page_cache[url] = result # even if None (failure) return result - _distname_re = re.compile(']*>([^<]+)<') + _distname_re = re.compile("]*>([^<]+)<") def get_distribution_names(self): """ @@ -827,11 +880,12 @@ def get_distribution_names(self): result = set() page = self.get_page(self.base_url) if not page: - raise DistlibException('Unable to get %s' % self.base_url) + raise DistlibException("Unable to get %s" % self.base_url) for match in self._distname_re.finditer(page.data): result.add(match.group(1)) return result + class DirectoryLocator(Locator): """ This class locates distributions in a directory tree. @@ -847,11 +901,11 @@ def __init__(self, path, **kwargs): recursed into. If False, only the top-level directory is searched, """ - self.recursive = kwargs.pop('recursive', True) + self.recursive = kwargs.pop("recursive", True) super(DirectoryLocator, self).__init__(**kwargs) path = os.path.abspath(path) if not os.path.isdir(path): # pragma: no cover - raise DistlibException('Not a directory: %r' % path) + raise DistlibException("Not a directory: %r" % path) self.base_dir = path def should_include(self, filename, parent): @@ -863,14 +917,14 @@ def should_include(self, filename, parent): return filename.endswith(self.downloadable_extensions) def _get_project(self, name): - result = {'urls': {}, 'digests': {}} + result = {"urls": {}, "digests": {}} for root, dirs, files in os.walk(self.base_dir): for fn in files: if self.should_include(fn, root): fn = os.path.join(root, fn) - url = urlunparse(('file', '', - pathname2url(os.path.abspath(fn)), - '', '', '')) + url = urlunparse( + ("file", "", pathname2url(os.path.abspath(fn)), "", "", "") + ) info = self.convert_url_to_download_info(url, name) if info: self._update_version_data(result, info) @@ -887,16 +941,17 @@ def get_distribution_names(self): for fn in files: if self.should_include(fn, root): fn = os.path.join(root, fn) - url = urlunparse(('file', '', - pathname2url(os.path.abspath(fn)), - '', '', '')) + url = urlunparse( + ("file", "", pathname2url(os.path.abspath(fn)), "", "", "") + ) info = self.convert_url_to_download_info(url, None) if info: - result.add(info['name']) + result.add(info["name"]) if not self.recursive: break return result + class JSONLocator(Locator): """ This locator uses special extended metadata (not available on PyPI) and is @@ -904,42 +959,47 @@ class JSONLocator(Locator): require archive downloads before dependencies can be determined! As you might imagine, that can be slow. """ + def get_distribution_names(self): """ Return all the distribution names known to this locator. """ - raise NotImplementedError('Not available from this locator') + raise NotImplementedError("Not available from this locator") def _get_project(self, name): - result = {'urls': {}, 'digests': {}} + result = {"urls": {}, "digests": {}} data = get_project_data(name) if data: - for info in data.get('files', []): - if info['ptype'] != 'sdist' or info['pyversion'] != 'source': + for info in data.get("files", []): + if info["ptype"] != "sdist" or info["pyversion"] != "source": continue # We don't store summary in project metadata as it makes # the data bigger for no benefit during dependency # resolution - dist = make_dist(data['name'], info['version'], - summary=data.get('summary', - 'Placeholder for summary'), - scheme=self.scheme) + dist = make_dist( + data["name"], + info["version"], + summary=data.get("summary", "Placeholder for summary"), + scheme=self.scheme, + ) md = dist.metadata - md.source_url = info['url'] + md.source_url = info["url"] # TODO SHA256 digest - if 'digest' in info and info['digest']: - dist.digest = ('md5', info['digest']) - md.dependencies = info.get('requirements', {}) - dist.exports = info.get('exports', {}) + if "digest" in info and info["digest"]: + dist.digest = ("md5", info["digest"]) + md.dependencies = info.get("requirements", {}) + dist.exports = info.get("exports", {}) result[dist.version] = dist - result['urls'].setdefault(dist.version, set()).add(info['url']) + result["urls"].setdefault(dist.version, set()).add(info["url"]) return result + class DistPathLocator(Locator): """ This locator finds installed distributions in a path. It can be useful for adding to an :class:`AggregatingLocator`. """ + def __init__(self, distpath, **kwargs): """ Initialise an instance. @@ -953,12 +1013,12 @@ def __init__(self, distpath, **kwargs): def _get_project(self, name): dist = self.distpath.get_distribution(name) if dist is None: - result = {'urls': {}, 'digests': {}} + result = {"urls": {}, "digests": {}} else: result = { dist.version: dist, - 'urls': {dist.version: set([dist.source_url])}, - 'digests': {dist.version: set([None])} + "urls": {dist.version: set([dist.source_url])}, + "digests": {dist.version: set([None])}, } return result @@ -967,6 +1027,7 @@ class AggregatingLocator(Locator): """ This class allows you to chain and/or merge a list of locators. """ + def __init__(self, *locators, **kwargs): """ Initialise an instance. @@ -979,7 +1040,7 @@ def __init__(self, *locators, **kwargs): the results from all locators are merged (this can be slow). """ - self.merge = kwargs.pop('merge', False) + self.merge = kwargs.pop("merge", False) self.locators = locators super(AggregatingLocator, self).__init__(**kwargs) @@ -1001,18 +1062,18 @@ def _get_project(self, name): d = locator.get_project(name) if d: if self.merge: - files = result.get('urls', {}) - digests = result.get('digests', {}) + files = result.get("urls", {}) + digests = result.get("digests", {}) # next line could overwrite result['urls'], result['digests'] result.update(d) - df = result.get('urls') + df = result.get("urls") if files and df: for k, v in files.items(): if k in df: df[k] |= v else: df[k] = v - dd = result.get('digests') + dd = result.get("digests") if digests and dd: dd.update(digests) else: @@ -1055,15 +1116,15 @@ def get_distribution_names(self): # We use a legacy scheme simply because most of the dists on PyPI use legacy # versions which don't conform to PEP 426 / PEP 440. default_locator = AggregatingLocator( - JSONLocator(), - SimpleScrapingLocator('https://pypi.org/simple/', - timeout=3.0), - scheme='legacy') + JSONLocator(), + SimpleScrapingLocator("https://pypi.org/simple/", timeout=3.0), + scheme="legacy", +) locate = default_locator.locate -NAME_VERSION_RE = re.compile(r'(?P[\w-]+)\s*' - r'\(\s*(==\s*)?(?P[^)]+)\)$') +NAME_VERSION_RE = re.compile(r"(?P[\w-]+)\s*" r"\(\s*(==\s*)?(?P[^)]+)\)$") + class DependencyFinder(object): """ @@ -1084,13 +1145,13 @@ def add_distribution(self, dist): about who provides what. :param dist: The distribution to add. """ - logger.debug('adding distribution %s', dist) + logger.debug("adding distribution %s", dist) name = dist.key self.dists_by_name[name] = dist self.dists[(name, dist.version)] = dist for p in dist.provides: name, version = parse_name_and_version(p) - logger.debug('Add to provided: %s, %s, %s', name, version, dist) + logger.debug("Add to provided: %s, %s, %s", name, version, dist) self.provided.setdefault(name, set()).add((version, dist)) def remove_distribution(self, dist): @@ -1099,13 +1160,13 @@ def remove_distribution(self, dist): information about who provides what. :param dist: The distribution to remove. """ - logger.debug('removing distribution %s', dist) + logger.debug("removing distribution %s", dist) name = dist.key del self.dists_by_name[name] del self.dists[(name, dist.version)] for p in dist.provides: name, version = parse_name_and_version(p) - logger.debug('Remove from provided: %s, %s, %s', name, version, dist) + logger.debug("Remove from provided: %s, %s, %s", name, version, dist) s = self.provided[name] s.remove((version, dist)) if not s: @@ -1136,7 +1197,7 @@ def find_providers(self, reqt): :return: A set of distribution which can fulfill the requirement. """ matcher = self.get_matcher(reqt) - name = matcher.key # case-insensitive + name = matcher.key # case-insensitive result = set() provided = self.provided if name in provided: @@ -1178,8 +1239,7 @@ def try_to_replace(self, provider, other, problems): unmatched.add(s) if unmatched: # can't replace other with provider - problems.add(('cantreplace', provider, other, - frozenset(unmatched))) + problems.add(("cantreplace", provider, other, frozenset(unmatched))) result = False else: # can replace other with provider @@ -1223,31 +1283,30 @@ def find(self, requirement, meta_extras=None, prereleases=False): self.reqts = {} meta_extras = set(meta_extras or []) - if ':*:' in meta_extras: - meta_extras.remove(':*:') + if ":*:" in meta_extras: + meta_extras.remove(":*:") # :meta: and :run: are implicitly included - meta_extras |= set([':test:', ':build:', ':dev:']) + meta_extras |= set([":test:", ":build:", ":dev:"]) if isinstance(requirement, Distribution): dist = odist = requirement - logger.debug('passed %s as requirement', odist) + logger.debug("passed %s as requirement", odist) else: - dist = odist = self.locator.locate(requirement, - prereleases=prereleases) + dist = odist = self.locator.locate(requirement, prereleases=prereleases) if dist is None: - raise DistlibException('Unable to locate %r' % requirement) - logger.debug('located %s', odist) + raise DistlibException("Unable to locate %r" % requirement) + logger.debug("located %s", odist) dist.requested = True problems = set() todo = set([dist]) install_dists = set([odist]) while todo: dist = todo.pop() - name = dist.key # case-insensitive + name = dist.key # case-insensitive if name not in self.dists_by_name: self.add_distribution(dist) else: - #import pdb; pdb.set_trace() + # import pdb; pdb.set_trace() other = self.dists_by_name[name] if other != dist: self.try_to_replace(dist, other, problems) @@ -1256,23 +1315,23 @@ def find(self, requirement, meta_extras=None, prereleases=False): sreqts = dist.build_requires ereqts = set() if meta_extras and dist in install_dists: - for key in ('test', 'build', 'dev'): - e = ':%s:' % key + for key in ("test", "build", "dev"): + e = ":%s:" % key if e in meta_extras: - ereqts |= getattr(dist, '%s_requires' % key) + ereqts |= getattr(dist, "%s_requires" % key) all_reqts = ireqts | sreqts | ereqts for r in all_reqts: providers = self.find_providers(r) if not providers: - logger.debug('No providers found for %r', r) + logger.debug("No providers found for %r", r) provider = self.locator.locate(r, prereleases=prereleases) # If no provider is found and we didn't consider # prereleases, consider them now. if provider is None and not prereleases: provider = self.locator.locate(r, prereleases=True) if provider is None: - logger.debug('Cannot satisfy %r', r) - problems.add(('unsatisfied', r)) + logger.debug("Cannot satisfy %r", r) + problems.add(("unsatisfied", r)) else: n, v = provider.key, provider.version if (n, v) not in self.dists: @@ -1280,8 +1339,9 @@ def find(self, requirement, meta_extras=None, prereleases=False): providers.add(provider) if r in ireqts and dist in install_dists: install_dists.add(provider) - logger.debug('Adding %s to install_dists', - provider.name_and_version) + logger.debug( + "Adding %s to install_dists", provider.name_and_version + ) for p in providers: name = p.key if name not in self.dists_by_name: @@ -1296,7 +1356,8 @@ def find(self, requirement, meta_extras=None, prereleases=False): for dist in dists: dist.build_time_dependency = dist not in install_dists if dist.build_time_dependency: - logger.debug('%s is a build-time dependency only.', - dist.name_and_version) - logger.debug('find done for %s', odist) + logger.debug( + "%s is a build-time dependency only.", dist.name_and_version + ) + logger.debug("find done for %s", odist) return dists, problems diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/manifest.py b/src/fetchcode/vcs/pip/_vendor/distlib/manifest.py index ca0fe442..8c507d2a 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/manifest.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/manifest.py @@ -19,13 +19,13 @@ from .util import convert_path -__all__ = ['Manifest'] +__all__ = ["Manifest"] logger = logging.getLogger(__name__) # a \ followed by some spaces + EOL -_COLLAPSE_PATTERN = re.compile('\\\\w*\n', re.M) -_COMMENTED_LINE = re.compile('#.*?(?=\n)|\n(?=$)', re.M | re.S) +_COLLAPSE_PATTERN = re.compile("\\\\w*\n", re.M) +_COMMENTED_LINE = re.compile("#.*?(?=\n)|\n(?=$)", re.M | re.S) # # Due to the different results returned by fnmatch.translate, we need @@ -34,6 +34,7 @@ # _PYTHON_VERSION = sys.version_info[:2] + class Manifest(object): """A list of files built by on exploring the filesystem and filtered by applying various patterns to what we find there. @@ -107,20 +108,22 @@ def sorted(self, wantdirs=False): def add_dir(dirs, d): dirs.add(d) - logger.debug('add_dir added %s', d) + logger.debug("add_dir added %s", d) if d != self.base: parent, _ = os.path.split(d) - assert parent not in ('', '/') + assert parent not in ("", "/") add_dir(dirs, parent) - result = set(self.files) # make a copy! + result = set(self.files) # make a copy! if wantdirs: dirs = set() for f in result: add_dir(dirs, os.path.dirname(f)) result |= dirs - return [os.path.join(*path_tuple) for path_tuple in - sorted(os.path.split(path) for path in result)] + return [ + os.path.join(*path_tuple) + for path_tuple in sorted(os.path.split(path) for path in result) + ] def clear(self): """Clear all collected files.""" @@ -147,60 +150,65 @@ def process_directive(self, directive): # OK, now we know that the action is valid and we have the # right number of words on the line for that action -- so we # can proceed with minimal error-checking. - if action == 'include': + if action == "include": for pattern in patterns: if not self._include_pattern(pattern, anchor=True): - logger.warning('no files found matching %r', pattern) + logger.warning("no files found matching %r", pattern) - elif action == 'exclude': + elif action == "exclude": for pattern in patterns: found = self._exclude_pattern(pattern, anchor=True) - #if not found: + # if not found: # logger.warning('no previously-included files ' # 'found matching %r', pattern) - elif action == 'global-include': + elif action == "global-include": for pattern in patterns: if not self._include_pattern(pattern, anchor=False): - logger.warning('no files found matching %r ' - 'anywhere in distribution', pattern) + logger.warning( + "no files found matching %r " "anywhere in distribution", + pattern, + ) - elif action == 'global-exclude': + elif action == "global-exclude": for pattern in patterns: found = self._exclude_pattern(pattern, anchor=False) - #if not found: + # if not found: # logger.warning('no previously-included files ' # 'matching %r found anywhere in ' # 'distribution', pattern) - elif action == 'recursive-include': + elif action == "recursive-include": for pattern in patterns: if not self._include_pattern(pattern, prefix=thedir): - logger.warning('no files found matching %r ' - 'under directory %r', pattern, thedir) + logger.warning( + "no files found matching %r " "under directory %r", + pattern, + thedir, + ) - elif action == 'recursive-exclude': + elif action == "recursive-exclude": for pattern in patterns: found = self._exclude_pattern(pattern, prefix=thedir) - #if not found: + # if not found: # logger.warning('no previously-included files ' # 'matching %r found under directory %r', # pattern, thedir) - elif action == 'graft': + elif action == "graft": if not self._include_pattern(None, prefix=dirpattern): - logger.warning('no directories found matching %r', - dirpattern) + logger.warning("no directories found matching %r", dirpattern) - elif action == 'prune': + elif action == "prune": if not self._exclude_pattern(None, prefix=dirpattern): - logger.warning('no previously-included directories found ' - 'matching %r', dirpattern) - else: # pragma: no cover + logger.warning( + "no previously-included directories found " "matching %r", + dirpattern, + ) + else: # pragma: no cover # This should never happen, as it should be caught in # _parse_template_line - raise DistlibException( - 'invalid action %r' % action) + raise DistlibException("invalid action %r" % action) # # Private API @@ -213,48 +221,49 @@ def _parse_directive(self, directive): :return: A tuple of action, patterns, thedir, dir_patterns """ words = directive.split() - if len(words) == 1 and words[0] not in ('include', 'exclude', - 'global-include', - 'global-exclude', - 'recursive-include', - 'recursive-exclude', - 'graft', 'prune'): + if len(words) == 1 and words[0] not in ( + "include", + "exclude", + "global-include", + "global-exclude", + "recursive-include", + "recursive-exclude", + "graft", + "prune", + ): # no action given, let's use the default 'include' - words.insert(0, 'include') + words.insert(0, "include") action = words[0] patterns = thedir = dir_pattern = None - if action in ('include', 'exclude', - 'global-include', 'global-exclude'): + if action in ("include", "exclude", "global-include", "global-exclude"): if len(words) < 2: - raise DistlibException( - '%r expects ...' % action) + raise DistlibException("%r expects ..." % action) patterns = [convert_path(word) for word in words[1:]] - elif action in ('recursive-include', 'recursive-exclude'): + elif action in ("recursive-include", "recursive-exclude"): if len(words) < 3: raise DistlibException( - '%r expects ...' % action) + "%r expects ..." % action + ) thedir = convert_path(words[1]) patterns = [convert_path(word) for word in words[2:]] - elif action in ('graft', 'prune'): + elif action in ("graft", "prune"): if len(words) != 2: - raise DistlibException( - '%r expects a single ' % action) + raise DistlibException("%r expects a single " % action) dir_pattern = convert_path(words[1]) else: - raise DistlibException('unknown action %r' % action) + raise DistlibException("unknown action %r" % action) return action, patterns, thedir, dir_pattern - def _include_pattern(self, pattern, anchor=True, prefix=None, - is_regex=False): + def _include_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. @@ -294,8 +303,7 @@ def _include_pattern(self, pattern, anchor=True, prefix=None, found = True return found - def _exclude_pattern(self, pattern, anchor=True, prefix=None, - is_regex=False): + def _exclude_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Remove strings (presumably filenames) from 'files' that match 'pattern'. @@ -314,8 +322,7 @@ def _exclude_pattern(self, pattern, anchor=True, prefix=None, found = True return found - def _translate_pattern(self, pattern, anchor=True, prefix=None, - is_regex=False): + def _translate_pattern(self, pattern, anchor=True, prefix=None, is_regex=False): """Translate a shell-like wildcard pattern to a compiled regular expression. @@ -331,41 +338,46 @@ def _translate_pattern(self, pattern, anchor=True, prefix=None, if _PYTHON_VERSION > (3, 2): # ditch start and end characters - start, _, end = self._glob_to_re('_').partition('_') + start, _, end = self._glob_to_re("_").partition("_") if pattern: pattern_re = self._glob_to_re(pattern) if _PYTHON_VERSION > (3, 2): assert pattern_re.startswith(start) and pattern_re.endswith(end) else: - pattern_re = '' + pattern_re = "" - base = re.escape(os.path.join(self.base, '')) + base = re.escape(os.path.join(self.base, "")) if prefix is not None: # ditch end of pattern character if _PYTHON_VERSION <= (3, 2): - empty_pattern = self._glob_to_re('') - prefix_re = self._glob_to_re(prefix)[:-len(empty_pattern)] + empty_pattern = self._glob_to_re("") + prefix_re = self._glob_to_re(prefix)[: -len(empty_pattern)] else: prefix_re = self._glob_to_re(prefix) assert prefix_re.startswith(start) and prefix_re.endswith(end) - prefix_re = prefix_re[len(start): len(prefix_re) - len(end)] + prefix_re = prefix_re[len(start) : len(prefix_re) - len(end)] sep = os.sep - if os.sep == '\\': - sep = r'\\' + if os.sep == "\\": + sep = r"\\" if _PYTHON_VERSION <= (3, 2): - pattern_re = '^' + base + sep.join((prefix_re, - '.*' + pattern_re)) + pattern_re = "^" + base + sep.join((prefix_re, ".*" + pattern_re)) else: - pattern_re = pattern_re[len(start): len(pattern_re) - len(end)] - pattern_re = r'%s%s%s%s.*%s%s' % (start, base, prefix_re, sep, - pattern_re, end) + pattern_re = pattern_re[len(start) : len(pattern_re) - len(end)] + pattern_re = r"%s%s%s%s.*%s%s" % ( + start, + base, + prefix_re, + sep, + pattern_re, + end, + ) else: # no prefix -- respect anchor flag if anchor: if _PYTHON_VERSION <= (3, 2): - pattern_re = '^' + base + pattern_re + pattern_re = "^" + base + pattern_re else: - pattern_re = r'%s%s%s' % (start, base, pattern_re[len(start):]) + pattern_re = r"%s%s%s" % (start, base, pattern_re[len(start) :]) return re.compile(pattern_re) @@ -384,10 +396,10 @@ def _glob_to_re(self, pattern): # any OS. So change all non-escaped dots in the RE to match any # character except the special characters (currently: just os.sep). sep = os.sep - if os.sep == '\\': + if os.sep == "\\": # we're using a regex to manipulate a regex, so we need # to escape the backslash twice - sep = r'\\\\' - escaped = r'\1[^%s]' % sep - pattern_re = re.sub(r'((? y, - '!=': lambda x, y: x != y, - '<': lambda x, y: x < y, - '<=': lambda x, y: x == y or x < y, - '>': lambda x, y: x > y, - '>=': lambda x, y: x == y or x > y, - 'and': lambda x, y: x and y, - 'or': lambda x, y: x or y, - 'in': lambda x, y: x in y, - 'not in': lambda x, y: x not in y, + "==": lambda x, y: x == y, + "===": lambda x, y: x == y, + "~=": lambda x, y: x == y or x > y, + "!=": lambda x, y: x != y, + "<": lambda x, y: x < y, + "<=": lambda x, y: x == y or x < y, + ">": lambda x, y: x > y, + ">=": lambda x, y: x == y or x > y, + "and": lambda x, y: x and y, + "or": lambda x, y: x or y, + "in": lambda x, y: x in y, + "not in": lambda x, y: x not in y, } def evaluate(self, expr, context): @@ -53,63 +55,66 @@ def evaluate(self, expr, context): function in the specified context. """ if isinstance(expr, string_types): - if expr[0] in '\'"': + if expr[0] in "'\"": result = expr[1:-1] else: if expr not in context: - raise SyntaxError('unknown variable: %s' % expr) + raise SyntaxError("unknown variable: %s" % expr) result = context[expr] else: assert isinstance(expr, dict) - op = expr['op'] + op = expr["op"] if op not in self.operations: - raise NotImplementedError('op not implemented: %s' % op) - elhs = expr['lhs'] - erhs = expr['rhs'] - if _is_literal(expr['lhs']) and _is_literal(expr['rhs']): - raise SyntaxError('invalid comparison: %s %s %s' % (elhs, op, erhs)) + raise NotImplementedError("op not implemented: %s" % op) + elhs = expr["lhs"] + erhs = expr["rhs"] + if _is_literal(expr["lhs"]) and _is_literal(expr["rhs"]): + raise SyntaxError("invalid comparison: %s %s %s" % (elhs, op, erhs)) lhs = self.evaluate(elhs, context) rhs = self.evaluate(erhs, context) result = self.operations[op](lhs, rhs) return result + def default_context(): def format_full_version(info): - version = '%s.%s.%s' % (info.major, info.minor, info.micro) + version = "%s.%s.%s" % (info.major, info.minor, info.micro) kind = info.releaselevel - if kind != 'final': + if kind != "final": version += kind[0] + str(info.serial) return version - if hasattr(sys, 'implementation'): + if hasattr(sys, "implementation"): implementation_version = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: - implementation_version = '0' - implementation_name = '' + implementation_version = "0" + implementation_name = "" result = { - 'implementation_name': implementation_name, - 'implementation_version': implementation_version, - 'os_name': os.name, - 'platform_machine': platform.machine(), - 'platform_python_implementation': platform.python_implementation(), - 'platform_release': platform.release(), - 'platform_system': platform.system(), - 'platform_version': platform.version(), - 'platform_in_venv': str(in_venv()), - 'python_full_version': platform.python_version(), - 'python_version': platform.python_version()[:3], - 'sys_platform': sys.platform, + "implementation_name": implementation_name, + "implementation_version": implementation_version, + "os_name": os.name, + "platform_machine": platform.machine(), + "platform_python_implementation": platform.python_implementation(), + "platform_release": platform.release(), + "platform_system": platform.system(), + "platform_version": platform.version(), + "platform_in_venv": str(in_venv()), + "python_full_version": platform.python_version(), + "python_version": platform.python_version()[:3], + "sys_platform": sys.platform, } return result + DEFAULT_CONTEXT = default_context() del default_context evaluator = Evaluator() + def interpret(marker, execution_context=None): """ Interpret a marker and return a result depending on environment. @@ -122,9 +127,9 @@ def interpret(marker, execution_context=None): try: expr, rest = parse_marker(marker) except Exception as e: - raise SyntaxError('Unable to interpret marker syntax: %s: %s' % (marker, e)) - if rest and rest[0] != '#': - raise SyntaxError('unexpected trailing data in marker: %s: %s' % (marker, rest)) + raise SyntaxError("Unable to interpret marker syntax: %s: %s" % (marker, e)) + if rest and rest[0] != "#": + raise SyntaxError("unexpected trailing data in marker: %s: %s" % (marker, rest)) context = dict(DEFAULT_CONTEXT) if execution_context: context.update(execution_context) diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/metadata.py b/src/fetchcode/vcs/pip/_vendor/distlib/metadata.py index 1061c32d..3d80b8e4 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/metadata.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/metadata.py @@ -39,64 +39,135 @@ class MetadataUnrecognizedVersionError(DistlibException): class MetadataInvalidError(DistlibException): """A metadata value is invalid""" + # public API of this module -__all__ = ['Metadata', 'PKG_INFO_ENCODING', 'PKG_INFO_PREFERRED_VERSION'] +__all__ = ["Metadata", "PKG_INFO_ENCODING", "PKG_INFO_PREFERRED_VERSION"] # Encoding used for the PKG-INFO files -PKG_INFO_ENCODING = 'utf-8' +PKG_INFO_ENCODING = "utf-8" # preferred version. Hopefully will be changed # to 1.2 once PEP 345 is supported everywhere -PKG_INFO_PREFERRED_VERSION = '1.1' - -_LINE_PREFIX_1_2 = re.compile('\n \\|') -_LINE_PREFIX_PRE_1_2 = re.compile('\n ') -_241_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', - 'Summary', 'Description', - 'Keywords', 'Home-page', 'Author', 'Author-email', - 'License') - -_314_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', - 'Supported-Platform', 'Summary', 'Description', - 'Keywords', 'Home-page', 'Author', 'Author-email', - 'License', 'Classifier', 'Download-URL', 'Obsoletes', - 'Provides', 'Requires') - -_314_MARKERS = ('Obsoletes', 'Provides', 'Requires', 'Classifier', - 'Download-URL') - -_345_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', - 'Supported-Platform', 'Summary', 'Description', - 'Keywords', 'Home-page', 'Author', 'Author-email', - 'Maintainer', 'Maintainer-email', 'License', - 'Classifier', 'Download-URL', 'Obsoletes-Dist', - 'Project-URL', 'Provides-Dist', 'Requires-Dist', - 'Requires-Python', 'Requires-External') - -_345_MARKERS = ('Provides-Dist', 'Requires-Dist', 'Requires-Python', - 'Obsoletes-Dist', 'Requires-External', 'Maintainer', - 'Maintainer-email', 'Project-URL') - -_426_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform', - 'Supported-Platform', 'Summary', 'Description', - 'Keywords', 'Home-page', 'Author', 'Author-email', - 'Maintainer', 'Maintainer-email', 'License', - 'Classifier', 'Download-URL', 'Obsoletes-Dist', - 'Project-URL', 'Provides-Dist', 'Requires-Dist', - 'Requires-Python', 'Requires-External', 'Private-Version', - 'Obsoleted-By', 'Setup-Requires-Dist', 'Extension', - 'Provides-Extra') - -_426_MARKERS = ('Private-Version', 'Provides-Extra', 'Obsoleted-By', - 'Setup-Requires-Dist', 'Extension') +PKG_INFO_PREFERRED_VERSION = "1.1" + +_LINE_PREFIX_1_2 = re.compile("\n \\|") +_LINE_PREFIX_PRE_1_2 = re.compile("\n ") +_241_FIELDS = ( + "Metadata-Version", + "Name", + "Version", + "Platform", + "Summary", + "Description", + "Keywords", + "Home-page", + "Author", + "Author-email", + "License", +) + +_314_FIELDS = ( + "Metadata-Version", + "Name", + "Version", + "Platform", + "Supported-Platform", + "Summary", + "Description", + "Keywords", + "Home-page", + "Author", + "Author-email", + "License", + "Classifier", + "Download-URL", + "Obsoletes", + "Provides", + "Requires", +) + +_314_MARKERS = ("Obsoletes", "Provides", "Requires", "Classifier", "Download-URL") + +_345_FIELDS = ( + "Metadata-Version", + "Name", + "Version", + "Platform", + "Supported-Platform", + "Summary", + "Description", + "Keywords", + "Home-page", + "Author", + "Author-email", + "Maintainer", + "Maintainer-email", + "License", + "Classifier", + "Download-URL", + "Obsoletes-Dist", + "Project-URL", + "Provides-Dist", + "Requires-Dist", + "Requires-Python", + "Requires-External", +) + +_345_MARKERS = ( + "Provides-Dist", + "Requires-Dist", + "Requires-Python", + "Obsoletes-Dist", + "Requires-External", + "Maintainer", + "Maintainer-email", + "Project-URL", +) + +_426_FIELDS = ( + "Metadata-Version", + "Name", + "Version", + "Platform", + "Supported-Platform", + "Summary", + "Description", + "Keywords", + "Home-page", + "Author", + "Author-email", + "Maintainer", + "Maintainer-email", + "License", + "Classifier", + "Download-URL", + "Obsoletes-Dist", + "Project-URL", + "Provides-Dist", + "Requires-Dist", + "Requires-Python", + "Requires-External", + "Private-Version", + "Obsoleted-By", + "Setup-Requires-Dist", + "Extension", + "Provides-Extra", +) + +_426_MARKERS = ( + "Private-Version", + "Provides-Extra", + "Obsoleted-By", + "Setup-Requires-Dist", + "Extension", +) # See issue #106: Sometimes 'Requires' and 'Provides' occur wrongly in # the metadata. Include them in the tuple literal below to allow them # (for now). -_566_FIELDS = _426_FIELDS + ('Description-Content-Type', - 'Requires', 'Provides') +_566_FIELDS = _426_FIELDS + ("Description-Content-Type", "Requires", "Provides") -_566_MARKERS = ('Description-Content-Type',) +_566_MARKERS = ("Description-Content-Type",) _ALL_FIELDS = set() _ALL_FIELDS.update(_241_FIELDS) @@ -105,25 +176,26 @@ class MetadataInvalidError(DistlibException): _ALL_FIELDS.update(_426_FIELDS) _ALL_FIELDS.update(_566_FIELDS) -EXTRA_RE = re.compile(r'''extra\s*==\s*("([^"]+)"|'([^']+)')''') +EXTRA_RE = re.compile(r"""extra\s*==\s*("([^"]+)"|'([^']+)')""") def _version2fieldlist(version): - if version == '1.0': + if version == "1.0": return _241_FIELDS - elif version == '1.1': + elif version == "1.1": return _314_FIELDS - elif version == '1.2': + elif version == "1.2": return _345_FIELDS - elif version in ('1.3', '2.1'): + elif version in ("1.3", "2.1"): return _345_FIELDS + _566_FIELDS - elif version == '2.0': + elif version == "2.0": return _426_FIELDS raise MetadataUnrecognizedVersionError(version) def _best_version(fields): """Detect the best version depending on the fields used.""" + def _has_marker(keys, markers): for marker in markers: if marker in keys: @@ -132,48 +204,48 @@ def _has_marker(keys, markers): keys = [] for key, value in fields.items(): - if value in ([], 'UNKNOWN', None): + if value in ([], "UNKNOWN", None): continue keys.append(key) - possible_versions = ['1.0', '1.1', '1.2', '1.3', '2.0', '2.1'] + possible_versions = ["1.0", "1.1", "1.2", "1.3", "2.0", "2.1"] # first let's try to see if a field is not part of one of the version for key in keys: - if key not in _241_FIELDS and '1.0' in possible_versions: - possible_versions.remove('1.0') - logger.debug('Removed 1.0 due to %s', key) - if key not in _314_FIELDS and '1.1' in possible_versions: - possible_versions.remove('1.1') - logger.debug('Removed 1.1 due to %s', key) - if key not in _345_FIELDS and '1.2' in possible_versions: - possible_versions.remove('1.2') - logger.debug('Removed 1.2 due to %s', key) - if key not in _566_FIELDS and '1.3' in possible_versions: - possible_versions.remove('1.3') - logger.debug('Removed 1.3 due to %s', key) - if key not in _566_FIELDS and '2.1' in possible_versions: - if key != 'Description': # In 2.1, description allowed after headers - possible_versions.remove('2.1') - logger.debug('Removed 2.1 due to %s', key) - if key not in _426_FIELDS and '2.0' in possible_versions: - possible_versions.remove('2.0') - logger.debug('Removed 2.0 due to %s', key) + if key not in _241_FIELDS and "1.0" in possible_versions: + possible_versions.remove("1.0") + logger.debug("Removed 1.0 due to %s", key) + if key not in _314_FIELDS and "1.1" in possible_versions: + possible_versions.remove("1.1") + logger.debug("Removed 1.1 due to %s", key) + if key not in _345_FIELDS and "1.2" in possible_versions: + possible_versions.remove("1.2") + logger.debug("Removed 1.2 due to %s", key) + if key not in _566_FIELDS and "1.3" in possible_versions: + possible_versions.remove("1.3") + logger.debug("Removed 1.3 due to %s", key) + if key not in _566_FIELDS and "2.1" in possible_versions: + if key != "Description": # In 2.1, description allowed after headers + possible_versions.remove("2.1") + logger.debug("Removed 2.1 due to %s", key) + if key not in _426_FIELDS and "2.0" in possible_versions: + possible_versions.remove("2.0") + logger.debug("Removed 2.0 due to %s", key) # possible_version contains qualified versions if len(possible_versions) == 1: - return possible_versions[0] # found ! + return possible_versions[0] # found ! elif len(possible_versions) == 0: - logger.debug('Out of options - unknown metadata set: %s', fields) - raise MetadataConflictError('Unknown metadata set') + logger.debug("Out of options - unknown metadata set: %s", fields) + raise MetadataConflictError("Unknown metadata set") # let's see if one unique marker is found - is_1_1 = '1.1' in possible_versions and _has_marker(keys, _314_MARKERS) - is_1_2 = '1.2' in possible_versions and _has_marker(keys, _345_MARKERS) - is_2_1 = '2.1' in possible_versions and _has_marker(keys, _566_MARKERS) - is_2_0 = '2.0' in possible_versions and _has_marker(keys, _426_MARKERS) + is_1_1 = "1.1" in possible_versions and _has_marker(keys, _314_MARKERS) + is_1_2 = "1.2" in possible_versions and _has_marker(keys, _345_MARKERS) + is_2_1 = "2.1" in possible_versions and _has_marker(keys, _566_MARKERS) + is_2_0 = "2.0" in possible_versions and _has_marker(keys, _426_MARKERS) if int(is_1_1) + int(is_1_2) + int(is_2_1) + int(is_2_0) > 1: - raise MetadataConflictError('You used incompatible 1.1/1.2/2.0/2.1 fields') + raise MetadataConflictError("You used incompatible 1.1/1.2/2.0/2.1 fields") # we have the choice, 1.0, or 1.2, or 2.0 # - 1.0 has a broken Summary field but works with all tools @@ -185,64 +257,76 @@ def _has_marker(keys, markers): if PKG_INFO_PREFERRED_VERSION in possible_versions: return PKG_INFO_PREFERRED_VERSION if is_1_1: - return '1.1' + return "1.1" if is_1_2: - return '1.2' + return "1.2" if is_2_1: - return '2.1' + return "2.1" + + return "2.0" - return '2.0' _ATTR2FIELD = { - 'metadata_version': 'Metadata-Version', - 'name': 'Name', - 'version': 'Version', - 'platform': 'Platform', - 'supported_platform': 'Supported-Platform', - 'summary': 'Summary', - 'description': 'Description', - 'keywords': 'Keywords', - 'home_page': 'Home-page', - 'author': 'Author', - 'author_email': 'Author-email', - 'maintainer': 'Maintainer', - 'maintainer_email': 'Maintainer-email', - 'license': 'License', - 'classifier': 'Classifier', - 'download_url': 'Download-URL', - 'obsoletes_dist': 'Obsoletes-Dist', - 'provides_dist': 'Provides-Dist', - 'requires_dist': 'Requires-Dist', - 'setup_requires_dist': 'Setup-Requires-Dist', - 'requires_python': 'Requires-Python', - 'requires_external': 'Requires-External', - 'requires': 'Requires', - 'provides': 'Provides', - 'obsoletes': 'Obsoletes', - 'project_url': 'Project-URL', - 'private_version': 'Private-Version', - 'obsoleted_by': 'Obsoleted-By', - 'extension': 'Extension', - 'provides_extra': 'Provides-Extra', + "metadata_version": "Metadata-Version", + "name": "Name", + "version": "Version", + "platform": "Platform", + "supported_platform": "Supported-Platform", + "summary": "Summary", + "description": "Description", + "keywords": "Keywords", + "home_page": "Home-page", + "author": "Author", + "author_email": "Author-email", + "maintainer": "Maintainer", + "maintainer_email": "Maintainer-email", + "license": "License", + "classifier": "Classifier", + "download_url": "Download-URL", + "obsoletes_dist": "Obsoletes-Dist", + "provides_dist": "Provides-Dist", + "requires_dist": "Requires-Dist", + "setup_requires_dist": "Setup-Requires-Dist", + "requires_python": "Requires-Python", + "requires_external": "Requires-External", + "requires": "Requires", + "provides": "Provides", + "obsoletes": "Obsoletes", + "project_url": "Project-URL", + "private_version": "Private-Version", + "obsoleted_by": "Obsoleted-By", + "extension": "Extension", + "provides_extra": "Provides-Extra", } -_PREDICATE_FIELDS = ('Requires-Dist', 'Obsoletes-Dist', 'Provides-Dist') -_VERSIONS_FIELDS = ('Requires-Python',) -_VERSION_FIELDS = ('Version',) -_LISTFIELDS = ('Platform', 'Classifier', 'Obsoletes', - 'Requires', 'Provides', 'Obsoletes-Dist', - 'Provides-Dist', 'Requires-Dist', 'Requires-External', - 'Project-URL', 'Supported-Platform', 'Setup-Requires-Dist', - 'Provides-Extra', 'Extension') -_LISTTUPLEFIELDS = ('Project-URL',) - -_ELEMENTSFIELD = ('Keywords',) - -_UNICODEFIELDS = ('Author', 'Maintainer', 'Summary', 'Description') +_PREDICATE_FIELDS = ("Requires-Dist", "Obsoletes-Dist", "Provides-Dist") +_VERSIONS_FIELDS = ("Requires-Python",) +_VERSION_FIELDS = ("Version",) +_LISTFIELDS = ( + "Platform", + "Classifier", + "Obsoletes", + "Requires", + "Provides", + "Obsoletes-Dist", + "Provides-Dist", + "Requires-Dist", + "Requires-External", + "Project-URL", + "Supported-Platform", + "Setup-Requires-Dist", + "Provides-Extra", + "Extension", +) +_LISTTUPLEFIELDS = ("Project-URL",) + +_ELEMENTSFIELD = ("Keywords",) + +_UNICODEFIELDS = ("Author", "Maintainer", "Summary", "Description") _MISSING = object() -_FILESAFE = re.compile('[^A-Za-z0-9.]+') +_FILESAFE = re.compile("[^A-Za-z0-9.]+") def _get_name_and_version(name, version, for_filename=False): @@ -253,9 +337,9 @@ def _get_name_and_version(name, version, for_filename=False): # For both name and version any runs of non-alphanumeric or '.' # characters are replaced with a single '-'. Additionally any # spaces in the version string become '.' - name = _FILESAFE.sub('-', name) - version = _FILESAFE.sub('-', version.replace(' ', '.')) - return '%s-%s' % (name, version) + name = _FILESAFE.sub("-", name) + version = _FILESAFE.sub("-", version.replace(" ", ".")) + return "%s-%s" % (name, version) class LegacyMetadata(object): @@ -268,12 +352,12 @@ class LegacyMetadata(object): - *mapping* is a dict-like object - *scheme* is a version scheme name """ + # TODO document the mapping API and UNKNOWN default key - def __init__(self, path=None, fileobj=None, mapping=None, - scheme='default'): + def __init__(self, path=None, fileobj=None, mapping=None, scheme="default"): if [path, fileobj, mapping].count(None) < 2: - raise TypeError('path, fileobj and mapping are exclusive') + raise TypeError("path, fileobj and mapping are exclusive") self._fields = {} self.requires_files = [] self._dependencies = None @@ -287,10 +371,10 @@ def __init__(self, path=None, fileobj=None, mapping=None, self.set_metadata_version() def set_metadata_version(self): - self._fields['Metadata-Version'] = _best_version(self._fields) + self._fields["Metadata-Version"] = _best_version(self._fields) def _write_field(self, fileobj, name, value): - fileobj.write('%s: %s\n' % (name, value)) + fileobj.write("%s: %s\n" % (name, value)) def __getitem__(self, name): return self.get(name) @@ -306,25 +390,24 @@ def __delitem__(self, name): raise KeyError(name) def __contains__(self, name): - return (name in self._fields or - self._convert_name(name) in self._fields) + return name in self._fields or self._convert_name(name) in self._fields def _convert_name(self, name): if name in _ALL_FIELDS: return name - name = name.replace('-', '_').lower() + name = name.replace("-", "_").lower() return _ATTR2FIELD.get(name, name) def _default_value(self, name): if name in _LISTFIELDS or name in _ELEMENTSFIELD: return [] - return 'UNKNOWN' + return "UNKNOWN" def _remove_line_prefix(self, value): - if self.metadata_version in ('1.0', '1.1'): - return _LINE_PREFIX_PRE_1_2.sub('\n', value) + if self.metadata_version in ("1.0", "1.1"): + return _LINE_PREFIX_PRE_1_2.sub("\n", value) else: - return _LINE_PREFIX_1_2.sub('\n', value) + return _LINE_PREFIX_1_2.sub("\n", value) def __getattr__(self, name): if name in _ATTR2FIELD: @@ -335,13 +418,13 @@ def __getattr__(self, name): # Public API # -# dependencies = property(_get_dependencies, _set_dependencies) + # dependencies = property(_get_dependencies, _set_dependencies) def get_fullname(self, filesafe=False): """Return the distribution name with version. If filesafe is true, return a filename-escaped form.""" - return _get_name_and_version(self['Name'], self['Version'], filesafe) + return _get_name_and_version(self["Name"], self["Version"], filesafe) def is_field(self, name): """return True if name is a valid metadata key""" @@ -354,7 +437,7 @@ def is_multi_field(self, name): def read(self, filepath): """Read the metadata values from a file path.""" - fp = codecs.open(filepath, 'r', encoding='utf-8') + fp = codecs.open(filepath, "r", encoding="utf-8") try: self.read_file(fp) finally: @@ -363,7 +446,7 @@ def read(self, filepath): def read_file(self, fileob): """Read the metadata values from a file object.""" msg = message_from_file(fileob) - self._fields['Metadata-Version'] = msg['metadata-version'] + self._fields["Metadata-Version"] = msg["metadata-version"] # When reading, get all the fields we can for field in _ALL_FIELDS: @@ -373,19 +456,19 @@ def read_file(self, fileob): # we can have multiple lines values = msg.get_all(field) if field in _LISTTUPLEFIELDS and values is not None: - values = [tuple(value.split(',')) for value in values] + values = [tuple(value.split(",")) for value in values] self.set(field, values) else: # single line value = msg[field] - if value is not None and value != 'UNKNOWN': + if value is not None and value != "UNKNOWN": self.set(field, value) # logger.debug('Attempting to set metadata for %s', self) # self.set_metadata_version() def write(self, filepath, skip_unknown=False): """Write the metadata fields to filepath.""" - fp = codecs.open(filepath, 'w', encoding='utf-8') + fp = codecs.open(filepath, "w", encoding="utf-8") try: self.write_file(fp, skip_unknown) finally: @@ -395,23 +478,23 @@ def write_file(self, fileobject, skip_unknown=False): """Write the PKG-INFO format data to a file object.""" self.set_metadata_version() - for field in _version2fieldlist(self['Metadata-Version']): + for field in _version2fieldlist(self["Metadata-Version"]): values = self.get(field) - if skip_unknown and values in ('UNKNOWN', [], ['UNKNOWN']): + if skip_unknown and values in ("UNKNOWN", [], ["UNKNOWN"]): continue if field in _ELEMENTSFIELD: - self._write_field(fileobject, field, ','.join(values)) + self._write_field(fileobject, field, ",".join(values)) continue if field not in _LISTFIELDS: - if field == 'Description': - if self.metadata_version in ('1.0', '1.1'): - values = values.replace('\n', '\n ') + if field == "Description": + if self.metadata_version in ("1.0", "1.1"): + values = values.replace("\n", "\n ") else: - values = values.replace('\n', '\n |') + values = values.replace("\n", "\n |") values = [values] if field in _LISTTUPLEFIELDS: - values = [','.join(value) for value in values] + values = [",".join(value) for value in values] for value in values: self._write_field(fileobject, field, value) @@ -426,6 +509,7 @@ def update(self, other=None, **kwargs): Keys that don't match a metadata field or that have an empty value are dropped. """ + def _set(key, value): if key in _ATTR2FIELD and value: self.set(self._convert_name(key), value) @@ -433,7 +517,7 @@ def _set(key, value): if not other: # other is None or empty container pass - elif hasattr(other, 'keys'): + elif hasattr(other, "keys"): for k in other.keys(): _set(k, other[k]) else: @@ -448,42 +532,53 @@ def set(self, name, value): """Control then set a metadata field.""" name = self._convert_name(name) - if ((name in _ELEMENTSFIELD or name == 'Platform') and - not isinstance(value, (list, tuple))): + if (name in _ELEMENTSFIELD or name == "Platform") and not isinstance( + value, (list, tuple) + ): if isinstance(value, string_types): - value = [v.strip() for v in value.split(',')] + value = [v.strip() for v in value.split(",")] else: value = [] - elif (name in _LISTFIELDS and - not isinstance(value, (list, tuple))): + elif name in _LISTFIELDS and not isinstance(value, (list, tuple)): if isinstance(value, string_types): value = [value] else: value = [] if logger.isEnabledFor(logging.WARNING): - project_name = self['Name'] + project_name = self["Name"] scheme = get_scheme(self.scheme) if name in _PREDICATE_FIELDS and value is not None: for v in value: # check that the values are valid - if not scheme.is_valid_matcher(v.split(';')[0]): + if not scheme.is_valid_matcher(v.split(";")[0]): logger.warning( "'%s': '%s' is not valid (field '%s')", - project_name, v, name) + project_name, + v, + name, + ) # FIXME this rejects UNKNOWN, is that right? elif name in _VERSIONS_FIELDS and value is not None: if not scheme.is_valid_constraint_list(value): - logger.warning("'%s': '%s' is not a valid version (field '%s')", - project_name, value, name) + logger.warning( + "'%s': '%s' is not a valid version (field '%s')", + project_name, + value, + name, + ) elif name in _VERSION_FIELDS and value is not None: if not scheme.is_valid_version(value): - logger.warning("'%s': '%s' is not a valid version (field '%s')", - project_name, value, name) + logger.warning( + "'%s': '%s' is not a valid version (field '%s')", + project_name, + value, + name, + ) if name in _UNICODEFIELDS: - if name == 'Description': + if name == "Description": value = self._remove_line_prefix(value) self._fields[name] = value @@ -514,7 +609,7 @@ def get(self, name, default=_MISSING): elif name in _ELEMENTSFIELD: value = self._fields[name] if isinstance(value, string_types): - return value.split(',') + return value.split(",") return self._fields[name] def check(self, strict=False): @@ -525,35 +620,35 @@ def check(self, strict=False): # XXX should check the versions (if the file was loaded) missing, warnings = [], [] - for attr in ('Name', 'Version'): # required by PEP 345 + for attr in ("Name", "Version"): # required by PEP 345 if attr not in self: missing.append(attr) if strict and missing != []: - msg = 'missing required metadata: %s' % ', '.join(missing) + msg = "missing required metadata: %s" % ", ".join(missing) raise MetadataMissingError(msg) - for attr in ('Home-page', 'Author'): + for attr in ("Home-page", "Author"): if attr not in self: missing.append(attr) # checking metadata 1.2 (XXX needs to check 1.1, 1.0) - if self['Metadata-Version'] != '1.2': + if self["Metadata-Version"] != "1.2": return missing, warnings scheme = get_scheme(self.scheme) def are_valid_constraints(value): for v in value: - if not scheme.is_valid_matcher(v.split(';')[0]): + if not scheme.is_valid_matcher(v.split(";")[0]): return False return True - for fields, controller in ((_PREDICATE_FIELDS, are_valid_constraints), - (_VERSIONS_FIELDS, - scheme.is_valid_constraint_list), - (_VERSION_FIELDS, - scheme.is_valid_version)): + for fields, controller in ( + (_PREDICATE_FIELDS, are_valid_constraints), + (_VERSIONS_FIELDS, scheme.is_valid_constraint_list), + (_VERSION_FIELDS, scheme.is_valid_version), + ): for field in fields: value = self.get(field, None) if value is not None and not controller(value): @@ -570,19 +665,19 @@ def todict(self, skip_missing=False): self.set_metadata_version() mapping_1_0 = ( - ('metadata_version', 'Metadata-Version'), - ('name', 'Name'), - ('version', 'Version'), - ('summary', 'Summary'), - ('home_page', 'Home-page'), - ('author', 'Author'), - ('author_email', 'Author-email'), - ('license', 'License'), - ('description', 'Description'), - ('keywords', 'Keywords'), - ('platform', 'Platform'), - ('classifiers', 'Classifier'), - ('download_url', 'Download-URL'), + ("metadata_version", "Metadata-Version"), + ("name", "Name"), + ("version", "Version"), + ("summary", "Summary"), + ("home_page", "Home-page"), + ("author", "Author"), + ("author_email", "Author-email"), + ("license", "License"), + ("description", "Description"), + ("keywords", "Keywords"), + ("platform", "Platform"), + ("classifiers", "Classifier"), + ("download_url", "Download-URL"), ) data = {} @@ -590,29 +685,29 @@ def todict(self, skip_missing=False): if not skip_missing or field_name in self._fields: data[key] = self[field_name] - if self['Metadata-Version'] == '1.2': + if self["Metadata-Version"] == "1.2": mapping_1_2 = ( - ('requires_dist', 'Requires-Dist'), - ('requires_python', 'Requires-Python'), - ('requires_external', 'Requires-External'), - ('provides_dist', 'Provides-Dist'), - ('obsoletes_dist', 'Obsoletes-Dist'), - ('project_url', 'Project-URL'), - ('maintainer', 'Maintainer'), - ('maintainer_email', 'Maintainer-email'), + ("requires_dist", "Requires-Dist"), + ("requires_python", "Requires-Python"), + ("requires_external", "Requires-External"), + ("provides_dist", "Provides-Dist"), + ("obsoletes_dist", "Obsoletes-Dist"), + ("project_url", "Project-URL"), + ("maintainer", "Maintainer"), + ("maintainer_email", "Maintainer-email"), ) for key, field_name in mapping_1_2: if not skip_missing or field_name in self._fields: - if key != 'project_url': + if key != "project_url": data[key] = self[field_name] else: - data[key] = [','.join(u) for u in self[field_name]] + data[key] = [",".join(u) for u in self[field_name]] - elif self['Metadata-Version'] == '1.1': + elif self["Metadata-Version"] == "1.1": mapping_1_1 = ( - ('provides', 'Provides'), - ('requires', 'Requires'), - ('obsoletes', 'Obsoletes'), + ("provides", "Provides"), + ("requires", "Requires"), + ("obsoletes", "Obsoletes"), ) for key, field_name in mapping_1_1: if not skip_missing or field_name in self._fields: @@ -621,18 +716,18 @@ def todict(self, skip_missing=False): return data def add_requirements(self, requirements): - if self['Metadata-Version'] == '1.1': + if self["Metadata-Version"] == "1.1": # we can't have 1.1 metadata *and* Setuptools requires - for field in ('Obsoletes', 'Requires', 'Provides'): + for field in ("Obsoletes", "Requires", "Provides"): if field in self: del self[field] - self['Requires-Dist'] += requirements + self["Requires-Dist"] += requirements # Mapping API # TODO could add iter* variants def keys(self): - return list(_version2fieldlist(self['Metadata-Version'])) + return list(_version2fieldlist(self["Metadata-Version"])) def __iter__(self): for key in self.keys(): @@ -645,13 +740,12 @@ def items(self): return [(key, self[key]) for key in self.keys()] def __repr__(self): - return '<%s %s %s>' % (self.__class__.__name__, self.name, - self.version) + return "<%s %s %s>" % (self.__class__.__name__, self.name, self.version) -METADATA_FILENAME = 'pydist.json' -WHEEL_METADATA_FILENAME = 'metadata.json' -LEGACY_METADATA_FILENAME = 'METADATA' +METADATA_FILENAME = "pydist.json" +WHEEL_METADATA_FILENAME = "metadata.json" +LEGACY_METADATA_FILENAME = "METADATA" class Metadata(object): @@ -661,49 +755,52 @@ class Metadata(object): instance which handles the key-value metadata format. """ - METADATA_VERSION_MATCHER = re.compile(r'^\d+(\.\d+)*$') + METADATA_VERSION_MATCHER = re.compile(r"^\d+(\.\d+)*$") - NAME_MATCHER = re.compile('^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$', re.I) + NAME_MATCHER = re.compile("^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$", re.I) VERSION_MATCHER = PEP440_VERSION_RE - SUMMARY_MATCHER = re.compile('.{1,2047}') + SUMMARY_MATCHER = re.compile(".{1,2047}") - METADATA_VERSION = '2.0' + METADATA_VERSION = "2.0" - GENERATOR = 'distlib (%s)' % __version__ + GENERATOR = "distlib (%s)" % __version__ MANDATORY_KEYS = { - 'name': (), - 'version': (), - 'summary': ('legacy',), + "name": (), + "version": (), + "summary": ("legacy",), } - INDEX_KEYS = ('name version license summary description author ' - 'author_email keywords platform home_page classifiers ' - 'download_url') + INDEX_KEYS = ( + "name version license summary description author " + "author_email keywords platform home_page classifiers " + "download_url" + ) - DEPENDENCY_KEYS = ('extras run_requires test_requires build_requires ' - 'dev_requires provides meta_requires obsoleted_by ' - 'supports_environments') + DEPENDENCY_KEYS = ( + "extras run_requires test_requires build_requires " + "dev_requires provides meta_requires obsoleted_by " + "supports_environments" + ) SYNTAX_VALIDATORS = { - 'metadata_version': (METADATA_VERSION_MATCHER, ()), - 'name': (NAME_MATCHER, ('legacy',)), - 'version': (VERSION_MATCHER, ('legacy',)), - 'summary': (SUMMARY_MATCHER, ('legacy',)), + "metadata_version": (METADATA_VERSION_MATCHER, ()), + "name": (NAME_MATCHER, ("legacy",)), + "version": (VERSION_MATCHER, ("legacy",)), + "summary": (SUMMARY_MATCHER, ("legacy",)), } - __slots__ = ('_legacy', '_data', 'scheme') + __slots__ = ("_legacy", "_data", "scheme") - def __init__(self, path=None, fileobj=None, mapping=None, - scheme='default'): + def __init__(self, path=None, fileobj=None, mapping=None, scheme="default"): if [path, fileobj, mapping].count(None) < 2: - raise TypeError('path, fileobj and mapping are exclusive') + raise TypeError("path, fileobj and mapping are exclusive") self._legacy = None self._data = None self.scheme = scheme - #import pdb; pdb.set_trace() + # import pdb; pdb.set_trace() if mapping is not None: try: self._validate_mapping(mapping, scheme) @@ -714,19 +811,19 @@ def __init__(self, path=None, fileobj=None, mapping=None, else: data = None if path: - with open(path, 'rb') as f: + with open(path, "rb") as f: data = f.read() elif fileobj: data = fileobj.read() if data is None: # Initialised with no args - to be added self._data = { - 'metadata_version': self.METADATA_VERSION, - 'generator': self.GENERATOR, + "metadata_version": self.METADATA_VERSION, + "generator": self.GENERATOR, } else: if not isinstance(data, text_type): - data = data.decode('utf-8') + data = data.decode("utf-8") try: self._data = json.loads(data) self._validate_mapping(self._data, scheme) @@ -737,36 +834,35 @@ def __init__(self, path=None, fileobj=None, mapping=None, # The ValueError comes from the json.load - if that # succeeds and we get a validation error, we want # that to propagate - self._legacy = LegacyMetadata(fileobj=StringIO(data), - scheme=scheme) + self._legacy = LegacyMetadata(fileobj=StringIO(data), scheme=scheme) self.validate() - common_keys = set(('name', 'version', 'license', 'keywords', 'summary')) + common_keys = set(("name", "version", "license", "keywords", "summary")) none_list = (None, list) none_dict = (None, dict) mapped_keys = { - 'run_requires': ('Requires-Dist', list), - 'build_requires': ('Setup-Requires-Dist', list), - 'dev_requires': none_list, - 'test_requires': none_list, - 'meta_requires': none_list, - 'extras': ('Provides-Extra', list), - 'modules': none_list, - 'namespaces': none_list, - 'exports': none_dict, - 'commands': none_dict, - 'classifiers': ('Classifier', list), - 'source_url': ('Download-URL', None), - 'metadata_version': ('Metadata-Version', None), + "run_requires": ("Requires-Dist", list), + "build_requires": ("Setup-Requires-Dist", list), + "dev_requires": none_list, + "test_requires": none_list, + "meta_requires": none_list, + "extras": ("Provides-Extra", list), + "modules": none_list, + "namespaces": none_list, + "exports": none_dict, + "commands": none_dict, + "classifiers": ("Classifier", list), + "source_url": ("Download-URL", None), + "metadata_version": ("Metadata-Version", None), } del none_list, none_dict def __getattribute__(self, key): - common = object.__getattribute__(self, 'common_keys') - mapped = object.__getattribute__(self, 'mapped_keys') + common = object.__getattribute__(self, "common_keys") + mapped = object.__getattribute__(self, "mapped_keys") if key in mapped: lk, maker = mapped[key] if self._legacy: @@ -776,25 +872,30 @@ def __getattribute__(self, key): result = self._legacy.get(lk) else: value = None if maker is None else maker() - if key not in ('commands', 'exports', 'modules', 'namespaces', - 'classifiers'): + if key not in ( + "commands", + "exports", + "modules", + "namespaces", + "classifiers", + ): result = self._data.get(key, value) else: # special cases for PEP 459 sentinel = object() result = sentinel - d = self._data.get('extensions') + d = self._data.get("extensions") if d: - if key == 'commands': - result = d.get('python.commands', value) - elif key == 'classifiers': - d = d.get('python.details') + if key == "commands": + result = d.get("python.commands", value) + elif key == "classifiers": + d = d.get("python.details") if d: result = d.get(key, value) else: - d = d.get('python.exports') + d = d.get("python.exports") if not d: - d = self._data.get('python.exports') + d = self._data.get("python.exports") if d: result = d.get(key, value) if result is sentinel: @@ -813,38 +914,44 @@ def _validate_value(self, key, value, scheme=None): if (scheme or self.scheme) not in exclusions: m = pattern.match(value) if not m: - raise MetadataInvalidError("'%s' is an invalid value for " - "the '%s' property" % (value, - key)) + raise MetadataInvalidError( + "'%s' is an invalid value for " + "the '%s' property" % (value, key) + ) def __setattr__(self, key, value): self._validate_value(key, value) - common = object.__getattribute__(self, 'common_keys') - mapped = object.__getattribute__(self, 'mapped_keys') + common = object.__getattribute__(self, "common_keys") + mapped = object.__getattribute__(self, "mapped_keys") if key in mapped: lk, _ = mapped[key] if self._legacy: if lk is None: raise NotImplementedError self._legacy[lk] = value - elif key not in ('commands', 'exports', 'modules', 'namespaces', - 'classifiers'): + elif key not in ( + "commands", + "exports", + "modules", + "namespaces", + "classifiers", + ): self._data[key] = value else: # special cases for PEP 459 - d = self._data.setdefault('extensions', {}) - if key == 'commands': - d['python.commands'] = value - elif key == 'classifiers': - d = d.setdefault('python.details', {}) + d = self._data.setdefault("extensions", {}) + if key == "commands": + d["python.commands"] = value + elif key == "classifiers": + d = d.setdefault("python.details", {}) d[key] = value else: - d = d.setdefault('python.exports', {}) + d = d.setdefault("python.exports", {}) d[key] = value elif key not in common: object.__setattr__(self, key, value) else: - if key == 'keywords': + if key == "keywords": if isinstance(value, string_types): value = value.strip() if value: @@ -863,10 +970,10 @@ def name_and_version(self): @property def provides(self): if self._legacy: - result = self._legacy['Provides-Dist'] + result = self._legacy["Provides-Dist"] else: - result = self._data.setdefault('provides', []) - s = '%s (%s)' % (self.name, self.version) + result = self._data.setdefault("provides", []) + s = "%s (%s)" % (self.name, self.version) if s not in result: result.append(s) return result @@ -874,9 +981,9 @@ def provides(self): @provides.setter def provides(self, value): if self._legacy: - self._legacy['Provides-Dist'] = value + self._legacy["Provides-Dist"] = value else: - self._data['provides'] = value + self._data["provides"] = value def get_requirements(self, reqts, extras=None, env=None): """ @@ -893,31 +1000,30 @@ def get_requirements(self, reqts, extras=None, env=None): result = [] extras = get_extras(extras or [], self.extras) for d in reqts: - if 'extra' not in d and 'environment' not in d: + if "extra" not in d and "environment" not in d: # unconditional include = True else: - if 'extra' not in d: + if "extra" not in d: # Not extra-dependent - only environment-dependent include = True else: - include = d.get('extra') in extras + include = d.get("extra") in extras if include: # Not excluded because of extras, check environment - marker = d.get('environment') + marker = d.get("environment") if marker: include = interpret(marker, env) if include: - result.extend(d['requires']) - for key in ('build', 'dev', 'test'): - e = ':%s:' % key + result.extend(d["requires"]) + for key in ("build", "dev", "test"): + e = ":%s:" % key if e in extras: extras.remove(e) # A recursive call, but it should terminate since 'test' # has been removed from the extras - reqts = self._data.get('%s_requires' % key, []) - result.extend(self.get_requirements(reqts, extras=extras, - env=env)) + reqts = self._data.get("%s_requires" % key, []) + result.extend(self.get_requirements(reqts, extras=extras, env=env)) return result @property @@ -941,7 +1047,7 @@ def dependencies(self, value): self._data.update(value) def _validate_mapping(self, mapping, scheme): - if mapping.get('metadata_version') != self.METADATA_VERSION: + if mapping.get("metadata_version") != self.METADATA_VERSION: raise MetadataUnrecognizedVersionError() missing = [] for key, exclusions in self.MANDATORY_KEYS.items(): @@ -949,7 +1055,7 @@ def _validate_mapping(self, mapping, scheme): if scheme not in exclusions: missing.append(key) if missing: - msg = 'Missing metadata items: %s' % ', '.join(missing) + msg = "Missing metadata items: %s" % ", ".join(missing) raise MetadataMissingError(msg) for k, v in mapping.items(): self._validate_value(k, v, scheme) @@ -958,8 +1064,7 @@ def validate(self): if self._legacy: missing, warnings = self._legacy.check(True) if missing or warnings: - logger.warning('Metadata: missing: %s, warnings: %s', - missing, warnings) + logger.warning("Metadata: missing: %s, warnings: %s", missing, warnings) else: self._validate_mapping(self._data, self.scheme) @@ -973,61 +1078,62 @@ def todict(self): def _from_legacy(self): assert self._legacy and not self._data result = { - 'metadata_version': self.METADATA_VERSION, - 'generator': self.GENERATOR, + "metadata_version": self.METADATA_VERSION, + "generator": self.GENERATOR, } - lmd = self._legacy.todict(True) # skip missing ones - for k in ('name', 'version', 'license', 'summary', 'description', - 'classifier'): + lmd = self._legacy.todict(True) # skip missing ones + for k in ("name", "version", "license", "summary", "description", "classifier"): if k in lmd: - if k == 'classifier': - nk = 'classifiers' + if k == "classifier": + nk = "classifiers" else: nk = k result[nk] = lmd[k] - kw = lmd.get('Keywords', []) - if kw == ['']: + kw = lmd.get("Keywords", []) + if kw == [""]: kw = [] - result['keywords'] = kw - keys = (('requires_dist', 'run_requires'), - ('setup_requires_dist', 'build_requires')) + result["keywords"] = kw + keys = ( + ("requires_dist", "run_requires"), + ("setup_requires_dist", "build_requires"), + ) for ok, nk in keys: if ok in lmd and lmd[ok]: - result[nk] = [{'requires': lmd[ok]}] - result['provides'] = self.provides + result[nk] = [{"requires": lmd[ok]}] + result["provides"] = self.provides author = {} maintainer = {} return result LEGACY_MAPPING = { - 'name': 'Name', - 'version': 'Version', - 'license': 'License', - 'summary': 'Summary', - 'description': 'Description', - 'classifiers': 'Classifier', + "name": "Name", + "version": "Version", + "license": "License", + "summary": "Summary", + "description": "Description", + "classifiers": "Classifier", } def _to_legacy(self): def process_entries(entries): reqts = set() for e in entries: - extra = e.get('extra') - env = e.get('environment') - rlist = e['requires'] + extra = e.get("extra") + env = e.get("environment") + rlist = e["requires"] for r in rlist: if not env and not extra: reqts.add(r) else: - marker = '' + marker = "" if extra: marker = 'extra == "%s"' % extra if env: if marker: - marker = '(%s) and %s' % (env, marker) + marker = "(%s) and %s" % (env, marker) else: marker = env - reqts.add(';'.join((r, marker))) + reqts.add(";".join((r, marker))) return reqts assert self._data and not self._legacy @@ -1039,15 +1145,15 @@ def process_entries(entries): r1 = process_entries(self.run_requires + self.meta_requires) r2 = process_entries(self.build_requires + self.dev_requires) if self.extras: - result['Provides-Extra'] = sorted(self.extras) - result['Requires-Dist'] = sorted(r1) - result['Setup-Requires-Dist'] = sorted(r2) + result["Provides-Extra"] = sorted(self.extras) + result["Requires-Dist"] = sorted(r1) + result["Setup-Requires-Dist"] = sorted(r2) # TODO: other fields such as contacts return result def write(self, path=None, fileobj=None, legacy=False, skip_unknown=True): if [path, fileobj].count(None) != 1: - raise ValueError('Exactly one of path and fileobj is needed') + raise ValueError("Exactly one of path and fileobj is needed") self.validate() if legacy: if self._legacy: @@ -1064,32 +1170,34 @@ def write(self, path=None, fileobj=None, legacy=False, skip_unknown=True): else: d = self._data if fileobj: - json.dump(d, fileobj, ensure_ascii=True, indent=2, - sort_keys=True) + json.dump(d, fileobj, ensure_ascii=True, indent=2, sort_keys=True) else: - with codecs.open(path, 'w', 'utf-8') as f: - json.dump(d, f, ensure_ascii=True, indent=2, - sort_keys=True) + with codecs.open(path, "w", "utf-8") as f: + json.dump(d, f, ensure_ascii=True, indent=2, sort_keys=True) def add_requirements(self, requirements): if self._legacy: self._legacy.add_requirements(requirements) else: - run_requires = self._data.setdefault('run_requires', []) + run_requires = self._data.setdefault("run_requires", []) always = None for entry in run_requires: - if 'environment' not in entry and 'extra' not in entry: + if "environment" not in entry and "extra" not in entry: always = entry break if always is None: - always = { 'requires': requirements } + always = {"requires": requirements} run_requires.insert(0, always) else: - rset = set(always['requires']) | set(requirements) - always['requires'] = sorted(rset) + rset = set(always["requires"]) | set(requirements) + always["requires"] = sorted(rset) def __repr__(self): - name = self.name or '(no name)' - version = self.version or 'no version' - return '<%s %s %s (%s)>' % (self.__class__.__name__, - self.metadata_version, name, version) + name = self.name or "(no name)" + version = self.version or "no version" + return "<%s %s %s (%s)>" % ( + self.__class__.__name__, + self.metadata_version, + name, + version, + ) diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/resources.py b/src/fetchcode/vcs/pip/_vendor/distlib/resources.py index 5ced830a..e22d4653 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/resources.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/resources.py @@ -21,14 +21,14 @@ logger = logging.getLogger(__name__) -cache = None # created when needed +cache = None # created when needed class ResourceCache(Cache): def __init__(self, base=None): if base is None: # Use native string to avoid issues on 2.x: see Python #20140. - base = os.path.join(get_cache_base(), str('resource-cache')) + base = os.path.join(get_cache_base(), str("resource-cache")) super(ResourceCache, self).__init__(base) def is_stale(self, resource, path): @@ -63,7 +63,7 @@ def get(self, resource): stale = self.is_stale(resource, path) if stale: # write the bytes of the resource to the cache location - with open(result, 'wb') as f: + with open(result, "wb") as f: f.write(resource.bytes) return result @@ -80,7 +80,8 @@ class Resource(ResourceBase): not normally instantiated by user code, but rather by a :class:`ResourceFinder` which manages the resource. """ - is_container = False # Backwards compatibility + + is_container = False # Backwards compatibility def as_stream(self): """ @@ -108,7 +109,7 @@ def size(self): class ResourceContainer(ResourceBase): - is_container = True # Backwards compatibility + is_container = True # Backwards compatibility @cached_property def resources(self): @@ -120,15 +121,15 @@ class ResourceFinder(object): Resource finder for file system resources. """ - if sys.platform.startswith('java'): - skipped_extensions = ('.pyc', '.pyo', '.class') + if sys.platform.startswith("java"): + skipped_extensions = (".pyc", ".pyo", ".class") else: - skipped_extensions = ('.pyc', '.pyo') + skipped_extensions = (".pyc", ".pyo") def __init__(self, module): self.module = module - self.loader = getattr(module, '__loader__', None) - self.base = os.path.dirname(getattr(module, '__file__', '')) + self.loader = getattr(module, "__loader__", None) + self.base = os.path.dirname(getattr(module, "__file__", "")) def _adjust_path(self, path): return os.path.realpath(path) @@ -136,10 +137,10 @@ def _adjust_path(self, path): def _make_path(self, resource_name): # Issue #50: need to preserve type of path on Python 2.x # like os.path._get_sep - if isinstance(resource_name, bytes): # should only happen on 2.x - sep = b'/' + if isinstance(resource_name, bytes): # should only happen on 2.x + sep = b"/" else: - sep = '/' + sep = "/" parts = resource_name.split(sep) parts.insert(0, self.base) result = os.path.join(*parts) @@ -164,10 +165,10 @@ def find(self, resource_name): return result def get_stream(self, resource): - return open(resource.path, 'rb') + return open(resource.path, "rb") def get_bytes(self, resource): - with open(resource.path, 'rb') as f: + with open(resource.path, "rb") as f: return f.read() def get_size(self, resource): @@ -175,8 +176,8 @@ def get_size(self, resource): def get_resources(self, resource): def allowed(f): - return (f != '__pycache__' and not - f.endswith(self.skipped_extensions)) + return f != "__pycache__" and not f.endswith(self.skipped_extensions) + return set([f for f in os.listdir(resource.path) if allowed(f)]) def is_container(self, resource): @@ -197,7 +198,7 @@ def iterator(self, resource_name): if not rname: new_name = name else: - new_name = '/'.join([rname, name]) + new_name = "/".join([rname, name]) child = self.find(new_name) if child.is_container: todo.append(child) @@ -209,12 +210,13 @@ class ZipResourceFinder(ResourceFinder): """ Resource finder for resources in .zip files. """ + def __init__(self, module): super(ZipResourceFinder, self).__init__(module) archive = self.loader.archive self.prefix_len = 1 + len(archive) # PyPy doesn't have a _files attr on zipimporter, and you can't set one - if hasattr(self.loader, '_files'): + if hasattr(self.loader, "_files"): self._files = self.loader._files else: self._files = zipimport._zip_directory_cache[archive] @@ -224,7 +226,7 @@ def _adjust_path(self, path): return path def _find(self, path): - path = path[self.prefix_len:] + path = path[self.prefix_len :] if path in self._files: result = True else: @@ -236,14 +238,14 @@ def _find(self, path): except IndexError: result = False if not result: - logger.debug('_find failed: %r %r', path, self.loader.prefix) + logger.debug("_find failed: %r %r", path, self.loader.prefix) else: - logger.debug('_find worked: %r %r', path, self.loader.prefix) + logger.debug("_find worked: %r %r", path, self.loader.prefix) return result def get_cache_info(self, resource): prefix = self.loader.archive - path = resource.path[1 + len(prefix):] + path = resource.path[1 + len(prefix) :] return prefix, path def get_bytes(self, resource): @@ -253,11 +255,11 @@ def get_stream(self, resource): return io.BytesIO(self.get_bytes(resource)) def get_size(self, resource): - path = resource.path[self.prefix_len:] + path = resource.path[self.prefix_len :] return self._files[path][3] def get_resources(self, resource): - path = resource.path[self.prefix_len:] + path = resource.path[self.prefix_len :] if path and path[-1] != os.sep: path += os.sep plen = len(path) @@ -267,12 +269,12 @@ def get_resources(self, resource): if not self.index[i].startswith(path): break s = self.index[i][plen:] - result.add(s.split(os.sep, 1)[0]) # only immediate children + result.add(s.split(os.sep, 1)[0]) # only immediate children i += 1 return result def _is_directory(self, path): - path = path[self.prefix_len:] + path = path[self.prefix_len :] if path and path[-1] != os.sep: path += os.sep i = bisect.bisect(self.index, path) @@ -282,9 +284,10 @@ def _is_directory(self, path): result = False return result + _finder_registry = { type(None): ResourceFinder, - zipimport.zipimporter: ZipResourceFinder + zipimport.zipimporter: ZipResourceFinder, } try: @@ -303,6 +306,7 @@ def _is_directory(self, path): def register_finder(loader, finder_maker): _finder_registry[type(loader)] = finder_maker + _finder_cache = {} @@ -318,20 +322,21 @@ def finder(package): if package not in sys.modules: __import__(package) module = sys.modules[package] - path = getattr(module, '__path__', None) + path = getattr(module, "__path__", None) if path is None: - raise DistlibException('You cannot get a finder for a module, ' - 'only for a package') - loader = getattr(module, '__loader__', None) + raise DistlibException( + "You cannot get a finder for a module, " "only for a package" + ) + loader = getattr(module, "__loader__", None) finder_maker = _finder_registry.get(type(loader)) if finder_maker is None: - raise DistlibException('Unable to locate finder for %r' % package) + raise DistlibException("Unable to locate finder for %r" % package) result = finder_maker(module) _finder_cache[package] = result return result -_dummy_module = types.ModuleType(str('__dummy__')) +_dummy_module = types.ModuleType(str("__dummy__")) def finder_for_path(path): @@ -348,7 +353,7 @@ def finder_for_path(path): finder = _finder_registry.get(type(loader)) if finder: module = _dummy_module - module.__file__ = os.path.join(path, '') + module.__file__ = os.path.join(path, "") module.__loader__ = loader result = finder(module) return result diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/scripts.py b/src/fetchcode/vcs/pip/_vendor/distlib/scripts.py index 51859741..e8215b95 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/scripts.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/scripts.py @@ -13,12 +13,11 @@ from .compat import sysconfig, detect_encoding, ZipFile from .resources import finder -from .util import (FileOperator, get_export_entry, convert_path, - get_executable, in_venv) +from .util import FileOperator, get_export_entry, convert_path, get_executable, in_venv logger = logging.getLogger(__name__) -_DEFAULT_MANIFEST = ''' +_DEFAULT_MANIFEST = """ -'''.strip() +""".strip() # check if Python is called on the first line with this expression -FIRST_LINE_RE = re.compile(b'^#!.*pythonw?[0-9.]*([ \t].*)?$') -SCRIPT_TEMPLATE = r'''# -*- coding: utf-8 -*- +FIRST_LINE_RE = re.compile(b"^#!.*pythonw?[0-9.]*([ \t].*)?$") +SCRIPT_TEMPLATE = r"""# -*- coding: utf-8 -*- import re import sys from %(module)s import %(import_name)s if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(%(func)s()) -''' +""" def _enquote_executable(executable): - if ' ' in executable: + if " " in executable: # make sure we quote only the executable in case of env # for example /usr/bin/env "/dir with spaces/bin/jython" # instead of "/usr/bin/env /dir with spaces/bin/jython" # otherwise whole - if executable.startswith('/usr/bin/env '): - env, _executable = executable.split(' ', 1) - if ' ' in _executable and not _executable.startswith('"'): + if executable.startswith("/usr/bin/env "): + env, _executable = executable.split(" ", 1) + if " " in _executable and not _executable.startswith('"'): executable = '%s "%s"' % (env, _executable) else: if not executable.startswith('"'): @@ -69,34 +68,37 @@ class ScriptMaker(object): A class to copy or create scripts from source scripts or callable specifications. """ + script_template = SCRIPT_TEMPLATE executable = None # for shebangs - def __init__(self, source_dir, target_dir, add_launchers=True, - dry_run=False, fileop=None): + def __init__( + self, source_dir, target_dir, add_launchers=True, dry_run=False, fileop=None + ): self.source_dir = source_dir self.target_dir = target_dir self.add_launchers = add_launchers self.force = False self.clobber = False # It only makes sense to set mode bits on POSIX. - self.set_mode = (os.name == 'posix') or (os.name == 'java' and - os._name == 'posix') - self.variants = set(('', 'X.Y')) + self.set_mode = (os.name == "posix") or ( + os.name == "java" and os._name == "posix" + ) + self.variants = set(("", "X.Y")) self._fileop = fileop or FileOperator(dry_run) - self._is_nt = os.name == 'nt' or ( - os.name == 'java' and os._name == 'nt') + self._is_nt = os.name == "nt" or (os.name == "java" and os._name == "nt") def _get_alternate_executable(self, executable, options): - if options.get('gui', False) and self._is_nt: # pragma: no cover + if options.get("gui", False) and self._is_nt: # pragma: no cover dn, fn = os.path.split(executable) - fn = fn.replace('python', 'pythonw') + fn = fn.replace("python", "pythonw") executable = os.path.join(dn, fn) return executable - if sys.platform.startswith('java'): # pragma: no cover + if sys.platform.startswith("java"): # pragma: no cover + def _is_shell(self, executable): """ Determine if the specified executable is a script @@ -104,9 +106,9 @@ def _is_shell(self, executable): """ try: with open(executable) as fp: - return fp.read(2) == '#!' + return fp.read(2) == "#!" except (OSError, IOError): - logger.warning('Failed to open %s', executable) + logger.warning("Failed to open %s", executable) return False def _fix_jython_executable(self, executable): @@ -114,12 +116,12 @@ def _fix_jython_executable(self, executable): # Workaround for Jython is not needed on Linux systems. import java - if java.lang.System.getProperty('os.name') == 'Linux': + if java.lang.System.getProperty("os.name") == "Linux": return executable - elif executable.lower().endswith('jython.exe'): + elif executable.lower().endswith("jython.exe"): # Use wrapper exe for Jython on Windows return executable - return '/usr/bin/env %s' % executable + return "/usr/bin/env %s" % executable def _build_shebang(self, executable, post_interp): """ @@ -132,45 +134,52 @@ def _build_shebang(self, executable, post_interp): See also: http://www.in-ulm.de/~mascheck/various/shebang/#length https://hg.mozilla.org/mozilla-central/file/tip/mach """ - if os.name != 'posix': + if os.name != "posix": simple_shebang = True else: # Add 3 for '#!' prefix and newline suffix. shebang_length = len(executable) + len(post_interp) + 3 - if sys.platform == 'darwin': + if sys.platform == "darwin": max_shebang_length = 512 else: max_shebang_length = 127 - simple_shebang = ((b' ' not in executable) and - (shebang_length <= max_shebang_length)) + simple_shebang = (b" " not in executable) and ( + shebang_length <= max_shebang_length + ) if simple_shebang: - result = b'#!' + executable + post_interp + b'\n' + result = b"#!" + executable + post_interp + b"\n" else: - result = b'#!/bin/sh\n' + result = b"#!/bin/sh\n" result += b"'''exec' " + executable + post_interp + b' "$0" "$@"\n' result += b"' '''" return result - def _get_shebang(self, encoding, post_interp=b'', options=None): + def _get_shebang(self, encoding, post_interp=b"", options=None): enquote = True if self.executable: executable = self.executable - enquote = False # assume this will be taken care of + enquote = False # assume this will be taken care of elif not sysconfig.is_python_build(): executable = get_executable() elif in_venv(): # pragma: no cover - executable = os.path.join(sysconfig.get_path('scripts'), - 'python%s' % sysconfig.get_config_var('EXE')) + executable = os.path.join( + sysconfig.get_path("scripts"), + "python%s" % sysconfig.get_config_var("EXE"), + ) else: # pragma: no cover executable = os.path.join( - sysconfig.get_config_var('BINDIR'), - 'python%s%s' % (sysconfig.get_config_var('VERSION'), - sysconfig.get_config_var('EXE'))) + sysconfig.get_config_var("BINDIR"), + "python%s%s" + % ( + sysconfig.get_config_var("VERSION"), + sysconfig.get_config_var("EXE"), + ), + ) if options: executable = self._get_alternate_executable(executable, options) - if sys.platform.startswith('java'): # pragma: no cover + if sys.platform.startswith("java"): # pragma: no cover executable = self._fix_jython_executable(executable) # Normalise case for Windows - COMMENTED OUT @@ -188,11 +197,14 @@ def _get_shebang(self, encoding, post_interp=b'', options=None): executable = _enquote_executable(executable) # Issue #51: don't use fsencode, since we later try to # check that the shebang is decodable using utf-8. - executable = executable.encode('utf-8') + executable = executable.encode("utf-8") # in case of IronPython, play safe and enable frames support - if (sys.platform == 'cli' and '-X:Frames' not in post_interp - and '-X:FullFrames' not in post_interp): # pragma: no cover - post_interp += b' -X:Frames' + if ( + sys.platform == "cli" + and "-X:Frames" not in post_interp + and "-X:FullFrames" not in post_interp + ): # pragma: no cover + post_interp += b" -X:Frames" shebang = self._build_shebang(executable, post_interp) # Python parser starts to read a script using UTF-8 until # it gets a #coding:xxx cookie. The shebang has to be the @@ -200,26 +212,28 @@ def _get_shebang(self, encoding, post_interp=b'', options=None): # written before. So the shebang has to be decodable from # UTF-8. try: - shebang.decode('utf-8') + shebang.decode("utf-8") except UnicodeDecodeError: # pragma: no cover - raise ValueError( - 'The shebang (%r) is not decodable from utf-8' % shebang) + raise ValueError("The shebang (%r) is not decodable from utf-8" % shebang) # If the script is encoded to a custom encoding (use a # #coding:xxx cookie), the shebang has to be decodable from # the script encoding too. - if encoding != 'utf-8': + if encoding != "utf-8": try: shebang.decode(encoding) except UnicodeDecodeError: # pragma: no cover raise ValueError( - 'The shebang (%r) is not decodable ' - 'from the script encoding (%r)' % (shebang, encoding)) + "The shebang (%r) is not decodable " + "from the script encoding (%r)" % (shebang, encoding) + ) return shebang def _get_script_text(self, entry): - return self.script_template % dict(module=entry.prefix, - import_name=entry.suffix.split('.')[0], - func=entry.suffix) + return self.script_template % dict( + module=entry.prefix, + import_name=entry.suffix.split(".")[0], + func=entry.suffix, + ) manifest = _DEFAULT_MANIFEST @@ -229,50 +243,50 @@ def get_manifest(self, exename): def _write_script(self, names, shebang, script_bytes, filenames, ext): use_launcher = self.add_launchers and self._is_nt - linesep = os.linesep.encode('utf-8') + linesep = os.linesep.encode("utf-8") if not shebang.endswith(linesep): shebang += linesep if not use_launcher: script_bytes = shebang + script_bytes else: # pragma: no cover - if ext == 'py': - launcher = self._get_launcher('t') + if ext == "py": + launcher = self._get_launcher("t") else: - launcher = self._get_launcher('w') + launcher = self._get_launcher("w") stream = BytesIO() - with ZipFile(stream, 'w') as zf: - zf.writestr('__main__.py', script_bytes) + with ZipFile(stream, "w") as zf: + zf.writestr("__main__.py", script_bytes) zip_data = stream.getvalue() script_bytes = launcher + shebang + zip_data for name in names: outname = os.path.join(self.target_dir, name) if use_launcher: # pragma: no cover n, e = os.path.splitext(outname) - if e.startswith('.py'): + if e.startswith(".py"): outname = n - outname = '%s.exe' % outname + outname = "%s.exe" % outname try: self._fileop.write_binary_file(outname, script_bytes) except Exception: # Failed writing an executable - it might be in use. - logger.warning('Failed to write executable - trying to ' - 'use .deleteme logic') - dfname = '%s.deleteme' % outname + logger.warning( + "Failed to write executable - trying to " "use .deleteme logic" + ) + dfname = "%s.deleteme" % outname if os.path.exists(dfname): - os.remove(dfname) # Not allowed to fail here + os.remove(dfname) # Not allowed to fail here os.rename(outname, dfname) # nor here self._fileop.write_binary_file(outname, script_bytes) - logger.debug('Able to replace executable using ' - '.deleteme logic') + logger.debug("Able to replace executable using " ".deleteme logic") try: os.remove(dfname) except Exception: - pass # still in use - ignore error + pass # still in use - ignore error else: - if self._is_nt and not outname.endswith('.' + ext): # pragma: no cover - outname = '%s.%s' % (outname, ext) + if self._is_nt and not outname.endswith("." + ext): # pragma: no cover + outname = "%s.%s" % (outname, ext) if os.path.exists(outname) and not self.clobber: - logger.warning('Skipping existing file %s', outname) + logger.warning("Skipping existing file %s", outname) continue self._fileop.write_binary_file(outname, script_bytes) if self.set_mode: @@ -280,27 +294,28 @@ def _write_script(self, names, shebang, script_bytes, filenames, ext): filenames.append(outname) def _make_script(self, entry, filenames, options=None): - post_interp = b'' + post_interp = b"" if options: - args = options.get('interpreter_args', []) + args = options.get("interpreter_args", []) if args: - args = ' %s' % ' '.join(args) - post_interp = args.encode('utf-8') - shebang = self._get_shebang('utf-8', post_interp, options=options) - script = self._get_script_text(entry).encode('utf-8') + args = " %s" % " ".join(args) + post_interp = args.encode("utf-8") + shebang = self._get_shebang("utf-8", post_interp, options=options) + script = self._get_script_text(entry).encode("utf-8") name = entry.name scriptnames = set() - if '' in self.variants: + if "" in self.variants: scriptnames.add(name) - if 'X' in self.variants: - scriptnames.add('%s%s' % (name, sys.version_info[0])) - if 'X.Y' in self.variants: - scriptnames.add('%s-%s.%s' % (name, sys.version_info[0], - sys.version_info[1])) - if options and options.get('gui', False): - ext = 'pyw' + if "X" in self.variants: + scriptnames.add("%s%s" % (name, sys.version_info[0])) + if "X.Y" in self.variants: + scriptnames.add( + "%s-%s.%s" % (name, sys.version_info[0], sys.version_info[1]) + ) + if options and options.get("gui", False): + ext = "pyw" else: - ext = 'py' + ext = "py" self._write_script(scriptnames, shebang, script, filenames, ext) def _copy_script(self, script, filenames): @@ -308,14 +323,14 @@ def _copy_script(self, script, filenames): script = os.path.join(self.source_dir, convert_path(script)) outname = os.path.join(self.target_dir, os.path.basename(script)) if not self.force and not self._fileop.newer(script, outname): - logger.debug('not copying %s (up-to-date)', script) + logger.debug("not copying %s (up-to-date)", script) return # Always open the file, but ignore failures in dry-run mode -- # that way, we'll get accurate feedback if we can read the # script. try: - f = open(script, 'rb') + f = open(script, "rb") except IOError: # pragma: no cover if not self.dry_run: raise @@ -323,14 +338,17 @@ def _copy_script(self, script, filenames): else: first_line = f.readline() if not first_line: # pragma: no cover - logger.warning('%s: %s is an empty file (skipping)', - self.get_command_name(), script) + logger.warning( + "%s: %s is an empty file (skipping)", + self.get_command_name(), + script, + ) return - match = FIRST_LINE_RE.match(first_line.replace(b'\r\n', b'\n')) + match = FIRST_LINE_RE.match(first_line.replace(b"\r\n", b"\n")) if match: adjust = True - post_interp = match.group(1) or b'' + post_interp = match.group(1) or b"" if not adjust: if f: @@ -340,16 +358,15 @@ def _copy_script(self, script, filenames): self._fileop.set_executable_mode([outname]) filenames.append(outname) else: - logger.info('copying and adjusting %s -> %s', script, - self.target_dir) + logger.info("copying and adjusting %s -> %s", script, self.target_dir) if not self._fileop.dry_run: encoding, lines = detect_encoding(f.readline) f.seek(0) shebang = self._get_shebang(encoding, post_interp) - if b'pythonw' in first_line: # pragma: no cover - ext = 'pyw' + if b"pythonw" in first_line: # pragma: no cover + ext = "pyw" else: - ext = 'py' + ext = "py" n = os.path.basename(outname) self._write_script([n], shebang, f.read(), filenames, ext) if f: @@ -363,23 +380,25 @@ def dry_run(self): def dry_run(self, value): self._fileop.dry_run = value - if os.name == 'nt' or (os.name == 'java' and os._name == 'nt'): # pragma: no cover + if os.name == "nt" or (os.name == "java" and os._name == "nt"): # pragma: no cover # Executable launcher support. # Launchers are from https://bitbucket.org/vinay.sajip/simple_launcher/ def _get_launcher(self, kind): - if struct.calcsize('P') == 8: # 64-bit - bits = '64' + if struct.calcsize("P") == 8: # 64-bit + bits = "64" else: - bits = '32' - name = '%s%s.exe' % (kind, bits) + bits = "32" + name = "%s%s.exe" % (kind, bits) # Issue 31: don't hardcode an absolute package name, but # determine it relative to the current package - distlib_package = __name__.rsplit('.', 1)[0] + distlib_package = __name__.rsplit(".", 1)[0] resource = finder(distlib_package).find(name) if not resource: - msg = ('Unable to find resource %s in package %s' % (name, - distlib_package)) + msg = "Unable to find resource %s in package %s" % ( + name, + distlib_package, + ) raise ValueError(msg) return resource.bytes diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/util.py b/src/fetchcode/vcs/pip/_vendor/distlib/util.py index 01324eae..75b84def 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/util.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/util.py @@ -14,6 +14,7 @@ import py_compile import re import socket + try: import ssl except ImportError: # pragma: no cover @@ -31,11 +32,29 @@ import time from . import DistlibException -from .compat import (string_types, text_type, shutil, raw_input, StringIO, - cache_from_source, urlopen, urljoin, httplib, xmlrpclib, - splittype, HTTPHandler, BaseConfigurator, valid_ident, - Container, configparser, URLError, ZipFile, fsdecode, - unquote, urlparse) +from .compat import ( + string_types, + text_type, + shutil, + raw_input, + StringIO, + cache_from_source, + urlopen, + urljoin, + httplib, + xmlrpclib, + splittype, + HTTPHandler, + BaseConfigurator, + valid_ident, + Container, + configparser, + URLError, + ZipFile, + fsdecode, + unquote, + urlparse, +) logger = logging.getLogger(__name__) @@ -43,14 +62,14 @@ # Requirement parsing code as per PEP 508 # -IDENTIFIER = re.compile(r'^([\w\.-]+)\s*') -VERSION_IDENTIFIER = re.compile(r'^([\w\.*+-]+)\s*') -COMPARE_OP = re.compile(r'^(<=?|>=?|={2,3}|[~!]=)\s*') -MARKER_OP = re.compile(r'^((<=?)|(>=?)|={2,3}|[~!]=|in|not\s+in)\s*') -OR = re.compile(r'^or\b\s*') -AND = re.compile(r'^and\b\s*') -NON_SPACE = re.compile(r'(\S+)\s*') -STRING_CHUNK = re.compile(r'([\s\w\.{}()*+#:;,/?!~`@$%^&=|<>\[\]-]+)') +IDENTIFIER = re.compile(r"^([\w\.-]+)\s*") +VERSION_IDENTIFIER = re.compile(r"^([\w\.*+-]+)\s*") +COMPARE_OP = re.compile(r"^(<=?|>=?|={2,3}|[~!]=)\s*") +MARKER_OP = re.compile(r"^((<=?)|(>=?)|={2,3}|[~!]=|in|not\s+in)\s*") +OR = re.compile(r"^or\b\s*") +AND = re.compile(r"^and\b\s*") +NON_SPACE = re.compile(r"(\S+)\s*") +STRING_CHUNK = re.compile(r"([\s\w\.{}()*+#:;,/?!~`@$%^&=|<>\[\]-]+)") def parse_marker(marker_string): @@ -62,19 +81,20 @@ def parse_marker(marker_string): interpreted as a literal string, and a string not contained in quotes is a variable (such as os_name). """ + def marker_var(remaining): # either identifier, or literal string m = IDENTIFIER.match(remaining) if m: result = m.groups()[0] - remaining = remaining[m.end():] + remaining = remaining[m.end() :] elif not remaining: - raise SyntaxError('unexpected end of input') + raise SyntaxError("unexpected end of input") else: q = remaining[0] - if q not in '\'"': - raise SyntaxError('invalid expression: %s' % remaining) - oq = '\'"'.replace(q, '') + if q not in "'\"": + raise SyntaxError("invalid expression: %s" % remaining) + oq = "'\"".replace(q, "") remaining = remaining[1:] parts = [q] while remaining: @@ -87,22 +107,22 @@ def marker_var(remaining): else: m = STRING_CHUNK.match(remaining) if not m: - raise SyntaxError('error in string literal: %s' % remaining) + raise SyntaxError("error in string literal: %s" % remaining) parts.append(m.groups()[0]) - remaining = remaining[m.end():] + remaining = remaining[m.end() :] else: - s = ''.join(parts) - raise SyntaxError('unterminated string: %s' % s) + s = "".join(parts) + raise SyntaxError("unterminated string: %s" % s) parts.append(q) - result = ''.join(parts) - remaining = remaining[1:].lstrip() # skip past closing quote + result = "".join(parts) + remaining = remaining[1:].lstrip() # skip past closing quote return result, remaining def marker_expr(remaining): - if remaining and remaining[0] == '(': + if remaining and remaining[0] == "(": result, remaining = marker(remaining[1:].lstrip()) - if remaining[0] != ')': - raise SyntaxError('unterminated parenthesis: %s' % remaining) + if remaining[0] != ")": + raise SyntaxError("unterminated parenthesis: %s" % remaining) remaining = remaining[1:].lstrip() else: lhs, remaining = marker_var(remaining) @@ -111,9 +131,9 @@ def marker_expr(remaining): if not m: break op = m.groups()[0] - remaining = remaining[m.end():] + remaining = remaining[m.end() :] rhs, remaining = marker_var(remaining) - lhs = {'op': op, 'lhs': lhs, 'rhs': rhs} + lhs = {"op": op, "lhs": lhs, "rhs": rhs} result = lhs return result, remaining @@ -123,9 +143,9 @@ def marker_and(remaining): m = AND.match(remaining) if not m: break - remaining = remaining[m.end():] + remaining = remaining[m.end() :] rhs, remaining = marker_expr(remaining) - lhs = {'op': 'and', 'lhs': lhs, 'rhs': rhs} + lhs = {"op": "and", "lhs": lhs, "rhs": rhs} return lhs, remaining def marker(remaining): @@ -134,9 +154,9 @@ def marker(remaining): m = OR.match(remaining) if not m: break - remaining = remaining[m.end():] + remaining = remaining[m.end() :] rhs, remaining = marker_and(remaining) - lhs = {'op': 'or', 'lhs': lhs, 'rhs': rhs} + lhs = {"op": "or", "lhs": lhs, "rhs": rhs} return lhs, remaining return marker(marker_string) @@ -148,41 +168,41 @@ def parse_requirement(req): whose attributes contain the various parts of the requirement. """ remaining = req.strip() - if not remaining or remaining.startswith('#'): + if not remaining or remaining.startswith("#"): return None m = IDENTIFIER.match(remaining) if not m: - raise SyntaxError('name expected: %s' % remaining) + raise SyntaxError("name expected: %s" % remaining) distname = m.groups()[0] - remaining = remaining[m.end():] + remaining = remaining[m.end() :] extras = mark_expr = versions = uri = None - if remaining and remaining[0] == '[': - i = remaining.find(']', 1) + if remaining and remaining[0] == "[": + i = remaining.find("]", 1) if i < 0: - raise SyntaxError('unterminated extra: %s' % remaining) + raise SyntaxError("unterminated extra: %s" % remaining) s = remaining[1:i] - remaining = remaining[i + 1:].lstrip() + remaining = remaining[i + 1 :].lstrip() extras = [] while s: m = IDENTIFIER.match(s) if not m: - raise SyntaxError('malformed extra: %s' % s) + raise SyntaxError("malformed extra: %s" % s) extras.append(m.groups()[0]) - s = s[m.end():] + s = s[m.end() :] if not s: break - if s[0] != ',': - raise SyntaxError('comma expected in extras: %s' % s) + if s[0] != ",": + raise SyntaxError("comma expected in extras: %s" % s) s = s[1:].lstrip() if not extras: extras = None if remaining: - if remaining[0] == '@': + if remaining[0] == "@": # it's a URI remaining = remaining[1:].lstrip() m = NON_SPACE.match(remaining) if not m: - raise SyntaxError('invalid URI: %s' % remaining) + raise SyntaxError("invalid URI: %s" % remaining) uri = m.groups()[0] t = urlparse(uri) # there are issues with Python and URL parsing, so this test @@ -190,8 +210,8 @@ def parse_requirement(req): # always parse invalid URLs correctly - it should raise # exceptions for malformed URLs if not (t.scheme and t.netloc): - raise SyntaxError('Invalid URL: %s' % uri) - remaining = remaining[m.end():].lstrip() + raise SyntaxError("Invalid URL: %s" % uri) + remaining = remaining[m.end() :].lstrip() else: def get_versions(ver_remaining): @@ -205,31 +225,31 @@ def get_versions(ver_remaining): versions = [] while True: op = m.groups()[0] - ver_remaining = ver_remaining[m.end():] + ver_remaining = ver_remaining[m.end() :] m = VERSION_IDENTIFIER.match(ver_remaining) if not m: - raise SyntaxError('invalid version: %s' % ver_remaining) + raise SyntaxError("invalid version: %s" % ver_remaining) v = m.groups()[0] versions.append((op, v)) - ver_remaining = ver_remaining[m.end():] - if not ver_remaining or ver_remaining[0] != ',': + ver_remaining = ver_remaining[m.end() :] + if not ver_remaining or ver_remaining[0] != ",": break ver_remaining = ver_remaining[1:].lstrip() m = COMPARE_OP.match(ver_remaining) if not m: - raise SyntaxError('invalid constraint: %s' % ver_remaining) + raise SyntaxError("invalid constraint: %s" % ver_remaining) if not versions: versions = None return versions, ver_remaining - if remaining[0] != '(': + if remaining[0] != "(": versions, remaining = get_versions(remaining) else: - i = remaining.find(')', 1) + i = remaining.find(")", 1) if i < 0: - raise SyntaxError('unterminated parenthesis: %s' % remaining) + raise SyntaxError("unterminated parenthesis: %s" % remaining) s = remaining[1:i] - remaining = remaining[i + 1:].lstrip() + remaining = remaining[i + 1 :].lstrip() # As a special diversion from PEP 508, allow a version number # a.b.c in parentheses as a synonym for ~= a.b.c (because this # is allowed in earlier PEPs) @@ -238,29 +258,35 @@ def get_versions(ver_remaining): else: m = VERSION_IDENTIFIER.match(s) if not m: - raise SyntaxError('invalid constraint: %s' % s) + raise SyntaxError("invalid constraint: %s" % s) v = m.groups()[0] - s = s[m.end():].lstrip() + s = s[m.end() :].lstrip() if s: - raise SyntaxError('invalid constraint: %s' % s) - versions = [('~=', v)] + raise SyntaxError("invalid constraint: %s" % s) + versions = [("~=", v)] if remaining: - if remaining[0] != ';': - raise SyntaxError('invalid requirement: %s' % remaining) + if remaining[0] != ";": + raise SyntaxError("invalid requirement: %s" % remaining) remaining = remaining[1:].lstrip() mark_expr, remaining = parse_marker(remaining) - if remaining and remaining[0] != '#': - raise SyntaxError('unexpected trailing data: %s' % remaining) + if remaining and remaining[0] != "#": + raise SyntaxError("unexpected trailing data: %s" % remaining) if not versions: rs = distname else: - rs = '%s %s' % (distname, ', '.join(['%s %s' % con for con in versions])) - return Container(name=distname, extras=extras, constraints=versions, - marker=mark_expr, url=uri, requirement=rs) + rs = "%s %s" % (distname, ", ".join(["%s %s" % con for con in versions])) + return Container( + name=distname, + extras=extras, + constraints=versions, + marker=mark_expr, + url=uri, + requirement=rs, + ) def get_resources_dests(resources_root, rules): @@ -268,10 +294,10 @@ def get_resources_dests(resources_root, rules): def get_rel_path(root, path): # normalizes and returns a lstripped-/-separated path - root = root.replace(os.path.sep, '/') - path = path.replace(os.path.sep, '/') + root = root.replace(os.path.sep, "/") + path = path.replace(os.path.sep, "/") assert path.startswith(root) - return path[len(root):].lstrip('/') + return path[len(root) :].lstrip("/") destinations = {} for base, suffix, dest in rules: @@ -284,31 +310,31 @@ def get_rel_path(root, path): destinations.pop(resource_file, None) else: rel_path = get_rel_path(abs_base, abs_path) - rel_dest = dest.replace(os.path.sep, '/').rstrip('/') - destinations[resource_file] = rel_dest + '/' + rel_path + rel_dest = dest.replace(os.path.sep, "/").rstrip("/") + destinations[resource_file] = rel_dest + "/" + rel_path return destinations def in_venv(): - if hasattr(sys, 'real_prefix'): + if hasattr(sys, "real_prefix"): # virtualenv venvs result = True else: # PEP 405 venvs - result = sys.prefix != getattr(sys, 'base_prefix', sys.prefix) + result = sys.prefix != getattr(sys, "base_prefix", sys.prefix) return result def get_executable(): -# The __PYVENV_LAUNCHER__ dance is apparently no longer needed, as -# changes to the stub launcher mean that sys.executable always points -# to the stub on OS X -# if sys.platform == 'darwin' and ('__PYVENV_LAUNCHER__' -# in os.environ): -# result = os.environ['__PYVENV_LAUNCHER__'] -# else: -# result = sys.executable -# return result + # The __PYVENV_LAUNCHER__ dance is apparently no longer needed, as + # changes to the stub launcher mean that sys.executable always points + # to the stub on OS X + # if sys.platform == 'darwin' and ('__PYVENV_LAUNCHER__' + # in os.environ): + # result = os.environ['__PYVENV_LAUNCHER__'] + # else: + # result = sys.executable + # return result result = os.path.normcase(sys.executable) if not isinstance(result, text_type): result = fsdecode(result) @@ -327,7 +353,7 @@ def proceed(prompt, allowed_chars, error_prompt=None, default=None): if c in allowed_chars: break if error_prompt: - p = '%c: %s\n%s' % (c, error_prompt, prompt) + p = "%c: %s\n%s" % (c, error_prompt, prompt) return c @@ -340,19 +366,20 @@ def extract_by_key(d, keys): result[key] = d[key] return result + def read_exports(stream): if sys.version_info[0] >= 3: # needs to be a text stream - stream = codecs.getreader('utf-8')(stream) + stream = codecs.getreader("utf-8")(stream) # Try to load as JSON, falling back on legacy format data = stream.read() stream = StringIO(data) try: jdata = json.load(stream) - result = jdata['extensions']['python.exports']['exports'] + result = jdata["extensions"]["python.exports"]["exports"] for group, entries in result.items(): for k, v in entries.items(): - s = '%s = %s' % (k, v) + s = "%s = %s" % (k, v) entry = get_export_entry(s) assert entry is not None entries[k] = entry @@ -361,7 +388,7 @@ def read_exports(stream): stream.seek(0, 0) def read_stream(cp, stream): - if hasattr(cp, 'read_file'): + if hasattr(cp, "read_file"): cp.read_file(stream) else: cp.readfp(stream) @@ -379,10 +406,10 @@ def read_stream(cp, stream): for key in cp.sections(): result[key] = entries = {} for name, value in cp.items(key): - s = '%s = %s' % (name, value) + s = "%s = %s" % (name, value) entry = get_export_entry(s) assert entry is not None - #entry.dist = self + # entry.dist = self entries[name] = entry return result @@ -390,7 +417,7 @@ def read_stream(cp, stream): def write_exports(exports, stream): if sys.version_info[0] >= 3: # needs to be a text stream - stream = codecs.getwriter('utf-8')(stream) + stream = codecs.getwriter("utf-8")(stream) cp = configparser.ConfigParser() for k, v in exports.items(): # TODO check k, v for valid values @@ -399,9 +426,9 @@ def write_exports(exports, stream): if entry.suffix is None: s = entry.prefix else: - s = '%s:%s' % (entry.prefix, entry.suffix) + s = "%s:%s" % (entry.prefix, entry.suffix) if entry.flags: - s = '%s [%s]' % (s, ', '.join(entry.flags)) + s = "%s [%s]" % (s, ", ".join(entry.flags)) cp.set(k, entry.name, s) cp.write(stream) @@ -414,6 +441,7 @@ def tempdir(): finally: shutil.rmtree(td) + @contextlib.contextmanager def chdir(d): cwd = os.getcwd() @@ -437,7 +465,7 @@ def socket_timeout(seconds=15): class cached_property(object): def __init__(self, func): self.func = func - #for attr in ('__name__', '__module__', '__doc__'): + # for attr in ('__name__', '__module__', '__doc__'): # setattr(self, attr, getattr(func, attr, None)) def __get__(self, obj, cls=None): @@ -445,9 +473,10 @@ def __get__(self, obj, cls=None): return self value = self.func(obj) object.__setattr__(obj, self.func.__name__, value) - #obj.__dict__[self.func.__name__] = value = self.func(obj) + # obj.__dict__[self.func.__name__] = value = self.func(obj) return value + def convert_path(pathname): """Return 'pathname' as a name that will work on the native filesystem. @@ -458,16 +487,16 @@ def convert_path(pathname): ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ - if os.sep == '/': + if os.sep == "/": return pathname if not pathname: return pathname - if pathname[0] == '/': + if pathname[0] == "/": raise ValueError("path '%s' cannot be absolute" % pathname) - if pathname[-1] == '/': + if pathname[-1] == "/": raise ValueError("path '%s' cannot end with '/'" % pathname) - paths = pathname.split('/') + paths = pathname.split("/") while os.curdir in paths: paths.remove(os.curdir) if not paths: @@ -503,39 +532,37 @@ def newer(self, source, target): second will have the same "age". """ if not os.path.exists(source): - raise DistlibException("file '%r' does not exist" % - os.path.abspath(source)) + raise DistlibException("file '%r' does not exist" % os.path.abspath(source)) if not os.path.exists(target): return True return os.stat(source).st_mtime > os.stat(target).st_mtime def copy_file(self, infile, outfile, check=True): - """Copy a file respecting dry-run and force flags. - """ + """Copy a file respecting dry-run and force flags.""" self.ensure_dir(os.path.dirname(outfile)) - logger.info('Copying %s to %s', infile, outfile) + logger.info("Copying %s to %s", infile, outfile) if not self.dry_run: msg = None if check: if os.path.islink(outfile): - msg = '%s is a symlink' % outfile + msg = "%s is a symlink" % outfile elif os.path.exists(outfile) and not os.path.isfile(outfile): - msg = '%s is a non-regular file' % outfile + msg = "%s is a non-regular file" % outfile if msg: - raise ValueError(msg + ' which would be overwritten') + raise ValueError(msg + " which would be overwritten") shutil.copyfile(infile, outfile) self.record_as_written(outfile) def copy_stream(self, instream, outfile, encoding=None): assert not os.path.isdir(outfile) self.ensure_dir(os.path.dirname(outfile)) - logger.info('Copying stream %s to %s', instream, outfile) + logger.info("Copying stream %s to %s", instream, outfile) if not self.dry_run: if encoding is None: - outstream = open(outfile, 'wb') + outstream = open(outfile, "wb") else: - outstream = codecs.open(outfile, 'w', encoding=encoding) + outstream = codecs.open(outfile, "w", encoding=encoding) try: shutil.copyfileobj(instream, outstream) finally: @@ -547,7 +574,7 @@ def write_binary_file(self, path, data): if not self.dry_run: if os.path.exists(path): os.remove(path) - with open(path, 'wb') as f: + with open(path, "wb") as f: f.write(data) self.record_as_written(path) @@ -555,7 +582,7 @@ def write_text_file(self, path, data, encoding): self.write_binary_file(path, data.encode(encoding)) def set_mode(self, bits, mask, files): - if os.name == 'posix' or (os.name == 'java' and os._name == 'posix'): + if os.name == "posix" or (os.name == "java" and os._name == "posix"): # Set the executable bits (owner, group, and world) on # all the files specified. for f in files: @@ -574,33 +601,39 @@ def ensure_dir(self, path): self.ensured.add(path) d, f = os.path.split(path) self.ensure_dir(d) - logger.info('Creating %s' % path) + logger.info("Creating %s" % path) if not self.dry_run: os.mkdir(path) if self.record: self.dirs_created.add(path) - def byte_compile(self, path, optimize=False, force=False, prefix=None, hashed_invalidation=False): + def byte_compile( + self, path, optimize=False, force=False, prefix=None, hashed_invalidation=False + ): dpath = cache_from_source(path, not optimize) - logger.info('Byte-compiling %s to %s', path, dpath) + logger.info("Byte-compiling %s to %s", path, dpath) if not self.dry_run: if force or self.newer(path, dpath): if not prefix: diagpath = None else: assert path.startswith(prefix) - diagpath = path[len(prefix):] + diagpath = path[len(prefix) :] compile_kwargs = {} - if hashed_invalidation and hasattr(py_compile, 'PycInvalidationMode'): - compile_kwargs['invalidation_mode'] = py_compile.PycInvalidationMode.CHECKED_HASH - py_compile.compile(path, dpath, diagpath, True, **compile_kwargs) # raise error + if hashed_invalidation and hasattr(py_compile, "PycInvalidationMode"): + compile_kwargs[ + "invalidation_mode" + ] = py_compile.PycInvalidationMode.CHECKED_HASH + py_compile.compile( + path, dpath, diagpath, True, **compile_kwargs + ) # raise error self.record_as_written(dpath) return dpath def ensure_removed(self, path): if os.path.exists(path): if os.path.isdir(path) and not os.path.islink(path): - logger.debug('Removing directory tree at %s', path) + logger.debug("Removing directory tree at %s", path) if not self.dry_run: shutil.rmtree(path) if self.record: @@ -608,10 +641,10 @@ def ensure_removed(self, path): self.dirs_created.remove(path) else: if os.path.islink(path): - s = 'link' + s = "link" else: - s = 'file' - logger.debug('Removing %s %s', s, path) + s = "file" + logger.debug("Removing %s %s", s, path) if not self.dry_run: os.remove(path) if self.record: @@ -652,12 +685,13 @@ def rollback(self): for d in dirs: flist = os.listdir(d) if flist: - assert flist == ['__pycache__'] + assert flist == ["__pycache__"] sd = os.path.join(d, flist[0]) os.rmdir(sd) - os.rmdir(d) # should fail if non-empty + os.rmdir(d) # should fail if non-empty self._init_record() + def resolve(module_name, dotted_path): if module_name in sys.modules: mod = sys.modules[module_name] @@ -666,7 +700,7 @@ def resolve(module_name, dotted_path): if dotted_path is None: result = mod else: - parts = dotted_path.split('.') + parts = dotted_path.split(".") result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) @@ -685,54 +719,61 @@ def value(self): return resolve(self.prefix, self.suffix) def __repr__(self): # pragma: no cover - return '' % (self.name, self.prefix, - self.suffix, self.flags) + return "" % ( + self.name, + self.prefix, + self.suffix, + self.flags, + ) def __eq__(self, other): if not isinstance(other, ExportEntry): result = False else: - result = (self.name == other.name and - self.prefix == other.prefix and - self.suffix == other.suffix and - self.flags == other.flags) + result = ( + self.name == other.name + and self.prefix == other.prefix + and self.suffix == other.suffix + and self.flags == other.flags + ) return result __hash__ = object.__hash__ -ENTRY_RE = re.compile(r'''(?P(\w|[-.+])+) +ENTRY_RE = re.compile( + r"""(?P(\w|[-.+])+) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? - ''', re.VERBOSE) + """, + re.VERBOSE, +) + def get_export_entry(specification): m = ENTRY_RE.search(specification) if not m: result = None - if '[' in specification or ']' in specification: - raise DistlibException("Invalid specification " - "'%s'" % specification) + if "[" in specification or "]" in specification: + raise DistlibException("Invalid specification " "'%s'" % specification) else: d = m.groupdict() - name = d['name'] - path = d['callable'] - colons = path.count(':') + name = d["name"] + path = d["callable"] + colons = path.count(":") if colons == 0: prefix, suffix = path, None else: if colons != 1: - raise DistlibException("Invalid specification " - "'%s'" % specification) - prefix, suffix = path.split(':') - flags = d['flags'] + raise DistlibException("Invalid specification " "'%s'" % specification) + prefix, suffix = path.split(":") + flags = d["flags"] if flags is None: - if '[' in specification or ']' in specification: - raise DistlibException("Invalid specification " - "'%s'" % specification) + if "[" in specification or "]" in specification: + raise DistlibException("Invalid specification " "'%s'" % specification) flags = [] else: - flags = [f.strip() for f in flags.split(',')] + flags = [f.strip() for f in flags.split(",")] result = ExportEntry(name, prefix, suffix, flags) return result @@ -753,28 +794,28 @@ def get_cache_base(suffix=None): determined above, or with the name specified with ``suffix``. """ if suffix is None: - suffix = '.distlib' - if os.name == 'nt' and 'LOCALAPPDATA' in os.environ: - result = os.path.expandvars('$localappdata') + suffix = ".distlib" + if os.name == "nt" and "LOCALAPPDATA" in os.environ: + result = os.path.expandvars("$localappdata") else: # Assume posix, or old Windows - result = os.path.expanduser('~') + result = os.path.expanduser("~") # we use 'isdir' instead of 'exists', because we want to # fail if there's a file with that name if os.path.isdir(result): usable = os.access(result, os.W_OK) if not usable: - logger.warning('Directory exists but is not writable: %s', result) + logger.warning("Directory exists but is not writable: %s", result) else: try: os.makedirs(result) usable = True except OSError: - logger.warning('Unable to create %s', result, exc_info=True) + logger.warning("Unable to create %s", result, exc_info=True) usable = False if not usable: result = tempfile.mkdtemp() - logger.warning('Default location unusable, using %s', result) + logger.warning("Default location unusable, using %s", result) return os.path.join(result, suffix) @@ -790,25 +831,25 @@ def path_to_cache_dir(path): """ d, p = os.path.splitdrive(os.path.abspath(path)) if d: - d = d.replace(':', '---') - p = p.replace(os.sep, '--') - return d + p + '.cache' + d = d.replace(":", "---") + p = p.replace(os.sep, "--") + return d + p + ".cache" def ensure_slash(s): - if not s.endswith('/'): - return s + '/' + if not s.endswith("/"): + return s + "/" return s def parse_credentials(netloc): username = password = None - if '@' in netloc: - prefix, netloc = netloc.rsplit('@', 1) - if ':' not in prefix: + if "@" in netloc: + prefix, netloc = netloc.rsplit("@", 1) + if ":" not in prefix: username = prefix else: - username, password = prefix.split(':', 1) + username, password = prefix.split(":", 1) if username: username = unquote(username) if password: @@ -821,6 +862,7 @@ def get_process_umask(): os.umask(result) return result + def is_string_sequence(seq): result = True i = None @@ -831,9 +873,11 @@ def is_string_sequence(seq): assert i is not None return result -PROJECT_NAME_AND_VERSION = re.compile('([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-' - '([a-z0-9_.+-]+)', re.I) -PYTHON_VERSION = re.compile(r'-py(\d\.?\d?)') + +PROJECT_NAME_AND_VERSION = re.compile( + "([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-" "([a-z0-9_.+-]+)", re.I +) +PYTHON_VERSION = re.compile(r"-py(\d\.?\d?)") def split_filename(filename, project_name=None): @@ -844,25 +888,26 @@ def split_filename(filename, project_name=None): """ result = None pyver = None - filename = unquote(filename).replace(' ', '-') + filename = unquote(filename).replace(" ", "-") m = PYTHON_VERSION.search(filename) if m: pyver = m.group(1) - filename = filename[:m.start()] + filename = filename[: m.start()] if project_name and len(filename) > len(project_name) + 1: - m = re.match(re.escape(project_name) + r'\b', filename) + m = re.match(re.escape(project_name) + r"\b", filename) if m: n = m.end() - result = filename[:n], filename[n + 1:], pyver + result = filename[:n], filename[n + 1 :], pyver if result is None: m = PROJECT_NAME_AND_VERSION.match(filename) if m: result = m.group(1), m.group(3), pyver return result + # Allow spaces in name because of legacy dists like "Twisted Core" -NAME_VERSION_RE = re.compile(r'(?P[\w .-]+)\s*' - r'\(\s*(?P[^\s)]+)\)$') +NAME_VERSION_RE = re.compile(r"(?P[\w .-]+)\s*" r"\(\s*(?P[^\s)]+)\)$") + def parse_name_and_version(p): """ @@ -875,35 +920,39 @@ def parse_name_and_version(p): """ m = NAME_VERSION_RE.match(p) if not m: - raise DistlibException('Ill-formed name/version string: \'%s\'' % p) + raise DistlibException("Ill-formed name/version string: '%s'" % p) d = m.groupdict() - return d['name'].strip().lower(), d['ver'] + return d["name"].strip().lower(), d["ver"] + def get_extras(requested, available): result = set() requested = set(requested or []) available = set(available or []) - if '*' in requested: - requested.remove('*') + if "*" in requested: + requested.remove("*") result |= available for r in requested: - if r == '-': + if r == "-": result.add(r) - elif r.startswith('-'): + elif r.startswith("-"): unwanted = r[1:] if unwanted not in available: - logger.warning('undeclared extra: %s' % unwanted) + logger.warning("undeclared extra: %s" % unwanted) if unwanted in result: result.remove(unwanted) else: if r not in available: - logger.warning('undeclared extra: %s' % r) + logger.warning("undeclared extra: %s" % r) result.add(r) return result + + # # Extended metadata functionality # + def _get_external_data(url): result = {} try: @@ -912,28 +961,31 @@ def _get_external_data(url): # using a custom redirect handler. resp = urlopen(url) headers = resp.info() - ct = headers.get('Content-Type') - if not ct.startswith('application/json'): - logger.debug('Unexpected response for JSON request: %s', ct) + ct = headers.get("Content-Type") + if not ct.startswith("application/json"): + logger.debug("Unexpected response for JSON request: %s", ct) else: - reader = codecs.getreader('utf-8')(resp) - #data = reader.read().decode('utf-8') - #result = json.loads(data) + reader = codecs.getreader("utf-8")(resp) + # data = reader.read().decode('utf-8') + # result = json.loads(data) result = json.load(reader) except Exception as e: - logger.exception('Failed to get external data for %s: %s', url, e) + logger.exception("Failed to get external data for %s: %s", url, e) return result -_external_data_base_url = 'https://www.red-dove.com/pypi/projects/' + +_external_data_base_url = "https://www.red-dove.com/pypi/projects/" + def get_project_data(name): - url = '%s/%s/project.json' % (name[0].upper(), name) + url = "%s/%s/project.json" % (name[0].upper(), name) url = urljoin(_external_data_base_url, url) result = _get_external_data(url) return result + def get_package_data(name, version): - url = '%s/%s/package-%s.json' % (name[0].upper(), name, version) + url = "%s/%s/package-%s.json" % (name[0].upper(), name, version) url = urljoin(_external_data_base_url, url) return _get_external_data(url) @@ -956,7 +1008,7 @@ def __init__(self, base): if not os.path.isdir(base): # pragma: no cover os.makedirs(base) if (os.stat(base).st_mode & 0o77) != 0: - logger.warning('Directory \'%s\' is not private', base) + logger.warning("Directory '%s' is not private", base) self.base = os.path.abspath(os.path.normpath(base)) def prefix_to_dir(self, prefix): @@ -986,6 +1038,7 @@ class EventMixin(object): """ A very simple publish/subscribe system. """ + def __init__(self): self._subscribers = {} @@ -1018,7 +1071,7 @@ def remove(self, event, subscriber): """ subs = self._subscribers if event not in subs: - raise ValueError('No subscribers: %r' % event) + raise ValueError("No subscribers: %r" % event) subs[event].remove(subscriber) def get_subscribers(self, event): @@ -1044,13 +1097,19 @@ def publish(self, event, *args, **kwargs): try: value = subscriber(event, *args, **kwargs) except Exception: - logger.exception('Exception during event publication') + logger.exception("Exception during event publication") value = None result.append(value) - logger.debug('publish %s: args = %s, kwargs = %s, result = %s', - event, args, kwargs, result) + logger.debug( + "publish %s: args = %s, kwargs = %s, result = %s", + event, + args, + kwargs, + result, + ) return result + # # Simple sequencing # @@ -1058,7 +1117,7 @@ class Sequencer(object): def __init__(self): self._preds = {} self._succs = {} - self._nodes = set() # nodes with no preds/succs + self._nodes = set() # nodes with no preds/succs def add_node(self, node): self._nodes.add(node) @@ -1090,20 +1149,19 @@ def remove(self, pred, succ): preds = self._preds[succ] succs = self._succs[pred] except KeyError: # pragma: no cover - raise ValueError('%r not a successor of anything' % succ) + raise ValueError("%r not a successor of anything" % succ) try: preds.remove(pred) succs.remove(succ) except KeyError: # pragma: no cover - raise ValueError('%r not a successor of %r' % (succ, pred)) + raise ValueError("%r not a successor of %r" % (succ, pred)) def is_step(self, step): - return (step in self._preds or step in self._succs or - step in self._nodes) + return step in self._preds or step in self._succs or step in self._nodes def get_steps(self, final): if not self.is_step(final): - raise ValueError('Unknown: %r' % final) + raise ValueError("Unknown: %r" % final) result = [] todo = [] seen = set() @@ -1128,7 +1186,7 @@ def get_steps(self, final): @property def strong_connections(self): - #http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm + # http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm index_counter = [0] stack = [] lowlinks = {} @@ -1153,11 +1211,11 @@ def strongconnect(node): if successor not in lowlinks: # Successor has not yet been visited strongconnect(successor) - lowlinks[node] = min(lowlinks[node],lowlinks[successor]) + lowlinks[node] = min(lowlinks[node], lowlinks[successor]) elif successor in stack: # the successor is in the stack and hence in the current # strongly connected component (SCC) - lowlinks[node] = min(lowlinks[node],index[successor]) + lowlinks[node] = min(lowlinks[node], index[successor]) # If `node` is a root node, pop the stack and generate an SCC if lowlinks[node] == index[node]: @@ -1166,7 +1224,8 @@ def strongconnect(node): while True: successor = stack.pop() connected_component.append(successor) - if successor == node: break + if successor == node: + break component = tuple(connected_component) # storing the result result.append(component) @@ -1179,52 +1238,52 @@ def strongconnect(node): @property def dot(self): - result = ['digraph G {'] + result = ["digraph G {"] for succ in self._preds: preds = self._preds[succ] for pred in preds: - result.append(' %s -> %s;' % (pred, succ)) + result.append(" %s -> %s;" % (pred, succ)) for node in self._nodes: - result.append(' %s;' % node) - result.append('}') - return '\n'.join(result) + result.append(" %s;" % node) + result.append("}") + return "\n".join(result) + # # Unarchiving functionality for zip, tar, tgz, tbz, whl # -ARCHIVE_EXTENSIONS = ('.tar.gz', '.tar.bz2', '.tar', '.zip', - '.tgz', '.tbz', '.whl') +ARCHIVE_EXTENSIONS = (".tar.gz", ".tar.bz2", ".tar", ".zip", ".tgz", ".tbz", ".whl") -def unarchive(archive_filename, dest_dir, format=None, check=True): +def unarchive(archive_filename, dest_dir, format=None, check=True): def check_path(path): if not isinstance(path, text_type): - path = path.decode('utf-8') + path = path.decode("utf-8") p = os.path.abspath(os.path.join(dest_dir, path)) if not p.startswith(dest_dir) or p[plen] != os.sep: - raise ValueError('path outside destination: %r' % p) + raise ValueError("path outside destination: %r" % p) dest_dir = os.path.abspath(dest_dir) plen = len(dest_dir) archive = None if format is None: - if archive_filename.endswith(('.zip', '.whl')): - format = 'zip' - elif archive_filename.endswith(('.tar.gz', '.tgz')): - format = 'tgz' - mode = 'r:gz' - elif archive_filename.endswith(('.tar.bz2', '.tbz')): - format = 'tbz' - mode = 'r:bz2' - elif archive_filename.endswith('.tar'): - format = 'tar' - mode = 'r' + if archive_filename.endswith((".zip", ".whl")): + format = "zip" + elif archive_filename.endswith((".tar.gz", ".tgz")): + format = "tgz" + mode = "r:gz" + elif archive_filename.endswith((".tar.bz2", ".tbz")): + format = "tbz" + mode = "r:bz2" + elif archive_filename.endswith(".tar"): + format = "tar" + mode = "r" else: # pragma: no cover - raise ValueError('Unknown format for %r' % archive_filename) + raise ValueError("Unknown format for %r" % archive_filename) try: - if format == 'zip': - archive = ZipFile(archive_filename, 'r') + if format == "zip": + archive = ZipFile(archive_filename, "r") if check: names = archive.namelist() for name in names: @@ -1235,14 +1294,14 @@ def check_path(path): names = archive.getnames() for name in names: check_path(name) - if format != 'zip' and sys.version_info[0] < 3: + if format != "zip" and sys.version_info[0] < 3: # See Python issue 17153. If the dest path contains Unicode, # tarfile extraction fails on Python 2.x if a member path name # contains non-ASCII characters - it leads to an implicit # bytes -> unicode conversion using ASCII to decode. for tarinfo in archive.getmembers(): if not isinstance(tarinfo.name, text_type): - tarinfo.name = tarinfo.name.decode('utf-8') + tarinfo.name = tarinfo.name.decode("utf-8") archive.extractall(dest_dir) finally: @@ -1263,15 +1322,16 @@ def zip_dir(directory): zf.write(full, dest) return result + # # Simple progress bar # -UNITS = ('', 'K', 'M', 'G','T','P') +UNITS = ("", "K", "M", "G", "T", "P") class Progress(object): - unknown = 'UNKNOWN' + unknown = "UNKNOWN" def __init__(self, minval=0, maxval=100): assert maxval is None or maxval >= minval @@ -1311,41 +1371,41 @@ def maximum(self): @property def percentage(self): if self.done: - result = '100 %' + result = "100 %" elif self.max is None: - result = ' ?? %' + result = " ?? %" else: v = 100.0 * (self.cur - self.min) / (self.max - self.min) - result = '%3d %%' % v + result = "%3d %%" % v return result def format_duration(self, duration): if (duration <= 0) and self.max is None or self.cur == self.min: - result = '??:??:??' - #elif duration < 1: + result = "??:??:??" + # elif duration < 1: # result = '--:--:--' else: - result = time.strftime('%H:%M:%S', time.gmtime(duration)) + result = time.strftime("%H:%M:%S", time.gmtime(duration)) return result @property def ETA(self): if self.done: - prefix = 'Done' + prefix = "Done" t = self.elapsed - #import pdb; pdb.set_trace() + # import pdb; pdb.set_trace() else: - prefix = 'ETA ' + prefix = "ETA " if self.max is None: t = -1 elif self.elapsed == 0 or (self.cur == self.min): t = 0 else: - #import pdb; pdb.set_trace() + # import pdb; pdb.set_trace() t = float(self.max - self.min) t /= self.cur - self.min t = (t - 1) * self.elapsed - return '%s: %s' % (prefix, self.format_duration(t)) + return "%s: %s" % (prefix, self.format_duration(t)) @property def speed(self): @@ -1357,15 +1417,16 @@ def speed(self): if result < 1000: break result /= 1000.0 - return '%d %sB/s' % (result, unit) + return "%d %sB/s" % (result, unit) + # # Glob functionality # -RICH_GLOB = re.compile(r'\{([^}]*)\}') -_CHECK_RECURSIVE_GLOB = re.compile(r'[^/\\,{]\*\*|\*\*[^/\\,}]') -_CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$') +RICH_GLOB = re.compile(r"\{([^}]*)\}") +_CHECK_RECURSIVE_GLOB = re.compile(r"[^/\\,{]\*\*|\*\*[^/\\,}]") +_CHECK_MISMATCH_SET = re.compile(r"^[^{]*\}|\{[^}]*$") def iglob(path_glob): @@ -1384,61 +1445,68 @@ def _iglob(path_glob): if len(rich_path_glob) > 1: assert len(rich_path_glob) == 3, rich_path_glob prefix, set, suffix = rich_path_glob - for item in set.split(','): - for path in _iglob(''.join((prefix, item, suffix))): + for item in set.split(","): + for path in _iglob("".join((prefix, item, suffix))): yield path else: - if '**' not in path_glob: + if "**" not in path_glob: for item in std_iglob(path_glob): yield item else: - prefix, radical = path_glob.split('**', 1) - if prefix == '': - prefix = '.' - if radical == '': - radical = '*' + prefix, radical = path_glob.split("**", 1) + if prefix == "": + prefix = "." + if radical == "": + radical = "*" else: # we support both - radical = radical.lstrip('/') - radical = radical.lstrip('\\') + radical = radical.lstrip("/") + radical = radical.lstrip("\\") for path, dir, files in os.walk(prefix): path = os.path.normpath(path) for fn in _iglob(os.path.join(path, radical)): yield fn -if ssl: - from .compat import (HTTPSHandler as BaseHTTPSHandler, match_hostname, - CertificateError) +if ssl: + from .compat import ( + HTTPSHandler as BaseHTTPSHandler, + match_hostname, + CertificateError, + ) -# -# HTTPSConnection which verifies certificates/matches domains -# + # + # HTTPSConnection which verifies certificates/matches domains + # class HTTPSConnection(httplib.HTTPSConnection): - ca_certs = None # set this to the path to the certs file (.pem) - check_domain = True # only used if ca_certs is not None + ca_certs = None # set this to the path to the certs file (.pem) + check_domain = True # only used if ca_certs is not None # noinspection PyPropertyAccess def connect(self): sock = socket.create_connection((self.host, self.port), self.timeout) - if getattr(self, '_tunnel_host', False): + if getattr(self, "_tunnel_host", False): self.sock = sock self._tunnel() - if not hasattr(ssl, 'SSLContext'): + if not hasattr(ssl, "SSLContext"): # For 2.x if self.ca_certs: cert_reqs = ssl.CERT_REQUIRED else: cert_reqs = ssl.CERT_NONE - self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, - cert_reqs=cert_reqs, - ssl_version=ssl.PROTOCOL_SSLv23, - ca_certs=self.ca_certs) + self.sock = ssl.wrap_socket( + sock, + self.key_file, + self.cert_file, + cert_reqs=cert_reqs, + ssl_version=ssl.PROTOCOL_SSLv23, + ca_certs=self.ca_certs, + ) else: # pragma: no cover context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - if hasattr(ssl, 'OP_NO_SSLv2'): + if hasattr(ssl, "OP_NO_SSLv2"): context.options |= ssl.OP_NO_SSLv2 if self.cert_file: context.load_cert_chain(self.cert_file, self.key_file) @@ -1446,13 +1514,13 @@ def connect(self): if self.ca_certs: context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(cafile=self.ca_certs) - if getattr(ssl, 'HAS_SNI', False): - kwargs['server_hostname'] = self.host + if getattr(ssl, "HAS_SNI", False): + kwargs["server_hostname"] = self.host self.sock = context.wrap_socket(sock, **kwargs) if self.ca_certs and self.check_domain: try: match_hostname(self.sock.getpeercert(), self.host) - logger.debug('Host verified: %s', self.host) + logger.debug("Host verified: %s", self.host) except CertificateError: # pragma: no cover self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() @@ -1484,9 +1552,10 @@ def https_open(self, req): try: return self.do_open(self._conn_maker, req) except URLError as e: - if 'certificate verify failed' in str(e.reason): - raise CertificateError('Unable to verify server certificate ' - 'for %s' % req.host) + if "certificate verify failed" in str(e.reason): + raise CertificateError( + "Unable to verify server certificate " "for %s" % req.host + ) else: raise @@ -1501,8 +1570,11 @@ def https_open(self, req): # class HTTPSOnlyHandler(HTTPSHandler, HTTPHandler): def http_open(self, req): - raise URLError('Unexpected HTTP request on what should be a secure ' - 'connection: %s' % req) + raise URLError( + "Unexpected HTTP request on what should be a secure " + "connection: %s" % req + ) + # # XML-RPC with timeouts @@ -1511,17 +1583,18 @@ def http_open(self, req): _ver_info = sys.version_info[:2] if _ver_info == (2, 6): + class HTTP(httplib.HTTP): - def __init__(self, host='', port=None, **kwargs): - if port == 0: # 0 means use port 0, not the default port + def __init__(self, host="", port=None, **kwargs): + if port == 0: # 0 means use port 0, not the default port port = None self._setup(self._connection_class(host, port, **kwargs)) - if ssl: + class HTTPS(httplib.HTTPS): - def __init__(self, host='', port=None, **kwargs): - if port == 0: # 0 means use port 0, not the default port + def __init__(self, host="", port=None, **kwargs): + if port == 0: # 0 means use port 0, not the default port port = None self._setup(self._connection_class(host, port, **kwargs)) @@ -1542,7 +1615,9 @@ def make_connection(self, host): result = self._connection[1] return result + if ssl: + class SafeTransport(xmlrpclib.SafeTransport): def __init__(self, timeout, use_datetime=0): self.timeout = timeout @@ -1552,55 +1627,56 @@ def make_connection(self, host): h, eh, kwargs = self.get_host_info(host) if not kwargs: kwargs = {} - kwargs['timeout'] = self.timeout + kwargs["timeout"] = self.timeout if _ver_info == (2, 6): result = HTTPS(host, None, **kwargs) else: if not self._connection or host != self._connection[0]: self._extra_headers = eh - self._connection = host, httplib.HTTPSConnection(h, None, - **kwargs) + self._connection = host, httplib.HTTPSConnection(h, None, **kwargs) result = self._connection[1] return result class ServerProxy(xmlrpclib.ServerProxy): def __init__(self, uri, **kwargs): - self.timeout = timeout = kwargs.pop('timeout', None) + self.timeout = timeout = kwargs.pop("timeout", None) # The above classes only come into play if a timeout # is specified if timeout is not None: scheme, _ = splittype(uri) - use_datetime = kwargs.get('use_datetime', 0) - if scheme == 'https': + use_datetime = kwargs.get("use_datetime", 0) + if scheme == "https": tcls = SafeTransport else: tcls = Transport - kwargs['transport'] = t = tcls(timeout, use_datetime=use_datetime) + kwargs["transport"] = t = tcls(timeout, use_datetime=use_datetime) self.transport = t xmlrpclib.ServerProxy.__init__(self, uri, **kwargs) + # # CSV functionality. This is provided because on 2.x, the csv module can't # handle Unicode. However, we need to deal with Unicode in e.g. RECORD files. # + def _csv_open(fn, mode, **kwargs): if sys.version_info[0] < 3: - mode += 'b' + mode += "b" else: - kwargs['newline'] = '' + kwargs["newline"] = "" # Python 3 determines encoding from locale. Force 'utf-8' # file encoding to match other forced utf-8 encoding - kwargs['encoding'] = 'utf-8' + kwargs["encoding"] = "utf-8" return open(fn, mode, **kwargs) class CSVBase(object): defaults = { - 'delimiter': str(','), # The strs are used because we need native - 'quotechar': str('"'), # str in the csv API (2.x won't take - 'lineterminator': str('\n') # Unicode) + "delimiter": str(","), # The strs are used because we need native + "quotechar": str('"'), # str in the csv API (2.x won't take + "lineterminator": str("\n"), # Unicode) } def __enter__(self): @@ -1612,14 +1688,14 @@ def __exit__(self, *exc_info): class CSVReader(CSVBase): def __init__(self, **kwargs): - if 'stream' in kwargs: - stream = kwargs['stream'] + if "stream" in kwargs: + stream = kwargs["stream"] if sys.version_info[0] >= 3: # needs to be a text stream - stream = codecs.getreader('utf-8')(stream) + stream = codecs.getreader("utf-8")(stream) self.stream = stream else: - self.stream = _csv_open(kwargs['path'], 'r') + self.stream = _csv_open(kwargs["path"], "r") self.reader = csv.reader(self.stream, **self.defaults) def __iter__(self): @@ -1630,14 +1706,15 @@ def next(self): if sys.version_info[0] < 3: for i, item in enumerate(result): if not isinstance(item, text_type): - result[i] = item.decode('utf-8') + result[i] = item.decode("utf-8") return result __next__ = next + class CSVWriter(CSVBase): def __init__(self, fn, **kwargs): - self.stream = _csv_open(fn, 'w') + self.stream = _csv_open(fn, "w") self.writer = csv.writer(self.stream, **self.defaults) def writerow(self, row): @@ -1645,19 +1722,21 @@ def writerow(self, row): r = [] for item in row: if isinstance(item, text_type): - item = item.encode('utf-8') + item = item.encode("utf-8") r.append(item) row = r self.writer.writerow(row) + # # Configurator functionality # + class Configurator(BaseConfigurator): value_converters = dict(BaseConfigurator.value_converters) - value_converters['inc'] = 'inc_convert' + value_converters["inc"] = "inc_convert" def __init__(self, config, base=None): super(Configurator, self).__init__(config) @@ -1668,7 +1747,7 @@ def convert(o): if isinstance(o, (list, tuple)): result = type(o)([convert(i) for i in o]) elif isinstance(o, dict): - if '()' in o: + if "()" in o: result = self.configure_custom(o) else: result = {} @@ -1678,12 +1757,12 @@ def convert(o): result = self.convert(o) return result - c = config.pop('()') + c = config.pop("()") if not callable(c): c = self.resolve(c) - props = config.pop('.', None) + props = config.pop(".", None) # Check for valid identifiers - args = config.pop('[]', ()) + args = config.pop("[]", ()) if args: args = tuple([convert(o) for o in args]) items = [(k, convert(config[k])) for k in config if valid_ident(k)] @@ -1696,7 +1775,7 @@ def convert(o): def __getitem__(self, key): result = self.config[key] - if isinstance(result, dict) and '()' in result: + if isinstance(result, dict) and "()" in result: self.config[key] = result = self.configure_custom(result) return result @@ -1704,7 +1783,7 @@ def inc_convert(self, value): """Default converter for the inc:// protocol.""" if not os.path.isabs(value): value = os.path.join(self.base, value) - with codecs.open(value, 'r', encoding='utf-8') as f: + with codecs.open(value, "r", encoding="utf-8") as f: result = json.load(f) return result @@ -1713,6 +1792,7 @@ class SubprocessMixin(object): """ Mixin for running subprocesses and capturing their output """ + def __init__(self, verbose=False, progress=None): self.verbose = verbose self.progress = progress @@ -1732,30 +1812,31 @@ def reader(self, stream, context): progress(s, context) else: if not verbose: - sys.stderr.write('.') + sys.stderr.write(".") else: - sys.stderr.write(s.decode('utf-8')) + sys.stderr.write(s.decode("utf-8")) sys.stderr.flush() stream.close() def run_command(self, cmd, **kwargs): - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, **kwargs) - t1 = threading.Thread(target=self.reader, args=(p.stdout, 'stdout')) + p = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs + ) + t1 = threading.Thread(target=self.reader, args=(p.stdout, "stdout")) t1.start() - t2 = threading.Thread(target=self.reader, args=(p.stderr, 'stderr')) + t2 = threading.Thread(target=self.reader, args=(p.stderr, "stderr")) t2.start() p.wait() t1.join() t2.join() if self.progress is not None: - self.progress('done.', 'main') + self.progress("done.", "main") elif self.verbose: - sys.stderr.write('done.\n') + sys.stderr.write("done.\n") return p def normalize_name(name): """Normalize a python package name a la PEP 503""" # https://www.python.org/dev/peps/pep-0503/#normalized-names - return re.sub('[-_.]+', '-', name).lower() + return re.sub("[-_.]+", "-", name).lower() diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/version.py b/src/fetchcode/vcs/pip/_vendor/distlib/version.py index 3eebe18e..b39167d8 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/version.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/version.py @@ -14,16 +14,23 @@ from .compat import string_types from .util import parse_requirement -__all__ = ['NormalizedVersion', 'NormalizedMatcher', - 'LegacyVersion', 'LegacyMatcher', - 'SemanticVersion', 'SemanticMatcher', - 'UnsupportedVersionError', 'get_scheme'] +__all__ = [ + "NormalizedVersion", + "NormalizedMatcher", + "LegacyVersion", + "LegacyMatcher", + "SemanticVersion", + "SemanticMatcher", + "UnsupportedVersionError", + "get_scheme", +] logger = logging.getLogger(__name__) class UnsupportedVersionError(ValueError): """This is an unsupported version.""" + pass @@ -35,11 +42,11 @@ def __init__(self, s): assert len(parts) > 0 def parse(self, s): - raise NotImplementedError('please implement in a subclass') + raise NotImplementedError("please implement in a subclass") def _check_compatible(self, other): if type(self) != type(other): - raise TypeError('cannot compare %r and %r' % (self, other)) + raise TypeError("cannot compare %r and %r" % (self, other)) def __eq__(self, other): self._check_compatible(other) @@ -73,7 +80,7 @@ def __str__(self): @property def is_prerelease(self): - raise NotImplementedError('Please implement in subclasses.') + raise NotImplementedError("Please implement in subclasses.") class Matcher(object): @@ -81,15 +88,15 @@ class Matcher(object): # value is either a callable or the name of a method _operators = { - '<': lambda v, c, p: v < c, - '>': lambda v, c, p: v > c, - '<=': lambda v, c, p: v == c or v < c, - '>=': lambda v, c, p: v == c or v > c, - '==': lambda v, c, p: v == c, - '===': lambda v, c, p: v == c, + "<": lambda v, c, p: v < c, + ">": lambda v, c, p: v > c, + "<=": lambda v, c, p: v == c or v < c, + ">=": lambda v, c, p: v == c or v > c, + "==": lambda v, c, p: v == c, + "===": lambda v, c, p: v == c, # by default, compatible => >=. - '~=': lambda v, c, p: v == c or v > c, - '!=': lambda v, c, p: v != c, + "~=": lambda v, c, p: v == c or v > c, + "!=": lambda v, c, p: v != c, } # this is a method only to support alternative implementations @@ -99,21 +106,20 @@ def parse_requirement(self, s): def __init__(self, s): if self.version_class is None: - raise ValueError('Please specify a version class') + raise ValueError("Please specify a version class") self._string = s = s.strip() r = self.parse_requirement(s) if not r: - raise ValueError('Not valid: %r' % s) + raise ValueError("Not valid: %r" % s) self.name = r.name - self.key = self.name.lower() # for case-insensitive comparisons + self.key = self.name.lower() # for case-insensitive comparisons clist = [] if r.constraints: # import pdb; pdb.set_trace() for op, s in r.constraints: - if s.endswith('.*'): - if op not in ('==', '!='): - raise ValueError('\'.*\' not allowed for ' - '%r constraints' % op) + if s.endswith(".*"): + if op not in ("==", "!="): + raise ValueError("'.*' not allowed for " "%r constraints" % op) # Could be a partial version (e.g. for '2.*') which # won't parse as a version, so keep it as a string vn, prefix = s[:-2], True @@ -140,8 +146,10 @@ def match(self, version): if isinstance(f, string_types): f = getattr(self, f) if not f: - msg = ('%r not implemented ' - 'for %s' % (operator, self.__class__.__name__)) + msg = "%r not implemented " "for %s" % ( + operator, + self.__class__.__name__, + ) raise NotImplementedError(msg) if not f(version, constraint, prefix): return False @@ -150,13 +158,13 @@ def match(self, version): @property def exact_version(self): result = None - if len(self._parts) == 1 and self._parts[0][0] in ('==', '==='): + if len(self._parts) == 1 and self._parts[0][0] in ("==", "==="): result = self._parts[0][1] return result def _check_compatible(self, other): if type(self) != type(other) or self.name != other.name: - raise TypeError('cannot compare %s and %s' % (self, other)) + raise TypeError("cannot compare %s and %s" % (self, other)) def __eq__(self, other): self._check_compatible(other) @@ -176,18 +184,20 @@ def __str__(self): return self._string -PEP440_VERSION_RE = re.compile(r'^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?' - r'(\.(post)(\d+))?(\.(dev)(\d+))?' - r'(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$') +PEP440_VERSION_RE = re.compile( + r"^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?" + r"(\.(post)(\d+))?(\.(dev)(\d+))?" + r"(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$" +) def _pep_440_key(s): s = s.strip() m = PEP440_VERSION_RE.match(s) if not m: - raise UnsupportedVersionError('Not a valid version: %s' % s) + raise UnsupportedVersionError("Not a valid version: %s" % s) groups = m.groups() - nums = tuple(int(v) for v in groups[1].split('.')) + nums = tuple(int(v) for v in groups[1].split(".")) while len(nums) > 1 and nums[-1] == 0: nums = nums[:-1] @@ -215,7 +225,7 @@ def _pep_440_key(s): local = () else: parts = [] - for part in local.split('.'): + for part in local.split("."): # to ensure that numeric compares as > lexicographic, avoid # comparing them directly, but encode a tuple which ensures # correct sorting @@ -229,16 +239,16 @@ def _pep_440_key(s): # either before pre-release, or final release and after if not post and dev: # before pre-release - pre = ('a', -1) # to sort before a0 + pre = ("a", -1) # to sort before a0 else: - pre = ('z',) # to sort after all pre-releases + pre = ("z",) # to sort after all pre-releases # now look at the state of post and dev. if not post: - post = ('_',) # sort before 'a' + post = ("_",) # sort before 'a' if not dev: - dev = ('final',) + dev = ("final",) - #print('%s -> %s' % (s, m.groups())) + # print('%s -> %s' % (s, m.groups())) return epoch, nums, pre, post, dev, local @@ -263,18 +273,19 @@ class NormalizedVersion(Version): 1.2a # release level must have a release serial 1.2.3b """ + def parse(self, s): result = _normalized_key(s) # _normalized_key loses trailing zeroes in the release # clause, since that's needed to ensure that X.Y == X.Y.0 == X.Y.0.0 # However, PEP 440 prefix matching needs it: for example, # (~= 1.4.5.0) matches differently to (~= 1.4.5.0.0). - m = PEP440_VERSION_RE.match(s) # must succeed + m = PEP440_VERSION_RE.match(s) # must succeed groups = m.groups() - self._release_clause = tuple(int(v) for v in groups[1].split('.')) + self._release_clause = tuple(int(v) for v in groups[1].split(".")) return result - PREREL_TAGS = set(['a', 'b', 'c', 'rc', 'dev']) + PREREL_TAGS = set(["a", "b", "c", "rc", "dev"]) @property def is_prerelease(self): @@ -289,7 +300,7 @@ def _match_prefix(x, y): if not x.startswith(y): return False n = len(y) - return x[n] == '.' + return x[n] == "." class NormalizedMatcher(Matcher): @@ -297,19 +308,19 @@ class NormalizedMatcher(Matcher): # value is either a callable or the name of a method _operators = { - '~=': '_match_compatible', - '<': '_match_lt', - '>': '_match_gt', - '<=': '_match_le', - '>=': '_match_ge', - '==': '_match_eq', - '===': '_match_arbitrary', - '!=': '_match_ne', + "~=": "_match_compatible", + "<": "_match_lt", + ">": "_match_gt", + "<=": "_match_le", + ">=": "_match_ge", + "==": "_match_eq", + "===": "_match_arbitrary", + "!=": "_match_ne", } def _adjust_local(self, version, constraint, prefix): if prefix: - strip_local = '+' not in constraint and version._parts[-1] + strip_local = "+" not in constraint and version._parts[-1] else: # both constraint and version are # NormalizedVersion instances. @@ -317,7 +328,7 @@ def _adjust_local(self, version, constraint, prefix): # ensure the version doesn't, either. strip_local = not constraint._parts[-1] and version._parts[-1] if strip_local: - s = version._string.split('+', 1)[0] + s = version._string.split("+", 1)[0] version = self.version_class(s) return version, constraint @@ -326,7 +337,7 @@ def _match_lt(self, version, constraint, prefix): if version >= constraint: return False release_clause = constraint._release_clause - pfx = '.'.join([str(i) for i in release_clause]) + pfx = ".".join([str(i) for i in release_clause]) return not _match_prefix(version, pfx) def _match_gt(self, version, constraint, prefix): @@ -334,7 +345,7 @@ def _match_gt(self, version, constraint, prefix): if version <= constraint: return False release_clause = constraint._release_clause - pfx = '.'.join([str(i) for i in release_clause]) + pfx = ".".join([str(i) for i in release_clause]) return not _match_prefix(version, pfx) def _match_le(self, version, constraint, prefix): @@ -348,7 +359,7 @@ def _match_ge(self, version, constraint, prefix): def _match_eq(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if not prefix: - result = (version == constraint) + result = version == constraint else: result = _match_prefix(version, constraint) return result @@ -359,7 +370,7 @@ def _match_arbitrary(self, version, constraint, prefix): def _match_ne(self, version, constraint, prefix): version, constraint = self._adjust_local(version, constraint, prefix) if not prefix: - result = (version != constraint) + result = version != constraint else: result = not _match_prefix(version, constraint) return result @@ -370,37 +381,37 @@ def _match_compatible(self, version, constraint, prefix): return True if version < constraint: return False -# if not prefix: -# return True + # if not prefix: + # return True release_clause = constraint._release_clause if len(release_clause) > 1: release_clause = release_clause[:-1] - pfx = '.'.join([str(i) for i in release_clause]) + pfx = ".".join([str(i) for i in release_clause]) return _match_prefix(version, pfx) + _REPLACEMENTS = ( - (re.compile('[.+-]$'), ''), # remove trailing puncts - (re.compile(r'^[.](\d)'), r'0.\1'), # .N -> 0.N at start - (re.compile('^[.-]'), ''), # remove leading puncts - (re.compile(r'^\((.*)\)$'), r'\1'), # remove parentheses - (re.compile(r'^v(ersion)?\s*(\d+)'), r'\2'), # remove leading v(ersion) - (re.compile(r'^r(ev)?\s*(\d+)'), r'\2'), # remove leading v(ersion) - (re.compile('[.]{2,}'), '.'), # multiple runs of '.' - (re.compile(r'\b(alfa|apha)\b'), 'alpha'), # misspelt alpha - (re.compile(r'\b(pre-alpha|prealpha)\b'), - 'pre.alpha'), # standardise - (re.compile(r'\(beta\)$'), 'beta'), # remove parentheses + (re.compile("[.+-]$"), ""), # remove trailing puncts + (re.compile(r"^[.](\d)"), r"0.\1"), # .N -> 0.N at start + (re.compile("^[.-]"), ""), # remove leading puncts + (re.compile(r"^\((.*)\)$"), r"\1"), # remove parentheses + (re.compile(r"^v(ersion)?\s*(\d+)"), r"\2"), # remove leading v(ersion) + (re.compile(r"^r(ev)?\s*(\d+)"), r"\2"), # remove leading v(ersion) + (re.compile("[.]{2,}"), "."), # multiple runs of '.' + (re.compile(r"\b(alfa|apha)\b"), "alpha"), # misspelt alpha + (re.compile(r"\b(pre-alpha|prealpha)\b"), "pre.alpha"), # standardise + (re.compile(r"\(beta\)$"), "beta"), # remove parentheses ) _SUFFIX_REPLACEMENTS = ( - (re.compile('^[:~._+-]+'), ''), # remove leading puncts - (re.compile('[,*")([\\]]'), ''), # remove unwanted chars - (re.compile('[~:+_ -]'), '.'), # replace illegal chars - (re.compile('[.]{2,}'), '.'), # multiple runs of '.' - (re.compile(r'\.$'), ''), # trailing '.' + (re.compile("^[:~._+-]+"), ""), # remove leading puncts + (re.compile('[,*")([\\]]'), ""), # remove unwanted chars + (re.compile("[~:+_ -]"), "."), # replace illegal chars + (re.compile("[.]{2,}"), "."), # multiple runs of '.' + (re.compile(r"\.$"), ""), # trailing '.' ) -_NUMERIC_PREFIX = re.compile(r'(\d+(\.\d+)*)') +_NUMERIC_PREFIX = re.compile(r"(\d+(\.\d+)*)") def _suggest_semantic_version(s): @@ -412,29 +423,29 @@ def _suggest_semantic_version(s): for pat, repl in _REPLACEMENTS: result = pat.sub(repl, result) if not result: - result = '0.0.0' + result = "0.0.0" # Now look for numeric prefix, and separate it out from # the rest. - #import pdb; pdb.set_trace() + # import pdb; pdb.set_trace() m = _NUMERIC_PREFIX.match(result) if not m: - prefix = '0.0.0' + prefix = "0.0.0" suffix = result else: - prefix = m.groups()[0].split('.') + prefix = m.groups()[0].split(".") prefix = [int(i) for i in prefix] while len(prefix) < 3: prefix.append(0) if len(prefix) == 3: - suffix = result[m.end():] + suffix = result[m.end() :] else: - suffix = '.'.join([str(i) for i in prefix[3:]]) + result[m.end():] + suffix = ".".join([str(i) for i in prefix[3:]]) + result[m.end() :] prefix = prefix[:3] - prefix = '.'.join([str(i) for i in prefix]) + prefix = ".".join([str(i) for i in prefix]) suffix = suffix.strip() if suffix: - #import pdb; pdb.set_trace() + # import pdb; pdb.set_trace() # massage the suffix. for pat, repl in _SUFFIX_REPLACEMENTS: suffix = pat.sub(repl, suffix) @@ -442,7 +453,7 @@ def _suggest_semantic_version(s): if not suffix: result = prefix else: - sep = '-' if 'dev' in suffix else '+' + sep = "-" if "dev" in suffix else "+" result = prefix + sep + suffix if not is_semver(result): result = None @@ -468,19 +479,30 @@ def _suggest_normalized_version(s): """ try: _normalized_key(s) - return s # already rational + return s # already rational except UnsupportedVersionError: pass rs = s.lower() # part of this could use maketrans - for orig, repl in (('-alpha', 'a'), ('-beta', 'b'), ('alpha', 'a'), - ('beta', 'b'), ('rc', 'c'), ('-final', ''), - ('-pre', 'c'), - ('-release', ''), ('.release', ''), ('-stable', ''), - ('+', '.'), ('_', '.'), (' ', ''), ('.final', ''), - ('final', '')): + for orig, repl in ( + ("-alpha", "a"), + ("-beta", "b"), + ("alpha", "a"), + ("beta", "b"), + ("rc", "c"), + ("-final", ""), + ("-pre", "c"), + ("-release", ""), + (".release", ""), + ("-stable", ""), + ("+", "."), + ("_", "."), + (" ", ""), + (".final", ""), + ("final", ""), + ): rs = rs.replace(orig, repl) # if something ends with dev or pre, we add a 0 @@ -500,11 +522,11 @@ def _suggest_normalized_version(s): rs = re.sub(r"[.~]?([abc])\.?", r"\1", rs) # Clean: v0.3, v1.0 - if rs.startswith('v'): + if rs.startswith("v"): rs = rs[1:] # Clean leading '0's on numbers. - #TODO: unintended side-effect on, e.g., "2003.05.09" + # TODO: unintended side-effect on, e.g., "2003.05.09" # PyPI stats: 77 (~2%) better rs = re.sub(r"\b0+(\d+)(?!\d)", r"\1", rs) @@ -559,19 +581,20 @@ def _suggest_normalized_version(s): rs = None return rs + # # Legacy version processing (distribute-compatible) # -_VERSION_PART = re.compile(r'([a-z]+|\d+|[\.-])', re.I) +_VERSION_PART = re.compile(r"([a-z]+|\d+|[\.-])", re.I) _VERSION_REPLACE = { - 'pre': 'c', - 'preview': 'c', - '-': 'final-', - 'rc': 'c', - 'dev': '@', - '': None, - '.': None, + "pre": "c", + "preview": "c", + "-": "final-", + "rc": "c", + "dev": "@", + "": None, + ".": None, } @@ -581,21 +604,21 @@ def get_parts(s): for p in _VERSION_PART.split(s.lower()): p = _VERSION_REPLACE.get(p, p) if p: - if '0' <= p[:1] <= '9': + if "0" <= p[:1] <= "9": p = p.zfill(8) else: - p = '*' + p + p = "*" + p result.append(p) - result.append('*final') + result.append("*final") return result result = [] for p in get_parts(s): - if p.startswith('*'): - if p < '*final': - while result and result[-1] == '*final-': + if p.startswith("*"): + if p < "*final": + while result and result[-1] == "*final-": result.pop() - while result and result[-1] == '00000000': + while result and result[-1] == "00000000": result.pop() result.append(p) return tuple(result) @@ -609,8 +632,7 @@ def parse(self, s): def is_prerelease(self): result = False for x in self._parts: - if (isinstance(x, string_types) and x.startswith('*') and - x < '*final'): + if isinstance(x, string_types) and x.startswith("*") and x < "*final": result = True break return result @@ -620,30 +642,37 @@ class LegacyMatcher(Matcher): version_class = LegacyVersion _operators = dict(Matcher._operators) - _operators['~='] = '_match_compatible' + _operators["~="] = "_match_compatible" - numeric_re = re.compile(r'^(\d+(\.\d+)*)') + numeric_re = re.compile(r"^(\d+(\.\d+)*)") def _match_compatible(self, version, constraint, prefix): if version < constraint: return False m = self.numeric_re.match(str(constraint)) if not m: - logger.warning('Cannot compute compatible match for version %s ' - ' and constraint %s', version, constraint) + logger.warning( + "Cannot compute compatible match for version %s " " and constraint %s", + version, + constraint, + ) return True s = m.groups()[0] - if '.' in s: - s = s.rsplit('.', 1)[0] + if "." in s: + s = s.rsplit(".", 1)[0] return _match_prefix(version, s) + # # Semantic versioning # -_SEMVER_RE = re.compile(r'^(\d+)\.(\d+)\.(\d+)' - r'(-[a-z0-9]+(\.[a-z0-9-]+)*)?' - r'(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$', re.I) +_SEMVER_RE = re.compile( + r"^(\d+)\.(\d+)\.(\d+)" + r"(-[a-z0-9]+(\.[a-z0-9-]+)*)?" + r"(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$", + re.I, +) def is_semver(s): @@ -655,7 +684,7 @@ def make_tuple(s, absent): if s is None: result = (absent,) else: - parts = s[1:].split('.') + parts = s[1:].split(".") # We can't compare ints and strings on Python 3, so fudge it # by zero-filling numeric values so simulate a numeric comparison result = tuple([p.zfill(8) if p.isdigit() else p for p in parts]) @@ -667,7 +696,7 @@ def make_tuple(s, absent): groups = m.groups() major, minor, patch = [int(i) for i in groups[:3]] # choose the '|' and '*' so that versions sort correctly - pre, build = make_tuple(groups[3], '|'), make_tuple(groups[5], '*') + pre, build = make_tuple(groups[3], "|"), make_tuple(groups[5], "*") return (major, minor, patch), pre, build @@ -677,7 +706,7 @@ def parse(self, s): @property def is_prerelease(self): - return self._parts[1][0] != '|' + return self._parts[1][0] != "|" class SemanticMatcher(Matcher): @@ -710,7 +739,7 @@ def is_valid_constraint_list(self, s): """ Used for processing some metadata fields """ - return self.is_valid_matcher('dummy_name (%s)' % s) + return self.is_valid_matcher("dummy_name (%s)" % s) def suggest(self, s): if self.suggester is None: @@ -719,18 +748,21 @@ def suggest(self, s): result = self.suggester(s) return result + _SCHEMES = { - 'normalized': VersionScheme(_normalized_key, NormalizedMatcher, - _suggest_normalized_version), - 'legacy': VersionScheme(_legacy_key, LegacyMatcher, lambda self, s: s), - 'semantic': VersionScheme(_semantic_key, SemanticMatcher, - _suggest_semantic_version), + "normalized": VersionScheme( + _normalized_key, NormalizedMatcher, _suggest_normalized_version + ), + "legacy": VersionScheme(_legacy_key, LegacyMatcher, lambda self, s: s), + "semantic": VersionScheme( + _semantic_key, SemanticMatcher, _suggest_semantic_version + ), } -_SCHEMES['default'] = _SCHEMES['normalized'] +_SCHEMES["default"] = _SCHEMES["normalized"] def get_scheme(name): if name not in _SCHEMES: - raise ValueError('unknown scheme name: %r' % name) + raise ValueError("unknown scheme name: %r" % name) return _SCHEMES[name] diff --git a/src/fetchcode/vcs/pip/_vendor/distlib/wheel.py b/src/fetchcode/vcs/pip/_vendor/distlib/wheel.py index d966bf3a..2458c192 100644 --- a/src/fetchcode/vcs/pip/_vendor/distlib/wheel.py +++ b/src/fetchcode/vcs/pip/_vendor/distlib/wheel.py @@ -26,48 +26,60 @@ from .compat import sysconfig, ZipFile, fsdecode, text_type, filter from .database import InstalledDistribution from .metadata import Metadata, METADATA_FILENAME, WHEEL_METADATA_FILENAME -from .util import (FileOperator, convert_path, CSVReader, CSVWriter, Cache, - cached_property, get_cache_base, read_exports, tempdir) +from .util import ( + FileOperator, + convert_path, + CSVReader, + CSVWriter, + Cache, + cached_property, + get_cache_base, + read_exports, + tempdir, +) from .version import NormalizedVersion, UnsupportedVersionError logger = logging.getLogger(__name__) -cache = None # created when needed +cache = None # created when needed -if hasattr(sys, 'pypy_version_info'): # pragma: no cover - IMP_PREFIX = 'pp' -elif sys.platform.startswith('java'): # pragma: no cover - IMP_PREFIX = 'jy' -elif sys.platform == 'cli': # pragma: no cover - IMP_PREFIX = 'ip' +if hasattr(sys, "pypy_version_info"): # pragma: no cover + IMP_PREFIX = "pp" +elif sys.platform.startswith("java"): # pragma: no cover + IMP_PREFIX = "jy" +elif sys.platform == "cli": # pragma: no cover + IMP_PREFIX = "ip" else: - IMP_PREFIX = 'cp' + IMP_PREFIX = "cp" -VER_SUFFIX = sysconfig.get_config_var('py_version_nodot') -if not VER_SUFFIX: # pragma: no cover - VER_SUFFIX = '%s%s' % sys.version_info[:2] -PYVER = 'py' + VER_SUFFIX +VER_SUFFIX = sysconfig.get_config_var("py_version_nodot") +if not VER_SUFFIX: # pragma: no cover + VER_SUFFIX = "%s%s" % sys.version_info[:2] +PYVER = "py" + VER_SUFFIX IMPVER = IMP_PREFIX + VER_SUFFIX -ARCH = distutils.util.get_platform().replace('-', '_').replace('.', '_') +ARCH = distutils.util.get_platform().replace("-", "_").replace(".", "_") -ABI = sysconfig.get_config_var('SOABI') -if ABI and ABI.startswith('cpython-'): - ABI = ABI.replace('cpython-', 'cp') +ABI = sysconfig.get_config_var("SOABI") +if ABI and ABI.startswith("cpython-"): + ABI = ABI.replace("cpython-", "cp") else: + def _derive_abi(): - parts = ['cp', VER_SUFFIX] - if sysconfig.get_config_var('Py_DEBUG'): - parts.append('d') - if sysconfig.get_config_var('WITH_PYMALLOC'): - parts.append('m') - if sysconfig.get_config_var('Py_UNICODE_SIZE') == 4: - parts.append('u') - return ''.join(parts) + parts = ["cp", VER_SUFFIX] + if sysconfig.get_config_var("Py_DEBUG"): + parts.append("d") + if sysconfig.get_config_var("WITH_PYMALLOC"): + parts.append("m") + if sysconfig.get_config_var("Py_UNICODE_SIZE") == 4: + parts.append("u") + return "".join(parts) + ABI = _derive_abi() del _derive_abi -FILENAME_RE = re.compile(r''' +FILENAME_RE = re.compile( + r""" (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))? @@ -75,23 +87,28 @@ def _derive_abi(): -(?P\w+) -(?P\w+(\.\w+)*) \.whl$ -''', re.IGNORECASE | re.VERBOSE) +""", + re.IGNORECASE | re.VERBOSE, +) -NAME_VERSION_RE = re.compile(r''' +NAME_VERSION_RE = re.compile( + r""" (?P[^-]+) -(?P\d+[^-]*) (-(?P\d+[^-]*))?$ -''', re.IGNORECASE | re.VERBOSE) +""", + re.IGNORECASE | re.VERBOSE, +) -SHEBANG_RE = re.compile(br'\s*#![^\r\n]*') -SHEBANG_DETAIL_RE = re.compile(br'^(\s*#!("[^"]+"|\S+))\s+(.*)$') -SHEBANG_PYTHON = b'#!python' -SHEBANG_PYTHONW = b'#!pythonw' +SHEBANG_RE = re.compile(rb"\s*#![^\r\n]*") +SHEBANG_DETAIL_RE = re.compile(rb'^(\s*#!("[^"]+"|\S+))\s+(.*)$') +SHEBANG_PYTHON = b"#!python" +SHEBANG_PYTHONW = b"#!pythonw" -if os.sep == '/': +if os.sep == "/": to_posix = lambda o: o else: - to_posix = lambda o: o.replace(os.sep, '/') + to_posix = lambda o: o.replace(os.sep, "/") class Mounter(object): @@ -121,14 +138,15 @@ def load_module(self, fullname): result = sys.modules[fullname] else: if fullname not in self.libs: - raise ImportError('unable to find extension for %s' % fullname) + raise ImportError("unable to find extension for %s" % fullname) result = imp.load_dynamic(fullname, self.libs[fullname]) result.__loader__ = self - parts = fullname.rsplit('.', 1) + parts = fullname.rsplit(".", 1) if len(parts) > 1: result.__package__ = parts[0] return result + _hook = Mounter() @@ -138,7 +156,7 @@ class Wheel(object): """ wheel_version = (1, 1) - hash_kind = 'sha256' + hash_kind = "sha256" def __init__(self, filename=None, sign=False, verify=False): """ @@ -146,40 +164,39 @@ def __init__(self, filename=None, sign=False, verify=False): """ self.sign = sign self.should_verify = verify - self.buildver = '' + self.buildver = "" self.pyver = [PYVER] - self.abi = ['none'] - self.arch = ['any'] + self.abi = ["none"] + self.arch = ["any"] self.dirname = os.getcwd() if filename is None: - self.name = 'dummy' - self.version = '0.1' + self.name = "dummy" + self.version = "0.1" self._filename = self.filename else: m = NAME_VERSION_RE.match(filename) if m: - info = m.groupdict('') - self.name = info['nm'] + info = m.groupdict("") + self.name = info["nm"] # Reinstate the local version separator - self.version = info['vn'].replace('_', '-') - self.buildver = info['bn'] + self.version = info["vn"].replace("_", "-") + self.buildver = info["bn"] self._filename = self.filename else: dirname, filename = os.path.split(filename) m = FILENAME_RE.match(filename) if not m: - raise DistlibException('Invalid name or ' - 'filename: %r' % filename) + raise DistlibException("Invalid name or " "filename: %r" % filename) if dirname: self.dirname = os.path.abspath(dirname) self._filename = filename - info = m.groupdict('') - self.name = info['nm'] - self.version = info['vn'] - self.buildver = info['bn'] - self.pyver = info['py'].split('.') - self.abi = info['bi'].split('.') - self.arch = info['ar'].split('.') + info = m.groupdict("") + self.name = info["nm"] + self.version = info["vn"] + self.buildver = info["bn"] + self.pyver = info["py"].split(".") + self.abi = info["bi"].split(".") + self.arch = info["ar"].split(".") @property def filename(self): @@ -187,16 +204,15 @@ def filename(self): Build and return a filename from the various components. """ if self.buildver: - buildver = '-' + self.buildver + buildver = "-" + self.buildver else: - buildver = '' - pyver = '.'.join(self.pyver) - abi = '.'.join(self.abi) - arch = '.'.join(self.arch) + buildver = "" + pyver = ".".join(self.pyver) + abi = ".".join(self.abi) + arch = ".".join(self.arch) # replace - with _ as a local version separator - version = self.version.replace('-', '_') - return '%s-%s%s-%s-%s-%s.whl' % (self.name, version, buildver, - pyver, abi, arch) + version = self.version.replace("-", "_") + return "%s-%s%s-%s-%s-%s.whl" % (self.name, version, buildver, pyver, abi, arch) @property def exists(self): @@ -213,15 +229,15 @@ def tags(self): @cached_property def metadata(self): pathname = os.path.join(self.dirname, self.filename) - name_ver = '%s-%s' % (self.name, self.version) - info_dir = '%s.dist-info' % name_ver - wrapper = codecs.getreader('utf-8') - with ZipFile(pathname, 'r') as zf: + name_ver = "%s-%s" % (self.name, self.version) + info_dir = "%s.dist-info" % name_ver + wrapper = codecs.getreader("utf-8") + with ZipFile(pathname, "r") as zf: wheel_metadata = self.get_wheel_metadata(zf) - wv = wheel_metadata['Wheel-Version'].split('.', 1) + wv = wheel_metadata["Wheel-Version"].split(".", 1) file_version = tuple([int(i) for i in wv]) if file_version < (1, 1): - fns = [WHEEL_METADATA_FILENAME, METADATA_FILENAME, 'METADATA'] + fns = [WHEEL_METADATA_FILENAME, METADATA_FILENAME, "METADATA"] else: fns = [WHEEL_METADATA_FILENAME, METADATA_FILENAME] result = None @@ -236,23 +252,25 @@ def metadata(self): except KeyError: pass if not result: - raise ValueError('Invalid wheel, because metadata is ' - 'missing: looked in %s' % ', '.join(fns)) + raise ValueError( + "Invalid wheel, because metadata is " + "missing: looked in %s" % ", ".join(fns) + ) return result def get_wheel_metadata(self, zf): - name_ver = '%s-%s' % (self.name, self.version) - info_dir = '%s.dist-info' % name_ver - metadata_filename = posixpath.join(info_dir, 'WHEEL') + name_ver = "%s-%s" % (self.name, self.version) + info_dir = "%s.dist-info" % name_ver + metadata_filename = posixpath.join(info_dir, "WHEEL") with zf.open(metadata_filename) as bf: - wf = codecs.getreader('utf-8')(bf) + wf = codecs.getreader("utf-8")(bf) message = message_from_file(wf) return dict(message) @cached_property def info(self): pathname = os.path.join(self.dirname, self.filename) - with ZipFile(pathname, 'r') as zf: + with ZipFile(pathname, "r") as zf: result = self.get_wheel_metadata(zf) return result @@ -262,27 +280,27 @@ def process_shebang(self, data): end = m.end() shebang, data_after_shebang = data[:end], data[end:] # Preserve any arguments after the interpreter - if b'pythonw' in shebang.lower(): + if b"pythonw" in shebang.lower(): shebang_python = SHEBANG_PYTHONW else: shebang_python = SHEBANG_PYTHON m = SHEBANG_DETAIL_RE.match(shebang) if m: - args = b' ' + m.groups()[-1] + args = b" " + m.groups()[-1] else: - args = b'' + args = b"" shebang = shebang_python + args data = shebang + data_after_shebang else: - cr = data.find(b'\r') - lf = data.find(b'\n') + cr = data.find(b"\r") + lf = data.find(b"\n") if cr < 0 or cr > lf: - term = b'\n' + term = b"\n" else: - if data[cr:cr + 2] == b'\r\n': - term = b'\r\n' + if data[cr : cr + 2] == b"\r\n": + term = b"\r\n" else: - term = b'\r' + term = b"\r" data = SHEBANG_PYTHON + term + data return data @@ -292,15 +310,15 @@ def get_hash(self, data, hash_kind=None): try: hasher = getattr(hashlib, hash_kind) except AttributeError: - raise DistlibException('Unsupported hash algorithm: %r' % hash_kind) + raise DistlibException("Unsupported hash algorithm: %r" % hash_kind) result = hasher(data).digest() - result = base64.urlsafe_b64encode(result).rstrip(b'=').decode('ascii') + result = base64.urlsafe_b64encode(result).rstrip(b"=").decode("ascii") return hash_kind, result def write_record(self, records, record_path, base): - records = list(records) # make a copy for sorting + records = list(records) # make a copy for sorting p = to_posix(os.path.relpath(record_path, base)) - records.append((p, '', '')) + records.append((p, "", "")) records.sort() with CSVWriter(record_path) as writer: for row in records: @@ -311,21 +329,21 @@ def write_records(self, info, libdir, archive_paths): distinfo, info_dir = info hasher = getattr(hashlib, self.hash_kind) for ap, p in archive_paths: - with open(p, 'rb') as f: + with open(p, "rb") as f: data = f.read() - digest = '%s=%s' % self.get_hash(data) + digest = "%s=%s" % self.get_hash(data) size = os.path.getsize(p) records.append((ap, digest, size)) - p = os.path.join(distinfo, 'RECORD') + p = os.path.join(distinfo, "RECORD") self.write_record(records, p, libdir) - ap = to_posix(os.path.join(info_dir, 'RECORD')) + ap = to_posix(os.path.join(info_dir, "RECORD")) archive_paths.append((ap, p)) def build_zip(self, pathname, archive_paths): - with ZipFile(pathname, 'w', zipfile.ZIP_DEFLATED) as zf: + with ZipFile(pathname, "w", zipfile.ZIP_DEFLATED) as zf: for ap, p in archive_paths: - logger.debug('Wrote %s to %s in wheel', p, ap) + logger.debug("Wrote %s to %s in wheel", p, ap) zf.write(p, ap) def build(self, paths, tags=None, wheel_version=None): @@ -336,32 +354,32 @@ def build(self, paths, tags=None, wheel_version=None): if tags is None: tags = {} - libkey = list(filter(lambda o: o in paths, ('purelib', 'platlib')))[0] - if libkey == 'platlib': - is_pure = 'false' + libkey = list(filter(lambda o: o in paths, ("purelib", "platlib")))[0] + if libkey == "platlib": + is_pure = "false" default_pyver = [IMPVER] default_abi = [ABI] default_arch = [ARCH] else: - is_pure = 'true' + is_pure = "true" default_pyver = [PYVER] - default_abi = ['none'] - default_arch = ['any'] + default_abi = ["none"] + default_arch = ["any"] - self.pyver = tags.get('pyver', default_pyver) - self.abi = tags.get('abi', default_abi) - self.arch = tags.get('arch', default_arch) + self.pyver = tags.get("pyver", default_pyver) + self.abi = tags.get("abi", default_abi) + self.arch = tags.get("arch", default_arch) libdir = paths[libkey] - name_ver = '%s-%s' % (self.name, self.version) - data_dir = '%s.data' % name_ver - info_dir = '%s.dist-info' % name_ver + name_ver = "%s-%s" % (self.name, self.version) + data_dir = "%s.data" % name_ver + info_dir = "%s.dist-info" % name_ver archive_paths = [] # First, stuff which is not in site-packages - for key in ('data', 'headers', 'scripts'): + for key in ("data", "headers", "scripts"): if key not in paths: continue path = paths[key] @@ -372,11 +390,11 @@ def build(self, paths, tags=None, wheel_version=None): rp = os.path.relpath(p, path) ap = to_posix(os.path.join(data_dir, key, rp)) archive_paths.append((ap, p)) - if key == 'scripts' and not p.endswith('.exe'): - with open(p, 'rb') as f: + if key == "scripts" and not p.endswith(".exe"): + with open(p, "rb") as f: data = f.read() data = self.process_shebang(data) - with open(p, 'wb') as f: + with open(p, "wb") as f: f.write(data) # Now, stuff which is in site-packages, other than the @@ -389,15 +407,15 @@ def build(self, paths, tags=None, wheel_version=None): # and skip it for now for i, dn in enumerate(dirs): dn = fsdecode(dn) - if dn.endswith('.dist-info'): + if dn.endswith(".dist-info"): distinfo = os.path.join(root, dn) del dirs[i] break - assert distinfo, '.dist-info directory expected, not found' + assert distinfo, ".dist-info directory expected, not found" for fn in files: # comment out next suite to leave .pyc files in - if fsdecode(fn).endswith(('.pyc', '.pyo')): + if fsdecode(fn).endswith((".pyc", ".pyo")): continue p = os.path.join(root, fn) rp = to_posix(os.path.relpath(p, path)) @@ -406,22 +424,22 @@ def build(self, paths, tags=None, wheel_version=None): # Now distinfo. Assumed to be flat, i.e. os.listdir is enough. files = os.listdir(distinfo) for fn in files: - if fn not in ('RECORD', 'INSTALLER', 'SHARED', 'WHEEL'): + if fn not in ("RECORD", "INSTALLER", "SHARED", "WHEEL"): p = fsdecode(os.path.join(distinfo, fn)) ap = to_posix(os.path.join(info_dir, fn)) archive_paths.append((ap, p)) wheel_metadata = [ - 'Wheel-Version: %d.%d' % (wheel_version or self.wheel_version), - 'Generator: distlib %s' % __version__, - 'Root-Is-Purelib: %s' % is_pure, + "Wheel-Version: %d.%d" % (wheel_version or self.wheel_version), + "Generator: distlib %s" % __version__, + "Root-Is-Purelib: %s" % is_pure, ] for pyver, abi, arch in self.tags: - wheel_metadata.append('Tag: %s-%s-%s' % (pyver, abi, arch)) - p = os.path.join(distinfo, 'WHEEL') - with open(p, 'w') as f: - f.write('\n'.join(wheel_metadata)) - ap = to_posix(os.path.join(info_dir, 'WHEEL')) + wheel_metadata.append("Tag: %s-%s-%s" % (pyver, abi, arch)) + p = os.path.join(distinfo, "WHEEL") + with open(p, "w") as f: + f.write("\n".join(wheel_metadata)) + ap = to_posix(os.path.join(info_dir, "WHEEL")) archive_paths.append((ap, p)) # Now, at last, RECORD. @@ -446,7 +464,7 @@ def skip_entry(self, arcname): # https://github.com/pypa/wheel/issues/287 # https://github.com/pypa/wheel/pull/289 # - return arcname.endswith(('/', '/RECORD.jws')) + return arcname.endswith(("/", "/RECORD.jws")) def install(self, paths, maker, **kwargs): """ @@ -466,34 +484,34 @@ def install(self, paths, maker, **kwargs): """ dry_run = maker.dry_run - warner = kwargs.get('warner') - lib_only = kwargs.get('lib_only', False) - bc_hashed_invalidation = kwargs.get('bytecode_hashed_invalidation', False) + warner = kwargs.get("warner") + lib_only = kwargs.get("lib_only", False) + bc_hashed_invalidation = kwargs.get("bytecode_hashed_invalidation", False) pathname = os.path.join(self.dirname, self.filename) - name_ver = '%s-%s' % (self.name, self.version) - data_dir = '%s.data' % name_ver - info_dir = '%s.dist-info' % name_ver + name_ver = "%s-%s" % (self.name, self.version) + data_dir = "%s.data" % name_ver + info_dir = "%s.dist-info" % name_ver metadata_name = posixpath.join(info_dir, METADATA_FILENAME) - wheel_metadata_name = posixpath.join(info_dir, 'WHEEL') - record_name = posixpath.join(info_dir, 'RECORD') + wheel_metadata_name = posixpath.join(info_dir, "WHEEL") + record_name = posixpath.join(info_dir, "RECORD") - wrapper = codecs.getreader('utf-8') + wrapper = codecs.getreader("utf-8") - with ZipFile(pathname, 'r') as zf: + with ZipFile(pathname, "r") as zf: with zf.open(wheel_metadata_name) as bwf: wf = wrapper(bwf) message = message_from_file(wf) - wv = message['Wheel-Version'].split('.', 1) + wv = message["Wheel-Version"].split(".", 1) file_version = tuple([int(i) for i in wv]) if (file_version != self.wheel_version) and warner: warner(self.wheel_version, file_version) - if message['Root-Is-Purelib'] == 'true': - libdir = paths['purelib'] + if message["Root-Is-Purelib"] == "true": + libdir = paths["purelib"] else: - libdir = paths['platlib'] + libdir = paths["platlib"] records = {} with zf.open(record_name) as bf: @@ -502,18 +520,18 @@ def install(self, paths, maker, **kwargs): p = row[0] records[p] = row - data_pfx = posixpath.join(data_dir, '') - info_pfx = posixpath.join(info_dir, '') - script_pfx = posixpath.join(data_dir, 'scripts', '') + data_pfx = posixpath.join(data_dir, "") + info_pfx = posixpath.join(info_dir, "") + script_pfx = posixpath.join(data_dir, "scripts", "") # make a new instance rather than a copy of maker's, # as we mutate it fileop = FileOperator(dry_run=dry_run) - fileop.record = True # so we can rollback if needed + fileop.record = True # so we can rollback if needed - bc = not sys.dont_write_bytecode # Double negatives. Lovely! + bc = not sys.dont_write_bytecode # Double negatives. Lovely! - outfiles = [] # for RECORD writing + outfiles = [] # for RECORD writing # for script copying/shebang processing workdir = tempfile.mkdtemp() @@ -528,30 +546,31 @@ def install(self, paths, maker, **kwargs): if isinstance(arcname, text_type): u_arcname = arcname else: - u_arcname = arcname.decode('utf-8') + u_arcname = arcname.decode("utf-8") if self.skip_entry(u_arcname): continue row = records[u_arcname] if row[2] and str(zinfo.file_size) != row[2]: - raise DistlibException('size mismatch for ' - '%s' % u_arcname) + raise DistlibException("size mismatch for " "%s" % u_arcname) if row[1]: - kind, value = row[1].split('=', 1) + kind, value = row[1].split("=", 1) with zf.open(arcname) as bf: data = bf.read() _, digest = self.get_hash(data, kind) if digest != value: - raise DistlibException('digest mismatch for ' - '%s' % arcname) + raise DistlibException( + "digest mismatch for " "%s" % arcname + ) if lib_only and u_arcname.startswith((info_pfx, data_pfx)): - logger.debug('lib_only: skipping %s', u_arcname) + logger.debug("lib_only: skipping %s", u_arcname) continue - is_script = (u_arcname.startswith(script_pfx) - and not u_arcname.endswith('.exe')) + is_script = u_arcname.startswith( + script_pfx + ) and not u_arcname.endswith(".exe") if u_arcname.startswith(data_pfx): - _, where, rp = u_arcname.split('/', 2) + _, where, rp = u_arcname.split("/", 2) outfile = os.path.join(paths[where], convert_path(rp)) else: # meant for site-packages. @@ -564,23 +583,25 @@ def install(self, paths, maker, **kwargs): outfiles.append(outfile) # Double check the digest of the written file if not dry_run and row[1]: - with open(outfile, 'rb') as bf: + with open(outfile, "rb") as bf: data = bf.read() _, newdigest = self.get_hash(data, kind) if newdigest != digest: - raise DistlibException('digest mismatch ' - 'on write for ' - '%s' % outfile) - if bc and outfile.endswith('.py'): + raise DistlibException( + "digest mismatch " + "on write for " + "%s" % outfile + ) + if bc and outfile.endswith(".py"): try: - pyc = fileop.byte_compile(outfile, - hashed_invalidation=bc_hashed_invalidation) + pyc = fileop.byte_compile( + outfile, hashed_invalidation=bc_hashed_invalidation + ) outfiles.append(pyc) except Exception: # Don't give up if byte-compilation fails, # but log it and perhaps warn the user - logger.warning('Byte-compilation failed', - exc_info=True) + logger.warning("Byte-compilation failed", exc_info=True) else: fn = os.path.basename(convert_path(arcname)) workname = os.path.join(workdir, fn) @@ -594,7 +615,7 @@ def install(self, paths, maker, **kwargs): outfiles.extend(filenames) if lib_only: - logger.debug('lib_only: returning None') + logger.debug("lib_only: returning None") dist = None else: # Generate scripts @@ -603,55 +624,58 @@ def install(self, paths, maker, **kwargs): # any commands to generate. If this fails (e.g. because # of a legacy wheel), log a warning but don't give up. commands = None - file_version = self.info['Wheel-Version'] - if file_version == '1.0': + file_version = self.info["Wheel-Version"] + if file_version == "1.0": # Use legacy info - ep = posixpath.join(info_dir, 'entry_points.txt') + ep = posixpath.join(info_dir, "entry_points.txt") try: with zf.open(ep) as bwf: epdata = read_exports(bwf) commands = {} - for key in ('console', 'gui'): - k = '%s_scripts' % key + for key in ("console", "gui"): + k = "%s_scripts" % key if k in epdata: - commands['wrap_%s' % key] = d = {} + commands["wrap_%s" % key] = d = {} for v in epdata[k].values(): - s = '%s:%s' % (v.prefix, v.suffix) + s = "%s:%s" % (v.prefix, v.suffix) if v.flags: - s += ' %s' % v.flags + s += " %s" % v.flags d[v.name] = s except Exception: - logger.warning('Unable to read legacy script ' - 'metadata, so cannot generate ' - 'scripts') + logger.warning( + "Unable to read legacy script " + "metadata, so cannot generate " + "scripts" + ) else: try: with zf.open(metadata_name) as bwf: wf = wrapper(bwf) - commands = json.load(wf).get('extensions') + commands = json.load(wf).get("extensions") if commands: - commands = commands.get('python.commands') + commands = commands.get("python.commands") except Exception: - logger.warning('Unable to read JSON metadata, so ' - 'cannot generate scripts') + logger.warning( + "Unable to read JSON metadata, so " + "cannot generate scripts" + ) if commands: - console_scripts = commands.get('wrap_console', {}) - gui_scripts = commands.get('wrap_gui', {}) + console_scripts = commands.get("wrap_console", {}) + gui_scripts = commands.get("wrap_gui", {}) if console_scripts or gui_scripts: - script_dir = paths.get('scripts', '') + script_dir = paths.get("scripts", "") if not os.path.isdir(script_dir): - raise ValueError('Valid script path not ' - 'specified') + raise ValueError("Valid script path not " "specified") maker.target_dir = script_dir for k, v in console_scripts.items(): - script = '%s = %s' % (k, v) + script = "%s = %s" % (k, v) filenames = maker.make(script) fileop.set_executable_mode(filenames) if gui_scripts: - options = {'gui': True } + options = {"gui": True} for k, v in gui_scripts.items(): - script = '%s = %s' % (k, v) + script = "%s = %s" % (k, v) filenames = maker.make(script, options) fileop.set_executable_mode(filenames) @@ -659,20 +683,19 @@ def install(self, paths, maker, **kwargs): dist = InstalledDistribution(p) # Write SHARED - paths = dict(paths) # don't change passed in dict - del paths['purelib'] - del paths['platlib'] - paths['lib'] = libdir + paths = dict(paths) # don't change passed in dict + del paths["purelib"] + del paths["platlib"] + paths["lib"] = libdir p = dist.write_shared_locations(paths, dry_run) if p: outfiles.append(p) # Write RECORD - dist.write_installed_files(outfiles, paths['prefix'], - dry_run) + dist.write_installed_files(outfiles, paths["prefix"], dry_run) return dist except Exception: # pragma: no cover - logger.exception('installation failed.') + logger.exception("installation failed.") fileop.rollback() raise finally: @@ -682,19 +705,20 @@ def _get_dylib_cache(self): global cache if cache is None: # Use native string to avoid issues on 2.x: see Python #20140. - base = os.path.join(get_cache_base(), str('dylib-cache'), - '%s.%s' % sys.version_info[:2]) + base = os.path.join( + get_cache_base(), str("dylib-cache"), "%s.%s" % sys.version_info[:2] + ) cache = Cache(base) return cache def _get_extensions(self): pathname = os.path.join(self.dirname, self.filename) - name_ver = '%s-%s' % (self.name, self.version) - info_dir = '%s.dist-info' % name_ver - arcname = posixpath.join(info_dir, 'EXTENSIONS') - wrapper = codecs.getreader('utf-8') + name_ver = "%s-%s" % (self.name, self.version) + info_dir = "%s.dist-info" % name_ver + arcname = posixpath.join(info_dir, "EXTENSIONS") + wrapper = codecs.getreader("utf-8") result = [] - with ZipFile(pathname, 'r') as zf: + with ZipFile(pathname, "r") as zf: try: with zf.open(arcname) as bf: wf = wrapper(bf) @@ -731,18 +755,18 @@ def is_mountable(self): """ Determine if a wheel is asserted as mountable by its metadata. """ - return True # for now - metadata details TBD + return True # for now - metadata details TBD def mount(self, append=False): pathname = os.path.abspath(os.path.join(self.dirname, self.filename)) if not self.is_compatible(): - msg = 'Wheel %s not compatible with this Python.' % pathname + msg = "Wheel %s not compatible with this Python." % pathname raise DistlibException(msg) if not self.is_mountable(): - msg = 'Wheel %s is marked as not mountable.' % pathname + msg = "Wheel %s is marked as not mountable." % pathname raise DistlibException(msg) if pathname in sys.path: - logger.debug('%s already in path', pathname) + logger.debug("%s already in path", pathname) else: if append: sys.path.append(pathname) @@ -757,7 +781,7 @@ def mount(self, append=False): def unmount(self): pathname = os.path.abspath(os.path.join(self.dirname, self.filename)) if pathname not in sys.path: - logger.debug('%s not in path', pathname) + logger.debug("%s not in path", pathname) else: sys.path.remove(pathname) if pathname in _hook.impure_wheels: @@ -768,21 +792,21 @@ def unmount(self): def verify(self): pathname = os.path.join(self.dirname, self.filename) - name_ver = '%s-%s' % (self.name, self.version) - data_dir = '%s.data' % name_ver - info_dir = '%s.dist-info' % name_ver + name_ver = "%s-%s" % (self.name, self.version) + data_dir = "%s.data" % name_ver + info_dir = "%s.dist-info" % name_ver metadata_name = posixpath.join(info_dir, METADATA_FILENAME) - wheel_metadata_name = posixpath.join(info_dir, 'WHEEL') - record_name = posixpath.join(info_dir, 'RECORD') + wheel_metadata_name = posixpath.join(info_dir, "WHEEL") + record_name = posixpath.join(info_dir, "RECORD") - wrapper = codecs.getreader('utf-8') + wrapper = codecs.getreader("utf-8") - with ZipFile(pathname, 'r') as zf: + with ZipFile(pathname, "r") as zf: with zf.open(wheel_metadata_name) as bwf: wf = wrapper(bwf) message = message_from_file(wf) - wv = message['Wheel-Version'].split('.', 1) + wv = message["Wheel-Version"].split(".", 1) file_version = tuple([int(i) for i in wv]) # TODO version verification @@ -798,29 +822,26 @@ def verify(self): if isinstance(arcname, text_type): u_arcname = arcname else: - u_arcname = arcname.decode('utf-8') + u_arcname = arcname.decode("utf-8") # See issue #115: some wheels have .. in their entries, but # in the filename ... e.g. __main__..py ! So the check is # updated to look for .. in the directory portions - p = u_arcname.split('/') - if '..' in p: - raise DistlibException('invalid entry in ' - 'wheel: %r' % u_arcname) + p = u_arcname.split("/") + if ".." in p: + raise DistlibException("invalid entry in " "wheel: %r" % u_arcname) if self.skip_entry(u_arcname): continue row = records[u_arcname] if row[2] and str(zinfo.file_size) != row[2]: - raise DistlibException('size mismatch for ' - '%s' % u_arcname) + raise DistlibException("size mismatch for " "%s" % u_arcname) if row[1]: - kind, value = row[1].split('=', 1) + kind, value = row[1].split("=", 1) with zf.open(arcname) as bf: data = bf.read() _, digest = self.get_hash(data, kind) if digest != value: - raise DistlibException('digest mismatch for ' - '%s' % arcname) + raise DistlibException("digest mismatch for " "%s" % arcname) def update(self, modifier, dest_dir=None, **kwargs): """ @@ -841,9 +862,9 @@ def update(self, modifier, dest_dir=None, **kwargs): def get_version(path_map, info_dir): version = path = None - key = '%s/%s' % (info_dir, METADATA_FILENAME) + key = "%s/%s" % (info_dir, METADATA_FILENAME) if key not in path_map: - key = '%s/PKG-INFO' % info_dir + key = "%s/PKG-INFO" % info_dir if key in path_map: path = path_map[key] version = Metadata(path=path).version @@ -853,43 +874,43 @@ def update_version(version, path): updated = None try: v = NormalizedVersion(version) - i = version.find('-') + i = version.find("-") if i < 0: - updated = '%s+1' % version + updated = "%s+1" % version else: - parts = [int(s) for s in version[i + 1:].split('.')] + parts = [int(s) for s in version[i + 1 :].split(".")] parts[-1] += 1 - updated = '%s+%s' % (version[:i], - '.'.join(str(i) for i in parts)) + updated = "%s+%s" % (version[:i], ".".join(str(i) for i in parts)) except UnsupportedVersionError: - logger.debug('Cannot update non-compliant (PEP-440) ' - 'version %r', version) + logger.debug( + "Cannot update non-compliant (PEP-440) " "version %r", version + ) if updated: md = Metadata(path=path) md.version = updated legacy = not path.endswith(METADATA_FILENAME) md.write(path=path, legacy=legacy) - logger.debug('Version updated from %r to %r', version, - updated) + logger.debug("Version updated from %r to %r", version, updated) pathname = os.path.join(self.dirname, self.filename) - name_ver = '%s-%s' % (self.name, self.version) - info_dir = '%s.dist-info' % name_ver - record_name = posixpath.join(info_dir, 'RECORD') + name_ver = "%s-%s" % (self.name, self.version) + info_dir = "%s.dist-info" % name_ver + record_name = posixpath.join(info_dir, "RECORD") with tempdir() as workdir: - with ZipFile(pathname, 'r') as zf: + with ZipFile(pathname, "r") as zf: path_map = {} for zinfo in zf.infolist(): arcname = zinfo.filename if isinstance(arcname, text_type): u_arcname = arcname else: - u_arcname = arcname.decode('utf-8') + u_arcname = arcname.decode("utf-8") if u_arcname == record_name: continue - if '..' in u_arcname: - raise DistlibException('invalid entry in ' - 'wheel: %r' % u_arcname) + if ".." in u_arcname: + raise DistlibException( + "invalid entry in " "wheel: %r" % u_arcname + ) zf.extract(zinfo, workdir) path = os.path.join(workdir, convert_path(u_arcname)) path_map[u_arcname] = path @@ -906,13 +927,13 @@ def update_version(version, path): update_version(current_version, path) # Decide where the new wheel goes. if dest_dir is None: - fd, newpath = tempfile.mkstemp(suffix='.whl', - prefix='wheel-update-', - dir=workdir) + fd, newpath = tempfile.mkstemp( + suffix=".whl", prefix="wheel-update-", dir=workdir + ) os.close(fd) else: if not os.path.isdir(dest_dir): - raise DistlibException('Not a directory: %r' % dest_dir) + raise DistlibException("Not a directory: %r" % dest_dir) newpath = os.path.join(dest_dir, self.filename) archive_paths = list(path_map.items()) distinfo = os.path.join(workdir, info_dir) @@ -923,65 +944,66 @@ def update_version(version, path): shutil.copyfile(newpath, pathname) return modified + def compatible_tags(): """ Return (pyver, abi, arch) tuples compatible with this Python. """ versions = [VER_SUFFIX] major = VER_SUFFIX[0] - for minor in range(sys.version_info[1] - 1, - 1, -1): - versions.append(''.join([major, str(minor)])) + for minor in range(sys.version_info[1] - 1, -1, -1): + versions.append("".join([major, str(minor)])) abis = [] for suffix, _, _ in imp.get_suffixes(): - if suffix.startswith('.abi'): - abis.append(suffix.split('.', 2)[1]) + if suffix.startswith(".abi"): + abis.append(suffix.split(".", 2)[1]) abis.sort() - if ABI != 'none': + if ABI != "none": abis.insert(0, ABI) - abis.append('none') + abis.append("none") result = [] arches = [ARCH] - if sys.platform == 'darwin': - m = re.match(r'(\w+)_(\d+)_(\d+)_(\w+)$', ARCH) + if sys.platform == "darwin": + m = re.match(r"(\w+)_(\d+)_(\d+)_(\w+)$", ARCH) if m: name, major, minor, arch = m.groups() minor = int(minor) matches = [arch] - if arch in ('i386', 'ppc'): - matches.append('fat') - if arch in ('i386', 'ppc', 'x86_64'): - matches.append('fat3') - if arch in ('ppc64', 'x86_64'): - matches.append('fat64') - if arch in ('i386', 'x86_64'): - matches.append('intel') - if arch in ('i386', 'x86_64', 'intel', 'ppc', 'ppc64'): - matches.append('universal') + if arch in ("i386", "ppc"): + matches.append("fat") + if arch in ("i386", "ppc", "x86_64"): + matches.append("fat3") + if arch in ("ppc64", "x86_64"): + matches.append("fat64") + if arch in ("i386", "x86_64"): + matches.append("intel") + if arch in ("i386", "x86_64", "intel", "ppc", "ppc64"): + matches.append("universal") while minor >= 0: for match in matches: - s = '%s_%s_%s_%s' % (name, major, minor, match) - if s != ARCH: # already there + s = "%s_%s_%s_%s" % (name, major, minor, match) + if s != ARCH: # already there arches.append(s) minor -= 1 # Most specific - our Python version, ABI and arch for abi in abis: for arch in arches: - result.append((''.join((IMP_PREFIX, versions[0])), abi, arch)) + result.append(("".join((IMP_PREFIX, versions[0])), abi, arch)) # where no ABI / arch dependency, but IMP_PREFIX dependency for i, version in enumerate(versions): - result.append((''.join((IMP_PREFIX, version)), 'none', 'any')) + result.append(("".join((IMP_PREFIX, version)), "none", "any")) if i == 0: - result.append((''.join((IMP_PREFIX, version[0])), 'none', 'any')) + result.append(("".join((IMP_PREFIX, version[0])), "none", "any")) # no IMP_PREFIX, ABI or arch dependency for i, version in enumerate(versions): - result.append((''.join(('py', version)), 'none', 'any')) + result.append(("".join(("py", version)), "none", "any")) if i == 0: - result.append((''.join(('py', version[0])), 'none', 'any')) + result.append(("".join(("py", version[0])), "none", "any")) return set(result) @@ -992,7 +1014,7 @@ def compatible_tags(): def is_compatible(wheel, tags=None): if not isinstance(wheel, Wheel): - wheel = Wheel(wheel) # assume it's a filename + wheel = Wheel(wheel) # assume it's a filename result = False if tags is None: tags = COMPATIBLE_TAGS diff --git a/src/fetchcode/vcs/pip/_vendor/distro.py b/src/fetchcode/vcs/pip/_vendor/distro.py index 0611b62a..af4fdc15 100644 --- a/src/fetchcode/vcs/pip/_vendor/distro.py +++ b/src/fetchcode/vcs/pip/_vendor/distro.py @@ -38,8 +38,8 @@ import subprocess -_UNIXCONFDIR = os.environ.get('UNIXCONFDIR', '/etc') -_OS_RELEASE_BASENAME = 'os-release' +_UNIXCONFDIR = os.environ.get("UNIXCONFDIR", "/etc") +_OS_RELEASE_BASENAME = "os-release" #: Translation table for normalizing the "ID" attribute defined in os-release #: files, for use by the :func:`distro.id` method. @@ -49,7 +49,7 @@ #: #: * Value: Normalized value. NORMALIZED_OS_ID = { - 'ol': 'oracle', # Oracle Linux + "ol": "oracle", # Oracle Linux } #: Translation table for normalizing the "Distributor ID" attribute returned by @@ -60,11 +60,11 @@ #: #: * Value: Normalized value. NORMALIZED_LSB_ID = { - 'enterpriseenterpriseas': 'oracle', # Oracle Enterprise Linux 4 - 'enterpriseenterpriseserver': 'oracle', # Oracle Linux 5 - 'redhatenterpriseworkstation': 'rhel', # RHEL 6, 7 Workstation - 'redhatenterpriseserver': 'rhel', # RHEL 6, 7 Server - 'redhatenterprisecomputenode': 'rhel', # RHEL 6 ComputeNode + "enterpriseenterpriseas": "oracle", # Oracle Enterprise Linux 4 + "enterpriseenterpriseserver": "oracle", # Oracle Linux 5 + "redhatenterpriseworkstation": "rhel", # RHEL 6, 7 Workstation + "redhatenterpriseserver": "rhel", # RHEL 6, 7 Server + "redhatenterprisecomputenode": "rhel", # RHEL 6 ComputeNode } #: Translation table for normalizing the distro ID derived from the file name @@ -75,25 +75,25 @@ #: #: * Value: Normalized value. NORMALIZED_DISTRO_ID = { - 'redhat': 'rhel', # RHEL 6.x, 7.x + "redhat": "rhel", # RHEL 6.x, 7.x } # Pattern for content of distro release file (reversed) _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN = re.compile( - r'(?:[^)]*\)(.*)\()? *(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler *)?(.+)') + r"(?:[^)]*\)(.*)\()? *(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler *)?(.+)" +) # Pattern for base file name of distro release file -_DISTRO_RELEASE_BASENAME_PATTERN = re.compile( - r'(\w+)[-_](release|version)$') +_DISTRO_RELEASE_BASENAME_PATTERN = re.compile(r"(\w+)[-_](release|version)$") # Base file names to be ignored when searching for distro release file _DISTRO_RELEASE_IGNORE_BASENAMES = ( - 'debian_version', - 'lsb-release', - 'oem-release', + "debian_version", + "lsb-release", + "oem-release", _OS_RELEASE_BASENAME, - 'system-release', - 'plesk-release', + "system-release", + "plesk-release", ) @@ -547,12 +547,13 @@ class cached_property(object): underlying function and sets the value in `__dict__` so future accesses will not re-call the property. """ + def __init__(self, f): self._fname = f.__name__ self._f = f def __get__(self, obj, owner): - assert obj is not None, 'call {} on an instance'.format(self._fname) + assert obj is not None, "call {} on an instance".format(self._fname) ret = obj.__dict__[self._fname] = self._f(obj) return ret @@ -575,11 +576,13 @@ class LinuxDistribution(object): lsb_release command. """ - def __init__(self, - include_lsb=True, - os_release_file='', - distro_release_file='', - include_uname=True): + def __init__( + self, + include_lsb=True, + os_release_file="", + distro_release_file="", + include_uname=True, + ): """ The initialization method of this class gathers information from the available data sources, and stores that in private instance attributes. @@ -647,26 +650,26 @@ def __init__(self, * :py:exc:`UnicodeError`: A data source has unexpected characters or uses an unexpected encoding. """ - self.os_release_file = os_release_file or \ - os.path.join(_UNIXCONFDIR, _OS_RELEASE_BASENAME) - self.distro_release_file = distro_release_file or '' # updated later + self.os_release_file = os_release_file or os.path.join( + _UNIXCONFDIR, _OS_RELEASE_BASENAME + ) + self.distro_release_file = distro_release_file or "" # updated later self.include_lsb = include_lsb self.include_uname = include_uname def __repr__(self): - """Return repr of all info - """ - return \ - "LinuxDistribution(" \ - "os_release_file={self.os_release_file!r}, " \ - "distro_release_file={self.distro_release_file!r}, " \ - "include_lsb={self.include_lsb!r}, " \ - "include_uname={self.include_uname!r}, " \ - "_os_release_info={self._os_release_info!r}, " \ - "_lsb_release_info={self._lsb_release_info!r}, " \ - "_distro_release_info={self._distro_release_info!r}, " \ - "_uname_info={self._uname_info!r})".format( - self=self) + """Return repr of all info""" + return ( + "LinuxDistribution(" + "os_release_file={self.os_release_file!r}, " + "distro_release_file={self.distro_release_file!r}, " + "include_lsb={self.include_lsb!r}, " + "include_uname={self.include_uname!r}, " + "_os_release_info={self._os_release_info!r}, " + "_lsb_release_info={self._lsb_release_info!r}, " + "_distro_release_info={self._distro_release_info!r}, " + "_uname_info={self._uname_info!r})".format(self=self) + ) def linux_distribution(self, full_distribution_name=True): """ @@ -679,7 +682,7 @@ def linux_distribution(self, full_distribution_name=True): return ( self.name() if full_distribution_name else self.id(), self.version(), - self.codename() + self.codename(), ) def id(self): @@ -687,27 +690,28 @@ def id(self): For details, see :func:`distro.id`. """ + def normalize(distro_id, table): - distro_id = distro_id.lower().replace(' ', '_') + distro_id = distro_id.lower().replace(" ", "_") return table.get(distro_id, distro_id) - distro_id = self.os_release_attr('id') + distro_id = self.os_release_attr("id") if distro_id: return normalize(distro_id, NORMALIZED_OS_ID) - distro_id = self.lsb_release_attr('distributor_id') + distro_id = self.lsb_release_attr("distributor_id") if distro_id: return normalize(distro_id, NORMALIZED_LSB_ID) - distro_id = self.distro_release_attr('id') + distro_id = self.distro_release_attr("id") if distro_id: return normalize(distro_id, NORMALIZED_DISTRO_ID) - distro_id = self.uname_attr('id') + distro_id = self.uname_attr("id") if distro_id: return normalize(distro_id, NORMALIZED_DISTRO_ID) - return '' + return "" def name(self, pretty=False): """ @@ -715,20 +719,22 @@ def name(self, pretty=False): For details, see :func:`distro.name`. """ - name = self.os_release_attr('name') \ - or self.lsb_release_attr('distributor_id') \ - or self.distro_release_attr('name') \ - or self.uname_attr('name') + name = ( + self.os_release_attr("name") + or self.lsb_release_attr("distributor_id") + or self.distro_release_attr("name") + or self.uname_attr("name") + ) if pretty: - name = self.os_release_attr('pretty_name') \ - or self.lsb_release_attr('description') + name = self.os_release_attr("pretty_name") or self.lsb_release_attr( + "description" + ) if not name: - name = self.distro_release_attr('name') \ - or self.uname_attr('name') + name = self.distro_release_attr("name") or self.uname_attr("name") version = self.version(pretty=True) if version: - name = name + ' ' + version - return name or '' + name = name + " " + version + return name or "" def version(self, pretty=False, best=False): """ @@ -737,31 +743,33 @@ def version(self, pretty=False, best=False): For details, see :func:`distro.version`. """ versions = [ - self.os_release_attr('version_id'), - self.lsb_release_attr('release'), - self.distro_release_attr('version_id'), - self._parse_distro_release_content( - self.os_release_attr('pretty_name')).get('version_id', ''), + self.os_release_attr("version_id"), + self.lsb_release_attr("release"), + self.distro_release_attr("version_id"), + self._parse_distro_release_content(self.os_release_attr("pretty_name")).get( + "version_id", "" + ), self._parse_distro_release_content( - self.lsb_release_attr('description')).get('version_id', ''), - self.uname_attr('release') + self.lsb_release_attr("description") + ).get("version_id", ""), + self.uname_attr("release"), ] - version = '' + version = "" if best: # This algorithm uses the last version in priority order that has # the best precision. If the versions are not in conflict, that # does not matter; otherwise, using the last one instead of the # first one might be considered a surprise. for v in versions: - if v.count(".") > version.count(".") or version == '': + if v.count(".") > version.count(".") or version == "": version = v else: for v in versions: - if v != '': + if v != "": version = v break if pretty and version and self.codename(): - version = '{0} ({1})'.format(version, self.codename()) + version = "{0} ({1})".format(version, self.codename()) return version def version_parts(self, best=False): @@ -773,12 +781,12 @@ def version_parts(self, best=False): """ version_str = self.version(best=best) if version_str: - version_regex = re.compile(r'(\d+)\.?(\d+)?\.?(\d+)?') + version_regex = re.compile(r"(\d+)\.?(\d+)?\.?(\d+)?") matches = version_regex.match(version_str) if matches: major, minor, build_number = matches.groups() - return major, minor or '', build_number or '' - return '', '', '' + return major, minor or "", build_number or "" + return "", "", "" def major_version(self, best=False): """ @@ -810,7 +818,7 @@ def like(self): For details, see :func:`distro.like`. """ - return self.os_release_attr('id_like') or '' + return self.os_release_attr("id_like") or "" def codename(self): """ @@ -821,11 +829,13 @@ def codename(self): try: # Handle os_release specially since distros might purposefully set # this to empty string to have no codename - return self._os_release_info['codename'] + return self._os_release_info["codename"] except KeyError: - return self.lsb_release_attr('codename') \ - or self.distro_release_attr('codename') \ - or '' + return ( + self.lsb_release_attr("codename") + or self.distro_release_attr("codename") + or "" + ) def info(self, pretty=False, best=False): """ @@ -840,7 +850,7 @@ def info(self, pretty=False, best=False): version_parts=dict( major=self.major_version(best), minor=self.minor_version(best), - build_number=self.build_number(best) + build_number=self.build_number(best), ), like=self.like(), codename=self.codename(), @@ -891,7 +901,7 @@ def os_release_attr(self, attribute): For details, see :func:`distro.os_release_attr`. """ - return self._os_release_info.get(attribute, '') + return self._os_release_info.get(attribute, "") def lsb_release_attr(self, attribute): """ @@ -900,7 +910,7 @@ def lsb_release_attr(self, attribute): For details, see :func:`distro.lsb_release_attr`. """ - return self._lsb_release_info.get(attribute, '') + return self._lsb_release_info.get(attribute, "") def distro_release_attr(self, attribute): """ @@ -909,7 +919,7 @@ def distro_release_attr(self, attribute): For details, see :func:`distro.distro_release_attr`. """ - return self._distro_release_info.get(attribute, '') + return self._distro_release_info.get(attribute, "") def uname_attr(self, attribute): """ @@ -918,7 +928,7 @@ def uname_attr(self, attribute): For details, see :func:`distro.uname_release_attr`. """ - return self._uname_info.get(attribute, '') + return self._uname_info.get(attribute, "") @cached_property def _os_release_info(self): @@ -959,7 +969,7 @@ def _parse_os_release_content(lines): # parsed content is a unicode object. The following fix resolves that # (... but it should be fixed in shlex...): if sys.version_info[0] == 2 and isinstance(lexer.wordchars, bytes): - lexer.wordchars = lexer.wordchars.decode('iso-8859-1') + lexer.wordchars = lexer.wordchars.decode("iso-8859-1") tokens = list(lexer) for token in tokens: @@ -969,32 +979,32 @@ def _parse_os_release_content(lines): # stripped, etc.), so the tokens are now either: # * variable assignments: var=value # * commands or their arguments (not allowed in os-release) - if '=' in token: - k, v = token.split('=', 1) + if "=" in token: + k, v = token.split("=", 1) props[k.lower()] = v else: # Ignore any tokens that are not variable assignments pass - if 'version_codename' in props: + if "version_codename" in props: # os-release added a version_codename field. Use that in # preference to anything else Note that some distros purposefully # do not have code names. They should be setting # version_codename="" - props['codename'] = props['version_codename'] - elif 'ubuntu_codename' in props: + props["codename"] = props["version_codename"] + elif "ubuntu_codename" in props: # Same as above but a non-standard field name used on older Ubuntus - props['codename'] = props['ubuntu_codename'] - elif 'version' in props: + props["codename"] = props["ubuntu_codename"] + elif "version" in props: # If there is no version_codename, parse it from the version - codename = re.search(r'(\(\D+\))|,(\s+)?\D+', props['version']) + codename = re.search(r"(\(\D+\))|,(\s+)?\D+", props["version"]) if codename: codename = codename.group() - codename = codename.strip('()') - codename = codename.strip(',') + codename = codename.strip("()") + codename = codename.strip(",") codename = codename.strip() # codename appears within paranthese. - props['codename'] = codename + props["codename"] = codename return props @@ -1008,9 +1018,9 @@ def _lsb_release_info(self): """ if not self.include_lsb: return {} - with open(os.devnull, 'w') as devnull: + with open(os.devnull, "w") as devnull: try: - cmd = ('lsb_release', '-a') + cmd = ("lsb_release", "-a") stdout = subprocess.check_output(cmd, stderr=devnull) except OSError: # Command not found return {} @@ -1033,19 +1043,19 @@ def _parse_lsb_release_content(lines): """ props = {} for line in lines: - kv = line.strip('\n').split(':', 1) + kv = line.strip("\n").split(":", 1) if len(kv) != 2: # Ignore lines without colon. continue k, v = kv - props.update({k.replace(' ', '_').lower(): v.strip()}) + props.update({k.replace(" ", "_").lower(): v.strip()}) return props @cached_property def _uname_info(self): - with open(os.devnull, 'w') as devnull: + with open(os.devnull, "w") as devnull: try: - cmd = ('uname', '-rs') + cmd = ("uname", "-rs") stdout = subprocess.check_output(cmd, stderr=devnull) except OSError: return {} @@ -1055,24 +1065,24 @@ def _uname_info(self): @staticmethod def _parse_uname_content(lines): props = {} - match = re.search(r'^([^\s]+)\s+([\d\.]+)', lines[0].strip()) + match = re.search(r"^([^\s]+)\s+([\d\.]+)", lines[0].strip()) if match: name, version = match.groups() # This is to prevent the Linux kernel version from # appearing as the 'best' version on otherwise # identifiable distributions. - if name == 'Linux': + if name == "Linux": return {} - props['id'] = name.lower() - props['name'] = name - props['release'] = version + props["id"] = name.lower() + props["name"] = name + props["release"] = version return props @staticmethod def _to_str(text): encoding = sys.getfilesystemencoding() - encoding = 'utf-8' if encoding == 'ascii' else encoding + encoding = "utf-8" if encoding == "ascii" else encoding if sys.version_info[0] >= 3: if isinstance(text, bytes): @@ -1094,19 +1104,17 @@ def _distro_release_info(self): if self.distro_release_file: # If it was specified, we use it and parse what we can, even if # its file name or content does not match the expected pattern. - distro_info = self._parse_distro_release_file( - self.distro_release_file) + distro_info = self._parse_distro_release_file(self.distro_release_file) basename = os.path.basename(self.distro_release_file) # The file name pattern for user-specified distro release files # is somewhat more tolerant (compared to when searching for the # file), because we want to use what was specified as best as # possible. match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename) - if 'name' in distro_info \ - and 'cloudlinux' in distro_info['name'].lower(): - distro_info['id'] = 'cloudlinux' + if "name" in distro_info and "cloudlinux" in distro_info["name"].lower(): + distro_info["id"] = "cloudlinux" elif match: - distro_info['id'] = match.group(1) + distro_info["id"] = match.group(1) return distro_info else: try: @@ -1120,21 +1128,23 @@ def _distro_release_info(self): # sure about the *-release files. Check common entries of # /etc for information. If they turn out to not be there the # error is handled in `_parse_distro_release_file()`. - basenames = ['SuSE-release', - 'arch-release', - 'base-release', - 'centos-release', - 'fedora-release', - 'gentoo-release', - 'mageia-release', - 'mandrake-release', - 'mandriva-release', - 'mandrivalinux-release', - 'manjaro-release', - 'oracle-release', - 'redhat-release', - 'sl-release', - 'slackware-version'] + basenames = [ + "SuSE-release", + "arch-release", + "base-release", + "centos-release", + "fedora-release", + "gentoo-release", + "mageia-release", + "mandrake-release", + "mandriva-release", + "mandrivalinux-release", + "manjaro-release", + "oracle-release", + "redhat-release", + "sl-release", + "slackware-version", + ] for basename in basenames: if basename in _DISTRO_RELEASE_IGNORE_BASENAMES: continue @@ -1142,12 +1152,12 @@ def _distro_release_info(self): if match: filepath = os.path.join(_UNIXCONFDIR, basename) distro_info = self._parse_distro_release_file(filepath) - if 'name' in distro_info: + if "name" in distro_info: # The name is always present if the pattern matches self.distro_release_file = filepath - distro_info['id'] = match.group(1) - if 'cloudlinux' in distro_info['name'].lower(): - distro_info['id'] = 'cloudlinux' + distro_info["id"] = match.group(1) + if "cloudlinux" in distro_info["name"].lower(): + distro_info["id"] = "cloudlinux" return distro_info return {} @@ -1185,18 +1195,17 @@ def _parse_distro_release_content(line): Returns: A dictionary containing all information items. """ - matches = _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN.match( - line.strip()[::-1]) + matches = _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN.match(line.strip()[::-1]) distro_info = {} if matches: # regexp ensures non-None - distro_info['name'] = matches.group(3)[::-1] + distro_info["name"] = matches.group(3)[::-1] if matches.group(2): - distro_info['version_id'] = matches.group(2)[::-1] + distro_info["version_id"] = matches.group(2)[::-1] if matches.group(1): - distro_info['codename'] = matches.group(1)[::-1] + distro_info["codename"] = matches.group(1)[::-1] elif line: - distro_info['name'] = line.strip() + distro_info["name"] = line.strip() return distro_info @@ -1210,21 +1219,19 @@ def main(): parser = argparse.ArgumentParser(description="OS distro info tool") parser.add_argument( - '--json', - '-j', - help="Output in machine readable format", - action="store_true") + "--json", "-j", help="Output in machine readable format", action="store_true" + ) args = parser.parse_args() if args.json: logger.info(json.dumps(info(), indent=4, sort_keys=True)) else: - logger.info('Name: %s', name(pretty=True)) + logger.info("Name: %s", name(pretty=True)) distribution_version = version(pretty=True) - logger.info('Version: %s', distribution_version) + logger.info("Version: %s", distribution_version) distribution_codename = codename() - logger.info('Codename: %s', distribution_codename) + logger.info("Codename: %s", distribution_codename) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/src/fetchcode/vcs/pip/_vendor/distro.pyi b/src/fetchcode/vcs/pip/_vendor/distro.pyi index c7ea94b3..2532973f 100644 --- a/src/fetchcode/vcs/pip/_vendor/distro.pyi +++ b/src/fetchcode/vcs/pip/_vendor/distro.pyi @@ -1 +1 @@ -from distro import * \ No newline at end of file +from distro import * diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib.pyi b/src/fetchcode/vcs/pip/_vendor/html5lib.pyi index 9bc9af95..7284d9bc 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib.pyi +++ b/src/fetchcode/vcs/pip/_vendor/html5lib.pyi @@ -1 +1 @@ -from html5lib import * \ No newline at end of file +from html5lib import * diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py b/src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py index f63fe8fc..98924635 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/__init__.py @@ -26,8 +26,14 @@ from .treewalkers import getTreeWalker from .serializer import serialize -__all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder", - "getTreeWalker", "serialize"] +__all__ = [ + "HTMLParser", + "parse", + "parseFragment", + "getTreeBuilder", + "getTreeWalker", + "serialize", +] # this has to be at the top level, see how setup.py parses this #: Distribution version number. diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py index 02753db7..b81adaec 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_ihatexml.py @@ -1,4 +1,3 @@ - import re import warnings @@ -91,8 +90,7 @@ letter = " | ".join([baseChar, ideographic]) # Without the -name = " | ".join([letter, digit, ".", "-", "_", combiningCharacter, - extender]) +name = " | ".join([letter, digit, ".", "-", "_", combiningCharacter, extender]) nameFirst = " | ".join([letter, "_"]) reChar = re.compile(r"#x([\d|A-F]{4,4})") @@ -135,6 +133,7 @@ def normaliseCharList(charList): i += j return rv + # We don't really support characters above the BMP :( max_unicode = int("FFFF", 16) @@ -156,8 +155,7 @@ def listToRegexpStr(charList): if item[0] == item[1]: rv.append(escapeRegexp(chr(item[0]))) else: - rv.append(escapeRegexp(chr(item[0])) + "-" + - escapeRegexp(chr(item[1]))) + rv.append(escapeRegexp(chr(item[0])) + "-" + escapeRegexp(chr(item[1]))) return "[%s]" % "".join(rv) @@ -166,17 +164,36 @@ def hexToInt(hex_str): def escapeRegexp(string): - specialCharacters = (".", "^", "$", "*", "+", "?", "{", "}", - "[", "]", "|", "(", ")", "-") + specialCharacters = ( + ".", + "^", + "$", + "*", + "+", + "?", + "{", + "}", + "[", + "]", + "|", + "(", + ")", + "-", + ) for char in specialCharacters: string = string.replace(char, "\\" + char) return string + # output from the above -nonXmlNameBMPRegexp = re.compile('[\x00-,/:-@\\[-\\^`\\{-\xb6\xb8-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u02cf\u02d2-\u02ff\u0346-\u035f\u0362-\u0385\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482\u0487-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u0590\u05a2\u05ba\u05be\u05c0\u05c3\u05c5-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u063f\u0653-\u065f\u066a-\u066f\u06b8-\u06b9\u06bf\u06cf\u06d4\u06e9\u06ee-\u06ef\u06fa-\u0900\u0904\u093a-\u093b\u094e-\u0950\u0955-\u0957\u0964-\u0965\u0970-\u0980\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09bb\u09bd\u09c5-\u09c6\u09c9-\u09ca\u09ce-\u09d6\u09d8-\u09db\u09de\u09e4-\u09e5\u09f2-\u0a01\u0a03-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a3b\u0a3d\u0a43-\u0a46\u0a49-\u0a4a\u0a4e-\u0a58\u0a5d\u0a5f-\u0a65\u0a75-\u0a80\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abb\u0ac6\u0aca\u0ace-\u0adf\u0ae1-\u0ae5\u0af0-\u0b00\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3b\u0b44-\u0b46\u0b49-\u0b4a\u0b4e-\u0b55\u0b58-\u0b5b\u0b5e\u0b62-\u0b65\u0b70-\u0b81\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0bbd\u0bc3-\u0bc5\u0bc9\u0bce-\u0bd6\u0bd8-\u0be6\u0bf0-\u0c00\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c3d\u0c45\u0c49\u0c4e-\u0c54\u0c57-\u0c5f\u0c62-\u0c65\u0c70-\u0c81\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cbd\u0cc5\u0cc9\u0cce-\u0cd4\u0cd7-\u0cdd\u0cdf\u0ce2-\u0ce5\u0cf0-\u0d01\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d3d\u0d44-\u0d45\u0d49\u0d4e-\u0d56\u0d58-\u0d5f\u0d62-\u0d65\u0d70-\u0e00\u0e2f\u0e3b-\u0e3f\u0e4f\u0e5a-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eba\u0ebe-\u0ebf\u0ec5\u0ec7\u0ece-\u0ecf\u0eda-\u0f17\u0f1a-\u0f1f\u0f2a-\u0f34\u0f36\u0f38\u0f3a-\u0f3d\u0f48\u0f6a-\u0f70\u0f85\u0f8c-\u0f8f\u0f96\u0f98\u0fae-\u0fb0\u0fb8\u0fba-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u20cf\u20dd-\u20e0\u20e2-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3004\u3006\u3008-\u3020\u3030\u3036-\u3040\u3095-\u3098\u309b-\u309c\u309f-\u30a0\u30fb\u30ff-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]') # noqa +nonXmlNameBMPRegexp = re.compile( + "[\x00-,/:-@\\[-\\^`\\{-\xb6\xb8-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u02cf\u02d2-\u02ff\u0346-\u035f\u0362-\u0385\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482\u0487-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u0590\u05a2\u05ba\u05be\u05c0\u05c3\u05c5-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u063f\u0653-\u065f\u066a-\u066f\u06b8-\u06b9\u06bf\u06cf\u06d4\u06e9\u06ee-\u06ef\u06fa-\u0900\u0904\u093a-\u093b\u094e-\u0950\u0955-\u0957\u0964-\u0965\u0970-\u0980\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09bb\u09bd\u09c5-\u09c6\u09c9-\u09ca\u09ce-\u09d6\u09d8-\u09db\u09de\u09e4-\u09e5\u09f2-\u0a01\u0a03-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a3b\u0a3d\u0a43-\u0a46\u0a49-\u0a4a\u0a4e-\u0a58\u0a5d\u0a5f-\u0a65\u0a75-\u0a80\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abb\u0ac6\u0aca\u0ace-\u0adf\u0ae1-\u0ae5\u0af0-\u0b00\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3b\u0b44-\u0b46\u0b49-\u0b4a\u0b4e-\u0b55\u0b58-\u0b5b\u0b5e\u0b62-\u0b65\u0b70-\u0b81\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0bbd\u0bc3-\u0bc5\u0bc9\u0bce-\u0bd6\u0bd8-\u0be6\u0bf0-\u0c00\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c3d\u0c45\u0c49\u0c4e-\u0c54\u0c57-\u0c5f\u0c62-\u0c65\u0c70-\u0c81\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cbd\u0cc5\u0cc9\u0cce-\u0cd4\u0cd7-\u0cdd\u0cdf\u0ce2-\u0ce5\u0cf0-\u0d01\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d3d\u0d44-\u0d45\u0d49\u0d4e-\u0d56\u0d58-\u0d5f\u0d62-\u0d65\u0d70-\u0e00\u0e2f\u0e3b-\u0e3f\u0e4f\u0e5a-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eba\u0ebe-\u0ebf\u0ec5\u0ec7\u0ece-\u0ecf\u0eda-\u0f17\u0f1a-\u0f1f\u0f2a-\u0f34\u0f36\u0f38\u0f3a-\u0f3d\u0f48\u0f6a-\u0f70\u0f85\u0f8c-\u0f8f\u0f96\u0f98\u0fae-\u0fb0\u0fb8\u0fba-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u20cf\u20dd-\u20e0\u20e2-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3004\u3006\u3008-\u3020\u3030\u3036-\u3040\u3095-\u3098\u309b-\u309c\u309f-\u30a0\u30fb\u30ff-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]" +) # noqa -nonXmlNameFirstBMPRegexp = re.compile('[\x00-@\\[-\\^`\\{-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u0385\u0387\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u0640\u064b-\u0670\u06b8-\u06b9\u06bf\u06cf\u06d4\u06d6-\u06e4\u06e7-\u0904\u093a-\u093c\u093e-\u0957\u0962-\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09db\u09de\u09e2-\u09ef\u09f2-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a58\u0a5d\u0a5f-\u0a71\u0a75-\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abc\u0abe-\u0adf\u0ae1-\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3c\u0b3e-\u0b5b\u0b5e\u0b62-\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c5f\u0c62-\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cdd\u0cdf\u0ce2-\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d5f\u0d62-\u0e00\u0e2f\u0e31\u0e34-\u0e3f\u0e46-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eb1\u0eb4-\u0ebc\u0ebe-\u0ebf\u0ec5-\u0f3f\u0f48\u0f6a-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3006\u3008-\u3020\u302a-\u3040\u3095-\u30a0\u30fb-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]') # noqa +nonXmlNameFirstBMPRegexp = re.compile( + "[\x00-@\\[-\\^`\\{-\xbf\xd7\xf7\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u01f6-\u01f9\u0218-\u024f\u02a9-\u02ba\u02c2-\u0385\u0387\u038b\u038d\u03a2\u03cf\u03d7-\u03d9\u03db\u03dd\u03df\u03e1\u03f4-\u0400\u040d\u0450\u045d\u0482-\u048f\u04c5-\u04c6\u04c9-\u04ca\u04cd-\u04cf\u04ec-\u04ed\u04f6-\u04f7\u04fa-\u0530\u0557-\u0558\u055a-\u0560\u0587-\u05cf\u05eb-\u05ef\u05f3-\u0620\u063b-\u0640\u064b-\u0670\u06b8-\u06b9\u06bf\u06cf\u06d4\u06d6-\u06e4\u06e7-\u0904\u093a-\u093c\u093e-\u0957\u0962-\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09db\u09de\u09e2-\u09ef\u09f2-\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a58\u0a5d\u0a5f-\u0a71\u0a75-\u0a84\u0a8c\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abc\u0abe-\u0adf\u0ae1-\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34-\u0b35\u0b3a-\u0b3c\u0b3e-\u0b5b\u0b5e\u0b62-\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bb6\u0bba-\u0c04\u0c0d\u0c11\u0c29\u0c34\u0c3a-\u0c5f\u0c62-\u0c84\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cdd\u0cdf\u0ce2-\u0d04\u0d0d\u0d11\u0d29\u0d3a-\u0d5f\u0d62-\u0e00\u0e2f\u0e31\u0e34-\u0e3f\u0e46-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eaf\u0eb1\u0eb4-\u0ebc\u0ebe-\u0ebf\u0ec5-\u0f3f\u0f48\u0f6a-\u109f\u10c6-\u10cf\u10f7-\u10ff\u1101\u1104\u1108\u110a\u110d\u1113-\u113b\u113d\u113f\u1141-\u114b\u114d\u114f\u1151-\u1153\u1156-\u1158\u115a-\u115e\u1162\u1164\u1166\u1168\u116a-\u116c\u116f-\u1171\u1174\u1176-\u119d\u119f-\u11a7\u11a9-\u11aa\u11ac-\u11ad\u11b0-\u11b6\u11b9\u11bb\u11c3-\u11ea\u11ec-\u11ef\u11f1-\u11f8\u11fa-\u1dff\u1e9c-\u1e9f\u1efa-\u1eff\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fbd\u1fbf-\u1fc1\u1fc5\u1fcd-\u1fcf\u1fd4-\u1fd5\u1fdc-\u1fdf\u1fed-\u1ff1\u1ff5\u1ffd-\u2125\u2127-\u2129\u212c-\u212d\u212f-\u217f\u2183-\u3006\u3008-\u3020\u302a-\u3040\u3095-\u30a0\u30fb-\u3104\u312d-\u4dff\u9fa6-\uabff\ud7a4-\uffff]" +) # noqa # Simpler things nonPubidCharRegexp = re.compile("[^\x20\x0D\x0Aa-zA-Z0-9\\-'()+,./:=?;!*#@$_%]") @@ -185,13 +202,15 @@ def escapeRegexp(string): class InfosetFilter(object): replacementRegexp = re.compile(r"U[\dA-F]{5,5}") - def __init__(self, - dropXmlnsLocalName=False, - dropXmlnsAttrNs=False, - preventDoubleDashComments=False, - preventDashAtCommentEnd=False, - replaceFormFeedCharacters=True, - preventSingleQuotePubid=False): + def __init__( + self, + dropXmlnsLocalName=False, + dropXmlnsAttrNs=False, + preventDoubleDashComments=False, + preventDashAtCommentEnd=False, + replaceFormFeedCharacters=True, + preventSingleQuotePubid=False, + ): self.dropXmlnsLocalName = dropXmlnsLocalName self.dropXmlnsAttrNs = dropXmlnsAttrNs @@ -209,8 +228,7 @@ def coerceAttribute(self, name, namespace=None): if self.dropXmlnsLocalName and name.startswith("xmlns:"): warnings.warn("Attributes cannot begin with xmlns", DataLossWarning) return None - elif (self.dropXmlnsAttrNs and - namespace == "http://www.w3.org/2000/xmlns/"): + elif self.dropXmlnsAttrNs and namespace == "http://www.w3.org/2000/xmlns/": warnings.warn("Attributes cannot be in the xml namespace", DataLossWarning) return None else: @@ -222,7 +240,9 @@ def coerceElement(self, name): def coerceComment(self, data): if self.preventDoubleDashComments: while "--" in data: - warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning) + warnings.warn( + "Comments cannot contain adjacent dashes", DataLossWarning + ) data = data.replace("--", "- -") if data.endswith("-"): warnings.warn("Comments cannot end in a dash", DataLossWarning) diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py index 0960243f..353f8ee1 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_inputstream.py @@ -1,4 +1,3 @@ - from fetchcode.vcs.pip._vendor.six import text_type, binary_type from fetchcode.vcs.pip._vendor.six.moves import http_client, urllib @@ -32,22 +31,58 @@ # eval. Not using this indirection would introduce an illegal # unicode literal on platforms not supporting such lone # surrogates. - assert invalid_unicode_no_surrogate[-1] == "]" and invalid_unicode_no_surrogate.count("]") == 1 - invalid_unicode_re = re.compile(invalid_unicode_no_surrogate[:-1] + - eval('"\\uD800-\\uDFFF"') + # pylint:disable=eval-used - "]") + assert ( + invalid_unicode_no_surrogate[-1] == "]" + and invalid_unicode_no_surrogate.count("]") == 1 + ) + invalid_unicode_re = re.compile( + invalid_unicode_no_surrogate[:-1] + + eval('"\\uD800-\\uDFFF"') + + "]" # pylint:disable=eval-used + ) else: invalid_unicode_re = re.compile(invalid_unicode_no_surrogate) -non_bmp_invalid_codepoints = set([0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, - 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF, - 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, - 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, - 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, - 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF, - 0x10FFFE, 0x10FFFF]) - -ascii_punctuation_re = re.compile("[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005C\u005B-\u0060\u007B-\u007E]") +non_bmp_invalid_codepoints = set( + [ + 0x1FFFE, + 0x1FFFF, + 0x2FFFE, + 0x2FFFF, + 0x3FFFE, + 0x3FFFF, + 0x4FFFE, + 0x4FFFF, + 0x5FFFE, + 0x5FFFF, + 0x6FFFE, + 0x6FFFF, + 0x7FFFE, + 0x7FFFF, + 0x8FFFE, + 0x8FFFF, + 0x9FFFE, + 0x9FFFF, + 0xAFFFE, + 0xAFFFF, + 0xBFFFE, + 0xBFFFF, + 0xCFFFE, + 0xCFFFF, + 0xDFFFE, + 0xDFFFF, + 0xEFFFE, + 0xEFFFF, + 0xFFFFE, + 0xFFFFF, + 0x10FFFE, + 0x10FFFF, + ] +) + +ascii_punctuation_re = re.compile( + "[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005C\u005B-\u0060\u007B-\u007E]" +) # Cache for charsUntil() charsUntilRegEx = {} @@ -67,7 +102,7 @@ def __init__(self, stream): def tell(self): pos = 0 - for chunk in self.buffer[:self.position[0]]: + for chunk in self.buffer[: self.position[0]]: pos += len(chunk) pos += self.position[1] return pos @@ -84,8 +119,9 @@ def seek(self, pos): def read(self, bytes): if not self.buffer: return self._readStream(bytes) - elif (self.position[0] == len(self.buffer) and - self.position[1] == len(self.buffer[-1])): + elif self.position[0] == len(self.buffer) and self.position[1] == len( + self.buffer[-1] + ): return self._readStream(bytes) else: return self._readFromBuffer(bytes) @@ -116,7 +152,7 @@ def _readFromBuffer(self, bytes): bytesToRead = len(bufferedData) - bufferOffset self.position = [bufferIndex, len(bufferedData)] bufferIndex += 1 - rv.append(bufferedData[bufferOffset:bufferOffset + bytesToRead]) + rv.append(bufferedData[bufferOffset : bufferOffset + bytesToRead]) remainingBytes -= bytesToRead bufferOffset = 0 @@ -130,10 +166,15 @@ def _readFromBuffer(self, bytes): def HTMLInputStream(source, **kwargs): # Work around Python bug #20007: read(0) closes the connection. # http://bugs.python.org/issue20007 - if (isinstance(source, http_client.HTTPResponse) or + if ( + isinstance(source, http_client.HTTPResponse) + or # Also check for addinfourl wrapping HTTPResponse - (isinstance(source, urllib.response.addbase) and - isinstance(source.fp, http_client.HTTPResponse))): + ( + isinstance(source, urllib.response.addbase) + and isinstance(source.fp, http_client.HTTPResponse) + ) + ): isUnicode = False elif hasattr(source, "read"): isUnicode = isinstance(source.read(0), text_type) @@ -143,7 +184,9 @@ def HTMLInputStream(source, **kwargs): if isUnicode: encodings = [x for x in kwargs if x.endswith("_encoding")] if encodings: - raise TypeError("Cannot set an encoding with a unicode input, set %r" % encodings) + raise TypeError( + "Cannot set an encoding with a unicode input, set %r" % encodings + ) return HTMLUnicodeInputStream(source, **kwargs) else: @@ -213,7 +256,7 @@ def openStream(self, source): """ # Already a file object - if hasattr(source, 'read'): + if hasattr(source, "read"): stream = source else: stream = StringIO(source) @@ -222,9 +265,9 @@ def openStream(self, source): def _position(self, offset): chunk = self.chunk - nLines = chunk.count('\n', 0, offset) + nLines = chunk.count("\n", 0, offset) positionLine = self.prevNumLines + nLines - lastLinePos = chunk.rfind('\n', 0, offset) + lastLinePos = chunk.rfind("\n", 0, offset) if lastLinePos == -1: positionColumn = self.prevNumCols + offset else: @@ -237,8 +280,8 @@ def position(self): return (line + 1, col) def char(self): - """ Read one character from the stream or queue if available. Return - EOF when EOF is reached. + """Read one character from the stream or queue if available. Return + EOF when EOF is reached. """ # Read a new chunk from the input stream if necessary if self.chunkOffset >= self.chunkSize: @@ -303,21 +346,20 @@ def characterErrorsUCS2(self, data): codepoint = ord(match.group()) pos = match.start() # Pretty sure there should be endianness issues here - if _utils.isSurrogatePair(data[pos:pos + 2]): + if _utils.isSurrogatePair(data[pos : pos + 2]): # We have a surrogate pair! - char_val = _utils.surrogatePairToCodepoint(data[pos:pos + 2]) + char_val = _utils.surrogatePairToCodepoint(data[pos : pos + 2]) if char_val in non_bmp_invalid_codepoints: self.errors.append("invalid-codepoint") skip = True - elif (codepoint >= 0xD800 and codepoint <= 0xDFFF and - pos == len(data) - 1): + elif codepoint >= 0xD800 and codepoint <= 0xDFFF and pos == len(data) - 1: self.errors.append("invalid-codepoint") else: skip = False self.errors.append("invalid-codepoint") def charsUntil(self, characters, opposite=False): - """ Returns a string of characters from the stream up to but not + """Returns a string of characters from the stream up to but not including any character in 'characters' or EOF. 'characters' must be a container that supports the 'in' method and iteration over its characters. @@ -329,11 +371,13 @@ def charsUntil(self, characters, opposite=False): except KeyError: if __debug__: for c in characters: - assert(ord(c) < 128) + assert ord(c) < 128 regex = "".join(["\\x%02x" % ord(c) for c in characters]) if not opposite: regex = "^%s" % regex - chars = charsUntilRegEx[(characters, opposite)] = re.compile("[%s]+" % regex) + chars = charsUntilRegEx[(characters, opposite)] = re.compile( + "[%s]+" % regex + ) rv = [] @@ -350,12 +394,12 @@ def charsUntil(self, characters, opposite=False): # If not the whole chunk matched, return everything # up to the part that didn't match if end != self.chunkSize: - rv.append(self.chunk[self.chunkOffset:end]) + rv.append(self.chunk[self.chunkOffset : end]) self.chunkOffset = end break # If the whole remainder of the chunk matched, # use it all and read the next chunk - rv.append(self.chunk[self.chunkOffset:]) + rv.append(self.chunk[self.chunkOffset :]) if not self.readChunk(): # Reached EOF break @@ -388,9 +432,16 @@ class HTMLBinaryInputStream(HTMLUnicodeInputStream): """ - def __init__(self, source, override_encoding=None, transport_encoding=None, - same_origin_parent_encoding=None, likely_encoding=None, - default_encoding="windows-1252", useChardet=True): + def __init__( + self, + source, + override_encoding=None, + transport_encoding=None, + same_origin_parent_encoding=None, + likely_encoding=None, + default_encoding="windows-1252", + useChardet=True, + ): """Initialises the HTMLInputStream. HTMLInputStream(source, [encoding]) -> Normalized stream from source @@ -431,7 +482,9 @@ def __init__(self, source, override_encoding=None, transport_encoding=None, self.reset() def reset(self): - self.dataStream = self.charEncoding[0].codec_info.streamreader(self.rawStream, 'replace') + self.dataStream = self.charEncoding[0].codec_info.streamreader( + self.rawStream, "replace" + ) HTMLUnicodeInputStream.reset(self) def openStream(self, source): @@ -441,7 +494,7 @@ def openStream(self, source): """ # Already a file object - if hasattr(source, 'read'): + if hasattr(source, "read"): stream = source else: stream = BytesIO(source) @@ -477,7 +530,9 @@ def determineEncoding(self, chardet=True): # Parent document encoding charEncoding = lookupEncoding(self.same_origin_parent_encoding), "tentative" - if charEncoding[0] is not None and not charEncoding[0].name.startswith("utf-16"): + if charEncoding[0] is not None and not charEncoding[0].name.startswith( + "utf-16" + ): return charEncoding # "likely" encoding @@ -488,7 +543,9 @@ def determineEncoding(self, chardet=True): # Guess with chardet, if available if chardet: try: - from fetchcode.vcs.pip._vendor.chardet.universaldetector import UniversalDetector + from fetchcode.vcs.pip._vendor.chardet.universaldetector import ( + UniversalDetector, + ) except ImportError: pass else: @@ -502,7 +559,7 @@ def determineEncoding(self, chardet=True): buffers.append(buffer) detector.feed(buffer) detector.close() - encoding = lookupEncoding(detector.result['encoding']) + encoding = lookupEncoding(detector.result["encoding"]) self.rawStream.seek(0) if encoding is not None: return encoding, "tentative" @@ -529,16 +586,20 @@ def changeEncoding(self, newEncoding): self.rawStream.seek(0) self.charEncoding = (newEncoding, "certain") self.reset() - raise _ReparseException("Encoding changed from %s to %s" % (self.charEncoding[0], newEncoding)) + raise _ReparseException( + "Encoding changed from %s to %s" % (self.charEncoding[0], newEncoding) + ) def detectBOM(self): """Attempts to detect at BOM at the start of the stream. If an encoding can be determined from the BOM return the name of the encoding otherwise return None""" bomDict = { - codecs.BOM_UTF8: 'utf-8', - codecs.BOM_UTF16_LE: 'utf-16le', codecs.BOM_UTF16_BE: 'utf-16be', - codecs.BOM_UTF32_LE: 'utf-32le', codecs.BOM_UTF32_BE: 'utf-32be' + codecs.BOM_UTF8: "utf-8", + codecs.BOM_UTF16_LE: "utf-16le", + codecs.BOM_UTF16_BE: "utf-16be", + codecs.BOM_UTF32_LE: "utf-32le", + codecs.BOM_UTF32_BE: "utf-32be", } # Go to beginning of file and read in 4 bytes @@ -546,11 +607,11 @@ def detectBOM(self): assert isinstance(string, bytes) # Try detecting the BOM using bytes from the string - encoding = bomDict.get(string[:3]) # UTF-8 + encoding = bomDict.get(string[:3]) # UTF-8 seek = 3 if not encoding: # Need to detect UTF-32 before UTF-16 - encoding = bomDict.get(string) # UTF-32 + encoding = bomDict.get(string) # UTF-32 seek = 4 if not encoding: encoding = bomDict.get(string[:2]) # UTF-16 @@ -566,8 +627,7 @@ def detectBOM(self): return None def detectEncodingMeta(self): - """Report the encoding declared by the meta element - """ + """Report the encoding declared by the meta element""" buffer = self.rawStream.read(self.numBytesMeta) assert isinstance(buffer, bytes) parser = EncodingParser(buffer) @@ -584,6 +644,7 @@ class EncodingBytes(bytes): """String-like object with an associated position and various extra methods If the position is ever greater than the string length then an exception is raised""" + def __new__(self, value): assert isinstance(value, bytes) return bytes.__new__(self, value.lower()) @@ -601,7 +662,7 @@ def __next__(self): raise StopIteration elif p < 0: raise TypeError - return self[p:p + 1] + return self[p : p + 1] def next(self): # Py2 compat @@ -614,7 +675,7 @@ def previous(self): elif p < 0: raise TypeError self._position = p = p - 1 - return self[p:p + 1] + return self[p : p + 1] def setPosition(self, position): if self._position >= len(self): @@ -632,15 +693,15 @@ def getPosition(self): position = property(getPosition, setPosition) def getCurrentByte(self): - return self[self.position:self.position + 1] + return self[self.position : self.position + 1] currentByte = property(getCurrentByte) def skip(self, chars=spaceCharactersBytes): """Skip past a list of characters""" - p = self.position # use property for the error-checking + p = self.position # use property for the error-checking while p < len(self): - c = self[p:p + 1] + c = self[p : p + 1] if c not in chars: self._position = p return c @@ -651,7 +712,7 @@ def skip(self, chars=spaceCharactersBytes): def skipUntil(self, chars): p = self.position while p < len(self): - c = self[p:p + 1] + c = self[p : p + 1] if c in chars: self._position = p return c @@ -664,7 +725,7 @@ def matchBytes(self, bytes): are found return True and advance the position to the byte after the match. Otherwise return False and leave the position alone""" p = self.position - data = self[p:p + len(bytes)] + data = self[p : p + len(bytes)] rv = data.startswith(bytes) if rv: self.position += len(bytes) @@ -673,12 +734,12 @@ def matchBytes(self, bytes): def jumpTo(self, bytes): """Look for the next sequence of bytes matching a given sequence. If a match is found advance the position to the last byte of the match""" - newPosition = self[self.position:].find(bytes) + newPosition = self[self.position :].find(bytes) if newPosition > -1: # XXX: This is ugly, but I can't see a nicer way to fix this. if self._position == -1: self._position = 0 - self._position += (newPosition + len(bytes) - 1) + self._position += newPosition + len(bytes) - 1 return True else: raise StopIteration @@ -699,7 +760,8 @@ def getEncoding(self): (b" 0x10FFFF)): + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "illegal-codepoint-for-numeric-entity", + "datavars": {"charAsInt": charAsInt}, + } + ) + elif (0xD800 <= charAsInt <= 0xDFFF) or (charAsInt > 0x10FFFF): char = "\uFFFD" - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "illegal-codepoint-for-numeric-entity", - "datavars": {"charAsInt": charAsInt}}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "illegal-codepoint-for-numeric-entity", + "datavars": {"charAsInt": charAsInt}, + } + ) else: # Should speed up this check somehow (e.g. move the set to a constant) - if ((0x0001 <= charAsInt <= 0x0008) or - (0x000E <= charAsInt <= 0x001F) or - (0x007F <= charAsInt <= 0x009F) or - (0xFDD0 <= charAsInt <= 0xFDEF) or - charAsInt in frozenset([0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, - 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, - 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, - 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, - 0x7FFFF, 0x8FFFE, 0x8FFFF, 0x9FFFE, - 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, - 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, - 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, - 0xFFFFF, 0x10FFFE, 0x10FFFF])): - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": - "illegal-codepoint-for-numeric-entity", - "datavars": {"charAsInt": charAsInt}}) + if ( + (0x0001 <= charAsInt <= 0x0008) + or (0x000E <= charAsInt <= 0x001F) + or (0x007F <= charAsInt <= 0x009F) + or (0xFDD0 <= charAsInt <= 0xFDEF) + or charAsInt + in frozenset( + [ + 0x000B, + 0xFFFE, + 0xFFFF, + 0x1FFFE, + 0x1FFFF, + 0x2FFFE, + 0x2FFFF, + 0x3FFFE, + 0x3FFFF, + 0x4FFFE, + 0x4FFFF, + 0x5FFFE, + 0x5FFFF, + 0x6FFFE, + 0x6FFFF, + 0x7FFFE, + 0x7FFFF, + 0x8FFFE, + 0x8FFFF, + 0x9FFFE, + 0x9FFFF, + 0xAFFFE, + 0xAFFFF, + 0xBFFFE, + 0xBFFFF, + 0xCFFFE, + 0xCFFFF, + 0xDFFFE, + 0xDFFFF, + 0xEFFFE, + 0xEFFFF, + 0xFFFFE, + 0xFFFFF, + 0x10FFFE, + 0x10FFFF, + ] + ) + ): + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "illegal-codepoint-for-numeric-entity", + "datavars": {"charAsInt": charAsInt}, + } + ) try: # Try/except needed as UCS-2 Python builds' unichar only works # within the BMP. @@ -127,8 +172,12 @@ def consumeNumberEntity(self, isHex): # Discard the ; if present. Otherwise, put it back on the queue and # invoke parseError on parser. if c != ";": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "numeric-entity-without-semicolon"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "numeric-entity-without-semicolon", + } + ) self.stream.unget(c) return char @@ -138,8 +187,11 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False): output = "&" charStack = [self.stream.char()] - if (charStack[0] in spaceCharacters or charStack[0] in (EOF, "<", "&") or - (allowedChar is not None and allowedChar == charStack[0])): + if ( + charStack[0] in spaceCharacters + or charStack[0] in (EOF, "<", "&") + or (allowedChar is not None and allowedChar == charStack[0]) + ): self.stream.unget(charStack[0]) elif charStack[0] == "#": @@ -151,15 +203,20 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False): charStack.append(self.stream.char()) # charStack[-1] should be the first digit - if (hex and charStack[-1] in hexDigits) \ - or (not hex and charStack[-1] in digits): + if (hex and charStack[-1] in hexDigits) or ( + not hex and charStack[-1] in digits + ): # At least one digit found, so consume the whole number self.stream.unget(charStack[-1]) output = self.consumeNumberEntity(hex) else: # No digits found - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "expected-numeric-entity"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-numeric-entity", + } + ) self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) @@ -169,7 +226,7 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False): # # Consume characters and compare to these to a substring of the # entity names in the list until the substring no longer matches. - while (charStack[-1] is not EOF): + while charStack[-1] is not EOF: if not entitiesTrie.has_keys_with_prefix("".join(charStack)): break charStack.append(self.stream.char()) @@ -186,12 +243,21 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False): if entityName is not None: if entityName[-1] != ";": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "named-entity-without-semicolon"}) - if (entityName[-1] != ";" and fromAttribute and - (charStack[entityLength] in asciiLetters or - charStack[entityLength] in digits or - charStack[entityLength] == "=")): + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "named-entity-without-semicolon", + } + ) + if ( + entityName[-1] != ";" + and fromAttribute + and ( + charStack[entityLength] in asciiLetters + or charStack[entityLength] in digits + or charStack[entityLength] == "=" + ) + ): self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) else: @@ -199,8 +265,9 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False): self.stream.unget(charStack.pop()) output += "".join(charStack[entityLength:]) else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-named-entity"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "expected-named-entity"} + ) self.stream.unget(charStack.pop()) output = "&" + "".join(charStack) @@ -214,8 +281,7 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False): self.tokenQueue.append({"type": tokenTypes[tokenType], "data": output}) def processEntityInAttribute(self, allowedChar): - """This method replaces the need for "entityInAttributeValueState". - """ + """This method replaces the need for "entityInAttributeValueState".""" self.consumeEntity(allowedChar=allowedChar, fromAttribute=True) def emitCurrentToken(self): @@ -225,15 +291,23 @@ def emitCurrentToken(self): """ token = self.currentToken # Add token to the queue to be yielded - if (token["type"] in tagTokenTypes): + if token["type"] in tagTokenTypes: token["name"] = token["name"].translate(asciiUpper2Lower) if token["type"] == tokenTypes["EndTag"]: if token["data"]: - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "attributes-in-end-tag"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "attributes-in-end-tag", + } + ) if token["selfClosing"]: - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "self-closing-flag-on-end-tag"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "self-closing-flag-on-end-tag", + } + ) self.tokenQueue.append(token) self.state = self.dataState @@ -245,10 +319,10 @@ def dataState(self): elif data == "<": self.state = self.tagOpenState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "\u0000"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) + self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\u0000"}) elif data is EOF: # Tokenization ends. return False @@ -256,15 +330,20 @@ def dataState(self): # Directly after emitting a token you switch back to the "data # state". At that point spaceCharacters are important so they are # emitted separately. - self.tokenQueue.append({"type": tokenTypes["SpaceCharacters"], "data": - data + self.stream.charsUntil(spaceCharacters, True)}) + self.tokenQueue.append( + { + "type": tokenTypes["SpaceCharacters"], + "data": data + self.stream.charsUntil(spaceCharacters, True), + } + ) # No need to update lastFourChars here, since the first space will # have already been appended to lastFourChars and will have broken # any sequences else: chars = self.stream.charsUntil(("&", "<", "\u0000")) - self.tokenQueue.append({"type": tokenTypes["Characters"], "data": - data + chars}) + self.tokenQueue.append( + {"type": tokenTypes["Characters"], "data": data + chars} + ) return True def entityDataState(self): @@ -282,23 +361,28 @@ def rcdataState(self): # Tokenization ends. return False elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "\uFFFD"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) + self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data in spaceCharacters: # Directly after emitting a token you switch back to the "data # state". At that point spaceCharacters are important so they are # emitted separately. - self.tokenQueue.append({"type": tokenTypes["SpaceCharacters"], "data": - data + self.stream.charsUntil(spaceCharacters, True)}) + self.tokenQueue.append( + { + "type": tokenTypes["SpaceCharacters"], + "data": data + self.stream.charsUntil(spaceCharacters, True), + } + ) # No need to update lastFourChars here, since the first space will # have already been appended to lastFourChars and will have broken # any sequences else: chars = self.stream.charsUntil(("&", "<", "\u0000")) - self.tokenQueue.append({"type": tokenTypes["Characters"], "data": - data + chars}) + self.tokenQueue.append( + {"type": tokenTypes["Characters"], "data": data + chars} + ) return True def characterReferenceInRcdata(self): @@ -311,17 +395,18 @@ def rawtextState(self): if data == "<": self.state = self.rawtextLessThanSignState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "\uFFFD"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) + self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data == EOF: # Tokenization ends. return False else: chars = self.stream.charsUntil(("<", "\u0000")) - self.tokenQueue.append({"type": tokenTypes["Characters"], "data": - data + chars}) + self.tokenQueue.append( + {"type": tokenTypes["Characters"], "data": data + chars} + ) return True def scriptDataState(self): @@ -329,17 +414,18 @@ def scriptDataState(self): if data == "<": self.state = self.scriptDataLessThanSignState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "\uFFFD"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) + self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) elif data == EOF: # Tokenization ends. return False else: chars = self.stream.charsUntil(("<", "\u0000")) - self.tokenQueue.append({"type": tokenTypes["Characters"], "data": - data + chars}) + self.tokenQueue.append( + {"type": tokenTypes["Characters"], "data": data + chars} + ) return True def plaintextState(self): @@ -348,13 +434,17 @@ def plaintextState(self): # Tokenization ends. return False elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "\uFFFD"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) + self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) else: - self.tokenQueue.append({"type": tokenTypes["Characters"], "data": - data + self.stream.charsUntil("\u0000")}) + self.tokenQueue.append( + { + "type": tokenTypes["Characters"], + "data": data + self.stream.charsUntil("\u0000"), + } + ) return True def tagOpenState(self): @@ -364,29 +454,41 @@ def tagOpenState(self): elif data == "/": self.state = self.closeTagOpenState elif data in asciiLetters: - self.currentToken = {"type": tokenTypes["StartTag"], - "name": data, "data": [], - "selfClosing": False, - "selfClosingAcknowledged": False} + self.currentToken = { + "type": tokenTypes["StartTag"], + "name": data, + "data": [], + "selfClosing": False, + "selfClosingAcknowledged": False, + } self.state = self.tagNameState elif data == ">": # XXX In theory it could be something besides a tag name. But # do we really care? - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-tag-name-but-got-right-bracket"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-tag-name-but-got-right-bracket", + } + ) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<>"}) self.state = self.dataState elif data == "?": # XXX In theory it could be something besides a tag name. But # do we really care? - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-tag-name-but-got-question-mark"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-tag-name-but-got-question-mark", + } + ) self.stream.unget(data) self.state = self.bogusCommentState else: # XXX - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-tag-name"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "expected-tag-name"} + ) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<"}) self.stream.unget(data) self.state = self.dataState @@ -395,23 +497,39 @@ def tagOpenState(self): def closeTagOpenState(self): data = self.stream.char() if data in asciiLetters: - self.currentToken = {"type": tokenTypes["EndTag"], "name": data, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": data, + "data": [], + "selfClosing": False, + } self.state = self.tagNameState elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-closing-tag-but-got-right-bracket"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-closing-tag-but-got-right-bracket", + } + ) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-closing-tag-but-got-eof"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-closing-tag-but-got-eof", + } + ) self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "": self.emitCurrentToken() elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-tag-name"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-tag-name"} + ) self.state = self.dataState elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["name"] += "\uFFFD" else: self.currentToken["name"] += data @@ -461,29 +581,42 @@ def rcdataEndTagOpenState(self): return True def rcdataEndTagNameState(self): - appropriate = self.currentToken and self.currentToken["name"].lower() == self.temporaryBuffer.lower() + appropriate = ( + self.currentToken + and self.currentToken["name"].lower() == self.temporaryBuffer.lower() + ) data = self.stream.char() if data in spaceCharacters and appropriate: - self.currentToken = {"type": tokenTypes["EndTag"], - "name": self.temporaryBuffer, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": self.temporaryBuffer, + "data": [], + "selfClosing": False, + } self.state = self.beforeAttributeNameState elif data == "/" and appropriate: - self.currentToken = {"type": tokenTypes["EndTag"], - "name": self.temporaryBuffer, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": self.temporaryBuffer, + "data": [], + "selfClosing": False, + } self.state = self.selfClosingStartTagState elif data == ">" and appropriate: - self.currentToken = {"type": tokenTypes["EndTag"], - "name": self.temporaryBuffer, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": self.temporaryBuffer, + "data": [], + "selfClosing": False, + } self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "" and appropriate: - self.currentToken = {"type": tokenTypes["EndTag"], - "name": self.temporaryBuffer, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": self.temporaryBuffer, + "data": [], + "selfClosing": False, + } self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "" and appropriate: - self.currentToken = {"type": tokenTypes["EndTag"], - "name": self.temporaryBuffer, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": self.temporaryBuffer, + "data": [], + "selfClosing": False, + } self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": ""}) self.state = self.scriptDataState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "\uFFFD"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) + self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) self.state = self.scriptDataEscapedState elif data == EOF: self.state = self.dataState @@ -679,7 +839,9 @@ def scriptDataEscapedLessThanSignState(self): self.temporaryBuffer = "" self.state = self.scriptDataEscapedEndTagOpenState elif data in asciiLetters: - self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "<" + data}) + self.tokenQueue.append( + {"type": tokenTypes["Characters"], "data": "<" + data} + ) self.temporaryBuffer = data self.state = self.scriptDataDoubleEscapeStartState else: @@ -700,29 +862,42 @@ def scriptDataEscapedEndTagOpenState(self): return True def scriptDataEscapedEndTagNameState(self): - appropriate = self.currentToken and self.currentToken["name"].lower() == self.temporaryBuffer.lower() + appropriate = ( + self.currentToken + and self.currentToken["name"].lower() == self.temporaryBuffer.lower() + ) data = self.stream.char() if data in spaceCharacters and appropriate: - self.currentToken = {"type": tokenTypes["EndTag"], - "name": self.temporaryBuffer, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": self.temporaryBuffer, + "data": [], + "selfClosing": False, + } self.state = self.beforeAttributeNameState elif data == "/" and appropriate: - self.currentToken = {"type": tokenTypes["EndTag"], - "name": self.temporaryBuffer, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": self.temporaryBuffer, + "data": [], + "selfClosing": False, + } self.state = self.selfClosingStartTagState elif data == ">" and appropriate: - self.currentToken = {"type": tokenTypes["EndTag"], - "name": self.temporaryBuffer, - "data": [], "selfClosing": False} + self.currentToken = { + "type": tokenTypes["EndTag"], + "name": self.temporaryBuffer, + "data": [], + "selfClosing": False, + } self.emitCurrentToken() self.state = self.dataState elif data in asciiLetters: self.temporaryBuffer += data else: - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": ""}) self.state = self.scriptDataState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": "\uFFFD"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) + self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "\uFFFD"}) self.state = self.scriptDataDoubleEscapedState elif data == EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-script-in-script"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-script-in-script"} + ) self.state = self.dataState else: self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) @@ -851,18 +1029,27 @@ def beforeAttributeNameState(self): elif data == "/": self.state = self.selfClosingStartTagState elif data in ("'", '"', "=", "<"): - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "invalid-character-in-attribute-name"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "invalid-character-in-attribute-name", + } + ) self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"].append(["\uFFFD", ""]) self.state = self.attributeNameState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-attribute-name-but-got-eof"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-attribute-name-but-got-eof", + } + ) self.state = self.dataState else: self.currentToken["data"].append([data, ""]) @@ -876,8 +1063,9 @@ def attributeNameState(self): if data == "=": self.state = self.beforeAttributeValueState elif data in asciiLetters: - self.currentToken["data"][-1][0] += data +\ - self.stream.charsUntil(asciiLetters, True) + self.currentToken["data"][-1][0] += data + self.stream.charsUntil( + asciiLetters, True + ) leavingThisState = False elif data == ">": # XXX If we emit here the attributes are converted to a dict @@ -889,19 +1077,24 @@ def attributeNameState(self): elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"][-1][0] += "\uFFFD" leavingThisState = False elif data in ("'", '"', "<"): - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": - "invalid-character-in-attribute-name"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "invalid-character-in-attribute-name", + } + ) self.currentToken["data"][-1][0] += data leavingThisState = False elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "eof-in-attribute-name"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-attribute-name"} + ) self.state = self.dataState else: self.currentToken["data"][-1][0] += data @@ -911,12 +1104,17 @@ def attributeNameState(self): # Attributes are not dropped at this stage. That happens when the # start tag token is emitted so values can still be safely appended # to attributes, but we do want to report the parse error in time. - self.currentToken["data"][-1][0] = ( - self.currentToken["data"][-1][0].translate(asciiUpper2Lower)) + self.currentToken["data"][-1][0] = self.currentToken["data"][-1][ + 0 + ].translate(asciiUpper2Lower) for name, _ in self.currentToken["data"][:-1]: if self.currentToken["data"][-1][0] == name: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "duplicate-attribute"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "duplicate-attribute", + } + ) break # XXX Fix for above XXX if emitToken: @@ -937,18 +1135,27 @@ def afterAttributeNameState(self): elif data == "/": self.state = self.selfClosingStartTagState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"].append(["\uFFFD", ""]) self.state = self.attributeNameState elif data in ("'", '"', "<"): - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "invalid-character-after-attribute-name"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "invalid-character-after-attribute-name", + } + ) self.currentToken["data"].append([data, ""]) self.state = self.attributeNameState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-end-of-tag-but-got-eof"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-end-of-tag-but-got-eof", + } + ) self.state = self.dataState else: self.currentToken["data"].append([data, ""]) @@ -959,7 +1166,7 @@ def beforeAttributeValueState(self): data = self.stream.char() if data in spaceCharacters: self.stream.charsUntil(spaceCharacters, True) - elif data == "\"": + elif data == '"': self.state = self.attributeValueDoubleQuotedState elif data == "&": self.state = self.attributeValueUnQuotedState @@ -967,22 +1174,35 @@ def beforeAttributeValueState(self): elif data == "'": self.state = self.attributeValueSingleQuotedState elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-attribute-value-but-got-right-bracket"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-attribute-value-but-got-right-bracket", + } + ) self.emitCurrentToken() elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"][-1][1] += "\uFFFD" self.state = self.attributeValueUnQuotedState elif data in ("=", "<", "`"): - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "equals-in-unquoted-attribute-value"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "equals-in-unquoted-attribute-value", + } + ) self.currentToken["data"][-1][1] += data self.state = self.attributeValueUnQuotedState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-attribute-value-but-got-eof"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-attribute-value-but-got-eof", + } + ) self.state = self.dataState else: self.currentToken["data"][-1][1] += data @@ -991,21 +1211,27 @@ def beforeAttributeValueState(self): def attributeValueDoubleQuotedState(self): data = self.stream.char() - if data == "\"": + if data == '"': self.state = self.afterAttributeValueState elif data == "&": self.processEntityInAttribute('"') elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-attribute-value-double-quote"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "eof-in-attribute-value-double-quote", + } + ) self.state = self.dataState else: - self.currentToken["data"][-1][1] += data +\ - self.stream.charsUntil(("\"", "&", "\u0000")) + self.currentToken["data"][-1][1] += data + self.stream.charsUntil( + ('"', "&", "\u0000") + ) return True def attributeValueSingleQuotedState(self): @@ -1015,16 +1241,22 @@ def attributeValueSingleQuotedState(self): elif data == "&": self.processEntityInAttribute("'") elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-attribute-value-single-quote"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "eof-in-attribute-value-single-quote", + } + ) self.state = self.dataState else: - self.currentToken["data"][-1][1] += data +\ - self.stream.charsUntil(("'", "&", "\u0000")) + self.currentToken["data"][-1][1] += data + self.stream.charsUntil( + ("'", "&", "\u0000") + ) return True def attributeValueUnQuotedState(self): @@ -1036,20 +1268,31 @@ def attributeValueUnQuotedState(self): elif data == ">": self.emitCurrentToken() elif data in ('"', "'", "=", "<", "`"): - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-character-in-unquoted-attribute-value"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "unexpected-character-in-unquoted-attribute-value", + } + ) self.currentToken["data"][-1][1] += data elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"][-1][1] += "\uFFFD" elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-attribute-value-no-quotes"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "eof-in-attribute-value-no-quotes", + } + ) self.state = self.dataState else: self.currentToken["data"][-1][1] += data + self.stream.charsUntil( - frozenset(("&", ">", '"', "'", "=", "<", "`", "\u0000")) | spaceCharacters) + frozenset(("&", ">", '"', "'", "=", "<", "`", "\u0000")) + | spaceCharacters + ) return True def afterAttributeValueState(self): @@ -1061,13 +1304,21 @@ def afterAttributeValueState(self): elif data == "/": self.state = self.selfClosingStartTagState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-EOF-after-attribute-value"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "unexpected-EOF-after-attribute-value", + } + ) self.stream.unget(data) self.state = self.dataState else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-character-after-attribute-value"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "unexpected-character-after-attribute-value", + } + ) self.stream.unget(data) self.state = self.beforeAttributeNameState return True @@ -1078,14 +1329,21 @@ def selfClosingStartTagState(self): self.currentToken["selfClosing"] = True self.emitCurrentToken() elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": - "unexpected-EOF-after-solidus-in-tag"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "unexpected-EOF-after-solidus-in-tag", + } + ) self.stream.unget(data) self.state = self.dataState else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-character-after-solidus-in-tag"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "unexpected-character-after-solidus-in-tag", + } + ) self.stream.unget(data) self.state = self.beforeAttributeNameState return True @@ -1096,8 +1354,7 @@ def bogusCommentState(self): # and emit it. data = self.stream.charsUntil(">") data = data.replace("\u0000", "\uFFFD") - self.tokenQueue.append( - {"type": tokenTypes["Comment"], "data": data}) + self.tokenQueue.append({"type": tokenTypes["Comment"], "data": data}) # Eat the character directly after the bogus comment which is either a # ">" or an EOF. @@ -1113,25 +1370,37 @@ def markupDeclarationOpenState(self): self.currentToken = {"type": tokenTypes["Comment"], "data": ""} self.state = self.commentStartState return True - elif charStack[-1] in ('d', 'D'): + elif charStack[-1] in ("d", "D"): matched = True - for expected in (('o', 'O'), ('c', 'C'), ('t', 'T'), - ('y', 'Y'), ('p', 'P'), ('e', 'E')): + for expected in ( + ("o", "O"), + ("c", "C"), + ("t", "T"), + ("y", "Y"), + ("p", "P"), + ("e", "E"), + ): charStack.append(self.stream.char()) if charStack[-1] not in expected: matched = False break if matched: - self.currentToken = {"type": tokenTypes["Doctype"], - "name": "", - "publicId": None, "systemId": None, - "correct": True} + self.currentToken = { + "type": tokenTypes["Doctype"], + "name": "", + "publicId": None, + "systemId": None, + "correct": True, + } self.state = self.doctypeState return True - elif (charStack[-1] == "[" and - self.parser is not None and - self.parser.tree.openElements and - self.parser.tree.openElements[-1].namespace != self.parser.tree.defaultNamespace): + elif ( + charStack[-1] == "[" + and self.parser is not None + and self.parser.tree.openElements + and self.parser.tree.openElements[-1].namespace + != self.parser.tree.defaultNamespace + ): matched = True for expected in ["C", "D", "A", "T", "A", "["]: charStack.append(self.stream.char()) @@ -1142,8 +1411,9 @@ def markupDeclarationOpenState(self): self.state = self.cdataSectionState return True - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-dashes-or-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "expected-dashes-or-doctype"} + ) while charStack: self.stream.unget(charStack.pop()) @@ -1155,17 +1425,20 @@ def commentStartState(self): if data == "-": self.state = self.commentStartDashState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"] += "\uFFFD" elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "incorrect-comment"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "incorrect-comment"} + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-comment"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-comment"} + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: @@ -1178,17 +1451,20 @@ def commentStartDashState(self): if data == "-": self.state = self.commentEndState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"] += "-\uFFFD" elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "incorrect-comment"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "incorrect-comment"} + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-comment"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-comment"} + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: @@ -1201,17 +1477,18 @@ def commentState(self): if data == "-": self.state = self.commentEndDashState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"] += "\uFFFD" elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "eof-in-comment"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-comment"} + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: - self.currentToken["data"] += data + \ - self.stream.charsUntil(("-", "\u0000")) + self.currentToken["data"] += data + self.stream.charsUntil(("-", "\u0000")) return True def commentEndDashState(self): @@ -1219,13 +1496,15 @@ def commentEndDashState(self): if data == "-": self.state = self.commentEndState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"] += "-\uFFFD" self.state = self.commentState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-comment-end-dash"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-comment-end-dash"} + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: @@ -1239,27 +1518,38 @@ def commentEndState(self): self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"] += "--\uFFFD" self.state = self.commentState elif data == "!": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-bang-after-double-dash-in-comment"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "unexpected-bang-after-double-dash-in-comment", + } + ) self.state = self.commentEndBangState elif data == "-": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-dash-after-double-dash-in-comment"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "unexpected-dash-after-double-dash-in-comment", + } + ) self.currentToken["data"] += data elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-comment-double-dash"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-comment-double-dash"} + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: # XXX - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-comment"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-comment"} + ) self.currentToken["data"] += "--" + data self.state = self.commentState return True @@ -1273,13 +1563,18 @@ def commentEndBangState(self): self.currentToken["data"] += "--!" self.state = self.commentEndDashState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["data"] += "--!\uFFFD" self.state = self.commentState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-comment-end-bang-state"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "eof-in-comment-end-bang-state", + } + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: @@ -1292,14 +1587,19 @@ def doctypeState(self): if data in spaceCharacters: self.state = self.beforeDoctypeNameState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-doctype-name-but-got-eof"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-doctype-name-but-got-eof", + } + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "need-space-after-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "need-space-after-doctype"} + ) self.stream.unget(data) self.state = self.beforeDoctypeNameState return True @@ -1309,19 +1609,28 @@ def beforeDoctypeNameState(self): if data in spaceCharacters: pass elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-doctype-name-but-got-right-bracket"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-doctype-name-but-got-right-bracket", + } + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["name"] = "\uFFFD" self.state = self.doctypeNameState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-doctype-name-but-got-eof"}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-doctype-name-but-got-eof", + } + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState @@ -1333,22 +1642,30 @@ def beforeDoctypeNameState(self): def doctypeNameState(self): data = self.stream.char() if data in spaceCharacters: - self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) + self.currentToken["name"] = self.currentToken["name"].translate( + asciiUpper2Lower + ) self.state = self.afterDoctypeNameState elif data == ">": - self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) + self.currentToken["name"] = self.currentToken["name"].translate( + asciiUpper2Lower + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["name"] += "\uFFFD" self.state = self.doctypeNameState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype-name"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype-name"} + ) self.currentToken["correct"] = False - self.currentToken["name"] = self.currentToken["name"].translate(asciiUpper2Lower) + self.currentToken["name"] = self.currentToken["name"].translate( + asciiUpper2Lower + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: @@ -1365,15 +1682,21 @@ def afterDoctypeNameState(self): elif data is EOF: self.currentToken["correct"] = False self.stream.unget(data) - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.tokenQueue.append(self.currentToken) self.state = self.dataState else: if data in ("p", "P"): matched = True - for expected in (("u", "U"), ("b", "B"), ("l", "L"), - ("i", "I"), ("c", "C")): + for expected in ( + ("u", "U"), + ("b", "B"), + ("l", "L"), + ("i", "I"), + ("c", "C"), + ): data = self.stream.char() if data not in expected: matched = False @@ -1383,8 +1706,13 @@ def afterDoctypeNameState(self): return True elif data in ("s", "S"): matched = True - for expected in (("y", "Y"), ("s", "S"), ("t", "T"), - ("e", "E"), ("m", "M")): + for expected in ( + ("y", "Y"), + ("s", "S"), + ("t", "T"), + ("e", "E"), + ("m", "M"), + ): data = self.stream.char() if data not in expected: matched = False @@ -1398,9 +1726,13 @@ def afterDoctypeNameState(self): # discarded; only the latest character might be '>' or EOF # and needs to be ungetted self.stream.unget(data) - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "expected-space-or-right-bracket-in-doctype", "datavars": - {"data": data}}) + self.tokenQueue.append( + { + "type": tokenTypes["ParseError"], + "data": "expected-space-or-right-bracket-in-doctype", + "datavars": {"data": data}, + } + ) self.currentToken["correct"] = False self.state = self.bogusDoctypeState @@ -1411,13 +1743,15 @@ def afterDoctypePublicKeywordState(self): if data in spaceCharacters: self.state = self.beforeDoctypePublicIdentifierState elif data in ("'", '"'): - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.stream.unget(data) self.state = self.beforeDoctypePublicIdentifierState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState @@ -1430,48 +1764,54 @@ def beforeDoctypePublicIdentifierState(self): data = self.stream.char() if data in spaceCharacters: pass - elif data == "\"": + elif data == '"': self.currentToken["publicId"] = "" self.state = self.doctypePublicIdentifierDoubleQuotedState elif data == "'": self.currentToken["publicId"] = "" self.state = self.doctypePublicIdentifierSingleQuotedState elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-end-of-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def doctypePublicIdentifierDoubleQuotedState(self): data = self.stream.char() - if data == "\"": + if data == '"': self.state = self.afterDoctypePublicIdentifierState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["publicId"] += "\uFFFD" elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-end-of-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState @@ -1484,18 +1824,21 @@ def doctypePublicIdentifierSingleQuotedState(self): if data == "'": self.state = self.afterDoctypePublicIdentifierState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["publicId"] += "\uFFFD" elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-end-of-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState @@ -1511,24 +1854,28 @@ def afterDoctypePublicIdentifierState(self): self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data == '"': - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierDoubleQuotedState elif data == "'": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True @@ -1547,14 +1894,16 @@ def betweenDoctypePublicAndSystemIdentifiersState(self): self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data == EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True @@ -1564,13 +1913,15 @@ def afterDoctypeSystemKeywordState(self): if data in spaceCharacters: self.state = self.beforeDoctypeSystemIdentifierState elif data in ("'", '"'): - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.stream.unget(data) self.state = self.beforeDoctypeSystemIdentifierState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState @@ -1583,48 +1934,54 @@ def beforeDoctypeSystemIdentifierState(self): data = self.stream.char() if data in spaceCharacters: pass - elif data == "\"": + elif data == '"': self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierDoubleQuotedState elif data == "'": self.currentToken["systemId"] = "" self.state = self.doctypeSystemIdentifierSingleQuotedState elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.currentToken["correct"] = False self.state = self.bogusDoctypeState return True def doctypeSystemIdentifierDoubleQuotedState(self): data = self.stream.char() - if data == "\"": + if data == '"': self.state = self.afterDoctypeSystemIdentifierState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["systemId"] += "\uFFFD" elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-end-of-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState @@ -1637,18 +1994,21 @@ def doctypeSystemIdentifierSingleQuotedState(self): if data == "'": self.state = self.afterDoctypeSystemIdentifierState elif data == "\u0000": - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) self.currentToken["systemId"] += "\uFFFD" elif data == ">": - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-end-of-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-end-of-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState @@ -1664,14 +2024,16 @@ def afterDoctypeSystemIdentifierState(self): self.tokenQueue.append(self.currentToken) self.state = self.dataState elif data is EOF: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "eof-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "eof-in-doctype"} + ) self.currentToken["correct"] = False self.tokenQueue.append(self.currentToken) self.state = self.dataState else: - self.tokenQueue.append({"type": tokenTypes["ParseError"], "data": - "unexpected-char-in-doctype"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "unexpected-char-in-doctype"} + ) self.state = self.bogusDoctypeState return True @@ -1710,11 +2072,11 @@ def cdataSectionState(self): nullCount = data.count("\u0000") if nullCount > 0: for _ in range(nullCount): - self.tokenQueue.append({"type": tokenTypes["ParseError"], - "data": "invalid-codepoint"}) + self.tokenQueue.append( + {"type": tokenTypes["ParseError"], "data": "invalid-codepoint"} + ) data = data.replace("\u0000", "\uFFFD") if data: - self.tokenQueue.append({"type": tokenTypes["Characters"], - "data": data}) + self.tokenQueue.append({"type": tokenTypes["Characters"], "data": data}) self.state = self.dataState return True diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py index 2f709100..2b5d0f66 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/__init__.py @@ -1,4 +1,3 @@ - from .py import Trie as PyTrie Trie = PyTrie diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py index 43f682ea..f7cf1b05 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/_base.py @@ -1,4 +1,3 @@ - try: from collections.abc import Mapping except ImportError: # Python 2.7 diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py index 3912058b..4a05a175 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_trie/datrie.py @@ -1,4 +1,3 @@ - from datrie import Trie as DATrie from fetchcode.vcs.pip._vendor.six import text_type diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py b/src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py index b9052ac6..b12de330 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/_utils.py @@ -1,4 +1,3 @@ - from types import ModuleType from fetchcode.vcs.pip._vendor.six import text_type @@ -9,9 +8,14 @@ import xml.etree.ElementTree as default_etree -__all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair", - "surrogatePairToCodepoint", "moduleFactoryFactory", - "supports_lone_surrogates"] +__all__ = [ + "default_etree", + "MethodDispatcher", + "isSurrogatePair", + "surrogatePairToCodepoint", + "moduleFactoryFactory", + "supports_lone_surrogates", +] # Platforms not supporting lone surrogates (\uD800-\uDFFF) should be @@ -67,17 +71,22 @@ def __getitem__(self, key): # Some utility functions to deal with weirdness around UCS2 vs UCS4 # python builds + def isSurrogatePair(data): - return (len(data) == 2 and - ord(data[0]) >= 0xD800 and ord(data[0]) <= 0xDBFF and - ord(data[1]) >= 0xDC00 and ord(data[1]) <= 0xDFFF) + return ( + len(data) == 2 + and ord(data[0]) >= 0xD800 + and ord(data[0]) <= 0xDBFF + and ord(data[1]) >= 0xDC00 + and ord(data[1]) <= 0xDFFF + ) def surrogatePairToCodepoint(data): - char_val = (0x10000 + (ord(data[0]) - 0xD800) * 0x400 + - (ord(data[1]) - 0xDC00)) + char_val = 0x10000 + (ord(data[0]) - 0xD800) * 0x400 + (ord(data[1]) - 0xDC00) return char_val + # Module Factory Factory (no, this isn't Java, I know) # Here to stop this being duplicated all over the place. diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/constants.py b/src/fetchcode/vcs/pip/_vendor/html5lib/constants.py index 5f752698..5119a062 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/constants.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/constants.py @@ -1,295 +1,164 @@ - import string EOF = None E = { - "null-character": - "Null character in input stream, replaced with U+FFFD.", - "invalid-codepoint": - "Invalid codepoint in stream.", - "incorrectly-placed-solidus": - "Solidus (/) incorrectly placed in tag.", - "incorrect-cr-newline-entity": - "Incorrect CR newline entity, replaced with LF.", - "illegal-windows-1252-entity": - "Entity used with illegal number (windows-1252 reference).", - "cant-convert-numeric-entity": - "Numeric entity couldn't be converted to character " - "(codepoint U+%(charAsInt)08x).", - "illegal-codepoint-for-numeric-entity": - "Numeric entity represents an illegal codepoint: " - "U+%(charAsInt)08x.", - "numeric-entity-without-semicolon": - "Numeric entity didn't end with ';'.", - "expected-numeric-entity-but-got-eof": - "Numeric entity expected. Got end of file instead.", - "expected-numeric-entity": - "Numeric entity expected but none found.", - "named-entity-without-semicolon": - "Named entity didn't end with ';'.", - "expected-named-entity": - "Named entity expected. Got none.", - "attributes-in-end-tag": - "End tag contains unexpected attributes.", - 'self-closing-flag-on-end-tag': - "End tag contains unexpected self-closing flag.", - "expected-tag-name-but-got-right-bracket": - "Expected tag name. Got '>' instead.", - "expected-tag-name-but-got-question-mark": - "Expected tag name. Got '?' instead. (HTML doesn't " - "support processing instructions.)", - "expected-tag-name": - "Expected tag name. Got something else instead", - "expected-closing-tag-but-got-right-bracket": - "Expected closing tag. Got '>' instead. Ignoring ''.", - "expected-closing-tag-but-got-eof": - "Expected closing tag. Unexpected end of file.", - "expected-closing-tag-but-got-char": - "Expected closing tag. Unexpected character '%(data)s' found.", - "eof-in-tag-name": - "Unexpected end of file in the tag name.", - "expected-attribute-name-but-got-eof": - "Unexpected end of file. Expected attribute name instead.", - "eof-in-attribute-name": - "Unexpected end of file in attribute name.", - "invalid-character-in-attribute-name": - "Invalid character in attribute name", - "duplicate-attribute": - "Dropped duplicate attribute on tag.", - "expected-end-of-tag-name-but-got-eof": - "Unexpected end of file. Expected = or end of tag.", - "expected-attribute-value-but-got-eof": - "Unexpected end of file. Expected attribute value.", - "expected-attribute-value-but-got-right-bracket": - "Expected attribute value. Got '>' instead.", - 'equals-in-unquoted-attribute-value': - "Unexpected = in unquoted attribute", - 'unexpected-character-in-unquoted-attribute-value': - "Unexpected character in unquoted attribute", - "invalid-character-after-attribute-name": - "Unexpected character after attribute name.", - "unexpected-character-after-attribute-value": - "Unexpected character after attribute value.", - "eof-in-attribute-value-double-quote": - "Unexpected end of file in attribute value (\").", - "eof-in-attribute-value-single-quote": - "Unexpected end of file in attribute value (').", - "eof-in-attribute-value-no-quotes": - "Unexpected end of file in attribute value.", - "unexpected-EOF-after-solidus-in-tag": - "Unexpected end of file in tag. Expected >", - "unexpected-character-after-solidus-in-tag": - "Unexpected character after / in tag. Expected >", - "expected-dashes-or-doctype": - "Expected '--' or 'DOCTYPE'. Not found.", - "unexpected-bang-after-double-dash-in-comment": - "Unexpected ! after -- in comment", - "unexpected-space-after-double-dash-in-comment": - "Unexpected space after -- in comment", - "incorrect-comment": - "Incorrect comment.", - "eof-in-comment": - "Unexpected end of file in comment.", - "eof-in-comment-end-dash": - "Unexpected end of file in comment (-)", - "unexpected-dash-after-double-dash-in-comment": - "Unexpected '-' after '--' found in comment.", - "eof-in-comment-double-dash": - "Unexpected end of file in comment (--).", - "eof-in-comment-end-space-state": - "Unexpected end of file in comment.", - "eof-in-comment-end-bang-state": - "Unexpected end of file in comment.", - "unexpected-char-in-comment": - "Unexpected character in comment found.", - "need-space-after-doctype": - "No space after literal string 'DOCTYPE'.", - "expected-doctype-name-but-got-right-bracket": - "Unexpected > character. Expected DOCTYPE name.", - "expected-doctype-name-but-got-eof": - "Unexpected end of file. Expected DOCTYPE name.", - "eof-in-doctype-name": - "Unexpected end of file in DOCTYPE name.", - "eof-in-doctype": - "Unexpected end of file in DOCTYPE.", - "expected-space-or-right-bracket-in-doctype": - "Expected space or '>'. Got '%(data)s'", - "unexpected-end-of-doctype": - "Unexpected end of DOCTYPE.", - "unexpected-char-in-doctype": - "Unexpected character in DOCTYPE.", - "eof-in-innerhtml": - "XXX innerHTML EOF", - "unexpected-doctype": - "Unexpected DOCTYPE. Ignored.", - "non-html-root": - "html needs to be the first start tag.", - "expected-doctype-but-got-eof": - "Unexpected End of file. Expected DOCTYPE.", - "unknown-doctype": - "Erroneous DOCTYPE.", - "expected-doctype-but-got-chars": - "Unexpected non-space characters. Expected DOCTYPE.", - "expected-doctype-but-got-start-tag": - "Unexpected start tag (%(name)s). Expected DOCTYPE.", - "expected-doctype-but-got-end-tag": - "Unexpected end tag (%(name)s). Expected DOCTYPE.", - "end-tag-after-implied-root": - "Unexpected end tag (%(name)s) after the (implied) root element.", - "expected-named-closing-tag-but-got-eof": - "Unexpected end of file. Expected end tag (%(name)s).", - "two-heads-are-not-better-than-one": - "Unexpected start tag head in existing head. Ignored.", - "unexpected-end-tag": - "Unexpected end tag (%(name)s). Ignored.", - "unexpected-start-tag-out-of-my-head": - "Unexpected start tag (%(name)s) that can be in head. Moved.", - "unexpected-start-tag": - "Unexpected start tag (%(name)s).", - "missing-end-tag": - "Missing end tag (%(name)s).", - "missing-end-tags": - "Missing end tags (%(name)s).", - "unexpected-start-tag-implies-end-tag": - "Unexpected start tag (%(startName)s) " - "implies end tag (%(endName)s).", - "unexpected-start-tag-treated-as": - "Unexpected start tag (%(originalName)s). Treated as %(newName)s.", - "deprecated-tag": - "Unexpected start tag %(name)s. Don't use it!", - "unexpected-start-tag-ignored": - "Unexpected start tag %(name)s. Ignored.", - "expected-one-end-tag-but-got-another": - "Unexpected end tag (%(gotName)s). " - "Missing end tag (%(expectedName)s).", - "end-tag-too-early": - "End tag (%(name)s) seen too early. Expected other end tag.", - "end-tag-too-early-named": - "Unexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).", - "end-tag-too-early-ignored": - "End tag (%(name)s) seen too early. Ignored.", - "adoption-agency-1.1": - "End tag (%(name)s) violates step 1, " - "paragraph 1 of the adoption agency algorithm.", - "adoption-agency-1.2": - "End tag (%(name)s) violates step 1, " - "paragraph 2 of the adoption agency algorithm.", - "adoption-agency-1.3": - "End tag (%(name)s) violates step 1, " - "paragraph 3 of the adoption agency algorithm.", - "adoption-agency-4.4": - "End tag (%(name)s) violates step 4, " - "paragraph 4 of the adoption agency algorithm.", - "unexpected-end-tag-treated-as": - "Unexpected end tag (%(originalName)s). Treated as %(newName)s.", - "no-end-tag": - "This element (%(name)s) has no end tag.", - "unexpected-implied-end-tag-in-table": - "Unexpected implied end tag (%(name)s) in the table phase.", - "unexpected-implied-end-tag-in-table-body": - "Unexpected implied end tag (%(name)s) in the table body phase.", - "unexpected-char-implies-table-voodoo": - "Unexpected non-space characters in " - "table context caused voodoo mode.", - "unexpected-hidden-input-in-table": - "Unexpected input with type hidden in table context.", - "unexpected-form-in-table": - "Unexpected form in table context.", - "unexpected-start-tag-implies-table-voodoo": - "Unexpected start tag (%(name)s) in " - "table context caused voodoo mode.", - "unexpected-end-tag-implies-table-voodoo": - "Unexpected end tag (%(name)s) in " - "table context caused voodoo mode.", - "unexpected-cell-in-table-body": - "Unexpected table cell start tag (%(name)s) " - "in the table body phase.", - "unexpected-cell-end-tag": - "Got table cell end tag (%(name)s) " - "while required end tags are missing.", - "unexpected-end-tag-in-table-body": - "Unexpected end tag (%(name)s) in the table body phase. Ignored.", - "unexpected-implied-end-tag-in-table-row": - "Unexpected implied end tag (%(name)s) in the table row phase.", - "unexpected-end-tag-in-table-row": - "Unexpected end tag (%(name)s) in the table row phase. Ignored.", - "unexpected-select-in-select": - "Unexpected select start tag in the select phase " - "treated as select end tag.", - "unexpected-input-in-select": - "Unexpected input start tag in the select phase.", - "unexpected-start-tag-in-select": - "Unexpected start tag token (%(name)s in the select phase. " - "Ignored.", - "unexpected-end-tag-in-select": - "Unexpected end tag (%(name)s) in the select phase. Ignored.", - "unexpected-table-element-start-tag-in-select-in-table": - "Unexpected table element start tag (%(name)s) in the select in table phase.", - "unexpected-table-element-end-tag-in-select-in-table": - "Unexpected table element end tag (%(name)s) in the select in table phase.", - "unexpected-char-after-body": - "Unexpected non-space characters in the after body phase.", - "unexpected-start-tag-after-body": - "Unexpected start tag token (%(name)s)" - " in the after body phase.", - "unexpected-end-tag-after-body": - "Unexpected end tag token (%(name)s)" - " in the after body phase.", - "unexpected-char-in-frameset": - "Unexpected characters in the frameset phase. Characters ignored.", - "unexpected-start-tag-in-frameset": - "Unexpected start tag token (%(name)s)" - " in the frameset phase. Ignored.", - "unexpected-frameset-in-frameset-innerhtml": - "Unexpected end tag token (frameset) " - "in the frameset phase (innerHTML).", - "unexpected-end-tag-in-frameset": - "Unexpected end tag token (%(name)s)" - " in the frameset phase. Ignored.", - "unexpected-char-after-frameset": - "Unexpected non-space characters in the " - "after frameset phase. Ignored.", - "unexpected-start-tag-after-frameset": - "Unexpected start tag (%(name)s)" - " in the after frameset phase. Ignored.", - "unexpected-end-tag-after-frameset": - "Unexpected end tag (%(name)s)" - " in the after frameset phase. Ignored.", - "unexpected-end-tag-after-body-innerhtml": - "Unexpected end tag after body(innerHtml)", - "expected-eof-but-got-char": - "Unexpected non-space characters. Expected end of file.", - "expected-eof-but-got-start-tag": - "Unexpected start tag (%(name)s)" - ". Expected end of file.", - "expected-eof-but-got-end-tag": - "Unexpected end tag (%(name)s)" - ". Expected end of file.", - "eof-in-table": - "Unexpected end of file. Expected table content.", - "eof-in-select": - "Unexpected end of file. Expected select content.", - "eof-in-frameset": - "Unexpected end of file. Expected frameset content.", - "eof-in-script-in-script": - "Unexpected end of file. Expected script content.", - "eof-in-foreign-lands": - "Unexpected end of file. Expected foreign content", - "non-void-element-with-trailing-solidus": - "Trailing solidus not allowed on element %(name)s", - "unexpected-html-element-in-foreign-content": - "Element %(name)s not allowed in a non-html context", - "unexpected-end-tag-before-html": - "Unexpected end tag (%(name)s) before html.", - "unexpected-inhead-noscript-tag": - "Element %(name)s not allowed in a inhead-noscript context", - "eof-in-head-noscript": - "Unexpected end of file. Expected inhead-noscript content", - "char-in-head-noscript": - "Unexpected non-space character. Expected inhead-noscript content", - "XXX-undefined-error": - "Undefined error (this sucks and should be fixed)", + "null-character": "Null character in input stream, replaced with U+FFFD.", + "invalid-codepoint": "Invalid codepoint in stream.", + "incorrectly-placed-solidus": "Solidus (/) incorrectly placed in tag.", + "incorrect-cr-newline-entity": "Incorrect CR newline entity, replaced with LF.", + "illegal-windows-1252-entity": "Entity used with illegal number (windows-1252 reference).", + "cant-convert-numeric-entity": "Numeric entity couldn't be converted to character " + "(codepoint U+%(charAsInt)08x).", + "illegal-codepoint-for-numeric-entity": "Numeric entity represents an illegal codepoint: " + "U+%(charAsInt)08x.", + "numeric-entity-without-semicolon": "Numeric entity didn't end with ';'.", + "expected-numeric-entity-but-got-eof": "Numeric entity expected. Got end of file instead.", + "expected-numeric-entity": "Numeric entity expected but none found.", + "named-entity-without-semicolon": "Named entity didn't end with ';'.", + "expected-named-entity": "Named entity expected. Got none.", + "attributes-in-end-tag": "End tag contains unexpected attributes.", + "self-closing-flag-on-end-tag": "End tag contains unexpected self-closing flag.", + "expected-tag-name-but-got-right-bracket": "Expected tag name. Got '>' instead.", + "expected-tag-name-but-got-question-mark": "Expected tag name. Got '?' instead. (HTML doesn't " + "support processing instructions.)", + "expected-tag-name": "Expected tag name. Got something else instead", + "expected-closing-tag-but-got-right-bracket": "Expected closing tag. Got '>' instead. Ignoring ''.", + "expected-closing-tag-but-got-eof": "Expected closing tag. Unexpected end of file.", + "expected-closing-tag-but-got-char": "Expected closing tag. Unexpected character '%(data)s' found.", + "eof-in-tag-name": "Unexpected end of file in the tag name.", + "expected-attribute-name-but-got-eof": "Unexpected end of file. Expected attribute name instead.", + "eof-in-attribute-name": "Unexpected end of file in attribute name.", + "invalid-character-in-attribute-name": "Invalid character in attribute name", + "duplicate-attribute": "Dropped duplicate attribute on tag.", + "expected-end-of-tag-name-but-got-eof": "Unexpected end of file. Expected = or end of tag.", + "expected-attribute-value-but-got-eof": "Unexpected end of file. Expected attribute value.", + "expected-attribute-value-but-got-right-bracket": "Expected attribute value. Got '>' instead.", + "equals-in-unquoted-attribute-value": "Unexpected = in unquoted attribute", + "unexpected-character-in-unquoted-attribute-value": "Unexpected character in unquoted attribute", + "invalid-character-after-attribute-name": "Unexpected character after attribute name.", + "unexpected-character-after-attribute-value": "Unexpected character after attribute value.", + "eof-in-attribute-value-double-quote": 'Unexpected end of file in attribute value (").', + "eof-in-attribute-value-single-quote": "Unexpected end of file in attribute value (').", + "eof-in-attribute-value-no-quotes": "Unexpected end of file in attribute value.", + "unexpected-EOF-after-solidus-in-tag": "Unexpected end of file in tag. Expected >", + "unexpected-character-after-solidus-in-tag": "Unexpected character after / in tag. Expected >", + "expected-dashes-or-doctype": "Expected '--' or 'DOCTYPE'. Not found.", + "unexpected-bang-after-double-dash-in-comment": "Unexpected ! after -- in comment", + "unexpected-space-after-double-dash-in-comment": "Unexpected space after -- in comment", + "incorrect-comment": "Incorrect comment.", + "eof-in-comment": "Unexpected end of file in comment.", + "eof-in-comment-end-dash": "Unexpected end of file in comment (-)", + "unexpected-dash-after-double-dash-in-comment": "Unexpected '-' after '--' found in comment.", + "eof-in-comment-double-dash": "Unexpected end of file in comment (--).", + "eof-in-comment-end-space-state": "Unexpected end of file in comment.", + "eof-in-comment-end-bang-state": "Unexpected end of file in comment.", + "unexpected-char-in-comment": "Unexpected character in comment found.", + "need-space-after-doctype": "No space after literal string 'DOCTYPE'.", + "expected-doctype-name-but-got-right-bracket": "Unexpected > character. Expected DOCTYPE name.", + "expected-doctype-name-but-got-eof": "Unexpected end of file. Expected DOCTYPE name.", + "eof-in-doctype-name": "Unexpected end of file in DOCTYPE name.", + "eof-in-doctype": "Unexpected end of file in DOCTYPE.", + "expected-space-or-right-bracket-in-doctype": "Expected space or '>'. Got '%(data)s'", + "unexpected-end-of-doctype": "Unexpected end of DOCTYPE.", + "unexpected-char-in-doctype": "Unexpected character in DOCTYPE.", + "eof-in-innerhtml": "XXX innerHTML EOF", + "unexpected-doctype": "Unexpected DOCTYPE. Ignored.", + "non-html-root": "html needs to be the first start tag.", + "expected-doctype-but-got-eof": "Unexpected End of file. Expected DOCTYPE.", + "unknown-doctype": "Erroneous DOCTYPE.", + "expected-doctype-but-got-chars": "Unexpected non-space characters. Expected DOCTYPE.", + "expected-doctype-but-got-start-tag": "Unexpected start tag (%(name)s). Expected DOCTYPE.", + "expected-doctype-but-got-end-tag": "Unexpected end tag (%(name)s). Expected DOCTYPE.", + "end-tag-after-implied-root": "Unexpected end tag (%(name)s) after the (implied) root element.", + "expected-named-closing-tag-but-got-eof": "Unexpected end of file. Expected end tag (%(name)s).", + "two-heads-are-not-better-than-one": "Unexpected start tag head in existing head. Ignored.", + "unexpected-end-tag": "Unexpected end tag (%(name)s). Ignored.", + "unexpected-start-tag-out-of-my-head": "Unexpected start tag (%(name)s) that can be in head. Moved.", + "unexpected-start-tag": "Unexpected start tag (%(name)s).", + "missing-end-tag": "Missing end tag (%(name)s).", + "missing-end-tags": "Missing end tags (%(name)s).", + "unexpected-start-tag-implies-end-tag": "Unexpected start tag (%(startName)s) " + "implies end tag (%(endName)s).", + "unexpected-start-tag-treated-as": "Unexpected start tag (%(originalName)s). Treated as %(newName)s.", + "deprecated-tag": "Unexpected start tag %(name)s. Don't use it!", + "unexpected-start-tag-ignored": "Unexpected start tag %(name)s. Ignored.", + "expected-one-end-tag-but-got-another": "Unexpected end tag (%(gotName)s). " + "Missing end tag (%(expectedName)s).", + "end-tag-too-early": "End tag (%(name)s) seen too early. Expected other end tag.", + "end-tag-too-early-named": "Unexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s).", + "end-tag-too-early-ignored": "End tag (%(name)s) seen too early. Ignored.", + "adoption-agency-1.1": "End tag (%(name)s) violates step 1, " + "paragraph 1 of the adoption agency algorithm.", + "adoption-agency-1.2": "End tag (%(name)s) violates step 1, " + "paragraph 2 of the adoption agency algorithm.", + "adoption-agency-1.3": "End tag (%(name)s) violates step 1, " + "paragraph 3 of the adoption agency algorithm.", + "adoption-agency-4.4": "End tag (%(name)s) violates step 4, " + "paragraph 4 of the adoption agency algorithm.", + "unexpected-end-tag-treated-as": "Unexpected end tag (%(originalName)s). Treated as %(newName)s.", + "no-end-tag": "This element (%(name)s) has no end tag.", + "unexpected-implied-end-tag-in-table": "Unexpected implied end tag (%(name)s) in the table phase.", + "unexpected-implied-end-tag-in-table-body": "Unexpected implied end tag (%(name)s) in the table body phase.", + "unexpected-char-implies-table-voodoo": "Unexpected non-space characters in " + "table context caused voodoo mode.", + "unexpected-hidden-input-in-table": "Unexpected input with type hidden in table context.", + "unexpected-form-in-table": "Unexpected form in table context.", + "unexpected-start-tag-implies-table-voodoo": "Unexpected start tag (%(name)s) in " + "table context caused voodoo mode.", + "unexpected-end-tag-implies-table-voodoo": "Unexpected end tag (%(name)s) in " + "table context caused voodoo mode.", + "unexpected-cell-in-table-body": "Unexpected table cell start tag (%(name)s) " + "in the table body phase.", + "unexpected-cell-end-tag": "Got table cell end tag (%(name)s) " + "while required end tags are missing.", + "unexpected-end-tag-in-table-body": "Unexpected end tag (%(name)s) in the table body phase. Ignored.", + "unexpected-implied-end-tag-in-table-row": "Unexpected implied end tag (%(name)s) in the table row phase.", + "unexpected-end-tag-in-table-row": "Unexpected end tag (%(name)s) in the table row phase. Ignored.", + "unexpected-select-in-select": "Unexpected select start tag in the select phase " + "treated as select end tag.", + "unexpected-input-in-select": "Unexpected input start tag in the select phase.", + "unexpected-start-tag-in-select": "Unexpected start tag token (%(name)s in the select phase. " + "Ignored.", + "unexpected-end-tag-in-select": "Unexpected end tag (%(name)s) in the select phase. Ignored.", + "unexpected-table-element-start-tag-in-select-in-table": "Unexpected table element start tag (%(name)s) in the select in table phase.", + "unexpected-table-element-end-tag-in-select-in-table": "Unexpected table element end tag (%(name)s) in the select in table phase.", + "unexpected-char-after-body": "Unexpected non-space characters in the after body phase.", + "unexpected-start-tag-after-body": "Unexpected start tag token (%(name)s)" + " in the after body phase.", + "unexpected-end-tag-after-body": "Unexpected end tag token (%(name)s)" + " in the after body phase.", + "unexpected-char-in-frameset": "Unexpected characters in the frameset phase. Characters ignored.", + "unexpected-start-tag-in-frameset": "Unexpected start tag token (%(name)s)" + " in the frameset phase. Ignored.", + "unexpected-frameset-in-frameset-innerhtml": "Unexpected end tag token (frameset) " + "in the frameset phase (innerHTML).", + "unexpected-end-tag-in-frameset": "Unexpected end tag token (%(name)s)" + " in the frameset phase. Ignored.", + "unexpected-char-after-frameset": "Unexpected non-space characters in the " + "after frameset phase. Ignored.", + "unexpected-start-tag-after-frameset": "Unexpected start tag (%(name)s)" + " in the after frameset phase. Ignored.", + "unexpected-end-tag-after-frameset": "Unexpected end tag (%(name)s)" + " in the after frameset phase. Ignored.", + "unexpected-end-tag-after-body-innerhtml": "Unexpected end tag after body(innerHtml)", + "expected-eof-but-got-char": "Unexpected non-space characters. Expected end of file.", + "expected-eof-but-got-start-tag": "Unexpected start tag (%(name)s)" + ". Expected end of file.", + "expected-eof-but-got-end-tag": "Unexpected end tag (%(name)s)" + ". Expected end of file.", + "eof-in-table": "Unexpected end of file. Expected table content.", + "eof-in-select": "Unexpected end of file. Expected select content.", + "eof-in-frameset": "Unexpected end of file. Expected frameset content.", + "eof-in-script-in-script": "Unexpected end of file. Expected script content.", + "eof-in-foreign-lands": "Unexpected end of file. Expected foreign content", + "non-void-element-with-trailing-solidus": "Trailing solidus not allowed on element %(name)s", + "unexpected-html-element-in-foreign-content": "Element %(name)s not allowed in a non-html context", + "unexpected-end-tag-before-html": "Unexpected end tag (%(name)s) before html.", + "unexpected-inhead-noscript-tag": "Element %(name)s not allowed in a inhead-noscript context", + "eof-in-head-noscript": "Unexpected end of file. Expected inhead-noscript content", + "char-in-head-noscript": "Unexpected non-space character. Expected inhead-noscript content", + "XXX-undefined-error": "Undefined error (this sucks and should be fixed)", } namespaces = { @@ -298,143 +167,153 @@ "svg": "http://www.w3.org/2000/svg", "xlink": "http://www.w3.org/1999/xlink", "xml": "http://www.w3.org/XML/1998/namespace", - "xmlns": "http://www.w3.org/2000/xmlns/" + "xmlns": "http://www.w3.org/2000/xmlns/", } -scopingElements = frozenset([ - (namespaces["html"], "applet"), - (namespaces["html"], "caption"), - (namespaces["html"], "html"), - (namespaces["html"], "marquee"), - (namespaces["html"], "object"), - (namespaces["html"], "table"), - (namespaces["html"], "td"), - (namespaces["html"], "th"), - (namespaces["mathml"], "mi"), - (namespaces["mathml"], "mo"), - (namespaces["mathml"], "mn"), - (namespaces["mathml"], "ms"), - (namespaces["mathml"], "mtext"), - (namespaces["mathml"], "annotation-xml"), - (namespaces["svg"], "foreignObject"), - (namespaces["svg"], "desc"), - (namespaces["svg"], "title"), -]) +scopingElements = frozenset( + [ + (namespaces["html"], "applet"), + (namespaces["html"], "caption"), + (namespaces["html"], "html"), + (namespaces["html"], "marquee"), + (namespaces["html"], "object"), + (namespaces["html"], "table"), + (namespaces["html"], "td"), + (namespaces["html"], "th"), + (namespaces["mathml"], "mi"), + (namespaces["mathml"], "mo"), + (namespaces["mathml"], "mn"), + (namespaces["mathml"], "ms"), + (namespaces["mathml"], "mtext"), + (namespaces["mathml"], "annotation-xml"), + (namespaces["svg"], "foreignObject"), + (namespaces["svg"], "desc"), + (namespaces["svg"], "title"), + ] +) -formattingElements = frozenset([ - (namespaces["html"], "a"), - (namespaces["html"], "b"), - (namespaces["html"], "big"), - (namespaces["html"], "code"), - (namespaces["html"], "em"), - (namespaces["html"], "font"), - (namespaces["html"], "i"), - (namespaces["html"], "nobr"), - (namespaces["html"], "s"), - (namespaces["html"], "small"), - (namespaces["html"], "strike"), - (namespaces["html"], "strong"), - (namespaces["html"], "tt"), - (namespaces["html"], "u") -]) +formattingElements = frozenset( + [ + (namespaces["html"], "a"), + (namespaces["html"], "b"), + (namespaces["html"], "big"), + (namespaces["html"], "code"), + (namespaces["html"], "em"), + (namespaces["html"], "font"), + (namespaces["html"], "i"), + (namespaces["html"], "nobr"), + (namespaces["html"], "s"), + (namespaces["html"], "small"), + (namespaces["html"], "strike"), + (namespaces["html"], "strong"), + (namespaces["html"], "tt"), + (namespaces["html"], "u"), + ] +) -specialElements = frozenset([ - (namespaces["html"], "address"), - (namespaces["html"], "applet"), - (namespaces["html"], "area"), - (namespaces["html"], "article"), - (namespaces["html"], "aside"), - (namespaces["html"], "base"), - (namespaces["html"], "basefont"), - (namespaces["html"], "bgsound"), - (namespaces["html"], "blockquote"), - (namespaces["html"], "body"), - (namespaces["html"], "br"), - (namespaces["html"], "button"), - (namespaces["html"], "caption"), - (namespaces["html"], "center"), - (namespaces["html"], "col"), - (namespaces["html"], "colgroup"), - (namespaces["html"], "command"), - (namespaces["html"], "dd"), - (namespaces["html"], "details"), - (namespaces["html"], "dir"), - (namespaces["html"], "div"), - (namespaces["html"], "dl"), - (namespaces["html"], "dt"), - (namespaces["html"], "embed"), - (namespaces["html"], "fieldset"), - (namespaces["html"], "figure"), - (namespaces["html"], "footer"), - (namespaces["html"], "form"), - (namespaces["html"], "frame"), - (namespaces["html"], "frameset"), - (namespaces["html"], "h1"), - (namespaces["html"], "h2"), - (namespaces["html"], "h3"), - (namespaces["html"], "h4"), - (namespaces["html"], "h5"), - (namespaces["html"], "h6"), - (namespaces["html"], "head"), - (namespaces["html"], "header"), - (namespaces["html"], "hr"), - (namespaces["html"], "html"), - (namespaces["html"], "iframe"), - # Note that image is commented out in the spec as "this isn't an - # element that can end up on the stack, so it doesn't matter," - (namespaces["html"], "image"), - (namespaces["html"], "img"), - (namespaces["html"], "input"), - (namespaces["html"], "isindex"), - (namespaces["html"], "li"), - (namespaces["html"], "link"), - (namespaces["html"], "listing"), - (namespaces["html"], "marquee"), - (namespaces["html"], "menu"), - (namespaces["html"], "meta"), - (namespaces["html"], "nav"), - (namespaces["html"], "noembed"), - (namespaces["html"], "noframes"), - (namespaces["html"], "noscript"), - (namespaces["html"], "object"), - (namespaces["html"], "ol"), - (namespaces["html"], "p"), - (namespaces["html"], "param"), - (namespaces["html"], "plaintext"), - (namespaces["html"], "pre"), - (namespaces["html"], "script"), - (namespaces["html"], "section"), - (namespaces["html"], "select"), - (namespaces["html"], "style"), - (namespaces["html"], "table"), - (namespaces["html"], "tbody"), - (namespaces["html"], "td"), - (namespaces["html"], "textarea"), - (namespaces["html"], "tfoot"), - (namespaces["html"], "th"), - (namespaces["html"], "thead"), - (namespaces["html"], "title"), - (namespaces["html"], "tr"), - (namespaces["html"], "ul"), - (namespaces["html"], "wbr"), - (namespaces["html"], "xmp"), - (namespaces["svg"], "foreignObject") -]) +specialElements = frozenset( + [ + (namespaces["html"], "address"), + (namespaces["html"], "applet"), + (namespaces["html"], "area"), + (namespaces["html"], "article"), + (namespaces["html"], "aside"), + (namespaces["html"], "base"), + (namespaces["html"], "basefont"), + (namespaces["html"], "bgsound"), + (namespaces["html"], "blockquote"), + (namespaces["html"], "body"), + (namespaces["html"], "br"), + (namespaces["html"], "button"), + (namespaces["html"], "caption"), + (namespaces["html"], "center"), + (namespaces["html"], "col"), + (namespaces["html"], "colgroup"), + (namespaces["html"], "command"), + (namespaces["html"], "dd"), + (namespaces["html"], "details"), + (namespaces["html"], "dir"), + (namespaces["html"], "div"), + (namespaces["html"], "dl"), + (namespaces["html"], "dt"), + (namespaces["html"], "embed"), + (namespaces["html"], "fieldset"), + (namespaces["html"], "figure"), + (namespaces["html"], "footer"), + (namespaces["html"], "form"), + (namespaces["html"], "frame"), + (namespaces["html"], "frameset"), + (namespaces["html"], "h1"), + (namespaces["html"], "h2"), + (namespaces["html"], "h3"), + (namespaces["html"], "h4"), + (namespaces["html"], "h5"), + (namespaces["html"], "h6"), + (namespaces["html"], "head"), + (namespaces["html"], "header"), + (namespaces["html"], "hr"), + (namespaces["html"], "html"), + (namespaces["html"], "iframe"), + # Note that image is commented out in the spec as "this isn't an + # element that can end up on the stack, so it doesn't matter," + (namespaces["html"], "image"), + (namespaces["html"], "img"), + (namespaces["html"], "input"), + (namespaces["html"], "isindex"), + (namespaces["html"], "li"), + (namespaces["html"], "link"), + (namespaces["html"], "listing"), + (namespaces["html"], "marquee"), + (namespaces["html"], "menu"), + (namespaces["html"], "meta"), + (namespaces["html"], "nav"), + (namespaces["html"], "noembed"), + (namespaces["html"], "noframes"), + (namespaces["html"], "noscript"), + (namespaces["html"], "object"), + (namespaces["html"], "ol"), + (namespaces["html"], "p"), + (namespaces["html"], "param"), + (namespaces["html"], "plaintext"), + (namespaces["html"], "pre"), + (namespaces["html"], "script"), + (namespaces["html"], "section"), + (namespaces["html"], "select"), + (namespaces["html"], "style"), + (namespaces["html"], "table"), + (namespaces["html"], "tbody"), + (namespaces["html"], "td"), + (namespaces["html"], "textarea"), + (namespaces["html"], "tfoot"), + (namespaces["html"], "th"), + (namespaces["html"], "thead"), + (namespaces["html"], "title"), + (namespaces["html"], "tr"), + (namespaces["html"], "ul"), + (namespaces["html"], "wbr"), + (namespaces["html"], "xmp"), + (namespaces["svg"], "foreignObject"), + ] +) -htmlIntegrationPointElements = frozenset([ - (namespaces["mathml"], "annotation-xml"), - (namespaces["svg"], "foreignObject"), - (namespaces["svg"], "desc"), - (namespaces["svg"], "title") -]) +htmlIntegrationPointElements = frozenset( + [ + (namespaces["mathml"], "annotation-xml"), + (namespaces["svg"], "foreignObject"), + (namespaces["svg"], "desc"), + (namespaces["svg"], "title"), + ] +) -mathmlTextIntegrationPointElements = frozenset([ - (namespaces["mathml"], "mi"), - (namespaces["mathml"], "mo"), - (namespaces["mathml"], "mn"), - (namespaces["mathml"], "ms"), - (namespaces["mathml"], "mtext") -]) +mathmlTextIntegrationPointElements = frozenset( + [ + (namespaces["mathml"], "mi"), + (namespaces["mathml"], "mo"), + (namespaces["mathml"], "mn"), + (namespaces["mathml"], "ms"), + (namespaces["mathml"], "mtext"), + ] +) adjustSVGAttributes = { "attributename": "attributeName", @@ -498,7 +377,7 @@ "viewtarget": "viewTarget", "xchannelselector": "xChannelSelector", "ychannelselector": "yChannelSelector", - "zoomandpan": "zoomAndPan" + "zoomandpan": "zoomAndPan", } adjustMathMLAttributes = {"definitionurl": "definitionURL"} @@ -515,27 +394,19 @@ "xml:lang": ("xml", "lang", namespaces["xml"]), "xml:space": ("xml", "space", namespaces["xml"]), "xmlns": (None, "xmlns", namespaces["xmlns"]), - "xmlns:xlink": ("xmlns", "xlink", namespaces["xmlns"]) + "xmlns:xlink": ("xmlns", "xlink", namespaces["xmlns"]), } -unadjustForeignAttributes = dict([((ns, local), qname) for qname, (prefix, local, ns) in - adjustForeignAttributes.items()]) +unadjustForeignAttributes = dict( + [ + ((ns, local), qname) + for qname, (prefix, local, ns) in adjustForeignAttributes.items() + ] +) -spaceCharacters = frozenset([ - "\t", - "\n", - "\u000C", - " ", - "\r" -]) +spaceCharacters = frozenset(["\t", "\n", "\u000C", " ", "\r"]) -tableInsertModeElements = frozenset([ - "table", - "tbody", - "tfoot", - "thead", - "tr" -]) +tableInsertModeElements = frozenset(["table", "tbody", "tfoot", "thead", "tr"]) asciiLowercase = frozenset(string.ascii_lowercase) asciiUppercase = frozenset(string.ascii_uppercase) @@ -543,48 +414,36 @@ digits = frozenset(string.digits) hexDigits = frozenset(string.hexdigits) -asciiUpper2Lower = dict([(ord(c), ord(c.lower())) - for c in string.ascii_uppercase]) +asciiUpper2Lower = dict([(ord(c), ord(c.lower())) for c in string.ascii_uppercase]) # Heading elements need to be ordered -headingElements = ( - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" -) +headingElements = ("h1", "h2", "h3", "h4", "h5", "h6") -voidElements = frozenset([ - "base", - "command", - "event-source", - "link", - "meta", - "hr", - "br", - "img", - "embed", - "param", - "area", - "col", - "input", - "source", - "track" -]) +voidElements = frozenset( + [ + "base", + "command", + "event-source", + "link", + "meta", + "hr", + "br", + "img", + "embed", + "param", + "area", + "col", + "input", + "source", + "track", + ] +) -cdataElements = frozenset(['title', 'textarea']) +cdataElements = frozenset(["title", "textarea"]) -rcdataElements = frozenset([ - 'style', - 'script', - 'xmp', - 'iframe', - 'noembed', - 'noframes', - 'noscript' -]) +rcdataElements = frozenset( + ["style", "script", "xmp", "iframe", "noembed", "noframes", "noscript"] +) booleanAttributes = { "": frozenset(["irrelevant", "itemscope"]), @@ -602,7 +461,9 @@ "option": frozenset(["disabled", "readonly", "selected"]), "optgroup": frozenset(["disabled", "readonly"]), "button": frozenset(["disabled", "autofocus"]), - "input": frozenset(["disabled", "readonly", "required", "autofocus", "checked", "ismap"]), + "input": frozenset( + ["disabled", "readonly", "required", "autofocus", "checked", "ismap"] + ), "select": frozenset(["disabled", "readonly", "autofocus", "multiple"]), "output": frozenset(["disabled", "readonly"]), "iframe": frozenset(["seamless"]), @@ -611,41 +472,41 @@ # entitiesWindows1252 has to be _ordered_ and needs to have an index. It # therefore can't be a frozenset. entitiesWindows1252 = ( - 8364, # 0x80 0x20AC EURO SIGN + 8364, # 0x80 0x20AC EURO SIGN 65533, # 0x81 UNDEFINED - 8218, # 0x82 0x201A SINGLE LOW-9 QUOTATION MARK - 402, # 0x83 0x0192 LATIN SMALL LETTER F WITH HOOK - 8222, # 0x84 0x201E DOUBLE LOW-9 QUOTATION MARK - 8230, # 0x85 0x2026 HORIZONTAL ELLIPSIS - 8224, # 0x86 0x2020 DAGGER - 8225, # 0x87 0x2021 DOUBLE DAGGER - 710, # 0x88 0x02C6 MODIFIER LETTER CIRCUMFLEX ACCENT - 8240, # 0x89 0x2030 PER MILLE SIGN - 352, # 0x8A 0x0160 LATIN CAPITAL LETTER S WITH CARON - 8249, # 0x8B 0x2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK - 338, # 0x8C 0x0152 LATIN CAPITAL LIGATURE OE + 8218, # 0x82 0x201A SINGLE LOW-9 QUOTATION MARK + 402, # 0x83 0x0192 LATIN SMALL LETTER F WITH HOOK + 8222, # 0x84 0x201E DOUBLE LOW-9 QUOTATION MARK + 8230, # 0x85 0x2026 HORIZONTAL ELLIPSIS + 8224, # 0x86 0x2020 DAGGER + 8225, # 0x87 0x2021 DOUBLE DAGGER + 710, # 0x88 0x02C6 MODIFIER LETTER CIRCUMFLEX ACCENT + 8240, # 0x89 0x2030 PER MILLE SIGN + 352, # 0x8A 0x0160 LATIN CAPITAL LETTER S WITH CARON + 8249, # 0x8B 0x2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK + 338, # 0x8C 0x0152 LATIN CAPITAL LIGATURE OE 65533, # 0x8D UNDEFINED - 381, # 0x8E 0x017D LATIN CAPITAL LETTER Z WITH CARON + 381, # 0x8E 0x017D LATIN CAPITAL LETTER Z WITH CARON 65533, # 0x8F UNDEFINED 65533, # 0x90 UNDEFINED - 8216, # 0x91 0x2018 LEFT SINGLE QUOTATION MARK - 8217, # 0x92 0x2019 RIGHT SINGLE QUOTATION MARK - 8220, # 0x93 0x201C LEFT DOUBLE QUOTATION MARK - 8221, # 0x94 0x201D RIGHT DOUBLE QUOTATION MARK - 8226, # 0x95 0x2022 BULLET - 8211, # 0x96 0x2013 EN DASH - 8212, # 0x97 0x2014 EM DASH - 732, # 0x98 0x02DC SMALL TILDE - 8482, # 0x99 0x2122 TRADE MARK SIGN - 353, # 0x9A 0x0161 LATIN SMALL LETTER S WITH CARON - 8250, # 0x9B 0x203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - 339, # 0x9C 0x0153 LATIN SMALL LIGATURE OE + 8216, # 0x91 0x2018 LEFT SINGLE QUOTATION MARK + 8217, # 0x92 0x2019 RIGHT SINGLE QUOTATION MARK + 8220, # 0x93 0x201C LEFT DOUBLE QUOTATION MARK + 8221, # 0x94 0x201D RIGHT DOUBLE QUOTATION MARK + 8226, # 0x95 0x2022 BULLET + 8211, # 0x96 0x2013 EN DASH + 8212, # 0x97 0x2014 EM DASH + 732, # 0x98 0x02DC SMALL TILDE + 8482, # 0x99 0x2122 TRADE MARK SIGN + 353, # 0x9A 0x0161 LATIN SMALL LETTER S WITH CARON + 8250, # 0x9B 0x203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + 339, # 0x9C 0x0153 LATIN SMALL LIGATURE OE 65533, # 0x9D UNDEFINED - 382, # 0x9E 0x017E LATIN SMALL LETTER Z WITH CARON - 376 # 0x9F 0x0178 LATIN CAPITAL LETTER Y WITH DIAERESIS + 382, # 0x9E 0x017E LATIN SMALL LETTER Z WITH CARON + 376, # 0x9F 0x0178 LATIN CAPITAL LETTER Y WITH DIAERESIS ) -xmlEntities = frozenset(['lt;', 'gt;', 'amp;', 'apos;', 'quot;']) +xmlEntities = frozenset(["lt;", "gt;", "amp;", "apos;", "quot;"]) entities = { "AElig": "\xc6", @@ -1082,8 +943,8 @@ "Proportional;": "\u221d", "Pscr;": "\U0001d4ab", "Psi;": "\u03a8", - "QUOT": "\"", - "QUOT;": "\"", + "QUOT": '"', + "QUOT;": '"', "Qfr;": "\U0001d514", "Qopf;": "\u211a", "Qscr;": "\U0001d4ac", @@ -2401,8 +2262,8 @@ "quatint;": "\u2a16", "quest;": "?", "questeq;": "\u225f", - "quot": "\"", - "quot;": "\"", + "quot": '"', + "quot;": '"', "rAarr;": "\u21db", "rArr;": "\u21d2", "rAtail;": "\u291c", @@ -2883,7 +2744,7 @@ replacementCharacters = { 0x0: "\uFFFD", - 0x0d: "\u000D", + 0x0D: "\u000D", 0x80: "\u20AC", 0x81: "\u0081", 0x82: "\u201A", @@ -2926,11 +2787,12 @@ "EndTag": 4, "EmptyTag": 5, "Comment": 6, - "ParseError": 7 + "ParseError": 7, } -tagTokenTypes = frozenset([tokenTypes["StartTag"], tokenTypes["EndTag"], - tokenTypes["EmptyTag"]]) +tagTokenTypes = frozenset( + [tokenTypes["StartTag"], tokenTypes["EndTag"], tokenTypes["EmptyTag"]] +) prefixes = dict([(v, k) for k, v in namespaces.items()]) @@ -2939,6 +2801,7 @@ class DataLossWarning(UserWarning): """Raised when the current tree is unable to represent the input data""" + pass diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py index c0be95b2..410c4ddf 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/alphabeticalattributes.py @@ -1,4 +1,3 @@ - from . import base from collections import OrderedDict @@ -12,17 +11,17 @@ def _attr_key(attr): ``None`` to an empty string first. """ - return (attr[0][0] or ''), attr[0][1] + return (attr[0][0] or ""), attr[0][1] class Filter(base.Filter): """Alphabetizes attributes for elements""" + def __iter__(self): for token in base.Filter.__iter__(self): if token["type"] in ("StartTag", "EmptyTag"): attrs = OrderedDict() - for name, value in sorted(token["data"].items(), - key=_attr_key): + for name, value in sorted(token["data"].items(), key=_attr_key): attrs[name] = value token["data"] = attrs yield token diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py index acd8d5c3..7f54c9d3 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/base.py @@ -1,5 +1,3 @@ - - class Filter(object): def __init__(self, source): self.source = source diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py index c8dc57b8..e6092f6e 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/inject_meta_charset.py @@ -1,9 +1,9 @@ - from . import base class Filter(base.Filter): """Injects ```` tag into head of document""" + def __init__(self, source, encoding): """Creates a Filter @@ -17,7 +17,7 @@ def __init__(self, source, encoding): def __iter__(self): state = "pre_head" - meta_found = (self.encoding is None) + meta_found = self.encoding is None pending = [] for token in base.Filter.__iter__(self): @@ -33,23 +33,30 @@ def __iter__(self): for (namespace, name), value in token["data"].items(): if namespace is not None: continue - elif name.lower() == 'charset': + elif name.lower() == "charset": token["data"][(namespace, name)] = self.encoding meta_found = True break - elif name == 'http-equiv' and value.lower() == 'content-type': + elif name == "http-equiv" and value.lower() == "content-type": has_http_equiv_content_type = True else: - if has_http_equiv_content_type and (None, "content") in token["data"]: - token["data"][(None, "content")] = 'text/html; charset=%s' % self.encoding + if ( + has_http_equiv_content_type + and (None, "content") in token["data"] + ): + token["data"][(None, "content")] = ( + "text/html; charset=%s" % self.encoding + ) meta_found = True elif token["name"].lower() == "head" and not meta_found: # insert meta into empty head - yield {"type": "StartTag", "name": "head", - "data": token["data"]} - yield {"type": "EmptyTag", "name": "meta", - "data": {(None, "charset"): self.encoding}} + yield {"type": "StartTag", "name": "head", "data": token["data"]} + yield { + "type": "EmptyTag", + "name": "meta", + "data": {(None, "charset"): self.encoding}, + } yield {"type": "EndTag", "name": "head"} meta_found = True continue @@ -59,8 +66,11 @@ def __iter__(self): # insert meta into head (if necessary) and flush pending queue yield pending.pop(0) if not meta_found: - yield {"type": "EmptyTag", "name": "meta", - "data": {(None, "charset"): self.encoding}} + yield { + "type": "EmptyTag", + "name": "meta", + "data": {(None, "charset"): self.encoding}, + } while pending: yield pending.pop(0) meta_found = True diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py index acf4bc0a..ad62bad6 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/lint.py @@ -1,10 +1,10 @@ - from fetchcode.vcs.pip._vendor.six import text_type from . import base from ..constants import namespaces, voidElements from ..constants import spaceCharacters + spaceCharacters = "".join(spaceCharacters) @@ -14,6 +14,7 @@ class Filter(base.Filter): If it finds any errors, it'll raise an ``AssertionError``. """ + def __init__(self, source, require_matching_tags=True): """Creates a Filter @@ -37,7 +38,9 @@ def __iter__(self): assert isinstance(name, text_type) assert name != "" assert isinstance(token["data"], dict) - if (not namespace or namespace == namespaces["html"]) and name in voidElements: + if ( + not namespace or namespace == namespaces["html"] + ) and name in voidElements: assert type == "EmptyTag" else: assert type == "StartTag" @@ -57,8 +60,12 @@ def __iter__(self): assert namespace != "" assert isinstance(name, text_type) assert name != "" - if (not namespace or namespace == namespaces["html"]) and name in voidElements: - assert False, "Void element reported as EndTag token: %(tag)s" % {"tag": name} + if ( + not namespace or namespace == namespaces["html"] + ) and name in voidElements: + assert False, "Void element reported as EndTag token: %(tag)s" % { + "tag": name + } elif self.require_matching_tags: start = open_elements.pop() assert start == (namespace, name) diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py index a44b2a00..d3b5bc4f 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/optionaltags.py @@ -1,9 +1,9 @@ - from . import base class Filter(base.Filter): """Removes optional tags from the token stream""" + def slider(self): previous1 = previous2 = None for token in self.source: @@ -18,8 +18,9 @@ def __iter__(self): for previous, token, next in self.slider(): type = token["type"] if type == "StartTag": - if (token["data"] or - not self.is_optional_start(token["name"], previous, next)): + if token["data"] or not self.is_optional_start( + token["name"], previous, next + ): yield token elif type == "EndTag": if not self.is_optional_end(token["name"], next): @@ -29,11 +30,11 @@ def __iter__(self): def is_optional_start(self, tagname, previous, next): type = next and next["type"] or None - if tagname in 'html': + if tagname in "html": # An html element's start tag may be omitted if the first thing # inside the html element is not a space character or a comment. return type not in ("Comment", "SpaceCharacters") - elif tagname == 'head': + elif tagname == "head": # A head element's start tag may be omitted if the first thing # inside the head element is an element. # XXX: we also omit the start tag if the head element is empty @@ -41,7 +42,7 @@ def is_optional_start(self, tagname, previous, next): return True elif type == "EndTag": return next["name"] == "head" - elif tagname == 'body': + elif tagname == "body": # A body element's start tag may be omitted if the first thing # inside the body element is not a space character or a comment, # except if the first thing inside the body element is a script @@ -53,10 +54,10 @@ def is_optional_start(self, tagname, previous, next): # XXX: we do not look at the preceding event, so we never omit # the body element's start tag if it's followed by a script or # a style element. - return next["name"] not in ('script', 'style') + return next["name"] not in ("script", "style") else: return True - elif tagname == 'colgroup': + elif tagname == "colgroup": # A colgroup element's start tag may be omitted if the first thing # inside the colgroup element is a col element, and if the element # is not immediately preceded by another colgroup element whose @@ -68,7 +69,7 @@ def is_optional_start(self, tagname, previous, next): return next["name"] == "col" else: return False - elif tagname == 'tbody': + elif tagname == "tbody": # A tbody element's start tag may be omitted if the first thing # inside the tbody element is a tr element, and if the element is # not immediately preceded by a tbody, thead, or tfoot element @@ -76,21 +77,24 @@ def is_optional_start(self, tagname, previous, next): if type == "StartTag": # omit the thead and tfoot elements' end tag when they are # immediately followed by a tbody element. See is_optional_end. - if previous and previous['type'] == 'EndTag' and \ - previous['name'] in ('tbody', 'thead', 'tfoot'): + if ( + previous + and previous["type"] == "EndTag" + and previous["name"] in ("tbody", "thead", "tfoot") + ): return False - return next["name"] == 'tr' + return next["name"] == "tr" else: return False return False def is_optional_end(self, tagname, next): type = next and next["type"] or None - if tagname in ('html', 'head', 'body'): + if tagname in ("html", "head", "body"): # An html element's end tag may be omitted if the html element # is not immediately followed by a space character or a comment. return type not in ("Comment", "SpaceCharacters") - elif tagname in ('li', 'optgroup', 'tr'): + elif tagname in ("li", "optgroup", "tr"): # A li element's end tag may be omitted if the li element is # immediately followed by another li element or if there is # no more content in the parent element. @@ -104,19 +108,19 @@ def is_optional_end(self, tagname, next): return next["name"] == tagname else: return type == "EndTag" or type is None - elif tagname in ('dt', 'dd'): + elif tagname in ("dt", "dd"): # A dt element's end tag may be omitted if the dt element is # immediately followed by another dt element or a dd element. # A dd element's end tag may be omitted if the dd element is # immediately followed by another dd element or a dt element, # or if there is no more content in the parent element. if type == "StartTag": - return next["name"] in ('dt', 'dd') - elif tagname == 'dd': + return next["name"] in ("dt", "dd") + elif tagname == "dd": return type == "EndTag" or type is None else: return False - elif tagname == 'p': + elif tagname == "p": # A p element's end tag may be omitted if the p element is # immediately followed by an address, article, aside, # blockquote, datagrid, dialog, dir, div, dl, fieldset, @@ -124,25 +128,49 @@ def is_optional_end(self, tagname, next): # nav, ol, p, pre, section, table, or ul, element, or if # there is no more content in the parent element. if type in ("StartTag", "EmptyTag"): - return next["name"] in ('address', 'article', 'aside', - 'blockquote', 'datagrid', 'dialog', - 'dir', 'div', 'dl', 'fieldset', 'footer', - 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', - 'header', 'hr', 'menu', 'nav', 'ol', - 'p', 'pre', 'section', 'table', 'ul') + return next["name"] in ( + "address", + "article", + "aside", + "blockquote", + "datagrid", + "dialog", + "dir", + "div", + "dl", + "fieldset", + "footer", + "form", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "header", + "hr", + "menu", + "nav", + "ol", + "p", + "pre", + "section", + "table", + "ul", + ) else: return type == "EndTag" or type is None - elif tagname == 'option': + elif tagname == "option": # An option element's end tag may be omitted if the option # element is immediately followed by another option element, # or if it is immediately followed by an optgroup # element, or if there is no more content in the parent # element. if type == "StartTag": - return next["name"] in ('option', 'optgroup') + return next["name"] in ("option", "optgroup") else: return type == "EndTag" or type is None - elif tagname in ('rt', 'rp'): + elif tagname in ("rt", "rp"): # An rt element's end tag may be omitted if the rt element is # immediately followed by an rt or rp element, or if there is # no more content in the parent element. @@ -150,10 +178,10 @@ def is_optional_end(self, tagname, next): # immediately followed by an rt or rp element, or if there is # no more content in the parent element. if type == "StartTag": - return next["name"] in ('rt', 'rp') + return next["name"] in ("rt", "rp") else: return type == "EndTag" or type is None - elif tagname == 'colgroup': + elif tagname == "colgroup": # A colgroup element's end tag may be omitted if the colgroup # element is not immediately followed by a space character or # a comment. @@ -162,10 +190,10 @@ def is_optional_end(self, tagname, next): elif type == "StartTag": # XXX: we also look for an immediately following colgroup # element. See is_optional_start. - return next["name"] != 'colgroup' + return next["name"] != "colgroup" else: return True - elif tagname in ('thead', 'tbody'): + elif tagname in ("thead", "tbody"): # A thead element's end tag may be omitted if the thead element # is immediately followed by a tbody or tfoot element. # A tbody element's end tag may be omitted if the tbody element @@ -177,22 +205,22 @@ def is_optional_end(self, tagname, next): # XXX: we never omit the end tag when the following element is # a tbody. See is_optional_start. if type == "StartTag": - return next["name"] in ['tbody', 'tfoot'] - elif tagname == 'tbody': + return next["name"] in ["tbody", "tfoot"] + elif tagname == "tbody": return type == "EndTag" or type is None else: return False - elif tagname == 'tfoot': + elif tagname == "tfoot": # A tfoot element's end tag may be omitted if the tfoot element # is immediately followed by a tbody element, or if there is no # more content in the parent element. # XXX: we never omit the end tag when the following element is # a tbody. See is_optional_start. if type == "StartTag": - return next["name"] == 'tbody' + return next["name"] == "tbody" else: return type == "EndTag" or type is None - elif tagname in ('td', 'th'): + elif tagname in ("td", "th"): # A td element's end tag may be omitted if the td element is # immediately followed by a td or th element, or if there is # no more content in the parent element. @@ -200,7 +228,7 @@ def is_optional_end(self, tagname, next): # immediately followed by a td or th element, or if there is # no more content in the parent element. if type == "StartTag": - return next["name"] in ('td', 'th') + return next["name"] in ("td", "th") else: return type == "EndTag" or type is None return False diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py index 6c269e1a..5a95a57c 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/sanitizer.py @@ -1,4 +1,3 @@ - import re from xml.sax.saxutils import escape, unescape @@ -10,686 +9,707 @@ __all__ = ["Filter"] -allowed_elements = frozenset(( - (namespaces['html'], 'a'), - (namespaces['html'], 'abbr'), - (namespaces['html'], 'acronym'), - (namespaces['html'], 'address'), - (namespaces['html'], 'area'), - (namespaces['html'], 'article'), - (namespaces['html'], 'aside'), - (namespaces['html'], 'audio'), - (namespaces['html'], 'b'), - (namespaces['html'], 'big'), - (namespaces['html'], 'blockquote'), - (namespaces['html'], 'br'), - (namespaces['html'], 'button'), - (namespaces['html'], 'canvas'), - (namespaces['html'], 'caption'), - (namespaces['html'], 'center'), - (namespaces['html'], 'cite'), - (namespaces['html'], 'code'), - (namespaces['html'], 'col'), - (namespaces['html'], 'colgroup'), - (namespaces['html'], 'command'), - (namespaces['html'], 'datagrid'), - (namespaces['html'], 'datalist'), - (namespaces['html'], 'dd'), - (namespaces['html'], 'del'), - (namespaces['html'], 'details'), - (namespaces['html'], 'dfn'), - (namespaces['html'], 'dialog'), - (namespaces['html'], 'dir'), - (namespaces['html'], 'div'), - (namespaces['html'], 'dl'), - (namespaces['html'], 'dt'), - (namespaces['html'], 'em'), - (namespaces['html'], 'event-source'), - (namespaces['html'], 'fieldset'), - (namespaces['html'], 'figcaption'), - (namespaces['html'], 'figure'), - (namespaces['html'], 'footer'), - (namespaces['html'], 'font'), - (namespaces['html'], 'form'), - (namespaces['html'], 'header'), - (namespaces['html'], 'h1'), - (namespaces['html'], 'h2'), - (namespaces['html'], 'h3'), - (namespaces['html'], 'h4'), - (namespaces['html'], 'h5'), - (namespaces['html'], 'h6'), - (namespaces['html'], 'hr'), - (namespaces['html'], 'i'), - (namespaces['html'], 'img'), - (namespaces['html'], 'input'), - (namespaces['html'], 'ins'), - (namespaces['html'], 'keygen'), - (namespaces['html'], 'kbd'), - (namespaces['html'], 'label'), - (namespaces['html'], 'legend'), - (namespaces['html'], 'li'), - (namespaces['html'], 'm'), - (namespaces['html'], 'map'), - (namespaces['html'], 'menu'), - (namespaces['html'], 'meter'), - (namespaces['html'], 'multicol'), - (namespaces['html'], 'nav'), - (namespaces['html'], 'nextid'), - (namespaces['html'], 'ol'), - (namespaces['html'], 'output'), - (namespaces['html'], 'optgroup'), - (namespaces['html'], 'option'), - (namespaces['html'], 'p'), - (namespaces['html'], 'pre'), - (namespaces['html'], 'progress'), - (namespaces['html'], 'q'), - (namespaces['html'], 's'), - (namespaces['html'], 'samp'), - (namespaces['html'], 'section'), - (namespaces['html'], 'select'), - (namespaces['html'], 'small'), - (namespaces['html'], 'sound'), - (namespaces['html'], 'source'), - (namespaces['html'], 'spacer'), - (namespaces['html'], 'span'), - (namespaces['html'], 'strike'), - (namespaces['html'], 'strong'), - (namespaces['html'], 'sub'), - (namespaces['html'], 'sup'), - (namespaces['html'], 'table'), - (namespaces['html'], 'tbody'), - (namespaces['html'], 'td'), - (namespaces['html'], 'textarea'), - (namespaces['html'], 'time'), - (namespaces['html'], 'tfoot'), - (namespaces['html'], 'th'), - (namespaces['html'], 'thead'), - (namespaces['html'], 'tr'), - (namespaces['html'], 'tt'), - (namespaces['html'], 'u'), - (namespaces['html'], 'ul'), - (namespaces['html'], 'var'), - (namespaces['html'], 'video'), - (namespaces['mathml'], 'maction'), - (namespaces['mathml'], 'math'), - (namespaces['mathml'], 'merror'), - (namespaces['mathml'], 'mfrac'), - (namespaces['mathml'], 'mi'), - (namespaces['mathml'], 'mmultiscripts'), - (namespaces['mathml'], 'mn'), - (namespaces['mathml'], 'mo'), - (namespaces['mathml'], 'mover'), - (namespaces['mathml'], 'mpadded'), - (namespaces['mathml'], 'mphantom'), - (namespaces['mathml'], 'mprescripts'), - (namespaces['mathml'], 'mroot'), - (namespaces['mathml'], 'mrow'), - (namespaces['mathml'], 'mspace'), - (namespaces['mathml'], 'msqrt'), - (namespaces['mathml'], 'mstyle'), - (namespaces['mathml'], 'msub'), - (namespaces['mathml'], 'msubsup'), - (namespaces['mathml'], 'msup'), - (namespaces['mathml'], 'mtable'), - (namespaces['mathml'], 'mtd'), - (namespaces['mathml'], 'mtext'), - (namespaces['mathml'], 'mtr'), - (namespaces['mathml'], 'munder'), - (namespaces['mathml'], 'munderover'), - (namespaces['mathml'], 'none'), - (namespaces['svg'], 'a'), - (namespaces['svg'], 'animate'), - (namespaces['svg'], 'animateColor'), - (namespaces['svg'], 'animateMotion'), - (namespaces['svg'], 'animateTransform'), - (namespaces['svg'], 'clipPath'), - (namespaces['svg'], 'circle'), - (namespaces['svg'], 'defs'), - (namespaces['svg'], 'desc'), - (namespaces['svg'], 'ellipse'), - (namespaces['svg'], 'font-face'), - (namespaces['svg'], 'font-face-name'), - (namespaces['svg'], 'font-face-src'), - (namespaces['svg'], 'g'), - (namespaces['svg'], 'glyph'), - (namespaces['svg'], 'hkern'), - (namespaces['svg'], 'linearGradient'), - (namespaces['svg'], 'line'), - (namespaces['svg'], 'marker'), - (namespaces['svg'], 'metadata'), - (namespaces['svg'], 'missing-glyph'), - (namespaces['svg'], 'mpath'), - (namespaces['svg'], 'path'), - (namespaces['svg'], 'polygon'), - (namespaces['svg'], 'polyline'), - (namespaces['svg'], 'radialGradient'), - (namespaces['svg'], 'rect'), - (namespaces['svg'], 'set'), - (namespaces['svg'], 'stop'), - (namespaces['svg'], 'svg'), - (namespaces['svg'], 'switch'), - (namespaces['svg'], 'text'), - (namespaces['svg'], 'title'), - (namespaces['svg'], 'tspan'), - (namespaces['svg'], 'use'), -)) - -allowed_attributes = frozenset(( - # HTML attributes - (None, 'abbr'), - (None, 'accept'), - (None, 'accept-charset'), - (None, 'accesskey'), - (None, 'action'), - (None, 'align'), - (None, 'alt'), - (None, 'autocomplete'), - (None, 'autofocus'), - (None, 'axis'), - (None, 'background'), - (None, 'balance'), - (None, 'bgcolor'), - (None, 'bgproperties'), - (None, 'border'), - (None, 'bordercolor'), - (None, 'bordercolordark'), - (None, 'bordercolorlight'), - (None, 'bottompadding'), - (None, 'cellpadding'), - (None, 'cellspacing'), - (None, 'ch'), - (None, 'challenge'), - (None, 'char'), - (None, 'charoff'), - (None, 'choff'), - (None, 'charset'), - (None, 'checked'), - (None, 'cite'), - (None, 'class'), - (None, 'clear'), - (None, 'color'), - (None, 'cols'), - (None, 'colspan'), - (None, 'compact'), - (None, 'contenteditable'), - (None, 'controls'), - (None, 'coords'), - (None, 'data'), - (None, 'datafld'), - (None, 'datapagesize'), - (None, 'datasrc'), - (None, 'datetime'), - (None, 'default'), - (None, 'delay'), - (None, 'dir'), - (None, 'disabled'), - (None, 'draggable'), - (None, 'dynsrc'), - (None, 'enctype'), - (None, 'end'), - (None, 'face'), - (None, 'for'), - (None, 'form'), - (None, 'frame'), - (None, 'galleryimg'), - (None, 'gutter'), - (None, 'headers'), - (None, 'height'), - (None, 'hidefocus'), - (None, 'hidden'), - (None, 'high'), - (None, 'href'), - (None, 'hreflang'), - (None, 'hspace'), - (None, 'icon'), - (None, 'id'), - (None, 'inputmode'), - (None, 'ismap'), - (None, 'keytype'), - (None, 'label'), - (None, 'leftspacing'), - (None, 'lang'), - (None, 'list'), - (None, 'longdesc'), - (None, 'loop'), - (None, 'loopcount'), - (None, 'loopend'), - (None, 'loopstart'), - (None, 'low'), - (None, 'lowsrc'), - (None, 'max'), - (None, 'maxlength'), - (None, 'media'), - (None, 'method'), - (None, 'min'), - (None, 'multiple'), - (None, 'name'), - (None, 'nohref'), - (None, 'noshade'), - (None, 'nowrap'), - (None, 'open'), - (None, 'optimum'), - (None, 'pattern'), - (None, 'ping'), - (None, 'point-size'), - (None, 'poster'), - (None, 'pqg'), - (None, 'preload'), - (None, 'prompt'), - (None, 'radiogroup'), - (None, 'readonly'), - (None, 'rel'), - (None, 'repeat-max'), - (None, 'repeat-min'), - (None, 'replace'), - (None, 'required'), - (None, 'rev'), - (None, 'rightspacing'), - (None, 'rows'), - (None, 'rowspan'), - (None, 'rules'), - (None, 'scope'), - (None, 'selected'), - (None, 'shape'), - (None, 'size'), - (None, 'span'), - (None, 'src'), - (None, 'start'), - (None, 'step'), - (None, 'style'), - (None, 'summary'), - (None, 'suppress'), - (None, 'tabindex'), - (None, 'target'), - (None, 'template'), - (None, 'title'), - (None, 'toppadding'), - (None, 'type'), - (None, 'unselectable'), - (None, 'usemap'), - (None, 'urn'), - (None, 'valign'), - (None, 'value'), - (None, 'variable'), - (None, 'volume'), - (None, 'vspace'), - (None, 'vrml'), - (None, 'width'), - (None, 'wrap'), - (namespaces['xml'], 'lang'), - # MathML attributes - (None, 'actiontype'), - (None, 'align'), - (None, 'columnalign'), - (None, 'columnalign'), - (None, 'columnalign'), - (None, 'columnlines'), - (None, 'columnspacing'), - (None, 'columnspan'), - (None, 'depth'), - (None, 'display'), - (None, 'displaystyle'), - (None, 'equalcolumns'), - (None, 'equalrows'), - (None, 'fence'), - (None, 'fontstyle'), - (None, 'fontweight'), - (None, 'frame'), - (None, 'height'), - (None, 'linethickness'), - (None, 'lspace'), - (None, 'mathbackground'), - (None, 'mathcolor'), - (None, 'mathvariant'), - (None, 'mathvariant'), - (None, 'maxsize'), - (None, 'minsize'), - (None, 'other'), - (None, 'rowalign'), - (None, 'rowalign'), - (None, 'rowalign'), - (None, 'rowlines'), - (None, 'rowspacing'), - (None, 'rowspan'), - (None, 'rspace'), - (None, 'scriptlevel'), - (None, 'selection'), - (None, 'separator'), - (None, 'stretchy'), - (None, 'width'), - (None, 'width'), - (namespaces['xlink'], 'href'), - (namespaces['xlink'], 'show'), - (namespaces['xlink'], 'type'), - # SVG attributes - (None, 'accent-height'), - (None, 'accumulate'), - (None, 'additive'), - (None, 'alphabetic'), - (None, 'arabic-form'), - (None, 'ascent'), - (None, 'attributeName'), - (None, 'attributeType'), - (None, 'baseProfile'), - (None, 'bbox'), - (None, 'begin'), - (None, 'by'), - (None, 'calcMode'), - (None, 'cap-height'), - (None, 'class'), - (None, 'clip-path'), - (None, 'color'), - (None, 'color-rendering'), - (None, 'content'), - (None, 'cx'), - (None, 'cy'), - (None, 'd'), - (None, 'dx'), - (None, 'dy'), - (None, 'descent'), - (None, 'display'), - (None, 'dur'), - (None, 'end'), - (None, 'fill'), - (None, 'fill-opacity'), - (None, 'fill-rule'), - (None, 'font-family'), - (None, 'font-size'), - (None, 'font-stretch'), - (None, 'font-style'), - (None, 'font-variant'), - (None, 'font-weight'), - (None, 'from'), - (None, 'fx'), - (None, 'fy'), - (None, 'g1'), - (None, 'g2'), - (None, 'glyph-name'), - (None, 'gradientUnits'), - (None, 'hanging'), - (None, 'height'), - (None, 'horiz-adv-x'), - (None, 'horiz-origin-x'), - (None, 'id'), - (None, 'ideographic'), - (None, 'k'), - (None, 'keyPoints'), - (None, 'keySplines'), - (None, 'keyTimes'), - (None, 'lang'), - (None, 'marker-end'), - (None, 'marker-mid'), - (None, 'marker-start'), - (None, 'markerHeight'), - (None, 'markerUnits'), - (None, 'markerWidth'), - (None, 'mathematical'), - (None, 'max'), - (None, 'min'), - (None, 'name'), - (None, 'offset'), - (None, 'opacity'), - (None, 'orient'), - (None, 'origin'), - (None, 'overline-position'), - (None, 'overline-thickness'), - (None, 'panose-1'), - (None, 'path'), - (None, 'pathLength'), - (None, 'points'), - (None, 'preserveAspectRatio'), - (None, 'r'), - (None, 'refX'), - (None, 'refY'), - (None, 'repeatCount'), - (None, 'repeatDur'), - (None, 'requiredExtensions'), - (None, 'requiredFeatures'), - (None, 'restart'), - (None, 'rotate'), - (None, 'rx'), - (None, 'ry'), - (None, 'slope'), - (None, 'stemh'), - (None, 'stemv'), - (None, 'stop-color'), - (None, 'stop-opacity'), - (None, 'strikethrough-position'), - (None, 'strikethrough-thickness'), - (None, 'stroke'), - (None, 'stroke-dasharray'), - (None, 'stroke-dashoffset'), - (None, 'stroke-linecap'), - (None, 'stroke-linejoin'), - (None, 'stroke-miterlimit'), - (None, 'stroke-opacity'), - (None, 'stroke-width'), - (None, 'systemLanguage'), - (None, 'target'), - (None, 'text-anchor'), - (None, 'to'), - (None, 'transform'), - (None, 'type'), - (None, 'u1'), - (None, 'u2'), - (None, 'underline-position'), - (None, 'underline-thickness'), - (None, 'unicode'), - (None, 'unicode-range'), - (None, 'units-per-em'), - (None, 'values'), - (None, 'version'), - (None, 'viewBox'), - (None, 'visibility'), - (None, 'width'), - (None, 'widths'), - (None, 'x'), - (None, 'x-height'), - (None, 'x1'), - (None, 'x2'), - (namespaces['xlink'], 'actuate'), - (namespaces['xlink'], 'arcrole'), - (namespaces['xlink'], 'href'), - (namespaces['xlink'], 'role'), - (namespaces['xlink'], 'show'), - (namespaces['xlink'], 'title'), - (namespaces['xlink'], 'type'), - (namespaces['xml'], 'base'), - (namespaces['xml'], 'lang'), - (namespaces['xml'], 'space'), - (None, 'y'), - (None, 'y1'), - (None, 'y2'), - (None, 'zoomAndPan'), -)) - -attr_val_is_uri = frozenset(( - (None, 'href'), - (None, 'src'), - (None, 'cite'), - (None, 'action'), - (None, 'longdesc'), - (None, 'poster'), - (None, 'background'), - (None, 'datasrc'), - (None, 'dynsrc'), - (None, 'lowsrc'), - (None, 'ping'), - (namespaces['xlink'], 'href'), - (namespaces['xml'], 'base'), -)) - -svg_attr_val_allows_ref = frozenset(( - (None, 'clip-path'), - (None, 'color-profile'), - (None, 'cursor'), - (None, 'fill'), - (None, 'filter'), - (None, 'marker'), - (None, 'marker-start'), - (None, 'marker-mid'), - (None, 'marker-end'), - (None, 'mask'), - (None, 'stroke'), -)) - -svg_allow_local_href = frozenset(( - (None, 'altGlyph'), - (None, 'animate'), - (None, 'animateColor'), - (None, 'animateMotion'), - (None, 'animateTransform'), - (None, 'cursor'), - (None, 'feImage'), - (None, 'filter'), - (None, 'linearGradient'), - (None, 'pattern'), - (None, 'radialGradient'), - (None, 'textpath'), - (None, 'tref'), - (None, 'set'), - (None, 'use') -)) - -allowed_css_properties = frozenset(( - 'azimuth', - 'background-color', - 'border-bottom-color', - 'border-collapse', - 'border-color', - 'border-left-color', - 'border-right-color', - 'border-top-color', - 'clear', - 'color', - 'cursor', - 'direction', - 'display', - 'elevation', - 'float', - 'font', - 'font-family', - 'font-size', - 'font-style', - 'font-variant', - 'font-weight', - 'height', - 'letter-spacing', - 'line-height', - 'overflow', - 'pause', - 'pause-after', - 'pause-before', - 'pitch', - 'pitch-range', - 'richness', - 'speak', - 'speak-header', - 'speak-numeral', - 'speak-punctuation', - 'speech-rate', - 'stress', - 'text-align', - 'text-decoration', - 'text-indent', - 'unicode-bidi', - 'vertical-align', - 'voice-family', - 'volume', - 'white-space', - 'width', -)) - -allowed_css_keywords = frozenset(( - 'auto', - 'aqua', - 'black', - 'block', - 'blue', - 'bold', - 'both', - 'bottom', - 'brown', - 'center', - 'collapse', - 'dashed', - 'dotted', - 'fuchsia', - 'gray', - 'green', - '!important', - 'italic', - 'left', - 'lime', - 'maroon', - 'medium', - 'none', - 'navy', - 'normal', - 'nowrap', - 'olive', - 'pointer', - 'purple', - 'red', - 'right', - 'solid', - 'silver', - 'teal', - 'top', - 'transparent', - 'underline', - 'white', - 'yellow', -)) - -allowed_svg_properties = frozenset(( - 'fill', - 'fill-opacity', - 'fill-rule', - 'stroke', - 'stroke-width', - 'stroke-linecap', - 'stroke-linejoin', - 'stroke-opacity', -)) - -allowed_protocols = frozenset(( - 'ed2k', - 'ftp', - 'http', - 'https', - 'irc', - 'mailto', - 'news', - 'gopher', - 'nntp', - 'telnet', - 'webcal', - 'xmpp', - 'callto', - 'feed', - 'urn', - 'aim', - 'rsync', - 'tag', - 'ssh', - 'sftp', - 'rtsp', - 'afs', - 'data', -)) - -allowed_content_types = frozenset(( - 'image/png', - 'image/jpeg', - 'image/gif', - 'image/webp', - 'image/bmp', - 'text/plain', -)) - - -data_content_type = re.compile(r''' +allowed_elements = frozenset( + ( + (namespaces["html"], "a"), + (namespaces["html"], "abbr"), + (namespaces["html"], "acronym"), + (namespaces["html"], "address"), + (namespaces["html"], "area"), + (namespaces["html"], "article"), + (namespaces["html"], "aside"), + (namespaces["html"], "audio"), + (namespaces["html"], "b"), + (namespaces["html"], "big"), + (namespaces["html"], "blockquote"), + (namespaces["html"], "br"), + (namespaces["html"], "button"), + (namespaces["html"], "canvas"), + (namespaces["html"], "caption"), + (namespaces["html"], "center"), + (namespaces["html"], "cite"), + (namespaces["html"], "code"), + (namespaces["html"], "col"), + (namespaces["html"], "colgroup"), + (namespaces["html"], "command"), + (namespaces["html"], "datagrid"), + (namespaces["html"], "datalist"), + (namespaces["html"], "dd"), + (namespaces["html"], "del"), + (namespaces["html"], "details"), + (namespaces["html"], "dfn"), + (namespaces["html"], "dialog"), + (namespaces["html"], "dir"), + (namespaces["html"], "div"), + (namespaces["html"], "dl"), + (namespaces["html"], "dt"), + (namespaces["html"], "em"), + (namespaces["html"], "event-source"), + (namespaces["html"], "fieldset"), + (namespaces["html"], "figcaption"), + (namespaces["html"], "figure"), + (namespaces["html"], "footer"), + (namespaces["html"], "font"), + (namespaces["html"], "form"), + (namespaces["html"], "header"), + (namespaces["html"], "h1"), + (namespaces["html"], "h2"), + (namespaces["html"], "h3"), + (namespaces["html"], "h4"), + (namespaces["html"], "h5"), + (namespaces["html"], "h6"), + (namespaces["html"], "hr"), + (namespaces["html"], "i"), + (namespaces["html"], "img"), + (namespaces["html"], "input"), + (namespaces["html"], "ins"), + (namespaces["html"], "keygen"), + (namespaces["html"], "kbd"), + (namespaces["html"], "label"), + (namespaces["html"], "legend"), + (namespaces["html"], "li"), + (namespaces["html"], "m"), + (namespaces["html"], "map"), + (namespaces["html"], "menu"), + (namespaces["html"], "meter"), + (namespaces["html"], "multicol"), + (namespaces["html"], "nav"), + (namespaces["html"], "nextid"), + (namespaces["html"], "ol"), + (namespaces["html"], "output"), + (namespaces["html"], "optgroup"), + (namespaces["html"], "option"), + (namespaces["html"], "p"), + (namespaces["html"], "pre"), + (namespaces["html"], "progress"), + (namespaces["html"], "q"), + (namespaces["html"], "s"), + (namespaces["html"], "samp"), + (namespaces["html"], "section"), + (namespaces["html"], "select"), + (namespaces["html"], "small"), + (namespaces["html"], "sound"), + (namespaces["html"], "source"), + (namespaces["html"], "spacer"), + (namespaces["html"], "span"), + (namespaces["html"], "strike"), + (namespaces["html"], "strong"), + (namespaces["html"], "sub"), + (namespaces["html"], "sup"), + (namespaces["html"], "table"), + (namespaces["html"], "tbody"), + (namespaces["html"], "td"), + (namespaces["html"], "textarea"), + (namespaces["html"], "time"), + (namespaces["html"], "tfoot"), + (namespaces["html"], "th"), + (namespaces["html"], "thead"), + (namespaces["html"], "tr"), + (namespaces["html"], "tt"), + (namespaces["html"], "u"), + (namespaces["html"], "ul"), + (namespaces["html"], "var"), + (namespaces["html"], "video"), + (namespaces["mathml"], "maction"), + (namespaces["mathml"], "math"), + (namespaces["mathml"], "merror"), + (namespaces["mathml"], "mfrac"), + (namespaces["mathml"], "mi"), + (namespaces["mathml"], "mmultiscripts"), + (namespaces["mathml"], "mn"), + (namespaces["mathml"], "mo"), + (namespaces["mathml"], "mover"), + (namespaces["mathml"], "mpadded"), + (namespaces["mathml"], "mphantom"), + (namespaces["mathml"], "mprescripts"), + (namespaces["mathml"], "mroot"), + (namespaces["mathml"], "mrow"), + (namespaces["mathml"], "mspace"), + (namespaces["mathml"], "msqrt"), + (namespaces["mathml"], "mstyle"), + (namespaces["mathml"], "msub"), + (namespaces["mathml"], "msubsup"), + (namespaces["mathml"], "msup"), + (namespaces["mathml"], "mtable"), + (namespaces["mathml"], "mtd"), + (namespaces["mathml"], "mtext"), + (namespaces["mathml"], "mtr"), + (namespaces["mathml"], "munder"), + (namespaces["mathml"], "munderover"), + (namespaces["mathml"], "none"), + (namespaces["svg"], "a"), + (namespaces["svg"], "animate"), + (namespaces["svg"], "animateColor"), + (namespaces["svg"], "animateMotion"), + (namespaces["svg"], "animateTransform"), + (namespaces["svg"], "clipPath"), + (namespaces["svg"], "circle"), + (namespaces["svg"], "defs"), + (namespaces["svg"], "desc"), + (namespaces["svg"], "ellipse"), + (namespaces["svg"], "font-face"), + (namespaces["svg"], "font-face-name"), + (namespaces["svg"], "font-face-src"), + (namespaces["svg"], "g"), + (namespaces["svg"], "glyph"), + (namespaces["svg"], "hkern"), + (namespaces["svg"], "linearGradient"), + (namespaces["svg"], "line"), + (namespaces["svg"], "marker"), + (namespaces["svg"], "metadata"), + (namespaces["svg"], "missing-glyph"), + (namespaces["svg"], "mpath"), + (namespaces["svg"], "path"), + (namespaces["svg"], "polygon"), + (namespaces["svg"], "polyline"), + (namespaces["svg"], "radialGradient"), + (namespaces["svg"], "rect"), + (namespaces["svg"], "set"), + (namespaces["svg"], "stop"), + (namespaces["svg"], "svg"), + (namespaces["svg"], "switch"), + (namespaces["svg"], "text"), + (namespaces["svg"], "title"), + (namespaces["svg"], "tspan"), + (namespaces["svg"], "use"), + ) +) + +allowed_attributes = frozenset( + ( + # HTML attributes + (None, "abbr"), + (None, "accept"), + (None, "accept-charset"), + (None, "accesskey"), + (None, "action"), + (None, "align"), + (None, "alt"), + (None, "autocomplete"), + (None, "autofocus"), + (None, "axis"), + (None, "background"), + (None, "balance"), + (None, "bgcolor"), + (None, "bgproperties"), + (None, "border"), + (None, "bordercolor"), + (None, "bordercolordark"), + (None, "bordercolorlight"), + (None, "bottompadding"), + (None, "cellpadding"), + (None, "cellspacing"), + (None, "ch"), + (None, "challenge"), + (None, "char"), + (None, "charoff"), + (None, "choff"), + (None, "charset"), + (None, "checked"), + (None, "cite"), + (None, "class"), + (None, "clear"), + (None, "color"), + (None, "cols"), + (None, "colspan"), + (None, "compact"), + (None, "contenteditable"), + (None, "controls"), + (None, "coords"), + (None, "data"), + (None, "datafld"), + (None, "datapagesize"), + (None, "datasrc"), + (None, "datetime"), + (None, "default"), + (None, "delay"), + (None, "dir"), + (None, "disabled"), + (None, "draggable"), + (None, "dynsrc"), + (None, "enctype"), + (None, "end"), + (None, "face"), + (None, "for"), + (None, "form"), + (None, "frame"), + (None, "galleryimg"), + (None, "gutter"), + (None, "headers"), + (None, "height"), + (None, "hidefocus"), + (None, "hidden"), + (None, "high"), + (None, "href"), + (None, "hreflang"), + (None, "hspace"), + (None, "icon"), + (None, "id"), + (None, "inputmode"), + (None, "ismap"), + (None, "keytype"), + (None, "label"), + (None, "leftspacing"), + (None, "lang"), + (None, "list"), + (None, "longdesc"), + (None, "loop"), + (None, "loopcount"), + (None, "loopend"), + (None, "loopstart"), + (None, "low"), + (None, "lowsrc"), + (None, "max"), + (None, "maxlength"), + (None, "media"), + (None, "method"), + (None, "min"), + (None, "multiple"), + (None, "name"), + (None, "nohref"), + (None, "noshade"), + (None, "nowrap"), + (None, "open"), + (None, "optimum"), + (None, "pattern"), + (None, "ping"), + (None, "point-size"), + (None, "poster"), + (None, "pqg"), + (None, "preload"), + (None, "prompt"), + (None, "radiogroup"), + (None, "readonly"), + (None, "rel"), + (None, "repeat-max"), + (None, "repeat-min"), + (None, "replace"), + (None, "required"), + (None, "rev"), + (None, "rightspacing"), + (None, "rows"), + (None, "rowspan"), + (None, "rules"), + (None, "scope"), + (None, "selected"), + (None, "shape"), + (None, "size"), + (None, "span"), + (None, "src"), + (None, "start"), + (None, "step"), + (None, "style"), + (None, "summary"), + (None, "suppress"), + (None, "tabindex"), + (None, "target"), + (None, "template"), + (None, "title"), + (None, "toppadding"), + (None, "type"), + (None, "unselectable"), + (None, "usemap"), + (None, "urn"), + (None, "valign"), + (None, "value"), + (None, "variable"), + (None, "volume"), + (None, "vspace"), + (None, "vrml"), + (None, "width"), + (None, "wrap"), + (namespaces["xml"], "lang"), + # MathML attributes + (None, "actiontype"), + (None, "align"), + (None, "columnalign"), + (None, "columnalign"), + (None, "columnalign"), + (None, "columnlines"), + (None, "columnspacing"), + (None, "columnspan"), + (None, "depth"), + (None, "display"), + (None, "displaystyle"), + (None, "equalcolumns"), + (None, "equalrows"), + (None, "fence"), + (None, "fontstyle"), + (None, "fontweight"), + (None, "frame"), + (None, "height"), + (None, "linethickness"), + (None, "lspace"), + (None, "mathbackground"), + (None, "mathcolor"), + (None, "mathvariant"), + (None, "mathvariant"), + (None, "maxsize"), + (None, "minsize"), + (None, "other"), + (None, "rowalign"), + (None, "rowalign"), + (None, "rowalign"), + (None, "rowlines"), + (None, "rowspacing"), + (None, "rowspan"), + (None, "rspace"), + (None, "scriptlevel"), + (None, "selection"), + (None, "separator"), + (None, "stretchy"), + (None, "width"), + (None, "width"), + (namespaces["xlink"], "href"), + (namespaces["xlink"], "show"), + (namespaces["xlink"], "type"), + # SVG attributes + (None, "accent-height"), + (None, "accumulate"), + (None, "additive"), + (None, "alphabetic"), + (None, "arabic-form"), + (None, "ascent"), + (None, "attributeName"), + (None, "attributeType"), + (None, "baseProfile"), + (None, "bbox"), + (None, "begin"), + (None, "by"), + (None, "calcMode"), + (None, "cap-height"), + (None, "class"), + (None, "clip-path"), + (None, "color"), + (None, "color-rendering"), + (None, "content"), + (None, "cx"), + (None, "cy"), + (None, "d"), + (None, "dx"), + (None, "dy"), + (None, "descent"), + (None, "display"), + (None, "dur"), + (None, "end"), + (None, "fill"), + (None, "fill-opacity"), + (None, "fill-rule"), + (None, "font-family"), + (None, "font-size"), + (None, "font-stretch"), + (None, "font-style"), + (None, "font-variant"), + (None, "font-weight"), + (None, "from"), + (None, "fx"), + (None, "fy"), + (None, "g1"), + (None, "g2"), + (None, "glyph-name"), + (None, "gradientUnits"), + (None, "hanging"), + (None, "height"), + (None, "horiz-adv-x"), + (None, "horiz-origin-x"), + (None, "id"), + (None, "ideographic"), + (None, "k"), + (None, "keyPoints"), + (None, "keySplines"), + (None, "keyTimes"), + (None, "lang"), + (None, "marker-end"), + (None, "marker-mid"), + (None, "marker-start"), + (None, "markerHeight"), + (None, "markerUnits"), + (None, "markerWidth"), + (None, "mathematical"), + (None, "max"), + (None, "min"), + (None, "name"), + (None, "offset"), + (None, "opacity"), + (None, "orient"), + (None, "origin"), + (None, "overline-position"), + (None, "overline-thickness"), + (None, "panose-1"), + (None, "path"), + (None, "pathLength"), + (None, "points"), + (None, "preserveAspectRatio"), + (None, "r"), + (None, "refX"), + (None, "refY"), + (None, "repeatCount"), + (None, "repeatDur"), + (None, "requiredExtensions"), + (None, "requiredFeatures"), + (None, "restart"), + (None, "rotate"), + (None, "rx"), + (None, "ry"), + (None, "slope"), + (None, "stemh"), + (None, "stemv"), + (None, "stop-color"), + (None, "stop-opacity"), + (None, "strikethrough-position"), + (None, "strikethrough-thickness"), + (None, "stroke"), + (None, "stroke-dasharray"), + (None, "stroke-dashoffset"), + (None, "stroke-linecap"), + (None, "stroke-linejoin"), + (None, "stroke-miterlimit"), + (None, "stroke-opacity"), + (None, "stroke-width"), + (None, "systemLanguage"), + (None, "target"), + (None, "text-anchor"), + (None, "to"), + (None, "transform"), + (None, "type"), + (None, "u1"), + (None, "u2"), + (None, "underline-position"), + (None, "underline-thickness"), + (None, "unicode"), + (None, "unicode-range"), + (None, "units-per-em"), + (None, "values"), + (None, "version"), + (None, "viewBox"), + (None, "visibility"), + (None, "width"), + (None, "widths"), + (None, "x"), + (None, "x-height"), + (None, "x1"), + (None, "x2"), + (namespaces["xlink"], "actuate"), + (namespaces["xlink"], "arcrole"), + (namespaces["xlink"], "href"), + (namespaces["xlink"], "role"), + (namespaces["xlink"], "show"), + (namespaces["xlink"], "title"), + (namespaces["xlink"], "type"), + (namespaces["xml"], "base"), + (namespaces["xml"], "lang"), + (namespaces["xml"], "space"), + (None, "y"), + (None, "y1"), + (None, "y2"), + (None, "zoomAndPan"), + ) +) + +attr_val_is_uri = frozenset( + ( + (None, "href"), + (None, "src"), + (None, "cite"), + (None, "action"), + (None, "longdesc"), + (None, "poster"), + (None, "background"), + (None, "datasrc"), + (None, "dynsrc"), + (None, "lowsrc"), + (None, "ping"), + (namespaces["xlink"], "href"), + (namespaces["xml"], "base"), + ) +) + +svg_attr_val_allows_ref = frozenset( + ( + (None, "clip-path"), + (None, "color-profile"), + (None, "cursor"), + (None, "fill"), + (None, "filter"), + (None, "marker"), + (None, "marker-start"), + (None, "marker-mid"), + (None, "marker-end"), + (None, "mask"), + (None, "stroke"), + ) +) + +svg_allow_local_href = frozenset( + ( + (None, "altGlyph"), + (None, "animate"), + (None, "animateColor"), + (None, "animateMotion"), + (None, "animateTransform"), + (None, "cursor"), + (None, "feImage"), + (None, "filter"), + (None, "linearGradient"), + (None, "pattern"), + (None, "radialGradient"), + (None, "textpath"), + (None, "tref"), + (None, "set"), + (None, "use"), + ) +) + +allowed_css_properties = frozenset( + ( + "azimuth", + "background-color", + "border-bottom-color", + "border-collapse", + "border-color", + "border-left-color", + "border-right-color", + "border-top-color", + "clear", + "color", + "cursor", + "direction", + "display", + "elevation", + "float", + "font", + "font-family", + "font-size", + "font-style", + "font-variant", + "font-weight", + "height", + "letter-spacing", + "line-height", + "overflow", + "pause", + "pause-after", + "pause-before", + "pitch", + "pitch-range", + "richness", + "speak", + "speak-header", + "speak-numeral", + "speak-punctuation", + "speech-rate", + "stress", + "text-align", + "text-decoration", + "text-indent", + "unicode-bidi", + "vertical-align", + "voice-family", + "volume", + "white-space", + "width", + ) +) + +allowed_css_keywords = frozenset( + ( + "auto", + "aqua", + "black", + "block", + "blue", + "bold", + "both", + "bottom", + "brown", + "center", + "collapse", + "dashed", + "dotted", + "fuchsia", + "gray", + "green", + "!important", + "italic", + "left", + "lime", + "maroon", + "medium", + "none", + "navy", + "normal", + "nowrap", + "olive", + "pointer", + "purple", + "red", + "right", + "solid", + "silver", + "teal", + "top", + "transparent", + "underline", + "white", + "yellow", + ) +) + +allowed_svg_properties = frozenset( + ( + "fill", + "fill-opacity", + "fill-rule", + "stroke", + "stroke-width", + "stroke-linecap", + "stroke-linejoin", + "stroke-opacity", + ) +) + +allowed_protocols = frozenset( + ( + "ed2k", + "ftp", + "http", + "https", + "irc", + "mailto", + "news", + "gopher", + "nntp", + "telnet", + "webcal", + "xmpp", + "callto", + "feed", + "urn", + "aim", + "rsync", + "tag", + "ssh", + "sftp", + "rtsp", + "afs", + "data", + ) +) + +allowed_content_types = frozenset( + ( + "image/png", + "image/jpeg", + "image/gif", + "image/webp", + "image/bmp", + "text/plain", + ) +) + + +data_content_type = re.compile( + r""" ^ # Match a content type / (?P[-a-zA-Z0-9.]+/[-a-zA-Z0-9.]+) @@ -699,24 +719,28 @@ # Assume the rest is data ,.* $ - ''', - re.VERBOSE) + """, + re.VERBOSE, +) class Filter(base.Filter): """Sanitizes token stream of XHTML+MathML+SVG and of inline style attributes""" - def __init__(self, - source, - allowed_elements=allowed_elements, - allowed_attributes=allowed_attributes, - allowed_css_properties=allowed_css_properties, - allowed_css_keywords=allowed_css_keywords, - allowed_svg_properties=allowed_svg_properties, - allowed_protocols=allowed_protocols, - allowed_content_types=allowed_content_types, - attr_val_is_uri=attr_val_is_uri, - svg_attr_val_allows_ref=svg_attr_val_allows_ref, - svg_allow_local_href=svg_allow_local_href): + + def __init__( + self, + source, + allowed_elements=allowed_elements, + allowed_attributes=allowed_attributes, + allowed_css_properties=allowed_css_properties, + allowed_css_keywords=allowed_css_keywords, + allowed_svg_properties=allowed_svg_properties, + allowed_protocols=allowed_protocols, + allowed_content_types=allowed_content_types, + attr_val_is_uri=attr_val_is_uri, + svg_attr_val_allows_ref=svg_attr_val_allows_ref, + svg_allow_local_href=svg_allow_local_href, + ): """Creates a Filter :arg allowed_elements: set of elements to allow--everything else will @@ -784,9 +808,10 @@ def sanitize_token(self, token): if token_type in ("StartTag", "EndTag", "EmptyTag"): name = token["name"] namespace = token["namespace"] - if ((namespace, name) in self.allowed_elements or - (namespace is None and - (namespaces["html"], name) in self.allowed_elements)): + if (namespace, name) in self.allowed_elements or ( + namespace is None + and (namespaces["html"], name) in self.allowed_elements + ): return self.allowed_token(token) else: return self.disallowed_token(token) @@ -801,19 +826,20 @@ def allowed_token(self, token): attr_names = set(attrs.keys()) # Remove forbidden attributes - for to_remove in (attr_names - self.allowed_attributes): + for to_remove in attr_names - self.allowed_attributes: del token["data"][to_remove] attr_names.remove(to_remove) # Remove attributes with disallowed URL values - for attr in (attr_names & self.attr_val_is_uri): + for attr in attr_names & self.attr_val_is_uri: assert attr in attrs # I don't have a clue where this regexp comes from or why it matches those # characters, nor why we call unescape. I just know it's always been here. # Should you be worried by this comment in a sanitizer? Yes. On the other hand, all # this will do is remove *more* than it otherwise would. - val_unescaped = re.sub("[`\x00-\x20\x7f-\xa0\\s]+", '', - unescape(attrs[attr])).lower() + val_unescaped = re.sub( + "[`\x00-\x20\x7f-\xa0\\s]+", "", unescape(attrs[attr]) + ).lower() # remove replacement characters from unescaped characters val_unescaped = val_unescaped.replace("\ufffd", "") try: @@ -824,24 +850,26 @@ def allowed_token(self, token): if uri and uri.scheme: if uri.scheme not in self.allowed_protocols: del attrs[attr] - if uri.scheme == 'data': + if uri.scheme == "data": m = data_content_type.match(uri.path) if not m: del attrs[attr] - elif m.group('content_type') not in self.allowed_content_types: + elif m.group("content_type") not in self.allowed_content_types: del attrs[attr] for attr in self.svg_attr_val_allows_ref: if attr in attrs: - attrs[attr] = re.sub(r'url\s*\(\s*[^#\s][^)]+?\)', - ' ', - unescape(attrs[attr])) - if (token["name"] in self.svg_allow_local_href and - (namespaces['xlink'], 'href') in attrs and re.search(r'^\s*[^#\s].*', - attrs[(namespaces['xlink'], 'href')])): - del attrs[(namespaces['xlink'], 'href')] - if (None, 'style') in attrs: - attrs[(None, 'style')] = self.sanitize_css(attrs[(None, 'style')]) + attrs[attr] = re.sub( + r"url\s*\(\s*[^#\s][^)]+?\)", " ", unescape(attrs[attr]) + ) + if ( + token["name"] in self.svg_allow_local_href + and (namespaces["xlink"], "href") in attrs + and re.search(r"^\s*[^#\s].*", attrs[(namespaces["xlink"], "href")]) + ): + del attrs[(namespaces["xlink"], "href")] + if (None, "style") in attrs: + attrs[(None, "style")] = self.sanitize_css(attrs[(None, "style")]) token["data"] = attrs return token @@ -853,8 +881,14 @@ def disallowed_token(self, token): assert token_type in ("StartTag", "EmptyTag") attrs = [] for (ns, name), v in token["data"].items(): - attrs.append(' %s="%s"' % (name if ns is None else "%s:%s" % (prefixes[ns], name), escape(v))) - token["data"] = "<%s%s>" % (token["name"], ''.join(attrs)) + attrs.append( + ' %s="%s"' + % ( + name if ns is None else "%s:%s" % (prefixes[ns], name), + escape(v), + ) + ) + token["data"] = "<%s%s>" % (token["name"], "".join(attrs)) else: token["data"] = "<%s>" % token["name"] if token.get("selfClosing"): @@ -867,29 +901,38 @@ def disallowed_token(self, token): def sanitize_css(self, style): # disallow urls - style = re.compile(r'url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style) + style = re.compile(r"url\s*\(\s*[^\s)]+?\s*\)\s*").sub(" ", style) # gauntlet - if not re.match(r"""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style): - return '' + if not re.match( + r"""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", + style, + ): + return "" if not re.match(r"^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style): - return '' + return "" clean = [] for prop, value in re.findall(r"([-\w]+)\s*:\s*([^:;]*)", style): if not value: continue if prop.lower() in self.allowed_css_properties: - clean.append(prop + ': ' + value + ';') - elif prop.split('-')[0].lower() in ['background', 'border', 'margin', - 'padding']: + clean.append(prop + ": " + value + ";") + elif prop.split("-")[0].lower() in [ + "background", + "border", + "margin", + "padding", + ]: for keyword in value.split(): - if keyword not in self.allowed_css_keywords and \ - not re.match(r"^(#[0-9a-fA-F]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword): # noqa + if keyword not in self.allowed_css_keywords and not re.match( + r"^(#[0-9a-fA-F]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", + keyword, + ): # noqa break else: - clean.append(prop + ': ' + value + ';') + clean.append(prop + ": " + value + ";") elif prop.lower() in self.allowed_svg_properties: - clean.append(prop + ': ' + value + ';') + clean.append(prop + ": " + value + ";") - return ' '.join(clean) + return " ".join(clean) diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py index ab40ef5a..36d59b0f 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/filters/whitespace.py @@ -1,8 +1,8 @@ - import re from . import base from ..constants import rcdataElements, spaceCharacters + spaceCharacters = "".join(spaceCharacters) SPACES_REGEX = re.compile("[%s]+" % spaceCharacters) @@ -10,14 +10,16 @@ class Filter(base.Filter): """Collapses whitespace except in pre, textarea, and script elements""" + spacePreserveElements = frozenset(["pre", "textarea"] + list(rcdataElements)) def __iter__(self): preserve = 0 for token in base.Filter.__iter__(self): type = token["type"] - if type == "StartTag" \ - and (preserve or token["name"] in self.spacePreserveElements): + if type == "StartTag" and ( + preserve or token["name"] in self.spacePreserveElements + ): preserve += 1 elif type == "EndTag" and preserve: @@ -34,4 +36,4 @@ def __iter__(self): def collapse_spaces(text): - return SPACES_REGEX.sub(' ', text) + return SPACES_REGEX.sub(" ", text) diff --git a/src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py b/src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py index 3f9e02c3..43c95f63 100644 --- a/src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py +++ b/src/fetchcode/vcs/pip/_vendor/html5lib/html5parser.py @@ -11,15 +11,22 @@ from . import _utils from .constants import ( - spaceCharacters, asciiUpper2Lower, - specialElements, headingElements, cdataElements, rcdataElements, - tokenTypes, tagTokenTypes, + spaceCharacters, + asciiUpper2Lower, + specialElements, + headingElements, + cdataElements, + rcdataElements, + tokenTypes, + tagTokenTypes, namespaces, - htmlIntegrationPointElements, mathmlTextIntegrationPointElements, + htmlIntegrationPointElements, + mathmlTextIntegrationPointElements, adjustForeignAttributes as adjustForeignAttributesMap, - adjustMathMLAttributes, adjustSVGAttributes, + adjustMathMLAttributes, + adjustSVGAttributes, E, - _ReparseException + _ReparseException, ) @@ -46,7 +53,9 @@ def parse(doc, treebuilder="etree", namespaceHTMLElements=True, **kwargs): return p.parse(doc, **kwargs) -def parseFragment(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs): +def parseFragment( + doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs +): """Parse an HTML fragment as a string or file-like object into a tree :arg doc: the fragment to parse as a string or file-like object @@ -80,6 +89,7 @@ def __new__(meta, classname, bases, classDict): classDict[attributeName] = attribute return type.__new__(meta, classname, bases, classDict) + return Decorated @@ -90,7 +100,9 @@ class HTMLParser(object): """ - def __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=False): + def __init__( + self, tree=None, strict=False, namespaceHTMLElements=True, debug=False + ): """ :arg tree: a treebuilder class controlling the type of tree that will be returned. Built in treebuilders can be accessed through @@ -118,10 +130,13 @@ def __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=Fa self.tree = tree(namespaceHTMLElements) self.errors = [] - self.phases = dict([(name, cls(self, self.tree)) for name, cls in - getPhases(debug).items()]) + self.phases = dict( + [(name, cls(self, self.tree)) for name, cls in getPhases(debug).items()] + ) - def _parse(self, stream, innerHTML=False, container="div", scripting=False, **kwargs): + def _parse( + self, stream, innerHTML=False, container="div", scripting=False, **kwargs + ): self.innerHTMLMode = innerHTML self.container = container @@ -150,7 +165,7 @@ def reset(self): self.tokenizer.state = self.tokenizer.rcdataState elif self.innerHTML in rcdataElements: self.tokenizer.state = self.tokenizer.rawtextState - elif self.innerHTML == 'plaintext': + elif self.innerHTML == "plaintext": self.tokenizer.state = self.tokenizer.plaintextState else: # state already is data state @@ -175,17 +190,18 @@ def documentEncoding(self): :obj:`None` if that is not determined yet """ - if not hasattr(self, 'tokenizer'): + if not hasattr(self, "tokenizer"): return None return self.tokenizer.stream.charEncoding[0].name def isHTMLIntegrationPoint(self, element): - if (element.name == "annotation-xml" and - element.namespace == namespaces["mathml"]): - return ("encoding" in element.attributes and - element.attributes["encoding"].translate( - asciiUpper2Lower) in - ("text/html", "application/xhtml+xml")) + if ( + element.name == "annotation-xml" + and element.namespace == namespaces["mathml"] + ): + return "encoding" in element.attributes and element.attributes[ + "encoding" + ].translate(asciiUpper2Lower) in ("text/html", "application/xhtml+xml") else: return (element.namespace, element.name) in htmlIntegrationPointElements @@ -206,7 +222,9 @@ def mainLoop(self): new_token = token while new_token is not None: prev_token = new_token - currentNode = self.tree.openElements[-1] if self.tree.openElements else None + currentNode = ( + self.tree.openElements[-1] if self.tree.openElements else None + ) currentNodeNamespace = currentNode.namespace if currentNode else None currentNodeName = currentNode.name if currentNode else None @@ -216,18 +234,32 @@ def mainLoop(self): self.parseError(new_token["data"], new_token.get("datavars", {})) new_token = None else: - if (len(self.tree.openElements) == 0 or - currentNodeNamespace == self.tree.defaultNamespace or - (self.isMathMLTextIntegrationPoint(currentNode) and - ((type == StartTagToken and - token["name"] not in frozenset(["mglyph", "malignmark"])) or - type in (CharactersToken, SpaceCharactersToken))) or - (currentNodeNamespace == namespaces["mathml"] and - currentNodeName == "annotation-xml" and - type == StartTagToken and - token["name"] == "svg") or - (self.isHTMLIntegrationPoint(currentNode) and - type in (StartTagToken, CharactersToken, SpaceCharactersToken))): + if ( + len(self.tree.openElements) == 0 + or currentNodeNamespace == self.tree.defaultNamespace + or ( + self.isMathMLTextIntegrationPoint(currentNode) + and ( + ( + type == StartTagToken + and token["name"] + not in frozenset(["mglyph", "malignmark"]) + ) + or type in (CharactersToken, SpaceCharactersToken) + ) + ) + or ( + currentNodeNamespace == namespaces["mathml"] + and currentNodeName == "annotation-xml" + and type == StartTagToken + and token["name"] == "svg" + ) + or ( + self.isHTMLIntegrationPoint(currentNode) + and type + in (StartTagToken, CharactersToken, SpaceCharactersToken) + ) + ): phase = self.phase else: phase = self.phases["inForeignContent"] @@ -245,10 +277,15 @@ def mainLoop(self): elif type == DoctypeToken: new_token = phase.processDoctype(new_token) - if (type == StartTagToken and prev_token["selfClosing"] and - not prev_token["selfClosingAcknowledged"]): - self.parseError("non-void-element-with-trailing-solidus", - {"name": prev_token["name"]}) + if ( + type == StartTagToken + and prev_token["selfClosing"] + and not prev_token["selfClosingAcknowledged"] + ): + self.parseError( + "non-void-element-with-trailing-solidus", + {"name": prev_token["name"]}, + ) # When the loop finishes it's EOF reprocess = True @@ -366,7 +403,7 @@ def resetInsertionMode(self): "head": "inBody", "body": "inBody", "frameset": "inFrameset", - "html": "beforeHead" + "html": "beforeHead", } for node in self.tree.openElements[::-1]: nodeName = node.name @@ -412,27 +449,31 @@ def parseRCDataRawtext(self, token, contentType): def getPhases(debug): def log(function): """Logger that records which phase processes each token""" - type_names = dict((value, key) for key, value in - tokenTypes.items()) + type_names = dict((value, key) for key, value in tokenTypes.items()) def wrapped(self, *args, **kwargs): if function.__name__.startswith("process") and len(args) > 0: token = args[0] try: - info = {"type": type_names[token['type']]} + info = {"type": type_names[token["type"]]} except: raise - if token['type'] in tagTokenTypes: - info["name"] = token['name'] - - self.parser.log.append((self.parser.tokenizer.state.__name__, - self.parser.phase.__class__.__name__, - self.__class__.__name__, - function.__name__, - info)) + if token["type"] in tagTokenTypes: + info["name"] = token["name"] + + self.parser.log.append( + ( + self.parser.tokenizer.state.__name__, + self.parser.phase.__class__.__name__, + self.__class__.__name__, + function.__name__, + info, + ) + ) return function(self, *args, **kwargs) else: return function(self, *args, **kwargs) + return wrapped def getMetaclass(use_metaclass, metaclass_func): @@ -443,8 +484,7 @@ def getMetaclass(use_metaclass, metaclass_func): # pylint:disable=unused-argument class Phase(with_metaclass(getMetaclass(debug, log))): - """Base class for helper object that implements each phase of processing - """ + """Base class for helper object that implements each phase of processing""" def __init__(self, parser, tree): self.parser = parser @@ -496,8 +536,12 @@ def processDoctype(self, token): systemId = token["systemId"] correct = token["correct"] - if (name != "html" or publicId is not None or - systemId is not None and systemId != "about:legacy-compat"): + if ( + name != "html" + or publicId is not None + or systemId is not None + and systemId != "about:legacy-compat" + ): self.parser.parseError("unknown-doctype") if publicId is None: @@ -508,79 +552,101 @@ def processDoctype(self, token): if publicId != "": publicId = publicId.translate(asciiUpper2Lower) - if (not correct or token["name"] != "html" or - publicId.startswith( - ("+//silmaril//dtd html pro v0r11 19970101//", - "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", - "-//as//dtd html 3.0 aswedit + extensions//", - "-//ietf//dtd html 2.0 level 1//", - "-//ietf//dtd html 2.0 level 2//", - "-//ietf//dtd html 2.0 strict level 1//", - "-//ietf//dtd html 2.0 strict level 2//", - "-//ietf//dtd html 2.0 strict//", - "-//ietf//dtd html 2.0//", - "-//ietf//dtd html 2.1e//", - "-//ietf//dtd html 3.0//", - "-//ietf//dtd html 3.2 final//", - "-//ietf//dtd html 3.2//", - "-//ietf//dtd html 3//", - "-//ietf//dtd html level 0//", - "-//ietf//dtd html level 1//", - "-//ietf//dtd html level 2//", - "-//ietf//dtd html level 3//", - "-//ietf//dtd html strict level 0//", - "-//ietf//dtd html strict level 1//", - "-//ietf//dtd html strict level 2//", - "-//ietf//dtd html strict level 3//", - "-//ietf//dtd html strict//", - "-//ietf//dtd html//", - "-//metrius//dtd metrius presentational//", - "-//microsoft//dtd internet explorer 2.0 html strict//", - "-//microsoft//dtd internet explorer 2.0 html//", - "-//microsoft//dtd internet explorer 2.0 tables//", - "-//microsoft//dtd internet explorer 3.0 html strict//", - "-//microsoft//dtd internet explorer 3.0 html//", - "-//microsoft//dtd internet explorer 3.0 tables//", - "-//netscape comm. corp.//dtd html//", - "-//netscape comm. corp.//dtd strict html//", - "-//o'reilly and associates//dtd html 2.0//", - "-//o'reilly and associates//dtd html extended 1.0//", - "-//o'reilly and associates//dtd html extended relaxed 1.0//", - "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", - "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", - "-//spyglass//dtd html 2.0 extended//", - "-//sq//dtd html 2.0 hotmetal + extensions//", - "-//sun microsystems corp.//dtd hotjava html//", - "-//sun microsystems corp.//dtd hotjava strict html//", - "-//w3c//dtd html 3 1995-03-24//", - "-//w3c//dtd html 3.2 draft//", - "-//w3c//dtd html 3.2 final//", - "-//w3c//dtd html 3.2//", - "-//w3c//dtd html 3.2s draft//", - "-//w3c//dtd html 4.0 frameset//", - "-//w3c//dtd html 4.0 transitional//", - "-//w3c//dtd html experimental 19960712//", - "-//w3c//dtd html experimental 970421//", - "-//w3c//dtd w3 html//", - "-//w3o//dtd w3 html 3.0//", - "-//webtechs//dtd mozilla html 2.0//", - "-//webtechs//dtd mozilla html//")) or - publicId in ("-//w3o//dtd w3 html strict 3.0//en//", - "-/w3c/dtd html 4.0 transitional/en", - "html") or - publicId.startswith( - ("-//w3c//dtd html 4.01 frameset//", - "-//w3c//dtd html 4.01 transitional//")) and - systemId is None or - systemId and systemId.lower() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"): + if ( + not correct + or token["name"] != "html" + or publicId.startswith( + ( + "+//silmaril//dtd html pro v0r11 19970101//", + "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", + "-//as//dtd html 3.0 aswedit + extensions//", + "-//ietf//dtd html 2.0 level 1//", + "-//ietf//dtd html 2.0 level 2//", + "-//ietf//dtd html 2.0 strict level 1//", + "-//ietf//dtd html 2.0 strict level 2//", + "-//ietf//dtd html 2.0 strict//", + "-//ietf//dtd html 2.0//", + "-//ietf//dtd html 2.1e//", + "-//ietf//dtd html 3.0//", + "-//ietf//dtd html 3.2 final//", + "-//ietf//dtd html 3.2//", + "-//ietf//dtd html 3//", + "-//ietf//dtd html level 0//", + "-//ietf//dtd html level 1//", + "-//ietf//dtd html level 2//", + "-//ietf//dtd html level 3//", + "-//ietf//dtd html strict level 0//", + "-//ietf//dtd html strict level 1//", + "-//ietf//dtd html strict level 2//", + "-//ietf//dtd html strict level 3//", + "-//ietf//dtd html strict//", + "-//ietf//dtd html//", + "-//metrius//dtd metrius presentational//", + "-//microsoft//dtd internet explorer 2.0 html strict//", + "-//microsoft//dtd internet explorer 2.0 html//", + "-//microsoft//dtd internet explorer 2.0 tables//", + "-//microsoft//dtd internet explorer 3.0 html strict//", + "-//microsoft//dtd internet explorer 3.0 html//", + "-//microsoft//dtd internet explorer 3.0 tables//", + "-//netscape comm. corp.//dtd html//", + "-//netscape comm. corp.//dtd strict html//", + "-//o'reilly and associates//dtd html 2.0//", + "-//o'reilly and associates//dtd html extended 1.0//", + "-//o'reilly and associates//dtd html extended relaxed 1.0//", + "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", + "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", + "-//spyglass//dtd html 2.0 extended//", + "-//sq//dtd html 2.0 hotmetal + extensions//", + "-//sun microsystems corp.//dtd hotjava html//", + "-//sun microsystems corp.//dtd hotjava strict html//", + "-//w3c//dtd html 3 1995-03-24//", + "-//w3c//dtd html 3.2 draft//", + "-//w3c//dtd html 3.2 final//", + "-//w3c//dtd html 3.2//", + "-//w3c//dtd html 3.2s draft//", + "-//w3c//dtd html 4.0 frameset//", + "-//w3c//dtd html 4.0 transitional//", + "-//w3c//dtd html experimental 19960712//", + "-//w3c//dtd html experimental 970421//", + "-//w3c//dtd w3 html//", + "-//w3o//dtd w3 html 3.0//", + "-//webtechs//dtd mozilla html 2.0//", + "-//webtechs//dtd mozilla html//", + ) + ) + or publicId + in ( + "-//w3o//dtd w3 html strict 3.0//en//", + "-/w3c/dtd html 4.0 transitional/en", + "html", + ) + or publicId.startswith( + ( + "-//w3c//dtd html 4.01 frameset//", + "-//w3c//dtd html 4.01 transitional//", + ) + ) + and systemId is None + or systemId + and systemId.lower() + == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" + ): self.parser.compatMode = "quirks" - elif (publicId.startswith( - ("-//w3c//dtd xhtml 1.0 frameset//", - "-//w3c//dtd xhtml 1.0 transitional//")) or - publicId.startswith( - ("-//w3c//dtd html 4.01 frameset//", - "-//w3c//dtd html 4.01 transitional//")) and - systemId is not None): + elif ( + publicId.startswith( + ( + "-//w3c//dtd xhtml 1.0 frameset//", + "-//w3c//dtd xhtml 1.0 transitional//", + ) + ) + or publicId.startswith( + ( + "-//w3c//dtd html 4.01 frameset//", + "-//w3c//dtd html 4.01 transitional//", + ) + ) + and systemId is not None + ): self.parser.compatMode = "limited quirks" self.parser.phase = self.parser.phases["beforeHtml"] @@ -595,14 +661,16 @@ def processCharacters(self, token): return token def processStartTag(self, token): - self.parser.parseError("expected-doctype-but-got-start-tag", - {"name": token["name"]}) + self.parser.parseError( + "expected-doctype-but-got-start-tag", {"name": token["name"]} + ) self.anythingElse() return token def processEndTag(self, token): - self.parser.parseError("expected-doctype-but-got-end-tag", - {"name": token["name"]}) + self.parser.parseError( + "expected-doctype-but-got-end-tag", {"name": token["name"]} + ) self.anythingElse() return token @@ -640,8 +708,9 @@ def processStartTag(self, token): def processEndTag(self, token): if token["name"] not in ("head", "body", "html", "br"): - self.parser.parseError("unexpected-end-tag-before-html", - {"name": token["name"]}) + self.parser.parseError( + "unexpected-end-tag-before-html", {"name": token["name"]} + ) else: self.insertHtmlElement() return token @@ -650,15 +719,14 @@ class BeforeHeadPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("head", self.startTagHead) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [("html", self.startTagHtml), ("head", self.startTagHead)] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - (("head", "body", "html", "br"), self.endTagImplyHead) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [(("head", "body", "html", "br"), self.endTagImplyHead)] + ) self.endTagHandler.default = self.endTagOther def processEOF(self): @@ -689,30 +757,37 @@ def endTagImplyHead(self, token): return token def endTagOther(self, token): - self.parser.parseError("end-tag-after-implied-root", - {"name": token["name"]}) + self.parser.parseError( + "end-tag-after-implied-root", {"name": token["name"]} + ) class InHeadPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("title", self.startTagTitle), - (("noframes", "style"), self.startTagNoFramesStyle), - ("noscript", self.startTagNoscript), - ("script", self.startTagScript), - (("base", "basefont", "bgsound", "command", "link"), - self.startTagBaseLinkCommand), - ("meta", self.startTagMeta), - ("head", self.startTagHead) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ("title", self.startTagTitle), + (("noframes", "style"), self.startTagNoFramesStyle), + ("noscript", self.startTagNoscript), + ("script", self.startTagScript), + ( + ("base", "basefont", "bgsound", "command", "link"), + self.startTagBaseLinkCommand, + ), + ("meta", self.startTagMeta), + ("head", self.startTagHead), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("head", self.endTagHead), - (("br", "html", "body"), self.endTagHtmlBodyBr) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + ("head", self.endTagHead), + (("br", "html", "body"), self.endTagHtmlBodyBr), + ] + ) self.endTagHandler.default = self.endTagOther # the real thing @@ -744,14 +819,18 @@ def startTagMeta(self, token): if self.parser.tokenizer.stream.charEncoding[1] == "tentative": if "charset" in attributes: self.parser.tokenizer.stream.changeEncoding(attributes["charset"]) - elif ("content" in attributes and - "http-equiv" in attributes and - attributes["http-equiv"].lower() == "content-type"): + elif ( + "content" in attributes + and "http-equiv" in attributes + and attributes["http-equiv"].lower() == "content-type" + ): # Encoding it as UTF-8 here is a hack, as really we should pass # the abstract Unicode string, and just use the # ContentAttrParser on that, but using UTF-8 allows all chars # to be encoded and as a ASCII-superset works. - data = _inputstream.EncodingBytes(attributes["content"].encode("utf-8")) + data = _inputstream.EncodingBytes( + attributes["content"].encode("utf-8") + ) parser = _inputstream.ContentAttrParser(data) codec = parser.parse() self.parser.tokenizer.stream.changeEncoding(codec) @@ -799,17 +878,24 @@ class InHeadNoscriptPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("basefont", "bgsound", "link", "meta", "noframes", "style"), self.startTagBaseLinkCommand), - (("head", "noscript"), self.startTagHeadNoscript), - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ( + ("basefont", "bgsound", "link", "meta", "noframes", "style"), + self.startTagBaseLinkCommand, + ), + (("head", "noscript"), self.startTagHeadNoscript), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("noscript", self.endTagNoscript), - ("br", self.endTagBr), - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + ("noscript", self.endTagNoscript), + ("br", self.endTagBr), + ] + ) self.endTagHandler.default = self.endTagOther def processEOF(self): @@ -838,7 +924,9 @@ def startTagHeadNoscript(self, token): self.parser.parseError("unexpected-start-tag", {"name": token["name"]}) def startTagOther(self, token): - self.parser.parseError("unexpected-inhead-noscript-tag", {"name": token["name"]}) + self.parser.parseError( + "unexpected-inhead-noscript-tag", {"name": token["name"]} + ) self.anythingElse() return token @@ -848,7 +936,9 @@ def endTagNoscript(self, token): self.parser.phase = self.parser.phases["inHead"] def endTagBr(self, token): - self.parser.parseError("unexpected-inhead-noscript-tag", {"name": token["name"]}) + self.parser.parseError( + "unexpected-inhead-noscript-tag", {"name": token["name"]} + ) self.anythingElse() return token @@ -863,18 +953,32 @@ class AfterHeadPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("body", self.startTagBody), - ("frameset", self.startTagFrameset), - (("base", "basefont", "bgsound", "link", "meta", "noframes", "script", - "style", "title"), - self.startTagFromHead), - ("head", self.startTagHead) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ("body", self.startTagBody), + ("frameset", self.startTagFrameset), + ( + ( + "base", + "basefont", + "bgsound", + "link", + "meta", + "noframes", + "script", + "style", + "title", + ), + self.startTagFromHead, + ), + ("head", self.startTagHead), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([(("body", "html", "br"), - self.endTagHtmlBodyBr)]) + self.endTagHandler = _utils.MethodDispatcher( + [(("body", "html", "br"), self.endTagHtmlBodyBr)] + ) self.endTagHandler.default = self.endTagOther def processEOF(self): @@ -898,8 +1002,9 @@ def startTagFrameset(self, token): self.parser.phase = self.parser.phases["inFrameset"] def startTagFromHead(self, token): - self.parser.parseError("unexpected-start-tag-out-of-my-head", - {"name": token["name"]}) + self.parser.parseError( + "unexpected-start-tag-out-of-my-head", {"name": token["name"]} + ) self.tree.openElements.append(self.tree.headPointer) self.parser.phases["inHead"].processStartTag(token) for node in self.tree.openElements[::-1]: @@ -935,75 +1040,189 @@ def __init__(self, parser, tree): # Set this to the default handler self.processSpaceCharacters = self.processSpaceCharactersNonPre - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("base", "basefont", "bgsound", "command", "link", "meta", - "script", "style", "title"), - self.startTagProcessInHead), - ("body", self.startTagBody), - ("frameset", self.startTagFrameset), - (("address", "article", "aside", "blockquote", "center", "details", - "dir", "div", "dl", "fieldset", "figcaption", "figure", - "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p", - "section", "summary", "ul"), - self.startTagCloseP), - (headingElements, self.startTagHeading), - (("pre", "listing"), self.startTagPreListing), - ("form", self.startTagForm), - (("li", "dd", "dt"), self.startTagListItem), - ("plaintext", self.startTagPlaintext), - ("a", self.startTagA), - (("b", "big", "code", "em", "font", "i", "s", "small", "strike", - "strong", "tt", "u"), self.startTagFormatting), - ("nobr", self.startTagNobr), - ("button", self.startTagButton), - (("applet", "marquee", "object"), self.startTagAppletMarqueeObject), - ("xmp", self.startTagXmp), - ("table", self.startTagTable), - (("area", "br", "embed", "img", "keygen", "wbr"), - self.startTagVoidFormatting), - (("param", "source", "track"), self.startTagParamSource), - ("input", self.startTagInput), - ("hr", self.startTagHr), - ("image", self.startTagImage), - ("isindex", self.startTagIsIndex), - ("textarea", self.startTagTextarea), - ("iframe", self.startTagIFrame), - ("noscript", self.startTagNoscript), - (("noembed", "noframes"), self.startTagRawtext), - ("select", self.startTagSelect), - (("rp", "rt"), self.startTagRpRt), - (("option", "optgroup"), self.startTagOpt), - (("math"), self.startTagMath), - (("svg"), self.startTagSvg), - (("caption", "col", "colgroup", "frame", "head", - "tbody", "td", "tfoot", "th", "thead", - "tr"), self.startTagMisplaced) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ( + ( + "base", + "basefont", + "bgsound", + "command", + "link", + "meta", + "script", + "style", + "title", + ), + self.startTagProcessInHead, + ), + ("body", self.startTagBody), + ("frameset", self.startTagFrameset), + ( + ( + "address", + "article", + "aside", + "blockquote", + "center", + "details", + "dir", + "div", + "dl", + "fieldset", + "figcaption", + "figure", + "footer", + "header", + "hgroup", + "main", + "menu", + "nav", + "ol", + "p", + "section", + "summary", + "ul", + ), + self.startTagCloseP, + ), + (headingElements, self.startTagHeading), + (("pre", "listing"), self.startTagPreListing), + ("form", self.startTagForm), + (("li", "dd", "dt"), self.startTagListItem), + ("plaintext", self.startTagPlaintext), + ("a", self.startTagA), + ( + ( + "b", + "big", + "code", + "em", + "font", + "i", + "s", + "small", + "strike", + "strong", + "tt", + "u", + ), + self.startTagFormatting, + ), + ("nobr", self.startTagNobr), + ("button", self.startTagButton), + (("applet", "marquee", "object"), self.startTagAppletMarqueeObject), + ("xmp", self.startTagXmp), + ("table", self.startTagTable), + ( + ("area", "br", "embed", "img", "keygen", "wbr"), + self.startTagVoidFormatting, + ), + (("param", "source", "track"), self.startTagParamSource), + ("input", self.startTagInput), + ("hr", self.startTagHr), + ("image", self.startTagImage), + ("isindex", self.startTagIsIndex), + ("textarea", self.startTagTextarea), + ("iframe", self.startTagIFrame), + ("noscript", self.startTagNoscript), + (("noembed", "noframes"), self.startTagRawtext), + ("select", self.startTagSelect), + (("rp", "rt"), self.startTagRpRt), + (("option", "optgroup"), self.startTagOpt), + (("math"), self.startTagMath), + (("svg"), self.startTagSvg), + ( + ( + "caption", + "col", + "colgroup", + "frame", + "head", + "tbody", + "td", + "tfoot", + "th", + "thead", + "tr", + ), + self.startTagMisplaced, + ), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("body", self.endTagBody), - ("html", self.endTagHtml), - (("address", "article", "aside", "blockquote", "button", "center", - "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", - "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", - "section", "summary", "ul"), self.endTagBlock), - ("form", self.endTagForm), - ("p", self.endTagP), - (("dd", "dt", "li"), self.endTagListItem), - (headingElements, self.endTagHeading), - (("a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", - "strike", "strong", "tt", "u"), self.endTagFormatting), - (("applet", "marquee", "object"), self.endTagAppletMarqueeObject), - ("br", self.endTagBr), - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + ("body", self.endTagBody), + ("html", self.endTagHtml), + ( + ( + "address", + "article", + "aside", + "blockquote", + "button", + "center", + "details", + "dialog", + "dir", + "div", + "dl", + "fieldset", + "figcaption", + "figure", + "footer", + "header", + "hgroup", + "listing", + "main", + "menu", + "nav", + "ol", + "pre", + "section", + "summary", + "ul", + ), + self.endTagBlock, + ), + ("form", self.endTagForm), + ("p", self.endTagP), + (("dd", "dt", "li"), self.endTagListItem), + (headingElements, self.endTagHeading), + ( + ( + "a", + "b", + "big", + "code", + "em", + "font", + "i", + "nobr", + "s", + "small", + "strike", + "strong", + "tt", + "u", + ), + self.endTagFormatting, + ), + (("applet", "marquee", "object"), self.endTagAppletMarqueeObject), + ("br", self.endTagBr), + ] + ) self.endTagHandler.default = self.endTagOther def isMatchingFormattingElement(self, node1, node2): - return (node1.name == node2.name and - node1.namespace == node2.namespace and - node1.attributes == node2.attributes) + return ( + node1.name == node2.name + and node1.namespace == node2.namespace + and node1.attributes == node2.attributes + ) # helper def addFormattingElement(self, token): @@ -1024,9 +1243,22 @@ def addFormattingElement(self, token): # the real deal def processEOF(self): - allowed_elements = frozenset(("dd", "dt", "li", "p", "tbody", "td", - "tfoot", "th", "thead", "tr", "body", - "html")) + allowed_elements = frozenset( + ( + "dd", + "dt", + "li", + "p", + "tbody", + "td", + "tfoot", + "th", + "thead", + "tr", + "body", + "html", + ) + ) for node in self.tree.openElements[::-1]: if node.name not in allowed_elements: self.parser.parseError("expected-closing-tag-but-got-eof") @@ -1038,9 +1270,11 @@ def processSpaceCharactersDropNewline(self, token): # want to drop leading newlines data = token["data"] self.processSpaceCharacters = self.processSpaceCharactersNonPre - if (data.startswith("\n") and - self.tree.openElements[-1].name in ("pre", "listing", "textarea") and - not self.tree.openElements[-1].hasContent()): + if ( + data.startswith("\n") + and self.tree.openElements[-1].name in ("pre", "listing", "textarea") + and not self.tree.openElements[-1].hasContent() + ): data = data[1:] if data: self.tree.reconstructActiveFormattingElements() @@ -1053,9 +1287,9 @@ def processCharacters(self, token): self.tree.reconstructActiveFormattingElements() self.tree.insertText(token["data"]) # This must be bad for performance - if (self.parser.framesetOK and - any([char not in spaceCharacters - for char in token["data"]])): + if self.parser.framesetOK and any( + [char not in spaceCharacters for char in token["data"]] + ): self.parser.framesetOK = False def processSpaceCharactersNonPre(self, token): @@ -1067,8 +1301,10 @@ def startTagProcessInHead(self, token): def startTagBody(self, token): self.parser.parseError("unexpected-start-tag", {"name": "body"}) - if (len(self.tree.openElements) == 1 or - self.tree.openElements[1].name != "body"): + if ( + len(self.tree.openElements) == 1 + or self.tree.openElements[1].name != "body" + ): assert self.parser.innerHTML else: self.parser.framesetOK = False @@ -1078,13 +1314,18 @@ def startTagBody(self, token): def startTagFrameset(self, token): self.parser.parseError("unexpected-start-tag", {"name": "frameset"}) - if (len(self.tree.openElements) == 1 or self.tree.openElements[1].name != "body"): + if ( + len(self.tree.openElements) == 1 + or self.tree.openElements[1].name != "body" + ): assert self.parser.innerHTML elif not self.parser.framesetOK: pass else: if self.tree.openElements[1].parent: - self.tree.openElements[1].parent.removeChild(self.tree.openElements[1]) + self.tree.openElements[1].parent.removeChild( + self.tree.openElements[1] + ) while self.tree.openElements[-1].name != "html": self.tree.openElements.pop() self.tree.insertElement(token) @@ -1114,22 +1355,23 @@ def startTagForm(self, token): def startTagListItem(self, token): self.parser.framesetOK = False - stopNamesMap = {"li": ["li"], - "dt": ["dt", "dd"], - "dd": ["dt", "dd"]} + stopNamesMap = {"li": ["li"], "dt": ["dt", "dd"], "dd": ["dt", "dd"]} stopNames = stopNamesMap[token["name"]] for node in reversed(self.tree.openElements): if node.name in stopNames: self.parser.phase.processEndTag( - impliedTagToken(node.name, "EndTag")) + impliedTagToken(node.name, "EndTag") + ) break - if (node.nameTuple in specialElements and - node.name not in ("address", "div", "p")): + if node.nameTuple in specialElements and node.name not in ( + "address", + "div", + "p", + ): break if self.tree.elementInScope("p", variant="button"): - self.parser.phase.processEndTag( - impliedTagToken("p", "EndTag")) + self.parser.phase.processEndTag(impliedTagToken("p", "EndTag")) self.tree.insertElement(token) @@ -1150,8 +1392,10 @@ def startTagHeading(self, token): def startTagA(self, token): afeAElement = self.tree.elementInActiveFormattingElements("a") if afeAElement: - self.parser.parseError("unexpected-start-tag-implies-end-tag", - {"startName": "a", "endName": "a"}) + self.parser.parseError( + "unexpected-start-tag-implies-end-tag", + {"startName": "a", "endName": "a"}, + ) self.endTagFormatting(impliedTagToken("a")) if afeAElement in self.tree.openElements: self.tree.openElements.remove(afeAElement) @@ -1167,8 +1411,10 @@ def startTagFormatting(self, token): def startTagNobr(self, token): self.tree.reconstructActiveFormattingElements() if self.tree.elementInScope("nobr"): - self.parser.parseError("unexpected-start-tag-implies-end-tag", - {"startName": "nobr", "endName": "nobr"}) + self.parser.parseError( + "unexpected-start-tag-implies-end-tag", + {"startName": "nobr", "endName": "nobr"}, + ) self.processEndTag(impliedTagToken("nobr")) # XXX Need tests that trigger the following self.tree.reconstructActiveFormattingElements() @@ -1176,8 +1422,10 @@ def startTagNobr(self, token): def startTagButton(self, token): if self.tree.elementInScope("button"): - self.parser.parseError("unexpected-start-tag-implies-end-tag", - {"startName": "button", "endName": "button"}) + self.parser.parseError( + "unexpected-start-tag-implies-end-tag", + {"startName": "button", "endName": "button"}, + ) self.processEndTag(impliedTagToken("button")) return token else: @@ -1216,8 +1464,10 @@ def startTagVoidFormatting(self, token): def startTagInput(self, token): framesetOK = self.parser.framesetOK self.startTagVoidFormatting(token) - if ("type" in token["data"] and - token["data"]["type"].translate(asciiUpper2Lower) == "hidden"): + if ( + "type" in token["data"] + and token["data"]["type"].translate(asciiUpper2Lower) == "hidden" + ): # input type=hidden doesn't change framesetOK self.parser.framesetOK = framesetOK @@ -1236,11 +1486,18 @@ def startTagHr(self, token): def startTagImage(self, token): # No really... - self.parser.parseError("unexpected-start-tag-treated-as", - {"originalName": "image", "newName": "img"}) - self.processStartTag(impliedTagToken("img", "StartTag", - attributes=token["data"], - selfClosing=token["selfClosing"])) + self.parser.parseError( + "unexpected-start-tag-treated-as", + {"originalName": "image", "newName": "img"}, + ) + self.processStartTag( + impliedTagToken( + "img", + "StartTag", + attributes=token["data"], + selfClosing=token["selfClosing"], + ) + ) def startTagIsIndex(self, token): self.parser.parseError("deprecated-tag", {"name": "isindex"}) @@ -1249,8 +1506,9 @@ def startTagIsIndex(self, token): form_attrs = {} if "action" in token["data"]: form_attrs["action"] = token["data"]["action"] - self.processStartTag(impliedTagToken("form", "StartTag", - attributes=form_attrs)) + self.processStartTag( + impliedTagToken("form", "StartTag", attributes=form_attrs) + ) self.processStartTag(impliedTagToken("hr", "StartTag")) self.processStartTag(impliedTagToken("label", "StartTag")) # XXX Localization ... @@ -1258,17 +1516,21 @@ def startTagIsIndex(self, token): prompt = token["data"]["prompt"] else: prompt = "This is a searchable index. Enter search keywords: " - self.processCharacters( - {"type": tokenTypes["Characters"], "data": prompt}) + self.processCharacters({"type": tokenTypes["Characters"], "data": prompt}) attributes = token["data"].copy() if "action" in attributes: del attributes["action"] if "prompt" in attributes: del attributes["prompt"] attributes["name"] = "isindex" - self.processStartTag(impliedTagToken("input", "StartTag", - attributes=attributes, - selfClosing=token["selfClosing"])) + self.processStartTag( + impliedTagToken( + "input", + "StartTag", + attributes=attributes, + selfClosing=token["selfClosing"], + ) + ) self.processEndTag(impliedTagToken("label")) self.processStartTag(impliedTagToken("hr", "StartTag")) self.processEndTag(impliedTagToken("form")) @@ -1303,12 +1565,14 @@ def startTagSelect(self, token): self.tree.reconstructActiveFormattingElements() self.tree.insertElement(token) self.parser.framesetOK = False - if self.parser.phase in (self.parser.phases["inTable"], - self.parser.phases["inCaption"], - self.parser.phases["inColumnGroup"], - self.parser.phases["inTableBody"], - self.parser.phases["inRow"], - self.parser.phases["inCell"]): + if self.parser.phase in ( + self.parser.phases["inTable"], + self.parser.phases["inCaption"], + self.parser.phases["inColumnGroup"], + self.parser.phases["inTableBody"], + self.parser.phases["inRow"], + self.parser.phases["inCell"], + ): self.parser.phase = self.parser.phases["inSelectInTable"] else: self.parser.phase = self.parser.phases["inSelect"] @@ -1345,13 +1609,15 @@ def startTagSvg(self, token): token["selfClosingAcknowledged"] = True def startTagMisplaced(self, token): - """ Elements that should be children of other elements that have a + """Elements that should be children of other elements that have a different insertion mode; here they are ignored "caption", "col", "colgroup", "frame", "frameset", "head", "option", "optgroup", "tbody", "td", "tfoot", "th", "thead", "tr", "noscript" """ - self.parser.parseError("unexpected-start-tag-ignored", {"name": token["name"]}) + self.parser.parseError( + "unexpected-start-tag-ignored", {"name": token["name"]} + ) def startTagOther(self, token): self.tree.reconstructActiveFormattingElements() @@ -1376,15 +1642,31 @@ def endTagBody(self, token): return elif self.tree.openElements[-1].name != "body": for node in self.tree.openElements[2:]: - if node.name not in frozenset(("dd", "dt", "li", "optgroup", - "option", "p", "rp", "rt", - "tbody", "td", "tfoot", - "th", "thead", "tr", "body", - "html")): + if node.name not in frozenset( + ( + "dd", + "dt", + "li", + "optgroup", + "option", + "p", + "rp", + "rt", + "tbody", + "td", + "tfoot", + "th", + "thead", + "tr", + "body", + "html", + ) + ): # Not sure this is the correct name for the parse error self.parser.parseError( "expected-one-end-tag-but-got-another", - {"gotName": "body", "expectedName": node.name}) + {"gotName": "body", "expectedName": node.name}, + ) break self.parser.phase = self.parser.phases["afterBody"] @@ -1412,13 +1694,13 @@ def endTagForm(self, token): node = self.tree.formPointer self.tree.formPointer = None if node is None or not self.tree.elementInScope(node): - self.parser.parseError("unexpected-end-tag", - {"name": "form"}) + self.parser.parseError("unexpected-end-tag", {"name": "form"}) else: self.tree.generateImpliedEndTags() if self.tree.openElements[-1] != node: - self.parser.parseError("end-tag-too-early-ignored", - {"name": "form"}) + self.parser.parseError( + "end-tag-too-early-ignored", {"name": "form"} + ) self.tree.openElements.remove(node) def endTagListItem(self, token): @@ -1431,9 +1713,7 @@ def endTagListItem(self, token): else: self.tree.generateImpliedEndTags(exclude=token["name"]) if self.tree.openElements[-1].name != token["name"]: - self.parser.parseError( - "end-tag-too-early", - {"name": token["name"]}) + self.parser.parseError("end-tag-too-early", {"name": token["name"]}) node = self.tree.openElements.pop() while node.name != token["name"]: node = self.tree.openElements.pop() @@ -1476,10 +1756,12 @@ def endTagFormatting(self, token): # otherwise, and # - has the same tag name as the token. formattingElement = self.tree.elementInActiveFormattingElements( - token["name"]) - if (not formattingElement or - (formattingElement in self.tree.openElements and - not self.tree.elementInScope(formattingElement.name))): + token["name"] + ) + if not formattingElement or ( + formattingElement in self.tree.openElements + and not self.tree.elementInScope(formattingElement.name) + ): # If there is no such node, then abort these steps # and instead act as described in the "any other # end tag" entry below. @@ -1491,7 +1773,9 @@ def endTagFormatting(self, token): # parse error; remove the element from the list, and # abort these steps. elif formattingElement not in self.tree.openElements: - self.parser.parseError("adoption-agency-1.2", {"name": token["name"]}) + self.parser.parseError( + "adoption-agency-1.2", {"name": token["name"]} + ) self.tree.activeFormattingElements.remove(formattingElement) return @@ -1500,7 +1784,9 @@ def endTagFormatting(self, token): # is not in scope, then this is a parse error; ignore # the token, and abort these steps. elif not self.tree.elementInScope(formattingElement.name): - self.parser.parseError("adoption-agency-4.4", {"name": token["name"]}) + self.parser.parseError( + "adoption-agency-4.4", {"name": token["name"]} + ) return # Otherwise, there is a formatting element and that @@ -1510,7 +1796,9 @@ def endTagFormatting(self, token): # written in the following steps. else: if formattingElement != self.tree.openElements[-1]: - self.parser.parseError("adoption-agency-1.3", {"name": token["name"]}) + self.parser.parseError( + "adoption-agency-1.3", {"name": token["name"]} + ) # Step 5: @@ -1573,9 +1861,9 @@ def endTagFormatting(self, token): clone = node.cloneNode() # Replace node with clone self.tree.activeFormattingElements[ - self.tree.activeFormattingElements.index(node)] = clone - self.tree.openElements[ - self.tree.openElements.index(node)] = clone + self.tree.activeFormattingElements.index(node) + ] = clone + self.tree.openElements[self.tree.openElements.index(node)] = clone node = clone # Step 9.9 # Remove lastNode from its parents, if any @@ -1592,7 +1880,9 @@ def endTagFormatting(self, token): if lastNode.parent: lastNode.parent.removeChild(lastNode) - if commonAncestor.name in frozenset(("table", "tbody", "tfoot", "thead", "tr")): + if commonAncestor.name in frozenset( + ("table", "tbody", "tfoot", "thead", "tr") + ): parent, insertBefore = self.tree.getTableMisnestedNodePosition() parent.insertBefore(lastNode, insertBefore) else: @@ -1614,7 +1904,8 @@ def endTagFormatting(self, token): # Step 15 self.tree.openElements.remove(formattingElement) self.tree.openElements.insert( - self.tree.openElements.index(furthestBlock) + 1, clone) + self.tree.openElements.index(furthestBlock) + 1, clone + ) def endTagAppletMarqueeObject(self, token): if self.tree.elementInScope(token["name"]): @@ -1629,8 +1920,10 @@ def endTagAppletMarqueeObject(self, token): self.tree.clearActiveFormattingElements() def endTagBr(self, token): - self.parser.parseError("unexpected-end-tag-treated-as", - {"originalName": "br", "newName": "br element"}) + self.parser.parseError( + "unexpected-end-tag-treated-as", + {"originalName": "br", "newName": "br element"}, + ) self.tree.reconstructActiveFormattingElements() self.tree.insertElement(impliedTagToken("br", "StartTag")) self.tree.openElements.pop() @@ -1640,13 +1933,17 @@ def endTagOther(self, token): if node.name == token["name"]: self.tree.generateImpliedEndTags(exclude=token["name"]) if self.tree.openElements[-1].name != token["name"]: - self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) + self.parser.parseError( + "unexpected-end-tag", {"name": token["name"]} + ) while self.tree.openElements.pop() != node: pass break else: if node.nameTuple in specialElements: - self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) + self.parser.parseError( + "unexpected-end-tag", {"name": token["name"]} + ) break class TextPhase(Phase): @@ -1654,22 +1951,27 @@ def __init__(self, parser, tree): Phase.__init__(self, parser, tree) self.startTagHandler = _utils.MethodDispatcher([]) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("script", self.endTagScript)]) + self.endTagHandler = _utils.MethodDispatcher( + [("script", self.endTagScript)] + ) self.endTagHandler.default = self.endTagOther def processCharacters(self, token): self.tree.insertText(token["data"]) def processEOF(self): - self.parser.parseError("expected-named-closing-tag-but-got-eof", - {"name": self.tree.openElements[-1].name}) + self.parser.parseError( + "expected-named-closing-tag-but-got-eof", + {"name": self.tree.openElements[-1].name}, + ) self.tree.openElements.pop() self.parser.phase = self.parser.originalPhase return True def startTagOther(self, token): - assert False, "Tried to process start tag %s in RCDATA/RAWTEXT mode" % token['name'] + assert False, ( + "Tried to process start tag %s in RCDATA/RAWTEXT mode" % token["name"] + ) def endTagScript(self, token): node = self.tree.openElements.pop() @@ -1686,25 +1988,43 @@ class InTablePhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-table def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("caption", self.startTagCaption), - ("colgroup", self.startTagColgroup), - ("col", self.startTagCol), - (("tbody", "tfoot", "thead"), self.startTagRowGroup), - (("td", "th", "tr"), self.startTagImplyTbody), - ("table", self.startTagTable), - (("style", "script"), self.startTagStyleScript), - ("input", self.startTagInput), - ("form", self.startTagForm) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ("caption", self.startTagCaption), + ("colgroup", self.startTagColgroup), + ("col", self.startTagCol), + (("tbody", "tfoot", "thead"), self.startTagRowGroup), + (("td", "th", "tr"), self.startTagImplyTbody), + ("table", self.startTagTable), + (("style", "script"), self.startTagStyleScript), + ("input", self.startTagInput), + ("form", self.startTagForm), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("table", self.endTagTable), - (("body", "caption", "col", "colgroup", "html", "tbody", "td", - "tfoot", "th", "thead", "tr"), self.endTagIgnore) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + ("table", self.endTagTable), + ( + ( + "body", + "caption", + "col", + "colgroup", + "html", + "tbody", + "td", + "tfoot", + "th", + "thead", + "tr", + ), + self.endTagIgnore, + ), + ] + ) self.endTagHandler.default = self.endTagOther # helper methods @@ -1768,8 +2088,10 @@ def startTagImplyTbody(self, token): return token def startTagTable(self, token): - self.parser.parseError("unexpected-start-tag-implies-end-tag", - {"startName": "table", "endName": "table"}) + self.parser.parseError( + "unexpected-start-tag-implies-end-tag", + {"startName": "table", "endName": "table"}, + ) self.parser.phase.processEndTag(impliedTagToken("table")) if not self.parser.innerHTML: return token @@ -1778,8 +2100,10 @@ def startTagStyleScript(self, token): return self.parser.phases["inHead"].processStartTag(token) def startTagInput(self, token): - if ("type" in token["data"] and - token["data"]["type"].translate(asciiUpper2Lower) == "hidden"): + if ( + "type" in token["data"] + and token["data"]["type"].translate(asciiUpper2Lower) == "hidden" + ): self.parser.parseError("unexpected-hidden-input-in-table") self.tree.insertElement(token) # XXX associate with form @@ -1795,7 +2119,9 @@ def startTagForm(self, token): self.tree.openElements.pop() def startTagOther(self, token): - self.parser.parseError("unexpected-start-tag-implies-table-voodoo", {"name": token["name"]}) + self.parser.parseError( + "unexpected-start-tag-implies-table-voodoo", {"name": token["name"]} + ) # Do the table magic! self.tree.insertFromTable = True self.parser.phases["inBody"].processStartTag(token) @@ -1805,9 +2131,13 @@ def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": - self.parser.parseError("end-tag-too-early-named", - {"gotName": "table", - "expectedName": self.tree.openElements[-1].name}) + self.parser.parseError( + "end-tag-too-early-named", + { + "gotName": "table", + "expectedName": self.tree.openElements[-1].name, + }, + ) while self.tree.openElements[-1].name != "table": self.tree.openElements.pop() self.tree.openElements.pop() @@ -1821,7 +2151,9 @@ def endTagIgnore(self, token): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) def endTagOther(self, token): - self.parser.parseError("unexpected-end-tag-implies-table-voodoo", {"name": token["name"]}) + self.parser.parseError( + "unexpected-end-tag-implies-table-voodoo", {"name": token["name"]} + ) # Do the table magic! self.tree.insertFromTable = True self.parser.phases["inBody"].processEndTag(token) @@ -1860,7 +2192,8 @@ def processCharacters(self, token): def processSpaceCharacters(self, token): # pretty sure we should never reach here self.characterTokens.append(token) - # assert False + + # assert False def processStartTag(self, token): self.flushCharacters() @@ -1877,19 +2210,48 @@ class InCaptionPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("caption", "col", "colgroup", "tbody", "td", "tfoot", "th", - "thead", "tr"), self.startTagTableElement) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ( + ( + "caption", + "col", + "colgroup", + "tbody", + "td", + "tfoot", + "th", + "thead", + "tr", + ), + self.startTagTableElement, + ), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("caption", self.endTagCaption), - ("table", self.endTagTable), - (("body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", - "thead", "tr"), self.endTagIgnore) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + ("caption", self.endTagCaption), + ("table", self.endTagTable), + ( + ( + "body", + "col", + "colgroup", + "html", + "tbody", + "td", + "tfoot", + "th", + "thead", + "tr", + ), + self.endTagIgnore, + ), + ] + ) self.endTagHandler.default = self.endTagOther def ignoreEndTagCaption(self): @@ -1917,9 +2279,13 @@ def endTagCaption(self, token): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": - self.parser.parseError("expected-one-end-tag-but-got-another", - {"gotName": "caption", - "expectedName": self.tree.openElements[-1].name}) + self.parser.parseError( + "expected-one-end-tag-but-got-another", + { + "gotName": "caption", + "expectedName": self.tree.openElements[-1].name, + }, + ) while self.tree.openElements[-1].name != "caption": self.tree.openElements.pop() self.tree.openElements.pop() @@ -1949,16 +2315,14 @@ class InColumnGroupPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("col", self.startTagCol) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [("html", self.startTagHtml), ("col", self.startTagCol)] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("colgroup", self.endTagColgroup), - ("col", self.endTagCol) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [("colgroup", self.endTagColgroup), ("col", self.endTagCol)] + ) self.endTagHandler.default = self.endTagOther def ignoreEndTagColgroup(self): @@ -2013,27 +2377,48 @@ class InTableBodyPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-table0 def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("tr", self.startTagTr), - (("td", "th"), self.startTagTableCell), - (("caption", "col", "colgroup", "tbody", "tfoot", "thead"), - self.startTagTableOther) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ("tr", self.startTagTr), + (("td", "th"), self.startTagTableCell), + ( + ("caption", "col", "colgroup", "tbody", "tfoot", "thead"), + self.startTagTableOther, + ), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - (("tbody", "tfoot", "thead"), self.endTagTableRowGroup), - ("table", self.endTagTable), - (("body", "caption", "col", "colgroup", "html", "td", "th", - "tr"), self.endTagIgnore) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + (("tbody", "tfoot", "thead"), self.endTagTableRowGroup), + ("table", self.endTagTable), + ( + ( + "body", + "caption", + "col", + "colgroup", + "html", + "td", + "th", + "tr", + ), + self.endTagIgnore, + ), + ] + ) self.endTagHandler.default = self.endTagOther # helper methods def clearStackToTableBodyContext(self): - while self.tree.openElements[-1].name not in ("tbody", "tfoot", - "thead", "html"): + while self.tree.openElements[-1].name not in ( + "tbody", + "tfoot", + "thead", + "html", + ): # self.parser.parseError("unexpected-implied-end-tag-in-table", # {"name": self.tree.openElements[-1].name}) self.tree.openElements.pop() @@ -2056,19 +2441,23 @@ def startTagTr(self, token): self.parser.phase = self.parser.phases["inRow"] def startTagTableCell(self, token): - self.parser.parseError("unexpected-cell-in-table-body", - {"name": token["name"]}) + self.parser.parseError( + "unexpected-cell-in-table-body", {"name": token["name"]} + ) self.startTagTr(impliedTagToken("tr", "StartTag")) return token def startTagTableOther(self, token): # XXX AT Any ideas on how to share this with endTagTable? - if (self.tree.elementInScope("tbody", variant="table") or - self.tree.elementInScope("thead", variant="table") or - self.tree.elementInScope("tfoot", variant="table")): + if ( + self.tree.elementInScope("tbody", variant="table") + or self.tree.elementInScope("thead", variant="table") + or self.tree.elementInScope("tfoot", variant="table") + ): self.clearStackToTableBodyContext() self.endTagTableRowGroup( - impliedTagToken(self.tree.openElements[-1].name)) + impliedTagToken(self.tree.openElements[-1].name) + ) return token else: # innerHTML case @@ -2084,16 +2473,20 @@ def endTagTableRowGroup(self, token): self.tree.openElements.pop() self.parser.phase = self.parser.phases["inTable"] else: - self.parser.parseError("unexpected-end-tag-in-table-body", - {"name": token["name"]}) + self.parser.parseError( + "unexpected-end-tag-in-table-body", {"name": token["name"]} + ) def endTagTable(self, token): - if (self.tree.elementInScope("tbody", variant="table") or - self.tree.elementInScope("thead", variant="table") or - self.tree.elementInScope("tfoot", variant="table")): + if ( + self.tree.elementInScope("tbody", variant="table") + or self.tree.elementInScope("thead", variant="table") + or self.tree.elementInScope("tfoot", variant="table") + ): self.clearStackToTableBodyContext() self.endTagTableRowGroup( - impliedTagToken(self.tree.openElements[-1].name)) + impliedTagToken(self.tree.openElements[-1].name) + ) return token else: # innerHTML case @@ -2101,8 +2494,9 @@ def endTagTable(self, token): self.parser.parseError() def endTagIgnore(self, token): - self.parser.parseError("unexpected-end-tag-in-table-body", - {"name": token["name"]}) + self.parser.parseError( + "unexpected-end-tag-in-table-body", {"name": token["name"]} + ) def endTagOther(self, token): return self.parser.phases["inTable"].processEndTag(token) @@ -2111,28 +2505,38 @@ class InRowPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-row def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("td", "th"), self.startTagTableCell), - (("caption", "col", "colgroup", "tbody", "tfoot", "thead", - "tr"), self.startTagTableOther) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + (("td", "th"), self.startTagTableCell), + ( + ("caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr"), + self.startTagTableOther, + ), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("tr", self.endTagTr), - ("table", self.endTagTable), - (("tbody", "tfoot", "thead"), self.endTagTableRowGroup), - (("body", "caption", "col", "colgroup", "html", "td", "th"), - self.endTagIgnore) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + ("tr", self.endTagTr), + ("table", self.endTagTable), + (("tbody", "tfoot", "thead"), self.endTagTableRowGroup), + ( + ("body", "caption", "col", "colgroup", "html", "td", "th"), + self.endTagIgnore, + ), + ] + ) self.endTagHandler.default = self.endTagOther # helper methods (XXX unify this with other table helper methods) def clearStackToTableRowContext(self): while self.tree.openElements[-1].name not in ("tr", "html"): - self.parser.parseError("unexpected-implied-end-tag-in-table-row", - {"name": self.tree.openElements[-1].name}) + self.parser.parseError( + "unexpected-implied-end-tag-in-table-row", + {"name": self.tree.openElements[-1].name}, + ) self.tree.openElements.pop() def ignoreEndTagTr(self): @@ -2190,8 +2594,9 @@ def endTagTableRowGroup(self, token): self.parser.parseError() def endTagIgnore(self, token): - self.parser.parseError("unexpected-end-tag-in-table-row", - {"name": token["name"]}) + self.parser.parseError( + "unexpected-end-tag-in-table-row", {"name": token["name"]} + ) def endTagOther(self, token): return self.parser.phases["inTable"].processEndTag(token) @@ -2200,18 +2605,34 @@ class InCellPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-cell def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("caption", "col", "colgroup", "tbody", "td", "tfoot", "th", - "thead", "tr"), self.startTagTableOther) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ( + ( + "caption", + "col", + "colgroup", + "tbody", + "td", + "tfoot", + "th", + "thead", + "tr", + ), + self.startTagTableOther, + ), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - (("td", "th"), self.endTagTableCell), - (("body", "caption", "col", "colgroup", "html"), self.endTagIgnore), - (("table", "tbody", "tfoot", "thead", "tr"), self.endTagImply) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + (("td", "th"), self.endTagTableCell), + (("body", "caption", "col", "colgroup", "html"), self.endTagIgnore), + (("table", "tbody", "tfoot", "thead", "tr"), self.endTagImply), + ] + ) self.endTagHandler.default = self.endTagOther # helper @@ -2229,8 +2650,9 @@ def processCharacters(self, token): return self.parser.phases["inBody"].processCharacters(token) def startTagTableOther(self, token): - if (self.tree.elementInScope("td", variant="table") or - self.tree.elementInScope("th", variant="table")): + if self.tree.elementInScope( + "td", variant="table" + ) or self.tree.elementInScope("th", variant="table"): self.closeCell() return token else: @@ -2245,8 +2667,9 @@ def endTagTableCell(self, token): if self.tree.elementInScope(token["name"], variant="table"): self.tree.generateImpliedEndTags(token["name"]) if self.tree.openElements[-1].name != token["name"]: - self.parser.parseError("unexpected-cell-end-tag", - {"name": token["name"]}) + self.parser.parseError( + "unexpected-cell-end-tag", {"name": token["name"]} + ) while True: node = self.tree.openElements.pop() if node.name == token["name"]: @@ -2276,21 +2699,25 @@ class InSelectPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("option", self.startTagOption), - ("optgroup", self.startTagOptgroup), - ("select", self.startTagSelect), - (("input", "keygen", "textarea"), self.startTagInput), - ("script", self.startTagScript) - ]) + self.startTagHandler = _utils.MethodDispatcher( + [ + ("html", self.startTagHtml), + ("option", self.startTagOption), + ("optgroup", self.startTagOptgroup), + ("select", self.startTagSelect), + (("input", "keygen", "textarea"), self.startTagInput), + ("script", self.startTagScript), + ] + ) self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("option", self.endTagOption), - ("optgroup", self.endTagOptgroup), - ("select", self.endTagSelect) - ]) + self.endTagHandler = _utils.MethodDispatcher( + [ + ("option", self.endTagOption), + ("optgroup", self.endTagOptgroup), + ("select", self.endTagSelect), + ] + ) self.endTagHandler.default = self.endTagOther # http://www.whatwg.org/specs/web-apps/current-work/#in-select @@ -2334,28 +2761,33 @@ def startTagScript(self, token): return self.parser.phases["inHead"].processStartTag(token) def startTagOther(self, token): - self.parser.parseError("unexpected-start-tag-in-select", - {"name": token["name"]}) + self.parser.parseError( + "unexpected-start-tag-in-select", {"name": token["name"]} + ) def endTagOption(self, token): if self.tree.openElements[-1].name == "option": self.tree.openElements.pop() else: - self.parser.parseError("unexpected-end-tag-in-select", - {"name": "option"}) + self.parser.parseError( + "unexpected-end-tag-in-select", {"name": "option"} + ) def endTagOptgroup(self, token): # implicitly closes