Datasets:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +3 -0
- material/dataset/Datasets/Electron Microscopy Image Masks/TiO2_Masks_TSEM/Image_Registration/Output/1908266/1908267.tif +3 -0
- material/dataset/Datasets/Electron Microscopy Image Masks/TiO2_Masks_TSEM/Image_Registration/Output/1908282/1908283.tif +3 -0
- material/dataset/Datasets/Electron Microscopy Images/SEM/1908260.tif +3 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/__init__.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/adapter.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/cache.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/compat.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/serialize.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/_cmd.py +61 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/filewrapper.py +111 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/certifi/__pycache__/__init__.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/certifi/__pycache__/core.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/big5freq.py +386 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/big5prober.py +47 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/codingstatemachine.py +88 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/compat.py +36 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/enums.py +76 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/euckrfreq.py +195 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/euckrprober.py +47 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/euctwprober.py +46 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/langbulgarianmodel.py +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/langthaimodel.py +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/langturkishmodel.py +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/latin1prober.py +145 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/sbcharsetprober.py +145 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/sbcsgroupprober.py +83 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/sjisprober.py +92 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/universaldetector.py +286 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__init__.py +6 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/__init__.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/ansi.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/ansitowin32.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/initialise.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/win32.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/winterm.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/ansi.py +102 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/ansitowin32.py +258 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/initialise.py +80 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/win32.py +152 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/winterm.py +169 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__init__.py +189 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/__init__.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/bar.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/colors.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/counter.cpython-310.pyc +0 -0
- material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/spinner.cpython-310.pyc +0 -0
.gitattributes
CHANGED
|
@@ -321,3 +321,6 @@ material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:
|
|
| 321 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_TSEM/Image_Registration/Input/1908314/1908315.tif filter=lfs diff=lfs merge=lfs -text
|
| 322 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Images/SEM/1908254.tif filter=lfs diff=lfs merge=lfs -text
|
| 323 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_TSEM/Image_Registration/Output/1908278/1908278.tif filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_TSEM/Image_Registration/Input/1908314/1908315.tif filter=lfs diff=lfs merge=lfs -text
|
| 322 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Images/SEM/1908254.tif filter=lfs diff=lfs merge=lfs -text
|
| 323 |
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_TSEM/Image_Registration/Output/1908278/1908278.tif filter=lfs diff=lfs merge=lfs -text
|
| 324 |
+
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Images/SEM/1908260.tif filter=lfs diff=lfs merge=lfs -text
|
| 325 |
+
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_TSEM/Image_Registration/Output/1908266/1908267.tif filter=lfs diff=lfs merge=lfs -text
|
| 326 |
+
material/dataset/Datasets/Electron[[:space:]]Microscopy[[:space:]]Image[[:space:]]Masks/TiO2_Masks_TSEM/Image_Registration/Output/1908282/1908283.tif filter=lfs diff=lfs merge=lfs -text
|
material/dataset/Datasets/Electron Microscopy Image Masks/TiO2_Masks_TSEM/Image_Registration/Output/1908266/1908267.tif
ADDED
|
|
Git LFS Details
|
material/dataset/Datasets/Electron Microscopy Image Masks/TiO2_Masks_TSEM/Image_Registration/Output/1908282/1908283.tif
ADDED
|
|
Git LFS Details
|
material/dataset/Datasets/Electron Microscopy Images/SEM/1908260.tif
ADDED
|
|
Git LFS Details
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (693 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-310.pyc
ADDED
|
Binary file (1.63 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/adapter.cpython-310.pyc
ADDED
|
Binary file (3.21 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/cache.cpython-310.pyc
ADDED
|
Binary file (1.9 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/compat.cpython-310.pyc
ADDED
|
Binary file (807 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-310.pyc
ADDED
|
Binary file (4.77 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/serialize.cpython-310.pyc
ADDED
|
Binary file (4.3 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-310.pyc
ADDED
|
Binary file (738 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/_cmd.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: 2015 Eric Larson
|
| 2 |
+
#
|
| 3 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 4 |
+
|
| 5 |
+
import logging
|
| 6 |
+
|
| 7 |
+
from pip._vendor import requests
|
| 8 |
+
|
| 9 |
+
from pip._vendor.cachecontrol.adapter import CacheControlAdapter
|
| 10 |
+
from pip._vendor.cachecontrol.cache import DictCache
|
| 11 |
+
from pip._vendor.cachecontrol.controller import logger
|
| 12 |
+
|
| 13 |
+
from argparse import ArgumentParser
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def setup_logging():
|
| 17 |
+
logger.setLevel(logging.DEBUG)
|
| 18 |
+
handler = logging.StreamHandler()
|
| 19 |
+
logger.addHandler(handler)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def get_session():
|
| 23 |
+
adapter = CacheControlAdapter(
|
| 24 |
+
DictCache(), cache_etags=True, serializer=None, heuristic=None
|
| 25 |
+
)
|
| 26 |
+
sess = requests.Session()
|
| 27 |
+
sess.mount("http://", adapter)
|
| 28 |
+
sess.mount("https://", adapter)
|
| 29 |
+
|
| 30 |
+
sess.cache_controller = adapter.controller
|
| 31 |
+
return sess
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def get_args():
|
| 35 |
+
parser = ArgumentParser()
|
| 36 |
+
parser.add_argument("url", help="The URL to try and cache")
|
| 37 |
+
return parser.parse_args()
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def main(args=None):
|
| 41 |
+
args = get_args()
|
| 42 |
+
sess = get_session()
|
| 43 |
+
|
| 44 |
+
# Make a request to get a response
|
| 45 |
+
resp = sess.get(args.url)
|
| 46 |
+
|
| 47 |
+
# Turn on logging
|
| 48 |
+
setup_logging()
|
| 49 |
+
|
| 50 |
+
# try setting the cache
|
| 51 |
+
sess.cache_controller.cache_response(resp.request, resp.raw)
|
| 52 |
+
|
| 53 |
+
# Now try to get it
|
| 54 |
+
if sess.cache_controller.cached_request(resp.request):
|
| 55 |
+
print("Cached!")
|
| 56 |
+
else:
|
| 57 |
+
print("Not cached :(")
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
if __name__ == "__main__":
|
| 61 |
+
main()
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/cachecontrol/filewrapper.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-FileCopyrightText: 2015 Eric Larson
|
| 2 |
+
#
|
| 3 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 4 |
+
|
| 5 |
+
from tempfile import NamedTemporaryFile
|
| 6 |
+
import mmap
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class CallbackFileWrapper(object):
|
| 10 |
+
"""
|
| 11 |
+
Small wrapper around a fp object which will tee everything read into a
|
| 12 |
+
buffer, and when that file is closed it will execute a callback with the
|
| 13 |
+
contents of that buffer.
|
| 14 |
+
|
| 15 |
+
All attributes are proxied to the underlying file object.
|
| 16 |
+
|
| 17 |
+
This class uses members with a double underscore (__) leading prefix so as
|
| 18 |
+
not to accidentally shadow an attribute.
|
| 19 |
+
|
| 20 |
+
The data is stored in a temporary file until it is all available. As long
|
| 21 |
+
as the temporary files directory is disk-based (sometimes it's a
|
| 22 |
+
memory-backed-``tmpfs`` on Linux), data will be unloaded to disk if memory
|
| 23 |
+
pressure is high. For small files the disk usually won't be used at all,
|
| 24 |
+
it'll all be in the filesystem memory cache, so there should be no
|
| 25 |
+
performance impact.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
def __init__(self, fp, callback):
|
| 29 |
+
self.__buf = NamedTemporaryFile("rb+", delete=True)
|
| 30 |
+
self.__fp = fp
|
| 31 |
+
self.__callback = callback
|
| 32 |
+
|
| 33 |
+
def __getattr__(self, name):
|
| 34 |
+
# The vaguaries of garbage collection means that self.__fp is
|
| 35 |
+
# not always set. By using __getattribute__ and the private
|
| 36 |
+
# name[0] allows looking up the attribute value and raising an
|
| 37 |
+
# AttributeError when it doesn't exist. This stop thigns from
|
| 38 |
+
# infinitely recursing calls to getattr in the case where
|
| 39 |
+
# self.__fp hasn't been set.
|
| 40 |
+
#
|
| 41 |
+
# [0] https://docs.python.org/2/reference/expressions.html#atom-identifiers
|
| 42 |
+
fp = self.__getattribute__("_CallbackFileWrapper__fp")
|
| 43 |
+
return getattr(fp, name)
|
| 44 |
+
|
| 45 |
+
def __is_fp_closed(self):
|
| 46 |
+
try:
|
| 47 |
+
return self.__fp.fp is None
|
| 48 |
+
|
| 49 |
+
except AttributeError:
|
| 50 |
+
pass
|
| 51 |
+
|
| 52 |
+
try:
|
| 53 |
+
return self.__fp.closed
|
| 54 |
+
|
| 55 |
+
except AttributeError:
|
| 56 |
+
pass
|
| 57 |
+
|
| 58 |
+
# We just don't cache it then.
|
| 59 |
+
# TODO: Add some logging here...
|
| 60 |
+
return False
|
| 61 |
+
|
| 62 |
+
def _close(self):
|
| 63 |
+
if self.__callback:
|
| 64 |
+
if self.__buf.tell() == 0:
|
| 65 |
+
# Empty file:
|
| 66 |
+
result = b""
|
| 67 |
+
else:
|
| 68 |
+
# Return the data without actually loading it into memory,
|
| 69 |
+
# relying on Python's buffer API and mmap(). mmap() just gives
|
| 70 |
+
# a view directly into the filesystem's memory cache, so it
|
| 71 |
+
# doesn't result in duplicate memory use.
|
| 72 |
+
self.__buf.seek(0, 0)
|
| 73 |
+
result = memoryview(
|
| 74 |
+
mmap.mmap(self.__buf.fileno(), 0, access=mmap.ACCESS_READ)
|
| 75 |
+
)
|
| 76 |
+
self.__callback(result)
|
| 77 |
+
|
| 78 |
+
# We assign this to None here, because otherwise we can get into
|
| 79 |
+
# really tricky problems where the CPython interpreter dead locks
|
| 80 |
+
# because the callback is holding a reference to something which
|
| 81 |
+
# has a __del__ method. Setting this to None breaks the cycle
|
| 82 |
+
# and allows the garbage collector to do it's thing normally.
|
| 83 |
+
self.__callback = None
|
| 84 |
+
|
| 85 |
+
# Closing the temporary file releases memory and frees disk space.
|
| 86 |
+
# Important when caching big files.
|
| 87 |
+
self.__buf.close()
|
| 88 |
+
|
| 89 |
+
def read(self, amt=None):
|
| 90 |
+
data = self.__fp.read(amt)
|
| 91 |
+
if data:
|
| 92 |
+
# We may be dealing with b'', a sign that things are over:
|
| 93 |
+
# it's passed e.g. after we've already closed self.__buf.
|
| 94 |
+
self.__buf.write(data)
|
| 95 |
+
if self.__is_fp_closed():
|
| 96 |
+
self._close()
|
| 97 |
+
|
| 98 |
+
return data
|
| 99 |
+
|
| 100 |
+
def _safe_read(self, amt):
|
| 101 |
+
data = self.__fp._safe_read(amt)
|
| 102 |
+
if amt == 2 and data == b"\r\n":
|
| 103 |
+
# urllib executes this read to toss the CRLF at the end
|
| 104 |
+
# of the chunk.
|
| 105 |
+
return data
|
| 106 |
+
|
| 107 |
+
self.__buf.write(data)
|
| 108 |
+
if self.__is_fp_closed():
|
| 109 |
+
self._close()
|
| 110 |
+
|
| 111 |
+
return data
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/certifi/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (326 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/certifi/__pycache__/core.cpython-310.pyc
ADDED
|
Binary file (1.56 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/big5freq.py
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is Mozilla Communicator client code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
#
|
| 12 |
+
# This library is free software; you can redistribute it and/or
|
| 13 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 14 |
+
# License as published by the Free Software Foundation; either
|
| 15 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 16 |
+
#
|
| 17 |
+
# This library is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 20 |
+
# Lesser General Public License for more details.
|
| 21 |
+
#
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 23 |
+
# License along with this library; if not, write to the Free Software
|
| 24 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 25 |
+
# 02110-1301 USA
|
| 26 |
+
######################### END LICENSE BLOCK #########################
|
| 27 |
+
|
| 28 |
+
# Big5 frequency table
|
| 29 |
+
# by Taiwan's Mandarin Promotion Council
|
| 30 |
+
# <http://www.edu.tw:81/mandr/>
|
| 31 |
+
#
|
| 32 |
+
# 128 --> 0.42261
|
| 33 |
+
# 256 --> 0.57851
|
| 34 |
+
# 512 --> 0.74851
|
| 35 |
+
# 1024 --> 0.89384
|
| 36 |
+
# 2048 --> 0.97583
|
| 37 |
+
#
|
| 38 |
+
# Ideal Distribution Ratio = 0.74851/(1-0.74851) =2.98
|
| 39 |
+
# Random Distribution Ration = 512/(5401-512)=0.105
|
| 40 |
+
#
|
| 41 |
+
# Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR
|
| 42 |
+
|
| 43 |
+
BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75
|
| 44 |
+
|
| 45 |
+
#Char to FreqOrder table
|
| 46 |
+
BIG5_TABLE_SIZE = 5376
|
| 47 |
+
|
| 48 |
+
BIG5_CHAR_TO_FREQ_ORDER = (
|
| 49 |
+
1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, # 16
|
| 50 |
+
3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, # 32
|
| 51 |
+
1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, # 48
|
| 52 |
+
63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, # 64
|
| 53 |
+
3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, # 80
|
| 54 |
+
4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, # 96
|
| 55 |
+
5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, # 112
|
| 56 |
+
630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, # 128
|
| 57 |
+
179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, # 144
|
| 58 |
+
995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, # 160
|
| 59 |
+
2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, # 176
|
| 60 |
+
1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, # 192
|
| 61 |
+
3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, # 208
|
| 62 |
+
706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, # 224
|
| 63 |
+
1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, # 240
|
| 64 |
+
3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, # 256
|
| 65 |
+
2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, # 272
|
| 66 |
+
437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, # 288
|
| 67 |
+
3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, # 304
|
| 68 |
+
1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, # 320
|
| 69 |
+
5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, # 336
|
| 70 |
+
266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, # 352
|
| 71 |
+
5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, # 368
|
| 72 |
+
1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, # 384
|
| 73 |
+
32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, # 400
|
| 74 |
+
188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, # 416
|
| 75 |
+
3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, # 432
|
| 76 |
+
3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, # 448
|
| 77 |
+
324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, # 464
|
| 78 |
+
2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, # 480
|
| 79 |
+
2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, # 496
|
| 80 |
+
314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, # 512
|
| 81 |
+
287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, # 528
|
| 82 |
+
3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, # 544
|
| 83 |
+
1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, # 560
|
| 84 |
+
1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, # 576
|
| 85 |
+
1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, # 592
|
| 86 |
+
2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, # 608
|
| 87 |
+
265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, # 624
|
| 88 |
+
4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, # 640
|
| 89 |
+
1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, # 656
|
| 90 |
+
5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, # 672
|
| 91 |
+
2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, # 688
|
| 92 |
+
383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, # 704
|
| 93 |
+
98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, # 720
|
| 94 |
+
523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, # 736
|
| 95 |
+
710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, # 752
|
| 96 |
+
5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, # 768
|
| 97 |
+
379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, # 784
|
| 98 |
+
1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, # 800
|
| 99 |
+
585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, # 816
|
| 100 |
+
690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, # 832
|
| 101 |
+
5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, # 848
|
| 102 |
+
1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, # 864
|
| 103 |
+
544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, # 880
|
| 104 |
+
3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, # 896
|
| 105 |
+
4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, # 912
|
| 106 |
+
3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, # 928
|
| 107 |
+
279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, # 944
|
| 108 |
+
610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, # 960
|
| 109 |
+
1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, # 976
|
| 110 |
+
4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, # 992
|
| 111 |
+
3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, # 1008
|
| 112 |
+
3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, # 1024
|
| 113 |
+
2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, # 1040
|
| 114 |
+
5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, # 1056
|
| 115 |
+
3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, # 1072
|
| 116 |
+
5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, # 1088
|
| 117 |
+
1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, # 1104
|
| 118 |
+
2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, # 1120
|
| 119 |
+
1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, # 1136
|
| 120 |
+
78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, # 1152
|
| 121 |
+
1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, # 1168
|
| 122 |
+
4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, # 1184
|
| 123 |
+
3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, # 1200
|
| 124 |
+
534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, # 1216
|
| 125 |
+
165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, # 1232
|
| 126 |
+
626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, # 1248
|
| 127 |
+
2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, # 1264
|
| 128 |
+
5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, # 1280
|
| 129 |
+
1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, # 1296
|
| 130 |
+
2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, # 1312
|
| 131 |
+
1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, # 1328
|
| 132 |
+
1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, # 1344
|
| 133 |
+
5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, # 1360
|
| 134 |
+
5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, # 1376
|
| 135 |
+
5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, # 1392
|
| 136 |
+
3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, # 1408
|
| 137 |
+
4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, # 1424
|
| 138 |
+
4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, # 1440
|
| 139 |
+
2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, # 1456
|
| 140 |
+
5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, # 1472
|
| 141 |
+
3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, # 1488
|
| 142 |
+
598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, # 1504
|
| 143 |
+
5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, # 1520
|
| 144 |
+
5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, # 1536
|
| 145 |
+
1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, # 1552
|
| 146 |
+
2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, # 1568
|
| 147 |
+
3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, # 1584
|
| 148 |
+
4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, # 1600
|
| 149 |
+
5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, # 1616
|
| 150 |
+
3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, # 1632
|
| 151 |
+
4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, # 1648
|
| 152 |
+
1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, # 1664
|
| 153 |
+
1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, # 1680
|
| 154 |
+
4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, # 1696
|
| 155 |
+
1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, # 1712
|
| 156 |
+
240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, # 1728
|
| 157 |
+
1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, # 1744
|
| 158 |
+
1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, # 1760
|
| 159 |
+
3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, # 1776
|
| 160 |
+
619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, # 1792
|
| 161 |
+
5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, # 1808
|
| 162 |
+
2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, # 1824
|
| 163 |
+
1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, # 1840
|
| 164 |
+
1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, # 1856
|
| 165 |
+
5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, # 1872
|
| 166 |
+
829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, # 1888
|
| 167 |
+
4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, # 1904
|
| 168 |
+
375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, # 1920
|
| 169 |
+
2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, # 1936
|
| 170 |
+
444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, # 1952
|
| 171 |
+
1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, # 1968
|
| 172 |
+
1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, # 1984
|
| 173 |
+
730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, # 2000
|
| 174 |
+
4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, # 2016
|
| 175 |
+
4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, # 2032
|
| 176 |
+
1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, # 2048
|
| 177 |
+
3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, # 2064
|
| 178 |
+
5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, # 2080
|
| 179 |
+
5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, # 2096
|
| 180 |
+
1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, # 2112
|
| 181 |
+
2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, # 2128
|
| 182 |
+
1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, # 2144
|
| 183 |
+
3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, # 2160
|
| 184 |
+
2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, # 2176
|
| 185 |
+
3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, # 2192
|
| 186 |
+
2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, # 2208
|
| 187 |
+
4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, # 2224
|
| 188 |
+
4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, # 2240
|
| 189 |
+
3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, # 2256
|
| 190 |
+
97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, # 2272
|
| 191 |
+
3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, # 2288
|
| 192 |
+
424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, # 2304
|
| 193 |
+
3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, # 2320
|
| 194 |
+
4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, # 2336
|
| 195 |
+
3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, # 2352
|
| 196 |
+
1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, # 2368
|
| 197 |
+
5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, # 2384
|
| 198 |
+
199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, # 2400
|
| 199 |
+
5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, # 2416
|
| 200 |
+
1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, # 2432
|
| 201 |
+
391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, # 2448
|
| 202 |
+
4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, # 2464
|
| 203 |
+
4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, # 2480
|
| 204 |
+
397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, # 2496
|
| 205 |
+
2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, # 2512
|
| 206 |
+
2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, # 2528
|
| 207 |
+
3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, # 2544
|
| 208 |
+
1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, # 2560
|
| 209 |
+
4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, # 2576
|
| 210 |
+
2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, # 2592
|
| 211 |
+
1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, # 2608
|
| 212 |
+
1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, # 2624
|
| 213 |
+
2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, # 2640
|
| 214 |
+
3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, # 2656
|
| 215 |
+
1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, # 2672
|
| 216 |
+
5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, # 2688
|
| 217 |
+
1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, # 2704
|
| 218 |
+
4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, # 2720
|
| 219 |
+
1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, # 2736
|
| 220 |
+
135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, # 2752
|
| 221 |
+
1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, # 2768
|
| 222 |
+
4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, # 2784
|
| 223 |
+
4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, # 2800
|
| 224 |
+
2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, # 2816
|
| 225 |
+
1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, # 2832
|
| 226 |
+
4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, # 2848
|
| 227 |
+
660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, # 2864
|
| 228 |
+
5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, # 2880
|
| 229 |
+
2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, # 2896
|
| 230 |
+
3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, # 2912
|
| 231 |
+
4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, # 2928
|
| 232 |
+
790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, # 2944
|
| 233 |
+
5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, # 2960
|
| 234 |
+
5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, # 2976
|
| 235 |
+
1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, # 2992
|
| 236 |
+
4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, # 3008
|
| 237 |
+
4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, # 3024
|
| 238 |
+
2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, # 3040
|
| 239 |
+
3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, # 3056
|
| 240 |
+
3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, # 3072
|
| 241 |
+
2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, # 3088
|
| 242 |
+
1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, # 3104
|
| 243 |
+
4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, # 3120
|
| 244 |
+
3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, # 3136
|
| 245 |
+
3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, # 3152
|
| 246 |
+
2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, # 3168
|
| 247 |
+
4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, # 3184
|
| 248 |
+
5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, # 3200
|
| 249 |
+
3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, # 3216
|
| 250 |
+
2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, # 3232
|
| 251 |
+
3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, # 3248
|
| 252 |
+
1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, # 3264
|
| 253 |
+
2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, # 3280
|
| 254 |
+
3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, # 3296
|
| 255 |
+
4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, # 3312
|
| 256 |
+
2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, # 3328
|
| 257 |
+
2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, # 3344
|
| 258 |
+
5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, # 3360
|
| 259 |
+
1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, # 3376
|
| 260 |
+
2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, # 3392
|
| 261 |
+
1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, # 3408
|
| 262 |
+
3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, # 3424
|
| 263 |
+
4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, # 3440
|
| 264 |
+
2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, # 3456
|
| 265 |
+
3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, # 3472
|
| 266 |
+
3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, # 3488
|
| 267 |
+
2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, # 3504
|
| 268 |
+
4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, # 3520
|
| 269 |
+
2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, # 3536
|
| 270 |
+
3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, # 3552
|
| 271 |
+
4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, # 3568
|
| 272 |
+
5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, # 3584
|
| 273 |
+
3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, # 3600
|
| 274 |
+
194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, # 3616
|
| 275 |
+
1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, # 3632
|
| 276 |
+
4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, # 3648
|
| 277 |
+
1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, # 3664
|
| 278 |
+
4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, # 3680
|
| 279 |
+
5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, # 3696
|
| 280 |
+
510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, # 3712
|
| 281 |
+
5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, # 3728
|
| 282 |
+
5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, # 3744
|
| 283 |
+
2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, # 3760
|
| 284 |
+
3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, # 3776
|
| 285 |
+
2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, # 3792
|
| 286 |
+
2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, # 3808
|
| 287 |
+
681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, # 3824
|
| 288 |
+
1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, # 3840
|
| 289 |
+
4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, # 3856
|
| 290 |
+
3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, # 3872
|
| 291 |
+
3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, # 3888
|
| 292 |
+
838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, # 3904
|
| 293 |
+
2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, # 3920
|
| 294 |
+
625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, # 3936
|
| 295 |
+
2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, # 3952
|
| 296 |
+
4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, # 3968
|
| 297 |
+
1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, # 3984
|
| 298 |
+
4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, # 4000
|
| 299 |
+
1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, # 4016
|
| 300 |
+
3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, # 4032
|
| 301 |
+
574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, # 4048
|
| 302 |
+
3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, # 4064
|
| 303 |
+
5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, # 4080
|
| 304 |
+
5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, # 4096
|
| 305 |
+
3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, # 4112
|
| 306 |
+
3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, # 4128
|
| 307 |
+
1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, # 4144
|
| 308 |
+
2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, # 4160
|
| 309 |
+
5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, # 4176
|
| 310 |
+
1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, # 4192
|
| 311 |
+
1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, # 4208
|
| 312 |
+
3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, # 4224
|
| 313 |
+
919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, # 4240
|
| 314 |
+
1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, # 4256
|
| 315 |
+
4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, # 4272
|
| 316 |
+
5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, # 4288
|
| 317 |
+
2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, # 4304
|
| 318 |
+
3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, # 4320
|
| 319 |
+
516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, # 4336
|
| 320 |
+
1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, # 4352
|
| 321 |
+
2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, # 4368
|
| 322 |
+
2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, # 4384
|
| 323 |
+
5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, # 4400
|
| 324 |
+
5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, # 4416
|
| 325 |
+
5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, # 4432
|
| 326 |
+
2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, # 4448
|
| 327 |
+
2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, # 4464
|
| 328 |
+
1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, # 4480
|
| 329 |
+
4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, # 4496
|
| 330 |
+
3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, # 4512
|
| 331 |
+
3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, # 4528
|
| 332 |
+
4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, # 4544
|
| 333 |
+
4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, # 4560
|
| 334 |
+
2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, # 4576
|
| 335 |
+
2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, # 4592
|
| 336 |
+
5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, # 4608
|
| 337 |
+
4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, # 4624
|
| 338 |
+
5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, # 4640
|
| 339 |
+
4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, # 4656
|
| 340 |
+
502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, # 4672
|
| 341 |
+
121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, # 4688
|
| 342 |
+
1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, # 4704
|
| 343 |
+
3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, # 4720
|
| 344 |
+
4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, # 4736
|
| 345 |
+
1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, # 4752
|
| 346 |
+
5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, # 4768
|
| 347 |
+
2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, # 4784
|
| 348 |
+
2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, # 4800
|
| 349 |
+
3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, # 4816
|
| 350 |
+
5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, # 4832
|
| 351 |
+
1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, # 4848
|
| 352 |
+
3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, # 4864
|
| 353 |
+
5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, # 4880
|
| 354 |
+
1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, # 4896
|
| 355 |
+
5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, # 4912
|
| 356 |
+
2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, # 4928
|
| 357 |
+
3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, # 4944
|
| 358 |
+
2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, # 4960
|
| 359 |
+
3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, # 4976
|
| 360 |
+
3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, # 4992
|
| 361 |
+
3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, # 5008
|
| 362 |
+
4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, # 5024
|
| 363 |
+
803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, # 5040
|
| 364 |
+
2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, # 5056
|
| 365 |
+
4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, # 5072
|
| 366 |
+
3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, # 5088
|
| 367 |
+
5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, # 5104
|
| 368 |
+
1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, # 5120
|
| 369 |
+
5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, # 5136
|
| 370 |
+
425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, # 5152
|
| 371 |
+
1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, # 5168
|
| 372 |
+
479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, # 5184
|
| 373 |
+
4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, # 5200
|
| 374 |
+
1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, # 5216
|
| 375 |
+
4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, # 5232
|
| 376 |
+
1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, # 5248
|
| 377 |
+
433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, # 5264
|
| 378 |
+
3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, # 5280
|
| 379 |
+
4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, # 5296
|
| 380 |
+
5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, # 5312
|
| 381 |
+
938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, # 5328
|
| 382 |
+
3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, # 5344
|
| 383 |
+
890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360
|
| 384 |
+
2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376
|
| 385 |
+
)
|
| 386 |
+
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/big5prober.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is Mozilla Communicator client code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
#
|
| 12 |
+
# This library is free software; you can redistribute it and/or
|
| 13 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 14 |
+
# License as published by the Free Software Foundation; either
|
| 15 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 16 |
+
#
|
| 17 |
+
# This library is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 20 |
+
# Lesser General Public License for more details.
|
| 21 |
+
#
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 23 |
+
# License along with this library; if not, write to the Free Software
|
| 24 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 25 |
+
# 02110-1301 USA
|
| 26 |
+
######################### END LICENSE BLOCK #########################
|
| 27 |
+
|
| 28 |
+
from .mbcharsetprober import MultiByteCharSetProber
|
| 29 |
+
from .codingstatemachine import CodingStateMachine
|
| 30 |
+
from .chardistribution import Big5DistributionAnalysis
|
| 31 |
+
from .mbcssm import BIG5_SM_MODEL
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class Big5Prober(MultiByteCharSetProber):
|
| 35 |
+
def __init__(self):
|
| 36 |
+
super(Big5Prober, self).__init__()
|
| 37 |
+
self.coding_sm = CodingStateMachine(BIG5_SM_MODEL)
|
| 38 |
+
self.distribution_analyzer = Big5DistributionAnalysis()
|
| 39 |
+
self.reset()
|
| 40 |
+
|
| 41 |
+
@property
|
| 42 |
+
def charset_name(self):
|
| 43 |
+
return "Big5"
|
| 44 |
+
|
| 45 |
+
@property
|
| 46 |
+
def language(self):
|
| 47 |
+
return "Chinese"
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/codingstatemachine.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is mozilla.org code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
#
|
| 12 |
+
# This library is free software; you can redistribute it and/or
|
| 13 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 14 |
+
# License as published by the Free Software Foundation; either
|
| 15 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 16 |
+
#
|
| 17 |
+
# This library is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 20 |
+
# Lesser General Public License for more details.
|
| 21 |
+
#
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 23 |
+
# License along with this library; if not, write to the Free Software
|
| 24 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 25 |
+
# 02110-1301 USA
|
| 26 |
+
######################### END LICENSE BLOCK #########################
|
| 27 |
+
|
| 28 |
+
import logging
|
| 29 |
+
|
| 30 |
+
from .enums import MachineState
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class CodingStateMachine(object):
|
| 34 |
+
"""
|
| 35 |
+
A state machine to verify a byte sequence for a particular encoding. For
|
| 36 |
+
each byte the detector receives, it will feed that byte to every active
|
| 37 |
+
state machine available, one byte at a time. The state machine changes its
|
| 38 |
+
state based on its previous state and the byte it receives. There are 3
|
| 39 |
+
states in a state machine that are of interest to an auto-detector:
|
| 40 |
+
|
| 41 |
+
START state: This is the state to start with, or a legal byte sequence
|
| 42 |
+
(i.e. a valid code point) for character has been identified.
|
| 43 |
+
|
| 44 |
+
ME state: This indicates that the state machine identified a byte sequence
|
| 45 |
+
that is specific to the charset it is designed for and that
|
| 46 |
+
there is no other possible encoding which can contain this byte
|
| 47 |
+
sequence. This will to lead to an immediate positive answer for
|
| 48 |
+
the detector.
|
| 49 |
+
|
| 50 |
+
ERROR state: This indicates the state machine identified an illegal byte
|
| 51 |
+
sequence for that encoding. This will lead to an immediate
|
| 52 |
+
negative answer for this encoding. Detector will exclude this
|
| 53 |
+
encoding from consideration from here on.
|
| 54 |
+
"""
|
| 55 |
+
def __init__(self, sm):
|
| 56 |
+
self._model = sm
|
| 57 |
+
self._curr_byte_pos = 0
|
| 58 |
+
self._curr_char_len = 0
|
| 59 |
+
self._curr_state = None
|
| 60 |
+
self.logger = logging.getLogger(__name__)
|
| 61 |
+
self.reset()
|
| 62 |
+
|
| 63 |
+
def reset(self):
|
| 64 |
+
self._curr_state = MachineState.START
|
| 65 |
+
|
| 66 |
+
def next_state(self, c):
|
| 67 |
+
# for each byte we get its class
|
| 68 |
+
# if it is first byte, we also get byte length
|
| 69 |
+
byte_class = self._model['class_table'][c]
|
| 70 |
+
if self._curr_state == MachineState.START:
|
| 71 |
+
self._curr_byte_pos = 0
|
| 72 |
+
self._curr_char_len = self._model['char_len_table'][byte_class]
|
| 73 |
+
# from byte's class and state_table, we get its next state
|
| 74 |
+
curr_state = (self._curr_state * self._model['class_factor']
|
| 75 |
+
+ byte_class)
|
| 76 |
+
self._curr_state = self._model['state_table'][curr_state]
|
| 77 |
+
self._curr_byte_pos += 1
|
| 78 |
+
return self._curr_state
|
| 79 |
+
|
| 80 |
+
def get_current_charlen(self):
|
| 81 |
+
return self._curr_char_len
|
| 82 |
+
|
| 83 |
+
def get_coding_state_machine(self):
|
| 84 |
+
return self._model['name']
|
| 85 |
+
|
| 86 |
+
@property
|
| 87 |
+
def language(self):
|
| 88 |
+
return self._model['language']
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/compat.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# Contributor(s):
|
| 3 |
+
# Dan Blanchard
|
| 4 |
+
# Ian Cordasco
|
| 5 |
+
#
|
| 6 |
+
# This library is free software; you can redistribute it and/or
|
| 7 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 8 |
+
# License as published by the Free Software Foundation; either
|
| 9 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 10 |
+
#
|
| 11 |
+
# This library is distributed in the hope that it will be useful,
|
| 12 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
# Lesser General Public License for more details.
|
| 15 |
+
#
|
| 16 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 17 |
+
# License along with this library; if not, write to the Free Software
|
| 18 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 19 |
+
# 02110-1301 USA
|
| 20 |
+
######################### END LICENSE BLOCK #########################
|
| 21 |
+
|
| 22 |
+
import sys
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
if sys.version_info < (3, 0):
|
| 26 |
+
PY2 = True
|
| 27 |
+
PY3 = False
|
| 28 |
+
string_types = (str, unicode)
|
| 29 |
+
text_type = unicode
|
| 30 |
+
iteritems = dict.iteritems
|
| 31 |
+
else:
|
| 32 |
+
PY2 = False
|
| 33 |
+
PY3 = True
|
| 34 |
+
string_types = (bytes, str)
|
| 35 |
+
text_type = str
|
| 36 |
+
iteritems = dict.items
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/enums.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
All of the Enums that are used throughout the chardet package.
|
| 3 |
+
|
| 4 |
+
:author: Dan Blanchard (dan.blanchard@gmail.com)
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class InputState(object):
|
| 9 |
+
"""
|
| 10 |
+
This enum represents the different states a universal detector can be in.
|
| 11 |
+
"""
|
| 12 |
+
PURE_ASCII = 0
|
| 13 |
+
ESC_ASCII = 1
|
| 14 |
+
HIGH_BYTE = 2
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class LanguageFilter(object):
|
| 18 |
+
"""
|
| 19 |
+
This enum represents the different language filters we can apply to a
|
| 20 |
+
``UniversalDetector``.
|
| 21 |
+
"""
|
| 22 |
+
CHINESE_SIMPLIFIED = 0x01
|
| 23 |
+
CHINESE_TRADITIONAL = 0x02
|
| 24 |
+
JAPANESE = 0x04
|
| 25 |
+
KOREAN = 0x08
|
| 26 |
+
NON_CJK = 0x10
|
| 27 |
+
ALL = 0x1F
|
| 28 |
+
CHINESE = CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL
|
| 29 |
+
CJK = CHINESE | JAPANESE | KOREAN
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class ProbingState(object):
|
| 33 |
+
"""
|
| 34 |
+
This enum represents the different states a prober can be in.
|
| 35 |
+
"""
|
| 36 |
+
DETECTING = 0
|
| 37 |
+
FOUND_IT = 1
|
| 38 |
+
NOT_ME = 2
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
class MachineState(object):
|
| 42 |
+
"""
|
| 43 |
+
This enum represents the different states a state machine can be in.
|
| 44 |
+
"""
|
| 45 |
+
START = 0
|
| 46 |
+
ERROR = 1
|
| 47 |
+
ITS_ME = 2
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class SequenceLikelihood(object):
|
| 51 |
+
"""
|
| 52 |
+
This enum represents the likelihood of a character following the previous one.
|
| 53 |
+
"""
|
| 54 |
+
NEGATIVE = 0
|
| 55 |
+
UNLIKELY = 1
|
| 56 |
+
LIKELY = 2
|
| 57 |
+
POSITIVE = 3
|
| 58 |
+
|
| 59 |
+
@classmethod
|
| 60 |
+
def get_num_categories(cls):
|
| 61 |
+
""":returns: The number of likelihood categories in the enum."""
|
| 62 |
+
return 4
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
class CharacterCategory(object):
|
| 66 |
+
"""
|
| 67 |
+
This enum represents the different categories language models for
|
| 68 |
+
``SingleByteCharsetProber`` put characters into.
|
| 69 |
+
|
| 70 |
+
Anything less than CONTROL is considered a letter.
|
| 71 |
+
"""
|
| 72 |
+
UNDEFINED = 255
|
| 73 |
+
LINE_BREAK = 254
|
| 74 |
+
SYMBOL = 253
|
| 75 |
+
DIGIT = 252
|
| 76 |
+
CONTROL = 251
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/euckrfreq.py
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is Mozilla Communicator client code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
#
|
| 12 |
+
# This library is free software; you can redistribute it and/or
|
| 13 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 14 |
+
# License as published by the Free Software Foundation; either
|
| 15 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 16 |
+
#
|
| 17 |
+
# This library is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 20 |
+
# Lesser General Public License for more details.
|
| 21 |
+
#
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 23 |
+
# License along with this library; if not, write to the Free Software
|
| 24 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 25 |
+
# 02110-1301 USA
|
| 26 |
+
######################### END LICENSE BLOCK #########################
|
| 27 |
+
|
| 28 |
+
# Sampling from about 20M text materials include literature and computer technology
|
| 29 |
+
|
| 30 |
+
# 128 --> 0.79
|
| 31 |
+
# 256 --> 0.92
|
| 32 |
+
# 512 --> 0.986
|
| 33 |
+
# 1024 --> 0.99944
|
| 34 |
+
# 2048 --> 0.99999
|
| 35 |
+
#
|
| 36 |
+
# Idea Distribution Ratio = 0.98653 / (1-0.98653) = 73.24
|
| 37 |
+
# Random Distribution Ration = 512 / (2350-512) = 0.279.
|
| 38 |
+
#
|
| 39 |
+
# Typical Distribution Ratio
|
| 40 |
+
|
| 41 |
+
EUCKR_TYPICAL_DISTRIBUTION_RATIO = 6.0
|
| 42 |
+
|
| 43 |
+
EUCKR_TABLE_SIZE = 2352
|
| 44 |
+
|
| 45 |
+
# Char to FreqOrder table ,
|
| 46 |
+
EUCKR_CHAR_TO_FREQ_ORDER = (
|
| 47 |
+
13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87,
|
| 48 |
+
1397,1723, 104, 536,1117,1203,1724,1267, 685,1268, 508,1725,1726,1727,1728,1398,
|
| 49 |
+
1399,1729,1730,1731, 141, 621, 326,1057, 368,1732, 267, 488, 20,1733,1269,1734,
|
| 50 |
+
945,1400,1735, 47, 904,1270,1736,1737, 773, 248,1738, 409, 313, 786, 429,1739,
|
| 51 |
+
116, 987, 813,1401, 683, 75,1204, 145,1740,1741,1742,1743, 16, 847, 667, 622,
|
| 52 |
+
708,1744,1745,1746, 966, 787, 304, 129,1747, 60, 820, 123, 676,1748,1749,1750,
|
| 53 |
+
1751, 617,1752, 626,1753,1754,1755,1756, 653,1757,1758,1759,1760,1761,1762, 856,
|
| 54 |
+
344,1763,1764,1765,1766, 89, 401, 418, 806, 905, 848,1767,1768,1769, 946,1205,
|
| 55 |
+
709,1770,1118,1771, 241,1772,1773,1774,1271,1775, 569,1776, 999,1777,1778,1779,
|
| 56 |
+
1780, 337, 751,1058, 28, 628, 254,1781, 177, 906, 270, 349, 891,1079,1782, 19,
|
| 57 |
+
1783, 379,1784, 315,1785, 629, 754,1402, 559,1786, 636, 203,1206,1787, 710, 567,
|
| 58 |
+
1788, 935, 814,1789,1790,1207, 766, 528,1791,1792,1208,1793,1794,1795,1796,1797,
|
| 59 |
+
1403,1798,1799, 533,1059,1404,1405,1156,1406, 936, 884,1080,1800, 351,1801,1802,
|
| 60 |
+
1803,1804,1805, 801,1806,1807,1808,1119,1809,1157, 714, 474,1407,1810, 298, 899,
|
| 61 |
+
885,1811,1120, 802,1158,1812, 892,1813,1814,1408, 659,1815,1816,1121,1817,1818,
|
| 62 |
+
1819,1820,1821,1822, 319,1823, 594, 545,1824, 815, 937,1209,1825,1826, 573,1409,
|
| 63 |
+
1022,1827,1210,1828,1829,1830,1831,1832,1833, 556, 722, 807,1122,1060,1834, 697,
|
| 64 |
+
1835, 900, 557, 715,1836,1410, 540,1411, 752,1159, 294, 597,1211, 976, 803, 770,
|
| 65 |
+
1412,1837,1838, 39, 794,1413, 358,1839, 371, 925,1840, 453, 661, 788, 531, 723,
|
| 66 |
+
544,1023,1081, 869, 91,1841, 392, 430, 790, 602,1414, 677,1082, 457,1415,1416,
|
| 67 |
+
1842,1843, 475, 327,1024,1417, 795, 121,1844, 733, 403,1418,1845,1846,1847, 300,
|
| 68 |
+
119, 711,1212, 627,1848,1272, 207,1849,1850, 796,1213, 382,1851, 519,1852,1083,
|
| 69 |
+
893,1853,1854,1855, 367, 809, 487, 671,1856, 663,1857,1858, 956, 471, 306, 857,
|
| 70 |
+
1859,1860,1160,1084,1861,1862,1863,1864,1865,1061,1866,1867,1868,1869,1870,1871,
|
| 71 |
+
282, 96, 574,1872, 502,1085,1873,1214,1874, 907,1875,1876, 827, 977,1419,1420,
|
| 72 |
+
1421, 268,1877,1422,1878,1879,1880, 308,1881, 2, 537,1882,1883,1215,1884,1885,
|
| 73 |
+
127, 791,1886,1273,1423,1887, 34, 336, 404, 643,1888, 571, 654, 894, 840,1889,
|
| 74 |
+
0, 886,1274, 122, 575, 260, 908, 938,1890,1275, 410, 316,1891,1892, 100,1893,
|
| 75 |
+
1894,1123, 48,1161,1124,1025,1895, 633, 901,1276,1896,1897, 115, 816,1898, 317,
|
| 76 |
+
1899, 694,1900, 909, 734,1424, 572, 866,1425, 691, 85, 524,1010, 543, 394, 841,
|
| 77 |
+
1901,1902,1903,1026,1904,1905,1906,1907,1908,1909, 30, 451, 651, 988, 310,1910,
|
| 78 |
+
1911,1426, 810,1216, 93,1912,1913,1277,1217,1914, 858, 759, 45, 58, 181, 610,
|
| 79 |
+
269,1915,1916, 131,1062, 551, 443,1000, 821,1427, 957, 895,1086,1917,1918, 375,
|
| 80 |
+
1919, 359,1920, 687,1921, 822,1922, 293,1923,1924, 40, 662, 118, 692, 29, 939,
|
| 81 |
+
887, 640, 482, 174,1925, 69,1162, 728,1428, 910,1926,1278,1218,1279, 386, 870,
|
| 82 |
+
217, 854,1163, 823,1927,1928,1929,1930, 834,1931, 78,1932, 859,1933,1063,1934,
|
| 83 |
+
1935,1936,1937, 438,1164, 208, 595,1938,1939,1940,1941,1219,1125,1942, 280, 888,
|
| 84 |
+
1429,1430,1220,1431,1943,1944,1945,1946,1947,1280, 150, 510,1432,1948,1949,1950,
|
| 85 |
+
1951,1952,1953,1954,1011,1087,1955,1433,1043,1956, 881,1957, 614, 958,1064,1065,
|
| 86 |
+
1221,1958, 638,1001, 860, 967, 896,1434, 989, 492, 553,1281,1165,1959,1282,1002,
|
| 87 |
+
1283,1222,1960,1961,1962,1963, 36, 383, 228, 753, 247, 454,1964, 876, 678,1965,
|
| 88 |
+
1966,1284, 126, 464, 490, 835, 136, 672, 529, 940,1088,1435, 473,1967,1968, 467,
|
| 89 |
+
50, 390, 227, 587, 279, 378, 598, 792, 968, 240, 151, 160, 849, 882,1126,1285,
|
| 90 |
+
639,1044, 133, 140, 288, 360, 811, 563,1027, 561, 142, 523,1969,1970,1971, 7,
|
| 91 |
+
103, 296, 439, 407, 506, 634, 990,1972,1973,1974,1975, 645,1976,1977,1978,1979,
|
| 92 |
+
1980,1981, 236,1982,1436,1983,1984,1089, 192, 828, 618, 518,1166, 333,1127,1985,
|
| 93 |
+
818,1223,1986,1987,1988,1989,1990,1991,1992,1993, 342,1128,1286, 746, 842,1994,
|
| 94 |
+
1995, 560, 223,1287, 98, 8, 189, 650, 978,1288,1996,1437,1997, 17, 345, 250,
|
| 95 |
+
423, 277, 234, 512, 226, 97, 289, 42, 167,1998, 201,1999,2000, 843, 836, 824,
|
| 96 |
+
532, 338, 783,1090, 182, 576, 436,1438,1439, 527, 500,2001, 947, 889,2002,2003,
|
| 97 |
+
2004,2005, 262, 600, 314, 447,2006, 547,2007, 693, 738,1129,2008, 71,1440, 745,
|
| 98 |
+
619, 688,2009, 829,2010,2011, 147,2012, 33, 948,2013,2014, 74, 224,2015, 61,
|
| 99 |
+
191, 918, 399, 637,2016,1028,1130, 257, 902,2017,2018,2019,2020,2021,2022,2023,
|
| 100 |
+
2024,2025,2026, 837,2027,2028,2029,2030, 179, 874, 591, 52, 724, 246,2031,2032,
|
| 101 |
+
2033,2034,1167, 969,2035,1289, 630, 605, 911,1091,1168,2036,2037,2038,1441, 912,
|
| 102 |
+
2039, 623,2040,2041, 253,1169,1290,2042,1442, 146, 620, 611, 577, 433,2043,1224,
|
| 103 |
+
719,1170, 959, 440, 437, 534, 84, 388, 480,1131, 159, 220, 198, 679,2044,1012,
|
| 104 |
+
819,1066,1443, 113,1225, 194, 318,1003,1029,2045,2046,2047,2048,1067,2049,2050,
|
| 105 |
+
2051,2052,2053, 59, 913, 112,2054, 632,2055, 455, 144, 739,1291,2056, 273, 681,
|
| 106 |
+
499,2057, 448,2058,2059, 760,2060,2061, 970, 384, 169, 245,1132,2062,2063, 414,
|
| 107 |
+
1444,2064,2065, 41, 235,2066, 157, 252, 877, 568, 919, 789, 580,2067, 725,2068,
|
| 108 |
+
2069,1292,2070,2071,1445,2072,1446,2073,2074, 55, 588, 66,1447, 271,1092,2075,
|
| 109 |
+
1226,2076, 960,1013, 372,2077,2078,2079,2080,2081,1293,2082,2083,2084,2085, 850,
|
| 110 |
+
2086,2087,2088,2089,2090, 186,2091,1068, 180,2092,2093,2094, 109,1227, 522, 606,
|
| 111 |
+
2095, 867,1448,1093, 991,1171, 926, 353,1133,2096, 581,2097,2098,2099,1294,1449,
|
| 112 |
+
1450,2100, 596,1172,1014,1228,2101,1451,1295,1173,1229,2102,2103,1296,1134,1452,
|
| 113 |
+
949,1135,2104,2105,1094,1453,1454,1455,2106,1095,2107,2108,2109,2110,2111,2112,
|
| 114 |
+
2113,2114,2115,2116,2117, 804,2118,2119,1230,1231, 805,1456, 405,1136,2120,2121,
|
| 115 |
+
2122,2123,2124, 720, 701,1297, 992,1457, 927,1004,2125,2126,2127,2128,2129,2130,
|
| 116 |
+
22, 417,2131, 303,2132, 385,2133, 971, 520, 513,2134,1174, 73,1096, 231, 274,
|
| 117 |
+
962,1458, 673,2135,1459,2136, 152,1137,2137,2138,2139,2140,1005,1138,1460,1139,
|
| 118 |
+
2141,2142,2143,2144, 11, 374, 844,2145, 154,1232, 46,1461,2146, 838, 830, 721,
|
| 119 |
+
1233, 106,2147, 90, 428, 462, 578, 566,1175, 352,2148,2149, 538,1234, 124,1298,
|
| 120 |
+
2150,1462, 761, 565,2151, 686,2152, 649,2153, 72, 173,2154, 460, 415,2155,1463,
|
| 121 |
+
2156,1235, 305,2157,2158,2159,2160,2161,2162, 579,2163,2164,2165,2166,2167, 747,
|
| 122 |
+
2168,2169,2170,2171,1464, 669,2172,2173,2174,2175,2176,1465,2177, 23, 530, 285,
|
| 123 |
+
2178, 335, 729,2179, 397,2180,2181,2182,1030,2183,2184, 698,2185,2186, 325,2187,
|
| 124 |
+
2188, 369,2189, 799,1097,1015, 348,2190,1069, 680,2191, 851,1466,2192,2193, 10,
|
| 125 |
+
2194, 613, 424,2195, 979, 108, 449, 589, 27, 172, 81,1031, 80, 774, 281, 350,
|
| 126 |
+
1032, 525, 301, 582,1176,2196, 674,1045,2197,2198,1467, 730, 762,2199,2200,2201,
|
| 127 |
+
2202,1468,2203, 993,2204,2205, 266,1070, 963,1140,2206,2207,2208, 664,1098, 972,
|
| 128 |
+
2209,2210,2211,1177,1469,1470, 871,2212,2213,2214,2215,2216,1471,2217,2218,2219,
|
| 129 |
+
2220,2221,2222,2223,2224,2225,2226,2227,1472,1236,2228,2229,2230,2231,2232,2233,
|
| 130 |
+
2234,2235,1299,2236,2237, 200,2238, 477, 373,2239,2240, 731, 825, 777,2241,2242,
|
| 131 |
+
2243, 521, 486, 548,2244,2245,2246,1473,1300, 53, 549, 137, 875, 76, 158,2247,
|
| 132 |
+
1301,1474, 469, 396,1016, 278, 712,2248, 321, 442, 503, 767, 744, 941,1237,1178,
|
| 133 |
+
1475,2249, 82, 178,1141,1179, 973,2250,1302,2251, 297,2252,2253, 570,2254,2255,
|
| 134 |
+
2256, 18, 450, 206,2257, 290, 292,1142,2258, 511, 162, 99, 346, 164, 735,2259,
|
| 135 |
+
1476,1477, 4, 554, 343, 798,1099,2260,1100,2261, 43, 171,1303, 139, 215,2262,
|
| 136 |
+
2263, 717, 775,2264,1033, 322, 216,2265, 831,2266, 149,2267,1304,2268,2269, 702,
|
| 137 |
+
1238, 135, 845, 347, 309,2270, 484,2271, 878, 655, 238,1006,1478,2272, 67,2273,
|
| 138 |
+
295,2274,2275, 461,2276, 478, 942, 412,2277,1034,2278,2279,2280, 265,2281, 541,
|
| 139 |
+
2282,2283,2284,2285,2286, 70, 852,1071,2287,2288,2289,2290, 21, 56, 509, 117,
|
| 140 |
+
432,2291,2292, 331, 980, 552,1101, 148, 284, 105, 393,1180,1239, 755,2293, 187,
|
| 141 |
+
2294,1046,1479,2295, 340,2296, 63,1047, 230,2297,2298,1305, 763,1306, 101, 800,
|
| 142 |
+
808, 494,2299,2300,2301, 903,2302, 37,1072, 14, 5,2303, 79, 675,2304, 312,
|
| 143 |
+
2305,2306,2307,2308,2309,1480, 6,1307,2310,2311,2312, 1, 470, 35, 24, 229,
|
| 144 |
+
2313, 695, 210, 86, 778, 15, 784, 592, 779, 32, 77, 855, 964,2314, 259,2315,
|
| 145 |
+
501, 380,2316,2317, 83, 981, 153, 689,1308,1481,1482,1483,2318,2319, 716,1484,
|
| 146 |
+
2320,2321,2322,2323,2324,2325,1485,2326,2327, 128, 57, 68, 261,1048, 211, 170,
|
| 147 |
+
1240, 31,2328, 51, 435, 742,2329,2330,2331, 635,2332, 264, 456,2333,2334,2335,
|
| 148 |
+
425,2336,1486, 143, 507, 263, 943,2337, 363, 920,1487, 256,1488,1102, 243, 601,
|
| 149 |
+
1489,2338,2339,2340,2341,2342,2343,2344, 861,2345,2346,2347,2348,2349,2350, 395,
|
| 150 |
+
2351,1490,1491, 62, 535, 166, 225,2352,2353, 668, 419,1241, 138, 604, 928,2354,
|
| 151 |
+
1181,2355,1492,1493,2356,2357,2358,1143,2359, 696,2360, 387, 307,1309, 682, 476,
|
| 152 |
+
2361,2362, 332, 12, 222, 156,2363, 232,2364, 641, 276, 656, 517,1494,1495,1035,
|
| 153 |
+
416, 736,1496,2365,1017, 586,2366,2367,2368,1497,2369, 242,2370,2371,2372,1498,
|
| 154 |
+
2373, 965, 713,2374,2375,2376,2377, 740, 982,1499, 944,1500,1007,2378,2379,1310,
|
| 155 |
+
1501,2380,2381,2382, 785, 329,2383,2384,1502,2385,2386,2387, 932,2388,1503,2389,
|
| 156 |
+
2390,2391,2392,1242,2393,2394,2395,2396,2397, 994, 950,2398,2399,2400,2401,1504,
|
| 157 |
+
1311,2402,2403,2404,2405,1049, 749,2406,2407, 853, 718,1144,1312,2408,1182,1505,
|
| 158 |
+
2409,2410, 255, 516, 479, 564, 550, 214,1506,1507,1313, 413, 239, 444, 339,1145,
|
| 159 |
+
1036,1508,1509,1314,1037,1510,1315,2411,1511,2412,2413,2414, 176, 703, 497, 624,
|
| 160 |
+
593, 921, 302,2415, 341, 165,1103,1512,2416,1513,2417,2418,2419, 376,2420, 700,
|
| 161 |
+
2421,2422,2423, 258, 768,1316,2424,1183,2425, 995, 608,2426,2427,2428,2429, 221,
|
| 162 |
+
2430,2431,2432,2433,2434,2435,2436,2437, 195, 323, 726, 188, 897, 983,1317, 377,
|
| 163 |
+
644,1050, 879,2438, 452,2439,2440,2441,2442,2443,2444, 914,2445,2446,2447,2448,
|
| 164 |
+
915, 489,2449,1514,1184,2450,2451, 515, 64, 427, 495,2452, 583,2453, 483, 485,
|
| 165 |
+
1038, 562, 213,1515, 748, 666,2454,2455,2456,2457, 334,2458, 780, 996,1008, 705,
|
| 166 |
+
1243,2459,2460,2461,2462,2463, 114,2464, 493,1146, 366, 163,1516, 961,1104,2465,
|
| 167 |
+
291,2466,1318,1105,2467,1517, 365,2468, 355, 951,1244,2469,1319,2470, 631,2471,
|
| 168 |
+
2472, 218,1320, 364, 320, 756,1518,1519,1321,1520,1322,2473,2474,2475,2476, 997,
|
| 169 |
+
2477,2478,2479,2480, 665,1185,2481, 916,1521,2482,2483,2484, 584, 684,2485,2486,
|
| 170 |
+
797,2487,1051,1186,2488,2489,2490,1522,2491,2492, 370,2493,1039,1187, 65,2494,
|
| 171 |
+
434, 205, 463,1188,2495, 125, 812, 391, 402, 826, 699, 286, 398, 155, 781, 771,
|
| 172 |
+
585,2496, 590, 505,1073,2497, 599, 244, 219, 917,1018, 952, 646,1523,2498,1323,
|
| 173 |
+
2499,2500, 49, 984, 354, 741,2501, 625,2502,1324,2503,1019, 190, 357, 757, 491,
|
| 174 |
+
95, 782, 868,2504,2505,2506,2507,2508,2509, 134,1524,1074, 422,1525, 898,2510,
|
| 175 |
+
161,2511,2512,2513,2514, 769,2515,1526,2516,2517, 411,1325,2518, 472,1527,2519,
|
| 176 |
+
2520,2521,2522,2523,2524, 985,2525,2526,2527,2528,2529,2530, 764,2531,1245,2532,
|
| 177 |
+
2533, 25, 204, 311,2534, 496,2535,1052,2536,2537,2538,2539,2540,2541,2542, 199,
|
| 178 |
+
704, 504, 468, 758, 657,1528, 196, 44, 839,1246, 272, 750,2543, 765, 862,2544,
|
| 179 |
+
2545,1326,2546, 132, 615, 933,2547, 732,2548,2549,2550,1189,1529,2551, 283,1247,
|
| 180 |
+
1053, 607, 929,2552,2553,2554, 930, 183, 872, 616,1040,1147,2555,1148,1020, 441,
|
| 181 |
+
249,1075,2556,2557,2558, 466, 743,2559,2560,2561, 92, 514, 426, 420, 526,2562,
|
| 182 |
+
2563,2564,2565,2566,2567,2568, 185,2569,2570,2571,2572, 776,1530, 658,2573, 362,
|
| 183 |
+
2574, 361, 922,1076, 793,2575,2576,2577,2578,2579,2580,1531, 251,2581,2582,2583,
|
| 184 |
+
2584,1532, 54, 612, 237,1327,2585,2586, 275, 408, 647, 111,2587,1533,1106, 465,
|
| 185 |
+
3, 458, 9, 38,2588, 107, 110, 890, 209, 26, 737, 498,2589,1534,2590, 431,
|
| 186 |
+
202, 88,1535, 356, 287,1107, 660,1149,2591, 381,1536, 986,1150, 445,1248,1151,
|
| 187 |
+
974,2592,2593, 846,2594, 446, 953, 184,1249,1250, 727,2595, 923, 193, 883,2596,
|
| 188 |
+
2597,2598, 102, 324, 539, 817,2599, 421,1041,2600, 832,2601, 94, 175, 197, 406,
|
| 189 |
+
2602, 459,2603,2604,2605,2606,2607, 330, 555,2608,2609,2610, 706,1108, 389,2611,
|
| 190 |
+
2612,2613,2614, 233,2615, 833, 558, 931, 954,1251,2616,2617,1537, 546,2618,2619,
|
| 191 |
+
1009,2620,2621,2622,1538, 690,1328,2623, 955,2624,1539,2625,2626, 772,2627,2628,
|
| 192 |
+
2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042,
|
| 193 |
+
670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, # 512, 256
|
| 194 |
+
)
|
| 195 |
+
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/euckrprober.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is mozilla.org code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
#
|
| 12 |
+
# This library is free software; you can redistribute it and/or
|
| 13 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 14 |
+
# License as published by the Free Software Foundation; either
|
| 15 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 16 |
+
#
|
| 17 |
+
# This library is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 20 |
+
# Lesser General Public License for more details.
|
| 21 |
+
#
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 23 |
+
# License along with this library; if not, write to the Free Software
|
| 24 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 25 |
+
# 02110-1301 USA
|
| 26 |
+
######################### END LICENSE BLOCK #########################
|
| 27 |
+
|
| 28 |
+
from .mbcharsetprober import MultiByteCharSetProber
|
| 29 |
+
from .codingstatemachine import CodingStateMachine
|
| 30 |
+
from .chardistribution import EUCKRDistributionAnalysis
|
| 31 |
+
from .mbcssm import EUCKR_SM_MODEL
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class EUCKRProber(MultiByteCharSetProber):
|
| 35 |
+
def __init__(self):
|
| 36 |
+
super(EUCKRProber, self).__init__()
|
| 37 |
+
self.coding_sm = CodingStateMachine(EUCKR_SM_MODEL)
|
| 38 |
+
self.distribution_analyzer = EUCKRDistributionAnalysis()
|
| 39 |
+
self.reset()
|
| 40 |
+
|
| 41 |
+
@property
|
| 42 |
+
def charset_name(self):
|
| 43 |
+
return "EUC-KR"
|
| 44 |
+
|
| 45 |
+
@property
|
| 46 |
+
def language(self):
|
| 47 |
+
return "Korean"
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/euctwprober.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is mozilla.org code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
#
|
| 12 |
+
# This library is free software; you can redistribute it and/or
|
| 13 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 14 |
+
# License as published by the Free Software Foundation; either
|
| 15 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 16 |
+
#
|
| 17 |
+
# This library is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 20 |
+
# Lesser General Public License for more details.
|
| 21 |
+
#
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 23 |
+
# License along with this library; if not, write to the Free Software
|
| 24 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 25 |
+
# 02110-1301 USA
|
| 26 |
+
######################### END LICENSE BLOCK #########################
|
| 27 |
+
|
| 28 |
+
from .mbcharsetprober import MultiByteCharSetProber
|
| 29 |
+
from .codingstatemachine import CodingStateMachine
|
| 30 |
+
from .chardistribution import EUCTWDistributionAnalysis
|
| 31 |
+
from .mbcssm import EUCTW_SM_MODEL
|
| 32 |
+
|
| 33 |
+
class EUCTWProber(MultiByteCharSetProber):
|
| 34 |
+
def __init__(self):
|
| 35 |
+
super(EUCTWProber, self).__init__()
|
| 36 |
+
self.coding_sm = CodingStateMachine(EUCTW_SM_MODEL)
|
| 37 |
+
self.distribution_analyzer = EUCTWDistributionAnalysis()
|
| 38 |
+
self.reset()
|
| 39 |
+
|
| 40 |
+
@property
|
| 41 |
+
def charset_name(self):
|
| 42 |
+
return "EUC-TW"
|
| 43 |
+
|
| 44 |
+
@property
|
| 45 |
+
def language(self):
|
| 46 |
+
return "Taiwan"
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/langbulgarianmodel.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/langthaimodel.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/langturkishmodel.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/latin1prober.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is Mozilla Universal charset detector code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 2001
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
# Shy Shalom - original C code
|
| 12 |
+
#
|
| 13 |
+
# This library is free software; you can redistribute it and/or
|
| 14 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 15 |
+
# License as published by the Free Software Foundation; either
|
| 16 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 17 |
+
#
|
| 18 |
+
# This library is distributed in the hope that it will be useful,
|
| 19 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 20 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 21 |
+
# Lesser General Public License for more details.
|
| 22 |
+
#
|
| 23 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 24 |
+
# License along with this library; if not, write to the Free Software
|
| 25 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 26 |
+
# 02110-1301 USA
|
| 27 |
+
######################### END LICENSE BLOCK #########################
|
| 28 |
+
|
| 29 |
+
from .charsetprober import CharSetProber
|
| 30 |
+
from .enums import ProbingState
|
| 31 |
+
|
| 32 |
+
FREQ_CAT_NUM = 4
|
| 33 |
+
|
| 34 |
+
UDF = 0 # undefined
|
| 35 |
+
OTH = 1 # other
|
| 36 |
+
ASC = 2 # ascii capital letter
|
| 37 |
+
ASS = 3 # ascii small letter
|
| 38 |
+
ACV = 4 # accent capital vowel
|
| 39 |
+
ACO = 5 # accent capital other
|
| 40 |
+
ASV = 6 # accent small vowel
|
| 41 |
+
ASO = 7 # accent small other
|
| 42 |
+
CLASS_NUM = 8 # total classes
|
| 43 |
+
|
| 44 |
+
Latin1_CharToClass = (
|
| 45 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 00 - 07
|
| 46 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 08 - 0F
|
| 47 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 10 - 17
|
| 48 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 18 - 1F
|
| 49 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 20 - 27
|
| 50 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 28 - 2F
|
| 51 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 30 - 37
|
| 52 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 38 - 3F
|
| 53 |
+
OTH, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 40 - 47
|
| 54 |
+
ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 48 - 4F
|
| 55 |
+
ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, # 50 - 57
|
| 56 |
+
ASC, ASC, ASC, OTH, OTH, OTH, OTH, OTH, # 58 - 5F
|
| 57 |
+
OTH, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 60 - 67
|
| 58 |
+
ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 68 - 6F
|
| 59 |
+
ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, # 70 - 77
|
| 60 |
+
ASS, ASS, ASS, OTH, OTH, OTH, OTH, OTH, # 78 - 7F
|
| 61 |
+
OTH, UDF, OTH, ASO, OTH, OTH, OTH, OTH, # 80 - 87
|
| 62 |
+
OTH, OTH, ACO, OTH, ACO, UDF, ACO, UDF, # 88 - 8F
|
| 63 |
+
UDF, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # 90 - 97
|
| 64 |
+
OTH, OTH, ASO, OTH, ASO, UDF, ASO, ACO, # 98 - 9F
|
| 65 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # A0 - A7
|
| 66 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # A8 - AF
|
| 67 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # B0 - B7
|
| 68 |
+
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, # B8 - BF
|
| 69 |
+
ACV, ACV, ACV, ACV, ACV, ACV, ACO, ACO, # C0 - C7
|
| 70 |
+
ACV, ACV, ACV, ACV, ACV, ACV, ACV, ACV, # C8 - CF
|
| 71 |
+
ACO, ACO, ACV, ACV, ACV, ACV, ACV, OTH, # D0 - D7
|
| 72 |
+
ACV, ACV, ACV, ACV, ACV, ACO, ACO, ACO, # D8 - DF
|
| 73 |
+
ASV, ASV, ASV, ASV, ASV, ASV, ASO, ASO, # E0 - E7
|
| 74 |
+
ASV, ASV, ASV, ASV, ASV, ASV, ASV, ASV, # E8 - EF
|
| 75 |
+
ASO, ASO, ASV, ASV, ASV, ASV, ASV, OTH, # F0 - F7
|
| 76 |
+
ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO, # F8 - FF
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
# 0 : illegal
|
| 80 |
+
# 1 : very unlikely
|
| 81 |
+
# 2 : normal
|
| 82 |
+
# 3 : very likely
|
| 83 |
+
Latin1ClassModel = (
|
| 84 |
+
# UDF OTH ASC ASS ACV ACO ASV ASO
|
| 85 |
+
0, 0, 0, 0, 0, 0, 0, 0, # UDF
|
| 86 |
+
0, 3, 3, 3, 3, 3, 3, 3, # OTH
|
| 87 |
+
0, 3, 3, 3, 3, 3, 3, 3, # ASC
|
| 88 |
+
0, 3, 3, 3, 1, 1, 3, 3, # ASS
|
| 89 |
+
0, 3, 3, 3, 1, 2, 1, 2, # ACV
|
| 90 |
+
0, 3, 3, 3, 3, 3, 3, 3, # ACO
|
| 91 |
+
0, 3, 1, 3, 1, 1, 1, 3, # ASV
|
| 92 |
+
0, 3, 1, 3, 1, 1, 3, 3, # ASO
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
class Latin1Prober(CharSetProber):
|
| 97 |
+
def __init__(self):
|
| 98 |
+
super(Latin1Prober, self).__init__()
|
| 99 |
+
self._last_char_class = None
|
| 100 |
+
self._freq_counter = None
|
| 101 |
+
self.reset()
|
| 102 |
+
|
| 103 |
+
def reset(self):
|
| 104 |
+
self._last_char_class = OTH
|
| 105 |
+
self._freq_counter = [0] * FREQ_CAT_NUM
|
| 106 |
+
CharSetProber.reset(self)
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def charset_name(self):
|
| 110 |
+
return "ISO-8859-1"
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def language(self):
|
| 114 |
+
return ""
|
| 115 |
+
|
| 116 |
+
def feed(self, byte_str):
|
| 117 |
+
byte_str = self.filter_with_english_letters(byte_str)
|
| 118 |
+
for c in byte_str:
|
| 119 |
+
char_class = Latin1_CharToClass[c]
|
| 120 |
+
freq = Latin1ClassModel[(self._last_char_class * CLASS_NUM)
|
| 121 |
+
+ char_class]
|
| 122 |
+
if freq == 0:
|
| 123 |
+
self._state = ProbingState.NOT_ME
|
| 124 |
+
break
|
| 125 |
+
self._freq_counter[freq] += 1
|
| 126 |
+
self._last_char_class = char_class
|
| 127 |
+
|
| 128 |
+
return self.state
|
| 129 |
+
|
| 130 |
+
def get_confidence(self):
|
| 131 |
+
if self.state == ProbingState.NOT_ME:
|
| 132 |
+
return 0.01
|
| 133 |
+
|
| 134 |
+
total = sum(self._freq_counter)
|
| 135 |
+
if total < 0.01:
|
| 136 |
+
confidence = 0.0
|
| 137 |
+
else:
|
| 138 |
+
confidence = ((self._freq_counter[3] - self._freq_counter[1] * 20.0)
|
| 139 |
+
/ total)
|
| 140 |
+
if confidence < 0.0:
|
| 141 |
+
confidence = 0.0
|
| 142 |
+
# lower the confidence of latin1 so that other more accurate
|
| 143 |
+
# detector can take priority.
|
| 144 |
+
confidence = confidence * 0.73
|
| 145 |
+
return confidence
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/sbcharsetprober.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is Mozilla Universal charset detector code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 2001
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
# Shy Shalom - original C code
|
| 12 |
+
#
|
| 13 |
+
# This library is free software; you can redistribute it and/or
|
| 14 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 15 |
+
# License as published by the Free Software Foundation; either
|
| 16 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 17 |
+
#
|
| 18 |
+
# This library is distributed in the hope that it will be useful,
|
| 19 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 20 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 21 |
+
# Lesser General Public License for more details.
|
| 22 |
+
#
|
| 23 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 24 |
+
# License along with this library; if not, write to the Free Software
|
| 25 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 26 |
+
# 02110-1301 USA
|
| 27 |
+
######################### END LICENSE BLOCK #########################
|
| 28 |
+
|
| 29 |
+
from collections import namedtuple
|
| 30 |
+
|
| 31 |
+
from .charsetprober import CharSetProber
|
| 32 |
+
from .enums import CharacterCategory, ProbingState, SequenceLikelihood
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
SingleByteCharSetModel = namedtuple('SingleByteCharSetModel',
|
| 36 |
+
['charset_name',
|
| 37 |
+
'language',
|
| 38 |
+
'char_to_order_map',
|
| 39 |
+
'language_model',
|
| 40 |
+
'typical_positive_ratio',
|
| 41 |
+
'keep_ascii_letters',
|
| 42 |
+
'alphabet'])
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class SingleByteCharSetProber(CharSetProber):
|
| 46 |
+
SAMPLE_SIZE = 64
|
| 47 |
+
SB_ENOUGH_REL_THRESHOLD = 1024 # 0.25 * SAMPLE_SIZE^2
|
| 48 |
+
POSITIVE_SHORTCUT_THRESHOLD = 0.95
|
| 49 |
+
NEGATIVE_SHORTCUT_THRESHOLD = 0.05
|
| 50 |
+
|
| 51 |
+
def __init__(self, model, reversed=False, name_prober=None):
|
| 52 |
+
super(SingleByteCharSetProber, self).__init__()
|
| 53 |
+
self._model = model
|
| 54 |
+
# TRUE if we need to reverse every pair in the model lookup
|
| 55 |
+
self._reversed = reversed
|
| 56 |
+
# Optional auxiliary prober for name decision
|
| 57 |
+
self._name_prober = name_prober
|
| 58 |
+
self._last_order = None
|
| 59 |
+
self._seq_counters = None
|
| 60 |
+
self._total_seqs = None
|
| 61 |
+
self._total_char = None
|
| 62 |
+
self._freq_char = None
|
| 63 |
+
self.reset()
|
| 64 |
+
|
| 65 |
+
def reset(self):
|
| 66 |
+
super(SingleByteCharSetProber, self).reset()
|
| 67 |
+
# char order of last character
|
| 68 |
+
self._last_order = 255
|
| 69 |
+
self._seq_counters = [0] * SequenceLikelihood.get_num_categories()
|
| 70 |
+
self._total_seqs = 0
|
| 71 |
+
self._total_char = 0
|
| 72 |
+
# characters that fall in our sampling range
|
| 73 |
+
self._freq_char = 0
|
| 74 |
+
|
| 75 |
+
@property
|
| 76 |
+
def charset_name(self):
|
| 77 |
+
if self._name_prober:
|
| 78 |
+
return self._name_prober.charset_name
|
| 79 |
+
else:
|
| 80 |
+
return self._model.charset_name
|
| 81 |
+
|
| 82 |
+
@property
|
| 83 |
+
def language(self):
|
| 84 |
+
if self._name_prober:
|
| 85 |
+
return self._name_prober.language
|
| 86 |
+
else:
|
| 87 |
+
return self._model.language
|
| 88 |
+
|
| 89 |
+
def feed(self, byte_str):
|
| 90 |
+
# TODO: Make filter_international_words keep things in self.alphabet
|
| 91 |
+
if not self._model.keep_ascii_letters:
|
| 92 |
+
byte_str = self.filter_international_words(byte_str)
|
| 93 |
+
if not byte_str:
|
| 94 |
+
return self.state
|
| 95 |
+
char_to_order_map = self._model.char_to_order_map
|
| 96 |
+
language_model = self._model.language_model
|
| 97 |
+
for char in byte_str:
|
| 98 |
+
order = char_to_order_map.get(char, CharacterCategory.UNDEFINED)
|
| 99 |
+
# XXX: This was SYMBOL_CAT_ORDER before, with a value of 250, but
|
| 100 |
+
# CharacterCategory.SYMBOL is actually 253, so we use CONTROL
|
| 101 |
+
# to make it closer to the original intent. The only difference
|
| 102 |
+
# is whether or not we count digits and control characters for
|
| 103 |
+
# _total_char purposes.
|
| 104 |
+
if order < CharacterCategory.CONTROL:
|
| 105 |
+
self._total_char += 1
|
| 106 |
+
# TODO: Follow uchardet's lead and discount confidence for frequent
|
| 107 |
+
# control characters.
|
| 108 |
+
# See https://github.com/BYVoid/uchardet/commit/55b4f23971db61
|
| 109 |
+
if order < self.SAMPLE_SIZE:
|
| 110 |
+
self._freq_char += 1
|
| 111 |
+
if self._last_order < self.SAMPLE_SIZE:
|
| 112 |
+
self._total_seqs += 1
|
| 113 |
+
if not self._reversed:
|
| 114 |
+
lm_cat = language_model[self._last_order][order]
|
| 115 |
+
else:
|
| 116 |
+
lm_cat = language_model[order][self._last_order]
|
| 117 |
+
self._seq_counters[lm_cat] += 1
|
| 118 |
+
self._last_order = order
|
| 119 |
+
|
| 120 |
+
charset_name = self._model.charset_name
|
| 121 |
+
if self.state == ProbingState.DETECTING:
|
| 122 |
+
if self._total_seqs > self.SB_ENOUGH_REL_THRESHOLD:
|
| 123 |
+
confidence = self.get_confidence()
|
| 124 |
+
if confidence > self.POSITIVE_SHORTCUT_THRESHOLD:
|
| 125 |
+
self.logger.debug('%s confidence = %s, we have a winner',
|
| 126 |
+
charset_name, confidence)
|
| 127 |
+
self._state = ProbingState.FOUND_IT
|
| 128 |
+
elif confidence < self.NEGATIVE_SHORTCUT_THRESHOLD:
|
| 129 |
+
self.logger.debug('%s confidence = %s, below negative '
|
| 130 |
+
'shortcut threshhold %s', charset_name,
|
| 131 |
+
confidence,
|
| 132 |
+
self.NEGATIVE_SHORTCUT_THRESHOLD)
|
| 133 |
+
self._state = ProbingState.NOT_ME
|
| 134 |
+
|
| 135 |
+
return self.state
|
| 136 |
+
|
| 137 |
+
def get_confidence(self):
|
| 138 |
+
r = 0.01
|
| 139 |
+
if self._total_seqs > 0:
|
| 140 |
+
r = ((1.0 * self._seq_counters[SequenceLikelihood.POSITIVE]) /
|
| 141 |
+
self._total_seqs / self._model.typical_positive_ratio)
|
| 142 |
+
r = r * self._freq_char / self._total_char
|
| 143 |
+
if r >= 1.0:
|
| 144 |
+
r = 0.99
|
| 145 |
+
return r
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/sbcsgroupprober.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is Mozilla Universal charset detector code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 2001
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
# Shy Shalom - original C code
|
| 12 |
+
#
|
| 13 |
+
# This library is free software; you can redistribute it and/or
|
| 14 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 15 |
+
# License as published by the Free Software Foundation; either
|
| 16 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 17 |
+
#
|
| 18 |
+
# This library is distributed in the hope that it will be useful,
|
| 19 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 20 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 21 |
+
# Lesser General Public License for more details.
|
| 22 |
+
#
|
| 23 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 24 |
+
# License along with this library; if not, write to the Free Software
|
| 25 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 26 |
+
# 02110-1301 USA
|
| 27 |
+
######################### END LICENSE BLOCK #########################
|
| 28 |
+
|
| 29 |
+
from .charsetgroupprober import CharSetGroupProber
|
| 30 |
+
from .hebrewprober import HebrewProber
|
| 31 |
+
from .langbulgarianmodel import (ISO_8859_5_BULGARIAN_MODEL,
|
| 32 |
+
WINDOWS_1251_BULGARIAN_MODEL)
|
| 33 |
+
from .langgreekmodel import ISO_8859_7_GREEK_MODEL, WINDOWS_1253_GREEK_MODEL
|
| 34 |
+
from .langhebrewmodel import WINDOWS_1255_HEBREW_MODEL
|
| 35 |
+
# from .langhungarianmodel import (ISO_8859_2_HUNGARIAN_MODEL,
|
| 36 |
+
# WINDOWS_1250_HUNGARIAN_MODEL)
|
| 37 |
+
from .langrussianmodel import (IBM855_RUSSIAN_MODEL, IBM866_RUSSIAN_MODEL,
|
| 38 |
+
ISO_8859_5_RUSSIAN_MODEL, KOI8_R_RUSSIAN_MODEL,
|
| 39 |
+
MACCYRILLIC_RUSSIAN_MODEL,
|
| 40 |
+
WINDOWS_1251_RUSSIAN_MODEL)
|
| 41 |
+
from .langthaimodel import TIS_620_THAI_MODEL
|
| 42 |
+
from .langturkishmodel import ISO_8859_9_TURKISH_MODEL
|
| 43 |
+
from .sbcharsetprober import SingleByteCharSetProber
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class SBCSGroupProber(CharSetGroupProber):
|
| 47 |
+
def __init__(self):
|
| 48 |
+
super(SBCSGroupProber, self).__init__()
|
| 49 |
+
hebrew_prober = HebrewProber()
|
| 50 |
+
logical_hebrew_prober = SingleByteCharSetProber(WINDOWS_1255_HEBREW_MODEL,
|
| 51 |
+
False, hebrew_prober)
|
| 52 |
+
# TODO: See if using ISO-8859-8 Hebrew model works better here, since
|
| 53 |
+
# it's actually the visual one
|
| 54 |
+
visual_hebrew_prober = SingleByteCharSetProber(WINDOWS_1255_HEBREW_MODEL,
|
| 55 |
+
True, hebrew_prober)
|
| 56 |
+
hebrew_prober.set_model_probers(logical_hebrew_prober,
|
| 57 |
+
visual_hebrew_prober)
|
| 58 |
+
# TODO: ORDER MATTERS HERE. I changed the order vs what was in master
|
| 59 |
+
# and several tests failed that did not before. Some thought
|
| 60 |
+
# should be put into the ordering, and we should consider making
|
| 61 |
+
# order not matter here, because that is very counter-intuitive.
|
| 62 |
+
self.probers = [
|
| 63 |
+
SingleByteCharSetProber(WINDOWS_1251_RUSSIAN_MODEL),
|
| 64 |
+
SingleByteCharSetProber(KOI8_R_RUSSIAN_MODEL),
|
| 65 |
+
SingleByteCharSetProber(ISO_8859_5_RUSSIAN_MODEL),
|
| 66 |
+
SingleByteCharSetProber(MACCYRILLIC_RUSSIAN_MODEL),
|
| 67 |
+
SingleByteCharSetProber(IBM866_RUSSIAN_MODEL),
|
| 68 |
+
SingleByteCharSetProber(IBM855_RUSSIAN_MODEL),
|
| 69 |
+
SingleByteCharSetProber(ISO_8859_7_GREEK_MODEL),
|
| 70 |
+
SingleByteCharSetProber(WINDOWS_1253_GREEK_MODEL),
|
| 71 |
+
SingleByteCharSetProber(ISO_8859_5_BULGARIAN_MODEL),
|
| 72 |
+
SingleByteCharSetProber(WINDOWS_1251_BULGARIAN_MODEL),
|
| 73 |
+
# TODO: Restore Hungarian encodings (iso-8859-2 and windows-1250)
|
| 74 |
+
# after we retrain model.
|
| 75 |
+
# SingleByteCharSetProber(ISO_8859_2_HUNGARIAN_MODEL),
|
| 76 |
+
# SingleByteCharSetProber(WINDOWS_1250_HUNGARIAN_MODEL),
|
| 77 |
+
SingleByteCharSetProber(TIS_620_THAI_MODEL),
|
| 78 |
+
SingleByteCharSetProber(ISO_8859_9_TURKISH_MODEL),
|
| 79 |
+
hebrew_prober,
|
| 80 |
+
logical_hebrew_prober,
|
| 81 |
+
visual_hebrew_prober,
|
| 82 |
+
]
|
| 83 |
+
self.reset()
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/sjisprober.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is mozilla.org code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
#
|
| 12 |
+
# This library is free software; you can redistribute it and/or
|
| 13 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 14 |
+
# License as published by the Free Software Foundation; either
|
| 15 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 16 |
+
#
|
| 17 |
+
# This library is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 20 |
+
# Lesser General Public License for more details.
|
| 21 |
+
#
|
| 22 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 23 |
+
# License along with this library; if not, write to the Free Software
|
| 24 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 25 |
+
# 02110-1301 USA
|
| 26 |
+
######################### END LICENSE BLOCK #########################
|
| 27 |
+
|
| 28 |
+
from .mbcharsetprober import MultiByteCharSetProber
|
| 29 |
+
from .codingstatemachine import CodingStateMachine
|
| 30 |
+
from .chardistribution import SJISDistributionAnalysis
|
| 31 |
+
from .jpcntx import SJISContextAnalysis
|
| 32 |
+
from .mbcssm import SJIS_SM_MODEL
|
| 33 |
+
from .enums import ProbingState, MachineState
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class SJISProber(MultiByteCharSetProber):
|
| 37 |
+
def __init__(self):
|
| 38 |
+
super(SJISProber, self).__init__()
|
| 39 |
+
self.coding_sm = CodingStateMachine(SJIS_SM_MODEL)
|
| 40 |
+
self.distribution_analyzer = SJISDistributionAnalysis()
|
| 41 |
+
self.context_analyzer = SJISContextAnalysis()
|
| 42 |
+
self.reset()
|
| 43 |
+
|
| 44 |
+
def reset(self):
|
| 45 |
+
super(SJISProber, self).reset()
|
| 46 |
+
self.context_analyzer.reset()
|
| 47 |
+
|
| 48 |
+
@property
|
| 49 |
+
def charset_name(self):
|
| 50 |
+
return self.context_analyzer.charset_name
|
| 51 |
+
|
| 52 |
+
@property
|
| 53 |
+
def language(self):
|
| 54 |
+
return "Japanese"
|
| 55 |
+
|
| 56 |
+
def feed(self, byte_str):
|
| 57 |
+
for i in range(len(byte_str)):
|
| 58 |
+
coding_state = self.coding_sm.next_state(byte_str[i])
|
| 59 |
+
if coding_state == MachineState.ERROR:
|
| 60 |
+
self.logger.debug('%s %s prober hit error at byte %s',
|
| 61 |
+
self.charset_name, self.language, i)
|
| 62 |
+
self._state = ProbingState.NOT_ME
|
| 63 |
+
break
|
| 64 |
+
elif coding_state == MachineState.ITS_ME:
|
| 65 |
+
self._state = ProbingState.FOUND_IT
|
| 66 |
+
break
|
| 67 |
+
elif coding_state == MachineState.START:
|
| 68 |
+
char_len = self.coding_sm.get_current_charlen()
|
| 69 |
+
if i == 0:
|
| 70 |
+
self._last_char[1] = byte_str[0]
|
| 71 |
+
self.context_analyzer.feed(self._last_char[2 - char_len:],
|
| 72 |
+
char_len)
|
| 73 |
+
self.distribution_analyzer.feed(self._last_char, char_len)
|
| 74 |
+
else:
|
| 75 |
+
self.context_analyzer.feed(byte_str[i + 1 - char_len:i + 3
|
| 76 |
+
- char_len], char_len)
|
| 77 |
+
self.distribution_analyzer.feed(byte_str[i - 1:i + 1],
|
| 78 |
+
char_len)
|
| 79 |
+
|
| 80 |
+
self._last_char[0] = byte_str[-1]
|
| 81 |
+
|
| 82 |
+
if self.state == ProbingState.DETECTING:
|
| 83 |
+
if (self.context_analyzer.got_enough_data() and
|
| 84 |
+
(self.get_confidence() > self.SHORTCUT_THRESHOLD)):
|
| 85 |
+
self._state = ProbingState.FOUND_IT
|
| 86 |
+
|
| 87 |
+
return self.state
|
| 88 |
+
|
| 89 |
+
def get_confidence(self):
|
| 90 |
+
context_conf = self.context_analyzer.get_confidence()
|
| 91 |
+
distrib_conf = self.distribution_analyzer.get_confidence()
|
| 92 |
+
return max(context_conf, distrib_conf)
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/chardet/universaldetector.py
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
######################## BEGIN LICENSE BLOCK ########################
|
| 2 |
+
# The Original Code is Mozilla Universal charset detector code.
|
| 3 |
+
#
|
| 4 |
+
# The Initial Developer of the Original Code is
|
| 5 |
+
# Netscape Communications Corporation.
|
| 6 |
+
# Portions created by the Initial Developer are Copyright (C) 2001
|
| 7 |
+
# the Initial Developer. All Rights Reserved.
|
| 8 |
+
#
|
| 9 |
+
# Contributor(s):
|
| 10 |
+
# Mark Pilgrim - port to Python
|
| 11 |
+
# Shy Shalom - original C code
|
| 12 |
+
#
|
| 13 |
+
# This library is free software; you can redistribute it and/or
|
| 14 |
+
# modify it under the terms of the GNU Lesser General Public
|
| 15 |
+
# License as published by the Free Software Foundation; either
|
| 16 |
+
# version 2.1 of the License, or (at your option) any later version.
|
| 17 |
+
#
|
| 18 |
+
# This library is distributed in the hope that it will be useful,
|
| 19 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 20 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 21 |
+
# Lesser General Public License for more details.
|
| 22 |
+
#
|
| 23 |
+
# You should have received a copy of the GNU Lesser General Public
|
| 24 |
+
# License along with this library; if not, write to the Free Software
|
| 25 |
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
| 26 |
+
# 02110-1301 USA
|
| 27 |
+
######################### END LICENSE BLOCK #########################
|
| 28 |
+
"""
|
| 29 |
+
Module containing the UniversalDetector detector class, which is the primary
|
| 30 |
+
class a user of ``chardet`` should use.
|
| 31 |
+
|
| 32 |
+
:author: Mark Pilgrim (initial port to Python)
|
| 33 |
+
:author: Shy Shalom (original C code)
|
| 34 |
+
:author: Dan Blanchard (major refactoring for 3.0)
|
| 35 |
+
:author: Ian Cordasco
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
import codecs
|
| 40 |
+
import logging
|
| 41 |
+
import re
|
| 42 |
+
|
| 43 |
+
from .charsetgroupprober import CharSetGroupProber
|
| 44 |
+
from .enums import InputState, LanguageFilter, ProbingState
|
| 45 |
+
from .escprober import EscCharSetProber
|
| 46 |
+
from .latin1prober import Latin1Prober
|
| 47 |
+
from .mbcsgroupprober import MBCSGroupProber
|
| 48 |
+
from .sbcsgroupprober import SBCSGroupProber
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class UniversalDetector(object):
|
| 52 |
+
"""
|
| 53 |
+
The ``UniversalDetector`` class underlies the ``chardet.detect`` function
|
| 54 |
+
and coordinates all of the different charset probers.
|
| 55 |
+
|
| 56 |
+
To get a ``dict`` containing an encoding and its confidence, you can simply
|
| 57 |
+
run:
|
| 58 |
+
|
| 59 |
+
.. code::
|
| 60 |
+
|
| 61 |
+
u = UniversalDetector()
|
| 62 |
+
u.feed(some_bytes)
|
| 63 |
+
u.close()
|
| 64 |
+
detected = u.result
|
| 65 |
+
|
| 66 |
+
"""
|
| 67 |
+
|
| 68 |
+
MINIMUM_THRESHOLD = 0.20
|
| 69 |
+
HIGH_BYTE_DETECTOR = re.compile(b'[\x80-\xFF]')
|
| 70 |
+
ESC_DETECTOR = re.compile(b'(\033|~{)')
|
| 71 |
+
WIN_BYTE_DETECTOR = re.compile(b'[\x80-\x9F]')
|
| 72 |
+
ISO_WIN_MAP = {'iso-8859-1': 'Windows-1252',
|
| 73 |
+
'iso-8859-2': 'Windows-1250',
|
| 74 |
+
'iso-8859-5': 'Windows-1251',
|
| 75 |
+
'iso-8859-6': 'Windows-1256',
|
| 76 |
+
'iso-8859-7': 'Windows-1253',
|
| 77 |
+
'iso-8859-8': 'Windows-1255',
|
| 78 |
+
'iso-8859-9': 'Windows-1254',
|
| 79 |
+
'iso-8859-13': 'Windows-1257'}
|
| 80 |
+
|
| 81 |
+
def __init__(self, lang_filter=LanguageFilter.ALL):
|
| 82 |
+
self._esc_charset_prober = None
|
| 83 |
+
self._charset_probers = []
|
| 84 |
+
self.result = None
|
| 85 |
+
self.done = None
|
| 86 |
+
self._got_data = None
|
| 87 |
+
self._input_state = None
|
| 88 |
+
self._last_char = None
|
| 89 |
+
self.lang_filter = lang_filter
|
| 90 |
+
self.logger = logging.getLogger(__name__)
|
| 91 |
+
self._has_win_bytes = None
|
| 92 |
+
self.reset()
|
| 93 |
+
|
| 94 |
+
def reset(self):
|
| 95 |
+
"""
|
| 96 |
+
Reset the UniversalDetector and all of its probers back to their
|
| 97 |
+
initial states. This is called by ``__init__``, so you only need to
|
| 98 |
+
call this directly in between analyses of different documents.
|
| 99 |
+
"""
|
| 100 |
+
self.result = {'encoding': None, 'confidence': 0.0, 'language': None}
|
| 101 |
+
self.done = False
|
| 102 |
+
self._got_data = False
|
| 103 |
+
self._has_win_bytes = False
|
| 104 |
+
self._input_state = InputState.PURE_ASCII
|
| 105 |
+
self._last_char = b''
|
| 106 |
+
if self._esc_charset_prober:
|
| 107 |
+
self._esc_charset_prober.reset()
|
| 108 |
+
for prober in self._charset_probers:
|
| 109 |
+
prober.reset()
|
| 110 |
+
|
| 111 |
+
def feed(self, byte_str):
|
| 112 |
+
"""
|
| 113 |
+
Takes a chunk of a document and feeds it through all of the relevant
|
| 114 |
+
charset probers.
|
| 115 |
+
|
| 116 |
+
After calling ``feed``, you can check the value of the ``done``
|
| 117 |
+
attribute to see if you need to continue feeding the
|
| 118 |
+
``UniversalDetector`` more data, or if it has made a prediction
|
| 119 |
+
(in the ``result`` attribute).
|
| 120 |
+
|
| 121 |
+
.. note::
|
| 122 |
+
You should always call ``close`` when you're done feeding in your
|
| 123 |
+
document if ``done`` is not already ``True``.
|
| 124 |
+
"""
|
| 125 |
+
if self.done:
|
| 126 |
+
return
|
| 127 |
+
|
| 128 |
+
if not len(byte_str):
|
| 129 |
+
return
|
| 130 |
+
|
| 131 |
+
if not isinstance(byte_str, bytearray):
|
| 132 |
+
byte_str = bytearray(byte_str)
|
| 133 |
+
|
| 134 |
+
# First check for known BOMs, since these are guaranteed to be correct
|
| 135 |
+
if not self._got_data:
|
| 136 |
+
# If the data starts with BOM, we know it is UTF
|
| 137 |
+
if byte_str.startswith(codecs.BOM_UTF8):
|
| 138 |
+
# EF BB BF UTF-8 with BOM
|
| 139 |
+
self.result = {'encoding': "UTF-8-SIG",
|
| 140 |
+
'confidence': 1.0,
|
| 141 |
+
'language': ''}
|
| 142 |
+
elif byte_str.startswith((codecs.BOM_UTF32_LE,
|
| 143 |
+
codecs.BOM_UTF32_BE)):
|
| 144 |
+
# FF FE 00 00 UTF-32, little-endian BOM
|
| 145 |
+
# 00 00 FE FF UTF-32, big-endian BOM
|
| 146 |
+
self.result = {'encoding': "UTF-32",
|
| 147 |
+
'confidence': 1.0,
|
| 148 |
+
'language': ''}
|
| 149 |
+
elif byte_str.startswith(b'\xFE\xFF\x00\x00'):
|
| 150 |
+
# FE FF 00 00 UCS-4, unusual octet order BOM (3412)
|
| 151 |
+
self.result = {'encoding': "X-ISO-10646-UCS-4-3412",
|
| 152 |
+
'confidence': 1.0,
|
| 153 |
+
'language': ''}
|
| 154 |
+
elif byte_str.startswith(b'\x00\x00\xFF\xFE'):
|
| 155 |
+
# 00 00 FF FE UCS-4, unusual octet order BOM (2143)
|
| 156 |
+
self.result = {'encoding': "X-ISO-10646-UCS-4-2143",
|
| 157 |
+
'confidence': 1.0,
|
| 158 |
+
'language': ''}
|
| 159 |
+
elif byte_str.startswith((codecs.BOM_LE, codecs.BOM_BE)):
|
| 160 |
+
# FF FE UTF-16, little endian BOM
|
| 161 |
+
# FE FF UTF-16, big endian BOM
|
| 162 |
+
self.result = {'encoding': "UTF-16",
|
| 163 |
+
'confidence': 1.0,
|
| 164 |
+
'language': ''}
|
| 165 |
+
|
| 166 |
+
self._got_data = True
|
| 167 |
+
if self.result['encoding'] is not None:
|
| 168 |
+
self.done = True
|
| 169 |
+
return
|
| 170 |
+
|
| 171 |
+
# If none of those matched and we've only see ASCII so far, check
|
| 172 |
+
# for high bytes and escape sequences
|
| 173 |
+
if self._input_state == InputState.PURE_ASCII:
|
| 174 |
+
if self.HIGH_BYTE_DETECTOR.search(byte_str):
|
| 175 |
+
self._input_state = InputState.HIGH_BYTE
|
| 176 |
+
elif self._input_state == InputState.PURE_ASCII and \
|
| 177 |
+
self.ESC_DETECTOR.search(self._last_char + byte_str):
|
| 178 |
+
self._input_state = InputState.ESC_ASCII
|
| 179 |
+
|
| 180 |
+
self._last_char = byte_str[-1:]
|
| 181 |
+
|
| 182 |
+
# If we've seen escape sequences, use the EscCharSetProber, which
|
| 183 |
+
# uses a simple state machine to check for known escape sequences in
|
| 184 |
+
# HZ and ISO-2022 encodings, since those are the only encodings that
|
| 185 |
+
# use such sequences.
|
| 186 |
+
if self._input_state == InputState.ESC_ASCII:
|
| 187 |
+
if not self._esc_charset_prober:
|
| 188 |
+
self._esc_charset_prober = EscCharSetProber(self.lang_filter)
|
| 189 |
+
if self._esc_charset_prober.feed(byte_str) == ProbingState.FOUND_IT:
|
| 190 |
+
self.result = {'encoding':
|
| 191 |
+
self._esc_charset_prober.charset_name,
|
| 192 |
+
'confidence':
|
| 193 |
+
self._esc_charset_prober.get_confidence(),
|
| 194 |
+
'language':
|
| 195 |
+
self._esc_charset_prober.language}
|
| 196 |
+
self.done = True
|
| 197 |
+
# If we've seen high bytes (i.e., those with values greater than 127),
|
| 198 |
+
# we need to do more complicated checks using all our multi-byte and
|
| 199 |
+
# single-byte probers that are left. The single-byte probers
|
| 200 |
+
# use character bigram distributions to determine the encoding, whereas
|
| 201 |
+
# the multi-byte probers use a combination of character unigram and
|
| 202 |
+
# bigram distributions.
|
| 203 |
+
elif self._input_state == InputState.HIGH_BYTE:
|
| 204 |
+
if not self._charset_probers:
|
| 205 |
+
self._charset_probers = [MBCSGroupProber(self.lang_filter)]
|
| 206 |
+
# If we're checking non-CJK encodings, use single-byte prober
|
| 207 |
+
if self.lang_filter & LanguageFilter.NON_CJK:
|
| 208 |
+
self._charset_probers.append(SBCSGroupProber())
|
| 209 |
+
self._charset_probers.append(Latin1Prober())
|
| 210 |
+
for prober in self._charset_probers:
|
| 211 |
+
if prober.feed(byte_str) == ProbingState.FOUND_IT:
|
| 212 |
+
self.result = {'encoding': prober.charset_name,
|
| 213 |
+
'confidence': prober.get_confidence(),
|
| 214 |
+
'language': prober.language}
|
| 215 |
+
self.done = True
|
| 216 |
+
break
|
| 217 |
+
if self.WIN_BYTE_DETECTOR.search(byte_str):
|
| 218 |
+
self._has_win_bytes = True
|
| 219 |
+
|
| 220 |
+
def close(self):
|
| 221 |
+
"""
|
| 222 |
+
Stop analyzing the current document and come up with a final
|
| 223 |
+
prediction.
|
| 224 |
+
|
| 225 |
+
:returns: The ``result`` attribute, a ``dict`` with the keys
|
| 226 |
+
`encoding`, `confidence`, and `language`.
|
| 227 |
+
"""
|
| 228 |
+
# Don't bother with checks if we're already done
|
| 229 |
+
if self.done:
|
| 230 |
+
return self.result
|
| 231 |
+
self.done = True
|
| 232 |
+
|
| 233 |
+
if not self._got_data:
|
| 234 |
+
self.logger.debug('no data received!')
|
| 235 |
+
|
| 236 |
+
# Default to ASCII if it is all we've seen so far
|
| 237 |
+
elif self._input_state == InputState.PURE_ASCII:
|
| 238 |
+
self.result = {'encoding': 'ascii',
|
| 239 |
+
'confidence': 1.0,
|
| 240 |
+
'language': ''}
|
| 241 |
+
|
| 242 |
+
# If we have seen non-ASCII, return the best that met MINIMUM_THRESHOLD
|
| 243 |
+
elif self._input_state == InputState.HIGH_BYTE:
|
| 244 |
+
prober_confidence = None
|
| 245 |
+
max_prober_confidence = 0.0
|
| 246 |
+
max_prober = None
|
| 247 |
+
for prober in self._charset_probers:
|
| 248 |
+
if not prober:
|
| 249 |
+
continue
|
| 250 |
+
prober_confidence = prober.get_confidence()
|
| 251 |
+
if prober_confidence > max_prober_confidence:
|
| 252 |
+
max_prober_confidence = prober_confidence
|
| 253 |
+
max_prober = prober
|
| 254 |
+
if max_prober and (max_prober_confidence > self.MINIMUM_THRESHOLD):
|
| 255 |
+
charset_name = max_prober.charset_name
|
| 256 |
+
lower_charset_name = max_prober.charset_name.lower()
|
| 257 |
+
confidence = max_prober.get_confidence()
|
| 258 |
+
# Use Windows encoding name instead of ISO-8859 if we saw any
|
| 259 |
+
# extra Windows-specific bytes
|
| 260 |
+
if lower_charset_name.startswith('iso-8859'):
|
| 261 |
+
if self._has_win_bytes:
|
| 262 |
+
charset_name = self.ISO_WIN_MAP.get(lower_charset_name,
|
| 263 |
+
charset_name)
|
| 264 |
+
self.result = {'encoding': charset_name,
|
| 265 |
+
'confidence': confidence,
|
| 266 |
+
'language': max_prober.language}
|
| 267 |
+
|
| 268 |
+
# Log all prober confidences if none met MINIMUM_THRESHOLD
|
| 269 |
+
if self.logger.getEffectiveLevel() <= logging.DEBUG:
|
| 270 |
+
if self.result['encoding'] is None:
|
| 271 |
+
self.logger.debug('no probers hit minimum threshold')
|
| 272 |
+
for group_prober in self._charset_probers:
|
| 273 |
+
if not group_prober:
|
| 274 |
+
continue
|
| 275 |
+
if isinstance(group_prober, CharSetGroupProber):
|
| 276 |
+
for prober in group_prober.probers:
|
| 277 |
+
self.logger.debug('%s %s confidence = %s',
|
| 278 |
+
prober.charset_name,
|
| 279 |
+
prober.language,
|
| 280 |
+
prober.get_confidence())
|
| 281 |
+
else:
|
| 282 |
+
self.logger.debug('%s %s confidence = %s',
|
| 283 |
+
group_prober.charset_name,
|
| 284 |
+
group_prober.language,
|
| 285 |
+
group_prober.get_confidence())
|
| 286 |
+
return self.result
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__init__.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
| 2 |
+
from .initialise import init, deinit, reinit, colorama_text
|
| 3 |
+
from .ansi import Fore, Back, Style, Cursor
|
| 4 |
+
from .ansitowin32 import AnsiToWin32
|
| 5 |
+
|
| 6 |
+
__version__ = '0.4.4'
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (494 Bytes). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/ansi.cpython-310.pyc
ADDED
|
Binary file (3.06 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/ansitowin32.cpython-310.pyc
ADDED
|
Binary file (7.95 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/initialise.cpython-310.pyc
ADDED
|
Binary file (1.74 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/win32.cpython-310.pyc
ADDED
|
Binary file (4 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/__pycache__/winterm.cpython-310.pyc
ADDED
|
Binary file (4.62 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/ansi.py
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
| 2 |
+
'''
|
| 3 |
+
This module generates ANSI character codes to printing colors to terminals.
|
| 4 |
+
See: http://en.wikipedia.org/wiki/ANSI_escape_code
|
| 5 |
+
'''
|
| 6 |
+
|
| 7 |
+
CSI = '\033['
|
| 8 |
+
OSC = '\033]'
|
| 9 |
+
BEL = '\a'
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def code_to_chars(code):
|
| 13 |
+
return CSI + str(code) + 'm'
|
| 14 |
+
|
| 15 |
+
def set_title(title):
|
| 16 |
+
return OSC + '2;' + title + BEL
|
| 17 |
+
|
| 18 |
+
def clear_screen(mode=2):
|
| 19 |
+
return CSI + str(mode) + 'J'
|
| 20 |
+
|
| 21 |
+
def clear_line(mode=2):
|
| 22 |
+
return CSI + str(mode) + 'K'
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class AnsiCodes(object):
|
| 26 |
+
def __init__(self):
|
| 27 |
+
# the subclasses declare class attributes which are numbers.
|
| 28 |
+
# Upon instantiation we define instance attributes, which are the same
|
| 29 |
+
# as the class attributes but wrapped with the ANSI escape sequence
|
| 30 |
+
for name in dir(self):
|
| 31 |
+
if not name.startswith('_'):
|
| 32 |
+
value = getattr(self, name)
|
| 33 |
+
setattr(self, name, code_to_chars(value))
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class AnsiCursor(object):
|
| 37 |
+
def UP(self, n=1):
|
| 38 |
+
return CSI + str(n) + 'A'
|
| 39 |
+
def DOWN(self, n=1):
|
| 40 |
+
return CSI + str(n) + 'B'
|
| 41 |
+
def FORWARD(self, n=1):
|
| 42 |
+
return CSI + str(n) + 'C'
|
| 43 |
+
def BACK(self, n=1):
|
| 44 |
+
return CSI + str(n) + 'D'
|
| 45 |
+
def POS(self, x=1, y=1):
|
| 46 |
+
return CSI + str(y) + ';' + str(x) + 'H'
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class AnsiFore(AnsiCodes):
|
| 50 |
+
BLACK = 30
|
| 51 |
+
RED = 31
|
| 52 |
+
GREEN = 32
|
| 53 |
+
YELLOW = 33
|
| 54 |
+
BLUE = 34
|
| 55 |
+
MAGENTA = 35
|
| 56 |
+
CYAN = 36
|
| 57 |
+
WHITE = 37
|
| 58 |
+
RESET = 39
|
| 59 |
+
|
| 60 |
+
# These are fairly well supported, but not part of the standard.
|
| 61 |
+
LIGHTBLACK_EX = 90
|
| 62 |
+
LIGHTRED_EX = 91
|
| 63 |
+
LIGHTGREEN_EX = 92
|
| 64 |
+
LIGHTYELLOW_EX = 93
|
| 65 |
+
LIGHTBLUE_EX = 94
|
| 66 |
+
LIGHTMAGENTA_EX = 95
|
| 67 |
+
LIGHTCYAN_EX = 96
|
| 68 |
+
LIGHTWHITE_EX = 97
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
class AnsiBack(AnsiCodes):
|
| 72 |
+
BLACK = 40
|
| 73 |
+
RED = 41
|
| 74 |
+
GREEN = 42
|
| 75 |
+
YELLOW = 43
|
| 76 |
+
BLUE = 44
|
| 77 |
+
MAGENTA = 45
|
| 78 |
+
CYAN = 46
|
| 79 |
+
WHITE = 47
|
| 80 |
+
RESET = 49
|
| 81 |
+
|
| 82 |
+
# These are fairly well supported, but not part of the standard.
|
| 83 |
+
LIGHTBLACK_EX = 100
|
| 84 |
+
LIGHTRED_EX = 101
|
| 85 |
+
LIGHTGREEN_EX = 102
|
| 86 |
+
LIGHTYELLOW_EX = 103
|
| 87 |
+
LIGHTBLUE_EX = 104
|
| 88 |
+
LIGHTMAGENTA_EX = 105
|
| 89 |
+
LIGHTCYAN_EX = 106
|
| 90 |
+
LIGHTWHITE_EX = 107
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
class AnsiStyle(AnsiCodes):
|
| 94 |
+
BRIGHT = 1
|
| 95 |
+
DIM = 2
|
| 96 |
+
NORMAL = 22
|
| 97 |
+
RESET_ALL = 0
|
| 98 |
+
|
| 99 |
+
Fore = AnsiFore()
|
| 100 |
+
Back = AnsiBack()
|
| 101 |
+
Style = AnsiStyle()
|
| 102 |
+
Cursor = AnsiCursor()
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/ansitowin32.py
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
| 2 |
+
import re
|
| 3 |
+
import sys
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style, BEL
|
| 7 |
+
from .winterm import WinTerm, WinColor, WinStyle
|
| 8 |
+
from .win32 import windll, winapi_test
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
winterm = None
|
| 12 |
+
if windll is not None:
|
| 13 |
+
winterm = WinTerm()
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class StreamWrapper(object):
|
| 17 |
+
'''
|
| 18 |
+
Wraps a stream (such as stdout), acting as a transparent proxy for all
|
| 19 |
+
attribute access apart from method 'write()', which is delegated to our
|
| 20 |
+
Converter instance.
|
| 21 |
+
'''
|
| 22 |
+
def __init__(self, wrapped, converter):
|
| 23 |
+
# double-underscore everything to prevent clashes with names of
|
| 24 |
+
# attributes on the wrapped stream object.
|
| 25 |
+
self.__wrapped = wrapped
|
| 26 |
+
self.__convertor = converter
|
| 27 |
+
|
| 28 |
+
def __getattr__(self, name):
|
| 29 |
+
return getattr(self.__wrapped, name)
|
| 30 |
+
|
| 31 |
+
def __enter__(self, *args, **kwargs):
|
| 32 |
+
# special method lookup bypasses __getattr__/__getattribute__, see
|
| 33 |
+
# https://stackoverflow.com/questions/12632894/why-doesnt-getattr-work-with-exit
|
| 34 |
+
# thus, contextlib magic methods are not proxied via __getattr__
|
| 35 |
+
return self.__wrapped.__enter__(*args, **kwargs)
|
| 36 |
+
|
| 37 |
+
def __exit__(self, *args, **kwargs):
|
| 38 |
+
return self.__wrapped.__exit__(*args, **kwargs)
|
| 39 |
+
|
| 40 |
+
def write(self, text):
|
| 41 |
+
self.__convertor.write(text)
|
| 42 |
+
|
| 43 |
+
def isatty(self):
|
| 44 |
+
stream = self.__wrapped
|
| 45 |
+
if 'PYCHARM_HOSTED' in os.environ:
|
| 46 |
+
if stream is not None and (stream is sys.__stdout__ or stream is sys.__stderr__):
|
| 47 |
+
return True
|
| 48 |
+
try:
|
| 49 |
+
stream_isatty = stream.isatty
|
| 50 |
+
except AttributeError:
|
| 51 |
+
return False
|
| 52 |
+
else:
|
| 53 |
+
return stream_isatty()
|
| 54 |
+
|
| 55 |
+
@property
|
| 56 |
+
def closed(self):
|
| 57 |
+
stream = self.__wrapped
|
| 58 |
+
try:
|
| 59 |
+
return stream.closed
|
| 60 |
+
except AttributeError:
|
| 61 |
+
return True
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class AnsiToWin32(object):
|
| 65 |
+
'''
|
| 66 |
+
Implements a 'write()' method which, on Windows, will strip ANSI character
|
| 67 |
+
sequences from the text, and if outputting to a tty, will convert them into
|
| 68 |
+
win32 function calls.
|
| 69 |
+
'''
|
| 70 |
+
ANSI_CSI_RE = re.compile('\001?\033\\[((?:\\d|;)*)([a-zA-Z])\002?') # Control Sequence Introducer
|
| 71 |
+
ANSI_OSC_RE = re.compile('\001?\033\\]([^\a]*)(\a)\002?') # Operating System Command
|
| 72 |
+
|
| 73 |
+
def __init__(self, wrapped, convert=None, strip=None, autoreset=False):
|
| 74 |
+
# The wrapped stream (normally sys.stdout or sys.stderr)
|
| 75 |
+
self.wrapped = wrapped
|
| 76 |
+
|
| 77 |
+
# should we reset colors to defaults after every .write()
|
| 78 |
+
self.autoreset = autoreset
|
| 79 |
+
|
| 80 |
+
# create the proxy wrapping our output stream
|
| 81 |
+
self.stream = StreamWrapper(wrapped, self)
|
| 82 |
+
|
| 83 |
+
on_windows = os.name == 'nt'
|
| 84 |
+
# We test if the WinAPI works, because even if we are on Windows
|
| 85 |
+
# we may be using a terminal that doesn't support the WinAPI
|
| 86 |
+
# (e.g. Cygwin Terminal). In this case it's up to the terminal
|
| 87 |
+
# to support the ANSI codes.
|
| 88 |
+
conversion_supported = on_windows and winapi_test()
|
| 89 |
+
|
| 90 |
+
# should we strip ANSI sequences from our output?
|
| 91 |
+
if strip is None:
|
| 92 |
+
strip = conversion_supported or (not self.stream.closed and not self.stream.isatty())
|
| 93 |
+
self.strip = strip
|
| 94 |
+
|
| 95 |
+
# should we should convert ANSI sequences into win32 calls?
|
| 96 |
+
if convert is None:
|
| 97 |
+
convert = conversion_supported and not self.stream.closed and self.stream.isatty()
|
| 98 |
+
self.convert = convert
|
| 99 |
+
|
| 100 |
+
# dict of ansi codes to win32 functions and parameters
|
| 101 |
+
self.win32_calls = self.get_win32_calls()
|
| 102 |
+
|
| 103 |
+
# are we wrapping stderr?
|
| 104 |
+
self.on_stderr = self.wrapped is sys.stderr
|
| 105 |
+
|
| 106 |
+
def should_wrap(self):
|
| 107 |
+
'''
|
| 108 |
+
True if this class is actually needed. If false, then the output
|
| 109 |
+
stream will not be affected, nor will win32 calls be issued, so
|
| 110 |
+
wrapping stdout is not actually required. This will generally be
|
| 111 |
+
False on non-Windows platforms, unless optional functionality like
|
| 112 |
+
autoreset has been requested using kwargs to init()
|
| 113 |
+
'''
|
| 114 |
+
return self.convert or self.strip or self.autoreset
|
| 115 |
+
|
| 116 |
+
def get_win32_calls(self):
|
| 117 |
+
if self.convert and winterm:
|
| 118 |
+
return {
|
| 119 |
+
AnsiStyle.RESET_ALL: (winterm.reset_all, ),
|
| 120 |
+
AnsiStyle.BRIGHT: (winterm.style, WinStyle.BRIGHT),
|
| 121 |
+
AnsiStyle.DIM: (winterm.style, WinStyle.NORMAL),
|
| 122 |
+
AnsiStyle.NORMAL: (winterm.style, WinStyle.NORMAL),
|
| 123 |
+
AnsiFore.BLACK: (winterm.fore, WinColor.BLACK),
|
| 124 |
+
AnsiFore.RED: (winterm.fore, WinColor.RED),
|
| 125 |
+
AnsiFore.GREEN: (winterm.fore, WinColor.GREEN),
|
| 126 |
+
AnsiFore.YELLOW: (winterm.fore, WinColor.YELLOW),
|
| 127 |
+
AnsiFore.BLUE: (winterm.fore, WinColor.BLUE),
|
| 128 |
+
AnsiFore.MAGENTA: (winterm.fore, WinColor.MAGENTA),
|
| 129 |
+
AnsiFore.CYAN: (winterm.fore, WinColor.CYAN),
|
| 130 |
+
AnsiFore.WHITE: (winterm.fore, WinColor.GREY),
|
| 131 |
+
AnsiFore.RESET: (winterm.fore, ),
|
| 132 |
+
AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True),
|
| 133 |
+
AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True),
|
| 134 |
+
AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True),
|
| 135 |
+
AnsiFore.LIGHTYELLOW_EX: (winterm.fore, WinColor.YELLOW, True),
|
| 136 |
+
AnsiFore.LIGHTBLUE_EX: (winterm.fore, WinColor.BLUE, True),
|
| 137 |
+
AnsiFore.LIGHTMAGENTA_EX: (winterm.fore, WinColor.MAGENTA, True),
|
| 138 |
+
AnsiFore.LIGHTCYAN_EX: (winterm.fore, WinColor.CYAN, True),
|
| 139 |
+
AnsiFore.LIGHTWHITE_EX: (winterm.fore, WinColor.GREY, True),
|
| 140 |
+
AnsiBack.BLACK: (winterm.back, WinColor.BLACK),
|
| 141 |
+
AnsiBack.RED: (winterm.back, WinColor.RED),
|
| 142 |
+
AnsiBack.GREEN: (winterm.back, WinColor.GREEN),
|
| 143 |
+
AnsiBack.YELLOW: (winterm.back, WinColor.YELLOW),
|
| 144 |
+
AnsiBack.BLUE: (winterm.back, WinColor.BLUE),
|
| 145 |
+
AnsiBack.MAGENTA: (winterm.back, WinColor.MAGENTA),
|
| 146 |
+
AnsiBack.CYAN: (winterm.back, WinColor.CYAN),
|
| 147 |
+
AnsiBack.WHITE: (winterm.back, WinColor.GREY),
|
| 148 |
+
AnsiBack.RESET: (winterm.back, ),
|
| 149 |
+
AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True),
|
| 150 |
+
AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True),
|
| 151 |
+
AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True),
|
| 152 |
+
AnsiBack.LIGHTYELLOW_EX: (winterm.back, WinColor.YELLOW, True),
|
| 153 |
+
AnsiBack.LIGHTBLUE_EX: (winterm.back, WinColor.BLUE, True),
|
| 154 |
+
AnsiBack.LIGHTMAGENTA_EX: (winterm.back, WinColor.MAGENTA, True),
|
| 155 |
+
AnsiBack.LIGHTCYAN_EX: (winterm.back, WinColor.CYAN, True),
|
| 156 |
+
AnsiBack.LIGHTWHITE_EX: (winterm.back, WinColor.GREY, True),
|
| 157 |
+
}
|
| 158 |
+
return dict()
|
| 159 |
+
|
| 160 |
+
def write(self, text):
|
| 161 |
+
if self.strip or self.convert:
|
| 162 |
+
self.write_and_convert(text)
|
| 163 |
+
else:
|
| 164 |
+
self.wrapped.write(text)
|
| 165 |
+
self.wrapped.flush()
|
| 166 |
+
if self.autoreset:
|
| 167 |
+
self.reset_all()
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
def reset_all(self):
|
| 171 |
+
if self.convert:
|
| 172 |
+
self.call_win32('m', (0,))
|
| 173 |
+
elif not self.strip and not self.stream.closed:
|
| 174 |
+
self.wrapped.write(Style.RESET_ALL)
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def write_and_convert(self, text):
|
| 178 |
+
'''
|
| 179 |
+
Write the given text to our wrapped stream, stripping any ANSI
|
| 180 |
+
sequences from the text, and optionally converting them into win32
|
| 181 |
+
calls.
|
| 182 |
+
'''
|
| 183 |
+
cursor = 0
|
| 184 |
+
text = self.convert_osc(text)
|
| 185 |
+
for match in self.ANSI_CSI_RE.finditer(text):
|
| 186 |
+
start, end = match.span()
|
| 187 |
+
self.write_plain_text(text, cursor, start)
|
| 188 |
+
self.convert_ansi(*match.groups())
|
| 189 |
+
cursor = end
|
| 190 |
+
self.write_plain_text(text, cursor, len(text))
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def write_plain_text(self, text, start, end):
|
| 194 |
+
if start < end:
|
| 195 |
+
self.wrapped.write(text[start:end])
|
| 196 |
+
self.wrapped.flush()
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def convert_ansi(self, paramstring, command):
|
| 200 |
+
if self.convert:
|
| 201 |
+
params = self.extract_params(command, paramstring)
|
| 202 |
+
self.call_win32(command, params)
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def extract_params(self, command, paramstring):
|
| 206 |
+
if command in 'Hf':
|
| 207 |
+
params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(';'))
|
| 208 |
+
while len(params) < 2:
|
| 209 |
+
# defaults:
|
| 210 |
+
params = params + (1,)
|
| 211 |
+
else:
|
| 212 |
+
params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0)
|
| 213 |
+
if len(params) == 0:
|
| 214 |
+
# defaults:
|
| 215 |
+
if command in 'JKm':
|
| 216 |
+
params = (0,)
|
| 217 |
+
elif command in 'ABCD':
|
| 218 |
+
params = (1,)
|
| 219 |
+
|
| 220 |
+
return params
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
def call_win32(self, command, params):
|
| 224 |
+
if command == 'm':
|
| 225 |
+
for param in params:
|
| 226 |
+
if param in self.win32_calls:
|
| 227 |
+
func_args = self.win32_calls[param]
|
| 228 |
+
func = func_args[0]
|
| 229 |
+
args = func_args[1:]
|
| 230 |
+
kwargs = dict(on_stderr=self.on_stderr)
|
| 231 |
+
func(*args, **kwargs)
|
| 232 |
+
elif command in 'J':
|
| 233 |
+
winterm.erase_screen(params[0], on_stderr=self.on_stderr)
|
| 234 |
+
elif command in 'K':
|
| 235 |
+
winterm.erase_line(params[0], on_stderr=self.on_stderr)
|
| 236 |
+
elif command in 'Hf': # cursor position - absolute
|
| 237 |
+
winterm.set_cursor_position(params, on_stderr=self.on_stderr)
|
| 238 |
+
elif command in 'ABCD': # cursor position - relative
|
| 239 |
+
n = params[0]
|
| 240 |
+
# A - up, B - down, C - forward, D - back
|
| 241 |
+
x, y = {'A': (0, -n), 'B': (0, n), 'C': (n, 0), 'D': (-n, 0)}[command]
|
| 242 |
+
winterm.cursor_adjust(x, y, on_stderr=self.on_stderr)
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
def convert_osc(self, text):
|
| 246 |
+
for match in self.ANSI_OSC_RE.finditer(text):
|
| 247 |
+
start, end = match.span()
|
| 248 |
+
text = text[:start] + text[end:]
|
| 249 |
+
paramstring, command = match.groups()
|
| 250 |
+
if command == BEL:
|
| 251 |
+
if paramstring.count(";") == 1:
|
| 252 |
+
params = paramstring.split(";")
|
| 253 |
+
# 0 - change title and icon (we will only change title)
|
| 254 |
+
# 1 - change icon (we don't support this)
|
| 255 |
+
# 2 - change title
|
| 256 |
+
if params[0] in '02':
|
| 257 |
+
winterm.set_title(params[1])
|
| 258 |
+
return text
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/initialise.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
| 2 |
+
import atexit
|
| 3 |
+
import contextlib
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
from .ansitowin32 import AnsiToWin32
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
orig_stdout = None
|
| 10 |
+
orig_stderr = None
|
| 11 |
+
|
| 12 |
+
wrapped_stdout = None
|
| 13 |
+
wrapped_stderr = None
|
| 14 |
+
|
| 15 |
+
atexit_done = False
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def reset_all():
|
| 19 |
+
if AnsiToWin32 is not None: # Issue #74: objects might become None at exit
|
| 20 |
+
AnsiToWin32(orig_stdout).reset_all()
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def init(autoreset=False, convert=None, strip=None, wrap=True):
|
| 24 |
+
|
| 25 |
+
if not wrap and any([autoreset, convert, strip]):
|
| 26 |
+
raise ValueError('wrap=False conflicts with any other arg=True')
|
| 27 |
+
|
| 28 |
+
global wrapped_stdout, wrapped_stderr
|
| 29 |
+
global orig_stdout, orig_stderr
|
| 30 |
+
|
| 31 |
+
orig_stdout = sys.stdout
|
| 32 |
+
orig_stderr = sys.stderr
|
| 33 |
+
|
| 34 |
+
if sys.stdout is None:
|
| 35 |
+
wrapped_stdout = None
|
| 36 |
+
else:
|
| 37 |
+
sys.stdout = wrapped_stdout = \
|
| 38 |
+
wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
|
| 39 |
+
if sys.stderr is None:
|
| 40 |
+
wrapped_stderr = None
|
| 41 |
+
else:
|
| 42 |
+
sys.stderr = wrapped_stderr = \
|
| 43 |
+
wrap_stream(orig_stderr, convert, strip, autoreset, wrap)
|
| 44 |
+
|
| 45 |
+
global atexit_done
|
| 46 |
+
if not atexit_done:
|
| 47 |
+
atexit.register(reset_all)
|
| 48 |
+
atexit_done = True
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def deinit():
|
| 52 |
+
if orig_stdout is not None:
|
| 53 |
+
sys.stdout = orig_stdout
|
| 54 |
+
if orig_stderr is not None:
|
| 55 |
+
sys.stderr = orig_stderr
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
@contextlib.contextmanager
|
| 59 |
+
def colorama_text(*args, **kwargs):
|
| 60 |
+
init(*args, **kwargs)
|
| 61 |
+
try:
|
| 62 |
+
yield
|
| 63 |
+
finally:
|
| 64 |
+
deinit()
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def reinit():
|
| 68 |
+
if wrapped_stdout is not None:
|
| 69 |
+
sys.stdout = wrapped_stdout
|
| 70 |
+
if wrapped_stderr is not None:
|
| 71 |
+
sys.stderr = wrapped_stderr
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def wrap_stream(stream, convert, strip, autoreset, wrap):
|
| 75 |
+
if wrap:
|
| 76 |
+
wrapper = AnsiToWin32(stream,
|
| 77 |
+
convert=convert, strip=strip, autoreset=autoreset)
|
| 78 |
+
if wrapper.should_wrap():
|
| 79 |
+
stream = wrapper.stream
|
| 80 |
+
return stream
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/win32.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
| 2 |
+
|
| 3 |
+
# from winbase.h
|
| 4 |
+
STDOUT = -11
|
| 5 |
+
STDERR = -12
|
| 6 |
+
|
| 7 |
+
try:
|
| 8 |
+
import ctypes
|
| 9 |
+
from ctypes import LibraryLoader
|
| 10 |
+
windll = LibraryLoader(ctypes.WinDLL)
|
| 11 |
+
from ctypes import wintypes
|
| 12 |
+
except (AttributeError, ImportError):
|
| 13 |
+
windll = None
|
| 14 |
+
SetConsoleTextAttribute = lambda *_: None
|
| 15 |
+
winapi_test = lambda *_: None
|
| 16 |
+
else:
|
| 17 |
+
from ctypes import byref, Structure, c_char, POINTER
|
| 18 |
+
|
| 19 |
+
COORD = wintypes._COORD
|
| 20 |
+
|
| 21 |
+
class CONSOLE_SCREEN_BUFFER_INFO(Structure):
|
| 22 |
+
"""struct in wincon.h."""
|
| 23 |
+
_fields_ = [
|
| 24 |
+
("dwSize", COORD),
|
| 25 |
+
("dwCursorPosition", COORD),
|
| 26 |
+
("wAttributes", wintypes.WORD),
|
| 27 |
+
("srWindow", wintypes.SMALL_RECT),
|
| 28 |
+
("dwMaximumWindowSize", COORD),
|
| 29 |
+
]
|
| 30 |
+
def __str__(self):
|
| 31 |
+
return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % (
|
| 32 |
+
self.dwSize.Y, self.dwSize.X
|
| 33 |
+
, self.dwCursorPosition.Y, self.dwCursorPosition.X
|
| 34 |
+
, self.wAttributes
|
| 35 |
+
, self.srWindow.Top, self.srWindow.Left, self.srWindow.Bottom, self.srWindow.Right
|
| 36 |
+
, self.dwMaximumWindowSize.Y, self.dwMaximumWindowSize.X
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
_GetStdHandle = windll.kernel32.GetStdHandle
|
| 40 |
+
_GetStdHandle.argtypes = [
|
| 41 |
+
wintypes.DWORD,
|
| 42 |
+
]
|
| 43 |
+
_GetStdHandle.restype = wintypes.HANDLE
|
| 44 |
+
|
| 45 |
+
_GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo
|
| 46 |
+
_GetConsoleScreenBufferInfo.argtypes = [
|
| 47 |
+
wintypes.HANDLE,
|
| 48 |
+
POINTER(CONSOLE_SCREEN_BUFFER_INFO),
|
| 49 |
+
]
|
| 50 |
+
_GetConsoleScreenBufferInfo.restype = wintypes.BOOL
|
| 51 |
+
|
| 52 |
+
_SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute
|
| 53 |
+
_SetConsoleTextAttribute.argtypes = [
|
| 54 |
+
wintypes.HANDLE,
|
| 55 |
+
wintypes.WORD,
|
| 56 |
+
]
|
| 57 |
+
_SetConsoleTextAttribute.restype = wintypes.BOOL
|
| 58 |
+
|
| 59 |
+
_SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition
|
| 60 |
+
_SetConsoleCursorPosition.argtypes = [
|
| 61 |
+
wintypes.HANDLE,
|
| 62 |
+
COORD,
|
| 63 |
+
]
|
| 64 |
+
_SetConsoleCursorPosition.restype = wintypes.BOOL
|
| 65 |
+
|
| 66 |
+
_FillConsoleOutputCharacterA = windll.kernel32.FillConsoleOutputCharacterA
|
| 67 |
+
_FillConsoleOutputCharacterA.argtypes = [
|
| 68 |
+
wintypes.HANDLE,
|
| 69 |
+
c_char,
|
| 70 |
+
wintypes.DWORD,
|
| 71 |
+
COORD,
|
| 72 |
+
POINTER(wintypes.DWORD),
|
| 73 |
+
]
|
| 74 |
+
_FillConsoleOutputCharacterA.restype = wintypes.BOOL
|
| 75 |
+
|
| 76 |
+
_FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute
|
| 77 |
+
_FillConsoleOutputAttribute.argtypes = [
|
| 78 |
+
wintypes.HANDLE,
|
| 79 |
+
wintypes.WORD,
|
| 80 |
+
wintypes.DWORD,
|
| 81 |
+
COORD,
|
| 82 |
+
POINTER(wintypes.DWORD),
|
| 83 |
+
]
|
| 84 |
+
_FillConsoleOutputAttribute.restype = wintypes.BOOL
|
| 85 |
+
|
| 86 |
+
_SetConsoleTitleW = windll.kernel32.SetConsoleTitleW
|
| 87 |
+
_SetConsoleTitleW.argtypes = [
|
| 88 |
+
wintypes.LPCWSTR
|
| 89 |
+
]
|
| 90 |
+
_SetConsoleTitleW.restype = wintypes.BOOL
|
| 91 |
+
|
| 92 |
+
def _winapi_test(handle):
|
| 93 |
+
csbi = CONSOLE_SCREEN_BUFFER_INFO()
|
| 94 |
+
success = _GetConsoleScreenBufferInfo(
|
| 95 |
+
handle, byref(csbi))
|
| 96 |
+
return bool(success)
|
| 97 |
+
|
| 98 |
+
def winapi_test():
|
| 99 |
+
return any(_winapi_test(h) for h in
|
| 100 |
+
(_GetStdHandle(STDOUT), _GetStdHandle(STDERR)))
|
| 101 |
+
|
| 102 |
+
def GetConsoleScreenBufferInfo(stream_id=STDOUT):
|
| 103 |
+
handle = _GetStdHandle(stream_id)
|
| 104 |
+
csbi = CONSOLE_SCREEN_BUFFER_INFO()
|
| 105 |
+
success = _GetConsoleScreenBufferInfo(
|
| 106 |
+
handle, byref(csbi))
|
| 107 |
+
return csbi
|
| 108 |
+
|
| 109 |
+
def SetConsoleTextAttribute(stream_id, attrs):
|
| 110 |
+
handle = _GetStdHandle(stream_id)
|
| 111 |
+
return _SetConsoleTextAttribute(handle, attrs)
|
| 112 |
+
|
| 113 |
+
def SetConsoleCursorPosition(stream_id, position, adjust=True):
|
| 114 |
+
position = COORD(*position)
|
| 115 |
+
# If the position is out of range, do nothing.
|
| 116 |
+
if position.Y <= 0 or position.X <= 0:
|
| 117 |
+
return
|
| 118 |
+
# Adjust for Windows' SetConsoleCursorPosition:
|
| 119 |
+
# 1. being 0-based, while ANSI is 1-based.
|
| 120 |
+
# 2. expecting (x,y), while ANSI uses (y,x).
|
| 121 |
+
adjusted_position = COORD(position.Y - 1, position.X - 1)
|
| 122 |
+
if adjust:
|
| 123 |
+
# Adjust for viewport's scroll position
|
| 124 |
+
sr = GetConsoleScreenBufferInfo(STDOUT).srWindow
|
| 125 |
+
adjusted_position.Y += sr.Top
|
| 126 |
+
adjusted_position.X += sr.Left
|
| 127 |
+
# Resume normal processing
|
| 128 |
+
handle = _GetStdHandle(stream_id)
|
| 129 |
+
return _SetConsoleCursorPosition(handle, adjusted_position)
|
| 130 |
+
|
| 131 |
+
def FillConsoleOutputCharacter(stream_id, char, length, start):
|
| 132 |
+
handle = _GetStdHandle(stream_id)
|
| 133 |
+
char = c_char(char.encode())
|
| 134 |
+
length = wintypes.DWORD(length)
|
| 135 |
+
num_written = wintypes.DWORD(0)
|
| 136 |
+
# Note that this is hard-coded for ANSI (vs wide) bytes.
|
| 137 |
+
success = _FillConsoleOutputCharacterA(
|
| 138 |
+
handle, char, length, start, byref(num_written))
|
| 139 |
+
return num_written.value
|
| 140 |
+
|
| 141 |
+
def FillConsoleOutputAttribute(stream_id, attr, length, start):
|
| 142 |
+
''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )'''
|
| 143 |
+
handle = _GetStdHandle(stream_id)
|
| 144 |
+
attribute = wintypes.WORD(attr)
|
| 145 |
+
length = wintypes.DWORD(length)
|
| 146 |
+
num_written = wintypes.DWORD(0)
|
| 147 |
+
# Note that this is hard-coded for ANSI (vs wide) bytes.
|
| 148 |
+
return _FillConsoleOutputAttribute(
|
| 149 |
+
handle, attribute, length, start, byref(num_written))
|
| 150 |
+
|
| 151 |
+
def SetConsoleTitle(title):
|
| 152 |
+
return _SetConsoleTitleW(title)
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/colorama/winterm.py
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
| 2 |
+
from . import win32
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# from wincon.h
|
| 6 |
+
class WinColor(object):
|
| 7 |
+
BLACK = 0
|
| 8 |
+
BLUE = 1
|
| 9 |
+
GREEN = 2
|
| 10 |
+
CYAN = 3
|
| 11 |
+
RED = 4
|
| 12 |
+
MAGENTA = 5
|
| 13 |
+
YELLOW = 6
|
| 14 |
+
GREY = 7
|
| 15 |
+
|
| 16 |
+
# from wincon.h
|
| 17 |
+
class WinStyle(object):
|
| 18 |
+
NORMAL = 0x00 # dim text, dim background
|
| 19 |
+
BRIGHT = 0x08 # bright text, dim background
|
| 20 |
+
BRIGHT_BACKGROUND = 0x80 # dim text, bright background
|
| 21 |
+
|
| 22 |
+
class WinTerm(object):
|
| 23 |
+
|
| 24 |
+
def __init__(self):
|
| 25 |
+
self._default = win32.GetConsoleScreenBufferInfo(win32.STDOUT).wAttributes
|
| 26 |
+
self.set_attrs(self._default)
|
| 27 |
+
self._default_fore = self._fore
|
| 28 |
+
self._default_back = self._back
|
| 29 |
+
self._default_style = self._style
|
| 30 |
+
# In order to emulate LIGHT_EX in windows, we borrow the BRIGHT style.
|
| 31 |
+
# So that LIGHT_EX colors and BRIGHT style do not clobber each other,
|
| 32 |
+
# we track them separately, since LIGHT_EX is overwritten by Fore/Back
|
| 33 |
+
# and BRIGHT is overwritten by Style codes.
|
| 34 |
+
self._light = 0
|
| 35 |
+
|
| 36 |
+
def get_attrs(self):
|
| 37 |
+
return self._fore + self._back * 16 + (self._style | self._light)
|
| 38 |
+
|
| 39 |
+
def set_attrs(self, value):
|
| 40 |
+
self._fore = value & 7
|
| 41 |
+
self._back = (value >> 4) & 7
|
| 42 |
+
self._style = value & (WinStyle.BRIGHT | WinStyle.BRIGHT_BACKGROUND)
|
| 43 |
+
|
| 44 |
+
def reset_all(self, on_stderr=None):
|
| 45 |
+
self.set_attrs(self._default)
|
| 46 |
+
self.set_console(attrs=self._default)
|
| 47 |
+
self._light = 0
|
| 48 |
+
|
| 49 |
+
def fore(self, fore=None, light=False, on_stderr=False):
|
| 50 |
+
if fore is None:
|
| 51 |
+
fore = self._default_fore
|
| 52 |
+
self._fore = fore
|
| 53 |
+
# Emulate LIGHT_EX with BRIGHT Style
|
| 54 |
+
if light:
|
| 55 |
+
self._light |= WinStyle.BRIGHT
|
| 56 |
+
else:
|
| 57 |
+
self._light &= ~WinStyle.BRIGHT
|
| 58 |
+
self.set_console(on_stderr=on_stderr)
|
| 59 |
+
|
| 60 |
+
def back(self, back=None, light=False, on_stderr=False):
|
| 61 |
+
if back is None:
|
| 62 |
+
back = self._default_back
|
| 63 |
+
self._back = back
|
| 64 |
+
# Emulate LIGHT_EX with BRIGHT_BACKGROUND Style
|
| 65 |
+
if light:
|
| 66 |
+
self._light |= WinStyle.BRIGHT_BACKGROUND
|
| 67 |
+
else:
|
| 68 |
+
self._light &= ~WinStyle.BRIGHT_BACKGROUND
|
| 69 |
+
self.set_console(on_stderr=on_stderr)
|
| 70 |
+
|
| 71 |
+
def style(self, style=None, on_stderr=False):
|
| 72 |
+
if style is None:
|
| 73 |
+
style = self._default_style
|
| 74 |
+
self._style = style
|
| 75 |
+
self.set_console(on_stderr=on_stderr)
|
| 76 |
+
|
| 77 |
+
def set_console(self, attrs=None, on_stderr=False):
|
| 78 |
+
if attrs is None:
|
| 79 |
+
attrs = self.get_attrs()
|
| 80 |
+
handle = win32.STDOUT
|
| 81 |
+
if on_stderr:
|
| 82 |
+
handle = win32.STDERR
|
| 83 |
+
win32.SetConsoleTextAttribute(handle, attrs)
|
| 84 |
+
|
| 85 |
+
def get_position(self, handle):
|
| 86 |
+
position = win32.GetConsoleScreenBufferInfo(handle).dwCursorPosition
|
| 87 |
+
# Because Windows coordinates are 0-based,
|
| 88 |
+
# and win32.SetConsoleCursorPosition expects 1-based.
|
| 89 |
+
position.X += 1
|
| 90 |
+
position.Y += 1
|
| 91 |
+
return position
|
| 92 |
+
|
| 93 |
+
def set_cursor_position(self, position=None, on_stderr=False):
|
| 94 |
+
if position is None:
|
| 95 |
+
# I'm not currently tracking the position, so there is no default.
|
| 96 |
+
# position = self.get_position()
|
| 97 |
+
return
|
| 98 |
+
handle = win32.STDOUT
|
| 99 |
+
if on_stderr:
|
| 100 |
+
handle = win32.STDERR
|
| 101 |
+
win32.SetConsoleCursorPosition(handle, position)
|
| 102 |
+
|
| 103 |
+
def cursor_adjust(self, x, y, on_stderr=False):
|
| 104 |
+
handle = win32.STDOUT
|
| 105 |
+
if on_stderr:
|
| 106 |
+
handle = win32.STDERR
|
| 107 |
+
position = self.get_position(handle)
|
| 108 |
+
adjusted_position = (position.Y + y, position.X + x)
|
| 109 |
+
win32.SetConsoleCursorPosition(handle, adjusted_position, adjust=False)
|
| 110 |
+
|
| 111 |
+
def erase_screen(self, mode=0, on_stderr=False):
|
| 112 |
+
# 0 should clear from the cursor to the end of the screen.
|
| 113 |
+
# 1 should clear from the cursor to the beginning of the screen.
|
| 114 |
+
# 2 should clear the entire screen, and move cursor to (1,1)
|
| 115 |
+
handle = win32.STDOUT
|
| 116 |
+
if on_stderr:
|
| 117 |
+
handle = win32.STDERR
|
| 118 |
+
csbi = win32.GetConsoleScreenBufferInfo(handle)
|
| 119 |
+
# get the number of character cells in the current buffer
|
| 120 |
+
cells_in_screen = csbi.dwSize.X * csbi.dwSize.Y
|
| 121 |
+
# get number of character cells before current cursor position
|
| 122 |
+
cells_before_cursor = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X
|
| 123 |
+
if mode == 0:
|
| 124 |
+
from_coord = csbi.dwCursorPosition
|
| 125 |
+
cells_to_erase = cells_in_screen - cells_before_cursor
|
| 126 |
+
elif mode == 1:
|
| 127 |
+
from_coord = win32.COORD(0, 0)
|
| 128 |
+
cells_to_erase = cells_before_cursor
|
| 129 |
+
elif mode == 2:
|
| 130 |
+
from_coord = win32.COORD(0, 0)
|
| 131 |
+
cells_to_erase = cells_in_screen
|
| 132 |
+
else:
|
| 133 |
+
# invalid mode
|
| 134 |
+
return
|
| 135 |
+
# fill the entire screen with blanks
|
| 136 |
+
win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
|
| 137 |
+
# now set the buffer's attributes accordingly
|
| 138 |
+
win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
|
| 139 |
+
if mode == 2:
|
| 140 |
+
# put the cursor where needed
|
| 141 |
+
win32.SetConsoleCursorPosition(handle, (1, 1))
|
| 142 |
+
|
| 143 |
+
def erase_line(self, mode=0, on_stderr=False):
|
| 144 |
+
# 0 should clear from the cursor to the end of the line.
|
| 145 |
+
# 1 should clear from the cursor to the beginning of the line.
|
| 146 |
+
# 2 should clear the entire line.
|
| 147 |
+
handle = win32.STDOUT
|
| 148 |
+
if on_stderr:
|
| 149 |
+
handle = win32.STDERR
|
| 150 |
+
csbi = win32.GetConsoleScreenBufferInfo(handle)
|
| 151 |
+
if mode == 0:
|
| 152 |
+
from_coord = csbi.dwCursorPosition
|
| 153 |
+
cells_to_erase = csbi.dwSize.X - csbi.dwCursorPosition.X
|
| 154 |
+
elif mode == 1:
|
| 155 |
+
from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
|
| 156 |
+
cells_to_erase = csbi.dwCursorPosition.X
|
| 157 |
+
elif mode == 2:
|
| 158 |
+
from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
|
| 159 |
+
cells_to_erase = csbi.dwSize.X
|
| 160 |
+
else:
|
| 161 |
+
# invalid mode
|
| 162 |
+
return
|
| 163 |
+
# fill the entire screen with blanks
|
| 164 |
+
win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
|
| 165 |
+
# now set the buffer's attributes accordingly
|
| 166 |
+
win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
|
| 167 |
+
|
| 168 |
+
def set_title(self, title):
|
| 169 |
+
win32.SetConsoleTitle(title)
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__init__.py
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2012 Georgios Verigakis <verigak@gmail.com>
|
| 2 |
+
#
|
| 3 |
+
# Permission to use, copy, modify, and distribute this software for any
|
| 4 |
+
# purpose with or without fee is hereby granted, provided that the above
|
| 5 |
+
# copyright notice and this permission notice appear in all copies.
|
| 6 |
+
#
|
| 7 |
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
| 8 |
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
| 9 |
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
| 10 |
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
| 11 |
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| 12 |
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
| 13 |
+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
| 14 |
+
|
| 15 |
+
from __future__ import division, print_function
|
| 16 |
+
|
| 17 |
+
from collections import deque
|
| 18 |
+
from datetime import timedelta
|
| 19 |
+
from math import ceil
|
| 20 |
+
from sys import stderr
|
| 21 |
+
try:
|
| 22 |
+
from time import monotonic
|
| 23 |
+
except ImportError:
|
| 24 |
+
from time import time as monotonic
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
__version__ = '1.6'
|
| 28 |
+
|
| 29 |
+
HIDE_CURSOR = '\x1b[?25l'
|
| 30 |
+
SHOW_CURSOR = '\x1b[?25h'
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class Infinite(object):
|
| 34 |
+
file = stderr
|
| 35 |
+
sma_window = 10 # Simple Moving Average window
|
| 36 |
+
check_tty = True
|
| 37 |
+
hide_cursor = True
|
| 38 |
+
|
| 39 |
+
def __init__(self, message='', **kwargs):
|
| 40 |
+
self.index = 0
|
| 41 |
+
self.start_ts = monotonic()
|
| 42 |
+
self.avg = 0
|
| 43 |
+
self._avg_update_ts = self.start_ts
|
| 44 |
+
self._ts = self.start_ts
|
| 45 |
+
self._xput = deque(maxlen=self.sma_window)
|
| 46 |
+
for key, val in kwargs.items():
|
| 47 |
+
setattr(self, key, val)
|
| 48 |
+
|
| 49 |
+
self._max_width = 0
|
| 50 |
+
self._hidden_cursor = False
|
| 51 |
+
self.message = message
|
| 52 |
+
|
| 53 |
+
if self.file and self.is_tty():
|
| 54 |
+
if self.hide_cursor:
|
| 55 |
+
print(HIDE_CURSOR, end='', file=self.file)
|
| 56 |
+
self._hidden_cursor = True
|
| 57 |
+
self.writeln('')
|
| 58 |
+
|
| 59 |
+
def __del__(self):
|
| 60 |
+
if self._hidden_cursor:
|
| 61 |
+
print(SHOW_CURSOR, end='', file=self.file)
|
| 62 |
+
|
| 63 |
+
def __getitem__(self, key):
|
| 64 |
+
if key.startswith('_'):
|
| 65 |
+
return None
|
| 66 |
+
return getattr(self, key, None)
|
| 67 |
+
|
| 68 |
+
@property
|
| 69 |
+
def elapsed(self):
|
| 70 |
+
return int(monotonic() - self.start_ts)
|
| 71 |
+
|
| 72 |
+
@property
|
| 73 |
+
def elapsed_td(self):
|
| 74 |
+
return timedelta(seconds=self.elapsed)
|
| 75 |
+
|
| 76 |
+
def update_avg(self, n, dt):
|
| 77 |
+
if n > 0:
|
| 78 |
+
xput_len = len(self._xput)
|
| 79 |
+
self._xput.append(dt / n)
|
| 80 |
+
now = monotonic()
|
| 81 |
+
# update when we're still filling _xput, then after every second
|
| 82 |
+
if (xput_len < self.sma_window or
|
| 83 |
+
now - self._avg_update_ts > 1):
|
| 84 |
+
self.avg = sum(self._xput) / len(self._xput)
|
| 85 |
+
self._avg_update_ts = now
|
| 86 |
+
|
| 87 |
+
def update(self):
|
| 88 |
+
pass
|
| 89 |
+
|
| 90 |
+
def start(self):
|
| 91 |
+
pass
|
| 92 |
+
|
| 93 |
+
def writeln(self, line):
|
| 94 |
+
if self.file and self.is_tty():
|
| 95 |
+
width = len(line)
|
| 96 |
+
if width < self._max_width:
|
| 97 |
+
# Add padding to cover previous contents
|
| 98 |
+
line += ' ' * (self._max_width - width)
|
| 99 |
+
else:
|
| 100 |
+
self._max_width = width
|
| 101 |
+
print('\r' + line, end='', file=self.file)
|
| 102 |
+
self.file.flush()
|
| 103 |
+
|
| 104 |
+
def finish(self):
|
| 105 |
+
if self.file and self.is_tty():
|
| 106 |
+
print(file=self.file)
|
| 107 |
+
if self._hidden_cursor:
|
| 108 |
+
print(SHOW_CURSOR, end='', file=self.file)
|
| 109 |
+
self._hidden_cursor = False
|
| 110 |
+
|
| 111 |
+
def is_tty(self):
|
| 112 |
+
try:
|
| 113 |
+
return self.file.isatty() if self.check_tty else True
|
| 114 |
+
except AttributeError:
|
| 115 |
+
msg = "%s has no attribute 'isatty'. Try setting check_tty=False." % self
|
| 116 |
+
raise AttributeError(msg)
|
| 117 |
+
|
| 118 |
+
def next(self, n=1):
|
| 119 |
+
now = monotonic()
|
| 120 |
+
dt = now - self._ts
|
| 121 |
+
self.update_avg(n, dt)
|
| 122 |
+
self._ts = now
|
| 123 |
+
self.index = self.index + n
|
| 124 |
+
self.update()
|
| 125 |
+
|
| 126 |
+
def iter(self, it):
|
| 127 |
+
self.iter_value = None
|
| 128 |
+
with self:
|
| 129 |
+
for x in it:
|
| 130 |
+
self.iter_value = x
|
| 131 |
+
yield x
|
| 132 |
+
self.next()
|
| 133 |
+
del self.iter_value
|
| 134 |
+
|
| 135 |
+
def __enter__(self):
|
| 136 |
+
self.start()
|
| 137 |
+
return self
|
| 138 |
+
|
| 139 |
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
| 140 |
+
self.finish()
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
class Progress(Infinite):
|
| 144 |
+
def __init__(self, *args, **kwargs):
|
| 145 |
+
super(Progress, self).__init__(*args, **kwargs)
|
| 146 |
+
self.max = kwargs.get('max', 100)
|
| 147 |
+
|
| 148 |
+
@property
|
| 149 |
+
def eta(self):
|
| 150 |
+
return int(ceil(self.avg * self.remaining))
|
| 151 |
+
|
| 152 |
+
@property
|
| 153 |
+
def eta_td(self):
|
| 154 |
+
return timedelta(seconds=self.eta)
|
| 155 |
+
|
| 156 |
+
@property
|
| 157 |
+
def percent(self):
|
| 158 |
+
return self.progress * 100
|
| 159 |
+
|
| 160 |
+
@property
|
| 161 |
+
def progress(self):
|
| 162 |
+
if self.max == 0:
|
| 163 |
+
return 0
|
| 164 |
+
return min(1, self.index / self.max)
|
| 165 |
+
|
| 166 |
+
@property
|
| 167 |
+
def remaining(self):
|
| 168 |
+
return max(self.max - self.index, 0)
|
| 169 |
+
|
| 170 |
+
def start(self):
|
| 171 |
+
self.update()
|
| 172 |
+
|
| 173 |
+
def goto(self, index):
|
| 174 |
+
incr = index - self.index
|
| 175 |
+
self.next(incr)
|
| 176 |
+
|
| 177 |
+
def iter(self, it):
|
| 178 |
+
try:
|
| 179 |
+
self.max = len(it)
|
| 180 |
+
except TypeError:
|
| 181 |
+
pass
|
| 182 |
+
|
| 183 |
+
self.iter_value = None
|
| 184 |
+
with self:
|
| 185 |
+
for x in it:
|
| 186 |
+
self.iter_value = x
|
| 187 |
+
yield x
|
| 188 |
+
self.next()
|
| 189 |
+
del self.iter_value
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (5.78 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/bar.cpython-310.pyc
ADDED
|
Binary file (2.75 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/colors.cpython-310.pyc
ADDED
|
Binary file (1.54 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/counter.cpython-310.pyc
ADDED
|
Binary file (1.61 kB). View file
|
|
|
material/dataset/xpsdeeplearning/.venv/lib/python3.10/site-packages/pip/_vendor/progress/__pycache__/spinner.cpython-310.pyc
ADDED
|
Binary file (1.44 kB). View file
|
|
|