diff --git a/venv/bin/Activate.ps1 b/venv/bin/Activate.ps1 deleted file mode 100644 index a3bc6fb1f05bf96c284d2cba2508314d115ce7e3..0000000000000000000000000000000000000000 --- a/venv/bin/Activate.ps1 +++ /dev/null @@ -1,241 +0,0 @@ -<# -.Synopsis -Activate a Python virtual environment for the current PowerShell session. - -.Description -Pushes the python executable for a virtual environment to the front of the -$Env:PATH environment variable and sets the prompt to signify that you are -in a Python virtual environment. Makes use of the command line switches as -well as the `pyvenv.cfg` file values present in the virtual environment. - -.Parameter VenvDir -Path to the directory that contains the virtual environment to activate. The -default value for this is the parent of the directory that the Activate.ps1 -script is located within. - -.Parameter Prompt -The prompt prefix to display when this virtual environment is activated. By -default, this prompt is the name of the virtual environment folder (VenvDir) -surrounded by parentheses and followed by a single space (ie. '(.venv) '). - -.Example -Activate.ps1 -Activates the Python virtual environment that contains the Activate.ps1 script. - -.Example -Activate.ps1 -Verbose -Activates the Python virtual environment that contains the Activate.ps1 script, -and shows extra information about the activation as it executes. - -.Example -Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv -Activates the Python virtual environment located in the specified location. - -.Example -Activate.ps1 -Prompt "MyPython" -Activates the Python virtual environment that contains the Activate.ps1 script, -and prefixes the current prompt with the specified string (surrounded in -parentheses) while the virtual environment is active. - -.Notes -On Windows, it may be required to enable this Activate.ps1 script by setting the -execution policy for the user. You can do this by issuing the following PowerShell -command: - -PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - -For more information on Execution Policies: -https://go.microsoft.com/fwlink/?LinkID=135170 - -#> -Param( - [Parameter(Mandatory = $false)] - [String] - $VenvDir, - [Parameter(Mandatory = $false)] - [String] - $Prompt -) - -<# Function declarations --------------------------------------------------- #> - -<# -.Synopsis -Remove all shell session elements added by the Activate script, including the -addition of the virtual environment's Python executable from the beginning of -the PATH variable. - -.Parameter NonDestructive -If present, do not remove this function from the global namespace for the -session. - -#> -function global:deactivate ([switch]$NonDestructive) { - # Revert to original values - - # The prior prompt: - if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { - Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt - Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT - } - - # The prior PYTHONHOME: - if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { - Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME - Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME - } - - # The prior PATH: - if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { - Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH - Remove-Item -Path Env:_OLD_VIRTUAL_PATH - } - - # Just remove the VIRTUAL_ENV altogether: - if (Test-Path -Path Env:VIRTUAL_ENV) { - Remove-Item -Path env:VIRTUAL_ENV - } - - # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: - if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { - Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force - } - - # Leave deactivate function in the global namespace if requested: - if (-not $NonDestructive) { - Remove-Item -Path function:deactivate - } -} - -<# -.Description -Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the -given folder, and returns them in a map. - -For each line in the pyvenv.cfg file, if that line can be parsed into exactly -two strings separated by `=` (with any amount of whitespace surrounding the =) -then it is considered a `key = value` line. The left hand string is the key, -the right hand is the value. - -If the value starts with a `'` or a `"` then the first and last character is -stripped from the value before being captured. - -.Parameter ConfigDir -Path to the directory that contains the `pyvenv.cfg` file. -#> -function Get-PyVenvConfig( - [String] - $ConfigDir -) { - Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" - - # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). - $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue - - # An empty map will be returned if no config file is found. - $pyvenvConfig = @{ } - - if ($pyvenvConfigPath) { - - Write-Verbose "File exists, parse `key = value` lines" - $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath - - $pyvenvConfigContent | ForEach-Object { - $keyval = $PSItem -split "\s*=\s*", 2 - if ($keyval[0] -and $keyval[1]) { - $val = $keyval[1] - - # Remove extraneous quotations around a string value. - if ("'""".Contains($val.Substring(0, 1))) { - $val = $val.Substring(1, $val.Length - 2) - } - - $pyvenvConfig[$keyval[0]] = $val - Write-Verbose "Adding Key: '$($keyval[0])'='$val'" - } - } - } - return $pyvenvConfig -} - - -<# Begin Activate script --------------------------------------------------- #> - -# Determine the containing directory of this script -$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition -$VenvExecDir = Get-Item -Path $VenvExecPath - -Write-Verbose "Activation script is located in path: '$VenvExecPath'" -Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" -Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" - -# Set values required in priority: CmdLine, ConfigFile, Default -# First, get the location of the virtual environment, it might not be -# VenvExecDir if specified on the command line. -if ($VenvDir) { - Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" -} -else { - Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." - $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") - Write-Verbose "VenvDir=$VenvDir" -} - -# Next, read the `pyvenv.cfg` file to determine any required value such -# as `prompt`. -$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir - -# Next, set the prompt from the command line, or the config file, or -# just use the name of the virtual environment folder. -if ($Prompt) { - Write-Verbose "Prompt specified as argument, using '$Prompt'" -} -else { - Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" - if ($pyvenvCfg -and $pyvenvCfg['prompt']) { - Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" - $Prompt = $pyvenvCfg['prompt']; - } - else { - Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virutal environment)" - Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" - $Prompt = Split-Path -Path $venvDir -Leaf - } -} - -Write-Verbose "Prompt = '$Prompt'" -Write-Verbose "VenvDir='$VenvDir'" - -# Deactivate any currently active virtual environment, but leave the -# deactivate function in place. -deactivate -nondestructive - -# Now set the environment variable VIRTUAL_ENV, used by many tools to determine -# that there is an activated venv. -$env:VIRTUAL_ENV = $VenvDir - -if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { - - Write-Verbose "Setting prompt to '$Prompt'" - - # Set the prompt to include the env name - # Make sure _OLD_VIRTUAL_PROMPT is global - function global:_OLD_VIRTUAL_PROMPT { "" } - Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT - New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt - - function global:prompt { - Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " - _OLD_VIRTUAL_PROMPT - } -} - -# Clear PYTHONHOME -if (Test-Path -Path Env:PYTHONHOME) { - Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME - Remove-Item -Path Env:PYTHONHOME -} - -# Add the venv to the PATH -Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH -$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/venv/bin/activate b/venv/bin/activate deleted file mode 100644 index 5422bd37fbd7ca832027d7870703992c9b32a59e..0000000000000000000000000000000000000000 --- a/venv/bin/activate +++ /dev/null @@ -1,76 +0,0 @@ -# This file must be used with "source bin/activate" *from bash* -# you cannot run it directly - -deactivate () { - # reset old environment variables - if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then - PATH="${_OLD_VIRTUAL_PATH:-}" - export PATH - unset _OLD_VIRTUAL_PATH - fi - if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then - PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" - export PYTHONHOME - unset _OLD_VIRTUAL_PYTHONHOME - fi - - # This should detect bash and zsh, which have a hash command that must - # be called to get it to forget past commands. Without forgetting - # past commands the $PATH changes we made may not be respected - if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then - hash -r - fi - - if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then - PS1="${_OLD_VIRTUAL_PS1:-}" - export PS1 - unset _OLD_VIRTUAL_PS1 - fi - - unset VIRTUAL_ENV - if [ ! "${1:-}" = "nondestructive" ] ; then - # Self destruct! - unset -f deactivate - fi -} - -# unset irrelevant variables -deactivate nondestructive - -VIRTUAL_ENV="/home/clairebarale/refugee_cases_ner/venv" -export VIRTUAL_ENV - -_OLD_VIRTUAL_PATH="$PATH" -PATH="$VIRTUAL_ENV/bin:$PATH" -export PATH - -# unset PYTHONHOME if set -# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) -# could use `if (set -u; : $PYTHONHOME) ;` in bash -if [ -n "${PYTHONHOME:-}" ] ; then - _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" - unset PYTHONHOME -fi - -if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then - _OLD_VIRTUAL_PS1="${PS1:-}" - if [ "x(venv) " != x ] ; then - PS1="(venv) ${PS1:-}" - else - if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then - # special case for Aspen magic directories - # see https://aspen.io/ - PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" - else - PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" - fi - fi - export PS1 -fi - -# This should detect bash and zsh, which have a hash command that must -# be called to get it to forget past commands. Without forgetting -# past commands the $PATH changes we made may not be respected -if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then - hash -r -fi diff --git a/venv/bin/activate.csh b/venv/bin/activate.csh deleted file mode 100644 index e7605995b59f6d9dc56f7635cbaf51945cf446f6..0000000000000000000000000000000000000000 --- a/venv/bin/activate.csh +++ /dev/null @@ -1,37 +0,0 @@ -# This file must be used with "source bin/activate.csh" *from csh*. -# You cannot run it directly. -# Created by Davide Di Blasi . -# Ported to Python 3.3 venv by Andrew Svetlov - -alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' - -# Unset irrelevant variables. -deactivate nondestructive - -setenv VIRTUAL_ENV "/home/clairebarale/refugee_cases_ner/venv" - -set _OLD_VIRTUAL_PATH="$PATH" -setenv PATH "$VIRTUAL_ENV/bin:$PATH" - - -set _OLD_VIRTUAL_PROMPT="$prompt" - -if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - if ("venv" != "") then - set env_name = "venv" - else - if (`basename "VIRTUAL_ENV"` == "__") then - # special case for Aspen magic directories - # see https://aspen.io/ - set env_name = `basename \`dirname "$VIRTUAL_ENV"\`` - else - set env_name = `basename "$VIRTUAL_ENV"` - endif - endif - set prompt = "[$env_name] $prompt" - unset env_name -endif - -alias pydoc python -m pydoc - -rehash diff --git a/venv/bin/activate.fish b/venv/bin/activate.fish deleted file mode 100644 index 1568441db1e7da7990e68100419bb80033bd4733..0000000000000000000000000000000000000000 --- a/venv/bin/activate.fish +++ /dev/null @@ -1,75 +0,0 @@ -# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org) -# you cannot run it directly - -function deactivate -d "Exit virtualenv and return to normal shell environment" - # reset old environment variables - if test -n "$_OLD_VIRTUAL_PATH" - set -gx PATH $_OLD_VIRTUAL_PATH - set -e _OLD_VIRTUAL_PATH - end - if test -n "$_OLD_VIRTUAL_PYTHONHOME" - set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME - set -e _OLD_VIRTUAL_PYTHONHOME - end - - if test -n "$_OLD_FISH_PROMPT_OVERRIDE" - functions -e fish_prompt - set -e _OLD_FISH_PROMPT_OVERRIDE - functions -c _old_fish_prompt fish_prompt - functions -e _old_fish_prompt - end - - set -e VIRTUAL_ENV - if test "$argv[1]" != "nondestructive" - # Self destruct! - functions -e deactivate - end -end - -# unset irrelevant variables -deactivate nondestructive - -set -gx VIRTUAL_ENV "/home/clairebarale/refugee_cases_ner/venv" - -set -gx _OLD_VIRTUAL_PATH $PATH -set -gx PATH "$VIRTUAL_ENV/bin" $PATH - -# unset PYTHONHOME if set -if set -q PYTHONHOME - set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME - set -e PYTHONHOME -end - -if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" - # fish uses a function instead of an env var to generate the prompt. - - # save the current fish_prompt function as the function _old_fish_prompt - functions -c fish_prompt _old_fish_prompt - - # with the original prompt function renamed, we can override with our own. - function fish_prompt - # Save the return status of the last command - set -l old_status $status - - # Prompt override? - if test -n "(venv) " - printf "%s%s" "(venv) " (set_color normal) - else - # ...Otherwise, prepend env - set -l _checkbase (basename "$VIRTUAL_ENV") - if test $_checkbase = "__" - # special case for Aspen magic directories - # see https://aspen.io/ - printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) - else - printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) - end - end - - # Restore the return status of the previous command. - echo "exit $old_status" | . - _old_fish_prompt - end - - set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" -end diff --git a/venv/bin/easy_install b/venv/bin/easy_install deleted file mode 100644 index 85a9ccf9468a20c28495b5054211d72f8e1c731f..0000000000000000000000000000000000000000 --- a/venv/bin/easy_install +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/clairebarale/refugee_cases_ner/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from setuptools.command.easy_install import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/venv/bin/easy_install-3.8 b/venv/bin/easy_install-3.8 deleted file mode 100644 index 85a9ccf9468a20c28495b5054211d72f8e1c731f..0000000000000000000000000000000000000000 --- a/venv/bin/easy_install-3.8 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/clairebarale/refugee_cases_ner/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from setuptools.command.easy_install import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/venv/bin/huggingface-cli b/venv/bin/huggingface-cli deleted file mode 100644 index 4624e4aaf7973712289bcbbf23b1834ce4a780ff..0000000000000000000000000000000000000000 --- a/venv/bin/huggingface-cli +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/clairebarale/refugee_cases_ner/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from huggingface_hub.commands.huggingface_cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/venv/bin/normalizer b/venv/bin/normalizer deleted file mode 100644 index e8a93cca5be5c53df150abf9e026de3a126cdf80..0000000000000000000000000000000000000000 --- a/venv/bin/normalizer +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/clairebarale/refugee_cases_ner/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from charset_normalizer.cli import cli_detect -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli_detect()) diff --git a/venv/bin/pip b/venv/bin/pip deleted file mode 100644 index 614d575cc06e98b1210ee3783fee6a50d688cba8..0000000000000000000000000000000000000000 --- a/venv/bin/pip +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/clairebarale/refugee_cases_ner/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/venv/bin/pip3 b/venv/bin/pip3 deleted file mode 100644 index 614d575cc06e98b1210ee3783fee6a50d688cba8..0000000000000000000000000000000000000000 --- a/venv/bin/pip3 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/clairebarale/refugee_cases_ner/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/venv/bin/pip3.8 b/venv/bin/pip3.8 deleted file mode 100644 index 614d575cc06e98b1210ee3783fee6a50d688cba8..0000000000000000000000000000000000000000 --- a/venv/bin/pip3.8 +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/clairebarale/refugee_cases_ner/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/venv/bin/python b/venv/bin/python deleted file mode 100644 index d7710722a606ad0fd2737998e58399d69963c239..0000000000000000000000000000000000000000 --- a/venv/bin/python +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0c7e43bc5123d4e89c45a854ac8906c0f93c9f436d699e4114c3385288878481 -size 5494584 diff --git a/venv/bin/python3 b/venv/bin/python3 deleted file mode 100644 index d7710722a606ad0fd2737998e58399d69963c239..0000000000000000000000000000000000000000 --- a/venv/bin/python3 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0c7e43bc5123d4e89c45a854ac8906c0f93c9f436d699e4114c3385288878481 -size 5494584 diff --git a/venv/bin/tqdm b/venv/bin/tqdm deleted file mode 100644 index 91e406c766ffd5ba5327da9f6f31ff48993d9cc9..0000000000000000000000000000000000000000 --- a/venv/bin/tqdm +++ /dev/null @@ -1,8 +0,0 @@ -#!/home/clairebarale/refugee_cases_ner/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from tqdm.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/LICENSE b/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/LICENSE deleted file mode 100644 index 2f1b8e15e5627d92f0521605c9870bc8e5505cb4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2017-2021 Ingy döt Net -Copyright (c) 2006-2016 Kirill Simonov - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/METADATA b/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/METADATA deleted file mode 100644 index c8905983e369893f68879f4cdfb7290d54d5f822..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/METADATA +++ /dev/null @@ -1,46 +0,0 @@ -Metadata-Version: 2.1 -Name: PyYAML -Version: 6.0.1 -Summary: YAML parser and emitter for Python -Home-page: https://pyyaml.org/ -Download-URL: https://pypi.org/project/PyYAML/ -Author: Kirill Simonov -Author-email: xi@resolvent.net -License: MIT -Project-URL: Bug Tracker, https://github.com/yaml/pyyaml/issues -Project-URL: CI, https://github.com/yaml/pyyaml/actions -Project-URL: Documentation, https://pyyaml.org/wiki/PyYAMLDocumentation -Project-URL: Mailing lists, http://lists.sourceforge.net/lists/listinfo/yaml-core -Project-URL: Source Code, https://github.com/yaml/pyyaml -Platform: Any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Cython -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Text Processing :: Markup -Requires-Python: >=3.6 -License-File: LICENSE - -YAML is a data serialization format designed for human readability -and interaction with scripting languages. PyYAML is a YAML parser -and emitter for Python. - -PyYAML features a complete YAML 1.1 parser, Unicode support, pickle -support, capable extension API, and sensible error messages. PyYAML -supports standard YAML tags and provides Python-specific tags that -allow to represent an arbitrary Python object. - -PyYAML is applicable for a broad range of tasks from complex -configuration files to object serialization and persistence. diff --git a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/RECORD b/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/RECORD deleted file mode 100644 index a5d4dc68c94b3569109b2cdeeab2316301de08ac..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/RECORD +++ /dev/null @@ -1,43 +0,0 @@ -PyYAML-6.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -PyYAML-6.0.1.dist-info/LICENSE,sha256=jTko-dxEkP1jVwfLiOsmvXZBAqcoKVQwfT5RZ6V36KQ,1101 -PyYAML-6.0.1.dist-info/METADATA,sha256=UNNF8-SzzwOKXVo-kV5lXUGH2_wDWMBmGxqISpp5HQk,2058 -PyYAML-6.0.1.dist-info/RECORD,, -PyYAML-6.0.1.dist-info/WHEEL,sha256=5DQRW5VdkIxH8e7ylwa-YBCXLhSZeqHiz1ZmuOscrlo,148 -PyYAML-6.0.1.dist-info/top_level.txt,sha256=rpj0IVMTisAjh_1vG3Ccf9v5jpCQwAz6cD1IVU5ZdhQ,11 -_yaml/__init__.py,sha256=04Ae_5osxahpJHa3XBZUAf4wi6XX32gR8D6X6p64GEA,1402 -_yaml/__pycache__/__init__.cpython-38.pyc,, -yaml/__init__.py,sha256=bhl05qSeO-1ZxlSRjGrvl2m9nrXb1n9-GQatTN0Mrqc,12311 -yaml/__pycache__/__init__.cpython-38.pyc,, -yaml/__pycache__/composer.cpython-38.pyc,, -yaml/__pycache__/constructor.cpython-38.pyc,, -yaml/__pycache__/cyaml.cpython-38.pyc,, -yaml/__pycache__/dumper.cpython-38.pyc,, -yaml/__pycache__/emitter.cpython-38.pyc,, -yaml/__pycache__/error.cpython-38.pyc,, -yaml/__pycache__/events.cpython-38.pyc,, -yaml/__pycache__/loader.cpython-38.pyc,, -yaml/__pycache__/nodes.cpython-38.pyc,, -yaml/__pycache__/parser.cpython-38.pyc,, -yaml/__pycache__/reader.cpython-38.pyc,, -yaml/__pycache__/representer.cpython-38.pyc,, -yaml/__pycache__/resolver.cpython-38.pyc,, -yaml/__pycache__/scanner.cpython-38.pyc,, -yaml/__pycache__/serializer.cpython-38.pyc,, -yaml/__pycache__/tokens.cpython-38.pyc,, -yaml/_yaml.cpython-38-x86_64-linux-gnu.so,sha256=LYS21yWcRUufTfHxLGpF3exE0PjGxwDNtmYGassqUJk,2397464 -yaml/composer.py,sha256=_Ko30Wr6eDWUeUpauUGT3Lcg9QPBnOPVlTnIMRGJ9FM,4883 -yaml/constructor.py,sha256=kNgkfaeLUkwQYY_Q6Ff1Tz2XVw_pG1xVE9Ak7z-viLA,28639 -yaml/cyaml.py,sha256=6ZrAG9fAYvdVe2FK_w0hmXoG7ZYsoYUwapG8CiC72H0,3851 -yaml/dumper.py,sha256=PLctZlYwZLp7XmeUdwRuv4nYOZ2UBnDIUy8-lKfLF-o,2837 -yaml/emitter.py,sha256=jghtaU7eFwg31bG0B7RZea_29Adi9CKmXq_QjgQpCkQ,43006 -yaml/error.py,sha256=Ah9z-toHJUbE9j-M8YpxgSRM5CgLCcwVzJgLLRF2Fxo,2533 -yaml/events.py,sha256=50_TksgQiE4up-lKo_V-nBy-tAIxkIPQxY5qDhKCeHw,2445 -yaml/loader.py,sha256=UVa-zIqmkFSCIYq_PgSGm4NSJttHY2Rf_zQ4_b1fHN0,2061 -yaml/nodes.py,sha256=gPKNj8pKCdh2d4gr3gIYINnPOaOxGhJAUiYhGRnPE84,1440 -yaml/parser.py,sha256=ilWp5vvgoHFGzvOZDItFoGjD6D42nhlZrZyjAwa0oJo,25495 -yaml/reader.py,sha256=0dmzirOiDG4Xo41RnuQS7K9rkY3xjHiVasfDMNTqCNw,6794 -yaml/representer.py,sha256=IuWP-cAW9sHKEnS0gCqSa894k1Bg4cgTxaDwIcbRQ-Y,14190 -yaml/resolver.py,sha256=9L-VYfm4mWHxUD1Vg4X7rjDRK_7VZd6b92wzq7Y2IKY,9004 -yaml/scanner.py,sha256=YEM3iLZSaQwXcQRg2l2R4MdT0zGP2F9eHkKGKnHyWQY,51279 -yaml/serializer.py,sha256=ChuFgmhU01hj4xgI8GaKv6vfM2Bujwa9i7d2FAHj7cA,4165 -yaml/tokens.py,sha256=lTQIzSVw8Mg9wv459-TjiOQe6wVziqaRlqX2_89rp54,2573 diff --git a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/WHEEL b/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/WHEEL deleted file mode 100644 index 4133c42cc8b5944c92213b6765295c90c2ae81b3..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.40.0) -Root-Is-Purelib: false -Tag: cp38-cp38-manylinux_2_17_x86_64 -Tag: cp38-cp38-manylinux2014_x86_64 - diff --git a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/top_level.txt deleted file mode 100644 index e6475e911f628412049bc4090d86f23ac403adde..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/PyYAML-6.0.1.dist-info/top_level.txt +++ /dev/null @@ -1,2 +0,0 @@ -_yaml -yaml diff --git a/venv/lib/python3.8/site-packages/__pycache__/easy_install.cpython-38.pyc b/venv/lib/python3.8/site-packages/__pycache__/easy_install.cpython-38.pyc deleted file mode 100644 index 639843aff50da3206087b881adec65674b81115f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/__pycache__/easy_install.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/__pycache__/typing_extensions.cpython-38.pyc b/venv/lib/python3.8/site-packages/__pycache__/typing_extensions.cpython-38.pyc deleted file mode 100644 index c8e9152b3bc4d5a43890d08a40425aae634a9822..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/__pycache__/typing_extensions.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/_yaml/__init__.py b/venv/lib/python3.8/site-packages/_yaml/__init__.py deleted file mode 100644 index 7baa8c4b68127d5cdf0be9a799429e61347c2694..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/_yaml/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# This is a stub package designed to roughly emulate the _yaml -# extension module, which previously existed as a standalone module -# and has been moved into the `yaml` package namespace. -# It does not perfectly mimic its old counterpart, but should get -# close enough for anyone who's relying on it even when they shouldn't. -import yaml - -# in some circumstances, the yaml module we imoprted may be from a different version, so we need -# to tread carefully when poking at it here (it may not have the attributes we expect) -if not getattr(yaml, '__with_libyaml__', False): - from sys import version_info - - exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError - raise exc("No module named '_yaml'") -else: - from yaml._yaml import * - import warnings - warnings.warn( - 'The _yaml extension module is now located at yaml._yaml' - ' and its location is subject to change. To use the' - ' LibYAML-based parser and emitter, import from `yaml`:' - ' `from yaml import CLoader as Loader, CDumper as Dumper`.', - DeprecationWarning - ) - del warnings - # Don't `del yaml` here because yaml is actually an existing - # namespace member of _yaml. - -__name__ = '_yaml' -# If the module is top-level (i.e. not a part of any specific package) -# then the attribute should be set to ''. -# https://docs.python.org/3.8/library/types.html -__package__ = '' diff --git a/venv/lib/python3.8/site-packages/_yaml/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/_yaml/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index b4cbb5c8faec17ac7ac6a767c396df847a52113b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/_yaml/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/LICENSE b/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/LICENSE deleted file mode 100644 index 0a64774eabe6b51f6fec2eeaf9875fc0f5e668e6..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -This package contains a modified version of ca-bundle.crt: - -ca-bundle.crt -- Bundle of CA Root Certificates - -Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011# -This is a bundle of X.509 certificates of public Certificate Authorities -(CA). These were automatically extracted from Mozilla's root certificates -file (certdata.txt). This file can be found in the mozilla source tree: -https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt -It contains the certificates in PEM format and therefore -can be directly used with curl / libcurl / php_curl, or with -an Apache+mod_ssl webserver for SSL client authentication. -Just configure this file as the SSLCACertificateFile.# - -***** BEGIN LICENSE BLOCK ***** -This Source Code Form is subject to the terms of the Mozilla Public License, -v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain -one at http://mozilla.org/MPL/2.0/. - -***** END LICENSE BLOCK ***** -@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $ diff --git a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/METADATA b/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/METADATA deleted file mode 100644 index 07f4991b71caa744c459bb7154e7ca31e4252d3c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/METADATA +++ /dev/null @@ -1,69 +0,0 @@ -Metadata-Version: 2.1 -Name: certifi -Version: 2023.7.22 -Summary: Python package for providing Mozilla's CA Bundle. -Home-page: https://github.com/certifi/python-certifi -Author: Kenneth Reitz -Author-email: me@kennethreitz.com -License: MPL-2.0 -Project-URL: Source, https://github.com/certifi/python-certifi -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) -Classifier: Natural Language :: English -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Requires-Python: >=3.6 -License-File: LICENSE - -Certifi: Python SSL Certificates -================================ - -Certifi provides Mozilla's carefully curated collection of Root Certificates for -validating the trustworthiness of SSL certificates while verifying the identity -of TLS hosts. It has been extracted from the `Requests`_ project. - -Installation ------------- - -``certifi`` is available on PyPI. Simply install it with ``pip``:: - - $ pip install certifi - -Usage ------ - -To reference the installed certificate authority (CA) bundle, you can use the -built-in function:: - - >>> import certifi - - >>> certifi.where() - '/usr/local/lib/python3.7/site-packages/certifi/cacert.pem' - -Or from the command line:: - - $ python -m certifi - /usr/local/lib/python3.7/site-packages/certifi/cacert.pem - -Enjoy! - -.. _`Requests`: https://requests.readthedocs.io/en/master/ - -Addition/Removal of Certificates --------------------------------- - -Certifi does not support any addition/removal or other modification of the -CA trust store content. This project is intended to provide a reliable and -highly portable root of trust to python deployments. Look to upstream projects -for methods to use alternate trust. - - diff --git a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/RECORD b/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/RECORD deleted file mode 100644 index 66e3474d1cc8afa060f6d7cf337a6986c213242e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/RECORD +++ /dev/null @@ -1,14 +0,0 @@ -certifi-2023.7.22.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -certifi-2023.7.22.dist-info/LICENSE,sha256=oC9sY4-fuE0G93ZMOrCF2K9-2luTwWbaVDEkeQd8b7A,1052 -certifi-2023.7.22.dist-info/METADATA,sha256=oyc8gd32SOVo0IGolt8-bR7FnZ9Z99GoHoGE6ACcvFA,2191 -certifi-2023.7.22.dist-info/RECORD,, -certifi-2023.7.22.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 -certifi-2023.7.22.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8 -certifi/__init__.py,sha256=L_j-d0kYuA_MzA2_2hraF1ovf6KT6DTquRdV3paQwOk,94 -certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243 -certifi/__pycache__/__init__.cpython-38.pyc,, -certifi/__pycache__/__main__.cpython-38.pyc,, -certifi/__pycache__/core.cpython-38.pyc,, -certifi/cacert.pem,sha256=eU0Dn_3yd8BH4m8sfVj4Glhl2KDrcCSg-sEWT-pNJ88,281617 -certifi/core.py,sha256=lhewz0zFb2b4ULsQurElmloYwQoecjWzPqY67P8T7iM,4219 -certifi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/WHEEL b/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/WHEEL deleted file mode 100644 index 5bad85fdc1cd08553756d0fb2c7be8b5ad6af7fb..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/top_level.txt deleted file mode 100644 index 963eac530b9bc28d704d1bc410299c68e3216d4d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi-2023.7.22.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -certifi diff --git a/venv/lib/python3.8/site-packages/certifi/__init__.py b/venv/lib/python3.8/site-packages/certifi/__init__.py deleted file mode 100644 index 8ce89cef706adc0d08fc4de5625a495e4003798e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .core import contents, where - -__all__ = ["contents", "where"] -__version__ = "2023.07.22" diff --git a/venv/lib/python3.8/site-packages/certifi/__main__.py b/venv/lib/python3.8/site-packages/certifi/__main__.py deleted file mode 100644 index 8945b5da857f4a7dec2b84f1225f012f6098418c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi/__main__.py +++ /dev/null @@ -1,12 +0,0 @@ -import argparse - -from certifi import contents, where - -parser = argparse.ArgumentParser() -parser.add_argument("-c", "--contents", action="store_true") -args = parser.parse_args() - -if args.contents: - print(contents()) -else: - print(where()) diff --git a/venv/lib/python3.8/site-packages/certifi/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/certifi/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index e4c60faf9d37832b6a5feae7ba9f6e6a9c3617b5..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/certifi/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/certifi/__pycache__/__main__.cpython-38.pyc b/venv/lib/python3.8/site-packages/certifi/__pycache__/__main__.cpython-38.pyc deleted file mode 100644 index 2623d40da83398b76f4135993da6abdee4bad1be..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/certifi/__pycache__/__main__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/certifi/__pycache__/core.cpython-38.pyc b/venv/lib/python3.8/site-packages/certifi/__pycache__/core.cpython-38.pyc deleted file mode 100644 index 15feddf7d793b555daa5799d06cf579ef9c2f075..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/certifi/__pycache__/core.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/certifi/cacert.pem b/venv/lib/python3.8/site-packages/certifi/cacert.pem deleted file mode 100644 index 02123695d01e8b7776994129cff8b99f0dd85fcc..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi/cacert.pem +++ /dev/null @@ -1,4635 +0,0 @@ - -# Issuer: CN=GlobalSign Root CA O=GlobalSign nv-sa OU=Root CA -# Subject: CN=GlobalSign Root CA O=GlobalSign nv-sa OU=Root CA -# Label: "GlobalSign Root CA" -# Serial: 4835703278459707669005204 -# MD5 Fingerprint: 3e:45:52:15:09:51:92:e1:b7:5d:37:9f:b1:87:29:8a -# SHA1 Fingerprint: b1:bc:96:8b:d4:f4:9d:62:2a:a8:9a:81:f2:15:01:52:a4:1d:82:9c -# SHA256 Fingerprint: eb:d4:10:40:e4:bb:3e:c7:42:c9:e3:81:d3:1e:f2:a4:1a:48:b6:68:5c:96:e7:ce:f3:c1:df:6c:d4:33:1c:99 ------BEGIN CERTIFICATE----- -MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG -A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv -b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw -MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i -YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT -aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ -jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp -xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp -1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG -snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ -U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 -9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B -AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz -yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE -38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP -AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad -DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME -HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== ------END CERTIFICATE----- - -# Issuer: CN=Entrust.net Certification Authority (2048) O=Entrust.net OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited -# Subject: CN=Entrust.net Certification Authority (2048) O=Entrust.net OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited -# Label: "Entrust.net Premium 2048 Secure Server CA" -# Serial: 946069240 -# MD5 Fingerprint: ee:29:31:bc:32:7e:9a:e6:e8:b5:f7:51:b4:34:71:90 -# SHA1 Fingerprint: 50:30:06:09:1d:97:d4:f5:ae:39:f7:cb:e7:92:7d:7d:65:2d:34:31 -# SHA256 Fingerprint: 6d:c4:71:72:e0:1c:bc:b0:bf:62:58:0d:89:5f:e2:b8:ac:9a:d4:f8:73:80:1e:0c:10:b9:c8:37:d2:1e:b1:77 ------BEGIN CERTIFICATE----- -MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML -RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp -bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 -IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3 -MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 -LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp -YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG -A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq -K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe -sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX -MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT -XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ -HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH -4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub -j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo -U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf -zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b -u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+ -bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er -fF6adulZkMV8gzURZVE= ------END CERTIFICATE----- - -# Issuer: CN=Baltimore CyberTrust Root O=Baltimore OU=CyberTrust -# Subject: CN=Baltimore CyberTrust Root O=Baltimore OU=CyberTrust -# Label: "Baltimore CyberTrust Root" -# Serial: 33554617 -# MD5 Fingerprint: ac:b6:94:a5:9c:17:e0:d7:91:52:9b:b1:97:06:a6:e4 -# SHA1 Fingerprint: d4:de:20:d0:5e:66:fc:53:fe:1a:50:88:2c:78:db:28:52:ca:e4:74 -# SHA256 Fingerprint: 16:af:57:a9:f6:76:b0:ab:12:60:95:aa:5e:ba:de:f2:2a:b3:11:19:d6:44:ac:95:cd:4b:93:db:f3:f2:6a:eb ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ -RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD -VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX -DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y -ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy -VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr -mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr -IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK -mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu -XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy -dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye -jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 -BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 -DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 -9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx -jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 -Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz -ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS -R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp ------END CERTIFICATE----- - -# Issuer: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. -# Subject: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. -# Label: "Entrust Root Certification Authority" -# Serial: 1164660820 -# MD5 Fingerprint: d6:a5:c3:ed:5d:dd:3e:00:c1:3d:87:92:1f:1d:3f:e4 -# SHA1 Fingerprint: b3:1e:b1:b7:40:e3:6c:84:02:da:dc:37:d4:4d:f5:d4:67:49:52:f9 -# SHA256 Fingerprint: 73:c1:76:43:4f:1b:c6:d5:ad:f4:5b:0e:76:e7:27:28:7c:8d:e5:76:16:c1:e6:e6:14:1a:2b:2c:bc:7d:8e:4c ------BEGIN CERTIFICATE----- -MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 -Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW -KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl -cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw -NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw -NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy -ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV -BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ -KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo -Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 -4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 -KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI -rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi -94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB -sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi -gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo -kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE -vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA -A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t -O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua -AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP -9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ -eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m -0vdXcDazv/wor3ElhVsT/h5/WrQ8 ------END CERTIFICATE----- - -# Issuer: CN=AAA Certificate Services O=Comodo CA Limited -# Subject: CN=AAA Certificate Services O=Comodo CA Limited -# Label: "Comodo AAA Services root" -# Serial: 1 -# MD5 Fingerprint: 49:79:04:b0:eb:87:19:ac:47:b0:bc:11:51:9b:74:d0 -# SHA1 Fingerprint: d1:eb:23:a4:6d:17:d6:8f:d9:25:64:c2:f1:f1:60:17:64:d8:e3:49 -# SHA256 Fingerprint: d7:a7:a0:fb:5d:7e:27:31:d7:71:e9:48:4e:bc:de:f7:1d:5f:0c:3e:0a:29:48:78:2b:c8:3e:e0:ea:69:9e:f4 ------BEGIN CERTIFICATE----- -MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb -MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow -GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj -YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL -MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE -BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM -GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua -BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe -3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 -YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR -rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm -ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU -oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF -MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v -QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t -b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF -AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q -GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz -Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 -G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi -l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 -smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 2 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 2 O=QuoVadis Limited -# Label: "QuoVadis Root CA 2" -# Serial: 1289 -# MD5 Fingerprint: 5e:39:7b:dd:f8:ba:ec:82:e9:ac:62:ba:0c:54:00:2b -# SHA1 Fingerprint: ca:3a:fb:cf:12:40:36:4b:44:b2:16:20:88:80:48:39:19:93:7c:f7 -# SHA256 Fingerprint: 85:a0:dd:7d:d7:20:ad:b7:ff:05:f8:3d:54:2b:20:9d:c7:ff:45:28:f7:d6:77:b1:83:89:fe:a5:e5:c4:9e:86 ------BEGIN CERTIFICATE----- -MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x -GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv -b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV -BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W -YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa -GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg -Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J -WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB -rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp -+ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 -ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i -Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz -PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og -/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH -oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI -yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud -EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 -A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL -MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT -ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f -BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn -g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl -fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K -WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha -B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc -hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR -TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD -mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z -ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y -4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza -8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 3 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 3 O=QuoVadis Limited -# Label: "QuoVadis Root CA 3" -# Serial: 1478 -# MD5 Fingerprint: 31:85:3c:62:94:97:63:b9:aa:fd:89:4e:af:6f:e0:cf -# SHA1 Fingerprint: 1f:49:14:f7:d8:74:95:1d:dd:ae:02:c0:be:fd:3a:2d:82:75:51:85 -# SHA256 Fingerprint: 18:f1:fc:7f:20:5d:f8:ad:dd:eb:7f:e0:07:dd:57:e3:af:37:5a:9c:4d:8d:73:54:6b:f4:f1:fe:d1:e1:8d:35 ------BEGIN CERTIFICATE----- -MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x -GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv -b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV -BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W -YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM -V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB -4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr -H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd -8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv -vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT -mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe -btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc -T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt -WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ -c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A -4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD -VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG -CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 -aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 -aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu -dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw -czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G -A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC -TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg -Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 -7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem -d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd -+LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B -4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN -t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x -DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 -k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s -zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j -Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT -mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK -4SVhM7JZG+Ju1zdXtg2pEto= ------END CERTIFICATE----- - -# Issuer: O=SECOM Trust.net OU=Security Communication RootCA1 -# Subject: O=SECOM Trust.net OU=Security Communication RootCA1 -# Label: "Security Communication Root CA" -# Serial: 0 -# MD5 Fingerprint: f1:bc:63:6a:54:e0:b5:27:f5:cd:e7:1a:e3:4d:6e:4a -# SHA1 Fingerprint: 36:b1:2b:49:f9:81:9e:d7:4c:9e:bc:38:0f:c6:56:8f:5d:ac:b2:f7 -# SHA256 Fingerprint: e7:5e:72:ed:9f:56:0e:ec:6e:b4:80:00:73:a4:3f:c3:ad:19:19:5a:39:22:82:01:78:95:97:4a:99:02:6b:6c ------BEGIN CERTIFICATE----- -MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY -MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t -dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5 -WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD -VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8 -9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ -DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9 -Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N -QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ -xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G -A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T -AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG -kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr -Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5 -Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU -JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot -RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw== ------END CERTIFICATE----- - -# Issuer: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com -# Subject: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com -# Label: "XRamp Global CA Root" -# Serial: 107108908803651509692980124233745014957 -# MD5 Fingerprint: a1:0b:44:b3:ca:10:d8:00:6e:9d:0f:d8:0f:92:0a:d1 -# SHA1 Fingerprint: b8:01:86:d1:eb:9c:86:a5:41:04:cf:30:54:f3:4c:52:b7:e5:58:c6 -# SHA256 Fingerprint: ce:cd:dc:90:50:99:d8:da:df:c5:b1:d2:09:b7:37:cb:e2:c1:8c:fb:2c:10:c0:ff:0b:cf:0d:32:86:fc:1a:a2 ------BEGIN CERTIFICATE----- -MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB -gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk -MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY -UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx -NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 -dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy -dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB -dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 -38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP -KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q -DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 -qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa -JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi -PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P -BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs -jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 -eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD -ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR -vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt -qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa -IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy -i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ -O+7ETPTsJ3xCwnR8gooJybQDJbw= ------END CERTIFICATE----- - -# Issuer: O=The Go Daddy Group, Inc. OU=Go Daddy Class 2 Certification Authority -# Subject: O=The Go Daddy Group, Inc. OU=Go Daddy Class 2 Certification Authority -# Label: "Go Daddy Class 2 CA" -# Serial: 0 -# MD5 Fingerprint: 91:de:06:25:ab:da:fd:32:17:0c:bb:25:17:2a:84:67 -# SHA1 Fingerprint: 27:96:ba:e6:3f:18:01:e2:77:26:1b:a0:d7:77:70:02:8f:20:ee:e4 -# SHA256 Fingerprint: c3:84:6b:f2:4b:9e:93:ca:64:27:4c:0e:c6:7c:1e:cc:5e:02:4f:fc:ac:d2:d7:40:19:35:0e:81:fe:54:6a:e4 ------BEGIN CERTIFICATE----- -MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh -MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE -YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 -MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo -ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg -MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN -ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA -PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w -wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi -EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY -avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ -YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE -sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h -/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 -IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD -ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy -OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P -TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ -HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER -dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf -ReYNnyicsbkqWletNw+vHX/bvZ8= ------END CERTIFICATE----- - -# Issuer: O=Starfield Technologies, Inc. OU=Starfield Class 2 Certification Authority -# Subject: O=Starfield Technologies, Inc. OU=Starfield Class 2 Certification Authority -# Label: "Starfield Class 2 CA" -# Serial: 0 -# MD5 Fingerprint: 32:4a:4b:bb:c8:63:69:9b:be:74:9a:c6:dd:1d:46:24 -# SHA1 Fingerprint: ad:7e:1c:28:b0:64:ef:8f:60:03:40:20:14:c3:d0:e3:37:0e:b5:8a -# SHA256 Fingerprint: 14:65:fa:20:53:97:b8:76:fa:a6:f0:a9:95:8e:55:90:e4:0f:cc:7f:aa:4f:b7:c2:c8:67:75:21:fb:5f:b6:58 ------BEGIN CERTIFICATE----- -MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl -MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp -U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw -NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE -ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp -ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 -DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf -8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN -+lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 -X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa -K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA -1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G -A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR -zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 -YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD -bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w -DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 -L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D -eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl -xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp -VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY -WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Assured ID Root CA" -# Serial: 17154717934120587862167794914071425081 -# MD5 Fingerprint: 87:ce:0b:7b:2a:0e:49:00:e1:58:71:9b:37:a8:93:72 -# SHA1 Fingerprint: 05:63:b8:63:0d:62:d7:5a:bb:c8:ab:1e:4b:df:b5:a8:99:b2:4d:43 -# SHA256 Fingerprint: 3e:90:99:b5:01:5e:8f:48:6c:00:bc:ea:9d:11:1e:e7:21:fa:ba:35:5a:89:bc:f1:df:69:56:1e:3d:c6:32:5c ------BEGIN CERTIFICATE----- -MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv -b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl -cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c -JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP -mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ -wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 -VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ -AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB -AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun -pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC -dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf -fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm -NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx -H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe -+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Global Root CA" -# Serial: 10944719598952040374951832963794454346 -# MD5 Fingerprint: 79:e4:a9:84:0d:7d:3a:96:d7:c0:4f:e2:43:4c:89:2e -# SHA1 Fingerprint: a8:98:5d:3a:65:e5:e5:c4:b2:d7:d6:6d:40:c6:dd:2f:b1:9c:54:36 -# SHA256 Fingerprint: 43:48:a0:e9:44:4c:78:cb:26:5e:05:8d:5e:89:44:b4:d8:4f:96:62:bd:26:db:25:7f:89:34:a4:43:c7:01:61 ------BEGIN CERTIFICATE----- -MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD -QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT -MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j -b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB -CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 -nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt -43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P -T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 -gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO -BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR -TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw -DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr -hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg -06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF -PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls -YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk -CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= ------END CERTIFICATE----- - -# Issuer: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert High Assurance EV Root CA" -# Serial: 3553400076410547919724730734378100087 -# MD5 Fingerprint: d4:74:de:57:5c:39:b2:d3:9c:85:83:c5:c0:65:49:8a -# SHA1 Fingerprint: 5f:b7:ee:06:33:e2:59:db:ad:0c:4c:9a:e6:d3:8f:1a:61:c7:dc:25 -# SHA256 Fingerprint: 74:31:e5:f4:c3:c1:ce:46:90:77:4f:0b:61:e0:54:40:88:3b:a9:a0:1e:d0:0b:a6:ab:d7:80:6e:d3:b1:18:cf ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j -ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL -MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 -LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug -RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm -+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW -PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM -xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB -Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 -hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg -EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA -FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec -nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z -eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF -hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 -Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe -vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep -+OkuE6N36B9K ------END CERTIFICATE----- - -# Issuer: CN=SwissSign Gold CA - G2 O=SwissSign AG -# Subject: CN=SwissSign Gold CA - G2 O=SwissSign AG -# Label: "SwissSign Gold CA - G2" -# Serial: 13492815561806991280 -# MD5 Fingerprint: 24:77:d9:a8:91:d1:3b:fa:88:2d:c2:ff:f8:cd:33:93 -# SHA1 Fingerprint: d8:c5:38:8a:b7:30:1b:1b:6e:d4:7a:e6:45:25:3a:6f:9f:1a:27:61 -# SHA256 Fingerprint: 62:dd:0b:e9:b9:f5:0a:16:3e:a0:f8:e7:5c:05:3b:1e:ca:57:ea:55:c8:68:8f:64:7c:68:81:f2:c8:35:7b:95 ------BEGIN CERTIFICATE----- -MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln -biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF -MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT -d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC -CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 -76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ -bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c -6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE -emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd -MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt -MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y -MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y -FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi -aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM -gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB -qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 -lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn -8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov -L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 -45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO -UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 -O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC -bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv -GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a -77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC -hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 -92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp -Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w -ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt -Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ ------END CERTIFICATE----- - -# Issuer: CN=SwissSign Silver CA - G2 O=SwissSign AG -# Subject: CN=SwissSign Silver CA - G2 O=SwissSign AG -# Label: "SwissSign Silver CA - G2" -# Serial: 5700383053117599563 -# MD5 Fingerprint: e0:06:a1:c9:7d:cf:c9:fc:0d:c0:56:75:96:d8:62:13 -# SHA1 Fingerprint: 9b:aa:e5:9f:56:ee:21:cb:43:5a:be:25:93:df:a7:f0:40:d1:1d:cb -# SHA256 Fingerprint: be:6c:4d:a2:bb:b9:ba:59:b6:f3:93:97:68:37:42:46:c3:c0:05:99:3f:a9:8f:02:0d:1d:ed:be:d4:8a:81:d5 ------BEGIN CERTIFICATE----- -MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UE -BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWdu -IFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0Nlow -RzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMY -U3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A -MIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644N0Mv -Fz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7br -YT7QbNHm+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieF -nbAVlDLaYQ1HTWBCrpJH6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH -6ATK72oxh9TAtvmUcXtnZLi2kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZt -eJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/ -c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJ -MoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRH -HTBsROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTf -jNFusB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6 -5i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOB -rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU -F6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRBtjpbO8tFnb0c -wpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 -cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIB -AHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShp -WJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9 -xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ -2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZ -IseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8 -aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2X -em1ZqSqPe97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQR -dAtq/gsD/KNVV4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/ -OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+ -hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy -tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u ------END CERTIFICATE----- - -# Issuer: CN=SecureTrust CA O=SecureTrust Corporation -# Subject: CN=SecureTrust CA O=SecureTrust Corporation -# Label: "SecureTrust CA" -# Serial: 17199774589125277788362757014266862032 -# MD5 Fingerprint: dc:32:c3:a7:6d:25:57:c7:68:09:9d:ea:2d:a9:a2:d1 -# SHA1 Fingerprint: 87:82:c6:c3:04:35:3b:cf:d2:96:92:d2:59:3e:7d:44:d9:34:ff:11 -# SHA256 Fingerprint: f1:c1:b5:0a:e5:a2:0d:d8:03:0e:c9:f6:bc:24:82:3d:d3:67:b5:25:57:59:b4:e7:1b:61:fc:e9:f7:37:5d:73 ------BEGIN CERTIFICATE----- -MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x -FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz -MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv -cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN -AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz -Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO -0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao -wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj -7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS -8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT -BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB -/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg -JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC -NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 -6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ -3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm -D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS -CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR -3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= ------END CERTIFICATE----- - -# Issuer: CN=Secure Global CA O=SecureTrust Corporation -# Subject: CN=Secure Global CA O=SecureTrust Corporation -# Label: "Secure Global CA" -# Serial: 9751836167731051554232119481456978597 -# MD5 Fingerprint: cf:f4:27:0d:d4:ed:dc:65:16:49:6d:3d:da:bf:6e:de -# SHA1 Fingerprint: 3a:44:73:5a:e5:81:90:1f:24:86:61:46:1e:3b:9c:c4:5f:f5:3a:1b -# SHA256 Fingerprint: 42:00:f5:04:3a:c8:59:0e:bb:52:7d:20:9e:d1:50:30:29:fb:cb:d4:1c:a1:b5:06:ec:27:f1:5a:de:7d:ac:69 ------BEGIN CERTIFICATE----- -MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x -GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx -MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg -Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ -iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa -/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ -jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI -HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 -sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w -gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw -KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG -AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L -URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO -H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm -I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY -iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc -f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW ------END CERTIFICATE----- - -# Issuer: CN=COMODO Certification Authority O=COMODO CA Limited -# Subject: CN=COMODO Certification Authority O=COMODO CA Limited -# Label: "COMODO Certification Authority" -# Serial: 104350513648249232941998508985834464573 -# MD5 Fingerprint: 5c:48:dc:f7:42:72:ec:56:94:6d:1c:cc:71:35:80:75 -# SHA1 Fingerprint: 66:31:bf:9e:f7:4f:9e:b6:c9:d5:a6:0c:ba:6a:be:d1:f7:bd:ef:7b -# SHA256 Fingerprint: 0c:2c:d6:3d:f7:80:6f:a3:99:ed:e8:09:11:6b:57:5b:f8:79:89:f0:65:18:f9:80:8c:86:05:03:17:8b:af:66 ------BEGIN CERTIFICATE----- -MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB -gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV -BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw -MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl -YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P -RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 -UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI -2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 -Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp -+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ -DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O -nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW -/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g -PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u -QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY -SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv -IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ -RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 -zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd -BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB -ZQ== ------END CERTIFICATE----- - -# Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited -# Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited -# Label: "COMODO ECC Certification Authority" -# Serial: 41578283867086692638256921589707938090 -# MD5 Fingerprint: 7c:62:ff:74:9d:31:53:5e:68:4a:d5:78:aa:1e:bf:23 -# SHA1 Fingerprint: 9f:74:4e:9f:2b:4d:ba:ec:0f:31:2c:50:b6:56:3b:8e:2d:93:c3:11 -# SHA256 Fingerprint: 17:93:92:7a:06:14:54:97:89:ad:ce:2f:8f:34:f7:f0:b6:6d:0f:3a:e3:a3:b8:4d:21:ec:15:db:ba:4f:ad:c7 ------BEGIN CERTIFICATE----- -MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTEL -MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE -BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT -IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwMzA2MDAw -MDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy -ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N -T0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlv -biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSR -FtSrYpn1PlILBs5BAH+X4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0J -cfRK9ChQtP6IHG4/bC8vCVlbpVsLM5niwz2J+Wos77LTBumjQjBAMB0GA1UdDgQW -BBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VGFAkK+qDm -fQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdv -GDeAU/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= ------END CERTIFICATE----- - -# Issuer: CN=Certigna O=Dhimyotis -# Subject: CN=Certigna O=Dhimyotis -# Label: "Certigna" -# Serial: 18364802974209362175 -# MD5 Fingerprint: ab:57:a6:5b:7d:42:82:19:b5:d8:58:26:28:5e:fd:ff -# SHA1 Fingerprint: b1:2e:13:63:45:86:a4:6f:1a:b2:60:68:37:58:2d:c4:ac:fd:94:97 -# SHA256 Fingerprint: e3:b6:a2:db:2e:d7:ce:48:84:2f:7a:c5:32:41:c7:b7:1d:54:14:4b:fb:40:c1:1f:3f:1d:0b:42:f5:ee:a1:2d ------BEGIN CERTIFICATE----- -MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV -BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X -DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ -BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4 -QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny -gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw -zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q -130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2 -JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw -DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw -ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT -AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj -AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG -9w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h -bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc -fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu -HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w -t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw -WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== ------END CERTIFICATE----- - -# Issuer: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority -# Subject: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority -# Label: "ePKI Root Certification Authority" -# Serial: 28956088682735189655030529057352760477 -# MD5 Fingerprint: 1b:2e:00:ca:26:06:90:3d:ad:fe:6f:15:68:d3:6b:b3 -# SHA1 Fingerprint: 67:65:0d:f1:7e:8e:7e:5b:82:40:a4:f4:56:4b:cf:e2:3d:69:c6:f0 -# SHA256 Fingerprint: c0:a6:f4:dc:63:a2:4b:fd:cf:54:ef:2a:6a:08:2a:0a:72:de:35:80:3e:2f:f5:ff:52:7a:e5:d8:72:06:df:d5 ------BEGIN CERTIFICATE----- -MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe -MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 -ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe -Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw -IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL -SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH -SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh -ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X -DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1 -TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ -fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA -sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU -WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS -nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH -dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip -NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC -AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF -MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH -ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB -uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl -PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP -JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/ -gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2 -j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6 -5ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB -o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS -/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z -Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE -W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D -hNQ+IIX3Sj0rnP0qCglN6oH4EZw= ------END CERTIFICATE----- - -# Issuer: O=certSIGN OU=certSIGN ROOT CA -# Subject: O=certSIGN OU=certSIGN ROOT CA -# Label: "certSIGN ROOT CA" -# Serial: 35210227249154 -# MD5 Fingerprint: 18:98:c0:d6:e9:3a:fc:f9:b0:f5:0c:f7:4b:01:44:17 -# SHA1 Fingerprint: fa:b7:ee:36:97:26:62:fb:2d:b0:2a:f6:bf:03:fd:e8:7c:4b:2f:9b -# SHA256 Fingerprint: ea:a9:62:c4:fa:4a:6b:af:eb:e4:15:19:6d:35:1c:cd:88:8d:4f:53:f3:fa:8a:e6:d7:c4:66:a9:4e:60:42:bb ------BEGIN CERTIFICATE----- -MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT -AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD -QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP -MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do -0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ -UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d -RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ -OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv -JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C -AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O -BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ -LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY -MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ -44gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I -Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw -i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN -9u6wWk5JRFRYX0KD ------END CERTIFICATE----- - -# Issuer: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) -# Subject: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) -# Label: "NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny" -# Serial: 80544274841616 -# MD5 Fingerprint: c5:a1:b7:ff:73:dd:d6:d7:34:32:18:df:fc:3c:ad:88 -# SHA1 Fingerprint: 06:08:3f:59:3f:15:a1:04:a0:69:a4:6b:a9:03:d0:06:b7:97:09:91 -# SHA256 Fingerprint: 6c:61:da:c3:a2:de:f0:31:50:6b:e0:36:d2:a6:fe:40:19:94:fb:d1:3d:f9:c8:d4:66:59:92:74:c4:46:ec:98 ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQG -EwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3 -MDUGA1UECwwuVGFuw7pzw610dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNl -cnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBBcmFueSAoQ2xhc3MgR29sZCkgRsWR -dGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgxMjA2MTUwODIxWjCB -pzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxOZXRM -b2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlm -aWNhdGlvbiBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNz -IEdvbGQpIEbFkXRhbsO6c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAxCRec75LbRTDofTjl5Bu0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrT -lF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw/HpYzY6b7cNGbIRwXdrz -AZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAkH3B5r9s5 -VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRG -ILdwfzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2 -BJtr+UBdADTHLpl1neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAG -AQH/AgEEMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2M -U9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwWqZw8UQCgwBEIBaeZ5m8BiFRh -bvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTtaYtOUZcTh5m2C -+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC -bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2F -uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 -XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= ------END CERTIFICATE----- - -# Issuer: CN=SecureSign RootCA11 O=Japan Certification Services, Inc. -# Subject: CN=SecureSign RootCA11 O=Japan Certification Services, Inc. -# Label: "SecureSign RootCA11" -# Serial: 1 -# MD5 Fingerprint: b7:52:74:e2:92:b4:80:93:f2:75:e4:cc:d7:f2:ea:26 -# SHA1 Fingerprint: 3b:c4:9f:48:f8:f3:73:a0:9c:1e:bd:f8:5b:b1:c3:65:c7:d8:11:b3 -# SHA256 Fingerprint: bf:0f:ee:fb:9e:3a:58:1a:d5:f9:e9:db:75:89:98:57:43:d2:61:08:5c:4d:31:4f:6f:5d:72:59:aa:42:16:12 ------BEGIN CERTIFICATE----- -MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDEr -MCkGA1UEChMiSmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoG -A1UEAxMTU2VjdXJlU2lnbiBSb290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0 -MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSswKQYDVQQKEyJKYXBhbiBDZXJ0aWZp -Y2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1cmVTaWduIFJvb3RD -QTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvLTJsz -i1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8 -h9uuywGOwvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOV -MdrAG/LuYpmGYz+/3ZMqg6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9 -UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rPO7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni -8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitAbpSACW22s293bzUIUPsC -h8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZXt94wDgYD -VR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEB -AKChOBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xm -KbabfSVSSUOrTC4rbnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQ -X5Ucv+2rIrVls4W6ng+4reV6G4pQOh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWr -QbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01y8hSyn+B/tlr0/cR7SXf+Of5 -pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061lgeLKBObjBmN -QSdJQO7e5iNEOdyhIta6A/I= ------END CERTIFICATE----- - -# Issuer: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. -# Subject: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. -# Label: "Microsec e-Szigno Root CA 2009" -# Serial: 14014712776195784473 -# MD5 Fingerprint: f8:49:f4:03:bc:44:2d:83:be:48:69:7d:29:64:fc:b1 -# SHA1 Fingerprint: 89:df:74:fe:5c:f4:0f:4a:80:f9:e3:37:7d:54:da:91:e1:01:31:8e -# SHA256 Fingerprint: 3c:5f:81:fe:a5:fa:b8:2c:64:bf:a2:ea:ec:af:cd:e8:e0:77:fc:86:20:a7:ca:e5:37:16:3d:f3:6e:db:f3:78 ------BEGIN CERTIFICATE----- -MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD -VQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0 -ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0G -CSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTAeFw0wOTA2MTYxMTMwMThaFw0y -OTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3Qx -FjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3pp -Z25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o -dTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvP -kd6mJviZpWNwrZuuyjNAfW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tc -cbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG0IMZfcChEhyVbUr02MelTTMuhTlAdX4U -fIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKApxn1ntxVUwOXewdI/5n7 -N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm1HxdrtbC -xkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1 -+rUCAwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G -A1UdDgQWBBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPM -Pcu1SCOhGnqmKrs0aDAbBgNVHREEFDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqG -SIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0olZMEyL/azXm4Q5DwpL7v8u8h -mLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfXI/OMn74dseGk -ddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 -tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c -2Pm2G2JwCz02yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5t -HMN1Rq41Bab2XD0h7lbwyYIiLXpUq3DDfSJlgnCW ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 -# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 -# Label: "GlobalSign Root CA - R3" -# Serial: 4835703278459759426209954 -# MD5 Fingerprint: c5:df:b8:49:ca:05:13:55:ee:2d:ba:1a:c3:3e:b0:28 -# SHA1 Fingerprint: d6:9b:56:11:48:f0:1c:77:c5:45:78:c1:09:26:df:5b:85:69:76:ad -# SHA256 Fingerprint: cb:b5:22:d7:b7:f1:27:ad:6a:01:13:86:5b:df:1c:d4:10:2e:7d:07:59:af:63:5a:7c:f4:72:0d:c9:63:c5:3b ------BEGIN CERTIFICATE----- -MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G -A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp -Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4 -MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG -A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8 -RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT -gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm -KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd -QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ -XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw -DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o -LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU -RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp -jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK -6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX -mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs -Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH -WD9f ------END CERTIFICATE----- - -# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 -# Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 -# Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" -# Serial: 6047274297262753887 -# MD5 Fingerprint: 73:3a:74:7a:ec:bb:a3:96:a6:c2:e4:e2:c8:9b:c0:c3 -# SHA1 Fingerprint: ae:c5:fb:3f:c8:e1:bf:c4:e5:4f:03:07:5a:9a:e8:00:b7:f7:b6:fa -# SHA256 Fingerprint: 04:04:80:28:bf:1f:28:64:d4:8f:9a:d4:d8:32:94:36:6a:82:88:56:55:3f:3b:14:30:3f:90:14:7f:5d:40:ef ------BEGIN CERTIFICATE----- -MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UE -BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h -cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEy -MzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg -Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 -thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM -cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG -L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i -NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h -X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b -m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy -Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja -EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T -KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF -6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh -OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD -VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNHDhpkLzCBpgYD -VR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp -cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBv -ACAAZABlACAAbABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBl -AGwAbwBuAGEAIAAwADgAMAAxADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF -661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx51tkljYyGOylMnfX40S2wBEqgLk9 -am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qkR71kMrv2JYSiJ0L1 -ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaPT481 -PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS -3a/DTg4fJl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5k -SeTy36LssUzAKh3ntLFlosS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF -3dvd6qJ2gHN99ZwExEWN57kci57q13XRcrHedUTnQn3iV2t93Jm8PYMo6oCTjcVM -ZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoRsaS8I8nkvof/uZS2+F0g -StRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTDKCOM/icz -Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB -jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V ------END CERTIFICATE----- - -# Issuer: CN=Izenpe.com O=IZENPE S.A. -# Subject: CN=Izenpe.com O=IZENPE S.A. -# Label: "Izenpe.com" -# Serial: 917563065490389241595536686991402621 -# MD5 Fingerprint: a6:b0:cd:85:80:da:5c:50:34:a3:39:90:2f:55:67:73 -# SHA1 Fingerprint: 2f:78:3d:25:52:18:a7:4a:65:39:71:b5:2c:a2:9c:45:15:6f:e9:19 -# SHA256 Fingerprint: 25:30:cc:8e:98:32:15:02:ba:d9:6f:9b:1f:ba:1b:09:9e:2d:29:9e:0f:45:48:bb:91:4f:36:3b:c0:d4:53:1f ------BEGIN CERTIFICATE----- -MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 -MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 -ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD -VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j -b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq -scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO -xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H -LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX -uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD -yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ -JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q -rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN -BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8L -hij+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIB -QFqNeb+Lz0vPqhbBleStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+ -HMh3/1uaD7euBUbl8agW7EekFwIDAQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2lu -Zm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+SVpFTlBFIFMuQS4gLSBDSUYg -QTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBGNjIgUzgxQzBB -BgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx -MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwHQYDVR0OBBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUA -A4ICAQB4pgwWSp9MiDrAyw6lFn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWb -laQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbgakEyrkgPH7UIBzg/YsfqikuFgba56 -awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8qhT/AQKM6WfxZSzwo -JNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Csg1lw -LDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCT -VyvehQP5aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGk -LhObNA5me0mrZJfQRsN5nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJb -UjWumDqtujWTI6cfSN01RpiyEGjkpTHCClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/ -QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+ -naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGls -QyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== ------END CERTIFICATE----- - -# Issuer: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. -# Subject: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. -# Label: "Go Daddy Root Certificate Authority - G2" -# Serial: 0 -# MD5 Fingerprint: 80:3a:bc:22:c1:e6:fb:8d:9b:3b:27:4a:32:1b:9a:01 -# SHA1 Fingerprint: 47:be:ab:c9:22:ea:e8:0e:78:78:34:62:a7:9f:45:c2:54:fd:e6:8b -# SHA256 Fingerprint: 45:14:0b:32:47:eb:9c:c8:c5:b4:f0:d7:b5:30:91:f7:32:92:08:9e:6e:5a:63:e2:74:9d:d3:ac:a9:19:8e:da ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT -EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp -ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz -NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH -EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE -AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD -E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH -/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy -DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh -GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR -tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA -AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE -FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX -WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu -9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr -gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo -2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO -LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI -4uJEvlz36hz1 ------END CERTIFICATE----- - -# Issuer: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. -# Subject: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. -# Label: "Starfield Root Certificate Authority - G2" -# Serial: 0 -# MD5 Fingerprint: d6:39:81:c6:52:7e:96:69:fc:fc:ca:66:ed:05:f2:96 -# SHA1 Fingerprint: b5:1c:06:7c:ee:2b:0c:3d:f8:55:ab:2d:92:f4:fe:39:d4:e7:0f:0e -# SHA256 Fingerprint: 2c:e1:cb:0b:f9:d2:f9:e1:02:99:3f:be:21:51:52:c3:b2:dd:0c:ab:de:1c:68:e5:31:9b:83:91:54:db:b7:f5 ------BEGIN CERTIFICATE----- -MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT -HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs -ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw -MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 -b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj -aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp -Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg -nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1 -HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N -Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN -dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0 -HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO -BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G -CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU -sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3 -4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg -8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K -pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1 -mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 ------END CERTIFICATE----- - -# Issuer: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. -# Subject: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. -# Label: "Starfield Services Root Certificate Authority - G2" -# Serial: 0 -# MD5 Fingerprint: 17:35:74:af:7b:61:1c:eb:f4:f9:3c:e2:ee:40:f9:a2 -# SHA1 Fingerprint: 92:5a:8f:8d:2c:6d:04:e0:66:5f:59:6a:ff:22:d8:63:e8:25:6f:3f -# SHA256 Fingerprint: 56:8d:69:05:a2:c8:87:08:a4:b3:02:51:90:ed:cf:ed:b1:97:4a:60:6a:13:c6:e5:29:0f:cb:2a:e6:3e:da:b5 ------BEGIN CERTIFICATE----- -MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT -HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs -ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 -MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy -ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy -dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p -OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2 -8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K -Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe -hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk -6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw -DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q -AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI -bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB -ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z -qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd -iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn -0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN -sSi6 ------END CERTIFICATE----- - -# Issuer: CN=AffirmTrust Commercial O=AffirmTrust -# Subject: CN=AffirmTrust Commercial O=AffirmTrust -# Label: "AffirmTrust Commercial" -# Serial: 8608355977964138876 -# MD5 Fingerprint: 82:92:ba:5b:ef:cd:8a:6f:a6:3d:55:f9:84:f6:d6:b7 -# SHA1 Fingerprint: f9:b5:b6:32:45:5f:9c:be:ec:57:5f:80:dc:e9:6e:2c:c7:b2:78:b7 -# SHA256 Fingerprint: 03:76:ab:1d:54:c5:f9:80:3c:e4:b2:e2:01:a0:ee:7e:ef:7b:57:b6:36:e8:a9:3c:9b:8d:48:60:c9:6f:5f:a7 ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP -Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr -ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL -MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1 -yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr -VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/ -nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG -XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj -vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt -Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g -N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC -nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= ------END CERTIFICATE----- - -# Issuer: CN=AffirmTrust Networking O=AffirmTrust -# Subject: CN=AffirmTrust Networking O=AffirmTrust -# Label: "AffirmTrust Networking" -# Serial: 8957382827206547757 -# MD5 Fingerprint: 42:65:ca:be:01:9a:9a:4c:a9:8c:41:49:cd:c0:d5:7f -# SHA1 Fingerprint: 29:36:21:02:8b:20:ed:02:f5:66:c5:32:d1:d6:ed:90:9f:45:00:2f -# SHA256 Fingerprint: 0a:81:ec:5a:92:97:77:f1:45:90:4a:f3:8d:5d:50:9f:66:b5:e2:c5:8f:cd:b5:31:05:8b:0e:17:f3:f0:b4:1b ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y -YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua -kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL -QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp -6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG -yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i -QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO -tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu -QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ -Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u -olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48 -x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= ------END CERTIFICATE----- - -# Issuer: CN=AffirmTrust Premium O=AffirmTrust -# Subject: CN=AffirmTrust Premium O=AffirmTrust -# Label: "AffirmTrust Premium" -# Serial: 7893706540734352110 -# MD5 Fingerprint: c4:5d:0e:48:b6:ac:28:30:4e:0a:bc:f9:38:16:87:57 -# SHA1 Fingerprint: d8:a6:33:2c:e0:03:6f:b1:85:f6:63:4f:7d:6a:06:65:26:32:28:27 -# SHA256 Fingerprint: 70:a7:3f:7f:37:6b:60:07:42:48:90:45:34:b1:14:82:d5:bf:0e:69:8e:cc:49:8d:f5:25:77:eb:f2:e9:3b:9a ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz -dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG -A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U -cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf -qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ -JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ -+jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS -s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5 -HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7 -70O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG -V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S -qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S -5u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia -C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX -OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE -FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ -BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2 -KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg -Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B -8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ -MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc -0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ -u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF -u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH -YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8 -GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO -RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e -KeC2uAloGRwYQw== ------END CERTIFICATE----- - -# Issuer: CN=AffirmTrust Premium ECC O=AffirmTrust -# Subject: CN=AffirmTrust Premium ECC O=AffirmTrust -# Label: "AffirmTrust Premium ECC" -# Serial: 8401224907861490260 -# MD5 Fingerprint: 64:b0:09:55:cf:b1:d5:99:e2:be:13:ab:a6:5d:ea:4d -# SHA1 Fingerprint: b8:23:6b:00:2f:1d:16:86:53:01:55:6c:11:a4:37:ca:eb:ff:c3:bb -# SHA256 Fingerprint: bd:71:fd:f6:da:97:e4:cf:62:d1:64:7a:dd:25:81:b0:7d:79:ad:f8:39:7e:b4:ec:ba:9c:5e:84:88:82:14:23 ------BEGIN CERTIFICATE----- -MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC -VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ -cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ -BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt -VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D -0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9 -ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G -A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs -aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I -flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ== ------END CERTIFICATE----- - -# Issuer: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority -# Subject: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority -# Label: "Certum Trusted Network CA" -# Serial: 279744 -# MD5 Fingerprint: d5:e9:81:40:c5:18:69:fc:46:2c:89:75:62:0f:aa:78 -# SHA1 Fingerprint: 07:e0:32:e0:20:b7:2c:3f:19:2f:06:28:a2:59:3a:19:a7:0f:06:9e -# SHA256 Fingerprint: 5c:58:46:8d:55:f5:8e:49:7e:74:39:82:d2:b5:00:10:b6:d1:65:37:4a:cf:83:a7:d4:a3:2d:b7:68:c4:40:8e ------BEGIN CERTIFICATE----- -MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM -MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D -ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU -cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 -WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg -Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw -IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH -UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM -TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU -BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM -kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x -AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV -HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y -sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL -I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 -J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY -VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI -03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= ------END CERTIFICATE----- - -# Issuer: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA -# Subject: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA -# Label: "TWCA Root Certification Authority" -# Serial: 1 -# MD5 Fingerprint: aa:08:8f:f6:f9:7b:b7:f2:b1:a7:1e:9b:ea:ea:bd:79 -# SHA1 Fingerprint: cf:9e:87:6d:d3:eb:fc:42:26:97:a3:b5:a3:7a:a0:76:a9:06:23:48 -# SHA256 Fingerprint: bf:d8:8f:e1:10:1c:41:ae:3e:80:1b:f8:be:56:35:0e:e9:ba:d1:a6:b9:bd:51:5e:dc:5c:6d:5b:87:11:ac:44 ------BEGIN CERTIFICATE----- -MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzES -MBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFU -V0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMz -WhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJVEFJV0FO -LUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFE -AcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HH -K3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX -RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/z -rX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx -3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkq -hkiG9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeC -MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls -XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D -lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn -aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ -YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== ------END CERTIFICATE----- - -# Issuer: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 -# Subject: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 -# Label: "Security Communication RootCA2" -# Serial: 0 -# MD5 Fingerprint: 6c:39:7d:a4:0e:55:59:b2:3f:d6:41:b1:12:50:de:43 -# SHA1 Fingerprint: 5f:3b:8c:f2:f8:10:b3:7d:78:b4:ce:ec:19:19:c3:73:34:b9:c7:74 -# SHA256 Fingerprint: 51:3b:2c:ec:b8:10:d4:cd:e5:dd:85:39:1a:df:c6:c2:dd:60:d8:7b:b7:36:d2:b5:21:48:4a:a4:7a:0e:be:f6 ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDEl -MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMe -U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoX -DTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRy -dXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3VyaXR5IENvbW11bmlj -YXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANAV -OVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGr -zbl+dp+++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVM -VAX3NuRFg3sUZdbcDE3R3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQ -hNBqyjoGADdH5H5XTz+L62e4iKrFvlNVspHEfbmwhRkGeC7bYRr6hfVKkaHnFtWO -ojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1KEOtOghY6rCcMU/Gt1SSw -awNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8QIH4D5cs -OPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 -DQEBCwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpF -coJxDjrSzG+ntKEju/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXc -okgfGT+Ok+vx+hfuzU7jBBJV1uXk3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8 -t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy -1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29mvVXIwAHIRc/ -SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 ------END CERTIFICATE----- - -# Issuer: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 -# Subject: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 -# Label: "Actalis Authentication Root CA" -# Serial: 6271844772424770508 -# MD5 Fingerprint: 69:c1:0d:4f:07:a3:1b:c3:fe:56:3d:04:bc:11:f6:a6 -# SHA1 Fingerprint: f3:73:b3:87:06:5a:28:84:8a:f2:f3:4a:ce:19:2b:dd:c7:8e:9c:ac -# SHA256 Fingerprint: 55:92:60:84:ec:96:3a:64:b9:6e:2a:be:01:ce:0b:a8:6a:64:fb:fe:bc:c7:aa:b5:af:c1:55:b3:7f:d7:60:66 ------BEGIN CERTIFICATE----- -MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UE -BhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8w -MzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 -IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMC -SVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1 -ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENB -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNv -UTufClrJwkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX -4ay8IMKx4INRimlNAJZaby/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9 -KK3giq0itFZljoZUj5NDKd45RnijMCO6zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/ -gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1fYVEiVRvjRuPjPdA1Yprb -rxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2oxgkg4YQ -51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2F -be8lEfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxe -KF+w6D9Fz8+vm2/7hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4F -v6MGn8i1zeQf1xcGDXqVdFUNaBr8EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbn -fpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5jF66CyCU3nuDuP/jVo23Eek7 -jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLYiDrIn3hm7Ynz -ezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt -ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAL -e3KHwGCmSUyIWOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70 -jsNjLiNmsGe+b7bAEzlgqqI0JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDz -WochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKxK3JCaKygvU5a2hi/a5iB0P2avl4V -SM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+Xlff1ANATIGk0k9j -pwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC4yyX -X04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+Ok -fcvHlXHo2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7R -K4X9p2jIugErsWx0Hbhzlefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btU -ZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXemOR/qnuOf0GZvBeyqdn6/axag67XH/JJU -LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT -LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== ------END CERTIFICATE----- - -# Issuer: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 -# Subject: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 -# Label: "Buypass Class 2 Root CA" -# Serial: 2 -# MD5 Fingerprint: 46:a7:d2:fe:45:fb:64:5a:a8:59:90:9b:78:44:9b:29 -# SHA1 Fingerprint: 49:0a:75:74:de:87:0a:47:fe:58:ee:f6:c7:6b:eb:c6:0b:12:40:99 -# SHA256 Fingerprint: 9a:11:40:25:19:7c:5b:b9:5d:94:e6:3d:55:cd:43:79:08:47:b6:46:b2:3c:df:11:ad:a4:a0:0e:ff:15:fb:48 ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg -Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow -TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw -HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr -6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV -L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91 -1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx -MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ -QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB -arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr -Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi -FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS -P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN -9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP -AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz -uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h -9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s -A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t -OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo -+fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7 -KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2 -DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us -H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ -I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7 -5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h -3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz -Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA= ------END CERTIFICATE----- - -# Issuer: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 -# Subject: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 -# Label: "Buypass Class 3 Root CA" -# Serial: 2 -# MD5 Fingerprint: 3d:3b:18:9e:2c:64:5a:e8:d5:88:ce:0e:f9:37:c2:ec -# SHA1 Fingerprint: da:fa:f7:fa:66:84:ec:06:8f:14:50:bd:c7:c2:81:a5:bc:a9:64:57 -# SHA256 Fingerprint: ed:f7:eb:bc:a2:7a:2a:38:4d:38:7b:7d:40:10:c6:66:e2:ed:b4:84:3e:4c:29:b4:ae:1d:5b:93:32:e6:b2:4d ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg -Q2xhc3MgMyBSb290IENBMB4XDTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFow -TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw -HgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRHsJ8Y -ZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3E -N3coTRiR5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9 -tznDDgFHmV0ST9tD+leh7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX -0DJq1l1sDPGzbjniazEuOQAnFN44wOwZZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c -/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH2xc519woe2v1n/MuwU8X -KhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV/afmiSTY -zIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvS -O1UQRwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D -34xFMFbG02SrZvPAXpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgP -K9Dx2hzLabjKSWJtyNBjYt1gD1iqj6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3 -AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEe4zf/lb+74suwv -Tg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAACAj -QTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV -cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXS -IGrs/CIBKM+GuIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2 -HJLw5QY33KbmkJs4j1xrG0aGQ0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsa -O5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8ZORK15FTAaggiG6cX0S5y2CBNOxv -033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2KSb12tjE8nVhz36u -dmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz6MkE -kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41 -3OEMXbugUZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvD -u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq -4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc= ------END CERTIFICATE----- - -# Issuer: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center -# Subject: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center -# Label: "T-TeleSec GlobalRoot Class 3" -# Serial: 1 -# MD5 Fingerprint: ca:fb:40:a8:4e:39:92:8a:1d:fe:8e:2f:c4:27:ea:ef -# SHA1 Fingerprint: 55:a6:72:3e:cb:f2:ec:cd:c3:23:74:70:19:9d:2a:be:11:e3:81:d1 -# SHA256 Fingerprint: fd:73:da:d3:1c:64:4f:f1:b4:3b:ef:0c:cd:da:96:71:0b:9c:d9:87:5e:ca:7e:31:70:7a:f3:e9:6d:52:2b:bd ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx -KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd -BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl -YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1 -OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy -aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 -ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN -8ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/ -RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4 -hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5 -ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM -EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1 -A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy -WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ -1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30 -6gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT -91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml -e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p -TpPDpFQUWw== ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH -# Subject: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH -# Label: "D-TRUST Root Class 3 CA 2 2009" -# Serial: 623603 -# MD5 Fingerprint: cd:e0:25:69:8d:47:ac:9c:89:35:90:f7:fd:51:3d:2f -# SHA1 Fingerprint: 58:e8:ab:b0:36:15:33:fb:80:f7:9b:1b:6d:29:d3:ff:8d:5f:00:f0 -# SHA256 Fingerprint: 49:e7:a4:42:ac:f0:ea:62:87:05:00:54:b5:25:64:b6:50:e4:f4:9e:42:e3:48:d6:aa:38:e0:39:e9:57:b1:c1 ------BEGIN CERTIFICATE----- -MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRF -MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBD -bGFzcyAzIENBIDIgMjAwOTAeFw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NTha -ME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMM -HkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOADER03 -UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42 -tSHKXzlABF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9R -ySPocq60vFYJfxLLHLGvKZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsM -lFqVlNpQmvH/pStmMaTJOKDfHR+4CS7zp+hnUquVH+BGPtikw8paxTGA6Eian5Rp -/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUCAwEAAaOCARowggEWMA8G -A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ4PGEMA4G -A1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVj -dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUy -MENBJTIwMiUyMDIwMDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRl -cmV2b2NhdGlvbmxpc3QwQ6BBoD+GPWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3Js -L2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAwOS5jcmwwDQYJKoZIhvcNAQEL -BQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm2H6NMLVwMeni -acfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 -o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4K -zCUqNQT4YJEVdT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8 -PIWmawomDeCTmGCufsYkl4phX5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3Y -Johw1+qRzT65ysCQblrGXnRl11z+o+I= ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH -# Subject: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH -# Label: "D-TRUST Root Class 3 CA 2 EV 2009" -# Serial: 623604 -# MD5 Fingerprint: aa:c6:43:2c:5e:2d:cd:c4:34:c0:50:4f:11:02:4f:b6 -# SHA1 Fingerprint: 96:c9:1b:0b:95:b4:10:98:42:fa:d0:d8:22:79:fe:60:fa:b9:16:83 -# SHA256 Fingerprint: ee:c5:49:6b:98:8c:e9:86:25:b9:34:09:2e:ec:29:08:be:d0:b0:f3:16:c2:d4:73:0c:84:ea:f1:f3:d3:48:81 ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRF -MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBD -bGFzcyAzIENBIDIgRVYgMjAwOTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUw -NDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNV -BAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAwOTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfSegpn -ljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM0 -3TP1YtHhzRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6Z -qQTMFexgaDbtCHu39b+T7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lR -p75mpoo6Kr3HGrHhFPC+Oh25z1uxav60sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8 -HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure3511H3a6UCAwEAAaOCASQw -ggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyvcop9Ntea -HNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFw -Oi8vZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xh -c3MlMjAzJTIwQ0ElMjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1E -RT9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0MEagRKBChkBodHRwOi8vd3d3LmQt -dHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xhc3NfM19jYV8yX2V2XzIwMDku -Y3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+PPoeUSbrh/Yp -3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 -nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNF -CSuGdXzfX2lXANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7na -xpeG0ILD5EJt/rDiZE4OJudANCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqX -KVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVvw9y4AyHqnxbxLFS1 ------END CERTIFICATE----- - -# Issuer: CN=CA Disig Root R2 O=Disig a.s. -# Subject: CN=CA Disig Root R2 O=Disig a.s. -# Label: "CA Disig Root R2" -# Serial: 10572350602393338211 -# MD5 Fingerprint: 26:01:fb:d8:27:a7:17:9a:45:54:38:1a:43:01:3b:03 -# SHA1 Fingerprint: b5:61:eb:ea:a4:de:e4:25:4b:69:1a:98:a5:57:47:c2:34:c7:d9:71 -# SHA256 Fingerprint: e2:3d:4a:03:6d:7b:70:e9:f5:95:b1:42:20:79:d2:b9:1e:df:bb:1f:b6:51:a0:63:3e:aa:8a:9d:c5:f8:07:03 ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV -BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu -MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQy -MDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx -EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjIw -ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbCw3Oe -NcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNH -PWSb6WiaxswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3I -x2ymrdMxp7zo5eFm1tL7A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbe -QTg06ov80egEFGEtQX6sx3dOy1FU+16SGBsEWmjGycT6txOgmLcRK7fWV8x8nhfR -yyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqVg8NTEQxzHQuyRpDRQjrO -QG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa5Beny912 -H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJ -QfYEkoopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUD -i/ZnWejBBhG93c+AAk9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORs -nLMOPReisjQS1n6yqEm70XooQL6iFh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1 -rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud -DwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5uQu0wDQYJKoZI -hvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM -tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqf -GopTpti72TVVsRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkb -lvdhuDvEK7Z4bLQjb/D907JedR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka -+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W81k/BfDxujRNt+3vrMNDcTa/F1bal -TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i -nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3 -gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr -G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os -zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x -L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL ------END CERTIFICATE----- - -# Issuer: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV -# Subject: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV -# Label: "ACCVRAIZ1" -# Serial: 6828503384748696800 -# MD5 Fingerprint: d0:a0:5a:ee:05:b6:09:94:21:a1:7d:f1:b2:29:82:02 -# SHA1 Fingerprint: 93:05:7a:88:15:c6:4f:ce:88:2f:fa:91:16:52:28:78:bc:53:64:17 -# SHA256 Fingerprint: 9a:6e:c0:12:e1:a7:da:9d:be:34:19:4d:47:8a:d7:c0:db:18:22:fb:07:1d:f1:29:81:49:6e:d1:04:38:41:13 ------BEGIN CERTIFICATE----- -MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UE -AwwJQUNDVlJBSVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQsw -CQYDVQQGEwJFUzAeFw0xMTA1MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQ -BgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwHUEtJQUNDVjENMAsGA1UECgwEQUND -VjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCb -qau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gMjmoY -HtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWo -G2ioPej0RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpA -lHPrzg5XPAOBOp0KoVdDaaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhr -IA8wKFSVf+DuzgpmndFALW4ir50awQUZ0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/ -0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDGWuzndN9wrqODJerWx5eH -k6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs78yM2x/47 -4KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMO -m3WR5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpa -cXpkatcnYGMN285J9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPl -uUsXQA+xtrn13k/c4LOsOxFwYIRKQ26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYI -KwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRwOi8vd3d3LmFjY3YuZXMvZmls -ZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEuY3J0MB8GCCsG -AQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 -VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeT -VfZW6oHlNsyMHj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIG -CCsGAQUFBwICMIIBFB6CARAAQQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUA -cgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBhAO0AegAgAGQAZQAgAGwAYQAgAEEA -QwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUAYwBuAG8AbABvAGcA -7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBjAHQA -cgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAA -QwBQAFMAIABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUA -czAwBggrBgEFBQcCARYkaHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2Mu -aHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRt -aW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2MV9kZXIuY3JsMA4GA1Ud -DwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZIhvcNAQEF -BQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdp -D70ER9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gU -JyCpZET/LtZ1qmxNYEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+m -AM/EKXMRNt6GGT6d7hmKG9Ww7Y49nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepD -vV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJTS+xJlsndQAJxGJ3KQhfnlms -tn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3sCPdK6jT2iWH -7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h -I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szA -h1xA2syVP1XgNce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xF -d3+YJ5oyXSrjhO7FmGYvliAd3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2H -pPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3pEfbRD0tVNEYqi4Y7 ------END CERTIFICATE----- - -# Issuer: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA -# Subject: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA -# Label: "TWCA Global Root CA" -# Serial: 3262 -# MD5 Fingerprint: f9:03:7e:cf:e6:9e:3c:73:7a:2a:90:07:69:ff:2b:96 -# SHA1 Fingerprint: 9c:bb:48:53:f6:a4:f6:d3:52:a4:e8:32:52:55:60:13:f5:ad:af:65 -# SHA256 Fingerprint: 59:76:90:07:f7:68:5d:0f:cd:50:87:2f:9f:95:d5:75:5a:5b:2b:45:7d:81:f3:69:2b:61:0a:98:67:2f:0e:1b ------BEGIN CERTIFICATE----- -MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcx -EjAQBgNVBAoTCVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMT -VFdDQSBHbG9iYWwgUm9vdCBDQTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5 -NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQKEwlUQUlXQU4tQ0ExEDAOBgNVBAsT -B1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3QgQ0EwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2CnJfF -10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz -0ALfUPZVr2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfCh -MBwqoJimFb3u/Rk28OKRQ4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbH -zIh1HrtsBv+baz4X7GGqcXzGHaL3SekVtTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc -46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1WKKD+u4ZqyPpcC1jcxkt2 -yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99sy2sbZCi -laLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYP -oA/pyJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQA -BDzfuBSO6N+pjWxnkjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcE -qYSjMq+u7msXi7Kx/mzhkIyIqJdIzshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm -4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB -/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6gcFGn90xHNcgL -1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn -LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WF -H6vPNOw/KP4M8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNo -RI2T9GRwoD2dKAXDOXC4Ynsg/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+ -nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlglPx4mI88k1HtQJAH32RjJMtOcQWh -15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryPA9gK8kxkRr05YuWW -6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3mi4TW -nsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5j -wa19hAM8EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWz -aGHQRiapIVJpLesux+t3zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmy -KwbQBM0= ------END CERTIFICATE----- - -# Issuer: CN=TeliaSonera Root CA v1 O=TeliaSonera -# Subject: CN=TeliaSonera Root CA v1 O=TeliaSonera -# Label: "TeliaSonera Root CA v1" -# Serial: 199041966741090107964904287217786801558 -# MD5 Fingerprint: 37:41:49:1b:18:56:9a:26:f5:ad:c2:66:fb:40:a5:4c -# SHA1 Fingerprint: 43:13:bb:96:f1:d5:86:9b:c1:4e:6a:92:f6:cf:f6:34:69:87:82:37 -# SHA256 Fingerprint: dd:69:36:fe:21:f8:f0:77:c1:23:a1:a5:21:c1:22:24:f7:22:55:b7:3e:03:a7:26:06:93:e8:a2:4b:0f:a3:89 ------BEGIN CERTIFICATE----- -MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw -NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv -b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD -VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2 -MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F -VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1 -7CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X -Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+ -/jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs -81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm -dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe -Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu -sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4 -pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs -slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ -arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD -VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG -9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl -dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx -0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj -TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed -Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7 -Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI -OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7 -vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW -t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn -HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx -SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= ------END CERTIFICATE----- - -# Issuer: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center -# Subject: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center -# Label: "T-TeleSec GlobalRoot Class 2" -# Serial: 1 -# MD5 Fingerprint: 2b:9b:9e:e4:7b:6c:1f:00:72:1a:cc:c1:77:79:df:6a -# SHA1 Fingerprint: 59:0d:2d:7d:88:4f:40:2e:61:7e:a5:62:32:17:65:cf:17:d8:94:e9 -# SHA256 Fingerprint: 91:e2:f5:78:8d:58:10:eb:a7:ba:58:73:7d:e1:54:8a:8e:ca:cd:01:45:98:bc:0b:14:3e:04:1b:17:05:25:52 ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx -KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd -BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl -YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1 -OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy -aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 -ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd -AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC -FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi -1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq -jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ -wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/ -WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy -NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC -uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw -IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6 -g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN -9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP -BSeOE6Fuwg== ------END CERTIFICATE----- - -# Issuer: CN=Atos TrustedRoot 2011 O=Atos -# Subject: CN=Atos TrustedRoot 2011 O=Atos -# Label: "Atos TrustedRoot 2011" -# Serial: 6643877497813316402 -# MD5 Fingerprint: ae:b9:c4:32:4b:ac:7f:5d:66:cc:77:94:bb:2a:77:56 -# SHA1 Fingerprint: 2b:b1:f5:3e:55:0c:1d:c5:f1:d4:e6:b7:6a:46:4b:55:06:02:ac:21 -# SHA256 Fingerprint: f3:56:be:a2:44:b7:a9:1e:b3:5d:53:ca:9a:d7:86:4a:ce:01:8e:2d:35:d5:f8:f9:6d:df:68:a6:f4:1a:a4:74 ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE -AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG -EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM -FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC -REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp -Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM -VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+ -SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ -4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L -cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi -eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV -HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG -A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3 -DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j -vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP -DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc -maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D -lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv -KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited -# Label: "QuoVadis Root CA 1 G3" -# Serial: 687049649626669250736271037606554624078720034195 -# MD5 Fingerprint: a4:bc:5b:3f:fe:37:9a:fa:64:f0:e2:fa:05:3d:0b:ab -# SHA1 Fingerprint: 1b:8e:ea:57:96:29:1a:c9:39:ea:b8:0a:81:1a:73:73:c0:93:79:67 -# SHA256 Fingerprint: 8a:86:6f:d1:b2:76:b5:7e:57:8e:92:1c:65:82:8a:2b:ed:58:e9:f2:f2:88:05:41:34:b7:f1:f4:bf:c9:cc:74 ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00 -MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakEPBtV -wedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWe -rNrwU8lmPNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF341 -68Xfuw6cwI2H44g4hWf6Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh -4Pw5qlPafX7PGglTvF0FBM+hSo+LdoINofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXp -UhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/lg6AnhF4EwfWQvTA9xO+o -abw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV7qJZjqlc -3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/G -KubX9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSt -hfbZxbGL0eUQMk1fiyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KO -Tk0k+17kBL5yG6YnLUlamXrXXAkgt3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOt -zCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZIhvcNAQELBQAD -ggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC -MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2 -cDMT/uFPpiN3GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUN -qXsCHKnQO18LwIE6PWThv6ctTr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5 -YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP+V04ikkwj+3x6xn0dxoxGE1nVGwv -b2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh3jRJjehZrJ3ydlo2 -8hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fawx/k -NSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNj -ZgKAvQU6O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhp -q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt -nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited -# Label: "QuoVadis Root CA 2 G3" -# Serial: 390156079458959257446133169266079962026824725800 -# MD5 Fingerprint: af:0c:86:6e:bf:40:2d:7f:0b:3e:12:50:ba:12:3d:06 -# SHA1 Fingerprint: 09:3c:61:f3:8b:8b:dc:7d:55:df:75:38:02:05:00:e1:25:f5:c8:36 -# SHA256 Fingerprint: 8f:e4:fb:0a:f9:3a:4d:0d:67:db:0b:eb:b2:3e:37:c7:1b:f3:25:dc:bc:dd:24:0e:a0:4d:af:58:b4:7e:18:40 ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00 -MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFhZiFf -qq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMW -n4rjyduYNM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ym -c5GQYaYDFCDy54ejiK2toIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+ -O7q414AB+6XrW7PFXmAqMaCvN+ggOp+oMiwMzAkd056OXbxMmO7FGmh77FOm6RQ1 -o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+lV0POKa2Mq1W/xPtbAd0j -IaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZoL1NesNKq -IcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz -8eQQsSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43eh -vNURG3YBZwjgQQvD6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l -7ZizlWNof/k19N+IxWA1ksB8aRxhlRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALG -cC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZIhvcNAQELBQAD -ggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66 -AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RC -roijQ1h5fq7KpVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0Ga -W/ZZGYjeVYg3UQt4XAoeo0L9x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4n -lv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgzdWqTHBLmYF5vHX/JHyPLhGGfHoJE -+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6XU/IyAgkwo1jwDQHV -csaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+NwmNtd -dbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNg -KCLjsZWDzYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeM -HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4 -WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited -# Label: "QuoVadis Root CA 3 G3" -# Serial: 268090761170461462463995952157327242137089239581 -# MD5 Fingerprint: df:7d:b9:ad:54:6f:68:a1:df:89:57:03:97:43:b0:d7 -# SHA1 Fingerprint: 48:12:bd:92:3c:a8:c4:39:06:e7:30:6d:27:96:e6:a4:cf:22:2e:7d -# SHA256 Fingerprint: 88:ef:81:de:20:2e:b0:18:45:2e:43:f8:64:72:5c:ea:5f:bd:1f:c2:d9:d2:05:73:07:09:c5:d8:b8:69:0f:46 ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00 -MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286IxSR -/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNu -FoM7pmRLMon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXR -U7Ox7sWTaYI+FrUoRqHe6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+c -ra1AdHkrAj80//ogaX3T7mH1urPnMNA3I4ZyYUUpSFlob3emLoG+B01vr87ERROR -FHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3UVDmrJqMz6nWB2i3ND0/k -A9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f75li59wzw -eyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634Ryl -sSqiMd5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBp -VzgeAVuNVejH38DMdyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0Q -A4XN8f+MFrXBsj6IbGB/kE+V9/YtrQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ -ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZIhvcNAQELBQAD -ggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px -KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnI -FUBhynLWcKzSt/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5Wvv -oxXqA/4Ti2Tk08HS6IT7SdEQTXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFg -u/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9DuDcpmvJRPpq3t/O5jrFc/ZSXPsoaP -0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGibIh6BJpsQBJFxwAYf -3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmDhPbl -8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+ -DhcI00iX0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HN -PlopNLk9hM6xZdRZkZFWdSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ -ywaZWWDYWGWVjUTR939+J399roD1B0y2PpxxVJkES/1Y+Zj0 ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Assured ID Root G2" -# Serial: 15385348160840213938643033620894905419 -# MD5 Fingerprint: 92:38:b9:f8:63:24:82:65:2c:57:33:e6:fe:81:8f:9d -# SHA1 Fingerprint: a1:4b:48:d9:43:ee:0a:0e:40:90:4f:3c:e0:a4:c0:91:93:51:5d:3f -# SHA256 Fingerprint: 7d:05:eb:b6:82:33:9f:8c:94:51:ee:09:4e:eb:fe:fa:79:53:a1:14:ed:b2:f4:49:49:45:2f:ab:7d:2f:c1:85 ------BEGIN CERTIFICATE----- -MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBl -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv -b3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl -cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSA -n61UQbVH35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4Htecc -biJVMWWXvdMX0h5i89vqbFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9Hp -EgjAALAcKxHad3A2m67OeYfcgnDmCXRwVWmvo2ifv922ebPynXApVfSr/5Vh88lA -bx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OPYLfykqGxvYmJHzDNw6Yu -YjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+RnlTGNAgMB -AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW -BBTOw0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPI -QW5pJ6d1Ee88hjZv0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I -0jJmwYrA8y8678Dj1JGG0VDjA9tzd29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4Gni -lmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAWhsI6yLETcDbYz+70CjTVW0z9 -B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0MjomZmWzwPDCv -ON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo -IhNzbM8m9Yop5w== ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Assured ID Root G3" -# Serial: 15459312981008553731928384953135426796 -# MD5 Fingerprint: 7c:7f:65:31:0c:81:df:8d:ba:3e:99:e2:5c:ad:6e:fb -# SHA1 Fingerprint: f5:17:a2:4f:9a:48:c6:c9:f8:a2:00:26:9f:dc:0f:48:2c:ab:30:89 -# SHA256 Fingerprint: 7e:37:cb:8b:4c:47:09:0c:ab:36:55:1b:a6:f4:5d:b8:40:68:0f:ba:16:6a:95:2d:b1:00:71:7f:43:05:3f:c2 ------BEGIN CERTIFICATE----- -MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQsw -CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu -ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg -RzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJV -UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu -Y29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJf -Zn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17Q -RSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ -BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQD -AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY -JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv -6pZjamVFkpUBtA== ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Global Root G2" -# Serial: 4293743540046975378534879503202253541 -# MD5 Fingerprint: e4:a6:8a:c8:54:ac:52:42:46:0a:fd:72:48:1b:2a:44 -# SHA1 Fingerprint: df:3c:24:f9:bf:d6:66:76:1b:26:80:73:fe:06:d1:cc:8d:4f:82:a4 -# SHA256 Fingerprint: cb:3c:cb:b7:60:31:e5:e0:13:8f:8d:d3:9a:23:f9:de:47:ff:c3:5e:43:c1:14:4c:ea:27:d4:6a:5a:b1:cb:5f ------BEGIN CERTIFICATE----- -MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH -MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT -MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j -b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI -2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx -1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ -q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz -tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ -vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP -BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV -5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY -1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 -NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG -Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 -8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe -pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl -MrY= ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Global Root G3" -# Serial: 7089244469030293291760083333884364146 -# MD5 Fingerprint: f5:5d:a4:50:a5:fb:28:7e:1e:0f:0d:cc:96:57:56:ca -# SHA1 Fingerprint: 7e:04:de:89:6a:3e:66:6d:00:e6:87:d3:3f:fa:d9:3b:e8:3d:34:9e -# SHA256 Fingerprint: 31:ad:66:48:f8:10:41:38:c7:38:f3:9e:a4:32:01:33:39:3e:3a:18:cc:02:29:6e:f9:7c:2a:c9:ef:67:31:d0 ------BEGIN CERTIFICATE----- -MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw -CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu -ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe -Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw -EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x -IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF -K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG -fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO -Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd -BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx -AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ -oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 -sycX ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Trusted Root G4" -# Serial: 7451500558977370777930084869016614236 -# MD5 Fingerprint: 78:f2:fc:aa:60:1f:2f:b4:eb:c9:37:ba:53:2e:75:49 -# SHA1 Fingerprint: dd:fb:16:cd:49:31:c9:73:a2:03:7d:3f:c8:3a:4d:7d:77:5d:05:e4 -# SHA256 Fingerprint: 55:2f:7b:dc:f1:a7:af:9e:6c:e6:72:01:7f:4f:12:ab:f7:72:40:c7:8e:76:1a:c2:03:d1:d9:d2:0a:c8:99:88 ------BEGIN CERTIFICATE----- -MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3Qg -RzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBiMQswCQYDVQQGEwJV -UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu -Y29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3y -ithZwuEppz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1If -xp4VpX6+n6lXFllVcq9ok3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDV -ySAdYyktzuxeTsiT+CFhmzTrBcZe7FsavOvJz82sNEBfsXpm7nfISKhmV1efVFiO -DCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGYQJB5w3jHtrHEtWoYOAMQ -jdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6MUSaM0C/ -CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCi -EhtmmnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADM -fRyVw4/3IbKyEbe7f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QY -uKZ3AeEPlAwhHbJUKSWJbOUOUlFHdL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXK -chYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8oR7FwI+isX4KJpn15GkvmB0t -9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -hjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD -ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2 -SV1EY+CtnJYYZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd -+SeuMIW59mdNOj6PWTkiU0TryF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWc -fFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy7zBZLq7gcfJW5GqXb5JQbZaNaHqa -sjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iahixTXTBmyUEFxPT9N -cCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN5r5N -0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie -4u1Ki7wb/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mI -r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1 -/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm -gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+ ------END CERTIFICATE----- - -# Issuer: CN=COMODO RSA Certification Authority O=COMODO CA Limited -# Subject: CN=COMODO RSA Certification Authority O=COMODO CA Limited -# Label: "COMODO RSA Certification Authority" -# Serial: 101909084537582093308941363524873193117 -# MD5 Fingerprint: 1b:31:b0:71:40:36:cc:14:36:91:ad:c4:3e:fd:ec:18 -# SHA1 Fingerprint: af:e5:d2:44:a8:d1:19:42:30:ff:47:9f:e2:f8:97:bb:cd:7a:8c:b4 -# SHA256 Fingerprint: 52:f0:e1:c4:e5:8e:c6:29:29:1b:60:31:7f:07:46:71:b8:5d:7e:a8:0d:5b:07:27:34:63:53:4b:32:b4:02:34 ------BEGIN CERTIFICATE----- -MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB -hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV -BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5 -MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT -EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR -Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR -6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X -pz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZFGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC -9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+5eNu/Nio5JIk2kNrYrhV -/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pGx8cgoLEf -Zd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z -+pUX2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7w -qP/0uK3pN/u6uPQLOvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZah -SL0896+1DSJMwBGB7FY79tOi4lu3sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVIC -u9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+CGCe01a60y1Dma/RMhnEw6abf -Fobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5WdYgGq/yapiq -crxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E -FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB -/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvl -wFTPoCWOAvn9sKIN9SCYPBMtrFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM -4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+nq6PK7o9mfjYcwlYRm6mnPTXJ9OV -2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSgtZx8jb8uk2Intzna -FxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwWsRqZ -CuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiK -boHGhfKppC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmcke -jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL -S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb -QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl -0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB -NVOFBkpdn627G190 ------END CERTIFICATE----- - -# Issuer: CN=USERTrust RSA Certification Authority O=The USERTRUST Network -# Subject: CN=USERTrust RSA Certification Authority O=The USERTRUST Network -# Label: "USERTrust RSA Certification Authority" -# Serial: 2645093764781058787591871645665788717 -# MD5 Fingerprint: 1b:fe:69:d1:91:b7:19:33:a3:72:a8:0f:e1:55:e5:b5 -# SHA1 Fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e -# SHA256 Fingerprint: e7:93:c9:b0:2f:d8:aa:13:e2:1c:31:22:8a:cc:b0:81:19:64:3b:74:9c:89:89:64:b1:74:6d:46:c3:d4:cb:d2 ------BEGIN CERTIFICATE----- -MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB -iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl -cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV -BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw -MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV -BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU -aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy -dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK -AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B -3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY -tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/ -Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2 -VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT -79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6 -c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT -Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l -c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee -UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE -Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd -BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G -A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF -Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO -VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3 -ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs -8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR -iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze -Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ -XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/ -qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB -VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB -L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG -jjxDah2nGN59PRbxYvnKkKj9 ------END CERTIFICATE----- - -# Issuer: CN=USERTrust ECC Certification Authority O=The USERTRUST Network -# Subject: CN=USERTrust ECC Certification Authority O=The USERTRUST Network -# Label: "USERTrust ECC Certification Authority" -# Serial: 123013823720199481456569720443997572134 -# MD5 Fingerprint: fa:68:bc:d9:b5:7f:ad:fd:c9:1d:06:83:28:cc:24:c1 -# SHA1 Fingerprint: d1:cb:ca:5d:b2:d5:2a:7f:69:3b:67:4d:e5:f0:5a:1d:0c:95:7d:f0 -# SHA256 Fingerprint: 4f:f4:60:d5:4b:9c:86:da:bf:bc:fc:57:12:e0:40:0d:2b:ed:3f:bc:4d:4f:bd:aa:86:e0:6a:dc:d2:a9:ad:7a ------BEGIN CERTIFICATE----- -MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl -eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT -JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAx -MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT -Ck5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUg -VVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqflo -I+d61SRvU8Za2EurxtW20eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinng -o4N+LZfQYcTxmdwlkWOrfzCjtHDix6EznPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0G -A1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBBHU6+4WMB -zzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbW -RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 -# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 -# Label: "GlobalSign ECC Root CA - R5" -# Serial: 32785792099990507226680698011560947931244 -# MD5 Fingerprint: 9f:ad:3b:1c:02:1e:8a:ba:17:74:38:81:0c:a2:bc:08 -# SHA1 Fingerprint: 1f:24:c6:30:cd:a4:18:ef:20:69:ff:ad:4f:dd:5f:46:3a:1b:69:aa -# SHA256 Fingerprint: 17:9f:bc:14:8a:3d:d0:0f:d2:4e:a1:34:58:cc:43:bf:a7:f5:9c:81:82:d7:83:a5:13:f6:eb:ec:10:0c:89:24 ------BEGIN CERTIFICATE----- -MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEk -MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpH -bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX -DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD -QSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu -MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6SFkc -8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke -hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI -KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg -515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO -xwy8p2Fp8fc74SrL+SvzZpA3 ------END CERTIFICATE----- - -# Issuer: CN=IdenTrust Commercial Root CA 1 O=IdenTrust -# Subject: CN=IdenTrust Commercial Root CA 1 O=IdenTrust -# Label: "IdenTrust Commercial Root CA 1" -# Serial: 13298821034946342390520003877796839426 -# MD5 Fingerprint: b3:3e:77:73:75:ee:a0:d3:e3:7e:49:63:49:59:bb:c7 -# SHA1 Fingerprint: df:71:7e:aa:4a:d9:4e:c9:55:84:99:60:2d:48:de:5f:bc:f0:3a:25 -# SHA256 Fingerprint: 5d:56:49:9b:e4:d2:e0:8b:cf:ca:d0:8a:3e:38:72:3d:50:50:3b:de:70:69:48:e4:2f:55:60:30:19:e5:28:ae ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBK -MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVu -VHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQw -MTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScw -JQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ldhNlT -3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU -+ehcCuz/mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gp -S0l4PJNgiCL8mdo2yMKi1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1 -bVoE/c40yiTcdCMbXTMTEl3EASX2MN0CXZ/g1Ue9tOsbobtJSdifWwLziuQkkORi -T0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl3ZBWzvurpWCdxJ35UrCL -vYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzyNeVJSQjK -Vsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZK -dHzVWYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHT -c+XvvqDtMwt0viAgxGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hv -l7yTmvmcEpB4eoCHFddydJxVdHixuuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5N -iGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB -/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZIhvcNAQELBQAD -ggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH -6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwt -LRvM7Kqas6pgghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93 -nAbowacYXVKV7cndJZ5t+qntozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3 -+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmVYjzlVYA211QC//G5Xc7UI2/YRYRK -W2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUXfeu+h1sXIFRRk0pT -AwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/rokTLq -l1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG -4iZZRHUe2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZ -mUlO+KWA2yUPHGNiiskzZ2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A -7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7RcGzM7vRX+Bi6hG6H ------END CERTIFICATE----- - -# Issuer: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust -# Subject: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust -# Label: "IdenTrust Public Sector Root CA 1" -# Serial: 13298821034946342390521976156843933698 -# MD5 Fingerprint: 37:06:a5:b0:fc:89:9d:ba:f4:6b:8c:1a:64:cd:d5:ba -# SHA1 Fingerprint: ba:29:41:60:77:98:3f:f4:f3:ef:f2:31:05:3b:2e:ea:6d:4d:45:fd -# SHA256 Fingerprint: 30:d0:89:5a:9a:44:8a:26:20:91:63:55:22:d1:f5:20:10:b5:86:7a:ca:e1:2c:78:ef:95:8f:d4:f4:38:9f:2f ------BEGIN CERTIFICATE----- -MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBN -MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVu -VHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcN -MzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0 -MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTyP4o7 -ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGy -RBb06tD6Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlS -bdsHyo+1W/CD80/HLaXIrcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF -/YTLNiCBWS2ab21ISGHKTN9T0a9SvESfqy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R -3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoSmJxZZoY+rfGwyj4GD3vw -EUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFnol57plzy -9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9V -GxyhLrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ -2fjXctscvG29ZV/viDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsV -WaFHVCkugyhfHMKiq3IXAAaOReyL4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gD -W/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMwDQYJKoZIhvcN -AQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj -t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHV -DRDtfULAj+7AmgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9 -TaDKQGXSc3z1i9kKlT/YPyNtGtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8G -lwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFtm6/n6J91eEyrRjuazr8FGF1NFTwW -mhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMxNRF4eKLg6TCMf4Df -WN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4Mhn5 -+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJ -tshquDDIajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhA -GaQdp/lLQzfcaFpPz+vCZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv -8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ3Wl9af0AVqW3rLatt8o+Ae+c ------END CERTIFICATE----- - -# Issuer: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only -# Subject: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only -# Label: "Entrust Root Certification Authority - G2" -# Serial: 1246989352 -# MD5 Fingerprint: 4b:e2:c9:91:96:65:0c:f4:0e:5a:93:92:a0:0a:fe:b2 -# SHA1 Fingerprint: 8c:f4:27:fd:79:0c:3a:d1:66:06:8d:e8:1e:57:ef:bb:93:22:72:d4 -# SHA256 Fingerprint: 43:df:57:74:b0:3e:7f:ef:5f:e4:0d:93:1a:7b:ed:f1:bb:2e:6b:42:73:8c:4e:6d:38:41:10:3d:3a:a7:f3:39 ------BEGIN CERTIFICATE----- -MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50 -cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs -IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz -dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy -NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu -dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt -dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0 -aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T -RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN -cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW -wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1 -U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0 -jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN -BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/ -jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ -Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v -1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R -nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH -VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g== ------END CERTIFICATE----- - -# Issuer: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only -# Subject: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only -# Label: "Entrust Root Certification Authority - EC1" -# Serial: 51543124481930649114116133369 -# MD5 Fingerprint: b6:7e:1d:f0:58:c5:49:6c:24:3b:3d:ed:98:18:ed:bc -# SHA1 Fingerprint: 20:d8:06:40:df:9b:25:f5:12:25:3a:11:ea:f7:59:8a:eb:14:b5:47 -# SHA256 Fingerprint: 02:ed:0e:b2:8c:14:da:45:16:5c:56:67:91:70:0d:64:51:d7:fb:56:f0:b2:ab:1d:3b:8e:b0:70:e5:6e:df:f5 ------BEGIN CERTIFICATE----- -MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG -A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3 -d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu -dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq -RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy -MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD -VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0 -L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g -Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD -ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi -A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt -ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH -Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O -BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC -R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX -hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G ------END CERTIFICATE----- - -# Issuer: CN=CFCA EV ROOT O=China Financial Certification Authority -# Subject: CN=CFCA EV ROOT O=China Financial Certification Authority -# Label: "CFCA EV ROOT" -# Serial: 407555286 -# MD5 Fingerprint: 74:e1:b6:ed:26:7a:7a:44:30:33:94:ab:7b:27:81:30 -# SHA1 Fingerprint: e2:b8:29:4b:55:84:ab:6b:58:c2:90:46:6c:ac:3f:b8:39:8f:84:83 -# SHA256 Fingerprint: 5c:c3:d7:8e:4e:1d:5e:45:54:7a:04:e6:87:3e:64:f9:0c:f9:53:6d:1c:cc:2e:f8:00:f3:55:c4:c5:fd:70:fd ------BEGIN CERTIFICATE----- -MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD -TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y -aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx -MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j -aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP -T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03 -sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL -TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5 -/ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp -7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz -EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt -hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP -a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot -aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg -TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV -PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv -cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL -tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd -BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB -ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT -ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL -jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS -ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy -P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19 -xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d -Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN -5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe -/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z -AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ -5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su ------END CERTIFICATE----- - -# Issuer: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed -# Subject: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed -# Label: "OISTE WISeKey Global Root GB CA" -# Serial: 157768595616588414422159278966750757568 -# MD5 Fingerprint: a4:eb:b9:61:28:2e:b7:2f:98:b0:35:26:90:99:51:1d -# SHA1 Fingerprint: 0f:f9:40:76:18:d3:d7:6a:4b:98:f0:a8:35:9e:0c:fd:27:ac:cc:ed -# SHA256 Fingerprint: 6b:9c:08:e8:6e:b0:f7:67:cf:ad:65:cd:98:b6:21:49:e5:49:4a:67:f5:84:5e:7b:d1:ed:01:9f:27:b8:6b:d6 ------BEGIN CERTIFICATE----- -MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBt -MQswCQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUg -Rm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9i -YWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAwMzJaFw0zOTEyMDExNTEwMzFaMG0x -CzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBG -b3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh -bCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3 -HEokKtaXscriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGx -WuR51jIjK+FTzJlFXHtPrby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX -1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNk -u7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4oQnc/nSMbsrY9gBQHTC5P -99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvgGUpuuy9r -M2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUB -BAMCAQAwDQYJKoZIhvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrgh -cViXfa43FK8+5/ea4n32cZiZBKpDdHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5 -gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0VQreUGdNZtGn//3ZwLWoo4rO -ZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEuiHZeeevJuQHHf -aPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic -Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM= ------END CERTIFICATE----- - -# Issuer: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. -# Subject: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. -# Label: "SZAFIR ROOT CA2" -# Serial: 357043034767186914217277344587386743377558296292 -# MD5 Fingerprint: 11:64:c1:89:b0:24:b1:8c:b1:07:7e:89:9e:51:9e:99 -# SHA1 Fingerprint: e2:52:fa:95:3f:ed:db:24:60:bd:6e:28:f3:9c:cc:cf:5e:b3:3f:de -# SHA256 Fingerprint: a1:33:9d:33:28:1a:0b:56:e5:57:d3:d3:2b:1c:e7:f9:36:7e:b0:94:bd:5f:a7:2a:7e:50:04:c8:de:d7:ca:fe ------BEGIN CERTIFICATE----- -MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQEL -BQAwUTELMAkGA1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6 -ZW5pb3dhIFMuQS4xGDAWBgNVBAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkw -NzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJBgNVBAYTAlBMMSgwJgYDVQQKDB9L -cmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYDVQQDDA9TWkFGSVIg -Uk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5QqEvN -QLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT -3PSQ1hNKDJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw -3gAeqDRHu5rr/gsUvTaE2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr6 -3fE9biCloBK0TXC5ztdyO4mTp4CEHCdJckm1/zuVnsHMyAHs6A6KCpbns6aH5db5 -BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwiieDhZNRnvDF5YTy7ykHN -XGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD -AgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsF -AAOCAQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw -8PRBEew/R40/cof5O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOG -nXkZ7/e7DDWQw4rtTw/1zBLZpD67oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCP -oky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul4+vJhaAlIDf7js4MNIThPIGy -d05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6+/NNIxuZMzSg -LvWpCz/UXeHPhJ/iGcJfitYgHuNztw== ------END CERTIFICATE----- - -# Issuer: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority -# Subject: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority -# Label: "Certum Trusted Network CA 2" -# Serial: 44979900017204383099463764357512596969 -# MD5 Fingerprint: 6d:46:9e:d9:25:6d:08:23:5b:5e:74:7d:1e:27:db:f2 -# SHA1 Fingerprint: d3:dd:48:3e:2b:bf:4c:05:e8:af:10:f5:fa:76:26:cf:d3:dc:30:92 -# SHA256 Fingerprint: b6:76:f2:ed:da:e8:77:5c:d3:6c:b0:f6:3c:d1:d4:60:39:61:f4:9e:62:65:ba:01:3a:2f:03:07:b6:d0:b8:04 ------BEGIN CERTIFICATE----- -MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCB -gDELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu -QS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIG -A1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29yayBDQSAyMCIYDzIwMTExMDA2MDgz -OTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQTDEiMCAGA1UEChMZ -VW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3 -b3JrIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWA -DGSdhhuWZGc/IjoedQF97/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn -0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+oCgCXhVqqndwpyeI1B+twTUrWwbNWuKFB -OJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40bRr5HMNUuctHFY9rnY3lE -fktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2puTRZCr+E -Sv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1m -o130GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02i -sx7QBlrd9pPPV3WZ9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOW -OZV7bIBaTxNyxtd9KXpEulKkKtVBRgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgez -Tv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pyehizKV/Ma5ciSixqClnrDvFAS -adgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vMBhBgu4M1t15n -3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD -AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMC -AQYwDQYJKoZIhvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQ -F/xlhMcQSZDe28cmk4gmb3DWAl45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTf -CVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuAL55MYIR4PSFk1vtBHxgP58l1cb29 -XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMoclm2q8KMZiYcdywm -djWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tMpkT/ -WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jb -AoJnwTnbw3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksq -P/ujmv5zMnHCnsZy4YpoJ/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Ko -b7a6bINDd82Kkhehnlt4Fj1F4jNy3eFmypnTycUm/Q1oBEauttmbjL4ZvrHG8hnj -XALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLXis7VmFxWlgPF7ncGNf/P -5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7zAYspsbi -DrW5viSP ------END CERTIFICATE----- - -# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority -# Subject: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority -# Label: "Hellenic Academic and Research Institutions RootCA 2015" -# Serial: 0 -# MD5 Fingerprint: ca:ff:e2:db:03:d9:cb:4b:e9:0f:ad:84:fd:7b:18:ce -# SHA1 Fingerprint: 01:0c:06:95:a6:98:19:14:ff:bf:5f:c6:b0:b6:95:ea:29:e9:12:a6 -# SHA256 Fingerprint: a0:40:92:9a:02:ce:53:b4:ac:f4:f2:ff:c6:98:1c:e4:49:6f:75:5e:6d:45:fe:0b:2a:69:2b:cd:52:52:3f:36 ------BEGIN CERTIFICATE----- -MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1Ix -DzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5k -IFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMT -N0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9v -dENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAxMTIxWjCBpjELMAkG -A1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNh -ZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkx -QDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 -dGlvbnMgUm9vdENBIDIwMTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC -AQDC+Kk/G4n8PDwEXT2QNrCROnk8ZlrvbTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA -4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+ehiGsxr/CL0BgzuNtFajT0 -AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+6PAQZe10 -4S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06C -ojXdFPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV -9Cz82XBST3i4vTwri5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrD -gfgXy5I2XdGj2HUb4Ysn6npIQf1FGQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6 -Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2fu/Z8VFRfS0myGlZYeCsargq -NhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9muiNX6hME6wGko -LfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc -Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVd -ctA4GGqd83EkVAswDQYJKoZIhvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0I -XtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+D1hYc2Ryx+hFjtyp8iY/xnmMsVMI -M4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrMd/K4kPFox/la/vot -9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+yd+2V -Z5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/ea -j8GsGsVn82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnh -X9izjFk0WaSrT2y7HxjbdavYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQ -l033DlZdwJVqwjbDG2jJ9SrcR5q+ss7FJej6A7na+RZukYT1HCjI/CbM1xyQVqdf -bzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVtJ94Cj8rDtSvK6evIIVM4 -pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGaJI7ZjnHK -e7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0 -vm9qp/UsQu0yrbYhnr68 ------END CERTIFICATE----- - -# Issuer: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority -# Subject: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority -# Label: "Hellenic Academic and Research Institutions ECC RootCA 2015" -# Serial: 0 -# MD5 Fingerprint: 81:e5:b4:17:eb:c2:f5:e1:4b:0d:41:7b:49:92:fe:ef -# SHA1 Fingerprint: 9f:f1:71:8d:92:d5:9a:f3:7d:74:97:b4:bc:6f:84:68:0b:ba:b6:66 -# SHA256 Fingerprint: 44:b5:45:aa:8a:25:e6:5a:73:ca:15:dc:27:fc:36:d2:4c:1c:b9:95:3a:06:65:39:b1:15:82:dc:48:7b:48:33 ------BEGIN CERTIFICATE----- -MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzAN -BgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl -c2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hl -bGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgRUNDIFJv -b3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEwMzcxMlowgaoxCzAJ -BgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmljIEFj -YWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5 -MUQwQgYDVQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0 -dXRpb25zIEVDQyBSb290Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKg -QehLgoRc4vgxEZmGZE4JJS+dQS8KrjVPdJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJa -jq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoKVlp8aQuqgAkkbH7BRqNC -MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLQi -C4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaep -lSTAGiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7Sof -TUwJCA3sS61kFyjndc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR ------END CERTIFICATE----- - -# Issuer: CN=ISRG Root X1 O=Internet Security Research Group -# Subject: CN=ISRG Root X1 O=Internet Security Research Group -# Label: "ISRG Root X1" -# Serial: 172886928669790476064670243504169061120 -# MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e -# SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8 -# SHA256 Fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6 ------BEGIN CERTIFICATE----- -MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw -TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh -cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 -WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu -ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY -MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc -h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ -0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U -A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW -T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH -B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC -B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv -KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn -OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn -jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw -qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI -rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq -hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL -ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ -3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK -NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 -ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur -TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC -jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc -oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq -4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA -mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d -emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= ------END CERTIFICATE----- - -# Issuer: O=FNMT-RCM OU=AC RAIZ FNMT-RCM -# Subject: O=FNMT-RCM OU=AC RAIZ FNMT-RCM -# Label: "AC RAIZ FNMT-RCM" -# Serial: 485876308206448804701554682760554759 -# MD5 Fingerprint: e2:09:04:b4:d3:bd:d1:a0:14:fd:1a:d2:47:c4:57:1d -# SHA1 Fingerprint: ec:50:35:07:b2:15:c4:95:62:19:e2:a8:9a:5b:42:99:2c:4c:2c:20 -# SHA256 Fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa ------BEGIN CERTIFICATE----- -MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsx -CzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJ -WiBGTk1ULVJDTTAeFw0wODEwMjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJ -BgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBG -Tk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALpxgHpMhm5/ -yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcfqQgf -BBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAz -WHFctPVrbtQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxF -tBDXaEAUwED653cXeuYLj2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z -374jNUUeAlz+taibmSXaXvMiwzn15Cou08YfxGyqxRxqAQVKL9LFwag0Jl1mpdIC -IfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mwWsXmo8RZZUc1g16p6DUL -mbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnTtOmlcYF7 -wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peS -MKGJ47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2 -ZSysV4999AeU14ECll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMet -UqIJ5G+GR4of6ygnXYMgrwTJbFaai0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUw -AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFPd9xf3E6Jobd2Sn9R2gzL+H -YJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1odHRwOi8vd3d3 -LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD -nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1 -RXxlDPiyN8+sD8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYM -LVN0V2Ue1bLdI4E7pWYjJ2cJj+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf -77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrTQfv6MooqtyuGC2mDOL7Nii4LcK2N -JpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW+YJF1DngoABd15jm -fZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7Ixjp -6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp -1txyM/1d8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B -9kiABdcPUXmsEKvU7ANm5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wok -RqEIr9baRRmW1FMdW4R58MD3R++Lj8UGrp1MYp3/RgT408m2ECVAdf4WqslKYIYv -uu8wd+RU4riEmViAqhOLUTpPSPaLtrM= ------END CERTIFICATE----- - -# Issuer: CN=Amazon Root CA 1 O=Amazon -# Subject: CN=Amazon Root CA 1 O=Amazon -# Label: "Amazon Root CA 1" -# Serial: 143266978916655856878034712317230054538369994 -# MD5 Fingerprint: 43:c6:bf:ae:ec:fe:ad:2f:18:c6:88:68:30:fc:c8:e6 -# SHA1 Fingerprint: 8d:a7:f9:65:ec:5e:fc:37:91:0f:1c:6e:59:fd:c1:cc:6a:6e:de:16 -# SHA256 Fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e ------BEGIN CERTIFICATE----- -MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF -ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 -b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL -MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv -b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj -ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM -9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw -IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6 -VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L -93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm -jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA -A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI -U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs -N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv -o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU -5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy -rqXRfboQnoZsG4q5WTP468SQvvG5 ------END CERTIFICATE----- - -# Issuer: CN=Amazon Root CA 2 O=Amazon -# Subject: CN=Amazon Root CA 2 O=Amazon -# Label: "Amazon Root CA 2" -# Serial: 143266982885963551818349160658925006970653239 -# MD5 Fingerprint: c8:e5:8d:ce:a8:42:e2:7a:c0:2a:5c:7c:9e:26:bf:66 -# SHA1 Fingerprint: 5a:8c:ef:45:d7:a6:98:59:76:7a:8c:8b:44:96:b5:78:cf:47:4b:1a -# SHA256 Fingerprint: 1b:a5:b2:aa:8c:65:40:1a:82:96:01:18:f8:0b:ec:4f:62:30:4d:83:ce:c4:71:3a:19:c3:9c:01:1e:a4:6d:b4 ------BEGIN CERTIFICATE----- -MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF -ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 -b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL -MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv -b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK -gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ -W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg -1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K -8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r -2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me -z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR -8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj -mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz -7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6 -+XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI -0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB -Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm -UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2 -LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY -+gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS -k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl -7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm -btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl -urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+ -fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63 -n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE -76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H -9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT -4PsJYGw= ------END CERTIFICATE----- - -# Issuer: CN=Amazon Root CA 3 O=Amazon -# Subject: CN=Amazon Root CA 3 O=Amazon -# Label: "Amazon Root CA 3" -# Serial: 143266986699090766294700635381230934788665930 -# MD5 Fingerprint: a0:d4:ef:0b:f7:b5:d8:49:95:2a:ec:f5:c4:fc:81:87 -# SHA1 Fingerprint: 0d:44:dd:8c:3c:8c:1a:1a:58:75:64:81:e9:0f:2e:2a:ff:b3:d2:6e -# SHA256 Fingerprint: 18:ce:6c:fe:7b:f1:4e:60:b2:e3:47:b8:df:e8:68:cb:31:d0:2e:bb:3a:da:27:15:69:f5:03:43:b4:6d:b3:a4 ------BEGIN CERTIFICATE----- -MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5 -MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g -Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG -A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg -Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl -ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr -ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr -BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM -YyRIHN8wfdVoOw== ------END CERTIFICATE----- - -# Issuer: CN=Amazon Root CA 4 O=Amazon -# Subject: CN=Amazon Root CA 4 O=Amazon -# Label: "Amazon Root CA 4" -# Serial: 143266989758080763974105200630763877849284878 -# MD5 Fingerprint: 89:bc:27:d5:eb:17:8d:06:6a:69:d5:fd:89:47:b4:cd -# SHA1 Fingerprint: f6:10:84:07:d6:f8:bb:67:98:0c:c2:e2:44:c2:eb:ae:1c:ef:63:be -# SHA256 Fingerprint: e3:5d:28:41:9e:d0:20:25:cf:a6:90:38:cd:62:39:62:45:8d:a5:c6:95:fb:de:a3:c2:2b:0b:fb:25:89:70:92 ------BEGIN CERTIFICATE----- -MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5 -MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g -Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG -A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg -Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi -9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk -M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB -/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB -MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw -CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW -1KyLa2tJElMzrdfkviT8tQp21KW8EA== ------END CERTIFICATE----- - -# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM -# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM -# Label: "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1" -# Serial: 1 -# MD5 Fingerprint: dc:00:81:dc:69:2f:3e:2f:b0:3b:f6:3d:5a:91:8e:49 -# SHA1 Fingerprint: 31:43:64:9b:ec:ce:27:ec:ed:3a:3f:0b:8f:0d:e4:e8:91:dd:ee:ca -# SHA256 Fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 ------BEGIN CERTIFICATE----- -MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIx -GDAWBgNVBAcTD0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxp -bXNlbCB2ZSBUZWtub2xvamlrIEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0w -KwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24gTWVya2V6aSAtIEthbXUgU00xNjA0 -BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRpZmlrYXNpIC0gU3Vy -dW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYDVQQG -EwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXll -IEJpbGltc2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklU -QUsxLTArBgNVBAsTJEthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBT -TTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11IFNNIFNTTCBLb2sgU2VydGlmaWthc2kg -LSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr3UwM6q7 -a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y86Ij5iySr -LqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INr -N3wcwv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2X -YacQuFWQfw4tJzh03+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/ -iSIzL+aFCr2lqBs23tPcLG07xxO9WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4f -AJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQUZT/HiobGPN08VFw1+DrtUgxH -V8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL -BQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh -AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPf -IPP54+M638yclNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4 -lzwDGrpDxpa5RXI4s6ehlj2Re37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c -8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0jq5Rm+K37DwhuJi1/FwcJsoz7UMCf -lo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= ------END CERTIFICATE----- - -# Issuer: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. -# Subject: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. -# Label: "GDCA TrustAUTH R5 ROOT" -# Serial: 9009899650740120186 -# MD5 Fingerprint: 63:cc:d9:3d:34:35:5c:6f:53:a3:e2:08:70:48:1f:b4 -# SHA1 Fingerprint: 0f:36:38:5b:81:1a:25:c3:9b:31:4e:83:ca:e9:34:66:70:cc:74:b4 -# SHA256 Fingerprint: bf:ff:8f:d0:44:33:48:7d:6a:8a:a6:0c:1a:29:76:7a:9f:c2:bb:b0:5e:42:0f:71:3a:13:b9:92:89:1d:38:93 ------BEGIN CERTIFICATE----- -MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UE -BhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ -IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0 -MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVowYjELMAkGA1UEBhMCQ04xMjAwBgNV -BAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8w -HQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJj -Dp6L3TQsAlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBj -TnnEt1u9ol2x8kECK62pOqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+u -KU49tm7srsHwJ5uu4/Ts765/94Y9cnrrpftZTqfrlYwiOXnhLQiPzLyRuEH3FMEj -qcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ9Cy5WmYqsBebnh52nUpm -MUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQxXABZG12 -ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloP -zgsMR6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3Gk -L30SgLdTMEZeS1SZD2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeC -jGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4oR24qoAATILnsn8JuLwwoC8N9VKejveSswoA -HQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx9hoh49pwBiFYFIeFd3mqgnkC -AwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlRMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg -p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZm -DRd9FBUb1Ov9H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5 -COmSdI31R9KrO9b7eGZONn356ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ry -L3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd+PwyvzeG5LuOmCd+uh8W4XAR8gPf -JWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQHtZa37dG/OaG+svg -IHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBDF8Io -2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV -09tL7ECQ8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQ -XR4EzzffHqhmsYzmIGrv/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrq -T8p+ck0LcIymSLumoRT2+1hEmRSuqguTaaApJUqlyyvdimYHFngVV3Eb7PVHhPOe -MTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g== ------END CERTIFICATE----- - -# Issuer: CN=SSL.com Root Certification Authority RSA O=SSL Corporation -# Subject: CN=SSL.com Root Certification Authority RSA O=SSL Corporation -# Label: "SSL.com Root Certification Authority RSA" -# Serial: 8875640296558310041 -# MD5 Fingerprint: 86:69:12:c0:70:f1:ec:ac:ac:c2:d5:bc:a5:5b:a1:29 -# SHA1 Fingerprint: b7:ab:33:08:d1:ea:44:77:ba:14:80:12:5a:6f:bd:a9:36:49:0c:bb -# SHA256 Fingerprint: 85:66:6a:56:2e:e0:be:5c:e9:25:c1:d8:89:0a:6f:76:a8:7e:c1:6d:4d:7d:5f:29:ea:74:19:cf:20:12:3b:69 ------BEGIN CERTIFICATE----- -MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UE -BhMCVVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQK -DA9TU0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYwMjEyMTczOTM5WhcNNDEwMjEyMTcz -OTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv -dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv -bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcN -AQEBBQADggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2R -xFdHaxh3a3by/ZPkPQ/CFp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aX -qhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcC -C52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/geoeOy3ZExqysdBP+lSgQ3 -6YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkpk8zruFvh -/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrF -YD3ZfBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93E -JNyAKoFBbZQ+yODJgUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVc -US4cK38acijnALXRdMbX5J+tB5O2UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8 -ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi81xtZPCvM8hnIk2snYxnP/Okm -+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4sbE6x/c+cCbqi -M+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV -HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4G -A1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGV -cpNxJK1ok1iOMq8bs3AD/CUrdIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBc -Hadm47GUBwwyOabqG7B52B2ccETjit3E+ZUfijhDPwGFpUenPUayvOUiaPd7nNgs -PgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAslu1OJD7OAUN5F7kR/ -q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjqerQ0 -cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jr -a6x+3uxjMxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90I -H37hVZkLId6Tngr75qNJvTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/Y -K9f1JmzJBjSWFupwWRoyeXkLtoh/D1JIPb9s2KJELtFOt3JY04kTlf5Eq/jXixtu -nLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406ywKBjYZC6VWg3dGq2ktuf -oYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShY -Ic2wBlX7Jz9TkHCpBB5XJ7k= ------END CERTIFICATE----- - -# Issuer: CN=SSL.com Root Certification Authority ECC O=SSL Corporation -# Subject: CN=SSL.com Root Certification Authority ECC O=SSL Corporation -# Label: "SSL.com Root Certification Authority ECC" -# Serial: 8495723813297216424 -# MD5 Fingerprint: 2e:da:e4:39:7f:9c:8f:37:d1:70:9f:26:17:51:3a:8e -# SHA1 Fingerprint: c3:19:7c:39:24:e6:54:af:1b:c4:ab:20:95:7a:e2:c3:0e:13:02:6a -# SHA256 Fingerprint: 34:17:bb:06:cc:60:07:da:1b:96:1c:92:0b:8a:b4:ce:3f:ad:82:0e:4a:a3:0b:9a:cb:c4:a7:4e:bd:ce:bc:65 ------BEGIN CERTIFICATE----- -MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMC -VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T -U0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNDAzWhcNNDEwMjEyMTgxNDAz -WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0 -b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNvbSBS -b290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB -BAAiA2IABEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI -7Z4INcgn64mMU1jrYor+8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPg -CemB+vNH06NjMGEwHQYDVR0OBBYEFILRhXMw5zUE044CkvvlpNHEIejNMA8GA1Ud -EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTTjgKS++Wk0cQh6M0wDgYD -VR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCWe+0F+S8T -kdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+ -gA0z5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl ------END CERTIFICATE----- - -# Issuer: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation -# Subject: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation -# Label: "SSL.com EV Root Certification Authority RSA R2" -# Serial: 6248227494352943350 -# MD5 Fingerprint: e1:1e:31:58:1a:ae:54:53:02:f6:17:6a:11:7b:4d:95 -# SHA1 Fingerprint: 74:3a:f0:52:9b:d0:32:a0:f4:4a:83:cd:d4:ba:a9:7b:7c:2e:c4:9a -# SHA256 Fingerprint: 2e:7b:f1:6c:c2:24:85:a7:bb:e2:aa:86:96:75:07:61:b0:ae:39:be:3b:2f:e9:d0:cc:6d:4e:f7:34:91:42:5c ------BEGIN CERTIFICATE----- -MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNV -BAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UE -CgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2Vy -dGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMB4XDTE3MDUzMTE4MTQzN1oXDTQy -MDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4G -A1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQD -DC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvq -M0fNTPl9fb69LT3w23jhhqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssuf -OePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7wcXHswxzpY6IXFJ3vG2fThVUCAtZJycxa -4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTOZw+oz12WGQvE43LrrdF9 -HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+B6KjBSYR -aZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcA -b9ZhCBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQ -Gp8hLH94t2S42Oim9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQV -PWKchjgGAGYS5Fl2WlPAApiiECtoRHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMO -pgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+SlmJuwgUHfbSguPvuUCYHBBXtSu -UDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48+qvWBkofZ6aY -MBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV -HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa4 -9QaAJadz20ZpqJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBW -s47LCp1Jjr+kxJG7ZhcFUZh1++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5 -Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nxY/hoLVUE0fKNsKTPvDxeH3jnpaAg -cLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2GguDKBAdRUNf/ktUM -79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDzOFSz -/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXt -ll9ldDz7CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEm -Kf7GUmG6sXP/wwyc5WxqlD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKK -QbNmC1r7fSOl8hqw/96bg5Qu0T/fkreRrwU7ZcegbLHNYhLDkBvjJc40vG93drEQ -w/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1hlMYegouCRw2n5H9gooi -S9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX9hwJ1C07 -mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w== ------END CERTIFICATE----- - -# Issuer: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation -# Subject: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation -# Label: "SSL.com EV Root Certification Authority ECC" -# Serial: 3182246526754555285 -# MD5 Fingerprint: 59:53:22:65:83:42:01:54:c0:ce:42:b9:5a:7c:f2:90 -# SHA1 Fingerprint: 4c:dd:51:a3:d1:f5:20:32:14:b0:c6:c5:32:23:03:91:c7:46:42:6d -# SHA256 Fingerprint: 22:a2:c1:f7:bd:ed:70:4c:c1:e7:01:b5:f4:08:c3:10:88:0f:e9:56:b5:de:2a:4a:44:f9:9c:87:3a:25:a7:c8 ------BEGIN CERTIFICATE----- -MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMC -VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T -U0wgQ29ycG9yYXRpb24xNDAyBgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNTIzWhcNNDEwMjEyMTgx -NTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv -dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NMLmNv -bSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49 -AgEGBSuBBAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMA -VIbc/R/fALhBYlzccBYy3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1Kthku -WnBaBu2+8KGwytAJKaNjMGEwHQYDVR0OBBYEFFvKXuXe0oGqzagtZFG22XKbl+ZP -MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe5d7SgarNqC1kUbbZcpuX -5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJN+vp1RPZ -ytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZg -h5Mmm7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg== ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 -# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 -# Label: "GlobalSign Root CA - R6" -# Serial: 1417766617973444989252670301619537 -# MD5 Fingerprint: 4f:dd:07:e4:d4:22:64:39:1e:0c:37:42:ea:d1:c6:ae -# SHA1 Fingerprint: 80:94:64:0e:b5:a7:a1:ca:11:9c:1f:dd:d5:9f:81:02:63:a7:fb:d1 -# SHA256 Fingerprint: 2c:ab:ea:fe:37:d0:6c:a2:2a:ba:73:91:c0:03:3d:25:98:29:52:c4:53:64:73:49:76:3a:3a:b5:ad:6c:cf:69 ------BEGIN CERTIFICATE----- -MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEg -MB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2Jh -bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQx -MjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSNjET -MBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQssgrRI -xutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1k -ZguSgMpE3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxD -aNc9PIrFsmbVkJq3MQbFvuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJw -LnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqMPKq0pPbzlUoSB239jLKJz9CgYXfIWHSw -1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+azayOeSsJDa38O+2HBNX -k7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05OWgtH8wY2 -SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/h -bguyCLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4n -WUx2OVvq+aWh2IMP0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpY -rZxCRXluDocZXFSxZba/jJvcE+kNb7gu3GduyYsRtYQUigAZcIN5kZeR1Bonvzce -MgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTAD -AQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNVHSMEGDAWgBSu -bAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN -nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGt -Ixg93eFyRJa0lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr61 -55wsTLxDKZmOMNOsIeDjHfrYBzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLj -vUYAGm0CuiVdjaExUd1URhxN25mW7xocBFymFe944Hn+Xds+qkxV/ZoVqW/hpvvf -cDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr3TsTjxKM4kEaSHpz -oHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB10jZp -nOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfs -pA9MRf/TuTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+v -JJUEeKgDu+6B5dpffItKoZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R -8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+tJDfLRVpOoERIyNiwmcUVhAn21klJwGW4 -5hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA= ------END CERTIFICATE----- - -# Issuer: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed -# Subject: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed -# Label: "OISTE WISeKey Global Root GC CA" -# Serial: 44084345621038548146064804565436152554 -# MD5 Fingerprint: a9:d6:b9:2d:2f:93:64:f8:a5:69:ca:91:e9:68:07:23 -# SHA1 Fingerprint: e0:11:84:5e:34:de:be:88:81:b9:9c:f6:16:26:d1:96:1f:c3:b9:31 -# SHA256 Fingerprint: 85:60:f9:1c:36:24:da:ba:95:70:b5:fe:a0:db:e3:6f:f1:1a:83:23:be:94:86:85:4f:b3:f3:4a:55:71:19:8d ------BEGIN CERTIFICATE----- -MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQsw -CQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91 -bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwg -Um9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRaFw00MjA1MDkwOTU4MzNaMG0xCzAJ -BgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBGb3Vu -ZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2JhbCBS -b290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4ni -eUqjFqdrVCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4W -p2OQ0jnUsYd4XxiWD1AbNTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7T -rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV -57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtkAjEA2zQg -Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 ------END CERTIFICATE----- - -# Issuer: CN=UCA Global G2 Root O=UniTrust -# Subject: CN=UCA Global G2 Root O=UniTrust -# Label: "UCA Global G2 Root" -# Serial: 124779693093741543919145257850076631279 -# MD5 Fingerprint: 80:fe:f0:c4:4a:f0:5c:62:32:9f:1c:ba:78:a9:50:f8 -# SHA1 Fingerprint: 28:f9:78:16:19:7a:ff:18:25:18:aa:44:fe:c1:a0:ce:5c:b6:4c:8a -# SHA256 Fingerprint: 9b:ea:11:c9:76:fe:01:47:64:c1:be:56:a6:f9:14:b5:a5:60:31:7a:bd:99:88:39:33:82:e5:16:1a:a0:49:3c ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9 -MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBH -bG9iYWwgRzIgUm9vdDAeFw0xNjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0x -CzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlUcnVzdDEbMBkGA1UEAwwSVUNBIEds -b2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxeYr -b3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmToni9 -kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzm -VHqUwCoV8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/R -VogvGjqNO7uCEeBHANBSh6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDc -C/Vkw85DvG1xudLeJ1uK6NjGruFZfc8oLTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIj -tm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/R+zvWr9LesGtOxdQXGLY -D0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBeKW4bHAyv -j5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6Dl -NaBa4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6 -iIis7nCs+dwp4wwcOxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznP -O6Q0ibd5Ei9Hxeepl2n8pndntd978XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/ -BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIHEjMz15DD/pQwIX4wV -ZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo5sOASD0Ee/oj -L3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5 -1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl -1qnN3e92mI0ADs0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oU -b3n09tDh05S60FdRvScFDcH9yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LV -PtateJLbXDzz2K36uGt/xDYotgIVilQsnLAXc47QN6MUPJiVAAwpBVueSUmxX8fj -y88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHojhJi6IjMtX9Gl8Cb -EGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZkbxqg -DMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI -+Vg7RE+xygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGy -YiGqhkCyLmTTX8jjfhFnRR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bX -UB+K+wb1whnw0A== ------END CERTIFICATE----- - -# Issuer: CN=UCA Extended Validation Root O=UniTrust -# Subject: CN=UCA Extended Validation Root O=UniTrust -# Label: "UCA Extended Validation Root" -# Serial: 106100277556486529736699587978573607008 -# MD5 Fingerprint: a1:f3:5f:43:c6:34:9b:da:bf:8c:7e:05:53:ad:96:e2 -# SHA1 Fingerprint: a3:a1:b0:6f:24:61:23:4a:e3:36:a5:c2:37:fc:a6:ff:dd:f0:d7:3a -# SHA256 Fingerprint: d4:3a:f9:b3:54:73:75:5c:96:84:fc:06:d7:d8:cb:70:ee:5c:28:e7:73:fb:29:4e:b4:1e:e7:17:22:92:4d:24 ------BEGIN CERTIFICATE----- -MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBH -MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBF -eHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMx -MDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNV -BAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrsiWog -D4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvS -sPGP2KxFRv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aop -O2z6+I9tTcg1367r3CTueUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dk -sHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR59mzLC52LqGj3n5qiAno8geK+LLNEOfi -c0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH0mK1lTnj8/FtDw5lhIpj -VMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KRel7sFsLz -KuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/ -TuDvB0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41G -sx2VYVdWf6/wFlthWG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs -1+lvK9JKBZP8nm9rZ/+I8U6laUpSNwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQD -fwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS3H5aBZ8eNJr34RQwDwYDVR0T -AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBADaN -l8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR -ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQ -VBcZEhrxH9cMaVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5 -c6sq1WnIeJEmMX3ixzDx/BR4dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp -4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb+7lsq+KePRXBOy5nAliRn+/4Qh8s -t2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOWF3sGPjLtx7dCvHaj -2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwiGpWO -vpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2C -xR9GUeOcGMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmx -cmtpzyKEC2IPrNkZAJSidjzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbM -fjKaiJUINlK73nZfdklJrX+9ZSCyycErdhh2n1ax ------END CERTIFICATE----- - -# Issuer: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 -# Subject: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 -# Label: "Certigna Root CA" -# Serial: 269714418870597844693661054334862075617 -# MD5 Fingerprint: 0e:5c:30:62:27:eb:5b:bc:d7:ae:62:ba:e9:d5:df:77 -# SHA1 Fingerprint: 2d:0d:52:14:ff:9e:ad:99:24:01:74:20:47:6e:6c:85:27:27:f5:43 -# SHA256 Fingerprint: d4:8d:3d:23:ee:db:50:a4:59:e5:51:97:60:1c:27:77:4b:9d:7b:18:c9:4d:5a:05:95:11:a1:02:50:b9:31:68 ------BEGIN CERTIFICATE----- -MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAw -WjELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAw -MiA0ODE0NjMwODEwMDAzNjEZMBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0x -MzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjdaMFoxCzAJBgNVBAYTAkZSMRIwEAYD -VQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYzMDgxMDAwMzYxGTAX -BgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sO -ty3tRQgXstmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9M -CiBtnyN6tMbaLOQdLNyzKNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPu -I9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8JXrJhFwLrN1CTivngqIkicuQstDuI7pm -TLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16XdG+RCYyKfHx9WzMfgIh -C59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq4NYKpkDf -ePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3Yz -IoejwpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWT -Co/1VTp2lc5ZmIoJlXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1k -JWumIWmbat10TWuXekG9qxf5kBdIjzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5 -hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp//TBt2dzhauH8XwIDAQABo4IB -GjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE -FBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of -1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczov -L3d3d3cuY2VydGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilo -dHRwOi8vY3JsLmNlcnRpZ25hLmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYr -aHR0cDovL2NybC5kaGlteW90aXMuY29tL2NlcnRpZ25hcm9vdGNhLmNybDANBgkq -hkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOItOoldaDgvUSILSo3L -6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxPTGRG -HVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH6 -0BGM+RFq7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncB -lA2c5uk5jR+mUYyZDDl34bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdi -o2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1 -gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS6Cvu5zHbugRqh5jnxV/v -faci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaYtlu3zM63 -Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayh -jWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw -3kAP+HwV96LOPNdeE4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0= ------END CERTIFICATE----- - -# Issuer: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI -# Subject: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI -# Label: "emSign Root CA - G1" -# Serial: 235931866688319308814040 -# MD5 Fingerprint: 9c:42:84:57:dd:cb:0b:a7:2e:95:ad:b6:f3:da:bc:ac -# SHA1 Fingerprint: 8a:c7:ad:8f:73:ac:4e:c1:b5:75:4d:a5:40:f4:fc:cf:7c:b5:8e:8c -# SHA256 Fingerprint: 40:f6:af:03:46:a9:9a:a1:cd:1d:55:5a:4e:9c:ce:62:c7:f9:63:46:03:ee:40:66:15:83:3d:c8:c8:d0:03:67 ------BEGIN CERTIFICATE----- -MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYD -VQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBU -ZWNobm9sb2dpZXMgTGltaXRlZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBH -MTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgxODMwMDBaMGcxCzAJBgNVBAYTAklO -MRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVkaHJhIFRlY2hub2xv -Z2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQz -f2N4aLTNLnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO -8oG0x5ZOrRkVUkr+PHB1cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aq -d7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHWDV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhM -tTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ6DqS0hdW5TUaQBw+jSzt -Od9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrHhQIDAQAB -o0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQD -AgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31x -PaOfG1vR2vjTnGs2vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjM -wiI/aTvFthUvozXGaCocV685743QNcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6d -GNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q+Mri/Tm3R7nrft8EI6/6nAYH -6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeihU80Bv2noWgby -RQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx -iN66zB+Afko= ------END CERTIFICATE----- - -# Issuer: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI -# Subject: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI -# Label: "emSign ECC Root CA - G3" -# Serial: 287880440101571086945156 -# MD5 Fingerprint: ce:0b:72:d1:9f:88:8e:d0:50:03:e8:e3:b8:8b:67:40 -# SHA1 Fingerprint: 30:43:fa:4f:f2:57:dc:a0:c3:80:ee:2e:58:ea:78:b2:3f:e6:bb:c1 -# SHA256 Fingerprint: 86:a1:ec:ba:08:9c:4a:8d:3b:be:27:34:c6:12:ba:34:1d:81:3e:04:3c:f9:e8:a8:62:cd:5c:57:a3:6b:be:6b ------BEGIN CERTIFICATE----- -MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQG -EwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNo -bm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g -RzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4MTgzMDAwWjBrMQswCQYDVQQGEwJJ -TjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9s -b2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMw -djAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0 -WXTsuwYc58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xyS -fvalY8L1X44uT6EYGQIrMgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuB -zhccLikenEhjQjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggq -hkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+DCBeQyh+KTOgNG3qxrdWB -CUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7jHvrZQnD -+JbNR6iC8hZVdyR+EhCVBCyj ------END CERTIFICATE----- - -# Issuer: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI -# Subject: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI -# Label: "emSign Root CA - C1" -# Serial: 825510296613316004955058 -# MD5 Fingerprint: d8:e3:5d:01:21:fa:78:5a:b0:df:ba:d2:ee:2a:5f:68 -# SHA1 Fingerprint: e7:2e:f1:df:fc:b2:09:28:cf:5d:d4:d5:67:37:b1:51:cb:86:4f:01 -# SHA256 Fingerprint: 12:56:09:aa:30:1d:a0:a2:49:b9:7a:82:39:cb:6a:34:21:6f:44:dc:ac:9f:39:54:b1:42:92:f2:e8:c8:60:8f ------BEGIN CERTIFICATE----- -MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkG -A1UEBhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEg -SW5jMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAw -MFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln -biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNpZ24gUm9v -dCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+upufGZ -BczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZ -HdPIWoU/Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH -3DspVpNqs8FqOp099cGXOFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvH -GPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4VI5b2P/AgNBbeCsbEBEV5f6f9vtKppa+c -xSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleoomslMuoaJuvimUnzYnu3Yy1 -aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+XJGFehiq -TbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL -BQADggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87 -/kOXSTKZEhVb3xEp/6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4 -kqNPEjE2NuLe/gDEo2APJ62gsIq1NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrG -YQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9wC68AivTxEDkigcxHpvOJpkT -+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQBmIMMMAVSKeo -WXzhriKi4gp6D/piq1JM4fHfyr6DDUI= ------END CERTIFICATE----- - -# Issuer: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI -# Subject: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI -# Label: "emSign ECC Root CA - C3" -# Serial: 582948710642506000014504 -# MD5 Fingerprint: 3e:53:b3:a3:81:ee:d7:10:f8:d3:b0:1d:17:92:f5:d5 -# SHA1 Fingerprint: b6:af:43:c2:9b:81:53:7d:f6:ef:6b:c3:1f:1f:60:15:0c:ee:48:66 -# SHA256 Fingerprint: bc:4d:80:9b:15:18:9d:78:db:3e:1d:8c:f4:f9:72:6a:79:5d:a1:64:3c:a5:f1:35:8e:1d:db:0e:dc:0d:7e:b3 ------BEGIN CERTIFICATE----- -MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQG -EwJVUzETMBEGA1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMx -IDAeBgNVBAMTF2VtU2lnbiBFQ0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAw -MFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln -biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQDExdlbVNpZ24gRUND -IFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd6bci -MK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4Ojavti -sIGJAnB9SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0O -BBYEFPtaSNCAIEDyqOkAB2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB -Af8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQC02C8Cif22TGK6Q04ThHK1rt0c -3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwUZOR8loMRnLDRWmFLpg9J -0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== ------END CERTIFICATE----- - -# Issuer: CN=Hongkong Post Root CA 3 O=Hongkong Post -# Subject: CN=Hongkong Post Root CA 3 O=Hongkong Post -# Label: "Hongkong Post Root CA 3" -# Serial: 46170865288971385588281144162979347873371282084 -# MD5 Fingerprint: 11:fc:9f:bd:73:30:02:8a:fd:3f:f3:58:b9:cb:20:f0 -# SHA1 Fingerprint: 58:a2:d0:ec:20:52:81:5b:c1:f3:f8:64:02:24:4e:c2:8e:02:4b:02 -# SHA256 Fingerprint: 5a:2f:c0:3f:0c:83:b0:90:bb:fa:40:60:4b:09:88:44:6c:76:36:18:3d:f9:84:6e:17:10:1a:44:7f:b8:ef:d6 ------BEGIN CERTIFICATE----- -MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQEL -BQAwbzELMAkGA1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJ -SG9uZyBLb25nMRYwFAYDVQQKEw1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25n -a29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2MDMwMjI5NDZaFw00MjA2MDMwMjI5 -NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtvbmcxEjAQBgNVBAcT -CUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMXSG9u -Z2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK -AoICAQCziNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFO -dem1p+/l6TWZ5Mwc50tfjTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mI -VoBc+L0sPOFMV4i707mV78vH9toxdCim5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV -9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOesL4jpNrcyCse2m5FHomY -2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj0mRiikKY -vLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+Tt -bNe/JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZb -x39ri1UbSsUgYT2uy1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+ -l2oBlKN8W4UdKjk60FSh0Tlxnf0h+bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YK -TE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsGxVd7GYYKecsAyVKvQv83j+Gj -Hno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwIDAQABo2MwYTAP -BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e -i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEw -DQYJKoZIhvcNAQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG -7BJ8dNVI0lkUmcDrudHr9EgwW62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCk -MpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWldy8joRTnU+kLBEUx3XZL7av9YROXr -gZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov+BS5gLNdTaqX4fnk -GMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDceqFS -3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJm -Ozj/2ZQw9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+ -l6mc1X5VTMbeRRAc6uk7nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6c -JfTzPV4e0hz5sy229zdcxsshTrD3mUcYhcErulWuBurQB7Lcq9CClnXO0lD+mefP -L5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB60PZ2Pierc+xYw5F9KBa -LJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fqdBb9HxEG -mpv0 ------END CERTIFICATE----- - -# Issuer: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only -# Subject: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only -# Label: "Entrust Root Certification Authority - G4" -# Serial: 289383649854506086828220374796556676440 -# MD5 Fingerprint: 89:53:f1:83:23:b7:7c:8e:05:f1:8c:71:38:4e:1f:88 -# SHA1 Fingerprint: 14:88:4e:86:26:37:b0:26:af:59:62:5c:40:77:ec:35:29:ba:96:01 -# SHA256 Fingerprint: db:35:17:d1:f6:73:2a:2d:5a:b9:7c:53:3e:c7:07:79:ee:32:70:a6:2f:b4:ac:42:38:37:24:60:e6:f0:1e:88 ------BEGIN CERTIFICATE----- -MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAw -gb4xCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQL -Ex9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykg -MjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAw -BgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0 -MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYTAlVT -MRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1 -c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJ -bmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3Qg -Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0MIICIjANBgkqhkiG9w0B -AQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3DumSXbcr3DbVZwbPLqGgZ -2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV3imz/f3E -T+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j -5pds8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAM -C1rlLAHGVK/XqsEQe9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73T -DtTUXm6Hnmo9RR3RXRv06QqsYJn7ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNX -wbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5XxNMhIWNlUpEbsZmOeX7m640A -2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV7rtNOzK+mndm -nqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8 -dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwl -N4y6mACXi0mWHv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNj -c0kCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9nMA0GCSqGSIb3DQEBCwUAA4ICAQAS -5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4QjbRaZIxowLByQzTS -Gwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht7LGr -hFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/ -B7NTeLUKYvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uI -AeV8KEsD+UmDfLJ/fOPtjqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbw -H5Lk6rWS02FREAutp9lfx1/cH6NcjKF+m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+ -b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKWRGhXxNUzzxkvFMSUHHuk -2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjAJOgc47Ol -IQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk -5F6G+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuY -n/PIjhs4ViFqUZPTkcpG2om3PVODLAgfi49T3f+sHw== ------END CERTIFICATE----- - -# Issuer: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation -# Subject: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation -# Label: "Microsoft ECC Root Certificate Authority 2017" -# Serial: 136839042543790627607696632466672567020 -# MD5 Fingerprint: dd:a1:03:e6:4a:93:10:d1:bf:f0:19:42:cb:fe:ed:67 -# SHA1 Fingerprint: 99:9a:64:c3:7f:f4:7d:9f:ab:95:f1:47:69:89:14:60:ee:c4:c3:c5 -# SHA256 Fingerprint: 35:8d:f3:9d:76:4a:f9:e1:b7:66:e9:c9:72:df:35:2e:e1:5c:fa:c2:27:af:6a:d1:d7:0e:8e:4a:6e:dc:ba:02 ------BEGIN CERTIFICATE----- -MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQsw -CQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYD -VQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIw -MTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4MjMxNjA0WjBlMQswCQYDVQQGEwJV -UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNy -b3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZR -ogPZnZH6thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYb -hGBKia/teQ87zvH2RPUBeMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBTIy5lycFIM+Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3 -FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlfXu5gKcs68tvWMoQZP3zV -L8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaReNtUjGUB -iudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M= ------END CERTIFICATE----- - -# Issuer: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation -# Subject: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation -# Label: "Microsoft RSA Root Certificate Authority 2017" -# Serial: 40975477897264996090493496164228220339 -# MD5 Fingerprint: 10:ff:00:ff:cf:c9:f8:c7:7a:c0:ee:35:8e:c9:0f:47 -# SHA1 Fingerprint: 73:a5:e6:4a:3b:ff:83:16:ff:0e:dc:cc:61:8a:90:6e:4e:ae:4d:74 -# SHA256 Fingerprint: c7:41:f7:0f:4b:2a:8d:88:bf:2e:71:c1:41:22:ef:53:ef:10:eb:a0:cf:a5:e6:4c:fa:20:f4:18:85:30:73:e0 ------BEGIN CERTIFICATE----- -MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBl -MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw -NAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIwNzE4MjMwMDIzWjBlMQswCQYDVQQG -EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1N -aWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZ -Nt9GkMml7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0 -ZdDMbRnMlfl7rEqUrQ7eS0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1 -HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw71VdyvD/IybLeS2v4I2wDwAW9lcfNcztm -gGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+dkC0zVJhUXAoP8XFWvLJ -jEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49FyGcohJUc -aDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaG -YaRSMLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6 -W6IYZVcSn2i51BVrlMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4K -UGsTuqwPN1q3ErWQgR5WrlcihtnJ0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH -+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJClTUFLkqqNfs+avNJVgyeY+Q -W5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/ -BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC -NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZC -LgLNFgVZJ8og6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OC -gMNPOsduET/m4xaRhPtthH80dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6 -tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk+ONVFT24bcMKpBLBaYVu32TxU5nh -SnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex/2kskZGT4d9Mozd2 -TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDyAmH3 -pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGR -xpl/j8nWZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiApp -GWSZI1b7rCoucL5mxAyE7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9 -dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKTc0QWbej09+CVgI+WXTik9KveCjCHk9hN -AHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D5KbvtwEwXlGjefVwaaZB -RA+GsCyRxj3qrg+E ------END CERTIFICATE----- - -# Issuer: CN=e-Szigno Root CA 2017 O=Microsec Ltd. -# Subject: CN=e-Szigno Root CA 2017 O=Microsec Ltd. -# Label: "e-Szigno Root CA 2017" -# Serial: 411379200276854331539784714 -# MD5 Fingerprint: de:1f:f6:9e:84:ae:a7:b4:21:ce:1e:58:7d:d1:84:98 -# SHA1 Fingerprint: 89:d4:83:03:4f:9e:9a:48:80:5f:72:37:d4:a9:a6:ef:cb:7c:1f:d1 -# SHA256 Fingerprint: be:b0:0b:30:83:9b:9b:c3:2c:32:e4:44:79:05:95:06:41:f2:64:21:b1:5e:d0:89:19:8b:51:8a:e2:ea:1b:99 ------BEGIN CERTIFICATE----- -MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNV -BAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRk -LjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJv -b3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZaFw00MjA4MjIxMjA3MDZaMHExCzAJ -BgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMg -THRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25v -IFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtv -xie+RJCxs1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+H -Wyx7xf58etqjYzBhMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G -A1UdDgQWBBSHERUI0arBeAyxr87GyZDvvzAEwDAfBgNVHSMEGDAWgBSHERUI0arB -eAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEAtVfd14pVCzbhhkT61Nlo -jbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxOsvxyqltZ -+efcMQ== ------END CERTIFICATE----- - -# Issuer: O=CERTSIGN SA OU=certSIGN ROOT CA G2 -# Subject: O=CERTSIGN SA OU=certSIGN ROOT CA G2 -# Label: "certSIGN Root CA G2" -# Serial: 313609486401300475190 -# MD5 Fingerprint: 8c:f1:75:8a:c6:19:cf:94:b7:f7:65:20:87:c3:97:c7 -# SHA1 Fingerprint: 26:f9:93:b4:ed:3d:28:27:b0:b9:4b:a7:e9:15:1d:a3:8d:92:e5:32 -# SHA256 Fingerprint: 65:7c:fe:2f:a7:3f:aa:38:46:25:71:f3:32:a2:36:3a:46:fc:e7:02:09:51:71:07:02:cd:fb:b6:ee:da:33:05 ------BEGIN CERTIFICATE----- -MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNV -BAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04g -Uk9PVCBDQSBHMjAeFw0xNzAyMDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJ -BgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJ -R04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDF -dRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05N0Iw -vlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZ -uIt4ImfkabBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhp -n+Sc8CnTXPnGFiWeI8MgwT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKs -cpc/I1mbySKEwQdPzH/iV8oScLumZfNpdWO9lfsbl83kqK/20U6o2YpxJM02PbyW -xPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91QqhngLjYl/rNUssuHLoPj1P -rCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732jcZZroiF -DsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fx -DTvf95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgy -LcsUDFDYg2WD7rlcz8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6C -eWRgKRM+o/1Pcmqr4tTluCRVLERLiohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCIS1mxteg4BXrzkwJ -d8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOBywaK8SJJ6ejq -kX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC -b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQl -qiCA2ClV9+BB/AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0 -OJD7uNGzcgbJceaBxXntC6Z58hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+c -NywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5BiKDUyUM/FHE5r7iOZULJK2v0ZXk -ltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklWatKcsWMy5WHgUyIO -pwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tUSxfj -03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZk -PuXaTH4MNMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE -1LlSVHJ7liXMvGnjSG4N0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MX -QRBdJ3NghVdJIgc= ------END CERTIFICATE----- - -# Issuer: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. -# Subject: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. -# Label: "Trustwave Global Certification Authority" -# Serial: 1846098327275375458322922162 -# MD5 Fingerprint: f8:1c:18:2d:2f:ba:5f:6d:a1:6c:bc:c7:ab:91:c7:0e -# SHA1 Fingerprint: 2f:8f:36:4f:e1:58:97:44:21:59:87:a5:2a:9a:d0:69:95:26:7f:b5 -# SHA256 Fingerprint: 97:55:20:15:f5:dd:fc:3c:87:88:c0:06:94:45:55:40:88:94:45:00:84:f1:00:86:70:86:bc:1a:2b:b5:8d:c8 ------BEGIN CERTIFICATE----- -MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQsw -CQYDVQQGEwJVUzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28x -ITAfBgNVBAoMGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1 -c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMx -OTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJVUzERMA8GA1UECAwI -SWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2ZSBI -b2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB -ALldUShLPDeS0YLOvR29zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0Xzn -swuvCAAJWX/NKSqIk4cXGIDtiLK0thAfLdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu -7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4BqstTnoApTAbqOl5F2brz8 -1Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9oWN0EACyW -80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotP -JqX+OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1l -RtzuzWniTY+HKE40Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfw -hI0Vcnyh78zyiGG69Gm7DIwLdVcEuE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10 -coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm+9jaJXLE9gCxInm943xZYkqc -BW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqjifLJS3tBEW1n -twiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud -EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1Ud -DwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W -0OhUKDtkLSGm+J1WE2pIPU/HPinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfe -uyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0HZJDmHvUqoai7PF35owgLEQzxPy0Q -lG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla4gt5kNdXElE1GYhB -aCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5RvbbE -sLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPT -MaCm/zjdzyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qe -qu5AvzSxnI9O4fKSTx+O856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxh -VicGaeVyQYHTtgGJoC86cnn+OjC/QezHYj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8 -h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu3R3y4G5OBVixwJAWKqQ9 -EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP29FpHOTK -yeC2nOnOcXHebD8WpHk= ------END CERTIFICATE----- - -# Issuer: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. -# Subject: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. -# Label: "Trustwave Global ECC P256 Certification Authority" -# Serial: 4151900041497450638097112925 -# MD5 Fingerprint: 5b:44:e3:8d:5d:36:86:26:e8:0d:05:d2:59:a7:83:54 -# SHA1 Fingerprint: b4:90:82:dd:45:0c:be:8b:5b:b1:66:d3:e2:a4:08:26:cd:ed:42:cf -# SHA256 Fingerprint: 94:5b:bc:82:5e:a5:54:f4:89:d1:fd:51:a7:3d:df:2e:a6:24:ac:70:19:a0:52:05:22:5c:22:a7:8c:cf:a8:b4 ------BEGIN CERTIFICATE----- -MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYD -VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf -BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 -YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x -NzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYDVQQGEwJVUzERMA8G -A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 -d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF -Q0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqG -SM49AwEHA0IABH77bOYj43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoN -FWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqmP62jQzBBMA8GA1UdEwEB/wQFMAMBAf8w -DwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt0UrrdaVKEJmzsaGLSvcw -CgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjzRM4q3wgh -DDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7 ------END CERTIFICATE----- - -# Issuer: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. -# Subject: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. -# Label: "Trustwave Global ECC P384 Certification Authority" -# Serial: 2704997926503831671788816187 -# MD5 Fingerprint: ea:cf:60:c4:3b:b9:15:29:40:a1:97:ed:78:27:93:d6 -# SHA1 Fingerprint: e7:f3:a3:c8:cf:6f:c3:04:2e:6d:0e:67:32:c5:9e:68:95:0d:5e:d2 -# SHA256 Fingerprint: 55:90:38:59:c8:c0:c3:eb:b8:75:9e:ce:4e:25:57:22:5f:f5:75:8b:bd:38:eb:d4:82:76:60:1e:1b:d5:80:97 ------BEGIN CERTIFICATE----- -MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYD -VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf -BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 -YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x -NzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYDVQQGEwJVUzERMA8G -A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 -d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF -Q0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuB -BAAiA2IABGvaDXU1CDFHBa5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJ -j9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr/TklZvFe/oyujUF5nQlgziip04pt89ZF -1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwYAMB0G -A1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNnADBkAjA3 -AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC -MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu -Sw== ------END CERTIFICATE----- - -# Issuer: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. -# Subject: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. -# Label: "NAVER Global Root Certification Authority" -# Serial: 9013692873798656336226253319739695165984492813 -# MD5 Fingerprint: c8:7e:41:f6:25:3b:f5:09:b3:17:e8:46:3d:bf:d0:9b -# SHA1 Fingerprint: 8f:6b:f2:a9:27:4a:da:14:a0:c4:f4:8e:61:27:f9:c0:1e:78:5d:d1 -# SHA256 Fingerprint: 88:f4:38:dc:f8:ff:d1:fa:8f:42:91:15:ff:e5:f8:2a:e1:e0:6e:0c:70:c3:75:fa:ad:71:7b:34:a4:9e:72:65 ------BEGIN CERTIFICATE----- -MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEM -BQAwaTELMAkGA1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRG -T1JNIENvcnAuMTIwMAYDVQQDDClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4NDJaFw0zNzA4MTgyMzU5NTlaMGkx -CzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVTUyBQTEFURk9STSBD -b3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlvbiBB -dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVA -iQqrDZBbUGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH -38dq6SZeWYp34+hInDEW+j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lE -HoSTGEq0n+USZGnQJoViAbbJAh2+g1G7XNr4rRVqmfeSVPc0W+m/6imBEtRTkZaz -kVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2aacp+yPOiNgSnABIqKYP -szuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4Yb8Obtoq -vC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHf -nZ3zVHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaG -YQ5fG8Ir4ozVu53BA0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo -0es+nPxdGoMuK8u180SdOqcXYZaicdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3a -CJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejyYhbLgGvtPe31HzClrkvJE+2K -AQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNVHQ4EFgQU0p+I -36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB -Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoN -qo0hV4/GPnrK21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatj -cu3cvuzHV+YwIHHW1xDBE1UBjCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm -+LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bxhYTeodoS76TiEJd6eN4MUZeoIUCL -hr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTgE34h5prCy8VCZLQe -lHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTHD8z7 -p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8 -piKCk5XQA76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLR -LBT/DShycpWbXgnbiUSYqqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX -5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oGI/hGoiLtk/bdmuYqh7GYVPEi92tF4+KO -dh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmgkpzNNIaRkPpkUZ3+/uul -9XXeifdy ------END CERTIFICATE----- - -# Issuer: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres -# Subject: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres -# Label: "AC RAIZ FNMT-RCM SERVIDORES SEGUROS" -# Serial: 131542671362353147877283741781055151509 -# MD5 Fingerprint: 19:36:9c:52:03:2f:d2:d1:bb:23:cc:dd:1e:12:55:bb -# SHA1 Fingerprint: 62:ff:d9:9e:c0:65:0d:03:ce:75:93:d2:ed:3f:2d:32:c9:e3:e5:4a -# SHA256 Fingerprint: 55:41:53:b1:3d:2c:f9:dd:b7:53:bf:be:1a:4e:0a:e0:8d:0a:a4:18:70:58:fe:60:a2:b8:62:b2:e4:b8:7b:cb ------BEGIN CERTIFICATE----- -MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQsw -CQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgw -FgYDVQRhDA9WQVRFUy1RMjgyNjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1S -Q00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4MTIyMDA5MzczM1oXDTQzMTIyMDA5 -MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQtUkNNMQ4wDAYDVQQL -DAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNBQyBS -QUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuB -BAAiA2IABPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LH -sbI6GA60XYyzZl2hNPk2LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oK -Um8BA06Oi6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqGSM49BAMDA2kAMGYCMQCu -SuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoDzBOQn5IC -MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy -v+c= ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign Root R46 O=GlobalSign nv-sa -# Subject: CN=GlobalSign Root R46 O=GlobalSign nv-sa -# Label: "GlobalSign Root R46" -# Serial: 1552617688466950547958867513931858518042577 -# MD5 Fingerprint: c4:14:30:e4:fa:66:43:94:2a:6a:1b:24:5f:19:d0:ef -# SHA1 Fingerprint: 53:a2:b0:4b:ca:6b:d6:45:e6:39:8a:8e:c4:0d:d2:bf:77:c3:a2:90 -# SHA256 Fingerprint: 4f:a3:12:6d:8d:3a:11:d1:c4:85:5a:4f:80:7c:ba:d6:cf:91:9d:3a:5a:88:b0:3b:ea:2c:63:72:d9:3c:40:c9 ------BEGIN CERTIFICATE----- -MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUA -MEYxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYD -VQQDExNHbG9iYWxTaWduIFJvb3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMy -MDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYt -c2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08EsCVeJ -OaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQG -vGIFAha/r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud -316HCkD7rRlr+/fKYIje2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo -0q3v84RLHIf8E6M6cqJaESvWJ3En7YEtbWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSE -y132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvjK8Cd+RTyG/FWaha/LIWF -zXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD412lPFzYE -+cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCN -I/onccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzs -x2sZy/N78CsHpdlseVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqa -ByFrgY/bxFn63iLABJzjqls2k+g9vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC -4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEMBQADggIBAHx4 -7PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg -JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti -2kM3S+LGteWygxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIk -pnnpHs6i58FZFZ8d4kuaPp92CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRF -FRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZmOUdkLG5NrmJ7v2B0GbhWrJKsFjLt -rWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qqJZ4d16GLuc1CLgSk -ZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwyeqiv5 -u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP -4vkYxboznxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6 -N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 -vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign Root E46 O=GlobalSign nv-sa -# Subject: CN=GlobalSign Root E46 O=GlobalSign nv-sa -# Label: "GlobalSign Root E46" -# Serial: 1552617690338932563915843282459653771421763 -# MD5 Fingerprint: b5:b8:66:ed:de:08:83:e3:c9:e2:01:34:06:ac:51:6f -# SHA1 Fingerprint: 39:b4:6c:d5:fe:80:06:eb:e2:2f:4a:bb:08:33:a0:af:db:b9:dd:84 -# SHA256 Fingerprint: cb:b9:c4:4d:84:b8:04:3e:10:50:ea:31:a6:9f:51:49:55:d7:bf:d2:e2:c6:b4:93:01:01:9a:d6:1d:9f:50:58 ------BEGIN CERTIFICATE----- -MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYx -CzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQD -ExNHbG9iYWxTaWduIFJvb3QgRTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAw -MDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2Ex -HDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA -IgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkBjtjq -R+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGdd -yXqBPCCjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud -DgQWBBQxCpCPtsad0kRLgLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ -7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZkvLtoURMMA/cVi4RguYv/Uo7njLwcAjA8 -+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+CAezNIm8BZ/3Hobui3A= ------END CERTIFICATE----- - -# Issuer: CN=GLOBALTRUST 2020 O=e-commerce monitoring GmbH -# Subject: CN=GLOBALTRUST 2020 O=e-commerce monitoring GmbH -# Label: "GLOBALTRUST 2020" -# Serial: 109160994242082918454945253 -# MD5 Fingerprint: 8a:c7:6f:cb:6d:e3:cc:a2:f1:7c:83:fa:0e:78:d7:e8 -# SHA1 Fingerprint: d0:67:c1:13:51:01:0c:aa:d0:c7:6a:65:37:31:16:26:4f:53:71:a2 -# SHA256 Fingerprint: 9a:29:6a:51:82:d1:d4:51:a2:e3:7f:43:9b:74:da:af:a2:67:52:33:29:f9:0f:9a:0d:20:07:c3:34:e2:3c:9a ------BEGIN CERTIFICATE----- -MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkG -A1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkw -FwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYx -MDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9u -aXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMIICIjANBgkq -hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWiD59b -RatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9Z -YybNpyrOVPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3 -QWPKzv9pj2gOlTblzLmMCcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPw -yJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCmfecqQjuCgGOlYx8ZzHyyZqjC0203b+J+ -BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKAA1GqtH6qRNdDYfOiaxaJ -SaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9ORJitHHmkH -r96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj0 -4KlGDfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9Me -dKZssCz3AwyIDMvUclOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIw -q7ejMZdnrY8XD2zHc+0klGvIg5rQmjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2 -nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1UdIwQYMBaAFNwu -H9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA -VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJC -XtzoRlgHNQIw4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd -6IwPS3BD0IL/qMy/pJTAvoe9iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf -+I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS8cE54+X1+NZK3TTN+2/BT+MAi1bi -kvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2HcqtbepBEX4tdJP7 -wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxSvTOB -TI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6C -MUO+1918oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn -4rnvyOL2NSl6dPrFf4IFYqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+I -aFvowdlxfv1k7/9nR4hYJS8+hge9+6jlgqispdNpQ80xiEmEU5LAsTkbOYMBMMTy -qfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg== ------END CERTIFICATE----- - -# Issuer: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz -# Subject: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz -# Label: "ANF Secure Server Root CA" -# Serial: 996390341000653745 -# MD5 Fingerprint: 26:a6:44:5a:d9:af:4e:2f:b2:1d:b6:65:b0:4e:e8:96 -# SHA1 Fingerprint: 5b:6e:68:d0:cc:15:b6:a0:5f:1e:c1:5f:ae:02:fc:6b:2f:5d:6f:74 -# SHA256 Fingerprint: fb:8f:ec:75:91:69:b9:10:6b:1e:51:16:44:c6:18:c5:13:04:37:3f:6c:06:43:08:8d:8b:ef:fd:1b:99:75:99 ------BEGIN CERTIFICATE----- -MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV -BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk -YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV -BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN -MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF -UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD -VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v -dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj -cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q -yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH -2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX -H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL -zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR -p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz -W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/ -SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn -LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3 -n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B -u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj -o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO -BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC -AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L -9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej -rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK -pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0 -vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq -OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ -/zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9 -2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI -+PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2 -MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo -tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= ------END CERTIFICATE----- - -# Issuer: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority -# Subject: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority -# Label: "Certum EC-384 CA" -# Serial: 160250656287871593594747141429395092468 -# MD5 Fingerprint: b6:65:b3:96:60:97:12:a1:ec:4e:e1:3d:a3:c6:c9:f1 -# SHA1 Fingerprint: f3:3e:78:3c:ac:df:f4:a2:cc:ac:67:55:69:56:d7:e5:16:3c:e1:ed -# SHA256 Fingerprint: 6b:32:80:85:62:53:18:aa:50:d1:73:c9:8d:8b:da:09:d5:7e:27:41:3d:11:4c:f7:87:a0:f5:d0:6c:03:0c:f6 ------BEGIN CERTIFICATE----- -MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQsw -CQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScw -JQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMT -EENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2MDcyNDU0WhcNNDMwMzI2MDcyNDU0 -WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBT -LkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAX -BgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATE -KI6rGFtqvm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7Tm -Fy8as10CW4kjPMIRBSqniBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68Kj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI0GZnQkdjrzife81r1HfS+8 -EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjADVS2m5hjEfO/J -UG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0QoSZ/6vn -nvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k= ------END CERTIFICATE----- - -# Issuer: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority -# Subject: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority -# Label: "Certum Trusted Root CA" -# Serial: 40870380103424195783807378461123655149 -# MD5 Fingerprint: 51:e1:c2:e7:fe:4c:84:af:59:0e:2f:f4:54:6f:ea:29 -# SHA1 Fingerprint: c8:83:44:c0:18:ae:9f:cc:f1:87:b7:8f:22:d1:c5:d7:45:84:ba:e5 -# SHA256 Fingerprint: fe:76:96:57:38:55:77:3e:37:a9:5e:7a:d4:d9:cc:96:c3:01:57:c1:5d:31:76:5b:a9:b1:57:04:e1:ae:78:fd ------BEGIN CERTIFICATE----- -MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6 -MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEu -MScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNV -BAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwHhcNMTgwMzE2MTIxMDEzWhcNNDMw -MzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEg -U3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRo -b3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZ -n0EGze2jusDbCSzBfN8pfktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/q -p1x4EaTByIVcJdPTsuclzxFUl6s1wB52HO8AU5853BSlLCIls3Jy/I2z5T4IHhQq -NwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2fJmItdUDmj0VDT06qKhF -8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGtg/BKEiJ3 -HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGa -mqi4NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi -7VdNIuJGmj8PkTQkfVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSF -ytKAQd8FqKPVhJBPC/PgP5sZ0jeJP/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0P -qafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSYnjYJdmZm/Bo/6khUHL4wvYBQ -v3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHKHRzQ+8S1h9E6 -Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1 -vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQAD -ggIBAEii1QALLtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4 -WxmB82M+w85bj/UvXgF2Ez8sALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvo -zMrnadyHncI013nR03e4qllY/p0m+jiGPp2Kh2RX5Rc64vmNueMzeMGQ2Ljdt4NR -5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8CYyqOhNf6DR5UMEQ -GfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA4kZf -5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq -0Uc9NneoWWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7D -P78v3DSk+yshzWePS/Tj6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTM -qJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmTOPQD8rv7gmsHINFSH5pkAnuYZttcTVoP -0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZckbxJF0WddCajJFdr60qZf -E2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb ------END CERTIFICATE----- - -# Issuer: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique -# Subject: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique -# Label: "TunTrust Root CA" -# Serial: 108534058042236574382096126452369648152337120275 -# MD5 Fingerprint: 85:13:b9:90:5b:36:5c:b6:5e:b8:5a:f8:e0:31:57:b4 -# SHA1 Fingerprint: cf:e9:70:84:0f:e0:73:0f:9d:f6:0c:7f:2c:4b:ee:20:46:34:9c:bb -# SHA256 Fingerprint: 2e:44:10:2a:b5:8c:b8:54:19:45:1c:8e:19:d9:ac:f3:66:2c:af:bc:61:4b:6a:53:96:0a:30:f7:d0:e2:eb:41 ------BEGIN CERTIFICATE----- -MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQEL -BQAwYTELMAkGA1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUg -Q2VydGlmaWNhdGlvbiBFbGVjdHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJv -b3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQwNDI2MDg1NzU2WjBhMQswCQYDVQQG -EwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBDZXJ0aWZpY2F0aW9u -IEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZ -n56eY+hz2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd -2JQDoOw05TDENX37Jk0bbjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgF -VwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZ -GoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAdgjH8KcwAWJeRTIAAHDOF -li/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViWVSHbhlnU -r8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2 -eY8fTpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIb -MlEsPvLfe/ZdeikZjuXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISg -jwBUFfyRbVinljvrS5YnzWuioYasDXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB -7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwSVXAkPcvCFDVDXSdOvsC9qnyW -5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI04Y+oXNZtPdE -ITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0 -90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+z -xiD2BkewhpMl0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYu -QEkHDVneixCwSQXi/5E/S7fdAo74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4 -FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRYYdZ2vyJ/0Adqp2RT8JeNnYA/u8EH -22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJpadbGNjHh/PqAulxP -xOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65xxBzn -dFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5 -Xc0yGYuPjCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7b -nV2UqL1g52KAdoGDDIzMMEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQ -CvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9zZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZH -u/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3rAZ3r2OvEhJn7wAzMMujj -d9qDRIueVSjAi1jTkD5OGwDxFa2DK5o= ------END CERTIFICATE----- - -# Issuer: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA -# Subject: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA -# Label: "HARICA TLS RSA Root CA 2021" -# Serial: 76817823531813593706434026085292783742 -# MD5 Fingerprint: 65:47:9b:58:86:dd:2c:f0:fc:a2:84:1f:1e:96:c4:91 -# SHA1 Fingerprint: 02:2d:05:82:fa:88:ce:14:0c:06:79:de:7f:14:10:e9:45:d7:a5:6d -# SHA256 Fingerprint: d9:5d:0e:8e:da:79:52:5b:f9:be:b1:1b:14:d2:10:0d:32:94:98:5f:0c:62:d9:fa:bd:9c:d9:99:ec:cb:7b:1d ------BEGIN CERTIFICATE----- -MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBs -MQswCQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl -c2VhcmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0Eg -Um9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUzOFoXDTQ1MDIxMzEwNTUzN1owbDEL -MAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl -YXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNBIFJv -b3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569l -mwVnlskNJLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE -4VGC/6zStGndLuwRo0Xua2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uv -a9of08WRiFukiZLRgeaMOVig1mlDqa2YUlhu2wr7a89o+uOkXjpFc5gH6l8Cct4M -pbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K5FrZx40d/JiZ+yykgmvw -Kh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEvdmn8kN3b -LW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcY -AuUR0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqB -AGMUuTNe3QvboEUHGjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYq -E613TBoYm5EPWNgGVMWX+Ko/IIqmhaZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHr -W2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQCPxrvrNQKlr9qEgYRtaQQJKQ -CoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE -AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAU -X15QvWiWkKQUEapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3 -f5Z2EMVGpdAgS1D0NTsY9FVqQRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxaja -H6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxDQpSbIPDRzbLrLFPCU3hKTwSUQZqP -JzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcRj88YxeMn/ibvBZ3P -zzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5vZSt -jBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0 -/L5H9MG0qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pT -BGIBnfHAT+7hOtSLIBD6Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79 -aPib8qXPMThcFarmlwDB31qlpzmq6YR/PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YW -xw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnnkf3/W9b3raYvAwtt41dU -63ZTGI0RmLo= ------END CERTIFICATE----- - -# Issuer: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA -# Subject: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA -# Label: "HARICA TLS ECC Root CA 2021" -# Serial: 137515985548005187474074462014555733966 -# MD5 Fingerprint: ae:f7:4c:e5:66:35:d1:b7:9b:8c:22:93:74:d3:4b:b0 -# SHA1 Fingerprint: bc:b0:c1:9d:e9:98:92:70:19:38:57:e9:8d:a7:b4:5d:6e:ee:01:48 -# SHA256 Fingerprint: 3f:99:cc:47:4a:cf:ce:4d:fe:d5:87:94:66:5e:47:8d:15:47:73:9f:2e:78:0f:1b:b4:ca:9b:13:30:97:d4:01 ------BEGIN CERTIFICATE----- -MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQsw -CQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2Vh -cmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9v -dCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoXDTQ1MDIxMzExMDEwOVowbDELMAkG -A1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj -aCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJvb3Qg -Q0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7 -KKrxcm1lAEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9Y -STHMmE5gEYd103KUkE+bECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQD -AgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAircJRQO9gcS3ujwLEXQNw -SaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/QwCZ61IygN -nxS2PFOiTAZpffpskcYqSUXm7LcT4Tps ------END CERTIFICATE----- - -# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 -# Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 -# Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" -# Serial: 1977337328857672817 -# MD5 Fingerprint: 4e:6e:9b:54:4c:ca:b7:fa:48:e4:90:b1:15:4b:1c:a3 -# SHA1 Fingerprint: 0b:be:c2:27:22:49:cb:39:aa:db:35:5c:53:e3:8c:ae:78:ff:b6:fe -# SHA256 Fingerprint: 57:de:05:83:ef:d2:b2:6e:03:61:da:99:da:9d:f4:64:8d:ef:7e:e8:44:1c:3b:72:8a:fa:9b:cd:e0:f9:b2:6a ------BEGIN CERTIFICATE----- -MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UE -BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h -cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1 -MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg -Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 -thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM -cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG -L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i -NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h -X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b -m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy -Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja -EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T -KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF -6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh -OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1UdDgQWBBRlzeurNR4APn7VdMAc -tHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4wgZswgZgGBFUd -IAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j -b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABC -AG8AbgBhAG4AbwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAw -ADEANzAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9m -iWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL4QjbEwj4KKE1soCzC1HA01aajTNF -Sa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDbLIpgD7dvlAceHabJ -hfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1ilI45P -Vf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZE -EAEeiGaPcjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV -1aUsIC+nmCjuRfzxuIgALI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2t -CsvMo2ebKHTEm9caPARYpoKdrcd7b/+Alun4jWq9GJAd/0kakFI3ky88Al2CdgtR -5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH9IBk9W6VULgRfhVwOEqw -f9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpfNIbnYrX9 -ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNK -GbqEZycPvEJdvSRUDewdcAZfpLz6IHxV ------END CERTIFICATE----- - -# Issuer: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. -# Subject: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. -# Label: "vTrus ECC Root CA" -# Serial: 630369271402956006249506845124680065938238527194 -# MD5 Fingerprint: de:4b:c1:f5:52:8c:9b:43:e1:3e:8f:55:54:17:8d:85 -# SHA1 Fingerprint: f6:9c:db:b0:fc:f6:02:13:b6:52:32:a6:a3:91:3f:16:70:da:c3:e1 -# SHA256 Fingerprint: 30:fb:ba:2c:32:23:8e:2a:98:54:7a:f9:79:31:e5:50:42:8b:9b:3f:1c:8e:eb:66:33:dc:fa:86:c5:b2:7d:d3 ------BEGIN CERTIFICATE----- -MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMw -RzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAY -BgNVBAMTEXZUcnVzIEVDQyBSb290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDcz -MTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28u -LEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYwEAYHKoZIzj0CAQYF -K4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+cToL0 -v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUd -e4BdS49nTPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYD -VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIw -V53dVvHH4+m4SVBrm2nDb+zDfSXkV5UTQJtS0zvzQBm8JsctBp61ezaf9SXUY2sA -AjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQLYgmRWAD5Tfs0aNoJrSEG -GJTO ------END CERTIFICATE----- - -# Issuer: CN=vTrus Root CA O=iTrusChina Co.,Ltd. -# Subject: CN=vTrus Root CA O=iTrusChina Co.,Ltd. -# Label: "vTrus Root CA" -# Serial: 387574501246983434957692974888460947164905180485 -# MD5 Fingerprint: b8:c9:37:df:fa:6b:31:84:64:c5:ea:11:6a:1b:75:fc -# SHA1 Fingerprint: 84:1a:69:fb:f5:cd:1a:25:34:13:3d:e3:f8:fc:b8:99:d0:c9:14:b7 -# SHA256 Fingerprint: 8a:71:de:65:59:33:6f:42:6c:26:e5:38:80:d0:0d:88:a1:8d:a4:c6:a9:1f:0d:cb:61:94:e2:06:c5:c9:63:87 ------BEGIN CERTIFICATE----- -MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL -BQAwQzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4x -FjAUBgNVBAMTDXZUcnVzIFJvb3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMx -MDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoGA1UEChMTaVRydXNDaGluYSBDby4s -THRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZotsSKYc -IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU -AyyNJJrIZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+ -GrPSbcKvdmaVayqwlHeFXgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z9 -8Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KAYPxMvDVTAWqXcoKv8R1w6Jz1717CbMdH -flqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70kLJrxLT5ZOrpGgrIDajt -J8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2AXPKBlim -0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZN -pGvu/9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQ -UqqzApVg+QxMaPnu1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHW -OXSuTEGC2/KmSNGzm/MzqvOmwMVO9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMB -AAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYgscasGrz2iTAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAKbqSSaet -8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd -nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1j -bhd47F18iMjrjld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvM -Kar5CKXiNxTKsbhm7xqC5PD48acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIiv -TDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJnxDHO2zTlJQNgJXtxmOTAGytfdELS -S8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554WgicEFOwE30z9J4nfr -I8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4sEb9 -b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNB -UvupLnKWnyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1P -Ti07NEPhmg4NpGaXutIcSkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929ven -sBxXVsFy6K2ir40zSbofitzmdHxghm+Hl3s= ------END CERTIFICATE----- - -# Issuer: CN=ISRG Root X2 O=Internet Security Research Group -# Subject: CN=ISRG Root X2 O=Internet Security Research Group -# Label: "ISRG Root X2" -# Serial: 87493402998870891108772069816698636114 -# MD5 Fingerprint: d3:9e:c4:1e:23:3c:a6:df:cf:a3:7e:6d:e0:14:e6:e5 -# SHA1 Fingerprint: bd:b1:b9:3c:d5:97:8d:45:c6:26:14:55:f8:db:95:c7:5a:d1:53:af -# SHA256 Fingerprint: 69:72:9b:8e:15:a8:6e:fc:17:7a:57:af:b7:17:1d:fc:64:ad:d2:8c:2f:ca:8c:f1:50:7e:34:45:3c:cb:14:70 ------BEGIN CERTIFICATE----- -MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw -CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg -R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00 -MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT -ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw -EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW -+1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9 -ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T -AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI -zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW -tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1 -/q4AaOeMSQ+2b1tbFfLn ------END CERTIFICATE----- - -# Issuer: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. -# Subject: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. -# Label: "HiPKI Root CA - G1" -# Serial: 60966262342023497858655262305426234976 -# MD5 Fingerprint: 69:45:df:16:65:4b:e8:68:9a:8f:76:5f:ff:80:9e:d3 -# SHA1 Fingerprint: 6a:92:e4:a8:ee:1b:ec:96:45:37:e3:29:57:49:cd:96:e3:e5:d2:60 -# SHA256 Fingerprint: f0:15:ce:3c:c2:39:bf:ef:06:4b:e9:f1:d2:c4:17:e1:a0:26:4a:0a:94:be:1f:0c:8d:12:18:64:eb:69:49:cc ------BEGIN CERTIFICATE----- -MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBP -MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 -ZC4xGzAZBgNVBAMMEkhpUEtJIFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRa -Fw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3 -YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kgUm9vdCBDQSAtIEcx -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0o9Qw -qNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twv -Vcg3Px+kwJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6 -lZgRZq2XNdZ1AYDgr/SEYYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnz -Qs7ZngyzsHeXZJzA9KMuH5UHsBffMNsAGJZMoYFL3QRtU6M9/Aes1MU3guvklQgZ -KILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfdhSi8MEyr48KxRURHH+CK -FgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj1jOXTyFj -HluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDr -y+K49a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ -/W3c1pzAtH2lsN0/Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgM -a/aOEmem8rJY5AIJEzypuxC00jBF8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6 -fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQDAgGGMA0GCSqG -SIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi -7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqc -SE5XCV0vrPSltJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6Fza -ZsT0pPBWGTMpWmWSBUdGSquEwx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9Tc -XzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07QJNBAsNB1CI69aO4I1258EHBGG3zg -iLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv5wiZqAxeJoBF1Pho -L5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+GpzjLrF -Ne85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wr -kkVbbiVghUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+ -vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU -YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ== ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 -# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 -# Label: "GlobalSign ECC Root CA - R4" -# Serial: 159662223612894884239637590694 -# MD5 Fingerprint: 26:29:f8:6d:e1:88:bf:a2:65:7f:aa:c4:cd:0f:7f:fc -# SHA1 Fingerprint: 6b:a0:b0:98:e1:71:ef:5a:ad:fe:48:15:80:77:10:f4:bd:6f:0b:28 -# SHA256 Fingerprint: b0:85:d7:0b:96:4f:19:1a:73:e4:af:0d:54:ae:7a:0e:07:aa:fd:af:9b:71:dd:08:62:13:8a:b7:32:5a:24:a2 ------BEGIN CERTIFICATE----- -MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYD -VQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2Jh -bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgw -MTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0g -UjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wWTAT -BgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkWymOx -uYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNV -HQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/ -+wpu+74zyTyjhNUwCgYIKoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147 -bmF0774BxL4YSFlhgjICICadVGNA3jdgUM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R1 O=Google Trust Services LLC -# Subject: CN=GTS Root R1 O=Google Trust Services LLC -# Label: "GTS Root R1" -# Serial: 159662320309726417404178440727 -# MD5 Fingerprint: 05:fe:d0:bf:71:a8:a3:76:63:da:01:e0:d8:52:dc:40 -# SHA1 Fingerprint: e5:8c:1c:c4:91:3b:38:63:4b:e9:10:6e:e3:ad:8e:6b:9d:d9:81:4a -# SHA256 Fingerprint: d9:47:43:2a:bd:e7:b7:fa:90:fc:2e:6b:59:10:1b:12:80:e0:e1:c7:e4:e4:0f:a3:c6:88:7f:ff:57:a7:f4:cf ------BEGIN CERTIFICATE----- -MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQsw -CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU -MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw -MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp -Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaMf/vo -27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7w -Cl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjw -TcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0Pfybl -qAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaH -szVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4Zor8 -Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUspzBmk -MiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92 -wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70p -aDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrN -VjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQID -AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E -FgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBAJ+qQibb -C5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe -QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuy -h6f88/qBVRRiClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM4 -7HLwEXWdyzRSjeZ2axfG34arJ45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J -ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef -MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/ -Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT -6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ -0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm -2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb -bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R2 O=Google Trust Services LLC -# Subject: CN=GTS Root R2 O=Google Trust Services LLC -# Label: "GTS Root R2" -# Serial: 159662449406622349769042896298 -# MD5 Fingerprint: 1e:39:c0:53:e6:1e:29:82:0b:ca:52:55:36:5d:57:dc -# SHA1 Fingerprint: 9a:44:49:76:32:db:de:fa:d0:bc:fb:5a:7b:17:bd:9e:56:09:24:94 -# SHA256 Fingerprint: 8d:25:cd:97:22:9d:bf:70:35:6b:da:4e:b3:cc:73:40:31:e2:4c:f0:0f:af:cf:d3:2d:c7:6e:b5:84:1c:7e:a8 ------BEGIN CERTIFICATE----- -MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQsw -CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU -MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw -MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp -Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3LvCvpt -nfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY -6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAu -MC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7k -RXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWg -f9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1mKPV -+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K8Yzo -dDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW -Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKa -G73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCq -gc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwID -AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E -FgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBAB/Kzt3H -vqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8 -0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyC -B19m3H0Q/gxhswWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2u -NmSRXbBoGOqKYcl3qJfEycel/FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMg -yALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVnjWQye+mew4K6Ki3pHrTgSAai/Gev -HyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y59PYjJbigapordwj6 -xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M7YNR -TOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924Sg -JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV -7LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl -6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R3 O=Google Trust Services LLC -# Subject: CN=GTS Root R3 O=Google Trust Services LLC -# Label: "GTS Root R3" -# Serial: 159662495401136852707857743206 -# MD5 Fingerprint: 3e:e7:9d:58:02:94:46:51:94:e5:e0:22:4a:8b:e7:73 -# SHA1 Fingerprint: ed:e5:71:80:2b:c8:92:b9:5b:83:3c:d2:32:68:3f:09:cd:a0:1e:46 -# SHA256 Fingerprint: 34:d8:a7:3e:e2:08:d9:bc:db:0d:95:65:20:93:4b:4e:40:e6:94:82:59:6e:8b:6f:73:c8:42:6b:01:0a:6f:48 ------BEGIN CERTIFICATE----- -MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYD -VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG -A1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw -WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz -IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNi -AAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout736G -jOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL2 -4CejQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7 -VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azTL818+FsuVbu/3ZL3pAzcMeGiAjEA/Jdm -ZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV11RZt+cRLInUue4X ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R4 O=Google Trust Services LLC -# Subject: CN=GTS Root R4 O=Google Trust Services LLC -# Label: "GTS Root R4" -# Serial: 159662532700760215368942768210 -# MD5 Fingerprint: 43:96:83:77:19:4d:76:b3:9d:65:52:e4:1d:22:a5:e8 -# SHA1 Fingerprint: 77:d3:03:67:b5:e0:0c:15:f6:0c:38:61:df:7c:e1:3b:92:46:4d:47 -# SHA256 Fingerprint: 34:9d:fa:40:58:c5:e2:63:12:3b:39:8a:e7:95:57:3c:4e:13:13:c8:3f:e6:8f:93:55:6c:d5:e8:03:1b:3c:7d ------BEGIN CERTIFICATE----- -MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD -VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG -A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw -WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz -IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi -AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi -QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR -HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D -9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8 -p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD ------END CERTIFICATE----- - -# Issuer: CN=Telia Root CA v2 O=Telia Finland Oyj -# Subject: CN=Telia Root CA v2 O=Telia Finland Oyj -# Label: "Telia Root CA v2" -# Serial: 7288924052977061235122729490515358 -# MD5 Fingerprint: 0e:8f:ac:aa:82:df:85:b1:f4:dc:10:1c:fc:99:d9:48 -# SHA1 Fingerprint: b9:99:cd:d1:73:50:8a:c4:47:05:08:9c:8c:88:fb:be:a0:2b:40:cd -# SHA256 Fingerprint: 24:2b:69:74:2f:cb:1e:5b:2a:bf:98:89:8b:94:57:21:87:54:4e:5b:4d:99:11:78:65:73:62:1f:6a:74:b8:2c ------BEGIN CERTIFICATE----- -MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQx -CzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UE -AwwQVGVsaWEgUm9vdCBDQSB2MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1 -NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZ -MBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ76zBq -AMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9 -vVYiQJ3q9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9 -lRdU2HhE8Qx3FZLgmEKnpNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTOD -n3WhUidhOPFZPY5Q4L15POdslv5e2QJltI5c0BE0312/UqeBAMN/mUWZFdUXyApT -7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW5olWK8jjfN7j/4nlNW4o -6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNrRBH0pUPC -TEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6 -WT0EBXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63R -DolUK5X6wK0dmBR4M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZI -pEYslOqodmJHixBTB0hXbOKSTbauBcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGj -YzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7Wxy+G2CQ5MB0GA1UdDgQWBBRy -rOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw -AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ -8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi -0f6X+J8wfBj5tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMM -A8iZGok1GTzTyVR8qPAs5m4HeW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBS -SRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+Cy748fdHif64W1lZYudogsYMVoe+K -TTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygCQMez2P2ccGrGKMOF -6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15h2Er -3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMt -Ty3EHD70sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pT -VmBds9hCG1xLEooc6+t9xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAW -ysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQraVplI/owd8k+BsHMYeB2F326CjYSlKA -rBPuUBQemMc= ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH -# Subject: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH -# Label: "D-TRUST BR Root CA 1 2020" -# Serial: 165870826978392376648679885835942448534 -# MD5 Fingerprint: b5:aa:4b:d5:ed:f7:e3:55:2e:8f:72:0a:f3:75:b8:ed -# SHA1 Fingerprint: 1f:5b:98:f0:e3:b5:f7:74:3c:ed:e6:b0:36:7d:32:cd:f4:09:41:67 -# SHA256 Fingerprint: e5:9a:aa:81:60:09:c2:2b:ff:5b:25:ba:d3:7d:f3:06:f0:49:79:7c:1f:81:d8:5a:b0:89:e6:57:bd:8f:00:44 ------BEGIN CERTIFICATE----- -MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQsw -CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS -VVNUIEJSIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5 -NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG -A1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB -BAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7dPYS -zuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0 -QVK5buXuQqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/ -VbNafAkl1bK6CKBrqx9tMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g -PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2JyX3Jvb3Rf -Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l -dC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 -c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO -PQQDAwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFW -wKrY7RjEsK70PvomAjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHV -dWNbFJWcHwHP2NVypw87 ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH -# Subject: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH -# Label: "D-TRUST EV Root CA 1 2020" -# Serial: 126288379621884218666039612629459926992 -# MD5 Fingerprint: 8c:2d:9d:70:9f:48:99:11:06:11:fb:e9:cb:30:c0:6e -# SHA1 Fingerprint: 61:db:8c:21:59:69:03:90:d8:7c:9c:12:86:54:cf:9d:3d:f4:dd:07 -# SHA256 Fingerprint: 08:17:0d:1a:a3:64:53:90:1a:2f:95:92:45:e3:47:db:0c:8d:37:ab:aa:bc:56:b8:1a:a1:00:dc:95:89:70:db ------BEGIN CERTIFICATE----- -MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQsw -CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS -VVNUIEVWIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5 -NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG -A1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB -BAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8ZRCC -/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rD -wpdhQntJraOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3 -OqQo5FD4pPfsazK2/umLMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g -PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2V2X3Jvb3Rf -Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l -dC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 -c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO -PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA -y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb -gfM0agPnIjhQW+0ZT0MW ------END CERTIFICATE----- - -# Issuer: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. -# Subject: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. -# Label: "DigiCert TLS ECC P384 Root G5" -# Serial: 13129116028163249804115411775095713523 -# MD5 Fingerprint: d3:71:04:6a:43:1c:db:a6:59:e1:a8:a3:aa:c5:71:ed -# SHA1 Fingerprint: 17:f3:de:5e:9f:0f:19:e9:8e:f6:1f:32:26:6e:20:c4:07:ae:30:ee -# SHA256 Fingerprint: 01:8e:13:f0:77:25:32:cf:80:9b:d1:b1:72:81:86:72:83:fc:48:c6:e1:3b:e9:c6:98:12:85:4a:49:0c:1b:05 ------BEGIN CERTIFICATE----- -MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQsw -CQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURp -Z2lDZXJ0IFRMUyBFQ0MgUDM4NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2 -MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJ -bmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQgUm9vdCBHNTB2MBAG -ByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1TzvdlHJS -7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp -0zVozptjn4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICIS -B4CIfBFqMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49 -BAMDA2gAMGUCMQCJao1H5+z8blUD2WdsJk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQ -LgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIxAJSdYsiJvRmEFOml+wG4 -DXZDjC5Ty3zfDBeWUA== ------END CERTIFICATE----- - -# Issuer: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. -# Subject: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. -# Label: "DigiCert TLS RSA4096 Root G5" -# Serial: 11930366277458970227240571539258396554 -# MD5 Fingerprint: ac:fe:f7:34:96:a9:f2:b3:b4:12:4b:e4:27:41:6f:e1 -# SHA1 Fingerprint: a7:88:49:dc:5d:7c:75:8c:8c:de:39:98:56:b3:aa:d0:b2:a5:71:35 -# SHA256 Fingerprint: 37:1a:00:dc:05:33:b3:72:1a:7e:eb:40:e8:41:9e:70:79:9d:2b:0a:0f:2c:1d:80:69:31:65:f7:ce:c4:ad:75 ------BEGIN CERTIFICATE----- -MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBN -MQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMT -HERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcN -NDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQs -IEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS87IE+ -ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG0 -2C+JFvuUAT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgp -wgscONyfMXdcvyej/Cestyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZM -pG2T6T867jp8nVid9E6P/DsjyG244gXazOvswzH016cpVIDPRFtMbzCe88zdH5RD -nU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnVDdXifBBiqmvwPXbzP6Po -sMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9qTXeXAaDx -Zre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cd -Lvvyz6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvX -KyY//SovcfXWJL5/MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNe -XoVPzthwiHvOAbWWl9fNff2C+MIkwcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPL -tgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4EFgQUUTMc7TZArxfTJc1paPKv -TiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcN -AQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw -GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7H -PNtQOa27PShNlnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLF -O4uJ+DQtpBflF+aZfTCIITfNMBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQ -REtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/u4cnYiWB39yhL/btp/96j1EuMPik -AdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9GOUrYU9DzLjtxpdRv -/PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh47a+ -p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilw -MUc/dNAUFvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WF -qUITVuwhd4GTWgzqltlJyqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCK -ovfepEWFJqgejF0pW8hL2JpqA15w8oVPbEtoL8pU9ozaMv7Da4M/OMZ+ ------END CERTIFICATE----- - -# Issuer: CN=Certainly Root R1 O=Certainly -# Subject: CN=Certainly Root R1 O=Certainly -# Label: "Certainly Root R1" -# Serial: 188833316161142517227353805653483829216 -# MD5 Fingerprint: 07:70:d4:3e:82:87:a0:fa:33:36:13:f4:fa:33:e7:12 -# SHA1 Fingerprint: a0:50:ee:0f:28:71:f4:27:b2:12:6d:6f:50:96:25:ba:cc:86:42:af -# SHA256 Fingerprint: 77:b8:2c:d8:64:4c:43:05:f7:ac:c5:cb:15:6b:45:67:50:04:03:3d:51:c6:0c:62:02:a8:e0:c3:34:67:d3:a0 ------BEGIN CERTIFICATE----- -MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAw -PTELMAkGA1UEBhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2Vy -dGFpbmx5IFJvb3QgUjEwHhcNMjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9 -MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0 -YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANA2 -1B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O5MQT -vqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbed -aFySpvXl8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b0 -1C7jcvk2xusVtyWMOvwlDbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5 -r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGIXsXwClTNSaa/ApzSRKft43jvRl5tcdF5 -cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkNKPl6I7ENPT2a/Z2B7yyQ -wHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQAjeZjOVJ -6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA -2CnbrlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyH -Wyf5QBGenDPBt+U1VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMR -eiFPCyEQtkA6qyI6BJyLm4SGcprSp6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB -/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTgqj8ljZ9EXME66C6u -d0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAszHQNTVfSVcOQr -PbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d -8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi -1wrykXprOQ4vMMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrd -rRT90+7iIgXr0PK3aBLXWopBGsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9di -taY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+gjwN/KUD+nsa2UUeYNrEjvn8K8l7 -lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgHJBu6haEaBQmAupVj -yTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7fpYn -Kx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLy -yCwzk5Iwx06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5n -wXARPbv0+Em34yaXOp/SX3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6 -OV+KmalBWQewLK8= ------END CERTIFICATE----- - -# Issuer: CN=Certainly Root E1 O=Certainly -# Subject: CN=Certainly Root E1 O=Certainly -# Label: "Certainly Root E1" -# Serial: 8168531406727139161245376702891150584 -# MD5 Fingerprint: 0a:9e:ca:cd:3e:52:50:c6:36:f3:4b:a3:ed:a7:53:e9 -# SHA1 Fingerprint: f9:e1:6d:dc:01:89:cf:d5:82:45:63:3e:c5:37:7d:c2:eb:93:6f:2b -# SHA256 Fingerprint: b4:58:5f:22:e4:ac:75:6a:4e:86:12:a1:36:1c:5d:9d:03:1a:93:fd:84:fe:bb:77:8f:a3:06:8b:0f:c4:2d:c2 ------BEGIN CERTIFICATE----- -MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQsw -CQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlu -bHkgUm9vdCBFMTAeFw0yMTA0MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJ -BgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlubHkxGjAYBgNVBAMTEUNlcnRhaW5s -eSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4fxzf7flHh4axpMCK -+IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9YBk2 -QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4 -hevIIgcwCgYIKoZIzj0EAwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozm -ut6Dacpps6kFtZaSF4fC0urQe87YQVt8rgIwRt7qy12a7DLCZRawTDBcMPPaTnOG -BtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR ------END CERTIFICATE----- - -# Issuer: CN=Security Communication RootCA3 O=SECOM Trust Systems CO.,LTD. -# Subject: CN=Security Communication RootCA3 O=SECOM Trust Systems CO.,LTD. -# Label: "Security Communication RootCA3" -# Serial: 16247922307909811815 -# MD5 Fingerprint: 1c:9a:16:ff:9e:5c:e0:4d:8a:14:01:f4:35:5d:29:26 -# SHA1 Fingerprint: c3:03:c8:22:74:92:e5:61:a2:9c:5f:79:91:2b:1e:44:13:91:30:3a -# SHA256 Fingerprint: 24:a5:5c:2a:b0:51:44:2d:06:17:76:65:41:23:9a:4a:d0:32:d7:c5:51:75:aa:34:ff:de:2f:bc:4f:5c:52:94 ------BEGIN CERTIFICATE----- -MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBDAUAMF0xCzAJBgNV -BAYTAkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMScw -JQYDVQQDEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTMwHhcNMTYwNjE2 -MDYxNzE2WhcNMzgwMTE4MDYxNzE2WjBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc -U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UEAxMeU2VjdXJpdHkg -Q29tbXVuaWNhdGlvbiBSb290Q0EzMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC -CgKCAgEA48lySfcw3gl8qUCBWNO0Ot26YQ+TUG5pPDXC7ltzkBtnTCHsXzW7OT4r -CmDvu20rhvtxosis5FaU+cmvsXLUIKx00rgVrVH+hXShuRD+BYD5UpOzQD11EKzA -lrenfna84xtSGc4RHwsENPXY9Wk8d/Nk9A2qhd7gCVAEF5aEt8iKvE1y/By7z/MG -TfmfZPd+pmaGNXHIEYBMwXFAWB6+oHP2/D5Q4eAvJj1+XCO1eXDe+uDRpdYMQXF7 -9+qMHIjH7Iv10S9VlkZ8WjtYO/u62C21Jdp6Ts9EriGmnpjKIG58u4iFW/vAEGK7 -8vknR+/RiTlDxN/e4UG/VHMgly1s2vPUB6PmudhvrvyMGS7TZ2crldtYXLVqAvO4 -g160a75BflcJdURQVc1aEWEhCmHCqYj9E7wtiS/NYeCVvsq1e+F7NGcLH7YMx3we -GVPKp7FKFSBWFHA9K4IsD50VHUeAR/94mQ4xr28+j+2GaR57GIgUssL8gjMunEst -+3A7caoreyYn8xrC3PsXuKHqy6C0rtOUfnrQq8PsOC0RLoi/1D+tEjtCrI8Cbn3M -0V9hvqG8OmpI6iZVIhZdXw3/JzOfGAN0iltSIEdrRU0id4xVJ/CvHozJgyJUt5rQ -T9nO/NkuHJYosQLTA70lUhw0Zk8jq/R3gpYd0VcwCBEF/VfR2ccCAwEAAaNCMEAw -HQYDVR0OBBYEFGQUfPxYchamCik0FW8qy7z8r6irMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQDcAiMI4u8hOscNtybS -YpOnpSNyByCCYN8Y11StaSWSntkUz5m5UoHPrmyKO1o5yGwBQ8IibQLwYs1OY0PA -FNr0Y/Dq9HHuTofjcan0yVflLl8cebsjqodEV+m9NU1Bu0soo5iyG9kLFwfl9+qd -9XbXv8S2gVj/yP9kaWJ5rW4OH3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQI -UYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASxYfQAW0q3nHE3GYV5v4GwxxMOdnE+ -OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZXSEIx2C/pHF7uNke -gr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml+LLf -iAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUV -nuiZIesnKwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD -2NCcnWXL0CsnMQMeNuE9dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI// -1ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm6Vwdp6POXiUyK+OVrCoHzrQoeIY8Laad -TdJ0MN1kURXbg4NR16/9M51NZg== ------END CERTIFICATE----- - -# Issuer: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. -# Subject: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. -# Label: "Security Communication ECC RootCA1" -# Serial: 15446673492073852651 -# MD5 Fingerprint: 7e:43:b0:92:68:ec:05:43:4c:98:ab:5d:35:2e:7e:86 -# SHA1 Fingerprint: b8:0e:26:a9:bf:d2:b2:3b:c0:ef:46:c9:ba:c7:bb:f6:1d:0d:41:41 -# SHA256 Fingerprint: e7:4f:bd:a5:5b:d5:64:c4:73:a3:6b:44:1a:a7:99:c8:a6:8e:07:74:40:e8:28:8b:9f:a1:e5:0e:4b:ba:ca:11 ------BEGIN CERTIFICATE----- -MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYT -AkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYD -VQQDEyJTZWN1cml0eSBDb21tdW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYx -NjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTELMAkGA1UEBhMCSlAxJTAjBgNVBAoT -HFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNVBAMTIlNlY3VyaXR5 -IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQAIgNi -AASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+Cnnfdl -dB9sELLo5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpK -ULGjQjBAMB0GA1UdDgQWBBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu -9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3LsnNdo4gIxwwCMQDAqy0O -be0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70eN9k= ------END CERTIFICATE----- - -# Issuer: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY -# Subject: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY -# Label: "BJCA Global Root CA1" -# Serial: 113562791157148395269083148143378328608 -# MD5 Fingerprint: 42:32:99:76:43:33:36:24:35:07:82:9b:28:f9:d0:90 -# SHA1 Fingerprint: d5:ec:8d:7b:4c:ba:79:f4:e7:e8:cb:9d:6b:ae:77:83:10:03:21:6a -# SHA256 Fingerprint: f3:89:6f:88:fe:7c:0a:88:27:66:a7:fa:6a:d2:74:9f:b5:7a:7f:3e:98:fb:76:9c:1f:a7:b0:9c:2c:44:d5:ae ------BEGIN CERTIFICATE----- -MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBU -MQswCQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRI -T1JJVFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAz -MTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJF -SUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2Jh -bCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFmCL3Z -xRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZ -spDyRhySsTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O5 -58dnJCNPYwpj9mZ9S1WnP3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgR -at7GGPZHOiJBhyL8xIkoVNiMpTAK+BcWyqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll -5+M7sSKGjwZteAf9kRJ/sGsciQ35uMt0WwfCyPQ10WRjeulumijWML3mG90Vr4Tq -nMfK9Q7q8l0ph49pczm+LiRvRSGsxdRpJQaDrXpIhRMsDQa4bHlW/KNnMoH1V6XK -V0Jp6VwkYe/iMBhORJhVb3rCk9gZtt58R4oRTklH2yiUAguUSiz5EtBP6DF+bHq/ -pj+bOT0CFqMYs2esWz8sgytnOYFcuX6U1WTdno9uruh8W7TXakdI136z1C2OVnZO -z2nxbkRs1CTqjSShGL+9V/6pmTW12xB3uD1IutbB5/EjPtffhZ0nPNRAvQoMvfXn -jSXWgXSHRtQpdaJCbPdzied9v3pKH9MiyRVVz99vfFXQpIsHETdfg6YmV6YBW37+ -WGgHqel62bno/1Afq8K0wM7o6v0PvY1NuLxxAgMBAAGjQjBAMB0GA1UdDgQWBBTF -7+3M2I0hxkjk49cULqcWk+WYATAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE -AwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAUoKsITQfI/Ki2Pm4rzc2IInRNwPWaZ+4 -YRC6ojGYWUfo0Q0lHhVBDOAqVdVXUsv45Mdpox1NcQJeXyFFYEhcCY5JEMEE3Kli -awLwQ8hOnThJdMkycFRtwUf8jrQ2ntScvd0g1lPJGKm1Vrl2i5VnZu69mP6u775u -+2D2/VnGKhs/I0qUJDAnyIm860Qkmss9vk/Ves6OF8tiwdneHg56/0OGNFK8YT88 -X7vZdrRTvJez/opMEi4r89fO4aL/3Xtw+zuhTaRjAv04l5U/BXCga99igUOLtFkN -SoxUnMW7gZ/NfaXvCyUeOiDbHPwfmGcCCtRzRBPbUYQaVQNW4AB+dAb/OMRyHdOo -P2gxXdMJxy6MW2Pg6Nwe0uxhHvLe5e/2mXZgLR6UcnHGCyoyx5JO1UbXHfmpGQrI -+pXObSOYqgs4rZpWDW+N8TEAiMEXnM0ZNjX+VVOg4DwzX5Ze4jLp3zO7Bkqp2IRz -znfSxqxx4VyjHQy7Ct9f4qNx2No3WqB4K/TUfet27fJhcKVlmtOJNBir+3I+17Q9 -eVzYH6Eze9mCUAyTF6ps3MKCuwJXNq+YJyo5UOGwifUll35HaBC07HPKs5fRJNz2 -YqAo07WjuGS3iGJCz51TzZm+ZGiPTx4SSPfSKcOYKMryMguTjClPPGAyzQWWYezy -r/6zcCwupvI= ------END CERTIFICATE----- - -# Issuer: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY -# Subject: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY -# Label: "BJCA Global Root CA2" -# Serial: 58605626836079930195615843123109055211 -# MD5 Fingerprint: 5e:0a:f6:47:5f:a6:14:e8:11:01:95:3f:4d:01:eb:3c -# SHA1 Fingerprint: f4:27:86:eb:6e:b8:6d:88:31:67:02:fb:ba:66:a4:53:00:aa:7a:a6 -# SHA256 Fingerprint: 57:4d:f6:93:1e:27:80:39:66:7b:72:0a:fd:c1:60:0f:c2:7e:b6:6d:d3:09:29:79:fb:73:85:64:87:21:28:82 ------BEGIN CERTIFICATE----- -MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQsw -CQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJ -VFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgy -MVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJ -TkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2JhbCBS -b290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jlSR9B -IgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK+ -+kpRuDCK/eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJK -sVF/BvDRgh9Obl+rg/xI1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD -AgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA -94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8gUXOQwKhbYdDFUDn9hf7B -43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w== ------END CERTIFICATE----- - -# Issuer: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited -# Subject: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited -# Label: "Sectigo Public Server Authentication Root E46" -# Serial: 88989738453351742415770396670917916916 -# MD5 Fingerprint: 28:23:f8:b2:98:5c:37:16:3b:3e:46:13:4e:b0:b3:01 -# SHA1 Fingerprint: ec:8a:39:6c:40:f0:2e:bc:42:75:d4:9f:ab:1c:1a:5b:67:be:d2:9a -# SHA256 Fingerprint: c9:0f:26:f0:fb:1b:40:18:b2:22:27:51:9b:5c:a2:b5:3e:2c:a5:b3:be:5c:f1:8e:fe:1b:ef:47:38:0c:53:83 ------BEGIN CERTIFICATE----- -MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQsw -CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T -ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcN -MjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYG -A1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT -ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA -IgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccC -WvkEN/U0NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+ -6xnOQ6OjQjBAMB0GA1UdDgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8B -Af8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNnADBkAjAn7qRa -qCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RHlAFWovgzJQxC36oCMB3q -4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21USAGKcw== ------END CERTIFICATE----- - -# Issuer: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited -# Subject: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited -# Label: "Sectigo Public Server Authentication Root R46" -# Serial: 156256931880233212765902055439220583700 -# MD5 Fingerprint: 32:10:09:52:00:d5:7e:6c:43:df:15:c0:b1:16:93:e5 -# SHA1 Fingerprint: ad:98:f9:f3:e4:7d:75:3b:65:d4:82:b3:a4:52:17:bb:6e:f5:e4:38 -# SHA256 Fingerprint: 7b:b6:47:a6:2a:ee:ac:88:bf:25:7a:a5:22:d0:1f:fe:a3:95:e0:ab:45:c7:3f:93:f6:56:54:ec:38:f2:5a:06 ------BEGIN CERTIFICATE----- -MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBf -MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQD -Ey1TZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYw -HhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEY -MBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1Ymxp -YyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDa -ef0rty2k1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnz -SDBh+oF8HqcIStw+KxwfGExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xf -iOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMPFF1bFOdLvt30yNoDN9HWOaEhUTCDsG3X -ME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vuZDCQOc2TZYEhMbUjUDM3 -IuM47fgxMMxF/mL50V0yeUKH32rMVhlATc6qu/m1dkmU8Sf4kaWD5QazYw6A3OAS -VYCmO2a0OYctyPDQ0RTp5A1NDvZdV3LFOxxHVp3i1fuBYYzMTYCQNFu31xR13NgE -SJ/AwSiItOkcyqex8Va3e0lMWeUgFaiEAin6OJRpmkkGj80feRQXEgyDet4fsZfu -+Zd4KKTIRJLpfSYFplhym3kT2BFfrsU4YjRosoYwjviQYZ4ybPUHNs2iTG7sijbt -8uaZFURww3y8nDnAtOFr94MlI1fZEoDlSfB1D++N6xybVCi0ITz8fAr/73trdf+L -HaAZBav6+CuBQug4urv7qv094PPK306Xlynt8xhW6aWWrL3DkJiy4Pmi1KZHQ3xt -zwIDAQABo0IwQDAdBgNVHQ4EFgQUVnNYZJX5khqwEioEYnmhQBWIIUkwDgYDVR0P -AQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAC9c -mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQ -YKlJfp/imTYpE0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52 -gDY9hAaLMyZlbcp+nv4fjFg4exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZA -Fv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M0ejf5lG5Nkc/kLnHvALcWxxPDkjB -JYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI84HxZmduTILA7rpX -DhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9mpFui -TdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5 -dHn5HrwdVw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65 -LvKRRFHQV80MNNVIIb/bE/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp -0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmmJ1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAY -QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL ------END CERTIFICATE----- - -# Issuer: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation -# Subject: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation -# Label: "SSL.com TLS RSA Root CA 2022" -# Serial: 148535279242832292258835760425842727825 -# MD5 Fingerprint: d8:4e:c6:59:30:d8:fe:a0:d6:7a:5a:2c:2c:69:78:da -# SHA1 Fingerprint: ec:2c:83:40:72:af:26:95:10:ff:0e:f2:03:ee:31:70:f6:78:9d:ca -# SHA256 Fingerprint: 8f:af:7d:2e:2c:b4:70:9b:b8:e0:b3:36:66:bf:75:a5:dd:45:b5:de:48:0f:8e:a8:d4:bf:e6:be:bc:17:f2:ed ------BEGIN CERTIFICATE----- -MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBO -MQswCQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQD -DBxTU0wuY29tIFRMUyBSU0EgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloX -DTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jw -b3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgUlNBIFJvb3QgQ0EgMjAyMjCC -AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANCkCXJPQIgSYT41I57u9nTP -L3tYPc48DRAokC+X94xI2KDYJbFMsBFMF3NQ0CJKY7uB0ylu1bUJPiYYf7ISf5OY -t6/wNr/y7hienDtSxUcZXXTzZGbVXcdotL8bHAajvI9AI7YexoS9UcQbOcGV0ins -S657Lb85/bRi3pZ7QcacoOAGcvvwB5cJOYF0r/c0WRFXCsJbwST0MXMwgsadugL3 -PnxEX4MN8/HdIGkWCVDi1FW24IBydm5MR7d1VVm0U3TZlMZBrViKMWYPHqIbKUBO -L9975hYsLfy/7PO0+r4Y9ptJ1O4Fbtk085zx7AGL0SDGD6C1vBdOSHtRwvzpXGk3 -R2azaPgVKPC506QVzFpPulJwoxJF3ca6TvvC0PeoUidtbnm1jPx7jMEWTO6Af77w -dr5BUxIzrlo4QqvXDz5BjXYHMtWrifZOZ9mxQnUjbvPNQrL8VfVThxc7wDNY8VLS -+YCk8OjwO4s4zKTGkH8PnP2L0aPP2oOnaclQNtVcBdIKQXTbYxE3waWglksejBYS -d66UNHsef8JmAOSqg+qKkK3ONkRN0VHpvB/zagX9wHQfJRlAUW7qglFA35u5CCoG -AtUjHBPW6dvbxrB6y3snm/vg1UYk7RBLY0ulBY+6uB0rpvqR4pJSvezrZ5dtmi2f -gTIFZzL7SAg/2SW4BCUvAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j -BBgwFoAU+y437uOEeicuzRk1sTN8/9REQrkwHQYDVR0OBBYEFPsuN+7jhHonLs0Z -NbEzfP/UREK5MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAjYlt -hEUY8U+zoO9opMAdrDC8Z2awms22qyIZZtM7QbUQnRC6cm4pJCAcAZli05bg4vsM -QtfhWsSWTVTNj8pDU/0quOr4ZcoBwq1gaAafORpR2eCNJvkLTqVTJXojpBzOCBvf -R4iyrT7gJ4eLSYwfqUdYe5byiB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJ -DPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjUo3KUQyxi4U5cMj29TH0ZR6LDSeeW -P4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqoENjwuSfr98t67wVy -lrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7EgkaibMOlq -bLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2w -AgDHbICivRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3q -r5nsLFR+jM4uElZI7xc7P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sji -Mho6/4UIyYOf8kpIEFR3N+2ivEC+5BB09+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU -98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA= ------END CERTIFICATE----- - -# Issuer: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation -# Subject: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation -# Label: "SSL.com TLS ECC Root CA 2022" -# Serial: 26605119622390491762507526719404364228 -# MD5 Fingerprint: 99:d7:5c:f1:51:36:cc:e9:ce:d9:19:2e:77:71:56:c5 -# SHA1 Fingerprint: 9f:5f:d9:1a:54:6d:f5:0c:71:f0:ee:7a:bd:17:49:98:84:73:e2:39 -# SHA256 Fingerprint: c3:2f:fd:9f:46:f9:36:d1:6c:36:73:99:09:59:43:4b:9a:d6:0a:af:bb:9e:7c:f3:36:54:f1:44:cc:1b:a1:43 ------BEGIN CERTIFICATE----- -MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQsw -CQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxT -U0wuY29tIFRMUyBFQ0MgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2 -MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3Jh -dGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3QgQ0EgMjAyMjB2MBAG -ByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWyJGYm -acCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFN -SeR7T5v15wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSME -GDAWgBSJjy+j6CugFFR781a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NW -uCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp -15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w7deedWo1dlJF4AIxAMeN -b0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5Zn6g6g== ------END CERTIFICATE----- - -# Issuer: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos -# Subject: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos -# Label: "Atos TrustedRoot Root CA ECC TLS 2021" -# Serial: 81873346711060652204712539181482831616 -# MD5 Fingerprint: 16:9f:ad:f1:70:ad:79:d6:ed:29:b4:d1:c5:79:70:a8 -# SHA1 Fingerprint: 9e:bc:75:10:42:b3:02:f3:81:f4:f7:30:62:d4:8f:c3:a7:51:b2:dd -# SHA256 Fingerprint: b2:fa:e5:3e:14:cc:d7:ab:92:12:06:47:01:ae:27:9c:1d:89:88:fa:cb:77:5f:a8:a0:08:91:4e:66:39:88:a8 ------BEGIN CERTIFICATE----- -MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4w -LAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0w -CwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0 -MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBF -Q0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMHYwEAYHKoZI -zj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6KDP/X -tXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4 -AjJn8ZQSb+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2 -KCXWfeBmmnoJsmo7jjPXNtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMD -aAAwZQIwW5kp85wxtolrbNa9d+F851F+uDrNozZffPc8dz7kUK2o59JZDCaOMDtu -CCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGYa3cpetskz2VAv9LcjBHo -9H1/IISpQuQo ------END CERTIFICATE----- - -# Issuer: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos -# Subject: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos -# Label: "Atos TrustedRoot Root CA RSA TLS 2021" -# Serial: 111436099570196163832749341232207667876 -# MD5 Fingerprint: d4:d3:46:b8:9a:c0:9c:76:5d:9e:3a:c3:b9:99:31:d2 -# SHA1 Fingerprint: 18:52:3b:0d:06:37:e4:d6:3a:df:23:e4:98:fb:5b:16:fb:86:74:48 -# SHA256 Fingerprint: 81:a9:08:8e:a5:9f:b3:64:c5:48:a6:f8:55:59:09:9b:6f:04:05:ef:bf:18:e5:32:4e:c9:f4:57:ba:00:11:2f ------BEGIN CERTIFICATE----- -MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBM -MS4wLAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIx -MQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00 -MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBD -QSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMIICIjAN -BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtoAOxHm9BYx9sKOdTSJNy/BBl01Z -4NH+VoyX8te9j2y3I49f1cTYQcvyAh5x5en2XssIKl4w8i1mx4QbZFc4nXUtVsYv -Ye+W/CBGvevUez8/fEc4BKkbqlLfEzfTFRVOvV98r61jx3ncCHvVoOX3W3WsgFWZ -kmGbzSoXfduP9LVq6hdKZChmFSlsAvFr1bqjM9xaZ6cF4r9lthawEO3NUDPJcFDs -GY6wx/J0W2tExn2WuZgIWWbeKQGb9Cpt0xU6kGpn8bRrZtkh68rZYnxGEFzedUln -nkL5/nWpo63/dgpnQOPF943HhZpZnmKaau1Fh5hnstVKPNe0OwANwI8f4UDErmwh -3El+fsqyjW22v5MvoVw+j8rtgI5Y4dtXz4U2OLJxpAmMkokIiEjxQGMYsluMWuPD -0xeqqxmjLBvk1cbiZnrXghmmOxYsL3GHX0WelXOTwkKBIROW1527k2gV+p2kHYzy -geBYBr3JtuP2iV2J+axEoctr+hbxx1A9JNr3w+SH1VbxT5Aw+kUJWdo0zuATHAR8 -ANSbhqRAvNncTFd+rrcztl524WWLZt+NyteYr842mIycg5kDcPOvdO3GDjbnvezB -c6eUWsuSZIKmAMFwoW4sKeFYV+xafJlrJaSQOoD0IJ2azsct+bJLKZWD6TWNp0lI -pw9MGZHQ9b8Q4HECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU -dEmZ0f+0emhFdcN+tNzMzjkz2ggwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB -DAUAA4ICAQAjQ1MkYlxt/T7Cz1UAbMVWiLkO3TriJQ2VSpfKgInuKs1l+NsW4AmS -4BjHeJi78+xCUvuppILXTdiK/ORO/auQxDh1MoSf/7OwKwIzNsAQkG8dnK/haZPs -o0UvFJ/1TCplQ3IM98P4lYsU84UgYt1UU90s3BiVaU+DR3BAM1h3Egyi61IxHkzJ -qM7F78PRreBrAwA0JrRUITWXAdxfG/F851X6LWh3e9NpzNMOa7pNdkTWwhWaJuyw -xfW70Xp0wmzNxbVe9kzmWy2B27O3Opee7c9GslA9hGCZcbUztVdF5kJHdWoOsAgM -rr3e97sPWD2PAzHoPYJQyi9eDF20l74gNAf0xBLh7tew2VktafcxBPTy+av5EzH4 -AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9qTFsR -0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuY -o7Ey7Nmj1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5 -dDTedk+SKlOxJTnbPP/lPqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcE -oji2jbDwN/zIIX8/syQbPYtuzE2wFg2WHYMfRsCbvUOZ58SWLs5fyQ== ------END CERTIFICATE----- diff --git a/venv/lib/python3.8/site-packages/certifi/core.py b/venv/lib/python3.8/site-packages/certifi/core.py deleted file mode 100644 index de028981b97e1fcc8ef4ab2c817cc8731b9c8738..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/certifi/core.py +++ /dev/null @@ -1,108 +0,0 @@ -""" -certifi.py -~~~~~~~~~~ - -This module returns the installation location of cacert.pem or its contents. -""" -import sys - - -if sys.version_info >= (3, 11): - - from importlib.resources import as_file, files - - _CACERT_CTX = None - _CACERT_PATH = None - - def where() -> str: - # This is slightly terrible, but we want to delay extracting the file - # in cases where we're inside of a zipimport situation until someone - # actually calls where(), but we don't want to re-extract the file - # on every call of where(), so we'll do it once then store it in a - # global variable. - global _CACERT_CTX - global _CACERT_PATH - if _CACERT_PATH is None: - # This is slightly janky, the importlib.resources API wants you to - # manage the cleanup of this file, so it doesn't actually return a - # path, it returns a context manager that will give you the path - # when you enter it and will do any cleanup when you leave it. In - # the common case of not needing a temporary file, it will just - # return the file system location and the __exit__() is a no-op. - # - # We also have to hold onto the actual context manager, because - # it will do the cleanup whenever it gets garbage collected, so - # we will also store that at the global level as well. - _CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem")) - _CACERT_PATH = str(_CACERT_CTX.__enter__()) - - return _CACERT_PATH - - def contents() -> str: - return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii") - -elif sys.version_info >= (3, 7): - - from importlib.resources import path as get_path, read_text - - _CACERT_CTX = None - _CACERT_PATH = None - - def where() -> str: - # This is slightly terrible, but we want to delay extracting the - # file in cases where we're inside of a zipimport situation until - # someone actually calls where(), but we don't want to re-extract - # the file on every call of where(), so we'll do it once then store - # it in a global variable. - global _CACERT_CTX - global _CACERT_PATH - if _CACERT_PATH is None: - # This is slightly janky, the importlib.resources API wants you - # to manage the cleanup of this file, so it doesn't actually - # return a path, it returns a context manager that will give - # you the path when you enter it and will do any cleanup when - # you leave it. In the common case of not needing a temporary - # file, it will just return the file system location and the - # __exit__() is a no-op. - # - # We also have to hold onto the actual context manager, because - # it will do the cleanup whenever it gets garbage collected, so - # we will also store that at the global level as well. - _CACERT_CTX = get_path("certifi", "cacert.pem") - _CACERT_PATH = str(_CACERT_CTX.__enter__()) - - return _CACERT_PATH - - def contents() -> str: - return read_text("certifi", "cacert.pem", encoding="ascii") - -else: - import os - import types - from typing import Union - - Package = Union[types.ModuleType, str] - Resource = Union[str, "os.PathLike"] - - # This fallback will work for Python versions prior to 3.7 that lack the - # importlib.resources module but relies on the existing `where` function - # so won't address issues with environments like PyOxidizer that don't set - # __file__ on modules. - def read_text( - package: Package, - resource: Resource, - encoding: str = 'utf-8', - errors: str = 'strict' - ) -> str: - with open(where(), encoding=encoding) as data: - return data.read() - - # If we don't have importlib.resources, then we will just do the old logic - # of assuming we're on the filesystem and munge the path directly. - def where() -> str: - f = os.path.dirname(__file__) - - return os.path.join(f, "cacert.pem") - - def contents() -> str: - return read_text("certifi", "cacert.pem", encoding="ascii") diff --git a/venv/lib/python3.8/site-packages/certifi/py.typed b/venv/lib/python3.8/site-packages/certifi/py.typed deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/LICENSE b/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/LICENSE deleted file mode 100644 index ad82355b802d542e8443dc78b937fa36fdcc0ace..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 TAHRI Ahmed R. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/METADATA b/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/METADATA deleted file mode 100644 index ad5158c0dee36d82d15bda9073a5c6cad9b9cd60..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/METADATA +++ /dev/null @@ -1,668 +0,0 @@ -Metadata-Version: 2.1 -Name: charset-normalizer -Version: 3.3.0 -Summary: The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. -Home-page: https://github.com/Ousret/charset_normalizer -Author: Ahmed TAHRI -Author-email: ahmed.tahri@cloudnursery.dev -License: MIT -Project-URL: Bug Reports, https://github.com/Ousret/charset_normalizer/issues -Project-URL: Documentation, https://charset-normalizer.readthedocs.io/en/latest -Keywords: encoding,charset,charset-detector,detector,normalization,unicode,chardet,detect -Classifier: Development Status :: 5 - Production/Stable -Classifier: License :: OSI Approved :: MIT License -Classifier: Intended Audience :: Developers -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Text Processing :: Linguistic -Classifier: Topic :: Utilities -Classifier: Typing :: Typed -Requires-Python: >=3.7.0 -Description-Content-Type: text/markdown -License-File: LICENSE -Provides-Extra: unicode_backport - -

Charset Detection, for Everyone 👋

- -

- The Real First Universal Charset Detector
- - - - - Download Count Total - - - - -

-

- Featured Packages
- - Static Badge - - - Static Badge - -

-

- In other language (unofficial port - by the community)
- - Static Badge - -

- -> A library that helps you read text from an unknown charset encoding.
Motivated by `chardet`, -> I'm trying to resolve the issue by taking a new approach. -> All IANA character set names for which the Python core library provides codecs are supported. - -

- >>>>> 👉 Try Me Online Now, Then Adopt Me 👈 <<<<< -

- -This project offers you an alternative to **Universal Charset Encoding Detector**, also known as **Chardet**. - -| Feature | [Chardet](https://github.com/chardet/chardet) | Charset Normalizer | [cChardet](https://github.com/PyYoshi/cChardet) | -|--------------------------------------------------|:---------------------------------------------:|:--------------------------------------------------------------------------------------------------:|:-----------------------------------------------:| -| `Fast` | ❌ | ✅ | ✅ | -| `Universal**` | ❌ | ✅ | ❌ | -| `Reliable` **without** distinguishable standards | ❌ | ✅ | ✅ | -| `Reliable` **with** distinguishable standards | ✅ | ✅ | ✅ | -| `License` | LGPL-2.1
_restrictive_ | MIT | MPL-1.1
_restrictive_ | -| `Native Python` | ✅ | ✅ | ❌ | -| `Detect spoken language` | ❌ | ✅ | N/A | -| `UnicodeDecodeError Safety` | ❌ | ✅ | ❌ | -| `Whl Size (min)` | 193.6 kB | 42 kB | ~200 kB | -| `Supported Encoding` | 33 | 🎉 [99](https://charset-normalizer.readthedocs.io/en/latest/user/support.html#supported-encodings) | 40 | - -

-Reading Normalized TextCat Reading Text -

- -*\*\* : They are clearly using specific code for a specific encoding even if covering most of used one*
-Did you got there because of the logs? See [https://charset-normalizer.readthedocs.io/en/latest/user/miscellaneous.html](https://charset-normalizer.readthedocs.io/en/latest/user/miscellaneous.html) - -## ⚡ Performance - -This package offer better performance than its counterpart Chardet. Here are some numbers. - -| Package | Accuracy | Mean per file (ms) | File per sec (est) | -|-----------------------------------------------|:--------:|:------------------:|:------------------:| -| [chardet](https://github.com/chardet/chardet) | 86 % | 200 ms | 5 file/sec | -| charset-normalizer | **98 %** | **10 ms** | 100 file/sec | - -| Package | 99th percentile | 95th percentile | 50th percentile | -|-----------------------------------------------|:---------------:|:---------------:|:---------------:| -| [chardet](https://github.com/chardet/chardet) | 1200 ms | 287 ms | 23 ms | -| charset-normalizer | 100 ms | 50 ms | 5 ms | - -Chardet's performance on larger file (1MB+) are very poor. Expect huge difference on large payload. - -> Stats are generated using 400+ files using default parameters. More details on used files, see GHA workflows. -> And yes, these results might change at any time. The dataset can be updated to include more files. -> The actual delays heavily depends on your CPU capabilities. The factors should remain the same. -> Keep in mind that the stats are generous and that Chardet accuracy vs our is measured using Chardet initial capability -> (eg. Supported Encoding) Challenge-them if you want. - -## ✨ Installation - -Using pip: - -```sh -pip install charset-normalizer -U -``` - -## 🚀 Basic Usage - -### CLI -This package comes with a CLI. - -``` -usage: normalizer [-h] [-v] [-a] [-n] [-m] [-r] [-f] [-t THRESHOLD] - file [file ...] - -The Real First Universal Charset Detector. Discover originating encoding used -on text file. Normalize text to unicode. - -positional arguments: - files File(s) to be analysed - -optional arguments: - -h, --help show this help message and exit - -v, --verbose Display complementary information about file if any. - Stdout will contain logs about the detection process. - -a, --with-alternative - Output complementary possibilities if any. Top-level - JSON WILL be a list. - -n, --normalize Permit to normalize input file. If not set, program - does not write anything. - -m, --minimal Only output the charset detected to STDOUT. Disabling - JSON output. - -r, --replace Replace file when trying to normalize it instead of - creating a new one. - -f, --force Replace file without asking if you are sure, use this - flag with caution. - -t THRESHOLD, --threshold THRESHOLD - Define a custom maximum amount of chaos allowed in - decoded content. 0. <= chaos <= 1. - --version Show version information and exit. -``` - -```bash -normalizer ./data/sample.1.fr.srt -``` - -or - -```bash -python -m charset_normalizer ./data/sample.1.fr.srt -``` - -🎉 Since version 1.4.0 the CLI produce easily usable stdout result in JSON format. - -```json -{ - "path": "/home/default/projects/charset_normalizer/data/sample.1.fr.srt", - "encoding": "cp1252", - "encoding_aliases": [ - "1252", - "windows_1252" - ], - "alternative_encodings": [ - "cp1254", - "cp1256", - "cp1258", - "iso8859_14", - "iso8859_15", - "iso8859_16", - "iso8859_3", - "iso8859_9", - "latin_1", - "mbcs" - ], - "language": "French", - "alphabets": [ - "Basic Latin", - "Latin-1 Supplement" - ], - "has_sig_or_bom": false, - "chaos": 0.149, - "coherence": 97.152, - "unicode_path": null, - "is_preferred": true -} -``` - -### Python -*Just print out normalized text* -```python -from charset_normalizer import from_path - -results = from_path('./my_subtitle.srt') - -print(str(results.best())) -``` - -*Upgrade your code without effort* -```python -from charset_normalizer import detect -``` - -The above code will behave the same as **chardet**. We ensure that we offer the best (reasonable) BC result possible. - -See the docs for advanced usage : [readthedocs.io](https://charset-normalizer.readthedocs.io/en/latest/) - -## 😇 Why - -When I started using Chardet, I noticed that it was not suited to my expectations, and I wanted to propose a -reliable alternative using a completely different method. Also! I never back down on a good challenge! - -I **don't care** about the **originating charset** encoding, because **two different tables** can -produce **two identical rendered string.** -What I want is to get readable text, the best I can. - -In a way, **I'm brute forcing text decoding.** How cool is that ? 😎 - -Don't confuse package **ftfy** with charset-normalizer or chardet. ftfy goal is to repair unicode string whereas charset-normalizer to convert raw file in unknown encoding to unicode. - -## 🍰 How - - - Discard all charset encoding table that could not fit the binary content. - - Measure noise, or the mess once opened (by chunks) with a corresponding charset encoding. - - Extract matches with the lowest mess detected. - - Additionally, we measure coherence / probe for a language. - -**Wait a minute**, what is noise/mess and coherence according to **YOU ?** - -*Noise :* I opened hundred of text files, **written by humans**, with the wrong encoding table. **I observed**, then -**I established** some ground rules about **what is obvious** when **it seems like** a mess. - I know that my interpretation of what is noise is probably incomplete, feel free to contribute in order to - improve or rewrite it. - -*Coherence :* For each language there is on earth, we have computed ranked letter appearance occurrences (the best we can). So I thought -that intel is worth something here. So I use those records against decoded text to check if I can detect intelligent design. - -## ⚡ Known limitations - - - Language detection is unreliable when text contains two or more languages sharing identical letters. (eg. HTML (english tags) + Turkish content (Sharing Latin characters)) - - Every charset detector heavily depends on sufficient content. In common cases, do not bother run detection on very tiny content. - -## ⚠️ About Python EOLs - -**If you are running:** - -- Python >=2.7,<3.5: Unsupported -- Python 3.5: charset-normalizer < 2.1 -- Python 3.6: charset-normalizer < 3.1 -- Python 3.7: charset-normalizer < 4.0 - -Upgrade your Python interpreter as soon as possible. - -## 👤 Contributing - -Contributions, issues and feature requests are very much welcome.
-Feel free to check [issues page](https://github.com/ousret/charset_normalizer/issues) if you want to contribute. - -## 📝 License - -Copyright © [Ahmed TAHRI @Ousret](https://github.com/Ousret).
-This project is [MIT](https://github.com/Ousret/charset_normalizer/blob/master/LICENSE) licensed. - -Characters frequencies used in this project © 2012 [Denny Vrandečić](http://simia.net/letters/) - -## 💼 For Enterprise - -Professional support for charset-normalizer is available as part of the [Tidelift -Subscription][1]. Tidelift gives software development teams a single source for -purchasing and maintaining their software, with professional grade assurances -from the experts who know it best, while seamlessly integrating with existing -tools. - -[1]: https://tidelift.com/subscription/pkg/pypi-charset-normalizer?utm_source=pypi-charset-normalizer&utm_medium=readme - -# Changelog -All notable changes to charset-normalizer will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - -## [3.3.0](https://github.com/Ousret/charset_normalizer/compare/3.2.0...3.3.0) (2023-09-30) - -### Added -- Allow to execute the CLI (e.g. normalizer) through `python -m charset_normalizer.cli` or `python -m charset_normalizer` -- Support for 9 forgotten encoding that are supported by Python but unlisted in `encoding.aliases` as they have no alias (#323) - -### Removed -- (internal) Redundant utils.is_ascii function and unused function is_private_use_only -- (internal) charset_normalizer.assets is moved inside charset_normalizer.constant - -### Changed -- (internal) Unicode code blocks in constants are updated using the latest v15.0.0 definition to improve detection -- Optional mypyc compilation upgraded to version 1.5.1 for Python >= 3.7 - -### Fixed -- Unable to properly sort CharsetMatch when both chaos/noise and coherence were close due to an unreachable condition in \_\_lt\_\_ (#350) - -## [3.2.0](https://github.com/Ousret/charset_normalizer/compare/3.1.0...3.2.0) (2023-06-07) - -### Changed -- Typehint for function `from_path` no longer enforce `PathLike` as its first argument -- Minor improvement over the global detection reliability - -### Added -- Introduce function `is_binary` that relies on main capabilities, and optimized to detect binaries -- Propagate `enable_fallback` argument throughout `from_bytes`, `from_path`, and `from_fp` that allow a deeper control over the detection (default True) -- Explicit support for Python 3.12 - -### Fixed -- Edge case detection failure where a file would contain 'very-long' camel cased word (Issue #289) - -## [3.1.0](https://github.com/Ousret/charset_normalizer/compare/3.0.1...3.1.0) (2023-03-06) - -### Added -- Argument `should_rename_legacy` for legacy function `detect` and disregard any new arguments without errors (PR #262) - -### Removed -- Support for Python 3.6 (PR #260) - -### Changed -- Optional speedup provided by mypy/c 1.0.1 - -## [3.0.1](https://github.com/Ousret/charset_normalizer/compare/3.0.0...3.0.1) (2022-11-18) - -### Fixed -- Multi-bytes cutter/chunk generator did not always cut correctly (PR #233) - -### Changed -- Speedup provided by mypy/c 0.990 on Python >= 3.7 - -## [3.0.0](https://github.com/Ousret/charset_normalizer/compare/2.1.1...3.0.0) (2022-10-20) - -### Added -- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results -- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES -- Add parameter `language_threshold` in `from_bytes`, `from_path` and `from_fp` to adjust the minimum expected coherence ratio -- `normalizer --version` now specify if current version provide extra speedup (meaning mypyc compilation whl) - -### Changed -- Build with static metadata using 'build' frontend -- Make the language detection stricter -- Optional: Module `md.py` can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1 - -### Fixed -- CLI with opt --normalize fail when using full path for files -- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it -- Sphinx warnings when generating the documentation - -### Removed -- Coherence detector no longer return 'Simple English' instead return 'English' -- Coherence detector no longer return 'Classical Chinese' instead return 'Chinese' -- Breaking: Method `first()` and `best()` from CharsetMatch -- UTF-7 will no longer appear as "detected" without a recognized SIG/mark (is unreliable/conflict with ASCII) -- Breaking: Class aliases CharsetDetector, CharsetDoctor, CharsetNormalizerMatch and CharsetNormalizerMatches -- Breaking: Top-level function `normalize` -- Breaking: Properties `chaos_secondary_pass`, `coherence_non_latin` and `w_counter` from CharsetMatch -- Support for the backport `unicodedata2` - -## [3.0.0rc1](https://github.com/Ousret/charset_normalizer/compare/3.0.0b2...3.0.0rc1) (2022-10-18) - -### Added -- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results -- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES -- Add parameter `language_threshold` in `from_bytes`, `from_path` and `from_fp` to adjust the minimum expected coherence ratio - -### Changed -- Build with static metadata using 'build' frontend -- Make the language detection stricter - -### Fixed -- CLI with opt --normalize fail when using full path for files -- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it - -### Removed -- Coherence detector no longer return 'Simple English' instead return 'English' -- Coherence detector no longer return 'Classical Chinese' instead return 'Chinese' - -## [3.0.0b2](https://github.com/Ousret/charset_normalizer/compare/3.0.0b1...3.0.0b2) (2022-08-21) - -### Added -- `normalizer --version` now specify if current version provide extra speedup (meaning mypyc compilation whl) - -### Removed -- Breaking: Method `first()` and `best()` from CharsetMatch -- UTF-7 will no longer appear as "detected" without a recognized SIG/mark (is unreliable/conflict with ASCII) - -### Fixed -- Sphinx warnings when generating the documentation - -## [3.0.0b1](https://github.com/Ousret/charset_normalizer/compare/2.1.0...3.0.0b1) (2022-08-15) - -### Changed -- Optional: Module `md.py` can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1 - -### Removed -- Breaking: Class aliases CharsetDetector, CharsetDoctor, CharsetNormalizerMatch and CharsetNormalizerMatches -- Breaking: Top-level function `normalize` -- Breaking: Properties `chaos_secondary_pass`, `coherence_non_latin` and `w_counter` from CharsetMatch -- Support for the backport `unicodedata2` - -## [2.1.1](https://github.com/Ousret/charset_normalizer/compare/2.1.0...2.1.1) (2022-08-19) - -### Deprecated -- Function `normalize` scheduled for removal in 3.0 - -### Changed -- Removed useless call to decode in fn is_unprintable (#206) - -### Fixed -- Third-party library (i18n xgettext) crashing not recognizing utf_8 (PEP 263) with underscore from [@aleksandernovikov](https://github.com/aleksandernovikov) (#204) - -## [2.1.0](https://github.com/Ousret/charset_normalizer/compare/2.0.12...2.1.0) (2022-06-19) - -### Added -- Output the Unicode table version when running the CLI with `--version` (PR #194) - -### Changed -- Re-use decoded buffer for single byte character sets from [@nijel](https://github.com/nijel) (PR #175) -- Fixing some performance bottlenecks from [@deedy5](https://github.com/deedy5) (PR #183) - -### Fixed -- Workaround potential bug in cpython with Zero Width No-Break Space located in Arabic Presentation Forms-B, Unicode 1.1 not acknowledged as space (PR #175) -- CLI default threshold aligned with the API threshold from [@oleksandr-kuzmenko](https://github.com/oleksandr-kuzmenko) (PR #181) - -### Removed -- Support for Python 3.5 (PR #192) - -### Deprecated -- Use of backport unicodedata from `unicodedata2` as Python is quickly catching up, scheduled for removal in 3.0 (PR #194) - -## [2.0.12](https://github.com/Ousret/charset_normalizer/compare/2.0.11...2.0.12) (2022-02-12) - -### Fixed -- ASCII miss-detection on rare cases (PR #170) - -## [2.0.11](https://github.com/Ousret/charset_normalizer/compare/2.0.10...2.0.11) (2022-01-30) - -### Added -- Explicit support for Python 3.11 (PR #164) - -### Changed -- The logging behavior have been completely reviewed, now using only TRACE and DEBUG levels (PR #163 #165) - -## [2.0.10](https://github.com/Ousret/charset_normalizer/compare/2.0.9...2.0.10) (2022-01-04) - -### Fixed -- Fallback match entries might lead to UnicodeDecodeError for large bytes sequence (PR #154) - -### Changed -- Skipping the language-detection (CD) on ASCII (PR #155) - -## [2.0.9](https://github.com/Ousret/charset_normalizer/compare/2.0.8...2.0.9) (2021-12-03) - -### Changed -- Moderating the logging impact (since 2.0.8) for specific environments (PR #147) - -### Fixed -- Wrong logging level applied when setting kwarg `explain` to True (PR #146) - -## [2.0.8](https://github.com/Ousret/charset_normalizer/compare/2.0.7...2.0.8) (2021-11-24) -### Changed -- Improvement over Vietnamese detection (PR #126) -- MD improvement on trailing data and long foreign (non-pure latin) data (PR #124) -- Efficiency improvements in cd/alphabet_languages from [@adbar](https://github.com/adbar) (PR #122) -- call sum() without an intermediary list following PEP 289 recommendations from [@adbar](https://github.com/adbar) (PR #129) -- Code style as refactored by Sourcery-AI (PR #131) -- Minor adjustment on the MD around european words (PR #133) -- Remove and replace SRTs from assets / tests (PR #139) -- Initialize the library logger with a `NullHandler` by default from [@nmaynes](https://github.com/nmaynes) (PR #135) -- Setting kwarg `explain` to True will add provisionally (bounded to function lifespan) a specific stream handler (PR #135) - -### Fixed -- Fix large (misleading) sequence giving UnicodeDecodeError (PR #137) -- Avoid using too insignificant chunk (PR #137) - -### Added -- Add and expose function `set_logging_handler` to configure a specific StreamHandler from [@nmaynes](https://github.com/nmaynes) (PR #135) -- Add `CHANGELOG.md` entries, format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) (PR #141) - -## [2.0.7](https://github.com/Ousret/charset_normalizer/compare/2.0.6...2.0.7) (2021-10-11) -### Added -- Add support for Kazakh (Cyrillic) language detection (PR #109) - -### Changed -- Further, improve inferring the language from a given single-byte code page (PR #112) -- Vainly trying to leverage PEP263 when PEP3120 is not supported (PR #116) -- Refactoring for potential performance improvements in loops from [@adbar](https://github.com/adbar) (PR #113) -- Various detection improvement (MD+CD) (PR #117) - -### Removed -- Remove redundant logging entry about detected language(s) (PR #115) - -### Fixed -- Fix a minor inconsistency between Python 3.5 and other versions regarding language detection (PR #117 #102) - -## [2.0.6](https://github.com/Ousret/charset_normalizer/compare/2.0.5...2.0.6) (2021-09-18) -### Fixed -- Unforeseen regression with the loss of the backward-compatibility with some older minor of Python 3.5.x (PR #100) -- Fix CLI crash when using --minimal output in certain cases (PR #103) - -### Changed -- Minor improvement to the detection efficiency (less than 1%) (PR #106 #101) - -## [2.0.5](https://github.com/Ousret/charset_normalizer/compare/2.0.4...2.0.5) (2021-09-14) -### Changed -- The project now comply with: flake8, mypy, isort and black to ensure a better overall quality (PR #81) -- The BC-support with v1.x was improved, the old staticmethods are restored (PR #82) -- The Unicode detection is slightly improved (PR #93) -- Add syntax sugar \_\_bool\_\_ for results CharsetMatches list-container (PR #91) - -### Removed -- The project no longer raise warning on tiny content given for detection, will be simply logged as warning instead (PR #92) - -### Fixed -- In some rare case, the chunks extractor could cut in the middle of a multi-byte character and could mislead the mess detection (PR #95) -- Some rare 'space' characters could trip up the UnprintablePlugin/Mess detection (PR #96) -- The MANIFEST.in was not exhaustive (PR #78) - -## [2.0.4](https://github.com/Ousret/charset_normalizer/compare/2.0.3...2.0.4) (2021-07-30) -### Fixed -- The CLI no longer raise an unexpected exception when no encoding has been found (PR #70) -- Fix accessing the 'alphabets' property when the payload contains surrogate characters (PR #68) -- The logger could mislead (explain=True) on detected languages and the impact of one MBCS match (PR #72) -- Submatch factoring could be wrong in rare edge cases (PR #72) -- Multiple files given to the CLI were ignored when publishing results to STDOUT. (After the first path) (PR #72) -- Fix line endings from CRLF to LF for certain project files (PR #67) - -### Changed -- Adjust the MD to lower the sensitivity, thus improving the global detection reliability (PR #69 #76) -- Allow fallback on specified encoding if any (PR #71) - -## [2.0.3](https://github.com/Ousret/charset_normalizer/compare/2.0.2...2.0.3) (2021-07-16) -### Changed -- Part of the detection mechanism has been improved to be less sensitive, resulting in more accurate detection results. Especially ASCII. (PR #63) -- According to the community wishes, the detection will fall back on ASCII or UTF-8 in a last-resort case. (PR #64) - -## [2.0.2](https://github.com/Ousret/charset_normalizer/compare/2.0.1...2.0.2) (2021-07-15) -### Fixed -- Empty/Too small JSON payload miss-detection fixed. Report from [@tseaver](https://github.com/tseaver) (PR #59) - -### Changed -- Don't inject unicodedata2 into sys.modules from [@akx](https://github.com/akx) (PR #57) - -## [2.0.1](https://github.com/Ousret/charset_normalizer/compare/2.0.0...2.0.1) (2021-07-13) -### Fixed -- Make it work where there isn't a filesystem available, dropping assets frequencies.json. Report from [@sethmlarson](https://github.com/sethmlarson). (PR #55) -- Using explain=False permanently disable the verbose output in the current runtime (PR #47) -- One log entry (language target preemptive) was not show in logs when using explain=True (PR #47) -- Fix undesired exception (ValueError) on getitem of instance CharsetMatches (PR #52) - -### Changed -- Public function normalize default args values were not aligned with from_bytes (PR #53) - -### Added -- You may now use charset aliases in cp_isolation and cp_exclusion arguments (PR #47) - -## [2.0.0](https://github.com/Ousret/charset_normalizer/compare/1.4.1...2.0.0) (2021-07-02) -### Changed -- 4x to 5 times faster than the previous 1.4.0 release. At least 2x faster than Chardet. -- Accent has been made on UTF-8 detection, should perform rather instantaneous. -- The backward compatibility with Chardet has been greatly improved. The legacy detect function returns an identical charset name whenever possible. -- The detection mechanism has been slightly improved, now Turkish content is detected correctly (most of the time) -- The program has been rewritten to ease the readability and maintainability. (+Using static typing)+ -- utf_7 detection has been reinstated. - -### Removed -- This package no longer require anything when used with Python 3.5 (Dropped cached_property) -- Removed support for these languages: Catalan, Esperanto, Kazakh, Baque, Volapük, Azeri, Galician, Nynorsk, Macedonian, and Serbocroatian. -- The exception hook on UnicodeDecodeError has been removed. - -### Deprecated -- Methods coherence_non_latin, w_counter, chaos_secondary_pass of the class CharsetMatch are now deprecated and scheduled for removal in v3.0 - -### Fixed -- The CLI output used the relative path of the file(s). Should be absolute. - -## [1.4.1](https://github.com/Ousret/charset_normalizer/compare/1.4.0...1.4.1) (2021-05-28) -### Fixed -- Logger configuration/usage no longer conflict with others (PR #44) - -## [1.4.0](https://github.com/Ousret/charset_normalizer/compare/1.3.9...1.4.0) (2021-05-21) -### Removed -- Using standard logging instead of using the package loguru. -- Dropping nose test framework in favor of the maintained pytest. -- Choose to not use dragonmapper package to help with gibberish Chinese/CJK text. -- Require cached_property only for Python 3.5 due to constraint. Dropping for every other interpreter version. -- Stop support for UTF-7 that does not contain a SIG. -- Dropping PrettyTable, replaced with pure JSON output in CLI. - -### Fixed -- BOM marker in a CharsetNormalizerMatch instance could be False in rare cases even if obviously present. Due to the sub-match factoring process. -- Not searching properly for the BOM when trying utf32/16 parent codec. - -### Changed -- Improving the package final size by compressing frequencies.json. -- Huge improvement over the larges payload. - -### Added -- CLI now produces JSON consumable output. -- Return ASCII if given sequences fit. Given reasonable confidence. - -## [1.3.9](https://github.com/Ousret/charset_normalizer/compare/1.3.8...1.3.9) (2021-05-13) - -### Fixed -- In some very rare cases, you may end up getting encode/decode errors due to a bad bytes payload (PR #40) - -## [1.3.8](https://github.com/Ousret/charset_normalizer/compare/1.3.7...1.3.8) (2021-05-12) - -### Fixed -- Empty given payload for detection may cause an exception if trying to access the `alphabets` property. (PR #39) - -## [1.3.7](https://github.com/Ousret/charset_normalizer/compare/1.3.6...1.3.7) (2021-05-12) - -### Fixed -- The legacy detect function should return UTF-8-SIG if sig is present in the payload. (PR #38) - -## [1.3.6](https://github.com/Ousret/charset_normalizer/compare/1.3.5...1.3.6) (2021-02-09) - -### Changed -- Amend the previous release to allow prettytable 2.0 (PR #35) - -## [1.3.5](https://github.com/Ousret/charset_normalizer/compare/1.3.4...1.3.5) (2021-02-08) - -### Fixed -- Fix error while using the package with a python pre-release interpreter (PR #33) - -### Changed -- Dependencies refactoring, constraints revised. - -### Added -- Add python 3.9 and 3.10 to the supported interpreters - -MIT License - -Copyright (c) 2019 TAHRI Ahmed R. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/RECORD b/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/RECORD deleted file mode 100644 index dcd8a8fbad0901b3d26498ed73490be961997cc8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/RECORD +++ /dev/null @@ -1,35 +0,0 @@ -../../../bin/normalizer,sha256=hvQJXPFFSYd1k3-UDKW4b3qlcT2g9Y9AXTQ6JiGmVl8,270 -charset_normalizer-3.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -charset_normalizer-3.3.0.dist-info/LICENSE,sha256=6zGgxaT7Cbik4yBV0lweX5w1iidS_vPNcgIT0cz-4kE,1070 -charset_normalizer-3.3.0.dist-info/METADATA,sha256=dIp-XpvvXQKv1zMQcdlRqMsROXvtJ8Yw55TIaXGegNg,32868 -charset_normalizer-3.3.0.dist-info/RECORD,, -charset_normalizer-3.3.0.dist-info/WHEEL,sha256=CzyHWKXay4N1oFds0wxFofK9MEs-L6SZ6gHGZF6-4Co,148 -charset_normalizer-3.3.0.dist-info/entry_points.txt,sha256=ADSTKrkXZ3hhdOVFi6DcUEHQRS0xfxDIE_pEz4wLIXA,65 -charset_normalizer-3.3.0.dist-info/top_level.txt,sha256=7ASyzePr8_xuZWJsnqJjIBtyV8vhEo0wBCv1MPRRi3Q,19 -charset_normalizer/__init__.py,sha256=UzI3xC8PhmcLRMzSgPb6minTmRq0kWznnCBJ8ZCc2XI,1577 -charset_normalizer/__main__.py,sha256=JxY8bleaENOFlLRb9HfoeZCzAMnn2A1oGR5Xm2eyqg0,73 -charset_normalizer/__pycache__/__init__.cpython-38.pyc,, -charset_normalizer/__pycache__/__main__.cpython-38.pyc,, -charset_normalizer/__pycache__/api.cpython-38.pyc,, -charset_normalizer/__pycache__/cd.cpython-38.pyc,, -charset_normalizer/__pycache__/constant.cpython-38.pyc,, -charset_normalizer/__pycache__/legacy.cpython-38.pyc,, -charset_normalizer/__pycache__/md.cpython-38.pyc,, -charset_normalizer/__pycache__/models.cpython-38.pyc,, -charset_normalizer/__pycache__/utils.cpython-38.pyc,, -charset_normalizer/__pycache__/version.cpython-38.pyc,, -charset_normalizer/api.py,sha256=WOlWjy6wT8SeMYFpaGbXZFN1TMXa-s8vZYfkL4G29iQ,21097 -charset_normalizer/cd.py,sha256=xwZliZcTQFA3jU0c00PRiu9MNxXTFxQkFLWmMW24ZzI,12560 -charset_normalizer/cli/__init__.py,sha256=D5ERp8P62llm2FuoMzydZ7d9rs8cvvLXqE-1_6oViPc,100 -charset_normalizer/cli/__main__.py,sha256=2F-xURZJzo063Ye-2RLJ2wcmURpbKeAzKwpiws65dAs,9744 -charset_normalizer/cli/__pycache__/__init__.cpython-38.pyc,, -charset_normalizer/cli/__pycache__/__main__.cpython-38.pyc,, -charset_normalizer/constant.py,sha256=p0IsOVcEbPWYPOdWhnhRbjK1YVBy6fs05C5vKC-zoxU,40481 -charset_normalizer/legacy.py,sha256=T-QuVMsMeDiQEk8WSszMrzVJg_14AMeSkmHdRYhdl1k,2071 -charset_normalizer/md.cpython-38-x86_64-linux-gnu.so,sha256=Y7QSLD5QLoSFAWys0-tL7R6QB7oi5864zM6zr7RWek4,16064 -charset_normalizer/md.py,sha256=N7pMe_84czujAOG_3U5Zv42JkpIO40DHCzD0bf47Caw,18668 -charset_normalizer/md__mypyc.cpython-38-x86_64-linux-gnu.so,sha256=q77sc1GMrEgIz9LXnNuiHznKYqlLVnnHMYBRR9lkglw,257312 -charset_normalizer/models.py,sha256=tA2tf9rfRyFW9sfoMXWSjoW0-y6EdfdMogHuQBfbOHM,11487 -charset_normalizer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -charset_normalizer/utils.py,sha256=welXEWvrzpBaZY0yfzPeaqsZVAZQ7mDcfMu4noiCTTU,11231 -charset_normalizer/version.py,sha256=cadHi_iqsnEErna9xaToqabie92T0nTPMTCUQ3u7yLw,79 diff --git a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/WHEEL b/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/WHEEL deleted file mode 100644 index e8d19a232e3934896b793560bbc9ef8c5bb6ca7a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.41.2) -Root-Is-Purelib: false -Tag: cp38-cp38-manylinux_2_17_x86_64 -Tag: cp38-cp38-manylinux2014_x86_64 - diff --git a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/entry_points.txt b/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/entry_points.txt deleted file mode 100644 index 65619e73ec06c20c2a70c9507b872ad624d1a85c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[console_scripts] -normalizer = charset_normalizer.cli:cli_detect diff --git a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/top_level.txt deleted file mode 100644 index 66958f0a069d7aea7939bed40b9197608e93b243..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer-3.3.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -charset_normalizer diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__init__.py b/venv/lib/python3.8/site-packages/charset_normalizer/__init__.py deleted file mode 100644 index 55991fc38062b9c800805437ee49b0cf42b98103..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/__init__.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Charset-Normalizer -~~~~~~~~~~~~~~ -The Real First Universal Charset Detector. -A library that helps you read text from an unknown charset encoding. -Motivated by chardet, This package is trying to resolve the issue by taking a new approach. -All IANA character set names for which the Python core library provides codecs are supported. - -Basic usage: - >>> from charset_normalizer import from_bytes - >>> results = from_bytes('Bсеки човек има право на образование. Oбразованието!'.encode('utf_8')) - >>> best_guess = results.best() - >>> str(best_guess) - 'Bсеки човек има право на образование. Oбразованието!' - -Others methods and usages are available - see the full documentation -at . -:copyright: (c) 2021 by Ahmed TAHRI -:license: MIT, see LICENSE for more details. -""" -import logging - -from .api import from_bytes, from_fp, from_path, is_binary -from .legacy import detect -from .models import CharsetMatch, CharsetMatches -from .utils import set_logging_handler -from .version import VERSION, __version__ - -__all__ = ( - "from_fp", - "from_path", - "from_bytes", - "is_binary", - "detect", - "CharsetMatch", - "CharsetMatches", - "__version__", - "VERSION", - "set_logging_handler", -) - -# Attach a NullHandler to the top level logger by default -# https://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library - -logging.getLogger("charset_normalizer").addHandler(logging.NullHandler()) diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__main__.py b/venv/lib/python3.8/site-packages/charset_normalizer/__main__.py deleted file mode 100644 index beae2ef77490c9f9c9255dd68facbb6de132841f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .cli import cli_detect - -if __name__ == "__main__": - cli_detect() diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index f3b545d1ebdc17e4b7eb275fe6e02fd71abba3e0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/__main__.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/__main__.cpython-38.pyc deleted file mode 100644 index 26aaeeb01f6a90a1974d358975a134d3a82e86a0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/__main__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/api.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/api.cpython-38.pyc deleted file mode 100644 index 548e60cb27e8d3eaf7aab10c4fe96ef16d36485a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/api.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/cd.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/cd.cpython-38.pyc deleted file mode 100644 index f4226ce42e949dfc1b37462b757299994e6496a3..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/cd.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/constant.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/constant.cpython-38.pyc deleted file mode 100644 index 9e0eb8e49e10b59a4430a0af19688cd3635a89f6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/constant.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/legacy.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/legacy.cpython-38.pyc deleted file mode 100644 index 642d540bdd201e9a82c7f09fc9d7a06e97340c12..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/legacy.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/md.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/md.cpython-38.pyc deleted file mode 100644 index a4d2025b6ffb1d8b0f8a437daaa1fc00f53f753c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/md.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/models.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/models.cpython-38.pyc deleted file mode 100644 index 80a6488d73318c2f1576cd684d96cacd1bd7e8df..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/models.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/utils.cpython-38.pyc deleted file mode 100644 index 5bddbc48673d4eadbfe07a94f7dfbd193af0337d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/version.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/version.cpython-38.pyc deleted file mode 100644 index 6ec64d87d5bde5b86a29b26aaca5ca4210bd79a6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/__pycache__/version.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/api.py b/venv/lib/python3.8/site-packages/charset_normalizer/api.py deleted file mode 100644 index 0ba08e3a50ba6d61e75f3f31772eb4dfdd3f8f05..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/api.py +++ /dev/null @@ -1,626 +0,0 @@ -import logging -from os import PathLike -from typing import BinaryIO, List, Optional, Set, Union - -from .cd import ( - coherence_ratio, - encoding_languages, - mb_encoding_languages, - merge_coherence_ratios, -) -from .constant import IANA_SUPPORTED, TOO_BIG_SEQUENCE, TOO_SMALL_SEQUENCE, TRACE -from .md import mess_ratio -from .models import CharsetMatch, CharsetMatches -from .utils import ( - any_specified_encoding, - cut_sequence_chunks, - iana_name, - identify_sig_or_bom, - is_cp_similar, - is_multi_byte_encoding, - should_strip_sig_or_bom, -) - -# Will most likely be controversial -# logging.addLevelName(TRACE, "TRACE") -logger = logging.getLogger("charset_normalizer") -explain_handler = logging.StreamHandler() -explain_handler.setFormatter( - logging.Formatter("%(asctime)s | %(levelname)s | %(message)s") -) - - -def from_bytes( - sequences: Union[bytes, bytearray], - steps: int = 5, - chunk_size: int = 512, - threshold: float = 0.2, - cp_isolation: Optional[List[str]] = None, - cp_exclusion: Optional[List[str]] = None, - preemptive_behaviour: bool = True, - explain: bool = False, - language_threshold: float = 0.1, - enable_fallback: bool = True, -) -> CharsetMatches: - """ - Given a raw bytes sequence, return the best possibles charset usable to render str objects. - If there is no results, it is a strong indicator that the source is binary/not text. - By default, the process will extract 5 blocks of 512o each to assess the mess and coherence of a given sequence. - And will give up a particular code page after 20% of measured mess. Those criteria are customizable at will. - - The preemptive behavior DOES NOT replace the traditional detection workflow, it prioritize a particular code page - but never take it for granted. Can improve the performance. - - You may want to focus your attention to some code page or/and not others, use cp_isolation and cp_exclusion for that - purpose. - - This function will strip the SIG in the payload/sequence every time except on UTF-16, UTF-32. - By default the library does not setup any handler other than the NullHandler, if you choose to set the 'explain' - toggle to True it will alter the logger configuration to add a StreamHandler that is suitable for debugging. - Custom logging format and handler can be set manually. - """ - - if not isinstance(sequences, (bytearray, bytes)): - raise TypeError( - "Expected object of type bytes or bytearray, got: {0}".format( - type(sequences) - ) - ) - - if explain: - previous_logger_level: int = logger.level - logger.addHandler(explain_handler) - logger.setLevel(TRACE) - - length: int = len(sequences) - - if length == 0: - logger.debug("Encoding detection on empty bytes, assuming utf_8 intention.") - if explain: - logger.removeHandler(explain_handler) - logger.setLevel(previous_logger_level or logging.WARNING) - return CharsetMatches([CharsetMatch(sequences, "utf_8", 0.0, False, [], "")]) - - if cp_isolation is not None: - logger.log( - TRACE, - "cp_isolation is set. use this flag for debugging purpose. " - "limited list of encoding allowed : %s.", - ", ".join(cp_isolation), - ) - cp_isolation = [iana_name(cp, False) for cp in cp_isolation] - else: - cp_isolation = [] - - if cp_exclusion is not None: - logger.log( - TRACE, - "cp_exclusion is set. use this flag for debugging purpose. " - "limited list of encoding excluded : %s.", - ", ".join(cp_exclusion), - ) - cp_exclusion = [iana_name(cp, False) for cp in cp_exclusion] - else: - cp_exclusion = [] - - if length <= (chunk_size * steps): - logger.log( - TRACE, - "override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.", - steps, - chunk_size, - length, - ) - steps = 1 - chunk_size = length - - if steps > 1 and length / steps < chunk_size: - chunk_size = int(length / steps) - - is_too_small_sequence: bool = len(sequences) < TOO_SMALL_SEQUENCE - is_too_large_sequence: bool = len(sequences) >= TOO_BIG_SEQUENCE - - if is_too_small_sequence: - logger.log( - TRACE, - "Trying to detect encoding from a tiny portion of ({}) byte(s).".format( - length - ), - ) - elif is_too_large_sequence: - logger.log( - TRACE, - "Using lazy str decoding because the payload is quite large, ({}) byte(s).".format( - length - ), - ) - - prioritized_encodings: List[str] = [] - - specified_encoding: Optional[str] = ( - any_specified_encoding(sequences) if preemptive_behaviour else None - ) - - if specified_encoding is not None: - prioritized_encodings.append(specified_encoding) - logger.log( - TRACE, - "Detected declarative mark in sequence. Priority +1 given for %s.", - specified_encoding, - ) - - tested: Set[str] = set() - tested_but_hard_failure: List[str] = [] - tested_but_soft_failure: List[str] = [] - - fallback_ascii: Optional[CharsetMatch] = None - fallback_u8: Optional[CharsetMatch] = None - fallback_specified: Optional[CharsetMatch] = None - - results: CharsetMatches = CharsetMatches() - - sig_encoding, sig_payload = identify_sig_or_bom(sequences) - - if sig_encoding is not None: - prioritized_encodings.append(sig_encoding) - logger.log( - TRACE, - "Detected a SIG or BOM mark on first %i byte(s). Priority +1 given for %s.", - len(sig_payload), - sig_encoding, - ) - - prioritized_encodings.append("ascii") - - if "utf_8" not in prioritized_encodings: - prioritized_encodings.append("utf_8") - - for encoding_iana in prioritized_encodings + IANA_SUPPORTED: - if cp_isolation and encoding_iana not in cp_isolation: - continue - - if cp_exclusion and encoding_iana in cp_exclusion: - continue - - if encoding_iana in tested: - continue - - tested.add(encoding_iana) - - decoded_payload: Optional[str] = None - bom_or_sig_available: bool = sig_encoding == encoding_iana - strip_sig_or_bom: bool = bom_or_sig_available and should_strip_sig_or_bom( - encoding_iana - ) - - if encoding_iana in {"utf_16", "utf_32"} and not bom_or_sig_available: - logger.log( - TRACE, - "Encoding %s won't be tested as-is because it require a BOM. Will try some sub-encoder LE/BE.", - encoding_iana, - ) - continue - if encoding_iana in {"utf_7"} and not bom_or_sig_available: - logger.log( - TRACE, - "Encoding %s won't be tested as-is because detection is unreliable without BOM/SIG.", - encoding_iana, - ) - continue - - try: - is_multi_byte_decoder: bool = is_multi_byte_encoding(encoding_iana) - except (ModuleNotFoundError, ImportError): - logger.log( - TRACE, - "Encoding %s does not provide an IncrementalDecoder", - encoding_iana, - ) - continue - - try: - if is_too_large_sequence and is_multi_byte_decoder is False: - str( - sequences[: int(50e4)] - if strip_sig_or_bom is False - else sequences[len(sig_payload) : int(50e4)], - encoding=encoding_iana, - ) - else: - decoded_payload = str( - sequences - if strip_sig_or_bom is False - else sequences[len(sig_payload) :], - encoding=encoding_iana, - ) - except (UnicodeDecodeError, LookupError) as e: - if not isinstance(e, LookupError): - logger.log( - TRACE, - "Code page %s does not fit given bytes sequence at ALL. %s", - encoding_iana, - str(e), - ) - tested_but_hard_failure.append(encoding_iana) - continue - - similar_soft_failure_test: bool = False - - for encoding_soft_failed in tested_but_soft_failure: - if is_cp_similar(encoding_iana, encoding_soft_failed): - similar_soft_failure_test = True - break - - if similar_soft_failure_test: - logger.log( - TRACE, - "%s is deemed too similar to code page %s and was consider unsuited already. Continuing!", - encoding_iana, - encoding_soft_failed, - ) - continue - - r_ = range( - 0 if not bom_or_sig_available else len(sig_payload), - length, - int(length / steps), - ) - - multi_byte_bonus: bool = ( - is_multi_byte_decoder - and decoded_payload is not None - and len(decoded_payload) < length - ) - - if multi_byte_bonus: - logger.log( - TRACE, - "Code page %s is a multi byte encoding table and it appear that at least one character " - "was encoded using n-bytes.", - encoding_iana, - ) - - max_chunk_gave_up: int = int(len(r_) / 4) - - max_chunk_gave_up = max(max_chunk_gave_up, 2) - early_stop_count: int = 0 - lazy_str_hard_failure = False - - md_chunks: List[str] = [] - md_ratios = [] - - try: - for chunk in cut_sequence_chunks( - sequences, - encoding_iana, - r_, - chunk_size, - bom_or_sig_available, - strip_sig_or_bom, - sig_payload, - is_multi_byte_decoder, - decoded_payload, - ): - md_chunks.append(chunk) - - md_ratios.append( - mess_ratio( - chunk, - threshold, - explain is True and 1 <= len(cp_isolation) <= 2, - ) - ) - - if md_ratios[-1] >= threshold: - early_stop_count += 1 - - if (early_stop_count >= max_chunk_gave_up) or ( - bom_or_sig_available and strip_sig_or_bom is False - ): - break - except ( - UnicodeDecodeError - ) as e: # Lazy str loading may have missed something there - logger.log( - TRACE, - "LazyStr Loading: After MD chunk decode, code page %s does not fit given bytes sequence at ALL. %s", - encoding_iana, - str(e), - ) - early_stop_count = max_chunk_gave_up - lazy_str_hard_failure = True - - # We might want to check the sequence again with the whole content - # Only if initial MD tests passes - if ( - not lazy_str_hard_failure - and is_too_large_sequence - and not is_multi_byte_decoder - ): - try: - sequences[int(50e3) :].decode(encoding_iana, errors="strict") - except UnicodeDecodeError as e: - logger.log( - TRACE, - "LazyStr Loading: After final lookup, code page %s does not fit given bytes sequence at ALL. %s", - encoding_iana, - str(e), - ) - tested_but_hard_failure.append(encoding_iana) - continue - - mean_mess_ratio: float = sum(md_ratios) / len(md_ratios) if md_ratios else 0.0 - if mean_mess_ratio >= threshold or early_stop_count >= max_chunk_gave_up: - tested_but_soft_failure.append(encoding_iana) - logger.log( - TRACE, - "%s was excluded because of initial chaos probing. Gave up %i time(s). " - "Computed mean chaos is %f %%.", - encoding_iana, - early_stop_count, - round(mean_mess_ratio * 100, ndigits=3), - ) - # Preparing those fallbacks in case we got nothing. - if ( - enable_fallback - and encoding_iana in ["ascii", "utf_8", specified_encoding] - and not lazy_str_hard_failure - ): - fallback_entry = CharsetMatch( - sequences, encoding_iana, threshold, False, [], decoded_payload - ) - if encoding_iana == specified_encoding: - fallback_specified = fallback_entry - elif encoding_iana == "ascii": - fallback_ascii = fallback_entry - else: - fallback_u8 = fallback_entry - continue - - logger.log( - TRACE, - "%s passed initial chaos probing. Mean measured chaos is %f %%", - encoding_iana, - round(mean_mess_ratio * 100, ndigits=3), - ) - - if not is_multi_byte_decoder: - target_languages: List[str] = encoding_languages(encoding_iana) - else: - target_languages = mb_encoding_languages(encoding_iana) - - if target_languages: - logger.log( - TRACE, - "{} should target any language(s) of {}".format( - encoding_iana, str(target_languages) - ), - ) - - cd_ratios = [] - - # We shall skip the CD when its about ASCII - # Most of the time its not relevant to run "language-detection" on it. - if encoding_iana != "ascii": - for chunk in md_chunks: - chunk_languages = coherence_ratio( - chunk, - language_threshold, - ",".join(target_languages) if target_languages else None, - ) - - cd_ratios.append(chunk_languages) - - cd_ratios_merged = merge_coherence_ratios(cd_ratios) - - if cd_ratios_merged: - logger.log( - TRACE, - "We detected language {} using {}".format( - cd_ratios_merged, encoding_iana - ), - ) - - results.append( - CharsetMatch( - sequences, - encoding_iana, - mean_mess_ratio, - bom_or_sig_available, - cd_ratios_merged, - decoded_payload, - ) - ) - - if ( - encoding_iana in [specified_encoding, "ascii", "utf_8"] - and mean_mess_ratio < 0.1 - ): - logger.debug( - "Encoding detection: %s is most likely the one.", encoding_iana - ) - if explain: - logger.removeHandler(explain_handler) - logger.setLevel(previous_logger_level) - return CharsetMatches([results[encoding_iana]]) - - if encoding_iana == sig_encoding: - logger.debug( - "Encoding detection: %s is most likely the one as we detected a BOM or SIG within " - "the beginning of the sequence.", - encoding_iana, - ) - if explain: - logger.removeHandler(explain_handler) - logger.setLevel(previous_logger_level) - return CharsetMatches([results[encoding_iana]]) - - if len(results) == 0: - if fallback_u8 or fallback_ascii or fallback_specified: - logger.log( - TRACE, - "Nothing got out of the detection process. Using ASCII/UTF-8/Specified fallback.", - ) - - if fallback_specified: - logger.debug( - "Encoding detection: %s will be used as a fallback match", - fallback_specified.encoding, - ) - results.append(fallback_specified) - elif ( - (fallback_u8 and fallback_ascii is None) - or ( - fallback_u8 - and fallback_ascii - and fallback_u8.fingerprint != fallback_ascii.fingerprint - ) - or (fallback_u8 is not None) - ): - logger.debug("Encoding detection: utf_8 will be used as a fallback match") - results.append(fallback_u8) - elif fallback_ascii: - logger.debug("Encoding detection: ascii will be used as a fallback match") - results.append(fallback_ascii) - - if results: - logger.debug( - "Encoding detection: Found %s as plausible (best-candidate) for content. With %i alternatives.", - results.best().encoding, # type: ignore - len(results) - 1, - ) - else: - logger.debug("Encoding detection: Unable to determine any suitable charset.") - - if explain: - logger.removeHandler(explain_handler) - logger.setLevel(previous_logger_level) - - return results - - -def from_fp( - fp: BinaryIO, - steps: int = 5, - chunk_size: int = 512, - threshold: float = 0.20, - cp_isolation: Optional[List[str]] = None, - cp_exclusion: Optional[List[str]] = None, - preemptive_behaviour: bool = True, - explain: bool = False, - language_threshold: float = 0.1, - enable_fallback: bool = True, -) -> CharsetMatches: - """ - Same thing than the function from_bytes but using a file pointer that is already ready. - Will not close the file pointer. - """ - return from_bytes( - fp.read(), - steps, - chunk_size, - threshold, - cp_isolation, - cp_exclusion, - preemptive_behaviour, - explain, - language_threshold, - enable_fallback, - ) - - -def from_path( - path: Union[str, bytes, PathLike], # type: ignore[type-arg] - steps: int = 5, - chunk_size: int = 512, - threshold: float = 0.20, - cp_isolation: Optional[List[str]] = None, - cp_exclusion: Optional[List[str]] = None, - preemptive_behaviour: bool = True, - explain: bool = False, - language_threshold: float = 0.1, - enable_fallback: bool = True, -) -> CharsetMatches: - """ - Same thing than the function from_bytes but with one extra step. Opening and reading given file path in binary mode. - Can raise IOError. - """ - with open(path, "rb") as fp: - return from_fp( - fp, - steps, - chunk_size, - threshold, - cp_isolation, - cp_exclusion, - preemptive_behaviour, - explain, - language_threshold, - enable_fallback, - ) - - -def is_binary( - fp_or_path_or_payload: Union[PathLike, str, BinaryIO, bytes], # type: ignore[type-arg] - steps: int = 5, - chunk_size: int = 512, - threshold: float = 0.20, - cp_isolation: Optional[List[str]] = None, - cp_exclusion: Optional[List[str]] = None, - preemptive_behaviour: bool = True, - explain: bool = False, - language_threshold: float = 0.1, - enable_fallback: bool = False, -) -> bool: - """ - Detect if the given input (file, bytes, or path) points to a binary file. aka. not a string. - Based on the same main heuristic algorithms and default kwargs at the sole exception that fallbacks match - are disabled to be stricter around ASCII-compatible but unlikely to be a string. - """ - if isinstance(fp_or_path_or_payload, (str, PathLike)): - guesses = from_path( - fp_or_path_or_payload, - steps=steps, - chunk_size=chunk_size, - threshold=threshold, - cp_isolation=cp_isolation, - cp_exclusion=cp_exclusion, - preemptive_behaviour=preemptive_behaviour, - explain=explain, - language_threshold=language_threshold, - enable_fallback=enable_fallback, - ) - elif isinstance( - fp_or_path_or_payload, - ( - bytes, - bytearray, - ), - ): - guesses = from_bytes( - fp_or_path_or_payload, - steps=steps, - chunk_size=chunk_size, - threshold=threshold, - cp_isolation=cp_isolation, - cp_exclusion=cp_exclusion, - preemptive_behaviour=preemptive_behaviour, - explain=explain, - language_threshold=language_threshold, - enable_fallback=enable_fallback, - ) - else: - guesses = from_fp( - fp_or_path_or_payload, - steps=steps, - chunk_size=chunk_size, - threshold=threshold, - cp_isolation=cp_isolation, - cp_exclusion=cp_exclusion, - preemptive_behaviour=preemptive_behaviour, - explain=explain, - language_threshold=language_threshold, - enable_fallback=enable_fallback, - ) - - return not guesses diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/cd.py b/venv/lib/python3.8/site-packages/charset_normalizer/cd.py deleted file mode 100644 index 4ea6760c45bce5773bfe4b46d7b3c07c2c139d49..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/cd.py +++ /dev/null @@ -1,395 +0,0 @@ -import importlib -from codecs import IncrementalDecoder -from collections import Counter -from functools import lru_cache -from typing import Counter as TypeCounter, Dict, List, Optional, Tuple - -from .constant import ( - FREQUENCIES, - KO_NAMES, - LANGUAGE_SUPPORTED_COUNT, - TOO_SMALL_SEQUENCE, - ZH_NAMES, -) -from .md import is_suspiciously_successive_range -from .models import CoherenceMatches -from .utils import ( - is_accentuated, - is_latin, - is_multi_byte_encoding, - is_unicode_range_secondary, - unicode_range, -) - - -def encoding_unicode_range(iana_name: str) -> List[str]: - """ - Return associated unicode ranges in a single byte code page. - """ - if is_multi_byte_encoding(iana_name): - raise IOError("Function not supported on multi-byte code page") - - decoder = importlib.import_module( - "encodings.{}".format(iana_name) - ).IncrementalDecoder - - p: IncrementalDecoder = decoder(errors="ignore") - seen_ranges: Dict[str, int] = {} - character_count: int = 0 - - for i in range(0x40, 0xFF): - chunk: str = p.decode(bytes([i])) - - if chunk: - character_range: Optional[str] = unicode_range(chunk) - - if character_range is None: - continue - - if is_unicode_range_secondary(character_range) is False: - if character_range not in seen_ranges: - seen_ranges[character_range] = 0 - seen_ranges[character_range] += 1 - character_count += 1 - - return sorted( - [ - character_range - for character_range in seen_ranges - if seen_ranges[character_range] / character_count >= 0.15 - ] - ) - - -def unicode_range_languages(primary_range: str) -> List[str]: - """ - Return inferred languages used with a unicode range. - """ - languages: List[str] = [] - - for language, characters in FREQUENCIES.items(): - for character in characters: - if unicode_range(character) == primary_range: - languages.append(language) - break - - return languages - - -@lru_cache() -def encoding_languages(iana_name: str) -> List[str]: - """ - Single-byte encoding language association. Some code page are heavily linked to particular language(s). - This function does the correspondence. - """ - unicode_ranges: List[str] = encoding_unicode_range(iana_name) - primary_range: Optional[str] = None - - for specified_range in unicode_ranges: - if "Latin" not in specified_range: - primary_range = specified_range - break - - if primary_range is None: - return ["Latin Based"] - - return unicode_range_languages(primary_range) - - -@lru_cache() -def mb_encoding_languages(iana_name: str) -> List[str]: - """ - Multi-byte encoding language association. Some code page are heavily linked to particular language(s). - This function does the correspondence. - """ - if ( - iana_name.startswith("shift_") - or iana_name.startswith("iso2022_jp") - or iana_name.startswith("euc_j") - or iana_name == "cp932" - ): - return ["Japanese"] - if iana_name.startswith("gb") or iana_name in ZH_NAMES: - return ["Chinese"] - if iana_name.startswith("iso2022_kr") or iana_name in KO_NAMES: - return ["Korean"] - - return [] - - -@lru_cache(maxsize=LANGUAGE_SUPPORTED_COUNT) -def get_target_features(language: str) -> Tuple[bool, bool]: - """ - Determine main aspects from a supported language if it contains accents and if is pure Latin. - """ - target_have_accents: bool = False - target_pure_latin: bool = True - - for character in FREQUENCIES[language]: - if not target_have_accents and is_accentuated(character): - target_have_accents = True - if target_pure_latin and is_latin(character) is False: - target_pure_latin = False - - return target_have_accents, target_pure_latin - - -def alphabet_languages( - characters: List[str], ignore_non_latin: bool = False -) -> List[str]: - """ - Return associated languages associated to given characters. - """ - languages: List[Tuple[str, float]] = [] - - source_have_accents = any(is_accentuated(character) for character in characters) - - for language, language_characters in FREQUENCIES.items(): - target_have_accents, target_pure_latin = get_target_features(language) - - if ignore_non_latin and target_pure_latin is False: - continue - - if target_have_accents is False and source_have_accents: - continue - - character_count: int = len(language_characters) - - character_match_count: int = len( - [c for c in language_characters if c in characters] - ) - - ratio: float = character_match_count / character_count - - if ratio >= 0.2: - languages.append((language, ratio)) - - languages = sorted(languages, key=lambda x: x[1], reverse=True) - - return [compatible_language[0] for compatible_language in languages] - - -def characters_popularity_compare( - language: str, ordered_characters: List[str] -) -> float: - """ - Determine if a ordered characters list (by occurrence from most appearance to rarest) match a particular language. - The result is a ratio between 0. (absolutely no correspondence) and 1. (near perfect fit). - Beware that is function is not strict on the match in order to ease the detection. (Meaning close match is 1.) - """ - if language not in FREQUENCIES: - raise ValueError("{} not available".format(language)) - - character_approved_count: int = 0 - FREQUENCIES_language_set = set(FREQUENCIES[language]) - - ordered_characters_count: int = len(ordered_characters) - target_language_characters_count: int = len(FREQUENCIES[language]) - - large_alphabet: bool = target_language_characters_count > 26 - - for character, character_rank in zip( - ordered_characters, range(0, ordered_characters_count) - ): - if character not in FREQUENCIES_language_set: - continue - - character_rank_in_language: int = FREQUENCIES[language].index(character) - expected_projection_ratio: float = ( - target_language_characters_count / ordered_characters_count - ) - character_rank_projection: int = int(character_rank * expected_projection_ratio) - - if ( - large_alphabet is False - and abs(character_rank_projection - character_rank_in_language) > 4 - ): - continue - - if ( - large_alphabet is True - and abs(character_rank_projection - character_rank_in_language) - < target_language_characters_count / 3 - ): - character_approved_count += 1 - continue - - characters_before_source: List[str] = FREQUENCIES[language][ - 0:character_rank_in_language - ] - characters_after_source: List[str] = FREQUENCIES[language][ - character_rank_in_language: - ] - characters_before: List[str] = ordered_characters[0:character_rank] - characters_after: List[str] = ordered_characters[character_rank:] - - before_match_count: int = len( - set(characters_before) & set(characters_before_source) - ) - - after_match_count: int = len( - set(characters_after) & set(characters_after_source) - ) - - if len(characters_before_source) == 0 and before_match_count <= 4: - character_approved_count += 1 - continue - - if len(characters_after_source) == 0 and after_match_count <= 4: - character_approved_count += 1 - continue - - if ( - before_match_count / len(characters_before_source) >= 0.4 - or after_match_count / len(characters_after_source) >= 0.4 - ): - character_approved_count += 1 - continue - - return character_approved_count / len(ordered_characters) - - -def alpha_unicode_split(decoded_sequence: str) -> List[str]: - """ - Given a decoded text sequence, return a list of str. Unicode range / alphabet separation. - Ex. a text containing English/Latin with a bit a Hebrew will return two items in the resulting list; - One containing the latin letters and the other hebrew. - """ - layers: Dict[str, str] = {} - - for character in decoded_sequence: - if character.isalpha() is False: - continue - - character_range: Optional[str] = unicode_range(character) - - if character_range is None: - continue - - layer_target_range: Optional[str] = None - - for discovered_range in layers: - if ( - is_suspiciously_successive_range(discovered_range, character_range) - is False - ): - layer_target_range = discovered_range - break - - if layer_target_range is None: - layer_target_range = character_range - - if layer_target_range not in layers: - layers[layer_target_range] = character.lower() - continue - - layers[layer_target_range] += character.lower() - - return list(layers.values()) - - -def merge_coherence_ratios(results: List[CoherenceMatches]) -> CoherenceMatches: - """ - This function merge results previously given by the function coherence_ratio. - The return type is the same as coherence_ratio. - """ - per_language_ratios: Dict[str, List[float]] = {} - for result in results: - for sub_result in result: - language, ratio = sub_result - if language not in per_language_ratios: - per_language_ratios[language] = [ratio] - continue - per_language_ratios[language].append(ratio) - - merge = [ - ( - language, - round( - sum(per_language_ratios[language]) / len(per_language_ratios[language]), - 4, - ), - ) - for language in per_language_ratios - ] - - return sorted(merge, key=lambda x: x[1], reverse=True) - - -def filter_alt_coherence_matches(results: CoherenceMatches) -> CoherenceMatches: - """ - We shall NOT return "English—" in CoherenceMatches because it is an alternative - of "English". This function only keeps the best match and remove the em-dash in it. - """ - index_results: Dict[str, List[float]] = dict() - - for result in results: - language, ratio = result - no_em_name: str = language.replace("—", "") - - if no_em_name not in index_results: - index_results[no_em_name] = [] - - index_results[no_em_name].append(ratio) - - if any(len(index_results[e]) > 1 for e in index_results): - filtered_results: CoherenceMatches = [] - - for language in index_results: - filtered_results.append((language, max(index_results[language]))) - - return filtered_results - - return results - - -@lru_cache(maxsize=2048) -def coherence_ratio( - decoded_sequence: str, threshold: float = 0.1, lg_inclusion: Optional[str] = None -) -> CoherenceMatches: - """ - Detect ANY language that can be identified in given sequence. The sequence will be analysed by layers. - A layer = Character extraction by alphabets/ranges. - """ - - results: List[Tuple[str, float]] = [] - ignore_non_latin: bool = False - - sufficient_match_count: int = 0 - - lg_inclusion_list = lg_inclusion.split(",") if lg_inclusion is not None else [] - if "Latin Based" in lg_inclusion_list: - ignore_non_latin = True - lg_inclusion_list.remove("Latin Based") - - for layer in alpha_unicode_split(decoded_sequence): - sequence_frequencies: TypeCounter[str] = Counter(layer) - most_common = sequence_frequencies.most_common() - - character_count: int = sum(o for c, o in most_common) - - if character_count <= TOO_SMALL_SEQUENCE: - continue - - popular_character_ordered: List[str] = [c for c, o in most_common] - - for language in lg_inclusion_list or alphabet_languages( - popular_character_ordered, ignore_non_latin - ): - ratio: float = characters_popularity_compare( - language, popular_character_ordered - ) - - if ratio < threshold: - continue - elif ratio >= 0.8: - sufficient_match_count += 1 - - results.append((language, round(ratio, 4))) - - if sufficient_match_count >= 3: - break - - return sorted( - filter_alt_coherence_matches(results), key=lambda x: x[1], reverse=True - ) diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/cli/__init__.py b/venv/lib/python3.8/site-packages/charset_normalizer/cli/__init__.py deleted file mode 100644 index d95fedfe5723713337f1a94ec8f0a00b6ca7816a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/cli/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from .__main__ import cli_detect, query_yes_no - -__all__ = ( - "cli_detect", - "query_yes_no", -) diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/cli/__main__.py b/venv/lib/python3.8/site-packages/charset_normalizer/cli/__main__.py deleted file mode 100644 index f4bcbaac049b542a004918a0b1499122fcca9cc0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/cli/__main__.py +++ /dev/null @@ -1,296 +0,0 @@ -import argparse -import sys -from json import dumps -from os.path import abspath, basename, dirname, join, realpath -from platform import python_version -from typing import List, Optional -from unicodedata import unidata_version - -import charset_normalizer.md as md_module -from charset_normalizer import from_fp -from charset_normalizer.models import CliDetectionResult -from charset_normalizer.version import __version__ - - -def query_yes_no(question: str, default: str = "yes") -> bool: - """Ask a yes/no question via input() and return their answer. - - "question" is a string that is presented to the user. - "default" is the presumed answer if the user just hits . - It must be "yes" (the default), "no" or None (meaning - an answer is required of the user). - - The "answer" return value is True for "yes" or False for "no". - - Credit goes to (c) https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input - """ - valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} - if default is None: - prompt = " [y/n] " - elif default == "yes": - prompt = " [Y/n] " - elif default == "no": - prompt = " [y/N] " - else: - raise ValueError("invalid default answer: '%s'" % default) - - while True: - sys.stdout.write(question + prompt) - choice = input().lower() - if default is not None and choice == "": - return valid[default] - elif choice in valid: - return valid[choice] - else: - sys.stdout.write("Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n") - - -def cli_detect(argv: Optional[List[str]] = None) -> int: - """ - CLI assistant using ARGV and ArgumentParser - :param argv: - :return: 0 if everything is fine, anything else equal trouble - """ - parser = argparse.ArgumentParser( - description="The Real First Universal Charset Detector. " - "Discover originating encoding used on text file. " - "Normalize text to unicode." - ) - - parser.add_argument( - "files", type=argparse.FileType("rb"), nargs="+", help="File(s) to be analysed" - ) - parser.add_argument( - "-v", - "--verbose", - action="store_true", - default=False, - dest="verbose", - help="Display complementary information about file if any. " - "Stdout will contain logs about the detection process.", - ) - parser.add_argument( - "-a", - "--with-alternative", - action="store_true", - default=False, - dest="alternatives", - help="Output complementary possibilities if any. Top-level JSON WILL be a list.", - ) - parser.add_argument( - "-n", - "--normalize", - action="store_true", - default=False, - dest="normalize", - help="Permit to normalize input file. If not set, program does not write anything.", - ) - parser.add_argument( - "-m", - "--minimal", - action="store_true", - default=False, - dest="minimal", - help="Only output the charset detected to STDOUT. Disabling JSON output.", - ) - parser.add_argument( - "-r", - "--replace", - action="store_true", - default=False, - dest="replace", - help="Replace file when trying to normalize it instead of creating a new one.", - ) - parser.add_argument( - "-f", - "--force", - action="store_true", - default=False, - dest="force", - help="Replace file without asking if you are sure, use this flag with caution.", - ) - parser.add_argument( - "-t", - "--threshold", - action="store", - default=0.2, - type=float, - dest="threshold", - help="Define a custom maximum amount of chaos allowed in decoded content. 0. <= chaos <= 1.", - ) - parser.add_argument( - "--version", - action="version", - version="Charset-Normalizer {} - Python {} - Unicode {} - SpeedUp {}".format( - __version__, - python_version(), - unidata_version, - "OFF" if md_module.__file__.lower().endswith(".py") else "ON", - ), - help="Show version information and exit.", - ) - - args = parser.parse_args(argv) - - if args.replace is True and args.normalize is False: - print("Use --replace in addition of --normalize only.", file=sys.stderr) - return 1 - - if args.force is True and args.replace is False: - print("Use --force in addition of --replace only.", file=sys.stderr) - return 1 - - if args.threshold < 0.0 or args.threshold > 1.0: - print("--threshold VALUE should be between 0. AND 1.", file=sys.stderr) - return 1 - - x_ = [] - - for my_file in args.files: - matches = from_fp(my_file, threshold=args.threshold, explain=args.verbose) - - best_guess = matches.best() - - if best_guess is None: - print( - 'Unable to identify originating encoding for "{}". {}'.format( - my_file.name, - "Maybe try increasing maximum amount of chaos." - if args.threshold < 1.0 - else "", - ), - file=sys.stderr, - ) - x_.append( - CliDetectionResult( - abspath(my_file.name), - None, - [], - [], - "Unknown", - [], - False, - 1.0, - 0.0, - None, - True, - ) - ) - else: - x_.append( - CliDetectionResult( - abspath(my_file.name), - best_guess.encoding, - best_guess.encoding_aliases, - [ - cp - for cp in best_guess.could_be_from_charset - if cp != best_guess.encoding - ], - best_guess.language, - best_guess.alphabets, - best_guess.bom, - best_guess.percent_chaos, - best_guess.percent_coherence, - None, - True, - ) - ) - - if len(matches) > 1 and args.alternatives: - for el in matches: - if el != best_guess: - x_.append( - CliDetectionResult( - abspath(my_file.name), - el.encoding, - el.encoding_aliases, - [ - cp - for cp in el.could_be_from_charset - if cp != el.encoding - ], - el.language, - el.alphabets, - el.bom, - el.percent_chaos, - el.percent_coherence, - None, - False, - ) - ) - - if args.normalize is True: - if best_guess.encoding.startswith("utf") is True: - print( - '"{}" file does not need to be normalized, as it already came from unicode.'.format( - my_file.name - ), - file=sys.stderr, - ) - if my_file.closed is False: - my_file.close() - continue - - dir_path = dirname(realpath(my_file.name)) - file_name = basename(realpath(my_file.name)) - - o_: List[str] = file_name.split(".") - - if args.replace is False: - o_.insert(-1, best_guess.encoding) - if my_file.closed is False: - my_file.close() - elif ( - args.force is False - and query_yes_no( - 'Are you sure to normalize "{}" by replacing it ?'.format( - my_file.name - ), - "no", - ) - is False - ): - if my_file.closed is False: - my_file.close() - continue - - try: - x_[0].unicode_path = join(dir_path, ".".join(o_)) - - with open(x_[0].unicode_path, "w", encoding="utf-8") as fp: - fp.write(str(best_guess)) - except IOError as e: - print(str(e), file=sys.stderr) - if my_file.closed is False: - my_file.close() - return 2 - - if my_file.closed is False: - my_file.close() - - if args.minimal is False: - print( - dumps( - [el.__dict__ for el in x_] if len(x_) > 1 else x_[0].__dict__, - ensure_ascii=True, - indent=4, - ) - ) - else: - for my_file in args.files: - print( - ", ".join( - [ - el.encoding or "undefined" - for el in x_ - if el.path == abspath(my_file.name) - ] - ) - ) - - return 0 - - -if __name__ == "__main__": - cli_detect() diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/cli/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/cli/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 434bb444ca5e4b0020fe8628492a6b7df1e0a4f0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/cli/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/cli/__pycache__/__main__.cpython-38.pyc b/venv/lib/python3.8/site-packages/charset_normalizer/cli/__pycache__/__main__.cpython-38.pyc deleted file mode 100644 index c0efc224ff2e8d91a1f2d21cf897bc8eab414ee9..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/cli/__pycache__/__main__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/constant.py b/venv/lib/python3.8/site-packages/charset_normalizer/constant.py deleted file mode 100644 index 863490461eacf57ca5f62658b713685476987149..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/constant.py +++ /dev/null @@ -1,1995 +0,0 @@ -# -*- coding: utf-8 -*- -from codecs import BOM_UTF8, BOM_UTF16_BE, BOM_UTF16_LE, BOM_UTF32_BE, BOM_UTF32_LE -from encodings.aliases import aliases -from re import IGNORECASE, compile as re_compile -from typing import Dict, List, Set, Union - -# Contain for each eligible encoding a list of/item bytes SIG/BOM -ENCODING_MARKS: Dict[str, Union[bytes, List[bytes]]] = { - "utf_8": BOM_UTF8, - "utf_7": [ - b"\x2b\x2f\x76\x38", - b"\x2b\x2f\x76\x39", - b"\x2b\x2f\x76\x2b", - b"\x2b\x2f\x76\x2f", - b"\x2b\x2f\x76\x38\x2d", - ], - "gb18030": b"\x84\x31\x95\x33", - "utf_32": [BOM_UTF32_BE, BOM_UTF32_LE], - "utf_16": [BOM_UTF16_BE, BOM_UTF16_LE], -} - -TOO_SMALL_SEQUENCE: int = 32 -TOO_BIG_SEQUENCE: int = int(10e6) - -UTF8_MAXIMAL_ALLOCATION: int = 1_112_064 - -# Up-to-date Unicode ucd/15.0.0 -UNICODE_RANGES_COMBINED: Dict[str, range] = { - "Control character": range(32), - "Basic Latin": range(32, 128), - "Latin-1 Supplement": range(128, 256), - "Latin Extended-A": range(256, 384), - "Latin Extended-B": range(384, 592), - "IPA Extensions": range(592, 688), - "Spacing Modifier Letters": range(688, 768), - "Combining Diacritical Marks": range(768, 880), - "Greek and Coptic": range(880, 1024), - "Cyrillic": range(1024, 1280), - "Cyrillic Supplement": range(1280, 1328), - "Armenian": range(1328, 1424), - "Hebrew": range(1424, 1536), - "Arabic": range(1536, 1792), - "Syriac": range(1792, 1872), - "Arabic Supplement": range(1872, 1920), - "Thaana": range(1920, 1984), - "NKo": range(1984, 2048), - "Samaritan": range(2048, 2112), - "Mandaic": range(2112, 2144), - "Syriac Supplement": range(2144, 2160), - "Arabic Extended-B": range(2160, 2208), - "Arabic Extended-A": range(2208, 2304), - "Devanagari": range(2304, 2432), - "Bengali": range(2432, 2560), - "Gurmukhi": range(2560, 2688), - "Gujarati": range(2688, 2816), - "Oriya": range(2816, 2944), - "Tamil": range(2944, 3072), - "Telugu": range(3072, 3200), - "Kannada": range(3200, 3328), - "Malayalam": range(3328, 3456), - "Sinhala": range(3456, 3584), - "Thai": range(3584, 3712), - "Lao": range(3712, 3840), - "Tibetan": range(3840, 4096), - "Myanmar": range(4096, 4256), - "Georgian": range(4256, 4352), - "Hangul Jamo": range(4352, 4608), - "Ethiopic": range(4608, 4992), - "Ethiopic Supplement": range(4992, 5024), - "Cherokee": range(5024, 5120), - "Unified Canadian Aboriginal Syllabics": range(5120, 5760), - "Ogham": range(5760, 5792), - "Runic": range(5792, 5888), - "Tagalog": range(5888, 5920), - "Hanunoo": range(5920, 5952), - "Buhid": range(5952, 5984), - "Tagbanwa": range(5984, 6016), - "Khmer": range(6016, 6144), - "Mongolian": range(6144, 6320), - "Unified Canadian Aboriginal Syllabics Extended": range(6320, 6400), - "Limbu": range(6400, 6480), - "Tai Le": range(6480, 6528), - "New Tai Lue": range(6528, 6624), - "Khmer Symbols": range(6624, 6656), - "Buginese": range(6656, 6688), - "Tai Tham": range(6688, 6832), - "Combining Diacritical Marks Extended": range(6832, 6912), - "Balinese": range(6912, 7040), - "Sundanese": range(7040, 7104), - "Batak": range(7104, 7168), - "Lepcha": range(7168, 7248), - "Ol Chiki": range(7248, 7296), - "Cyrillic Extended-C": range(7296, 7312), - "Georgian Extended": range(7312, 7360), - "Sundanese Supplement": range(7360, 7376), - "Vedic Extensions": range(7376, 7424), - "Phonetic Extensions": range(7424, 7552), - "Phonetic Extensions Supplement": range(7552, 7616), - "Combining Diacritical Marks Supplement": range(7616, 7680), - "Latin Extended Additional": range(7680, 7936), - "Greek Extended": range(7936, 8192), - "General Punctuation": range(8192, 8304), - "Superscripts and Subscripts": range(8304, 8352), - "Currency Symbols": range(8352, 8400), - "Combining Diacritical Marks for Symbols": range(8400, 8448), - "Letterlike Symbols": range(8448, 8528), - "Number Forms": range(8528, 8592), - "Arrows": range(8592, 8704), - "Mathematical Operators": range(8704, 8960), - "Miscellaneous Technical": range(8960, 9216), - "Control Pictures": range(9216, 9280), - "Optical Character Recognition": range(9280, 9312), - "Enclosed Alphanumerics": range(9312, 9472), - "Box Drawing": range(9472, 9600), - "Block Elements": range(9600, 9632), - "Geometric Shapes": range(9632, 9728), - "Miscellaneous Symbols": range(9728, 9984), - "Dingbats": range(9984, 10176), - "Miscellaneous Mathematical Symbols-A": range(10176, 10224), - "Supplemental Arrows-A": range(10224, 10240), - "Braille Patterns": range(10240, 10496), - "Supplemental Arrows-B": range(10496, 10624), - "Miscellaneous Mathematical Symbols-B": range(10624, 10752), - "Supplemental Mathematical Operators": range(10752, 11008), - "Miscellaneous Symbols and Arrows": range(11008, 11264), - "Glagolitic": range(11264, 11360), - "Latin Extended-C": range(11360, 11392), - "Coptic": range(11392, 11520), - "Georgian Supplement": range(11520, 11568), - "Tifinagh": range(11568, 11648), - "Ethiopic Extended": range(11648, 11744), - "Cyrillic Extended-A": range(11744, 11776), - "Supplemental Punctuation": range(11776, 11904), - "CJK Radicals Supplement": range(11904, 12032), - "Kangxi Radicals": range(12032, 12256), - "Ideographic Description Characters": range(12272, 12288), - "CJK Symbols and Punctuation": range(12288, 12352), - "Hiragana": range(12352, 12448), - "Katakana": range(12448, 12544), - "Bopomofo": range(12544, 12592), - "Hangul Compatibility Jamo": range(12592, 12688), - "Kanbun": range(12688, 12704), - "Bopomofo Extended": range(12704, 12736), - "CJK Strokes": range(12736, 12784), - "Katakana Phonetic Extensions": range(12784, 12800), - "Enclosed CJK Letters and Months": range(12800, 13056), - "CJK Compatibility": range(13056, 13312), - "CJK Unified Ideographs Extension A": range(13312, 19904), - "Yijing Hexagram Symbols": range(19904, 19968), - "CJK Unified Ideographs": range(19968, 40960), - "Yi Syllables": range(40960, 42128), - "Yi Radicals": range(42128, 42192), - "Lisu": range(42192, 42240), - "Vai": range(42240, 42560), - "Cyrillic Extended-B": range(42560, 42656), - "Bamum": range(42656, 42752), - "Modifier Tone Letters": range(42752, 42784), - "Latin Extended-D": range(42784, 43008), - "Syloti Nagri": range(43008, 43056), - "Common Indic Number Forms": range(43056, 43072), - "Phags-pa": range(43072, 43136), - "Saurashtra": range(43136, 43232), - "Devanagari Extended": range(43232, 43264), - "Kayah Li": range(43264, 43312), - "Rejang": range(43312, 43360), - "Hangul Jamo Extended-A": range(43360, 43392), - "Javanese": range(43392, 43488), - "Myanmar Extended-B": range(43488, 43520), - "Cham": range(43520, 43616), - "Myanmar Extended-A": range(43616, 43648), - "Tai Viet": range(43648, 43744), - "Meetei Mayek Extensions": range(43744, 43776), - "Ethiopic Extended-A": range(43776, 43824), - "Latin Extended-E": range(43824, 43888), - "Cherokee Supplement": range(43888, 43968), - "Meetei Mayek": range(43968, 44032), - "Hangul Syllables": range(44032, 55216), - "Hangul Jamo Extended-B": range(55216, 55296), - "High Surrogates": range(55296, 56192), - "High Private Use Surrogates": range(56192, 56320), - "Low Surrogates": range(56320, 57344), - "Private Use Area": range(57344, 63744), - "CJK Compatibility Ideographs": range(63744, 64256), - "Alphabetic Presentation Forms": range(64256, 64336), - "Arabic Presentation Forms-A": range(64336, 65024), - "Variation Selectors": range(65024, 65040), - "Vertical Forms": range(65040, 65056), - "Combining Half Marks": range(65056, 65072), - "CJK Compatibility Forms": range(65072, 65104), - "Small Form Variants": range(65104, 65136), - "Arabic Presentation Forms-B": range(65136, 65280), - "Halfwidth and Fullwidth Forms": range(65280, 65520), - "Specials": range(65520, 65536), - "Linear B Syllabary": range(65536, 65664), - "Linear B Ideograms": range(65664, 65792), - "Aegean Numbers": range(65792, 65856), - "Ancient Greek Numbers": range(65856, 65936), - "Ancient Symbols": range(65936, 66000), - "Phaistos Disc": range(66000, 66048), - "Lycian": range(66176, 66208), - "Carian": range(66208, 66272), - "Coptic Epact Numbers": range(66272, 66304), - "Old Italic": range(66304, 66352), - "Gothic": range(66352, 66384), - "Old Permic": range(66384, 66432), - "Ugaritic": range(66432, 66464), - "Old Persian": range(66464, 66528), - "Deseret": range(66560, 66640), - "Shavian": range(66640, 66688), - "Osmanya": range(66688, 66736), - "Osage": range(66736, 66816), - "Elbasan": range(66816, 66864), - "Caucasian Albanian": range(66864, 66928), - "Vithkuqi": range(66928, 67008), - "Linear A": range(67072, 67456), - "Latin Extended-F": range(67456, 67520), - "Cypriot Syllabary": range(67584, 67648), - "Imperial Aramaic": range(67648, 67680), - "Palmyrene": range(67680, 67712), - "Nabataean": range(67712, 67760), - "Hatran": range(67808, 67840), - "Phoenician": range(67840, 67872), - "Lydian": range(67872, 67904), - "Meroitic Hieroglyphs": range(67968, 68000), - "Meroitic Cursive": range(68000, 68096), - "Kharoshthi": range(68096, 68192), - "Old South Arabian": range(68192, 68224), - "Old North Arabian": range(68224, 68256), - "Manichaean": range(68288, 68352), - "Avestan": range(68352, 68416), - "Inscriptional Parthian": range(68416, 68448), - "Inscriptional Pahlavi": range(68448, 68480), - "Psalter Pahlavi": range(68480, 68528), - "Old Turkic": range(68608, 68688), - "Old Hungarian": range(68736, 68864), - "Hanifi Rohingya": range(68864, 68928), - "Rumi Numeral Symbols": range(69216, 69248), - "Yezidi": range(69248, 69312), - "Arabic Extended-C": range(69312, 69376), - "Old Sogdian": range(69376, 69424), - "Sogdian": range(69424, 69488), - "Old Uyghur": range(69488, 69552), - "Chorasmian": range(69552, 69600), - "Elymaic": range(69600, 69632), - "Brahmi": range(69632, 69760), - "Kaithi": range(69760, 69840), - "Sora Sompeng": range(69840, 69888), - "Chakma": range(69888, 69968), - "Mahajani": range(69968, 70016), - "Sharada": range(70016, 70112), - "Sinhala Archaic Numbers": range(70112, 70144), - "Khojki": range(70144, 70224), - "Multani": range(70272, 70320), - "Khudawadi": range(70320, 70400), - "Grantha": range(70400, 70528), - "Newa": range(70656, 70784), - "Tirhuta": range(70784, 70880), - "Siddham": range(71040, 71168), - "Modi": range(71168, 71264), - "Mongolian Supplement": range(71264, 71296), - "Takri": range(71296, 71376), - "Ahom": range(71424, 71504), - "Dogra": range(71680, 71760), - "Warang Citi": range(71840, 71936), - "Dives Akuru": range(71936, 72032), - "Nandinagari": range(72096, 72192), - "Zanabazar Square": range(72192, 72272), - "Soyombo": range(72272, 72368), - "Unified Canadian Aboriginal Syllabics Extended-A": range(72368, 72384), - "Pau Cin Hau": range(72384, 72448), - "Devanagari Extended-A": range(72448, 72544), - "Bhaiksuki": range(72704, 72816), - "Marchen": range(72816, 72896), - "Masaram Gondi": range(72960, 73056), - "Gunjala Gondi": range(73056, 73136), - "Makasar": range(73440, 73472), - "Kawi": range(73472, 73568), - "Lisu Supplement": range(73648, 73664), - "Tamil Supplement": range(73664, 73728), - "Cuneiform": range(73728, 74752), - "Cuneiform Numbers and Punctuation": range(74752, 74880), - "Early Dynastic Cuneiform": range(74880, 75088), - "Cypro-Minoan": range(77712, 77824), - "Egyptian Hieroglyphs": range(77824, 78896), - "Egyptian Hieroglyph Format Controls": range(78896, 78944), - "Anatolian Hieroglyphs": range(82944, 83584), - "Bamum Supplement": range(92160, 92736), - "Mro": range(92736, 92784), - "Tangsa": range(92784, 92880), - "Bassa Vah": range(92880, 92928), - "Pahawh Hmong": range(92928, 93072), - "Medefaidrin": range(93760, 93856), - "Miao": range(93952, 94112), - "Ideographic Symbols and Punctuation": range(94176, 94208), - "Tangut": range(94208, 100352), - "Tangut Components": range(100352, 101120), - "Khitan Small Script": range(101120, 101632), - "Tangut Supplement": range(101632, 101760), - "Kana Extended-B": range(110576, 110592), - "Kana Supplement": range(110592, 110848), - "Kana Extended-A": range(110848, 110896), - "Small Kana Extension": range(110896, 110960), - "Nushu": range(110960, 111360), - "Duployan": range(113664, 113824), - "Shorthand Format Controls": range(113824, 113840), - "Znamenny Musical Notation": range(118528, 118736), - "Byzantine Musical Symbols": range(118784, 119040), - "Musical Symbols": range(119040, 119296), - "Ancient Greek Musical Notation": range(119296, 119376), - "Kaktovik Numerals": range(119488, 119520), - "Mayan Numerals": range(119520, 119552), - "Tai Xuan Jing Symbols": range(119552, 119648), - "Counting Rod Numerals": range(119648, 119680), - "Mathematical Alphanumeric Symbols": range(119808, 120832), - "Sutton SignWriting": range(120832, 121520), - "Latin Extended-G": range(122624, 122880), - "Glagolitic Supplement": range(122880, 122928), - "Cyrillic Extended-D": range(122928, 123024), - "Nyiakeng Puachue Hmong": range(123136, 123216), - "Toto": range(123536, 123584), - "Wancho": range(123584, 123648), - "Nag Mundari": range(124112, 124160), - "Ethiopic Extended-B": range(124896, 124928), - "Mende Kikakui": range(124928, 125152), - "Adlam": range(125184, 125280), - "Indic Siyaq Numbers": range(126064, 126144), - "Ottoman Siyaq Numbers": range(126208, 126288), - "Arabic Mathematical Alphabetic Symbols": range(126464, 126720), - "Mahjong Tiles": range(126976, 127024), - "Domino Tiles": range(127024, 127136), - "Playing Cards": range(127136, 127232), - "Enclosed Alphanumeric Supplement": range(127232, 127488), - "Enclosed Ideographic Supplement": range(127488, 127744), - "Miscellaneous Symbols and Pictographs": range(127744, 128512), - "Emoticons range(Emoji)": range(128512, 128592), - "Ornamental Dingbats": range(128592, 128640), - "Transport and Map Symbols": range(128640, 128768), - "Alchemical Symbols": range(128768, 128896), - "Geometric Shapes Extended": range(128896, 129024), - "Supplemental Arrows-C": range(129024, 129280), - "Supplemental Symbols and Pictographs": range(129280, 129536), - "Chess Symbols": range(129536, 129648), - "Symbols and Pictographs Extended-A": range(129648, 129792), - "Symbols for Legacy Computing": range(129792, 130048), - "CJK Unified Ideographs Extension B": range(131072, 173792), - "CJK Unified Ideographs Extension C": range(173824, 177984), - "CJK Unified Ideographs Extension D": range(177984, 178208), - "CJK Unified Ideographs Extension E": range(178208, 183984), - "CJK Unified Ideographs Extension F": range(183984, 191472), - "CJK Compatibility Ideographs Supplement": range(194560, 195104), - "CJK Unified Ideographs Extension G": range(196608, 201552), - "CJK Unified Ideographs Extension H": range(201552, 205744), - "Tags": range(917504, 917632), - "Variation Selectors Supplement": range(917760, 918000), - "Supplementary Private Use Area-A": range(983040, 1048576), - "Supplementary Private Use Area-B": range(1048576, 1114112), -} - - -UNICODE_SECONDARY_RANGE_KEYWORD: List[str] = [ - "Supplement", - "Extended", - "Extensions", - "Modifier", - "Marks", - "Punctuation", - "Symbols", - "Forms", - "Operators", - "Miscellaneous", - "Drawing", - "Block", - "Shapes", - "Supplemental", - "Tags", -] - -RE_POSSIBLE_ENCODING_INDICATION = re_compile( - r"(?:(?:encoding)|(?:charset)|(?:coding))(?:[\:= ]{1,10})(?:[\"\']?)([a-zA-Z0-9\-_]+)(?:[\"\']?)", - IGNORECASE, -) - -IANA_NO_ALIASES = [ - "cp720", - "cp737", - "cp856", - "cp874", - "cp875", - "cp1006", - "koi8_r", - "koi8_t", - "koi8_u", -] - -IANA_SUPPORTED: List[str] = sorted( - filter( - lambda x: x.endswith("_codec") is False - and x not in {"rot_13", "tactis", "mbcs"}, - list(set(aliases.values())) + IANA_NO_ALIASES, - ) -) - -IANA_SUPPORTED_COUNT: int = len(IANA_SUPPORTED) - -# pre-computed code page that are similar using the function cp_similarity. -IANA_SUPPORTED_SIMILAR: Dict[str, List[str]] = { - "cp037": ["cp1026", "cp1140", "cp273", "cp500"], - "cp1026": ["cp037", "cp1140", "cp273", "cp500"], - "cp1125": ["cp866"], - "cp1140": ["cp037", "cp1026", "cp273", "cp500"], - "cp1250": ["iso8859_2"], - "cp1251": ["kz1048", "ptcp154"], - "cp1252": ["iso8859_15", "iso8859_9", "latin_1"], - "cp1253": ["iso8859_7"], - "cp1254": ["iso8859_15", "iso8859_9", "latin_1"], - "cp1257": ["iso8859_13"], - "cp273": ["cp037", "cp1026", "cp1140", "cp500"], - "cp437": ["cp850", "cp858", "cp860", "cp861", "cp862", "cp863", "cp865"], - "cp500": ["cp037", "cp1026", "cp1140", "cp273"], - "cp850": ["cp437", "cp857", "cp858", "cp865"], - "cp857": ["cp850", "cp858", "cp865"], - "cp858": ["cp437", "cp850", "cp857", "cp865"], - "cp860": ["cp437", "cp861", "cp862", "cp863", "cp865"], - "cp861": ["cp437", "cp860", "cp862", "cp863", "cp865"], - "cp862": ["cp437", "cp860", "cp861", "cp863", "cp865"], - "cp863": ["cp437", "cp860", "cp861", "cp862", "cp865"], - "cp865": ["cp437", "cp850", "cp857", "cp858", "cp860", "cp861", "cp862", "cp863"], - "cp866": ["cp1125"], - "iso8859_10": ["iso8859_14", "iso8859_15", "iso8859_4", "iso8859_9", "latin_1"], - "iso8859_11": ["tis_620"], - "iso8859_13": ["cp1257"], - "iso8859_14": [ - "iso8859_10", - "iso8859_15", - "iso8859_16", - "iso8859_3", - "iso8859_9", - "latin_1", - ], - "iso8859_15": [ - "cp1252", - "cp1254", - "iso8859_10", - "iso8859_14", - "iso8859_16", - "iso8859_3", - "iso8859_9", - "latin_1", - ], - "iso8859_16": [ - "iso8859_14", - "iso8859_15", - "iso8859_2", - "iso8859_3", - "iso8859_9", - "latin_1", - ], - "iso8859_2": ["cp1250", "iso8859_16", "iso8859_4"], - "iso8859_3": ["iso8859_14", "iso8859_15", "iso8859_16", "iso8859_9", "latin_1"], - "iso8859_4": ["iso8859_10", "iso8859_2", "iso8859_9", "latin_1"], - "iso8859_7": ["cp1253"], - "iso8859_9": [ - "cp1252", - "cp1254", - "cp1258", - "iso8859_10", - "iso8859_14", - "iso8859_15", - "iso8859_16", - "iso8859_3", - "iso8859_4", - "latin_1", - ], - "kz1048": ["cp1251", "ptcp154"], - "latin_1": [ - "cp1252", - "cp1254", - "cp1258", - "iso8859_10", - "iso8859_14", - "iso8859_15", - "iso8859_16", - "iso8859_3", - "iso8859_4", - "iso8859_9", - ], - "mac_iceland": ["mac_roman", "mac_turkish"], - "mac_roman": ["mac_iceland", "mac_turkish"], - "mac_turkish": ["mac_iceland", "mac_roman"], - "ptcp154": ["cp1251", "kz1048"], - "tis_620": ["iso8859_11"], -} - - -CHARDET_CORRESPONDENCE: Dict[str, str] = { - "iso2022_kr": "ISO-2022-KR", - "iso2022_jp": "ISO-2022-JP", - "euc_kr": "EUC-KR", - "tis_620": "TIS-620", - "utf_32": "UTF-32", - "euc_jp": "EUC-JP", - "koi8_r": "KOI8-R", - "iso8859_1": "ISO-8859-1", - "iso8859_2": "ISO-8859-2", - "iso8859_5": "ISO-8859-5", - "iso8859_6": "ISO-8859-6", - "iso8859_7": "ISO-8859-7", - "iso8859_8": "ISO-8859-8", - "utf_16": "UTF-16", - "cp855": "IBM855", - "mac_cyrillic": "MacCyrillic", - "gb2312": "GB2312", - "gb18030": "GB18030", - "cp932": "CP932", - "cp866": "IBM866", - "utf_8": "utf-8", - "utf_8_sig": "UTF-8-SIG", - "shift_jis": "SHIFT_JIS", - "big5": "Big5", - "cp1250": "windows-1250", - "cp1251": "windows-1251", - "cp1252": "Windows-1252", - "cp1253": "windows-1253", - "cp1255": "windows-1255", - "cp1256": "windows-1256", - "cp1254": "Windows-1254", - "cp949": "CP949", -} - - -COMMON_SAFE_ASCII_CHARACTERS: Set[str] = { - "<", - ">", - "=", - ":", - "/", - "&", - ";", - "{", - "}", - "[", - "]", - ",", - "|", - '"', - "-", -} - - -KO_NAMES: Set[str] = {"johab", "cp949", "euc_kr"} -ZH_NAMES: Set[str] = {"big5", "cp950", "big5hkscs", "hz"} - -# Logging LEVEL below DEBUG -TRACE: int = 5 - - -# Language label that contain the em dash "—" -# character are to be considered alternative seq to origin -FREQUENCIES: Dict[str, List[str]] = { - "English": [ - "e", - "a", - "t", - "i", - "o", - "n", - "s", - "r", - "h", - "l", - "d", - "c", - "u", - "m", - "f", - "p", - "g", - "w", - "y", - "b", - "v", - "k", - "x", - "j", - "z", - "q", - ], - "English—": [ - "e", - "a", - "t", - "i", - "o", - "n", - "s", - "r", - "h", - "l", - "d", - "c", - "m", - "u", - "f", - "p", - "g", - "w", - "b", - "y", - "v", - "k", - "j", - "x", - "z", - "q", - ], - "German": [ - "e", - "n", - "i", - "r", - "s", - "t", - "a", - "d", - "h", - "u", - "l", - "g", - "o", - "c", - "m", - "b", - "f", - "k", - "w", - "z", - "p", - "v", - "ü", - "ä", - "ö", - "j", - ], - "French": [ - "e", - "a", - "s", - "n", - "i", - "t", - "r", - "l", - "u", - "o", - "d", - "c", - "p", - "m", - "é", - "v", - "g", - "f", - "b", - "h", - "q", - "à", - "x", - "è", - "y", - "j", - ], - "Dutch": [ - "e", - "n", - "a", - "i", - "r", - "t", - "o", - "d", - "s", - "l", - "g", - "h", - "v", - "m", - "u", - "k", - "c", - "p", - "b", - "w", - "j", - "z", - "f", - "y", - "x", - "ë", - ], - "Italian": [ - "e", - "i", - "a", - "o", - "n", - "l", - "t", - "r", - "s", - "c", - "d", - "u", - "p", - "m", - "g", - "v", - "f", - "b", - "z", - "h", - "q", - "è", - "à", - "k", - "y", - "ò", - ], - "Polish": [ - "a", - "i", - "o", - "e", - "n", - "r", - "z", - "w", - "s", - "c", - "t", - "k", - "y", - "d", - "p", - "m", - "u", - "l", - "j", - "ł", - "g", - "b", - "h", - "ą", - "ę", - "ó", - ], - "Spanish": [ - "e", - "a", - "o", - "n", - "s", - "r", - "i", - "l", - "d", - "t", - "c", - "u", - "m", - "p", - "b", - "g", - "v", - "f", - "y", - "ó", - "h", - "q", - "í", - "j", - "z", - "á", - ], - "Russian": [ - "о", - "а", - "е", - "и", - "н", - "с", - "т", - "р", - "в", - "л", - "к", - "м", - "д", - "п", - "у", - "г", - "я", - "ы", - "з", - "б", - "й", - "ь", - "ч", - "х", - "ж", - "ц", - ], - # Jap-Kanji - "Japanese": [ - "人", - "一", - "大", - "亅", - "丁", - "丨", - "竹", - "笑", - "口", - "日", - "今", - "二", - "彳", - "行", - "十", - "土", - "丶", - "寸", - "寺", - "時", - "乙", - "丿", - "乂", - "气", - "気", - "冂", - "巾", - "亠", - "市", - "目", - "儿", - "見", - "八", - "小", - "凵", - "県", - "月", - "彐", - "門", - "間", - "木", - "東", - "山", - "出", - "本", - "中", - "刀", - "分", - "耳", - "又", - "取", - "最", - "言", - "田", - "心", - "思", - "刂", - "前", - "京", - "尹", - "事", - "生", - "厶", - "云", - "会", - "未", - "来", - "白", - "冫", - "楽", - "灬", - "馬", - "尸", - "尺", - "駅", - "明", - "耂", - "者", - "了", - "阝", - "都", - "高", - "卜", - "占", - "厂", - "广", - "店", - "子", - "申", - "奄", - "亻", - "俺", - "上", - "方", - "冖", - "学", - "衣", - "艮", - "食", - "自", - ], - # Jap-Katakana - "Japanese—": [ - "ー", - "ン", - "ス", - "・", - "ル", - "ト", - "リ", - "イ", - "ア", - "ラ", - "ッ", - "ク", - "ド", - "シ", - "レ", - "ジ", - "タ", - "フ", - "ロ", - "カ", - "テ", - "マ", - "ィ", - "グ", - "バ", - "ム", - "プ", - "オ", - "コ", - "デ", - "ニ", - "ウ", - "メ", - "サ", - "ビ", - "ナ", - "ブ", - "ャ", - "エ", - "ュ", - "チ", - "キ", - "ズ", - "ダ", - "パ", - "ミ", - "ェ", - "ョ", - "ハ", - "セ", - "ベ", - "ガ", - "モ", - "ツ", - "ネ", - "ボ", - "ソ", - "ノ", - "ァ", - "ヴ", - "ワ", - "ポ", - "ペ", - "ピ", - "ケ", - "ゴ", - "ギ", - "ザ", - "ホ", - "ゲ", - "ォ", - "ヤ", - "ヒ", - "ユ", - "ヨ", - "ヘ", - "ゼ", - "ヌ", - "ゥ", - "ゾ", - "ヶ", - "ヂ", - "ヲ", - "ヅ", - "ヵ", - "ヱ", - "ヰ", - "ヮ", - "ヽ", - "゠", - "ヾ", - "ヷ", - "ヿ", - "ヸ", - "ヹ", - "ヺ", - ], - # Jap-Hiragana - "Japanese——": [ - "の", - "に", - "る", - "た", - "と", - "は", - "し", - "い", - "を", - "で", - "て", - "が", - "な", - "れ", - "か", - "ら", - "さ", - "っ", - "り", - "す", - "あ", - "も", - "こ", - "ま", - "う", - "く", - "よ", - "き", - "ん", - "め", - "お", - "け", - "そ", - "つ", - "だ", - "や", - "え", - "ど", - "わ", - "ち", - "み", - "せ", - "じ", - "ば", - "へ", - "び", - "ず", - "ろ", - "ほ", - "げ", - "む", - "べ", - "ひ", - "ょ", - "ゆ", - "ぶ", - "ご", - "ゃ", - "ね", - "ふ", - "ぐ", - "ぎ", - "ぼ", - "ゅ", - "づ", - "ざ", - "ぞ", - "ぬ", - "ぜ", - "ぱ", - "ぽ", - "ぷ", - "ぴ", - "ぃ", - "ぁ", - "ぇ", - "ぺ", - "ゞ", - "ぢ", - "ぉ", - "ぅ", - "ゐ", - "ゝ", - "ゑ", - "゛", - "゜", - "ゎ", - "ゔ", - "゚", - "ゟ", - "゙", - "ゕ", - "ゖ", - ], - "Portuguese": [ - "a", - "e", - "o", - "s", - "i", - "r", - "d", - "n", - "t", - "m", - "u", - "c", - "l", - "p", - "g", - "v", - "b", - "f", - "h", - "ã", - "q", - "é", - "ç", - "á", - "z", - "í", - ], - "Swedish": [ - "e", - "a", - "n", - "r", - "t", - "s", - "i", - "l", - "d", - "o", - "m", - "k", - "g", - "v", - "h", - "f", - "u", - "p", - "ä", - "c", - "b", - "ö", - "å", - "y", - "j", - "x", - ], - "Chinese": [ - "的", - "一", - "是", - "不", - "了", - "在", - "人", - "有", - "我", - "他", - "这", - "个", - "们", - "中", - "来", - "上", - "大", - "为", - "和", - "国", - "地", - "到", - "以", - "说", - "时", - "要", - "就", - "出", - "会", - "可", - "也", - "你", - "对", - "生", - "能", - "而", - "子", - "那", - "得", - "于", - "着", - "下", - "自", - "之", - "年", - "过", - "发", - "后", - "作", - "里", - "用", - "道", - "行", - "所", - "然", - "家", - "种", - "事", - "成", - "方", - "多", - "经", - "么", - "去", - "法", - "学", - "如", - "都", - "同", - "现", - "当", - "没", - "动", - "面", - "起", - "看", - "定", - "天", - "分", - "还", - "进", - "好", - "小", - "部", - "其", - "些", - "主", - "样", - "理", - "心", - "她", - "本", - "前", - "开", - "但", - "因", - "只", - "从", - "想", - "实", - ], - "Ukrainian": [ - "о", - "а", - "н", - "і", - "и", - "р", - "в", - "т", - "е", - "с", - "к", - "л", - "у", - "д", - "м", - "п", - "з", - "я", - "ь", - "б", - "г", - "й", - "ч", - "х", - "ц", - "ї", - ], - "Norwegian": [ - "e", - "r", - "n", - "t", - "a", - "s", - "i", - "o", - "l", - "d", - "g", - "k", - "m", - "v", - "f", - "p", - "u", - "b", - "h", - "å", - "y", - "j", - "ø", - "c", - "æ", - "w", - ], - "Finnish": [ - "a", - "i", - "n", - "t", - "e", - "s", - "l", - "o", - "u", - "k", - "ä", - "m", - "r", - "v", - "j", - "h", - "p", - "y", - "d", - "ö", - "g", - "c", - "b", - "f", - "w", - "z", - ], - "Vietnamese": [ - "n", - "h", - "t", - "i", - "c", - "g", - "a", - "o", - "u", - "m", - "l", - "r", - "à", - "đ", - "s", - "e", - "v", - "p", - "b", - "y", - "ư", - "d", - "á", - "k", - "ộ", - "ế", - ], - "Czech": [ - "o", - "e", - "a", - "n", - "t", - "s", - "i", - "l", - "v", - "r", - "k", - "d", - "u", - "m", - "p", - "í", - "c", - "h", - "z", - "á", - "y", - "j", - "b", - "ě", - "é", - "ř", - ], - "Hungarian": [ - "e", - "a", - "t", - "l", - "s", - "n", - "k", - "r", - "i", - "o", - "z", - "á", - "é", - "g", - "m", - "b", - "y", - "v", - "d", - "h", - "u", - "p", - "j", - "ö", - "f", - "c", - ], - "Korean": [ - "이", - "다", - "에", - "의", - "는", - "로", - "하", - "을", - "가", - "고", - "지", - "서", - "한", - "은", - "기", - "으", - "년", - "대", - "사", - "시", - "를", - "리", - "도", - "인", - "스", - "일", - ], - "Indonesian": [ - "a", - "n", - "e", - "i", - "r", - "t", - "u", - "s", - "d", - "k", - "m", - "l", - "g", - "p", - "b", - "o", - "h", - "y", - "j", - "c", - "w", - "f", - "v", - "z", - "x", - "q", - ], - "Turkish": [ - "a", - "e", - "i", - "n", - "r", - "l", - "ı", - "k", - "d", - "t", - "s", - "m", - "y", - "u", - "o", - "b", - "ü", - "ş", - "v", - "g", - "z", - "h", - "c", - "p", - "ç", - "ğ", - ], - "Romanian": [ - "e", - "i", - "a", - "r", - "n", - "t", - "u", - "l", - "o", - "c", - "s", - "d", - "p", - "m", - "ă", - "f", - "v", - "î", - "g", - "b", - "ș", - "ț", - "z", - "h", - "â", - "j", - ], - "Farsi": [ - "ا", - "ی", - "ر", - "د", - "ن", - "ه", - "و", - "م", - "ت", - "ب", - "س", - "ل", - "ک", - "ش", - "ز", - "ف", - "گ", - "ع", - "خ", - "ق", - "ج", - "آ", - "پ", - "ح", - "ط", - "ص", - ], - "Arabic": [ - "ا", - "ل", - "ي", - "م", - "و", - "ن", - "ر", - "ت", - "ب", - "ة", - "ع", - "د", - "س", - "ف", - "ه", - "ك", - "ق", - "أ", - "ح", - "ج", - "ش", - "ط", - "ص", - "ى", - "خ", - "إ", - ], - "Danish": [ - "e", - "r", - "n", - "t", - "a", - "i", - "s", - "d", - "l", - "o", - "g", - "m", - "k", - "f", - "v", - "u", - "b", - "h", - "p", - "å", - "y", - "ø", - "æ", - "c", - "j", - "w", - ], - "Serbian": [ - "а", - "и", - "о", - "е", - "н", - "р", - "с", - "у", - "т", - "к", - "ј", - "в", - "д", - "м", - "п", - "л", - "г", - "з", - "б", - "a", - "i", - "e", - "o", - "n", - "ц", - "ш", - ], - "Lithuanian": [ - "i", - "a", - "s", - "o", - "r", - "e", - "t", - "n", - "u", - "k", - "m", - "l", - "p", - "v", - "d", - "j", - "g", - "ė", - "b", - "y", - "ų", - "š", - "ž", - "c", - "ą", - "į", - ], - "Slovene": [ - "e", - "a", - "i", - "o", - "n", - "r", - "s", - "l", - "t", - "j", - "v", - "k", - "d", - "p", - "m", - "u", - "z", - "b", - "g", - "h", - "č", - "c", - "š", - "ž", - "f", - "y", - ], - "Slovak": [ - "o", - "a", - "e", - "n", - "i", - "r", - "v", - "t", - "s", - "l", - "k", - "d", - "m", - "p", - "u", - "c", - "h", - "j", - "b", - "z", - "á", - "y", - "ý", - "í", - "č", - "é", - ], - "Hebrew": [ - "י", - "ו", - "ה", - "ל", - "ר", - "ב", - "ת", - "מ", - "א", - "ש", - "נ", - "ע", - "ם", - "ד", - "ק", - "ח", - "פ", - "ס", - "כ", - "ג", - "ט", - "צ", - "ן", - "ז", - "ך", - ], - "Bulgarian": [ - "а", - "и", - "о", - "е", - "н", - "т", - "р", - "с", - "в", - "л", - "к", - "д", - "п", - "м", - "з", - "г", - "я", - "ъ", - "у", - "б", - "ч", - "ц", - "й", - "ж", - "щ", - "х", - ], - "Croatian": [ - "a", - "i", - "o", - "e", - "n", - "r", - "j", - "s", - "t", - "u", - "k", - "l", - "v", - "d", - "m", - "p", - "g", - "z", - "b", - "c", - "č", - "h", - "š", - "ž", - "ć", - "f", - ], - "Hindi": [ - "क", - "र", - "स", - "न", - "त", - "म", - "ह", - "प", - "य", - "ल", - "व", - "ज", - "द", - "ग", - "ब", - "श", - "ट", - "अ", - "ए", - "थ", - "भ", - "ड", - "च", - "ध", - "ष", - "इ", - ], - "Estonian": [ - "a", - "i", - "e", - "s", - "t", - "l", - "u", - "n", - "o", - "k", - "r", - "d", - "m", - "v", - "g", - "p", - "j", - "h", - "ä", - "b", - "õ", - "ü", - "f", - "c", - "ö", - "y", - ], - "Thai": [ - "า", - "น", - "ร", - "อ", - "ก", - "เ", - "ง", - "ม", - "ย", - "ล", - "ว", - "ด", - "ท", - "ส", - "ต", - "ะ", - "ป", - "บ", - "ค", - "ห", - "แ", - "จ", - "พ", - "ช", - "ข", - "ใ", - ], - "Greek": [ - "α", - "τ", - "ο", - "ι", - "ε", - "ν", - "ρ", - "σ", - "κ", - "η", - "π", - "ς", - "υ", - "μ", - "λ", - "ί", - "ό", - "ά", - "γ", - "έ", - "δ", - "ή", - "ω", - "χ", - "θ", - "ύ", - ], - "Tamil": [ - "க", - "த", - "ப", - "ட", - "ர", - "ம", - "ல", - "ன", - "வ", - "ற", - "ய", - "ள", - "ச", - "ந", - "இ", - "ண", - "அ", - "ஆ", - "ழ", - "ங", - "எ", - "உ", - "ஒ", - "ஸ", - ], - "Kazakh": [ - "а", - "ы", - "е", - "н", - "т", - "р", - "л", - "і", - "д", - "с", - "м", - "қ", - "к", - "о", - "б", - "и", - "у", - "ғ", - "ж", - "ң", - "з", - "ш", - "й", - "п", - "г", - "ө", - ], -} - -LANGUAGE_SUPPORTED_COUNT: int = len(FREQUENCIES) diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/legacy.py b/venv/lib/python3.8/site-packages/charset_normalizer/legacy.py deleted file mode 100644 index 43aad21a9dd1c08c8d31e38908485d46b14efbd2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/legacy.py +++ /dev/null @@ -1,54 +0,0 @@ -from typing import Any, Dict, Optional, Union -from warnings import warn - -from .api import from_bytes -from .constant import CHARDET_CORRESPONDENCE - - -def detect( - byte_str: bytes, should_rename_legacy: bool = False, **kwargs: Any -) -> Dict[str, Optional[Union[str, float]]]: - """ - chardet legacy method - Detect the encoding of the given byte string. It should be mostly backward-compatible. - Encoding name will match Chardet own writing whenever possible. (Not on encoding name unsupported by it) - This function is deprecated and should be used to migrate your project easily, consult the documentation for - further information. Not planned for removal. - - :param byte_str: The byte sequence to examine. - :param should_rename_legacy: Should we rename legacy encodings - to their more modern equivalents? - """ - if len(kwargs): - warn( - f"charset-normalizer disregard arguments '{','.join(list(kwargs.keys()))}' in legacy function detect()" - ) - - if not isinstance(byte_str, (bytearray, bytes)): - raise TypeError( # pragma: nocover - "Expected object of type bytes or bytearray, got: " - "{0}".format(type(byte_str)) - ) - - if isinstance(byte_str, bytearray): - byte_str = bytes(byte_str) - - r = from_bytes(byte_str).best() - - encoding = r.encoding if r is not None else None - language = r.language if r is not None and r.language != "Unknown" else "" - confidence = 1.0 - r.chaos if r is not None else None - - # Note: CharsetNormalizer does not return 'UTF-8-SIG' as the sig get stripped in the detection/normalization process - # but chardet does return 'utf-8-sig' and it is a valid codec name. - if r is not None and encoding == "utf_8" and r.bom: - encoding += "_sig" - - if should_rename_legacy is False and encoding in CHARDET_CORRESPONDENCE: - encoding = CHARDET_CORRESPONDENCE[encoding] - - return { - "encoding": encoding, - "language": language, - "confidence": confidence, - } diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/md.cpython-38-x86_64-linux-gnu.so b/venv/lib/python3.8/site-packages/charset_normalizer/md.cpython-38-x86_64-linux-gnu.so deleted file mode 100644 index 3824a428ffd621958e1f1f22dfd105c58417ffd0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/md.cpython-38-x86_64-linux-gnu.so and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/md.py b/venv/lib/python3.8/site-packages/charset_normalizer/md.py deleted file mode 100644 index a6d9350c8b2ce7d05100f47bbd5b2fac20e8f5a9..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/md.py +++ /dev/null @@ -1,581 +0,0 @@ -from functools import lru_cache -from logging import getLogger -from typing import List, Optional - -from .constant import ( - COMMON_SAFE_ASCII_CHARACTERS, - TRACE, - UNICODE_SECONDARY_RANGE_KEYWORD, -) -from .utils import ( - is_accentuated, - is_case_variable, - is_cjk, - is_emoticon, - is_hangul, - is_hiragana, - is_katakana, - is_latin, - is_punctuation, - is_separator, - is_symbol, - is_thai, - is_unprintable, - remove_accent, - unicode_range, -) - - -class MessDetectorPlugin: - """ - Base abstract class used for mess detection plugins. - All detectors MUST extend and implement given methods. - """ - - def eligible(self, character: str) -> bool: - """ - Determine if given character should be fed in. - """ - raise NotImplementedError # pragma: nocover - - def feed(self, character: str) -> None: - """ - The main routine to be executed upon character. - Insert the logic in witch the text would be considered chaotic. - """ - raise NotImplementedError # pragma: nocover - - def reset(self) -> None: # pragma: no cover - """ - Permit to reset the plugin to the initial state. - """ - raise NotImplementedError - - @property - def ratio(self) -> float: - """ - Compute the chaos ratio based on what your feed() has seen. - Must NOT be lower than 0.; No restriction gt 0. - """ - raise NotImplementedError # pragma: nocover - - -class TooManySymbolOrPunctuationPlugin(MessDetectorPlugin): - def __init__(self) -> None: - self._punctuation_count: int = 0 - self._symbol_count: int = 0 - self._character_count: int = 0 - - self._last_printable_char: Optional[str] = None - self._frenzy_symbol_in_word: bool = False - - def eligible(self, character: str) -> bool: - return character.isprintable() - - def feed(self, character: str) -> None: - self._character_count += 1 - - if ( - character != self._last_printable_char - and character not in COMMON_SAFE_ASCII_CHARACTERS - ): - if is_punctuation(character): - self._punctuation_count += 1 - elif ( - character.isdigit() is False - and is_symbol(character) - and is_emoticon(character) is False - ): - self._symbol_count += 2 - - self._last_printable_char = character - - def reset(self) -> None: # pragma: no cover - self._punctuation_count = 0 - self._character_count = 0 - self._symbol_count = 0 - - @property - def ratio(self) -> float: - if self._character_count == 0: - return 0.0 - - ratio_of_punctuation: float = ( - self._punctuation_count + self._symbol_count - ) / self._character_count - - return ratio_of_punctuation if ratio_of_punctuation >= 0.3 else 0.0 - - -class TooManyAccentuatedPlugin(MessDetectorPlugin): - def __init__(self) -> None: - self._character_count: int = 0 - self._accentuated_count: int = 0 - - def eligible(self, character: str) -> bool: - return character.isalpha() - - def feed(self, character: str) -> None: - self._character_count += 1 - - if is_accentuated(character): - self._accentuated_count += 1 - - def reset(self) -> None: # pragma: no cover - self._character_count = 0 - self._accentuated_count = 0 - - @property - def ratio(self) -> float: - if self._character_count == 0 or self._character_count < 8: - return 0.0 - ratio_of_accentuation: float = self._accentuated_count / self._character_count - return ratio_of_accentuation if ratio_of_accentuation >= 0.35 else 0.0 - - -class UnprintablePlugin(MessDetectorPlugin): - def __init__(self) -> None: - self._unprintable_count: int = 0 - self._character_count: int = 0 - - def eligible(self, character: str) -> bool: - return True - - def feed(self, character: str) -> None: - if is_unprintable(character): - self._unprintable_count += 1 - self._character_count += 1 - - def reset(self) -> None: # pragma: no cover - self._unprintable_count = 0 - - @property - def ratio(self) -> float: - if self._character_count == 0: - return 0.0 - - return (self._unprintable_count * 8) / self._character_count - - -class SuspiciousDuplicateAccentPlugin(MessDetectorPlugin): - def __init__(self) -> None: - self._successive_count: int = 0 - self._character_count: int = 0 - - self._last_latin_character: Optional[str] = None - - def eligible(self, character: str) -> bool: - return character.isalpha() and is_latin(character) - - def feed(self, character: str) -> None: - self._character_count += 1 - if ( - self._last_latin_character is not None - and is_accentuated(character) - and is_accentuated(self._last_latin_character) - ): - if character.isupper() and self._last_latin_character.isupper(): - self._successive_count += 1 - # Worse if its the same char duplicated with different accent. - if remove_accent(character) == remove_accent(self._last_latin_character): - self._successive_count += 1 - self._last_latin_character = character - - def reset(self) -> None: # pragma: no cover - self._successive_count = 0 - self._character_count = 0 - self._last_latin_character = None - - @property - def ratio(self) -> float: - if self._character_count == 0: - return 0.0 - - return (self._successive_count * 2) / self._character_count - - -class SuspiciousRange(MessDetectorPlugin): - def __init__(self) -> None: - self._suspicious_successive_range_count: int = 0 - self._character_count: int = 0 - self._last_printable_seen: Optional[str] = None - - def eligible(self, character: str) -> bool: - return character.isprintable() - - def feed(self, character: str) -> None: - self._character_count += 1 - - if ( - character.isspace() - or is_punctuation(character) - or character in COMMON_SAFE_ASCII_CHARACTERS - ): - self._last_printable_seen = None - return - - if self._last_printable_seen is None: - self._last_printable_seen = character - return - - unicode_range_a: Optional[str] = unicode_range(self._last_printable_seen) - unicode_range_b: Optional[str] = unicode_range(character) - - if is_suspiciously_successive_range(unicode_range_a, unicode_range_b): - self._suspicious_successive_range_count += 1 - - self._last_printable_seen = character - - def reset(self) -> None: # pragma: no cover - self._character_count = 0 - self._suspicious_successive_range_count = 0 - self._last_printable_seen = None - - @property - def ratio(self) -> float: - if self._character_count == 0: - return 0.0 - - ratio_of_suspicious_range_usage: float = ( - self._suspicious_successive_range_count * 2 - ) / self._character_count - - if ratio_of_suspicious_range_usage < 0.1: - return 0.0 - - return ratio_of_suspicious_range_usage - - -class SuperWeirdWordPlugin(MessDetectorPlugin): - def __init__(self) -> None: - self._word_count: int = 0 - self._bad_word_count: int = 0 - self._foreign_long_count: int = 0 - - self._is_current_word_bad: bool = False - self._foreign_long_watch: bool = False - - self._character_count: int = 0 - self._bad_character_count: int = 0 - - self._buffer: str = "" - self._buffer_accent_count: int = 0 - - def eligible(self, character: str) -> bool: - return True - - def feed(self, character: str) -> None: - if character.isalpha(): - self._buffer += character - if is_accentuated(character): - self._buffer_accent_count += 1 - if ( - self._foreign_long_watch is False - and (is_latin(character) is False or is_accentuated(character)) - and is_cjk(character) is False - and is_hangul(character) is False - and is_katakana(character) is False - and is_hiragana(character) is False - and is_thai(character) is False - ): - self._foreign_long_watch = True - return - if not self._buffer: - return - if ( - character.isspace() or is_punctuation(character) or is_separator(character) - ) and self._buffer: - self._word_count += 1 - buffer_length: int = len(self._buffer) - - self._character_count += buffer_length - - if buffer_length >= 4: - if self._buffer_accent_count / buffer_length > 0.34: - self._is_current_word_bad = True - # Word/Buffer ending with an upper case accentuated letter are so rare, - # that we will consider them all as suspicious. Same weight as foreign_long suspicious. - if is_accentuated(self._buffer[-1]) and self._buffer[-1].isupper(): - self._foreign_long_count += 1 - self._is_current_word_bad = True - if buffer_length >= 24 and self._foreign_long_watch: - camel_case_dst = [ - i - for c, i in zip(self._buffer, range(0, buffer_length)) - if c.isupper() - ] - probable_camel_cased: bool = False - - if camel_case_dst and (len(camel_case_dst) / buffer_length <= 0.3): - probable_camel_cased = True - - if not probable_camel_cased: - self._foreign_long_count += 1 - self._is_current_word_bad = True - - if self._is_current_word_bad: - self._bad_word_count += 1 - self._bad_character_count += len(self._buffer) - self._is_current_word_bad = False - - self._foreign_long_watch = False - self._buffer = "" - self._buffer_accent_count = 0 - elif ( - character not in {"<", ">", "-", "=", "~", "|", "_"} - and character.isdigit() is False - and is_symbol(character) - ): - self._is_current_word_bad = True - self._buffer += character - - def reset(self) -> None: # pragma: no cover - self._buffer = "" - self._is_current_word_bad = False - self._foreign_long_watch = False - self._bad_word_count = 0 - self._word_count = 0 - self._character_count = 0 - self._bad_character_count = 0 - self._foreign_long_count = 0 - - @property - def ratio(self) -> float: - if self._word_count <= 10 and self._foreign_long_count == 0: - return 0.0 - - return self._bad_character_count / self._character_count - - -class CjkInvalidStopPlugin(MessDetectorPlugin): - """ - GB(Chinese) based encoding often render the stop incorrectly when the content does not fit and - can be easily detected. Searching for the overuse of '丅' and '丄'. - """ - - def __init__(self) -> None: - self._wrong_stop_count: int = 0 - self._cjk_character_count: int = 0 - - def eligible(self, character: str) -> bool: - return True - - def feed(self, character: str) -> None: - if character in {"丅", "丄"}: - self._wrong_stop_count += 1 - return - if is_cjk(character): - self._cjk_character_count += 1 - - def reset(self) -> None: # pragma: no cover - self._wrong_stop_count = 0 - self._cjk_character_count = 0 - - @property - def ratio(self) -> float: - if self._cjk_character_count < 16: - return 0.0 - return self._wrong_stop_count / self._cjk_character_count - - -class ArchaicUpperLowerPlugin(MessDetectorPlugin): - def __init__(self) -> None: - self._buf: bool = False - - self._character_count_since_last_sep: int = 0 - - self._successive_upper_lower_count: int = 0 - self._successive_upper_lower_count_final: int = 0 - - self._character_count: int = 0 - - self._last_alpha_seen: Optional[str] = None - self._current_ascii_only: bool = True - - def eligible(self, character: str) -> bool: - return True - - def feed(self, character: str) -> None: - is_concerned = character.isalpha() and is_case_variable(character) - chunk_sep = is_concerned is False - - if chunk_sep and self._character_count_since_last_sep > 0: - if ( - self._character_count_since_last_sep <= 64 - and character.isdigit() is False - and self._current_ascii_only is False - ): - self._successive_upper_lower_count_final += ( - self._successive_upper_lower_count - ) - - self._successive_upper_lower_count = 0 - self._character_count_since_last_sep = 0 - self._last_alpha_seen = None - self._buf = False - self._character_count += 1 - self._current_ascii_only = True - - return - - if self._current_ascii_only is True and character.isascii() is False: - self._current_ascii_only = False - - if self._last_alpha_seen is not None: - if (character.isupper() and self._last_alpha_seen.islower()) or ( - character.islower() and self._last_alpha_seen.isupper() - ): - if self._buf is True: - self._successive_upper_lower_count += 2 - self._buf = False - else: - self._buf = True - else: - self._buf = False - - self._character_count += 1 - self._character_count_since_last_sep += 1 - self._last_alpha_seen = character - - def reset(self) -> None: # pragma: no cover - self._character_count = 0 - self._character_count_since_last_sep = 0 - self._successive_upper_lower_count = 0 - self._successive_upper_lower_count_final = 0 - self._last_alpha_seen = None - self._buf = False - self._current_ascii_only = True - - @property - def ratio(self) -> float: - if self._character_count == 0: - return 0.0 - - return self._successive_upper_lower_count_final / self._character_count - - -@lru_cache(maxsize=1024) -def is_suspiciously_successive_range( - unicode_range_a: Optional[str], unicode_range_b: Optional[str] -) -> bool: - """ - Determine if two Unicode range seen next to each other can be considered as suspicious. - """ - if unicode_range_a is None or unicode_range_b is None: - return True - - if unicode_range_a == unicode_range_b: - return False - - if "Latin" in unicode_range_a and "Latin" in unicode_range_b: - return False - - if "Emoticons" in unicode_range_a or "Emoticons" in unicode_range_b: - return False - - # Latin characters can be accompanied with a combining diacritical mark - # eg. Vietnamese. - if ("Latin" in unicode_range_a or "Latin" in unicode_range_b) and ( - "Combining" in unicode_range_a or "Combining" in unicode_range_b - ): - return False - - keywords_range_a, keywords_range_b = unicode_range_a.split( - " " - ), unicode_range_b.split(" ") - - for el in keywords_range_a: - if el in UNICODE_SECONDARY_RANGE_KEYWORD: - continue - if el in keywords_range_b: - return False - - # Japanese Exception - range_a_jp_chars, range_b_jp_chars = ( - unicode_range_a - in ( - "Hiragana", - "Katakana", - ), - unicode_range_b in ("Hiragana", "Katakana"), - ) - if (range_a_jp_chars or range_b_jp_chars) and ( - "CJK" in unicode_range_a or "CJK" in unicode_range_b - ): - return False - if range_a_jp_chars and range_b_jp_chars: - return False - - if "Hangul" in unicode_range_a or "Hangul" in unicode_range_b: - if "CJK" in unicode_range_a or "CJK" in unicode_range_b: - return False - if unicode_range_a == "Basic Latin" or unicode_range_b == "Basic Latin": - return False - - # Chinese/Japanese use dedicated range for punctuation and/or separators. - if ("CJK" in unicode_range_a or "CJK" in unicode_range_b) or ( - unicode_range_a in ["Katakana", "Hiragana"] - and unicode_range_b in ["Katakana", "Hiragana"] - ): - if "Punctuation" in unicode_range_a or "Punctuation" in unicode_range_b: - return False - if "Forms" in unicode_range_a or "Forms" in unicode_range_b: - return False - - return True - - -@lru_cache(maxsize=2048) -def mess_ratio( - decoded_sequence: str, maximum_threshold: float = 0.2, debug: bool = False -) -> float: - """ - Compute a mess ratio given a decoded bytes sequence. The maximum threshold does stop the computation earlier. - """ - - detectors: List[MessDetectorPlugin] = [ - md_class() for md_class in MessDetectorPlugin.__subclasses__() - ] - - length: int = len(decoded_sequence) + 1 - - mean_mess_ratio: float = 0.0 - - if length < 512: - intermediary_mean_mess_ratio_calc: int = 32 - elif length <= 1024: - intermediary_mean_mess_ratio_calc = 64 - else: - intermediary_mean_mess_ratio_calc = 128 - - for character, index in zip(decoded_sequence + "\n", range(length)): - for detector in detectors: - if detector.eligible(character): - detector.feed(character) - - if ( - index > 0 and index % intermediary_mean_mess_ratio_calc == 0 - ) or index == length - 1: - mean_mess_ratio = sum(dt.ratio for dt in detectors) - - if mean_mess_ratio >= maximum_threshold: - break - - if debug: - logger = getLogger("charset_normalizer") - - logger.log( - TRACE, - "Mess-detector extended-analysis start. " - f"intermediary_mean_mess_ratio_calc={intermediary_mean_mess_ratio_calc} mean_mess_ratio={mean_mess_ratio} " - f"maximum_threshold={maximum_threshold}", - ) - - if len(decoded_sequence) > 16: - logger.log(TRACE, f"Starting with: {decoded_sequence[:16]}") - logger.log(TRACE, f"Ending with: {decoded_sequence[-16::]}") - - for dt in detectors: # pragma: nocover - logger.log(TRACE, f"{dt.__class__}: {dt.ratio}") - - return round(mean_mess_ratio, 3) diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/md__mypyc.cpython-38-x86_64-linux-gnu.so b/venv/lib/python3.8/site-packages/charset_normalizer/md__mypyc.cpython-38-x86_64-linux-gnu.so deleted file mode 100644 index 1b755072b86646d33f6dc0eebefcf19f04e4692a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/charset_normalizer/md__mypyc.cpython-38-x86_64-linux-gnu.so and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/models.py b/venv/lib/python3.8/site-packages/charset_normalizer/models.py deleted file mode 100644 index f3f7bcc8f9a7ddd7c1832c4053e7f4b37d51562a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/models.py +++ /dev/null @@ -1,337 +0,0 @@ -from encodings.aliases import aliases -from hashlib import sha256 -from json import dumps -from typing import Any, Dict, Iterator, List, Optional, Tuple, Union - -from .constant import TOO_BIG_SEQUENCE -from .utils import iana_name, is_multi_byte_encoding, unicode_range - - -class CharsetMatch: - def __init__( - self, - payload: bytes, - guessed_encoding: str, - mean_mess_ratio: float, - has_sig_or_bom: bool, - languages: "CoherenceMatches", - decoded_payload: Optional[str] = None, - ): - self._payload: bytes = payload - - self._encoding: str = guessed_encoding - self._mean_mess_ratio: float = mean_mess_ratio - self._languages: CoherenceMatches = languages - self._has_sig_or_bom: bool = has_sig_or_bom - self._unicode_ranges: Optional[List[str]] = None - - self._leaves: List[CharsetMatch] = [] - self._mean_coherence_ratio: float = 0.0 - - self._output_payload: Optional[bytes] = None - self._output_encoding: Optional[str] = None - - self._string: Optional[str] = decoded_payload - - def __eq__(self, other: object) -> bool: - if not isinstance(other, CharsetMatch): - raise TypeError( - "__eq__ cannot be invoked on {} and {}.".format( - str(other.__class__), str(self.__class__) - ) - ) - return self.encoding == other.encoding and self.fingerprint == other.fingerprint - - def __lt__(self, other: object) -> bool: - """ - Implemented to make sorted available upon CharsetMatches items. - """ - if not isinstance(other, CharsetMatch): - raise ValueError - - chaos_difference: float = abs(self.chaos - other.chaos) - coherence_difference: float = abs(self.coherence - other.coherence) - - # Below 1% difference --> Use Coherence - if chaos_difference < 0.01 and coherence_difference > 0.02: - return self.coherence > other.coherence - elif chaos_difference < 0.01 and coherence_difference <= 0.02: - # When having a difficult decision, use the result that decoded as many multi-byte as possible. - return self.multi_byte_usage > other.multi_byte_usage - - return self.chaos < other.chaos - - @property - def multi_byte_usage(self) -> float: - return 1.0 - (len(str(self)) / len(self.raw)) - - def __str__(self) -> str: - # Lazy Str Loading - if self._string is None: - self._string = str(self._payload, self._encoding, "strict") - return self._string - - def __repr__(self) -> str: - return "".format(self.encoding, self.fingerprint) - - def add_submatch(self, other: "CharsetMatch") -> None: - if not isinstance(other, CharsetMatch) or other == self: - raise ValueError( - "Unable to add instance <{}> as a submatch of a CharsetMatch".format( - other.__class__ - ) - ) - - other._string = None # Unload RAM usage; dirty trick. - self._leaves.append(other) - - @property - def encoding(self) -> str: - return self._encoding - - @property - def encoding_aliases(self) -> List[str]: - """ - Encoding name are known by many name, using this could help when searching for IBM855 when it's listed as CP855. - """ - also_known_as: List[str] = [] - for u, p in aliases.items(): - if self.encoding == u: - also_known_as.append(p) - elif self.encoding == p: - also_known_as.append(u) - return also_known_as - - @property - def bom(self) -> bool: - return self._has_sig_or_bom - - @property - def byte_order_mark(self) -> bool: - return self._has_sig_or_bom - - @property - def languages(self) -> List[str]: - """ - Return the complete list of possible languages found in decoded sequence. - Usually not really useful. Returned list may be empty even if 'language' property return something != 'Unknown'. - """ - return [e[0] for e in self._languages] - - @property - def language(self) -> str: - """ - Most probable language found in decoded sequence. If none were detected or inferred, the property will return - "Unknown". - """ - if not self._languages: - # Trying to infer the language based on the given encoding - # Its either English or we should not pronounce ourselves in certain cases. - if "ascii" in self.could_be_from_charset: - return "English" - - # doing it there to avoid circular import - from charset_normalizer.cd import encoding_languages, mb_encoding_languages - - languages = ( - mb_encoding_languages(self.encoding) - if is_multi_byte_encoding(self.encoding) - else encoding_languages(self.encoding) - ) - - if len(languages) == 0 or "Latin Based" in languages: - return "Unknown" - - return languages[0] - - return self._languages[0][0] - - @property - def chaos(self) -> float: - return self._mean_mess_ratio - - @property - def coherence(self) -> float: - if not self._languages: - return 0.0 - return self._languages[0][1] - - @property - def percent_chaos(self) -> float: - return round(self.chaos * 100, ndigits=3) - - @property - def percent_coherence(self) -> float: - return round(self.coherence * 100, ndigits=3) - - @property - def raw(self) -> bytes: - """ - Original untouched bytes. - """ - return self._payload - - @property - def submatch(self) -> List["CharsetMatch"]: - return self._leaves - - @property - def has_submatch(self) -> bool: - return len(self._leaves) > 0 - - @property - def alphabets(self) -> List[str]: - if self._unicode_ranges is not None: - return self._unicode_ranges - # list detected ranges - detected_ranges: List[Optional[str]] = [ - unicode_range(char) for char in str(self) - ] - # filter and sort - self._unicode_ranges = sorted(list({r for r in detected_ranges if r})) - return self._unicode_ranges - - @property - def could_be_from_charset(self) -> List[str]: - """ - The complete list of encoding that output the exact SAME str result and therefore could be the originating - encoding. - This list does include the encoding available in property 'encoding'. - """ - return [self._encoding] + [m.encoding for m in self._leaves] - - def output(self, encoding: str = "utf_8") -> bytes: - """ - Method to get re-encoded bytes payload using given target encoding. Default to UTF-8. - Any errors will be simply ignored by the encoder NOT replaced. - """ - if self._output_encoding is None or self._output_encoding != encoding: - self._output_encoding = encoding - self._output_payload = str(self).encode(encoding, "replace") - - return self._output_payload # type: ignore - - @property - def fingerprint(self) -> str: - """ - Retrieve the unique SHA256 computed using the transformed (re-encoded) payload. Not the original one. - """ - return sha256(self.output()).hexdigest() - - -class CharsetMatches: - """ - Container with every CharsetMatch items ordered by default from most probable to the less one. - Act like a list(iterable) but does not implements all related methods. - """ - - def __init__(self, results: Optional[List[CharsetMatch]] = None): - self._results: List[CharsetMatch] = sorted(results) if results else [] - - def __iter__(self) -> Iterator[CharsetMatch]: - yield from self._results - - def __getitem__(self, item: Union[int, str]) -> CharsetMatch: - """ - Retrieve a single item either by its position or encoding name (alias may be used here). - Raise KeyError upon invalid index or encoding not present in results. - """ - if isinstance(item, int): - return self._results[item] - if isinstance(item, str): - item = iana_name(item, False) - for result in self._results: - if item in result.could_be_from_charset: - return result - raise KeyError - - def __len__(self) -> int: - return len(self._results) - - def __bool__(self) -> bool: - return len(self._results) > 0 - - def append(self, item: CharsetMatch) -> None: - """ - Insert a single match. Will be inserted accordingly to preserve sort. - Can be inserted as a submatch. - """ - if not isinstance(item, CharsetMatch): - raise ValueError( - "Cannot append instance '{}' to CharsetMatches".format( - str(item.__class__) - ) - ) - # We should disable the submatch factoring when the input file is too heavy (conserve RAM usage) - if len(item.raw) <= TOO_BIG_SEQUENCE: - for match in self._results: - if match.fingerprint == item.fingerprint and match.chaos == item.chaos: - match.add_submatch(item) - return - self._results.append(item) - self._results = sorted(self._results) - - def best(self) -> Optional["CharsetMatch"]: - """ - Simply return the first match. Strict equivalent to matches[0]. - """ - if not self._results: - return None - return self._results[0] - - def first(self) -> Optional["CharsetMatch"]: - """ - Redundant method, call the method best(). Kept for BC reasons. - """ - return self.best() - - -CoherenceMatch = Tuple[str, float] -CoherenceMatches = List[CoherenceMatch] - - -class CliDetectionResult: - def __init__( - self, - path: str, - encoding: Optional[str], - encoding_aliases: List[str], - alternative_encodings: List[str], - language: str, - alphabets: List[str], - has_sig_or_bom: bool, - chaos: float, - coherence: float, - unicode_path: Optional[str], - is_preferred: bool, - ): - self.path: str = path - self.unicode_path: Optional[str] = unicode_path - self.encoding: Optional[str] = encoding - self.encoding_aliases: List[str] = encoding_aliases - self.alternative_encodings: List[str] = alternative_encodings - self.language: str = language - self.alphabets: List[str] = alphabets - self.has_sig_or_bom: bool = has_sig_or_bom - self.chaos: float = chaos - self.coherence: float = coherence - self.is_preferred: bool = is_preferred - - @property - def __dict__(self) -> Dict[str, Any]: # type: ignore - return { - "path": self.path, - "encoding": self.encoding, - "encoding_aliases": self.encoding_aliases, - "alternative_encodings": self.alternative_encodings, - "language": self.language, - "alphabets": self.alphabets, - "has_sig_or_bom": self.has_sig_or_bom, - "chaos": self.chaos, - "coherence": self.coherence, - "unicode_path": self.unicode_path, - "is_preferred": self.is_preferred, - } - - def to_json(self) -> str: - return dumps(self.__dict__, ensure_ascii=True, indent=4) diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/py.typed b/venv/lib/python3.8/site-packages/charset_normalizer/py.typed deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/utils.py b/venv/lib/python3.8/site-packages/charset_normalizer/utils.py deleted file mode 100644 index 45a402e42f2bb0c0d7bf265d479d570617dcfeaf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/utils.py +++ /dev/null @@ -1,399 +0,0 @@ -import importlib -import logging -import unicodedata -from codecs import IncrementalDecoder -from encodings.aliases import aliases -from functools import lru_cache -from re import findall -from typing import Generator, List, Optional, Set, Tuple, Union - -from _multibytecodec import MultibyteIncrementalDecoder - -from .constant import ( - ENCODING_MARKS, - IANA_SUPPORTED_SIMILAR, - RE_POSSIBLE_ENCODING_INDICATION, - UNICODE_RANGES_COMBINED, - UNICODE_SECONDARY_RANGE_KEYWORD, - UTF8_MAXIMAL_ALLOCATION, -) - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_accentuated(character: str) -> bool: - try: - description: str = unicodedata.name(character) - except ValueError: - return False - return ( - "WITH GRAVE" in description - or "WITH ACUTE" in description - or "WITH CEDILLA" in description - or "WITH DIAERESIS" in description - or "WITH CIRCUMFLEX" in description - or "WITH TILDE" in description - ) - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def remove_accent(character: str) -> str: - decomposed: str = unicodedata.decomposition(character) - if not decomposed: - return character - - codes: List[str] = decomposed.split(" ") - - return chr(int(codes[0], 16)) - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def unicode_range(character: str) -> Optional[str]: - """ - Retrieve the Unicode range official name from a single character. - """ - character_ord: int = ord(character) - - for range_name, ord_range in UNICODE_RANGES_COMBINED.items(): - if character_ord in ord_range: - return range_name - - return None - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_latin(character: str) -> bool: - try: - description: str = unicodedata.name(character) - except ValueError: - return False - return "LATIN" in description - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_punctuation(character: str) -> bool: - character_category: str = unicodedata.category(character) - - if "P" in character_category: - return True - - character_range: Optional[str] = unicode_range(character) - - if character_range is None: - return False - - return "Punctuation" in character_range - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_symbol(character: str) -> bool: - character_category: str = unicodedata.category(character) - - if "S" in character_category or "N" in character_category: - return True - - character_range: Optional[str] = unicode_range(character) - - if character_range is None: - return False - - return "Forms" in character_range - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_emoticon(character: str) -> bool: - character_range: Optional[str] = unicode_range(character) - - if character_range is None: - return False - - return "Emoticons" in character_range - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_separator(character: str) -> bool: - if character.isspace() or character in {"|", "+", "<", ">"}: - return True - - character_category: str = unicodedata.category(character) - - return "Z" in character_category or character_category in {"Po", "Pd", "Pc"} - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_case_variable(character: str) -> bool: - return character.islower() != character.isupper() - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_cjk(character: str) -> bool: - try: - character_name = unicodedata.name(character) - except ValueError: - return False - - return "CJK" in character_name - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_hiragana(character: str) -> bool: - try: - character_name = unicodedata.name(character) - except ValueError: - return False - - return "HIRAGANA" in character_name - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_katakana(character: str) -> bool: - try: - character_name = unicodedata.name(character) - except ValueError: - return False - - return "KATAKANA" in character_name - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_hangul(character: str) -> bool: - try: - character_name = unicodedata.name(character) - except ValueError: - return False - - return "HANGUL" in character_name - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_thai(character: str) -> bool: - try: - character_name = unicodedata.name(character) - except ValueError: - return False - - return "THAI" in character_name - - -@lru_cache(maxsize=len(UNICODE_RANGES_COMBINED)) -def is_unicode_range_secondary(range_name: str) -> bool: - return any(keyword in range_name for keyword in UNICODE_SECONDARY_RANGE_KEYWORD) - - -@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) -def is_unprintable(character: str) -> bool: - return ( - character.isspace() is False # includes \n \t \r \v - and character.isprintable() is False - and character != "\x1A" # Why? Its the ASCII substitute character. - and character != "\ufeff" # bug discovered in Python, - # Zero Width No-Break Space located in Arabic Presentation Forms-B, Unicode 1.1 not acknowledged as space. - ) - - -def any_specified_encoding(sequence: bytes, search_zone: int = 8192) -> Optional[str]: - """ - Extract using ASCII-only decoder any specified encoding in the first n-bytes. - """ - if not isinstance(sequence, bytes): - raise TypeError - - seq_len: int = len(sequence) - - results: List[str] = findall( - RE_POSSIBLE_ENCODING_INDICATION, - sequence[: min(seq_len, search_zone)].decode("ascii", errors="ignore"), - ) - - if len(results) == 0: - return None - - for specified_encoding in results: - specified_encoding = specified_encoding.lower().replace("-", "_") - - encoding_alias: str - encoding_iana: str - - for encoding_alias, encoding_iana in aliases.items(): - if encoding_alias == specified_encoding: - return encoding_iana - if encoding_iana == specified_encoding: - return encoding_iana - - return None - - -@lru_cache(maxsize=128) -def is_multi_byte_encoding(name: str) -> bool: - """ - Verify is a specific encoding is a multi byte one based on it IANA name - """ - return name in { - "utf_8", - "utf_8_sig", - "utf_16", - "utf_16_be", - "utf_16_le", - "utf_32", - "utf_32_le", - "utf_32_be", - "utf_7", - } or issubclass( - importlib.import_module("encodings.{}".format(name)).IncrementalDecoder, - MultibyteIncrementalDecoder, - ) - - -def identify_sig_or_bom(sequence: bytes) -> Tuple[Optional[str], bytes]: - """ - Identify and extract SIG/BOM in given sequence. - """ - - for iana_encoding in ENCODING_MARKS: - marks: Union[bytes, List[bytes]] = ENCODING_MARKS[iana_encoding] - - if isinstance(marks, bytes): - marks = [marks] - - for mark in marks: - if sequence.startswith(mark): - return iana_encoding, mark - - return None, b"" - - -def should_strip_sig_or_bom(iana_encoding: str) -> bool: - return iana_encoding not in {"utf_16", "utf_32"} - - -def iana_name(cp_name: str, strict: bool = True) -> str: - cp_name = cp_name.lower().replace("-", "_") - - encoding_alias: str - encoding_iana: str - - for encoding_alias, encoding_iana in aliases.items(): - if cp_name in [encoding_alias, encoding_iana]: - return encoding_iana - - if strict: - raise ValueError("Unable to retrieve IANA for '{}'".format(cp_name)) - - return cp_name - - -def range_scan(decoded_sequence: str) -> List[str]: - ranges: Set[str] = set() - - for character in decoded_sequence: - character_range: Optional[str] = unicode_range(character) - - if character_range is None: - continue - - ranges.add(character_range) - - return list(ranges) - - -def cp_similarity(iana_name_a: str, iana_name_b: str) -> float: - if is_multi_byte_encoding(iana_name_a) or is_multi_byte_encoding(iana_name_b): - return 0.0 - - decoder_a = importlib.import_module( - "encodings.{}".format(iana_name_a) - ).IncrementalDecoder - decoder_b = importlib.import_module( - "encodings.{}".format(iana_name_b) - ).IncrementalDecoder - - id_a: IncrementalDecoder = decoder_a(errors="ignore") - id_b: IncrementalDecoder = decoder_b(errors="ignore") - - character_match_count: int = 0 - - for i in range(255): - to_be_decoded: bytes = bytes([i]) - if id_a.decode(to_be_decoded) == id_b.decode(to_be_decoded): - character_match_count += 1 - - return character_match_count / 254 - - -def is_cp_similar(iana_name_a: str, iana_name_b: str) -> bool: - """ - Determine if two code page are at least 80% similar. IANA_SUPPORTED_SIMILAR dict was generated using - the function cp_similarity. - """ - return ( - iana_name_a in IANA_SUPPORTED_SIMILAR - and iana_name_b in IANA_SUPPORTED_SIMILAR[iana_name_a] - ) - - -def set_logging_handler( - name: str = "charset_normalizer", - level: int = logging.INFO, - format_string: str = "%(asctime)s | %(levelname)s | %(message)s", -) -> None: - logger = logging.getLogger(name) - logger.setLevel(level) - - handler = logging.StreamHandler() - handler.setFormatter(logging.Formatter(format_string)) - logger.addHandler(handler) - - -def cut_sequence_chunks( - sequences: bytes, - encoding_iana: str, - offsets: range, - chunk_size: int, - bom_or_sig_available: bool, - strip_sig_or_bom: bool, - sig_payload: bytes, - is_multi_byte_decoder: bool, - decoded_payload: Optional[str] = None, -) -> Generator[str, None, None]: - if decoded_payload and is_multi_byte_decoder is False: - for i in offsets: - chunk = decoded_payload[i : i + chunk_size] - if not chunk: - break - yield chunk - else: - for i in offsets: - chunk_end = i + chunk_size - if chunk_end > len(sequences) + 8: - continue - - cut_sequence = sequences[i : i + chunk_size] - - if bom_or_sig_available and strip_sig_or_bom is False: - cut_sequence = sig_payload + cut_sequence - - chunk = cut_sequence.decode( - encoding_iana, - errors="ignore" if is_multi_byte_decoder else "strict", - ) - - # multi-byte bad cutting detector and adjustment - # not the cleanest way to perform that fix but clever enough for now. - if is_multi_byte_decoder and i > 0: - chunk_partial_size_chk: int = min(chunk_size, 16) - - if ( - decoded_payload - and chunk[:chunk_partial_size_chk] not in decoded_payload - ): - for j in range(i, i - 4, -1): - cut_sequence = sequences[j:chunk_end] - - if bom_or_sig_available and strip_sig_or_bom is False: - cut_sequence = sig_payload + cut_sequence - - chunk = cut_sequence.decode(encoding_iana, errors="ignore") - - if chunk[:chunk_partial_size_chk] in decoded_payload: - break - - yield chunk diff --git a/venv/lib/python3.8/site-packages/charset_normalizer/version.py b/venv/lib/python3.8/site-packages/charset_normalizer/version.py deleted file mode 100644 index db1ff57a1d45957ed559d77da795dfe09719b637..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/charset_normalizer/version.py +++ /dev/null @@ -1,6 +0,0 @@ -""" -Expose version -""" - -__version__ = "3.3.0" -VERSION = __version__.split(".") diff --git a/venv/lib/python3.8/site-packages/easy_install.py b/venv/lib/python3.8/site-packages/easy_install.py deleted file mode 100644 index d87e984034b6e6e9eb456ebcb2b3f420c07a48bc..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/easy_install.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Run the EasyInstall command""" - -if __name__ == '__main__': - from setuptools.command.easy_install import main - main() diff --git a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/METADATA b/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/METADATA deleted file mode 100644 index 0cc0da1b0906b5908cb8e45ebee5a8cf98153718..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/METADATA +++ /dev/null @@ -1,56 +0,0 @@ -Metadata-Version: 2.1 -Name: filelock -Version: 3.12.4 -Summary: A platform independent file lock. -Project-URL: Documentation, https://py-filelock.readthedocs.io -Project-URL: Homepage, https://github.com/tox-dev/py-filelock -Project-URL: Source, https://github.com/tox-dev/py-filelock -Project-URL: Tracker, https://github.com/tox-dev/py-filelock/issues -Maintainer-email: Bernát Gábor -License-Expression: Unlicense -License-File: LICENSE -Keywords: application,cache,directory,log,user -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: The Unlicense (Unlicense) -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Topic :: Internet -Classifier: Topic :: Software Development :: Libraries -Classifier: Topic :: System -Requires-Python: >=3.8 -Provides-Extra: docs -Requires-Dist: furo>=2023.7.26; extra == 'docs' -Requires-Dist: sphinx-autodoc-typehints!=1.23.4,>=1.24; extra == 'docs' -Requires-Dist: sphinx>=7.1.2; extra == 'docs' -Provides-Extra: testing -Requires-Dist: covdefaults>=2.3; extra == 'testing' -Requires-Dist: coverage>=7.3; extra == 'testing' -Requires-Dist: diff-cover>=7.7; extra == 'testing' -Requires-Dist: pytest-cov>=4.1; extra == 'testing' -Requires-Dist: pytest-mock>=3.11.1; extra == 'testing' -Requires-Dist: pytest-timeout>=2.1; extra == 'testing' -Requires-Dist: pytest>=7.4; extra == 'testing' -Provides-Extra: typing -Requires-Dist: typing-extensions>=4.7.1; python_version < '3.11' and extra == 'typing' -Description-Content-Type: text/markdown - -# filelock - -[![PyPI](https://img.shields.io/pypi/v/filelock)](https://pypi.org/project/filelock/) -[![Supported Python -versions](https://img.shields.io/pypi/pyversions/filelock.svg)](https://pypi.org/project/filelock/) -[![Documentation -status](https://readthedocs.org/projects/py-filelock/badge/?version=latest)](https://py-filelock.readthedocs.io/en/latest/?badge=latest) -[![Code style: -black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -[![Downloads](https://static.pepy.tech/badge/filelock/month)](https://pepy.tech/project/filelock) -[![check](https://github.com/tox-dev/py-filelock/actions/workflows/check.yml/badge.svg)](https://github.com/tox-dev/py-filelock/actions/workflows/check.yml) - -For more information checkout the [official documentation](https://py-filelock.readthedocs.io/en/latest/index.html). diff --git a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/RECORD b/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/RECORD deleted file mode 100644 index 7bee14fbbdffcdc5fbb4ecac9a5d57fe303521f0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/RECORD +++ /dev/null @@ -1,22 +0,0 @@ -filelock-3.12.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -filelock-3.12.4.dist-info/METADATA,sha256=RESqvTTKHP28SevB_X_ew6UGedwsLHYNoUiCOHiUnes,2786 -filelock-3.12.4.dist-info/RECORD,, -filelock-3.12.4.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87 -filelock-3.12.4.dist-info/licenses/LICENSE,sha256=iNm062BXnBkew5HKBMFhMFctfu3EqG2qWL8oxuFMm80,1210 -filelock/__init__.py,sha256=AdZEYEPa5h20Tfw59XuYwyBZpvvJfYwQbRccaPU-uqY,1229 -filelock/__pycache__/__init__.cpython-38.pyc,, -filelock/__pycache__/_api.cpython-38.pyc,, -filelock/__pycache__/_error.cpython-38.pyc,, -filelock/__pycache__/_soft.cpython-38.pyc,, -filelock/__pycache__/_unix.cpython-38.pyc,, -filelock/__pycache__/_util.cpython-38.pyc,, -filelock/__pycache__/_windows.cpython-38.pyc,, -filelock/__pycache__/version.cpython-38.pyc,, -filelock/_api.py,sha256=SXiSpiT1WEFe1x_6uvHIFjeql6j_PaU1SF29x2s9fow,10313 -filelock/_error.py,sha256=-5jMcjTu60YAvAO1UbqDD1GIEjVkwr8xCFwDBtMeYDg,787 -filelock/_soft.py,sha256=haqtc_TB_KJbYv2a8iuEAclKuM4fMG1vTcp28sK919c,1711 -filelock/_unix.py,sha256=ViG38PgJsIhT3xaArugvw0TPP6VWoP2VJj7FEIWypkg,2157 -filelock/_util.py,sha256=dBDlIj1dHL_juXX0Qqq6bZtyE53YZTN8GFhtyTV043o,1708 -filelock/_windows.py,sha256=eMKL8dZKrgekf5VYVGR14an29JGEInRtUO8ui9ABywg,2177 -filelock/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -filelock/version.py,sha256=tE6bR7f4F_jRGzzjUMbClybJQXhcnX-ivfuziklFw4E,162 diff --git a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/WHEEL b/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/WHEEL deleted file mode 100644 index ba1a8af28bcccdacebb8c22dfda1537447a1a58a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: hatchling 1.18.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/licenses/LICENSE b/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/licenses/LICENSE deleted file mode 100644 index cf1ab25da0349f84a3fdd40032f0ce99db813b8b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock-3.12.4.dist-info/licenses/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to diff --git a/venv/lib/python3.8/site-packages/filelock/__init__.py b/venv/lib/python3.8/site-packages/filelock/__init__.py deleted file mode 100644 index 0b8c1d2fdfceac1c4ee0cb8321b1d6e95cd28914..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock/__init__.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -A platform independent file lock that supports the with-statement. - -.. autodata:: filelock.__version__ - :no-value: - -""" -from __future__ import annotations - -import sys -import warnings -from typing import TYPE_CHECKING - -from ._api import AcquireReturnProxy, BaseFileLock -from ._error import Timeout -from ._soft import SoftFileLock -from ._unix import UnixFileLock, has_fcntl -from ._windows import WindowsFileLock -from .version import version - -#: version of the project as a string -__version__: str = version - - -if sys.platform == "win32": # pragma: win32 cover - _FileLock: type[BaseFileLock] = WindowsFileLock -else: # pragma: win32 no cover # noqa: PLR5501 - if has_fcntl: - _FileLock: type[BaseFileLock] = UnixFileLock - else: - _FileLock = SoftFileLock - if warnings is not None: - warnings.warn("only soft file lock is available", stacklevel=2) - -if TYPE_CHECKING: # noqa: SIM108 - FileLock = SoftFileLock -else: - #: Alias for the lock, which should be used for the current platform. - FileLock = _FileLock - - -__all__ = [ - "__version__", - "FileLock", - "SoftFileLock", - "Timeout", - "UnixFileLock", - "WindowsFileLock", - "BaseFileLock", - "AcquireReturnProxy", -] diff --git a/venv/lib/python3.8/site-packages/filelock/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/filelock/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 9476c7b090ecd41c62b2a0e877e22de1c3c35e3f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/filelock/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/filelock/__pycache__/_api.cpython-38.pyc b/venv/lib/python3.8/site-packages/filelock/__pycache__/_api.cpython-38.pyc deleted file mode 100644 index a8d72a3a494063e931c5e51f9a393fc411a1cd09..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/filelock/__pycache__/_api.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/filelock/__pycache__/_error.cpython-38.pyc b/venv/lib/python3.8/site-packages/filelock/__pycache__/_error.cpython-38.pyc deleted file mode 100644 index d9b28e25d8d6658ce97c68efeb8e7eb333512241..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/filelock/__pycache__/_error.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/filelock/__pycache__/_soft.cpython-38.pyc b/venv/lib/python3.8/site-packages/filelock/__pycache__/_soft.cpython-38.pyc deleted file mode 100644 index 916dcb61a63222f30a1ed421e3b9711112888d62..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/filelock/__pycache__/_soft.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/filelock/__pycache__/_unix.cpython-38.pyc b/venv/lib/python3.8/site-packages/filelock/__pycache__/_unix.cpython-38.pyc deleted file mode 100644 index 58dab2c80f5673b6c6804bc5deddfd8d7c16eb4a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/filelock/__pycache__/_unix.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/filelock/__pycache__/_util.cpython-38.pyc b/venv/lib/python3.8/site-packages/filelock/__pycache__/_util.cpython-38.pyc deleted file mode 100644 index f7672e9ea95754838dba90e7d33f9c8baf221f0f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/filelock/__pycache__/_util.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/filelock/__pycache__/_windows.cpython-38.pyc b/venv/lib/python3.8/site-packages/filelock/__pycache__/_windows.cpython-38.pyc deleted file mode 100644 index 335a4d82f3781d5c15964deac6305e8034cb8ff0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/filelock/__pycache__/_windows.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/filelock/__pycache__/version.cpython-38.pyc b/venv/lib/python3.8/site-packages/filelock/__pycache__/version.cpython-38.pyc deleted file mode 100644 index dcd5d97104e8a11836fca131955aa6e7844d56b5..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/filelock/__pycache__/version.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/filelock/_api.py b/venv/lib/python3.8/site-packages/filelock/_api.py deleted file mode 100644 index 8a40ccd0efb23ba621292d00f3fbbcd6d0ae5e93..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock/_api.py +++ /dev/null @@ -1,288 +0,0 @@ -from __future__ import annotations - -import contextlib -import logging -import os -import time -import warnings -from abc import ABC, abstractmethod -from dataclasses import dataclass -from threading import local -from typing import TYPE_CHECKING, Any - -from ._error import Timeout - -if TYPE_CHECKING: - import sys - from types import TracebackType - - if sys.version_info >= (3, 11): # pragma: no cover (py311+) - from typing import Self - else: # pragma: no cover ( None: - self.lock = lock - - def __enter__(self) -> BaseFileLock: - return self.lock - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - ) -> None: - self.lock.release() - - -@dataclass -class FileLockContext: - """A dataclass which holds the context for a ``BaseFileLock`` object.""" - - # The context is held in a separate class to allow optional use of thread local storage via the - # ThreadLocalFileContext class. - - #: The path to the lock file. - lock_file: str - - #: The default timeout value. - timeout: float - - #: The mode for the lock files - mode: int - - #: The file descriptor for the *_lock_file* as it is returned by the os.open() function, not None when lock held - lock_file_fd: int | None = None - - #: The lock counter is used for implementing the nested locking mechanism. - lock_counter: int = 0 # When the lock is acquired is increased and the lock is only released, when this value is 0 - - -class ThreadLocalFileContext(FileLockContext, local): - """A thread local version of the ``FileLockContext`` class.""" - - -class BaseFileLock(ABC, contextlib.ContextDecorator): - """Abstract base class for a file lock object.""" - - def __init__( - self, - lock_file: str | os.PathLike[str], - timeout: float = -1, - mode: int = 0o644, - thread_local: bool = True, # noqa: FBT001, FBT002 - ) -> None: - """ - Create a new lock object. - - :param lock_file: path to the file - :param timeout: default timeout when acquiring the lock, in seconds. It will be used as fallback value in - the acquire method, if no timeout value (``None``) is given. If you want to disable the timeout, set it - to a negative value. A timeout of 0 means, that there is exactly one attempt to acquire the file lock. - :param mode: file permissions for the lockfile. - :param thread_local: Whether this object's internal context should be thread local or not. - If this is set to ``False`` then the lock will be reentrant across threads. - """ - self._is_thread_local = thread_local - - # Create the context. Note that external code should not work with the context directly and should instead use - # properties of this class. - kwargs: dict[str, Any] = { - "lock_file": os.fspath(lock_file), - "timeout": timeout, - "mode": mode, - } - self._context: FileLockContext = (ThreadLocalFileContext if thread_local else FileLockContext)(**kwargs) - - def is_thread_local(self) -> bool: - """:return: a flag indicating if this lock is thread local or not""" - return self._is_thread_local - - @property - def lock_file(self) -> str: - """:return: path to the lock file""" - return self._context.lock_file - - @property - def timeout(self) -> float: - """ - :return: the default timeout value, in seconds - - .. versionadded:: 2.0.0 - """ - return self._context.timeout - - @timeout.setter - def timeout(self, value: float | str) -> None: - """ - Change the default timeout value. - - :param value: the new value, in seconds - """ - self._context.timeout = float(value) - - @abstractmethod - def _acquire(self) -> None: - """If the file lock could be acquired, self._context.lock_file_fd holds the file descriptor of the lock file.""" - raise NotImplementedError - - @abstractmethod - def _release(self) -> None: - """Releases the lock and sets self._context.lock_file_fd to None.""" - raise NotImplementedError - - @property - def is_locked(self) -> bool: - """ - - :return: A boolean indicating if the lock file is holding the lock currently. - - .. versionchanged:: 2.0.0 - - This was previously a method and is now a property. - """ - return self._context.lock_file_fd is not None - - @property - def lock_counter(self) -> int: - """:return: The number of times this lock has been acquired (but not yet released).""" - return self._context.lock_counter - - def acquire( - self, - timeout: float | None = None, - poll_interval: float = 0.05, - *, - poll_intervall: float | None = None, - blocking: bool = True, - ) -> AcquireReturnProxy: - """ - Try to acquire the file lock. - - :param timeout: maximum wait time for acquiring the lock, ``None`` means use the default :attr:`~timeout` is and - if ``timeout < 0``, there is no timeout and this method will block until the lock could be acquired - :param poll_interval: interval of trying to acquire the lock file - :param poll_intervall: deprecated, kept for backwards compatibility, use ``poll_interval`` instead - :param blocking: defaults to True. If False, function will return immediately if it cannot obtain a lock on the - first attempt. Otherwise, this method will block until the timeout expires or the lock is acquired. - :raises Timeout: if fails to acquire lock within the timeout period - :return: a context object that will unlock the file when the context is exited - - .. code-block:: python - - # You can use this method in the context manager (recommended) - with lock.acquire(): - pass - - # Or use an equivalent try-finally construct: - lock.acquire() - try: - pass - finally: - lock.release() - - .. versionchanged:: 2.0.0 - - This method returns now a *proxy* object instead of *self*, - so that it can be used in a with statement without side effects. - - """ - # Use the default timeout, if no timeout is provided. - if timeout is None: - timeout = self._context.timeout - - if poll_intervall is not None: - msg = "use poll_interval instead of poll_intervall" - warnings.warn(msg, DeprecationWarning, stacklevel=2) - poll_interval = poll_intervall - - # Increment the number right at the beginning. We can still undo it, if something fails. - self._context.lock_counter += 1 - - lock_id = id(self) - lock_filename = self.lock_file - start_time = time.perf_counter() - try: - while True: - if not self.is_locked: - _LOGGER.debug("Attempting to acquire lock %s on %s", lock_id, lock_filename) - self._acquire() - if self.is_locked: - _LOGGER.debug("Lock %s acquired on %s", lock_id, lock_filename) - break - if blocking is False: - _LOGGER.debug("Failed to immediately acquire lock %s on %s", lock_id, lock_filename) - raise Timeout(lock_filename) # noqa: TRY301 - if 0 <= timeout < time.perf_counter() - start_time: - _LOGGER.debug("Timeout on acquiring lock %s on %s", lock_id, lock_filename) - raise Timeout(lock_filename) # noqa: TRY301 - msg = "Lock %s not acquired on %s, waiting %s seconds ..." - _LOGGER.debug(msg, lock_id, lock_filename, poll_interval) - time.sleep(poll_interval) - except BaseException: # Something did go wrong, so decrement the counter. - self._context.lock_counter = max(0, self._context.lock_counter - 1) - raise - return AcquireReturnProxy(lock=self) - - def release(self, force: bool = False) -> None: # noqa: FBT001, FBT002 - """ - Releases the file lock. Please note, that the lock is only completely released, if the lock counter is 0. Also - note, that the lock file itself is not automatically deleted. - - :param force: If true, the lock counter is ignored and the lock is released in every case/ - """ - if self.is_locked: - self._context.lock_counter -= 1 - - if self._context.lock_counter == 0 or force: - lock_id, lock_filename = id(self), self.lock_file - - _LOGGER.debug("Attempting to release lock %s on %s", lock_id, lock_filename) - self._release() - self._context.lock_counter = 0 - _LOGGER.debug("Lock %s released on %s", lock_id, lock_filename) - - def __enter__(self) -> Self: - """ - Acquire the lock. - - :return: the lock object - """ - self.acquire() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - ) -> None: - """ - Release the lock. - - :param exc_type: the exception type if raised - :param exc_value: the exception value if raised - :param traceback: the exception traceback if raised - """ - self.release() - - def __del__(self) -> None: - """Called when the lock object is deleted.""" - self.release(force=True) - - -__all__ = [ - "BaseFileLock", - "AcquireReturnProxy", -] diff --git a/venv/lib/python3.8/site-packages/filelock/_error.py b/venv/lib/python3.8/site-packages/filelock/_error.py deleted file mode 100644 index f7ff08c0f508ad7077eb6ed1990898840c952b3a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock/_error.py +++ /dev/null @@ -1,30 +0,0 @@ -from __future__ import annotations - -from typing import Any - - -class Timeout(TimeoutError): # noqa: N818 - """Raised when the lock could not be acquired in *timeout* seconds.""" - - def __init__(self, lock_file: str) -> None: - super().__init__() - self._lock_file = lock_file - - def __reduce__(self) -> str | tuple[Any, ...]: - return self.__class__, (self._lock_file,) # Properly pickle the exception - - def __str__(self) -> str: - return f"The file lock '{self._lock_file}' could not be acquired." - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({self.lock_file!r})" - - @property - def lock_file(self) -> str: - """:return: The path of the file lock.""" - return self._lock_file - - -__all__ = [ - "Timeout", -] diff --git a/venv/lib/python3.8/site-packages/filelock/_soft.py b/venv/lib/python3.8/site-packages/filelock/_soft.py deleted file mode 100644 index 28c67f74cc82b8f55e47afd6a71972cc1fb95eb6..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock/_soft.py +++ /dev/null @@ -1,47 +0,0 @@ -from __future__ import annotations - -import os -import sys -from contextlib import suppress -from errno import EACCES, EEXIST -from pathlib import Path - -from ._api import BaseFileLock -from ._util import ensure_directory_exists, raise_on_not_writable_file - - -class SoftFileLock(BaseFileLock): - """Simply watches the existence of the lock file.""" - - def _acquire(self) -> None: - raise_on_not_writable_file(self.lock_file) - ensure_directory_exists(self.lock_file) - # first check for exists and read-only mode as the open will mask this case as EEXIST - flags = ( - os.O_WRONLY # open for writing only - | os.O_CREAT - | os.O_EXCL # together with above raise EEXIST if the file specified by filename exists - | os.O_TRUNC # truncate the file to zero byte - ) - try: - file_handler = os.open(self.lock_file, flags, self._context.mode) - except OSError as exception: # re-raise unless expected exception - if not ( - exception.errno == EEXIST # lock already exist - or (exception.errno == EACCES and sys.platform == "win32") # has no access to this lock - ): # pragma: win32 no cover - raise - else: - self._context.lock_file_fd = file_handler - - def _release(self) -> None: - assert self._context.lock_file_fd is not None # noqa: S101 - os.close(self._context.lock_file_fd) # the lock file is definitely not None - self._context.lock_file_fd = None - with suppress(OSError): # the file is already deleted and that's what we want - Path(self.lock_file).unlink() - - -__all__ = [ - "SoftFileLock", -] diff --git a/venv/lib/python3.8/site-packages/filelock/_unix.py b/venv/lib/python3.8/site-packages/filelock/_unix.py deleted file mode 100644 index 93ce3be58fbea2a736072cddb0dc5d6454395cc2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock/_unix.py +++ /dev/null @@ -1,65 +0,0 @@ -from __future__ import annotations - -import os -import sys -from contextlib import suppress -from errno import ENOSYS -from typing import cast - -from ._api import BaseFileLock -from ._util import ensure_directory_exists - -#: a flag to indicate if the fcntl API is available -has_fcntl = False -if sys.platform == "win32": # pragma: win32 cover - - class UnixFileLock(BaseFileLock): - """Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems.""" - - def _acquire(self) -> None: - raise NotImplementedError - - def _release(self) -> None: - raise NotImplementedError - -else: # pragma: win32 no cover - try: - import fcntl - except ImportError: - pass - else: - has_fcntl = True - - class UnixFileLock(BaseFileLock): - """Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems.""" - - def _acquire(self) -> None: - ensure_directory_exists(self.lock_file) - open_flags = os.O_RDWR | os.O_CREAT | os.O_TRUNC - fd = os.open(self.lock_file, open_flags, self._context.mode) - with suppress(PermissionError): # This locked is not owned by this UID - os.fchmod(fd, self._context.mode) - try: - fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) - except OSError as exception: - os.close(fd) - if exception.errno == ENOSYS: # NotImplemented error - msg = "FileSystem does not appear to support flock; user SoftFileLock instead" - raise NotImplementedError(msg) from exception - else: - self._context.lock_file_fd = fd - - def _release(self) -> None: - # Do not remove the lockfile: - # https://github.com/tox-dev/py-filelock/issues/31 - # https://stackoverflow.com/questions/17708885/flock-removing-locked-file-without-race-condition - fd = cast(int, self._context.lock_file_fd) - self._context.lock_file_fd = None - fcntl.flock(fd, fcntl.LOCK_UN) - os.close(fd) - - -__all__ = [ - "has_fcntl", - "UnixFileLock", -] diff --git a/venv/lib/python3.8/site-packages/filelock/_util.py b/venv/lib/python3.8/site-packages/filelock/_util.py deleted file mode 100644 index 543c1394678821cef6bdcbfeb59a545b99d0a7cf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock/_util.py +++ /dev/null @@ -1,47 +0,0 @@ -from __future__ import annotations - -import os -import stat -import sys -from errno import EACCES, EISDIR -from pathlib import Path - - -def raise_on_not_writable_file(filename: str) -> None: - """ - Raise an exception if attempting to open the file for writing would fail. - This is done so files that will never be writable can be separated from - files that are writable but currently locked - :param filename: file to check - :raises OSError: as if the file was opened for writing. - """ - try: # use stat to do exists + can write to check without race condition - file_stat = os.stat(filename) # noqa: PTH116 - except OSError: - return # swallow does not exist or other errors - - if file_stat.st_mtime != 0: # if os.stat returns but modification is zero that's an invalid os.stat - ignore it - if not (file_stat.st_mode & stat.S_IWUSR): - raise PermissionError(EACCES, "Permission denied", filename) - - if stat.S_ISDIR(file_stat.st_mode): - if sys.platform == "win32": # pragma: win32 cover - # On Windows, this is PermissionError - raise PermissionError(EACCES, "Permission denied", filename) - else: # pragma: win32 no cover # noqa: RET506 - # On linux / macOS, this is IsADirectoryError - raise IsADirectoryError(EISDIR, "Is a directory", filename) - - -def ensure_directory_exists(filename: Path | str) -> None: - """ - Ensure the directory containing the file exists (create it if necessary) - :param filename: file. - """ - Path(filename).parent.mkdir(parents=True, exist_ok=True) - - -__all__ = [ - "raise_on_not_writable_file", - "ensure_directory_exists", -] diff --git a/venv/lib/python3.8/site-packages/filelock/_windows.py b/venv/lib/python3.8/site-packages/filelock/_windows.py deleted file mode 100644 index 8db55dcbaa3e7bab091781b17ce22fde1fc239f2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock/_windows.py +++ /dev/null @@ -1,65 +0,0 @@ -from __future__ import annotations - -import os -import sys -from contextlib import suppress -from errno import EACCES -from pathlib import Path -from typing import cast - -from ._api import BaseFileLock -from ._util import ensure_directory_exists, raise_on_not_writable_file - -if sys.platform == "win32": # pragma: win32 cover - import msvcrt - - class WindowsFileLock(BaseFileLock): - """Uses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.""" - - def _acquire(self) -> None: - raise_on_not_writable_file(self.lock_file) - ensure_directory_exists(self.lock_file) - flags = ( - os.O_RDWR # open for read and write - | os.O_CREAT # create file if not exists - | os.O_TRUNC # truncate file if not empty - ) - try: - fd = os.open(self.lock_file, flags, self._context.mode) - except OSError as exception: - if exception.errno != EACCES: # has no access to this lock - raise - else: - try: - msvcrt.locking(fd, msvcrt.LK_NBLCK, 1) - except OSError as exception: - os.close(fd) # close file first - if exception.errno != EACCES: # file is already locked - raise - else: - self._context.lock_file_fd = fd - - def _release(self) -> None: - fd = cast(int, self._context.lock_file_fd) - self._context.lock_file_fd = None - msvcrt.locking(fd, msvcrt.LK_UNLCK, 1) - os.close(fd) - - with suppress(OSError): # Probably another instance of the application hat acquired the file lock. - Path(self.lock_file).unlink() - -else: # pragma: win32 no cover - - class WindowsFileLock(BaseFileLock): - """Uses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.""" - - def _acquire(self) -> None: - raise NotImplementedError - - def _release(self) -> None: - raise NotImplementedError - - -__all__ = [ - "WindowsFileLock", -] diff --git a/venv/lib/python3.8/site-packages/filelock/py.typed b/venv/lib/python3.8/site-packages/filelock/py.typed deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/filelock/version.py b/venv/lib/python3.8/site-packages/filelock/version.py deleted file mode 100644 index 23c19a10e0ab8f0f2eeeab0e656b2d868837d450..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/filelock/version.py +++ /dev/null @@ -1,4 +0,0 @@ -# file generated by setuptools_scm -# don't change, don't track in version control -__version__ = version = '3.12.4' -__version_tuple__ = version_tuple = (3, 12, 4) diff --git a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/LICENSE b/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/LICENSE deleted file mode 100644 index 67590a5e5be5a5a2dde3fe53a7512e404a896c22..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2018, Martin Durant -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/METADATA b/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/METADATA deleted file mode 100644 index 06908bdae5219819dd421fd1ddcd2786372a9607..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/METADATA +++ /dev/null @@ -1,167 +0,0 @@ -Metadata-Version: 2.1 -Name: fsspec -Version: 2023.9.2 -Summary: File-system specification -Home-page: https://github.com/fsspec/filesystem_spec -Maintainer: Martin Durant -Maintainer-email: mdurant@anaconda.com -License: BSD -Project-URL: Changelog, https://filesystem-spec.readthedocs.io/en/latest/changelog.html -Project-URL: Documentation, https://filesystem-spec.readthedocs.io/en/latest/ -Keywords: file -Classifier: Development Status :: 4 - Beta -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Requires-Python: >=3.8 -Description-Content-Type: text/markdown -License-File: LICENSE -Provides-Extra: abfs -Requires-Dist: adlfs ; extra == 'abfs' -Provides-Extra: adl -Requires-Dist: adlfs ; extra == 'adl' -Provides-Extra: arrow -Requires-Dist: pyarrow (>=1) ; extra == 'arrow' -Provides-Extra: dask -Requires-Dist: dask ; extra == 'dask' -Requires-Dist: distributed ; extra == 'dask' -Provides-Extra: devel -Requires-Dist: pytest ; extra == 'devel' -Requires-Dist: pytest-cov ; extra == 'devel' -Provides-Extra: dropbox -Requires-Dist: dropboxdrivefs ; extra == 'dropbox' -Requires-Dist: requests ; extra == 'dropbox' -Requires-Dist: dropbox ; extra == 'dropbox' -Provides-Extra: entrypoints -Provides-Extra: full -Requires-Dist: adlfs ; extra == 'full' -Requires-Dist: aiohttp (!=4.0.0a0,!=4.0.0a1) ; extra == 'full' -Requires-Dist: dask ; extra == 'full' -Requires-Dist: distributed ; extra == 'full' -Requires-Dist: dropbox ; extra == 'full' -Requires-Dist: dropboxdrivefs ; extra == 'full' -Requires-Dist: fusepy ; extra == 'full' -Requires-Dist: gcsfs ; extra == 'full' -Requires-Dist: libarchive-c ; extra == 'full' -Requires-Dist: ocifs ; extra == 'full' -Requires-Dist: panel ; extra == 'full' -Requires-Dist: paramiko ; extra == 'full' -Requires-Dist: pyarrow (>=1) ; extra == 'full' -Requires-Dist: pygit2 ; extra == 'full' -Requires-Dist: requests ; extra == 'full' -Requires-Dist: s3fs ; extra == 'full' -Requires-Dist: smbprotocol ; extra == 'full' -Requires-Dist: tqdm ; extra == 'full' -Provides-Extra: fuse -Requires-Dist: fusepy ; extra == 'fuse' -Provides-Extra: gcs -Requires-Dist: gcsfs ; extra == 'gcs' -Provides-Extra: git -Requires-Dist: pygit2 ; extra == 'git' -Provides-Extra: github -Requires-Dist: requests ; extra == 'github' -Provides-Extra: gs -Requires-Dist: gcsfs ; extra == 'gs' -Provides-Extra: gui -Requires-Dist: panel ; extra == 'gui' -Provides-Extra: hdfs -Requires-Dist: pyarrow (>=1) ; extra == 'hdfs' -Provides-Extra: http -Requires-Dist: requests ; extra == 'http' -Requires-Dist: aiohttp (!=4.0.0a0,!=4.0.0a1) ; extra == 'http' -Provides-Extra: libarchive -Requires-Dist: libarchive-c ; extra == 'libarchive' -Provides-Extra: oci -Requires-Dist: ocifs ; extra == 'oci' -Provides-Extra: s3 -Requires-Dist: s3fs ; extra == 's3' -Provides-Extra: sftp -Requires-Dist: paramiko ; extra == 'sftp' -Provides-Extra: smb -Requires-Dist: smbprotocol ; extra == 'smb' -Provides-Extra: ssh -Requires-Dist: paramiko ; extra == 'ssh' -Provides-Extra: tqdm -Requires-Dist: tqdm ; extra == 'tqdm' - -# filesystem_spec - -[![PyPI version](https://badge.fury.io/py/fsspec.svg)](https://pypi.python.org/pypi/fsspec/) -[![Anaconda-Server Badge](https://anaconda.org/conda-forge/fsspec/badges/version.svg)](https://anaconda.org/conda-forge/fsspec) -![Build](https://github.com/fsspec/filesystem_spec/workflows/CI/badge.svg) -[![Docs](https://readthedocs.org/projects/filesystem-spec/badge/?version=latest)](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest) - -A specification for pythonic filesystems. - -## Install - -```bash -pip install fsspec -``` - -would install the base fsspec. Various optionally supported features might require specification of custom -extra require, e.g. `pip install fsspec[ssh]` will install dependencies for `ssh` backends support. -Use `pip install fsspec[full]` for installation of all known extra dependencies. - -Up-to-date package also provided through conda-forge distribution: - -```bash -conda install -c conda-forge fsspec -``` - - -## Purpose - -To produce a template or specification for a file-system interface, that specific implementations should follow, -so that applications making use of them can rely on a common behaviour and not have to worry about the specific -internal implementation decisions with any given backend. Many such implementations are included in this package, -or in sister projects such as `s3fs` and `gcsfs`. - -In addition, if this is well-designed, then additional functionality, such as a key-value store or FUSE -mounting of the file-system implementation may be available for all implementations "for free". - -## Documentation - -Please refer to [RTD](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest) - -## Develop - -fsspec uses GitHub Actions for CI. Environment files can be found -in the "ci/" directory. Note that the main environment is called "py38", -but it is expected that the version of python installed be adjustable at -CI runtime. For local use, pick a version suitable for you. - -### Testing - -Tests can be run in the dev environment, if activated, via ``pytest fsspec``. - -The full fsspec suite requires a system-level docker, docker-compose, and fuse -installation. If only making changes to one backend implementation, it is -not generally necessary to run all tests locally. - -It is expected that contributors ensure that any change to fsspec does not -cause issues or regressions for either other fsspec-related packages such -as gcsfs and s3fs, nor for downstream users of fsspec. The "downstream" CI -run and corresponding environment file run a set of tests from the dask -test suite, and very minimal tests against pandas and zarr from the -test_downstream.py module in this repo. - -### Code Formatting - -fsspec uses [Black](https://black.readthedocs.io/en/stable) to ensure -a consistent code format throughout the project. -Run ``black fsspec`` from the root of the filesystem_spec repository to -auto-format your code. Additionally, many editors have plugins that will apply -``black`` as you edit files. ``black`` is included in the ``tox`` environments. - -Optionally, you may wish to setup [pre-commit hooks](https://pre-commit.com) to -automatically run ``black`` when you make a git commit. -Run ``pre-commit install --install-hooks`` from the root of the -filesystem_spec repository to setup pre-commit hooks. ``black`` will now be run -before you commit, reformatting any changed files. You can format without -committing via ``pre-commit run`` or skip these checks with ``git commit ---no-verify``. diff --git a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/RECORD b/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/RECORD deleted file mode 100644 index caa7341876d1fbaa40ee528d29610c39fd14fe03..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/RECORD +++ /dev/null @@ -1,104 +0,0 @@ -fsspec-2023.9.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -fsspec-2023.9.2.dist-info/LICENSE,sha256=LcNUls5TpzB5FcAIqESq1T53K0mzTN0ARFBnaRQH7JQ,1513 -fsspec-2023.9.2.dist-info/METADATA,sha256=RAdSuAwvyZcIrCRlumxUl7F7ozke8-HGy-makwhlnzw,6711 -fsspec-2023.9.2.dist-info/RECORD,, -fsspec-2023.9.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92 -fsspec-2023.9.2.dist-info/top_level.txt,sha256=blt2pDrQDwN3Gklcw13CSPLQRd6aaOgJ8AxqrW395MI,7 -fsspec/__init__.py,sha256=vbKs09bNlgkk-bfKZOzzvAVJ2-cYNvrmN07R48344F4,1800 -fsspec/__pycache__/__init__.cpython-38.pyc,, -fsspec/__pycache__/_version.cpython-38.pyc,, -fsspec/__pycache__/archive.cpython-38.pyc,, -fsspec/__pycache__/asyn.cpython-38.pyc,, -fsspec/__pycache__/caching.cpython-38.pyc,, -fsspec/__pycache__/callbacks.cpython-38.pyc,, -fsspec/__pycache__/compression.cpython-38.pyc,, -fsspec/__pycache__/config.cpython-38.pyc,, -fsspec/__pycache__/conftest.cpython-38.pyc,, -fsspec/__pycache__/core.cpython-38.pyc,, -fsspec/__pycache__/dircache.cpython-38.pyc,, -fsspec/__pycache__/exceptions.cpython-38.pyc,, -fsspec/__pycache__/fuse.cpython-38.pyc,, -fsspec/__pycache__/generic.cpython-38.pyc,, -fsspec/__pycache__/gui.cpython-38.pyc,, -fsspec/__pycache__/mapping.cpython-38.pyc,, -fsspec/__pycache__/parquet.cpython-38.pyc,, -fsspec/__pycache__/registry.cpython-38.pyc,, -fsspec/__pycache__/spec.cpython-38.pyc,, -fsspec/__pycache__/transaction.cpython-38.pyc,, -fsspec/__pycache__/utils.cpython-38.pyc,, -fsspec/_version.py,sha256=K9BhdYRHxLOa4-qJTPkOakIMP8a2Vq4dNRhbxLXV2QI,500 -fsspec/archive.py,sha256=FSbEj8w26fcCfuQjQZ_GMLQy5-O5M_KrZkrEdsksato,2406 -fsspec/asyn.py,sha256=6djXIMTdRmke1AxcFsw8QXJWrmYflaSUOq4i_NBnS_M,36593 -fsspec/caching.py,sha256=WsqzBZXVHnAmGaVPKkovsC8siBHpVg7o9NLotKKHqAw,26365 -fsspec/callbacks.py,sha256=qmD1v-WWxWmTmcUkEadq-_F_n3OGp9JYarjupUq_j3o,6358 -fsspec/compression.py,sha256=-A_TjrGys1jSBQ1IPoPWOdE6X8HJHOSUv94rEvBj9_4,4905 -fsspec/config.py,sha256=LF4Zmu1vhJW7Je9Q-cwkRc3xP7Rhyy7Xnwj26Z6sv2g,4279 -fsspec/conftest.py,sha256=fVfx-NLrH_OZS1TIpYNoPzM7efEcMoL62reHOdYeFCA,1245 -fsspec/core.py,sha256=zEj9l3wJJQGsAmqQ1FcaPJKfZOjaUE-VYpZ0xf62U6Y,22041 -fsspec/dircache.py,sha256=YzogWJrhEastHU7vWz-cJiJ7sdtLXFXhEpInGKd4EcM,2717 -fsspec/exceptions.py,sha256=s5eA2wIwzj-aeV0i_KDXsBaIhJJRKzmMGUGwuBHTnS4,348 -fsspec/fuse.py,sha256=VnXybwERLONVTgqTTi2ZLVwa2_CzORkRPJG3aHZgAEw,10187 -fsspec/generic.py,sha256=DfRoESTne-DejjV_4VwYJlTqFECYikNIf9brwWp9wsU,13269 -fsspec/gui.py,sha256=hb01x41jL5kmGbnnMtBXMuu_W8dRG4hulCcmdpbOcZg,13880 -fsspec/implementations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -fsspec/implementations/__pycache__/__init__.cpython-38.pyc,, -fsspec/implementations/__pycache__/arrow.cpython-38.pyc,, -fsspec/implementations/__pycache__/cache_mapper.cpython-38.pyc,, -fsspec/implementations/__pycache__/cache_metadata.cpython-38.pyc,, -fsspec/implementations/__pycache__/cached.cpython-38.pyc,, -fsspec/implementations/__pycache__/dask.cpython-38.pyc,, -fsspec/implementations/__pycache__/dbfs.cpython-38.pyc,, -fsspec/implementations/__pycache__/dirfs.cpython-38.pyc,, -fsspec/implementations/__pycache__/ftp.cpython-38.pyc,, -fsspec/implementations/__pycache__/git.cpython-38.pyc,, -fsspec/implementations/__pycache__/github.cpython-38.pyc,, -fsspec/implementations/__pycache__/http.cpython-38.pyc,, -fsspec/implementations/__pycache__/http_sync.cpython-38.pyc,, -fsspec/implementations/__pycache__/jupyter.cpython-38.pyc,, -fsspec/implementations/__pycache__/libarchive.cpython-38.pyc,, -fsspec/implementations/__pycache__/local.cpython-38.pyc,, -fsspec/implementations/__pycache__/memory.cpython-38.pyc,, -fsspec/implementations/__pycache__/reference.cpython-38.pyc,, -fsspec/implementations/__pycache__/sftp.cpython-38.pyc,, -fsspec/implementations/__pycache__/smb.cpython-38.pyc,, -fsspec/implementations/__pycache__/tar.cpython-38.pyc,, -fsspec/implementations/__pycache__/webhdfs.cpython-38.pyc,, -fsspec/implementations/__pycache__/zip.cpython-38.pyc,, -fsspec/implementations/arrow.py,sha256=1d-c5KceQJxm8QXML8fFXHvQx0wstG-tNJNsrgMX_CI,8240 -fsspec/implementations/cache_mapper.py,sha256=nE_sY3vw-jJbeBcAP6NGtacP3jHW_7EcG3yUSf0A-4Y,2502 -fsspec/implementations/cache_metadata.py,sha256=ZvyA7Y3KK-5Ct4E5pELzD6mH_5T03XqaKVT96qYDADU,8576 -fsspec/implementations/cached.py,sha256=ei5j6Ll5NKwWw_XN8L50kGdmIg63jKGXBYl6j51JfFk,27427 -fsspec/implementations/dask.py,sha256=CXZbJzIVOhKV8ILcxuy3bTvcacCueAbyQxmvAkbPkrk,4466 -fsspec/implementations/dbfs.py,sha256=0ndCE2OQqrWv6Y8ETufxOQ9ymIIO2JA_Q82bnilqTaw,14660 -fsspec/implementations/dirfs.py,sha256=8EEgKin5JgFBqzHaKig7ipiFAZJvbChUX_vpC_jagoY,11136 -fsspec/implementations/ftp.py,sha256=4oAragG80N75O78vVBWVIE1bPB1SGPnw_c7jFNOljsk,11463 -fsspec/implementations/git.py,sha256=Sn96xSjXAl1aA-Gf1DByTd23tiObqv-uAQGc_mryiEw,4034 -fsspec/implementations/github.py,sha256=1d7L22BococztJHKFZvzwvUQZ2cqcBHLhH-4tEDoL0A,7328 -fsspec/implementations/http.py,sha256=73aOFG_e5lEMCOGDebEGm1V8ejIk76nqqxfZHnE9DDk,30068 -fsspec/implementations/http_sync.py,sha256=mWHICWqhAqX-WSfdQeWKY5xfhekkVlx3qEl9bY1Y_yA,28555 -fsspec/implementations/jupyter.py,sha256=maOaSOcu3lXI45KCfS3KWkVcM2EZJJjNSICQCXupLK0,3816 -fsspec/implementations/libarchive.py,sha256=gt3MVqMN36kAeq01SYfMoJUc7rSCdIx2RQuqkbU3G2Y,7182 -fsspec/implementations/local.py,sha256=dXnZgjjc4wz5ndIRWREh_DzwY_m5qWhPXFFlRhHdWt8,13146 -fsspec/implementations/memory.py,sha256=4llvIMyQre_Pr63HFLOYliEJavRWCpHevMKVHyXzPpw,9698 -fsspec/implementations/reference.py,sha256=3rFxJjLaybO2d7hK8G9K3z2wze9hihLO_dWpTp5ewUs,40765 -fsspec/implementations/sftp.py,sha256=W94CEardmBsiDy8NmH_oo__LNoNKT3CLFsFr0gWac68,5571 -fsspec/implementations/smb.py,sha256=SGGyT1zTIjoSrELuR4A3ZhNCiieqv8C-b2CTRVC040M,10625 -fsspec/implementations/tar.py,sha256=5ZpUp4E3SYbqrwAX2ezvZJqUoZO74Pjb9FpF8o1YBGs,4071 -fsspec/implementations/webhdfs.py,sha256=kJ_gya30beO5fEwlNi8G8CyuZJpfIQ1oe1jOxgF6RjQ,15391 -fsspec/implementations/zip.py,sha256=p_WG-uapYOF_t6hwRfg32aLLkDZ7k9GWkEed-9E218Y,4150 -fsspec/mapping.py,sha256=xr0JkYBf-wwzJcrBi7QIi2dyuZKFD6NWo5UVUHa61BU,8166 -fsspec/parquet.py,sha256=i4H3EU3K1Q6jp8sqjFji6a6gKnlOEZufaa7DRNE5X-4,19516 -fsspec/registry.py,sha256=cOxTT6MpRBif2AeW1x3tWsxYvZBHBsxEwYGNADBBxSM,11012 -fsspec/spec.py,sha256=KqH2YhgleKcBE7WMg1W0QOvK8biFICEYIzidQH4TQao,66742 -fsspec/tests/abstract/__init__.py,sha256=i1wcFixV6QhOwdoB24c8oXjzobISNqiKVz9kl2DvAY8,10028 -fsspec/tests/abstract/__pycache__/__init__.cpython-38.pyc,, -fsspec/tests/abstract/__pycache__/common.cpython-38.pyc,, -fsspec/tests/abstract/__pycache__/copy.cpython-38.pyc,, -fsspec/tests/abstract/__pycache__/get.cpython-38.pyc,, -fsspec/tests/abstract/__pycache__/put.cpython-38.pyc,, -fsspec/tests/abstract/common.py,sha256=X1ijH_pdMc9uVpZtgGj1P-2Zj9VIY-Y0tG3u1vTGcpE,4963 -fsspec/tests/abstract/copy.py,sha256=nyCp1Q9apHzti2_UPDh3HzVhRmV7dciD-3dq-wM7JuU,19643 -fsspec/tests/abstract/get.py,sha256=vNR4HztvTR7Cj56AMo7_tx7TeYz1Jgr_2Wb8Lv-UiBY,20755 -fsspec/tests/abstract/put.py,sha256=hEf-yuMWBOT7B6eWcck3tMyJWzdVXtxkY-O6LUt1KAE,20877 -fsspec/transaction.py,sha256=gNcyHtN1mzdazsGyhDadWsR_E9WyCr3S9OypBQGpp2s,2179 -fsspec/utils.py,sha256=8ste5YfMzOx-DEgKo8jAiGnrFWZkpaboarpMlBGzB3Y,17434 diff --git a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/WHEEL b/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/WHEEL deleted file mode 100644 index 57e3d840d59a650ac5bccbad5baeec47d155f0ad..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.38.4) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/top_level.txt deleted file mode 100644 index 968fea66e533ba30593c7fbfe750c36fae2f3cfe..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec-2023.9.2.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -fsspec diff --git a/venv/lib/python3.8/site-packages/fsspec/__init__.py b/venv/lib/python3.8/site-packages/fsspec/__init__.py deleted file mode 100644 index 301fead45c765c60e2e27f07eb174a2675d6f554..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -from importlib.metadata import entry_points - -from . import _version, caching -from .callbacks import Callback -from .compression import available_compressions -from .core import get_fs_token_paths, open, open_files, open_local -from .exceptions import FSTimeoutError -from .mapping import FSMap, get_mapper -from .registry import ( - available_protocols, - filesystem, - get_filesystem_class, - register_implementation, - registry, -) -from .spec import AbstractFileSystem - -__version__ = _version.get_versions()["version"] - -__all__ = [ - "AbstractFileSystem", - "FSTimeoutError", - "FSMap", - "filesystem", - "register_implementation", - "get_filesystem_class", - "get_fs_token_paths", - "get_mapper", - "open", - "open_files", - "open_local", - "registry", - "caching", - "Callback", - "available_protocols", - "available_compressions", -] - - -def process_entries(): - if entry_points is not None: - try: - eps = entry_points() - except TypeError: - pass # importlib-metadata < 0.8 - else: - if hasattr(eps, "select"): # Python 3.10+ / importlib_metadata >= 3.9.0 - specs = eps.select(group="fsspec.specs") - else: - specs = eps.get("fsspec.specs", []) - for spec in specs: - err_msg = f"Unable to load filesystem from {spec}" - register_implementation( - spec.name, - spec.value.replace(":", "."), - errtxt=err_msg, - # We take our implementations as the ones to overload with if - # for some reason we encounter some, may be the same, already - # registered - clobber=True, - ) - - -process_entries() diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 40aca46dd747fd98d603deea8825d29434744ef7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/_version.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/_version.cpython-38.pyc deleted file mode 100644 index d697fd8ae3297cffb00ee21bed789f657fdbd51f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/_version.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/archive.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/archive.cpython-38.pyc deleted file mode 100644 index 7c37ce9eec47fac94cb91cdd12ff6a445cbf5b5b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/archive.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/asyn.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/asyn.cpython-38.pyc deleted file mode 100644 index 7b214d26ba1a0c4b4cf2f8600dd3297c626d3b95..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/asyn.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/caching.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/caching.cpython-38.pyc deleted file mode 100644 index 10e909d27e2682b0466f0d7c771c90b9465431b3..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/caching.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/callbacks.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/callbacks.cpython-38.pyc deleted file mode 100644 index 7a2b9e7ff7083afd9cfbb39d53c5ae89389d309e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/callbacks.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/compression.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/compression.cpython-38.pyc deleted file mode 100644 index e10d15449d05744ee419ca07ed4301f37ad3ecfb..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/compression.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/config.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/config.cpython-38.pyc deleted file mode 100644 index afb98d63c7b2cccc71a302af924b46c515cd5910..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/config.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/conftest.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/conftest.cpython-38.pyc deleted file mode 100644 index cc78feaa254c742be604191d4eed2604cb21962e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/conftest.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/core.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/core.cpython-38.pyc deleted file mode 100644 index fd6f4b65eb960a48c0b8e86ce52ca7a0358cf9b4..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/core.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/dircache.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/dircache.cpython-38.pyc deleted file mode 100644 index 64dc7e524f9e063d20a14b106a7cce2e2f013fff..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/dircache.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/exceptions.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/exceptions.cpython-38.pyc deleted file mode 100644 index bf818477fb51b8929286dc5915fe32b69458de8b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/exceptions.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/fuse.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/fuse.cpython-38.pyc deleted file mode 100644 index e88b7d455d5bbfca44652dd9e1e60a6c1062028c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/fuse.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/generic.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/generic.cpython-38.pyc deleted file mode 100644 index 77525c3222fcc17400c5b7e0aa07f5b67d4ec8a7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/generic.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/gui.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/gui.cpython-38.pyc deleted file mode 100644 index 37d29d0d1e943e83d43ec61f459a2da5526e8a29..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/gui.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/mapping.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/mapping.cpython-38.pyc deleted file mode 100644 index 187c0fd8f58f39bfbb90b09c7e1a75953ff5de22..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/mapping.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/parquet.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/parquet.cpython-38.pyc deleted file mode 100644 index 9598b75a54518fb7f8c090ad70b45b201cebab94..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/parquet.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/registry.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/registry.cpython-38.pyc deleted file mode 100644 index 813122795fe8c8077f709a25c46320fc0313615f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/registry.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/spec.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/spec.cpython-38.pyc deleted file mode 100644 index 8f8af8a384d61d567f5831ab81913f3224725852..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/spec.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/transaction.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/transaction.cpython-38.pyc deleted file mode 100644 index 3ae6cd3d08d6dd2e9d573e5cc972a5ea8120b5a7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/transaction.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/__pycache__/utils.cpython-38.pyc deleted file mode 100644 index 42be8965369b6ccb51376b23cc9d3d8dd999d43d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/__pycache__/utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/_version.py b/venv/lib/python3.8/site-packages/fsspec/_version.py deleted file mode 100644 index ed9907d764d33da040cf4552bcce6417fc2bbb74..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/_version.py +++ /dev/null @@ -1,21 +0,0 @@ - -# This file was generated by 'versioneer.py' (0.20) from -# revision-control system data, or from the parent directory name of an -# unpacked source archive. Distribution tarballs contain a pre-generated copy -# of this file. - -import json - -version_json = ''' -{ - "date": "2023-09-22T14:30:26-0400", - "dirty": false, - "error": null, - "full-revisionid": "3ad74814c8bd8620b3aa434080218eb658a81a6c", - "version": "2023.9.2" -} -''' # END VERSION_JSON - - -def get_versions(): - return json.loads(version_json) diff --git a/venv/lib/python3.8/site-packages/fsspec/archive.py b/venv/lib/python3.8/site-packages/fsspec/archive.py deleted file mode 100644 index dc5c1490b972c592fd3eb9aaeb30b589e384ccb7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/archive.py +++ /dev/null @@ -1,73 +0,0 @@ -from fsspec import AbstractFileSystem -from fsspec.utils import tokenize - - -class AbstractArchiveFileSystem(AbstractFileSystem): - """ - A generic superclass for implementing Archive-based filesystems. - - Currently, it is shared amongst - :class:`~fsspec.implementations.zip.ZipFileSystem`, - :class:`~fsspec.implementations.libarchive.LibArchiveFileSystem` and - :class:`~fsspec.implementations.tar.TarFileSystem`. - """ - - def __str__(self): - return "" % (type(self).__name__, id(self)) - - __repr__ = __str__ - - def ukey(self, path): - return tokenize(path, self.fo, self.protocol) - - def _all_dirnames(self, paths): - """Returns *all* directory names for each path in paths, including intermediate - ones. - - Parameters - ---------- - paths: Iterable of path strings - """ - if len(paths) == 0: - return set() - - dirnames = {self._parent(path) for path in paths} - {self.root_marker} - return dirnames | self._all_dirnames(dirnames) - - def info(self, path, **kwargs): - self._get_dirs() - path = self._strip_protocol(path) - if path in {"", "/"} and self.dir_cache: - return {"name": "/", "type": "directory", "size": 0} - if path in self.dir_cache: - return self.dir_cache[path] - elif path + "/" in self.dir_cache: - return self.dir_cache[path + "/"] - else: - raise FileNotFoundError(path) - - def ls(self, path, detail=True, **kwargs): - self._get_dirs() - paths = {} - for p, f in self.dir_cache.items(): - p = p.rstrip("/") - if "/" in p: - root = p.rsplit("/", 1)[0] - else: - root = "" - if root == path.rstrip("/"): - paths[p] = f - elif all( - (a == b) - for a, b in zip(path.split("/"), [""] + p.strip("/").split("/")) - ): - # root directory entry - ppath = p.rstrip("/").split("/", 1)[0] - if ppath not in paths: - out = {"name": ppath + "/", "size": 0, "type": "directory"} - paths[ppath] = out - out = sorted(paths.values(), key=lambda _: _["name"]) - if detail: - return out - else: - return [f["name"] for f in out] diff --git a/venv/lib/python3.8/site-packages/fsspec/asyn.py b/venv/lib/python3.8/site-packages/fsspec/asyn.py deleted file mode 100644 index 347e262ad054a6d5c06c85c894c873b58b340c00..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/asyn.py +++ /dev/null @@ -1,1091 +0,0 @@ -import asyncio -import asyncio.events -import functools -import inspect -import io -import numbers -import os -import re -import threading -from contextlib import contextmanager -from glob import has_magic -from typing import TYPE_CHECKING, Iterable - -from .callbacks import _DEFAULT_CALLBACK -from .exceptions import FSTimeoutError -from .implementations.local import LocalFileSystem, make_path_posix, trailing_sep -from .spec import AbstractBufferedFile, AbstractFileSystem -from .utils import is_exception, other_paths - -private = re.compile("_[^_]") -iothread = [None] # dedicated fsspec IO thread -loop = [None] # global event loop for any non-async instance -_lock = None # global lock placeholder -get_running_loop = asyncio.get_running_loop - - -def get_lock(): - """Allocate or return a threading lock. - - The lock is allocated on first use to allow setting one lock per forked process. - """ - global _lock - if not _lock: - _lock = threading.Lock() - return _lock - - -def reset_lock(): - """Reset the global lock. - - This should be called only on the init of a forked process to reset the lock to - None, enabling the new forked process to get a new lock. - """ - global _lock - - iothread[0] = None - loop[0] = None - _lock = None - - -async def _runner(event, coro, result, timeout=None): - timeout = timeout if timeout else None # convert 0 or 0.0 to None - if timeout is not None: - coro = asyncio.wait_for(coro, timeout=timeout) - try: - result[0] = await coro - except Exception as ex: - result[0] = ex - finally: - event.set() - - -def sync(loop, func, *args, timeout=None, **kwargs): - """ - Make loop run coroutine until it returns. Runs in other thread - - Examples - -------- - >>> fsspec.asyn.sync(fsspec.asyn.get_loop(), func, *args, - timeout=timeout, **kwargs) - """ - timeout = timeout if timeout else None # convert 0 or 0.0 to None - # NB: if the loop is not running *yet*, it is OK to submit work - # and we will wait for it - if loop is None or loop.is_closed(): - raise RuntimeError("Loop is not running") - try: - loop0 = asyncio.events.get_running_loop() - if loop0 is loop: - raise NotImplementedError("Calling sync() from within a running loop") - except NotImplementedError: - raise - except RuntimeError: - pass - coro = func(*args, **kwargs) - result = [None] - event = threading.Event() - asyncio.run_coroutine_threadsafe(_runner(event, coro, result, timeout), loop) - while True: - # this loops allows thread to get interrupted - if event.wait(1): - break - if timeout is not None: - timeout -= 1 - if timeout < 0: - raise FSTimeoutError - - return_result = result[0] - if isinstance(return_result, asyncio.TimeoutError): - # suppress asyncio.TimeoutError, raise FSTimeoutError - raise FSTimeoutError from return_result - elif isinstance(return_result, BaseException): - raise return_result - else: - return return_result - - -def sync_wrapper(func, obj=None): - """Given a function, make so can be called in async or blocking contexts - - Leave obj=None if defining within a class. Pass the instance if attaching - as an attribute of the instance. - """ - - @functools.wraps(func) - def wrapper(*args, **kwargs): - self = obj or args[0] - return sync(self.loop, func, *args, **kwargs) - - return wrapper - - -@contextmanager -def _selector_policy(): - original_policy = asyncio.get_event_loop_policy() - try: - if os.name == "nt" and hasattr(asyncio, "WindowsSelectorEventLoopPolicy"): - asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) - - yield - finally: - asyncio.set_event_loop_policy(original_policy) - - -def get_loop(): - """Create or return the default fsspec IO loop - - The loop will be running on a separate thread. - """ - if loop[0] is None: - with get_lock(): - # repeat the check just in case the loop got filled between the - # previous two calls from another thread - if loop[0] is None: - with _selector_policy(): - loop[0] = asyncio.new_event_loop() - th = threading.Thread(target=loop[0].run_forever, name="fsspecIO") - th.daemon = True - th.start() - iothread[0] = th - return loop[0] - - -if TYPE_CHECKING: - import resource - - ResourceError = resource.error -else: - try: - import resource - except ImportError: - resource = None - ResourceError = OSError - else: - ResourceError = getattr(resource, "error", OSError) - -_DEFAULT_BATCH_SIZE = 128 -_NOFILES_DEFAULT_BATCH_SIZE = 1280 - - -def _get_batch_size(nofiles=False): - from fsspec.config import conf - - if nofiles: - if "nofiles_gather_batch_size" in conf: - return conf["nofiles_gather_batch_size"] - else: - if "gather_batch_size" in conf: - return conf["gather_batch_size"] - if nofiles: - return _NOFILES_DEFAULT_BATCH_SIZE - if resource is None: - return _DEFAULT_BATCH_SIZE - - try: - soft_limit, _ = resource.getrlimit(resource.RLIMIT_NOFILE) - except (ImportError, ValueError, ResourceError): - return _DEFAULT_BATCH_SIZE - - if soft_limit == resource.RLIM_INFINITY: - return -1 - else: - return soft_limit // 8 - - -def running_async() -> bool: - """Being executed by an event loop?""" - try: - asyncio.get_running_loop() - return True - except RuntimeError: - return False - - -async def _run_coros_in_chunks( - coros, - batch_size=None, - callback=_DEFAULT_CALLBACK, - timeout=None, - return_exceptions=False, - nofiles=False, -): - """Run the given coroutines in chunks. - - Parameters - ---------- - coros: list of coroutines to run - batch_size: int or None - Number of coroutines to submit/wait on simultaneously. - If -1, then it will not be any throttling. If - None, it will be inferred from _get_batch_size() - callback: fsspec.callbacks.Callback instance - Gets a relative_update when each coroutine completes - timeout: number or None - If given, each coroutine times out after this time. Note that, since - there are multiple batches, the total run time of this function will in - general be longer - return_exceptions: bool - Same meaning as in asyncio.gather - nofiles: bool - If inferring the batch_size, does this operation involve local files? - If yes, you normally expect smaller batches. - """ - - if batch_size is None: - batch_size = _get_batch_size(nofiles=nofiles) - - if batch_size == -1: - batch_size = len(coros) - - assert batch_size > 0 - results = [] - for start in range(0, len(coros), batch_size): - chunk = [ - asyncio.Task(asyncio.wait_for(c, timeout=timeout)) - for c in coros[start : start + batch_size] - ] - if callback is not _DEFAULT_CALLBACK: - [ - t.add_done_callback(lambda *_, **__: callback.relative_update(1)) - for t in chunk - ] - results.extend( - await asyncio.gather(*chunk, return_exceptions=return_exceptions), - ) - return results - - -# these methods should be implemented as async by any async-able backend -async_methods = [ - "_ls", - "_cat_file", - "_get_file", - "_put_file", - "_rm_file", - "_cp_file", - "_pipe_file", - "_expand_path", - "_info", - "_isfile", - "_isdir", - "_exists", - "_walk", - "_glob", - "_find", - "_du", - "_size", - "_mkdir", - "_makedirs", -] - - -class AsyncFileSystem(AbstractFileSystem): - """Async file operations, default implementations - - Passes bulk operations to asyncio.gather for concurrent operation. - - Implementations that have concurrent batch operations and/or async methods - should inherit from this class instead of AbstractFileSystem. Docstrings are - copied from the un-underscored method in AbstractFileSystem, if not given. - """ - - # note that methods do not have docstring here; they will be copied - # for _* methods and inferred for overridden methods. - - async_impl = True - mirror_sync_methods = True - disable_throttling = False - - def __init__(self, *args, asynchronous=False, loop=None, batch_size=None, **kwargs): - self.asynchronous = asynchronous - self._pid = os.getpid() - if not asynchronous: - self._loop = loop or get_loop() - else: - self._loop = None - self.batch_size = batch_size - super().__init__(*args, **kwargs) - - @property - def loop(self): - if self._pid != os.getpid(): - raise RuntimeError("This class is not fork-safe") - return self._loop - - async def _rm_file(self, path, **kwargs): - raise NotImplementedError - - async def _rm(self, path, recursive=False, batch_size=None, **kwargs): - # TODO: implement on_error - batch_size = batch_size or self.batch_size - path = await self._expand_path(path, recursive=recursive) - return await _run_coros_in_chunks( - [self._rm_file(p, **kwargs) for p in reversed(path)], - batch_size=batch_size, - nofiles=True, - ) - - async def _cp_file(self, path1, path2, **kwargs): - raise NotImplementedError - - async def _copy( - self, - path1, - path2, - recursive=False, - on_error=None, - maxdepth=None, - batch_size=None, - **kwargs, - ): - if on_error is None and recursive: - on_error = "ignore" - elif on_error is None: - on_error = "raise" - - if isinstance(path1, list) and isinstance(path2, list): - # No need to expand paths when both source and destination - # are provided as lists - paths1 = path1 - paths2 = path2 - else: - source_is_str = isinstance(path1, str) - paths1 = await self._expand_path( - path1, maxdepth=maxdepth, recursive=recursive - ) - if source_is_str and (not recursive or maxdepth is not None): - # Non-recursive glob does not copy directories - paths1 = [ - p for p in paths1 if not (trailing_sep(p) or await self._isdir(p)) - ] - if not paths1: - return - - source_is_file = len(paths1) == 1 - dest_is_dir = isinstance(path2, str) and ( - trailing_sep(path2) or await self._isdir(path2) - ) - - exists = source_is_str and ( - (has_magic(path1) and source_is_file) - or (not has_magic(path1) and dest_is_dir and not trailing_sep(path1)) - ) - paths2 = other_paths( - paths1, - path2, - exists=exists, - flatten=not source_is_str, - ) - - batch_size = batch_size or self.batch_size - coros = [self._cp_file(p1, p2, **kwargs) for p1, p2 in zip(paths1, paths2)] - result = await _run_coros_in_chunks( - coros, batch_size=batch_size, return_exceptions=True, nofiles=True - ) - - for ex in filter(is_exception, result): - if on_error == "ignore" and isinstance(ex, FileNotFoundError): - continue - raise ex - - async def _pipe_file(self, path, value, **kwargs): - raise NotImplementedError - - async def _pipe(self, path, value=None, batch_size=None, **kwargs): - if isinstance(path, str): - path = {path: value} - batch_size = batch_size or self.batch_size - return await _run_coros_in_chunks( - [self._pipe_file(k, v, **kwargs) for k, v in path.items()], - batch_size=batch_size, - nofiles=True, - ) - - async def _process_limits(self, url, start, end): - """Helper for "Range"-based _cat_file""" - size = None - suff = False - if start is not None and start < 0: - # if start is negative and end None, end is the "suffix length" - if end is None: - end = -start - start = "" - suff = True - else: - size = size or (await self._info(url))["size"] - start = size + start - elif start is None: - start = 0 - if not suff: - if end is not None and end < 0: - if start is not None: - size = size or (await self._info(url))["size"] - end = size + end - elif end is None: - end = "" - if isinstance(end, numbers.Integral): - end -= 1 # bytes range is inclusive - return "bytes=%s-%s" % (start, end) - - async def _cat_file(self, path, start=None, end=None, **kwargs): - raise NotImplementedError - - async def _cat( - self, path, recursive=False, on_error="raise", batch_size=None, **kwargs - ): - paths = await self._expand_path(path, recursive=recursive) - coros = [self._cat_file(path, **kwargs) for path in paths] - batch_size = batch_size or self.batch_size - out = await _run_coros_in_chunks( - coros, batch_size=batch_size, nofiles=True, return_exceptions=True - ) - if on_error == "raise": - ex = next(filter(is_exception, out), False) - if ex: - raise ex - if ( - len(paths) > 1 - or isinstance(path, list) - or paths[0] != self._strip_protocol(path) - ): - return { - k: v - for k, v in zip(paths, out) - if on_error != "omit" or not is_exception(v) - } - else: - return out[0] - - async def _cat_ranges( - self, - paths, - starts, - ends, - max_gap=None, - batch_size=None, - on_error="return", - **kwargs, - ): - # TODO: on_error - if max_gap is not None: - # use utils.merge_offset_ranges - raise NotImplementedError - if not isinstance(paths, list): - raise TypeError - if not isinstance(starts, Iterable): - starts = [starts] * len(paths) - if not isinstance(ends, Iterable): - ends = [starts] * len(paths) - if len(starts) != len(paths) or len(ends) != len(paths): - raise ValueError - coros = [ - self._cat_file(p, start=s, end=e, **kwargs) - for p, s, e in zip(paths, starts, ends) - ] - batch_size = batch_size or self.batch_size - return await _run_coros_in_chunks( - coros, batch_size=batch_size, nofiles=True, return_exceptions=True - ) - - async def _put_file(self, lpath, rpath, **kwargs): - raise NotImplementedError - - async def _put( - self, - lpath, - rpath, - recursive=False, - callback=_DEFAULT_CALLBACK, - batch_size=None, - maxdepth=None, - **kwargs, - ): - """Copy file(s) from local. - - Copies a specific file or tree of files (if recursive=True). If rpath - ends with a "/", it will be assumed to be a directory, and target files - will go within. - - The put_file method will be called concurrently on a batch of files. The - batch_size option can configure the amount of futures that can be executed - at the same time. If it is -1, then all the files will be uploaded concurrently. - The default can be set for this instance by passing "batch_size" in the - constructor, or for all instances by setting the "gather_batch_size" key - in ``fsspec.config.conf``, falling back to 1/8th of the system limit . - """ - if isinstance(lpath, list) and isinstance(rpath, list): - # No need to expand paths when both source and destination - # are provided as lists - rpaths = rpath - lpaths = lpath - else: - source_is_str = isinstance(lpath, str) - if source_is_str: - lpath = make_path_posix(lpath) - fs = LocalFileSystem() - lpaths = fs.expand_path(lpath, recursive=recursive, maxdepth=maxdepth) - if source_is_str and (not recursive or maxdepth is not None): - # Non-recursive glob does not copy directories - lpaths = [p for p in lpaths if not (trailing_sep(p) or fs.isdir(p))] - if not lpaths: - return - - source_is_file = len(lpaths) == 1 - dest_is_dir = isinstance(rpath, str) and ( - trailing_sep(rpath) or await self._isdir(rpath) - ) - - rpath = self._strip_protocol(rpath) - exists = source_is_str and ( - (has_magic(lpath) and source_is_file) - or (not has_magic(lpath) and dest_is_dir and not trailing_sep(lpath)) - ) - rpaths = other_paths( - lpaths, - rpath, - exists=exists, - flatten=not source_is_str, - ) - - is_dir = {l: os.path.isdir(l) for l in lpaths} - rdirs = [r for l, r in zip(lpaths, rpaths) if is_dir[l]] - file_pairs = [(l, r) for l, r in zip(lpaths, rpaths) if not is_dir[l]] - - await asyncio.gather(*[self._makedirs(d, exist_ok=True) for d in rdirs]) - batch_size = batch_size or self.batch_size - - coros = [] - callback.set_size(len(file_pairs)) - for lfile, rfile in file_pairs: - callback.branch(lfile, rfile, kwargs) - coros.append(self._put_file(lfile, rfile, **kwargs)) - - return await _run_coros_in_chunks( - coros, batch_size=batch_size, callback=callback - ) - - async def _get_file(self, rpath, lpath, **kwargs): - raise NotImplementedError - - async def _get( - self, - rpath, - lpath, - recursive=False, - callback=_DEFAULT_CALLBACK, - maxdepth=None, - **kwargs, - ): - """Copy file(s) to local. - - Copies a specific file or tree of files (if recursive=True). If lpath - ends with a "/", it will be assumed to be a directory, and target files - will go within. Can submit a list of paths, which may be glob-patterns - and will be expanded. - - The get_file method will be called concurrently on a batch of files. The - batch_size option can configure the amount of futures that can be executed - at the same time. If it is -1, then all the files will be uploaded concurrently. - The default can be set for this instance by passing "batch_size" in the - constructor, or for all instances by setting the "gather_batch_size" key - in ``fsspec.config.conf``, falling back to 1/8th of the system limit . - """ - if isinstance(lpath, list) and isinstance(rpath, list): - # No need to expand paths when both source and destination - # are provided as lists - rpaths = rpath - lpaths = lpath - else: - source_is_str = isinstance(rpath, str) - # First check for rpath trailing slash as _strip_protocol removes it. - source_not_trailing_sep = source_is_str and not trailing_sep(rpath) - rpath = self._strip_protocol(rpath) - rpaths = await self._expand_path( - rpath, recursive=recursive, maxdepth=maxdepth - ) - if source_is_str and (not recursive or maxdepth is not None): - # Non-recursive glob does not copy directories - rpaths = [ - p for p in rpaths if not (trailing_sep(p) or await self._isdir(p)) - ] - if not rpaths: - return - - lpath = make_path_posix(lpath) - source_is_file = len(rpaths) == 1 - dest_is_dir = isinstance(lpath, str) and ( - trailing_sep(lpath) or LocalFileSystem().isdir(lpath) - ) - - exists = source_is_str and ( - (has_magic(rpath) and source_is_file) - or (not has_magic(rpath) and dest_is_dir and source_not_trailing_sep) - ) - lpaths = other_paths( - rpaths, - lpath, - exists=exists, - flatten=not source_is_str, - ) - - [os.makedirs(os.path.dirname(lp), exist_ok=True) for lp in lpaths] - batch_size = kwargs.pop("batch_size", self.batch_size) - - coros = [] - callback.set_size(len(lpaths)) - for lpath, rpath in zip(lpaths, rpaths): - callback.branch(rpath, lpath, kwargs) - coros.append(self._get_file(rpath, lpath, **kwargs)) - return await _run_coros_in_chunks( - coros, batch_size=batch_size, callback=callback - ) - - async def _isfile(self, path): - try: - return (await self._info(path))["type"] == "file" - except: # noqa: E722 - return False - - async def _isdir(self, path): - try: - return (await self._info(path))["type"] == "directory" - except OSError: - return False - - async def _size(self, path): - return (await self._info(path)).get("size", None) - - async def _sizes(self, paths, batch_size=None): - batch_size = batch_size or self.batch_size - return await _run_coros_in_chunks( - [self._size(p) for p in paths], batch_size=batch_size - ) - - async def _exists(self, path): - try: - await self._info(path) - return True - except FileNotFoundError: - return False - - async def _info(self, path, **kwargs): - raise NotImplementedError - - async def _ls(self, path, detail=True, **kwargs): - raise NotImplementedError - - async def _walk(self, path, maxdepth=None, on_error="omit", **kwargs): - if maxdepth is not None and maxdepth < 1: - raise ValueError("maxdepth must be at least 1") - - path = self._strip_protocol(path) - full_dirs = {} - dirs = {} - files = {} - - detail = kwargs.pop("detail", False) - try: - listing = await self._ls(path, detail=True, **kwargs) - except (FileNotFoundError, OSError) as e: - if on_error == "raise": - raise - elif callable(on_error): - on_error(e) - if detail: - yield path, {}, {} - else: - yield path, [], [] - return - - for info in listing: - # each info name must be at least [path]/part , but here - # we check also for names like [path]/part/ - pathname = info["name"].rstrip("/") - name = pathname.rsplit("/", 1)[-1] - if info["type"] == "directory" and pathname != path: - # do not include "self" path - full_dirs[name] = pathname - dirs[name] = info - elif pathname == path: - # file-like with same name as give path - files[""] = info - else: - files[name] = info - - if detail: - yield path, dirs, files - else: - yield path, list(dirs), list(files) - - if maxdepth is not None: - maxdepth -= 1 - if maxdepth < 1: - return - - for d in dirs: - async for _ in self._walk( - full_dirs[d], maxdepth=maxdepth, detail=detail, **kwargs - ): - yield _ - - async def _glob(self, path, maxdepth=None, **kwargs): - if maxdepth is not None and maxdepth < 1: - raise ValueError("maxdepth must be at least 1") - - import re - - ends = path.endswith("/") - path = self._strip_protocol(path) - idx_star = path.find("*") if path.find("*") >= 0 else len(path) - idx_qmark = path.find("?") if path.find("?") >= 0 else len(path) - idx_brace = path.find("[") if path.find("[") >= 0 else len(path) - - min_idx = min(idx_star, idx_qmark, idx_brace) - - detail = kwargs.pop("detail", False) - - if not has_magic(path): - if await self._exists(path): - if not detail: - return [path] - else: - return {path: await self._info(path)} - else: - if not detail: - return [] # glob of non-existent returns empty - else: - return {} - elif "/" in path[:min_idx]: - min_idx = path[:min_idx].rindex("/") - root = path[: min_idx + 1] - depth = path[min_idx + 1 :].count("/") + 1 - else: - root = "" - depth = path[min_idx + 1 :].count("/") + 1 - - if "**" in path: - if maxdepth is not None: - idx_double_stars = path.find("**") - depth_double_stars = path[idx_double_stars:].count("/") + 1 - depth = depth - depth_double_stars + maxdepth - else: - depth = None - - allpaths = await self._find( - root, maxdepth=depth, withdirs=True, detail=True, **kwargs - ) - # Escape characters special to python regex, leaving our supported - # special characters in place. - # See https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html - # for shell globbing details. - pattern = ( - "^" - + ( - path.replace("\\", r"\\") - .replace(".", r"\.") - .replace("+", r"\+") - .replace("//", "/") - .replace("(", r"\(") - .replace(")", r"\)") - .replace("|", r"\|") - .replace("^", r"\^") - .replace("$", r"\$") - .replace("{", r"\{") - .replace("}", r"\}") - .rstrip("/") - .replace("?", ".") - ) - + "$" - ) - pattern = re.sub("/[*]{2}", "=SLASH_DOUBLE_STARS=", pattern) - pattern = re.sub("[*]{2}/?", "=DOUBLE_STARS=", pattern) - pattern = re.sub("[*]", "[^/]*", pattern) - pattern = re.sub("=SLASH_DOUBLE_STARS=", "(|/.*)", pattern) - pattern = re.sub("=DOUBLE_STARS=", ".*", pattern) - pattern = re.compile(pattern) - out = { - p: allpaths[p] - for p in sorted(allpaths) - if pattern.match(p.replace("//", "/").rstrip("/")) - } - - # Return directories only when the glob end by a slash - # This is needed for posix glob compliance - if ends: - out = {k: v for k, v in out.items() if v["type"] == "directory"} - - if detail: - return out - else: - return list(out) - - async def _du(self, path, total=True, maxdepth=None, **kwargs): - sizes = {} - # async for? - for f in await self._find(path, maxdepth=maxdepth, **kwargs): - info = await self._info(f) - sizes[info["name"]] = info["size"] - if total: - return sum(sizes.values()) - else: - return sizes - - async def _find(self, path, maxdepth=None, withdirs=False, **kwargs): - path = self._strip_protocol(path) - out = {} - detail = kwargs.pop("detail", False) - - # Add the root directory if withdirs is requested - # This is needed for posix glob compliance - if withdirs and path != "" and await self._isdir(path): - out[path] = await self._info(path) - - # async for? - async for _, dirs, files in self._walk(path, maxdepth, detail=True, **kwargs): - if withdirs: - files.update(dirs) - out.update({info["name"]: info for name, info in files.items()}) - if not out and (await self._isfile(path)): - # walk works on directories, but find should also return [path] - # when path happens to be a file - out[path] = {} - names = sorted(out) - if not detail: - return names - else: - return {name: out[name] for name in names} - - async def _expand_path(self, path, recursive=False, maxdepth=None): - if maxdepth is not None and maxdepth < 1: - raise ValueError("maxdepth must be at least 1") - - if isinstance(path, str): - out = await self._expand_path([path], recursive, maxdepth) - else: - out = set() - path = [self._strip_protocol(p) for p in path] - for p in path: # can gather here - if has_magic(p): - bit = set(await self._glob(p, maxdepth=maxdepth)) - out |= bit - if recursive: - # glob call above expanded one depth so if maxdepth is defined - # then decrement it in expand_path call below. If it is zero - # after decrementing then avoid expand_path call. - if maxdepth is not None and maxdepth <= 1: - continue - out |= set( - await self._expand_path( - list(bit), - recursive=recursive, - maxdepth=maxdepth - 1 if maxdepth is not None else None, - ) - ) - continue - elif recursive: - rec = set(await self._find(p, maxdepth=maxdepth, withdirs=True)) - out |= rec - if p not in out and (recursive is False or (await self._exists(p))): - # should only check once, for the root - out.add(p) - if not out: - raise FileNotFoundError(path) - return sorted(out) - - async def _mkdir(self, path, create_parents=True, **kwargs): - pass # not necessary to implement, may not have directories - - async def _makedirs(self, path, exist_ok=False): - pass # not necessary to implement, may not have directories - - async def open_async(self, path, mode="rb", **kwargs): - if "b" not in mode or kwargs.get("compression"): - raise ValueError - raise NotImplementedError - - -def mirror_sync_methods(obj): - """Populate sync and async methods for obj - - For each method will create a sync version if the name refers to an async method - (coroutine) and there is no override in the child class; will create an async - method for the corresponding sync method if there is no implementation. - - Uses the methods specified in - - async_methods: the set that an implementation is expected to provide - - default_async_methods: that can be derived from their sync version in - AbstractFileSystem - - AsyncFileSystem: async-specific default coroutines - """ - from fsspec import AbstractFileSystem - - for method in async_methods + dir(AsyncFileSystem): - if not method.startswith("_"): - continue - smethod = method[1:] - if private.match(method): - isco = inspect.iscoroutinefunction(getattr(obj, method, None)) - unsync = getattr(getattr(obj, smethod, False), "__func__", None) - is_default = unsync is getattr(AbstractFileSystem, smethod, "") - if isco and is_default: - mth = sync_wrapper(getattr(obj, method), obj=obj) - setattr(obj, smethod, mth) - if not mth.__doc__: - mth.__doc__ = getattr( - getattr(AbstractFileSystem, smethod, None), "__doc__", "" - ) - - -class FSSpecCoroutineCancel(Exception): - pass - - -def _dump_running_tasks( - printout=True, cancel=True, exc=FSSpecCoroutineCancel, with_task=False -): - import traceback - - tasks = [t for t in asyncio.tasks.all_tasks(loop[0]) if not t.done()] - if printout: - [task.print_stack() for task in tasks] - out = [ - { - "locals": task._coro.cr_frame.f_locals, - "file": task._coro.cr_frame.f_code.co_filename, - "firstline": task._coro.cr_frame.f_code.co_firstlineno, - "linelo": task._coro.cr_frame.f_lineno, - "stack": traceback.format_stack(task._coro.cr_frame), - "task": task if with_task else None, - } - for task in tasks - ] - if cancel: - for t in tasks: - cbs = t._callbacks - t.cancel() - asyncio.futures.Future.set_exception(t, exc) - asyncio.futures.Future.cancel(t) - [cb[0](t) for cb in cbs] # cancels any dependent concurrent.futures - try: - t._coro.throw(exc) # exits coro, unless explicitly handled - except exc: - pass - return out - - -class AbstractAsyncStreamedFile(AbstractBufferedFile): - # no read buffering, and always auto-commit - # TODO: readahead might still be useful here, but needs async version - - async def read(self, length=-1): - """ - Return data from cache, or fetch pieces as necessary - - Parameters - ---------- - length: int (-1) - Number of bytes to read; if <0, all remaining bytes. - """ - length = -1 if length is None else int(length) - if self.mode != "rb": - raise ValueError("File not in read mode") - if length < 0: - length = self.size - self.loc - if self.closed: - raise ValueError("I/O operation on closed file.") - if length == 0: - # don't even bother calling fetch - return b"" - out = await self._fetch_range(self.loc, self.loc + length) - self.loc += len(out) - return out - - async def write(self, data): - """ - Write data to buffer. - - Buffer only sent on flush() or if buffer is greater than - or equal to blocksize. - - Parameters - ---------- - data: bytes - Set of bytes to be written. - """ - if self.mode not in {"wb", "ab"}: - raise ValueError("File not in write mode") - if self.closed: - raise ValueError("I/O operation on closed file.") - if self.forced: - raise ValueError("This file has been force-flushed, can only close") - out = self.buffer.write(data) - self.loc += out - if self.buffer.tell() >= self.blocksize: - await self.flush() - return out - - async def close(self): - """Close file - - Finalizes writes, discards cache - """ - if getattr(self, "_unclosable", False): - return - if self.closed: - return - if self.mode == "rb": - self.cache = None - else: - if not self.forced: - await self.flush(force=True) - - if self.fs is not None: - self.fs.invalidate_cache(self.path) - self.fs.invalidate_cache(self.fs._parent(self.path)) - - self.closed = True - - async def flush(self, force=False): - if self.closed: - raise ValueError("Flush on closed file") - if force and self.forced: - raise ValueError("Force flush cannot be called more than once") - if force: - self.forced = True - - if self.mode not in {"wb", "ab"}: - # no-op to flush on read-mode - return - - if not force and self.buffer.tell() < self.blocksize: - # Defer write on small block - return - - if self.offset is None: - # Initialize a multipart upload - self.offset = 0 - try: - await self._initiate_upload() - except: # noqa: E722 - self.closed = True - raise - - if await self._upload_chunk(final=force) is not False: - self.offset += self.buffer.seek(0, 2) - self.buffer = io.BytesIO() - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_val, exc_tb): - await self.close() - - async def _fetch_range(self, start, end): - raise NotImplementedError - - async def _initiate_upload(self): - pass - - async def _upload_chunk(self, final=False): - raise NotImplementedError diff --git a/venv/lib/python3.8/site-packages/fsspec/caching.py b/venv/lib/python3.8/site-packages/fsspec/caching.py deleted file mode 100644 index 41b661ba20af8603c205eda294aade2e47738662..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/caching.py +++ /dev/null @@ -1,804 +0,0 @@ -import collections -import functools -import logging -import math -import os -import threading -import warnings -from concurrent.futures import ThreadPoolExecutor - -logger = logging.getLogger("fsspec") - - -class BaseCache: - """Pass-though cache: doesn't keep anything, calls every time - - Acts as base class for other cachers - - Parameters - ---------- - blocksize: int - How far to read ahead in numbers of bytes - fetcher: func - Function of the form f(start, end) which gets bytes from remote as - specified - size: int - How big this file is - """ - - name = "none" - - def __init__(self, blocksize, fetcher, size): - self.blocksize = blocksize - self.fetcher = fetcher - self.size = size - - def _fetch(self, start, stop): - if start is None: - start = 0 - if stop is None: - stop = self.size - if start >= self.size or start >= stop: - return b"" - return self.fetcher(start, stop) - - -class MMapCache(BaseCache): - """memory-mapped sparse file cache - - Opens temporary file, which is filled blocks-wise when data is requested. - Ensure there is enough disc space in the temporary location. - - This cache method might only work on posix - """ - - name = "mmap" - - def __init__(self, blocksize, fetcher, size, location=None, blocks=None): - super().__init__(blocksize, fetcher, size) - self.blocks = set() if blocks is None else blocks - self.location = location - self.cache = self._makefile() - - def _makefile(self): - import mmap - import tempfile - - if self.size == 0: - return bytearray() - - # posix version - if self.location is None or not os.path.exists(self.location): - if self.location is None: - fd = tempfile.TemporaryFile() - self.blocks = set() - else: - fd = open(self.location, "wb+") - fd.seek(self.size - 1) - fd.write(b"1") - fd.flush() - else: - fd = open(self.location, "rb+") - - return mmap.mmap(fd.fileno(), self.size) - - def _fetch(self, start, end): - logger.debug(f"MMap cache fetching {start}-{end}") - if start is None: - start = 0 - if end is None: - end = self.size - if start >= self.size or start >= end: - return b"" - start_block = start // self.blocksize - end_block = end // self.blocksize - need = [i for i in range(start_block, end_block + 1) if i not in self.blocks] - while need: - # TODO: not a for loop so we can consolidate blocks later to - # make fewer fetch calls; this could be parallel - i = need.pop(0) - sstart = i * self.blocksize - send = min(sstart + self.blocksize, self.size) - logger.debug(f"MMap get block #{i} ({sstart}-{send}") - self.cache[sstart:send] = self.fetcher(sstart, send) - self.blocks.add(i) - - return self.cache[start:end] - - def __getstate__(self): - state = self.__dict__.copy() - # Remove the unpicklable entries. - del state["cache"] - return state - - def __setstate__(self, state): - # Restore instance attributes - self.__dict__.update(state) - self.cache = self._makefile() - - -class ReadAheadCache(BaseCache): - """Cache which reads only when we get beyond a block of data - - This is a much simpler version of BytesCache, and does not attempt to - fill holes in the cache or keep fragments alive. It is best suited to - many small reads in a sequential order (e.g., reading lines from a file). - """ - - name = "readahead" - - def __init__(self, blocksize, fetcher, size): - super().__init__(blocksize, fetcher, size) - self.cache = b"" - self.start = 0 - self.end = 0 - - def _fetch(self, start, end): - if start is None: - start = 0 - if end is None or end > self.size: - end = self.size - if start >= self.size or start >= end: - return b"" - l = end - start - if start >= self.start and end <= self.end: - # cache hit - return self.cache[start - self.start : end - self.start] - elif self.start <= start < self.end: - # partial hit - part = self.cache[start - self.start :] - l -= len(part) - start = self.end - else: - # miss - part = b"" - end = min(self.size, end + self.blocksize) - self.cache = self.fetcher(start, end) # new block replaces old - self.start = start - self.end = self.start + len(self.cache) - return part + self.cache[:l] - - -class FirstChunkCache(BaseCache): - """Caches the first block of a file only - - This may be useful for file types where the metadata is stored in the header, - but is randomly accessed. - """ - - name = "first" - - def __init__(self, blocksize, fetcher, size): - super().__init__(blocksize, fetcher, size) - self.cache = None - - def _fetch(self, start, end): - start = start or 0 - end = end or self.size - if start < self.blocksize: - if self.cache is None: - if end > self.blocksize: - data = self.fetcher(0, end) - self.cache = data[: self.blocksize] - return data[start:] - self.cache = self.fetcher(0, self.blocksize) - part = self.cache[start:end] - if end > self.blocksize: - part += self.fetcher(self.blocksize, end) - return part - else: - return self.fetcher(start, end) - - -class BlockCache(BaseCache): - """ - Cache holding memory as a set of blocks. - - Requests are only ever made ``blocksize`` at a time, and are - stored in an LRU cache. The least recently accessed block is - discarded when more than ``maxblocks`` are stored. - - Parameters - ---------- - blocksize : int - The number of bytes to store in each block. - Requests are only ever made for ``blocksize``, so this - should balance the overhead of making a request against - the granularity of the blocks. - fetcher : Callable - size : int - The total size of the file being cached. - maxblocks : int - The maximum number of blocks to cache for. The maximum memory - use for this cache is then ``blocksize * maxblocks``. - """ - - name = "blockcache" - - def __init__(self, blocksize, fetcher, size, maxblocks=32): - super().__init__(blocksize, fetcher, size) - self.nblocks = math.ceil(size / blocksize) - self.maxblocks = maxblocks - self._fetch_block_cached = functools.lru_cache(maxblocks)(self._fetch_block) - - def __repr__(self): - return "".format( - self.blocksize, self.size, self.nblocks - ) - - def cache_info(self): - """ - The statistics on the block cache. - - Returns - ------- - NamedTuple - Returned directly from the LRU Cache used internally. - """ - return self._fetch_block_cached.cache_info() - - def __getstate__(self): - state = self.__dict__ - del state["_fetch_block_cached"] - return state - - def __setstate__(self, state): - self.__dict__.update(state) - self._fetch_block_cached = functools.lru_cache(state["maxblocks"])( - self._fetch_block - ) - - def _fetch(self, start, end): - if start is None: - start = 0 - if end is None: - end = self.size - if start >= self.size or start >= end: - return b"" - - # byte position -> block numbers - start_block_number = start // self.blocksize - end_block_number = end // self.blocksize - - # these are cached, so safe to do multiple calls for the same start and end. - for block_number in range(start_block_number, end_block_number + 1): - self._fetch_block_cached(block_number) - - return self._read_cache( - start, - end, - start_block_number=start_block_number, - end_block_number=end_block_number, - ) - - def _fetch_block(self, block_number): - """ - Fetch the block of data for `block_number`. - """ - if block_number > self.nblocks: - raise ValueError( - "'block_number={}' is greater than the number of blocks ({})".format( - block_number, self.nblocks - ) - ) - - start = block_number * self.blocksize - end = start + self.blocksize - logger.info("BlockCache fetching block %d", block_number) - block_contents = super()._fetch(start, end) - return block_contents - - def _read_cache(self, start, end, start_block_number, end_block_number): - """ - Read from our block cache. - - Parameters - ---------- - start, end : int - The start and end byte positions. - start_block_number, end_block_number : int - The start and end block numbers. - """ - start_pos = start % self.blocksize - end_pos = end % self.blocksize - - if start_block_number == end_block_number: - block = self._fetch_block_cached(start_block_number) - return block[start_pos:end_pos] - - else: - # read from the initial - out = [] - out.append(self._fetch_block_cached(start_block_number)[start_pos:]) - - # intermediate blocks - # Note: it'd be nice to combine these into one big request. However - # that doesn't play nicely with our LRU cache. - for block_number in range(start_block_number + 1, end_block_number): - out.append(self._fetch_block_cached(block_number)) - - # final block - out.append(self._fetch_block_cached(end_block_number)[:end_pos]) - - return b"".join(out) - - -class BytesCache(BaseCache): - """Cache which holds data in a in-memory bytes object - - Implements read-ahead by the block size, for semi-random reads progressing - through the file. - - Parameters - ---------- - trim: bool - As we read more data, whether to discard the start of the buffer when - we are more than a blocksize ahead of it. - """ - - name = "bytes" - - def __init__(self, blocksize, fetcher, size, trim=True): - super().__init__(blocksize, fetcher, size) - self.cache = b"" - self.start = None - self.end = None - self.trim = trim - - def _fetch(self, start, end): - # TODO: only set start/end after fetch, in case it fails? - # is this where retry logic might go? - if start is None: - start = 0 - if end is None: - end = self.size - if start >= self.size or start >= end: - return b"" - if ( - self.start is not None - and start >= self.start - and self.end is not None - and end < self.end - ): - # cache hit: we have all the required data - offset = start - self.start - return self.cache[offset : offset + end - start] - - if self.blocksize: - bend = min(self.size, end + self.blocksize) - else: - bend = end - - if bend == start or start > self.size: - return b"" - - if (self.start is None or start < self.start) and ( - self.end is None or end > self.end - ): - # First read, or extending both before and after - self.cache = self.fetcher(start, bend) - self.start = start - elif start < self.start: - if self.end - end > self.blocksize: - self.cache = self.fetcher(start, bend) - self.start = start - else: - new = self.fetcher(start, self.start) - self.start = start - self.cache = new + self.cache - elif bend > self.end: - if self.end > self.size: - pass - elif end - self.end > self.blocksize: - self.cache = self.fetcher(start, bend) - self.start = start - else: - new = self.fetcher(self.end, bend) - self.cache = self.cache + new - - self.end = self.start + len(self.cache) - offset = start - self.start - out = self.cache[offset : offset + end - start] - if self.trim: - num = (self.end - self.start) // (self.blocksize + 1) - if num > 1: - self.start += self.blocksize * num - self.cache = self.cache[self.blocksize * num :] - return out - - def __len__(self): - return len(self.cache) - - -class AllBytes(BaseCache): - """Cache entire contents of the file""" - - name = "all" - - def __init__(self, blocksize=None, fetcher=None, size=None, data=None): - super().__init__(blocksize, fetcher, size) - if data is None: - data = self.fetcher(0, self.size) - self.data = data - - def _fetch(self, start, end): - return self.data[start:end] - - -class KnownPartsOfAFile(BaseCache): - """ - Cache holding known file parts. - - Parameters - ---------- - blocksize: int - How far to read ahead in numbers of bytes - fetcher: func - Function of the form f(start, end) which gets bytes from remote as - specified - size: int - How big this file is - data: dict - A dictionary mapping explicit `(start, stop)` file-offset tuples - with known bytes. - strict: bool, default True - Whether to fetch reads that go beyond a known byte-range boundary. - If `False`, any read that ends outside a known part will be zero - padded. Note that zero padding will not be used for reads that - begin outside a known byte-range. - """ - - name = "parts" - - def __init__(self, blocksize, fetcher, size, data={}, strict=True, **_): - super(KnownPartsOfAFile, self).__init__(blocksize, fetcher, size) - self.strict = strict - - # simple consolidation of contiguous blocks - if data: - old_offsets = sorted(data.keys()) - offsets = [old_offsets[0]] - blocks = [data.pop(old_offsets[0])] - for start, stop in old_offsets[1:]: - start0, stop0 = offsets[-1] - if start == stop0: - offsets[-1] = (start0, stop) - blocks[-1] += data.pop((start, stop)) - else: - offsets.append((start, stop)) - blocks.append(data.pop((start, stop))) - - self.data = dict(zip(offsets, blocks)) - else: - self.data = data - - def _fetch(self, start, stop): - out = b"" - for (loc0, loc1), data in self.data.items(): - # If self.strict=False, use zero-padded data - # for reads beyond the end of a "known" buffer - if loc0 <= start < loc1: - off = start - loc0 - out = data[off : off + stop - start] - if not self.strict or loc0 <= stop <= loc1: - # The request is within a known range, or - # it begins within a known range, and we - # are allowed to pad reads beyond the - # buffer with zero - out += b"\x00" * (stop - start - len(out)) - return out - else: - # The request ends outside a known range, - # and we are being "strict" about reads - # beyond the buffer - start = loc1 - break - - # We only get here if there is a request outside the - # known parts of the file. In an ideal world, this - # should never happen - if self.fetcher is None: - # We cannot fetch the data, so raise an error - raise ValueError(f"Read is outside the known file parts: {(start, stop)}. ") - # We can fetch the data, but should warn the user - # that this may be slow - warnings.warn( - f"Read is outside the known file parts: {(start, stop)}. " - f"IO/caching performance may be poor!" - ) - logger.debug(f"KnownPartsOfAFile cache fetching {start}-{stop}") - return out + super()._fetch(start, stop) - - -class UpdatableLRU: - """ - Custom implementation of LRU cache that allows updating keys - - Used by BackgroudBlockCache - """ - - CacheInfo = collections.namedtuple( - "CacheInfo", ["hits", "misses", "maxsize", "currsize"] - ) - - def __init__(self, func, max_size=128): - self._cache = collections.OrderedDict() - self._func = func - self._max_size = max_size - self._hits = 0 - self._misses = 0 - self._lock = threading.Lock() - - def __call__(self, *args): - with self._lock: - if args in self._cache: - self._cache.move_to_end(args) - self._hits += 1 - return self._cache[args] - - result = self._func(*args) - - with self._lock: - self._cache[args] = result - self._misses += 1 - if len(self._cache) > self._max_size: - self._cache.popitem(last=False) - - return result - - def is_key_cached(self, *args): - with self._lock: - return args in self._cache - - def add_key(self, result, *args): - with self._lock: - self._cache[args] = result - if len(self._cache) > self._max_size: - self._cache.popitem(last=False) - - def cache_info(self): - with self._lock: - return self.CacheInfo( - maxsize=self._max_size, - currsize=len(self._cache), - hits=self._hits, - misses=self._misses, - ) - - -class BackgroundBlockCache(BaseCache): - """ - Cache holding memory as a set of blocks with pre-loading of - the next block in the background. - - Requests are only ever made ``blocksize`` at a time, and are - stored in an LRU cache. The least recently accessed block is - discarded when more than ``maxblocks`` are stored. If the - next block is not in cache, it is loaded in a separate thread - in non-blocking way. - - Parameters - ---------- - blocksize : int - The number of bytes to store in each block. - Requests are only ever made for ``blocksize``, so this - should balance the overhead of making a request against - the granularity of the blocks. - fetcher : Callable - size : int - The total size of the file being cached. - maxblocks : int - The maximum number of blocks to cache for. The maximum memory - use for this cache is then ``blocksize * maxblocks``. - """ - - name = "background" - - def __init__(self, blocksize, fetcher, size, maxblocks=32): - super().__init__(blocksize, fetcher, size) - self.nblocks = math.ceil(size / blocksize) - self.maxblocks = maxblocks - self._fetch_block_cached = UpdatableLRU(self._fetch_block, maxblocks) - - self._thread_executor = ThreadPoolExecutor(max_workers=1) - self._fetch_future_block_number = None - self._fetch_future = None - self._fetch_future_lock = threading.Lock() - - def __repr__(self): - return "".format( - self.blocksize, self.size, self.nblocks - ) - - def cache_info(self): - """ - The statistics on the block cache. - - Returns - ------- - NamedTuple - Returned directly from the LRU Cache used internally. - """ - return self._fetch_block_cached.cache_info() - - def __getstate__(self): - state = self.__dict__ - del state["_fetch_block_cached"] - del state["_thread_executor"] - del state["_fetch_future_block_number"] - del state["_fetch_future"] - del state["_fetch_future_lock"] - return state - - def __setstate__(self, state): - self.__dict__.update(state) - self._fetch_block_cached = UpdatableLRU(self._fetch_block, state["maxblocks"]) - self._thread_executor = ThreadPoolExecutor(max_workers=1) - self._fetch_future_block_number = None - self._fetch_future = None - self._fetch_future_lock = threading.Lock() - - def _fetch(self, start, end): - if start is None: - start = 0 - if end is None: - end = self.size - if start >= self.size or start >= end: - return b"" - - # byte position -> block numbers - start_block_number = start // self.blocksize - end_block_number = end // self.blocksize - - fetch_future_block_number = None - fetch_future = None - with self._fetch_future_lock: - # Background thread is running. Check we we can or must join it. - if self._fetch_future is not None: - if self._fetch_future.done(): - logger.info("BlockCache joined background fetch without waiting.") - self._fetch_block_cached.add_key( - self._fetch_future.result(), self._fetch_future_block_number - ) - # Cleanup the fetch variables. Done with fetching the block. - self._fetch_future_block_number = None - self._fetch_future = None - else: - # Must join if we need the block for the current fetch - must_join = bool( - start_block_number - <= self._fetch_future_block_number - <= end_block_number - ) - if must_join: - # Copy to the local variables to release lock - # before waiting for result - fetch_future_block_number = self._fetch_future_block_number - fetch_future = self._fetch_future - - # Cleanup the fetch variables. Have a local copy. - self._fetch_future_block_number = None - self._fetch_future = None - - # Need to wait for the future for the current read - if fetch_future is not None: - logger.info("BlockCache waiting for background fetch.") - # Wait until result and put it in cache - self._fetch_block_cached.add_key( - fetch_future.result(), fetch_future_block_number - ) - - # these are cached, so safe to do multiple calls for the same start and end. - for block_number in range(start_block_number, end_block_number + 1): - self._fetch_block_cached(block_number) - - # fetch next block in the background if nothing is running in the background, - # the block is within file and it is not already cached - end_block_plus_1 = end_block_number + 1 - with self._fetch_future_lock: - if ( - self._fetch_future is None - and end_block_plus_1 <= self.nblocks - and not self._fetch_block_cached.is_key_cached(end_block_plus_1) - ): - self._fetch_future_block_number = end_block_plus_1 - self._fetch_future = self._thread_executor.submit( - self._fetch_block, end_block_plus_1, "async" - ) - - return self._read_cache( - start, - end, - start_block_number=start_block_number, - end_block_number=end_block_number, - ) - - def _fetch_block(self, block_number, log_info="sync"): - """ - Fetch the block of data for `block_number`. - """ - if block_number > self.nblocks: - raise ValueError( - "'block_number={}' is greater than the number of blocks ({})".format( - block_number, self.nblocks - ) - ) - - start = block_number * self.blocksize - end = start + self.blocksize - logger.info("BlockCache fetching block (%s) %d", log_info, block_number) - block_contents = super()._fetch(start, end) - return block_contents - - def _read_cache(self, start, end, start_block_number, end_block_number): - """ - Read from our block cache. - - Parameters - ---------- - start, end : int - The start and end byte positions. - start_block_number, end_block_number : int - The start and end block numbers. - """ - start_pos = start % self.blocksize - end_pos = end % self.blocksize - - if start_block_number == end_block_number: - block = self._fetch_block_cached(start_block_number) - return block[start_pos:end_pos] - - else: - # read from the initial - out = [] - out.append(self._fetch_block_cached(start_block_number)[start_pos:]) - - # intermediate blocks - # Note: it'd be nice to combine these into one big request. However - # that doesn't play nicely with our LRU cache. - for block_number in range(start_block_number + 1, end_block_number): - out.append(self._fetch_block_cached(block_number)) - - # final block - out.append(self._fetch_block_cached(end_block_number)[:end_pos]) - - return b"".join(out) - - -caches = { - # one custom case - None: BaseCache, -} - - -def register_cache(cls, clobber=False): - """'Register' cache implementation. - - Parameters - ---------- - clobber: bool, optional - If set to True (default is False) - allow to overwrite existing - entry. - - Raises - ------ - ValueError - """ - name = cls.name - if not clobber and name in caches: - raise ValueError(f"Cache with name {name!r} is already known: {caches[name]}") - caches[name] = cls - - -for c in ( - BaseCache, - MMapCache, - BytesCache, - ReadAheadCache, - BlockCache, - FirstChunkCache, - AllBytes, - KnownPartsOfAFile, - BackgroundBlockCache, -): - register_cache(c) diff --git a/venv/lib/python3.8/site-packages/fsspec/callbacks.py b/venv/lib/python3.8/site-packages/fsspec/callbacks.py deleted file mode 100644 index 4500d02cbcae78d9cd764956d4cc46963b525213..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/callbacks.py +++ /dev/null @@ -1,238 +0,0 @@ -class Callback: - """ - Base class and interface for callback mechanism - - This class can be used directly for monitoring file transfers by - providing ``callback=Callback(hooks=...)`` (see the ``hooks`` argument, - below), or subclassed for more specialised behaviour. - - Parameters - ---------- - size: int (optional) - Nominal quantity for the value that corresponds to a complete - transfer, e.g., total number of tiles or total number of - bytes - value: int (0) - Starting internal counter value - hooks: dict or None - A dict of named functions to be called on each update. The signature - of these must be ``f(size, value, **kwargs)`` - """ - - def __init__(self, size=None, value=0, hooks=None, **kwargs): - self.size = size - self.value = value - self.hooks = hooks or {} - self.kw = kwargs - - def set_size(self, size): - """ - Set the internal maximum size attribute - - Usually called if not initially set at instantiation. Note that this - triggers a ``call()``. - - Parameters - ---------- - size: int - """ - self.size = size - self.call() - - def absolute_update(self, value): - """ - Set the internal value state - - Triggers ``call()`` - - Parameters - ---------- - value: int - """ - self.value = value - self.call() - - def relative_update(self, inc=1): - """ - Delta increment the internal counter - - Triggers ``call()`` - - Parameters - ---------- - inc: int - """ - self.value += inc - self.call() - - def call(self, hook_name=None, **kwargs): - """ - Execute hook(s) with current state - - Each function is passed the internal size and current value - - Parameters - ---------- - hook_name: str or None - If given, execute on this hook - kwargs: passed on to (all) hook(s) - """ - if not self.hooks: - return - kw = self.kw.copy() - kw.update(kwargs) - if hook_name: - if hook_name not in self.hooks: - return - return self.hooks[hook_name](self.size, self.value, **kw) - for hook in self.hooks.values() or []: - hook(self.size, self.value, **kw) - - def wrap(self, iterable): - """ - Wrap an iterable to call ``relative_update`` on each iterations - - Parameters - ---------- - iterable: Iterable - The iterable that is being wrapped - """ - for item in iterable: - self.relative_update() - yield item - - def branch(self, path_1, path_2, kwargs): - """ - Set callbacks for child transfers - - If this callback is operating at a higher level, e.g., put, which may - trigger transfers that can also be monitored. The passed kwargs are - to be *mutated* to add ``callback=``, if this class supports branching - to children. - - Parameters - ---------- - path_1: str - Child's source path - path_2: str - Child's destination path - kwargs: dict - arguments passed to child method, e.g., put_file. - - Returns - ------- - - """ - return None - - def no_op(self, *_, **__): - pass - - def __getattr__(self, item): - """ - If undefined methods are called on this class, nothing happens - """ - return self.no_op - - @classmethod - def as_callback(cls, maybe_callback=None): - """Transform callback=... into Callback instance - - For the special value of ``None``, return the global instance of - ``NoOpCallback``. This is an alternative to including - ``callback=_DEFAULT_CALLBACK`` directly in a method signature. - """ - if maybe_callback is None: - return _DEFAULT_CALLBACK - return maybe_callback - - -class NoOpCallback(Callback): - """ - This implementation of Callback does exactly nothing - """ - - def call(self, *args, **kwargs): - return None - - -class DotPrinterCallback(Callback): - """ - Simple example Callback implementation - - Almost identical to Callback with a hook that prints a char; here we - demonstrate how the outer layer may print "#" and the inner layer "." - """ - - def __init__(self, chr_to_print="#", **kwargs): - self.chr = chr_to_print - super().__init__(**kwargs) - - def branch(self, path_1, path_2, kwargs): - """Mutate kwargs to add new instance with different print char""" - kwargs["callback"] = DotPrinterCallback(".") - - def call(self, **kwargs): - """Just outputs a character""" - print(self.chr, end="") - - -class TqdmCallback(Callback): - """ - A callback to display a progress bar using tqdm - - Parameters - ---------- - tqdm_kwargs : dict, (optional) - Any argument accepted by the tqdm constructor. - See the `tqdm doc `_. - Will be forwarded to tqdm. - - Examples - -------- - >>> import fsspec - >>> from fsspec.callbacks import TqdmCallback - >>> fs = fsspec.filesystem("memory") - >>> path2distant_data = "/your-path" - >>> fs.upload( - ".", - path2distant_data, - recursive=True, - callback=TqdmCallback(), - ) - - You can forward args to tqdm using the ``tqdm_kwargs`` parameter. - - >>> fs.upload( - ".", - path2distant_data, - recursive=True, - callback=TqdmCallback(tqdm_kwargs={"desc": "Your tqdm description"}), - ) - """ - - def __init__(self, tqdm_kwargs=None, *args, **kwargs): - try: - import tqdm - - self._tqdm = tqdm - except ImportError as exce: - raise ImportError( - "Using TqdmCallback requires tqdm to be installed" - ) from exce - - self._tqdm_kwargs = tqdm_kwargs or {} - super().__init__(*args, **kwargs) - - def set_size(self, size): - self.tqdm = self._tqdm.tqdm(total=size, **self._tqdm_kwargs) - - def relative_update(self, inc=1): - self.tqdm.update(inc) - - def __del__(self): - self.tqdm.close() - self.tqdm = None - - -_DEFAULT_CALLBACK = NoOpCallback() diff --git a/venv/lib/python3.8/site-packages/fsspec/compression.py b/venv/lib/python3.8/site-packages/fsspec/compression.py deleted file mode 100644 index 38b1d6dd6501b20d6ae9ed05c4856f56ee3b6ddd..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/compression.py +++ /dev/null @@ -1,176 +0,0 @@ -"""Helper functions for a standard streaming compression API""" -from zipfile import ZipFile - -import fsspec.utils -from fsspec.spec import AbstractBufferedFile - - -def noop_file(file, mode, **kwargs): - return file - - -# TODO: files should also be available as contexts -# should be functions of the form func(infile, mode=, **kwargs) -> file-like -compr = {None: noop_file} - - -def register_compression(name, callback, extensions, force=False): - """Register an "inferable" file compression type. - - Registers transparent file compression type for use with fsspec.open. - Compression can be specified by name in open, or "infer"-ed for any files - ending with the given extensions. - - Args: - name: (str) The compression type name. Eg. "gzip". - callback: A callable of form (infile, mode, **kwargs) -> file-like. - Accepts an input file-like object, the target mode and kwargs. - Returns a wrapped file-like object. - extensions: (str, Iterable[str]) A file extension, or list of file - extensions for which to infer this compression scheme. Eg. "gz". - force: (bool) Force re-registration of compression type or extensions. - - Raises: - ValueError: If name or extensions already registered, and not force. - - """ - if isinstance(extensions, str): - extensions = [extensions] - - # Validate registration - if name in compr and not force: - raise ValueError("Duplicate compression registration: %s" % name) - - for ext in extensions: - if ext in fsspec.utils.compressions and not force: - raise ValueError( - "Duplicate compression file extension: %s (%s)" % (ext, name) - ) - - compr[name] = callback - - for ext in extensions: - fsspec.utils.compressions[ext] = name - - -def unzip(infile, mode="rb", filename=None, **kwargs): - if "r" not in mode: - filename = filename or "file" - z = ZipFile(infile, mode="w", **kwargs) - fo = z.open(filename, mode="w") - fo.close = lambda closer=fo.close: closer() or z.close() - return fo - z = ZipFile(infile) - if filename is None: - filename = z.namelist()[0] - return z.open(filename, mode="r", **kwargs) - - -register_compression("zip", unzip, "zip") - -try: - from bz2 import BZ2File -except ImportError: - pass -else: - register_compression("bz2", BZ2File, "bz2") - -try: # pragma: no cover - from isal import igzip - - def isal(infile, mode="rb", **kwargs): - return igzip.IGzipFile(fileobj=infile, mode=mode, **kwargs) - - register_compression("gzip", isal, "gz") -except ImportError: - from gzip import GzipFile - - register_compression( - "gzip", lambda f, **kwargs: GzipFile(fileobj=f, **kwargs), "gz" - ) - -try: - from lzma import LZMAFile - - register_compression("lzma", LZMAFile, "xz") - register_compression("xz", LZMAFile, "xz", force=True) -except ImportError: - pass - -try: - import lzmaffi - - register_compression("lzma", lzmaffi.LZMAFile, "xz", force=True) - register_compression("xz", lzmaffi.LZMAFile, "xz", force=True) -except ImportError: - pass - - -class SnappyFile(AbstractBufferedFile): - def __init__(self, infile, mode, **kwargs): - import snappy - - super().__init__( - fs=None, path="snappy", mode=mode.strip("b") + "b", size=999999999, **kwargs - ) - self.infile = infile - if "r" in mode: - self.codec = snappy.StreamDecompressor() - else: - self.codec = snappy.StreamCompressor() - - def _upload_chunk(self, final=False): - self.buffer.seek(0) - out = self.codec.add_chunk(self.buffer.read()) - self.infile.write(out) - return True - - def seek(self, loc, whence=0): - raise NotImplementedError("SnappyFile is not seekable") - - def seekable(self): - return False - - def _fetch_range(self, start, end): - """Get the specified set of bytes from remote""" - data = self.infile.read(end - start) - return self.codec.decompress(data) - - -try: - import snappy - - snappy.compress - # Snappy may use the .sz file extension, but this is not part of the - # standard implementation. - register_compression("snappy", SnappyFile, []) - -except (ImportError, NameError, AttributeError): - pass - -try: - import lz4.frame - - register_compression("lz4", lz4.frame.open, "lz4") -except ImportError: - pass - -try: - import zstandard as zstd - - def zstandard_file(infile, mode="rb"): - if "r" in mode: - cctx = zstd.ZstdDecompressor() - return cctx.stream_reader(infile) - else: - cctx = zstd.ZstdCompressor(level=10) - return cctx.stream_writer(infile) - - register_compression("zstd", zstandard_file, "zst") -except ImportError: - pass - - -def available_compressions(): - """Return a list of the implemented compressions.""" - return list(compr) diff --git a/venv/lib/python3.8/site-packages/fsspec/config.py b/venv/lib/python3.8/site-packages/fsspec/config.py deleted file mode 100644 index 76d9af14aaf7df47c4551c169f27b05abf9c269e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/config.py +++ /dev/null @@ -1,131 +0,0 @@ -from __future__ import annotations - -import configparser -import json -import os -import warnings -from typing import Any - -conf: dict[str, dict[str, Any]] = {} -default_conf_dir = os.path.join(os.path.expanduser("~"), ".config/fsspec") -conf_dir = os.environ.get("FSSPEC_CONFIG_DIR", default_conf_dir) - - -def set_conf_env(conf_dict, envdict=os.environ): - """Set config values from environment variables - - Looks for variables of the form ``FSSPEC_`` and - ``FSSPEC__``. For ``FSSPEC_`` the value is parsed - as a json dictionary and used to ``update`` the config of the - corresponding protocol. For ``FSSPEC__`` there is no - attempt to convert the string value, but the kwarg keys will be lower-cased. - - The ``FSSPEC__`` variables are applied after the - ``FSSPEC_`` ones. - - Parameters - ---------- - conf_dict : dict(str, dict) - This dict will be mutated - envdict : dict-like(str, str) - Source for the values - usually the real environment - """ - kwarg_keys = [] - for key in envdict: - if key.startswith("FSSPEC_") and len(key) > 7 and key[7] != "_": - if key.count("_") > 1: - kwarg_keys.append(key) - continue - try: - value = json.loads(envdict[key]) - except json.decoder.JSONDecodeError as ex: - warnings.warn( - f"Ignoring environment variable {key} due to a parse failure: {ex}" - ) - else: - if isinstance(value, dict): - _, proto = key.split("_", 1) - conf_dict.setdefault(proto.lower(), {}).update(value) - else: - warnings.warn( - f"Ignoring environment variable {key} due to not being a dict:" - f" {type(value)}" - ) - elif key.startswith("FSSPEC"): - warnings.warn( - f"Ignoring environment variable {key} due to having an unexpected name" - ) - - for key in kwarg_keys: - _, proto, kwarg = key.split("_", 2) - conf_dict.setdefault(proto.lower(), {})[kwarg.lower()] = envdict[key] - - -def set_conf_files(cdir, conf_dict): - """Set config values from files - - Scans for INI and JSON files in the given dictionary, and uses their - contents to set the config. In case of repeated values, later values - win. - - In the case of INI files, all values are strings, and these will not - be converted. - - Parameters - ---------- - cdir : str - Directory to search - conf_dict : dict(str, dict) - This dict will be mutated - """ - if not os.path.isdir(cdir): - return - allfiles = sorted(os.listdir(cdir)) - for fn in allfiles: - if fn.endswith(".ini"): - ini = configparser.ConfigParser() - ini.read(os.path.join(cdir, fn)) - for key in ini: - if key == "DEFAULT": - continue - conf_dict.setdefault(key, {}).update(dict(ini[key])) - if fn.endswith(".json"): - with open(os.path.join(cdir, fn)) as f: - js = json.load(f) - for key in js: - conf_dict.setdefault(key, {}).update(dict(js[key])) - - -def apply_config(cls, kwargs, conf_dict=None): - """Supply default values for kwargs when instantiating class - - Augments the passed kwargs, by finding entries in the config dict - which match the classes ``.protocol`` attribute (one or more str) - - Parameters - ---------- - cls : file system implementation - kwargs : dict - conf_dict : dict of dict - Typically this is the global configuration - - Returns - ------- - dict : the modified set of kwargs - """ - if conf_dict is None: - conf_dict = conf - protos = cls.protocol if isinstance(cls.protocol, (tuple, list)) else [cls.protocol] - kw = {} - for proto in protos: - # default kwargs from the current state of the config - if proto in conf_dict: - kw.update(conf_dict[proto]) - # explicit kwargs always win - kw.update(**kwargs) - kwargs = kw - return kwargs - - -set_conf_files(conf_dir, conf) -set_conf_env(conf) diff --git a/venv/lib/python3.8/site-packages/fsspec/conftest.py b/venv/lib/python3.8/site-packages/fsspec/conftest.py deleted file mode 100644 index 6874a42c4895c3c7b973dc5d63fd4488a4e60b44..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/conftest.py +++ /dev/null @@ -1,55 +0,0 @@ -import os -import shutil -import subprocess -import sys -import time - -import pytest - -import fsspec -from fsspec.implementations.cached import CachingFileSystem - - -@pytest.fixture() -def m(): - """ - Fixture providing a memory filesystem. - """ - m = fsspec.filesystem("memory") - m.store.clear() - m.pseudo_dirs.clear() - m.pseudo_dirs.append("") - try: - yield m - finally: - m.store.clear() - m.pseudo_dirs.clear() - m.pseudo_dirs.append("") - - -@pytest.fixture -def ftp_writable(tmpdir): - """ - Fixture providing a writable FTP filesystem. - """ - pytest.importorskip("pyftpdlib") - from fsspec.implementations.ftp import FTPFileSystem - - FTPFileSystem.clear_instance_cache() # remove lingering connections - CachingFileSystem.clear_instance_cache() - d = str(tmpdir) - with open(os.path.join(d, "out"), "wb") as f: - f.write(b"hello" * 10000) - P = subprocess.Popen( - [sys.executable, "-m", "pyftpdlib", "-d", d, "-u", "user", "-P", "pass", "-w"] - ) - try: - time.sleep(1) - yield "localhost", 2121, "user", "pass" - finally: - P.terminate() - P.wait() - try: - shutil.rmtree(tmpdir) - except Exception: - pass diff --git a/venv/lib/python3.8/site-packages/fsspec/core.py b/venv/lib/python3.8/site-packages/fsspec/core.py deleted file mode 100644 index 6e5a831ae4e6210ec1a35528d725df19509ab5a1..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/core.py +++ /dev/null @@ -1,697 +0,0 @@ -import io -import logging -import os -import re -from glob import has_magic - -# for backwards compat, we export cache things from here too -from .caching import ( # noqa: F401 - BaseCache, - BlockCache, - BytesCache, - MMapCache, - ReadAheadCache, - caches, -) -from .compression import compr -from .registry import filesystem, get_filesystem_class -from .utils import ( - _unstrip_protocol, - build_name_function, - infer_compression, - stringify_path, -) - -logger = logging.getLogger("fsspec") - - -class OpenFile: - """ - File-like object to be used in a context - - Can layer (buffered) text-mode and compression over any file-system, which - are typically binary-only. - - These instances are safe to serialize, as the low-level file object - is not created until invoked using ``with``. - - Parameters - ---------- - fs: FileSystem - The file system to use for opening the file. Should be a subclass or duck-type - with ``fsspec.spec.AbstractFileSystem`` - path: str - Location to open - mode: str like 'rb', optional - Mode of the opened file - compression: str or None, optional - Compression to apply - encoding: str or None, optional - The encoding to use if opened in text mode. - errors: str or None, optional - How to handle encoding errors if opened in text mode. - newline: None or str - Passed to TextIOWrapper in text mode, how to handle line endings. - autoopen: bool - If True, calls open() immediately. Mostly used by pickle - pos: int - If given and autoopen is True, seek to this location immediately - """ - - def __init__( - self, - fs, - path, - mode="rb", - compression=None, - encoding=None, - errors=None, - newline=None, - ): - self.fs = fs - self.path = path - self.mode = mode - self.compression = get_compression(path, compression) - self.encoding = encoding - self.errors = errors - self.newline = newline - self.fobjects = [] - - def __reduce__(self): - return ( - OpenFile, - ( - self.fs, - self.path, - self.mode, - self.compression, - self.encoding, - self.errors, - self.newline, - ), - ) - - def __repr__(self): - return "".format(self.path) - - def __enter__(self): - mode = self.mode.replace("t", "").replace("b", "") + "b" - - f = self.fs.open(self.path, mode=mode) - - self.fobjects = [f] - - if self.compression is not None: - compress = compr[self.compression] - f = compress(f, mode=mode[0]) - self.fobjects.append(f) - - if "b" not in self.mode: - # assume, for example, that 'r' is equivalent to 'rt' as in builtin - f = PickleableTextIOWrapper( - f, encoding=self.encoding, errors=self.errors, newline=self.newline - ) - self.fobjects.append(f) - - return self.fobjects[-1] - - def __exit__(self, *args): - self.close() - - @property - def full_name(self): - return _unstrip_protocol(self.path, self.fs) - - def open(self): - """Materialise this as a real open file without context - - The OpenFile object should be explicitly closed to avoid enclosed file - instances persisting. You must, therefore, keep a reference to the OpenFile - during the life of the file-like it generates. - """ - return self.__enter__() - - def close(self): - """Close all encapsulated file objects""" - for f in reversed(self.fobjects): - if "r" not in self.mode and not f.closed: - f.flush() - f.close() - self.fobjects.clear() - - -class OpenFiles(list): - """List of OpenFile instances - - Can be used in a single context, which opens and closes all of the - contained files. Normal list access to get the elements works as - normal. - - A special case is made for caching filesystems - the files will - be down/uploaded together at the start or end of the context, and - this may happen concurrently, if the target filesystem supports it. - """ - - def __init__(self, *args, mode="rb", fs=None): - self.mode = mode - self.fs = fs - self.files = [] - super().__init__(*args) - - def __enter__(self): - if self.fs is None: - raise ValueError("Context has already been used") - - fs = self.fs - while True: - if hasattr(fs, "open_many"): - # check for concurrent cache download; or set up for upload - self.files = fs.open_many(self) - return self.files - if hasattr(fs, "fs") and fs.fs is not None: - fs = fs.fs - else: - break - return [s.__enter__() for s in self] - - def __exit__(self, *args): - fs = self.fs - [s.__exit__(*args) for s in self] - if "r" not in self.mode: - while True: - if hasattr(fs, "open_many"): - # check for concurrent cache upload - fs.commit_many(self.files) - return - if hasattr(fs, "fs") and fs.fs is not None: - fs = fs.fs - else: - break - - def __getitem__(self, item): - out = super().__getitem__(item) - if isinstance(item, slice): - return OpenFiles(out, mode=self.mode, fs=self.fs) - return out - - def __repr__(self): - return "" % len(self) - - -def open_files( - urlpath, - mode="rb", - compression=None, - encoding="utf8", - errors=None, - name_function=None, - num=1, - protocol=None, - newline=None, - auto_mkdir=True, - expand=True, - **kwargs, -): - """Given a path or paths, return a list of ``OpenFile`` objects. - - For writing, a str path must contain the "*" character, which will be filled - in by increasing numbers, e.g., "part*" -> "part1", "part2" if num=2. - - For either reading or writing, can instead provide explicit list of paths. - - Parameters - ---------- - urlpath: string or list - Absolute or relative filepath(s). Prefix with a protocol like ``s3://`` - to read from alternative filesystems. To read from multiple files you - can pass a globstring or a list of paths, with the caveat that they - must all have the same protocol. - mode: 'rb', 'wt', etc. - compression: string or None - If given, open file using compression codec. Can either be a compression - name (a key in ``fsspec.compression.compr``) or "infer" to guess the - compression from the filename suffix. - encoding: str - For text mode only - errors: None or str - Passed to TextIOWrapper in text mode - name_function: function or None - if opening a set of files for writing, those files do not yet exist, - so we need to generate their names by formatting the urlpath for - each sequence number - num: int [1] - if writing mode, number of files we expect to create (passed to - name+function) - protocol: str or None - If given, overrides the protocol found in the URL. - newline: bytes or None - Used for line terminator in text mode. If None, uses system default; - if blank, uses no translation. - auto_mkdir: bool (True) - If in write mode, this will ensure the target directory exists before - writing, by calling ``fs.mkdirs(exist_ok=True)``. - expand: bool - **kwargs: dict - Extra options that make sense to a particular storage connection, e.g. - host, port, username, password, etc. - - Examples - -------- - >>> files = open_files('2015-*-*.csv') # doctest: +SKIP - >>> files = open_files( - ... 's3://bucket/2015-*-*.csv.gz', compression='gzip' - ... ) # doctest: +SKIP - - Returns - ------- - An ``OpenFiles`` instance, which is a list of ``OpenFile`` objects that can - be used as a single context - - Notes - ----- - For a full list of the available protocols and the implementations that - they map across to see the latest online documentation: - - - For implementations built into ``fsspec`` see - https://filesystem-spec.readthedocs.io/en/latest/api.html#built-in-implementations - - For implementations in separate packages see - https://filesystem-spec.readthedocs.io/en/latest/api.html#other-known-implementations - """ - fs, fs_token, paths = get_fs_token_paths( - urlpath, - mode, - num=num, - name_function=name_function, - storage_options=kwargs, - protocol=protocol, - expand=expand, - ) - if fs.protocol == "file": - fs.auto_mkdir = auto_mkdir - elif "r" not in mode and auto_mkdir: - parents = {fs._parent(path) for path in paths} - [fs.makedirs(parent, exist_ok=True) for parent in parents] - return OpenFiles( - [ - OpenFile( - fs, - path, - mode=mode, - compression=compression, - encoding=encoding, - errors=errors, - newline=newline, - ) - for path in paths - ], - mode=mode, - fs=fs, - ) - - -def _un_chain(path, kwargs): - x = re.compile(".*[^a-z]+.*") # test for non protocol-like single word - bits = ( - [p if "://" in p or x.match(p) else p + "://" for p in path.split("::")] - if "::" in path - else [path] - ) - # [[url, protocol, kwargs], ...] - out = [] - previous_bit = None - kwargs = kwargs.copy() - for bit in reversed(bits): - protocol = kwargs.pop("protocol", None) or split_protocol(bit)[0] or "file" - cls = get_filesystem_class(protocol) - extra_kwargs = cls._get_kwargs_from_urls(bit) - kws = kwargs.pop(protocol, {}) - if bit is bits[0]: - kws.update(kwargs) - kw = dict(**extra_kwargs, **kws) - bit = cls._strip_protocol(bit) - if ( - protocol in {"blockcache", "filecache", "simplecache"} - and "target_protocol" not in kw - ): - bit = previous_bit - out.append((bit, protocol, kw)) - previous_bit = bit - out = list(reversed(out)) - return out - - -def url_to_fs(url, **kwargs): - """ - Turn fully-qualified and potentially chained URL into filesystem instance - - Parameters - ---------- - url : str - The fsspec-compatible URL - **kwargs: dict - Extra options that make sense to a particular storage connection, e.g. - host, port, username, password, etc. - - Returns - ------- - filesystem : FileSystem - The new filesystem discovered from ``url`` and created with - ``**kwargs``. - urlpath : str - The file-systems-specific URL for ``url``. - """ - # non-FS arguments that appear in fsspec.open() - # inspect could keep this in sync with open()'s signature - known_kwargs = { - "compression", - "encoding", - "errors", - "expand", - "mode", - "name_function", - "newline", - "num", - } - kwargs = {k: v for k, v in kwargs.items() if k not in known_kwargs} - chain = _un_chain(url, kwargs) - inkwargs = {} - # Reverse iterate the chain, creating a nested target_* structure - for i, ch in enumerate(reversed(chain)): - urls, protocol, kw = ch - if i == len(chain) - 1: - inkwargs = dict(**kw, **inkwargs) - continue - inkwargs["target_options"] = dict(**kw, **inkwargs) - inkwargs["target_protocol"] = protocol - inkwargs["fo"] = urls - urlpath, protocol, _ = chain[0] - fs = filesystem(protocol, **inkwargs) - return fs, urlpath - - -def open( - urlpath, - mode="rb", - compression=None, - encoding="utf8", - errors=None, - protocol=None, - newline=None, - **kwargs, -): - """Given a path or paths, return one ``OpenFile`` object. - - Parameters - ---------- - urlpath: string or list - Absolute or relative filepath. Prefix with a protocol like ``s3://`` - to read from alternative filesystems. Should not include glob - character(s). - mode: 'rb', 'wt', etc. - compression: string or None - If given, open file using compression codec. Can either be a compression - name (a key in ``fsspec.compression.compr``) or "infer" to guess the - compression from the filename suffix. - encoding: str - For text mode only - errors: None or str - Passed to TextIOWrapper in text mode - protocol: str or None - If given, overrides the protocol found in the URL. - newline: bytes or None - Used for line terminator in text mode. If None, uses system default; - if blank, uses no translation. - **kwargs: dict - Extra options that make sense to a particular storage connection, e.g. - host, port, username, password, etc. - - Examples - -------- - >>> openfile = open('2015-01-01.csv') # doctest: +SKIP - >>> openfile = open( - ... 's3://bucket/2015-01-01.csv.gz', compression='gzip' - ... ) # doctest: +SKIP - >>> with openfile as f: - ... df = pd.read_csv(f) # doctest: +SKIP - ... - - Returns - ------- - ``OpenFile`` object. - - Notes - ----- - For a full list of the available protocols and the implementations that - they map across to see the latest online documentation: - - - For implementations built into ``fsspec`` see - https://filesystem-spec.readthedocs.io/en/latest/api.html#built-in-implementations - - For implementations in separate packages see - https://filesystem-spec.readthedocs.io/en/latest/api.html#other-known-implementations - """ - out = open_files( - urlpath=[urlpath], - mode=mode, - compression=compression, - encoding=encoding, - errors=errors, - protocol=protocol, - newline=newline, - expand=False, - **kwargs, - ) - if not out: - raise FileNotFoundError(urlpath) - return out[0] - - -def open_local(url, mode="rb", **storage_options): - """Open file(s) which can be resolved to local - - For files which either are local, or get downloaded upon open - (e.g., by file caching) - - Parameters - ---------- - url: str or list(str) - mode: str - Must be read mode - storage_options: - passed on to FS for or used by open_files (e.g., compression) - """ - if "r" not in mode: - raise ValueError("Can only ensure local files when reading") - of = open_files(url, mode=mode, **storage_options) - if not getattr(of[0].fs, "local_file", False): - raise ValueError( - "open_local can only be used on a filesystem which" - " has attribute local_file=True" - ) - with of as files: - paths = [f.name for f in files] - if isinstance(url, str) and not has_magic(url): - return paths[0] - return paths - - -def get_compression(urlpath, compression): - if compression == "infer": - compression = infer_compression(urlpath) - if compression is not None and compression not in compr: - raise ValueError("Compression type %s not supported" % compression) - return compression - - -def split_protocol(urlpath): - """Return protocol, path pair""" - urlpath = stringify_path(urlpath) - if "://" in urlpath: - protocol, path = urlpath.split("://", 1) - if len(protocol) > 1: - # excludes Windows paths - return protocol, path - return None, urlpath - - -def strip_protocol(urlpath): - """Return only path part of full URL, according to appropriate backend""" - protocol, _ = split_protocol(urlpath) - cls = get_filesystem_class(protocol) - return cls._strip_protocol(urlpath) - - -def expand_paths_if_needed(paths, mode, num, fs, name_function): - """Expand paths if they have a ``*`` in them (write mode) or any of ``*?[]`` - in them (read mode). - - :param paths: list of paths - mode: str - Mode in which to open files. - num: int - If opening in writing mode, number of files we expect to create. - fs: filesystem object - name_function: callable - If opening in writing mode, this callable is used to generate path - names. Names are generated for each partition by - ``urlpath.replace('*', name_function(partition_index))``. - :return: list of paths - """ - expanded_paths = [] - paths = list(paths) - - if "w" in mode: # read mode - if sum([1 for p in paths if "*" in p]) > 1: - raise ValueError( - "When writing data, only one filename mask can be specified." - ) - num = max(num, len(paths)) - - for curr_path in paths: - if "*" in curr_path: - # expand using name_function - expanded_paths.extend(_expand_paths(curr_path, name_function, num)) - else: - expanded_paths.append(curr_path) - # if we generated more paths that asked for, trim the list - if len(expanded_paths) > num: - expanded_paths = expanded_paths[:num] - - else: # read mode - for curr_path in paths: - if has_magic(curr_path): - # expand using glob - expanded_paths.extend(fs.glob(curr_path)) - else: - expanded_paths.append(curr_path) - - return expanded_paths - - -def get_fs_token_paths( - urlpath, - mode="rb", - num=1, - name_function=None, - storage_options=None, - protocol=None, - expand=True, -): - """Filesystem, deterministic token, and paths from a urlpath and options. - - Parameters - ---------- - urlpath: string or iterable - Absolute or relative filepath, URL (may include protocols like - ``s3://``), or globstring pointing to data. - mode: str, optional - Mode in which to open files. - num: int, optional - If opening in writing mode, number of files we expect to create. - name_function: callable, optional - If opening in writing mode, this callable is used to generate path - names. Names are generated for each partition by - ``urlpath.replace('*', name_function(partition_index))``. - storage_options: dict, optional - Additional keywords to pass to the filesystem class. - protocol: str or None - To override the protocol specifier in the URL - expand: bool - Expand string paths for writing, assuming the path is a directory - """ - if isinstance(urlpath, (list, tuple, set)): - if not urlpath: - raise ValueError("empty urlpath sequence") - urlpath0 = stringify_path(list(urlpath)[0]) - else: - urlpath0 = stringify_path(urlpath) - storage_options = storage_options or {} - if protocol: - storage_options["protocol"] = protocol - chain = _un_chain(urlpath0, storage_options or {}) - inkwargs = {} - # Reverse iterate the chain, creating a nested target_* structure - for i, ch in enumerate(reversed(chain)): - urls, nested_protocol, kw = ch - if i == len(chain) - 1: - inkwargs = dict(**kw, **inkwargs) - continue - inkwargs["target_options"] = dict(**kw, **inkwargs) - inkwargs["target_protocol"] = nested_protocol - inkwargs["fo"] = urls - paths, protocol, _ = chain[0] - fs = filesystem(protocol, **inkwargs) - if isinstance(urlpath, (list, tuple, set)): - pchains = [ - _un_chain(stringify_path(u), storage_options or {})[0] for u in urlpath - ] - if len({pc[1] for pc in pchains}) > 1: - raise ValueError("Protocol mismatch getting fs from %s", urlpath) - paths = [pc[0] for pc in pchains] - else: - paths = fs._strip_protocol(paths) - if isinstance(paths, (list, tuple, set)): - paths = expand_paths_if_needed(paths, mode, num, fs, name_function) - else: - if "w" in mode and expand: - paths = _expand_paths(paths, name_function, num) - elif "x" in mode and expand: - paths = _expand_paths(paths, name_function, num) - elif "*" in paths: - paths = [f for f in sorted(fs.glob(paths)) if not fs.isdir(f)] - else: - paths = [paths] - - return fs, fs._fs_token, paths - - -def _expand_paths(path, name_function, num): - if isinstance(path, str): - if path.count("*") > 1: - raise ValueError("Output path spec must contain exactly one '*'.") - elif "*" not in path: - path = os.path.join(path, "*.part") - - if name_function is None: - name_function = build_name_function(num - 1) - - paths = [path.replace("*", name_function(i)) for i in range(num)] - if paths != sorted(paths): - logger.warning( - "In order to preserve order between partitions" - " paths created with ``name_function`` should " - "sort to partition order" - ) - elif isinstance(path, (tuple, list)): - assert len(path) == num - paths = list(path) - else: - raise ValueError( - "Path should be either\n" - "1. A list of paths: ['foo.json', 'bar.json', ...]\n" - "2. A directory: 'foo/\n" - "3. A path with a '*' in it: 'foo.*.json'" - ) - return paths - - -class PickleableTextIOWrapper(io.TextIOWrapper): - """TextIOWrapper cannot be pickled. This solves it. - - Requires that ``buffer`` be pickleable, which all instances of - AbstractBufferedFile are. - """ - - def __init__( - self, - buffer, - encoding=None, - errors=None, - newline=None, - line_buffering=False, - write_through=False, - ): - self.args = buffer, encoding, errors, newline, line_buffering, write_through - super().__init__(*self.args) - - def __reduce__(self): - return PickleableTextIOWrapper, self.args diff --git a/venv/lib/python3.8/site-packages/fsspec/dircache.py b/venv/lib/python3.8/site-packages/fsspec/dircache.py deleted file mode 100644 index eca19566b135e5a7a4f6e7407d56411ec58bfe44..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/dircache.py +++ /dev/null @@ -1,98 +0,0 @@ -import time -from collections.abc import MutableMapping -from functools import lru_cache - - -class DirCache(MutableMapping): - """ - Caching of directory listings, in a structure like:: - - {"path0": [ - {"name": "path0/file0", - "size": 123, - "type": "file", - ... - }, - {"name": "path0/file1", - }, - ... - ], - "path1": [...] - } - - Parameters to this class control listing expiry or indeed turn - caching off - """ - - def __init__( - self, - use_listings_cache=True, - listings_expiry_time=None, - max_paths=None, - **kwargs, - ): - """ - - Parameters - ---------- - use_listings_cache: bool - If False, this cache never returns items, but always reports KeyError, - and setting items has no effect - listings_expiry_time: int or float (optional) - Time in seconds that a listing is considered valid. If None, - listings do not expire. - max_paths: int (optional) - The number of most recent listings that are considered valid; 'recent' - refers to when the entry was set. - """ - self._cache = {} - self._times = {} - if max_paths: - self._q = lru_cache(max_paths + 1)(lambda key: self._cache.pop(key, None)) - self.use_listings_cache = use_listings_cache - self.listings_expiry_time = listings_expiry_time - self.max_paths = max_paths - - def __getitem__(self, item): - if self.listings_expiry_time is not None: - if self._times.get(item, 0) - time.time() < -self.listings_expiry_time: - del self._cache[item] - if self.max_paths: - self._q(item) - return self._cache[item] # maybe raises KeyError - - def clear(self): - self._cache.clear() - - def __len__(self): - return len(self._cache) - - def __contains__(self, item): - try: - self[item] - return True - except KeyError: - return False - - def __setitem__(self, key, value): - if not self.use_listings_cache: - return - if self.max_paths: - self._q(key) - self._cache[key] = value - if self.listings_expiry_time is not None: - self._times[key] = time.time() - - def __delitem__(self, key): - del self._cache[key] - - def __iter__(self): - entries = list(self._cache) - - return (k for k in entries if k in self) - - def __reduce__(self): - return ( - DirCache, - (self.use_listings_cache, self.listings_expiry_time, self.max_paths), - ) diff --git a/venv/lib/python3.8/site-packages/fsspec/exceptions.py b/venv/lib/python3.8/site-packages/fsspec/exceptions.py deleted file mode 100644 index 2d6e1a44b6a1667d1c302869ff2a332634fda47e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/exceptions.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -fsspec user-defined exception classes -""" -import asyncio - - -class BlocksizeMismatchError(ValueError): - """ - Raised when a cached file is opened with a different blocksize than it was - written with - """ - - ... - - -class FSTimeoutError(asyncio.TimeoutError): - """ - Raised when a fsspec function timed out occurs - """ - - ... diff --git a/venv/lib/python3.8/site-packages/fsspec/fuse.py b/venv/lib/python3.8/site-packages/fsspec/fuse.py deleted file mode 100644 index cdf742a52cfaa1ccbb37a9d053cf428831e59b19..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/fuse.py +++ /dev/null @@ -1,324 +0,0 @@ -import argparse -import logging -import os -import stat -import threading -import time -from errno import EIO, ENOENT - -from fuse import FUSE, FuseOSError, LoggingMixIn, Operations - -from fsspec import __version__ -from fsspec.core import url_to_fs - -logger = logging.getLogger("fsspec.fuse") - - -class FUSEr(Operations): - def __init__(self, fs, path, ready_file=False): - self.fs = fs - self.cache = {} - self.root = path.rstrip("/") + "/" - self.counter = 0 - logger.info("Starting FUSE at %s", path) - self._ready_file = ready_file - - def getattr(self, path, fh=None): - logger.debug("getattr %s", path) - if self._ready_file and path in ["/.fuse_ready", ".fuse_ready"]: - return {"type": "file", "st_size": 5} - - path = "".join([self.root, path.lstrip("/")]).rstrip("/") - try: - info = self.fs.info(path) - except FileNotFoundError: - raise FuseOSError(ENOENT) - - data = {"st_uid": info.get("uid", 1000), "st_gid": info.get("gid", 1000)} - perm = info.get("mode", 0o777) - - if info["type"] != "file": - data["st_mode"] = stat.S_IFDIR | perm - data["st_size"] = 0 - data["st_blksize"] = 0 - else: - data["st_mode"] = stat.S_IFREG | perm - data["st_size"] = info["size"] - data["st_blksize"] = 5 * 2**20 - data["st_nlink"] = 1 - data["st_atime"] = info["atime"] if "atime" in info else time.time() - data["st_ctime"] = info["ctime"] if "ctime" in info else time.time() - data["st_mtime"] = info["mtime"] if "mtime" in info else time.time() - return data - - def readdir(self, path, fh): - logger.debug("readdir %s", path) - path = "".join([self.root, path.lstrip("/")]) - files = self.fs.ls(path, False) - files = [os.path.basename(f.rstrip("/")) for f in files] - return [".", ".."] + files - - def mkdir(self, path, mode): - path = "".join([self.root, path.lstrip("/")]) - self.fs.mkdir(path) - return 0 - - def rmdir(self, path): - path = "".join([self.root, path.lstrip("/")]) - self.fs.rmdir(path) - return 0 - - def read(self, path, size, offset, fh): - logger.debug("read %s", (path, size, offset)) - if self._ready_file and path in ["/.fuse_ready", ".fuse_ready"]: - # status indicator - return b"ready" - - f = self.cache[fh] - f.seek(offset) - out = f.read(size) - return out - - def write(self, path, data, offset, fh): - logger.debug("write %s", (path, offset)) - f = self.cache[fh] - f.seek(offset) - f.write(data) - return len(data) - - def create(self, path, flags, fi=None): - logger.debug("create %s", (path, flags)) - fn = "".join([self.root, path.lstrip("/")]) - self.fs.touch(fn) # OS will want to get attributes immediately - f = self.fs.open(fn, "wb") - self.cache[self.counter] = f - self.counter += 1 - return self.counter - 1 - - def open(self, path, flags): - logger.debug("open %s", (path, flags)) - fn = "".join([self.root, path.lstrip("/")]) - if flags % 2 == 0: - # read - mode = "rb" - else: - # write/create - mode = "wb" - self.cache[self.counter] = self.fs.open(fn, mode) - self.counter += 1 - return self.counter - 1 - - def truncate(self, path, length, fh=None): - fn = "".join([self.root, path.lstrip("/")]) - if length != 0: - raise NotImplementedError - # maybe should be no-op since open with write sets size to zero anyway - self.fs.touch(fn) - - def unlink(self, path): - fn = "".join([self.root, path.lstrip("/")]) - try: - self.fs.rm(fn, False) - except (OSError, FileNotFoundError): - raise FuseOSError(EIO) - - def release(self, path, fh): - try: - if fh in self.cache: - f = self.cache[fh] - f.close() - self.cache.pop(fh) - except Exception as e: - print(e) - return 0 - - def chmod(self, path, mode): - if hasattr(self.fs, "chmod"): - path = "".join([self.root, path.lstrip("/")]) - return self.fs.chmod(path, mode) - raise NotImplementedError - - -def run( - fs, - path, - mount_point, - foreground=True, - threads=False, - ready_file=False, - ops_class=FUSEr, -): - """Mount stuff in a local directory - - This uses fusepy to make it appear as if a given path on an fsspec - instance is in fact resident within the local file-system. - - This requires that fusepy by installed, and that FUSE be available on - the system (typically requiring a package to be installed with - apt, yum, brew, etc.). - - Parameters - ---------- - fs: file-system instance - From one of the compatible implementations - path: str - Location on that file-system to regard as the root directory to - mount. Note that you typically should include the terminating "/" - character. - mount_point: str - An empty directory on the local file-system where the contents of - the remote path will appear. - foreground: bool - Whether or not calling this function will block. Operation will - typically be more stable if True. - threads: bool - Whether or not to create threads when responding to file operations - within the mounter directory. Operation will typically be more - stable if False. - ready_file: bool - Whether the FUSE process is ready. The ``.fuse_ready`` file will - exist in the ``mount_point`` directory if True. Debugging purpose. - ops_class: FUSEr or Subclass of FUSEr - To override the default behavior of FUSEr. For Example, logging - to file. - - """ - func = lambda: FUSE( - ops_class(fs, path, ready_file=ready_file), - mount_point, - nothreads=not threads, - foreground=foreground, - ) - if not foreground: - th = threading.Thread(target=func) - th.daemon = True - th.start() - return th - else: # pragma: no cover - try: - func() - except KeyboardInterrupt: - pass - - -def main(args): - """Mount filesystem from chained URL to MOUNT_POINT. - - Examples: - - python3 -m fsspec.fuse memory /usr/share /tmp/mem - - python3 -m fsspec.fuse local /tmp/source /tmp/local \\ - -l /tmp/fsspecfuse.log - - You can also mount chained-URLs and use special settings: - - python3 -m fsspec.fuse 'filecache::zip::file://data.zip' \\ - / /tmp/zip \\ - -o 'filecache-cache_storage=/tmp/simplecache' - - You can specify the type of the setting by using `[int]` or `[bool]`, - (`true`, `yes`, `1` represents the Boolean value `True`): - - python3 -m fsspec.fuse 'simplecache::ftp://ftp1.at.proftpd.org' \\ - /historic/packages/RPMS /tmp/ftp \\ - -o 'simplecache-cache_storage=/tmp/simplecache' \\ - -o 'simplecache-check_files=false[bool]' \\ - -o 'ftp-listings_expiry_time=60[int]' \\ - -o 'ftp-username=anonymous' \\ - -o 'ftp-password=xieyanbo' - """ - - class RawDescriptionArgumentParser(argparse.ArgumentParser): - def format_help(self): - usage = super(RawDescriptionArgumentParser, self).format_help() - parts = usage.split("\n\n") - parts[1] = self.description.rstrip() - return "\n\n".join(parts) - - parser = RawDescriptionArgumentParser(prog="fsspec.fuse", description=main.__doc__) - parser.add_argument("--version", action="version", version=__version__) - parser.add_argument("url", type=str, help="fs url") - parser.add_argument("source_path", type=str, help="source directory in fs") - parser.add_argument("mount_point", type=str, help="local directory") - parser.add_argument( - "-o", - "--option", - action="append", - help="Any options of protocol included in the chained URL", - ) - parser.add_argument( - "-l", "--log-file", type=str, help="Logging FUSE debug info (Default: '')" - ) - parser.add_argument( - "-f", - "--foreground", - action="store_false", - help="Running in foreground or not (Default: False)", - ) - parser.add_argument( - "-t", - "--threads", - action="store_false", - help="Running with threads support (Default: False)", - ) - parser.add_argument( - "-r", - "--ready-file", - action="store_false", - help="The `.fuse_ready` file will exist after FUSE is ready. " - "(Debugging purpose, Default: False)", - ) - args = parser.parse_args(args) - - kwargs = {} - for item in args.option or []: - key, sep, value = item.partition("=") - if not sep: - parser.error(message="Wrong option: {!r}".format(item)) - val = value.lower() - if val.endswith("[int]"): - value = int(value[: -len("[int]")]) - elif val.endswith("[bool]"): - value = val[: -len("[bool]")] in ["1", "yes", "true"] - - if "-" in key: - fs_name, setting_name = key.split("-", 1) - if fs_name in kwargs: - kwargs[fs_name][setting_name] = value - else: - kwargs[fs_name] = {setting_name: value} - else: - kwargs[key] = value - - if args.log_file: - logging.basicConfig( - level=logging.DEBUG, - filename=args.log_file, - format="%(asctime)s %(message)s", - ) - - class LoggingFUSEr(FUSEr, LoggingMixIn): - pass - - fuser = LoggingFUSEr - else: - fuser = FUSEr - - fs, url_path = url_to_fs(args.url, **kwargs) - logger.debug("Mounting %s to %s", url_path, str(args.mount_point)) - run( - fs, - args.source_path, - args.mount_point, - foreground=args.foreground, - threads=args.threads, - ready_file=args.ready_file, - ops_class=fuser, - ) - - -if __name__ == "__main__": - import sys - - main(sys.argv[1:]) diff --git a/venv/lib/python3.8/site-packages/fsspec/generic.py b/venv/lib/python3.8/site-packages/fsspec/generic.py deleted file mode 100644 index 15151f3303a2360ddcb23616394751339b2da1f5..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/generic.py +++ /dev/null @@ -1,396 +0,0 @@ -from __future__ import annotations - -import inspect -import logging -import os -import shutil -import uuid -from typing import Optional - -from .asyn import AsyncFileSystem, _run_coros_in_chunks, sync_wrapper -from .callbacks import _DEFAULT_CALLBACK -from .core import filesystem, get_filesystem_class, split_protocol, url_to_fs - -_generic_fs = {} -logger = logging.getLogger("fsspec.generic") - - -def set_generic_fs(protocol, **storage_options): - _generic_fs[protocol] = filesystem(protocol, **storage_options) - - -default_method = "default" - - -def _resolve_fs(url, method=None, protocol=None, storage_options=None): - """Pick instance of backend FS""" - method = method or default_method - protocol = protocol or split_protocol(url)[0] - storage_options = storage_options or {} - if method == "default": - return filesystem(protocol) - if method == "generic": - return _generic_fs[protocol] - if method == "current": - cls = get_filesystem_class(protocol) - return cls.current() - if method == "options": - fs, _ = url_to_fs(url, **storage_options.get(protocol, {})) - return fs - raise ValueError(f"Unknown FS resolution method: {method}") - - -def rsync( - source, - destination, - delete_missing=False, - source_field="size", - dest_field="size", - update_cond="different", - inst_kwargs=None, - fs=None, - **kwargs, -): - """Sync files between two directory trees - - (experimental) - - Parameters - ---------- - source: str - Root of the directory tree to take files from. This must be a directory, but - do not include any terminating "/" character - destination: str - Root path to copy into. The contents of this location should be - identical to the contents of ``source`` when done. This will be made a - directory, and the terminal "/" should not be included. - delete_missing: bool - If there are paths in the destination that don't exist in the - source and this is True, delete them. Otherwise, leave them alone. - source_field: str | callable - If ``update_field`` is "different", this is the key in the info - of source files to consider for difference. Maybe a function of the - info dict. - dest_field: str | callable - If ``update_field`` is "different", this is the key in the info - of destination files to consider for difference. May be a function of - the info dict. - update_cond: "different"|"always"|"never" - If "always", every file is copied, regardless of whether it exists in - the destination. If "never", files that exist in the destination are - not copied again. If "different" (default), only copy if the info - fields given by ``source_field`` and ``dest_field`` (usually "size") - are different. Other comparisons may be added in the future. - inst_kwargs: dict|None - If ``fs`` is None, use this set of keyword arguments to make a - GenericFileSystem instance - fs: GenericFileSystem|None - Instance to use if explicitly given. The instance defines how to - to make downstream file system instances from paths. - """ - fs = fs or GenericFileSystem(**(inst_kwargs or {})) - source = fs._strip_protocol(source) - destination = fs._strip_protocol(destination) - allfiles = fs.find(source, withdirs=True, detail=True) - if not fs.isdir(source): - raise ValueError("Can only rsync on a directory") - otherfiles = fs.find(destination, withdirs=True, detail=True) - dirs = [ - a - for a, v in allfiles.items() - if v["type"] == "directory" and a.replace(source, destination) not in otherfiles - ] - logger.debug(f"{len(dirs)} directories to create") - if dirs: - fs.make_many_dirs( - [dirn.replace(source, destination) for dirn in dirs], exist_ok=True - ) - allfiles = {a: v for a, v in allfiles.items() if v["type"] == "file"} - logger.debug(f"{len(allfiles)} files to consider for copy") - to_delete = [ - o - for o, v in otherfiles.items() - if o.replace(destination, source) not in allfiles and v["type"] == "file" - ] - for k, v in allfiles.copy().items(): - otherfile = k.replace(source, destination) - if otherfile in otherfiles: - if update_cond == "always": - allfiles[k] = otherfile - elif update_cond == "different": - inf1 = source_field(v) if callable(source_field) else v[source_field] - v2 = otherfiles[otherfile] - inf2 = dest_field(v2) if callable(dest_field) else v2[dest_field] - if inf1 != inf2: - # details mismatch, make copy - allfiles[k] = otherfile - else: - # details match, don't copy - allfiles.pop(k) - else: - # file not in target yet - allfiles[k] = otherfile - logger.debug(f"{len(allfiles)} files to copy") - if allfiles: - source_files, target_files = zip(*allfiles.items()) - fs.cp(source_files, target_files, **kwargs) - logger.debug(f"{len(to_delete)} files to delete") - if delete_missing: - fs.rm(to_delete) - - -class GenericFileSystem(AsyncFileSystem): - """Wrapper over all other FS types - - - - This implementation is a single unified interface to be able to run FS operations - over generic URLs, and dispatch to the specific implementations using the URL - protocol prefix. - - Note: instances of this FS are always async, even if you never use it with any async - backend. - """ - - protocol = "generic" # there is no real reason to ever use a protocol with this FS - - def __init__(self, default_method="default", **kwargs): - """ - - Parameters - ---------- - default_method: str (optional) - Defines how to configure backend FS instances. Options are: - - "default": instantiate like FSClass(), with no - extra arguments; this is the default instance of that FS, and can be - configured via the config system - - "generic": takes instances from the `_generic_fs` dict in this module, - which you must populate before use. Keys are by protocol - - "current": takes the most recently instantiated version of each FS - """ - self.method = default_method - super(GenericFileSystem, self).__init__(**kwargs) - - def _strip_protocol(self, path): - # normalization only - fs = _resolve_fs(path, self.method) - return fs.unstrip_protocol(fs._strip_protocol(path)) - - async def _find(self, path, maxdepth=None, withdirs=False, detail=False, **kwargs): - fs = _resolve_fs(path, self.method) - if fs.async_impl: - out = await fs._find( - path, maxdepth=maxdepth, withdirs=withdirs, detail=True, **kwargs - ) - else: - out = fs.find( - path, maxdepth=maxdepth, withdirs=withdirs, detail=True, **kwargs - ) - result = {} - for k, v in out.items(): - name = fs.unstrip_protocol(k) - v["name"] = name - result[name] = v - if detail: - return result - return list(result) - - async def _info(self, url, **kwargs): - fs = _resolve_fs(url, self.method) - if fs.async_impl: - out = await fs._info(url, **kwargs) - else: - out = fs.info(url, **kwargs) - out["name"] = fs.unstrip_protocol(out["name"]) - return out - - async def _ls( - self, - url, - detail=True, - **kwargs, - ): - fs = _resolve_fs(url, self.method) - if fs.async_impl: - out = await fs._ls(url, detail=True, **kwargs) - else: - out = fs.ls(url, detail=True, **kwargs) - for o in out: - o["name"] = fs.unstrip_protocol(o["name"]) - if detail: - return out - else: - return [o["name"] for o in out] - - async def _cat_file( - self, - url, - **kwargs, - ): - fs = _resolve_fs(url, self.method) - if fs.async_impl: - return await fs._cat_file(url, **kwargs) - else: - return fs.cat_file(url, **kwargs) - - async def _pipe_file( - self, - path, - value, - **kwargs, - ): - fs = _resolve_fs(path, self.method) - if fs.async_impl: - return await fs._pipe_file(path, value, **kwargs) - else: - return fs.pipe_file(path, value, **kwargs) - - async def _rm(self, url, **kwargs): - fs = _resolve_fs(url, self.method) - if fs.async_impl: - await fs._rm(url, **kwargs) - else: - fs.rm(url, **kwargs) - - async def _makedirs(self, path, exist_ok=False): - logger.debug("Make dir %s", path) - fs = _resolve_fs(path, self.method) - if fs.async_impl: - await fs._makedirs(path, exist_ok=exist_ok) - else: - fs.makedirs(path, exist_ok=exist_ok) - - def rsync(self, source, destination, **kwargs): - """Sync files between two directory trees - - See `func:rsync` for more details. - """ - rsync(source, destination, fs=self, **kwargs) - - async def _cp_file( - self, - url, - url2, - blocksize=2**20, - callback=_DEFAULT_CALLBACK, - **kwargs, - ): - fs = _resolve_fs(url, self.method) - fs2 = _resolve_fs(url2, self.method) - if fs is fs2: - # pure remote - if fs.async_impl: - return await fs._cp_file(url, url2, **kwargs) - else: - return fs.cp_file(url, url2, **kwargs) - kw = {"blocksize": 0, "cache_type": "none"} - try: - f1 = ( - await fs.open_async(url, "rb") - if hasattr(fs, "open_async") - else fs.open(url, "rb", **kw) - ) - callback.set_size(await maybe_await(f1.size)) - f2 = ( - await fs2.open_async(url2, "wb") - if hasattr(fs2, "open_async") - else fs2.open(url2, "wb", **kw) - ) - while f1.size is None or f2.tell() < f1.size: - data = await maybe_await(f1.read(blocksize)) - if f1.size is None and not data: - break - await maybe_await(f2.write(data)) - callback.absolute_update(f2.tell()) - finally: - try: - await maybe_await(f2.close()) - await maybe_await(f1.close()) - except NameError: - # fail while opening f1 or f2 - pass - - async def _make_many_dirs(self, urls, exist_ok=True): - fs = _resolve_fs(urls[0], self.method) - if fs.async_impl: - coros = [fs._makedirs(u, exist_ok=exist_ok) for u in urls] - await _run_coros_in_chunks(coros) - else: - for u in urls: - fs.makedirs(u, exist_ok=exist_ok) - - make_many_dirs = sync_wrapper(_make_many_dirs) - - async def _copy( - self, - path1: list[str], - path2: list[str], - recursive: bool = False, - on_error: str = "ignore", - maxdepth: Optional[int] = None, - batch_size: Optional[int] = None, - tempdir: Optional[str] = None, - **kwargs, - ): - if recursive: - raise NotImplementedError - fs = _resolve_fs(path1[0], self.method) - fs2 = _resolve_fs(path2[0], self.method) - # not expanding paths atm., assume call is from rsync() - if fs is fs2: - # pure remote - if fs.async_impl: - return await fs._copy(path1, path2, **kwargs) - else: - return fs.copy(path1, path2, **kwargs) - await copy_file_op( - fs, path1, fs2, path2, tempdir, batch_size, on_error=on_error - ) - - -async def copy_file_op( - fs1, url1, fs2, url2, tempdir=None, batch_size=20, on_error="ignore" -): - import tempfile - - tempdir = tempdir or tempfile.mkdtemp() - try: - coros = [ - _copy_file_op( - fs1, - u1, - fs2, - u2, - os.path.join(tempdir, uuid.uuid4().hex), - on_error=on_error, - ) - for u1, u2 in zip(url1, url2) - ] - await _run_coros_in_chunks(coros, batch_size=batch_size) - finally: - shutil.rmtree(tempdir) - - -async def _copy_file_op(fs1, url1, fs2, url2, local, on_error="ignore"): - ex = () if on_error == "raise" else Exception - logger.debug("Copy %s -> %s", url1, url2) - try: - if fs1.async_impl: - await fs1._get_file(url1, local) - else: - fs1.get_file(url1, local) - if fs2.async_impl: - await fs2._put_file(local, url2) - else: - fs2.put_file(local, url2) - os.unlink(local) - logger.debug("Copy %s -> %s; done", url1, url2) - except ex as e: - logger.debug("ignoring cp exception for %s: %s", url1, e) - - -async def maybe_await(cor): - if inspect.iscoroutine(cor): - return await cor - else: - return cor diff --git a/venv/lib/python3.8/site-packages/fsspec/gui.py b/venv/lib/python3.8/site-packages/fsspec/gui.py deleted file mode 100644 index 80ccac21fa60044a89f90c83e46666a1e937ad13..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/gui.py +++ /dev/null @@ -1,413 +0,0 @@ -import ast -import contextlib -import logging -import os -import re -from typing import ClassVar, Sequence - -import panel as pn - -from .core import OpenFile, get_filesystem_class, split_protocol -from .registry import known_implementations - -pn.extension() -logger = logging.getLogger("fsspec.gui") - - -class SigSlot: - """Signal-slot mixin, for Panel event passing - - Include this class in a widget manager's superclasses to be able to - register events and callbacks on Panel widgets managed by that class. - - The method ``_register`` should be called as widgets are added, and external - code should call ``connect`` to associate callbacks. - - By default, all signals emit a DEBUG logging statement. - """ - - # names of signals that this class may emit each of which must be - # set by _register for any new instance - signals: ClassVar[Sequence[str]] = [] - # names of actions that this class may respond to - slots: ClassVar[Sequence[str]] = [] - - # each of which must be a method name - - def __init__(self): - self._ignoring_events = False - self._sigs = {} - self._map = {} - self._setup() - - def _setup(self): - """Create GUI elements and register signals""" - self.panel = pn.pane.PaneBase() - # no signals to set up in the base class - - def _register( - self, widget, name, thing="value", log_level=logging.DEBUG, auto=False - ): - """Watch the given attribute of a widget and assign it a named event - - This is normally called at the time a widget is instantiated, in the - class which owns it. - - Parameters - ---------- - widget : pn.layout.Panel or None - Widget to watch. If None, an anonymous signal not associated with - any widget. - name : str - Name of this event - thing : str - Attribute of the given widget to watch - log_level : int - When the signal is triggered, a logging event of the given level - will be fired in the dfviz logger. - auto : bool - If True, automatically connects with a method in this class of the - same name. - """ - if name not in self.signals: - raise ValueError("Attempt to assign an undeclared signal: %s" % name) - self._sigs[name] = { - "widget": widget, - "callbacks": [], - "thing": thing, - "log": log_level, - } - wn = "-".join( - [ - getattr(widget, "name", str(widget)) if widget is not None else "none", - thing, - ] - ) - self._map[wn] = name - if widget is not None: - widget.param.watch(self._signal, thing, onlychanged=True) - if auto and hasattr(self, name): - self.connect(name, getattr(self, name)) - - def _repr_mimebundle_(self, *args, **kwargs): - """Display in a notebook or a server""" - try: - return self.panel._repr_mimebundle_(*args, **kwargs) - except (ValueError, AttributeError): - raise NotImplementedError("Panel does not seem to be set " "up properly") - - def connect(self, signal, slot): - """Associate call back with given event - - The callback must be a function which takes the "new" value of the - watched attribute as the only parameter. If the callback return False, - this cancels any further processing of the given event. - - Alternatively, the callback can be a string, in which case it means - emitting the correspondingly-named event (i.e., connect to self) - """ - self._sigs[signal]["callbacks"].append(slot) - - def _signal(self, event): - """This is called by a an action on a widget - - Within an self.ignore_events context, nothing happens. - - Tests can execute this method by directly changing the values of - widget components. - """ - if not self._ignoring_events: - wn = "-".join([event.obj.name, event.name]) - if wn in self._map and self._map[wn] in self._sigs: - self._emit(self._map[wn], event.new) - - @contextlib.contextmanager - def ignore_events(self): - """Temporarily turn off events processing in this instance - - (does not propagate to children) - """ - self._ignoring_events = True - try: - yield - finally: - self._ignoring_events = False - - def _emit(self, sig, value=None): - """An event happened, call its callbacks - - This method can be used in tests to simulate message passing without - directly changing visual elements. - - Calling of callbacks will halt whenever one returns False. - """ - logger.log(self._sigs[sig]["log"], "{}: {}".format(sig, value)) - for callback in self._sigs[sig]["callbacks"]: - if isinstance(callback, str): - self._emit(callback) - else: - try: - # running callbacks should not break the interface - ret = callback(value) - if ret is False: - break - except Exception as e: - logger.exception( - "Exception (%s) while executing callback for signal: %s" - "" % (e, sig) - ) - - def show(self, threads=False): - """Open a new browser tab and display this instance's interface""" - self.panel.show(threads=threads, verbose=False) - return self - - -class SingleSelect(SigSlot): - """A multiselect which only allows you to select one item for an event""" - - signals = ["_selected", "selected"] # the first is internal - slots = ["set_options", "set_selection", "add", "clear", "select"] - - def __init__(self, **kwargs): - self.kwargs = kwargs - super().__init__() - - def _setup(self): - self.panel = pn.widgets.MultiSelect(**self.kwargs) - self._register(self.panel, "_selected", "value") - self._register(None, "selected") - self.connect("_selected", self.select_one) - - def _signal(self, *args, **kwargs): - super()._signal(*args, **kwargs) - - def select_one(self, *_): - with self.ignore_events(): - val = [self.panel.value[-1]] if self.panel.value else [] - self.panel.value = val - self._emit("selected", self.panel.value) - - def set_options(self, options): - self.panel.options = options - - def clear(self): - self.panel.options = [] - - @property - def value(self): - return self.panel.value - - def set_selection(self, selection): - self.panel.value = [selection] - - -class FileSelector(SigSlot): - """Panel-based graphical file selector widget - - Instances of this widget are interactive and can be displayed in jupyter by having - them as the output of a cell, or in a separate browser tab using ``.show()``. - """ - - signals = [ - "protocol_changed", - "selection_changed", - "directory_entered", - "home_clicked", - "up_clicked", - "go_clicked", - "filters_changed", - ] - slots = ["set_filters", "go_home"] - - def __init__(self, url=None, filters=None, ignore=None, kwargs=None): - """ - - Parameters - ---------- - url : str (optional) - Initial value of the URL to populate the dialog; should include protocol - filters : list(str) (optional) - File endings to include in the listings. If not included, all files are - allowed. Does not affect directories. - If given, the endings will appear as checkboxes in the interface - ignore : list(str) (optional) - Regex(s) of file basename patterns to ignore, e.g., "\\." for typical - hidden files on posix - kwargs : dict (optional) - To pass to file system instance - """ - if url: - self.init_protocol, url = split_protocol(url) - else: - self.init_protocol, url = "file", os.getcwd() - self.init_url = url - self.init_kwargs = kwargs or "{}" - self.filters = filters - self.ignore = [re.compile(i) for i in ignore or []] - self._fs = None - super().__init__() - - def _setup(self): - self.url = pn.widgets.TextInput( - name="url", - value=self.init_url, - align="end", - sizing_mode="stretch_width", - width_policy="max", - ) - self.protocol = pn.widgets.Select( - options=sorted(known_implementations), - value=self.init_protocol, - name="protocol", - align="center", - ) - self.kwargs = pn.widgets.TextInput( - name="kwargs", value=self.init_kwargs, align="center" - ) - self.go = pn.widgets.Button(name="⇨", align="end", width=45) - self.main = SingleSelect(size=10) - self.home = pn.widgets.Button(name="🏠", width=40, height=30, align="end") - self.up = pn.widgets.Button(name="‹", width=30, height=30, align="end") - - self._register(self.protocol, "protocol_changed", auto=True) - self._register(self.go, "go_clicked", "clicks", auto=True) - self._register(self.up, "up_clicked", "clicks", auto=True) - self._register(self.home, "home_clicked", "clicks", auto=True) - self._register(None, "selection_changed") - self.main.connect("selected", self.selection_changed) - self._register(None, "directory_entered") - self.prev_protocol = self.protocol.value - self.prev_kwargs = self.storage_options - - self.filter_sel = pn.widgets.CheckBoxGroup( - value=[], options=[], inline=False, align="end", width_policy="min" - ) - self._register(self.filter_sel, "filters_changed", auto=True) - - self.panel = pn.Column( - pn.Row(self.protocol, self.kwargs), - pn.Row(self.home, self.up, self.url, self.go, self.filter_sel), - self.main.panel, - ) - self.set_filters(self.filters) - self.go_clicked() - - def set_filters(self, filters=None): - self.filters = filters - if filters: - self.filter_sel.options = filters - self.filter_sel.value = filters - else: - self.filter_sel.options = [] - self.filter_sel.value = [] - - @property - def storage_options(self): - """Value of the kwargs box as a dictionary""" - return ast.literal_eval(self.kwargs.value) or {} - - @property - def fs(self): - """Current filesystem instance""" - if self._fs is None: - cls = get_filesystem_class(self.protocol.value) - self._fs = cls(**self.storage_options) - return self._fs - - @property - def urlpath(self): - """URL of currently selected item""" - return ( - (self.protocol.value + "://" + self.main.value[0]) - if self.main.value - else None - ) - - def open_file(self, mode="rb", compression=None, encoding=None): - """Create OpenFile instance for the currently selected item - - For example, in a notebook you might do something like - - .. code-block:: - - [ ]: sel = FileSelector(); sel - - # user selects their file - - [ ]: with sel.open_file('rb') as f: - ... out = f.read() - - Parameters - ---------- - mode: str (optional) - Open mode for the file. - compression: str (optional) - The interact with the file as compressed. Set to 'infer' to guess - compression from the file ending - encoding: str (optional) - If using text mode, use this encoding; defaults to UTF8. - """ - if self.urlpath is None: - raise ValueError("No file selected") - return OpenFile(self.fs, self.urlpath, mode, compression, encoding) - - def filters_changed(self, values): - self.filters = values - self.go_clicked() - - def selection_changed(self, *_): - if self.urlpath is None: - return - if self.fs.isdir(self.urlpath): - self.url.value = self.fs._strip_protocol(self.urlpath) - self.go_clicked() - - def go_clicked(self, *_): - if ( - self.prev_protocol != self.protocol.value - or self.prev_kwargs != self.storage_options - ): - self._fs = None # causes fs to be recreated - self.prev_protocol = self.protocol.value - self.prev_kwargs = self.storage_options - listing = sorted( - self.fs.ls(self.url.value, detail=True), key=lambda x: x["name"] - ) - listing = [ - l - for l in listing - if not any(i.match(l["name"].rsplit("/", 1)[-1]) for i in self.ignore) - ] - folders = { - "📁 " + o["name"].rsplit("/", 1)[-1]: o["name"] - for o in listing - if o["type"] == "directory" - } - files = { - "📄 " + o["name"].rsplit("/", 1)[-1]: o["name"] - for o in listing - if o["type"] == "file" - } - if self.filters: - files = { - k: v - for k, v in files.items() - if any(v.endswith(ext) for ext in self.filters) - } - self.main.set_options(dict(**folders, **files)) - - def protocol_changed(self, *_): - self._fs = None - self.main.options = [] - self.url.value = "" - - def home_clicked(self, *_): - self.protocol.value = self.init_protocol - self.kwargs.value = self.init_kwargs - self.url.value = self.init_url - self.go_clicked() - - def up_clicked(self, *_): - self.url.value = self.fs._parent(self.url.value) - self.go_clicked() diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__init__.py b/venv/lib/python3.8/site-packages/fsspec/implementations/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 252dccff7dabf95dcbc37f8e966f5d27951a77c0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/arrow.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/arrow.cpython-38.pyc deleted file mode 100644 index 79967b881f7fce58337952a093361f6f88269502..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/arrow.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cache_mapper.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cache_mapper.cpython-38.pyc deleted file mode 100644 index 298ecd2242d0bad04ff90a495431c50b15fb9c06..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cache_mapper.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cache_metadata.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cache_metadata.cpython-38.pyc deleted file mode 100644 index a8a9878955a16b693f64b84ae1d1c2296f17c6c1..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cache_metadata.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cached.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cached.cpython-38.pyc deleted file mode 100644 index 697e18388360542a9d50ec4cbe250d200a0c62f0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/cached.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dask.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dask.cpython-38.pyc deleted file mode 100644 index fd978d2e7595440bcbb81ef8033fc970a94500ab..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dask.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dbfs.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dbfs.cpython-38.pyc deleted file mode 100644 index 4e525eec3281c3f7242110332e3f7b9582f1a4a4..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dbfs.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dirfs.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dirfs.cpython-38.pyc deleted file mode 100644 index f794af1ebc3f14459f58676f32774b33c3b77fb4..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/dirfs.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/ftp.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/ftp.cpython-38.pyc deleted file mode 100644 index 6d9539b91a9ac60d285a37acf6b84a72d0e30e89..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/ftp.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/git.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/git.cpython-38.pyc deleted file mode 100644 index b6eb03617fcf166103fd81044fcd6b9067f48f85..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/git.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/github.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/github.cpython-38.pyc deleted file mode 100644 index 6f3db7b31637e564a0a658aa637ab636865a0e75..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/github.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/http.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/http.cpython-38.pyc deleted file mode 100644 index 2912230ae4eea1efb5eaa41f59f2f69e9cf1ff4f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/http.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/http_sync.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/http_sync.cpython-38.pyc deleted file mode 100644 index 840a44555e769076012750fdd719efe71ae35559..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/http_sync.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/jupyter.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/jupyter.cpython-38.pyc deleted file mode 100644 index 9e2ef19939336d013a230b3e71b3d2af9500e594..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/jupyter.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/libarchive.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/libarchive.cpython-38.pyc deleted file mode 100644 index c3e280e3503e1abc38d9f31fafff87f70c1178c9..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/libarchive.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/local.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/local.cpython-38.pyc deleted file mode 100644 index 35245c7d1acc317a0a94881af530df665e4dcbb3..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/local.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/memory.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/memory.cpython-38.pyc deleted file mode 100644 index 9ea01066a31ee4c1193f818ecf618caae98c1263..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/memory.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/reference.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/reference.cpython-38.pyc deleted file mode 100644 index 522b2fe3e133a23804dedbcfdf6b84d7df20c65b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/reference.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/sftp.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/sftp.cpython-38.pyc deleted file mode 100644 index 31e2728dc04c38dbe5eab3efc2955c0426a6175e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/sftp.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/smb.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/smb.cpython-38.pyc deleted file mode 100644 index 89bf2446a9fc9a4d87b67815c241c286ba45cf00..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/smb.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/tar.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/tar.cpython-38.pyc deleted file mode 100644 index 593e59d3994fa8e9b67c933cc5caddf84355a54e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/tar.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/webhdfs.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/webhdfs.cpython-38.pyc deleted file mode 100644 index 588c00563ea79428b26a8580914d5530c5a46def..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/webhdfs.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/zip.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/zip.cpython-38.pyc deleted file mode 100644 index 6b29fd7a3303fde6c68bca6e6ac62f5978d35310..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/implementations/__pycache__/zip.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/arrow.py b/venv/lib/python3.8/site-packages/fsspec/implementations/arrow.py deleted file mode 100644 index 3b1048acdec34d4f5eeff90e30e3629023c6099d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/arrow.py +++ /dev/null @@ -1,297 +0,0 @@ -import errno -import io -import os -import secrets -import shutil -from contextlib import suppress -from functools import cached_property, wraps - -from fsspec.spec import AbstractFileSystem -from fsspec.utils import ( - get_package_version_without_import, - infer_storage_options, - mirror_from, - tokenize, -) - - -def wrap_exceptions(func): - @wraps(func) - def wrapper(*args, **kwargs): - try: - return func(*args, **kwargs) - except OSError as exception: - if not exception.args: - raise - - message, *args = exception.args - if isinstance(message, str) and "does not exist" in message: - raise FileNotFoundError(errno.ENOENT, message) from exception - else: - raise - - return wrapper - - -PYARROW_VERSION = None - - -class ArrowFSWrapper(AbstractFileSystem): - """FSSpec-compatible wrapper of pyarrow.fs.FileSystem. - - Parameters - ---------- - fs : pyarrow.fs.FileSystem - - """ - - root_marker = "/" - - def __init__(self, fs, **kwargs): - global PYARROW_VERSION - PYARROW_VERSION = get_package_version_without_import("pyarrow") - self.fs = fs - super().__init__(**kwargs) - - @property - def protocol(self): - return self.fs.type_name - - @cached_property - def fsid(self): - return "hdfs_" + tokenize(self.fs.host, self.fs.port) - - @classmethod - def _strip_protocol(cls, path): - ops = infer_storage_options(path) - path = ops["path"] - if path.startswith("//"): - # special case for "hdfs://path" (without the triple slash) - path = path[1:] - return path - - def ls(self, path, detail=False, **kwargs): - path = self._strip_protocol(path) - from pyarrow.fs import FileSelector - - entries = [ - self._make_entry(entry) - for entry in self.fs.get_file_info(FileSelector(path)) - ] - if detail: - return entries - else: - return [entry["name"] for entry in entries] - - def info(self, path, **kwargs): - path = self._strip_protocol(path) - [info] = self.fs.get_file_info([path]) - return self._make_entry(info) - - def exists(self, path): - path = self._strip_protocol(path) - try: - self.info(path) - except FileNotFoundError: - return False - else: - return True - - def _make_entry(self, info): - from pyarrow.fs import FileType - - if info.type is FileType.Directory: - kind = "directory" - elif info.type is FileType.File: - kind = "file" - elif info.type is FileType.NotFound: - raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), info.path) - else: - kind = "other" - - return { - "name": info.path, - "size": info.size, - "type": kind, - "mtime": info.mtime, - } - - @wrap_exceptions - def cp_file(self, path1, path2, **kwargs): - path1 = self._strip_protocol(path1).rstrip("/") - path2 = self._strip_protocol(path2).rstrip("/") - - with self._open(path1, "rb") as lstream: - tmp_fname = f"{path2}.tmp.{secrets.token_hex(6)}" - try: - with self.open(tmp_fname, "wb") as rstream: - shutil.copyfileobj(lstream, rstream) - self.fs.move(tmp_fname, path2) - except BaseException: # noqa - with suppress(FileNotFoundError): - self.fs.delete_file(tmp_fname) - raise - - @wrap_exceptions - def mv(self, path1, path2, **kwargs): - path1 = self._strip_protocol(path1).rstrip("/") - path2 = self._strip_protocol(path2).rstrip("/") - self.fs.move(path1, path2) - - mv_file = mv - - @wrap_exceptions - def rm_file(self, path): - path = self._strip_protocol(path) - self.fs.delete_file(path) - - @wrap_exceptions - def rm(self, path, recursive=False, maxdepth=None): - path = self._strip_protocol(path).rstrip("/") - if self.isdir(path): - if recursive: - self.fs.delete_dir(path) - else: - raise ValueError("Can't delete directories without recursive=False") - else: - self.fs.delete_file(path) - - @wrap_exceptions - def _open(self, path, mode="rb", block_size=None, seekable=True, **kwargs): - if mode == "rb": - if seekable: - method = self.fs.open_input_file - else: - method = self.fs.open_input_stream - elif mode == "wb": - method = self.fs.open_output_stream - elif mode == "ab": - method = self.fs.open_append_stream - else: - raise ValueError(f"unsupported mode for Arrow filesystem: {mode!r}") - - _kwargs = {} - if mode != "rb" or not seekable: - if int(PYARROW_VERSION.split(".")[0]) >= 4: - # disable compression auto-detection - _kwargs["compression"] = None - stream = method(path, **_kwargs) - - return ArrowFile(self, stream, path, mode, block_size, **kwargs) - - @wrap_exceptions - def mkdir(self, path, create_parents=True, **kwargs): - path = self._strip_protocol(path) - if create_parents: - self.makedirs(path, exist_ok=True) - else: - self.fs.create_dir(path, recursive=False) - - @wrap_exceptions - def makedirs(self, path, exist_ok=False): - path = self._strip_protocol(path) - self.fs.create_dir(path, recursive=True) - - @wrap_exceptions - def rmdir(self, path): - path = self._strip_protocol(path) - self.fs.delete_dir(path) - - @wrap_exceptions - def modified(self, path): - path = self._strip_protocol(path) - return self.fs.get_file_info(path).mtime - - def cat_file(self, path, start=None, end=None, **kwargs): - kwargs["seekable"] = start not in [None, 0] - return super().cat_file(path, start=None, end=None, **kwargs) - - def get_file(self, rpath, lpath, **kwargs): - kwargs["seekable"] = False - super().get_file(rpath, lpath, **kwargs) - - -@mirror_from( - "stream", - [ - "read", - "seek", - "tell", - "write", - "readable", - "writable", - "close", - "size", - "seekable", - ], -) -class ArrowFile(io.IOBase): - def __init__(self, fs, stream, path, mode, block_size=None, **kwargs): - self.path = path - self.mode = mode - - self.fs = fs - self.stream = stream - - self.blocksize = self.block_size = block_size - self.kwargs = kwargs - - def __enter__(self): - return self - - def __exit__(self, *args): - return self.close() - - -class HadoopFileSystem(ArrowFSWrapper): - """A wrapper on top of the pyarrow.fs.HadoopFileSystem - to connect it's interface with fsspec""" - - protocol = "hdfs" - - def __init__( - self, - host="default", - port=0, - user=None, - kerb_ticket=None, - extra_conf=None, - **kwargs, - ): - """ - - Parameters - ---------- - host: str - Hostname, IP or "default" to try to read from Hadoop config - port: int - Port to connect on, or default from Hadoop config if 0 - user: str or None - If given, connect as this username - kerb_ticket: str or None - If given, use this ticket for authentication - extra_conf: None or dict - Passed on to HadoopFileSystem - """ - from pyarrow.fs import HadoopFileSystem - - fs = HadoopFileSystem( - host=host, - port=port, - user=user, - kerb_ticket=kerb_ticket, - extra_conf=extra_conf, - ) - super().__init__(fs=fs, **kwargs) - - @staticmethod - def _get_kwargs_from_urls(path): - ops = infer_storage_options(path) - out = {} - if ops.get("host", None): - out["host"] = ops["host"] - if ops.get("username", None): - out["user"] = ops["username"] - if ops.get("port", None): - out["port"] = ops["port"] - return out diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/cache_mapper.py b/venv/lib/python3.8/site-packages/fsspec/implementations/cache_mapper.py deleted file mode 100644 index 000ccebc83304369cd00fcd8b3458b852c366530..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/cache_mapper.py +++ /dev/null @@ -1,80 +0,0 @@ -from __future__ import annotations - -import abc -import hashlib -from typing import TYPE_CHECKING - -from fsspec.implementations.local import make_path_posix - -if TYPE_CHECKING: - from typing import Any - - -class AbstractCacheMapper(abc.ABC): - """Abstract super-class for mappers from remote URLs to local cached - basenames. - """ - - @abc.abstractmethod - def __call__(self, path: str) -> str: - ... - - def __eq__(self, other: Any) -> bool: - # Identity only depends on class. When derived classes have attributes - # they will need to be included. - return isinstance(other, type(self)) - - def __hash__(self) -> int: - # Identity only depends on class. When derived classes have attributes - # they will need to be included. - return hash(type(self)) - - -class BasenameCacheMapper(AbstractCacheMapper): - """Cache mapper that uses the basename of the remote URL and a fixed number - of directory levels above this. - - The default is zero directory levels, meaning different paths with the same - basename will have the same cached basename. - """ - - def __init__(self, directory_levels: int = 0): - if directory_levels < 0: - raise ValueError( - "BasenameCacheMapper requires zero or positive directory_levels" - ) - self.directory_levels = directory_levels - - # Separator for directories when encoded as strings. - self._separator = "_@_" - - def __call__(self, path: str) -> str: - path = make_path_posix(path) - prefix, *bits = path.rsplit("/", self.directory_levels + 1) - if bits: - return self._separator.join(bits) - else: - return prefix # No separator found, simple filename - - def __eq__(self, other: Any) -> bool: - return super().__eq__(other) and self.directory_levels == other.directory_levels - - def __hash__(self) -> int: - return super().__hash__() ^ hash(self.directory_levels) - - -class HashCacheMapper(AbstractCacheMapper): - """Cache mapper that uses a hash of the remote URL.""" - - def __call__(self, path: str) -> str: - return hashlib.sha256(path.encode()).hexdigest() - - -def create_cache_mapper(same_names: bool) -> AbstractCacheMapper: - """Factory method to create cache mapper for backward compatibility with - ``CachingFileSystem`` constructor using ``same_names`` kwarg. - """ - if same_names: - return BasenameCacheMapper() - else: - return HashCacheMapper() diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/cache_metadata.py b/venv/lib/python3.8/site-packages/fsspec/implementations/cache_metadata.py deleted file mode 100644 index 16964c2a7153d40b480dd47513d1129ed27e307b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/cache_metadata.py +++ /dev/null @@ -1,232 +0,0 @@ -from __future__ import annotations - -import os -import pickle -import time -from typing import TYPE_CHECKING - -from fsspec.utils import atomic_write - -try: - import ujson as json -except ImportError: - if not TYPE_CHECKING: - import json - -if TYPE_CHECKING: - from typing import Any, Dict, Iterator, Literal - - from typing_extensions import TypeAlias - - from .cached import CachingFileSystem - - Detail: TypeAlias = Dict[str, Any] - - -class CacheMetadata: - """Cache metadata. - - All reading and writing of cache metadata is performed by this class, - accessing the cached files and blocks is not. - - Metadata is stored in a single file per storage directory in JSON format. - For backward compatibility, also reads metadata stored in pickle format - which is converted to JSON when next saved. - """ - - def __init__(self, storage: list[str]): - """ - - Parameters - ---------- - storage: list[str] - Directories containing cached files, must be at least one. Metadata - is stored in the last of these directories by convention. - """ - if not storage: - raise ValueError("CacheMetadata expects at least one storage location") - - self._storage = storage - self.cached_files: list[Detail] = [{}] - - # Private attribute to force saving of metadata in pickle format rather than - # JSON for use in tests to confirm can read both pickle and JSON formats. - self._force_save_pickle = False - - def _load(self, fn: str) -> Detail: - """Low-level function to load metadata from specific file""" - try: - with open(fn, "r") as f: - return json.load(f) - except ValueError: - with open(fn, "rb") as f: - return pickle.load(f) - - def _save(self, metadata_to_save: Detail, fn: str) -> None: - """Low-level function to save metadata to specific file""" - if self._force_save_pickle: - with atomic_write(fn) as f: - pickle.dump(metadata_to_save, f) - else: - with atomic_write(fn, mode="w") as f: - json.dump(metadata_to_save, f) - - def _scan_locations( - self, writable_only: bool = False - ) -> Iterator[tuple[str, str, bool]]: - """Yield locations (filenames) where metadata is stored, and whether - writable or not. - - Parameters - ---------- - writable: bool - Set to True to only yield writable locations. - - Returns - ------- - Yields (str, str, bool) - """ - n = len(self._storage) - for i, storage in enumerate(self._storage): - writable = i == n - 1 - if writable_only and not writable: - continue - yield os.path.join(storage, "cache"), storage, writable - - def check_file( - self, path: str, cfs: CachingFileSystem | None - ) -> Literal[False] | tuple[Detail, str]: - """If path is in cache return its details, otherwise return ``False``. - - If the optional CachingFileSystem is specified then it is used to - perform extra checks to reject possible matches, such as if they are - too old. - """ - for (fn, base, _), cache in zip(self._scan_locations(), self.cached_files): - if path not in cache: - continue - detail = cache[path].copy() - - if cfs is not None: - if cfs.check_files and detail["uid"] != cfs.fs.ukey(path): - # Wrong file as determined by hash of file properties - continue - if cfs.expiry and time.time() - detail["time"] > cfs.expiry: - # Cached file has expired - continue - - fn = os.path.join(base, detail["fn"]) - if os.path.exists(fn): - return detail, fn - return False - - def clear_expired(self, expiry_time: int) -> tuple[list[str], bool]: - """Remove expired metadata from the cache. - - Returns names of files corresponding to expired metadata and a boolean - flag indicating whether the writable cache is empty. Caller is - responsible for deleting the expired files. - """ - expired_files = [] - for path, detail in self.cached_files[-1].copy().items(): - if time.time() - detail["time"] > expiry_time: - fn = detail.get("fn", "") - if not fn: - raise RuntimeError( - f"Cache metadata does not contain 'fn' for {path}" - ) - fn = os.path.join(self._storage[-1], fn) - expired_files.append(fn) - self.cached_files[-1].pop(path) - - if self.cached_files[-1]: - cache_path = os.path.join(self._storage[-1], "cache") - self._save(self.cached_files[-1], cache_path) - - writable_cache_empty = not self.cached_files[-1] - return expired_files, writable_cache_empty - - def load(self) -> None: - """Load all metadata from disk and store in ``self.cached_files``""" - cached_files = [] - for fn, _, _ in self._scan_locations(): - if os.path.exists(fn): - # TODO: consolidate blocks here - loaded_cached_files = self._load(fn) - for c in loaded_cached_files.values(): - if isinstance(c["blocks"], list): - c["blocks"] = set(c["blocks"]) - cached_files.append(loaded_cached_files) - else: - cached_files.append({}) - self.cached_files = cached_files or [{}] - - def on_close_cached_file(self, f: Any, path: str) -> None: - """Perform side-effect actions on closing a cached file. - - The actual closing of the file is the responsibility of the caller. - """ - # File must be writeble, so in self.cached_files[-1] - c = self.cached_files[-1][path] - if c["blocks"] is not True and len(c["blocks"]) * f.blocksize >= f.size: - c["blocks"] = True - - def pop_file(self, path: str) -> str | None: - """Remove metadata of cached file. - - If path is in the cache, return the filename of the cached file, - otherwise return ``None``. Caller is responsible for deleting the - cached file. - """ - details = self.check_file(path, None) - if not details: - return None - _, fn = details - if fn.startswith(self._storage[-1]): - self.cached_files[-1].pop(path) - self.save() - else: - raise PermissionError( - "Can only delete cached file in last, writable cache location" - ) - return fn - - def save(self) -> None: - """Save metadata to disk""" - for (fn, _, writable), cache in zip(self._scan_locations(), self.cached_files): - if not writable: - continue - - if os.path.exists(fn): - cached_files = self._load(fn) - for k, c in cached_files.items(): - if k in cache: - if c["blocks"] is True or cache[k]["blocks"] is True: - c["blocks"] = True - else: - # self.cached_files[*][*]["blocks"] must continue to - # point to the same set object so that updates - # performed by MMapCache are propagated back to - # self.cached_files. - blocks = cache[k]["blocks"] - blocks.update(c["blocks"]) - c["blocks"] = blocks - c["time"] = max(c["time"], cache[k]["time"]) - c["uid"] = cache[k]["uid"] - - # Files can be added to cache after it was written once - for k, c in cache.items(): - if k not in cached_files: - cached_files[k] = c - else: - cached_files = cache - cache = {k: v.copy() for k, v in cached_files.items()} - for c in cache.values(): - if isinstance(c["blocks"], set): - c["blocks"] = list(c["blocks"]) - self._save(cache, fn) - self.cached_files[-1] = cached_files - - def update_file(self, path: str, detail: Detail) -> None: - """Update metadata for specific file in memory, do not save""" - self.cached_files[-1][path] = detail diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/cached.py b/venv/lib/python3.8/site-packages/fsspec/implementations/cached.py deleted file mode 100644 index b679cce51186d8371011d590d87b6c250943f95c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/cached.py +++ /dev/null @@ -1,784 +0,0 @@ -from __future__ import annotations - -import inspect -import logging -import os -import tempfile -import time -import weakref -from shutil import rmtree -from typing import TYPE_CHECKING, Any, Callable, ClassVar - -from fsspec import AbstractFileSystem, filesystem -from fsspec.callbacks import _DEFAULT_CALLBACK -from fsspec.compression import compr -from fsspec.core import BaseCache, MMapCache -from fsspec.exceptions import BlocksizeMismatchError -from fsspec.implementations.cache_mapper import create_cache_mapper -from fsspec.implementations.cache_metadata import CacheMetadata -from fsspec.spec import AbstractBufferedFile -from fsspec.utils import infer_compression - -if TYPE_CHECKING: - from fsspec.implementations.cache_mapper import AbstractCacheMapper - -logger = logging.getLogger("fsspec.cached") - - -class CachingFileSystem(AbstractFileSystem): - """Locally caching filesystem, layer over any other FS - - This class implements chunk-wise local storage of remote files, for quick - access after the initial download. The files are stored in a given - directory with hashes of URLs for the filenames. If no directory is given, - a temporary one is used, which should be cleaned up by the OS after the - process ends. The files themselves are sparse (as implemented in - :class:`~fsspec.caching.MMapCache`), so only the data which is accessed - takes up space. - - Restrictions: - - - the block-size must be the same for each access of a given file, unless - all blocks of the file have already been read - - caching can only be applied to file-systems which produce files - derived from fsspec.spec.AbstractBufferedFile ; LocalFileSystem is also - allowed, for testing - """ - - protocol: ClassVar[str | tuple[str, ...]] = ("blockcache", "cached") - - def __init__( - self, - target_protocol=None, - cache_storage="TMP", - cache_check=10, - check_files=False, - expiry_time=604800, - target_options=None, - fs=None, - same_names: bool | None = None, - compression=None, - cache_mapper: AbstractCacheMapper | None = None, - **kwargs, - ): - """ - - Parameters - ---------- - target_protocol: str (optional) - Target filesystem protocol. Provide either this or ``fs``. - cache_storage: str or list(str) - Location to store files. If "TMP", this is a temporary directory, - and will be cleaned up by the OS when this process ends (or later). - If a list, each location will be tried in the order given, but - only the last will be considered writable. - cache_check: int - Number of seconds between reload of cache metadata - check_files: bool - Whether to explicitly see if the UID of the remote file matches - the stored one before using. Warning: some file systems such as - HTTP cannot reliably give a unique hash of the contents of some - path, so be sure to set this option to False. - expiry_time: int - The time in seconds after which a local copy is considered useless. - Set to falsy to prevent expiry. The default is equivalent to one - week. - target_options: dict or None - Passed to the instantiation of the FS, if fs is None. - fs: filesystem instance - The target filesystem to run against. Provide this or ``protocol``. - same_names: bool (optional) - By default, target URLs are hashed using a ``HashCacheMapper`` so - that files from different backends with the same basename do not - conflict. If this argument is ``true``, a ``BasenameCacheMapper`` - is used instead. Other cache mapper options are available by using - the ``cache_mapper`` keyword argument. Only one of this and - ``cache_mapper`` should be specified. - compression: str (optional) - To decompress on download. Can be 'infer' (guess from the URL name), - one of the entries in ``fsspec.compression.compr``, or None for no - decompression. - cache_mapper: AbstractCacheMapper (optional) - The object use to map from original filenames to cached filenames. - Only one of this and ``same_names`` should be specified. - """ - super().__init__(**kwargs) - if fs is None and target_protocol is None: - raise ValueError( - "Please provide filesystem instance(fs) or target_protocol" - ) - if not (fs is None) ^ (target_protocol is None): - raise ValueError( - "Both filesystems (fs) and target_protocol may not be both given." - ) - if cache_storage == "TMP": - tempdir = tempfile.mkdtemp() - storage = [tempdir] - weakref.finalize(self, self._remove_tempdir, tempdir) - else: - if isinstance(cache_storage, str): - storage = [cache_storage] - else: - storage = cache_storage - os.makedirs(storage[-1], exist_ok=True) - self.storage = storage - self.kwargs = target_options or {} - self.cache_check = cache_check - self.check_files = check_files - self.expiry = expiry_time - self.compression = compression - - if same_names is not None and cache_mapper is not None: - raise ValueError( - "Cannot specify both same_names and cache_mapper in " - "CachingFileSystem.__init__" - ) - if cache_mapper is not None: - self._mapper = cache_mapper - else: - self._mapper = create_cache_mapper( - same_names if same_names is not None else False - ) - - self.target_protocol = ( - target_protocol - if isinstance(target_protocol, str) - else (fs.protocol if isinstance(fs.protocol, str) else fs.protocol[0]) - ) - self._metadata = CacheMetadata(self.storage) - self.load_cache() - self.fs = fs if fs is not None else filesystem(target_protocol, **self.kwargs) - - def _strip_protocol(path): - # acts as a method, since each instance has a difference target - return self.fs._strip_protocol(type(self)._strip_protocol(path)) - - self._strip_protocol: Callable = _strip_protocol - - @staticmethod - def _remove_tempdir(tempdir): - try: - rmtree(tempdir) - except Exception: - pass - - def _mkcache(self): - os.makedirs(self.storage[-1], exist_ok=True) - - def load_cache(self): - """Read set of stored blocks from file""" - self._metadata.load() - self._mkcache() - self.last_cache = time.time() - - def save_cache(self): - """Save set of stored blocks from file""" - self._mkcache() - self._metadata.save() - self.last_cache = time.time() - - def _check_cache(self): - """Reload caches if time elapsed or any disappeared""" - self._mkcache() - if not self.cache_check: - # explicitly told not to bother checking - return - timecond = time.time() - self.last_cache > self.cache_check - existcond = all(os.path.exists(storage) for storage in self.storage) - if timecond or not existcond: - self.load_cache() - - def _check_file(self, path): - """Is path in cache and still valid""" - path = self._strip_protocol(path) - self._check_cache() - return self._metadata.check_file(path, self) - - def clear_cache(self): - """Remove all files and metadata from the cache - - In the case of multiple cache locations, this clears only the last one, - which is assumed to be the read/write one. - """ - rmtree(self.storage[-1]) - self.load_cache() - - def clear_expired_cache(self, expiry_time=None): - """Remove all expired files and metadata from the cache - - In the case of multiple cache locations, this clears only the last one, - which is assumed to be the read/write one. - - Parameters - ---------- - expiry_time: int - The time in seconds after which a local copy is considered useless. - If not defined the default is equivalent to the attribute from the - file caching instantiation. - """ - - if not expiry_time: - expiry_time = self.expiry - - self._check_cache() - - expired_files, writable_cache_empty = self._metadata.clear_expired(expiry_time) - for fn in expired_files: - if os.path.exists(fn): - os.remove(fn) - - if writable_cache_empty: - rmtree(self.storage[-1]) - self.load_cache() - - def pop_from_cache(self, path): - """Remove cached version of given file - - Deletes local copy of the given (remote) path. If it is found in a cache - location which is not the last, it is assumed to be read-only, and - raises PermissionError - """ - path = self._strip_protocol(path) - fn = self._metadata.pop_file(path) - if fn is not None: - os.remove(fn) - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - cache_options=None, - **kwargs, - ): - """Wrap the target _open - - If the whole file exists in the cache, just open it locally and - return that. - - Otherwise, open the file on the target FS, and make it have a mmap - cache pointing to the location which we determine, in our cache. - The ``blocks`` instance is shared, so as the mmap cache instance - updates, so does the entry in our ``cached_files`` attribute. - We monkey-patch this file, so that when it closes, we call - ``close_and_update`` to save the state of the blocks. - """ - path = self._strip_protocol(path) - - path = self.fs._strip_protocol(path) - if "r" not in mode: - return self.fs._open( - path, - mode=mode, - block_size=block_size, - autocommit=autocommit, - cache_options=cache_options, - **kwargs, - ) - detail = self._check_file(path) - if detail: - # file is in cache - detail, fn = detail - hash, blocks = detail["fn"], detail["blocks"] - if blocks is True: - # stored file is complete - logger.debug("Opening local copy of %s" % path) - return open(fn, mode) - # TODO: action where partial file exists in read-only cache - logger.debug("Opening partially cached copy of %s" % path) - else: - hash = self._mapper(path) - fn = os.path.join(self.storage[-1], hash) - blocks = set() - detail = { - "original": path, - "fn": hash, - "blocks": blocks, - "time": time.time(), - "uid": self.fs.ukey(path), - } - self._metadata.update_file(path, detail) - logger.debug("Creating local sparse file for %s" % path) - - # call target filesystems open - self._mkcache() - f = self.fs._open( - path, - mode=mode, - block_size=block_size, - autocommit=autocommit, - cache_options=cache_options, - cache_type="none", - **kwargs, - ) - if self.compression: - comp = ( - infer_compression(path) - if self.compression == "infer" - else self.compression - ) - f = compr[comp](f, mode="rb") - if "blocksize" in detail: - if detail["blocksize"] != f.blocksize: - raise BlocksizeMismatchError( - "Cached file must be reopened with same block" - "size as original (old: %i, new %i)" - "" % (detail["blocksize"], f.blocksize) - ) - else: - detail["blocksize"] = f.blocksize - f.cache = MMapCache(f.blocksize, f._fetch_range, f.size, fn, blocks) - close = f.close - f.close = lambda: self.close_and_update(f, close) - self.save_cache() - return f - - def hash_name(self, path: str, *args: Any) -> str: - # Kept for backward compatibility with downstream libraries. - # Ignores extra arguments, previously same_name boolean. - return self._mapper(path) - - def close_and_update(self, f, close): - """Called when a file is closing, so store the set of blocks""" - if f.closed: - return - path = self._strip_protocol(f.path) - self._metadata.on_close_cached_file(f, path) - try: - logger.debug("going to save") - self.save_cache() - logger.debug("saved") - except OSError: - logger.debug("Cache saving failed while closing file") - except NameError: - logger.debug("Cache save failed due to interpreter shutdown") - close() - f.closed = True - - def __getattribute__(self, item): - if item in [ - "load_cache", - "_open", - "save_cache", - "close_and_update", - "__init__", - "__getattribute__", - "__reduce__", - "_make_local_details", - "open", - "cat", - "cat_file", - "get", - "read_block", - "tail", - "head", - "_check_file", - "_check_cache", - "_mkcache", - "clear_cache", - "clear_expired_cache", - "pop_from_cache", - "_mkcache", - "local_file", - "_paths_from_path", - "get_mapper", - "open_many", - "commit_many", - "hash_name", - "__hash__", - "__eq__", - "to_json", - ]: - # all the methods defined in this class. Note `open` here, since - # it calls `_open`, but is actually in superclass - return lambda *args, **kw: getattr(type(self), item).__get__(self)( - *args, **kw - ) - if item in ["__reduce_ex__"]: - raise AttributeError - if item in ["_cache"]: - # class attributes - return getattr(type(self), item) - if item == "__class__": - return type(self) - d = object.__getattribute__(self, "__dict__") - fs = d.get("fs", None) # fs is not immediately defined - if item in d: - return d[item] - elif fs is not None: - if item in fs.__dict__: - # attribute of instance - return fs.__dict__[item] - # attributed belonging to the target filesystem - cls = type(fs) - m = getattr(cls, item) - if (inspect.isfunction(m) or inspect.isdatadescriptor(m)) and ( - not hasattr(m, "__self__") or m.__self__ is None - ): - # instance method - return m.__get__(fs, cls) - return m # class method or attribute - else: - # attributes of the superclass, while target is being set up - return super().__getattribute__(item) - - def __eq__(self, other): - """Test for equality.""" - if self is other: - return True - if not isinstance(other, type(self)): - return False - return ( - self.storage == other.storage - and self.kwargs == other.kwargs - and self.cache_check == other.cache_check - and self.check_files == other.check_files - and self.expiry == other.expiry - and self.compression == other.compression - and self._mapper == other._mapper - and self.target_protocol == other.target_protocol - ) - - def __hash__(self): - """Calculate hash.""" - return ( - hash(tuple(self.storage)) - ^ hash(str(self.kwargs)) - ^ hash(self.cache_check) - ^ hash(self.check_files) - ^ hash(self.expiry) - ^ hash(self.compression) - ^ hash(self._mapper) - ^ hash(self.target_protocol) - ) - - def to_json(self): - """Calculate JSON representation. - - Not implemented yet for CachingFileSystem. - """ - raise NotImplementedError( - "CachingFileSystem JSON representation not implemented" - ) - - -class WholeFileCacheFileSystem(CachingFileSystem): - """Caches whole remote files on first access - - This class is intended as a layer over any other file system, and - will make a local copy of each file accessed, so that all subsequent - reads are local. This is similar to ``CachingFileSystem``, but without - the block-wise functionality and so can work even when sparse files - are not allowed. See its docstring for definition of the init - arguments. - - The class still needs access to the remote store for listing files, - and may refresh cached files. - """ - - protocol = "filecache" - local_file = True - - def open_many(self, open_files): - paths = [of.path for of in open_files] - if "r" in open_files.mode: - self._mkcache() - else: - return [ - LocalTempFile(self.fs, path, mode=open_files.mode) for path in paths - ] - - if self.compression: - raise NotImplementedError - details = [self._check_file(sp) for sp in paths] - downpath = [p for p, d in zip(paths, details) if not d] - downfn0 = [ - os.path.join(self.storage[-1], self._mapper(p)) - for p, d in zip(paths, details) - ] # keep these path names for opening later - downfn = [fn for fn, d in zip(downfn0, details) if not d] - if downpath: - # skip if all files are already cached and up to date - self.fs.get(downpath, downfn) - - # update metadata - only happens when downloads are successful - newdetail = [ - { - "original": path, - "fn": self._mapper(path), - "blocks": True, - "time": time.time(), - "uid": self.fs.ukey(path), - } - for path in downpath - ] - for path, detail in zip(downpath, newdetail): - self._metadata.update_file(path, detail) - self.save_cache() - - def firstpart(fn): - # helper to adapt both whole-file and simple-cache - return fn[1] if isinstance(fn, tuple) else fn - - return [ - open(firstpart(fn0) if fn0 else fn1, mode=open_files.mode) - for fn0, fn1 in zip(details, downfn0) - ] - - def commit_many(self, open_files): - self.fs.put([f.fn for f in open_files], [f.path for f in open_files]) - [f.close() for f in open_files] - for f in open_files: - # in case autocommit is off, and so close did not already delete - try: - os.remove(f.name) - except FileNotFoundError: - pass - - def _make_local_details(self, path): - hash = self._mapper(path) - fn = os.path.join(self.storage[-1], hash) - detail = { - "original": path, - "fn": hash, - "blocks": True, - "time": time.time(), - "uid": self.fs.ukey(path), - } - self._metadata.update_file(path, detail) - logger.debug("Copying %s to local cache" % path) - return fn - - def cat( - self, - path, - recursive=False, - on_error="raise", - callback=_DEFAULT_CALLBACK, - **kwargs, - ): - paths = self.expand_path( - path, recursive=recursive, maxdepth=kwargs.get("maxdepth", None) - ) - getpaths = [] - storepaths = [] - fns = [] - out = {} - for p in paths.copy(): - try: - detail = self._check_file(p) - if not detail: - fn = self._make_local_details(p) - getpaths.append(p) - storepaths.append(fn) - else: - detail, fn = detail if isinstance(detail, tuple) else (None, detail) - fns.append(fn) - except Exception as e: - if on_error == "raise": - raise - if on_error == "return": - out[p] = e - paths.remove(p) - - if getpaths: - self.fs.get(getpaths, storepaths) - self.save_cache() - - callback.set_size(len(paths)) - for p, fn in zip(paths, fns): - with open(fn, "rb") as f: - out[p] = f.read() - callback.relative_update(1) - if isinstance(path, str) and len(paths) == 1 and recursive is False: - out = out[paths[0]] - return out - - def _open(self, path, mode="rb", **kwargs): - path = self._strip_protocol(path) - if "r" not in mode: - return LocalTempFile(self, path, mode=mode) - detail = self._check_file(path) - if detail: - detail, fn = detail - _, blocks = detail["fn"], detail["blocks"] - if blocks is True: - logger.debug("Opening local copy of %s" % path) - - # In order to support downstream filesystems to be able to - # infer the compression from the original filename, like - # the `TarFileSystem`, let's extend the `io.BufferedReader` - # fileobject protocol by adding a dedicated attribute - # `original`. - f = open(fn, mode) - f.original = detail.get("original") - return f - else: - raise ValueError( - "Attempt to open partially cached file %s" - "as a wholly cached file" % path - ) - else: - fn = self._make_local_details(path) - kwargs["mode"] = mode - - # call target filesystems open - self._mkcache() - if self.compression: - with self.fs._open(path, **kwargs) as f, open(fn, "wb") as f2: - if isinstance(f, AbstractBufferedFile): - # want no type of caching if just downloading whole thing - f.cache = BaseCache(0, f.cache.fetcher, f.size) - comp = ( - infer_compression(path) - if self.compression == "infer" - else self.compression - ) - f = compr[comp](f, mode="rb") - data = True - while data: - block = getattr(f, "blocksize", 5 * 2**20) - data = f.read(block) - f2.write(data) - else: - self.fs.get_file(path, fn) - self.save_cache() - return self._open(path, mode) - - -class SimpleCacheFileSystem(WholeFileCacheFileSystem): - """Caches whole remote files on first access - - This class is intended as a layer over any other file system, and - will make a local copy of each file accessed, so that all subsequent - reads are local. This implementation only copies whole files, and - does not keep any metadata about the download time or file details. - It is therefore safer to use in multi-threaded/concurrent situations. - - This is the only of the caching filesystems that supports write: you will - be given a real local open file, and upon close and commit, it will be - uploaded to the target filesystem; the writability or the target URL is - not checked until that time. - - """ - - protocol = "simplecache" - local_file = True - - def __init__(self, **kwargs): - kw = kwargs.copy() - for key in ["cache_check", "expiry_time", "check_files"]: - kw[key] = False - super().__init__(**kw) - for storage in self.storage: - if not os.path.exists(storage): - os.makedirs(storage, exist_ok=True) - - def _check_file(self, path): - self._check_cache() - sha = self._mapper(path) - for storage in self.storage: - fn = os.path.join(storage, sha) - if os.path.exists(fn): - return fn - - def save_cache(self): - pass - - def load_cache(self): - pass - - def _open(self, path, mode="rb", **kwargs): - path = self._strip_protocol(path) - - if "r" not in mode: - return LocalTempFile(self, path, mode=mode) - fn = self._check_file(path) - if fn: - return open(fn, mode) - - sha = self._mapper(path) - fn = os.path.join(self.storage[-1], sha) - logger.debug("Copying %s to local cache" % path) - kwargs["mode"] = mode - - self._mkcache() - if self.compression: - with self.fs._open(path, **kwargs) as f, open(fn, "wb") as f2: - if isinstance(f, AbstractBufferedFile): - # want no type of caching if just downloading whole thing - f.cache = BaseCache(0, f.cache.fetcher, f.size) - comp = ( - infer_compression(path) - if self.compression == "infer" - else self.compression - ) - f = compr[comp](f, mode="rb") - data = True - while data: - block = getattr(f, "blocksize", 5 * 2**20) - data = f.read(block) - f2.write(data) - else: - self.fs.get_file(path, fn) - return self._open(path, mode) - - -class LocalTempFile: - """A temporary local file, which will be uploaded on commit""" - - def __init__(self, fs, path, fn=None, mode="wb", autocommit=True, seek=0): - if fn: - self.fn = fn - self.fh = open(fn, mode) - else: - fd, self.fn = tempfile.mkstemp() - self.fh = open(fd, mode) - self.mode = mode - if seek: - self.fh.seek(seek) - self.path = path - self.fs = fs - self.closed = False - self.autocommit = autocommit - - def __reduce__(self): - # always open in rb+ to allow continuing writing at a location - return ( - LocalTempFile, - (self.fs, self.path, self.fn, "rb+", self.autocommit, self.tell()), - ) - - def __enter__(self): - return self.fh - - def __exit__(self, exc_type, exc_val, exc_tb): - self.close() - - def close(self): - if self.closed: - return - self.fh.close() - self.closed = True - if self.autocommit: - self.commit() - - def discard(self): - self.fh.close() - os.remove(self.fn) - - def commit(self): - self.fs.put(self.fn, self.path) - try: - os.remove(self.fn) - except (PermissionError, FileNotFoundError): - # file path may be held by new version of the file on windows - pass - - @property - def name(self): - return self.fn - - def __getattr__(self, item): - return getattr(self.fh, item) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/dask.py b/venv/lib/python3.8/site-packages/fsspec/implementations/dask.py deleted file mode 100644 index 3e1276463db6866665e6a0fe114efc247971b57e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/dask.py +++ /dev/null @@ -1,152 +0,0 @@ -import dask -from distributed.client import Client, _get_global_client -from distributed.worker import Worker - -from fsspec import filesystem -from fsspec.spec import AbstractBufferedFile, AbstractFileSystem -from fsspec.utils import infer_storage_options - - -def _get_client(client): - if client is None: - return _get_global_client() - elif isinstance(client, Client): - return client - else: - # e.g., connection string - return Client(client) - - -def _in_worker(): - return bool(Worker._instances) - - -class DaskWorkerFileSystem(AbstractFileSystem): - """View files accessible to a worker as any other remote file-system - - When instances are run on the worker, uses the real filesystem. When - run on the client, they call the worker to provide information or data. - - **Warning** this implementation is experimental, and read-only for now. - """ - - def __init__( - self, target_protocol=None, target_options=None, fs=None, client=None, **kwargs - ): - super().__init__(**kwargs) - if not (fs is None) ^ (target_protocol is None): - raise ValueError( - "Please provide one of filesystem instance (fs) or" - " target_protocol, not both" - ) - self.target_protocol = target_protocol - self.target_options = target_options - self.worker = None - self.client = client - self.fs = fs - self._determine_worker() - - @staticmethod - def _get_kwargs_from_urls(path): - so = infer_storage_options(path) - if "host" in so and "port" in so: - return {"client": f"{so['host']}:{so['port']}"} - else: - return {} - - def _determine_worker(self): - if _in_worker(): - self.worker = True - if self.fs is None: - self.fs = filesystem( - self.target_protocol, **(self.target_options or {}) - ) - else: - self.worker = False - self.client = _get_client(self.client) - self.rfs = dask.delayed(self) - - def mkdir(self, *args, **kwargs): - if self.worker: - self.fs.mkdir(*args, **kwargs) - else: - self.rfs.mkdir(*args, **kwargs).compute() - - def rm(self, *args, **kwargs): - if self.worker: - self.fs.rm(*args, **kwargs) - else: - self.rfs.rm(*args, **kwargs).compute() - - def copy(self, *args, **kwargs): - if self.worker: - self.fs.copy(*args, **kwargs) - else: - self.rfs.copy(*args, **kwargs).compute() - - def mv(self, *args, **kwargs): - if self.worker: - self.fs.mv(*args, **kwargs) - else: - self.rfs.mv(*args, **kwargs).compute() - - def ls(self, *args, **kwargs): - if self.worker: - return self.fs.ls(*args, **kwargs) - else: - return self.rfs.ls(*args, **kwargs).compute() - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - cache_options=None, - **kwargs, - ): - if self.worker: - return self.fs._open( - path, - mode=mode, - block_size=block_size, - autocommit=autocommit, - cache_options=cache_options, - **kwargs, - ) - else: - return DaskFile( - fs=self, - path=path, - mode=mode, - block_size=block_size, - autocommit=autocommit, - cache_options=cache_options, - **kwargs, - ) - - def fetch_range(self, path, mode, start, end): - if self.worker: - with self._open(path, mode) as f: - f.seek(start) - return f.read(end - start) - else: - return self.rfs.fetch_range(path, mode, start, end).compute() - - -class DaskFile(AbstractBufferedFile): - def __init__(self, mode="rb", **kwargs): - if mode != "rb": - raise ValueError('Remote dask files can only be opened in "rb" mode') - super().__init__(**kwargs) - - def _upload_chunk(self, final=False): - pass - - def _initiate_upload(self): - """Create remote file/upload""" - pass - - def _fetch_range(self, start, end): - """Get the specified set of bytes from remote""" - return self.fs.fetch_range(self.path, self.mode, start, end) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/dbfs.py b/venv/lib/python3.8/site-packages/fsspec/implementations/dbfs.py deleted file mode 100644 index 9f5b330cab9e751142794253d1072bab48b8bc29..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/dbfs.py +++ /dev/null @@ -1,457 +0,0 @@ -import base64 -import urllib - -import requests - -from fsspec import AbstractFileSystem -from fsspec.spec import AbstractBufferedFile - - -class DatabricksException(Exception): - """ - Helper class for exceptions raised in this module. - """ - - def __init__(self, error_code, message): - """Create a new DatabricksException""" - super().__init__(message) - - self.error_code = error_code - self.message = message - - -class DatabricksFileSystem(AbstractFileSystem): - """ - Get access to the Databricks filesystem implementation over HTTP. - Can be used inside and outside of a databricks cluster. - """ - - def __init__(self, instance, token, **kwargs): - """ - Create a new DatabricksFileSystem. - - Parameters - ---------- - instance: str - The instance URL of the databricks cluster. - For example for an Azure databricks cluster, this - has the form adb-..azuredatabricks.net. - token: str - Your personal token. Find out more - here: https://docs.databricks.com/dev-tools/api/latest/authentication.html - """ - self.instance = instance - self.token = token - - self.session = requests.Session() - self.session.headers.update({"Authorization": f"Bearer {self.token}"}) - - super().__init__(**kwargs) - - def ls(self, path, detail=True): - """ - List the contents of the given path. - - Parameters - ---------- - path: str - Absolute path - detail: bool - Return not only the list of filenames, - but also additional information on file sizes - and types. - """ - out = self._ls_from_cache(path) - if not out: - try: - r = self._send_to_api( - method="get", endpoint="list", json={"path": path} - ) - except DatabricksException as e: - if e.error_code == "RESOURCE_DOES_NOT_EXIST": - raise FileNotFoundError(e.message) - - raise e - files = r["files"] - out = [ - { - "name": o["path"], - "type": "directory" if o["is_dir"] else "file", - "size": o["file_size"], - } - for o in files - ] - self.dircache[path] = out - - if detail: - return out - return [o["name"] for o in out] - - def makedirs(self, path, exist_ok=True): - """ - Create a given absolute path and all of its parents. - - Parameters - ---------- - path: str - Absolute path to create - exist_ok: bool - If false, checks if the folder - exists before creating it (and raises an - Exception if this is the case) - """ - if not exist_ok: - try: - # If the following succeeds, the path is already present - self._send_to_api( - method="get", endpoint="get-status", json={"path": path} - ) - raise FileExistsError(f"Path {path} already exists") - except DatabricksException as e: - if e.error_code == "RESOURCE_DOES_NOT_EXIST": - pass - - try: - self._send_to_api(method="post", endpoint="mkdirs", json={"path": path}) - except DatabricksException as e: - if e.error_code == "RESOURCE_ALREADY_EXISTS": - raise FileExistsError(e.message) - - raise e - self.invalidate_cache(self._parent(path)) - - def mkdir(self, path, create_parents=True, **kwargs): - """ - Create a given absolute path and all of its parents. - - Parameters - ---------- - path: str - Absolute path to create - create_parents: bool - Whether to create all parents or not. - "False" is not implemented so far. - """ - if not create_parents: - raise NotImplementedError - - self.mkdirs(path, **kwargs) - - def rm(self, path, recursive=False): - """ - Remove the file or folder at the given absolute path. - - Parameters - ---------- - path: str - Absolute path what to remove - recursive: bool - Recursively delete all files in a folder. - """ - try: - self._send_to_api( - method="post", - endpoint="delete", - json={"path": path, "recursive": recursive}, - ) - except DatabricksException as e: - # This is not really an exception, it just means - # not everything was deleted so far - if e.error_code == "PARTIAL_DELETE": - self.rm(path=path, recursive=recursive) - elif e.error_code == "IO_ERROR": - # Using the same exception as the os module would use here - raise OSError(e.message) - - raise e - self.invalidate_cache(self._parent(path)) - - def mv(self, source_path, destination_path, recursive=False, maxdepth=None): - """ - Move a source to a destination path. - - A note from the original [databricks API manual] - (https://docs.databricks.com/dev-tools/api/latest/dbfs.html#move). - - When moving a large number of files the API call will time out after - approximately 60s, potentially resulting in partially moved data. - Therefore, for operations that move more than 10k files, we strongly - discourage using the DBFS REST API. - - Parameters - ---------- - source_path: str - From where to move (absolute path) - destination_path: str - To where to move (absolute path) - recursive: bool - Not implemented to far. - maxdepth: - Not implemented to far. - """ - if recursive: - raise NotImplementedError - if maxdepth: - raise NotImplementedError - - try: - self._send_to_api( - method="post", - endpoint="move", - json={"source_path": source_path, "destination_path": destination_path}, - ) - except DatabricksException as e: - if e.error_code == "RESOURCE_DOES_NOT_EXIST": - raise FileNotFoundError(e.message) - elif e.error_code == "RESOURCE_ALREADY_EXISTS": - raise FileExistsError(e.message) - - raise e - self.invalidate_cache(self._parent(source_path)) - self.invalidate_cache(self._parent(destination_path)) - - def _open(self, path, mode="rb", block_size="default", **kwargs): - """ - Overwrite the base class method to make sure to create a DBFile. - All arguments are copied from the base method. - - Only the default blocksize is allowed. - """ - return DatabricksFile(self, path, mode=mode, block_size=block_size, **kwargs) - - def _send_to_api(self, method, endpoint, json): - """ - Send the given json to the DBFS API - using a get or post request (specified by the argument `method`). - - Parameters - ---------- - method: str - Which http method to use for communication; "get" or "post". - endpoint: str - Where to send the request to (last part of the API URL) - json: dict - Dictionary of information to send - """ - if method == "post": - session_call = self.session.post - elif method == "get": - session_call = self.session.get - else: - raise ValueError(f"Do not understand method {method}") - - url = urllib.parse.urljoin(f"https://{self.instance}/api/2.0/dbfs/", endpoint) - - r = session_call(url, json=json) - - # The DBFS API will return a json, also in case of an exception. - # We want to preserve this information as good as possible. - try: - r.raise_for_status() - except requests.HTTPError as e: - # try to extract json error message - # if that fails, fall back to the original exception - try: - exception_json = e.response.json() - except Exception: - raise e - - raise DatabricksException(**exception_json) - - return r.json() - - def _create_handle(self, path, overwrite=True): - """ - Internal function to create a handle, which can be used to - write blocks of a file to DBFS. - A handle has a unique identifier which needs to be passed - whenever written during this transaction. - The handle is active for 10 minutes - after that a new - write transaction needs to be created. - Make sure to close the handle after you are finished. - - Parameters - ---------- - path: str - Absolute path for this file. - overwrite: bool - If a file already exist at this location, either overwrite - it or raise an exception. - """ - try: - r = self._send_to_api( - method="post", - endpoint="create", - json={"path": path, "overwrite": overwrite}, - ) - return r["handle"] - except DatabricksException as e: - if e.error_code == "RESOURCE_ALREADY_EXISTS": - raise FileExistsError(e.message) - - raise e - - def _close_handle(self, handle): - """ - Close a handle, which was opened by :func:`_create_handle`. - - Parameters - ---------- - handle: str - Which handle to close. - """ - try: - self._send_to_api(method="post", endpoint="close", json={"handle": handle}) - except DatabricksException as e: - if e.error_code == "RESOURCE_DOES_NOT_EXIST": - raise FileNotFoundError(e.message) - - raise e - - def _add_data(self, handle, data): - """ - Upload data to an already opened file handle - (opened by :func:`_create_handle`). - The maximal allowed data size is 1MB after - conversion to base64. - Remember to close the handle when you are finished. - - Parameters - ---------- - handle: str - Which handle to upload data to. - data: bytes - Block of data to add to the handle. - """ - data = base64.b64encode(data).decode() - try: - self._send_to_api( - method="post", - endpoint="add-block", - json={"handle": handle, "data": data}, - ) - except DatabricksException as e: - if e.error_code == "RESOURCE_DOES_NOT_EXIST": - raise FileNotFoundError(e.message) - elif e.error_code == "MAX_BLOCK_SIZE_EXCEEDED": - raise ValueError(e.message) - - raise e - - def _get_data(self, path, start, end): - """ - Download data in bytes from a given absolute path in a block - from [start, start+length]. - The maximum number of allowed bytes to read is 1MB. - - Parameters - ---------- - path: str - Absolute path to download data from - start: int - Start position of the block - end: int - End position of the block - """ - try: - r = self._send_to_api( - method="get", - endpoint="read", - json={"path": path, "offset": start, "length": end - start}, - ) - return base64.b64decode(r["data"]) - except DatabricksException as e: - if e.error_code == "RESOURCE_DOES_NOT_EXIST": - raise FileNotFoundError(e.message) - elif e.error_code in ["INVALID_PARAMETER_VALUE", "MAX_READ_SIZE_EXCEEDED"]: - raise ValueError(e.message) - - raise e - - def invalidate_cache(self, path=None): - if path is None: - self.dircache.clear() - else: - self.dircache.pop(path, None) - super().invalidate_cache(path) - - -class DatabricksFile(AbstractBufferedFile): - """ - Helper class for files referenced in the DatabricksFileSystem. - """ - - DEFAULT_BLOCK_SIZE = 1 * 2**20 # only allowed block size - - def __init__( - self, - fs, - path, - mode="rb", - block_size="default", - autocommit=True, - cache_type="readahead", - cache_options=None, - **kwargs, - ): - """ - Create a new instance of the DatabricksFile. - - The blocksize needs to be the default one. - """ - if block_size is None or block_size == "default": - block_size = self.DEFAULT_BLOCK_SIZE - - assert ( - block_size == self.DEFAULT_BLOCK_SIZE - ), f"Only the default block size is allowed, not {block_size}" - - super().__init__( - fs, - path, - mode=mode, - block_size=block_size, - autocommit=autocommit, - cache_type=cache_type, - cache_options=cache_options or {}, - **kwargs, - ) - - def _initiate_upload(self): - """Internal function to start a file upload""" - self.handle = self.fs._create_handle(self.path) - - def _upload_chunk(self, final=False): - """Internal function to add a chunk of data to a started upload""" - self.buffer.seek(0) - data = self.buffer.getvalue() - - data_chunks = [ - data[start:end] for start, end in self._to_sized_blocks(len(data)) - ] - - for data_chunk in data_chunks: - self.fs._add_data(handle=self.handle, data=data_chunk) - - if final: - self.fs._close_handle(handle=self.handle) - return True - - def _fetch_range(self, start, end): - """Internal function to download a block of data""" - return_buffer = b"" - length = end - start - for chunk_start, chunk_end in self._to_sized_blocks(length, start): - return_buffer += self.fs._get_data( - path=self.path, start=chunk_start, end=chunk_end - ) - - return return_buffer - - def _to_sized_blocks(self, length, start=0): - """Helper function to split a range from 0 to total_length into bloksizes""" - end = start + length - for data_chunk in range(start, end, self.blocksize): - data_start = data_chunk - data_end = min(end, data_chunk + self.blocksize) - yield data_start, data_end diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/dirfs.py b/venv/lib/python3.8/site-packages/fsspec/implementations/dirfs.py deleted file mode 100644 index a3eac87efa2414d85bf9eec59b2f35722418ed71..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/dirfs.py +++ /dev/null @@ -1,358 +0,0 @@ -from .. import filesystem -from ..asyn import AsyncFileSystem - - -class DirFileSystem(AsyncFileSystem): - """Directory prefix filesystem - - The DirFileSystem is a filesystem-wrapper. It assumes every path it is dealing with - is relative to the `path`. After performing the necessary paths operation it - delegates everything to the wrapped filesystem. - """ - - protocol = "dir" - - def __init__( - self, - path=None, - fs=None, - fo=None, - target_protocol=None, - target_options=None, - **storage_options, - ): - """ - Parameters - ---------- - path: str - Path to the directory. - fs: AbstractFileSystem - An instantiated filesystem to wrap. - target_protocol, target_options: - if fs is none, construct it from these - fo: str - Alternate for path; do not provide both - """ - super().__init__(**storage_options) - if fs is None: - fs = filesystem(protocol=target_protocol, **(target_options or {})) - if (path is not None) ^ (fo is not None) is False: - raise ValueError("Provide path or fo, not both") - path = path or fo - - if self.asynchronous and not fs.async_impl: - raise ValueError("can't use asynchronous with non-async fs") - - if fs.async_impl and self.asynchronous != fs.asynchronous: - raise ValueError("both dirfs and fs should be in the same sync/async mode") - - self.path = fs._strip_protocol(path) - self.fs = fs - - def _join(self, path): - if isinstance(path, str): - if not self.path: - return path - if not path: - return self.path - return self.fs.sep.join((self.path, self._strip_protocol(path))) - return [self._join(_path) for _path in path] - - def _relpath(self, path): - if isinstance(path, str): - if not self.path: - return path - if path == self.path: - return "" - prefix = self.path + self.fs.sep - assert path.startswith(prefix) - return path[len(prefix) :] - return [self._relpath(_path) for _path in path] - - # Wrappers below - - @property - def sep(self): - return self.fs.sep - - async def set_session(self, *args, **kwargs): - return await self.fs.set_session(*args, **kwargs) - - async def _rm_file(self, path, **kwargs): - return await self.fs._rm_file(self._join(path), **kwargs) - - def rm_file(self, path, **kwargs): - return self.fs.rm_file(self._join(path), **kwargs) - - async def _rm(self, path, *args, **kwargs): - return await self.fs._rm(self._join(path), *args, **kwargs) - - def rm(self, path, *args, **kwargs): - return self.fs.rm(self._join(path), *args, **kwargs) - - async def _cp_file(self, path1, path2, **kwargs): - return await self.fs._cp_file(self._join(path1), self._join(path2), **kwargs) - - def cp_file(self, path1, path2, **kwargs): - return self.fs.cp_file(self._join(path1), self._join(path2), **kwargs) - - async def _copy( - self, - path1, - path2, - *args, - **kwargs, - ): - return await self.fs._copy( - self._join(path1), - self._join(path2), - *args, - **kwargs, - ) - - def copy(self, path1, path2, *args, **kwargs): - return self.fs.copy( - self._join(path1), - self._join(path2), - *args, - **kwargs, - ) - - async def _pipe(self, path, *args, **kwargs): - return await self.fs._pipe(self._join(path), *args, **kwargs) - - def pipe(self, path, *args, **kwargs): - return self.fs.pipe(self._join(path), *args, **kwargs) - - async def _cat_file(self, path, *args, **kwargs): - return await self.fs._cat_file(self._join(path), *args, **kwargs) - - def cat_file(self, path, *args, **kwargs): - return self.fs.cat_file(self._join(path), *args, **kwargs) - - async def _cat(self, path, *args, **kwargs): - ret = await self.fs._cat( - self._join(path), - *args, - **kwargs, - ) - - if isinstance(ret, dict): - return {self._relpath(key): value for key, value in ret.items()} - - return ret - - def cat(self, path, *args, **kwargs): - ret = self.fs.cat( - self._join(path), - *args, - **kwargs, - ) - - if isinstance(ret, dict): - return {self._relpath(key): value for key, value in ret.items()} - - return ret - - async def _put_file(self, lpath, rpath, **kwargs): - return await self.fs._put_file(lpath, self._join(rpath), **kwargs) - - def put_file(self, lpath, rpath, **kwargs): - return self.fs.put_file(lpath, self._join(rpath), **kwargs) - - async def _put( - self, - lpath, - rpath, - *args, - **kwargs, - ): - return await self.fs._put( - lpath, - self._join(rpath), - *args, - **kwargs, - ) - - def put(self, lpath, rpath, *args, **kwargs): - return self.fs.put( - lpath, - self._join(rpath), - *args, - **kwargs, - ) - - async def _get_file(self, rpath, lpath, **kwargs): - return await self.fs._get_file(self._join(rpath), lpath, **kwargs) - - def get_file(self, rpath, lpath, **kwargs): - return self.fs.get_file(self._join(rpath), lpath, **kwargs) - - async def _get(self, rpath, *args, **kwargs): - return await self.fs._get(self._join(rpath), *args, **kwargs) - - def get(self, rpath, *args, **kwargs): - return self.fs.get(self._join(rpath), *args, **kwargs) - - async def _isfile(self, path): - return await self.fs._isfile(self._join(path)) - - def isfile(self, path): - return self.fs.isfile(self._join(path)) - - async def _isdir(self, path): - return await self.fs._isdir(self._join(path)) - - def isdir(self, path): - return self.fs.isdir(self._join(path)) - - async def _size(self, path): - return await self.fs._size(self._join(path)) - - def size(self, path): - return self.fs.size(self._join(path)) - - async def _exists(self, path): - return await self.fs._exists(self._join(path)) - - def exists(self, path): - return self.fs.exists(self._join(path)) - - async def _info(self, path, **kwargs): - return await self.fs._info(self._join(path), **kwargs) - - def info(self, path, **kwargs): - return self.fs.info(self._join(path), **kwargs) - - async def _ls(self, path, detail=True, **kwargs): - ret = (await self.fs._ls(self._join(path), detail=detail, **kwargs)).copy() - if detail: - out = [] - for entry in ret: - entry = entry.copy() - entry["name"] = self._relpath(entry["name"]) - out.append(entry) - return out - - return self._relpath(ret) - - def ls(self, path, detail=True, **kwargs): - ret = self.fs.ls(self._join(path), detail=detail, **kwargs).copy() - if detail: - out = [] - for entry in ret: - entry = entry.copy() - entry["name"] = self._relpath(entry["name"]) - out.append(entry) - return out - - return self._relpath(ret) - - async def _walk(self, path, *args, **kwargs): - async for root, dirs, files in self.fs._walk(self._join(path), *args, **kwargs): - yield self._relpath(root), dirs, files - - def walk(self, path, *args, **kwargs): - for root, dirs, files in self.fs.walk(self._join(path), *args, **kwargs): - yield self._relpath(root), dirs, files - - async def _glob(self, path, **kwargs): - detail = kwargs.get("detail", False) - ret = await self.fs._glob(self._join(path), **kwargs) - if detail: - return {self._relpath(path): info for path, info in ret.items()} - return self._relpath(ret) - - def glob(self, path, **kwargs): - detail = kwargs.get("detail", False) - ret = self.fs.glob(self._join(path), **kwargs) - if detail: - return {self._relpath(path): info for path, info in ret.items()} - return self._relpath(ret) - - async def _du(self, path, *args, **kwargs): - total = kwargs.get("total", True) - ret = await self.fs._du(self._join(path), *args, **kwargs) - if total: - return ret - - return {self._relpath(path): size for path, size in ret.items()} - - def du(self, path, *args, **kwargs): - total = kwargs.get("total", True) - ret = self.fs.du(self._join(path), *args, **kwargs) - if total: - return ret - - return {self._relpath(path): size for path, size in ret.items()} - - async def _find(self, path, *args, **kwargs): - detail = kwargs.get("detail", False) - ret = await self.fs._find(self._join(path), *args, **kwargs) - if detail: - return {self._relpath(path): info for path, info in ret.items()} - return self._relpath(ret) - - def find(self, path, *args, **kwargs): - detail = kwargs.get("detail", False) - ret = self.fs.find(self._join(path), *args, **kwargs) - if detail: - return {self._relpath(path): info for path, info in ret.items()} - return self._relpath(ret) - - async def _expand_path(self, path, *args, **kwargs): - return self._relpath( - await self.fs._expand_path(self._join(path), *args, **kwargs) - ) - - def expand_path(self, path, *args, **kwargs): - return self._relpath(self.fs.expand_path(self._join(path), *args, **kwargs)) - - async def _mkdir(self, path, *args, **kwargs): - return await self.fs._mkdir(self._join(path), *args, **kwargs) - - def mkdir(self, path, *args, **kwargs): - return self.fs.mkdir(self._join(path), *args, **kwargs) - - async def _makedirs(self, path, *args, **kwargs): - return await self.fs._makedirs(self._join(path), *args, **kwargs) - - def makedirs(self, path, *args, **kwargs): - return self.fs.makedirs(self._join(path), *args, **kwargs) - - def rmdir(self, path): - return self.fs.rmdir(self._join(path)) - - def mv_file(self, path1, path2, **kwargs): - return self.fs.mv_file( - self._join(path1), - self._join(path2), - **kwargs, - ) - - def touch(self, path, **kwargs): - return self.fs.touch(self._join(path), **kwargs) - - def created(self, path): - return self.fs.created(self._join(path)) - - def modified(self, path): - return self.fs.modified(self._join(path)) - - def sign(self, path, *args, **kwargs): - return self.fs.sign(self._join(path), *args, **kwargs) - - def __repr__(self): - return f"{self.__class__.__qualname__}(path='{self.path}', fs={self.fs})" - - def open( - self, - path, - *args, - **kwargs, - ): - return self.fs.open( - self._join(path), - *args, - **kwargs, - ) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/ftp.py b/venv/lib/python3.8/site-packages/fsspec/implementations/ftp.py deleted file mode 100644 index 7e79877ebdd287e0ab2938345d448f52ab92dc90..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/ftp.py +++ /dev/null @@ -1,380 +0,0 @@ -import os -import sys -import uuid -import warnings -from ftplib import FTP, Error, error_perm -from typing import Any - -from ..spec import AbstractBufferedFile, AbstractFileSystem -from ..utils import infer_storage_options, isfilelike - - -class FTPFileSystem(AbstractFileSystem): - """A filesystem over classic FTP""" - - root_marker = "/" - cachable = False - protocol = "ftp" - - def __init__( - self, - host, - port=21, - username=None, - password=None, - acct=None, - block_size=None, - tempdir=None, - timeout=30, - encoding="utf-8", - **kwargs, - ): - """ - You can use _get_kwargs_from_urls to get some kwargs from - a reasonable FTP url. - - Authentication will be anonymous if username/password are not - given. - - Parameters - ---------- - host: str - The remote server name/ip to connect to - port: int - Port to connect with - username: str or None - If authenticating, the user's identifier - password: str of None - User's password on the server, if using - acct: str or None - Some servers also need an "account" string for auth - block_size: int or None - If given, the read-ahead or write buffer size. - tempdir: str - Directory on remote to put temporary files when in a transaction - timeout: int - Timeout of the ftp connection in seconds - encoding: str - Encoding to use for directories and filenames in FTP connection - """ - super(FTPFileSystem, self).__init__(**kwargs) - self.host = host - self.port = port - self.tempdir = tempdir or "/tmp" - self.cred = username, password, acct - self.timeout = timeout - self.encoding = encoding - if block_size is not None: - self.blocksize = block_size - else: - self.blocksize = 2**16 - self._connect() - - def _connect(self): - if sys.version_info >= (3, 9): - self.ftp = FTP(timeout=self.timeout, encoding=self.encoding) - elif self.encoding: - warnings.warn("`encoding` not supported for python<3.9, ignoring") - self.ftp = FTP(timeout=self.timeout) - else: - self.ftp = FTP(timeout=self.timeout) - self.ftp.connect(self.host, self.port) - self.ftp.login(*self.cred) - - @classmethod - def _strip_protocol(cls, path): - return "/" + infer_storage_options(path)["path"].lstrip("/").rstrip("/") - - @staticmethod - def _get_kwargs_from_urls(urlpath): - out = infer_storage_options(urlpath) - out.pop("path", None) - out.pop("protocol", None) - return out - - def ls(self, path, detail=True, **kwargs): - path = self._strip_protocol(path) - out = [] - if path not in self.dircache: - try: - try: - out = [ - (fn, details) - for (fn, details) in self.ftp.mlsd(path) - if fn not in [".", ".."] - and details["type"] not in ["pdir", "cdir"] - ] - except error_perm: - out = _mlsd2(self.ftp, path) # Not platform independent - for fn, details in out: - if path == "/": - path = "" # just for forming the names, below - details["name"] = "/".join([path, fn.lstrip("/")]) - if details["type"] == "file": - details["size"] = int(details["size"]) - else: - details["size"] = 0 - if details["type"] == "dir": - details["type"] = "directory" - self.dircache[path] = out - except Error: - try: - info = self.info(path) - if info["type"] == "file": - out = [(path, info)] - except (Error, IndexError): - raise FileNotFoundError(path) - files = self.dircache.get(path, out) - if not detail: - return sorted([fn for fn, details in files]) - return [details for fn, details in files] - - def info(self, path, **kwargs): - # implement with direct method - path = self._strip_protocol(path) - if path == "/": - # special case, since this dir has no real entry - return {"name": "/", "size": 0, "type": "directory"} - files = self.ls(self._parent(path).lstrip("/"), True) - try: - out = [f for f in files if f["name"] == path][0] - except IndexError: - raise FileNotFoundError(path) - return out - - def get_file(self, rpath, lpath, **kwargs): - if self.isdir(rpath): - if not os.path.exists(lpath): - os.mkdir(lpath) - return - if isfilelike(lpath): - outfile = lpath - else: - outfile = open(lpath, "wb") - - def cb(x): - outfile.write(x) - - self.ftp.retrbinary( - "RETR %s" % rpath, - blocksize=self.blocksize, - callback=cb, - ) - if not isfilelike(lpath): - outfile.close() - - def cat_file(self, path, start=None, end=None, **kwargs): - if end is not None: - return super().cat_file(path, start, end, **kwargs) - out = [] - - def cb(x): - out.append(x) - - self.ftp.retrbinary( - "RETR %s" % path, - blocksize=self.blocksize, - rest=start, - callback=cb, - ) - return b"".join(out) - - def _open( - self, - path, - mode="rb", - block_size=None, - cache_options=None, - autocommit=True, - **kwargs, - ): - path = self._strip_protocol(path) - block_size = block_size or self.blocksize - return FTPFile( - self, - path, - mode=mode, - block_size=block_size, - tempdir=self.tempdir, - autocommit=autocommit, - cache_options=cache_options, - ) - - def _rm(self, path): - path = self._strip_protocol(path) - self.ftp.delete(path) - self.invalidate_cache(self._parent(path)) - - def rm(self, path, recursive=False, maxdepth=None): - paths = self.expand_path(path, recursive=recursive, maxdepth=maxdepth) - for p in reversed(paths): - if self.isfile(p): - self.rm_file(p) - else: - self.rmdir(p) - - def mkdir(self, path: str, create_parents: bool = True, **kwargs: Any) -> None: - path = self._strip_protocol(path) - parent = self._parent(path) - if parent != self.root_marker and not self.exists(parent) and create_parents: - self.mkdir(parent, create_parents=create_parents) - - self.ftp.mkd(path) - self.invalidate_cache(self._parent(path)) - - def makedirs(self, path: str, exist_ok: bool = False) -> None: - path = self._strip_protocol(path) - if self.exists(path): - # NB: "/" does not "exist" as it has no directory entry - if not exist_ok: - raise FileExistsError(f"{path} exists without `exist_ok`") - # exists_ok=True -> no-op - else: - self.mkdir(path, create_parents=True) - - def rmdir(self, path): - path = self._strip_protocol(path) - self.ftp.rmd(path) - self.invalidate_cache(self._parent(path)) - - def mv(self, path1, path2, **kwargs): - path1 = self._strip_protocol(path1) - path2 = self._strip_protocol(path2) - self.ftp.rename(path1, path2) - self.invalidate_cache(self._parent(path1)) - self.invalidate_cache(self._parent(path2)) - - def __del__(self): - self.ftp.close() - - def invalidate_cache(self, path=None): - if path is None: - self.dircache.clear() - else: - self.dircache.pop(path, None) - super(FTPFileSystem, self).invalidate_cache(path) - - -class TransferDone(Exception): - """Internal exception to break out of transfer""" - - pass - - -class FTPFile(AbstractBufferedFile): - """Interact with a remote FTP file with read/write buffering""" - - def __init__( - self, - fs, - path, - mode="rb", - block_size="default", - autocommit=True, - cache_type="readahead", - cache_options=None, - **kwargs, - ): - super().__init__( - fs, - path, - mode=mode, - block_size=block_size, - autocommit=autocommit, - cache_type=cache_type, - cache_options=cache_options, - **kwargs, - ) - if not autocommit: - self.target = self.path - self.path = "/".join([kwargs["tempdir"], str(uuid.uuid4())]) - - def commit(self): - self.fs.mv(self.path, self.target) - - def discard(self): - self.fs.rm(self.path) - - def _fetch_range(self, start, end): - """Get bytes between given byte limits - - Implemented by raising an exception in the fetch callback when the - number of bytes received reaches the requested amount. - - Will fail if the server does not respect the REST command on - retrieve requests. - """ - out = [] - total = [0] - - def callback(x): - total[0] += len(x) - if total[0] > end - start: - out.append(x[: (end - start) - total[0]]) - if end < self.size: - raise TransferDone - else: - out.append(x) - - if total[0] == end - start and end < self.size: - raise TransferDone - - try: - self.fs.ftp.retrbinary( - "RETR %s" % self.path, - blocksize=self.blocksize, - rest=start, - callback=callback, - ) - except TransferDone: - try: - # stop transfer, we got enough bytes for this block - self.fs.ftp.abort() - self.fs.ftp.getmultiline() - except Error: - self.fs._connect() - - return b"".join(out) - - def _upload_chunk(self, final=False): - self.buffer.seek(0) - self.fs.ftp.storbinary( - "STOR " + self.path, self.buffer, blocksize=self.blocksize, rest=self.offset - ) - return True - - -def _mlsd2(ftp, path="."): - """ - Fall back to using `dir` instead of `mlsd` if not supported. - - This parses a Linux style `ls -l` response to `dir`, but the response may - be platform dependent. - - Parameters - ---------- - ftp: ftplib.FTP - path: str - Expects to be given path, but defaults to ".". - """ - lines = [] - minfo = [] - ftp.dir(path, lines.append) - for line in lines: - line = line.split() - this = ( - line[-1], - { - "modify": " ".join(line[5:8]), - "unix.owner": line[2], - "unix.group": line[3], - "unix.mode": line[0], - "size": line[4], - }, - ) - if "d" == this[1]["unix.mode"][0]: - this[1]["type"] = "dir" - else: - this[1]["type"] = "file" - minfo.append(this) - return minfo diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/git.py b/venv/lib/python3.8/site-packages/fsspec/implementations/git.py deleted file mode 100644 index 80c73e066d83211da6cfb2940edf97ab5cfe0789..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/git.py +++ /dev/null @@ -1,127 +0,0 @@ -import os - -import pygit2 - -from fsspec.spec import AbstractFileSystem - -from .memory import MemoryFile - - -class GitFileSystem(AbstractFileSystem): - """Browse the files of a local git repo at any hash/tag/branch - - (experimental backend) - """ - - root_marker = "" - cachable = True - - def __init__(self, path=None, fo=None, ref=None, **kwargs): - """ - - Parameters - ---------- - path: str (optional) - Local location of the repo (uses current directory if not given). - May be deprecated in favour of ``fo``. When used with a higher - level function such as fsspec.open(), may be of the form - "git://[path-to-repo[:]][ref@]path/to/file" (but the actual - file path should not contain "@" or ":"). - fo: str (optional) - Same as ``path``, but passed as part of a chained URL. This one - takes precedence if both are given. - ref: str (optional) - Reference to work with, could be a hash, tag or branch name. Defaults - to current working tree. Note that ``ls`` and ``open`` also take hash, - so this becomes the default for those operations - kwargs - """ - super().__init__(**kwargs) - self.repo = pygit2.Repository(fo or path or os.getcwd()) - self.ref = ref or "master" - - @classmethod - def _strip_protocol(cls, path): - path = super()._strip_protocol(path).lstrip("/") - if ":" in path: - path = path.split(":", 1)[1] - if "@" in path: - path = path.split("@", 1)[1] - return path.lstrip("/") - - def _path_to_object(self, path, ref): - comm, ref = self.repo.resolve_refish(ref or self.ref) - parts = path.split("/") - tree = comm.tree - for part in parts: - if part and isinstance(tree, pygit2.Tree): - tree = tree[part] - return tree - - @staticmethod - def _get_kwargs_from_urls(path): - if path.startswith("git://"): - path = path[6:] - out = {} - if ":" in path: - out["path"], path = path.split(":", 1) - if "@" in path: - out["ref"], path = path.split("@", 1) - return out - - def ls(self, path, detail=True, ref=None, **kwargs): - path = self._strip_protocol(path) - tree = self._path_to_object(path, ref) - if isinstance(tree, pygit2.Tree): - out = [] - for obj in tree: - if isinstance(obj, pygit2.Tree): - out.append( - { - "type": "directory", - "name": "/".join([path, obj.name]).lstrip("/"), - "hex": obj.hex, - "mode": "%o" % obj.filemode, - "size": 0, - } - ) - else: - out.append( - { - "type": "file", - "name": "/".join([path, obj.name]).lstrip("/"), - "hex": obj.hex, - "mode": "%o" % obj.filemode, - "size": obj.size, - } - ) - else: - obj = tree - out = [ - { - "type": "file", - "name": obj.name, - "hex": obj.hex, - "mode": "%o" % obj.filemode, - "size": obj.size, - } - ] - if detail: - return out - return [o["name"] for o in out] - - def ukey(self, path, ref=None): - return self.info(path, ref=ref)["hex"] - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - cache_options=None, - ref=None, - **kwargs, - ): - obj = self._path_to_object(path, ref or self.ref) - return MemoryFile(data=obj.data) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/github.py b/venv/lib/python3.8/site-packages/fsspec/implementations/github.py deleted file mode 100644 index b148124d7481bb867cb100ad1ab2213e6acadf56..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/github.py +++ /dev/null @@ -1,219 +0,0 @@ -import requests - -from ..spec import AbstractFileSystem -from ..utils import infer_storage_options -from .memory import MemoryFile - -# TODO: add GIST backend, would be very similar - - -class GithubFileSystem(AbstractFileSystem): - """Interface to files in github - - An instance of this class provides the files residing within a remote github - repository. You may specify a point in the repos history, by SHA, branch - or tag (default is current master). - - Given that code files tend to be small, and that github does not support - retrieving partial content, we always fetch whole files. - - When using fsspec.open, allows URIs of the form: - - - "github://path/file", in which case you must specify org, repo and - may specify sha in the extra args - - 'github://org:repo@/precip/catalog.yml', where the org and repo are - part of the URI - - 'github://org:repo@sha/precip/catalog.yml', where the sha is also included - - ``sha`` can be the full or abbreviated hex of the commit you want to fetch - from, or a branch or tag name (so long as it doesn't contain special characters - like "/", "?", which would have to be HTTP-encoded). - - For authorised access, you must provide username and token, which can be made - at https://github.com/settings/tokens - """ - - url = "https://api.github.com/repos/{org}/{repo}/git/trees/{sha}" - rurl = "https://raw.githubusercontent.com/{org}/{repo}/{sha}/{path}" - protocol = "github" - - def __init__(self, org, repo, sha=None, username=None, token=None, **kwargs): - super().__init__(**kwargs) - self.org = org - self.repo = repo - if (username is None) ^ (token is None): - raise ValueError("Auth required both username and token") - self.username = username - self.token = token - if sha is None: - # look up default branch (not necessarily "master") - u = "https://api.github.com/repos/{org}/{repo}" - r = requests.get(u.format(org=org, repo=repo), **self.kw) - r.raise_for_status() - sha = r.json()["default_branch"] - - self.root = sha - self.ls("") - - @property - def kw(self): - if self.username: - return {"auth": (self.username, self.token)} - return {} - - @classmethod - def repos(cls, org_or_user, is_org=True): - """List repo names for given org or user - - This may become the top level of the FS - - Parameters - ---------- - org_or_user: str - Name of the github org or user to query - is_org: bool (default True) - Whether the name is an organisation (True) or user (False) - - Returns - ------- - List of string - """ - r = requests.get( - "https://api.github.com/{part}/{org}/repos".format( - part=["users", "orgs"][is_org], org=org_or_user - ) - ) - r.raise_for_status() - return [repo["name"] for repo in r.json()] - - @property - def tags(self): - """Names of tags in the repo""" - r = requests.get( - "https://api.github.com/repos/{org}/{repo}/tags" - "".format(org=self.org, repo=self.repo), - **self.kw, - ) - r.raise_for_status() - return [t["name"] for t in r.json()] - - @property - def branches(self): - """Names of branches in the repo""" - r = requests.get( - "https://api.github.com/repos/{org}/{repo}/branches" - "".format(org=self.org, repo=self.repo), - **self.kw, - ) - r.raise_for_status() - return [t["name"] for t in r.json()] - - @property - def refs(self): - """Named references, tags and branches""" - return {"tags": self.tags, "branches": self.branches} - - def ls(self, path, detail=False, sha=None, _sha=None, **kwargs): - """List files at given path - - Parameters - ---------- - path: str - Location to list, relative to repo root - detail: bool - If True, returns list of dicts, one per file; if False, returns - list of full filenames only - sha: str (optional) - List at the given point in the repo history, branch or tag name or commit - SHA - _sha: str (optional) - List this specific tree object (used internally to descend into trees) - """ - path = self._strip_protocol(path) - if path == "": - _sha = sha or self.root - if _sha is None: - parts = path.rstrip("/").split("/") - so_far = "" - _sha = sha or self.root - for part in parts: - out = self.ls(so_far, True, sha=sha, _sha=_sha) - so_far += "/" + part if so_far else part - out = [o for o in out if o["name"] == so_far] - if not out: - raise FileNotFoundError(path) - out = out[0] - if out["type"] == "file": - if detail: - return [out] - else: - return path - _sha = out["sha"] - if path not in self.dircache or sha not in [self.root, None]: - r = requests.get( - self.url.format(org=self.org, repo=self.repo, sha=_sha), **self.kw - ) - if r.status_code == 404: - raise FileNotFoundError(path) - r.raise_for_status() - types = {"blob": "file", "tree": "directory"} - out = [ - { - "name": path + "/" + f["path"] if path else f["path"], - "mode": f["mode"], - "type": types[f["type"]], - "size": f.get("size", 0), - "sha": f["sha"], - } - for f in r.json()["tree"] - if f["type"] in types - ] - if sha in [self.root, None]: - self.dircache[path] = out - else: - out = self.dircache[path] - if detail: - return out - else: - return sorted([f["name"] for f in out]) - - def invalidate_cache(self, path=None): - self.dircache.clear() - - @classmethod - def _strip_protocol(cls, path): - opts = infer_storage_options(path) - if "username" not in opts: - return super()._strip_protocol(path) - return opts["path"].lstrip("/") - - @staticmethod - def _get_kwargs_from_urls(path): - opts = infer_storage_options(path) - if "username" not in opts: - return {} - out = {"org": opts["username"], "repo": opts["password"]} - if opts["host"]: - out["sha"] = opts["host"] - return out - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - cache_options=None, - sha=None, - **kwargs, - ): - if mode != "rb": - raise NotImplementedError - url = self.rurl.format( - org=self.org, repo=self.repo, path=path, sha=sha or self.root - ) - r = requests.get(url, **self.kw) - if r.status_code == 404: - raise FileNotFoundError(path) - r.raise_for_status() - return MemoryFile(None, None, r.content) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/http.py b/venv/lib/python3.8/site-packages/fsspec/implementations/http.py deleted file mode 100644 index 06551017ee8c11594bf7197add6af4203efb886f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/http.py +++ /dev/null @@ -1,877 +0,0 @@ -import asyncio -import io -import logging -import re -import weakref -from copy import copy -from urllib.parse import urlparse - -import aiohttp -import requests -import yarl - -from fsspec.asyn import AbstractAsyncStreamedFile, AsyncFileSystem, sync, sync_wrapper -from fsspec.callbacks import _DEFAULT_CALLBACK -from fsspec.exceptions import FSTimeoutError -from fsspec.spec import AbstractBufferedFile -from fsspec.utils import DEFAULT_BLOCK_SIZE, isfilelike, nullcontext, tokenize - -from ..caching import AllBytes - -# https://stackoverflow.com/a/15926317/3821154 -ex = re.compile(r"""<(a|A)\s+(?:[^>]*?\s+)?(href|HREF)=["'](?P[^"']+)""") -ex2 = re.compile(r"""(?Phttp[s]?://[-a-zA-Z0-9@:%_+.~#?&/=]+)""") -logger = logging.getLogger("fsspec.http") - - -async def get_client(**kwargs): - return aiohttp.ClientSession(**kwargs) - - -class HTTPFileSystem(AsyncFileSystem): - """ - Simple File-System for fetching data via HTTP(S) - - ``ls()`` is implemented by loading the parent page and doing a regex - match on the result. If simple_link=True, anything of the form - "http(s)://server.com/stuff?thing=other"; otherwise only links within - HTML href tags will be used. - """ - - sep = "/" - - def __init__( - self, - simple_links=True, - block_size=None, - same_scheme=True, - size_policy=None, - cache_type="bytes", - cache_options=None, - asynchronous=False, - loop=None, - client_kwargs=None, - get_client=get_client, - encoded=False, - **storage_options, - ): - """ - NB: if this is called async, you must await set_client - - Parameters - ---------- - block_size: int - Blocks to read bytes; if 0, will default to raw requests file-like - objects instead of HTTPFile instances - simple_links: bool - If True, will consider both HTML tags and anything that looks - like a URL; if False, will consider only the former. - same_scheme: True - When doing ls/glob, if this is True, only consider paths that have - http/https matching the input URLs. - size_policy: this argument is deprecated - client_kwargs: dict - Passed to aiohttp.ClientSession, see - https://docs.aiohttp.org/en/stable/client_reference.html - For example, ``{'auth': aiohttp.BasicAuth('user', 'pass')}`` - get_client: Callable[..., aiohttp.ClientSession] - A callable which takes keyword arguments and constructs - an aiohttp.ClientSession. It's state will be managed by - the HTTPFileSystem class. - storage_options: key-value - Any other parameters passed on to requests - cache_type, cache_options: defaults used in open - """ - super().__init__(self, asynchronous=asynchronous, loop=loop, **storage_options) - self.block_size = block_size if block_size is not None else DEFAULT_BLOCK_SIZE - self.simple_links = simple_links - self.same_schema = same_scheme - self.cache_type = cache_type - self.cache_options = cache_options - self.client_kwargs = client_kwargs or {} - self.get_client = get_client - self.encoded = encoded - self.kwargs = storage_options - self._session = None - - # Clean caching-related parameters from `storage_options` - # before propagating them as `request_options` through `self.kwargs`. - # TODO: Maybe rename `self.kwargs` to `self.request_options` to make - # it clearer. - request_options = copy(storage_options) - self.use_listings_cache = request_options.pop("use_listings_cache", False) - request_options.pop("listings_expiry_time", None) - request_options.pop("max_paths", None) - request_options.pop("skip_instance_cache", None) - self.kwargs = request_options - - @property - def fsid(self): - return "http" - - def encode_url(self, url): - return yarl.URL(url, encoded=self.encoded) - - @staticmethod - def close_session(loop, session): - if loop is not None and loop.is_running(): - try: - sync(loop, session.close, timeout=0.1) - return - except (TimeoutError, FSTimeoutError): - pass - connector = getattr(session, "_connector", None) - if connector is not None: - # close after loop is dead - connector._close() - - async def set_session(self): - if self._session is None: - self._session = await self.get_client(loop=self.loop, **self.client_kwargs) - if not self.asynchronous: - weakref.finalize(self, self.close_session, self.loop, self._session) - return self._session - - @classmethod - def _strip_protocol(cls, path): - """For HTTP, we always want to keep the full URL""" - return path - - @classmethod - def _parent(cls, path): - # override, since _strip_protocol is different for URLs - par = super()._parent(path) - if len(par) > 7: # "http://..." - return par - return "" - - async def _ls_real(self, url, detail=True, **kwargs): - # ignoring URL-encoded arguments - kw = self.kwargs.copy() - kw.update(kwargs) - logger.debug(url) - session = await self.set_session() - async with session.get(self.encode_url(url), **self.kwargs) as r: - self._raise_not_found_for_status(r, url) - text = await r.text() - if self.simple_links: - links = ex2.findall(text) + [u[2] for u in ex.findall(text)] - else: - links = [u[2] for u in ex.findall(text)] - out = set() - parts = urlparse(url) - for l in links: - if isinstance(l, tuple): - l = l[1] - if l.startswith("/") and len(l) > 1: - # absolute URL on this server - l = parts.scheme + "://" + parts.netloc + l - if l.startswith("http"): - if self.same_schema and l.startswith(url.rstrip("/") + "/"): - out.add(l) - elif l.replace("https", "http").startswith( - url.replace("https", "http").rstrip("/") + "/" - ): - # allowed to cross http <-> https - out.add(l) - else: - if l not in ["..", "../"]: - # Ignore FTP-like "parent" - out.add("/".join([url.rstrip("/"), l.lstrip("/")])) - if not out and url.endswith("/"): - out = await self._ls_real(url.rstrip("/"), detail=False) - if detail: - return [ - { - "name": u, - "size": None, - "type": "directory" if u.endswith("/") else "file", - } - for u in out - ] - else: - return sorted(out) - - async def _ls(self, url, detail=True, **kwargs): - if self.use_listings_cache and url in self.dircache: - out = self.dircache[url] - else: - out = await self._ls_real(url, detail=detail, **kwargs) - self.dircache[url] = out - return out - - ls = sync_wrapper(_ls) - - def _raise_not_found_for_status(self, response, url): - """ - Raises FileNotFoundError for 404s, otherwise uses raise_for_status. - """ - if response.status == 404: - raise FileNotFoundError(url) - response.raise_for_status() - - async def _cat_file(self, url, start=None, end=None, **kwargs): - kw = self.kwargs.copy() - kw.update(kwargs) - logger.debug(url) - - if start is not None or end is not None: - if start == end: - return b"" - headers = kw.pop("headers", {}).copy() - - headers["Range"] = await self._process_limits(url, start, end) - kw["headers"] = headers - session = await self.set_session() - async with session.get(self.encode_url(url), **kw) as r: - out = await r.read() - self._raise_not_found_for_status(r, url) - return out - - async def _get_file( - self, rpath, lpath, chunk_size=5 * 2**20, callback=_DEFAULT_CALLBACK, **kwargs - ): - kw = self.kwargs.copy() - kw.update(kwargs) - logger.debug(rpath) - session = await self.set_session() - async with session.get(self.encode_url(rpath), **kw) as r: - try: - size = int(r.headers["content-length"]) - except (ValueError, KeyError): - size = None - - callback.set_size(size) - self._raise_not_found_for_status(r, rpath) - if isfilelike(lpath): - outfile = lpath - else: - outfile = open(lpath, "wb") - - try: - chunk = True - while chunk: - chunk = await r.content.read(chunk_size) - outfile.write(chunk) - callback.relative_update(len(chunk)) - finally: - if not isfilelike(lpath): - outfile.close() - - async def _put_file( - self, - lpath, - rpath, - chunk_size=5 * 2**20, - callback=_DEFAULT_CALLBACK, - method="post", - **kwargs, - ): - async def gen_chunks(): - # Support passing arbitrary file-like objects - # and use them instead of streams. - if isinstance(lpath, io.IOBase): - context = nullcontext(lpath) - use_seek = False # might not support seeking - else: - context = open(lpath, "rb") - use_seek = True - - with context as f: - if use_seek: - callback.set_size(f.seek(0, 2)) - f.seek(0) - else: - callback.set_size(getattr(f, "size", None)) - - chunk = f.read(chunk_size) - while chunk: - yield chunk - callback.relative_update(len(chunk)) - chunk = f.read(chunk_size) - - kw = self.kwargs.copy() - kw.update(kwargs) - session = await self.set_session() - - method = method.lower() - if method not in ("post", "put"): - raise ValueError( - f"method has to be either 'post' or 'put', not: {method!r}" - ) - - meth = getattr(session, method) - async with meth(rpath, data=gen_chunks(), **kw) as resp: - self._raise_not_found_for_status(resp, rpath) - - async def _exists(self, path, **kwargs): - kw = self.kwargs.copy() - kw.update(kwargs) - try: - logger.debug(path) - session = await self.set_session() - r = await session.get(self.encode_url(path), **kw) - async with r: - return r.status < 400 - except (requests.HTTPError, aiohttp.ClientError): - return False - - async def _isfile(self, path, **kwargs): - return await self._exists(path, **kwargs) - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=None, # XXX: This differs from the base class. - cache_type=None, - cache_options=None, - size=None, - **kwargs, - ): - """Make a file-like object - - Parameters - ---------- - path: str - Full URL with protocol - mode: string - must be "rb" - block_size: int or None - Bytes to download in one request; use instance value if None. If - zero, will return a streaming Requests file-like instance. - kwargs: key-value - Any other parameters, passed to requests calls - """ - if mode != "rb": - raise NotImplementedError - block_size = block_size if block_size is not None else self.block_size - kw = self.kwargs.copy() - kw["asynchronous"] = self.asynchronous - kw.update(kwargs) - size = size or self.info(path, **kwargs)["size"] - session = sync(self.loop, self.set_session) - if block_size and size: - return HTTPFile( - self, - path, - session=session, - block_size=block_size, - mode=mode, - size=size, - cache_type=cache_type or self.cache_type, - cache_options=cache_options or self.cache_options, - loop=self.loop, - **kw, - ) - else: - return HTTPStreamFile( - self, - path, - mode=mode, - loop=self.loop, - session=session, - **kw, - ) - - async def open_async(self, path, mode="rb", size=None, **kwargs): - session = await self.set_session() - if size is None: - try: - size = (await self._info(path, **kwargs))["size"] - except FileNotFoundError: - pass - return AsyncStreamFile( - self, - path, - loop=self.loop, - session=session, - size=size, - **kwargs, - ) - - def ukey(self, url): - """Unique identifier; assume HTTP files are static, unchanging""" - return tokenize(url, self.kwargs, self.protocol) - - async def _info(self, url, **kwargs): - """Get info of URL - - Tries to access location via HEAD, and then GET methods, but does - not fetch the data. - - It is possible that the server does not supply any size information, in - which case size will be given as None (and certain operations on the - corresponding file will not work). - """ - info = {} - session = await self.set_session() - - for policy in ["head", "get"]: - try: - info.update( - await _file_info( - self.encode_url(url), - size_policy=policy, - session=session, - **self.kwargs, - **kwargs, - ) - ) - if info.get("size") is not None: - break - except Exception as exc: - if policy == "get": - # If get failed, then raise a FileNotFoundError - raise FileNotFoundError(url) from exc - logger.debug(str(exc)) - - return {"name": url, "size": None, **info, "type": "file"} - - async def _glob(self, path, maxdepth=None, **kwargs): - """ - Find files by glob-matching. - - This implementation is idntical to the one in AbstractFileSystem, - but "?" is not considered as a character for globbing, because it is - so common in URLs, often identifying the "query" part. - """ - if maxdepth is not None and maxdepth < 1: - raise ValueError("maxdepth must be at least 1") - import re - - ends = path.endswith("/") - path = self._strip_protocol(path) - idx_star = path.find("*") if path.find("*") >= 0 else len(path) - idx_brace = path.find("[") if path.find("[") >= 0 else len(path) - - min_idx = min(idx_star, idx_brace) - - detail = kwargs.pop("detail", False) - - if not has_magic(path): - if await self._exists(path): - if not detail: - return [path] - else: - return {path: await self._info(path)} - else: - if not detail: - return [] # glob of non-existent returns empty - else: - return {} - elif "/" in path[:min_idx]: - min_idx = path[:min_idx].rindex("/") - root = path[: min_idx + 1] - depth = path[min_idx + 1 :].count("/") + 1 - else: - root = "" - depth = path[min_idx + 1 :].count("/") + 1 - - if "**" in path: - if maxdepth is not None: - idx_double_stars = path.find("**") - depth_double_stars = path[idx_double_stars:].count("/") + 1 - depth = depth - depth_double_stars + maxdepth - else: - depth = None - - allpaths = await self._find( - root, maxdepth=depth, withdirs=True, detail=True, **kwargs - ) - # Escape characters special to python regex, leaving our supported - # special characters in place. - # See https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html - # for shell globbing details. - pattern = ( - "^" - + ( - path.replace("\\", r"\\") - .replace(".", r"\.") - .replace("+", r"\+") - .replace("//", "/") - .replace("(", r"\(") - .replace(")", r"\)") - .replace("|", r"\|") - .replace("^", r"\^") - .replace("$", r"\$") - .replace("{", r"\{") - .replace("}", r"\}") - .rstrip("/") - ) - + "$" - ) - pattern = re.sub("/[*]{2}", "=SLASH_DOUBLE_STARS=", pattern) - pattern = re.sub("[*]{2}/?", "=DOUBLE_STARS=", pattern) - pattern = re.sub("[*]", "[^/]*", pattern) - pattern = re.sub("=SLASH_DOUBLE_STARS=", "(|/.*)", pattern) - pattern = re.sub("=DOUBLE_STARS=", ".*", pattern) - pattern = re.compile(pattern) - out = { - p: allpaths[p] - for p in sorted(allpaths) - if pattern.match(p.replace("//", "/").rstrip("/")) - } - - # Return directories only when the glob end by a slash - # This is needed for posix glob compliance - if ends: - out = {k: v for k, v in out.items() if v["type"] == "directory"} - - if detail: - return out - else: - return list(out) - - async def _isdir(self, path): - # override, since all URLs are (also) files - try: - return bool(await self._ls(path)) - except (FileNotFoundError, ValueError): - return False - - -class HTTPFile(AbstractBufferedFile): - """ - A file-like object pointing to a remove HTTP(S) resource - - Supports only reading, with read-ahead of a predermined block-size. - - In the case that the server does not supply the filesize, only reading of - the complete file in one go is supported. - - Parameters - ---------- - url: str - Full URL of the remote resource, including the protocol - session: requests.Session or None - All calls will be made within this session, to avoid restarting - connections where the server allows this - block_size: int or None - The amount of read-ahead to do, in bytes. Default is 5MB, or the value - configured for the FileSystem creating this file - size: None or int - If given, this is the size of the file in bytes, and we don't attempt - to call the server to find the value. - kwargs: all other key-values are passed to requests calls. - """ - - def __init__( - self, - fs, - url, - session=None, - block_size=None, - mode="rb", - cache_type="bytes", - cache_options=None, - size=None, - loop=None, - asynchronous=False, - **kwargs, - ): - if mode != "rb": - raise NotImplementedError("File mode not supported") - self.asynchronous = asynchronous - self.url = url - self.session = session - self.details = {"name": url, "size": size, "type": "file"} - super().__init__( - fs=fs, - path=url, - mode=mode, - block_size=block_size, - cache_type=cache_type, - cache_options=cache_options, - **kwargs, - ) - self.loop = loop - - def read(self, length=-1): - """Read bytes from file - - Parameters - ---------- - length: int - Read up to this many bytes. If negative, read all content to end of - file. If the server has not supplied the filesize, attempting to - read only part of the data will raise a ValueError. - """ - if ( - (length < 0 and self.loc == 0) # explicit read all - # but not when the size is known and fits into a block anyways - and not (self.size is not None and self.size <= self.blocksize) - ): - self._fetch_all() - if self.size is None: - if length < 0: - self._fetch_all() - else: - length = min(self.size - self.loc, length) - return super().read(length) - - async def async_fetch_all(self): - """Read whole file in one shot, without caching - - This is only called when position is still at zero, - and read() is called without a byte-count. - """ - logger.debug(f"Fetch all for {self}") - if not isinstance(self.cache, AllBytes): - r = await self.session.get(self.fs.encode_url(self.url), **self.kwargs) - async with r: - r.raise_for_status() - out = await r.read() - self.cache = AllBytes( - size=len(out), fetcher=None, blocksize=None, data=out - ) - self.size = len(out) - - _fetch_all = sync_wrapper(async_fetch_all) - - def _parse_content_range(self, headers): - """Parse the Content-Range header""" - s = headers.get("Content-Range", "") - m = re.match(r"bytes (\d+-\d+|\*)/(\d+|\*)", s) - if not m: - return None, None, None - - if m[1] == "*": - start = end = None - else: - start, end = [int(x) for x in m[1].split("-")] - total = None if m[2] == "*" else int(m[2]) - return start, end, total - - async def async_fetch_range(self, start, end): - """Download a block of data - - The expectation is that the server returns only the requested bytes, - with HTTP code 206. If this is not the case, we first check the headers, - and then stream the output - if the data size is bigger than we - requested, an exception is raised. - """ - logger.debug(f"Fetch range for {self}: {start}-{end}") - kwargs = self.kwargs.copy() - headers = kwargs.pop("headers", {}).copy() - headers["Range"] = "bytes=%i-%i" % (start, end - 1) - logger.debug(str(self.url) + " : " + headers["Range"]) - r = await self.session.get( - self.fs.encode_url(self.url), headers=headers, **kwargs - ) - async with r: - if r.status == 416: - # range request outside file - return b"" - r.raise_for_status() - - # If the server has handled the range request, it should reply - # with status 206 (partial content). But we'll guess that a suitable - # Content-Range header or a Content-Length no more than the - # requested range also mean we have got the desired range. - response_is_range = ( - r.status == 206 - or self._parse_content_range(r.headers)[0] == start - or int(r.headers.get("Content-Length", end + 1)) <= end - start - ) - - if response_is_range: - # partial content, as expected - out = await r.read() - elif start > 0: - raise ValueError( - "The HTTP server doesn't appear to support range requests. " - "Only reading this file from the beginning is supported. " - "Open with block_size=0 for a streaming file interface." - ) - else: - # Response is not a range, but we want the start of the file, - # so we can read the required amount anyway. - cl = 0 - out = [] - while True: - chunk = await r.content.read(2**20) - # data size unknown, let's read until we have enough - if chunk: - out.append(chunk) - cl += len(chunk) - if cl > end - start: - break - else: - break - out = b"".join(out)[: end - start] - return out - - _fetch_range = sync_wrapper(async_fetch_range) - - def __reduce__(self): - return ( - reopen, - ( - self.fs, - self.url, - self.mode, - self.blocksize, - self.cache.name if self.cache else "none", - self.size, - ), - ) - - -def reopen(fs, url, mode, blocksize, cache_type, size=None): - return fs.open( - url, mode=mode, block_size=blocksize, cache_type=cache_type, size=size - ) - - -magic_check = re.compile("([*[])") - - -def has_magic(s): - match = magic_check.search(s) - return match is not None - - -class HTTPStreamFile(AbstractBufferedFile): - def __init__(self, fs, url, mode="rb", loop=None, session=None, **kwargs): - self.asynchronous = kwargs.pop("asynchronous", False) - self.url = url - self.loop = loop - self.session = session - if mode != "rb": - raise ValueError - self.details = {"name": url, "size": None} - super().__init__(fs=fs, path=url, mode=mode, cache_type="none", **kwargs) - - async def cor(): - r = await self.session.get(self.fs.encode_url(url), **kwargs).__aenter__() - self.fs._raise_not_found_for_status(r, url) - return r - - self.r = sync(self.loop, cor) - - def seek(self, loc, whence=0): - if loc == 0 and whence == 1: - return - if loc == self.loc and whence == 0: - return - raise ValueError("Cannot seek streaming HTTP file") - - async def _read(self, num=-1): - out = await self.r.content.read(num) - self.loc += len(out) - return out - - read = sync_wrapper(_read) - - async def _close(self): - self.r.close() - - def close(self): - asyncio.run_coroutine_threadsafe(self._close(), self.loop) - super().close() - - def __reduce__(self): - return reopen, (self.fs, self.url, self.mode, self.blocksize, self.cache.name) - - -class AsyncStreamFile(AbstractAsyncStreamedFile): - def __init__( - self, fs, url, mode="rb", loop=None, session=None, size=None, **kwargs - ): - self.url = url - self.session = session - self.r = None - if mode != "rb": - raise ValueError - self.details = {"name": url, "size": None} - self.kwargs = kwargs - super().__init__(fs=fs, path=url, mode=mode, cache_type="none") - self.size = size - - async def read(self, num=-1): - if self.r is None: - r = await self.session.get( - self.fs.encode_url(self.url), **self.kwargs - ).__aenter__() - self.fs._raise_not_found_for_status(r, self.url) - self.r = r - out = await self.r.content.read(num) - self.loc += len(out) - return out - - async def close(self): - if self.r is not None: - self.r.close() - self.r = None - await super().close() - - -async def get_range(session, url, start, end, file=None, **kwargs): - # explicit get a range when we know it must be safe - kwargs = kwargs.copy() - headers = kwargs.pop("headers", {}).copy() - headers["Range"] = "bytes=%i-%i" % (start, end - 1) - r = await session.get(url, headers=headers, **kwargs) - r.raise_for_status() - async with r: - out = await r.read() - if file: - with open(file, "rb+") as f: - f.seek(start) - f.write(out) - else: - return out - - -async def _file_info(url, session, size_policy="head", **kwargs): - """Call HEAD on the server to get details about the file (size/checksum etc.) - - Default operation is to explicitly allow redirects and use encoding - 'identity' (no compression) to get the true size of the target. - """ - logger.debug("Retrieve file size for %s" % url) - kwargs = kwargs.copy() - ar = kwargs.pop("allow_redirects", True) - head = kwargs.get("headers", {}).copy() - head["Accept-Encoding"] = "identity" - kwargs["headers"] = head - - info = {} - if size_policy == "head": - r = await session.head(url, allow_redirects=ar, **kwargs) - elif size_policy == "get": - r = await session.get(url, allow_redirects=ar, **kwargs) - else: - raise TypeError('size_policy must be "head" or "get", got %s' "" % size_policy) - async with r: - r.raise_for_status() - - # TODO: - # recognise lack of 'Accept-Ranges', - # or 'Accept-Ranges': 'none' (not 'bytes') - # to mean streaming only, no random access => return None - if "Content-Length" in r.headers: - # Some servers may choose to ignore Accept-Encoding and return - # compressed content, in which case the returned size is unreliable. - if r.headers.get("Content-Encoding", "identity") == "identity": - info["size"] = int(r.headers["Content-Length"]) - elif "Content-Range" in r.headers: - info["size"] = int(r.headers["Content-Range"].split("/")[1]) - - for checksum_field in ["ETag", "Content-MD5", "Digest"]: - if r.headers.get(checksum_field): - info[checksum_field] = r.headers[checksum_field] - - return info - - -async def _file_size(url, session=None, *args, **kwargs): - if session is None: - session = await get_client() - info = await _file_info(url, session=session, *args, **kwargs) - return info.get("size") - - -file_size = sync_wrapper(_file_size) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/http_sync.py b/venv/lib/python3.8/site-packages/fsspec/implementations/http_sync.py deleted file mode 100644 index 744b2bd315cb421b982af3c21254d22bacd77c16..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/http_sync.py +++ /dev/null @@ -1,882 +0,0 @@ -from __future__ import absolute_import, division, print_function - -import io -import logging -import re -import urllib.error -import urllib.parse -from copy import copy -from json import dumps, loads -from urllib.parse import urlparse - -try: - import yarl -except (ImportError, ModuleNotFoundError, OSError): - yarl = False - -from fsspec.callbacks import _DEFAULT_CALLBACK -from fsspec.registry import register_implementation -from fsspec.spec import AbstractBufferedFile, AbstractFileSystem -from fsspec.utils import DEFAULT_BLOCK_SIZE, isfilelike, nullcontext, tokenize - -from ..caching import AllBytes - -# https://stackoverflow.com/a/15926317/3821154 -ex = re.compile(r"""<(a|A)\s+(?:[^>]*?\s+)?(href|HREF)=["'](?P[^"']+)""") -ex2 = re.compile(r"""(?Phttp[s]?://[-a-zA-Z0-9@:%_+.~#?&/=]+)""") -logger = logging.getLogger("fsspec.http") - - -class JsHttpException(urllib.error.HTTPError): - ... - - -class StreamIO(io.BytesIO): - # fake class, so you can set attributes on it - # will eventually actually stream - ... - - -class ResponseProxy: - """Looks like a requests response""" - - def __init__(self, req, stream=False): - self.request = req - self.stream = stream - self._data = None - self._headers = None - - @property - def raw(self): - if self._data is None: - b = self.request.response.to_bytes() - if self.stream: - self._data = StreamIO(b) - else: - self._data = b - return self._data - - def close(self): - if hasattr(self, "_data"): - del self._data - - @property - def headers(self): - if self._headers is None: - self._headers = dict( - [ - _.split(": ") - for _ in self.request.getAllResponseHeaders().strip().split("\r\n") - ] - ) - return self._headers - - @property - def status_code(self): - return int(self.request.status) - - def raise_for_status(self): - if not self.ok: - raise JsHttpException( - self.url, self.status_code, self.reason, self.headers, None - ) - - @property - def reason(self): - return self.request.statusText - - @property - def ok(self): - return self.status_code < 400 - - @property - def url(self): - return self.request.response.responseURL - - @property - def text(self): - # TODO: encoding from headers - return self.content.decode() - - @property - def content(self): - self.stream = False - return self.raw - - @property - def json(self): - return loads(self.text) - - -class RequestsSessionShim: - def __init__(self): - self.headers = {} - - def request( - self, - method, - url, - params=None, - data=None, - headers=None, - cookies=None, - files=None, - auth=None, - timeout=None, - allow_redirects=None, - proxies=None, - hooks=None, - stream=None, - verify=None, - cert=None, - json=None, - ): - import js - from js import Blob, XMLHttpRequest - - if hasattr(js, "document"): - raise RuntimeError("Filesystem can only be run from a worker, not main") - - logger.debug("JS request: %s %s", method, url) - - if cert or verify or proxies or files or cookies or hooks: - raise NotImplementedError - if data and json: - raise ValueError("Use json= or data=, not both") - req = XMLHttpRequest.new() - extra = auth if auth else () - if params: - url = f"{url}?{urllib.parse.urlencode(params)}" - req.open(method, url, False, *extra) - if timeout: - req.timeout = timeout - if headers: - for k, v in headers.items(): - req.setRequestHeader(k, v) - - req.setRequestHeader("Accept", "application/octet-stream") - req.responseType = "arraybuffer" - if json: - blob = Blob.new([dumps(data)], {type: "application/json"}) - req.send(blob) - elif data: - if isinstance(data, io.IOBase): - data = data.read() - blob = Blob.new([data], {type: "application/octet-stream"}) - req.send(blob) - else: - req.send(None) - return ResponseProxy(req, stream=stream) - - def get(self, url, **kwargs): - return self.request("GET", url, **kwargs) - - def head(self, url, **kwargs): - return self.request("HEAD", url, **kwargs) - - def post(self, url, **kwargs): - return self.request("POST}", url, **kwargs) - - def put(self, url, **kwargs): - return self.request("PUT", url, **kwargs) - - def patch(self, url, **kwargs): - return self.request("PATCH", url, **kwargs) - - def delete(self, url, **kwargs): - return self.request("DELETE", url, **kwargs) - - -class HTTPFileSystem(AbstractFileSystem): - """ - Simple File-System for fetching data via HTTP(S) - - ``ls()`` is implemented by loading the parent page and doing a regex - match on the result. If simple_link=True, anything of the form - "http(s)://server.com/stuff?thing=other"; otherwise only links within - HTML href tags will be used. - """ - - sep = "/" - - def __init__( - self, - simple_links=True, - block_size=None, - same_scheme=True, - cache_type="readahead", - cache_options=None, - client_kwargs=None, - encoded=False, - **storage_options, - ): - """ - - Parameters - ---------- - block_size: int - Blocks to read bytes; if 0, will default to raw requests file-like - objects instead of HTTPFile instances - simple_links: bool - If True, will consider both HTML tags and anything that looks - like a URL; if False, will consider only the former. - same_scheme: True - When doing ls/glob, if this is True, only consider paths that have - http/https matching the input URLs. - size_policy: this argument is deprecated - client_kwargs: dict - Passed to aiohttp.ClientSession, see - https://docs.aiohttp.org/en/stable/client_reference.html - For example, ``{'auth': aiohttp.BasicAuth('user', 'pass')}`` - storage_options: key-value - Any other parameters passed on to requests - cache_type, cache_options: defaults used in open - """ - super().__init__(self, **storage_options) - self.block_size = block_size if block_size is not None else DEFAULT_BLOCK_SIZE - self.simple_links = simple_links - self.same_schema = same_scheme - self.cache_type = cache_type - self.cache_options = cache_options - self.client_kwargs = client_kwargs or {} - self.encoded = encoded - self.kwargs = storage_options - - try: - import js # noqa: F401 - - logger.debug("Starting JS session") - self.session = RequestsSessionShim() - self.js = True - except Exception as e: - import requests - - logger.debug("Starting cpython session because of: %s", e) - self.session = requests.Session(**(client_kwargs or {})) - self.js = False - - request_options = copy(storage_options) - self.use_listings_cache = request_options.pop("use_listings_cache", False) - request_options.pop("listings_expiry_time", None) - request_options.pop("max_paths", None) - request_options.pop("skip_instance_cache", None) - self.kwargs = request_options - - @property - def fsid(self): - return "http" - - def encode_url(self, url): - if yarl: - return yarl.URL(url, encoded=self.encoded) - return url - - @classmethod - def _strip_protocol(cls, path): - """For HTTP, we always want to keep the full URL""" - return path - - @classmethod - def _parent(cls, path): - # override, since _strip_protocol is different for URLs - par = super()._parent(path) - if len(par) > 7: # "http://..." - return par - return "" - - def _ls_real(self, url, detail=True, **kwargs): - # ignoring URL-encoded arguments - kw = self.kwargs.copy() - kw.update(kwargs) - logger.debug(url) - r = self.session.get(self.encode_url(url), **self.kwargs) - self._raise_not_found_for_status(r, url) - text = r.text - if self.simple_links: - links = ex2.findall(text) + [u[2] for u in ex.findall(text)] - else: - links = [u[2] for u in ex.findall(text)] - out = set() - parts = urlparse(url) - for l in links: - if isinstance(l, tuple): - l = l[1] - if l.startswith("/") and len(l) > 1: - # absolute URL on this server - l = parts.scheme + "://" + parts.netloc + l - if l.startswith("http"): - if self.same_schema and l.startswith(url.rstrip("/") + "/"): - out.add(l) - elif l.replace("https", "http").startswith( - url.replace("https", "http").rstrip("/") + "/" - ): - # allowed to cross http <-> https - out.add(l) - else: - if l not in ["..", "../"]: - # Ignore FTP-like "parent" - out.add("/".join([url.rstrip("/"), l.lstrip("/")])) - if not out and url.endswith("/"): - out = self._ls_real(url.rstrip("/"), detail=False) - if detail: - return [ - { - "name": u, - "size": None, - "type": "directory" if u.endswith("/") else "file", - } - for u in out - ] - else: - return list(sorted(out)) - - def ls(self, url, detail=True, **kwargs): - - if self.use_listings_cache and url in self.dircache: - out = self.dircache[url] - else: - out = self._ls_real(url, detail=detail, **kwargs) - self.dircache[url] = out - return out - - def _raise_not_found_for_status(self, response, url): - """ - Raises FileNotFoundError for 404s, otherwise uses raise_for_status. - """ - if response.status_code == 404: - raise FileNotFoundError(url) - response.raise_for_status() - - def cat_file(self, url, start=None, end=None, **kwargs): - kw = self.kwargs.copy() - kw.update(kwargs) - logger.debug(url) - - if start is not None or end is not None: - if start == end: - return b"" - headers = kw.pop("headers", {}).copy() - - headers["Range"] = self._process_limits(url, start, end) - kw["headers"] = headers - r = self.session.get(self.encode_url(url), **kw) - self._raise_not_found_for_status(r, url) - return r.content - - def get_file( - self, rpath, lpath, chunk_size=5 * 2**20, callback=_DEFAULT_CALLBACK, **kwargs - ): - kw = self.kwargs.copy() - kw.update(kwargs) - logger.debug(rpath) - r = self.session.get(self.encode_url(rpath), **kw) - try: - size = int(r.headers["content-length"]) - except (ValueError, KeyError): - size = None - - callback.set_size(size) - self._raise_not_found_for_status(r, rpath) - if not isfilelike(lpath): - lpath = open(lpath, "wb") - chunk = True - while chunk: - r.raw.decode_content = True - chunk = r.raw.read(chunk_size) - lpath.write(chunk) - callback.relative_update(len(chunk)) - - def put_file( - self, - lpath, - rpath, - chunk_size=5 * 2**20, - callback=_DEFAULT_CALLBACK, - method="post", - **kwargs, - ): - def gen_chunks(): - # Support passing arbitrary file-like objects - # and use them instead of streams. - if isinstance(lpath, io.IOBase): - context = nullcontext(lpath) - use_seek = False # might not support seeking - else: - context = open(lpath, "rb") - use_seek = True - - with context as f: - if use_seek: - callback.set_size(f.seek(0, 2)) - f.seek(0) - else: - callback.set_size(getattr(f, "size", None)) - - chunk = f.read(chunk_size) - while chunk: - yield chunk - callback.relative_update(len(chunk)) - chunk = f.read(chunk_size) - - kw = self.kwargs.copy() - kw.update(kwargs) - - method = method.lower() - if method not in ("post", "put"): - raise ValueError( - f"method has to be either 'post' or 'put', not: {method!r}" - ) - - meth = getattr(self.session, method) - resp = meth(rpath, data=gen_chunks(), **kw) - self._raise_not_found_for_status(resp, rpath) - - def exists(self, path, **kwargs): - kw = self.kwargs.copy() - kw.update(kwargs) - try: - logger.debug(path) - r = self.session.get(self.encode_url(path), **kw) - return r.status_code < 400 - except Exception: - return False - - def isfile(self, path, **kwargs): - return self.exists(path, **kwargs) - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=None, # XXX: This differs from the base class. - cache_type=None, - cache_options=None, - size=None, - **kwargs, - ): - """Make a file-like object - - Parameters - ---------- - path: str - Full URL with protocol - mode: string - must be "rb" - block_size: int or None - Bytes to download in one request; use instance value if None. If - zero, will return a streaming Requests file-like instance. - kwargs: key-value - Any other parameters, passed to requests calls - """ - if mode != "rb": - raise NotImplementedError - block_size = block_size if block_size is not None else self.block_size - kw = self.kwargs.copy() - kw.update(kwargs) - size = size or self.info(path, **kwargs)["size"] - if block_size and size: - return HTTPFile( - self, - path, - session=self.session, - block_size=block_size, - mode=mode, - size=size, - cache_type=cache_type or self.cache_type, - cache_options=cache_options or self.cache_options, - **kw, - ) - else: - return HTTPStreamFile( - self, - path, - mode=mode, - session=self.session, - **kw, - ) - - def ukey(self, url): - """Unique identifier; assume HTTP files are static, unchanging""" - return tokenize(url, self.kwargs, self.protocol) - - def info(self, url, **kwargs): - """Get info of URL - - Tries to access location via HEAD, and then GET methods, but does - not fetch the data. - - It is possible that the server does not supply any size information, in - which case size will be given as None (and certain operations on the - corresponding file will not work). - """ - info = {} - for policy in ["head", "get"]: - try: - info.update( - _file_info( - self.encode_url(url), - size_policy=policy, - session=self.session, - **self.kwargs, - **kwargs, - ) - ) - if info.get("size") is not None: - break - except Exception as exc: - if policy == "get": - # If get failed, then raise a FileNotFoundError - raise FileNotFoundError(url) from exc - logger.debug(str(exc)) - - return {"name": url, "size": None, **info, "type": "file"} - - def glob(self, path, **kwargs): - """ - Find files by glob-matching. - - This implementation is idntical to the one in AbstractFileSystem, - but "?" is not considered as a character for globbing, because it is - so common in URLs, often identifying the "query" part. - """ - import re - - ends = path.endswith("/") - path = self._strip_protocol(path) - indstar = path.find("*") if path.find("*") >= 0 else len(path) - indbrace = path.find("[") if path.find("[") >= 0 else len(path) - - ind = min(indstar, indbrace) - - detail = kwargs.pop("detail", False) - - if not has_magic(path): - root = path - depth = 1 - if ends: - path += "/*" - elif self.exists(path): - if not detail: - return [path] - else: - return {path: self.info(path)} - else: - if not detail: - return [] # glob of non-existent returns empty - else: - return {} - elif "/" in path[:ind]: - ind2 = path[:ind].rindex("/") - root = path[: ind2 + 1] - depth = None if "**" in path else path[ind2 + 1 :].count("/") + 1 - else: - root = "" - depth = None if "**" in path else path[ind + 1 :].count("/") + 1 - - allpaths = self.find(root, maxdepth=depth, withdirs=True, detail=True, **kwargs) - # Escape characters special to python regex, leaving our supported - # special characters in place. - # See https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html - # for shell globbing details. - pattern = ( - "^" - + ( - path.replace("\\", r"\\") - .replace(".", r"\.") - .replace("+", r"\+") - .replace("//", "/") - .replace("(", r"\(") - .replace(")", r"\)") - .replace("|", r"\|") - .replace("^", r"\^") - .replace("$", r"\$") - .replace("{", r"\{") - .replace("}", r"\}") - .rstrip("/") - ) - + "$" - ) - pattern = re.sub("[*]{2}", "=PLACEHOLDER=", pattern) - pattern = re.sub("[*]", "[^/]*", pattern) - pattern = re.compile(pattern.replace("=PLACEHOLDER=", ".*")) - out = { - p: allpaths[p] - for p in sorted(allpaths) - if pattern.match(p.replace("//", "/").rstrip("/")) - } - if detail: - return out - else: - return list(out) - - def isdir(self, path): - # override, since all URLs are (also) files - try: - return bool(self._ls(path)) - except (FileNotFoundError, ValueError): - return False - - -class HTTPFile(AbstractBufferedFile): - """ - A file-like object pointing to a remove HTTP(S) resource - - Supports only reading, with read-ahead of a predermined block-size. - - In the case that the server does not supply the filesize, only reading of - the complete file in one go is supported. - - Parameters - ---------- - url: str - Full URL of the remote resource, including the protocol - session: requests.Session or None - All calls will be made within this session, to avoid restarting - connections where the server allows this - block_size: int or None - The amount of read-ahead to do, in bytes. Default is 5MB, or the value - configured for the FileSystem creating this file - size: None or int - If given, this is the size of the file in bytes, and we don't attempt - to call the server to find the value. - kwargs: all other key-values are passed to requests calls. - """ - - def __init__( - self, - fs, - url, - session=None, - block_size=None, - mode="rb", - cache_type="bytes", - cache_options=None, - size=None, - **kwargs, - ): - if mode != "rb": - raise NotImplementedError("File mode not supported") - self.url = url - self.session = session - self.details = {"name": url, "size": size, "type": "file"} - super().__init__( - fs=fs, - path=url, - mode=mode, - block_size=block_size, - cache_type=cache_type, - cache_options=cache_options, - **kwargs, - ) - - def read(self, length=-1): - """Read bytes from file - - Parameters - ---------- - length: int - Read up to this many bytes. If negative, read all content to end of - file. If the server has not supplied the filesize, attempting to - read only part of the data will raise a ValueError. - """ - if ( - (length < 0 and self.loc == 0) # explicit read all - # but not when the size is known and fits into a block anyways - and not (self.size is not None and self.size <= self.blocksize) - ): - self._fetch_all() - if self.size is None: - if length < 0: - self._fetch_all() - else: - length = min(self.size - self.loc, length) - return super().read(length) - - def _fetch_all(self): - """Read whole file in one shot, without caching - - This is only called when position is still at zero, - and read() is called without a byte-count. - """ - logger.debug(f"Fetch all for {self}") - if not isinstance(self.cache, AllBytes): - r = self.session.get(self.fs.encode_url(self.url), **self.kwargs) - r.raise_for_status() - out = r.content - self.cache = AllBytes(size=len(out), fetcher=None, blocksize=None, data=out) - self.size = len(out) - - def _parse_content_range(self, headers): - """Parse the Content-Range header""" - s = headers.get("Content-Range", "") - m = re.match(r"bytes (\d+-\d+|\*)/(\d+|\*)", s) - if not m: - return None, None, None - - if m[1] == "*": - start = end = None - else: - start, end = [int(x) for x in m[1].split("-")] - total = None if m[2] == "*" else int(m[2]) - return start, end, total - - def _fetch_range(self, start, end): - """Download a block of data - - The expectation is that the server returns only the requested bytes, - with HTTP code 206. If this is not the case, we first check the headers, - and then stream the output - if the data size is bigger than we - requested, an exception is raised. - """ - logger.debug(f"Fetch range for {self}: {start}-{end}") - kwargs = self.kwargs.copy() - headers = kwargs.pop("headers", {}).copy() - headers["Range"] = "bytes=%i-%i" % (start, end - 1) - logger.debug(str(self.url) + " : " + headers["Range"]) - r = self.session.get(self.fs.encode_url(self.url), headers=headers, **kwargs) - if r.status_code == 416: - # range request outside file - return b"" - r.raise_for_status() - - # If the server has handled the range request, it should reply - # with status 206 (partial content). But we'll guess that a suitable - # Content-Range header or a Content-Length no more than the - # requested range also mean we have got the desired range. - cl = r.headers.get("Content-Length", r.headers.get("content-length", end + 1)) - response_is_range = ( - r.status_code == 206 - or self._parse_content_range(r.headers)[0] == start - or int(cl) <= end - start - ) - - if response_is_range: - # partial content, as expected - out = r.content - elif start > 0: - raise ValueError( - "The HTTP server doesn't appear to support range requests. " - "Only reading this file from the beginning is supported. " - "Open with block_size=0 for a streaming file interface." - ) - else: - # Response is not a range, but we want the start of the file, - # so we can read the required amount anyway. - cl = 0 - out = [] - while True: - r.raw.decode_content = True - chunk = r.raw.read(2**20) - # data size unknown, let's read until we have enough - if chunk: - out.append(chunk) - cl += len(chunk) - if cl > end - start: - break - else: - break - r.raw.close() - out = b"".join(out)[: end - start] - return out - - -magic_check = re.compile("([*[])") - - -def has_magic(s): - match = magic_check.search(s) - return match is not None - - -class HTTPStreamFile(AbstractBufferedFile): - def __init__(self, fs, url, mode="rb", session=None, **kwargs): - self.url = url - self.session = session - if mode != "rb": - raise ValueError - self.details = {"name": url, "size": None} - super().__init__(fs=fs, path=url, mode=mode, cache_type="readahead", **kwargs) - - r = self.session.get(self.fs.encode_url(url), stream=True, **kwargs) - r.raw.decode_content = True - self.fs._raise_not_found_for_status(r, url) - - self.r = r - - def seek(self, *args, **kwargs): - raise ValueError("Cannot seek streaming HTTP file") - - def read(self, num=-1): - bufs = [] - leng = 0 - while not self.r.raw.closed and (leng < num or num < 0): - out = self.r.raw.read(num) - if out: - bufs.append(out) - else: - break - leng += len(out) - self.loc += leng - return b"".join(bufs) - - def close(self): - self.r.close() - - -def get_range(session, url, start, end, **kwargs): - # explicit get a range when we know it must be safe - kwargs = kwargs.copy() - headers = kwargs.pop("headers", {}).copy() - headers["Range"] = "bytes=%i-%i" % (start, end - 1) - r = session.get(url, headers=headers, **kwargs) - r.raise_for_status() - return r.content - - -def _file_info(url, session, size_policy="head", **kwargs): - """Call HEAD on the server to get details about the file (size/checksum etc.) - - Default operation is to explicitly allow redirects and use encoding - 'identity' (no compression) to get the true size of the target. - """ - logger.debug("Retrieve file size for %s" % url) - kwargs = kwargs.copy() - ar = kwargs.pop("allow_redirects", True) - head = kwargs.get("headers", {}).copy() - # TODO: not allowed in JS - # head["Accept-Encoding"] = "identity" - kwargs["headers"] = head - - info = {} - if size_policy == "head": - r = session.head(url, allow_redirects=ar, **kwargs) - elif size_policy == "get": - r = session.get(url, allow_redirects=ar, **kwargs) - else: - raise TypeError('size_policy must be "head" or "get", got %s' "" % size_policy) - r.raise_for_status() - - # TODO: - # recognise lack of 'Accept-Ranges', - # or 'Accept-Ranges': 'none' (not 'bytes') - # to mean streaming only, no random access => return None - if "Content-Length" in r.headers: - info["size"] = int(r.headers["Content-Length"]) - elif "Content-Range" in r.headers: - info["size"] = int(r.headers["Content-Range"].split("/")[1]) - if "content-length" in r.headers: - info["size"] = int(r.headers["content-length"]) - elif "content-range" in r.headers: - info["size"] = int(r.headers["content-range"].split("/")[1]) - - for checksum_field in ["ETag", "Content-MD5", "Digest"]: - if r.headers.get(checksum_field): - info[checksum_field] = r.headers[checksum_field] - - return info - - -# importing this is enough to register it -register_implementation("http", HTTPFileSystem, clobber=True) -register_implementation("https", HTTPFileSystem, clobber=True) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/jupyter.py b/venv/lib/python3.8/site-packages/fsspec/implementations/jupyter.py deleted file mode 100644 index 782fa86399d0ae7e4abaf5bad590f6a67f1a4f08..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/jupyter.py +++ /dev/null @@ -1,124 +0,0 @@ -import base64 -import io -import re - -import requests - -import fsspec - - -class JupyterFileSystem(fsspec.AbstractFileSystem): - """View of the files as seen by a Jupyter server (notebook or lab)""" - - protocol = ("jupyter", "jlab") - - def __init__(self, url, tok=None, **kwargs): - """ - - Parameters - ---------- - url : str - Base URL of the server, like "http://127.0.0.1:8888". May include - token in the string, which is given by the process when starting up - tok : str - If the token is obtained separately, can be given here - kwargs - """ - if "?" in url: - if tok is None: - try: - tok = re.findall("token=([a-z0-9]+)", url)[0] - except IndexError as e: - raise ValueError("Could not determine token") from e - url = url.split("?", 1)[0] - self.url = url.rstrip("/") + "/api/contents" - self.session = requests.Session() - if tok: - self.session.headers["Authorization"] = f"token {tok}" - - super().__init__(**kwargs) - - def ls(self, path, detail=True, **kwargs): - path = self._strip_protocol(path) - r = self.session.get(self.url + "/" + path) - if r.status_code == 404: - return FileNotFoundError(path) - r.raise_for_status() - out = r.json() - - if out["type"] == "directory": - out = out["content"] - else: - out = [out] - for o in out: - o["name"] = o.pop("path") - o.pop("content") - if o["type"] == "notebook": - o["type"] = "file" - if detail: - return out - return [o["name"] for o in out] - - def cat_file(self, path, start=None, end=None, **kwargs): - path = self._strip_protocol(path) - r = self.session.get(self.url + "/" + path) - if r.status_code == 404: - return FileNotFoundError(path) - r.raise_for_status() - out = r.json() - if out["format"] == "text": - # data should be binary - b = out["content"].encode() - else: - b = base64.b64decode(out["content"]) - return b[start:end] - - def pipe_file(self, path, value, **_): - path = self._strip_protocol(path) - json = { - "name": path.rsplit("/", 1)[-1], - "path": path, - "size": len(value), - "content": base64.b64encode(value).decode(), - "format": "base64", - "type": "file", - } - self.session.put(self.url + "/" + path, json=json) - - def mkdir(self, path, create_parents=True, **kwargs): - path = self._strip_protocol(path) - if create_parents and "/" in path: - self.mkdir(path.rsplit("/", 1)[0], True) - json = { - "name": path.rsplit("/", 1)[-1], - "path": path, - "size": None, - "content": None, - "type": "directory", - } - self.session.put(self.url + "/" + path, json=json) - - def _rm(self, path): - path = self._strip_protocol(path) - self.session.delete(self.url + "/" + path) - - def _open(self, path, mode="rb", **kwargs): - path = self._strip_protocol(path) - if mode == "rb": - data = self.cat_file(path) - return io.BytesIO(data) - else: - return SimpleFileWriter(self, path, mode="wb") - - -class SimpleFileWriter(fsspec.spec.AbstractBufferedFile): - def _upload_chunk(self, final=False): - """Never uploads a chunk until file is done - - Not suitable for large files - """ - if final is False: - return False - self.buffer.seek(0) - data = self.buffer.read() - self.fs.pipe_file(self.path, data) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/libarchive.py b/venv/lib/python3.8/site-packages/fsspec/implementations/libarchive.py deleted file mode 100644 index 8490404239856a8172a7d348fdbbd52ff22d34ce..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/libarchive.py +++ /dev/null @@ -1,215 +0,0 @@ -from contextlib import contextmanager -from ctypes import ( - CFUNCTYPE, - POINTER, - c_int, - c_longlong, - c_void_p, - cast, - create_string_buffer, -) - -import libarchive -import libarchive.ffi as ffi - -from fsspec import open_files -from fsspec.archive import AbstractArchiveFileSystem -from fsspec.implementations.memory import MemoryFile -from fsspec.utils import DEFAULT_BLOCK_SIZE - -# Libarchive requires seekable files or memory only for certain archive -# types. However, since we read the directory first to cache the contents -# and also allow random access to any file, the file-like object needs -# to be seekable no matter what. - -# Seek call-backs (not provided in the libarchive python wrapper) -SEEK_CALLBACK = CFUNCTYPE(c_longlong, c_int, c_void_p, c_longlong, c_int) -read_set_seek_callback = ffi.ffi( - "read_set_seek_callback", [ffi.c_archive_p, SEEK_CALLBACK], c_int, ffi.check_int -) -new_api = hasattr(ffi, "NO_OPEN_CB") - - -@contextmanager -def custom_reader(file, format_name="all", filter_name="all", block_size=ffi.page_size): - """Read an archive from a seekable file-like object. - - The `file` object must support the standard `readinto` and 'seek' methods. - """ - buf = create_string_buffer(block_size) - buf_p = cast(buf, c_void_p) - - def read_func(archive_p, context, ptrptr): - # readinto the buffer, returns number of bytes read - length = file.readinto(buf) - # write the address of the buffer into the pointer - ptrptr = cast(ptrptr, POINTER(c_void_p)) - ptrptr[0] = buf_p - # tell libarchive how much data was written into the buffer - return length - - def seek_func(archive_p, context, offset, whence): - file.seek(offset, whence) - # tell libarchvie the current position - return file.tell() - - read_cb = ffi.READ_CALLBACK(read_func) - seek_cb = SEEK_CALLBACK(seek_func) - - if new_api: - open_cb = ffi.NO_OPEN_CB - close_cb = ffi.NO_CLOSE_CB - else: - open_cb = libarchive.read.OPEN_CALLBACK(ffi.VOID_CB) - close_cb = libarchive.read.CLOSE_CALLBACK(ffi.VOID_CB) - - with libarchive.read.new_archive_read(format_name, filter_name) as archive_p: - read_set_seek_callback(archive_p, seek_cb) - ffi.read_open(archive_p, None, open_cb, read_cb, close_cb) - yield libarchive.read.ArchiveRead(archive_p) - - -class LibArchiveFileSystem(AbstractArchiveFileSystem): - """Compressed archives as a file-system (read-only) - - Supports the following formats: - tar, pax , cpio, ISO9660, zip, mtree, shar, ar, raw, xar, lha/lzh, rar - Microsoft CAB, 7-Zip, WARC - - See the libarchive documentation for further restrictions. - https://www.libarchive.org/ - - Keeps file object open while instance lives. It only works in seekable - file-like objects. In case the filesystem does not support this kind of - file object, it is recommended to cache locally. - - This class is pickleable, but not necessarily thread-safe (depends on the - platform). See libarchive documentation for details. - """ - - root_marker = "" - protocol = "libarchive" - cachable = False - - def __init__( - self, - fo="", - mode="r", - target_protocol=None, - target_options=None, - block_size=DEFAULT_BLOCK_SIZE, - **kwargs, - ): - """ - Parameters - ---------- - fo: str or file-like - Contains ZIP, and must exist. If a str, will fetch file using - :meth:`~fsspec.open_files`, which must return one file exactly. - mode: str - Currently, only 'r' accepted - target_protocol: str (optional) - If ``fo`` is a string, this value can be used to override the - FS protocol inferred from a URL - target_options: dict (optional) - Kwargs passed when instantiating the target FS, if ``fo`` is - a string. - """ - super().__init__(self, **kwargs) - if mode != "r": - raise ValueError("Only read from archive files accepted") - if isinstance(fo, str): - files = open_files(fo, protocol=target_protocol, **(target_options or {})) - if len(files) != 1: - raise ValueError( - 'Path "{}" did not resolve to exactly' - 'one file: "{}"'.format(fo, files) - ) - fo = files[0] - self.of = fo - self.fo = fo.__enter__() # the whole instance is a context - self.block_size = block_size - self.dir_cache = None - - @contextmanager - def _open_archive(self): - self.fo.seek(0) - with custom_reader(self.fo, block_size=self.block_size) as arc: - yield arc - - @classmethod - def _strip_protocol(cls, path): - # file paths are always relative to the archive root - return super()._strip_protocol(path).lstrip("/") - - def _get_dirs(self): - fields = { - "name": "pathname", - "size": "size", - "created": "ctime", - "mode": "mode", - "uid": "uid", - "gid": "gid", - "mtime": "mtime", - } - - if self.dir_cache is not None: - return - - self.dir_cache = {} - list_names = [] - with self._open_archive() as arc: - for entry in arc: - if not entry.isdir and not entry.isfile: - # Skip symbolic links, fifo entries, etc. - continue - self.dir_cache.update( - { - dirname - + "/": {"name": dirname + "/", "size": 0, "type": "directory"} - for dirname in self._all_dirnames(set(entry.name)) - } - ) - f = {key: getattr(entry, fields[key]) for key in fields} - f["type"] = "directory" if entry.isdir else "file" - list_names.append(entry.name) - - self.dir_cache[f["name"]] = f - # libarchive does not seem to return an entry for the directories (at least - # not in all formats), so get the directories names from the files names - self.dir_cache.update( - { - dirname + "/": {"name": dirname + "/", "size": 0, "type": "directory"} - for dirname in self._all_dirnames(list_names) - } - ) - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - cache_options=None, - **kwargs, - ): - path = self._strip_protocol(path) - if mode != "rb": - raise NotImplementedError - - data = bytes() - with self._open_archive() as arc: - for entry in arc: - if entry.pathname != path: - continue - - if entry.size == 0: - # empty file, so there are no blocks - break - - for block in entry.get_blocks(entry.size): - data = block - break - else: - raise ValueError - return MemoryFile(fs=self, path=path, data=data) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/local.py b/venv/lib/python3.8/site-packages/fsspec/implementations/local.py deleted file mode 100644 index 971074e95ee8f32c1284217702fe67e5f259db47..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/local.py +++ /dev/null @@ -1,407 +0,0 @@ -import datetime -import io -import logging -import os -import os.path as osp -import posixpath -import re -import shutil -import stat -import tempfile - -from fsspec import AbstractFileSystem -from fsspec.compression import compr -from fsspec.core import get_compression -from fsspec.utils import isfilelike, stringify_path - -logger = logging.getLogger("fsspec.local") - - -class LocalFileSystem(AbstractFileSystem): - """Interface to files on local storage - - Parameters - ---------- - auto_mkdir: bool - Whether, when opening a file, the directory containing it should - be created (if it doesn't already exist). This is assumed by pyarrow - code. - """ - - root_marker = "/" - protocol = "file" - local_file = True - - def __init__(self, auto_mkdir=False, **kwargs): - super().__init__(**kwargs) - self.auto_mkdir = auto_mkdir - - @property - def fsid(self): - return "local" - - def mkdir(self, path, create_parents=True, **kwargs): - path = self._strip_protocol(path) - if self.exists(path): - raise FileExistsError(path) - if create_parents: - self.makedirs(path, exist_ok=True) - else: - os.mkdir(path, **kwargs) - - def makedirs(self, path, exist_ok=False): - path = self._strip_protocol(path) - os.makedirs(path, exist_ok=exist_ok) - - def rmdir(self, path): - path = self._strip_protocol(path) - os.rmdir(path) - - def ls(self, path, detail=False, **kwargs): - path = self._strip_protocol(path) - if detail: - with os.scandir(path) as it: - return [self.info(f) for f in it] - else: - return [posixpath.join(path, f) for f in os.listdir(path)] - - def info(self, path, **kwargs): - if isinstance(path, os.DirEntry): - # scandir DirEntry - out = path.stat(follow_symlinks=False) - link = path.is_symlink() - if path.is_dir(follow_symlinks=False): - t = "directory" - elif path.is_file(follow_symlinks=False): - t = "file" - else: - t = "other" - path = self._strip_protocol(path.path) - else: - # str or path-like - path = self._strip_protocol(path) - out = os.stat(path, follow_symlinks=False) - link = stat.S_ISLNK(out.st_mode) - if link: - out = os.stat(path, follow_symlinks=True) - if stat.S_ISDIR(out.st_mode): - t = "directory" - elif stat.S_ISREG(out.st_mode): - t = "file" - else: - t = "other" - result = { - "name": path, - "size": out.st_size, - "type": t, - "created": out.st_ctime, - "islink": link, - } - for field in ["mode", "uid", "gid", "mtime", "ino", "nlink"]: - result[field] = getattr(out, "st_" + field) - if result["islink"]: - result["destination"] = os.readlink(path) - try: - out2 = os.stat(path, follow_symlinks=True) - result["size"] = out2.st_size - except OSError: - result["size"] = 0 - return result - - def lexists(self, path, **kwargs): - return osp.lexists(path) - - def cp_file(self, path1, path2, **kwargs): - path1 = self._strip_protocol(path1).rstrip("/") - path2 = self._strip_protocol(path2).rstrip("/") - if self.auto_mkdir: - self.makedirs(self._parent(path2), exist_ok=True) - if self.isfile(path1): - shutil.copyfile(path1, path2) - elif self.isdir(path1): - self.mkdirs(path2, exist_ok=True) - else: - raise FileNotFoundError(path1) - - def get_file(self, path1, path2, callback=None, **kwargs): - if isfilelike(path2): - with open(path1, "rb") as f: - shutil.copyfileobj(f, path2) - else: - return self.cp_file(path1, path2, **kwargs) - - def put_file(self, path1, path2, callback=None, **kwargs): - return self.cp_file(path1, path2, **kwargs) - - def mv_file(self, path1, path2, **kwargs): - path1 = self._strip_protocol(path1).rstrip("/") - path2 = self._strip_protocol(path2).rstrip("/") - shutil.move(path1, path2) - - def link(self, src, dst, **kwargs): - src = self._strip_protocol(src) - dst = self._strip_protocol(dst) - os.link(src, dst, **kwargs) - - def symlink(self, src, dst, **kwargs): - src = self._strip_protocol(src) - dst = self._strip_protocol(dst) - os.symlink(src, dst, **kwargs) - - def islink(self, path) -> bool: - return os.path.islink(self._strip_protocol(path)) - - def rm_file(self, path): - os.remove(self._strip_protocol(path)) - - def rm(self, path, recursive=False, maxdepth=None): - if not isinstance(path, list): - path = [path] - - for p in path: - p = self._strip_protocol(p).rstrip("/") - if self.isdir(p): - if not recursive: - raise ValueError("Cannot delete directory, set recursive=True") - if osp.abspath(p) == os.getcwd(): - raise ValueError("Cannot delete current working directory") - shutil.rmtree(p) - else: - os.remove(p) - - def unstrip_protocol(self, name): - name = self._strip_protocol(name) # normalise for local/win/... - return f"file://{name}" - - def _open(self, path, mode="rb", block_size=None, **kwargs): - path = self._strip_protocol(path) - if self.auto_mkdir and "w" in mode: - self.makedirs(self._parent(path), exist_ok=True) - return LocalFileOpener(path, mode, fs=self, **kwargs) - - def touch(self, path, truncate=True, **kwargs): - path = self._strip_protocol(path) - if self.auto_mkdir: - self.makedirs(self._parent(path), exist_ok=True) - if self.exists(path): - os.utime(path, None) - else: - open(path, "a").close() - if truncate: - os.truncate(path, 0) - - def created(self, path): - info = self.info(path=path) - return datetime.datetime.fromtimestamp( - info["created"], tz=datetime.timezone.utc - ) - - def modified(self, path): - info = self.info(path=path) - return datetime.datetime.fromtimestamp(info["mtime"], tz=datetime.timezone.utc) - - @classmethod - def _parent(cls, path): - path = cls._strip_protocol(path).rstrip("/") - if "/" in path: - return path.rsplit("/", 1)[0] - else: - return cls.root_marker - - @classmethod - def _strip_protocol(cls, path): - path = stringify_path(path) - if path.startswith("file://"): - path = path[7:] - elif path.startswith("file:"): - path = path[5:] - return make_path_posix(path).rstrip("/") or cls.root_marker - - def _isfilestore(self): - # Inheriting from DaskFileSystem makes this False (S3, etc. were) - # the original motivation. But we are a posix-like file system. - # See https://github.com/dask/dask/issues/5526 - return True - - def chmod(self, path, mode): - path = stringify_path(path) - return os.chmod(path, mode) - - -def make_path_posix(path, sep=os.sep): - """Make path generic""" - if isinstance(path, (list, set, tuple)): - return type(path)(make_path_posix(p) for p in path) - if "~" in path: - path = osp.expanduser(path) - if sep == "/": - # most common fast case for posix - if path.startswith("/"): - return path - if path.startswith("./"): - path = path[2:] - return os.getcwd() + "/" + path - if ( - (sep not in path and "/" not in path) - or (sep == "/" and not path.startswith("/")) - or (sep == "\\" and ":" not in path and not path.startswith("\\\\")) - ): - # relative path like "path" or "rel\\path" (win) or rel/path" - if os.sep == "\\": - # abspath made some more '\\' separators - return make_path_posix(osp.abspath(path)) - else: - return os.getcwd() + "/" + path - if path.startswith("file://"): - path = path[7:] - if re.match("/[A-Za-z]:", path): - # for windows file URI like "file:///C:/folder/file" - # or "file:///C:\\dir\\file" - path = path[1:].replace("\\", "/").replace("//", "/") - if path.startswith("\\\\"): - # special case for windows UNC/DFS-style paths, do nothing, - # just flip the slashes around (case below does not work!) - return path.replace("\\", "/") - if re.match("[A-Za-z]:", path): - # windows full path like "C:\\local\\path" - return path.lstrip("\\").replace("\\", "/").replace("//", "/") - if path.startswith("\\"): - # windows network path like "\\server\\path" - return "/" + path.lstrip("\\").replace("\\", "/").replace("//", "/") - return path - - -def trailing_sep(path): - """Return True if the path ends with a path separator. - - A forward slash is always considered a path separator, even on Operating - Systems that normally use a backslash. - """ - # TODO: if all incoming paths were posix-compliant then separator would - # always be a forward slash, simplifying this function. - # See https://github.com/fsspec/filesystem_spec/pull/1250 - return path.endswith(os.sep) or (os.altsep is not None and path.endswith(os.altsep)) - - -class LocalFileOpener(io.IOBase): - def __init__( - self, path, mode, autocommit=True, fs=None, compression=None, **kwargs - ): - logger.debug("open file: %s", path) - self.path = path - self.mode = mode - self.fs = fs - self.f = None - self.autocommit = autocommit - self.compression = get_compression(path, compression) - self.blocksize = io.DEFAULT_BUFFER_SIZE - self._open() - - def _open(self): - if self.f is None or self.f.closed: - if self.autocommit or "w" not in self.mode: - self.f = open(self.path, mode=self.mode) - if self.compression: - compress = compr[self.compression] - self.f = compress(self.f, mode=self.mode) - else: - # TODO: check if path is writable? - i, name = tempfile.mkstemp() - os.close(i) # we want normal open and normal buffered file - self.temp = name - self.f = open(name, mode=self.mode) - if "w" not in self.mode: - self.size = self.f.seek(0, 2) - self.f.seek(0) - self.f.size = self.size - - def _fetch_range(self, start, end): - # probably only used by cached FS - if "r" not in self.mode: - raise ValueError - self._open() - self.f.seek(start) - return self.f.read(end - start) - - def __setstate__(self, state): - self.f = None - loc = state.pop("loc", None) - self.__dict__.update(state) - if "r" in state["mode"]: - self.f = None - self._open() - self.f.seek(loc) - - def __getstate__(self): - d = self.__dict__.copy() - d.pop("f") - if "r" in self.mode: - d["loc"] = self.f.tell() - else: - if not self.f.closed: - raise ValueError("Cannot serialise open write-mode local file") - return d - - def commit(self): - if self.autocommit: - raise RuntimeError("Can only commit if not already set to autocommit") - shutil.move(self.temp, self.path) - - def discard(self): - if self.autocommit: - raise RuntimeError("Cannot discard if set to autocommit") - os.remove(self.temp) - - def readable(self) -> bool: - return True - - def writable(self) -> bool: - return "r" not in self.mode - - def read(self, *args, **kwargs): - return self.f.read(*args, **kwargs) - - def write(self, *args, **kwargs): - return self.f.write(*args, **kwargs) - - def tell(self, *args, **kwargs): - return self.f.tell(*args, **kwargs) - - def seek(self, *args, **kwargs): - return self.f.seek(*args, **kwargs) - - def seekable(self, *args, **kwargs): - return self.f.seekable(*args, **kwargs) - - def readline(self, *args, **kwargs): - return self.f.readline(*args, **kwargs) - - def readlines(self, *args, **kwargs): - return self.f.readlines(*args, **kwargs) - - def close(self): - return self.f.close() - - @property - def closed(self): - return self.f.closed - - def fileno(self): - return self.raw.fileno() - - def flush(self) -> None: - self.f.flush() - - def __iter__(self): - return self.f.__iter__() - - def __getattr__(self, item): - return getattr(self.f, item) - - def __enter__(self): - self._incontext = True - return self - - def __exit__(self, exc_type, exc_value, traceback): - self._incontext = False - self.f.__exit__(exc_type, exc_value, traceback) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/memory.py b/venv/lib/python3.8/site-packages/fsspec/implementations/memory.py deleted file mode 100644 index 32daaf0f1c0c9e930c3ba5bbdbfe207ff5381cf3..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/memory.py +++ /dev/null @@ -1,292 +0,0 @@ -from __future__ import annotations - -import logging -from datetime import datetime, timezone -from errno import ENOTEMPTY -from io import BytesIO -from typing import Any, ClassVar - -from fsspec import AbstractFileSystem - -logger = logging.Logger("fsspec.memoryfs") - - -class MemoryFileSystem(AbstractFileSystem): - """A filesystem based on a dict of BytesIO objects - - This is a global filesystem so instances of this class all point to the same - in memory filesystem. - """ - - store: ClassVar[dict[str, Any]] = {} # global, do not overwrite! - pseudo_dirs = [""] # global, do not overwrite! - protocol = "memory" - root_marker = "/" - - @classmethod - def _strip_protocol(cls, path): - if path.startswith("memory://"): - path = path[len("memory://") :] - if "::" in path or "://" in path: - return path.rstrip("/") - path = path.lstrip("/").rstrip("/") - return "/" + path if path else "" - - def ls(self, path, detail=True, **kwargs): - path = self._strip_protocol(path) - if path in self.store: - # there is a key with this exact name - if not detail: - return [path] - return [ - { - "name": path, - "size": self.store[path].size, - "type": "file", - "created": self.store[path].created.timestamp(), - } - ] - paths = set() - starter = path + "/" - out = [] - for p2 in tuple(self.store): - if p2.startswith(starter): - if "/" not in p2[len(starter) :]: - # exact child - out.append( - { - "name": p2, - "size": self.store[p2].size, - "type": "file", - "created": self.store[p2].created.timestamp(), - } - ) - elif len(p2) > len(starter): - # implied child directory - ppath = starter + p2[len(starter) :].split("/", 1)[0] - if ppath not in paths: - out = out or [] - out.append( - { - "name": ppath, - "size": 0, - "type": "directory", - } - ) - paths.add(ppath) - for p2 in self.pseudo_dirs: - if p2.startswith(starter): - if "/" not in p2[len(starter) :]: - # exact child pdir - if p2 not in paths: - out.append({"name": p2, "size": 0, "type": "directory"}) - paths.add(p2) - else: - # directory implied by deeper pdir - ppath = starter + p2[len(starter) :].split("/", 1)[0] - if ppath not in paths: - out.append({"name": ppath, "size": 0, "type": "directory"}) - paths.add(ppath) - if not out: - if path in self.pseudo_dirs: - # empty dir - return [] - raise FileNotFoundError(path) - if detail: - return out - return sorted([f["name"] for f in out]) - - def mkdir(self, path, create_parents=True, **kwargs): - path = self._strip_protocol(path) - if path in self.store or path in self.pseudo_dirs: - raise FileExistsError(path) - if self._parent(path).strip("/") and self.isfile(self._parent(path)): - raise NotADirectoryError(self._parent(path)) - if create_parents and self._parent(path).strip("/"): - try: - self.mkdir(self._parent(path), create_parents, **kwargs) - except FileExistsError: - pass - if path and path not in self.pseudo_dirs: - self.pseudo_dirs.append(path) - - def makedirs(self, path, exist_ok=False): - try: - self.mkdir(path, create_parents=True) - except FileExistsError: - if not exist_ok: - raise - - def pipe_file(self, path, value, **kwargs): - """Set the bytes of given file - - Avoids copies of the data if possible - """ - self.open(path, "wb", data=value) - - def rmdir(self, path): - path = self._strip_protocol(path) - if path == "": - # silently avoid deleting FS root - return - if path in self.pseudo_dirs: - if not self.ls(path): - self.pseudo_dirs.remove(path) - else: - raise OSError(ENOTEMPTY, "Directory not empty", path) - else: - raise FileNotFoundError(path) - - def info(self, path, **kwargs): - path = self._strip_protocol(path) - if path in self.pseudo_dirs or any( - p.startswith(path + "/") for p in list(self.store) + self.pseudo_dirs - ): - return { - "name": path, - "size": 0, - "type": "directory", - } - elif path in self.store: - filelike = self.store[path] - return { - "name": path, - "size": filelike.size, - "type": "file", - "created": getattr(filelike, "created", None), - } - else: - raise FileNotFoundError(path) - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - cache_options=None, - **kwargs, - ): - path = self._strip_protocol(path) - if path in self.pseudo_dirs: - raise IsADirectoryError(path) - parent = path - while len(parent) > 1: - parent = self._parent(parent) - if self.isfile(parent): - raise FileExistsError(parent) - if mode in ["rb", "ab", "rb+"]: - if path in self.store: - f = self.store[path] - if mode == "ab": - # position at the end of file - f.seek(0, 2) - else: - # position at the beginning of file - f.seek(0) - return f - else: - raise FileNotFoundError(path) - elif mode == "wb": - m = MemoryFile(self, path, kwargs.get("data")) - if not self._intrans: - m.commit() - return m - else: - name = self.__class__.__name__ - raise ValueError(f"unsupported file mode for {name}: {mode!r}") - - def cp_file(self, path1, path2, **kwargs): - path1 = self._strip_protocol(path1) - path2 = self._strip_protocol(path2) - if self.isfile(path1): - self.store[path2] = MemoryFile( - self, path2, self.store[path1].getvalue() - ) # implicit copy - elif self.isdir(path1): - if path2 not in self.pseudo_dirs: - self.pseudo_dirs.append(path2) - else: - raise FileNotFoundError(path1) - - def cat_file(self, path, start=None, end=None, **kwargs): - path = self._strip_protocol(path) - try: - return bytes(self.store[path].getbuffer()[start:end]) - except KeyError: - raise FileNotFoundError(path) - - def _rm(self, path): - path = self._strip_protocol(path) - try: - del self.store[path] - except KeyError as e: - raise FileNotFoundError(path) from e - - def modified(self, path): - path = self._strip_protocol(path) - try: - return self.store[path].modified - except KeyError: - raise FileNotFoundError(path) - - def created(self, path): - path = self._strip_protocol(path) - try: - return self.store[path].created - except KeyError: - raise FileNotFoundError(path) - - def rm(self, path, recursive=False, maxdepth=None): - if isinstance(path, str): - path = self._strip_protocol(path) - else: - path = [self._strip_protocol(p) for p in path] - paths = self.expand_path(path, recursive=recursive, maxdepth=maxdepth) - for p in reversed(paths): - # If the expanded path doesn't exist, it is only because the expanded - # path was a directory that does not exist in self.pseudo_dirs. This - # is possible if you directly create files without making the - # directories first. - if not self.exists(p): - continue - if self.isfile(p): - self.rm_file(p) - else: - self.rmdir(p) - - -class MemoryFile(BytesIO): - """A BytesIO which can't close and works as a context manager - - Can initialise with data. Each path should only be active once at any moment. - - No need to provide fs, path if auto-committing (default) - """ - - def __init__(self, fs=None, path=None, data=None): - logger.debug("open file %s", path) - self.fs = fs - self.path = path - self.created = datetime.now(tz=timezone.utc) - self.modified = datetime.now(tz=timezone.utc) - if data: - super().__init__(data) - self.seek(0) - - @property - def size(self): - return self.getbuffer().nbytes - - def __enter__(self): - return self - - def close(self): - pass - - def discard(self): - pass - - def commit(self): - self.fs.store[self.path] = self - self.modified = datetime.now(tz=timezone.utc) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/reference.py b/venv/lib/python3.8/site-packages/fsspec/implementations/reference.py deleted file mode 100644 index 398ec69ab6c75a3296b32c8bd7c300f62c198d05..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/reference.py +++ /dev/null @@ -1,1080 +0,0 @@ -import base64 -import collections -import io -import itertools -import logging -import math -import os -from functools import lru_cache -from typing import TYPE_CHECKING - -import fsspec.core - -try: - import ujson as json -except ImportError: - if not TYPE_CHECKING: - import json - -from ..asyn import AsyncFileSystem -from ..callbacks import _DEFAULT_CALLBACK -from ..core import filesystem, open, split_protocol -from ..utils import isfilelike, merge_offset_ranges, other_paths - -logger = logging.getLogger("fsspec.reference") - - -class ReferenceNotReachable(RuntimeError): - def __init__(self, reference, target, *args): - super().__init__(*args) - self.reference = reference - self.target = target - - def __str__(self): - return f'Reference "{self.reference}" failed to fetch target {self.target}' - - -def _first(d): - return list(d.values())[0] - - -def _prot_in_references(path, references): - ref = references.get(path) - if isinstance(ref, (list, tuple)): - return split_protocol(ref[0])[0] if ref[0] else ref[0] - - -def _protocol_groups(paths, references): - if isinstance(paths, str): - return {_prot_in_references(paths, references): [paths]} - out = {} - for path in paths: - protocol = _prot_in_references(path, references) - out.setdefault(protocol, []).append(path) - return out - - -class RefsValuesView(collections.abc.ValuesView): - def __iter__(self): - for val in self._mapping.zmetadata.values(): - yield json.dumps(val).encode() - yield from self._mapping._items.values() - for field in self._mapping.listdir(): - chunk_sizes = self._mapping._get_chunk_sizes(field) - if len(chunk_sizes) == 0: - yield self._mapping[field + "/0"] - continue - yield from self._mapping._generate_all_records(field) - - -class RefsItemsView(collections.abc.ItemsView): - def __iter__(self): - return zip(self._mapping.keys(), self._mapping.values()) - - -def ravel_multi_index(idx, sizes): - val = 0 - mult = 1 - for i, s in zip(idx[::-1], sizes[::-1]): - val += i * mult - mult *= s - return val - - -class LazyReferenceMapper(collections.abc.MutableMapping): - """Interface to read parquet store as if it were a standard kerchunk - references dict.""" - - # import is class level to prevent numpy dep requirement for fsspec - @property - def np(self): - import numpy as np - - return np - - @property - def pd(self): - import pandas as pd - - return pd - - def __init__( - self, root, fs=None, out_root=None, cache_size=128, categorical_threshold=10 - ): - """ - Parameters - ---------- - root : str - Root of parquet store - fs : fsspec.AbstractFileSystem - fsspec filesystem object, default is local filesystem. - cache_size : int - Maximum size of LRU cache, where cache_size*record_size denotes - the total number of references that can be loaded in memory at once. - """ - self.root = root - self.chunk_sizes = {} - self._items = {} - self.dirs = None - self.fs = fsspec.filesystem("file") if fs is None else fs - with self.fs.open("/".join([self.root, ".zmetadata"]), "rb") as f: - self._items[".zmetadata"] = f.read() - met = json.loads(self._items[".zmetadata"]) - self.record_size = met["record_size"] - self.zmetadata = met["metadata"] - self.url = self.root + "/{field}/refs.{record}.parq" - self.out_root = out_root or self.root - self.cat_thresh = categorical_threshold - - # Define function to open and decompress refs - @lru_cache(maxsize=cache_size) - def open_refs(field, record): - """cached parquet file loader""" - path = self.url.format(field=field, record=record) - with self.fs.open(path) as f: - # TODO: since all we do is iterate, is arrow without pandas - # better here? - df = self.pd.read_parquet(f, engine="fastparquet") - refs = {c: df[c].values for c in df.columns} - return refs - - self.open_refs = open_refs - - @staticmethod - def create(record_size, root, fs, **kwargs): - met = {"metadata": {}, "record_size": record_size} - fs.pipe("/".join([root, ".zmetadata"]), json.dumps(met).encode()) - return LazyReferenceMapper(root, fs, **kwargs) - - def listdir(self, basename=True): - """List top-level directories""" - if self.dirs is None: - dirs = [p.split("/", 1)[0] for p in self.zmetadata] - self.dirs = {p for p in dirs if p and not p.startswith(".")} - listing = self.dirs - if basename: - listing = [os.path.basename(path) for path in listing] - return listing - - def ls(self, path="", detail=True): - """Shortcut file listings""" - if not path: - dirnames = self.listdir() - others = set( - [".zmetadata"] - + [name for name in self.zmetadata if "/" not in name] - + [name for name in self._items if "/" not in name] - ) - if detail is False: - others.update(dirnames) - return sorted(others) - dirinfo = [ - {"name": name, "type": "directory", "size": 0} for name in dirnames - ] - fileinfo = [ - { - "name": name, - "type": "file", - "size": len( - json.dumps(self.zmetadata[name]) - if name in self.zmetadata - else self._items[name] - ), - } - for name in others - ] - return sorted(dirinfo + fileinfo, key=lambda s: s["name"]) - parts = path.split("/", 1) - if len(parts) > 1: - raise FileNotFoundError("Cannot list within directories right now") - field = parts[0] - others = set( - [name for name in self.zmetadata if name.startswith(f"{path}/")] - + [name for name in self._items if name.startswith(f"{path}/")] - ) - fileinfo = [ - { - "name": name, - "type": "file", - "size": len( - json.dumps(self.zmetadata[name]) - if name in self.zmetadata - else self._items[name] - ), - } - for name in others - ] - keys = self._keys_in_field(field) - - if detail is False: - return list(others) + list(keys) - recs = self._generate_all_records(field) - recinfo = [ - {"name": name, "type": "file", "size": rec[-1]} - for name, rec in zip(keys, recs) - if rec[0] # filters out path==None, deleted/missing - ] - return fileinfo + recinfo - - def _load_one_key(self, key): - """Get the reference for one key - - Returns bytes, one-element list or three-element list. - """ - if key in self._items: - return self._items[key] - elif key in self.zmetadata: - return json.dumps(self.zmetadata[key]).encode() - elif "/" not in key or self._is_meta(key): - raise KeyError(key) - field, sub_key = key.split("/") - record, _, _ = self._key_to_record(key) - maybe = self._items.get((field, key), {}).get(sub_key, False) - if maybe is None: - # explicitly deleted - raise KeyError - elif maybe: - return maybe - - # Chunk keys can be loaded from row group and cached in LRU cache - try: - record, ri, chunk_size = self._key_to_record(key) - if chunk_size == 0: - return b"" - refs = self.open_refs(field, record) - except (ValueError, TypeError, FileNotFoundError): - raise KeyError(key) - columns = ["path", "offset", "size", "raw"] - selection = [refs[c][ri] if c in refs else None for c in columns] - raw = selection[-1] - if raw is not None: - return raw - if selection[0] is None: - raise KeyError("This reference has been deleted") - if selection[1:3] == [0, 0]: - # URL only - return selection[:1] - # URL, offset, size - return selection[:3] - - @lru_cache(4096) - def _key_to_record(self, key): - """Details needed to construct a reference for one key""" - field, chunk = key.split("/") - chunk_sizes = self._get_chunk_sizes(field) - if len(chunk_sizes) == 0: - return 0, 0, 0 - chunk_idx = [int(c) for c in chunk.split(".")] - chunk_number = ravel_multi_index(chunk_idx, chunk_sizes) - record = chunk_number // self.record_size - ri = chunk_number % self.record_size - return record, ri, len(chunk_sizes) - - def _get_chunk_sizes(self, field): - """The number of chunks along each axis for a given field""" - if field not in self.chunk_sizes: - zarray = self.zmetadata[f"{field}/.zarray"] - size_ratio = [ - math.ceil(s / c) for s, c in zip(zarray["shape"], zarray["chunks"]) - ] - self.chunk_sizes[field] = size_ratio - return self.chunk_sizes[field] - - def _generate_record(self, field, record): - """The references for a given parquet file of a given field""" - refs = self.open_refs(field, record) - it = iter(zip(refs.values())) - if len(refs) == 3: - # All urls - return (list(t) for t in it) - elif len(refs) == 1: - # All raws - return refs["raw"] - else: - # Mix of urls and raws - return (list(t[:3]) if not t[3] else t[3] for t in it) - - def _generate_all_records(self, field): - """Load all the references within a field by iterating over the parquet files""" - nrec = 1 - for ch in self._get_chunk_sizes(field): - nrec *= ch - nrec = math.ceil(nrec / self.record_size) - for record in range(nrec): - yield from self._generate_record(field, record) - - def values(self): - return RefsValuesView(self) - - def items(self): - return RefsItemsView(self) - - def __hash__(self): - return id(self) - - @lru_cache(20) - def __getitem__(self, key): - return self._load_one_key(key) - - def __setitem__(self, key, value): - if "/" in key and not self._is_meta(key): - field, chunk = key.split("/") - record, i, _ = self._key_to_record(key) - subdict = self._items.setdefault((field, record), {}) - subdict[i] = value - if len(subdict) == self.record_size: - self.write(field, record) - else: - # metadata or top-level - self._items[key] = value - self.zmetadata[key] = json.loads( - value.decode() if isinstance(value, bytes) else value - ) - - @staticmethod - def _is_meta(key): - return key.startswith(".z") or "/.z" in key - - def __delitem__(self, key): - if key in self._items: - del self._items[key] - elif key in self.zmetadata: - del self.zmetadata[key] - else: - if "/" in key and not self._is_meta(key): - field, chunk = key.split("/") - record, _, _ = self._key_to_record(key) - subdict = self._items.setdefault((field, record), {}) - subdict[chunk] = None - if len(subdict) == self.record_size: - self.write(field, record) - else: - # metadata or top-level - self._items[key] = None - - def write(self, field, record, base_url=None, storage_options=None): - # extra requirements if writing - import kerchunk.df - import numpy as np - import pandas as pd - - # TODO: if the dict is incomplete, also load records and merge in - partition = self._items[(field, record)] - fn = f"{base_url or self.out_root}/{field}/refs.{record}.parq" - - #### - paths = np.full(self.record_size, np.nan, dtype="O") - offsets = np.zeros(self.record_size, dtype="int64") - sizes = np.zeros(self.record_size, dtype="int64") - raws = np.full(self.record_size, np.nan, dtype="O") - nraw = 0 - npath = 0 - for j, data in partition.items(): - if isinstance(data, list): - npath += 1 - paths[j] = data[0] - if len(data) > 1: - offsets[j] = data[1] - sizes[j] = data[2] - else: - nraw += 1 - raws[j] = kerchunk.df._proc_raw(data) - # TODO: only save needed columns - df = pd.DataFrame( - { - "path": paths, - "offset": offsets, - "size": sizes, - "raw": raws, - }, - copy=False, - ) - if df.path.count() / (df.path.nunique() or 1) > self.cat_thresh: - df["path"] = df["path"].astype("category") - object_encoding = {"raw": "bytes", "path": "utf8"} - has_nulls = ["path", "raw"] - - self.fs.mkdirs(f"{base_url or self.out_root}/{field}", exist_ok=True) - df.to_parquet( - fn, - engine="fastparquet", - storage_options=storage_options - or getattr(self.fs, "storage_options", None), - compression="zstd", - index=False, - stats=False, - object_encoding=object_encoding, - has_nulls=has_nulls, - # **kwargs, - ) - partition.clear() - self._items.pop((field, record)) - - def flush(self, base_url=None, storage_options=None): - """Output any modified or deleted keys - - Parameters - ---------- - base_url: str - Location of the output - """ - # write what we have so far and clear sub chunks - for thing in list(self._items): - if isinstance(thing, tuple): - field, record = thing - self.write( - field, - record, - base_url=base_url, - storage_options=storage_options, - ) - - # gather .zmetadata from self._items and write that too - for k in list(self._items): - if k != ".zmetadata" and ".z" in k: - self.zmetadata[k] = json.loads(self._items.pop(k)) - met = {"metadata": self.zmetadata, "record_size": self.record_size} - self._items[".zmetadata"] = json.dumps(met).encode() - self.fs.pipe( - "/".join([base_url or self.out_root, ".zmetadata"]), - self._items[".zmetadata"], - ) - - # TODO: only clear those that we wrote to? - self.open_refs.cache_clear() - - def __len__(self): - # Caveat: This counts expected references, not actual - count = 0 - for field in self.listdir(): - if field.startswith("."): - count += 1 - else: - chunk_sizes = self._get_chunk_sizes(field) - nchunks = self.np.product(chunk_sizes) - count += nchunks - count += len(self.zmetadata) # all metadata keys - count += len(self._items) # the metadata file itself - return count - - def __iter__(self): - # Caveat: Note that this generates all expected keys, but does not - # account for reference keys that are missing. - metas = set(self.zmetadata) - metas.update(self._items) - for bit in metas: - if isinstance(bit, str): - yield bit - for field in self.listdir(): - yield from self._keys_in_field(field) - - def __contains__(self, item): - try: - self._load_one_key(item) - return True - except KeyError: - return False - - def _keys_in_field(self, field): - """List key names in given field - - Produces strings like "field/x.y" appropriate from the chunking of the array - """ - chunk_sizes = self._get_chunk_sizes(field) - if len(chunk_sizes) == 0: - yield field + "/0" - return - inds = itertools.product(*(range(i) for i in chunk_sizes)) - for ind in inds: - yield field + "/" + ".".join([str(c) for c in ind]) - - -class ReferenceFileSystem(AsyncFileSystem): - """View byte ranges of some other file as a file system - Initial version: single file system target, which must support - async, and must allow start and end args in _cat_file. Later versions - may allow multiple arbitrary URLs for the targets. - This FileSystem is read-only. It is designed to be used with async - targets (for now). This FileSystem only allows whole-file access, no - ``open``. We do not get original file details from the target FS. - Configuration is by passing a dict of references at init, or a URL to - a JSON file containing the same; this dict - can also contain concrete data for some set of paths. - Reference dict format: - {path0: bytes_data, path1: (target_url, offset, size)} - https://github.com/fsspec/kerchunk/blob/main/README.md - """ - - protocol = "reference" - - def __init__( - self, - fo, - target=None, - ref_storage_args=None, - target_protocol=None, - target_options=None, - remote_protocol=None, - remote_options=None, - fs=None, - template_overrides=None, - simple_templates=True, - max_gap=64_000, - max_block=256_000_000, - cache_size=128, - **kwargs, - ): - """ - Parameters - ---------- - fo : dict or str - The set of references to use for this instance, with a structure as above. - If str referencing a JSON file, will use fsspec.open, in conjunction - with target_options and target_protocol to open and parse JSON at this - location. If a directory, then assume references are a set of parquet - files to be loaded lazily. - target : str - For any references having target_url as None, this is the default file - target to use - ref_storage_args : dict - If references is a str, use these kwargs for loading the JSON file. - Deprecated: use target_options instead. - target_protocol : str - Used for loading the reference file, if it is a path. If None, protocol - will be derived from the given path - target_options : dict - Extra FS options for loading the reference file ``fo``, if given as a path - remote_protocol : str - The protocol of the filesystem on which the references will be evaluated - (unless fs is provided). If not given, will be derived from the first - URL that has a protocol in the templates or in the references, in that - order. - remote_options : dict - kwargs to go with remote_protocol - fs : AbstractFileSystem | dict(str, (AbstractFileSystem | dict)) - Directly provide a file system(s): - - a single filesystem instance - - a dict of protocol:filesystem, where each value is either a filesystem - instance, or a dict of kwargs that can be used to create in - instance for the given protocol - - If this is given, remote_options and remote_protocol are ignored. - template_overrides : dict - Swap out any templates in the references file with these - useful for - testing. - simple_templates: bool - Whether templates can be processed with simple replace (True) or if - jinja is needed (False, much slower). All reference sets produced by - ``kerchunk`` are simple in this sense, but the spec allows for complex. - max_gap, max_block: int - For merging multiple concurrent requests to the same remote file. - Neighboring byte ranges will only be merged when their - inter-range gap is <= ``max_gap``. Default is 64KB. Set to 0 - to only merge when it requires no extra bytes. Pass a negative - number to disable merging, appropriate for local target files. - Neighboring byte ranges will only be merged when the size of - the aggregated range is <= ``max_block``. Default is 256MB. - cache_size : int - Maximum size of LRU cache, where cache_size*record_size denotes - the total number of references that can be loaded in memory at once. - Only used for lazily loaded references. - kwargs : passed to parent class - """ - super().__init__(**kwargs) - self.target = target - self.template_overrides = template_overrides - self.simple_templates = simple_templates - self.templates = {} - self.fss = {} - self._dircache = {} - self.max_gap = max_gap - self.max_block = max_block - if isinstance(fo, str): - dic = dict( - **(ref_storage_args or target_options or {}), protocol=target_protocol - ) - ref_fs, fo2 = fsspec.core.url_to_fs(fo, **dic) - if ref_fs.isfile(fo): - # text JSON - with fsspec.open(fo, "rb", **dic) as f: - logger.info("Read reference from URL %s", fo) - text = json.load(f) - self._process_references(text, template_overrides) - else: - # Lazy parquet refs - logger.info("Open lazy reference dict from URL %s", fo) - self.references = LazyReferenceMapper( - fo2, - fs=ref_fs, - cache_size=cache_size, - ) - else: - # dictionaries - self._process_references(fo, template_overrides) - if isinstance(fs, dict): - self.fss = { - k: ( - fsspec.filesystem(k.split(":", 1)[0], **opts) - if isinstance(opts, dict) - else opts - ) - for k, opts in fs.items() - } - if None not in self.fss: - self.fss[None] = filesystem("file") - return - if fs is not None: - # single remote FS - remote_protocol = ( - fs.protocol[0] if isinstance(fs.protocol, tuple) else fs.protocol - ) - self.fss[remote_protocol] = fs - - if remote_protocol is None: - # get single protocol from any templates - for ref in self.templates.values(): - if callable(ref): - ref = ref() - protocol, _ = fsspec.core.split_protocol(ref) - if protocol and protocol not in self.fss: - fs = filesystem(protocol, **(remote_options or {})) - self.fss[protocol] = fs - if remote_protocol is None: - # get single protocol from references - for ref in self.references.values(): - if callable(ref): - ref = ref() - if isinstance(ref, list) and ref[0]: - protocol, _ = fsspec.core.split_protocol(ref[0]) - if protocol not in self.fss: - fs = filesystem(protocol, **(remote_options or {})) - self.fss[protocol] = fs - # only use first remote URL - break - - if remote_protocol and remote_protocol not in self.fss: - fs = filesystem(remote_protocol, **(remote_options or {})) - self.fss[remote_protocol] = fs - - self.fss[None] = fs or filesystem("file") # default one - - def _cat_common(self, path, start=None, end=None): - path = self._strip_protocol(path) - logger.debug(f"cat: {path}") - try: - part = self.references[path] - except KeyError: - raise FileNotFoundError(path) - if isinstance(part, str): - part = part.encode() - if isinstance(part, bytes): - logger.debug(f"Reference: {path}, type bytes") - if part.startswith(b"base64:"): - part = base64.b64decode(part[7:]) - return part, None, None - - if len(part) == 1: - logger.debug(f"Reference: {path}, whole file => {part}") - url = part[0] - start1, end1 = start, end - else: - url, start0, size = part - logger.debug(f"Reference: {path} => {url}, offset {start0}, size {size}") - end0 = start0 + size - - if start is not None: - if start >= 0: - start1 = start0 + start - else: - start1 = end0 + start - else: - start1 = start0 - if end is not None: - if end >= 0: - end1 = start0 + end - else: - end1 = end0 + end - else: - end1 = end0 - if url is None: - url = self.target - return url, start1, end1 - - async def _cat_file(self, path, start=None, end=None, **kwargs): - part_or_url, start0, end0 = self._cat_common(path, start=start, end=end) - if isinstance(part_or_url, bytes): - return part_or_url[start:end] - protocol, _ = split_protocol(part_or_url) - try: - await self.fss[protocol]._cat_file(part_or_url, start=start, end=end) - except Exception as e: - raise ReferenceNotReachable(path, part_or_url) from e - - def cat_file(self, path, start=None, end=None, **kwargs): - part_or_url, start0, end0 = self._cat_common(path, start=start, end=end) - if isinstance(part_or_url, bytes): - return part_or_url[start:end] - protocol, _ = split_protocol(part_or_url) - try: - return self.fss[protocol].cat_file(part_or_url, start=start0, end=end0) - except Exception as e: - raise ReferenceNotReachable(path, part_or_url) from e - - def pipe_file(self, path, value, **_): - """Temporarily add binary data or reference as a file""" - self.references[path] = value - - async def _get_file(self, rpath, lpath, **kwargs): - if self.isdir(rpath): - return os.makedirs(lpath, exist_ok=True) - data = await self._cat_file(rpath) - with open(lpath, "wb") as f: - f.write(data) - - def get_file(self, rpath, lpath, callback=_DEFAULT_CALLBACK, **kwargs): - if self.isdir(rpath): - return os.makedirs(lpath, exist_ok=True) - data = self.cat_file(rpath, **kwargs) - callback.set_size(len(data)) - if isfilelike(lpath): - lpath.write(data) - else: - with open(lpath, "wb") as f: - f.write(data) - callback.absolute_update(len(data)) - - def get(self, rpath, lpath, recursive=False, **kwargs): - if recursive: - # trigger directory build - self.ls("") - rpath = self.expand_path(rpath, recursive=recursive) - fs = fsspec.filesystem("file", auto_mkdir=True) - targets = other_paths(rpath, lpath) - if recursive: - data = self.cat([r for r in rpath if not self.isdir(r)]) - else: - data = self.cat(rpath) - for remote, local in zip(rpath, targets): - if remote in data: - fs.pipe_file(local, data[remote]) - - def cat(self, path, recursive=False, on_error="raise", **kwargs): - if isinstance(path, str) and recursive: - raise NotImplementedError - if isinstance(path, list) and (recursive or any("*" in p for p in path)): - raise NotImplementedError - proto_dict = _protocol_groups(path, self.references) - out = {} - for proto, paths in proto_dict.items(): - fs = self.fss[proto] - urls, starts, ends = [], [], [] - for p in paths: - # find references or label not-found. Early exit if any not - # found and on_error is "raise" - try: - u, s, e = self._cat_common(p) - urls.append(u) - starts.append(s) - ends.append(e) - except FileNotFoundError as err: - if on_error == "raise": - raise - if on_error != "omit": - out[p] = err - - # process references into form for merging - urls2 = [] - starts2 = [] - ends2 = [] - paths2 = [] - whole_files = set() - for u, s, e, p in zip(urls, starts, ends, paths): - if isinstance(u, bytes): - # data - out[p] = u - elif s is None: - # whole file - limits are None, None, but no further - # entries take for this file - whole_files.add(u) - urls2.append(u) - starts2.append(s) - ends2.append(e) - paths2.append(p) - for u, s, e, p in zip(urls, starts, ends, paths): - # second run to account for files that are to be loaded whole - if s is not None and u not in whole_files: - urls2.append(u) - starts2.append(s) - ends2.append(e) - paths2.append(p) - - # merge and fetch consolidated ranges - new_paths, new_starts, new_ends = merge_offset_ranges( - list(urls2), - list(starts2), - list(ends2), - sort=True, - max_gap=self.max_gap, - max_block=self.max_block, - ) - bytes_out = fs.cat_ranges(new_paths, new_starts, new_ends) - - # unbundle from merged bytes - simple approach - for u, s, e, p in zip(urls, starts, ends, paths): - if p in out: - continue # was bytes, already handled - for np, ns, ne, b in zip(new_paths, new_starts, new_ends, bytes_out): - if np == u and (ns is None or ne is None): - if isinstance(b, Exception): - out[p] = b - else: - out[p] = b[s:e] - elif np == u and s >= ns and e <= ne: - if isinstance(b, Exception): - out[p] = b - else: - out[p] = b[s - ns : (e - ne) or None] - - for k, v in out.copy().items(): - # these were valid references, but fetch failed, so transform exc - if isinstance(v, Exception) and k in self.references: - ex = out[k] - new_ex = ReferenceNotReachable(k, self.references[k]) - new_ex.__cause__ = ex - if on_error == "raise": - raise new_ex - elif on_error != "omit": - out[k] = new_ex - - if len(out) == 1 and isinstance(path, str) and "*" not in path: - return _first(out) - return out - - def _process_references(self, references, template_overrides=None): - vers = references.get("version", None) - if vers is None: - self._process_references0(references) - elif vers == 1: - self._process_references1(references, template_overrides=template_overrides) - else: - raise ValueError(f"Unknown reference spec version: {vers}") - # TODO: we make dircache by iterating over all entries, but for Spec >= 1, - # can replace with programmatic. Is it even needed for mapper interface? - - def _process_references0(self, references): - """Make reference dict for Spec Version 0""" - self.references = references - - def _process_references1(self, references, template_overrides=None): - if not self.simple_templates or self.templates: - import jinja2 - self.references = {} - self._process_templates(references.get("templates", {})) - - @lru_cache(1000) - def _render_jinja(u): - return jinja2.Template(u).render(**self.templates) - - for k, v in references.get("refs", {}).items(): - if isinstance(v, str): - if v.startswith("base64:"): - self.references[k] = base64.b64decode(v[7:]) - self.references[k] = v - elif self.templates: - u = v[0] - if "{{" in u: - if self.simple_templates: - u = ( - u.replace("{{", "{") - .replace("}}", "}") - .format(**self.templates) - ) - else: - u = _render_jinja(u) - self.references[k] = [u] if len(v) == 1 else [u, v[1], v[2]] - else: - self.references[k] = v - self.references.update(self._process_gen(references.get("gen", []))) - - def _process_templates(self, tmp): - self.templates = {} - if self.template_overrides is not None: - tmp.update(self.template_overrides) - for k, v in tmp.items(): - if "{{" in v: - import jinja2 - - self.templates[k] = lambda temp=v, **kwargs: jinja2.Template( - temp - ).render(**kwargs) - else: - self.templates[k] = v - - def _process_gen(self, gens): - out = {} - for gen in gens: - dimension = { - k: v - if isinstance(v, list) - else range(v.get("start", 0), v["stop"], v.get("step", 1)) - for k, v in gen["dimensions"].items() - } - products = ( - dict(zip(dimension.keys(), values)) - for values in itertools.product(*dimension.values()) - ) - for pr in products: - import jinja2 - - key = jinja2.Template(gen["key"]).render(**pr, **self.templates) - url = jinja2.Template(gen["url"]).render(**pr, **self.templates) - if ("offset" in gen) and ("length" in gen): - offset = int( - jinja2.Template(gen["offset"]).render(**pr, **self.templates) - ) - length = int( - jinja2.Template(gen["length"]).render(**pr, **self.templates) - ) - out[key] = [url, offset, length] - elif ("offset" in gen) ^ ("length" in gen): - raise ValueError( - "Both 'offset' and 'length' are required for a " - "reference generator entry if either is provided." - ) - else: - out[key] = [url] - return out - - def _dircache_from_items(self): - self.dircache = {"": []} - it = self.references.items() - for path, part in it: - if isinstance(part, (bytes, str)): - size = len(part) - elif len(part) == 1: - size = None - else: - _, start, size = part - par = path.rsplit("/", 1)[0] if "/" in path else "" - par0 = par - while par0 and par0 not in self.dircache: - # build parent directories - self.dircache[par0] = [] - self.dircache.setdefault( - par0.rsplit("/", 1)[0] if "/" in par0 else "", [] - ).append({"name": par0, "type": "directory", "size": 0}) - par0 = self._parent(par0) - - self.dircache[par].append({"name": path, "type": "file", "size": size}) - - def _open(self, path, mode="rb", block_size=None, cache_options=None, **kwargs): - data = self.cat_file(path) # load whole chunk into memory - return io.BytesIO(data) - - def ls(self, path, detail=True, **kwargs): - path = self._strip_protocol(path) - if isinstance(self.references, LazyReferenceMapper): - try: - return self.references.ls(path, detail) - except KeyError: - pass - raise FileNotFoundError(f"'{path}' is not a known key") - if not self.dircache: - self._dircache_from_items() - out = self._ls_from_cache(path) - if out is None: - raise FileNotFoundError(path) - if detail: - return out - return [o["name"] for o in out] - - def exists(self, path, **kwargs): # overwrite auto-sync version - return self.isdir(path) or self.isfile(path) - - def isdir(self, path): # overwrite auto-sync version - if self.dircache: - return path in self.dircache - elif isinstance(self.references, LazyReferenceMapper): - return path in self.references.listdir("") - else: - # this may be faster than building dircache for single calls, but - # by looping will be slow for many calls; could cache it? - return any(_.startswith(f"{path}/") for _ in self.references) - - def isfile(self, path): # overwrite auto-sync version - return path in self.references - - async def _ls(self, path, detail=True, **kwargs): # calls fast sync code - return self.ls(path, detail, **kwargs) - - def find(self, path, maxdepth=None, withdirs=False, detail=False, **kwargs): - if withdirs: - return super().find( - path, maxdepth=maxdepth, withdirs=withdirs, detail=detail, **kwargs - ) - if path: - path = self._strip_protocol(path) - r = sorted(k for k in self.references if k.startswith(path)) - else: - r = sorted(self.references) - if detail: - if not self.dircache: - self._dircache_from_items() - return {k: self._ls_from_cache(k)[0] for k in r} - else: - return r - - def info(self, path, **kwargs): - out = self.references.get(path) - if out is not None: - if isinstance(out, (str, bytes)): - # decode base64 here - return {"name": path, "type": "file", "size": len(out)} - elif len(out) > 1: - return {"name": path, "type": "file", "size": out[2]} - else: - out0 = [{"name": path, "type": "file", "size": None}] - else: - out = self.ls(path, True) - out0 = [o for o in out if o["name"] == path] - if not out0: - return {"name": path, "type": "directory", "size": 0} - if out0[0]["size"] is None: - # if this is a whole remote file, update size using remote FS - prot, _ = split_protocol(self.references[path][0]) - out0[0]["size"] = self.fss[prot].size(self.references[path][0]) - return out0[0] - - async def _info(self, path, **kwargs): # calls fast sync code - return self.info(path) - - async def _rm_file(self, path, **kwargs): - self.references.pop( - path, None - ) # ignores FileNotFound, just as well for directories - self.dircache.clear() # this is a bit heavy handed - - async def _pipe_file(self, path, data): - # can be str or bytes - self.references[path] = data - self.dircache.clear() # this is a bit heavy handed - - async def _put_file(self, lpath, rpath): - # puts binary - with open(lpath, "rb") as f: - self.references[rpath] = f.read() - self.dircache.clear() # this is a bit heavy handed - - def save_json(self, url, **storage_options): - """Write modified references into new location""" - out = {} - for k, v in self.references.items(): - if isinstance(v, bytes): - try: - out[k] = v.decode("ascii") - except UnicodeDecodeError: - out[k] = (b"base64:" + base64.b64encode(v)).decode() - else: - out[k] = v - with fsspec.open(url, "wb", **storage_options) as f: - f.write(json.dumps({"version": 1, "refs": out}).encode()) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/sftp.py b/venv/lib/python3.8/site-packages/fsspec/implementations/sftp.py deleted file mode 100644 index 1153e7c6a412760cb80ed92db433a6baa826442c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/sftp.py +++ /dev/null @@ -1,179 +0,0 @@ -import datetime -import logging -import os -import types -import uuid -from stat import S_ISDIR, S_ISLNK - -import paramiko - -from .. import AbstractFileSystem -from ..utils import infer_storage_options - -logger = logging.getLogger("fsspec.sftp") - - -class SFTPFileSystem(AbstractFileSystem): - """Files over SFTP/SSH - - Peer-to-peer filesystem over SSH using paramiko. - - Note: if using this with the ``open`` or ``open_files``, with full URLs, - there is no way to tell if a path is relative, so all paths are assumed - to be absolute. - """ - - protocol = "sftp", "ssh" - - def __init__(self, host, **ssh_kwargs): - """ - - Parameters - ---------- - host: str - Hostname or IP as a string - temppath: str - Location on the server to put files, when within a transaction - ssh_kwargs: dict - Parameters passed on to connection. See details in - https://docs.paramiko.org/en/3.3/api/client.html#paramiko.client.SSHClient.connect - May include port, username, password... - """ - if self._cached: - return - super(SFTPFileSystem, self).__init__(**ssh_kwargs) - self.temppath = ssh_kwargs.pop("temppath", "/tmp") # remote temp directory - self.host = host - self.ssh_kwargs = ssh_kwargs - self._connect() - - def _connect(self): - logger.debug("Connecting to SFTP server %s" % self.host) - self.client = paramiko.SSHClient() - self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - self.client.connect(self.host, **self.ssh_kwargs) - self.ftp = self.client.open_sftp() - - @classmethod - def _strip_protocol(cls, path): - return infer_storage_options(path)["path"] - - @staticmethod - def _get_kwargs_from_urls(urlpath): - out = infer_storage_options(urlpath) - out.pop("path", None) - out.pop("protocol", None) - return out - - def mkdir(self, path, create_parents=False, mode=511): - logger.debug("Creating folder %s" % path) - if self.exists(path): - raise FileExistsError("File exists: {}".format(path)) - - if create_parents: - self.makedirs(path) - else: - self.ftp.mkdir(path, mode) - - def makedirs(self, path, exist_ok=False, mode=511): - if self.exists(path) and not exist_ok: - raise FileExistsError("File exists: {}".format(path)) - - parts = path.split("/") - path = "" - - for part in parts: - path += "/" + part - if not self.exists(path): - self.ftp.mkdir(path, mode) - - def rmdir(self, path): - logger.debug("Removing folder %s" % path) - self.ftp.rmdir(path) - - def info(self, path): - stat = self._decode_stat(self.ftp.stat(path)) - stat["name"] = path - return stat - - @staticmethod - def _decode_stat(stat, parent_path=None): - if S_ISDIR(stat.st_mode): - t = "directory" - elif S_ISLNK(stat.st_mode): - t = "link" - else: - t = "file" - out = { - "name": "", - "size": stat.st_size, - "type": t, - "uid": stat.st_uid, - "gid": stat.st_gid, - "time": datetime.datetime.fromtimestamp( - stat.st_atime, tz=datetime.timezone.utc - ), - "mtime": datetime.datetime.fromtimestamp( - stat.st_mtime, tz=datetime.timezone.utc - ), - } - if parent_path: - out["name"] = "/".join([parent_path.rstrip("/"), stat.filename]) - return out - - def ls(self, path, detail=False): - logger.debug("Listing folder %s" % path) - stats = [self._decode_stat(stat, path) for stat in self.ftp.listdir_iter(path)] - if detail: - return stats - else: - paths = [stat["name"] for stat in stats] - return sorted(paths) - - def put(self, lpath, rpath, callback=None, **kwargs): - logger.debug("Put file %s into %s" % (lpath, rpath)) - self.ftp.put(lpath, rpath) - - def get_file(self, rpath, lpath, **kwargs): - if self.isdir(rpath): - os.makedirs(lpath, exist_ok=True) - else: - self.ftp.get(self._strip_protocol(rpath), lpath) - - def _open(self, path, mode="rb", block_size=None, **kwargs): - """ - block_size: int or None - If 0, no buffering, if 1, line buffering, if >1, buffer that many - bytes, if None use default from paramiko. - """ - logger.debug("Opening file %s" % path) - if kwargs.get("autocommit", True) is False: - # writes to temporary file, move on commit - path2 = "/".join([self.temppath, str(uuid.uuid4())]) - f = self.ftp.open(path2, mode, bufsize=block_size if block_size else -1) - f.temppath = path2 - f.targetpath = path - f.fs = self - f.commit = types.MethodType(commit_a_file, f) - f.discard = types.MethodType(discard_a_file, f) - else: - f = self.ftp.open(path, mode, bufsize=block_size if block_size else -1) - return f - - def _rm(self, path): - if self.isdir(path): - self.ftp.rmdir(path) - else: - self.ftp.remove(path) - - def mv(self, old, new): - logger.debug("Renaming %s into %s" % (old, new)) - self.ftp.posix_rename(old, new) - - -def commit_a_file(self): - self.fs.mv(self.temppath, self.targetpath) - - -def discard_a_file(self): - self.fs._rm(self.temppath) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/smb.py b/venv/lib/python3.8/site-packages/fsspec/implementations/smb.py deleted file mode 100644 index a3816773c229d53be509dfc494005e3febdfccc1..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/smb.py +++ /dev/null @@ -1,325 +0,0 @@ -# -*- coding: utf-8 -*- -""" -This module contains SMBFileSystem class responsible for handling access to -Windows Samba network shares by using package smbprotocol -""" - -import datetime -import uuid -from stat import S_ISDIR, S_ISLNK - -import smbclient - -from .. import AbstractFileSystem -from ..utils import infer_storage_options - -# ! pylint: disable=bad-continuation - - -class SMBFileSystem(AbstractFileSystem): - """Allow reading and writing to Windows and Samba network shares. - - When using `fsspec.open()` for getting a file-like object the URI - should be specified as this format: - ``smb://workgroup;user:password@server:port/share/folder/file.csv``. - - Example:: - - >>> import fsspec - >>> with fsspec.open( - ... 'smb://myuser:mypassword@myserver.com/' 'share/folder/file.csv' - ... ) as smbfile: - ... df = pd.read_csv(smbfile, sep='|', header=None) - - Note that you need to pass in a valid hostname or IP address for the host - component of the URL. Do not use the Windows/NetBIOS machine name for the - host component. - - The first component of the path in the URL points to the name of the shared - folder. Subsequent path components will point to the directory/folder/file. - - The URL components ``workgroup`` , ``user``, ``password`` and ``port`` may be - optional. - - .. note:: - - For working this source require `smbprotocol`_ to be installed, e.g.:: - - $ pip install smbprotocol - # or - # pip install smbprotocol[kerberos] - - .. _smbprotocol: https://github.com/jborean93/smbprotocol#requirements - - Note: if using this with the ``open`` or ``open_files``, with full URLs, - there is no way to tell if a path is relative, so all paths are assumed - to be absolute. - """ - - protocol = "smb" - - # pylint: disable=too-many-arguments - def __init__( - self, - host, - port=None, - username=None, - password=None, - timeout=60, - encrypt=None, - share_access=None, - **kwargs, - ): - """ - You can use _get_kwargs_from_urls to get some kwargs from - a reasonable SMB url. - - Authentication will be anonymous or integrated if username/password are not - given. - - Parameters - ---------- - host: str - The remote server name/ip to connect to - port: int or None - Port to connect with. Usually 445, sometimes 139. - username: str or None - Username to connect with. Required if Kerberos auth is not being used. - password: str or None - User's password on the server, if using username - timeout: int - Connection timeout in seconds - encrypt: bool - Whether to force encryption or not, once this has been set to True - the session cannot be changed back to False. - share_access: str or None - Specifies the default access applied to file open operations - performed with this file system object. - This affects whether other processes can concurrently open a handle - to the same file. - - - None (the default): exclusively locks the file until closed. - - 'r': Allow other handles to be opened with read access. - - 'w': Allow other handles to be opened with write access. - - 'd': Allow other handles to be opened with delete access. - """ - super(SMBFileSystem, self).__init__(**kwargs) - self.host = host - self.port = port - self.username = username - self.password = password - self.timeout = timeout - self.encrypt = encrypt - self.temppath = kwargs.pop("temppath", "") - self.share_access = share_access - self._connect() - - @property - def _port(self): - return 445 if self.port is None else self.port - - def _connect(self): - smbclient.register_session( - self.host, - username=self.username, - password=self.password, - port=self._port, - encrypt=self.encrypt, - connection_timeout=self.timeout, - ) - - @classmethod - def _strip_protocol(cls, path): - return infer_storage_options(path)["path"] - - @staticmethod - def _get_kwargs_from_urls(path): - # smb://workgroup;user:password@host:port/share/folder/file.csv - out = infer_storage_options(path) - out.pop("path", None) - out.pop("protocol", None) - return out - - def mkdir(self, path, create_parents=True, **kwargs): - wpath = _as_unc_path(self.host, path) - if create_parents: - smbclient.makedirs(wpath, exist_ok=False, port=self._port, **kwargs) - else: - smbclient.mkdir(wpath, port=self._port, **kwargs) - - def makedirs(self, path, exist_ok=False): - if _share_has_path(path): - wpath = _as_unc_path(self.host, path) - smbclient.makedirs(wpath, exist_ok=exist_ok, port=self._port) - - def rmdir(self, path): - if _share_has_path(path): - wpath = _as_unc_path(self.host, path) - smbclient.rmdir(wpath, port=self._port) - - def info(self, path, **kwargs): - wpath = _as_unc_path(self.host, path) - stats = smbclient.stat(wpath, port=self._port, **kwargs) - if S_ISDIR(stats.st_mode): - stype = "directory" - elif S_ISLNK(stats.st_mode): - stype = "link" - else: - stype = "file" - res = { - "name": path + "/" if stype == "directory" else path, - "size": stats.st_size, - "type": stype, - "uid": stats.st_uid, - "gid": stats.st_gid, - "time": stats.st_atime, - "mtime": stats.st_mtime, - } - return res - - def created(self, path): - """Return the created timestamp of a file as a datetime.datetime""" - wpath = _as_unc_path(self.host, path) - stats = smbclient.stat(wpath, port=self._port) - return datetime.datetime.fromtimestamp(stats.st_ctime, tz=datetime.timezone.utc) - - def modified(self, path): - """Return the modified timestamp of a file as a datetime.datetime""" - wpath = _as_unc_path(self.host, path) - stats = smbclient.stat(wpath, port=self._port) - return datetime.datetime.fromtimestamp(stats.st_mtime, tz=datetime.timezone.utc) - - def ls(self, path, detail=True, **kwargs): - unc = _as_unc_path(self.host, path) - listed = smbclient.listdir(unc, port=self._port, **kwargs) - dirs = ["/".join([path.rstrip("/"), p]) for p in listed] - if detail: - dirs = [self.info(d) for d in dirs] - return dirs - - # pylint: disable=too-many-arguments - def _open( - self, - path, - mode="rb", - block_size=-1, - autocommit=True, - cache_options=None, - **kwargs, - ): - """ - block_size: int or None - If 0, no buffering, 1, line buffering, >1, buffer that many bytes - - Notes - ----- - By specifying 'share_access' in 'kwargs' it is possible to override the - default shared access setting applied in the constructor of this object. - """ - bls = block_size if block_size is not None and block_size >= 0 else -1 - wpath = _as_unc_path(self.host, path) - share_access = kwargs.pop("share_access", self.share_access) - if "w" in mode and autocommit is False: - temp = _as_temp_path(self.host, path, self.temppath) - return SMBFileOpener( - wpath, temp, mode, port=self._port, block_size=bls, **kwargs - ) - return smbclient.open_file( - wpath, - mode, - buffering=bls, - share_access=share_access, - port=self._port, - **kwargs, - ) - - def copy(self, path1, path2, **kwargs): - """Copy within two locations in the same filesystem""" - wpath1 = _as_unc_path(self.host, path1) - wpath2 = _as_unc_path(self.host, path2) - smbclient.copyfile(wpath1, wpath2, port=self._port, **kwargs) - - def _rm(self, path): - if _share_has_path(path): - wpath = _as_unc_path(self.host, path) - stats = smbclient.stat(wpath, port=self._port) - if S_ISDIR(stats.st_mode): - smbclient.rmdir(wpath, port=self._port) - else: - smbclient.remove(wpath, port=self._port) - - def mv(self, path1, path2, **kwargs): - wpath1 = _as_unc_path(self.host, path1) - wpath2 = _as_unc_path(self.host, path2) - smbclient.rename(wpath1, wpath2, port=self._port, **kwargs) - - -def _as_unc_path(host, path): - rpath = path.replace("/", "\\") - unc = "\\\\{}{}".format(host, rpath) - return unc - - -def _as_temp_path(host, path, temppath): - share = path.split("/")[1] - temp_file = "/{}{}/{}".format(share, temppath, uuid.uuid4()) - unc = _as_unc_path(host, temp_file) - return unc - - -def _share_has_path(path): - parts = path.count("/") - if path.endswith("/"): - return parts > 2 - return parts > 1 - - -class SMBFileOpener: - """writes to remote temporary file, move on commit""" - - def __init__(self, path, temp, mode, port=445, block_size=-1, **kwargs): - self.path = path - self.temp = temp - self.mode = mode - self.block_size = block_size - self.kwargs = kwargs - self.smbfile = None - self._incontext = False - self.port = port - self._open() - - def _open(self): - if self.smbfile is None or self.smbfile.closed: - self.smbfile = smbclient.open_file( - self.temp, - self.mode, - port=self.port, - buffering=self.block_size, - **self.kwargs, - ) - - def commit(self): - """Move temp file to definitive on success.""" - # TODO: use transaction support in SMB protocol - smbclient.replace(self.temp, self.path, port=self.port) - - def discard(self): - """Remove the temp file on failure.""" - smbclient.remove(self.temp, port=self.port) - - def __fspath__(self): - return self.path - - def __iter__(self): - return self.smbfile.__iter__() - - def __getattr__(self, item): - return getattr(self.smbfile, item) - - def __enter__(self): - self._incontext = True - return self.smbfile.__enter__() - - def __exit__(self, exc_type, exc_value, traceback): - self._incontext = False - self.smbfile.__exit__(exc_type, exc_value, traceback) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/tar.py b/venv/lib/python3.8/site-packages/fsspec/implementations/tar.py deleted file mode 100644 index 62bb58f84f2aeefe9927823cb7cb236e65f326e2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/tar.py +++ /dev/null @@ -1,123 +0,0 @@ -import logging -import tarfile - -import fsspec -from fsspec.archive import AbstractArchiveFileSystem -from fsspec.compression import compr -from fsspec.utils import infer_compression - -typemap = {b"0": "file", b"5": "directory"} - -logger = logging.getLogger("tar") - - -class TarFileSystem(AbstractArchiveFileSystem): - """Compressed Tar archives as a file-system (read-only) - - Supports the following formats: - tar.gz, tar.bz2, tar.xz - """ - - root_marker = "" - protocol = "tar" - cachable = False - - def __init__( - self, - fo="", - index_store=None, - target_options=None, - target_protocol=None, - compression=None, - **kwargs, - ): - super().__init__(**kwargs) - target_options = target_options or {} - - if isinstance(fo, str): - self.of = fsspec.open(fo, protocol=target_protocol, **target_options) - fo = self.of.open() # keep the reference - - # Try to infer compression. - if compression is None: - name = None - - # Try different ways to get hold of the filename. `fo` might either - # be a `fsspec.LocalFileOpener`, an `io.BufferedReader` or an - # `fsspec.AbstractFileSystem` instance. - try: - # Amended io.BufferedReader or similar. - # This uses a "protocol extension" where original filenames are - # propagated to archive-like filesystems in order to let them - # infer the right compression appropriately. - if hasattr(fo, "original"): - name = fo.original - - # fsspec.LocalFileOpener - elif hasattr(fo, "path"): - name = fo.path - - # io.BufferedReader - elif hasattr(fo, "name"): - name = fo.name - - # fsspec.AbstractFileSystem - elif hasattr(fo, "info"): - name = fo.info()["name"] - - except Exception as ex: - logger.warning( - f"Unable to determine file name, not inferring compression: {ex}" - ) - - if name is not None: - compression = infer_compression(name) - logger.info(f"Inferred compression {compression} from file name {name}") - - if compression is not None: - # TODO: tarfile already implements compression with modes like "'r:gz'", - # but then would seek to offset in the file work? - fo = compr[compression](fo) - - self._fo_ref = fo - self.fo = fo # the whole instance is a context - self.tar = tarfile.TarFile(fileobj=self.fo) - self.dir_cache = None - - self.index_store = index_store - self.index = None - self._index() - - def _index(self): - # TODO: load and set saved index, if exists - out = {} - for ti in self.tar: - info = ti.get_info() - info["type"] = typemap.get(info["type"], "file") - name = ti.get_info()["name"].rstrip("/") - out[name] = (info, ti.offset_data) - - self.index = out - # TODO: save index to self.index_store here, if set - - def _get_dirs(self): - if self.dir_cache is not None: - return - - # This enables ls to get directories as children as well as files - self.dir_cache = { - dirname + "/": {"name": dirname + "/", "size": 0, "type": "directory"} - for dirname in self._all_dirnames(self.tar.getnames()) - } - for member in self.tar.getmembers(): - info = member.get_info() - info["type"] = typemap.get(info["type"], "file") - self.dir_cache[info["name"]] = info - - def _open(self, path, mode="rb", **kwargs): - if mode != "rb": - raise ValueError("Read-only filesystem implementation") - details, offset = self.index[path] - if details["type"] != "file": - raise ValueError("Can only handle regular files") - return self.tar.extractfile(path) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/webhdfs.py b/venv/lib/python3.8/site-packages/fsspec/implementations/webhdfs.py deleted file mode 100644 index cc595934f9a0161be24d3e300260fb73d4fd9784..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/webhdfs.py +++ /dev/null @@ -1,447 +0,0 @@ -# https://hadoop.apache.org/docs/r1.0.4/webhdfs.html - -import logging -import os -import secrets -import shutil -import tempfile -import uuid -from contextlib import suppress -from urllib.parse import quote - -import requests - -from ..spec import AbstractBufferedFile, AbstractFileSystem -from ..utils import infer_storage_options, tokenize - -logger = logging.getLogger("webhdfs") - - -class WebHDFS(AbstractFileSystem): - """ - Interface to HDFS over HTTP using the WebHDFS API. Supports also HttpFS gateways. - - Three auth mechanisms are supported: - - insecure: no auth is done, and the user is assumed to be whoever they - say they are (parameter ``user``), or a predefined value such as - "dr.who" if not given - spnego: when kerberos authentication is enabled, auth is negotiated by - requests_kerberos https://github.com/requests/requests-kerberos . - This establishes a session based on existing kinit login and/or - specified principal/password; parameters are passed with ``kerb_kwargs`` - token: uses an existing Hadoop delegation token from another secured - service. Indeed, this client can also generate such tokens when - not insecure. Note that tokens expire, but can be renewed (by a - previously specified user) and may allow for proxying. - - """ - - tempdir = str(tempfile.gettempdir()) - protocol = "webhdfs", "webHDFS" - - def __init__( - self, - host, - port=50070, - kerberos=False, - token=None, - user=None, - proxy_to=None, - kerb_kwargs=None, - data_proxy=None, - use_https=False, - **kwargs, - ): - """ - Parameters - ---------- - host: str - Name-node address - port: int - Port for webHDFS - kerberos: bool - Whether to authenticate with kerberos for this connection - token: str or None - If given, use this token on every call to authenticate. A user - and user-proxy may be encoded in the token and should not be also - given - user: str or None - If given, assert the user name to connect with - proxy_to: str or None - If given, the user has the authority to proxy, and this value is - the user in who's name actions are taken - kerb_kwargs: dict - Any extra arguments for HTTPKerberosAuth, see - ``_ - data_proxy: dict, callable or None - If given, map data-node addresses. This can be necessary if the - HDFS cluster is behind a proxy, running on Docker or otherwise has - a mismatch between the host-names given by the name-node and the - address by which to refer to them from the client. If a dict, - maps host names ``host->data_proxy[host]``; if a callable, full - URLs are passed, and function must conform to - ``url->data_proxy(url)``. - use_https: bool - Whether to connect to the Name-node using HTTPS instead of HTTP - kwargs - """ - if self._cached: - return - super().__init__(**kwargs) - self.url = "{protocol}://{host}:{port}/webhdfs/v1".format( - protocol="https" if use_https else "http", host=host, port=port - ) - self.kerb = kerberos - self.kerb_kwargs = kerb_kwargs or {} - self.pars = {} - self.proxy = data_proxy or {} - if token is not None: - if user is not None or proxy_to is not None: - raise ValueError( - "If passing a delegation token, must not set " - "user or proxy_to, as these are encoded in the" - " token" - ) - self.pars["delegation"] = token - if user is not None: - self.pars["user.name"] = user - if proxy_to is not None: - self.pars["doas"] = proxy_to - if kerberos and user is not None: - raise ValueError( - "If using Kerberos auth, do not specify the " - "user, this is handled by kinit." - ) - self._connect() - - self._fsid = "webhdfs_" + tokenize(host, port) - - @property - def fsid(self): - return self._fsid - - def _connect(self): - self.session = requests.Session() - if self.kerb: - from requests_kerberos import HTTPKerberosAuth - - self.session.auth = HTTPKerberosAuth(**self.kerb_kwargs) - - def _call(self, op, method="get", path=None, data=None, redirect=True, **kwargs): - url = self.url + quote(path or "") - args = kwargs.copy() - args.update(self.pars) - args["op"] = op.upper() - logger.debug("sending %s with %s", url, method) - out = self.session.request( - method=method.upper(), - url=url, - params=args, - data=data, - allow_redirects=redirect, - ) - if out.status_code in [400, 401, 403, 404, 500]: - try: - err = out.json() - msg = err["RemoteException"]["message"] - exp = err["RemoteException"]["exception"] - except (ValueError, KeyError): - pass - else: - if exp in ["IllegalArgumentException", "UnsupportedOperationException"]: - raise ValueError(msg) - elif exp in ["SecurityException", "AccessControlException"]: - raise PermissionError(msg) - elif exp in ["FileNotFoundException"]: - raise FileNotFoundError(msg) - else: - raise RuntimeError(msg) - out.raise_for_status() - return out - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - replication=None, - permissions=None, - **kwargs, - ): - """ - - Parameters - ---------- - path: str - File location - mode: str - 'rb', 'wb', etc. - block_size: int - Client buffer size for read-ahead or write buffer - autocommit: bool - If False, writes to temporary file that only gets put in final - location upon commit - replication: int - Number of copies of file on the cluster, write mode only - permissions: str or int - posix permissions, write mode only - kwargs - - Returns - ------- - WebHDFile instance - """ - block_size = block_size or self.blocksize - return WebHDFile( - self, - path, - mode=mode, - block_size=block_size, - tempdir=self.tempdir, - autocommit=autocommit, - replication=replication, - permissions=permissions, - ) - - @staticmethod - def _process_info(info): - info["type"] = info["type"].lower() - info["size"] = info["length"] - return info - - @classmethod - def _strip_protocol(cls, path): - return infer_storage_options(path)["path"] - - @staticmethod - def _get_kwargs_from_urls(urlpath): - out = infer_storage_options(urlpath) - out.pop("path", None) - out.pop("protocol", None) - if "username" in out: - out["user"] = out.pop("username") - return out - - def info(self, path): - out = self._call("GETFILESTATUS", path=path) - info = out.json()["FileStatus"] - info["name"] = path - return self._process_info(info) - - def ls(self, path, detail=False): - out = self._call("LISTSTATUS", path=path) - infos = out.json()["FileStatuses"]["FileStatus"] - for info in infos: - self._process_info(info) - info["name"] = path.rstrip("/") + "/" + info["pathSuffix"] - if detail: - return sorted(infos, key=lambda i: i["name"]) - else: - return sorted(info["name"] for info in infos) - - def content_summary(self, path): - """Total numbers of files, directories and bytes under path""" - out = self._call("GETCONTENTSUMMARY", path=path) - return out.json()["ContentSummary"] - - def ukey(self, path): - """Checksum info of file, giving method and result""" - out = self._call("GETFILECHECKSUM", path=path, redirect=False) - if "Location" in out.headers: - location = self._apply_proxy(out.headers["Location"]) - out2 = self.session.get(location) - out2.raise_for_status() - return out2.json()["FileChecksum"] - else: - out.raise_for_status() - return out.json()["FileChecksum"] - - def home_directory(self): - """Get user's home directory""" - out = self._call("GETHOMEDIRECTORY") - return out.json()["Path"] - - def get_delegation_token(self, renewer=None): - """Retrieve token which can give the same authority to other uses - - Parameters - ---------- - renewer: str or None - User who may use this token; if None, will be current user - """ - if renewer: - out = self._call("GETDELEGATIONTOKEN", renewer=renewer) - else: - out = self._call("GETDELEGATIONTOKEN") - t = out.json()["Token"] - if t is None: - raise ValueError("No token available for this user/security context") - return t["urlString"] - - def renew_delegation_token(self, token): - """Make token live longer. Returns new expiry time""" - out = self._call("RENEWDELEGATIONTOKEN", method="put", token=token) - return out.json()["long"] - - def cancel_delegation_token(self, token): - """Stop the token from being useful""" - self._call("CANCELDELEGATIONTOKEN", method="put", token=token) - - def chmod(self, path, mod): - """Set the permission at path - - Parameters - ---------- - path: str - location to set (file or directory) - mod: str or int - posix epresentation or permission, give as oct string, e.g, '777' - or 0o777 - """ - self._call("SETPERMISSION", method="put", path=path, permission=mod) - - def chown(self, path, owner=None, group=None): - """Change owning user and/or group""" - kwargs = {} - if owner is not None: - kwargs["owner"] = owner - if group is not None: - kwargs["group"] = group - self._call("SETOWNER", method="put", path=path, **kwargs) - - def set_replication(self, path, replication): - """ - Set file replication factor - - Parameters - ---------- - path: str - File location (not for directories) - replication: int - Number of copies of file on the cluster. Should be smaller than - number of data nodes; normally 3 on most systems. - """ - self._call("SETREPLICATION", path=path, method="put", replication=replication) - - def mkdir(self, path, **kwargs): - self._call("MKDIRS", method="put", path=path) - - def makedirs(self, path, exist_ok=False): - if exist_ok is False and self.exists(path): - raise FileExistsError(path) - self.mkdir(path) - - def mv(self, path1, path2, **kwargs): - self._call("RENAME", method="put", path=path1, destination=path2) - - def rm(self, path, recursive=False, **kwargs): - self._call( - "DELETE", - method="delete", - path=path, - recursive="true" if recursive else "false", - ) - - def rm_file(self, path, **kwargs): - self.rm(path) - - def cp_file(self, lpath, rpath, **kwargs): - with self.open(lpath) as lstream: - tmp_fname = "/".join([self._parent(rpath), f".tmp.{secrets.token_hex(16)}"]) - # Perform an atomic copy (stream to a temporary file and - # move it to the actual destination). - try: - with self.open(tmp_fname, "wb") as rstream: - shutil.copyfileobj(lstream, rstream) - self.mv(tmp_fname, rpath) - except BaseException: # noqa - with suppress(FileNotFoundError): - self.rm(tmp_fname) - raise - - def _apply_proxy(self, location): - if self.proxy and callable(self.proxy): - location = self.proxy(location) - elif self.proxy: - # as a dict - for k, v in self.proxy.items(): - location = location.replace(k, v, 1) - return location - - -class WebHDFile(AbstractBufferedFile): - """A file living in HDFS over webHDFS""" - - def __init__(self, fs, path, **kwargs): - super().__init__(fs, path, **kwargs) - kwargs = kwargs.copy() - if kwargs.get("permissions", None) is None: - kwargs.pop("permissions", None) - if kwargs.get("replication", None) is None: - kwargs.pop("replication", None) - self.permissions = kwargs.pop("permissions", 511) - tempdir = kwargs.pop("tempdir") - if kwargs.pop("autocommit", False) is False: - self.target = self.path - self.path = os.path.join(tempdir, str(uuid.uuid4())) - - def _upload_chunk(self, final=False): - """Write one part of a multi-block file upload - - Parameters - ========== - final: bool - This is the last block, so should complete file, if - self.autocommit is True. - """ - out = self.fs.session.post( - self.location, - data=self.buffer.getvalue(), - headers={"content-type": "application/octet-stream"}, - ) - out.raise_for_status() - return True - - def _initiate_upload(self): - """Create remote file/upload""" - kwargs = self.kwargs.copy() - if "a" in self.mode: - op, method = "APPEND", "POST" - else: - op, method = "CREATE", "PUT" - kwargs["overwrite"] = "true" - out = self.fs._call(op, method, self.path, redirect=False, **kwargs) - location = self.fs._apply_proxy(out.headers["Location"]) - if "w" in self.mode: - # create empty file to append to - out2 = self.fs.session.put( - location, headers={"content-type": "application/octet-stream"} - ) - out2.raise_for_status() - # after creating empty file, change location to append to - out2 = self.fs._call("APPEND", "POST", self.path, redirect=False, **kwargs) - self.location = self.fs._apply_proxy(out2.headers["Location"]) - - def _fetch_range(self, start, end): - start = max(start, 0) - end = min(self.size, end) - if start >= end or start >= self.size: - return b"" - out = self.fs._call( - "OPEN", path=self.path, offset=start, length=end - start, redirect=False - ) - out.raise_for_status() - if "Location" in out.headers: - location = out.headers["Location"] - out2 = self.fs.session.get(self.fs._apply_proxy(location)) - return out2.content - else: - return out.content - - def commit(self): - self.fs.mv(self.path, self.target) - - def discard(self): - self.fs.rm(self.path) diff --git a/venv/lib/python3.8/site-packages/fsspec/implementations/zip.py b/venv/lib/python3.8/site-packages/fsspec/implementations/zip.py deleted file mode 100644 index 91c8ec4f4abfa60070212e1a00392b1a3f945ab1..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/implementations/zip.py +++ /dev/null @@ -1,125 +0,0 @@ -import zipfile - -import fsspec -from fsspec.archive import AbstractArchiveFileSystem - - -class ZipFileSystem(AbstractArchiveFileSystem): - """Read/Write contents of ZIP archive as a file-system - - Keeps file object open while instance lives. - - This class is pickleable, but not necessarily thread-safe - """ - - root_marker = "" - protocol = "zip" - cachable = False - - def __init__( - self, - fo="", - mode="r", - target_protocol=None, - target_options=None, - compression=zipfile.ZIP_STORED, - allowZip64=True, - compresslevel=None, - **kwargs, - ): - """ - Parameters - ---------- - fo: str or file-like - Contains ZIP, and must exist. If a str, will fetch file using - :meth:`~fsspec.open_files`, which must return one file exactly. - mode: str - Accept: "r", "w", "a" - target_protocol: str (optional) - If ``fo`` is a string, this value can be used to override the - FS protocol inferred from a URL - target_options: dict (optional) - Kwargs passed when instantiating the target FS, if ``fo`` is - a string. - compression, allowZip64, compresslevel: passed to ZipFile - Only relevant when creating a ZIP - """ - super().__init__(self, **kwargs) - if mode not in set("rwa"): - raise ValueError(f"mode '{mode}' no understood") - self.mode = mode - if isinstance(fo, str): - fo = fsspec.open( - fo, mode=mode + "b", protocol=target_protocol, **(target_options or {}) - ) - self.of = fo - self.fo = fo.__enter__() # the whole instance is a context - self.zip = zipfile.ZipFile( - self.fo, - mode=mode, - compression=compression, - allowZip64=allowZip64, - compresslevel=compresslevel, - ) - self.dir_cache = None - - @classmethod - def _strip_protocol(cls, path): - # zip file paths are always relative to the archive root - return super()._strip_protocol(path).lstrip("/") - - def __del__(self): - if hasattr(self, "zip"): - self.close() - del self.zip - - def close(self): - """Commits any write changes to the file. Done on ``del`` too.""" - self.zip.close() - - def _get_dirs(self): - if self.dir_cache is None or self.mode in set("wa"): - # when writing, dir_cache is always in the ZipFile's attributes, - # not read from the file. - files = self.zip.infolist() - self.dir_cache = { - dirname + "/": {"name": dirname + "/", "size": 0, "type": "directory"} - for dirname in self._all_dirnames(self.zip.namelist()) - } - for z in files: - f = {s: getattr(z, s, None) for s in zipfile.ZipInfo.__slots__} - f.update( - { - "name": z.filename, - "size": z.file_size, - "type": ("directory" if z.is_dir() else "file"), - } - ) - self.dir_cache[f["name"]] = f - - def pipe_file(self, path, value, **kwargs): - # override upstream, because we know the exact file size in this case - self.zip.writestr(path, value, **kwargs) - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - cache_options=None, - **kwargs, - ): - path = self._strip_protocol(path) - if "r" in mode and self.mode in set("wa"): - if self.exists(path): - raise IOError("ZipFS can only be open for reading or writing, not both") - raise FileNotFoundError(path) - if "r" in self.mode and "w" in mode: - raise IOError("ZipFS can only be open for reading or writing, not both") - out = self.zip.open(path, mode.strip("b")) - if "r" in mode: - info = self.info(path) - out.size = info["size"] - out.name = info["name"] - return out diff --git a/venv/lib/python3.8/site-packages/fsspec/mapping.py b/venv/lib/python3.8/site-packages/fsspec/mapping.py deleted file mode 100644 index 2b75c2e41f6f741ed03bc674e4ba43921041d864..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/mapping.py +++ /dev/null @@ -1,247 +0,0 @@ -import array -import posixpath -import warnings -from collections.abc import MutableMapping -from functools import cached_property - -from .core import url_to_fs - - -class FSMap(MutableMapping): - """Wrap a FileSystem instance as a mutable wrapping. - - The keys of the mapping become files under the given root, and the - values (which must be bytes) the contents of those files. - - Parameters - ---------- - root: string - prefix for all the files - fs: FileSystem instance - check: bool (=True) - performs a touch at the location, to check for write access. - - Examples - -------- - >>> fs = FileSystem(**parameters) # doctest: +SKIP - >>> d = FSMap('my-data/path/', fs) # doctest: +SKIP - or, more likely - >>> d = fs.get_mapper('my-data/path/') - - >>> d['loc1'] = b'Hello World' # doctest: +SKIP - >>> list(d.keys()) # doctest: +SKIP - ['loc1'] - >>> d['loc1'] # doctest: +SKIP - b'Hello World' - """ - - def __init__(self, root, fs, check=False, create=False, missing_exceptions=None): - self.fs = fs - self.root = fs._strip_protocol(root).rstrip("/") - self._root_key_to_str = fs._strip_protocol(posixpath.join(root, "x"))[:-1] - if missing_exceptions is None: - missing_exceptions = ( - FileNotFoundError, - IsADirectoryError, - NotADirectoryError, - ) - self.missing_exceptions = missing_exceptions - self.check = check - self.create = create - if create: - if not self.fs.exists(root): - self.fs.mkdir(root) - if check: - if not self.fs.exists(root): - raise ValueError( - "Path %s does not exist. Create " - " with the ``create=True`` keyword" % root - ) - self.fs.touch(root + "/a") - self.fs.rm(root + "/a") - - @cached_property - def dirfs(self): - """dirfs instance that can be used with the same keys as the mapper""" - from .implementations.dirfs import DirFileSystem - - return DirFileSystem(path=self._root_key_to_str, fs=self.fs) - - def clear(self): - """Remove all keys below root - empties out mapping""" - try: - self.fs.rm(self.root, True) - self.fs.mkdir(self.root) - except: # noqa: E722 - pass - - def getitems(self, keys, on_error="raise"): - """Fetch multiple items from the store - - If the backend is async-able, this might proceed concurrently - - Parameters - ---------- - keys: list(str) - They keys to be fetched - on_error : "raise", "omit", "return" - If raise, an underlying exception will be raised (converted to KeyError - if the type is in self.missing_exceptions); if omit, keys with exception - will simply not be included in the output; if "return", all keys are - included in the output, but the value will be bytes or an exception - instance. - - Returns - ------- - dict(key, bytes|exception) - """ - keys2 = [self._key_to_str(k) for k in keys] - oe = on_error if on_error == "raise" else "return" - try: - out = self.fs.cat(keys2, on_error=oe) - if isinstance(out, bytes): - out = {keys2[0]: out} - except self.missing_exceptions as e: - raise KeyError from e - out = { - k: (KeyError() if isinstance(v, self.missing_exceptions) else v) - for k, v in out.items() - } - return { - key: out[k2] - for key, k2 in zip(keys, keys2) - if on_error == "return" or not isinstance(out[k2], BaseException) - } - - def setitems(self, values_dict): - """Set the values of multiple items in the store - - Parameters - ---------- - values_dict: dict(str, bytes) - """ - values = {self._key_to_str(k): maybe_convert(v) for k, v in values_dict.items()} - self.fs.pipe(values) - - def delitems(self, keys): - """Remove multiple keys from the store""" - self.fs.rm([self._key_to_str(k) for k in keys]) - - def _key_to_str(self, key): - """Generate full path for the key""" - if not isinstance(key, str): - # raise TypeError("key must be of type `str`, got `{type(key).__name__}`" - warnings.warn( - "from fsspec 2023.5 onward FSMap non-str keys will raise TypeError", - DeprecationWarning, - ) - if isinstance(key, list): - key = tuple(key) - key = str(key) - return f"{self._root_key_to_str}{key}" - - def _str_to_key(self, s): - """Strip path of to leave key name""" - return s[len(self.root) :].lstrip("/") - - def __getitem__(self, key, default=None): - """Retrieve data""" - k = self._key_to_str(key) - try: - result = self.fs.cat(k) - except self.missing_exceptions: - if default is not None: - return default - raise KeyError(key) - return result - - def pop(self, key, default=None): - """Pop data""" - result = self.__getitem__(key, default) - try: - del self[key] - except KeyError: - pass - return result - - def __setitem__(self, key, value): - """Store value in key""" - key = self._key_to_str(key) - self.fs.mkdirs(self.fs._parent(key), exist_ok=True) - self.fs.pipe_file(key, maybe_convert(value)) - - def __iter__(self): - return (self._str_to_key(x) for x in self.fs.find(self.root)) - - def __len__(self): - return len(self.fs.find(self.root)) - - def __delitem__(self, key): - """Remove key""" - try: - self.fs.rm(self._key_to_str(key)) - except: # noqa: E722 - raise KeyError - - def __contains__(self, key): - """Does key exist in mapping?""" - path = self._key_to_str(key) - return self.fs.exists(path) and self.fs.isfile(path) - - def __reduce__(self): - return FSMap, (self.root, self.fs, False, False, self.missing_exceptions) - - -def maybe_convert(value): - if isinstance(value, array.array) or hasattr(value, "__array__"): - # bytes-like things - if hasattr(value, "dtype") and value.dtype.kind in "Mm": - # The buffer interface doesn't support datetime64/timdelta64 numpy - # arrays - value = value.view("int64") - value = bytes(memoryview(value)) - return value - - -def get_mapper( - url="", - check=False, - create=False, - missing_exceptions=None, - alternate_root=None, - **kwargs, -): - """Create key-value interface for given URL and options - - The URL will be of the form "protocol://location" and point to the root - of the mapper required. All keys will be file-names below this location, - and their values the contents of each key. - - Also accepts compound URLs like zip::s3://bucket/file.zip , see ``fsspec.open``. - - Parameters - ---------- - url: str - Root URL of mapping - check: bool - Whether to attempt to read from the location before instantiation, to - check that the mapping does exist - create: bool - Whether to make the directory corresponding to the root before - instantiating - missing_exceptions: None or tuple - If given, these exception types will be regarded as missing keys and - return KeyError when trying to read data. By default, you get - (FileNotFoundError, IsADirectoryError, NotADirectoryError) - alternate_root: None or str - In cases of complex URLs, the parser may fail to pick the correct part - for the mapper root, so this arg can override - - Returns - ------- - ``FSMap`` instance, the dict-like key-value store. - """ - # Removing protocol here - could defer to each open() on the backend - fs, urlpath = url_to_fs(url, **kwargs) - root = alternate_root if alternate_root is not None else urlpath - return FSMap(root, fs, check, create, missing_exceptions=missing_exceptions) diff --git a/venv/lib/python3.8/site-packages/fsspec/parquet.py b/venv/lib/python3.8/site-packages/fsspec/parquet.py deleted file mode 100644 index af55f8cf48e80ed81ba9abc3bff51915a5daf84c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/parquet.py +++ /dev/null @@ -1,551 +0,0 @@ -import io -import json -import warnings - -from .core import url_to_fs -from .utils import merge_offset_ranges - -# Parquet-Specific Utilities for fsspec -# -# Most of the functions defined in this module are NOT -# intended for public consumption. The only exception -# to this is `open_parquet_file`, which should be used -# place of `fs.open()` to open parquet-formatted files -# on remote file systems. - - -def open_parquet_file( - path, - mode="rb", - fs=None, - metadata=None, - columns=None, - row_groups=None, - storage_options=None, - strict=False, - engine="auto", - max_gap=64_000, - max_block=256_000_000, - footer_sample_size=1_000_000, - **kwargs, -): - """ - Return a file-like object for a single Parquet file. - - The specified parquet `engine` will be used to parse the - footer metadata, and determine the required byte ranges - from the file. The target path will then be opened with - the "parts" (`KnownPartsOfAFile`) caching strategy. - - Note that this method is intended for usage with remote - file systems, and is unlikely to improve parquet-read - performance on local file systems. - - Parameters - ---------- - path: str - Target file path. - mode: str, optional - Mode option to be passed through to `fs.open`. Default is "rb". - metadata: Any, optional - Parquet metadata object. Object type must be supported - by the backend parquet engine. For now, only the "fastparquet" - engine supports an explicit `ParquetFile` metadata object. - If a metadata object is supplied, the remote footer metadata - will not need to be transferred into local memory. - fs: AbstractFileSystem, optional - Filesystem object to use for opening the file. If nothing is - specified, an `AbstractFileSystem` object will be inferred. - engine : str, default "auto" - Parquet engine to use for metadata parsing. Allowed options - include "fastparquet", "pyarrow", and "auto". The specified - engine must be installed in the current environment. If - "auto" is specified, and both engines are installed, - "fastparquet" will take precedence over "pyarrow". - columns: list, optional - List of all column names that may be read from the file. - row_groups : list, optional - List of all row-groups that may be read from the file. This - may be a list of row-group indices (integers), or it may be - a list of `RowGroup` metadata objects (if the "fastparquet" - engine is used). - storage_options : dict, optional - Used to generate an `AbstractFileSystem` object if `fs` was - not specified. - strict : bool, optional - Whether the resulting `KnownPartsOfAFile` cache should - fetch reads that go beyond a known byte-range boundary. - If `False` (the default), any read that ends outside a - known part will be zero padded. Note that using - `strict=True` may be useful for debugging. - max_gap : int, optional - Neighboring byte ranges will only be merged when their - inter-range gap is <= `max_gap`. Default is 64KB. - max_block : int, optional - Neighboring byte ranges will only be merged when the size of - the aggregated range is <= `max_block`. Default is 256MB. - footer_sample_size : int, optional - Number of bytes to read from the end of the path to look - for the footer metadata. If the sampled bytes do not contain - the footer, a second read request will be required, and - performance will suffer. Default is 1MB. - **kwargs : - Optional key-word arguments to pass to `fs.open` - """ - - # Make sure we have an `AbstractFileSystem` object - # to work with - if fs is None: - fs = url_to_fs(path, **(storage_options or {}))[0] - - # For now, `columns == []` not supported. Just use - # default `open` command with `path` input - if columns is not None and len(columns) == 0: - return fs.open(path, mode=mode) - - # Set the engine - engine = _set_engine(engine) - - # Fetch the known byte ranges needed to read - # `columns` and/or `row_groups` - data = _get_parquet_byte_ranges( - [path], - fs, - metadata=metadata, - columns=columns, - row_groups=row_groups, - engine=engine, - max_gap=max_gap, - max_block=max_block, - footer_sample_size=footer_sample_size, - ) - - # Extract file name from `data` - fn = next(iter(data)) if data else path - - # Call self.open with "parts" caching - options = kwargs.pop("cache_options", {}).copy() - return fs.open( - fn, - mode=mode, - cache_type="parts", - cache_options={ - **options, - **{ - "data": data.get(fn, {}), - "strict": strict, - }, - }, - **kwargs, - ) - - -def _get_parquet_byte_ranges( - paths, - fs, - metadata=None, - columns=None, - row_groups=None, - max_gap=64_000, - max_block=256_000_000, - footer_sample_size=1_000_000, - engine="auto", -): - """Get a dictionary of the known byte ranges needed - to read a specific column/row-group selection from a - Parquet dataset. Each value in the output dictionary - is intended for use as the `data` argument for the - `KnownPartsOfAFile` caching strategy of a single path. - """ - - # Set engine if necessary - if isinstance(engine, str): - engine = _set_engine(engine) - - # Pass to specialized function if metadata is defined - if metadata is not None: - - # Use the provided parquet metadata object - # to avoid transferring/parsing footer metadata - return _get_parquet_byte_ranges_from_metadata( - metadata, - fs, - engine, - columns=columns, - row_groups=row_groups, - max_gap=max_gap, - max_block=max_block, - ) - - # Get file sizes asynchronously - file_sizes = fs.sizes(paths) - - # Populate global paths, starts, & ends - result = {} - data_paths = [] - data_starts = [] - data_ends = [] - add_header_magic = True - if columns is None and row_groups is None: - # We are NOT selecting specific columns or row-groups. - # - # We can avoid sampling the footers, and just transfer - # all file data with cat_ranges - for i, path in enumerate(paths): - result[path] = {} - for b in range(0, file_sizes[i], max_block): - data_paths.append(path) - data_starts.append(b) - data_ends.append(min(b + max_block, file_sizes[i])) - add_header_magic = False # "Magic" should already be included - else: - # We ARE selecting specific columns or row-groups. - # - # Gather file footers. - # We just take the last `footer_sample_size` bytes of each - # file (or the entire file if it is smaller than that) - footer_starts = [] - footer_ends = [] - for i, path in enumerate(paths): - footer_ends.append(file_sizes[i]) - sample_size = max(0, file_sizes[i] - footer_sample_size) - footer_starts.append(sample_size) - footer_samples = fs.cat_ranges(paths, footer_starts, footer_ends) - - # Check our footer samples and re-sample if necessary. - missing_footer_starts = footer_starts.copy() - large_footer = 0 - for i, path in enumerate(paths): - footer_size = int.from_bytes(footer_samples[i][-8:-4], "little") - real_footer_start = file_sizes[i] - (footer_size + 8) - if real_footer_start < footer_starts[i]: - missing_footer_starts[i] = real_footer_start - large_footer = max(large_footer, (footer_size + 8)) - if large_footer: - warnings.warn( - f"Not enough data was used to sample the parquet footer. " - f"Try setting footer_sample_size >= {large_footer}." - ) - for i, block in enumerate( - fs.cat_ranges( - paths, - missing_footer_starts, - footer_starts, - ) - ): - footer_samples[i] = block + footer_samples[i] - footer_starts[i] = missing_footer_starts[i] - - # Calculate required byte ranges for each path - for i, path in enumerate(paths): - - # Deal with small-file case. - # Just include all remaining bytes of the file - # in a single range. - if file_sizes[i] < max_block: - if footer_starts[i] > 0: - # Only need to transfer the data if the - # footer sample isn't already the whole file - data_paths.append(path) - data_starts.append(0) - data_ends.append(footer_starts[i]) - continue - - # Use "engine" to collect data byte ranges - path_data_starts, path_data_ends = engine._parquet_byte_ranges( - columns, - row_groups=row_groups, - footer=footer_samples[i], - footer_start=footer_starts[i], - ) - - data_paths += [path] * len(path_data_starts) - data_starts += path_data_starts - data_ends += path_data_ends - - # Merge adjacent offset ranges - data_paths, data_starts, data_ends = merge_offset_ranges( - data_paths, - data_starts, - data_ends, - max_gap=max_gap, - max_block=max_block, - sort=False, # Should already be sorted - ) - - # Start by populating `result` with footer samples - for i, path in enumerate(paths): - result[path] = {(footer_starts[i], footer_ends[i]): footer_samples[i]} - - # Transfer the data byte-ranges into local memory - _transfer_ranges(fs, result, data_paths, data_starts, data_ends) - - # Add b"PAR1" to header if necessary - if add_header_magic: - _add_header_magic(result) - - return result - - -def _get_parquet_byte_ranges_from_metadata( - metadata, - fs, - engine, - columns=None, - row_groups=None, - max_gap=64_000, - max_block=256_000_000, -): - """Simplified version of `_get_parquet_byte_ranges` for - the case that an engine-specific `metadata` object is - provided, and the remote footer metadata does not need to - be transferred before calculating the required byte ranges. - """ - - # Use "engine" to collect data byte ranges - data_paths, data_starts, data_ends = engine._parquet_byte_ranges( - columns, - row_groups=row_groups, - metadata=metadata, - ) - - # Merge adjacent offset ranges - data_paths, data_starts, data_ends = merge_offset_ranges( - data_paths, - data_starts, - data_ends, - max_gap=max_gap, - max_block=max_block, - sort=False, # Should be sorted - ) - - # Transfer the data byte-ranges into local memory - result = {fn: {} for fn in list(set(data_paths))} - _transfer_ranges(fs, result, data_paths, data_starts, data_ends) - - # Add b"PAR1" to header - _add_header_magic(result) - - return result - - -def _transfer_ranges(fs, blocks, paths, starts, ends): - # Use cat_ranges to gather the data byte_ranges - ranges = (paths, starts, ends) - for path, start, stop, data in zip(*ranges, fs.cat_ranges(*ranges)): - blocks[path][(start, stop)] = data - - -def _add_header_magic(data): - # Add b"PAR1" to file headers - for i, path in enumerate(list(data.keys())): - add_magic = True - for k in data[path].keys(): - if k[0] == 0 and k[1] >= 4: - add_magic = False - break - if add_magic: - data[path][(0, 4)] = b"PAR1" - - -def _set_engine(engine_str): - - # Define a list of parquet engines to try - if engine_str == "auto": - try_engines = ("fastparquet", "pyarrow") - elif not isinstance(engine_str, str): - raise ValueError( - "Failed to set parquet engine! " - "Please pass 'fastparquet', 'pyarrow', or 'auto'" - ) - elif engine_str not in ("fastparquet", "pyarrow"): - raise ValueError(f"{engine_str} engine not supported by `fsspec.parquet`") - else: - try_engines = [engine_str] - - # Try importing the engines in `try_engines`, - # and choose the first one that succeeds - for engine in try_engines: - try: - if engine == "fastparquet": - return FastparquetEngine() - elif engine == "pyarrow": - return PyarrowEngine() - except ImportError: - pass - - # Raise an error if a supported parquet engine - # was not found - raise ImportError( - f"The following parquet engines are not installed " - f"in your python environment: {try_engines}." - f"Please install 'fastparquert' or 'pyarrow' to " - f"utilize the `fsspec.parquet` module." - ) - - -class FastparquetEngine: - - # The purpose of the FastparquetEngine class is - # to check if fastparquet can be imported (on initialization) - # and to define a `_parquet_byte_ranges` method. In the - # future, this class may also be used to define other - # methods/logic that are specific to fastparquet. - - def __init__(self): - import fastparquet as fp - - self.fp = fp - - def _row_group_filename(self, row_group, pf): - return pf.row_group_filename(row_group) - - def _parquet_byte_ranges( - self, - columns, - row_groups=None, - metadata=None, - footer=None, - footer_start=None, - ): - - # Initialize offset ranges and define ParqetFile metadata - pf = metadata - data_paths, data_starts, data_ends = [], [], [] - if pf is None: - pf = self.fp.ParquetFile(io.BytesIO(footer)) - - # Convert columns to a set and add any index columns - # specified in the pandas metadata (just in case) - column_set = None if columns is None else set(columns) - if column_set is not None and hasattr(pf, "pandas_metadata"): - md_index = [ - ind - for ind in pf.pandas_metadata.get("index_columns", []) - # Ignore RangeIndex information - if not isinstance(ind, dict) - ] - column_set |= set(md_index) - - # Check if row_groups is a list of integers - # or a list of row-group metadata - if row_groups and not isinstance(row_groups[0], int): - # Input row_groups contains row-group metadata - row_group_indices = None - else: - # Input row_groups contains row-group indices - row_group_indices = row_groups - row_groups = pf.row_groups - - # Loop through column chunks to add required byte ranges - for r, row_group in enumerate(row_groups): - # Skip this row-group if we are targeting - # specific row-groups - if row_group_indices is None or r in row_group_indices: - - # Find the target parquet-file path for `row_group` - fn = self._row_group_filename(row_group, pf) - - for column in row_group.columns: - name = column.meta_data.path_in_schema[0] - # Skip this column if we are targeting a - # specific columns - if column_set is None or name in column_set: - file_offset0 = column.meta_data.dictionary_page_offset - if file_offset0 is None: - file_offset0 = column.meta_data.data_page_offset - num_bytes = column.meta_data.total_compressed_size - if footer_start is None or file_offset0 < footer_start: - data_paths.append(fn) - data_starts.append(file_offset0) - data_ends.append( - min( - file_offset0 + num_bytes, - footer_start or (file_offset0 + num_bytes), - ) - ) - - if metadata: - # The metadata in this call may map to multiple - # file paths. Need to include `data_paths` - return data_paths, data_starts, data_ends - return data_starts, data_ends - - -class PyarrowEngine: - - # The purpose of the PyarrowEngine class is - # to check if pyarrow can be imported (on initialization) - # and to define a `_parquet_byte_ranges` method. In the - # future, this class may also be used to define other - # methods/logic that are specific to pyarrow. - - def __init__(self): - import pyarrow.parquet as pq - - self.pq = pq - - def _row_group_filename(self, row_group, metadata): - raise NotImplementedError - - def _parquet_byte_ranges( - self, - columns, - row_groups=None, - metadata=None, - footer=None, - footer_start=None, - ): - - if metadata is not None: - raise ValueError("metadata input not supported for PyarrowEngine") - - data_starts, data_ends = [], [] - md = self.pq.ParquetFile(io.BytesIO(footer)).metadata - - # Convert columns to a set and add any index columns - # specified in the pandas metadata (just in case) - column_set = None if columns is None else set(columns) - if column_set is not None: - schema = md.schema.to_arrow_schema() - has_pandas_metadata = ( - schema.metadata is not None and b"pandas" in schema.metadata - ) - if has_pandas_metadata: - md_index = [ - ind - for ind in json.loads( - schema.metadata[b"pandas"].decode("utf8") - ).get("index_columns", []) - # Ignore RangeIndex information - if not isinstance(ind, dict) - ] - column_set |= set(md_index) - - # Loop through column chunks to add required byte ranges - for r in range(md.num_row_groups): - # Skip this row-group if we are targeting - # specific row-groups - if row_groups is None or r in row_groups: - row_group = md.row_group(r) - for c in range(row_group.num_columns): - column = row_group.column(c) - name = column.path_in_schema - # Skip this column if we are targeting a - # specific columns - split_name = name.split(".")[0] - if ( - column_set is None - or name in column_set - or split_name in column_set - ): - file_offset0 = column.dictionary_page_offset - if file_offset0 is None: - file_offset0 = column.data_page_offset - num_bytes = column.total_compressed_size - if file_offset0 < footer_start: - data_starts.append(file_offset0) - data_ends.append( - min(file_offset0 + num_bytes, footer_start) - ) - return data_starts, data_ends diff --git a/venv/lib/python3.8/site-packages/fsspec/registry.py b/venv/lib/python3.8/site-packages/fsspec/registry.py deleted file mode 100644 index 851bc65bc8fa1ea01a48d425563bce06ccfe8ecd..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/registry.py +++ /dev/null @@ -1,297 +0,0 @@ -from __future__ import annotations - -import importlib -import types -import warnings - -__all__ = ["registry", "get_filesystem_class", "default"] - -# internal, mutable -_registry: dict[str, type] = {} - -# external, immutable -registry = types.MappingProxyType(_registry) -default = "file" - - -def register_implementation(name, cls, clobber=False, errtxt=None): - """Add implementation class to the registry - - Parameters - ---------- - name: str - Protocol name to associate with the class - cls: class or str - if a class: fsspec-compliant implementation class (normally inherits from - ``fsspec.AbstractFileSystem``, gets added straight to the registry. If a - str, the full path to an implementation class like package.module.class, - which gets added to known_implementations, - so the import is deferred until the filesystem is actually used. - clobber: bool (optional) - Whether to overwrite a protocol with the same name; if False, will raise - instead. - errtxt: str (optional) - If given, then a failure to import the given class will result in this - text being given. - """ - if isinstance(cls, str): - if name in known_implementations and clobber is False: - if cls != known_implementations[name]["class"]: - raise ValueError( - "Name (%s) already in the known_implementations and clobber " - "is False" % name - ) - else: - known_implementations[name] = { - "class": cls, - "err": errtxt or "%s import failed for protocol %s" % (cls, name), - } - - else: - if name in registry and clobber is False: - if _registry[name] is not cls: - raise ValueError( - "Name (%s) already in the registry and clobber is False" % name - ) - else: - _registry[name] = cls - - -# protocols mapped to the class which implements them. This dict can -# updated with register_implementation -known_implementations = { - "file": {"class": "fsspec.implementations.local.LocalFileSystem"}, - "memory": {"class": "fsspec.implementations.memory.MemoryFileSystem"}, - "dropbox": { - "class": "dropboxdrivefs.DropboxDriveFileSystem", - "err": ( - 'DropboxFileSystem requires "dropboxdrivefs",' - '"requests" and "dropbox" to be installed' - ), - }, - "http": { - "class": "fsspec.implementations.http.HTTPFileSystem", - "err": 'HTTPFileSystem requires "requests" and "aiohttp" to be installed', - }, - "https": { - "class": "fsspec.implementations.http.HTTPFileSystem", - "err": 'HTTPFileSystem requires "requests" and "aiohttp" to be installed', - }, - "zip": {"class": "fsspec.implementations.zip.ZipFileSystem"}, - "tar": {"class": "fsspec.implementations.tar.TarFileSystem"}, - "gcs": { - "class": "gcsfs.GCSFileSystem", - "err": "Please install gcsfs to access Google Storage", - }, - "gs": { - "class": "gcsfs.GCSFileSystem", - "err": "Please install gcsfs to access Google Storage", - }, - "gdrive": { - "class": "gdrivefs.GoogleDriveFileSystem", - "err": "Please install gdrivefs for access to Google Drive", - }, - "sftp": { - "class": "fsspec.implementations.sftp.SFTPFileSystem", - "err": 'SFTPFileSystem requires "paramiko" to be installed', - }, - "ssh": { - "class": "fsspec.implementations.sftp.SFTPFileSystem", - "err": 'SFTPFileSystem requires "paramiko" to be installed', - }, - "ftp": {"class": "fsspec.implementations.ftp.FTPFileSystem"}, - "hdfs": { - "class": "fsspec.implementations.arrow.HadoopFileSystem", - "err": "pyarrow and local java libraries required for HDFS", - }, - "arrow_hdfs": { - "class": "fsspec.implementations.arrow.HadoopFileSystem", - "err": "pyarrow and local java libraries required for HDFS", - }, - "webhdfs": { - "class": "fsspec.implementations.webhdfs.WebHDFS", - "err": 'webHDFS access requires "requests" to be installed', - }, - "s3": {"class": "s3fs.S3FileSystem", "err": "Install s3fs to access S3"}, - "s3a": {"class": "s3fs.S3FileSystem", "err": "Install s3fs to access S3"}, - "wandb": {"class": "wandbfs.WandbFS", "err": "Install wandbfs to access wandb"}, - "oci": { - "class": "ocifs.OCIFileSystem", - "err": "Install ocifs to access OCI Object Storage", - }, - "ocilake": { - "class": "ocifs.OCIFileSystem", - "err": "Install ocifs to access OCI Data Lake", - }, - "asynclocal": { - "class": "morefs.asyn_local.AsyncLocalFileSystem", - "err": "Install 'morefs[asynclocalfs]' to use AsyncLocalFileSystem", - }, - "adl": { - "class": "adlfs.AzureDatalakeFileSystem", - "err": "Install adlfs to access Azure Datalake Gen1", - }, - "abfs": { - "class": "adlfs.AzureBlobFileSystem", - "err": "Install adlfs to access Azure Datalake Gen2 and Azure Blob Storage", - }, - "az": { - "class": "adlfs.AzureBlobFileSystem", - "err": "Install adlfs to access Azure Datalake Gen2 and Azure Blob Storage", - }, - "cached": {"class": "fsspec.implementations.cached.CachingFileSystem"}, - "blockcache": {"class": "fsspec.implementations.cached.CachingFileSystem"}, - "filecache": {"class": "fsspec.implementations.cached.WholeFileCacheFileSystem"}, - "simplecache": {"class": "fsspec.implementations.cached.SimpleCacheFileSystem"}, - "dask": { - "class": "fsspec.implementations.dask.DaskWorkerFileSystem", - "err": "Install dask distributed to access worker file system", - }, - "dbfs": { - "class": "fsspec.implementations.dbfs.DatabricksFileSystem", - "err": "Install the requests package to use the DatabricksFileSystem", - }, - "github": { - "class": "fsspec.implementations.github.GithubFileSystem", - "err": "Install the requests package to use the github FS", - }, - "git": { - "class": "fsspec.implementations.git.GitFileSystem", - "err": "Install pygit2 to browse local git repos", - }, - "smb": { - "class": "fsspec.implementations.smb.SMBFileSystem", - "err": 'SMB requires "smbprotocol" or "smbprotocol[kerberos]" installed', - }, - "jupyter": { - "class": "fsspec.implementations.jupyter.JupyterFileSystem", - "err": "Jupyter FS requires requests to be installed", - }, - "jlab": { - "class": "fsspec.implementations.jupyter.JupyterFileSystem", - "err": "Jupyter FS requires requests to be installed", - }, - "libarchive": { - "class": "fsspec.implementations.libarchive.LibArchiveFileSystem", - "err": "LibArchive requires to be installed", - }, - "reference": {"class": "fsspec.implementations.reference.ReferenceFileSystem"}, - "generic": {"class": "fsspec.generic.GenericFileSystem"}, - "oss": { - "class": "ossfs.OSSFileSystem", - "err": "Install ossfs to access Alibaba Object Storage System", - }, - "webdav": { - "class": "webdav4.fsspec.WebdavFileSystem", - "err": "Install webdav4 to access WebDAV", - }, - "dvc": { - "class": "dvc.api.DVCFileSystem", - "err": "Install dvc to access DVCFileSystem", - }, - "hf": { - "class": "huggingface_hub.HfFileSystem", - "err": "Install huggingface_hub to access HfFileSystem", - }, - "root": { - "class": "fsspec_xrootd.XRootDFileSystem", - "err": "Install fsspec-xrootd to access xrootd storage system." - + " Note: 'root' is the protocol name for xrootd storage systems," - + " not referring to root directories", - }, - "dir": {"class": "fsspec.implementations.dirfs.DirFileSystem"}, - "box": { - "class": "boxfs.BoxFileSystem", - "err": "Please install boxfs to access BoxFileSystem", - }, - "lakefs": { - "class": "lakefs_spec.LakeFSFileSystem", - "err": "Please install lakefs-spec to access LakeFSFileSystem", - }, -} - - -def get_filesystem_class(protocol): - """Fetch named protocol implementation from the registry - - The dict ``known_implementations`` maps protocol names to the locations - of classes implementing the corresponding file-system. When used for the - first time, appropriate imports will happen and the class will be placed in - the registry. All subsequent calls will fetch directly from the registry. - - Some protocol implementations require additional dependencies, and so the - import may fail. In this case, the string in the "err" field of the - ``known_implementations`` will be given as the error message. - """ - if not protocol: - protocol = default - - if protocol not in registry: - if protocol not in known_implementations: - raise ValueError("Protocol not known: %s" % protocol) - bit = known_implementations[protocol] - try: - register_implementation(protocol, _import_class(bit["class"])) - except ImportError as e: - raise ImportError(bit["err"]) from e - cls = registry[protocol] - if getattr(cls, "protocol", None) in ("abstract", None): - cls.protocol = protocol - - return cls - - -s3_msg = """Your installed version of s3fs is very old and known to cause -severe performance issues, see also https://github.com/dask/dask/issues/10276 - -To fix, you should specify a lower version bound on s3fs, or -update the current installation. -""" - - -def _import_class(cls, minv=None): - """Take a string FQP and return the imported class or identifier - - clas is of the form "package.module.klass" or "package.module:subobject.klass" - """ - if ":" in cls: - mod, name = cls.rsplit(":", 1) - s3 = mod == "s3fs" - mod = importlib.import_module(mod) - if s3 and mod.__version__.split(".") < ["0", "5"]: - warnings.warn(s3_msg) - for part in name.split("."): - mod = getattr(mod, part) - return mod - else: - mod, name = cls.rsplit(".", 1) - s3 = mod == "s3fs" - mod = importlib.import_module(mod) - if s3 and mod.__version__.split(".") < ["0", "5"]: - warnings.warn(s3_msg) - return getattr(mod, name) - - -def filesystem(protocol, **storage_options): - """Instantiate filesystems for given protocol and arguments - - ``storage_options`` are specific to the protocol being chosen, and are - passed directly to the class. - """ - if protocol == "arrow_hdfs": - warnings.warn( - "The 'arrow_hdfs' protocol has been deprecated and will be " - "removed in the future. Specify it as 'hdfs'.", - DeprecationWarning, - ) - - cls = get_filesystem_class(protocol) - return cls(**storage_options) - - -def available_protocols(): - """Return a list of the implemented protocols. - - Note that any given protocol may require extra packages to be importable. - """ - return list(known_implementations) diff --git a/venv/lib/python3.8/site-packages/fsspec/spec.py b/venv/lib/python3.8/site-packages/fsspec/spec.py deleted file mode 100644 index a205cb2b66cf5caa77aa84b81b77b0e66db12f33..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/spec.py +++ /dev/null @@ -1,1977 +0,0 @@ -from __future__ import annotations - -import io -import logging -import os -import threading -import warnings -import weakref -from errno import ESPIPE -from glob import has_magic -from hashlib import sha256 -from typing import ClassVar - -from .callbacks import _DEFAULT_CALLBACK -from .config import apply_config, conf -from .dircache import DirCache -from .transaction import Transaction -from .utils import ( - _unstrip_protocol, - isfilelike, - other_paths, - read_block, - stringify_path, - tokenize, -) - -logger = logging.getLogger("fsspec") - - -def make_instance(cls, args, kwargs): - return cls(*args, **kwargs) - - -class _Cached(type): - """ - Metaclass for caching file system instances. - - Notes - ----- - Instances are cached according to - - * The values of the class attributes listed in `_extra_tokenize_attributes` - * The arguments passed to ``__init__``. - - This creates an additional reference to the filesystem, which prevents the - filesystem from being garbage collected when all *user* references go away. - A call to the :meth:`AbstractFileSystem.clear_instance_cache` must *also* - be made for a filesystem instance to be garbage collected. - """ - - def __init__(cls, *args, **kwargs): - super().__init__(*args, **kwargs) - # Note: we intentionally create a reference here, to avoid garbage - # collecting instances when all other references are gone. To really - # delete a FileSystem, the cache must be cleared. - if conf.get("weakref_instance_cache"): # pragma: no cover - # debug option for analysing fork/spawn conditions - cls._cache = weakref.WeakValueDictionary() - else: - cls._cache = {} - cls._pid = os.getpid() - - def __call__(cls, *args, **kwargs): - kwargs = apply_config(cls, kwargs) - extra_tokens = tuple( - getattr(cls, attr, None) for attr in cls._extra_tokenize_attributes - ) - token = tokenize( - cls, cls._pid, threading.get_ident(), *args, *extra_tokens, **kwargs - ) - skip = kwargs.pop("skip_instance_cache", False) - if os.getpid() != cls._pid: - cls._cache.clear() - cls._pid = os.getpid() - if not skip and cls.cachable and token in cls._cache: - cls._latest = token - return cls._cache[token] - else: - obj = super().__call__(*args, **kwargs) - # Setting _fs_token here causes some static linters to complain. - obj._fs_token_ = token - obj.storage_args = args - obj.storage_options = kwargs - if obj.async_impl and obj.mirror_sync_methods: - from .asyn import mirror_sync_methods - - mirror_sync_methods(obj) - - if cls.cachable and not skip: - cls._latest = token - cls._cache[token] = obj - return obj - - -class AbstractFileSystem(metaclass=_Cached): - """ - An abstract super-class for pythonic file-systems - - Implementations are expected to be compatible with or, better, subclass - from here. - """ - - cachable = True # this class can be cached, instances reused - _cached = False - blocksize = 2**22 - sep = "/" - protocol: ClassVar[str | tuple[str, ...]] = "abstract" - _latest = None - async_impl = False - mirror_sync_methods = False - root_marker = "" # For some FSs, may require leading '/' or other character - - #: Extra *class attributes* that should be considered when hashing. - _extra_tokenize_attributes = () - - def __init__(self, *args, **storage_options): - """Create and configure file-system instance - - Instances may be cachable, so if similar enough arguments are seen - a new instance is not required. The token attribute exists to allow - implementations to cache instances if they wish. - - A reasonable default should be provided if there are no arguments. - - Subclasses should call this method. - - Parameters - ---------- - use_listings_cache, listings_expiry_time, max_paths: - passed to ``DirCache``, if the implementation supports - directory listing caching. Pass use_listings_cache=False - to disable such caching. - skip_instance_cache: bool - If this is a cachable implementation, pass True here to force - creating a new instance even if a matching instance exists, and prevent - storing this instance. - asynchronous: bool - loop: asyncio-compatible IOLoop or None - """ - if self._cached: - # reusing instance, don't change - return - self._cached = True - self._intrans = False - self._transaction = None - self._invalidated_caches_in_transaction = [] - self.dircache = DirCache(**storage_options) - - if storage_options.pop("add_docs", None): - warnings.warn("add_docs is no longer supported.", FutureWarning) - - if storage_options.pop("add_aliases", None): - warnings.warn("add_aliases has been removed.", FutureWarning) - # This is set in _Cached - self._fs_token_ = None - - @property - def fsid(self): - """Persistent filesystem id that can be used to compare filesystems - across sessions. - """ - raise NotImplementedError - - @property - def _fs_token(self): - return self._fs_token_ - - def __dask_tokenize__(self): - return self._fs_token - - def __hash__(self): - return int(self._fs_token, 16) - - def __eq__(self, other): - return isinstance(other, type(self)) and self._fs_token == other._fs_token - - def __reduce__(self): - return make_instance, (type(self), self.storage_args, self.storage_options) - - @classmethod - def _strip_protocol(cls, path): - """Turn path from fully-qualified to file-system-specific - - May require FS-specific handling, e.g., for relative paths or links. - """ - if isinstance(path, list): - return [cls._strip_protocol(p) for p in path] - path = stringify_path(path) - protos = (cls.protocol,) if isinstance(cls.protocol, str) else cls.protocol - for protocol in protos: - if path.startswith(protocol + "://"): - path = path[len(protocol) + 3 :] - elif path.startswith(protocol + "::"): - path = path[len(protocol) + 2 :] - path = path.rstrip("/") - # use of root_marker to make minimum required path, e.g., "/" - return path or cls.root_marker - - def unstrip_protocol(self, name): - """Format FS-specific path to generic, including protocol""" - protos = (self.protocol,) if isinstance(self.protocol, str) else self.protocol - for protocol in protos: - if name.startswith(f"{protocol}://"): - return name - return f"{protos[0]}://{name}" - - @staticmethod - def _get_kwargs_from_urls(path): - """If kwargs can be encoded in the paths, extract them here - - This should happen before instantiation of the class; incoming paths - then should be amended to strip the options in methods. - - Examples may look like an sftp path "sftp://user@host:/my/path", where - the user and host should become kwargs and later get stripped. - """ - # by default, nothing happens - return {} - - @classmethod - def current(cls): - """Return the most recently instantiated FileSystem - - If no instance has been created, then create one with defaults - """ - if cls._latest in cls._cache: - return cls._cache[cls._latest] - return cls() - - @property - def transaction(self): - """A context within which files are committed together upon exit - - Requires the file class to implement `.commit()` and `.discard()` - for the normal and exception cases. - """ - if self._transaction is None: - self._transaction = Transaction(self) - return self._transaction - - def start_transaction(self): - """Begin write transaction for deferring files, non-context version""" - self._intrans = True - self._transaction = Transaction(self) - return self.transaction - - def end_transaction(self): - """Finish write transaction, non-context version""" - self.transaction.complete() - self._transaction = None - # The invalid cache must be cleared after the transcation is completed. - for path in self._invalidated_caches_in_transaction: - self.invalidate_cache(path) - self._invalidated_caches_in_transaction.clear() - - def invalidate_cache(self, path=None): - """ - Discard any cached directory information - - Parameters - ---------- - path: string or None - If None, clear all listings cached else listings at or under given - path. - """ - # Not necessary to implement invalidation mechanism, may have no cache. - # But if have, you should call this method of parent class from your - # subclass to ensure expiring caches after transacations correctly. - # See the implementation of FTPFileSystem in ftp.py - if self._intrans: - self._invalidated_caches_in_transaction.append(path) - - def mkdir(self, path, create_parents=True, **kwargs): - """ - Create directory entry at path - - For systems that don't have true directories, may create an for - this instance only and not touch the real filesystem - - Parameters - ---------- - path: str - location - create_parents: bool - if True, this is equivalent to ``makedirs`` - kwargs: - may be permissions, etc. - """ - pass # not necessary to implement, may not have directories - - def makedirs(self, path, exist_ok=False): - """Recursively make directories - - Creates directory at path and any intervening required directories. - Raises exception if, for instance, the path already exists but is a - file. - - Parameters - ---------- - path: str - leaf directory name - exist_ok: bool (False) - If False, will error if the target already exists - """ - pass # not necessary to implement, may not have directories - - def rmdir(self, path): - """Remove a directory, if empty""" - pass # not necessary to implement, may not have directories - - def ls(self, path, detail=True, **kwargs): - """List objects at path. - - This should include subdirectories and files at that location. The - difference between a file and a directory must be clear when details - are requested. - - The specific keys, or perhaps a FileInfo class, or similar, is TBD, - but must be consistent across implementations. - Must include: - - - full path to the entry (without protocol) - - size of the entry, in bytes. If the value cannot be determined, will - be ``None``. - - type of entry, "file", "directory" or other - - Additional information - may be present, appropriate to the file-system, e.g., generation, - checksum, etc. - - May use refresh=True|False to allow use of self._ls_from_cache to - check for a saved listing and avoid calling the backend. This would be - common where listing may be expensive. - - Parameters - ---------- - path: str - detail: bool - if True, gives a list of dictionaries, where each is the same as - the result of ``info(path)``. If False, gives a list of paths - (str). - kwargs: may have additional backend-specific options, such as version - information - - Returns - ------- - List of strings if detail is False, or list of directory information - dicts if detail is True. - """ - raise NotImplementedError - - def _ls_from_cache(self, path): - """Check cache for listing - - Returns listing, if found (may be empty list for a directly that exists - but contains nothing), None if not in cache. - """ - parent = self._parent(path) - if path.rstrip("/") in self.dircache: - return self.dircache[path.rstrip("/")] - try: - files = [ - f - for f in self.dircache[parent] - if f["name"] == path - or (f["name"] == path.rstrip("/") and f["type"] == "directory") - ] - if len(files) == 0: - # parent dir was listed but did not contain this file - raise FileNotFoundError(path) - return files - except KeyError: - pass - - def walk(self, path, maxdepth=None, topdown=True, on_error="omit", **kwargs): - """Return all files belows path - - List all files, recursing into subdirectories; output is iterator-style, - like ``os.walk()``. For a simple list of files, ``find()`` is available. - - When topdown is True, the caller can modify the dirnames list in-place (perhaps - using del or slice assignment), and walk() will - only recurse into the subdirectories whose names remain in dirnames; - this can be used to prune the search, impose a specific order of visiting, - or even to inform walk() about directories the caller creates or renames before - it resumes walk() again. - Modifying dirnames when topdown is False has no effect. (see os.walk) - - Note that the "files" outputted will include anything that is not - a directory, such as links. - - Parameters - ---------- - path: str - Root to recurse into - maxdepth: int - Maximum recursion depth. None means limitless, but not recommended - on link-based file-systems. - topdown: bool (True) - Whether to walk the directory tree from the top downwards or from - the bottom upwards. - on_error: "omit", "raise", a collable - if omit (default), path with exception will simply be empty; - If raise, an underlying exception will be raised; - if callable, it will be called with a single OSError instance as argument - kwargs: passed to ``ls`` - """ - if maxdepth is not None and maxdepth < 1: - raise ValueError("maxdepth must be at least 1") - - path = self._strip_protocol(path) - full_dirs = {} - dirs = {} - files = {} - - detail = kwargs.pop("detail", False) - try: - listing = self.ls(path, detail=True, **kwargs) - except (FileNotFoundError, OSError) as e: - if on_error == "raise": - raise - elif callable(on_error): - on_error(e) - if detail: - return path, {}, {} - return path, [], [] - - for info in listing: - # each info name must be at least [path]/part , but here - # we check also for names like [path]/part/ - pathname = info["name"].rstrip("/") - name = pathname.rsplit("/", 1)[-1] - if info["type"] == "directory" and pathname != path: - # do not include "self" path - full_dirs[name] = pathname - dirs[name] = info - elif pathname == path: - # file-like with same name as give path - files[""] = info - else: - files[name] = info - - if not detail: - dirs = list(dirs) - files = list(files) - - if topdown: - # Yield before recursion if walking top down - yield path, dirs, files - - if maxdepth is not None: - maxdepth -= 1 - if maxdepth < 1: - if not topdown: - yield path, dirs, files - return - - for d in dirs: - yield from self.walk( - full_dirs[d], - maxdepth=maxdepth, - detail=detail, - topdown=topdown, - **kwargs, - ) - - if not topdown: - # Yield after recursion if walking bottom up - yield path, dirs, files - - def find(self, path, maxdepth=None, withdirs=False, detail=False, **kwargs): - """List all files below path. - - Like posix ``find`` command without conditions - - Parameters - ---------- - path : str - maxdepth: int or None - If not None, the maximum number of levels to descend - withdirs: bool - Whether to include directory paths in the output. This is True - when used by glob, but users usually only want files. - kwargs are passed to ``ls``. - """ - # TODO: allow equivalent of -name parameter - path = self._strip_protocol(path) - out = {} - - # Add the root directory if withdirs is requested - # This is needed for posix glob compliance - if withdirs and path != "" and self.isdir(path): - out[path] = self.info(path) - - for _, dirs, files in self.walk(path, maxdepth, detail=True, **kwargs): - if withdirs: - files.update(dirs) - out.update({info["name"]: info for name, info in files.items()}) - if not out and self.isfile(path): - # walk works on directories, but find should also return [path] - # when path happens to be a file - out[path] = {} - names = sorted(out) - if not detail: - return names - else: - return {name: out[name] for name in names} - - def du(self, path, total=True, maxdepth=None, withdirs=False, **kwargs): - """Space used by files and optionally directories within a path - - Directory size does not include the size of its contents. - - Parameters - ---------- - path: str - total: bool - Whether to sum all the file sizes - maxdepth: int or None - Maximum number of directory levels to descend, None for unlimited. - withdirs: bool - Whether to include directory paths in the output. - kwargs: passed to ``find`` - - Returns - ------- - Dict of {path: size} if total=False, or int otherwise, where numbers - refer to bytes used. - """ - sizes = {} - if withdirs and self.isdir(path): - # Include top-level directory in output - info = self.info(path) - sizes[info["name"]] = info["size"] - for f in self.find(path, maxdepth=maxdepth, withdirs=withdirs, **kwargs): - info = self.info(f) - sizes[info["name"]] = info["size"] - if total: - return sum(sizes.values()) - else: - return sizes - - def glob(self, path, maxdepth=None, **kwargs): - """ - Find files by glob-matching. - - If the path ends with '/', only folders are returned. - - We support ``"**"``, - ``"?"`` and ``"[..]"``. We do not support ^ for pattern negation. - - The `maxdepth` option is applied on the first `**` found in the path. - - Search path names that contain embedded characters special to this - implementation of glob may not produce expected results; - e.g., 'foo/bar/*starredfilename*'. - - kwargs are passed to ``ls``. - """ - if maxdepth is not None and maxdepth < 1: - raise ValueError("maxdepth must be at least 1") - - import re - - ends = path.endswith("/") - path = self._strip_protocol(path) - idx_star = path.find("*") if path.find("*") >= 0 else len(path) - idx_qmark = path.find("?") if path.find("?") >= 0 else len(path) - idx_brace = path.find("[") if path.find("[") >= 0 else len(path) - - min_idx = min(idx_star, idx_qmark, idx_brace) - - detail = kwargs.pop("detail", False) - - if not has_magic(path): - if self.exists(path): - if not detail: - return [path] - else: - return {path: self.info(path)} - else: - if not detail: - return [] # glob of non-existent returns empty - else: - return {} - elif "/" in path[:min_idx]: - min_idx = path[:min_idx].rindex("/") - root = path[: min_idx + 1] - depth = path[min_idx + 1 :].count("/") + 1 - else: - root = "" - depth = path[min_idx + 1 :].count("/") + 1 - - if "**" in path: - if maxdepth is not None: - idx_double_stars = path.find("**") - depth_double_stars = path[idx_double_stars:].count("/") + 1 - depth = depth - depth_double_stars + maxdepth - else: - depth = None - - allpaths = self.find(root, maxdepth=depth, withdirs=True, detail=True, **kwargs) - # Escape characters special to python regex, leaving our supported - # special characters in place. - # See https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html - # for shell globbing details. - pattern = ( - "^" - + ( - path.replace("\\", r"\\") - .replace(".", r"\.") - .replace("+", r"\+") - .replace("//", "/") - .replace("(", r"\(") - .replace(")", r"\)") - .replace("|", r"\|") - .replace("^", r"\^") - .replace("$", r"\$") - .replace("{", r"\{") - .replace("}", r"\}") - .rstrip("/") - .replace("?", ".") - ) - + "$" - ) - pattern = re.sub("/[*]{2}", "=SLASH_DOUBLE_STARS=", pattern) - pattern = re.sub("[*]{2}/?", "=DOUBLE_STARS=", pattern) - pattern = re.sub("[*]", "[^/]*", pattern) - pattern = re.sub("=SLASH_DOUBLE_STARS=", "(|/.*)", pattern) - pattern = re.sub("=DOUBLE_STARS=", ".*", pattern) - pattern = re.compile(pattern) - - out = { - p: allpaths[p] - for p in sorted(allpaths) - if pattern.match(p.replace("//", "/").rstrip("/")) - } - - # Return directories only when the glob end by a slash - # This is needed for posix glob compliance - if ends: - out = {k: v for k, v in out.items() if v["type"] == "directory"} - - if detail: - return out - else: - return list(out) - - def exists(self, path, **kwargs): - """Is there a file at the given path""" - try: - self.info(path, **kwargs) - return True - except: # noqa: E722 - # any exception allowed bar FileNotFoundError? - return False - - def lexists(self, path, **kwargs): - """If there is a file at the given path (including - broken links)""" - return self.exists(path) - - def info(self, path, **kwargs): - """Give details of entry at path - - Returns a single dictionary, with exactly the same information as ``ls`` - would with ``detail=True``. - - The default implementation should calls ls and could be overridden by a - shortcut. kwargs are passed on to ```ls()``. - - Some file systems might not be able to measure the file's size, in - which case, the returned dict will include ``'size': None``. - - Returns - ------- - dict with keys: name (full path in the FS), size (in bytes), type (file, - directory, or something else) and other FS-specific keys. - """ - path = self._strip_protocol(path) - out = self.ls(self._parent(path), detail=True, **kwargs) - out = [o for o in out if o["name"].rstrip("/") == path] - if out: - return out[0] - out = self.ls(path, detail=True, **kwargs) - path = path.rstrip("/") - out1 = [o for o in out if o["name"].rstrip("/") == path] - if len(out1) == 1: - if "size" not in out1[0]: - out1[0]["size"] = None - return out1[0] - elif len(out1) > 1 or out: - return {"name": path, "size": 0, "type": "directory"} - else: - raise FileNotFoundError(path) - - def checksum(self, path): - """Unique value for current version of file - - If the checksum is the same from one moment to another, the contents - are guaranteed to be the same. If the checksum changes, the contents - *might* have changed. - - This should normally be overridden; default will probably capture - creation/modification timestamp (which would be good) or maybe - access timestamp (which would be bad) - """ - return int(tokenize(self.info(path)), 16) - - def size(self, path): - """Size in bytes of file""" - return self.info(path).get("size", None) - - def sizes(self, paths): - """Size in bytes of each file in a list of paths""" - return [self.size(p) for p in paths] - - def isdir(self, path): - """Is this entry directory-like?""" - try: - return self.info(path)["type"] == "directory" - except OSError: - return False - - def isfile(self, path): - """Is this entry file-like?""" - try: - return self.info(path)["type"] == "file" - except: # noqa: E722 - return False - - def read_text(self, path, encoding=None, errors=None, newline=None, **kwargs): - """Get the contents of the file as a string. - - Parameters - ---------- - path: str - URL of file on this filesystems - encoding, errors, newline: same as `open`. - """ - with self.open( - path, - mode="r", - encoding=encoding, - errors=errors, - newline=newline, - **kwargs, - ) as f: - return f.read() - - def write_text( - self, path, value, encoding=None, errors=None, newline=None, **kwargs - ): - """Write the text to the given file. - - An existing file will be overwritten. - - Parameters - ---------- - path: str - URL of file on this filesystems - value: str - Text to write. - encoding, errors, newline: same as `open`. - """ - with self.open( - path, - mode="w", - encoding=encoding, - errors=errors, - newline=newline, - **kwargs, - ) as f: - return f.write(value) - - def cat_file(self, path, start=None, end=None, **kwargs): - """Get the content of a file - - Parameters - ---------- - path: URL of file on this filesystems - start, end: int - Bytes limits of the read. If negative, backwards from end, - like usual python slices. Either can be None for start or - end of file, respectively - kwargs: passed to ``open()``. - """ - # explicitly set buffering off? - with self.open(path, "rb", **kwargs) as f: - if start is not None: - if start >= 0: - f.seek(start) - else: - f.seek(max(0, f.size + start)) - if end is not None: - if end < 0: - end = f.size + end - return f.read(end - f.tell()) - return f.read() - - def pipe_file(self, path, value, **kwargs): - """Set the bytes of given file""" - with self.open(path, "wb", **kwargs) as f: - f.write(value) - - def pipe(self, path, value=None, **kwargs): - """Put value into path - - (counterpart to ``cat``) - - Parameters - ---------- - path: string or dict(str, bytes) - If a string, a single remote location to put ``value`` bytes; if a dict, - a mapping of {path: bytesvalue}. - value: bytes, optional - If using a single path, these are the bytes to put there. Ignored if - ``path`` is a dict - """ - if isinstance(path, str): - self.pipe_file(self._strip_protocol(path), value, **kwargs) - elif isinstance(path, dict): - for k, v in path.items(): - self.pipe_file(self._strip_protocol(k), v, **kwargs) - else: - raise ValueError("path must be str or dict") - - def cat_ranges( - self, paths, starts, ends, max_gap=None, on_error="return", **kwargs - ): - if max_gap is not None: - raise NotImplementedError - if not isinstance(paths, list): - raise TypeError - if not isinstance(starts, list): - starts = [starts] * len(paths) - if not isinstance(ends, list): - ends = [starts] * len(paths) - if len(starts) != len(paths) or len(ends) != len(paths): - raise ValueError - out = [] - for p, s, e in zip(paths, starts, ends): - try: - out.append(self.cat_file(p, s, e)) - except Exception as e: - if on_error == "return": - out.append(e) - else: - raise - return out - - def cat(self, path, recursive=False, on_error="raise", **kwargs): - """Fetch (potentially multiple) paths' contents - - Parameters - ---------- - recursive: bool - If True, assume the path(s) are directories, and get all the - contained files - on_error : "raise", "omit", "return" - If raise, an underlying exception will be raised (converted to KeyError - if the type is in self.missing_exceptions); if omit, keys with exception - will simply not be included in the output; if "return", all keys are - included in the output, but the value will be bytes or an exception - instance. - kwargs: passed to cat_file - - Returns - ------- - dict of {path: contents} if there are multiple paths - or the path has been otherwise expanded - """ - paths = self.expand_path(path, recursive=recursive) - if ( - len(paths) > 1 - or isinstance(path, list) - or paths[0] != self._strip_protocol(path) - ): - out = {} - for path in paths: - try: - out[path] = self.cat_file(path, **kwargs) - except Exception as e: - if on_error == "raise": - raise - if on_error == "return": - out[path] = e - return out - else: - return self.cat_file(paths[0], **kwargs) - - def get_file( - self, rpath, lpath, callback=_DEFAULT_CALLBACK, outfile=None, **kwargs - ): - """Copy single remote file to local""" - from .implementations.local import LocalFileSystem - - if isfilelike(lpath): - outfile = lpath - elif self.isdir(rpath): - os.makedirs(lpath, exist_ok=True) - return None - - LocalFileSystem(auto_mkdir=True).makedirs(self._parent(lpath), exist_ok=True) - - with self.open(rpath, "rb", **kwargs) as f1: - if outfile is None: - outfile = open(lpath, "wb") - - try: - callback.set_size(getattr(f1, "size", None)) - data = True - while data: - data = f1.read(self.blocksize) - segment_len = outfile.write(data) - if segment_len is None: - segment_len = len(data) - callback.relative_update(segment_len) - finally: - if not isfilelike(lpath): - outfile.close() - - def get( - self, - rpath, - lpath, - recursive=False, - callback=_DEFAULT_CALLBACK, - maxdepth=None, - **kwargs, - ): - """Copy file(s) to local. - - Copies a specific file or tree of files (if recursive=True). If lpath - ends with a "/", it will be assumed to be a directory, and target files - will go within. Can submit a list of paths, which may be glob-patterns - and will be expanded. - - Calls get_file for each source. - """ - if isinstance(lpath, list) and isinstance(rpath, list): - # No need to expand paths when both source and destination - # are provided as lists - rpaths = rpath - lpaths = lpath - else: - from .implementations.local import ( - LocalFileSystem, - make_path_posix, - trailing_sep, - ) - - source_is_str = isinstance(rpath, str) - rpaths = self.expand_path(rpath, recursive=recursive, maxdepth=maxdepth) - if source_is_str and (not recursive or maxdepth is not None): - # Non-recursive glob does not copy directories - rpaths = [p for p in rpaths if not (trailing_sep(p) or self.isdir(p))] - if not rpaths: - return - - if isinstance(lpath, str): - lpath = make_path_posix(lpath) - - source_is_file = len(rpaths) == 1 - dest_is_dir = isinstance(lpath, str) and ( - trailing_sep(lpath) or LocalFileSystem().isdir(lpath) - ) - - exists = source_is_str and ( - (has_magic(rpath) and source_is_file) - or (not has_magic(rpath) and dest_is_dir and not trailing_sep(rpath)) - ) - lpaths = other_paths( - rpaths, - lpath, - exists=exists, - flatten=not source_is_str, - ) - - callback.set_size(len(lpaths)) - for lpath, rpath in callback.wrap(zip(lpaths, rpaths)): - callback.branch(rpath, lpath, kwargs) - self.get_file(rpath, lpath, **kwargs) - - def put_file(self, lpath, rpath, callback=_DEFAULT_CALLBACK, **kwargs): - """Copy single file to remote""" - if os.path.isdir(lpath): - self.makedirs(rpath, exist_ok=True) - return None - - with open(lpath, "rb") as f1: - size = f1.seek(0, 2) - callback.set_size(size) - f1.seek(0) - - self.mkdirs(self._parent(os.fspath(rpath)), exist_ok=True) - with self.open(rpath, "wb", **kwargs) as f2: - while f1.tell() < size: - data = f1.read(self.blocksize) - segment_len = f2.write(data) - if segment_len is None: - segment_len = len(data) - callback.relative_update(segment_len) - - def put( - self, - lpath, - rpath, - recursive=False, - callback=_DEFAULT_CALLBACK, - maxdepth=None, - **kwargs, - ): - """Copy file(s) from local. - - Copies a specific file or tree of files (if recursive=True). If rpath - ends with a "/", it will be assumed to be a directory, and target files - will go within. - - Calls put_file for each source. - """ - if isinstance(lpath, list) and isinstance(rpath, list): - # No need to expand paths when both source and destination - # are provided as lists - rpaths = rpath - lpaths = lpath - else: - from .implementations.local import ( - LocalFileSystem, - make_path_posix, - trailing_sep, - ) - - source_is_str = isinstance(lpath, str) - if source_is_str: - lpath = make_path_posix(lpath) - fs = LocalFileSystem() - lpaths = fs.expand_path(lpath, recursive=recursive, maxdepth=maxdepth) - if source_is_str and (not recursive or maxdepth is not None): - # Non-recursive glob does not copy directories - lpaths = [p for p in lpaths if not (trailing_sep(p) or fs.isdir(p))] - if not lpaths: - return - - source_is_file = len(lpaths) == 1 - dest_is_dir = isinstance(rpath, str) and ( - trailing_sep(rpath) or self.isdir(rpath) - ) - - rpath = ( - self._strip_protocol(rpath) - if isinstance(rpath, str) - else [self._strip_protocol(p) for p in rpath] - ) - exists = source_is_str and ( - (has_magic(lpath) and source_is_file) - or (not has_magic(lpath) and dest_is_dir and not trailing_sep(lpath)) - ) - rpaths = other_paths( - lpaths, - rpath, - exists=exists, - flatten=not source_is_str, - ) - - callback.set_size(len(rpaths)) - for lpath, rpath in callback.wrap(zip(lpaths, rpaths)): - callback.branch(lpath, rpath, kwargs) - self.put_file(lpath, rpath, **kwargs) - - def head(self, path, size=1024): - """Get the first ``size`` bytes from file""" - with self.open(path, "rb") as f: - return f.read(size) - - def tail(self, path, size=1024): - """Get the last ``size`` bytes from file""" - with self.open(path, "rb") as f: - f.seek(max(-size, -f.size), 2) - return f.read() - - def cp_file(self, path1, path2, **kwargs): - raise NotImplementedError - - def copy( - self, path1, path2, recursive=False, maxdepth=None, on_error=None, **kwargs - ): - """Copy within two locations in the filesystem - - on_error : "raise", "ignore" - If raise, any not-found exceptions will be raised; if ignore any - not-found exceptions will cause the path to be skipped; defaults to - raise unless recursive is true, where the default is ignore - """ - if on_error is None and recursive: - on_error = "ignore" - elif on_error is None: - on_error = "raise" - - if isinstance(path1, list) and isinstance(path2, list): - # No need to expand paths when both source and destination - # are provided as lists - paths1 = path1 - paths2 = path2 - else: - from .implementations.local import trailing_sep - - source_is_str = isinstance(path1, str) - paths1 = self.expand_path(path1, recursive=recursive, maxdepth=maxdepth) - if source_is_str and (not recursive or maxdepth is not None): - # Non-recursive glob does not copy directories - paths1 = [p for p in paths1 if not (trailing_sep(p) or self.isdir(p))] - if not paths1: - return - - source_is_file = len(paths1) == 1 - dest_is_dir = isinstance(path2, str) and ( - trailing_sep(path2) or self.isdir(path2) - ) - - exists = source_is_str and ( - (has_magic(path1) and source_is_file) - or (not has_magic(path1) and dest_is_dir and not trailing_sep(path1)) - ) - paths2 = other_paths( - paths1, - path2, - exists=exists, - flatten=not source_is_str, - ) - - for p1, p2 in zip(paths1, paths2): - try: - self.cp_file(p1, p2, **kwargs) - except FileNotFoundError: - if on_error == "raise": - raise - - def expand_path(self, path, recursive=False, maxdepth=None, **kwargs): - """Turn one or more globs or directories into a list of all matching paths - to files or directories. - - kwargs are passed to ``glob`` or ``find``, which may in turn call ``ls`` - """ - - if maxdepth is not None and maxdepth < 1: - raise ValueError("maxdepth must be at least 1") - - if isinstance(path, str): - out = self.expand_path([path], recursive, maxdepth) - else: - out = set() - path = [self._strip_protocol(p) for p in path] - for p in path: - if has_magic(p): - bit = set(self.glob(p, maxdepth=maxdepth, **kwargs)) - out |= bit - if recursive: - # glob call above expanded one depth so if maxdepth is defined - # then decrement it in expand_path call below. If it is zero - # after decrementing then avoid expand_path call. - if maxdepth is not None and maxdepth <= 1: - continue - out |= set( - self.expand_path( - list(bit), - recursive=recursive, - maxdepth=maxdepth - 1 if maxdepth is not None else None, - **kwargs, - ) - ) - continue - elif recursive: - rec = set( - self.find( - p, maxdepth=maxdepth, withdirs=True, detail=False, **kwargs - ) - ) - out |= rec - if p not in out and (recursive is False or self.exists(p)): - # should only check once, for the root - out.add(p) - if not out: - raise FileNotFoundError(path) - return sorted(out) - - def mv(self, path1, path2, recursive=False, maxdepth=None, **kwargs): - """Move file(s) from one location to another""" - if path1 == path2: - logger.debug( - "%s mv: The paths are the same, so no files were moved." % (self) - ) - else: - self.copy(path1, path2, recursive=recursive, maxdepth=maxdepth) - self.rm(path1, recursive=recursive) - - def rm_file(self, path): - """Delete a file""" - self._rm(path) - - def _rm(self, path): - """Delete one file""" - # this is the old name for the method, prefer rm_file - raise NotImplementedError - - def rm(self, path, recursive=False, maxdepth=None): - """Delete files. - - Parameters - ---------- - path: str or list of str - File(s) to delete. - recursive: bool - If file(s) are directories, recursively delete contents and then - also remove the directory - maxdepth: int or None - Depth to pass to walk for finding files to delete, if recursive. - If None, there will be no limit and infinite recursion may be - possible. - """ - path = self.expand_path(path, recursive=recursive, maxdepth=maxdepth) - for p in reversed(path): - self.rm_file(p) - - @classmethod - def _parent(cls, path): - path = cls._strip_protocol(path) - if "/" in path: - parent = path.rsplit("/", 1)[0].lstrip(cls.root_marker) - return cls.root_marker + parent - else: - return cls.root_marker - - def _open( - self, - path, - mode="rb", - block_size=None, - autocommit=True, - cache_options=None, - **kwargs, - ): - """Return raw bytes-mode file-like from the file-system""" - return AbstractBufferedFile( - self, - path, - mode, - block_size, - autocommit, - cache_options=cache_options, - **kwargs, - ) - - def open( - self, - path, - mode="rb", - block_size=None, - cache_options=None, - compression=None, - **kwargs, - ): - """ - Return a file-like object from the filesystem - - The resultant instance must function correctly in a context ``with`` - block. - - Parameters - ---------- - path: str - Target file - mode: str like 'rb', 'w' - See builtin ``open()`` - block_size: int - Some indication of buffering - this is a value in bytes - cache_options : dict, optional - Extra arguments to pass through to the cache. - compression: string or None - If given, open file using compression codec. Can either be a compression - name (a key in ``fsspec.compression.compr``) or "infer" to guess the - compression from the filename suffix. - encoding, errors, newline: passed on to TextIOWrapper for text mode - """ - import io - - path = self._strip_protocol(path) - if "b" not in mode: - mode = mode.replace("t", "") + "b" - - text_kwargs = { - k: kwargs.pop(k) - for k in ["encoding", "errors", "newline"] - if k in kwargs - } - return io.TextIOWrapper( - self.open( - path, - mode, - block_size=block_size, - cache_options=cache_options, - compression=compression, - **kwargs, - ), - **text_kwargs, - ) - else: - ac = kwargs.pop("autocommit", not self._intrans) - f = self._open( - path, - mode=mode, - block_size=block_size, - autocommit=ac, - cache_options=cache_options, - **kwargs, - ) - if compression is not None: - from fsspec.compression import compr - from fsspec.core import get_compression - - compression = get_compression(path, compression) - compress = compr[compression] - f = compress(f, mode=mode[0]) - - if not ac and "r" not in mode: - self.transaction.files.append(f) - return f - - def touch(self, path, truncate=True, **kwargs): - """Create empty file, or update timestamp - - Parameters - ---------- - path: str - file location - truncate: bool - If True, always set file size to 0; if False, update timestamp and - leave file unchanged, if backend allows this - """ - if truncate or not self.exists(path): - with self.open(path, "wb", **kwargs): - pass - else: - raise NotImplementedError # update timestamp, if possible - - def ukey(self, path): - """Hash of file properties, to tell if it has changed""" - return sha256(str(self.info(path)).encode()).hexdigest() - - def read_block(self, fn, offset, length, delimiter=None): - """Read a block of bytes from - - Starting at ``offset`` of the file, read ``length`` bytes. If - ``delimiter`` is set then we ensure that the read starts and stops at - delimiter boundaries that follow the locations ``offset`` and ``offset - + length``. If ``offset`` is zero then we start at zero. The - bytestring returned WILL include the end delimiter string. - - If offset+length is beyond the eof, reads to eof. - - Parameters - ---------- - fn: string - Path to filename - offset: int - Byte offset to start read - length: int - Number of bytes to read. If None, read to end. - delimiter: bytes (optional) - Ensure reading starts and stops at delimiter bytestring - - Examples - -------- - >>> fs.read_block('data/file.csv', 0, 13) # doctest: +SKIP - b'Alice, 100\\nBo' - >>> fs.read_block('data/file.csv', 0, 13, delimiter=b'\\n') # doctest: +SKIP - b'Alice, 100\\nBob, 200\\n' - - Use ``length=None`` to read to the end of the file. - >>> fs.read_block('data/file.csv', 0, None, delimiter=b'\\n') # doctest: +SKIP - b'Alice, 100\\nBob, 200\\nCharlie, 300' - - See Also - -------- - :func:`fsspec.utils.read_block` - """ - with self.open(fn, "rb") as f: - size = f.size - if length is None: - length = size - if size is not None and offset + length > size: - length = size - offset - return read_block(f, offset, length, delimiter) - - def to_json(self): - """ - JSON representation of this filesystem instance - - Returns - ------- - str: JSON structure with keys cls (the python location of this class), - protocol (text name of this class's protocol, first one in case of - multiple), args (positional args, usually empty), and all other - kwargs as their own keys. - """ - import json - - cls = type(self) - cls = ".".join((cls.__module__, cls.__name__)) - proto = ( - self.protocol[0] - if isinstance(self.protocol, (tuple, list)) - else self.protocol - ) - return json.dumps( - dict( - **{"cls": cls, "protocol": proto, "args": self.storage_args}, - **self.storage_options, - ) - ) - - @staticmethod - def from_json(blob): - """ - Recreate a filesystem instance from JSON representation - - See ``.to_json()`` for the expected structure of the input - - Parameters - ---------- - blob: str - - Returns - ------- - file system instance, not necessarily of this particular class. - """ - import json - - from .registry import _import_class, get_filesystem_class - - dic = json.loads(blob) - protocol = dic.pop("protocol") - try: - cls = _import_class(dic.pop("cls")) - except (ImportError, ValueError, RuntimeError, KeyError): - cls = get_filesystem_class(protocol) - return cls(*dic.pop("args", ()), **dic) - - def _get_pyarrow_filesystem(self): - """ - Make a version of the FS instance which will be acceptable to pyarrow - """ - # all instances already also derive from pyarrow - return self - - def get_mapper(self, root="", check=False, create=False, missing_exceptions=None): - """Create key/value store based on this file-system - - Makes a MutableMapping interface to the FS at the given root path. - See ``fsspec.mapping.FSMap`` for further details. - """ - from .mapping import FSMap - - return FSMap( - root, - self, - check=check, - create=create, - missing_exceptions=missing_exceptions, - ) - - @classmethod - def clear_instance_cache(cls): - """ - Clear the cache of filesystem instances. - - Notes - ----- - Unless overridden by setting the ``cachable`` class attribute to False, - the filesystem class stores a reference to newly created instances. This - prevents Python's normal rules around garbage collection from working, - since the instances refcount will not drop to zero until - ``clear_instance_cache`` is called. - """ - cls._cache.clear() - - def created(self, path): - """Return the created timestamp of a file as a datetime.datetime""" - raise NotImplementedError - - def modified(self, path): - """Return the modified timestamp of a file as a datetime.datetime""" - raise NotImplementedError - - # ------------------------------------------------------------------------ - # Aliases - - def read_bytes(self, path, start=None, end=None, **kwargs): - """Alias of `AbstractFileSystem.cat_file`.""" - return self.cat_file(path, start=start, end=end, **kwargs) - - def write_bytes(self, path, value, **kwargs): - """Alias of `AbstractFileSystem.pipe_file`.""" - self.pipe_file(path, value, **kwargs) - - def makedir(self, path, create_parents=True, **kwargs): - """Alias of `AbstractFileSystem.mkdir`.""" - return self.mkdir(path, create_parents=create_parents, **kwargs) - - def mkdirs(self, path, exist_ok=False): - """Alias of `AbstractFileSystem.makedirs`.""" - return self.makedirs(path, exist_ok=exist_ok) - - def listdir(self, path, detail=True, **kwargs): - """Alias of `AbstractFileSystem.ls`.""" - return self.ls(path, detail=detail, **kwargs) - - def cp(self, path1, path2, **kwargs): - """Alias of `AbstractFileSystem.copy`.""" - return self.copy(path1, path2, **kwargs) - - def move(self, path1, path2, **kwargs): - """Alias of `AbstractFileSystem.mv`.""" - return self.mv(path1, path2, **kwargs) - - def stat(self, path, **kwargs): - """Alias of `AbstractFileSystem.info`.""" - return self.info(path, **kwargs) - - def disk_usage(self, path, total=True, maxdepth=None, **kwargs): - """Alias of `AbstractFileSystem.du`.""" - return self.du(path, total=total, maxdepth=maxdepth, **kwargs) - - def rename(self, path1, path2, **kwargs): - """Alias of `AbstractFileSystem.mv`.""" - return self.mv(path1, path2, **kwargs) - - def delete(self, path, recursive=False, maxdepth=None): - """Alias of `AbstractFileSystem.rm`.""" - return self.rm(path, recursive=recursive, maxdepth=maxdepth) - - def upload(self, lpath, rpath, recursive=False, **kwargs): - """Alias of `AbstractFileSystem.put`.""" - return self.put(lpath, rpath, recursive=recursive, **kwargs) - - def download(self, rpath, lpath, recursive=False, **kwargs): - """Alias of `AbstractFileSystem.get`.""" - return self.get(rpath, lpath, recursive=recursive, **kwargs) - - def sign(self, path, expiration=100, **kwargs): - """Create a signed URL representing the given path - - Some implementations allow temporary URLs to be generated, as a - way of delegating credentials. - - Parameters - ---------- - path : str - The path on the filesystem - expiration : int - Number of seconds to enable the URL for (if supported) - - Returns - ------- - URL : str - The signed URL - - Raises - ------ - NotImplementedError : if method is not implemented for a filesystem - """ - raise NotImplementedError("Sign is not implemented for this filesystem") - - def _isfilestore(self): - # Originally inherited from pyarrow DaskFileSystem. Keeping this - # here for backwards compatibility as long as pyarrow uses its - # legacy fsspec-compatible filesystems and thus accepts fsspec - # filesystems as well - return False - - -class AbstractBufferedFile(io.IOBase): - """Convenient class to derive from to provide buffering - - In the case that the backend does not provide a pythonic file-like object - already, this class contains much of the logic to build one. The only - methods that need to be overridden are ``_upload_chunk``, - ``_initiate_upload`` and ``_fetch_range``. - """ - - DEFAULT_BLOCK_SIZE = 5 * 2**20 - _details = None - - def __init__( - self, - fs, - path, - mode="rb", - block_size="default", - autocommit=True, - cache_type="readahead", - cache_options=None, - size=None, - **kwargs, - ): - """ - Template for files with buffered reading and writing - - Parameters - ---------- - fs: instance of FileSystem - path: str - location in file-system - mode: str - Normal file modes. Currently only 'wb', 'ab' or 'rb'. Some file - systems may be read-only, and some may not support append. - block_size: int - Buffer size for reading or writing, 'default' for class default - autocommit: bool - Whether to write to final destination; may only impact what - happens when file is being closed. - cache_type: {"readahead", "none", "mmap", "bytes"}, default "readahead" - Caching policy in read mode. See the definitions in ``core``. - cache_options : dict - Additional options passed to the constructor for the cache specified - by `cache_type`. - size: int - If given and in read mode, suppressed having to look up the file size - kwargs: - Gets stored as self.kwargs - """ - from .core import caches - - self.path = path - self.fs = fs - self.mode = mode - self.blocksize = ( - self.DEFAULT_BLOCK_SIZE if block_size in ["default", None] else block_size - ) - self.loc = 0 - self.autocommit = autocommit - self.end = None - self.start = None - self.closed = False - - if cache_options is None: - cache_options = {} - - if "trim" in kwargs: - warnings.warn( - "Passing 'trim' to control the cache behavior has been deprecated. " - "Specify it within the 'cache_options' argument instead.", - FutureWarning, - ) - cache_options["trim"] = kwargs.pop("trim") - - self.kwargs = kwargs - - if mode not in {"ab", "rb", "wb"}: - raise NotImplementedError("File mode not supported") - if mode == "rb": - if size is not None: - self.size = size - else: - self.size = self.details["size"] - self.cache = caches[cache_type]( - self.blocksize, self._fetch_range, self.size, **cache_options - ) - else: - self.buffer = io.BytesIO() - self.offset = None - self.forced = False - self.location = None - - @property - def details(self): - if self._details is None: - self._details = self.fs.info(self.path) - return self._details - - @details.setter - def details(self, value): - self._details = value - self.size = value["size"] - - @property - def full_name(self): - return _unstrip_protocol(self.path, self.fs) - - @property - def closed(self): - # get around this attr being read-only in IOBase - # use getattr here, since this can be called during del - return getattr(self, "_closed", True) - - @closed.setter - def closed(self, c): - self._closed = c - - def __hash__(self): - if "w" in self.mode: - return id(self) - else: - return int(tokenize(self.details), 16) - - def __eq__(self, other): - """Files are equal if they have the same checksum, only in read mode""" - return self.mode == "rb" and other.mode == "rb" and hash(self) == hash(other) - - def commit(self): - """Move from temp to final destination""" - - def discard(self): - """Throw away temporary file""" - - def info(self): - """File information about this path""" - if "r" in self.mode: - return self.details - else: - raise ValueError("Info not available while writing") - - def tell(self): - """Current file location""" - return self.loc - - def seek(self, loc, whence=0): - """Set current file location - - Parameters - ---------- - loc: int - byte location - whence: {0, 1, 2} - from start of file, current location or end of file, resp. - """ - loc = int(loc) - if not self.mode == "rb": - raise OSError(ESPIPE, "Seek only available in read mode") - if whence == 0: - nloc = loc - elif whence == 1: - nloc = self.loc + loc - elif whence == 2: - nloc = self.size + loc - else: - raise ValueError("invalid whence (%s, should be 0, 1 or 2)" % whence) - if nloc < 0: - raise ValueError("Seek before start of file") - self.loc = nloc - return self.loc - - def write(self, data): - """ - Write data to buffer. - - Buffer only sent on flush() or if buffer is greater than - or equal to blocksize. - - Parameters - ---------- - data: bytes - Set of bytes to be written. - """ - if self.mode not in {"wb", "ab"}: - raise ValueError("File not in write mode") - if self.closed: - raise ValueError("I/O operation on closed file.") - if self.forced: - raise ValueError("This file has been force-flushed, can only close") - out = self.buffer.write(data) - self.loc += out - if self.buffer.tell() >= self.blocksize: - self.flush() - return out - - def flush(self, force=False): - """ - Write buffered data to backend store. - - Writes the current buffer, if it is larger than the block-size, or if - the file is being closed. - - Parameters - ---------- - force: bool - When closing, write the last block even if it is smaller than - blocks are allowed to be. Disallows further writing to this file. - """ - - if self.closed: - raise ValueError("Flush on closed file") - if force and self.forced: - raise ValueError("Force flush cannot be called more than once") - if force: - self.forced = True - - if self.mode not in {"wb", "ab"}: - # no-op to flush on read-mode - return - - if not force and self.buffer.tell() < self.blocksize: - # Defer write on small block - return - - if self.offset is None: - # Initialize a multipart upload - self.offset = 0 - try: - self._initiate_upload() - except: # noqa: E722 - self.closed = True - raise - - if self._upload_chunk(final=force) is not False: - self.offset += self.buffer.seek(0, 2) - self.buffer = io.BytesIO() - - def _upload_chunk(self, final=False): - """Write one part of a multi-block file upload - - Parameters - ========== - final: bool - This is the last block, so should complete file, if - self.autocommit is True. - """ - # may not yet have been initialized, may need to call _initialize_upload - - def _initiate_upload(self): - """Create remote file/upload""" - pass - - def _fetch_range(self, start, end): - """Get the specified set of bytes from remote""" - raise NotImplementedError - - def read(self, length=-1): - """ - Return data from cache, or fetch pieces as necessary - - Parameters - ---------- - length: int (-1) - Number of bytes to read; if <0, all remaining bytes. - """ - length = -1 if length is None else int(length) - if self.mode != "rb": - raise ValueError("File not in read mode") - if length < 0: - length = self.size - self.loc - if self.closed: - raise ValueError("I/O operation on closed file.") - logger.debug("%s read: %i - %i" % (self, self.loc, self.loc + length)) - if length == 0: - # don't even bother calling fetch - return b"" - out = self.cache._fetch(self.loc, self.loc + length) - self.loc += len(out) - return out - - def readinto(self, b): - """mirrors builtin file's readinto method - - https://docs.python.org/3/library/io.html#io.RawIOBase.readinto - """ - out = memoryview(b).cast("B") - data = self.read(out.nbytes) - out[: len(data)] = data - return len(data) - - def readuntil(self, char=b"\n", blocks=None): - """Return data between current position and first occurrence of char - - char is included in the output, except if the end of the tile is - encountered first. - - Parameters - ---------- - char: bytes - Thing to find - blocks: None or int - How much to read in each go. Defaults to file blocksize - which may - mean a new read on every call. - """ - out = [] - while True: - start = self.tell() - part = self.read(blocks or self.blocksize) - if len(part) == 0: - break - found = part.find(char) - if found > -1: - out.append(part[: found + len(char)]) - self.seek(start + found + len(char)) - break - out.append(part) - return b"".join(out) - - def readline(self): - """Read until first occurrence of newline character - - Note that, because of character encoding, this is not necessarily a - true line ending. - """ - return self.readuntil(b"\n") - - def __next__(self): - out = self.readline() - if out: - return out - raise StopIteration - - def __iter__(self): - return self - - def readlines(self): - """Return all data, split by the newline character""" - data = self.read() - lines = data.split(b"\n") - out = [l + b"\n" for l in lines[:-1]] - if data.endswith(b"\n"): - return out - else: - return out + [lines[-1]] - # return list(self) ??? - - def readinto1(self, b): - return self.readinto(b) - - def close(self): - """Close file - - Finalizes writes, discards cache - """ - if getattr(self, "_unclosable", False): - return - if self.closed: - return - if self.mode == "rb": - self.cache = None - else: - if not self.forced: - self.flush(force=True) - - if self.fs is not None: - self.fs.invalidate_cache(self.path) - self.fs.invalidate_cache(self.fs._parent(self.path)) - - self.closed = True - - def readable(self): - """Whether opened for reading""" - return self.mode == "rb" and not self.closed - - def seekable(self): - """Whether is seekable (only in read mode)""" - return self.readable() - - def writable(self): - """Whether opened for writing""" - return self.mode in {"wb", "ab"} and not self.closed - - def __del__(self): - if not self.closed: - self.close() - - def __str__(self): - return "" % (type(self.fs).__name__, self.path) - - __repr__ = __str__ - - def __enter__(self): - return self - - def __exit__(self, *args): - self.close() diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__init__.py b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__init__.py deleted file mode 100644 index 45d081921ad29104bedd336dbf04fa86e1e48b7a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__init__.py +++ /dev/null @@ -1,287 +0,0 @@ -import os -from hashlib import md5 - -import pytest - -from fsspec.implementations.local import LocalFileSystem -from fsspec.tests.abstract.copy import AbstractCopyTests # noqa -from fsspec.tests.abstract.get import AbstractGetTests # noqa -from fsspec.tests.abstract.put import AbstractPutTests # noqa - - -class BaseAbstractFixtures: - """ - Abstract base class containing fixtures that are used by but never need to - be overridden in derived filesystem-specific classes to run the abstract - tests on such filesystems. - """ - - @pytest.fixture - def fs_bulk_operations_scenario_0(self, fs, fs_join, fs_path): - """ - Scenario on remote filesystem that is used for many cp/get/put tests. - - Cleans up at the end of each test it which it is used. - """ - source = self._bulk_operations_scenario_0(fs, fs_join, fs_path) - yield source - fs.rm(source, recursive=True) - - @pytest.fixture - def fs_glob_edge_cases_files(self, fs, fs_join, fs_path): - """ - Scenario on remote filesystem that is used for glob edge cases cp/get/put tests. - - Cleans up at the end of each test it which it is used. - """ - source = self._glob_edge_cases_files(fs, fs_join, fs_path) - yield source - fs.rm(source, recursive=True) - - @pytest.fixture - def fs_dir_and_file_with_same_name_prefix(self, fs, fs_join, fs_path): - """ - Scenario on remote filesystem that is used to check cp/get/put on directory - and file with the same name prefixes. - - Cleans up at the end of each test it which it is used. - """ - source = self._dir_and_file_with_same_name_prefix(fs, fs_join, fs_path) - yield source - fs.rm(source, recursive=True) - - @pytest.fixture - def fs_10_files_with_hashed_names(self, fs, fs_join, fs_path): - """ - Scenario on remote filesystem that is used to check cp/get/put files order - when source and destination are lists. - - Cleans up at the end of each test it which it is used. - """ - source = self._10_files_with_hashed_names(fs, fs_join, fs_path) - yield source - fs.rm(source, recursive=True) - - @pytest.fixture - def fs_target(self, fs, fs_join, fs_path): - """ - Return name of remote directory that does not yet exist to copy into. - - Cleans up at the end of each test it which it is used. - """ - target = fs_join(fs_path, "target") - yield target - if fs.exists(target): - fs.rm(target, recursive=True) - - @pytest.fixture - def local_bulk_operations_scenario_0(self, local_fs, local_join, local_path): - """ - Scenario on local filesystem that is used for many cp/get/put tests. - - Cleans up at the end of each test it which it is used. - """ - source = self._bulk_operations_scenario_0(local_fs, local_join, local_path) - yield source - local_fs.rm(source, recursive=True) - - @pytest.fixture - def local_glob_edge_cases_files(self, local_fs, local_join, local_path): - """ - Scenario on local filesystem that is used for glob edge cases cp/get/put tests. - - Cleans up at the end of each test it which it is used. - """ - source = self._glob_edge_cases_files(local_fs, local_join, local_path) - yield source - local_fs.rm(source, recursive=True) - - @pytest.fixture - def local_dir_and_file_with_same_name_prefix( - self, local_fs, local_join, local_path - ): - """ - Scenario on local filesystem that is used to check cp/get/put on directory - and file with the same name prefixes. - - Cleans up at the end of each test it which it is used. - """ - source = self._dir_and_file_with_same_name_prefix( - local_fs, local_join, local_path - ) - yield source - local_fs.rm(source, recursive=True) - - @pytest.fixture - def local_10_files_with_hashed_names(self, local_fs, local_join, local_path): - """ - Scenario on local filesystem that is used to check cp/get/put files order - when source and destination are lists. - - Cleans up at the end of each test it which it is used. - """ - source = self._10_files_with_hashed_names(local_fs, local_join, local_path) - yield source - local_fs.rm(source, recursive=True) - - @pytest.fixture - def local_target(self, local_fs, local_join, local_path): - """ - Return name of local directory that does not yet exist to copy into. - - Cleans up at the end of each test it which it is used. - """ - target = local_join(local_path, "target") - yield target - if local_fs.exists(target): - local_fs.rm(target, recursive=True) - - def _glob_edge_cases_files(self, some_fs, some_join, some_path): - """ - Scenario that is used for glob edge cases cp/get/put tests. - Creates the following directory and file structure: - - 📁 source - ├── 📄 file1 - ├── 📄 file2 - ├── 📁 subdir0 - │ ├── 📄 subfile1 - │ ├── 📄 subfile2 - │ └── 📁 nesteddir - │ └── 📄 nestedfile - └── 📁 subdir1 - ├── 📄 subfile1 - ├── 📄 subfile2 - └── 📁 nesteddir - └── 📄 nestedfile - """ - source = some_join(some_path, "source") - some_fs.touch(some_join(source, "file1")) - some_fs.touch(some_join(source, "file2")) - - for subdir_idx in range(2): - subdir = some_join(source, f"subdir{subdir_idx}") - nesteddir = some_join(subdir, "nesteddir") - some_fs.makedirs(nesteddir) - some_fs.touch(some_join(subdir, "subfile1")) - some_fs.touch(some_join(subdir, "subfile2")) - some_fs.touch(some_join(nesteddir, "nestedfile")) - - return source - - def _bulk_operations_scenario_0(self, some_fs, some_join, some_path): - """ - Scenario that is used for many cp/get/put tests. Creates the following - directory and file structure: - - 📁 source - ├── 📄 file1 - ├── 📄 file2 - └── 📁 subdir - ├── 📄 subfile1 - ├── 📄 subfile2 - └── 📁 nesteddir - └── 📄 nestedfile - """ - source = some_join(some_path, "source") - subdir = some_join(source, "subdir") - nesteddir = some_join(subdir, "nesteddir") - some_fs.makedirs(nesteddir) - some_fs.touch(some_join(source, "file1")) - some_fs.touch(some_join(source, "file2")) - some_fs.touch(some_join(subdir, "subfile1")) - some_fs.touch(some_join(subdir, "subfile2")) - some_fs.touch(some_join(nesteddir, "nestedfile")) - return source - - def _dir_and_file_with_same_name_prefix(self, some_fs, some_join, some_path): - """ - Scenario that is used to check cp/get/put on directory and file with - the same name prefixes. Creates the following directory and file structure: - - 📁 source - ├── 📄 subdir.txt - └── 📁 subdir - └── 📄 subfile.txt - """ - source = some_join(some_path, "source") - subdir = some_join(source, "subdir") - file = some_join(source, "subdir.txt") - subfile = some_join(subdir, "subfile.txt") - some_fs.makedirs(subdir) - some_fs.touch(file) - some_fs.touch(subfile) - return source - - def _10_files_with_hashed_names(self, some_fs, some_join, some_path): - """ - Scenario that is used to check cp/get/put files order when source and - destination are lists. Creates the following directory and file structure: - - 📁 source - └── 📄 {hashed([0-9])}.txt - """ - source = some_join(some_path, "source") - for i in range(10): - hashed_i = md5(str(i).encode("utf-8")).hexdigest() - path = some_join(source, f"{hashed_i}.txt") - some_fs.pipe(path=path, value=f"{i}".encode("utf-8")) - return source - - -class AbstractFixtures(BaseAbstractFixtures): - """ - Abstract base class containing fixtures that may be overridden in derived - filesystem-specific classes to run the abstract tests on such filesystems. - - For any particular filesystem some of these fixtures must be overridden, - such as ``fs`` and ``fs_path``, and others may be overridden if the - default functions here are not appropriate, such as ``fs_join``. - """ - - @pytest.fixture - def fs(self): - raise NotImplementedError("This function must be overridden in derived classes") - - @pytest.fixture - def fs_join(self): - """ - Return a function that joins its arguments together into a path. - - Most fsspec implementations join paths in a platform-dependent way, - but some will override this to always use a forward slash. - """ - return os.path.join - - @pytest.fixture - def fs_path(self): - raise NotImplementedError("This function must be overridden in derived classes") - - @pytest.fixture(scope="class") - def local_fs(self): - # Maybe need an option for auto_mkdir=False? This is only relevant - # for certain implementations. - return LocalFileSystem(auto_mkdir=True) - - @pytest.fixture - def local_join(self): - """ - Return a function that joins its arguments together into a path, on - the local filesystem. - """ - return os.path.join - - @pytest.fixture - def local_path(self, tmpdir): - return tmpdir - - @pytest.fixture - def supports_empty_directories(self): - """ - Return whether this implementation supports empty directories. - """ - return True - - @pytest.fixture - def fs_sanitize_path(self): - return lambda x: x diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index dc093d01bab2ba8d6fa72390bec998cb471c066f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/common.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/common.cpython-38.pyc deleted file mode 100644 index 7165a6acf53119c5564bc2e789e3d06d5bdb9f4c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/common.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/copy.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/copy.cpython-38.pyc deleted file mode 100644 index 011eb13a513352175089704df5ca431d0f0be83a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/copy.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/get.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/get.cpython-38.pyc deleted file mode 100644 index 705b09270b395a3a2194edf90af5041ded53efe6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/get.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/put.cpython-38.pyc b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/put.cpython-38.pyc deleted file mode 100644 index 2148cf74ce0a6005877bcc9a3b8e9a5691b4e94e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/__pycache__/put.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/common.py b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/common.py deleted file mode 100644 index 93896a443c0682736545df1558dfa757f412c02b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/common.py +++ /dev/null @@ -1,175 +0,0 @@ -GLOB_EDGE_CASES_TESTS = { - "argnames": ("path", "recursive", "maxdepth", "expected"), - "argvalues": [ - ("fil?1", False, None, ["file1"]), - ("fil?1", True, None, ["file1"]), - ("file[1-2]", False, None, ["file1", "file2"]), - ("file[1-2]", True, None, ["file1", "file2"]), - ("*", False, None, ["file1", "file2"]), - ( - "*", - True, - None, - [ - "file1", - "file2", - "subdir0/subfile1", - "subdir0/subfile2", - "subdir0/nesteddir/nestedfile", - "subdir1/subfile1", - "subdir1/subfile2", - "subdir1/nesteddir/nestedfile", - ], - ), - ("*", True, 1, ["file1", "file2"]), - ( - "*", - True, - 2, - [ - "file1", - "file2", - "subdir0/subfile1", - "subdir0/subfile2", - "subdir1/subfile1", - "subdir1/subfile2", - ], - ), - ("*1", False, None, ["file1"]), - ( - "*1", - True, - None, - [ - "file1", - "subdir1/subfile1", - "subdir1/subfile2", - "subdir1/nesteddir/nestedfile", - ], - ), - ("*1", True, 2, ["file1", "subdir1/subfile1", "subdir1/subfile2"]), - ( - "**", - False, - None, - [ - "file1", - "file2", - "subdir0/subfile1", - "subdir0/subfile2", - "subdir0/nesteddir/nestedfile", - "subdir1/subfile1", - "subdir1/subfile2", - "subdir1/nesteddir/nestedfile", - ], - ), - ( - "**", - True, - None, - [ - "file1", - "file2", - "subdir0/subfile1", - "subdir0/subfile2", - "subdir0/nesteddir/nestedfile", - "subdir1/subfile1", - "subdir1/subfile2", - "subdir1/nesteddir/nestedfile", - ], - ), - ("**", True, 1, ["file1", "file2"]), - ( - "**", - True, - 2, - [ - "file1", - "file2", - "subdir0/subfile1", - "subdir0/subfile2", - "subdir0/nesteddir/nestedfile", - "subdir1/subfile1", - "subdir1/subfile2", - "subdir1/nesteddir/nestedfile", - ], - ), - ( - "**", - False, - 2, - [ - "file1", - "file2", - "subdir0/subfile1", - "subdir0/subfile2", - "subdir1/subfile1", - "subdir1/subfile2", - ], - ), - ("**1", False, None, ["file1", "subdir0/subfile1", "subdir1/subfile1"]), - ( - "**1", - True, - None, - [ - "file1", - "subdir0/subfile1", - "subdir1/subfile1", - "subdir1/subfile2", - "subdir1/nesteddir/nestedfile", - ], - ), - ("**1", True, 1, ["file1"]), - ( - "**1", - True, - 2, - ["file1", "subdir0/subfile1", "subdir1/subfile1", "subdir1/subfile2"], - ), - ("**1", False, 2, ["file1", "subdir0/subfile1", "subdir1/subfile1"]), - ("**/subdir0", False, None, []), - ("**/subdir0", True, None, ["subfile1", "subfile2", "nesteddir/nestedfile"]), - ("**/subdir0/nested*", False, 2, []), - ("**/subdir0/nested*", True, 2, ["nestedfile"]), - ("subdir[1-2]", False, None, []), - ("subdir[1-2]", True, None, ["subfile1", "subfile2", "nesteddir/nestedfile"]), - ("subdir[1-2]", True, 2, ["subfile1", "subfile2"]), - ("subdir[0-1]", False, None, []), - ( - "subdir[0-1]", - True, - None, - [ - "subdir0/subfile1", - "subdir0/subfile2", - "subdir0/nesteddir/nestedfile", - "subdir1/subfile1", - "subdir1/subfile2", - "subdir1/nesteddir/nestedfile", - ], - ), - ( - "subdir[0-1]/*fil[e]*", - False, - None, - [ - "subdir0/subfile1", - "subdir0/subfile2", - "subdir1/subfile1", - "subdir1/subfile2", - ], - ), - ( - "subdir[0-1]/*fil[e]*", - True, - None, - [ - "subdir0/subfile1", - "subdir0/subfile2", - "subdir1/subfile1", - "subdir1/subfile2", - ], - ), - ], -} diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/copy.py b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/copy.py deleted file mode 100644 index 01ff09c95e7d81b3aa3a58436f795b4d47b6889a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/copy.py +++ /dev/null @@ -1,543 +0,0 @@ -from hashlib import md5 -from itertools import product - -import pytest - -from fsspec.tests.abstract.common import GLOB_EDGE_CASES_TESTS - - -class AbstractCopyTests: - def test_copy_file_to_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - fs_target, - supports_empty_directories, - ): - # Copy scenario 1a - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - fs.touch(fs_join(target, "dummy")) - assert fs.isdir(target) - - target_file2 = fs_join(target, "file2") - target_subfile1 = fs_join(target, "subfile1") - - # Copy from source directory - fs.cp(fs_join(source, "file2"), target) - assert fs.isfile(target_file2) - - # Copy from sub directory - fs.cp(fs_join(source, "subdir", "subfile1"), target) - assert fs.isfile(target_subfile1) - - # Remove copied files - fs.rm([target_file2, target_subfile1]) - assert not fs.exists(target_file2) - assert not fs.exists(target_subfile1) - - # Repeat with trailing slash on target - fs.cp(fs_join(source, "file2"), target + "/") - assert fs.isdir(target) - assert fs.isfile(target_file2) - - fs.cp(fs_join(source, "subdir", "subfile1"), target + "/") - assert fs.isfile(target_subfile1) - - def test_copy_file_to_new_directory( - self, fs, fs_join, fs_bulk_operations_scenario_0, fs_target - ): - # Copy scenario 1b - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - fs.cp( - fs_join(source, "subdir", "subfile1"), fs_join(target, "newdir/") - ) # Note trailing slash - assert fs.isdir(target) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - - def test_copy_file_to_file_in_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - fs_target, - supports_empty_directories, - ): - # Copy scenario 1c - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - fs.touch(fs_join(target, "dummy")) - assert fs.isdir(target) - - fs.cp(fs_join(source, "subdir", "subfile1"), fs_join(target, "newfile")) - assert fs.isfile(fs_join(target, "newfile")) - - def test_copy_file_to_file_in_new_directory( - self, fs, fs_join, fs_bulk_operations_scenario_0, fs_target - ): - # Copy scenario 1d - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - fs.cp( - fs_join(source, "subdir", "subfile1"), fs_join(target, "newdir", "newfile") - ) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "newfile")) - - def test_copy_directory_to_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - fs_target, - supports_empty_directories, - ): - # Copy scenario 1e - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - dummy = fs_join(target, "dummy") - fs.touch(dummy) - assert fs.isdir(target) - - for source_slash, target_slash in zip([False, True], [False, True]): - s = fs_join(source, "subdir") - if source_slash: - s += "/" - t = target + "/" if target_slash else target - - # Without recursive does nothing - fs.cp(s, t) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - # With recursive - fs.cp(s, t, recursive=True) - if source_slash: - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert fs.isdir(fs_join(target, "nesteddir")) - assert fs.isfile(fs_join(target, "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - fs_join(target, "nesteddir"), - ], - recursive=True, - ) - else: - assert fs.isdir(fs_join(target, "subdir")) - assert fs.isfile(fs_join(target, "subdir", "subfile1")) - assert fs.isfile(fs_join(target, "subdir", "subfile2")) - assert fs.isdir(fs_join(target, "subdir", "nesteddir")) - assert fs.isfile(fs_join(target, "subdir", "nesteddir", "nestedfile")) - - fs.rm(fs_join(target, "subdir"), recursive=True) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - # Limit recursive by maxdepth - fs.cp(s, t, recursive=True, maxdepth=1) - if source_slash: - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert not fs.exists(fs_join(target, "nesteddir")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - ], - recursive=True, - ) - else: - assert fs.isdir(fs_join(target, "subdir")) - assert fs.isfile(fs_join(target, "subdir", "subfile1")) - assert fs.isfile(fs_join(target, "subdir", "subfile2")) - assert not fs.exists(fs_join(target, "subdir", "nesteddir")) - - fs.rm(fs_join(target, "subdir"), recursive=True) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - def test_copy_directory_to_new_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - fs_target, - supports_empty_directories, - ): - # Copy scenario 1f - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - for source_slash, target_slash in zip([False, True], [False, True]): - s = fs_join(source, "subdir") - if source_slash: - s += "/" - t = fs_join(target, "newdir") - if target_slash: - t += "/" - - # Without recursive does nothing - fs.cp(s, t) - if supports_empty_directories: - assert fs.ls(target) == [] - else: - with pytest.raises(FileNotFoundError): - fs.ls(target) - - # With recursive - fs.cp(s, t, recursive=True) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert fs.isdir(fs_join(target, "newdir", "nesteddir")) - assert fs.isfile(fs_join(target, "newdir", "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - # Limit recursive by maxdepth - fs.cp(s, t, recursive=True, maxdepth=1) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert not fs.exists(fs_join(target, "newdir", "nesteddir")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - def test_copy_glob_to_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - fs_target, - supports_empty_directories, - ): - # Copy scenario 1g - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - dummy = fs_join(target, "dummy") - fs.touch(dummy) - assert fs.isdir(target) - - for target_slash in [False, True]: - t = target + "/" if target_slash else target - - # Without recursive - fs.cp(fs_join(source, "subdir", "*"), t) - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert not fs.isdir(fs_join(target, "nesteddir")) - assert not fs.exists(fs_join(target, "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - ], - recursive=True, - ) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - # With recursive - for glob, recursive in zip(["*", "**"], [True, False]): - fs.cp(fs_join(source, "subdir", glob), t, recursive=recursive) - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert fs.isdir(fs_join(target, "nesteddir")) - assert fs.isfile(fs_join(target, "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - fs_join(target, "nesteddir"), - ], - recursive=True, - ) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - # Limit recursive by maxdepth - fs.cp( - fs_join(source, "subdir", glob), t, recursive=recursive, maxdepth=1 - ) - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert not fs.exists(fs_join(target, "nesteddir")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - ], - recursive=True, - ) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - def test_copy_glob_to_new_directory( - self, fs, fs_join, fs_bulk_operations_scenario_0, fs_target - ): - # Copy scenario 1h - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - for target_slash in [False, True]: - t = fs_join(target, "newdir") - if target_slash: - t += "/" - - # Without recursive - fs.cp(fs_join(source, "subdir", "*"), t) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert not fs.exists(fs_join(target, "newdir", "nesteddir")) - assert not fs.exists(fs_join(target, "newdir", "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - assert not fs.exists(fs_join(target, "newdir", "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - # With recursive - for glob, recursive in zip(["*", "**"], [True, False]): - fs.cp(fs_join(source, "subdir", glob), t, recursive=recursive) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert fs.isdir(fs_join(target, "newdir", "nesteddir")) - assert fs.isfile(fs_join(target, "newdir", "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - assert not fs.exists(fs_join(target, "newdir", "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - # Limit recursive by maxdepth - fs.cp( - fs_join(source, "subdir", glob), t, recursive=recursive, maxdepth=1 - ) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert not fs.exists(fs_join(target, "newdir", "nesteddir")) - assert not fs.exists(fs_join(target, "subdir")) - assert not fs.exists(fs_join(target, "newdir", "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - @pytest.mark.parametrize( - GLOB_EDGE_CASES_TESTS["argnames"], - GLOB_EDGE_CASES_TESTS["argvalues"], - ) - def test_copy_glob_edge_cases( - self, - path, - recursive, - maxdepth, - expected, - fs, - fs_join, - fs_glob_edge_cases_files, - fs_target, - fs_sanitize_path, - ): - # Copy scenario 1g - source = fs_glob_edge_cases_files - - target = fs_target - - for new_dir, target_slash in product([True, False], [True, False]): - fs.mkdir(target) - - t = fs_join(target, "newdir") if new_dir else target - t = t + "/" if target_slash else t - - fs.copy(fs_join(source, path), t, recursive=recursive, maxdepth=maxdepth) - - output = fs.find(target) - if new_dir: - prefixed_expected = [ - fs_sanitize_path(fs_join(target, "newdir", p)) for p in expected - ] - else: - prefixed_expected = [ - fs_sanitize_path(fs_join(target, p)) for p in expected - ] - assert sorted(output) == sorted(prefixed_expected) - - try: - fs.rm(target, recursive=True) - except FileNotFoundError: - pass - - def test_copy_list_of_files_to_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - fs_target, - supports_empty_directories, - ): - # Copy scenario 2a - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - dummy = fs_join(target, "dummy") - fs.touch(dummy) - assert fs.isdir(target) - - source_files = [ - fs_join(source, "file1"), - fs_join(source, "file2"), - fs_join(source, "subdir", "subfile1"), - ] - - for target_slash in [False, True]: - t = target + "/" if target_slash else target - - fs.cp(source_files, t) - assert fs.isfile(fs_join(target, "file1")) - assert fs.isfile(fs_join(target, "file2")) - assert fs.isfile(fs_join(target, "subfile1")) - - fs.rm( - [ - fs_join(target, "file1"), - fs_join(target, "file2"), - fs_join(target, "subfile1"), - ], - recursive=True, - ) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - def test_copy_list_of_files_to_new_directory( - self, fs, fs_join, fs_bulk_operations_scenario_0, fs_target - ): - # Copy scenario 2b - source = fs_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - source_files = [ - fs_join(source, "file1"), - fs_join(source, "file2"), - fs_join(source, "subdir", "subfile1"), - ] - - fs.cp(source_files, fs_join(target, "newdir") + "/") # Note trailing slash - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "file1")) - assert fs.isfile(fs_join(target, "newdir", "file2")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - - def test_copy_two_files_new_directory( - self, fs, fs_join, fs_bulk_operations_scenario_0, fs_target - ): - # This is a duplicate of test_copy_list_of_files_to_new_directory and - # can eventually be removed. - source = fs_bulk_operations_scenario_0 - - target = fs_target - assert not fs.exists(target) - fs.cp([fs_join(source, "file1"), fs_join(source, "file2")], target) - - assert fs.isdir(target) - assert fs.isfile(fs_join(target, "file1")) - assert fs.isfile(fs_join(target, "file2")) - - def test_copy_directory_without_files_with_same_name_prefix( - self, - fs, - fs_join, - fs_target, - fs_dir_and_file_with_same_name_prefix, - supports_empty_directories, - ): - # Create the test dirs - source = fs_dir_and_file_with_same_name_prefix - target = fs_target - - # Test without glob - fs.cp(fs_join(source, "subdir"), target, recursive=True) - - assert fs.isfile(fs_join(target, "subfile.txt")) - assert not fs.isfile(fs_join(target, "subdir.txt")) - - fs.rm([fs_join(target, "subfile.txt")]) - if supports_empty_directories: - assert fs.ls(target) == [] - else: - assert not fs.exists(target) - - # Test with glob - fs.cp(fs_join(source, "subdir*"), target, recursive=True) - - assert fs.isdir(fs_join(target, "subdir")) - assert fs.isfile(fs_join(target, "subdir", "subfile.txt")) - assert fs.isfile(fs_join(target, "subdir.txt")) - - def test_copy_with_source_and_destination_as_list( - self, fs, fs_target, fs_join, fs_10_files_with_hashed_names - ): - # Create the test dir - source = fs_10_files_with_hashed_names - target = fs_target - - # Create list of files for source and destination - source_files = [] - destination_files = [] - for i in range(10): - hashed_i = md5(str(i).encode("utf-8")).hexdigest() - source_files.append(fs_join(source, f"{hashed_i}.txt")) - destination_files.append(fs_join(target, f"{hashed_i}.txt")) - - # Copy and assert order was kept - fs.copy(path1=source_files, path2=destination_files) - - for i in range(10): - file_content = fs.cat(destination_files[i]).decode("utf-8") - assert file_content == str(i) diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/get.py b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/get.py deleted file mode 100644 index 851ab81ee581e74cac41c64c83ef0af75826d6b0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/get.py +++ /dev/null @@ -1,587 +0,0 @@ -from hashlib import md5 -from itertools import product - -import pytest - -from fsspec.implementations.local import make_path_posix -from fsspec.tests.abstract.common import GLOB_EDGE_CASES_TESTS - - -class AbstractGetTests: - def test_get_file_to_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1a - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - assert local_fs.isdir(target) - - target_file2 = local_join(target, "file2") - target_subfile1 = local_join(target, "subfile1") - - # Copy from source directory - fs.get(fs_join(source, "file2"), target) - assert local_fs.isfile(target_file2) - - # Copy from sub directory - fs.get(fs_join(source, "subdir", "subfile1"), target) - assert local_fs.isfile(target_subfile1) - - # Remove copied files - local_fs.rm([target_file2, target_subfile1]) - assert not local_fs.exists(target_file2) - assert not local_fs.exists(target_subfile1) - - # Repeat with trailing slash on target - fs.get(fs_join(source, "file2"), target + "/") - assert local_fs.isdir(target) - assert local_fs.isfile(target_file2) - - fs.get(fs_join(source, "subdir", "subfile1"), target + "/") - assert local_fs.isfile(target_subfile1) - - def test_get_file_to_new_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1b - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - - fs.get( - fs_join(source, "subdir", "subfile1"), local_join(target, "newdir/") - ) # Note trailing slash - - assert local_fs.isdir(target) - assert local_fs.isdir(local_join(target, "newdir")) - assert local_fs.isfile(local_join(target, "newdir", "subfile1")) - - def test_get_file_to_file_in_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1c - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - - fs.get(fs_join(source, "subdir", "subfile1"), local_join(target, "newfile")) - assert local_fs.isfile(local_join(target, "newfile")) - - def test_get_file_to_file_in_new_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1d - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - - fs.get( - fs_join(source, "subdir", "subfile1"), - local_join(target, "newdir", "newfile"), - ) - assert local_fs.isdir(local_join(target, "newdir")) - assert local_fs.isfile(local_join(target, "newdir", "newfile")) - - def test_get_directory_to_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1e - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - assert local_fs.isdir(target) - - for source_slash, target_slash in zip([False, True], [False, True]): - s = fs_join(source, "subdir") - if source_slash: - s += "/" - t = target + "/" if target_slash else target - - # Without recursive does nothing - fs.get(s, t) - assert local_fs.ls(target) == [] - - # With recursive - fs.get(s, t, recursive=True) - if source_slash: - assert local_fs.isfile(local_join(target, "subfile1")) - assert local_fs.isfile(local_join(target, "subfile2")) - assert local_fs.isdir(local_join(target, "nesteddir")) - assert local_fs.isfile(local_join(target, "nesteddir", "nestedfile")) - assert not local_fs.exists(local_join(target, "subdir")) - - local_fs.rm( - [ - local_join(target, "subfile1"), - local_join(target, "subfile2"), - local_join(target, "nesteddir"), - ], - recursive=True, - ) - else: - assert local_fs.isdir(local_join(target, "subdir")) - assert local_fs.isfile(local_join(target, "subdir", "subfile1")) - assert local_fs.isfile(local_join(target, "subdir", "subfile2")) - assert local_fs.isdir(local_join(target, "subdir", "nesteddir")) - assert local_fs.isfile( - local_join(target, "subdir", "nesteddir", "nestedfile") - ) - - local_fs.rm(local_join(target, "subdir"), recursive=True) - assert local_fs.ls(target) == [] - - # Limit recursive by maxdepth - fs.get(s, t, recursive=True, maxdepth=1) - if source_slash: - assert local_fs.isfile(local_join(target, "subfile1")) - assert local_fs.isfile(local_join(target, "subfile2")) - assert not local_fs.exists(local_join(target, "nesteddir")) - assert not local_fs.exists(local_join(target, "subdir")) - - local_fs.rm( - [ - local_join(target, "subfile1"), - local_join(target, "subfile2"), - ], - recursive=True, - ) - else: - assert local_fs.isdir(local_join(target, "subdir")) - assert local_fs.isfile(local_join(target, "subdir", "subfile1")) - assert local_fs.isfile(local_join(target, "subdir", "subfile2")) - assert not local_fs.exists(local_join(target, "subdir", "nesteddir")) - - local_fs.rm(local_join(target, "subdir"), recursive=True) - assert local_fs.ls(target) == [] - - def test_get_directory_to_new_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1f - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - - for source_slash, target_slash in zip([False, True], [False, True]): - s = fs_join(source, "subdir") - if source_slash: - s += "/" - t = local_join(target, "newdir") - if target_slash: - t += "/" - - # Without recursive does nothing - fs.get(s, t) - assert local_fs.ls(target) == [] - - # With recursive - fs.get(s, t, recursive=True) - assert local_fs.isdir(local_join(target, "newdir")) - assert local_fs.isfile(local_join(target, "newdir", "subfile1")) - assert local_fs.isfile(local_join(target, "newdir", "subfile2")) - assert local_fs.isdir(local_join(target, "newdir", "nesteddir")) - assert local_fs.isfile( - local_join(target, "newdir", "nesteddir", "nestedfile") - ) - assert not local_fs.exists(local_join(target, "subdir")) - - local_fs.rm(local_join(target, "newdir"), recursive=True) - assert local_fs.ls(target) == [] - - # Limit recursive by maxdepth - fs.get(s, t, recursive=True, maxdepth=1) - assert local_fs.isdir(local_join(target, "newdir")) - assert local_fs.isfile(local_join(target, "newdir", "subfile1")) - assert local_fs.isfile(local_join(target, "newdir", "subfile2")) - assert not local_fs.exists(local_join(target, "newdir", "nesteddir")) - assert not local_fs.exists(local_join(target, "subdir")) - - local_fs.rm(local_join(target, "newdir"), recursive=True) - assert not local_fs.exists(local_join(target, "newdir")) - - def test_get_glob_to_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1g - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - - for target_slash in [False, True]: - t = target + "/" if target_slash else target - - # Without recursive - fs.get(fs_join(source, "subdir", "*"), t) - assert local_fs.isfile(local_join(target, "subfile1")) - assert local_fs.isfile(local_join(target, "subfile2")) - assert not local_fs.isdir(local_join(target, "nesteddir")) - assert not local_fs.exists(local_join(target, "nesteddir", "nestedfile")) - assert not local_fs.exists(local_join(target, "subdir")) - - local_fs.rm( - [ - local_join(target, "subfile1"), - local_join(target, "subfile2"), - ], - recursive=True, - ) - assert local_fs.ls(target) == [] - - # With recursive - for glob, recursive in zip(["*", "**"], [True, False]): - fs.get(fs_join(source, "subdir", glob), t, recursive=recursive) - assert local_fs.isfile(local_join(target, "subfile1")) - assert local_fs.isfile(local_join(target, "subfile2")) - assert local_fs.isdir(local_join(target, "nesteddir")) - assert local_fs.isfile(local_join(target, "nesteddir", "nestedfile")) - assert not local_fs.exists(local_join(target, "subdir")) - - local_fs.rm( - [ - local_join(target, "subfile1"), - local_join(target, "subfile2"), - local_join(target, "nesteddir"), - ], - recursive=True, - ) - assert local_fs.ls(target) == [] - - # Limit recursive by maxdepth - fs.get( - fs_join(source, "subdir", glob), t, recursive=recursive, maxdepth=1 - ) - assert local_fs.isfile(local_join(target, "subfile1")) - assert local_fs.isfile(local_join(target, "subfile2")) - assert not local_fs.exists(local_join(target, "nesteddir")) - assert not local_fs.exists(local_join(target, "subdir")) - - local_fs.rm( - [ - local_join(target, "subfile1"), - local_join(target, "subfile2"), - ], - recursive=True, - ) - assert local_fs.ls(target) == [] - - def test_get_glob_to_new_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1h - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - - for target_slash in [False, True]: - t = fs_join(target, "newdir") - if target_slash: - t += "/" - - # Without recursive - fs.get(fs_join(source, "subdir", "*"), t) - assert local_fs.isdir(local_join(target, "newdir")) - assert local_fs.isfile(local_join(target, "newdir", "subfile1")) - assert local_fs.isfile(local_join(target, "newdir", "subfile2")) - assert not local_fs.exists(local_join(target, "newdir", "nesteddir")) - assert not local_fs.exists( - local_join(target, "newdir", "nesteddir", "nestedfile") - ) - assert not local_fs.exists(local_join(target, "subdir")) - assert not local_fs.exists(local_join(target, "newdir", "subdir")) - - local_fs.rm(local_join(target, "newdir"), recursive=True) - assert local_fs.ls(target) == [] - - # With recursive - for glob, recursive in zip(["*", "**"], [True, False]): - fs.get(fs_join(source, "subdir", glob), t, recursive=recursive) - assert local_fs.isdir(local_join(target, "newdir")) - assert local_fs.isfile(local_join(target, "newdir", "subfile1")) - assert local_fs.isfile(local_join(target, "newdir", "subfile2")) - assert local_fs.isdir(local_join(target, "newdir", "nesteddir")) - assert local_fs.isfile( - local_join(target, "newdir", "nesteddir", "nestedfile") - ) - assert not local_fs.exists(local_join(target, "subdir")) - assert not local_fs.exists(local_join(target, "newdir", "subdir")) - - local_fs.rm(local_join(target, "newdir"), recursive=True) - assert not local_fs.exists(local_join(target, "newdir")) - - # Limit recursive by maxdepth - fs.get( - fs_join(source, "subdir", glob), t, recursive=recursive, maxdepth=1 - ) - assert local_fs.isdir(local_join(target, "newdir")) - assert local_fs.isfile(local_join(target, "newdir", "subfile1")) - assert local_fs.isfile(local_join(target, "newdir", "subfile2")) - assert not local_fs.exists(local_join(target, "newdir", "nesteddir")) - assert not local_fs.exists(local_join(target, "subdir")) - assert not local_fs.exists(local_join(target, "newdir", "subdir")) - - local_fs.rm(local_fs.ls(target, detail=False), recursive=True) - assert not local_fs.exists(local_join(target, "newdir")) - - @pytest.mark.parametrize( - GLOB_EDGE_CASES_TESTS["argnames"], - GLOB_EDGE_CASES_TESTS["argvalues"], - ) - def test_get_glob_edge_cases( - self, - path, - recursive, - maxdepth, - expected, - fs, - fs_join, - fs_glob_edge_cases_files, - local_fs, - local_join, - local_target, - ): - # Copy scenario 1g - source = fs_glob_edge_cases_files - - target = local_target - - for new_dir, target_slash in product([True, False], [True, False]): - local_fs.mkdir(target) - - t = local_join(target, "newdir") if new_dir else target - t = t + "/" if target_slash else t - - fs.get(fs_join(source, path), t, recursive=recursive, maxdepth=maxdepth) - - output = local_fs.find(target) - if new_dir: - prefixed_expected = [ - make_path_posix(local_join(target, "newdir", p)) for p in expected - ] - else: - prefixed_expected = [ - make_path_posix(local_join(target, p)) for p in expected - ] - assert sorted(output) == sorted(prefixed_expected) - - try: - local_fs.rm(target, recursive=True) - except FileNotFoundError: - pass - - def test_get_list_of_files_to_existing_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 2a - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - - source_files = [ - fs_join(source, "file1"), - fs_join(source, "file2"), - fs_join(source, "subdir", "subfile1"), - ] - - for target_slash in [False, True]: - t = target + "/" if target_slash else target - - fs.get(source_files, t) - assert local_fs.isfile(local_join(target, "file1")) - assert local_fs.isfile(local_join(target, "file2")) - assert local_fs.isfile(local_join(target, "subfile1")) - - local_fs.rm( - [ - local_join(target, "file1"), - local_join(target, "file2"), - local_join(target, "subfile1"), - ], - recursive=True, - ) - assert local_fs.ls(target) == [] - - def test_get_list_of_files_to_new_directory( - self, - fs, - fs_join, - fs_bulk_operations_scenario_0, - local_fs, - local_join, - local_target, - ): - # Copy scenario 2b - source = fs_bulk_operations_scenario_0 - - target = local_target - local_fs.mkdir(target) - - source_files = [ - fs_join(source, "file1"), - fs_join(source, "file2"), - fs_join(source, "subdir", "subfile1"), - ] - - fs.get(source_files, local_join(target, "newdir") + "/") # Note trailing slash - assert local_fs.isdir(local_join(target, "newdir")) - assert local_fs.isfile(local_join(target, "newdir", "file1")) - assert local_fs.isfile(local_join(target, "newdir", "file2")) - assert local_fs.isfile(local_join(target, "newdir", "subfile1")) - - def test_get_directory_recursive( - self, fs, fs_join, fs_path, local_fs, local_join, local_target - ): - # https://github.com/fsspec/filesystem_spec/issues/1062 - # Recursive cp/get/put of source directory into non-existent target directory. - src = fs_join(fs_path, "src") - src_file = fs_join(src, "file") - fs.mkdir(src) - fs.touch(src_file) - - target = local_target - - # get without slash - assert not local_fs.exists(target) - for loop in range(2): - fs.get(src, target, recursive=True) - assert local_fs.isdir(target) - - if loop == 0: - assert local_fs.isfile(local_join(target, "file")) - assert not local_fs.exists(local_join(target, "src")) - else: - assert local_fs.isfile(local_join(target, "file")) - assert local_fs.isdir(local_join(target, "src")) - assert local_fs.isfile(local_join(target, "src", "file")) - - local_fs.rm(target, recursive=True) - - # get with slash - assert not local_fs.exists(target) - for loop in range(2): - fs.get(src + "/", target, recursive=True) - assert local_fs.isdir(target) - assert local_fs.isfile(local_join(target, "file")) - assert not local_fs.exists(local_join(target, "src")) - - def test_get_directory_without_files_with_same_name_prefix( - self, - fs, - fs_join, - local_fs, - local_join, - local_target, - fs_dir_and_file_with_same_name_prefix, - ): - # Create the test dirs - source = fs_dir_and_file_with_same_name_prefix - target = local_target - - # Test without glob - fs.get(fs_join(source, "subdir"), target, recursive=True) - - assert local_fs.isfile(local_join(target, "subfile.txt")) - assert not local_fs.isfile(local_join(target, "subdir.txt")) - - local_fs.rm([local_join(target, "subfile.txt")]) - assert local_fs.ls(target) == [] - - # Test with glob - fs.get(fs_join(source, "subdir*"), target, recursive=True) - - assert local_fs.isdir(local_join(target, "subdir")) - assert local_fs.isfile(local_join(target, "subdir", "subfile.txt")) - assert local_fs.isfile(local_join(target, "subdir.txt")) - - def test_get_with_source_and_destination_as_list( - self, - fs, - fs_join, - local_fs, - local_join, - local_target, - fs_10_files_with_hashed_names, - ): - # Create the test dir - source = fs_10_files_with_hashed_names - target = local_target - - # Create list of files for source and destination - source_files = [] - destination_files = [] - for i in range(10): - hashed_i = md5(str(i).encode("utf-8")).hexdigest() - source_files.append(fs_join(source, f"{hashed_i}.txt")) - destination_files.append( - make_path_posix(local_join(target, f"{hashed_i}.txt")) - ) - - # Copy and assert order was kept - fs.get(rpath=source_files, lpath=destination_files) - - for i in range(10): - file_content = local_fs.cat(destination_files[i]).decode("utf-8") - assert file_content == str(i) diff --git a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/put.py b/venv/lib/python3.8/site-packages/fsspec/tests/abstract/put.py deleted file mode 100644 index 1d5f2c7beb9e035e727766241509db367981bc81..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/tests/abstract/put.py +++ /dev/null @@ -1,577 +0,0 @@ -from hashlib import md5 -from itertools import product - -import pytest - -from fsspec.tests.abstract.common import GLOB_EDGE_CASES_TESTS - - -class AbstractPutTests: - def test_put_file_to_existing_directory( - self, - fs, - fs_join, - fs_target, - local_join, - local_bulk_operations_scenario_0, - supports_empty_directories, - ): - # Copy scenario 1a - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - fs.touch(fs_join(target, "dummy")) - assert fs.isdir(target) - - target_file2 = fs_join(target, "file2") - target_subfile1 = fs_join(target, "subfile1") - - # Copy from source directory - fs.put(local_join(source, "file2"), target) - assert fs.isfile(target_file2) - - # Copy from sub directory - fs.put(local_join(source, "subdir", "subfile1"), target) - assert fs.isfile(target_subfile1) - - # Remove copied files - fs.rm([target_file2, target_subfile1]) - assert not fs.exists(target_file2) - assert not fs.exists(target_subfile1) - - # Repeat with trailing slash on target - fs.put(local_join(source, "file2"), target + "/") - assert fs.isdir(target) - assert fs.isfile(target_file2) - - fs.put(local_join(source, "subdir", "subfile1"), target + "/") - assert fs.isfile(target_subfile1) - - def test_put_file_to_new_directory( - self, fs, fs_join, fs_target, local_join, local_bulk_operations_scenario_0 - ): - # Copy scenario 1b - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - fs.put( - local_join(source, "subdir", "subfile1"), fs_join(target, "newdir/") - ) # Note trailing slash - assert fs.isdir(target) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - - def test_put_file_to_file_in_existing_directory( - self, - fs, - fs_join, - fs_target, - local_join, - supports_empty_directories, - local_bulk_operations_scenario_0, - ): - # Copy scenario 1c - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - fs.touch(fs_join(target, "dummy")) - assert fs.isdir(target) - - fs.put(local_join(source, "subdir", "subfile1"), fs_join(target, "newfile")) - assert fs.isfile(fs_join(target, "newfile")) - - def test_put_file_to_file_in_new_directory( - self, fs, fs_join, fs_target, local_join, local_bulk_operations_scenario_0 - ): - # Copy scenario 1d - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - fs.put( - local_join(source, "subdir", "subfile1"), - fs_join(target, "newdir", "newfile"), - ) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "newfile")) - - def test_put_directory_to_existing_directory( - self, - fs, - fs_join, - fs_target, - local_bulk_operations_scenario_0, - supports_empty_directories, - ): - # Copy scenario 1e - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - dummy = fs_join(target, "dummy") - fs.touch(dummy) - assert fs.isdir(target) - - for source_slash, target_slash in zip([False, True], [False, True]): - s = fs_join(source, "subdir") - if source_slash: - s += "/" - t = target + "/" if target_slash else target - - # Without recursive does nothing - fs.put(s, t) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - # With recursive - fs.put(s, t, recursive=True) - if source_slash: - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert fs.isdir(fs_join(target, "nesteddir")) - assert fs.isfile(fs_join(target, "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - fs_join(target, "nesteddir"), - ], - recursive=True, - ) - else: - assert fs.isdir(fs_join(target, "subdir")) - assert fs.isfile(fs_join(target, "subdir", "subfile1")) - assert fs.isfile(fs_join(target, "subdir", "subfile2")) - assert fs.isdir(fs_join(target, "subdir", "nesteddir")) - assert fs.isfile(fs_join(target, "subdir", "nesteddir", "nestedfile")) - - fs.rm(fs_join(target, "subdir"), recursive=True) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - # Limit recursive by maxdepth - fs.put(s, t, recursive=True, maxdepth=1) - if source_slash: - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert not fs.exists(fs_join(target, "nesteddir")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - ], - recursive=True, - ) - else: - assert fs.isdir(fs_join(target, "subdir")) - assert fs.isfile(fs_join(target, "subdir", "subfile1")) - assert fs.isfile(fs_join(target, "subdir", "subfile2")) - assert not fs.exists(fs_join(target, "subdir", "nesteddir")) - - fs.rm(fs_join(target, "subdir"), recursive=True) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - def test_put_directory_to_new_directory( - self, - fs, - fs_join, - fs_target, - local_bulk_operations_scenario_0, - supports_empty_directories, - ): - # Copy scenario 1f - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - for source_slash, target_slash in zip([False, True], [False, True]): - s = fs_join(source, "subdir") - if source_slash: - s += "/" - t = fs_join(target, "newdir") - if target_slash: - t += "/" - - # Without recursive does nothing - fs.put(s, t) - if supports_empty_directories: - assert fs.ls(target) == [] - else: - with pytest.raises(FileNotFoundError): - fs.ls(target) - - # With recursive - fs.put(s, t, recursive=True) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert fs.isdir(fs_join(target, "newdir", "nesteddir")) - assert fs.isfile(fs_join(target, "newdir", "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - # Limit recursive by maxdepth - fs.put(s, t, recursive=True, maxdepth=1) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert not fs.exists(fs_join(target, "newdir", "nesteddir")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - def test_put_glob_to_existing_directory( - self, - fs, - fs_join, - fs_target, - local_join, - supports_empty_directories, - local_bulk_operations_scenario_0, - ): - # Copy scenario 1g - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - dummy = fs_join(target, "dummy") - fs.touch(dummy) - assert fs.isdir(target) - - for target_slash in [False, True]: - t = target + "/" if target_slash else target - - # Without recursive - fs.put(local_join(source, "subdir", "*"), t) - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert not fs.isdir(fs_join(target, "nesteddir")) - assert not fs.exists(fs_join(target, "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - ], - recursive=True, - ) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - # With recursive - for glob, recursive in zip(["*", "**"], [True, False]): - fs.put(local_join(source, "subdir", glob), t, recursive=recursive) - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert fs.isdir(fs_join(target, "nesteddir")) - assert fs.isfile(fs_join(target, "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - fs_join(target, "nesteddir"), - ], - recursive=True, - ) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - # Limit recursive by maxdepth - fs.put( - local_join(source, "subdir", glob), - t, - recursive=recursive, - maxdepth=1, - ) - assert fs.isfile(fs_join(target, "subfile1")) - assert fs.isfile(fs_join(target, "subfile2")) - assert not fs.exists(fs_join(target, "nesteddir")) - assert not fs.exists(fs_join(target, "subdir")) - - fs.rm( - [ - fs_join(target, "subfile1"), - fs_join(target, "subfile2"), - ], - recursive=True, - ) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - def test_put_glob_to_new_directory( - self, fs, fs_join, fs_target, local_join, local_bulk_operations_scenario_0 - ): - # Copy scenario 1h - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - for target_slash in [False, True]: - t = fs_join(target, "newdir") - if target_slash: - t += "/" - - # Without recursive - fs.put(local_join(source, "subdir", "*"), t) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert not fs.exists(fs_join(target, "newdir", "nesteddir")) - assert not fs.exists(fs_join(target, "newdir", "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - assert not fs.exists(fs_join(target, "newdir", "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - # With recursive - for glob, recursive in zip(["*", "**"], [True, False]): - fs.put(local_join(source, "subdir", glob), t, recursive=recursive) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert fs.isdir(fs_join(target, "newdir", "nesteddir")) - assert fs.isfile(fs_join(target, "newdir", "nesteddir", "nestedfile")) - assert not fs.exists(fs_join(target, "subdir")) - assert not fs.exists(fs_join(target, "newdir", "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - # Limit recursive by maxdepth - fs.put( - local_join(source, "subdir", glob), - t, - recursive=recursive, - maxdepth=1, - ) - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - assert fs.isfile(fs_join(target, "newdir", "subfile2")) - assert not fs.exists(fs_join(target, "newdir", "nesteddir")) - assert not fs.exists(fs_join(target, "subdir")) - assert not fs.exists(fs_join(target, "newdir", "subdir")) - - fs.rm(fs_join(target, "newdir"), recursive=True) - assert not fs.exists(fs_join(target, "newdir")) - - @pytest.mark.parametrize( - GLOB_EDGE_CASES_TESTS["argnames"], - GLOB_EDGE_CASES_TESTS["argvalues"], - ) - def test_put_glob_edge_cases( - self, - path, - recursive, - maxdepth, - expected, - fs, - fs_join, - fs_target, - local_glob_edge_cases_files, - local_join, - fs_sanitize_path, - ): - # Copy scenario 1g - source = local_glob_edge_cases_files - - target = fs_target - - for new_dir, target_slash in product([True, False], [True, False]): - fs.mkdir(target) - - t = fs_join(target, "newdir") if new_dir else target - t = t + "/" if target_slash else t - - fs.put(local_join(source, path), t, recursive=recursive, maxdepth=maxdepth) - - output = fs.find(target) - if new_dir: - prefixed_expected = [ - fs_sanitize_path(fs_join(target, "newdir", p)) for p in expected - ] - else: - prefixed_expected = [ - fs_sanitize_path(fs_join(target, p)) for p in expected - ] - assert sorted(output) == sorted(prefixed_expected) - - try: - fs.rm(target, recursive=True) - except FileNotFoundError: - pass - - def test_put_list_of_files_to_existing_directory( - self, - fs, - fs_join, - fs_target, - local_join, - local_bulk_operations_scenario_0, - supports_empty_directories, - ): - # Copy scenario 2a - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - if not supports_empty_directories: - # Force target directory to exist by adding a dummy file - dummy = fs_join(target, "dummy") - fs.touch(dummy) - assert fs.isdir(target) - - source_files = [ - local_join(source, "file1"), - local_join(source, "file2"), - local_join(source, "subdir", "subfile1"), - ] - - for target_slash in [False, True]: - t = target + "/" if target_slash else target - - fs.put(source_files, t) - assert fs.isfile(fs_join(target, "file1")) - assert fs.isfile(fs_join(target, "file2")) - assert fs.isfile(fs_join(target, "subfile1")) - - fs.rm( - [ - fs_join(target, "file1"), - fs_join(target, "file2"), - fs_join(target, "subfile1"), - ], - recursive=True, - ) - assert fs.ls(target) == ([] if supports_empty_directories else [dummy]) - - def test_put_list_of_files_to_new_directory( - self, fs, fs_join, fs_target, local_join, local_bulk_operations_scenario_0 - ): - # Copy scenario 2b - source = local_bulk_operations_scenario_0 - - target = fs_target - fs.mkdir(target) - - source_files = [ - local_join(source, "file1"), - local_join(source, "file2"), - local_join(source, "subdir", "subfile1"), - ] - - fs.put(source_files, fs_join(target, "newdir") + "/") # Note trailing slash - assert fs.isdir(fs_join(target, "newdir")) - assert fs.isfile(fs_join(target, "newdir", "file1")) - assert fs.isfile(fs_join(target, "newdir", "file2")) - assert fs.isfile(fs_join(target, "newdir", "subfile1")) - - def test_put_directory_recursive( - self, fs, fs_join, fs_target, local_fs, local_join, local_path - ): - # https://github.com/fsspec/filesystem_spec/issues/1062 - # Recursive cp/get/put of source directory into non-existent target directory. - src = local_join(local_path, "src") - src_file = local_join(src, "file") - local_fs.mkdir(src) - local_fs.touch(src_file) - - target = fs_target - - # put without slash - assert not fs.exists(target) - for loop in range(2): - fs.put(src, target, recursive=True) - assert fs.isdir(target) - - if loop == 0: - assert fs.isfile(fs_join(target, "file")) - assert not fs.exists(fs_join(target, "src")) - else: - assert fs.isfile(fs_join(target, "file")) - assert fs.isdir(fs_join(target, "src")) - assert fs.isfile(fs_join(target, "src", "file")) - - fs.rm(target, recursive=True) - - # put with slash - assert not fs.exists(target) - for loop in range(2): - fs.put(src + "/", target, recursive=True) - assert fs.isdir(target) - assert fs.isfile(fs_join(target, "file")) - assert not fs.exists(fs_join(target, "src")) - - def test_put_directory_without_files_with_same_name_prefix( - self, - fs, - fs_join, - fs_target, - local_join, - local_dir_and_file_with_same_name_prefix, - supports_empty_directories, - ): - # Create the test dirs - source = local_dir_and_file_with_same_name_prefix - target = fs_target - - # Test without glob - fs.put(local_join(source, "subdir"), fs_target, recursive=True) - - assert fs.isfile(fs_join(fs_target, "subfile.txt")) - assert not fs.isfile(fs_join(fs_target, "subdir.txt")) - - fs.rm([fs_join(target, "subfile.txt")]) - if supports_empty_directories: - assert fs.ls(target) == [] - else: - assert not fs.exists(target) - - # Test with glob - fs.put(local_join(source, "subdir*"), fs_target, recursive=True) - - assert fs.isdir(fs_join(fs_target, "subdir")) - assert fs.isfile(fs_join(fs_target, "subdir", "subfile.txt")) - assert fs.isfile(fs_join(fs_target, "subdir.txt")) - - def test_copy_with_source_and_destination_as_list( - self, fs, fs_target, fs_join, local_join, local_10_files_with_hashed_names - ): - # Create the test dir - source = local_10_files_with_hashed_names - target = fs_target - - # Create list of files for source and destination - source_files = [] - destination_files = [] - for i in range(10): - hashed_i = md5(str(i).encode("utf-8")).hexdigest() - source_files.append(local_join(source, f"{hashed_i}.txt")) - destination_files.append(fs_join(target, f"{hashed_i}.txt")) - - # Copy and assert order was kept - fs.put(lpath=source_files, rpath=destination_files) - - for i in range(10): - file_content = fs.cat(destination_files[i]).decode("utf-8") - assert file_content == str(i) diff --git a/venv/lib/python3.8/site-packages/fsspec/transaction.py b/venv/lib/python3.8/site-packages/fsspec/transaction.py deleted file mode 100644 index d0b5dc91990ac75b7165d36a384282249ee644ab..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/transaction.py +++ /dev/null @@ -1,81 +0,0 @@ -class Transaction: - """Filesystem transaction write context - - Gathers files for deferred commit or discard, so that several write - operations can be finalized semi-atomically. This works by having this - instance as the ``.transaction`` attribute of the given filesystem - """ - - def __init__(self, fs): - """ - Parameters - ---------- - fs: FileSystem instance - """ - self.fs = fs - self.files = [] - - def __enter__(self): - self.start() - - def __exit__(self, exc_type, exc_val, exc_tb): - """End transaction and commit, if exit is not due to exception""" - # only commit if there was no exception - self.complete(commit=exc_type is None) - self.fs._intrans = False - self.fs._transaction = None - - def start(self): - """Start a transaction on this FileSystem""" - self.files = [] # clean up after previous failed completions - self.fs._intrans = True - - def complete(self, commit=True): - """Finish transaction: commit or discard all deferred files""" - for f in self.files: - if commit: - f.commit() - else: - f.discard() - self.files = [] - self.fs._intrans = False - - -class FileActor: - def __init__(self): - self.files = [] - - def commit(self): - for f in self.files: - f.commit() - self.files.clear() - - def discard(self): - for f in self.files: - f.discard() - self.files.clear() - - def append(self, f): - self.files.append(f) - - -class DaskTransaction(Transaction): - def __init__(self, fs): - """ - Parameters - ---------- - fs: FileSystem instance - """ - import distributed - - super().__init__(fs) - client = distributed.default_client() - self.files = client.submit(FileActor, actor=True).result() - - def complete(self, commit=True): - """Finish transaction: commit or discard all deferred files""" - if commit: - self.files.commit().result() - else: - self.files.discard().result() - self.fs._intrans = False diff --git a/venv/lib/python3.8/site-packages/fsspec/utils.py b/venv/lib/python3.8/site-packages/fsspec/utils.py deleted file mode 100644 index 593a40d2a244aaaec46f4aa5e2712c5cce8f5c41..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/fsspec/utils.py +++ /dev/null @@ -1,575 +0,0 @@ -from __future__ import annotations - -import contextlib -import logging -import math -import os -import pathlib -import re -import sys -import tempfile -from functools import partial -from hashlib import md5 -from importlib.metadata import version -from urllib.parse import urlsplit - -DEFAULT_BLOCK_SIZE = 5 * 2**20 - - -def infer_storage_options(urlpath, inherit_storage_options=None): - """Infer storage options from URL path and merge it with existing storage - options. - - Parameters - ---------- - urlpath: str or unicode - Either local absolute file path or URL (hdfs://namenode:8020/file.csv) - inherit_storage_options: dict (optional) - Its contents will get merged with the inferred information from the - given path - - Returns - ------- - Storage options dict. - - Examples - -------- - >>> infer_storage_options('/mnt/datasets/test.csv') # doctest: +SKIP - {"protocol": "file", "path", "/mnt/datasets/test.csv"} - >>> infer_storage_options( - ... 'hdfs://username:pwd@node:123/mnt/datasets/test.csv?q=1', - ... inherit_storage_options={'extra': 'value'}, - ... ) # doctest: +SKIP - {"protocol": "hdfs", "username": "username", "password": "pwd", - "host": "node", "port": 123, "path": "/mnt/datasets/test.csv", - "url_query": "q=1", "extra": "value"} - """ - # Handle Windows paths including disk name in this special case - if ( - re.match(r"^[a-zA-Z]:[\\/]", urlpath) - or re.match(r"^[a-zA-Z0-9]+://", urlpath) is None - ): - return {"protocol": "file", "path": urlpath} - - parsed_path = urlsplit(urlpath) - protocol = parsed_path.scheme or "file" - if parsed_path.fragment: - path = "#".join([parsed_path.path, parsed_path.fragment]) - else: - path = parsed_path.path - if protocol == "file": - # Special case parsing file protocol URL on Windows according to: - # https://msdn.microsoft.com/en-us/library/jj710207.aspx - windows_path = re.match(r"^/([a-zA-Z])[:|]([\\/].*)$", path) - if windows_path: - path = "%s:%s" % windows_path.groups() - - if protocol in ["http", "https"]: - # for HTTP, we don't want to parse, as requests will anyway - return {"protocol": protocol, "path": urlpath} - - options = {"protocol": protocol, "path": path} - - if parsed_path.netloc: - # Parse `hostname` from netloc manually because `parsed_path.hostname` - # lowercases the hostname which is not always desirable (e.g. in S3): - # https://github.com/dask/dask/issues/1417 - options["host"] = parsed_path.netloc.rsplit("@", 1)[-1].rsplit(":", 1)[0] - - if protocol in ("s3", "s3a", "gcs", "gs"): - options["path"] = options["host"] + options["path"] - else: - options["host"] = options["host"] - if parsed_path.port: - options["port"] = parsed_path.port - if parsed_path.username: - options["username"] = parsed_path.username - if parsed_path.password: - options["password"] = parsed_path.password - - if parsed_path.query: - options["url_query"] = parsed_path.query - if parsed_path.fragment: - options["url_fragment"] = parsed_path.fragment - - if inherit_storage_options: - update_storage_options(options, inherit_storage_options) - - return options - - -def update_storage_options(options, inherited=None): - if not inherited: - inherited = {} - collisions = set(options) & set(inherited) - if collisions: - for collision in collisions: - if options.get(collision) != inherited.get(collision): - raise KeyError( - "Collision between inferred and specified storage " - "option:\n%s" % collision - ) - options.update(inherited) - - -# Compression extensions registered via fsspec.compression.register_compression -compressions: dict[str, str] = {} - - -def infer_compression(filename): - """Infer compression, if available, from filename. - - Infer a named compression type, if registered and available, from filename - extension. This includes builtin (gz, bz2, zip) compressions, as well as - optional compressions. See fsspec.compression.register_compression. - """ - extension = os.path.splitext(filename)[-1].strip(".").lower() - if extension in compressions: - return compressions[extension] - - -def build_name_function(max_int): - """Returns a function that receives a single integer - and returns it as a string padded by enough zero characters - to align with maximum possible integer - - >>> name_f = build_name_function(57) - - >>> name_f(7) - '07' - >>> name_f(31) - '31' - >>> build_name_function(1000)(42) - '0042' - >>> build_name_function(999)(42) - '042' - >>> build_name_function(0)(0) - '0' - """ - # handle corner cases max_int is 0 or exact power of 10 - max_int += 1e-8 - - pad_length = int(math.ceil(math.log10(max_int))) - - def name_function(i): - return str(i).zfill(pad_length) - - return name_function - - -def seek_delimiter(file, delimiter, blocksize): - r"""Seek current file to file start, file end, or byte after delimiter seq. - - Seeks file to next chunk delimiter, where chunks are defined on file start, - a delimiting sequence, and file end. Use file.tell() to see location afterwards. - Note that file start is a valid split, so must be at offset > 0 to seek for - delimiter. - - Parameters - ---------- - file: a file - delimiter: bytes - a delimiter like ``b'\n'`` or message sentinel, matching file .read() type - blocksize: int - Number of bytes to read from the file at once. - - - Returns - ------- - Returns True if a delimiter was found, False if at file start or end. - - """ - - if file.tell() == 0: - # beginning-of-file, return without seek - return False - - # Interface is for binary IO, with delimiter as bytes, but initialize last - # with result of file.read to preserve compatibility with text IO. - last = None - while True: - current = file.read(blocksize) - if not current: - # end-of-file without delimiter - return False - full = last + current if last else current - try: - if delimiter in full: - i = full.index(delimiter) - file.seek(file.tell() - (len(full) - i) + len(delimiter)) - return True - elif len(current) < blocksize: - # end-of-file without delimiter - return False - except (OSError, ValueError): - pass - last = full[-len(delimiter) :] - - -def read_block(f, offset, length, delimiter=None, split_before=False): - """Read a block of bytes from a file - - Parameters - ---------- - f: File - Open file - offset: int - Byte offset to start read - length: int - Number of bytes to read, read through end of file if None - delimiter: bytes (optional) - Ensure reading starts and stops at delimiter bytestring - split_before: bool (optional) - Start/stop read *before* delimiter bytestring. - - - If using the ``delimiter=`` keyword argument we ensure that the read - starts and stops at delimiter boundaries that follow the locations - ``offset`` and ``offset + length``. If ``offset`` is zero then we - start at zero, regardless of delimiter. The bytestring returned WILL - include the terminating delimiter string. - - Examples - -------- - - >>> from io import BytesIO # doctest: +SKIP - >>> f = BytesIO(b'Alice, 100\\nBob, 200\\nCharlie, 300') # doctest: +SKIP - >>> read_block(f, 0, 13) # doctest: +SKIP - b'Alice, 100\\nBo' - - >>> read_block(f, 0, 13, delimiter=b'\\n') # doctest: +SKIP - b'Alice, 100\\nBob, 200\\n' - - >>> read_block(f, 10, 10, delimiter=b'\\n') # doctest: +SKIP - b'Bob, 200\\nCharlie, 300' - """ - if delimiter: - f.seek(offset) - found_start_delim = seek_delimiter(f, delimiter, 2**16) - if length is None: - return f.read() - start = f.tell() - length -= start - offset - - f.seek(start + length) - found_end_delim = seek_delimiter(f, delimiter, 2**16) - end = f.tell() - - # Adjust split location to before delimiter iff seek found the - # delimiter sequence, not start or end of file. - if found_start_delim and split_before: - start -= len(delimiter) - - if found_end_delim and split_before: - end -= len(delimiter) - - offset = start - length = end - start - - f.seek(offset) - b = f.read(length) - return b - - -def tokenize(*args, **kwargs): - """Deterministic token - - (modified from dask.base) - - >>> tokenize([1, 2, '3']) - '9d71491b50023b06fc76928e6eddb952' - - >>> tokenize('Hello') == tokenize('Hello') - True - """ - if kwargs: - args += (kwargs,) - try: - return md5(str(args).encode()).hexdigest() - except ValueError: - # FIPS systems: https://github.com/fsspec/filesystem_spec/issues/380 - return md5(str(args).encode(), usedforsecurity=False).hexdigest() - - -def stringify_path(filepath): - """Attempt to convert a path-like object to a string. - - Parameters - ---------- - filepath: object to be converted - - Returns - ------- - filepath_str: maybe a string version of the object - - Notes - ----- - Objects supporting the fspath protocol are coerced according to its - __fspath__ method. - - For backwards compatibility with older Python version, pathlib.Path - objects are specially coerced. - - Any other object is passed through unchanged, which includes bytes, - strings, buffers, or anything else that's not even path-like. - """ - if isinstance(filepath, str): - return filepath - elif hasattr(filepath, "__fspath__"): - return filepath.__fspath__() - elif isinstance(filepath, pathlib.Path): - return str(filepath) - elif hasattr(filepath, "path"): - return filepath.path - else: - return filepath - - -def make_instance(cls, args, kwargs): - inst = cls(*args, **kwargs) - inst._determine_worker() - return inst - - -def common_prefix(paths): - """For a list of paths, find the shortest prefix common to all""" - parts = [p.split("/") for p in paths] - lmax = min(len(p) for p in parts) - end = 0 - for i in range(lmax): - end = all(p[i] == parts[0][i] for p in parts) - if not end: - break - i += end - return "/".join(parts[0][:i]) - - -def other_paths(paths, path2, exists=False, flatten=False): - """In bulk file operations, construct a new file tree from a list of files - - Parameters - ---------- - paths: list of str - The input file tree - path2: str or list of str - Root to construct the new list in. If this is already a list of str, we just - assert it has the right number of elements. - exists: bool (optional) - For a str destination, it is already exists (and is a dir), files should - end up inside. - flatten: bool (optional) - Whether to flatten the input directory tree structure so that the output files - are in the same directory. - - Returns - ------- - list of str - """ - - if isinstance(path2, str): - path2 = path2.rstrip("/") - - if flatten: - path2 = ["/".join((path2, p.split("/")[-1])) for p in paths] - else: - cp = common_prefix(paths) - if exists: - cp = cp.rsplit("/", 1)[0] - if not cp and all(not s.startswith("/") for s in paths): - path2 = ["/".join([path2, p]) for p in paths] - else: - path2 = [p.replace(cp, path2, 1) for p in paths] - else: - assert len(paths) == len(path2) - return path2 - - -def is_exception(obj): - return isinstance(obj, BaseException) - - -def isfilelike(f): - for attr in ["read", "close", "tell"]: - if not hasattr(f, attr): - return False - return True - - -def get_protocol(url): - parts = re.split(r"(\:\:|\://)", url, 1) - if len(parts) > 1: - return parts[0] - return "file" - - -def can_be_local(path): - """Can the given URL be used with open_local?""" - from fsspec import get_filesystem_class - - try: - return getattr(get_filesystem_class(get_protocol(path)), "local_file", False) - except (ValueError, ImportError): - # not in registry or import failed - return False - - -def get_package_version_without_import(name): - """For given package name, try to find the version without importing it - - Import and package.__version__ is still the backup here, so an import - *might* happen. - - Returns either the version string, or None if the package - or the version was not readily found. - """ - if name in sys.modules: - mod = sys.modules[name] - if hasattr(mod, "__version__"): - return mod.__version__ - try: - return version(name) - except: # noqa: E722 - pass - try: - import importlib - - mod = importlib.import_module(name) - return mod.__version__ - except (ImportError, AttributeError): - return None - - -def setup_logging(logger=None, logger_name=None, level="DEBUG", clear=True): - if logger is None and logger_name is None: - raise ValueError("Provide either logger object or logger name") - logger = logger or logging.getLogger(logger_name) - handle = logging.StreamHandler() - formatter = logging.Formatter( - "%(asctime)s - %(name)s - %(levelname)s - %(funcName)s -- %(message)s" - ) - handle.setFormatter(formatter) - if clear: - logger.handlers.clear() - logger.addHandler(handle) - logger.setLevel(level) - return logger - - -def _unstrip_protocol(name, fs): - return fs.unstrip_protocol(name) - - -def mirror_from(origin_name, methods): - """Mirror attributes and methods from the given - origin_name attribute of the instance to the - decorated class""" - - def origin_getter(method, self): - origin = getattr(self, origin_name) - return getattr(origin, method) - - def wrapper(cls): - for method in methods: - wrapped_method = partial(origin_getter, method) - setattr(cls, method, property(wrapped_method)) - return cls - - return wrapper - - -@contextlib.contextmanager -def nullcontext(obj): - yield obj - - -def merge_offset_ranges(paths, starts, ends, max_gap=0, max_block=None, sort=True): - """Merge adjacent byte-offset ranges when the inter-range - gap is <= `max_gap`, and when the merged byte range does not - exceed `max_block` (if specified). By default, this function - will re-order the input paths and byte ranges to ensure sorted - order. If the user can guarantee that the inputs are already - sorted, passing `sort=False` will skip the re-ordering. - """ - # Check input - if not isinstance(paths, list): - raise TypeError - if not isinstance(starts, list): - starts = [starts] * len(paths) - if not isinstance(ends, list): - ends = [starts] * len(paths) - if len(starts) != len(paths) or len(ends) != len(paths): - raise ValueError - - # Early Return - if len(starts) <= 1: - return paths, starts, ends - - starts = [s or 0 for s in starts] - # Sort by paths and then ranges if `sort=True` - if sort: - paths, starts, ends = [ - list(v) - for v in zip( - *sorted( - zip(paths, starts, ends), - ) - ) - ] - - if paths: - # Loop through the coupled `paths`, `starts`, and - # `ends`, and merge adjacent blocks when appropriate - new_paths = paths[:1] - new_starts = starts[:1] - new_ends = ends[:1] - for i in range(1, len(paths)): - if paths[i] == paths[i - 1] and new_ends[-1] is None: - continue - elif ( - paths[i] != paths[i - 1] - or ((starts[i] - new_ends[-1]) > max_gap) - or ((max_block is not None and (ends[i] - new_starts[-1]) > max_block)) - ): - # Cannot merge with previous block. - # Add new `paths`, `starts`, and `ends` elements - new_paths.append(paths[i]) - new_starts.append(starts[i]) - new_ends.append(ends[i]) - else: - # Merge with previous block by updating the - # last element of `ends` - new_ends[-1] = ends[i] - return new_paths, new_starts, new_ends - - # `paths` is empty. Just return input lists - return paths, starts, ends - - -def file_size(filelike): - """Find length of any open read-mode file-like""" - pos = filelike.tell() - try: - return filelike.seek(0, 2) - finally: - filelike.seek(pos) - - -@contextlib.contextmanager -def atomic_write(path: str, mode: str = "wb"): - """ - A context manager that opens a temporary file next to `path` and, on exit, - replaces `path` with the temporary file, thereby updating `path` - atomically. - """ - fd, fn = tempfile.mkstemp( - dir=os.path.dirname(path), prefix=os.path.basename(path) + "-" - ) - try: - with open(fd, mode) as fp: - yield fp - except BaseException: - with contextlib.suppress(FileNotFoundError): - os.unlink(fn) - raise - else: - os.replace(fn, path) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/LICENSE b/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/LICENSE deleted file mode 100644 index 261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/METADATA b/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/METADATA deleted file mode 100644 index b7b5deceb233db55c796f8b0b4978d46685e3d39..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/METADATA +++ /dev/null @@ -1,314 +0,0 @@ -Metadata-Version: 2.1 -Name: huggingface-hub -Version: 0.18.0 -Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub -Home-page: https://github.com/huggingface/huggingface_hub -Author: Hugging Face, Inc. -Author-email: julien@huggingface.co -License: Apache -Keywords: model-hub machine-learning models natural-language-processing deep-learning pytorch pretrained-models -Platform: UNKNOWN -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: Education -Classifier: Intended Audience :: Science/Research -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence -Requires-Python: >=3.8.0 -Description-Content-Type: text/markdown -License-File: LICENSE -Requires-Dist: filelock -Requires-Dist: fsspec >=2023.5.0 -Requires-Dist: requests -Requires-Dist: tqdm >=4.42.1 -Requires-Dist: pyyaml >=5.1 -Requires-Dist: typing-extensions >=3.7.4.3 -Requires-Dist: packaging >=20.9 -Provides-Extra: all -Requires-Dist: InquirerPy ==0.3.4 ; extra == 'all' -Requires-Dist: aiohttp ; extra == 'all' -Requires-Dist: pydantic <2.0 ; extra == 'all' -Requires-Dist: jedi ; extra == 'all' -Requires-Dist: Jinja2 ; extra == 'all' -Requires-Dist: pytest ; extra == 'all' -Requires-Dist: pytest-cov ; extra == 'all' -Requires-Dist: pytest-env ; extra == 'all' -Requires-Dist: pytest-xdist ; extra == 'all' -Requires-Dist: pytest-vcr ; extra == 'all' -Requires-Dist: pytest-asyncio ; extra == 'all' -Requires-Dist: urllib3 <2.0 ; extra == 'all' -Requires-Dist: soundfile ; extra == 'all' -Requires-Dist: Pillow ; extra == 'all' -Requires-Dist: gradio ; extra == 'all' -Requires-Dist: numpy ; extra == 'all' -Requires-Dist: black ==23.7 ; extra == 'all' -Requires-Dist: ruff >=0.0.241 ; extra == 'all' -Requires-Dist: mypy ==1.5.1 ; extra == 'all' -Requires-Dist: types-PyYAML ; extra == 'all' -Requires-Dist: types-requests ; extra == 'all' -Requires-Dist: types-simplejson ; extra == 'all' -Requires-Dist: types-toml ; extra == 'all' -Requires-Dist: types-tqdm ; extra == 'all' -Requires-Dist: types-urllib3 ; extra == 'all' -Provides-Extra: cli -Requires-Dist: InquirerPy ==0.3.4 ; extra == 'cli' -Provides-Extra: dev -Requires-Dist: InquirerPy ==0.3.4 ; extra == 'dev' -Requires-Dist: aiohttp ; extra == 'dev' -Requires-Dist: pydantic <2.0 ; extra == 'dev' -Requires-Dist: jedi ; extra == 'dev' -Requires-Dist: Jinja2 ; extra == 'dev' -Requires-Dist: pytest ; extra == 'dev' -Requires-Dist: pytest-cov ; extra == 'dev' -Requires-Dist: pytest-env ; extra == 'dev' -Requires-Dist: pytest-xdist ; extra == 'dev' -Requires-Dist: pytest-vcr ; extra == 'dev' -Requires-Dist: pytest-asyncio ; extra == 'dev' -Requires-Dist: urllib3 <2.0 ; extra == 'dev' -Requires-Dist: soundfile ; extra == 'dev' -Requires-Dist: Pillow ; extra == 'dev' -Requires-Dist: gradio ; extra == 'dev' -Requires-Dist: numpy ; extra == 'dev' -Requires-Dist: black ==23.7 ; extra == 'dev' -Requires-Dist: ruff >=0.0.241 ; extra == 'dev' -Requires-Dist: mypy ==1.5.1 ; extra == 'dev' -Requires-Dist: types-PyYAML ; extra == 'dev' -Requires-Dist: types-requests ; extra == 'dev' -Requires-Dist: types-simplejson ; extra == 'dev' -Requires-Dist: types-toml ; extra == 'dev' -Requires-Dist: types-tqdm ; extra == 'dev' -Requires-Dist: types-urllib3 ; extra == 'dev' -Provides-Extra: docs -Requires-Dist: InquirerPy ==0.3.4 ; extra == 'docs' -Requires-Dist: aiohttp ; extra == 'docs' -Requires-Dist: pydantic <2.0 ; extra == 'docs' -Requires-Dist: jedi ; extra == 'docs' -Requires-Dist: Jinja2 ; extra == 'docs' -Requires-Dist: pytest ; extra == 'docs' -Requires-Dist: pytest-cov ; extra == 'docs' -Requires-Dist: pytest-env ; extra == 'docs' -Requires-Dist: pytest-xdist ; extra == 'docs' -Requires-Dist: pytest-vcr ; extra == 'docs' -Requires-Dist: pytest-asyncio ; extra == 'docs' -Requires-Dist: urllib3 <2.0 ; extra == 'docs' -Requires-Dist: soundfile ; extra == 'docs' -Requires-Dist: Pillow ; extra == 'docs' -Requires-Dist: gradio ; extra == 'docs' -Requires-Dist: numpy ; extra == 'docs' -Requires-Dist: black ==23.7 ; extra == 'docs' -Requires-Dist: ruff >=0.0.241 ; extra == 'docs' -Requires-Dist: mypy ==1.5.1 ; extra == 'docs' -Requires-Dist: types-PyYAML ; extra == 'docs' -Requires-Dist: types-requests ; extra == 'docs' -Requires-Dist: types-simplejson ; extra == 'docs' -Requires-Dist: types-toml ; extra == 'docs' -Requires-Dist: types-tqdm ; extra == 'docs' -Requires-Dist: types-urllib3 ; extra == 'docs' -Requires-Dist: hf-doc-builder ; extra == 'docs' -Requires-Dist: watchdog ; extra == 'docs' -Provides-Extra: fastai -Requires-Dist: toml ; extra == 'fastai' -Requires-Dist: fastai >=2.4 ; extra == 'fastai' -Requires-Dist: fastcore >=1.3.27 ; extra == 'fastai' -Provides-Extra: inference -Requires-Dist: aiohttp ; extra == 'inference' -Requires-Dist: pydantic <2.0 ; extra == 'inference' -Provides-Extra: quality -Requires-Dist: black ==23.7 ; extra == 'quality' -Requires-Dist: ruff >=0.0.241 ; extra == 'quality' -Requires-Dist: mypy ==1.5.1 ; extra == 'quality' -Provides-Extra: tensorflow -Requires-Dist: tensorflow ; extra == 'tensorflow' -Requires-Dist: pydot ; extra == 'tensorflow' -Requires-Dist: graphviz ; extra == 'tensorflow' -Provides-Extra: testing -Requires-Dist: InquirerPy ==0.3.4 ; extra == 'testing' -Requires-Dist: aiohttp ; extra == 'testing' -Requires-Dist: pydantic <2.0 ; extra == 'testing' -Requires-Dist: jedi ; extra == 'testing' -Requires-Dist: Jinja2 ; extra == 'testing' -Requires-Dist: pytest ; extra == 'testing' -Requires-Dist: pytest-cov ; extra == 'testing' -Requires-Dist: pytest-env ; extra == 'testing' -Requires-Dist: pytest-xdist ; extra == 'testing' -Requires-Dist: pytest-vcr ; extra == 'testing' -Requires-Dist: pytest-asyncio ; extra == 'testing' -Requires-Dist: urllib3 <2.0 ; extra == 'testing' -Requires-Dist: soundfile ; extra == 'testing' -Requires-Dist: Pillow ; extra == 'testing' -Requires-Dist: gradio ; extra == 'testing' -Requires-Dist: numpy ; extra == 'testing' -Provides-Extra: torch -Requires-Dist: torch ; extra == 'torch' -Provides-Extra: typing -Requires-Dist: types-PyYAML ; extra == 'typing' -Requires-Dist: types-requests ; extra == 'typing' -Requires-Dist: types-simplejson ; extra == 'typing' -Requires-Dist: types-toml ; extra == 'typing' -Requires-Dist: types-tqdm ; extra == 'typing' -Requires-Dist: types-urllib3 ; extra == 'typing' -Requires-Dist: pydantic <2.0 ; extra == 'typing' - -

-
- huggingface_hub library logo -
-

- -

- The official Python client for the Huggingface Hub. -

- -

- Documentation - GitHub release - PyPi version - downloads - Code coverage -

- -

-

- English | - Deutsch | - 한국어 -

-

---- - -**Documentation**: https://hf.co/docs/huggingface_hub - -**Source Code**: https://github.com/huggingface/huggingface_hub - ---- - -## Welcome to the huggingface_hub library - -The `huggingface_hub` library allows you to interact with the [Hugging Face Hub](https://huggingface.co/), a platform democratizing open-source Machine Learning for creators and collaborators. Discover pre-trained models and datasets for your projects or play with the thousands of machine learning apps hosted on the Hub. You can also create and share your own models, datasets and demos with the community. The `huggingface_hub` library provides a simple way to do all these things with Python. - -## Key features - -- [Download files](https://huggingface.co/docs/huggingface_hub/en/guides/download) from the Hub. -- [Upload files](https://huggingface.co/docs/huggingface_hub/en/guides/upload) to the Hub. -- [Manage your repositories](https://huggingface.co/docs/huggingface_hub/en/guides/repository). -- [Run Inference](https://huggingface.co/docs/huggingface_hub/en/guides/inference) on deployed models. -- [Search](https://huggingface.co/docs/huggingface_hub/en/guides/search) for models, datasets and Spaces. -- [Share Model Cards](https://huggingface.co/docs/huggingface_hub/en/guides/model-cards) to document your models. -- [Engage with the community](https://huggingface.co/docs/huggingface_hub/en/guides/community) through PRs and comments. - -## Installation - -Install the `huggingface_hub` package with [pip](https://pypi.org/project/huggingface-hub/): - -```bash -pip install huggingface_hub -``` - -If you prefer, you can also install it with [conda](https://huggingface.co/docs/huggingface_hub/en/installation#install-with-conda). - -In order to keep the package minimal by default, `huggingface_hub` comes with optional dependencies useful for some use cases. For example, if you want have a complete experience for Inference, run: - -```bash -pip install huggingface_hub[inference] -``` - -To learn more installation and optional dependencies, check out the [installation guide](https://huggingface.co/docs/huggingface_hub/en/installation). - -## Quick start - -### Download files - -Download a single file - -```py -from huggingface_hub import hf_hub_download - -hf_hub_download(repo_id="tiiuae/falcon-7b-instruct", filename="config.json") -``` - -Or an entire repository - -```py -from huggingface_hub import snapshot_download - -snapshot_download("stabilityai/stable-diffusion-2-1") -``` - -Files will be downloaded in a local cache folder. More details in [this guide](https://huggingface.co/docs/huggingface_hub/en/guides/manage-cache). - -### Login - -The Hugging Face Hub uses tokens to authenticate applications (see [docs](https://huggingface.co/docs/hub/security-tokens)). To login your machine, run the following CLI: - -```bash -huggingface-cli login -# or using an environment variable -huggingface-cli login --token $HUGGINGFACE_TOKEN -``` - -### Create a repository - -```py -from huggingface_hub import create_repo - -create_repo(repo_id="super-cool-model") -``` - -### Upload files - -Upload a single file - -```py -from huggingface_hub import upload_file - -upload_file( - path_or_fileobj="/home/lysandre/dummy-test/README.md", - path_in_repo="README.md", - repo_id="lysandre/test-model", -) -``` - -Or an entire folder - -```py -from huggingface_hub import upload_folder - -upload_folder( - folder_path="/path/to/local/space", - repo_id="username/my-cool-space", - repo_type="space", -) -``` - -For details in the [upload guide](https://huggingface.co/docs/huggingface_hub/en/guides/upload). - -## Integrating to the Hub. - -We're partnering with cool open source ML libraries to provide free model hosting and versioning. You can find the existing integrations [here](https://huggingface.co/docs/hub/libraries). - -The advantages are: - -- Free model or dataset hosting for libraries and their users. -- Built-in file versioning, even with very large files, thanks to a git-based approach. -- Hosted inference API for all models publicly available. -- In-browser widgets to play with the uploaded models. -- Anyone can upload a new model for your library, they just need to add the corresponding tag for the model to be discoverable. -- Fast downloads! We use Cloudfront (a CDN) to geo-replicate downloads so they're blazing fast from anywhere on the globe. -- Usage stats and more features to come. - -If you would like to integrate your library, feel free to open an issue to begin the discussion. We wrote a [step-by-step guide](https://huggingface.co/docs/hub/adding-a-library) with ❤️ showing how to do this integration. - -## Contributions (feature requests, bugs, etc.) are super welcome 💙💚💛💜🧡❤️ - -Everyone is welcome to contribute, and we value everybody's contribution. Code is not the only way to help the community. -Answering questions, helping others, reaching out and improving the documentations are immensely valuable to the community. -We wrote a [contribution guide](https://github.com/huggingface/huggingface_hub/blob/main/CONTRIBUTING.md) to summarize -how to get started to contribute to this repository. - - diff --git a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/RECORD b/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/RECORD deleted file mode 100644 index a747c6bf1bc8340c9a44863bb1390043e8fdb6cf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/RECORD +++ /dev/null @@ -1,138 +0,0 @@ -../../../bin/huggingface-cli,sha256=Ijk8ialEDBr18fk3F3ArHssQQULrseftvqWusyljyZ8,276 -huggingface_hub-0.18.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -huggingface_hub-0.18.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357 -huggingface_hub-0.18.0.dist-info/METADATA,sha256=QFxmMhRD72QPjDccBiDP6zh3CklbxN-Q6_bGzHHwGkg,13425 -huggingface_hub-0.18.0.dist-info/RECORD,, -huggingface_hub-0.18.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92 -huggingface_hub-0.18.0.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131 -huggingface_hub-0.18.0.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16 -huggingface_hub/__init__.py,sha256=_3RgmiOpCthej3ZJexwk_MBLVfSf13tvAIB4UX-TfLk,18780 -huggingface_hub/__pycache__/__init__.cpython-38.pyc,, -huggingface_hub/__pycache__/_commit_api.cpython-38.pyc,, -huggingface_hub/__pycache__/_commit_scheduler.cpython-38.pyc,, -huggingface_hub/__pycache__/_login.cpython-38.pyc,, -huggingface_hub/__pycache__/_multi_commits.cpython-38.pyc,, -huggingface_hub/__pycache__/_snapshot_download.cpython-38.pyc,, -huggingface_hub/__pycache__/_space_api.cpython-38.pyc,, -huggingface_hub/__pycache__/_tensorboard_logger.cpython-38.pyc,, -huggingface_hub/__pycache__/_webhooks_payload.cpython-38.pyc,, -huggingface_hub/__pycache__/_webhooks_server.cpython-38.pyc,, -huggingface_hub/__pycache__/community.cpython-38.pyc,, -huggingface_hub/__pycache__/constants.cpython-38.pyc,, -huggingface_hub/__pycache__/fastai_utils.cpython-38.pyc,, -huggingface_hub/__pycache__/file_download.cpython-38.pyc,, -huggingface_hub/__pycache__/hf_api.cpython-38.pyc,, -huggingface_hub/__pycache__/hf_file_system.cpython-38.pyc,, -huggingface_hub/__pycache__/hub_mixin.cpython-38.pyc,, -huggingface_hub/__pycache__/inference_api.cpython-38.pyc,, -huggingface_hub/__pycache__/keras_mixin.cpython-38.pyc,, -huggingface_hub/__pycache__/lfs.cpython-38.pyc,, -huggingface_hub/__pycache__/repocard.cpython-38.pyc,, -huggingface_hub/__pycache__/repocard_data.cpython-38.pyc,, -huggingface_hub/__pycache__/repository.cpython-38.pyc,, -huggingface_hub/_commit_api.py,sha256=2OA0mNhjnVJWuhhKlkLcQQxGtnJhZ0RX1wRg0eOcgFM,26108 -huggingface_hub/_commit_scheduler.py,sha256=FgfjYv3E0oK3iBxDdy45Y7t78FWkmjnBR4dRd5aZviU,13653 -huggingface_hub/_login.py,sha256=x23VDrus7c4w_g0OgdgiihzgR0iwsaq-58xvgTSloSw,14265 -huggingface_hub/_multi_commits.py,sha256=j1Pvo-c8H5lWIh1lixIWCE4KXTBMK5f2gc7o8U6wSoo,12502 -huggingface_hub/_snapshot_download.py,sha256=LadYOT122mE1qZn3Bo5LXX1fBfRZEFSuXS4bxUDgI3Q,11873 -huggingface_hub/_space_api.py,sha256=mxV1CnFZX3Qi9xjpuNicFLCz-ZRDXm2D6wokYET7Q7s,4988 -huggingface_hub/_tensorboard_logger.py,sha256=_gBNoN9mq1_63H95m8lNDkuPjnf7xVD4KFkCoxxIagU,7164 -huggingface_hub/_webhooks_payload.py,sha256=_J_wdbIsJWKcJgAHR-TedLH22cpa8bzuVAGSqKriJ2o,2754 -huggingface_hub/_webhooks_server.py,sha256=2wETO28XU2NSLnG-ardYbcLCuVbPL8e_Pl83_4-MngA,14757 -huggingface_hub/commands/__init__.py,sha256=AkbM2a-iGh0Vq_xAWhK3mu3uZ44km8-X5uWjKcvcrUQ,928 -huggingface_hub/commands/__pycache__/__init__.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/_cli_utils.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/delete_cache.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/download.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/env.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/huggingface_cli.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/lfs.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/scan_cache.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/upload.cpython-38.pyc,, -huggingface_hub/commands/__pycache__/user.cpython-38.pyc,, -huggingface_hub/commands/_cli_utils.py,sha256=VA_3cHzIlsEQmKPnfNTgJNI36UtcrxRmfB44RdbP1LA,1970 -huggingface_hub/commands/delete_cache.py,sha256=9Nn2ihdORPpkULkhAzju6aYar2rsa4laSE38rt8645I,16130 -huggingface_hub/commands/download.py,sha256=sthMmLQD3E0uybAlGoYt1Mpk_8w7r_im7FyDGJrZWyo,9161 -huggingface_hub/commands/env.py,sha256=LJjOxo-m0DrvQdyhWGjnLGtWt91ec63BMI4FQ-5bWXQ,1225 -huggingface_hub/commands/huggingface_cli.py,sha256=o862C98OcZoyqCzY7mNpia1h0KaLJUgSb0y10ot8sxA,1924 -huggingface_hub/commands/lfs.py,sha256=Y0ENdtUKO1rwfslUE1jUuBhobpzvsG952auIFgBrHzM,7348 -huggingface_hub/commands/scan_cache.py,sha256=nMEJxBScezxs00EWyAvJtWCjhwxCL1YlBE6qNfiT3RY,5182 -huggingface_hub/commands/upload.py,sha256=nDUKGE8WVM_rppo06iZjvaOBhuHN9Ex3CFc-7dN0hys,12894 -huggingface_hub/commands/user.py,sha256=aPnSVO4OU86rb8NAL43s-5i2QDBfj0UoeubBJLJ1i8M,6955 -huggingface_hub/community.py,sha256=FTuDzikTckQKCU29ZoeEHCg_qRXEqqdiPY3_dIiTsAo,12088 -huggingface_hub/constants.py,sha256=rhZDyP6P4XLmK4eVMlQnQquqnBm10543K8HD0vHJsoM,5797 -huggingface_hub/fastai_utils.py,sha256=5I7zAfgHJU_mZnxnf9wgWTHrCRu_EAV8VTangDVfE_o,16676 -huggingface_hub/file_download.py,sha256=Een96F-0Qfgd1OdwWTJB3vGKI3jGwFBhBpW7zUThrAI,72994 -huggingface_hub/hf_api.py,sha256=nqtGF4j-POdZXneTCUBx9UdGZT9NFr80iyyFBiAf6Ck,274139 -huggingface_hub/hf_file_system.py,sha256=GxjLvgwZEYzoCpHQxRVzJuqMBz_v43Nk55g2JEo5hio,19822 -huggingface_hub/hub_mixin.py,sha256=owjmMbrZ_LjbURBrGp99XmHMXiPAj3cDdosG92mkLpI,16130 -huggingface_hub/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -huggingface_hub/inference/__pycache__/__init__.cpython-38.pyc,, -huggingface_hub/inference/__pycache__/_client.cpython-38.pyc,, -huggingface_hub/inference/__pycache__/_common.cpython-38.pyc,, -huggingface_hub/inference/__pycache__/_text_generation.cpython-38.pyc,, -huggingface_hub/inference/__pycache__/_types.cpython-38.pyc,, -huggingface_hub/inference/_client.py,sha256=vMixe4Qege02o-DUHyEX5Ub6GGh4AL8qMeVD4PdpxlA,83323 -huggingface_hub/inference/_common.py,sha256=uvA9c2W8vSUGkJNpbx2qHMtD5FVL5GVcE7HaVty3qKY,11338 -huggingface_hub/inference/_generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -huggingface_hub/inference/_generated/__pycache__/__init__.cpython-38.pyc,, -huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-38.pyc,, -huggingface_hub/inference/_generated/_async_client.py,sha256=y-YICUeIKp50gxHm7YuHUly-cEDAL8SZ9j6TZss6jas,86187 -huggingface_hub/inference/_text_generation.py,sha256=R_muTr3yx4StxA3gcru8hqBxd3F5eCJmUNVBLsTk-GE,17274 -huggingface_hub/inference/_types.py,sha256=fRrORbJbZqCxZVQG4HK4Zx4xHwPej-Hppz_cb1wJ1I0,5664 -huggingface_hub/inference_api.py,sha256=BMYNBYIZixXgIXPFiMfgY3Mki39bsSiXbPVTmPoZMkk,8334 -huggingface_hub/keras_mixin.py,sha256=BG_Ck_dbaKecW2y2keGXAxVSpPyLACLmWVsd2larcJU,18837 -huggingface_hub/lfs.py,sha256=ZEmyc1CdA3BuPmqkTGDCT2h4IB-r5DqA47E8gouPS6g,17884 -huggingface_hub/repocard.py,sha256=xgHKwiz10LKnTBuvU0RJPtx_eDJAuOaPn3JDSO1Qorc,34311 -huggingface_hub/repocard_data.py,sha256=GBcgbCUV4kcwht0VExoUJpIogxZUnGQhR2qQBeD34AE,29580 -huggingface_hub/repository.py,sha256=ioL9eEV0ITtV5LbJ85IQ-EV7prqZmPWkiUen9PWDA3s,53703 -huggingface_hub/templates/datasetcard_template.md,sha256=tWvaTQhO3WkU9Igi8Odwb44my9oYKAakb2ArfnTn1AU,5502 -huggingface_hub/templates/modelcard_template.md,sha256=d4Ssf9kkmWT3ycOhmjRHFmtuZZtwnuYxaMw8vGhXiag,6860 -huggingface_hub/utils/__init__.py,sha256=2zT29QdBGpI0dTfeHVKlu6FiXI68fRVhR18QBJBCnaU,3008 -huggingface_hub/utils/__pycache__/__init__.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_cache_assets.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_cache_manager.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_chunk_utils.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_datetime.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_deprecation.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_errors.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_experimental.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_fixes.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_git_credential.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_headers.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_hf_folder.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_http.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_pagination.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_paths.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_runtime.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_subprocess.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_telemetry.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_typing.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/_validators.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/logging.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/sha.cpython-38.pyc,, -huggingface_hub/utils/__pycache__/tqdm.cpython-38.pyc,, -huggingface_hub/utils/_cache_assets.py,sha256=QmI_qlzsOpjK0B6k4GYiLFrKzq3mFLQVoTn2pmWqshE,5755 -huggingface_hub/utils/_cache_manager.py,sha256=r-x578yTOhnW1-EyAnw8L8jgon2okT-k5cRA3hDVDv0,29097 -huggingface_hub/utils/_chunk_utils.py,sha256=6VRyjiGr2bPupPl1azSUTxKuJ51wdgELipwJ2YRfH5U,2129 -huggingface_hub/utils/_datetime.py,sha256=RA92d7k3pV6JKmRXFvsofgp1oHfjMZb5Y-X0vpTIkgQ,2728 -huggingface_hub/utils/_deprecation.py,sha256=oc30GmTjW1ccr8I7_-WnGaPYfqNrnJ8CNkQSUu0uAX4,4735 -huggingface_hub/utils/_errors.py,sha256=T6AyAqXpt1ZKiGqIYvWe3PhiFNtXtfK_hFoKrJMXk38,13490 -huggingface_hub/utils/_experimental.py,sha256=rBx4gV2NU1dT_OfeRzsCmCWyIF4Wxcf0PdkmIASoT6o,2394 -huggingface_hub/utils/_fixes.py,sha256=wFvfTYj62Il2OwkQB_Qp0xONG6SARQ5oEkT3_FhB4rc,2437 -huggingface_hub/utils/_git_credential.py,sha256=8tOMTZBPTm7Z2nTw-6OknP6BW9zglLJK-wwiPI9FxIM,4047 -huggingface_hub/utils/_headers.py,sha256=OwP8mzgMwXKLhjwRPwy0Q6-NeQLOgitF2CHuF8o8rzs,9358 -huggingface_hub/utils/_hf_folder.py,sha256=_94Fo9S-r8mvqFWXW6cvV1jA2Q6S-wSH44JOBxMbZ04,3876 -huggingface_hub/utils/_http.py,sha256=CTgSlkQO575XRLRrf7Dzgt1f6hiUVCOBxFKa3uVGvuc,11922 -huggingface_hub/utils/_pagination.py,sha256=VfpmMLyNCRo24fw0o_yWysMK69d9M6sSg2-nWtuypO4,1840 -huggingface_hub/utils/_paths.py,sha256=nUaxXN-R2EcWfHE8ivFWfHqEKMIvXEdUeCGDC_QHMqc,4397 -huggingface_hub/utils/_runtime.py,sha256=l3uzjQzcVGBfpeLv6YziyWYEZIlZTrhnkwqNqDa1k0g,8890 -huggingface_hub/utils/_subprocess.py,sha256=LW9b8TWh9rsm3pW9_5b-mVV_AtYNyLXgC6e09SthkWI,4616 -huggingface_hub/utils/_telemetry.py,sha256=jHAdgWNcL9nVvMT3ec3i78O-cwL09GnlifuokzpQjMI,4641 -huggingface_hub/utils/_typing.py,sha256=zTA0nTJAILGveXbJKyeh6u9uIagrFgPoRqr-uCEGDQI,921 -huggingface_hub/utils/_validators.py,sha256=3ZmHubjslDRwFYe1oKyaUw6DZrc3DsuV2gABPrx7PTw,9358 -huggingface_hub/utils/endpoint_helpers.py,sha256=KCIjPkv2goSpD6b4EI6TIPK28lyQaewV3eUw5yMlrCY,12857 -huggingface_hub/utils/logging.py,sha256=-Uov2WGLv16hS-V4Trvs_XO-TvSeZ1xIWZ-cfvDl7ac,4778 -huggingface_hub/utils/sha.py,sha256=Wmeh2lwS2H0_CNLqDk_mNyb4jAjfTdlG6FZsuh6LqVg,890 -huggingface_hub/utils/tqdm.py,sha256=zBWgoxxwHooOceABVREVqSNpJGcMpaByKFVDU8VbuUQ,6334 diff --git a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/WHEEL b/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/WHEEL deleted file mode 100644 index 7e688737d490be3643d705bc16b5a77f7bd567b7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.41.2) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/entry_points.txt b/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/entry_points.txt deleted file mode 100644 index eb3dafd90f19de60b3e520aeaf8132402980214d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/entry_points.txt +++ /dev/null @@ -1,6 +0,0 @@ -[console_scripts] -huggingface-cli = huggingface_hub.commands.huggingface_cli:main - -[fsspec.specs] -hf=huggingface_hub.HfFileSystem - diff --git a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/top_level.txt deleted file mode 100644 index 6b964ccca3c1b6766042b3fe3b2707ba25372924..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub-0.18.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -huggingface_hub diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__init__.py b/venv/lib/python3.8/site-packages/huggingface_hub/__init__.py deleted file mode 100644 index 188b03edf233bc4cdbc747124eac706d65a6a372..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/__init__.py +++ /dev/null @@ -1,598 +0,0 @@ -# Copyright 2020 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# *********** -# `huggingface_hub` init has 2 modes: -# - Normal usage: -# If imported to use it, all modules and functions are lazy-loaded. This means -# they exist at top level in module but are imported only the first time they are -# used. This way, `from huggingface_hub import something` will import `something` -# quickly without the hassle of importing all the features from `huggingface_hub`. -# - Static check: -# If statically analyzed, all modules and functions are loaded normally. This way -# static typing check works properly as well as autocomplete in text editors and -# IDEs. -# -# The static model imports are done inside the `if TYPE_CHECKING:` statement at -# the bottom of this file. Since module/functions imports are duplicated, it is -# mandatory to make sure to add them twice when adding one. This is checked in the -# `make quality` command. -# -# To update the static imports, please run the following command and commit the changes. -# ``` -# # Use script -# python utils/check_static_imports.py --update-file -# -# # Or run style on codebase -# make style -# ``` -# -# *********** -# Lazy loader vendored from https://github.com/scientific-python/lazy_loader -import importlib -import os -import sys -from typing import TYPE_CHECKING - - -__version__ = "0.18.0" - -# Alphabetical order of definitions is ensured in tests -# WARNING: any comment added in this dictionary definition will be lost when -# re-generating the file ! -_SUBMOD_ATTRS = { - "_commit_scheduler": [ - "CommitScheduler", - ], - "_login": [ - "interpreter_login", - "login", - "logout", - "notebook_login", - ], - "_multi_commits": [ - "MultiCommitException", - "plan_multi_commits", - ], - "_snapshot_download": [ - "snapshot_download", - ], - "_space_api": [ - "SpaceHardware", - "SpaceRuntime", - "SpaceStage", - "SpaceStorage", - "SpaceVariable", - ], - "_tensorboard_logger": [ - "HFSummaryWriter", - ], - "_webhooks_payload": [ - "WebhookPayload", - "WebhookPayloadComment", - "WebhookPayloadDiscussion", - "WebhookPayloadDiscussionChanges", - "WebhookPayloadEvent", - "WebhookPayloadMovedTo", - "WebhookPayloadRepo", - "WebhookPayloadUrl", - "WebhookPayloadWebhook", - ], - "_webhooks_server": [ - "WebhooksServer", - "webhook_endpoint", - ], - "community": [ - "Discussion", - "DiscussionComment", - "DiscussionCommit", - "DiscussionEvent", - "DiscussionStatusChange", - "DiscussionTitleChange", - "DiscussionWithDetails", - ], - "constants": [ - "CONFIG_NAME", - "FLAX_WEIGHTS_NAME", - "HUGGINGFACE_CO_URL_HOME", - "HUGGINGFACE_CO_URL_TEMPLATE", - "PYTORCH_WEIGHTS_NAME", - "REPO_TYPE_DATASET", - "REPO_TYPE_MODEL", - "REPO_TYPE_SPACE", - "TF2_WEIGHTS_NAME", - "TF_WEIGHTS_NAME", - ], - "fastai_utils": [ - "_save_pretrained_fastai", - "from_pretrained_fastai", - "push_to_hub_fastai", - ], - "file_download": [ - "HfFileMetadata", - "_CACHED_NO_EXIST", - "cached_download", - "get_hf_file_metadata", - "hf_hub_download", - "hf_hub_url", - "try_to_load_from_cache", - ], - "hf_api": [ - "Collection", - "CollectionItem", - "CommitInfo", - "CommitOperation", - "CommitOperationAdd", - "CommitOperationCopy", - "CommitOperationDelete", - "DatasetSearchArguments", - "GitCommitInfo", - "GitRefInfo", - "GitRefs", - "HfApi", - "ModelSearchArguments", - "RepoUrl", - "User", - "UserLikes", - "add_collection_item", - "add_space_secret", - "add_space_variable", - "change_discussion_status", - "comment_discussion", - "create_branch", - "create_collection", - "create_commit", - "create_commits_on_pr", - "create_discussion", - "create_pull_request", - "create_repo", - "create_tag", - "dataset_info", - "delete_branch", - "delete_collection", - "delete_collection_item", - "delete_file", - "delete_folder", - "delete_repo", - "delete_space_secret", - "delete_space_storage", - "delete_space_variable", - "delete_tag", - "duplicate_space", - "edit_discussion_comment", - "file_exists", - "get_collection", - "get_dataset_tags", - "get_discussion_details", - "get_full_repo_name", - "get_model_tags", - "get_repo_discussions", - "get_space_runtime", - "get_space_variables", - "get_token_permission", - "like", - "list_datasets", - "list_files_info", - "list_liked_repos", - "list_metrics", - "list_models", - "list_repo_commits", - "list_repo_files", - "list_repo_likers", - "list_repo_refs", - "list_spaces", - "merge_pull_request", - "model_info", - "move_repo", - "pause_space", - "preupload_lfs_files", - "rename_discussion", - "repo_exists", - "repo_info", - "repo_type_and_id_from_hf_id", - "request_space_hardware", - "request_space_storage", - "restart_space", - "run_as_future", - "set_space_sleep_time", - "space_info", - "super_squash_history", - "unlike", - "update_collection_item", - "update_collection_metadata", - "update_repo_visibility", - "upload_file", - "upload_folder", - "whoami", - ], - "hf_file_system": [ - "HfFileSystem", - "HfFileSystemFile", - "HfFileSystemResolvedPath", - ], - "hub_mixin": [ - "ModelHubMixin", - "PyTorchModelHubMixin", - ], - "inference._client": [ - "InferenceClient", - "InferenceTimeoutError", - ], - "inference._generated._async_client": [ - "AsyncInferenceClient", - ], - "inference_api": [ - "InferenceApi", - ], - "keras_mixin": [ - "KerasModelHubMixin", - "from_pretrained_keras", - "push_to_hub_keras", - "save_pretrained_keras", - ], - "repocard": [ - "DatasetCard", - "ModelCard", - "RepoCard", - "SpaceCard", - "metadata_eval_result", - "metadata_load", - "metadata_save", - "metadata_update", - ], - "repocard_data": [ - "CardData", - "DatasetCardData", - "EvalResult", - "ModelCardData", - "SpaceCardData", - ], - "repository": [ - "Repository", - ], - "utils": [ - "CacheNotFound", - "CachedFileInfo", - "CachedRepoInfo", - "CachedRevisionInfo", - "CorruptedCacheException", - "DeleteCacheStrategy", - "HFCacheInfo", - "HfFolder", - "cached_assets_path", - "configure_http_backend", - "dump_environment_info", - "get_session", - "logging", - "scan_cache_dir", - ], - "utils.endpoint_helpers": [ - "DatasetFilter", - "ModelFilter", - ], -} - - -def _attach(package_name, submodules=None, submod_attrs=None): - """Attach lazily loaded submodules, functions, or other attributes. - - Typically, modules import submodules and attributes as follows: - - ```py - import mysubmodule - import anothersubmodule - - from .foo import someattr - ``` - - The idea is to replace a package's `__getattr__`, `__dir__`, and - `__all__`, such that all imports work exactly the way they would - with normal imports, except that the import occurs upon first use. - - The typical way to call this function, replacing the above imports, is: - - ```python - __getattr__, __dir__, __all__ = lazy.attach( - __name__, - ['mysubmodule', 'anothersubmodule'], - {'foo': ['someattr']} - ) - ``` - This functionality requires Python 3.7 or higher. - - Args: - package_name (`str`): - Typically use `__name__`. - submodules (`set`): - List of submodules to attach. - submod_attrs (`dict`): - Dictionary of submodule -> list of attributes / functions. - These attributes are imported as they are used. - - Returns: - __getattr__, __dir__, __all__ - - """ - if submod_attrs is None: - submod_attrs = {} - - if submodules is None: - submodules = set() - else: - submodules = set(submodules) - - attr_to_modules = {attr: mod for mod, attrs in submod_attrs.items() for attr in attrs} - - __all__ = list(submodules | attr_to_modules.keys()) - - def __getattr__(name): - if name in submodules: - return importlib.import_module(f"{package_name}.{name}") - elif name in attr_to_modules: - submod_path = f"{package_name}.{attr_to_modules[name]}" - submod = importlib.import_module(submod_path) - attr = getattr(submod, name) - - # If the attribute lives in a file (module) with the same - # name as the attribute, ensure that the attribute and *not* - # the module is accessible on the package. - if name == attr_to_modules[name]: - pkg = sys.modules[package_name] - pkg.__dict__[name] = attr - - return attr - else: - raise AttributeError(f"No {package_name} attribute {name}") - - def __dir__(): - return __all__ - - if os.environ.get("EAGER_IMPORT", ""): - for attr in set(attr_to_modules.keys()) | submodules: - __getattr__(attr) - - return __getattr__, __dir__, list(__all__) - - -__getattr__, __dir__, __all__ = _attach(__name__, submodules=[], submod_attrs=_SUBMOD_ATTRS) - -# WARNING: any content below this statement is generated automatically. Any manual edit -# will be lost when re-generating this file ! -# -# To update the static imports, please run the following command and commit the changes. -# ``` -# # Use script -# python utils/check_static_imports.py --update-file -# -# # Or run style on codebase -# make style -# ``` -if TYPE_CHECKING: # pragma: no cover - from ._commit_scheduler import CommitScheduler # noqa: F401 - from ._login import ( - interpreter_login, # noqa: F401 - login, # noqa: F401 - logout, # noqa: F401 - notebook_login, # noqa: F401 - ) - from ._multi_commits import ( - MultiCommitException, # noqa: F401 - plan_multi_commits, # noqa: F401 - ) - from ._snapshot_download import snapshot_download # noqa: F401 - from ._space_api import ( - SpaceHardware, # noqa: F401 - SpaceRuntime, # noqa: F401 - SpaceStage, # noqa: F401 - SpaceStorage, # noqa: F401 - SpaceVariable, # noqa: F401 - ) - from ._tensorboard_logger import HFSummaryWriter # noqa: F401 - from ._webhooks_payload import ( - WebhookPayload, # noqa: F401 - WebhookPayloadComment, # noqa: F401 - WebhookPayloadDiscussion, # noqa: F401 - WebhookPayloadDiscussionChanges, # noqa: F401 - WebhookPayloadEvent, # noqa: F401 - WebhookPayloadMovedTo, # noqa: F401 - WebhookPayloadRepo, # noqa: F401 - WebhookPayloadUrl, # noqa: F401 - WebhookPayloadWebhook, # noqa: F401 - ) - from ._webhooks_server import ( - WebhooksServer, # noqa: F401 - webhook_endpoint, # noqa: F401 - ) - from .community import ( - Discussion, # noqa: F401 - DiscussionComment, # noqa: F401 - DiscussionCommit, # noqa: F401 - DiscussionEvent, # noqa: F401 - DiscussionStatusChange, # noqa: F401 - DiscussionTitleChange, # noqa: F401 - DiscussionWithDetails, # noqa: F401 - ) - from .constants import ( - CONFIG_NAME, # noqa: F401 - FLAX_WEIGHTS_NAME, # noqa: F401 - HUGGINGFACE_CO_URL_HOME, # noqa: F401 - HUGGINGFACE_CO_URL_TEMPLATE, # noqa: F401 - PYTORCH_WEIGHTS_NAME, # noqa: F401 - REPO_TYPE_DATASET, # noqa: F401 - REPO_TYPE_MODEL, # noqa: F401 - REPO_TYPE_SPACE, # noqa: F401 - TF2_WEIGHTS_NAME, # noqa: F401 - TF_WEIGHTS_NAME, # noqa: F401 - ) - from .fastai_utils import ( - _save_pretrained_fastai, # noqa: F401 - from_pretrained_fastai, # noqa: F401 - push_to_hub_fastai, # noqa: F401 - ) - from .file_download import ( - _CACHED_NO_EXIST, # noqa: F401 - HfFileMetadata, # noqa: F401 - cached_download, # noqa: F401 - get_hf_file_metadata, # noqa: F401 - hf_hub_download, # noqa: F401 - hf_hub_url, # noqa: F401 - try_to_load_from_cache, # noqa: F401 - ) - from .hf_api import ( - Collection, # noqa: F401 - CollectionItem, # noqa: F401 - CommitInfo, # noqa: F401 - CommitOperation, # noqa: F401 - CommitOperationAdd, # noqa: F401 - CommitOperationCopy, # noqa: F401 - CommitOperationDelete, # noqa: F401 - DatasetSearchArguments, # noqa: F401 - GitCommitInfo, # noqa: F401 - GitRefInfo, # noqa: F401 - GitRefs, # noqa: F401 - HfApi, # noqa: F401 - ModelSearchArguments, # noqa: F401 - RepoUrl, # noqa: F401 - User, # noqa: F401 - UserLikes, # noqa: F401 - add_collection_item, # noqa: F401 - add_space_secret, # noqa: F401 - add_space_variable, # noqa: F401 - change_discussion_status, # noqa: F401 - comment_discussion, # noqa: F401 - create_branch, # noqa: F401 - create_collection, # noqa: F401 - create_commit, # noqa: F401 - create_commits_on_pr, # noqa: F401 - create_discussion, # noqa: F401 - create_pull_request, # noqa: F401 - create_repo, # noqa: F401 - create_tag, # noqa: F401 - dataset_info, # noqa: F401 - delete_branch, # noqa: F401 - delete_collection, # noqa: F401 - delete_collection_item, # noqa: F401 - delete_file, # noqa: F401 - delete_folder, # noqa: F401 - delete_repo, # noqa: F401 - delete_space_secret, # noqa: F401 - delete_space_storage, # noqa: F401 - delete_space_variable, # noqa: F401 - delete_tag, # noqa: F401 - duplicate_space, # noqa: F401 - edit_discussion_comment, # noqa: F401 - file_exists, # noqa: F401 - get_collection, # noqa: F401 - get_dataset_tags, # noqa: F401 - get_discussion_details, # noqa: F401 - get_full_repo_name, # noqa: F401 - get_model_tags, # noqa: F401 - get_repo_discussions, # noqa: F401 - get_space_runtime, # noqa: F401 - get_space_variables, # noqa: F401 - get_token_permission, # noqa: F401 - like, # noqa: F401 - list_datasets, # noqa: F401 - list_files_info, # noqa: F401 - list_liked_repos, # noqa: F401 - list_metrics, # noqa: F401 - list_models, # noqa: F401 - list_repo_commits, # noqa: F401 - list_repo_files, # noqa: F401 - list_repo_likers, # noqa: F401 - list_repo_refs, # noqa: F401 - list_spaces, # noqa: F401 - merge_pull_request, # noqa: F401 - model_info, # noqa: F401 - move_repo, # noqa: F401 - pause_space, # noqa: F401 - preupload_lfs_files, # noqa: F401 - rename_discussion, # noqa: F401 - repo_exists, # noqa: F401 - repo_info, # noqa: F401 - repo_type_and_id_from_hf_id, # noqa: F401 - request_space_hardware, # noqa: F401 - request_space_storage, # noqa: F401 - restart_space, # noqa: F401 - run_as_future, # noqa: F401 - set_space_sleep_time, # noqa: F401 - space_info, # noqa: F401 - super_squash_history, # noqa: F401 - unlike, # noqa: F401 - update_collection_item, # noqa: F401 - update_collection_metadata, # noqa: F401 - update_repo_visibility, # noqa: F401 - upload_file, # noqa: F401 - upload_folder, # noqa: F401 - whoami, # noqa: F401 - ) - from .hf_file_system import ( - HfFileSystem, # noqa: F401 - HfFileSystemFile, # noqa: F401 - HfFileSystemResolvedPath, # noqa: F401 - ) - from .hub_mixin import ( - ModelHubMixin, # noqa: F401 - PyTorchModelHubMixin, # noqa: F401 - ) - from .inference._client import ( - InferenceClient, # noqa: F401 - InferenceTimeoutError, # noqa: F401 - ) - from .inference._generated._async_client import AsyncInferenceClient # noqa: F401 - from .inference_api import InferenceApi # noqa: F401 - from .keras_mixin import ( - KerasModelHubMixin, # noqa: F401 - from_pretrained_keras, # noqa: F401 - push_to_hub_keras, # noqa: F401 - save_pretrained_keras, # noqa: F401 - ) - from .repocard import ( - DatasetCard, # noqa: F401 - ModelCard, # noqa: F401 - RepoCard, # noqa: F401 - SpaceCard, # noqa: F401 - metadata_eval_result, # noqa: F401 - metadata_load, # noqa: F401 - metadata_save, # noqa: F401 - metadata_update, # noqa: F401 - ) - from .repocard_data import ( - CardData, # noqa: F401 - DatasetCardData, # noqa: F401 - EvalResult, # noqa: F401 - ModelCardData, # noqa: F401 - SpaceCardData, # noqa: F401 - ) - from .repository import Repository # noqa: F401 - from .utils import ( - CachedFileInfo, # noqa: F401 - CachedRepoInfo, # noqa: F401 - CachedRevisionInfo, # noqa: F401 - CacheNotFound, # noqa: F401 - CorruptedCacheException, # noqa: F401 - DeleteCacheStrategy, # noqa: F401 - HFCacheInfo, # noqa: F401 - HfFolder, # noqa: F401 - cached_assets_path, # noqa: F401 - configure_http_backend, # noqa: F401 - dump_environment_info, # noqa: F401 - get_session, # noqa: F401 - logging, # noqa: F401 - scan_cache_dir, # noqa: F401 - ) - from .utils.endpoint_helpers import ( - DatasetFilter, # noqa: F401 - ModelFilter, # noqa: F401 - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 2ac52b6617f1b97d8a6d123494d8c436098b1364..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_commit_api.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_commit_api.cpython-38.pyc deleted file mode 100644 index 12924ea34997b5b976da9c6037f14e01c244badb..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_commit_api.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_commit_scheduler.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_commit_scheduler.cpython-38.pyc deleted file mode 100644 index 9cd1b7f8754196781d61d70df9f23a6590226aec..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_commit_scheduler.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_login.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_login.cpython-38.pyc deleted file mode 100644 index 3c8d6c0a5298a6a20b8c27b638f4750bd84dedb3..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_login.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_multi_commits.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_multi_commits.cpython-38.pyc deleted file mode 100644 index e5dc9a82261badb80776d6ce7c6041924e1e6f03..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_multi_commits.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_snapshot_download.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_snapshot_download.cpython-38.pyc deleted file mode 100644 index 3eb28bf4711dce71d8519e262aa9a97618bc6055..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_snapshot_download.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_space_api.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_space_api.cpython-38.pyc deleted file mode 100644 index 3bb724c2d621fb29e0bd244348c46de464b41d06..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_space_api.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_tensorboard_logger.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_tensorboard_logger.cpython-38.pyc deleted file mode 100644 index b9f3ef36d20d3f7fddad9240af479d1eaf97a49c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_tensorboard_logger.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_webhooks_payload.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_webhooks_payload.cpython-38.pyc deleted file mode 100644 index 4c7ea91e814a0f986ccb23ff1f084c309175e6e1..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_webhooks_payload.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_webhooks_server.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_webhooks_server.cpython-38.pyc deleted file mode 100644 index e7675d31a4fd4f1f0039eb547a3cfe8be28eb7f0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/_webhooks_server.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/community.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/community.cpython-38.pyc deleted file mode 100644 index 3acbd66e997d0a84a6ebc8e48ca529f055451f4b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/community.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/constants.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/constants.cpython-38.pyc deleted file mode 100644 index 224940d8f048198807964bc90ebe398541b3ebc7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/constants.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/fastai_utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/fastai_utils.cpython-38.pyc deleted file mode 100644 index 76ebf29cbb35aa99924e7c1f07d17d8692e232f3..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/fastai_utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/file_download.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/file_download.cpython-38.pyc deleted file mode 100644 index c08f6a2d64d06aba623b95349bd22bdd5f04e5f8..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/file_download.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hf_api.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hf_api.cpython-38.pyc deleted file mode 100644 index 19526cd8309b379bde5b438028a5c35f2708761d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hf_api.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hf_file_system.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hf_file_system.cpython-38.pyc deleted file mode 100644 index b7991f5587a2889006bf2df37c4544197ec51839..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hf_file_system.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hub_mixin.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hub_mixin.cpython-38.pyc deleted file mode 100644 index a6cfc0fc270ae38d55e644163ce87667ed85e053..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/hub_mixin.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/inference_api.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/inference_api.cpython-38.pyc deleted file mode 100644 index 9cfb90f5cce9c44a8682c983941a61cebf32ca94..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/inference_api.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/keras_mixin.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/keras_mixin.cpython-38.pyc deleted file mode 100644 index c03a2b96d8ed99a8f04a51bc71cc6114d769703f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/keras_mixin.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/lfs.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/lfs.cpython-38.pyc deleted file mode 100644 index 54e90b2dba7a5280022937cdc0f9789698086372..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/lfs.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repocard.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repocard.cpython-38.pyc deleted file mode 100644 index 6515f311f8555a605a7f5346c41ec94cdb838101..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repocard.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-38.pyc deleted file mode 100644 index 5a75749c646562648d8cbaacaab04dd7730e3e02..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repository.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repository.cpython-38.pyc deleted file mode 100644 index aac4212b772399d495603388b500bc26a2f2479c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/__pycache__/repository.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_commit_api.py b/venv/lib/python3.8/site-packages/huggingface_hub/_commit_api.py deleted file mode 100644 index bdf481e2653d41ee364dc7cadf4321778224175b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_commit_api.py +++ /dev/null @@ -1,637 +0,0 @@ -""" -Type definitions and utilities for the `create_commit` API -""" -import base64 -import io -import os -import warnings -from collections import defaultdict -from contextlib import contextmanager -from dataclasses import dataclass, field -from itertools import groupby -from pathlib import Path, PurePosixPath -from typing import TYPE_CHECKING, Any, BinaryIO, Dict, Iterable, Iterator, List, Literal, Optional, Tuple, Union - -from tqdm.contrib.concurrent import thread_map - -from huggingface_hub import get_session - -from .constants import ENDPOINT, HF_HUB_ENABLE_HF_TRANSFER -from .lfs import UploadInfo, lfs_upload, post_lfs_batch_info -from .utils import ( - EntryNotFoundError, - build_hf_headers, - chunk_iterable, - hf_raise_for_status, - logging, - tqdm_stream_file, - validate_hf_hub_args, -) -from .utils import tqdm as hf_tqdm - - -if TYPE_CHECKING: - from .hf_api import RepoFile - - -logger = logging.get_logger(__name__) - - -UploadMode = Literal["lfs", "regular"] - -# Max is 1,000 per request on the Hub for HfApi.list_files_info -# Otherwise we get: -# HfHubHTTPError: 413 Client Error: Payload Too Large for url: https://huggingface.co/api/datasets/xxx (Request ID: xxx)\n\ntoo many parameters -# See https://github.com/huggingface/huggingface_hub/issues/1503 -FETCH_LFS_BATCH_SIZE = 500 - - -@dataclass -class CommitOperationDelete: - """ - Data structure holding necessary info to delete a file or a folder from a repository - on the Hub. - - Args: - path_in_repo (`str`): - Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"` - for a file or `"checkpoints/1fec34a/"` for a folder. - is_folder (`bool` or `Literal["auto"]`, *optional*) - Whether the Delete Operation applies to a folder or not. If "auto", the path - type (file or folder) is guessed automatically by looking if path ends with - a "/" (folder) or not (file). To explicitly set the path type, you can set - `is_folder=True` or `is_folder=False`. - """ - - path_in_repo: str - is_folder: Union[bool, Literal["auto"]] = "auto" - - def __post_init__(self): - self.path_in_repo = _validate_path_in_repo(self.path_in_repo) - - if self.is_folder == "auto": - self.is_folder = self.path_in_repo.endswith("/") - if not isinstance(self.is_folder, bool): - raise ValueError( - f"Wrong value for `is_folder`. Must be one of [`True`, `False`, `'auto'`]. Got '{self.is_folder}'." - ) - - -@dataclass -class CommitOperationCopy: - """ - Data structure holding necessary info to copy a file in a repository on the Hub. - - Limitations: - - Only LFS files can be copied. To copy a regular file, you need to download it locally and re-upload it - - Cross-repository copies are not supported. - - Note: you can combine a [`CommitOperationCopy`] and a [`CommitOperationDelete`] to rename an LFS file on the Hub. - - Args: - src_path_in_repo (`str`): - Relative filepath in the repo of the file to be copied, e.g. `"checkpoints/1fec34a/weights.bin"`. - path_in_repo (`str`): - Relative filepath in the repo where to copy the file, e.g. `"checkpoints/1fec34a/weights_copy.bin"`. - src_revision (`str`, *optional*): - The git revision of the file to be copied. Can be any valid git revision. - Default to the target commit revision. - """ - - src_path_in_repo: str - path_in_repo: str - src_revision: Optional[str] = None - - def __post_init__(self): - self.src_path_in_repo = _validate_path_in_repo(self.src_path_in_repo) - self.path_in_repo = _validate_path_in_repo(self.path_in_repo) - - -@dataclass -class CommitOperationAdd: - """ - Data structure holding necessary info to upload a file to a repository on the Hub. - - Args: - path_in_repo (`str`): - Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"` - path_or_fileobj (`str`, `Path`, `bytes`, or `BinaryIO`): - Either: - - a path to a local file (as `str` or `pathlib.Path`) to upload - - a buffer of bytes (`bytes`) holding the content of the file to upload - - a "file object" (subclass of `io.BufferedIOBase`), typically obtained - with `open(path, "rb")`. It must support `seek()` and `tell()` methods. - - Raises: - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If `path_or_fileobj` is not one of `str`, `Path`, `bytes` or `io.BufferedIOBase`. - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If `path_or_fileobj` is a `str` or `Path` but not a path to an existing file. - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If `path_or_fileobj` is a `io.BufferedIOBase` but it doesn't support both - `seek()` and `tell()`. - """ - - path_in_repo: str - path_or_fileobj: Union[str, Path, bytes, BinaryIO] - upload_info: UploadInfo = field(init=False, repr=False) - - # Internal attributes - _upload_mode: Optional[UploadMode] = field( - init=False, repr=False, default=None - ) # set to "lfs" or "regular" once known - _is_uploaded: bool = field( - init=False, repr=False, default=False - ) # set to True once the file has been uploaded as LFS - _is_committed: bool = field(init=False, repr=False, default=False) # set to True once the file has been committed - - def __post_init__(self) -> None: - """Validates `path_or_fileobj` and compute `upload_info`.""" - self.path_in_repo = _validate_path_in_repo(self.path_in_repo) - - # Validate `path_or_fileobj` value - if isinstance(self.path_or_fileobj, Path): - self.path_or_fileobj = str(self.path_or_fileobj) - if isinstance(self.path_or_fileobj, str): - path_or_fileobj = os.path.normpath(os.path.expanduser(self.path_or_fileobj)) - if not os.path.isfile(path_or_fileobj): - raise ValueError(f"Provided path: '{path_or_fileobj}' is not a file on the local file system") - elif not isinstance(self.path_or_fileobj, (io.BufferedIOBase, bytes)): - # ^^ Inspired from: https://stackoverflow.com/questions/44584829/how-to-determine-if-file-is-opened-in-binary-or-text-mode - raise ValueError( - "path_or_fileobj must be either an instance of str, bytes or" - " io.BufferedIOBase. If you passed a file-like object, make sure it is" - " in binary mode." - ) - if isinstance(self.path_or_fileobj, io.BufferedIOBase): - try: - self.path_or_fileobj.tell() - self.path_or_fileobj.seek(0, os.SEEK_CUR) - except (OSError, AttributeError) as exc: - raise ValueError( - "path_or_fileobj is a file-like object but does not implement seek() and tell()" - ) from exc - - # Compute "upload_info" attribute - if isinstance(self.path_or_fileobj, str): - self.upload_info = UploadInfo.from_path(self.path_or_fileobj) - elif isinstance(self.path_or_fileobj, bytes): - self.upload_info = UploadInfo.from_bytes(self.path_or_fileobj) - else: - self.upload_info = UploadInfo.from_fileobj(self.path_or_fileobj) - - @contextmanager - def as_file(self, with_tqdm: bool = False) -> Iterator[BinaryIO]: - """ - A context manager that yields a file-like object allowing to read the underlying - data behind `path_or_fileobj`. - - Args: - with_tqdm (`bool`, *optional*, defaults to `False`): - If True, iterating over the file object will display a progress bar. Only - works if the file-like object is a path to a file. Pure bytes and buffers - are not supported. - - Example: - - ```python - >>> operation = CommitOperationAdd( - ... path_in_repo="remote/dir/weights.h5", - ... path_or_fileobj="./local/weights.h5", - ... ) - CommitOperationAdd(path_in_repo='remote/dir/weights.h5', path_or_fileobj='./local/weights.h5') - - >>> with operation.as_file() as file: - ... content = file.read() - - >>> with operation.as_file(with_tqdm=True) as file: - ... while True: - ... data = file.read(1024) - ... if not data: - ... break - config.json: 100%|█████████████████████████| 8.19k/8.19k [00:02<00:00, 3.72kB/s] - - >>> with operation.as_file(with_tqdm=True) as file: - ... requests.put(..., data=file) - config.json: 100%|█████████████████████████| 8.19k/8.19k [00:02<00:00, 3.72kB/s] - ``` - """ - if isinstance(self.path_or_fileobj, str) or isinstance(self.path_or_fileobj, Path): - if with_tqdm: - with tqdm_stream_file(self.path_or_fileobj) as file: - yield file - else: - with open(self.path_or_fileobj, "rb") as file: - yield file - elif isinstance(self.path_or_fileobj, bytes): - yield io.BytesIO(self.path_or_fileobj) - elif isinstance(self.path_or_fileobj, io.BufferedIOBase): - prev_pos = self.path_or_fileobj.tell() - yield self.path_or_fileobj - self.path_or_fileobj.seek(prev_pos, io.SEEK_SET) - - def b64content(self) -> bytes: - """ - The base64-encoded content of `path_or_fileobj` - - Returns: `bytes` - """ - with self.as_file() as file: - return base64.b64encode(file.read()) - - -def _validate_path_in_repo(path_in_repo: str) -> str: - # Validate `path_in_repo` value to prevent a server-side issue - if path_in_repo.startswith("/"): - path_in_repo = path_in_repo[1:] - if path_in_repo == "." or path_in_repo == ".." or path_in_repo.startswith("../"): - raise ValueError(f"Invalid `path_in_repo` in CommitOperation: '{path_in_repo}'") - if path_in_repo.startswith("./"): - path_in_repo = path_in_repo[2:] - if any(part == ".git" for part in path_in_repo.split("/")): - raise ValueError( - "Invalid `path_in_repo` in CommitOperation: cannot update files under a '.git/' folder (path:" - f" '{path_in_repo}')." - ) - return path_in_repo - - -CommitOperation = Union[CommitOperationAdd, CommitOperationCopy, CommitOperationDelete] - - -def _warn_on_overwriting_operations(operations: List[CommitOperation]) -> None: - """ - Warn user when a list of operations is expected to overwrite itself in a single - commit. - - Rules: - - If a filepath is updated by multiple `CommitOperationAdd` operations, a warning - message is triggered. - - If a filepath is updated at least once by a `CommitOperationAdd` and then deleted - by a `CommitOperationDelete`, a warning is triggered. - - If a `CommitOperationDelete` deletes a filepath that is then updated by a - `CommitOperationAdd`, no warning is triggered. This is usually useless (no need to - delete before upload) but can happen if a user deletes an entire folder and then - add new files to it. - """ - nb_additions_per_path: Dict[str, int] = defaultdict(int) - for operation in operations: - path_in_repo = operation.path_in_repo - if isinstance(operation, CommitOperationAdd): - if nb_additions_per_path[path_in_repo] > 0: - warnings.warn( - "About to update multiple times the same file in the same commit:" - f" '{path_in_repo}'. This can cause undesired inconsistencies in" - " your repo." - ) - nb_additions_per_path[path_in_repo] += 1 - for parent in PurePosixPath(path_in_repo).parents: - # Also keep track of number of updated files per folder - # => warns if deleting a folder overwrite some contained files - nb_additions_per_path[str(parent)] += 1 - if isinstance(operation, CommitOperationDelete): - if nb_additions_per_path[str(PurePosixPath(path_in_repo))] > 0: - if operation.is_folder: - warnings.warn( - "About to delete a folder containing files that have just been" - f" updated within the same commit: '{path_in_repo}'. This can" - " cause undesired inconsistencies in your repo." - ) - else: - warnings.warn( - "About to delete a file that have just been updated within the" - f" same commit: '{path_in_repo}'. This can cause undesired" - " inconsistencies in your repo." - ) - - -@validate_hf_hub_args -def _upload_lfs_files( - *, - additions: List[CommitOperationAdd], - repo_type: str, - repo_id: str, - token: Optional[str], - endpoint: Optional[str] = None, - num_threads: int = 5, -): - """ - Uploads the content of `additions` to the Hub using the large file storage protocol. - - Relevant external documentation: - - LFS Batch API: https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md - - Args: - additions (`List` of `CommitOperationAdd`): - The files to be uploaded - repo_type (`str`): - Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`. - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - token (`str`, *optional*): - An authentication token ( See https://huggingface.co/settings/tokens ) - num_threads (`int`, *optional*): - The number of concurrent threads to use when uploading. Defaults to 5. - - - Raises: `RuntimeError` if an upload failed for any reason - - Raises: `ValueError` if the server returns malformed responses - - Raises: `requests.HTTPError` if the LFS batch endpoint returned an HTTP - error - - """ - # Step 1: retrieve upload instructions from the LFS batch endpoint. - # Upload instructions are retrieved by chunk of 256 files to avoid reaching - # the payload limit. - batch_actions: List[Dict] = [] - for chunk in chunk_iterable(additions, chunk_size=256): - batch_actions_chunk, batch_errors_chunk = post_lfs_batch_info( - upload_infos=[op.upload_info for op in chunk], - token=token, - repo_id=repo_id, - repo_type=repo_type, - endpoint=endpoint, - ) - - # If at least 1 error, we do not retrieve information for other chunks - if batch_errors_chunk: - message = "\n".join( - [ - f'Encountered error for file with OID {err.get("oid")}: `{err.get("error", {}).get("message")}' - for err in batch_errors_chunk - ] - ) - raise ValueError(f"LFS batch endpoint returned errors:\n{message}") - - batch_actions += batch_actions_chunk - oid2addop = {add_op.upload_info.sha256.hex(): add_op for add_op in additions} - - # Step 2: ignore files that have already been uploaded - filtered_actions = [] - for action in batch_actions: - if action.get("actions") is None: - logger.debug( - f"Content of file {oid2addop[action['oid']].path_in_repo} is already" - " present upstream - skipping upload." - ) - else: - filtered_actions.append(action) - - if len(filtered_actions) == 0: - logger.debug("No LFS files to upload.") - return - - # Step 3: upload files concurrently according to these instructions - def _wrapped_lfs_upload(batch_action) -> None: - try: - operation = oid2addop[batch_action["oid"]] - lfs_upload(operation=operation, lfs_batch_action=batch_action, token=token) - except Exception as exc: - raise RuntimeError(f"Error while uploading '{operation.path_in_repo}' to the Hub.") from exc - - if HF_HUB_ENABLE_HF_TRANSFER: - logger.debug(f"Uploading {len(filtered_actions)} LFS files to the Hub using `hf_transfer`.") - for action in hf_tqdm(filtered_actions): - _wrapped_lfs_upload(action) - elif len(filtered_actions) == 1: - logger.debug("Uploading 1 LFS file to the Hub") - _wrapped_lfs_upload(filtered_actions[0]) - else: - logger.debug( - f"Uploading {len(filtered_actions)} LFS files to the Hub using up to {num_threads} threads concurrently" - ) - thread_map( - _wrapped_lfs_upload, - filtered_actions, - desc=f"Upload {len(filtered_actions)} LFS files", - max_workers=num_threads, - tqdm_class=hf_tqdm, - ) - - -def _validate_preupload_info(preupload_info: dict): - files = preupload_info.get("files") - if not isinstance(files, list): - raise ValueError("preupload_info is improperly formatted") - for file_info in files: - if not ( - isinstance(file_info, dict) - and isinstance(file_info.get("path"), str) - and isinstance(file_info.get("uploadMode"), str) - and (file_info["uploadMode"] in ("lfs", "regular")) - ): - raise ValueError("preupload_info is improperly formatted:") - return preupload_info - - -@validate_hf_hub_args -def _fetch_upload_modes( - additions: Iterable[CommitOperationAdd], - repo_type: str, - repo_id: str, - token: Optional[str], - revision: str, - endpoint: Optional[str] = None, - create_pr: bool = False, -) -> None: - """ - Requests the Hub "preupload" endpoint to determine whether each input file should be uploaded as a regular git blob - or as git LFS blob. Input `additions` are mutated in-place with the upload mode. - - Args: - additions (`Iterable` of :class:`CommitOperationAdd`): - Iterable of :class:`CommitOperationAdd` describing the files to - upload to the Hub. - repo_type (`str`): - Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`. - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - token (`str`, *optional*): - An authentication token ( See https://huggingface.co/settings/tokens ) - revision (`str`): - The git revision to upload the files to. Can be any valid git revision. - - Raises: - [`~utils.HfHubHTTPError`] - If the Hub API returned an error. - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If the Hub API response is improperly formatted. - """ - endpoint = endpoint if endpoint is not None else ENDPOINT - headers = build_hf_headers(token=token) - - # Fetch upload mode (LFS or regular) chunk by chunk. - upload_modes: Dict[str, UploadMode] = {} - for chunk in chunk_iterable(additions, 256): - payload = { - "files": [ - { - "path": op.path_in_repo, - "sample": base64.b64encode(op.upload_info.sample).decode("ascii"), - "size": op.upload_info.size, - "sha": op.upload_info.sha256.hex(), - } - for op in chunk - ] - } - - resp = get_session().post( - f"{endpoint}/api/{repo_type}s/{repo_id}/preupload/{revision}", - json=payload, - headers=headers, - params={"create_pr": "1"} if create_pr else None, - ) - hf_raise_for_status(resp) - preupload_info = _validate_preupload_info(resp.json()) - upload_modes.update(**{file["path"]: file["uploadMode"] for file in preupload_info["files"]}) - - # Set upload mode for each addition operation - for addition in additions: - addition._upload_mode = upload_modes[addition.path_in_repo] - - # Empty files cannot be uploaded as LFS (S3 would fail with a 501 Not Implemented) - # => empty files are uploaded as "regular" to still allow users to commit them. - for addition in additions: - if addition.upload_info.size == 0: - addition._upload_mode = "regular" - - -@validate_hf_hub_args -def _fetch_lfs_files_to_copy( - copies: Iterable[CommitOperationCopy], - repo_type: str, - repo_id: str, - token: Optional[str], - revision: str, - endpoint: Optional[str] = None, -) -> Dict[Tuple[str, Optional[str]], "RepoFile"]: - """ - Requests the Hub files information of the LFS files to be copied, including their sha256. - - Args: - copies (`Iterable` of :class:`CommitOperationCopy`): - Iterable of :class:`CommitOperationCopy` describing the files to - copy on the Hub. - repo_type (`str`): - Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`. - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - token (`str`, *optional*): - An authentication token ( See https://huggingface.co/settings/tokens ) - revision (`str`): - The git revision to upload the files to. Can be any valid git revision. - - Returns: `Dict[Tuple[str, Optional[str]], RepoFile]]` - Key is the file path and revision of the file to copy, value is the repo file. - - Raises: - [`~utils.HfHubHTTPError`] - If the Hub API returned an error. - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If the Hub API response is improperly formatted. - """ - from .hf_api import HfApi - - hf_api = HfApi(endpoint=endpoint, token=token) - files_to_copy = {} - for src_revision, operations in groupby(copies, key=lambda op: op.src_revision): - operations = list(operations) # type: ignore - paths = [op.src_path_in_repo for op in operations] - for offset in range(0, len(paths), FETCH_LFS_BATCH_SIZE): - src_repo_files = hf_api.list_files_info( - repo_id=repo_id, - paths=paths[offset : offset + FETCH_LFS_BATCH_SIZE], - revision=src_revision or revision, - repo_type=repo_type, - ) - for src_repo_file in src_repo_files: - if not src_repo_file.lfs: - raise NotImplementedError("Copying a non-LFS file is not implemented") - files_to_copy[(src_repo_file.rfilename, src_revision)] = src_repo_file - for operation in operations: - if (operation.src_path_in_repo, src_revision) not in files_to_copy: - raise EntryNotFoundError( - f"Cannot copy {operation.src_path_in_repo} at revision " - f"{src_revision or revision}: file is missing on repo." - ) - return files_to_copy - - -def _prepare_commit_payload( - operations: Iterable[CommitOperation], - files_to_copy: Dict[Tuple[str, Optional[str]], "RepoFile"], - commit_message: str, - commit_description: Optional[str] = None, - parent_commit: Optional[str] = None, -) -> Iterable[Dict[str, Any]]: - """ - Builds the payload to POST to the `/commit` API of the Hub. - - Payload is returned as an iterator so that it can be streamed as a ndjson in the - POST request. - - For more information, see: - - https://github.com/huggingface/huggingface_hub/issues/1085#issuecomment-1265208073 - - http://ndjson.org/ - """ - commit_description = commit_description if commit_description is not None else "" - - # 1. Send a header item with the commit metadata - header_value = {"summary": commit_message, "description": commit_description} - if parent_commit is not None: - header_value["parentCommit"] = parent_commit - yield {"key": "header", "value": header_value} - - # 2. Send operations, one per line - for operation in operations: - # 2.a. Case adding a regular file - if isinstance(operation, CommitOperationAdd) and operation._upload_mode == "regular": - yield { - "key": "file", - "value": { - "content": operation.b64content().decode(), - "path": operation.path_in_repo, - "encoding": "base64", - }, - } - # 2.b. Case adding an LFS file - elif isinstance(operation, CommitOperationAdd) and operation._upload_mode == "lfs": - yield { - "key": "lfsFile", - "value": { - "path": operation.path_in_repo, - "algo": "sha256", - "oid": operation.upload_info.sha256.hex(), - "size": operation.upload_info.size, - }, - } - # 2.c. Case deleting a file or folder - elif isinstance(operation, CommitOperationDelete): - yield { - "key": "deletedFolder" if operation.is_folder else "deletedFile", - "value": {"path": operation.path_in_repo}, - } - # 2.d. Case copying a file or folder - elif isinstance(operation, CommitOperationCopy): - file_to_copy = files_to_copy[(operation.src_path_in_repo, operation.src_revision)] - if not file_to_copy.lfs: - raise NotImplementedError("Copying a non-LFS file is not implemented") - yield { - "key": "lfsFile", - "value": { - "path": operation.path_in_repo, - "algo": "sha256", - "oid": file_to_copy.lfs["sha256"], - }, - } - # 2.e. Never expected to happen - else: - raise ValueError( - f"Unknown operation to commit. Operation: {operation}. Upload mode:" - f" {getattr(operation, '_upload_mode', None)}" - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_commit_scheduler.py b/venv/lib/python3.8/site-packages/huggingface_hub/_commit_scheduler.py deleted file mode 100644 index 80d8dac7866a4eeef888d36cfbb974aa06a9930b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_commit_scheduler.py +++ /dev/null @@ -1,327 +0,0 @@ -import atexit -import logging -import os -import time -from concurrent.futures import Future -from dataclasses import dataclass -from io import SEEK_END, SEEK_SET, BytesIO -from pathlib import Path -from threading import Lock, Thread -from typing import Dict, List, Optional, Union - -from .hf_api import IGNORE_GIT_FOLDER_PATTERNS, CommitInfo, CommitOperationAdd, HfApi -from .utils import filter_repo_objects - - -logger = logging.getLogger(__name__) - - -@dataclass(frozen=True) -class _FileToUpload: - """Temporary dataclass to store info about files to upload. Not meant to be used directly.""" - - local_path: Path - path_in_repo: str - size_limit: int - last_modified: float - - -class CommitScheduler: - """ - Scheduler to upload a local folder to the Hub at regular intervals (e.g. push to hub every 5 minutes). - - The scheduler is started when instantiated and run indefinitely. At the end of your script, a last commit is - triggered. Checkout the [upload guide](https://huggingface.co/docs/huggingface_hub/guides/upload#scheduled-uploads) - to learn more about how to use it. - - Args: - repo_id (`str`): - The id of the repo to commit to. - folder_path (`str` or `Path`): - Path to the local folder to upload regularly. - every (`int` or `float`, *optional*): - The number of minutes between each commit. Defaults to 5 minutes. - path_in_repo (`str`, *optional*): - Relative path of the directory in the repo, for example: `"checkpoints/"`. Defaults to the root folder - of the repository. - repo_type (`str`, *optional*): - The type of the repo to commit to. Defaults to `model`. - revision (`str`, *optional*): - The revision of the repo to commit to. Defaults to `main`. - private (`bool`, *optional*): - Whether to make the repo private. Defaults to `False`. This value is ignored if the repo already exist. - token (`str`, *optional*): - The token to use to commit to the repo. Defaults to the token saved on the machine. - allow_patterns (`List[str]` or `str`, *optional*): - If provided, only files matching at least one pattern are uploaded. - ignore_patterns (`List[str]` or `str`, *optional*): - If provided, files matching any of the patterns are not uploaded. - squash_history (`bool`, *optional*): - Whether to squash the history of the repo after each commit. Defaults to `False`. Squashing commits is - useful to avoid degraded performances on the repo when it grows too large. - hf_api (`HfApi`, *optional*): - The [`HfApi`] client to use to commit to the Hub. Can be set with custom settings (user agent, token,...). - - Example: - ```py - >>> from pathlib import Path - >>> from huggingface_hub import CommitScheduler - - # Scheduler uploads every 10 minutes - >>> csv_path = Path("watched_folder/data.csv") - >>> CommitScheduler(repo_id="test_scheduler", repo_type="dataset", folder_path=csv_path.parent, every=10) - - >>> with csv_path.open("a") as f: - ... f.write("first line") - - # Some time later (...) - >>> with csv_path.open("a") as f: - ... f.write("second line") - ``` - """ - - def __init__( - self, - *, - repo_id: str, - folder_path: Union[str, Path], - every: Union[int, float] = 5, - path_in_repo: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - private: bool = False, - token: Optional[str] = None, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - squash_history: bool = False, - hf_api: Optional["HfApi"] = None, - ) -> None: - self.api = hf_api or HfApi(token=token) - - # Folder - self.folder_path = Path(folder_path).expanduser().resolve() - self.path_in_repo = path_in_repo or "" - self.allow_patterns = allow_patterns - - if ignore_patterns is None: - ignore_patterns = [] - elif isinstance(ignore_patterns, str): - ignore_patterns = [ignore_patterns] - self.ignore_patterns = ignore_patterns + IGNORE_GIT_FOLDER_PATTERNS - - if self.folder_path.is_file(): - raise ValueError(f"'folder_path' must be a directory, not a file: '{self.folder_path}'.") - self.folder_path.mkdir(parents=True, exist_ok=True) - - # Repository - repo_url = self.api.create_repo(repo_id=repo_id, private=private, repo_type=repo_type, exist_ok=True) - self.repo_id = repo_url.repo_id - self.repo_type = repo_type - self.revision = revision - self.token = token - - # Keep track of already uploaded files - self.last_uploaded: Dict[Path, float] = {} # key is local path, value is timestamp - - # Scheduler - if not every > 0: - raise ValueError(f"'every' must be a positive integer, not '{every}'.") - self.lock = Lock() - self.every = every - self.squash_history = squash_history - - logger.info(f"Scheduled job to push '{self.folder_path}' to '{self.repo_id}' every {self.every} minutes.") - self._scheduler_thread = Thread(target=self._run_scheduler, daemon=True) - self._scheduler_thread.start() - atexit.register(self._push_to_hub) - - self.__stopped = False - - def stop(self) -> None: - """Stop the scheduler. - - A stopped scheduler cannot be restarted. Mostly for tests purposes. - """ - self.__stopped = True - - def _run_scheduler(self) -> None: - """Dumb thread waiting between each scheduled push to Hub.""" - while True: - self.last_future = self.trigger() - time.sleep(self.every * 60) - if self.__stopped: - break - - def trigger(self) -> Future: - """Trigger a `push_to_hub` and return a future. - - This method is automatically called every `every` minutes. You can also call it manually to trigger a commit - immediately, without waiting for the next scheduled commit. - """ - return self.api.run_as_future(self._push_to_hub) - - def _push_to_hub(self) -> Optional[CommitInfo]: - if self.__stopped: # If stopped, already scheduled commits are ignored - return None - - logger.info("(Background) scheduled commit triggered.") - try: - value = self.push_to_hub() - if self.squash_history: - logger.info("(Background) squashing repo history.") - self.api.super_squash_history(repo_id=self.repo_id, repo_type=self.repo_type, branch=self.revision) - return value - except Exception as e: - logger.error(f"Error while pushing to Hub: {e}") # Depending on the setup, error might be silenced - raise - - def push_to_hub(self) -> Optional[CommitInfo]: - """ - Push folder to the Hub and return the commit info. - - - - This method is not meant to be called directly. It is run in the background by the scheduler, respecting a - queue mechanism to avoid concurrent commits. Making a direct call to the method might lead to concurrency - issues. - - - - The default behavior of `push_to_hub` is to assume an append-only folder. It lists all files in the folder and - uploads only changed files. If no changes are found, the method returns without committing anything. If you want - to change this behavior, you can inherit from [`CommitScheduler`] and override this method. This can be useful - for example to compress data together in a single file before committing. For more details and examples, check - out our [integration guide](https://huggingface.co/docs/huggingface_hub/main/en/guides/upload#scheduled-uploads). - """ - # Check files to upload (with lock) - with self.lock: - logger.debug("Listing files to upload for scheduled commit.") - - # List files from folder (taken from `_prepare_upload_folder_additions`) - relpath_to_abspath = { - path.relative_to(self.folder_path).as_posix(): path - for path in sorted(self.folder_path.glob("**/*")) # sorted to be deterministic - if path.is_file() - } - prefix = f"{self.path_in_repo.strip('/')}/" if self.path_in_repo else "" - - # Filter with pattern + filter out unchanged files + retrieve current file size - files_to_upload: List[_FileToUpload] = [] - for relpath in filter_repo_objects( - relpath_to_abspath.keys(), allow_patterns=self.allow_patterns, ignore_patterns=self.ignore_patterns - ): - local_path = relpath_to_abspath[relpath] - stat = local_path.stat() - if self.last_uploaded.get(local_path) is None or self.last_uploaded[local_path] != stat.st_mtime: - files_to_upload.append( - _FileToUpload( - local_path=local_path, - path_in_repo=prefix + relpath, - size_limit=stat.st_size, - last_modified=stat.st_mtime, - ) - ) - - # Return if nothing to upload - if len(files_to_upload) == 0: - logger.debug("Dropping schedule commit: no changed file to upload.") - return None - - # Convert `_FileToUpload` as `CommitOperationAdd` (=> compute file shas + limit to file size) - logger.debug("Removing unchanged files since previous scheduled commit.") - add_operations = [ - CommitOperationAdd( - # Cap the file to its current size, even if the user append data to it while a scheduled commit is happening - path_or_fileobj=PartialFileIO(file_to_upload.local_path, size_limit=file_to_upload.size_limit), - path_in_repo=file_to_upload.path_in_repo, - ) - for file_to_upload in files_to_upload - ] - - # Upload files (append mode expected - no need for lock) - logger.debug("Uploading files for scheduled commit.") - commit_info = self.api.create_commit( - repo_id=self.repo_id, - repo_type=self.repo_type, - operations=add_operations, - commit_message="Scheduled Commit", - revision=self.revision, - ) - - # Successful commit: keep track of the latest "last_modified" for each file - for file in files_to_upload: - self.last_uploaded[file.local_path] = file.last_modified - return commit_info - - -class PartialFileIO(BytesIO): - """A file-like object that reads only the first part of a file. - - Useful to upload a file to the Hub when the user might still be appending data to it. Only the first part of the - file is uploaded (i.e. the part that was available when the filesystem was first scanned). - - In practice, only used internally by the CommitScheduler to regularly push a folder to the Hub with minimal - disturbance for the user. The object is passed to `CommitOperationAdd`. - - Only supports `read`, `tell` and `seek` methods. - - Args: - file_path (`str` or `Path`): - Path to the file to read. - size_limit (`int`): - The maximum number of bytes to read from the file. If the file is larger than this, only the first part - will be read (and uploaded). - """ - - def __init__(self, file_path: Union[str, Path], size_limit: int) -> None: - self._file_path = Path(file_path) - self._file = self._file_path.open("rb") - self._size_limit = min(size_limit, os.fstat(self._file.fileno()).st_size) - - def __del__(self) -> None: - self._file.close() - return super().__del__() - - def __repr__(self) -> str: - return f"" - - def __len__(self) -> int: - return self._size_limit - - def __getattribute__(self, name: str): - if name.startswith("_") or name in ("read", "tell", "seek"): # only 3 public methods supported - return super().__getattribute__(name) - raise NotImplementedError(f"PartialFileIO does not support '{name}'.") - - def tell(self) -> int: - """Return the current file position.""" - return self._file.tell() - - def seek(self, __offset: int, __whence: int = SEEK_SET) -> int: - """Change the stream position to the given offset. - - Behavior is the same as a regular file, except that the position is capped to the size limit. - """ - if __whence == SEEK_END: - # SEEK_END => set from the truncated end - __offset = len(self) + __offset - __whence = SEEK_SET - - pos = self._file.seek(__offset, __whence) - if pos > self._size_limit: - return self._file.seek(self._size_limit) - return pos - - def read(self, __size: Optional[int] = -1) -> bytes: - """Read at most `__size` bytes from the file. - - Behavior is the same as a regular file, except that it is capped to the size limit. - """ - current = self._file.tell() - if __size is None or __size < 0: - # Read until file limit - truncated_size = self._size_limit - current - else: - # Read until file limit or __size - truncated_size = min(__size, self._size_limit - current) - return self._file.read(truncated_size) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_login.py b/venv/lib/python3.8/site-packages/huggingface_hub/_login.py deleted file mode 100644 index 2185654884a1b1ff555b72fab023fef977de5556..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_login.py +++ /dev/null @@ -1,364 +0,0 @@ -# Copyright 2020 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains methods to login to the Hub.""" -import os -import subprocess -from functools import partial -from getpass import getpass -from typing import Optional - -from .commands._cli_utils import ANSI -from .commands.delete_cache import _ask_for_confirmation_no_tui -from .hf_api import get_token_permission -from .utils import ( - HfFolder, - capture_output, - is_google_colab, - is_notebook, - list_credential_helpers, - logging, - run_subprocess, - set_git_credential, - unset_git_credential, -) - - -logger = logging.get_logger(__name__) - - -def login( - token: Optional[str] = None, - add_to_git_credential: bool = False, - new_session: bool = True, - write_permission: bool = False, -) -> None: - """Login the machine to access the Hub. - - The `token` is persisted in cache and set as a git credential. Once done, the machine - is logged in and the access token will be available across all `huggingface_hub` - components. If `token` is not provided, it will be prompted to the user either with - a widget (in a notebook) or via the terminal. - - To login from outside of a script, one can also use `huggingface-cli login` which is - a cli command that wraps [`login`]. - - - - [`login`] is a drop-in replacement method for [`notebook_login`] as it wraps and - extends its capabilities. - - - - - - When the token is not passed, [`login`] will automatically detect if the script runs - in a notebook or not. However, this detection might not be accurate due to the - variety of notebooks that exists nowadays. If that is the case, you can always force - the UI by using [`notebook_login`] or [`interpreter_login`]. - - - - Args: - token (`str`, *optional*): - User access token to generate from https://huggingface.co/settings/token. - add_to_git_credential (`bool`, defaults to `False`): - If `True`, token will be set as git credential. If no git credential helper - is configured, a warning will be displayed to the user. If `token` is `None`, - the value of `add_to_git_credential` is ignored and will be prompted again - to the end user. - new_session (`bool`, defaults to `True`): - If `True`, will request a token even if one is already saved on the machine. - write_permission (`bool`, defaults to `False`): - If `True`, requires a token with write permission. - Raises: - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If an organization token is passed. Only personal account tokens are valid - to login. - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If token is invalid. - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError) - If running in a notebook but `ipywidgets` is not installed. - """ - if token is not None: - if not add_to_git_credential: - print( - "Token will not been saved to git credential helper. Pass" - " `add_to_git_credential=True` if you want to set the git" - " credential as well." - ) - _login(token, add_to_git_credential=add_to_git_credential, write_permission=write_permission) - elif is_notebook(): - notebook_login(new_session=new_session, write_permission=write_permission) - else: - interpreter_login(new_session=new_session, write_permission=write_permission) - - -def logout() -> None: - """Logout the machine from the Hub. - - Token is deleted from the machine and removed from git credential. - """ - token = HfFolder.get_token() - if token is None: - print("Not logged in!") - return - HfFolder.delete_token() - unset_git_credential() - print("Successfully logged out.") - - -### -# Interpreter-based login (text) -### - - -def interpreter_login(new_session: bool = True, write_permission: bool = False) -> None: - """ - Displays a prompt to login to the HF website and store the token. - - This is equivalent to [`login`] without passing a token when not run in a notebook. - [`interpreter_login`] is useful if you want to force the use of the terminal prompt - instead of a notebook widget. - - For more details, see [`login`]. - - Args: - new_session (`bool`, defaults to `True`): - If `True`, will request a token even if one is already saved on the machine. - write_permission (`bool`, defaults to `False`): - If `True`, requires a token with write permission. - - """ - if not new_session and _current_token_okay(write_permission=write_permission): - print("User is already logged in.") - return - - print(""" - _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_| - _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| - _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_| - _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| - _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_| - """) - if HfFolder.get_token() is not None: - print( - " A token is already saved on your machine. Run `huggingface-cli" - " whoami` to get more information or `huggingface-cli logout` if you want" - " to log out." - ) - print(" Setting a new token will erase the existing one.") - - print(" To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .") - if os.name == "nt": - print("Token can be pasted using 'Right-Click'.") - token = getpass("Token: ") - add_to_git_credential = _ask_for_confirmation_no_tui("Add token as git credential?") - - _login(token=token, add_to_git_credential=add_to_git_credential, write_permission=write_permission) - - -### -# Notebook-based login (widget) -### - -NOTEBOOK_LOGIN_PASSWORD_HTML = """

Immediately click login after typing your password or -it might be stored in plain text in this notebook file.
""" - - -NOTEBOOK_LOGIN_TOKEN_HTML_START = """

Copy a token from your Hugging Face -tokens page and paste it below.
Immediately click login after copying -your token or it might be stored in plain text in this notebook file.
""" - - -NOTEBOOK_LOGIN_TOKEN_HTML_END = """ -Pro Tip: If you don't already have one, you can create a dedicated -'notebooks' token with 'write' access, that you can then easily reuse for all -notebooks. """ - - -def notebook_login(new_session: bool = True, write_permission: bool = False) -> None: - """ - Displays a widget to login to the HF website and store the token. - - This is equivalent to [`login`] without passing a token when run in a notebook. - [`notebook_login`] is useful if you want to force the use of the notebook widget - instead of a prompt in the terminal. - - For more details, see [`login`]. - - Args: - new_session (`bool`, defaults to `True`): - If `True`, will request a token even if one is already saved on the machine. - write_permission (`bool`, defaults to `False`): - If `True`, requires a token with write permission. - """ - try: - import ipywidgets.widgets as widgets # type: ignore - from IPython.display import display # type: ignore - except ImportError: - raise ImportError( - "The `notebook_login` function can only be used in a notebook (Jupyter or" - " Colab) and you need the `ipywidgets` module: `pip install ipywidgets`." - ) - if not new_session and _current_token_okay(write_permission=write_permission): - print("User is already logged in.") - return - - box_layout = widgets.Layout(display="flex", flex_flow="column", align_items="center", width="50%") - - token_widget = widgets.Password(description="Token:") - git_checkbox_widget = widgets.Checkbox(value=True, description="Add token as git credential?") - token_finish_button = widgets.Button(description="Login") - - login_token_widget = widgets.VBox( - [ - widgets.HTML(NOTEBOOK_LOGIN_TOKEN_HTML_START), - token_widget, - git_checkbox_widget, - token_finish_button, - widgets.HTML(NOTEBOOK_LOGIN_TOKEN_HTML_END), - ], - layout=box_layout, - ) - display(login_token_widget) - - # On click events - def login_token_event(t, write_permission: bool = False): - """ - Event handler for the login button. - - Args: - write_permission (`bool`, defaults to `False`): - If `True`, requires a token with write permission. - """ - token = token_widget.value - add_to_git_credential = git_checkbox_widget.value - # Erase token and clear value to make sure it's not saved in the notebook. - token_widget.value = "" - # Hide inputs - login_token_widget.children = [widgets.Label("Connecting...")] - try: - with capture_output() as captured: - _login(token, add_to_git_credential=add_to_git_credential, write_permission=write_permission) - message = captured.getvalue() - except Exception as error: - message = str(error) - # Print result (success message or error) - login_token_widget.children = [widgets.Label(line) for line in message.split("\n") if line.strip()] - - token_finish_button.on_click(partial(login_token_event, write_permission=write_permission)) - - -### -# Login private helpers -### - - -def _login(token: str, add_to_git_credential: bool, write_permission: bool = False) -> None: - if token.startswith("api_org"): - raise ValueError("You must use your personal account token, not an organization token.") - - permission = get_token_permission(token) - if permission is None: - raise ValueError("Invalid token passed!") - elif write_permission and permission != "write": - raise ValueError( - "Token is valid but is 'read-only' and a 'write' token is required.\nPlease provide a new token with" - " correct permission." - ) - print(f"Token is valid (permission: {permission}).") - - if add_to_git_credential: - if _is_git_credential_helper_configured(): - set_git_credential(token) - print( - "Your token has been saved in your configured git credential helpers" - + f" ({','.join(list_credential_helpers())})." - ) - else: - print("Token has not been saved to git credential helper.") - - HfFolder.save_token(token) - print(f"Your token has been saved to {HfFolder.path_token}") - print("Login successful") - - -def _current_token_okay(write_permission: bool = False): - """Check if the current token is valid. - - Args: - write_permission (`bool`, defaults to `False`): - If `True`, requires a token with write permission. - - Returns: - `bool`: `True` if the current token is valid, `False` otherwise. - """ - permission = get_token_permission() - if permission is None or (write_permission and permission != "write"): - return False - return True - - -def _is_git_credential_helper_configured() -> bool: - """Check if a git credential helper is configured. - - Warns user if not the case (except for Google Colab where "store" is set by default - by `huggingface_hub`). - """ - helpers = list_credential_helpers() - if len(helpers) > 0: - return True # Do not warn: at least 1 helper is set - - # Only in Google Colab to avoid the warning message - # See https://github.com/huggingface/huggingface_hub/issues/1043#issuecomment-1247010710 - if is_google_colab(): - _set_store_as_git_credential_helper_globally() - return True # Do not warn: "store" is used by default in Google Colab - - # Otherwise, warn user - print( - ANSI.red( - "Cannot authenticate through git-credential as no helper is defined on your" - " machine.\nYou might have to re-authenticate when pushing to the Hugging" - " Face Hub.\nRun the following command in your terminal in case you want to" - " set the 'store' credential helper as default.\n\ngit config --global" - " credential.helper store\n\nRead" - " https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage for more" - " details." - ) - ) - return False - - -def _set_store_as_git_credential_helper_globally() -> None: - """Set globally the credential.helper to `store`. - - To be used only in Google Colab as we assume the user doesn't care about the git - credential config. It is the only particular case where we don't want to display the - warning message in [`notebook_login()`]. - - Related: - - https://github.com/huggingface/huggingface_hub/issues/1043 - - https://github.com/huggingface/huggingface_hub/issues/1051 - - https://git-scm.com/docs/git-credential-store - """ - try: - run_subprocess("git config --global credential.helper store") - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_multi_commits.py b/venv/lib/python3.8/site-packages/huggingface_hub/_multi_commits.py deleted file mode 100644 index c41d2a36fc0971ad031e05d851e632b263f10e48..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_multi_commits.py +++ /dev/null @@ -1,305 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to multi-commits (i.e. push changes iteratively on a PR).""" -import re -from dataclasses import dataclass, field -from hashlib import sha256 -from typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Union - -from ._commit_api import CommitOperationAdd, CommitOperationDelete -from .community import DiscussionWithDetails -from .utils import experimental -from .utils._cache_manager import _format_size - - -if TYPE_CHECKING: - from .hf_api import HfApi - - -class MultiCommitException(Exception): - """Base exception for any exception happening while doing a multi-commit.""" - - -MULTI_COMMIT_PR_DESCRIPTION_TEMPLATE = """ -## {commit_message} - -{commit_description} - -**Multi commit ID:** {multi_commit_id} - -Scheduled commits: - -{multi_commit_strategy} - -_This is a PR opened using the `huggingface_hub` library in the context of a multi-commit. PR can be commented as a usual PR. However, please be aware that manually updating the PR description, changing the PR status, or pushing new commits, is not recommended as it might corrupt the commit process. Learn more about multi-commits [in this guide](https://huggingface.co/docs/huggingface_hub/main/guides/upload)._ -""" - -MULTI_COMMIT_PR_COMPLETION_COMMENT_TEMPLATE = """ -Multi-commit is now completed! You can ping the repo owner to review the changes. This PR can now be commented or modified without risking to corrupt it. - -_This is a comment posted using the `huggingface_hub` library in the context of a multi-commit. Learn more about multi-commits [in this guide](https://huggingface.co/docs/huggingface_hub/main/guides/upload)._ -""" - -MULTI_COMMIT_PR_CLOSING_COMMENT_TEMPLATE = """ -`create_pr=False` has been passed so PR is automatically merged. - -_This is a comment posted using the `huggingface_hub` library in the context of a multi-commit. Learn more about multi-commits [in this guide](https://huggingface.co/docs/huggingface_hub/main/guides/upload)._ -""" - -MULTI_COMMIT_PR_CLOSE_COMMENT_FAILURE_NO_CHANGES_TEMPLATE = """ -Cannot merge Pull Requests as no changes are associated. This PR will be closed automatically. - -_This is a comment posted using the `huggingface_hub` library in the context of a multi-commit. Learn more about multi-commits [in this guide](https://huggingface.co/docs/huggingface_hub/main/guides/upload)._ -""" - -MULTI_COMMIT_PR_CLOSE_COMMENT_FAILURE_BAD_REQUEST_TEMPLATE = """ -An error occurred while trying to merge the Pull Request: `{error_message}`. - -_This is a comment posted using the `huggingface_hub` library in the context of a multi-commit. Learn more about multi-commits [in this guide](https://huggingface.co/docs/huggingface_hub/main/guides/upload)._ -""" - - -STEP_ID_REGEX = re.compile(r"- \[(?P[ |x])\].*(?P[a-fA-F0-9]{64})", flags=re.MULTILINE) - - -@experimental -def plan_multi_commits( - operations: Iterable[Union[CommitOperationAdd, CommitOperationDelete]], - max_operations_per_commit: int = 50, - max_upload_size_per_commit: int = 2 * 1024 * 1024 * 1024, -) -> Tuple[List[List[CommitOperationAdd]], List[List[CommitOperationDelete]]]: - """Split a list of operations in a list of commits to perform. - - Implementation follows a sub-optimal (yet simple) algorithm: - 1. Delete operations are grouped together by commits of maximum `max_operations_per_commits` operations. - 2. All additions exceeding `max_upload_size_per_commit` are committed 1 by 1. - 3. All remaining additions are grouped together and split each time the `max_operations_per_commit` or the - `max_upload_size_per_commit` limit is reached. - - We do not try to optimize the splitting to get the lowest number of commits as this is a NP-hard problem (see - [bin packing problem](https://en.wikipedia.org/wiki/Bin_packing_problem)). For our use case, it is not problematic - to use a sub-optimal solution so we favored an easy-to-explain implementation. - - Args: - operations (`List` of [`~hf_api.CommitOperation`]): - The list of operations to split into commits. - max_operations_per_commit (`int`): - Maximum number of operations in a single commit. Defaults to 50. - max_upload_size_per_commit (`int`): - Maximum size to upload (in bytes) in a single commit. Defaults to 2GB. Files bigger than this limit are - uploaded, 1 per commit. - - Returns: - `Tuple[List[List[CommitOperationAdd]], List[List[CommitOperationDelete]]]`: a tuple. First item is a list of - lists of [`CommitOperationAdd`] representing the addition commits to push. The second item is a list of lists - of [`CommitOperationDelete`] representing the deletion commits. - - - - `plan_multi_commits` is experimental. Its API and behavior is subject to change in the future without prior notice. - - - - Example: - ```python - >>> from huggingface_hub import HfApi, plan_multi_commits - >>> addition_commits, deletion_commits = plan_multi_commits( - ... operations=[ - ... CommitOperationAdd(...), - ... CommitOperationAdd(...), - ... CommitOperationDelete(...), - ... CommitOperationDelete(...), - ... CommitOperationAdd(...), - ... ], - ... ) - >>> HfApi().create_commits_on_pr( - ... repo_id="my-cool-model", - ... addition_commits=addition_commits, - ... deletion_commits=deletion_commits, - ... (...) - ... verbose=True, - ... ) - ``` - - - - The initial order of the operations is not guaranteed! All deletions will be performed before additions. If you are - not updating multiple times the same file, you are fine. - - - """ - addition_commits: List[List[CommitOperationAdd]] = [] - deletion_commits: List[List[CommitOperationDelete]] = [] - - additions: List[CommitOperationAdd] = [] - additions_size = 0 - deletions: List[CommitOperationDelete] = [] - for op in operations: - if isinstance(op, CommitOperationDelete): - # Group delete operations together - deletions.append(op) - if len(deletions) >= max_operations_per_commit: - deletion_commits.append(deletions) - deletions = [] - - elif op.upload_info.size >= max_upload_size_per_commit: - # Upload huge files 1 by 1 - addition_commits.append([op]) - - elif additions_size + op.upload_info.size < max_upload_size_per_commit: - # Group other additions and split if size limit is reached (either max_nb_files or max_upload_size) - additions.append(op) - additions_size += op.upload_info.size - - else: - addition_commits.append(additions) - additions = [op] - additions_size = op.upload_info.size - - if len(additions) >= max_operations_per_commit: - addition_commits.append(additions) - additions = [] - additions_size = 0 - - if len(additions) > 0: - addition_commits.append(additions) - if len(deletions) > 0: - deletion_commits.append(deletions) - - return addition_commits, deletion_commits - - -@dataclass -class MultiCommitStep: - """Dataclass containing a list of CommitOperation to commit at once. - - A [`MultiCommitStep`] is one atomic part of a [`MultiCommitStrategy`]. Each step is identified by its own - deterministic ID based on the list of commit operations (hexadecimal sha256). ID is persistent between re-runs if - the list of commits is kept the same. - """ - - operations: List[Union[CommitOperationAdd, CommitOperationDelete]] - - id: str = field(init=False) - completed: bool = False - - def __post_init__(self) -> None: - if len(self.operations) == 0: - raise ValueError("A MultiCommitStep must have at least 1 commit operation, got 0.") - - # Generate commit id - sha = sha256() - for op in self.operations: - if isinstance(op, CommitOperationAdd): - sha.update(b"ADD") - sha.update(op.path_in_repo.encode()) - sha.update(op.upload_info.sha256) - elif isinstance(op, CommitOperationDelete): - sha.update(b"DELETE") - sha.update(op.path_in_repo.encode()) - sha.update(str(op.is_folder).encode()) - else: - NotImplementedError() - self.id = sha.hexdigest() - - def __str__(self) -> str: - """Format a step for PR description. - - Formatting can be changed in the future as long as it is single line, starts with `- [ ]`/`- [x]` and contains - `self.id`. Must be able to match `STEP_ID_REGEX`. - """ - additions = [op for op in self.operations if isinstance(op, CommitOperationAdd)] - file_deletions = [op for op in self.operations if isinstance(op, CommitOperationDelete) and not op.is_folder] - folder_deletions = [op for op in self.operations if isinstance(op, CommitOperationDelete) and op.is_folder] - if len(additions) > 0: - return ( - f"- [{'x' if self.completed else ' '}] Upload {len(additions)} file(s) " - f"totalling {_format_size(sum(add.upload_info.size for add in additions))}" - f" ({self.id})" - ) - else: - return ( - f"- [{'x' if self.completed else ' '}] Delete {len(file_deletions)} file(s) and" - f" {len(folder_deletions)} folder(s) ({self.id})" - ) - - -@dataclass -class MultiCommitStrategy: - """Dataclass containing a list of [`MultiCommitStep`] to commit iteratively. - - A strategy is identified by its own deterministic ID based on the list of its steps (hexadecimal sha256). ID is - persistent between re-runs if the list of commits is kept the same. - """ - - addition_commits: List[MultiCommitStep] - deletion_commits: List[MultiCommitStep] - - id: str = field(init=False) - all_steps: Set[str] = field(init=False) - - def __post_init__(self) -> None: - self.all_steps = {step.id for step in self.addition_commits + self.deletion_commits} - if len(self.all_steps) < len(self.addition_commits) + len(self.deletion_commits): - raise ValueError("Got duplicate commits in MultiCommitStrategy. All commits must be unique.") - - if len(self.all_steps) == 0: - raise ValueError("A MultiCommitStrategy must have at least 1 commit, got 0.") - - # Generate strategy id - sha = sha256() - for step in self.addition_commits + self.deletion_commits: - sha.update("new step".encode()) - sha.update(step.id.encode()) - self.id = sha.hexdigest() - - -def multi_commit_create_pull_request( - api: "HfApi", - repo_id: str, - commit_message: str, - commit_description: Optional[str], - strategy: MultiCommitStrategy, - token: Optional[str], - repo_type: Optional[str], -) -> DiscussionWithDetails: - return api.create_pull_request( - repo_id=repo_id, - title=f"[WIP] {commit_message} (multi-commit {strategy.id})", - description=multi_commit_generate_comment( - commit_message=commit_message, commit_description=commit_description, strategy=strategy - ), - token=token, - repo_type=repo_type, - ) - - -def multi_commit_generate_comment( - commit_message: str, - commit_description: Optional[str], - strategy: MultiCommitStrategy, -) -> str: - return MULTI_COMMIT_PR_DESCRIPTION_TEMPLATE.format( - commit_message=commit_message, - commit_description=commit_description or "", - multi_commit_id=strategy.id, - multi_commit_strategy="\n".join( - str(commit) for commit in strategy.deletion_commits + strategy.addition_commits - ), - ) - - -def multi_commit_parse_pr_description(description: str) -> Set[str]: - return {match[1] for match in STEP_ID_REGEX.findall(description)} diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_snapshot_download.py b/venv/lib/python3.8/site-packages/huggingface_hub/_snapshot_download.py deleted file mode 100644 index 72f40ad2ef7e8692a6b4239a481d59f707a0ac12..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_snapshot_download.py +++ /dev/null @@ -1,250 +0,0 @@ -import os -from pathlib import Path -from typing import Dict, List, Literal, Optional, Union - -from tqdm.auto import tqdm as base_tqdm -from tqdm.contrib.concurrent import thread_map - -from .constants import ( - DEFAULT_REVISION, - HF_HUB_ENABLE_HF_TRANSFER, - HUGGINGFACE_HUB_CACHE, - REPO_TYPES, -) -from .file_download import REGEX_COMMIT_HASH, hf_hub_download, repo_folder_name -from .hf_api import HfApi -from .utils import filter_repo_objects, logging, validate_hf_hub_args -from .utils import tqdm as hf_tqdm - - -logger = logging.get_logger(__name__) - - -@validate_hf_hub_args -def snapshot_download( - repo_id: str, - *, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - endpoint: Optional[str] = None, - cache_dir: Union[str, Path, None] = None, - local_dir: Union[str, Path, None] = None, - local_dir_use_symlinks: Union[bool, Literal["auto"]] = "auto", - library_name: Optional[str] = None, - library_version: Optional[str] = None, - user_agent: Optional[Union[Dict, str]] = None, - proxies: Optional[Dict] = None, - etag_timeout: float = 10, - resume_download: bool = False, - force_download: bool = False, - token: Optional[Union[bool, str]] = None, - local_files_only: bool = False, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - max_workers: int = 8, - tqdm_class: Optional[base_tqdm] = None, -) -> str: - """Download repo files. - - Download a whole snapshot of a repo's files at the specified revision. This is useful when you want all files from - a repo, because you don't know which ones you will need a priori. All files are nested inside a folder in order - to keep their actual filename relative to that folder. You can also filter which files to download using - `allow_patterns` and `ignore_patterns`. - - If `local_dir` is provided, the file structure from the repo will be replicated in this location. You can configure - how you want to move those files: - - If `local_dir_use_symlinks="auto"` (default), files are downloaded and stored in the cache directory as blob - files. Small files (<5MB) are duplicated in `local_dir` while a symlink is created for bigger files. The goal - is to be able to manually edit and save small files without corrupting the cache while saving disk space for - binary files. The 5MB threshold can be configured with the `HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD` - environment variable. - - If `local_dir_use_symlinks=True`, files are downloaded, stored in the cache directory and symlinked in `local_dir`. - This is optimal in term of disk usage but files must not be manually edited. - - If `local_dir_use_symlinks=False` and the blob files exist in the cache directory, they are duplicated in the - local dir. This means disk usage is not optimized. - - Finally, if `local_dir_use_symlinks=False` and the blob files do not exist in the cache directory, then the - files are downloaded and directly placed under `local_dir`. This means if you need to download them again later, - they will be re-downloaded entirely. - - An alternative would be to clone the repo but this requires git and git-lfs to be installed and properly - configured. It is also not possible to filter which files to download when cloning a repository using git. - - Args: - repo_id (`str`): - A user or an organization name and a repo name separated by a `/`. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if downloading from a dataset or space, - `None` or `"model"` if downloading from a model. Default is `None`. - revision (`str`, *optional*): - An optional Git revision id which can be a branch name, a tag, or a - commit hash. - endpoint (`str`, *optional*): - Hugging Face Hub base url. Will default to https://huggingface.co/. Otherwise, one can set the `HF_ENDPOINT` - environment variable. - cache_dir (`str`, `Path`, *optional*): - Path to the folder where cached files are stored. - local_dir (`str` or `Path`, *optional*): - If provided, the downloaded files will be placed under this directory, either as symlinks (default) or - regular files (see description for more details). - local_dir_use_symlinks (`"auto"` or `bool`, defaults to `"auto"`): - To be used with `local_dir`. If set to "auto", the cache directory will be used and the file will be either - duplicated or symlinked to the local directory depending on its size. It set to `True`, a symlink will be - created, no matter the file size. If set to `False`, the file will either be duplicated from cache (if - already exists) or downloaded from the Hub and not cached. See description for more details. - library_name (`str`, *optional*): - The name of the library to which the object corresponds. - library_version (`str`, *optional*): - The version of the library. - user_agent (`str`, `dict`, *optional*): - The user-agent info in the form of a dictionary or a string. - proxies (`dict`, *optional*): - Dictionary mapping protocol to the URL of the proxy passed to - `requests.request`. - etag_timeout (`float`, *optional*, defaults to `10`): - When fetching ETag, how many seconds to wait for the server to send - data before giving up which is passed to `requests.request`. - resume_download (`bool`, *optional*, defaults to `False): - If `True`, resume a previously interrupted download. - force_download (`bool`, *optional*, defaults to `False`): - Whether the file should be downloaded even if it already exists in the local cache. - token (`str`, `bool`, *optional*): - A token to be used for the download. - - If `True`, the token is read from the HuggingFace config - folder. - - If a string, it's used as the authentication token. - local_files_only (`bool`, *optional*, defaults to `False`): - If `True`, avoid downloading the file and return the path to the - local cached file if it exists. - allow_patterns (`List[str]` or `str`, *optional*): - If provided, only files matching at least one pattern are downloaded. - ignore_patterns (`List[str]` or `str`, *optional*): - If provided, files matching any of the patterns are not downloaded. - max_workers (`int`, *optional*): - Number of concurrent threads to download files (1 thread = 1 file download). - Defaults to 8. - tqdm_class (`tqdm`, *optional*): - If provided, overwrites the default behavior for the progress bar. Passed - argument must inherit from `tqdm.auto.tqdm` or at least mimic its behavior. - Note that the `tqdm_class` is not passed to each individual download. - Defaults to the custom HF progress bar that can be disabled by setting - `HF_HUB_DISABLE_PROGRESS_BARS` environment variable. - - Returns: - Local folder path (string) of repo snapshot - - - - Raises the following errors: - - - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - if `token=True` and the token cannot be found. - - [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) if - ETag cannot be determined. - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - - """ - if cache_dir is None: - cache_dir = HUGGINGFACE_HUB_CACHE - if revision is None: - revision = DEFAULT_REVISION - if isinstance(cache_dir, Path): - cache_dir = str(cache_dir) - - if repo_type is None: - repo_type = "model" - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type: {repo_type}. Accepted repo types are: {str(REPO_TYPES)}") - - storage_folder = os.path.join(cache_dir, repo_folder_name(repo_id=repo_id, repo_type=repo_type)) - - # if we have no internet connection we will look for an - # appropriate folder in the cache - # If the specified revision is a commit hash, look inside "snapshots". - # If the specified revision is a branch or tag, look inside "refs". - if local_files_only: - if REGEX_COMMIT_HASH.match(revision): - commit_hash = revision - else: - # retrieve commit_hash from file - ref_path = os.path.join(storage_folder, "refs", revision) - with open(ref_path) as f: - commit_hash = f.read() - - snapshot_folder = os.path.join(storage_folder, "snapshots", commit_hash) - - if os.path.exists(snapshot_folder): - return snapshot_folder - - raise ValueError( - "Cannot find an appropriate cached snapshot folder for the specified" - " revision on the local disk and outgoing traffic has been disabled. To" - " enable repo look-ups and downloads online, set 'local_files_only' to" - " False." - ) - - # if we have internet connection we retrieve the correct folder name from the huggingface api - api = HfApi(library_name=library_name, library_version=library_version, user_agent=user_agent, endpoint=endpoint) - repo_info = api.repo_info(repo_id=repo_id, repo_type=repo_type, revision=revision, token=token) - assert repo_info.sha is not None, "Repo info returned from server must have a revision sha." - - filtered_repo_files = list( - filter_repo_objects( - items=[f.rfilename for f in repo_info.siblings], - allow_patterns=allow_patterns, - ignore_patterns=ignore_patterns, - ) - ) - commit_hash = repo_info.sha - snapshot_folder = os.path.join(storage_folder, "snapshots", commit_hash) - # if passed revision is not identical to commit_hash - # then revision has to be a branch name or tag name. - # In that case store a ref. - if revision != commit_hash: - ref_path = os.path.join(storage_folder, "refs", revision) - os.makedirs(os.path.dirname(ref_path), exist_ok=True) - with open(ref_path, "w") as f: - f.write(commit_hash) - - # we pass the commit_hash to hf_hub_download - # so no network call happens if we already - # have the file locally. - def _inner_hf_hub_download(repo_file: str): - return hf_hub_download( - repo_id, - filename=repo_file, - repo_type=repo_type, - revision=commit_hash, - endpoint=endpoint, - cache_dir=cache_dir, - local_dir=local_dir, - local_dir_use_symlinks=local_dir_use_symlinks, - library_name=library_name, - library_version=library_version, - user_agent=user_agent, - proxies=proxies, - etag_timeout=etag_timeout, - resume_download=resume_download, - force_download=force_download, - token=token, - ) - - if HF_HUB_ENABLE_HF_TRANSFER: - # when using hf_transfer we don't want extra parallelism - # from the one hf_transfer provides - for file in filtered_repo_files: - _inner_hf_hub_download(file) - else: - thread_map( - _inner_hf_hub_download, - filtered_repo_files, - desc=f"Fetching {len(filtered_repo_files)} files", - max_workers=max_workers, - # User can use its own tqdm class or the default one from `huggingface_hub.utils` - tqdm_class=tqdm_class or hf_tqdm, - ) - - if local_dir is not None: - return str(os.path.realpath(local_dir)) - return snapshot_folder diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_space_api.py b/venv/lib/python3.8/site-packages/huggingface_hub/_space_api.py deleted file mode 100644 index ce07fca09891c436d977804596bade3f22e398a4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_space_api.py +++ /dev/null @@ -1,151 +0,0 @@ -# coding=utf-8 -# Copyright 2019-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from dataclasses import dataclass -from datetime import datetime -from enum import Enum -from typing import Dict, Optional - -from huggingface_hub.utils import parse_datetime - - -class SpaceStage(str, Enum): - """ - Enumeration of possible stage of a Space on the Hub. - - Value can be compared to a string: - ```py - assert SpaceStage.BUILDING == "BUILDING" - ``` - - Taken from https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceInfo.ts#L61 (private url). - """ - - # Copied from moon-landing > server > repo_types > SpaceInfo.ts (private repo) - NO_APP_FILE = "NO_APP_FILE" - CONFIG_ERROR = "CONFIG_ERROR" - BUILDING = "BUILDING" - BUILD_ERROR = "BUILD_ERROR" - RUNNING = "RUNNING" - RUNNING_BUILDING = "RUNNING_BUILDING" - RUNTIME_ERROR = "RUNTIME_ERROR" - DELETING = "DELETING" - STOPPED = "STOPPED" - PAUSED = "PAUSED" - - -class SpaceHardware(str, Enum): - """ - Enumeration of hardwares available to run your Space on the Hub. - - Value can be compared to a string: - ```py - assert SpaceHardware.CPU_BASIC == "cpu-basic" - ``` - - Taken from https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceInfo.ts#L73 (private url). - """ - - CPU_BASIC = "cpu-basic" - CPU_UPGRADE = "cpu-upgrade" - T4_SMALL = "t4-small" - T4_MEDIUM = "t4-medium" - A10G_SMALL = "a10g-small" - A10G_LARGE = "a10g-large" - A100_LARGE = "a100-large" - - -class SpaceStorage(str, Enum): - """ - Enumeration of persistent storage available for your Space on the Hub. - - Value can be compared to a string: - ```py - assert SpaceStorage.SMALL == "small" - ``` - - Taken from https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceHardwareFlavor.ts#L24 (private url). - """ - - SMALL = "small" - MEDIUM = "medium" - LARGE = "large" - - -@dataclass -class SpaceRuntime: - """ - Contains information about the current runtime of a Space. - - Args: - stage (`str`): - Current stage of the space. Example: RUNNING. - hardware (`str` or `None`): - Current hardware of the space. Example: "cpu-basic". Can be `None` if Space - is `BUILDING` for the first time. - requested_hardware (`str` or `None`): - Requested hardware. Can be different than `hardware` especially if the request - has just been made. Example: "t4-medium". Can be `None` if no hardware has - been requested yet. - sleep_time (`int` or `None`): - Number of seconds the Space will be kept alive after the last request. By default (if value is `None`), the - Space will never go to sleep if it's running on an upgraded hardware, while it will go to sleep after 48 - hours on a free 'cpu-basic' hardware. For more details, see https://huggingface.co/docs/hub/spaces-gpus#sleep-time. - raw (`dict`): - Raw response from the server. Contains more information about the Space - runtime like number of replicas, number of cpu, memory size,... - """ - - stage: SpaceStage - hardware: Optional[SpaceHardware] - requested_hardware: Optional[SpaceHardware] - sleep_time: Optional[int] - storage: Optional[SpaceStorage] - raw: Dict - - def __init__(self, data: Dict) -> None: - self.stage = data["stage"] - self.hardware = data["hardware"]["current"] - self.requested_hardware = data["hardware"]["requested"] - self.sleep_time = data["gcTimeout"] - self.storage = data["storage"] - self.raw = data - - -@dataclass -class SpaceVariable: - """ - Contains information about the current variables of a Space. - - Args: - key (`str`): - Variable key. Example: `"MODEL_REPO_ID"` - value (`str`): - Variable value. Example: `"the_model_repo_id"`. - description (`str` or None): - Description of the variable. Example: `"Model Repo ID of the implemented model"`. - updatedAt (`datetime`): - datetime of the last update of the variable. - """ - - key: str - value: str - description: Optional[str] - updated_at: datetime - - def __init__(self, key: str, values: Dict) -> None: - self.key = key - self.value = values["value"] - self.description = values.get("description") - self.updated_at = parse_datetime(values["updatedAt"]) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_tensorboard_logger.py b/venv/lib/python3.8/site-packages/huggingface_hub/_tensorboard_logger.py deleted file mode 100644 index c48720c655ffd6ca7c3d1f81cb39afc8f558c80b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_tensorboard_logger.py +++ /dev/null @@ -1,167 +0,0 @@ -# Copyright 2023 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains a logger to push training logs to the Hub, using Tensorboard.""" -from pathlib import Path -from typing import TYPE_CHECKING, List, Optional, Union - -from huggingface_hub._commit_scheduler import CommitScheduler - -from .utils import experimental, is_tensorboard_available - - -if is_tensorboard_available(): - from tensorboardX import SummaryWriter - - # TODO: clarify: should we import from torch.utils.tensorboard ? -else: - SummaryWriter = object # Dummy class to avoid failing at import. Will raise on instance creation. - -if TYPE_CHECKING: - from tensorboardX import SummaryWriter - - -class HFSummaryWriter(SummaryWriter): - """ - Wrapper around the tensorboard's `SummaryWriter` to push training logs to the Hub. - - Data is logged locally and then pushed to the Hub asynchronously. Pushing data to the Hub is done in a separate - thread to avoid blocking the training script. In particular, if the upload fails for any reason (e.g. a connection - issue), the main script will not be interrupted. Data is automatically pushed to the Hub every `commit_every` - minutes (default to every 5 minutes). - - - - `HFSummaryWriter` is experimental. Its API is subject to change in the future without prior notice. - - - - Args: - repo_id (`str`): - The id of the repo to which the logs will be pushed. - logdir (`str`, *optional*): - The directory where the logs will be written. If not specified, a local directory will be created by the - underlying `SummaryWriter` object. - commit_every (`int` or `float`, *optional*): - The frequency (in minutes) at which the logs will be pushed to the Hub. Defaults to 5 minutes. - squash_history (`bool`, *optional*): - Whether to squash the history of the repo after each commit. Defaults to `False`. Squashing commits is - useful to avoid degraded performances on the repo when it grows too large. - repo_type (`str`, *optional*): - The type of the repo to which the logs will be pushed. Defaults to "model". - repo_revision (`str`, *optional*): - The revision of the repo to which the logs will be pushed. Defaults to "main". - repo_private (`bool`, *optional*): - Whether to create a private repo or not. Defaults to False. This argument is ignored if the repo already - exists. - path_in_repo (`str`, *optional*): - The path to the folder in the repo where the logs will be pushed. Defaults to "tensorboard/". - repo_allow_patterns (`List[str]` or `str`, *optional*): - A list of patterns to include in the upload. Defaults to `"*.tfevents.*"`. Check out the - [upload guide](https://huggingface.co/docs/huggingface_hub/guides/upload#upload-a-folder) for more details. - repo_ignore_patterns (`List[str]` or `str`, *optional*): - A list of patterns to exclude in the upload. Check out the - [upload guide](https://huggingface.co/docs/huggingface_hub/guides/upload#upload-a-folder) for more details. - token (`str`, *optional*): - Authentication token. Will default to the stored token. See https://huggingface.co/settings/token for more - details - kwargs: - Additional keyword arguments passed to `SummaryWriter`. - - Examples: - ```py - >>> from huggingface_hub import HFSummaryWriter - - # Logs are automatically pushed every 15 minutes - >>> logger = HFSummaryWriter(repo_id="test_hf_logger", commit_every=15) - >>> logger.add_scalar("a", 1) - >>> logger.add_scalar("b", 2) - ... - - # You can also trigger a push manually - >>> logger.scheduler.trigger() - ``` - - ```py - >>> from huggingface_hub import HFSummaryWriter - - # Logs are automatically pushed every 5 minutes (default) + when exiting the context manager - >>> with HFSummaryWriter(repo_id="test_hf_logger") as logger: - ... logger.add_scalar("a", 1) - ... logger.add_scalar("b", 2) - ``` - """ - - @experimental - def __new__(cls, *args, **kwargs) -> "HFSummaryWriter": - if not is_tensorboard_available(): - raise ImportError( - "You must have `tensorboard` installed to use `HFSummaryWriter`. Please run `pip install --upgrade" - " tensorboardX` first." - ) - return super().__new__(cls) - - def __init__( - self, - repo_id: str, - *, - logdir: Optional[str] = None, - commit_every: Union[int, float] = 5, - squash_history: bool = False, - repo_type: Optional[str] = None, - repo_revision: Optional[str] = None, - repo_private: bool = False, - path_in_repo: Optional[str] = "tensorboard", - repo_allow_patterns: Optional[Union[List[str], str]] = "*.tfevents.*", - repo_ignore_patterns: Optional[Union[List[str], str]] = None, - token: Optional[str] = None, - **kwargs, - ): - # Initialize SummaryWriter - super().__init__(logdir=logdir, **kwargs) - - # Check logdir has been correctly initialized and fail early otherwise. In practice, SummaryWriter takes care of it. - if not isinstance(self.logdir, str): - raise ValueError(f"`self.logdir` must be a string. Got '{self.logdir}' of type {type(self.logdir)}.") - - # Append logdir name to `path_in_repo` - if path_in_repo is None or path_in_repo == "": - path_in_repo = Path(self.logdir).name - else: - path_in_repo = path_in_repo.strip("/") + "/" + Path(self.logdir).name - - # Initialize scheduler - self.scheduler = CommitScheduler( - folder_path=self.logdir, - path_in_repo=path_in_repo, - repo_id=repo_id, - repo_type=repo_type, - revision=repo_revision, - private=repo_private, - token=token, - allow_patterns=repo_allow_patterns, - ignore_patterns=repo_ignore_patterns, - every=commit_every, - squash_history=squash_history, - ) - - # Exposing some high-level info at root level - self.repo_id = self.scheduler.repo_id - self.repo_type = self.scheduler.repo_type - self.repo_revision = self.scheduler.revision - - def __exit__(self, exc_type, exc_val, exc_tb): - """Push to hub in a non-blocking way when exiting the logger's context manager.""" - super().__exit__(exc_type, exc_val, exc_tb) - future = self.scheduler.trigger() - future.result() diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_webhooks_payload.py b/venv/lib/python3.8/site-packages/huggingface_hub/_webhooks_payload.py deleted file mode 100644 index 5d66b99643bfbf8a9bbb6c353c71ac2d7b2ae0fd..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_webhooks_payload.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains data structures to parse the webhooks payload.""" -from typing import List, Literal, Optional - -from pydantic import BaseModel - - -# This is an adaptation of the ReportV3 interface implemented in moon-landing. V0, V1 and V2 have been ignored as they -# are not in used anymore. To keep in sync when format is updated in -# https://github.com/huggingface/moon-landing/blob/main/server/lib/HFWebhooks.ts (internal link). - - -WebhookEvent_T = Literal[ - "create", - "delete", - "move", - "update", -] -RepoChangeEvent_T = Literal[ - "add", - "move", - "remove", - "update", -] -RepoType_T = Literal[ - "dataset", - "model", - "space", -] -DiscussionStatus_T = Literal[ - "closed", - "draft", - "open", - "merged", -] -SupportedWebhookVersion = Literal[3] - - -class ObjectId(BaseModel): - id: str - - -class WebhookPayloadUrl(BaseModel): - web: str - api: Optional[str] - - -class WebhookPayloadMovedTo(BaseModel): - name: str - owner: ObjectId - - -class WebhookPayloadWebhook(ObjectId): - version: SupportedWebhookVersion - - -class WebhookPayloadEvent(BaseModel): - action: WebhookEvent_T - scope: str - - -class WebhookPayloadDiscussionChanges(BaseModel): - base: str - mergeCommitId: Optional[str] - - -class WebhookPayloadComment(ObjectId): - author: ObjectId - hidden: bool - content: Optional[str] - url: WebhookPayloadUrl - - -class WebhookPayloadDiscussion(ObjectId): - num: int - author: ObjectId - url: WebhookPayloadUrl - title: str - isPullRequest: bool - status: DiscussionStatus_T - changes: Optional[WebhookPayloadDiscussionChanges] - pinned: Optional[bool] - - -class WebhookPayloadRepo(ObjectId): - owner: ObjectId - head_sha: Optional[str] - name: str - private: bool - subdomain: Optional[str] - tags: Optional[List[str]] - type: Literal["dataset", "model", "space"] - url: WebhookPayloadUrl - - -class WebhookPayload(BaseModel): - event: WebhookPayloadEvent - repo: WebhookPayloadRepo - discussion: Optional[WebhookPayloadDiscussion] - comment: Optional[WebhookPayloadComment] - webhook: WebhookPayloadWebhook - movedTo: Optional[WebhookPayloadMovedTo] diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/_webhooks_server.py b/venv/lib/python3.8/site-packages/huggingface_hub/_webhooks_server.py deleted file mode 100644 index 7cc5dd4ce7769fee10e0198cffe79f64a33b211d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/_webhooks_server.py +++ /dev/null @@ -1,369 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains `WebhooksServer` and `webhook_endpoint` to create a webhook server easily.""" -import atexit -import inspect -import os -from functools import wraps -from typing import TYPE_CHECKING, Callable, Dict, Optional - -from .utils import experimental, is_gradio_available - - -if TYPE_CHECKING: - import gradio as gr - - -from fastapi import FastAPI, Request -from fastapi.responses import JSONResponse - - -_global_app: Optional["WebhooksServer"] = None -_is_local = os.getenv("SYSTEM") != "spaces" - - -@experimental -class WebhooksServer: - """ - The [`WebhooksServer`] class lets you create an instance of a Gradio app that can receive Huggingface webhooks. - These webhooks can be registered using the [`~WebhooksServer.add_webhook`] decorator. Webhook endpoints are added to - the app as a POST endpoint to the FastAPI router. Once all the webhooks are registered, the `run` method has to be - called to start the app. - - It is recommended to accept [`WebhookPayload`] as the first argument of the webhook function. It is a Pydantic - model that contains all the information about the webhook event. The data will be parsed automatically for you. - - Check out the [webhooks guide](../guides/webhooks_server) for a step-by-step tutorial on how to setup your - WebhooksServer and deploy it on a Space. - - - - `WebhooksServer` is experimental. Its API is subject to change in the future. - - - - - - You must have `gradio` installed to use `WebhooksServer` (`pip install --upgrade gradio`). - - - - Args: - ui (`gradio.Blocks`, optional): - A Gradio UI instance to be used as the Space landing page. If `None`, a UI displaying instructions - about the configured webhooks is created. - webhook_secret (`str`, optional): - A secret key to verify incoming webhook requests. You can set this value to any secret you want as long as - you also configure it in your [webhooks settings panel](https://huggingface.co/settings/webhooks). You - can also set this value as the `WEBHOOK_SECRET` environment variable. If no secret is provided, the - webhook endpoints are opened without any security. - - Example: - - ```python - import gradio as gr - from huggingface_hub import WebhooksServer, WebhookPayload - - with gr.Blocks() as ui: - ... - - app = WebhooksServer(ui=ui, webhook_secret="my_secret_key") - - @app.add_webhook("/say_hello") - async def hello(payload: WebhookPayload): - return {"message": "hello"} - - app.run() - ``` - """ - - def __new__(cls, *args, **kwargs) -> "WebhooksServer": - if not is_gradio_available(): - raise ImportError( - "You must have `gradio` installed to use `WebhooksServer`. Please run `pip install --upgrade gradio`" - " first." - ) - return super().__new__(cls) - - def __init__( - self, - ui: Optional["gr.Blocks"] = None, - webhook_secret: Optional[str] = None, - ) -> None: - self._ui = ui - - self.webhook_secret = webhook_secret or os.getenv("WEBHOOK_SECRET") - self.registered_webhooks: Dict[str, Callable] = {} - _warn_on_empty_secret(self.webhook_secret) - - def add_webhook(self, path: Optional[str] = None) -> Callable: - """ - Decorator to add a webhook to the [`WebhooksServer`] server. - - Args: - path (`str`, optional): - The URL path to register the webhook function. If not provided, the function name will be used as the - path. In any case, all webhooks are registered under `/webhooks`. - - Raises: - ValueError: If the provided path is already registered as a webhook. - - Example: - ```python - from huggingface_hub import WebhooksServer, WebhookPayload - - app = WebhooksServer() - - @app.add_webhook - async def trigger_training(payload: WebhookPayload): - if payload.repo.type == "dataset" and payload.event.action == "update": - # Trigger a training job if a dataset is updated - ... - - app.run() - ``` - """ - # Usage: directly as decorator. Example: `@app.add_webhook` - if callable(path): - # If path is a function, it means it was used as a decorator without arguments - return self.add_webhook()(path) - - # Usage: provide a path. Example: `@app.add_webhook(...)` - @wraps(FastAPI.post) - def _inner_post(*args, **kwargs): - func = args[0] - abs_path = f"/webhooks/{(path or func.__name__).strip('/')}" - if abs_path in self.registered_webhooks: - raise ValueError(f"Webhook {abs_path} already exists.") - self.registered_webhooks[abs_path] = func - - return _inner_post - - def run(self) -> None: - """Starts the Gradio app with the FastAPI server and registers the webhooks.""" - ui = self._ui or self._get_default_ui() - - # Start Gradio App - # - as non-blocking so that webhooks can be added afterwards - # - as shared if launch locally (to debug webhooks) - self.fastapi_app, _, _ = ui.launch(prevent_thread_lock=True, share=_is_local) - - # Register webhooks to FastAPI app - for path, func in self.registered_webhooks.items(): - # Add secret check if required - if self.webhook_secret is not None: - func = _wrap_webhook_to_check_secret(func, webhook_secret=self.webhook_secret) - - # Add route to FastAPI app - self.fastapi_app.post(path)(func) - - # Print instructions and block main thread - url = (ui.share_url or ui.local_url).strip("/") - message = "\nWebhooks are correctly setup and ready to use:" - message += "\n" + "\n".join(f" - POST {url}{webhook}" for webhook in self.registered_webhooks) - message += "\nGo to https://huggingface.co/settings/webhooks to setup your webhooks." - print(message) - - ui.block_thread() - - def _get_default_ui(self) -> "gr.Blocks": - """Default UI if not provided (lists webhooks and provides basic instructions).""" - import gradio as gr - - with gr.Blocks() as ui: - gr.Markdown("# This is an app to process 🤗 Webhooks") - gr.Markdown( - "Webhooks are a foundation for MLOps-related features. They allow you to listen for new changes on" - " specific repos or to all repos belonging to particular set of users/organizations (not just your" - " repos, but any repo). Check out this [guide](https://huggingface.co/docs/hub/webhooks) to get to" - " know more about webhooks on the Huggingface Hub." - ) - gr.Markdown( - f"{len(self.registered_webhooks)} webhook(s) are registered:" - + "\n\n" - + "\n ".join( - f"- [{webhook_path}]({_get_webhook_doc_url(webhook.__name__, webhook_path)})" - for webhook_path, webhook in self.registered_webhooks.items() - ) - ) - gr.Markdown( - "Go to https://huggingface.co/settings/webhooks to setup your webhooks." - + "\nYou app is running locally. Please look at the logs to check the full URL you need to set." - if _is_local - else ( - "\nThis app is running on a Space. You can find the corresponding URL in the options menu" - " (top-right) > 'Embed the Space'. The URL looks like 'https://{username}-{repo_name}.hf.space'." - ) - ) - return ui - - -@experimental -def webhook_endpoint(path: Optional[str] = None) -> Callable: - """Decorator to start a [`WebhooksServer`] and register the decorated function as a webhook endpoint. - - This is a helper to get started quickly. If you need more flexibility (custom landing page or webhook secret), - you can use [`WebhooksServer`] directly. You can register multiple webhook endpoints (to the same server) by using - this decorator multiple times. - - Check out the [webhooks guide](../guides/webhooks_server) for a step-by-step tutorial on how to setup your - server and deploy it on a Space. - - - - `webhook_endpoint` is experimental. Its API is subject to change in the future. - - - - - - You must have `gradio` installed to use `webhook_endpoint` (`pip install --upgrade gradio`). - - - - Args: - path (`str`, optional): - The URL path to register the webhook function. If not provided, the function name will be used as the path. - In any case, all webhooks are registered under `/webhooks`. - - Examples: - The default usage is to register a function as a webhook endpoint. The function name will be used as the path. - The server will be started automatically at exit (i.e. at the end of the script). - - ```python - from huggingface_hub import webhook_endpoint, WebhookPayload - - @webhook_endpoint - async def trigger_training(payload: WebhookPayload): - if payload.repo.type == "dataset" and payload.event.action == "update": - # Trigger a training job if a dataset is updated - ... - - # Server is automatically started at the end of the script. - ``` - - Advanced usage: register a function as a webhook endpoint and start the server manually. This is useful if you - are running it in a notebook. - - ```python - from huggingface_hub import webhook_endpoint, WebhookPayload - - @webhook_endpoint - async def trigger_training(payload: WebhookPayload): - if payload.repo.type == "dataset" and payload.event.action == "update": - # Trigger a training job if a dataset is updated - ... - - # Start the server manually - trigger_training.run() - ``` - """ - if callable(path): - # If path is a function, it means it was used as a decorator without arguments - return webhook_endpoint()(path) - - @wraps(WebhooksServer.add_webhook) - def _inner(func: Callable) -> Callable: - app = _get_global_app() - app.add_webhook(path)(func) - if len(app.registered_webhooks) == 1: - # Register `app.run` to run at exit (only once) - atexit.register(app.run) - - @wraps(app.run) - def _run_now(): - # Run the app directly (without waiting atexit) - atexit.unregister(app.run) - app.run() - - func.run = _run_now # type: ignore - return func - - return _inner - - -def _get_global_app() -> WebhooksServer: - global _global_app - if _global_app is None: - _global_app = WebhooksServer() - return _global_app - - -def _warn_on_empty_secret(webhook_secret: Optional[str]) -> None: - if webhook_secret is None: - print("Webhook secret is not defined. This means your webhook endpoints will be open to everyone.") - print( - "To add a secret, set `WEBHOOK_SECRET` as environment variable or pass it at initialization: " - "\n\t`app = WebhooksServer(webhook_secret='my_secret', ...)`" - ) - print( - "For more details about webhook secrets, please refer to" - " https://huggingface.co/docs/hub/webhooks#webhook-secret." - ) - else: - print("Webhook secret is correctly defined.") - - -def _get_webhook_doc_url(webhook_name: str, webhook_path: str) -> str: - """Returns the anchor to a given webhook in the docs (experimental)""" - return "/docs#/default/" + webhook_name + webhook_path.replace("/", "_") + "_post" - - -def _wrap_webhook_to_check_secret(func: Callable, webhook_secret: str) -> Callable: - """Wraps a webhook function to check the webhook secret before calling the function. - - This is a hacky way to add the `request` parameter to the function signature. Since FastAPI based itself on route - parameters to inject the values to the function, we need to hack the function signature to retrieve the `Request` - object (and hence the headers). A far cleaner solution would be to use a middleware. However, since - `fastapi==0.90.1`, a middleware cannot be added once the app has started. And since the FastAPI app is started by - Gradio internals (and not by us), we cannot add a middleware. - - This method is called only when a secret has been defined by the user. If a request is sent without the - "x-webhook-secret", the function will return a 401 error (unauthorized). If the header is sent but is incorrect, - the function will return a 403 error (forbidden). - - Inspired by https://stackoverflow.com/a/33112180. - """ - initial_sig = inspect.signature(func) - - @wraps(func) - async def _protected_func(request: Request, **kwargs): - request_secret = request.headers.get("x-webhook-secret") - if request_secret is None: - return JSONResponse({"error": "x-webhook-secret header not set."}, status_code=401) - if request_secret != webhook_secret: - return JSONResponse({"error": "Invalid webhook secret."}, status_code=403) - - # Inject `request` in kwargs if required - if "request" in initial_sig.parameters: - kwargs["request"] = request - - # Handle both sync and async routes - if inspect.iscoroutinefunction(func): - return await func(**kwargs) - else: - return func(**kwargs) - - # Update signature to include request - if "request" not in initial_sig.parameters: - _protected_func.__signature__ = initial_sig.replace( # type: ignore - parameters=( - inspect.Parameter(name="request", kind=inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=Request), - ) - + tuple(initial_sig.parameters.values()) - ) - - # Return protected route - return _protected_func diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__init__.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__init__.py deleted file mode 100644 index 49d088214505b9604964ab142e7f8a5b38ccd5ef..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2020 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from abc import ABC, abstractmethod -from argparse import _SubParsersAction - - -class BaseHuggingfaceCLICommand(ABC): - @staticmethod - @abstractmethod - def register_subcommand(parser: _SubParsersAction): - raise NotImplementedError() - - @abstractmethod - def run(self): - raise NotImplementedError() diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index cd4a5d51d428b11f8eb8d9feb0905e434e1d0042..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/_cli_utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/_cli_utils.cpython-38.pyc deleted file mode 100644 index 2c96e2225577dd65cfb061a3aa896eb0eed938ae..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/_cli_utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/delete_cache.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/delete_cache.cpython-38.pyc deleted file mode 100644 index 0b7b74dec9347f120292c3aa796d4157ad3a20f1..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/delete_cache.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/download.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/download.cpython-38.pyc deleted file mode 100644 index 29fb066d28fdcb6378f431289772e87f1d439fde..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/download.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/env.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/env.cpython-38.pyc deleted file mode 100644 index 12911c52e61b9dbdd80b4d779b48fd5d1758e517..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/env.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/huggingface_cli.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/huggingface_cli.cpython-38.pyc deleted file mode 100644 index 9146a53d16c35874acd2ecae81f0de9d28045f7a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/huggingface_cli.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/lfs.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/lfs.cpython-38.pyc deleted file mode 100644 index d62dbe20f019bfd3eca2c6487dee08f64349536e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/lfs.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/scan_cache.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/scan_cache.cpython-38.pyc deleted file mode 100644 index 17da94b982ff272b973af9ad2d9f80d5dfb44a46..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/scan_cache.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/upload.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/upload.cpython-38.pyc deleted file mode 100644 index d068c7141bb2c09b703c9c95914d5bbf00c54978..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/upload.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/user.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/user.cpython-38.pyc deleted file mode 100644 index 14bbb13be78a5a6c5d4a6c362f7b19081741e28a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/commands/__pycache__/user.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/_cli_utils.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/_cli_utils.py deleted file mode 100644 index bbf17e887e901e58461b09e6648d614bb2caabbb..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/_cli_utils.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2022 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains a utility for good-looking prints.""" -import os -from typing import List, Union - - -class ANSI: - """ - Helper for en.wikipedia.org/wiki/ANSI_escape_code - """ - - _bold = "\u001b[1m" - _gray = "\u001b[90m" - _red = "\u001b[31m" - _reset = "\u001b[0m" - - @classmethod - def bold(cls, s: str) -> str: - return cls._format(s, cls._bold) - - @classmethod - def gray(cls, s: str) -> str: - return cls._format(s, cls._gray) - - @classmethod - def red(cls, s: str) -> str: - return cls._format(s, cls._bold + cls._red) - - @classmethod - def _format(cls, s: str, code: str) -> str: - if os.environ.get("NO_COLOR"): - # See https://no-color.org/ - return s - return f"{code}{s}{cls._reset}" - - -def tabulate(rows: List[List[Union[str, int]]], headers: List[str]) -> str: - """ - Inspired by: - - - stackoverflow.com/a/8356620/593036 - - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data - """ - col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)] - row_format = ("{{:{}}} " * len(headers)).format(*col_widths) - lines = [] - lines.append(row_format.format(*headers)) - lines.append(row_format.format(*["-" * w for w in col_widths])) - for row in rows: - lines.append(row_format.format(*row)) - return "\n".join(lines) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/delete_cache.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/delete_cache.py deleted file mode 100644 index c61863f55d3cde2773e4b0e14988514d9c476b01..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/delete_cache.py +++ /dev/null @@ -1,427 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains command to delete some revisions from the HF cache directory. - -Usage: - huggingface-cli delete-cache - huggingface-cli delete-cache --disable-tui - huggingface-cli delete-cache --dir ~/.cache/huggingface/hub - -NOTE: - This command is based on `InquirerPy` to build the multiselect menu in the terminal. - This dependency has to be installed with `pip install huggingface_hub[cli]`. Since - we want to avoid as much as possible cross-platform issues, I chose a library that - is built on top of `python-prompt-toolkit` which seems to be a reference in terminal - GUI (actively maintained on both Unix and Windows, 7.9k stars). - - For the moment, the TUI feature is in beta. - - See: - - https://github.com/kazhala/InquirerPy - - https://inquirerpy.readthedocs.io/en/latest/ - - https://github.com/prompt-toolkit/python-prompt-toolkit - - Other solutions could have been: - - `simple_term_menu`: would be good as well for our use case but some issues suggest - that Windows is less supported. - See: https://github.com/IngoMeyer441/simple-term-menu - - `PyInquirer`: very similar to `InquirerPy` but older and not maintained anymore. - In particular, no support of Python3.10. - See: https://github.com/CITGuru/PyInquirer - - `pick` (or `pickpack`): easy to use and flexible but built on top of Python's - standard library `curses` that is specific to Unix (not implemented on Windows). - See https://github.com/wong2/pick and https://github.com/anafvana/pickpack. - - `inquirer`: lot of traction (700 stars) but explicitly states "experimental - support of Windows". Not built on top of `python-prompt-toolkit`. - See https://github.com/magmax/python-inquirer - -TODO: add support for `huggingface-cli delete-cache aaaaaa bbbbbb cccccc (...)` ? -TODO: add "--keep-last" arg to delete revisions that are not on `main` ref -TODO: add "--filter" arg to filter repositories by name ? -TODO: add "--sort" arg to sort by size ? -TODO: add "--limit" arg to limit to X repos ? -TODO: add "-y" arg for immediate deletion ? -See discussions in https://github.com/huggingface/huggingface_hub/issues/1025. -""" -import os -from argparse import Namespace, _SubParsersAction -from functools import wraps -from tempfile import mkstemp -from typing import Any, Callable, Iterable, List, Optional, Union - -from ..utils import CachedRepoInfo, CachedRevisionInfo, HFCacheInfo, scan_cache_dir -from . import BaseHuggingfaceCLICommand -from ._cli_utils import ANSI - - -try: - from InquirerPy import inquirer - from InquirerPy.base.control import Choice - from InquirerPy.separator import Separator - - _inquirer_py_available = True -except ImportError: - _inquirer_py_available = False - - -def require_inquirer_py(fn: Callable) -> Callable: - """Decorator to flag methods that require `InquirerPy`.""" - - # TODO: refactor this + imports in a unified pattern across codebase - @wraps(fn) - def _inner(*args, **kwargs): - if not _inquirer_py_available: - raise ImportError( - "The `delete-cache` command requires extra dependencies to work with" - " the TUI.\nPlease run `pip install huggingface_hub[cli]` to install" - " them.\nOtherwise, disable TUI using the `--disable-tui` flag." - ) - - return fn(*args, **kwargs) - - return _inner - - -# Possibility for the user to cancel deletion -_CANCEL_DELETION_STR = "CANCEL_DELETION" - - -class DeleteCacheCommand(BaseHuggingfaceCLICommand): - @staticmethod - def register_subcommand(parser: _SubParsersAction): - delete_cache_parser = parser.add_parser("delete-cache", help="Delete revisions from the cache directory.") - - delete_cache_parser.add_argument( - "--dir", - type=str, - default=None, - help="cache directory (optional). Default to the default HuggingFace cache.", - ) - - delete_cache_parser.add_argument( - "--disable-tui", - action="store_true", - help=( - "Disable Terminal User Interface (TUI) mode. Useful if your" - " platform/terminal doesn't support the multiselect menu." - ), - ) - - delete_cache_parser.set_defaults(func=DeleteCacheCommand) - - def __init__(self, args: Namespace) -> None: - self.cache_dir: Optional[str] = args.dir - self.disable_tui: bool = args.disable_tui - - def run(self): - """Run `delete-cache` command with or without TUI.""" - # Scan cache directory - hf_cache_info = scan_cache_dir(self.cache_dir) - - # Manual review from the user - if self.disable_tui: - selected_hashes = _manual_review_no_tui(hf_cache_info, preselected=[]) - else: - selected_hashes = _manual_review_tui(hf_cache_info, preselected=[]) - - # If deletion is not cancelled - if len(selected_hashes) > 0 and _CANCEL_DELETION_STR not in selected_hashes: - confirm_message = _get_expectations_str(hf_cache_info, selected_hashes) + " Confirm deletion ?" - - # Confirm deletion - if self.disable_tui: - confirmed = _ask_for_confirmation_no_tui(confirm_message) - else: - confirmed = _ask_for_confirmation_tui(confirm_message) - - # Deletion is confirmed - if confirmed: - strategy = hf_cache_info.delete_revisions(*selected_hashes) - print("Start deletion.") - strategy.execute() - print( - f"Done. Deleted {len(strategy.repos)} repo(s) and" - f" {len(strategy.snapshots)} revision(s) for a total of" - f" {strategy.expected_freed_size_str}." - ) - return - - # Deletion is cancelled - print("Deletion is cancelled. Do nothing.") - - -@require_inquirer_py -def _manual_review_tui(hf_cache_info: HFCacheInfo, preselected: List[str]) -> List[str]: - """Ask the user for a manual review of the revisions to delete. - - Displays a multi-select menu in the terminal (TUI). - """ - # Define multiselect list - choices = _get_tui_choices_from_scan(repos=hf_cache_info.repos, preselected=preselected) - checkbox = inquirer.checkbox( - message="Select revisions to delete:", - choices=choices, # List of revisions with some pre-selection - cycle=False, # No loop between top and bottom - height=100, # Large list if possible - # We use the instruction to display to the user the expected effect of the - # deletion. - instruction=_get_expectations_str( - hf_cache_info, - selected_hashes=[c.value for c in choices if isinstance(c, Choice) and c.enabled], - ), - # We use the long instruction to should keybindings instructions to the user - long_instruction="Press to select, to validate and to quit without modification.", - # Message that is displayed once the user validates its selection. - transformer=lambda result: f"{len(result)} revision(s) selected.", - ) - - # Add a callback to update the information line when a revision is - # selected/unselected - def _update_expectations(_) -> None: - # Hacky way to dynamically set an instruction message to the checkbox when - # a revision hash is selected/unselected. - checkbox._instruction = _get_expectations_str( - hf_cache_info, - selected_hashes=[choice["value"] for choice in checkbox.content_control.choices if choice["enabled"]], - ) - - checkbox.kb_func_lookup["toggle"].append({"func": _update_expectations}) - - # Finally display the form to the user. - try: - return checkbox.execute() - except KeyboardInterrupt: - return [] # Quit without deletion - - -@require_inquirer_py -def _ask_for_confirmation_tui(message: str, default: bool = True) -> bool: - """Ask for confirmation using Inquirer.""" - return inquirer.confirm(message, default=default).execute() - - -def _get_tui_choices_from_scan(repos: Iterable[CachedRepoInfo], preselected: List[str]) -> List: - """Build a list of choices from the scanned repos. - - Args: - repos (*Iterable[`CachedRepoInfo`]*): - List of scanned repos on which we want to delete revisions. - preselected (*List[`str`]*): - List of revision hashes that will be preselected. - - Return: - The list of choices to pass to `inquirer.checkbox`. - """ - choices: List[Union[Choice, Separator]] = [] - - # First choice is to cancel the deletion. If selected, nothing will be deleted, - # no matter the other selected items. - choices.append( - Choice( - _CANCEL_DELETION_STR, - name="None of the following (if selected, nothing will be deleted).", - enabled=False, - ) - ) - - # Display a separator per repo and a Choice for each revisions of the repo - for repo in sorted(repos, key=_repo_sorting_order): - # Repo as separator - choices.append( - Separator( - f"\n{repo.repo_type.capitalize()} {repo.repo_id} ({repo.size_on_disk_str}," - f" used {repo.last_accessed_str})" - ) - ) - for revision in sorted(repo.revisions, key=_revision_sorting_order): - # Revision as choice - choices.append( - Choice( - revision.commit_hash, - name=( - f"{revision.commit_hash[:8]}:" - f" {', '.join(sorted(revision.refs)) or '(detached)'} #" - f" modified {revision.last_modified_str}" - ), - enabled=revision.commit_hash in preselected, - ) - ) - - # Return choices - return choices - - -def _manual_review_no_tui(hf_cache_info: HFCacheInfo, preselected: List[str]) -> List[str]: - """Ask the user for a manual review of the revisions to delete. - - Used when TUI is disabled. Manual review happens in a separate tmp file that the - user can manually edit. - """ - # 1. Generate temporary file with delete commands. - fd, tmp_path = mkstemp(suffix=".txt") # suffix to make it easier to find by editors - os.close(fd) - - lines = [] - for repo in sorted(hf_cache_info.repos, key=_repo_sorting_order): - lines.append( - f"\n# {repo.repo_type.capitalize()} {repo.repo_id} ({repo.size_on_disk_str}," - f" used {repo.last_accessed_str})" - ) - for revision in sorted(repo.revisions, key=_revision_sorting_order): - lines.append( - # Deselect by prepending a '#' - f"{'' if revision.commit_hash in preselected else '#'} " - f" {revision.commit_hash} # Refs:" - # Print `refs` as comment on same line - f" {', '.join(sorted(revision.refs)) or '(detached)'} # modified" - # Print `last_modified` as comment on same line - f" {revision.last_modified_str}" - ) - - with open(tmp_path, "w") as f: - f.write(_MANUAL_REVIEW_NO_TUI_INSTRUCTIONS) - f.write("\n".join(lines)) - - # 2. Prompt instructions to user. - instructions = f""" - TUI is disabled. In order to select which revisions you want to delete, please edit - the following file using the text editor of your choice. Instructions for manual - editing are located at the beginning of the file. Edit the file, save it and confirm - to continue. - File to edit: {ANSI.bold(tmp_path)} - """ - print("\n".join(line.strip() for line in instructions.strip().split("\n"))) - - # 3. Wait for user confirmation. - while True: - selected_hashes = _read_manual_review_tmp_file(tmp_path) - if _ask_for_confirmation_no_tui( - _get_expectations_str(hf_cache_info, selected_hashes) + " Continue ?", - default=False, - ): - break - - # 4. Return selected_hashes - os.remove(tmp_path) - return selected_hashes - - -def _ask_for_confirmation_no_tui(message: str, default: bool = True) -> bool: - """Ask for confirmation using pure-python.""" - YES = ("y", "yes", "1") - NO = ("n", "no", "0") - DEFAULT = "" - ALL = YES + NO + (DEFAULT,) - full_message = message + (" (Y/n) " if default else " (y/N) ") - while True: - answer = input(full_message).lower() - if answer == DEFAULT: - return default - if answer in YES: - return True - if answer in NO: - return False - print(f"Invalid input. Must be one of {ALL}") - - -def _get_expectations_str(hf_cache_info: HFCacheInfo, selected_hashes: List[str]) -> str: - """Format a string to display to the user how much space would be saved. - - Example: - ``` - >>> _get_expectations_str(hf_cache_info, selected_hashes) - '7 revisions selected counting for 4.3G.' - ``` - """ - if _CANCEL_DELETION_STR in selected_hashes: - return "Nothing will be deleted." - strategy = hf_cache_info.delete_revisions(*selected_hashes) - return f"{len(selected_hashes)} revisions selected counting for {strategy.expected_freed_size_str}." - - -def _read_manual_review_tmp_file(tmp_path: str) -> List[str]: - """Read the manually reviewed instruction file and return a list of revision hash. - - Example: - ```txt - # This is the tmp file content - ### - - # Commented out line - 123456789 # revision hash - - # Something else - # a_newer_hash # 2 days ago - an_older_hash # 3 days ago - ``` - - ```py - >>> _read_manual_review_tmp_file(tmp_path) - ['123456789', 'an_older_hash'] - ``` - """ - with open(tmp_path) as f: - content = f.read() - - # Split lines - lines = [line.strip() for line in content.split("\n")] - - # Filter commented lines - selected_lines = [line for line in lines if not line.startswith("#")] - - # Select only before comment - selected_hashes = [line.split("#")[0].strip() for line in selected_lines] - - # Return revision hashes - return [hash for hash in selected_hashes if len(hash) > 0] - - -_MANUAL_REVIEW_NO_TUI_INSTRUCTIONS = f""" -# INSTRUCTIONS -# ------------ -# This is a temporary file created by running `huggingface-cli delete-cache` with the -# `--disable-tui` option. It contains a set of revisions that can be deleted from your -# local cache directory. -# -# Please manually review the revisions you want to delete: -# - Revision hashes can be commented out with '#'. -# - Only non-commented revisions in this file will be deleted. -# - Revision hashes that are removed from this file are ignored as well. -# - If `{_CANCEL_DELETION_STR}` line is uncommented, the all cache deletion is cancelled and -# no changes will be applied. -# -# Once you've manually reviewed this file, please confirm deletion in the terminal. This -# file will be automatically removed once done. -# ------------ - -# KILL SWITCH -# ------------ -# Un-comment following line to completely cancel the deletion process -# {_CANCEL_DELETION_STR} -# ------------ - -# REVISIONS -# ------------ -""".strip() - - -def _repo_sorting_order(repo: CachedRepoInfo) -> Any: - # First split by Dataset/Model, then sort by last accessed (oldest first) - return (repo.repo_type, repo.last_accessed) - - -def _revision_sorting_order(revision: CachedRevisionInfo) -> Any: - # Sort by last modified (oldest first) - return revision.last_modified diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/download.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/download.py deleted file mode 100644 index 8ac5205e842fcc1e1711333983a40157bb863a7b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/download.py +++ /dev/null @@ -1,214 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains command to download files from the Hub with the CLI. - -Usage: - huggingface-cli download --help - - # Download file - huggingface-cli download gpt2 config.json - - # Download entire repo - huggingface-cli download fffiloni/zeroscope --repo-type=space --revision=refs/pr/78 - - # Download repo with filters - huggingface-cli download gpt2 --include="*.safetensors" - - # Download with token - huggingface-cli download Wauplin/private-model --token=hf_*** - - # Download quietly (no progress bar, no warnings, only the returned path) - huggingface-cli download gpt2 config.json --quiet - - # Download to local dir - huggingface-cli download gpt2 --local-dir=./models/gpt2 -""" -import warnings -from argparse import Namespace, _SubParsersAction -from typing import List, Literal, Optional, Union - -from huggingface_hub import logging -from huggingface_hub._snapshot_download import snapshot_download -from huggingface_hub.commands import BaseHuggingfaceCLICommand -from huggingface_hub.constants import HF_HUB_ENABLE_HF_TRANSFER -from huggingface_hub.file_download import hf_hub_download -from huggingface_hub.utils import disable_progress_bars, enable_progress_bars - - -logger = logging.get_logger(__name__) - - -class DownloadCommand(BaseHuggingfaceCLICommand): - @staticmethod - def register_subcommand(parser: _SubParsersAction): - download_parser = parser.add_parser("download", help="Download files from the Hub") - download_parser.add_argument( - "repo_id", type=str, help="ID of the repo to download from (e.g. `username/repo-name`)." - ) - download_parser.add_argument( - "filenames", type=str, nargs="*", help="Files to download (e.g. `config.json`, `data/metadata.jsonl`)." - ) - download_parser.add_argument( - "--repo-type", - choices=["model", "dataset", "space"], - default="model", - help="Type of repo to download from (e.g. `dataset`).", - ) - download_parser.add_argument( - "--revision", - type=str, - help="An optional Git revision id which can be a branch name, a tag, or a commit hash.", - ) - download_parser.add_argument( - "--include", nargs="*", type=str, help="Glob patterns to match files to download." - ) - download_parser.add_argument( - "--exclude", nargs="*", type=str, help="Glob patterns to exclude from files to download." - ) - download_parser.add_argument( - "--cache-dir", type=str, help="Path to the directory where to save the downloaded files." - ) - download_parser.add_argument( - "--local-dir", - type=str, - help=( - "If set, the downloaded file will be placed under this directory either as a symlink (default) or a" - " regular file. Check out" - " https://huggingface.co/docs/huggingface_hub/guides/download#download-files-to-local-folder for more" - " details." - ), - ) - download_parser.add_argument( - "--local-dir-use-symlinks", - choices=["auto", "True", "False"], - default="auto", - help=( - "To be used with `local_dir`. If set to 'auto', the cache directory will be used and the file will be" - " either duplicated or symlinked to the local directory depending on its size. It set to `True`, a" - " symlink will be created, no matter the file size. If set to `False`, the file will either be" - " duplicated from cache (if already exists) or downloaded from the Hub and not cached." - ), - ) - download_parser.add_argument( - "--force-download", - action="store_true", - help="If True, the files will be downloaded even if they are already cached.", - ) - download_parser.add_argument( - "--resume-download", action="store_true", help="If True, resume a previously interrupted download." - ) - download_parser.add_argument( - "--token", type=str, help="A User Access Token generated from https://huggingface.co/settings/tokens" - ) - download_parser.add_argument( - "--quiet", - action="store_true", - help="If True, progress bars are disabled and only the path to the download files is printed.", - ) - download_parser.set_defaults(func=DownloadCommand) - - def __init__(self, args: Namespace) -> None: - self.token = args.token - self.repo_id: str = args.repo_id - self.filenames: List[str] = args.filenames - self.repo_type: str = args.repo_type - self.revision: Optional[str] = args.revision - self.include: Optional[List[str]] = args.include - self.exclude: Optional[List[str]] = args.exclude - self.cache_dir: Optional[str] = args.cache_dir - self.local_dir: Optional[str] = args.local_dir - self.force_download: bool = args.force_download - self.resume_download: bool = args.resume_download - self.quiet: bool = args.quiet - - # Raise if local_dir_use_symlinks is invalid - self.local_dir_use_symlinks: Union[Literal["auto"], bool] - use_symlinks_lowercase = args.local_dir_use_symlinks.lower() - if use_symlinks_lowercase == "true": - self.local_dir_use_symlinks = True - elif use_symlinks_lowercase == "false": - self.local_dir_use_symlinks = False - elif use_symlinks_lowercase == "auto": - self.local_dir_use_symlinks = "auto" - else: - raise ValueError( - f"'{args.local_dir_use_symlinks}' is not a valid value for `local_dir_use_symlinks`. It must be either" - " 'auto', 'True' or 'False'." - ) - - def run(self) -> None: - if self.quiet: - disable_progress_bars() - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - print(self._download()) # Print path to downloaded files - enable_progress_bars() - else: - logging.set_verbosity_info() - print(self._download()) # Print path to downloaded files - logging.set_verbosity_warning() - - def _download(self) -> str: - # Warn user if patterns are ignored - if len(self.filenames) > 0: - if self.include is not None and len(self.include) > 0: - warnings.warn("Ignoring `--include` since filenames have being explicitly set.") - if self.exclude is not None and len(self.exclude) > 0: - warnings.warn("Ignoring `--exclude` since filenames have being explicitly set.") - - if not HF_HUB_ENABLE_HF_TRANSFER: - logger.info( - "Consider using `hf_transfer` for faster downloads. This solution comes with some limitations. See" - " https://huggingface.co/docs/huggingface_hub/hf_transfer for more details." - ) - - # Single file to download: use `hf_hub_download` - if len(self.filenames) == 1: - return hf_hub_download( - repo_id=self.repo_id, - repo_type=self.repo_type, - revision=self.revision, - filename=self.filenames[0], - cache_dir=self.cache_dir, - resume_download=self.resume_download, - force_download=self.force_download, - token=self.token, - local_dir=self.local_dir, - local_dir_use_symlinks=self.local_dir_use_symlinks, - library_name="huggingface-cli", - ) - - # Otherwise: use `snapshot_download` to ensure all files comes from same revision - elif len(self.filenames) == 0: - allow_patterns = self.include - ignore_patterns = self.exclude - else: - allow_patterns = self.filenames - ignore_patterns = None - - return snapshot_download( - repo_id=self.repo_id, - repo_type=self.repo_type, - revision=self.revision, - allow_patterns=allow_patterns, - ignore_patterns=ignore_patterns, - resume_download=self.resume_download, - force_download=self.force_download, - cache_dir=self.cache_dir, - token=self.token, - local_dir=self.local_dir, - local_dir_use_symlinks=self.local_dir_use_symlinks, - library_name="huggingface-cli", - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/env.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/env.py deleted file mode 100644 index 26d0d7fb151125703d5a0c84fa5d78d68f1eb8d8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/env.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2022 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains command to print information about the environment. - -Usage: - huggingface-cli env -""" -from argparse import _SubParsersAction - -from ..utils import dump_environment_info -from . import BaseHuggingfaceCLICommand - - -class EnvironmentCommand(BaseHuggingfaceCLICommand): - def __init__(self, args): - self.args = args - - @staticmethod - def register_subcommand(parser: _SubParsersAction): - env_parser = parser.add_parser("env", help="Print information about the environment.") - env_parser.set_defaults(func=EnvironmentCommand) - - def run(self) -> None: - dump_environment_info() diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/huggingface_cli.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/huggingface_cli.py deleted file mode 100644 index 39b6dfe49ab681f80dea6751e473843e5f685ff3..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/huggingface_cli.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -# Copyright 2020 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from argparse import ArgumentParser - -from huggingface_hub.commands.delete_cache import DeleteCacheCommand -from huggingface_hub.commands.download import DownloadCommand -from huggingface_hub.commands.env import EnvironmentCommand -from huggingface_hub.commands.lfs import LfsCommands -from huggingface_hub.commands.scan_cache import ScanCacheCommand -from huggingface_hub.commands.upload import UploadCommand -from huggingface_hub.commands.user import UserCommands - - -def main(): - parser = ArgumentParser("huggingface-cli", usage="huggingface-cli []") - commands_parser = parser.add_subparsers(help="huggingface-cli command helpers") - - # Register commands - EnvironmentCommand.register_subcommand(commands_parser) - UserCommands.register_subcommand(commands_parser) - UploadCommand.register_subcommand(commands_parser) - DownloadCommand.register_subcommand(commands_parser) - LfsCommands.register_subcommand(commands_parser) - ScanCacheCommand.register_subcommand(commands_parser) - DeleteCacheCommand.register_subcommand(commands_parser) - - # Let's go - args = parser.parse_args() - - if not hasattr(args, "func"): - parser.print_help() - exit(1) - - # Run - service = args.func(args) - service.run() - - -if __name__ == "__main__": - main() diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/lfs.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/lfs.py deleted file mode 100644 index a40951c2a3b6a139786203dc09d28714e7194782..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/lfs.py +++ /dev/null @@ -1,202 +0,0 @@ -""" -Implementation of a custom transfer agent for the transfer type "multipart" for -git-lfs. - -Inspired by: -github.com/cbartz/git-lfs-swift-transfer-agent/blob/master/git_lfs_swift_transfer.py - -Spec is: github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md - - -To launch debugger while developing: - -``` [lfs "customtransfer.multipart"] -path = /path/to/huggingface_hub/.env/bin/python args = -m debugpy --listen 5678 ---wait-for-client -/path/to/huggingface_hub/src/huggingface_hub/commands/huggingface_cli.py -lfs-multipart-upload ```""" - -import json -import os -import subprocess -import sys -from argparse import _SubParsersAction -from typing import Dict, List, Optional - -from huggingface_hub.commands import BaseHuggingfaceCLICommand -from huggingface_hub.lfs import LFS_MULTIPART_UPLOAD_COMMAND, SliceFileObj - -from ..utils import get_session, hf_raise_for_status, logging - - -logger = logging.get_logger(__name__) - - -class LfsCommands(BaseHuggingfaceCLICommand): - """ - Implementation of a custom transfer agent for the transfer type "multipart" - for git-lfs. This lets users upload large files >5GB 🔥. Spec for LFS custom - transfer agent is: - https://github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md - - This introduces two commands to the CLI: - - 1. $ huggingface-cli lfs-enable-largefiles - - This should be executed once for each model repo that contains a model file - >5GB. It's documented in the error message you get if you just try to git - push a 5GB file without having enabled it before. - - 2. $ huggingface-cli lfs-multipart-upload - - This command is called by lfs directly and is not meant to be called by the - user. - """ - - @staticmethod - def register_subcommand(parser: _SubParsersAction): - enable_parser = parser.add_parser( - "lfs-enable-largefiles", - help="Configure your repository to enable upload of files > 5GB.", - ) - enable_parser.add_argument("path", type=str, help="Local path to repository you want to configure.") - enable_parser.set_defaults(func=lambda args: LfsEnableCommand(args)) - - upload_parser = parser.add_parser( - LFS_MULTIPART_UPLOAD_COMMAND, - help="Command will get called by git-lfs, do not call it directly.", - ) - upload_parser.set_defaults(func=lambda args: LfsUploadCommand(args)) - - -class LfsEnableCommand: - def __init__(self, args): - self.args = args - - def run(self): - local_path = os.path.abspath(self.args.path) - if not os.path.isdir(local_path): - print("This does not look like a valid git repo.") - exit(1) - subprocess.run( - "git config lfs.customtransfer.multipart.path huggingface-cli".split(), - check=True, - cwd=local_path, - ) - subprocess.run( - f"git config lfs.customtransfer.multipart.args {LFS_MULTIPART_UPLOAD_COMMAND}".split(), - check=True, - cwd=local_path, - ) - print("Local repo set up for largefiles") - - -def write_msg(msg: Dict): - """Write out the message in Line delimited JSON.""" - msg_str = json.dumps(msg) + "\n" - sys.stdout.write(msg_str) - sys.stdout.flush() - - -def read_msg() -> Optional[Dict]: - """Read Line delimited JSON from stdin.""" - msg = json.loads(sys.stdin.readline().strip()) - - if "terminate" in (msg.get("type"), msg.get("event")): - # terminate message received - return None - - if msg.get("event") not in ("download", "upload"): - logger.critical("Received unexpected message") - sys.exit(1) - - return msg - - -class LfsUploadCommand: - def __init__(self, args) -> None: - self.args = args - - def run(self) -> None: - # Immediately after invoking a custom transfer process, git-lfs - # sends initiation data to the process over stdin. - # This tells the process useful information about the configuration. - init_msg = json.loads(sys.stdin.readline().strip()) - if not (init_msg.get("event") == "init" and init_msg.get("operation") == "upload"): - write_msg({"error": {"code": 32, "message": "Wrong lfs init operation"}}) - sys.exit(1) - - # The transfer process should use the information it needs from the - # initiation structure, and also perform any one-off setup tasks it - # needs to do. It should then respond on stdout with a simple empty - # confirmation structure, as follows: - write_msg({}) - - # After the initiation exchange, git-lfs will send any number of - # transfer requests to the stdin of the transfer process, in a serial sequence. - while True: - msg = read_msg() - if msg is None: - # When all transfers have been processed, git-lfs will send - # a terminate event to the stdin of the transfer process. - # On receiving this message the transfer process should - # clean up and terminate. No response is expected. - sys.exit(0) - - oid = msg["oid"] - filepath = msg["path"] - completion_url = msg["action"]["href"] - header = msg["action"]["header"] - chunk_size = int(header.pop("chunk_size")) - presigned_urls: List[str] = list(header.values()) - - # Send a "started" progress event to allow other workers to start. - # Otherwise they're delayed until first "progress" event is reported, - # i.e. after the first 5GB by default (!) - write_msg( - { - "event": "progress", - "oid": oid, - "bytesSoFar": 1, - "bytesSinceLast": 0, - } - ) - - parts = [] - with open(filepath, "rb") as file: - for i, presigned_url in enumerate(presigned_urls): - with SliceFileObj( - file, - seek_from=i * chunk_size, - read_limit=chunk_size, - ) as data: - r = get_session().put(presigned_url, data=data) - hf_raise_for_status(r) - parts.append( - { - "etag": r.headers.get("etag"), - "partNumber": i + 1, - } - ) - # In order to support progress reporting while data is uploading / downloading, - # the transfer process should post messages to stdout - write_msg( - { - "event": "progress", - "oid": oid, - "bytesSoFar": (i + 1) * chunk_size, - "bytesSinceLast": chunk_size, - } - ) - # Not precise but that's ok. - - r = get_session().post( - completion_url, - json={ - "oid": oid, - "parts": parts, - }, - ) - hf_raise_for_status(r) - - write_msg({"event": "complete", "oid": oid}) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/scan_cache.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/scan_cache.py deleted file mode 100644 index 392bec966e11aa9c8a3a80f60c760c54329b403c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/scan_cache.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains command to scan the HF cache directory. - -Usage: - huggingface-cli scan-cache - huggingface-cli scan-cache -v - huggingface-cli scan-cache -vvv - huggingface-cli scan-cache --dir ~/.cache/huggingface/hub -""" -import time -from argparse import Namespace, _SubParsersAction -from typing import Optional - -from ..utils import CacheNotFound, HFCacheInfo, scan_cache_dir -from . import BaseHuggingfaceCLICommand -from ._cli_utils import ANSI, tabulate - - -class ScanCacheCommand(BaseHuggingfaceCLICommand): - @staticmethod - def register_subcommand(parser: _SubParsersAction): - scan_cache_parser = parser.add_parser("scan-cache", help="Scan cache directory.") - - scan_cache_parser.add_argument( - "--dir", - type=str, - default=None, - help="cache directory to scan (optional). Default to the default HuggingFace cache.", - ) - scan_cache_parser.add_argument( - "-v", - "--verbose", - action="count", - default=0, - help="show a more verbose output", - ) - scan_cache_parser.set_defaults(func=ScanCacheCommand) - - def __init__(self, args: Namespace) -> None: - self.verbosity: int = args.verbose - self.cache_dir: Optional[str] = args.dir - - def run(self): - try: - t0 = time.time() - hf_cache_info = scan_cache_dir(self.cache_dir) - t1 = time.time() - except CacheNotFound as exc: - cache_dir = exc.cache_dir - print(f"Cache directory not found: {cache_dir}") - return - - self._print_hf_cache_info_as_table(hf_cache_info) - - print( - f"\nDone in {round(t1-t0,1)}s. Scanned {len(hf_cache_info.repos)} repo(s)" - f" for a total of {ANSI.red(hf_cache_info.size_on_disk_str)}." - ) - if len(hf_cache_info.warnings) > 0: - message = f"Got {len(hf_cache_info.warnings)} warning(s) while scanning." - if self.verbosity >= 3: - print(ANSI.gray(message)) - for warning in hf_cache_info.warnings: - print(ANSI.gray(warning)) - else: - print(ANSI.gray(message + " Use -vvv to print details.")) - - def _print_hf_cache_info_as_table(self, hf_cache_info: HFCacheInfo) -> None: - if self.verbosity == 0: - print( - tabulate( - rows=[ - [ - repo.repo_id, - repo.repo_type, - "{:>12}".format(repo.size_on_disk_str), - repo.nb_files, - repo.last_accessed_str, - repo.last_modified_str, - ", ".join(sorted(repo.refs)), - str(repo.repo_path), - ] - for repo in sorted(hf_cache_info.repos, key=lambda repo: repo.repo_path) - ], - headers=[ - "REPO ID", - "REPO TYPE", - "SIZE ON DISK", - "NB FILES", - "LAST_ACCESSED", - "LAST_MODIFIED", - "REFS", - "LOCAL PATH", - ], - ) - ) - else: - print( - tabulate( - rows=[ - [ - repo.repo_id, - repo.repo_type, - revision.commit_hash, - "{:>12}".format(revision.size_on_disk_str), - revision.nb_files, - revision.last_modified_str, - ", ".join(sorted(revision.refs)), - str(revision.snapshot_path), - ] - for repo in sorted(hf_cache_info.repos, key=lambda repo: repo.repo_path) - for revision in sorted(repo.revisions, key=lambda revision: revision.commit_hash) - ], - headers=[ - "REPO ID", - "REPO TYPE", - "REVISION", - "SIZE ON DISK", - "NB FILES", - "LAST_MODIFIED", - "REFS", - "LOCAL PATH", - ], - ) - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/upload.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/upload.py deleted file mode 100644 index 55b2e0785dfb336875e5074ab6bb40e39de23bb2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/upload.py +++ /dev/null @@ -1,285 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains command to upload a repo or file with the CLI. - -Usage: - # Upload file (implicit) - huggingface-cli upload my-cool-model ./my-cool-model.safetensors - - # Upload file (explicit) - huggingface-cli upload my-cool-model ./my-cool-model.safetensors model.safetensors - - # Upload directory (implicit). If `my-cool-model/` is a directory it will be uploaded, otherwise an exception is raised. - huggingface-cli upload my-cool-model - - # Upload directory (explicit) - huggingface-cli upload my-cool-model ./models/my-cool-model . - - # Upload filtered directory (example: tensorboard logs except for the last run) - huggingface-cli upload my-cool-model ./model/training /logs --include "*.tfevents.*" --exclude "*20230905*" - - # Upload private dataset - huggingface-cli upload Wauplin/my-cool-dataset ./data . --repo-type=dataset --private - - # Upload with token - huggingface-cli upload Wauplin/my-cool-model --token=hf_**** - - # Sync local Space with Hub (upload new files, delete removed files) - huggingface-cli upload Wauplin/space-example --repo-type=space --exclude="/logs/*" --delete="*" --commit-message="Sync local Space with Hub" - - # Schedule commits every 30 minutes - huggingface-cli upload Wauplin/my-cool-model --every=30 -""" -import os -import time -import warnings -from argparse import Namespace, _SubParsersAction -from typing import List, Optional - -from huggingface_hub import logging -from huggingface_hub._commit_scheduler import CommitScheduler -from huggingface_hub.commands import BaseHuggingfaceCLICommand -from huggingface_hub.constants import HF_HUB_ENABLE_HF_TRANSFER -from huggingface_hub.hf_api import HfApi -from huggingface_hub.utils import disable_progress_bars, enable_progress_bars - - -logger = logging.get_logger(__name__) - - -class UploadCommand(BaseHuggingfaceCLICommand): - @staticmethod - def register_subcommand(parser: _SubParsersAction): - upload_parser = parser.add_parser("upload", help="Upload a file or a folder to a repo on the Hub") - upload_parser.add_argument( - "repo_id", type=str, help="The ID of the repo to upload to (e.g. `username/repo-name`)." - ) - upload_parser.add_argument( - "local_path", nargs="?", help="Local path to the file or folder to upload. Defaults to current directory." - ) - upload_parser.add_argument( - "path_in_repo", - nargs="?", - help="Path of the file or folder in the repo. Defaults to the relative path of the file or folder.", - ) - upload_parser.add_argument( - "--repo-type", - choices=["model", "dataset", "space"], - default="model", - help="Type of the repo to upload to (e.g. `dataset`).", - ) - upload_parser.add_argument( - "--revision", - type=str, - help="An optional Git revision id which can be a branch name, a tag, or a commit hash.", - ) - upload_parser.add_argument( - "--private", - action="store_true", - help=( - "Whether to create a private repo if repo doesn't exist on the Hub. Ignored if the repo already" - " exists." - ), - ) - upload_parser.add_argument("--include", nargs="*", type=str, help="Glob patterns to match files to upload.") - upload_parser.add_argument( - "--exclude", nargs="*", type=str, help="Glob patterns to exclude from files to upload." - ) - upload_parser.add_argument( - "--delete", - nargs="*", - type=str, - help="Glob patterns for file to be deleted from the repo while committing.", - ) - upload_parser.add_argument( - "--commit-message", type=str, help="The summary / title / first line of the generated commit." - ) - upload_parser.add_argument("--commit-description", type=str, help="The description of the generated commit.") - upload_parser.add_argument( - "--create-pr", action="store_true", help="Whether to upload content as a new Pull Request." - ) - upload_parser.add_argument( - "--every", - type=float, - help="If set, a background job is scheduled to create commits every `every` minutes.", - ) - upload_parser.add_argument( - "--token", type=str, help="A User Access Token generated from https://huggingface.co/settings/tokens" - ) - upload_parser.add_argument( - "--quiet", - action="store_true", - help="If True, progress bars are disabled and only the path to the uploaded files is printed.", - ) - upload_parser.set_defaults(func=UploadCommand) - - def __init__(self, args: Namespace) -> None: - self.repo_id: str = args.repo_id - self.repo_type: Optional[str] = args.repo_type - self.revision: Optional[str] = args.revision - self.private: bool = args.private - - self.include: Optional[List[str]] = args.include - self.exclude: Optional[List[str]] = args.exclude - self.delete: Optional[List[str]] = args.delete - - self.commit_message: Optional[str] = args.commit_message - self.commit_description: Optional[str] = args.commit_description - self.create_pr: bool = args.create_pr - self.api: HfApi = HfApi(token=args.token, library_name="huggingface-cli") - self.quiet: bool = args.quiet # disable warnings and progress bars - - # Check `--every` is valid - if args.every is not None and args.every <= 0: - raise ValueError(f"`every` must be a positive value (got '{args.every}')") - self.every: Optional[float] = args.every - - # Resolve `local_path` and `path_in_repo` - repo_name: str = args.repo_id.split("/")[-1] # e.g. "Wauplin/my-cool-model" => "my-cool-model" - self.local_path: str - self.path_in_repo: str - if args.local_path is None and os.path.isfile(repo_name): - # Implicit case 1: user provided only a repo_id which happen to be a local file as well => upload it with same name - self.local_path = repo_name - self.path_in_repo = repo_name - elif args.local_path is None and os.path.isdir(repo_name): - # Implicit case 2: user provided only a repo_id which happen to be a local folder as well => upload it at root - self.local_path = repo_name - self.path_in_repo = "." - elif args.local_path is None: - # Implicit case 3: user provided only a repo_id that does not match a local file or folder - # => the user must explicitly provide a local_path => raise exception - raise ValueError(f"'{repo_name}' is not a local file or folder. Please set `local_path` explicitly.") - elif args.path_in_repo is None and os.path.isfile(args.local_path): - # Explicit local path to file, no path in repo => upload it at root with same name - self.local_path = args.local_path - self.path_in_repo = os.path.basename(args.local_path) - elif args.path_in_repo is None: - # Explicit local path to folder, no path in repo => upload at root - self.local_path = args.local_path - self.path_in_repo = "." - else: - # Finally, if both paths are explicit - self.local_path = args.local_path - self.path_in_repo = args.path_in_repo - - def run(self) -> None: - if self.quiet: - disable_progress_bars() - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - print(self._upload()) - enable_progress_bars() - else: - logging.set_verbosity_info() - print(self._upload()) - logging.set_verbosity_warning() - - def _upload(self) -> str: - if os.path.isfile(self.local_path): - if self.include is not None and len(self.include) > 0: - warnings.warn("Ignoring `--include` since a single file is uploaded.") - if self.exclude is not None and len(self.exclude) > 0: - warnings.warn("Ignoring `--exclude` since a single file is uploaded.") - if self.delete is not None and len(self.delete) > 0: - warnings.warn("Ignoring `--delete` since a single file is uploaded.") - - if not HF_HUB_ENABLE_HF_TRANSFER: - logger.info( - "Consider using `hf_transfer` for faster uploads. This solution comes with some limitations. See" - " https://huggingface.co/docs/huggingface_hub/hf_transfer for more details." - ) - - # Schedule commits if `every` is set - if self.every is not None: - if os.path.isfile(self.local_path): - # If file => watch entire folder + use allow_patterns - folder_path = os.path.dirname(self.local_path) - path_in_repo = ( - self.path_in_repo[: -len(self.local_path)] # remove filename from path_in_repo - if self.path_in_repo.endswith(self.local_path) - else self.path_in_repo - ) - allow_patterns = [self.local_path] - ignore_patterns = [] - else: - folder_path = self.local_path - path_in_repo = self.path_in_repo - allow_patterns = self.include or [] - ignore_patterns = self.exclude or [] - if self.delete is not None and len(self.delete) > 0: - warnings.warn("Ignoring `--delete` when uploading with scheduled commits.") - - scheduler = CommitScheduler( - folder_path=folder_path, - repo_id=self.repo_id, - repo_type=self.repo_type, - revision=self.revision, - allow_patterns=allow_patterns, - ignore_patterns=ignore_patterns, - path_in_repo=path_in_repo, - private=self.private, - every=self.every, - hf_api=self.api, - ) - print(f"Scheduling commits every {self.every} minutes to {scheduler.repo_id}.") - try: # Block main thread until KeyboardInterrupt - while True: - time.sleep(100) - except KeyboardInterrupt: - scheduler.stop() - return "Stopped scheduled commits." - - # Otherwise, create repo and proceed with the upload - if not os.path.isfile(self.local_path) and not os.path.isdir(self.local_path): - raise FileNotFoundError(f"No such file or directory: '{self.local_path}'.") - repo_id = self.api.create_repo( - repo_id=self.repo_id, - repo_type=self.repo_type, - exist_ok=True, - private=self.private, - space_sdk="gradio" if self.repo_type == "space" else None, - # ^ We don't want it to fail when uploading to a Space => let's set Gradio by default. - # ^ I'd rather not add CLI args to set it explicitly as we already have `huggingface-cli repo create` for that. - ).repo_id - - # File-based upload - if os.path.isfile(self.local_path): - return self.api.upload_file( - path_or_fileobj=self.local_path, - path_in_repo=self.path_in_repo, - repo_id=repo_id, - repo_type=self.repo_type, - revision=self.revision, - commit_message=self.commit_message, - commit_description=self.commit_description, - create_pr=self.create_pr, - ) - - # Folder-based upload - else: - return self.api.upload_folder( - folder_path=self.local_path, - path_in_repo=self.path_in_repo, - repo_id=repo_id, - repo_type=self.repo_type, - revision=self.revision, - commit_message=self.commit_message, - commit_description=self.commit_description, - create_pr=self.create_pr, - allow_patterns=self.include, - ignore_patterns=self.exclude, - delete_patterns=self.delete, - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/commands/user.py b/venv/lib/python3.8/site-packages/huggingface_hub/commands/user.py deleted file mode 100644 index b6a7a0145cfa6069423e99ec4b6c154d606ae18b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/commands/user.py +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright 2020 The HuggingFace Team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import subprocess -from argparse import _SubParsersAction - -from requests.exceptions import HTTPError - -from huggingface_hub.commands import BaseHuggingfaceCLICommand -from huggingface_hub.constants import ( - ENDPOINT, - REPO_TYPES, - REPO_TYPES_URL_PREFIXES, - SPACES_SDK_TYPES, -) -from huggingface_hub.hf_api import HfApi - -from .._login import ( # noqa: F401 # for backward compatibility # noqa: F401 # for backward compatibility - NOTEBOOK_LOGIN_PASSWORD_HTML, - NOTEBOOK_LOGIN_TOKEN_HTML_END, - NOTEBOOK_LOGIN_TOKEN_HTML_START, - login, - logout, - notebook_login, -) -from ..utils import HfFolder -from ._cli_utils import ANSI - - -class UserCommands(BaseHuggingfaceCLICommand): - @staticmethod - def register_subcommand(parser: _SubParsersAction): - login_parser = parser.add_parser("login", help="Log in using a token from huggingface.co/settings/tokens") - login_parser.add_argument( - "--token", - type=str, - help="Token generated from https://huggingface.co/settings/tokens", - ) - login_parser.add_argument( - "--add-to-git-credential", - action="store_true", - help="Optional: Save token to git credential helper.", - ) - login_parser.set_defaults(func=lambda args: LoginCommand(args)) - whoami_parser = parser.add_parser("whoami", help="Find out which huggingface.co account you are logged in as.") - whoami_parser.set_defaults(func=lambda args: WhoamiCommand(args)) - logout_parser = parser.add_parser("logout", help="Log out") - logout_parser.set_defaults(func=lambda args: LogoutCommand(args)) - - # new system: git-based repo system - repo_parser = parser.add_parser( - "repo", - help="{create, ls-files} Commands to interact with your huggingface.co repos.", - ) - repo_subparsers = repo_parser.add_subparsers(help="huggingface.co repos related commands") - repo_create_parser = repo_subparsers.add_parser("create", help="Create a new repo on huggingface.co") - repo_create_parser.add_argument( - "name", - type=str, - help="Name for your repo. Will be namespaced under your username to build the repo id.", - ) - repo_create_parser.add_argument( - "--type", - type=str, - help='Optional: repo_type: set to "dataset" or "space" if creating a dataset or space, default is model.', - ) - repo_create_parser.add_argument("--organization", type=str, help="Optional: organization namespace.") - repo_create_parser.add_argument( - "--space_sdk", - type=str, - help='Optional: Hugging Face Spaces SDK type. Required when --type is set to "space".', - choices=SPACES_SDK_TYPES, - ) - repo_create_parser.add_argument( - "-y", - "--yes", - action="store_true", - help="Optional: answer Yes to the prompt", - ) - repo_create_parser.set_defaults(func=lambda args: RepoCreateCommand(args)) - - -class BaseUserCommand: - def __init__(self, args): - self.args = args - self._api = HfApi() - - -class LoginCommand(BaseUserCommand): - def run(self): - login(token=self.args.token, add_to_git_credential=self.args.add_to_git_credential) - - -class LogoutCommand(BaseUserCommand): - def run(self): - logout() - - -class WhoamiCommand(BaseUserCommand): - def run(self): - token = HfFolder.get_token() - if token is None: - print("Not logged in") - exit() - try: - info = self._api.whoami(token) - print(info["name"]) - orgs = [org["name"] for org in info["orgs"]] - if orgs: - print(ANSI.bold("orgs: "), ",".join(orgs)) - - if ENDPOINT != "https://huggingface.co": - print(f"Authenticated through private endpoint: {ENDPOINT}") - except HTTPError as e: - print(e) - print(ANSI.red(e.response.text)) - exit(1) - - -class RepoCreateCommand(BaseUserCommand): - def run(self): - token = HfFolder.get_token() - if token is None: - print("Not logged in") - exit(1) - try: - stdout = subprocess.check_output(["git", "--version"]).decode("utf-8") - print(ANSI.gray(stdout.strip())) - except FileNotFoundError: - print("Looks like you do not have git installed, please install.") - - try: - stdout = subprocess.check_output(["git-lfs", "--version"]).decode("utf-8") - print(ANSI.gray(stdout.strip())) - except FileNotFoundError: - print( - ANSI.red( - "Looks like you do not have git-lfs installed, please install." - " You can install from https://git-lfs.github.com/." - " Then run `git lfs install` (you only have to do this once)." - ) - ) - print("") - - user = self._api.whoami(token)["name"] - namespace = self.args.organization if self.args.organization is not None else user - - repo_id = f"{namespace}/{self.args.name}" - - if self.args.type not in REPO_TYPES: - print("Invalid repo --type") - exit(1) - - if self.args.type in REPO_TYPES_URL_PREFIXES: - prefixed_repo_id = REPO_TYPES_URL_PREFIXES[self.args.type] + repo_id - else: - prefixed_repo_id = repo_id - - print(f"You are about to create {ANSI.bold(prefixed_repo_id)}") - - if not self.args.yes: - choice = input("Proceed? [Y/n] ").lower() - if not (choice == "" or choice == "y" or choice == "yes"): - print("Abort") - exit() - try: - url = self._api.create_repo( - repo_id=repo_id, - token=token, - repo_type=self.args.type, - space_sdk=self.args.space_sdk, - ) - except HTTPError as e: - print(e) - print(ANSI.red(e.response.text)) - exit(1) - print("\nYour repo now lives at:") - print(f" {ANSI.bold(url)}") - print("\nYou can clone it locally with the command below, and commit/push as usual.") - print(f"\n git clone {url}") - print("") diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/community.py b/venv/lib/python3.8/site-packages/huggingface_hub/community.py deleted file mode 100644 index f5422ca911fac8cd5717695c59a1703cf3dc73e7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/community.py +++ /dev/null @@ -1,353 +0,0 @@ -""" -Data structures to interact with Discussions and Pull Requests on the Hub. - -See [the Discussions and Pull Requests guide](https://huggingface.co/docs/hub/repositories-pull-requests-discussions) -for more information on Pull Requests, Discussions, and the community tab. -""" -from dataclasses import dataclass -from datetime import datetime -from typing import List, Literal, Optional - -from .constants import REPO_TYPE_MODEL -from .utils import parse_datetime - - -DiscussionStatus = Literal["open", "closed", "merged", "draft"] - - -@dataclass -class Discussion: - """ - A Discussion or Pull Request on the Hub. - - This dataclass is not intended to be instantiated directly. - - Attributes: - title (`str`): - The title of the Discussion / Pull Request - status (`str`): - The status of the Discussion / Pull Request. - It must be one of: - * `"open"` - * `"closed"` - * `"merged"` (only for Pull Requests ) - * `"draft"` (only for Pull Requests ) - num (`int`): - The number of the Discussion / Pull Request. - repo_id (`str`): - The id (`"{namespace}/{repo_name}"`) of the repo on which - the Discussion / Pull Request was open. - repo_type (`str`): - The type of the repo on which the Discussion / Pull Request was open. - Possible values are: `"model"`, `"dataset"`, `"space"`. - author (`str`): - The username of the Discussion / Pull Request author. - Can be `"deleted"` if the user has been deleted since. - is_pull_request (`bool`): - Whether or not this is a Pull Request. - created_at (`datetime`): - The `datetime` of creation of the Discussion / Pull Request. - endpoint (`str`): - Endpoint of the Hub. Default is https://huggingface.co. - git_reference (`str`, *optional*): - (property) Git reference to which changes can be pushed if this is a Pull Request, `None` otherwise. - url (`str`): - (property) URL of the discussion on the Hub. - """ - - title: str - status: DiscussionStatus - num: int - repo_id: str - repo_type: str - author: str - is_pull_request: bool - created_at: datetime - endpoint: str - - @property - def git_reference(self) -> Optional[str]: - """ - If this is a Pull Request , returns the git reference to which changes can be pushed. - Returns `None` otherwise. - """ - if self.is_pull_request: - return f"refs/pr/{self.num}" - return None - - @property - def url(self) -> str: - """Returns the URL of the discussion on the Hub.""" - if self.repo_type is None or self.repo_type == REPO_TYPE_MODEL: - return f"{self.endpoint}/{self.repo_id}/discussions/{self.num}" - return f"{self.endpoint}/{self.repo_type}s/{self.repo_id}/discussions/{self.num}" - - -@dataclass -class DiscussionWithDetails(Discussion): - """ - Subclass of [`Discussion`]. - - Attributes: - title (`str`): - The title of the Discussion / Pull Request - status (`str`): - The status of the Discussion / Pull Request. - It can be one of: - * `"open"` - * `"closed"` - * `"merged"` (only for Pull Requests ) - * `"draft"` (only for Pull Requests ) - num (`int`): - The number of the Discussion / Pull Request. - repo_id (`str`): - The id (`"{namespace}/{repo_name}"`) of the repo on which - the Discussion / Pull Request was open. - repo_type (`str`): - The type of the repo on which the Discussion / Pull Request was open. - Possible values are: `"model"`, `"dataset"`, `"space"`. - author (`str`): - The username of the Discussion / Pull Request author. - Can be `"deleted"` if the user has been deleted since. - is_pull_request (`bool`): - Whether or not this is a Pull Request. - created_at (`datetime`): - The `datetime` of creation of the Discussion / Pull Request. - events (`list` of [`DiscussionEvent`]) - The list of [`DiscussionEvents`] in this Discussion or Pull Request. - conflicting_files (`list` of `str`, *optional*): - A list of conflicting files if this is a Pull Request. - `None` if `self.is_pull_request` is `False`. - target_branch (`str`, *optional*): - The branch into which changes are to be merged if this is a - Pull Request . `None` if `self.is_pull_request` is `False`. - merge_commit_oid (`str`, *optional*): - If this is a merged Pull Request , this is set to the OID / SHA of - the merge commit, `None` otherwise. - diff (`str`, *optional*): - The git diff if this is a Pull Request , `None` otherwise. - endpoint (`str`): - Endpoint of the Hub. Default is https://huggingface.co. - git_reference (`str`, *optional*): - (property) Git reference to which changes can be pushed if this is a Pull Request, `None` otherwise. - url (`str`): - (property) URL of the discussion on the Hub. - """ - - events: List["DiscussionEvent"] - conflicting_files: Optional[List[str]] - target_branch: Optional[str] - merge_commit_oid: Optional[str] - diff: Optional[str] - - -@dataclass -class DiscussionEvent: - """ - An event in a Discussion or Pull Request. - - Use concrete classes: - * [`DiscussionComment`] - * [`DiscussionStatusChange`] - * [`DiscussionCommit`] - * [`DiscussionTitleChange`] - - Attributes: - id (`str`): - The ID of the event. An hexadecimal string. - type (`str`): - The type of the event. - created_at (`datetime`): - A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) - object holding the creation timestamp for the event. - author (`str`): - The username of the Discussion / Pull Request author. - Can be `"deleted"` if the user has been deleted since. - """ - - id: str - type: str - created_at: datetime - author: str - - _event: dict - """Stores the original event data, in case we need to access it later.""" - - -@dataclass -class DiscussionComment(DiscussionEvent): - """A comment in a Discussion / Pull Request. - - Subclass of [`DiscussionEvent`]. - - - Attributes: - id (`str`): - The ID of the event. An hexadecimal string. - type (`str`): - The type of the event. - created_at (`datetime`): - A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) - object holding the creation timestamp for the event. - author (`str`): - The username of the Discussion / Pull Request author. - Can be `"deleted"` if the user has been deleted since. - content (`str`): - The raw markdown content of the comment. Mentions, links and images are not rendered. - edited (`bool`): - Whether or not this comment has been edited. - hidden (`bool`): - Whether or not this comment has been hidden. - """ - - content: str - edited: bool - hidden: bool - - @property - def rendered(self) -> str: - """The rendered comment, as a HTML string""" - return self._event["data"]["latest"]["html"] - - @property - def last_edited_at(self) -> datetime: - """The last edit time, as a `datetime` object.""" - return parse_datetime(self._event["data"]["latest"]["updatedAt"]) - - @property - def last_edited_by(self) -> str: - """The last edit time, as a `datetime` object.""" - return self._event["data"]["latest"].get("author", {}).get("name", "deleted") - - @property - def edit_history(self) -> List[dict]: - """The edit history of the comment""" - return self._event["data"]["history"] - - @property - def number_of_edits(self) -> int: - return len(self.edit_history) - - -@dataclass -class DiscussionStatusChange(DiscussionEvent): - """A change of status in a Discussion / Pull Request. - - Subclass of [`DiscussionEvent`]. - - Attributes: - id (`str`): - The ID of the event. An hexadecimal string. - type (`str`): - The type of the event. - created_at (`datetime`): - A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) - object holding the creation timestamp for the event. - author (`str`): - The username of the Discussion / Pull Request author. - Can be `"deleted"` if the user has been deleted since. - new_status (`str`): - The status of the Discussion / Pull Request after the change. - It can be one of: - * `"open"` - * `"closed"` - * `"merged"` (only for Pull Requests ) - """ - - new_status: str - - -@dataclass -class DiscussionCommit(DiscussionEvent): - """A commit in a Pull Request. - - Subclass of [`DiscussionEvent`]. - - Attributes: - id (`str`): - The ID of the event. An hexadecimal string. - type (`str`): - The type of the event. - created_at (`datetime`): - A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) - object holding the creation timestamp for the event. - author (`str`): - The username of the Discussion / Pull Request author. - Can be `"deleted"` if the user has been deleted since. - summary (`str`): - The summary of the commit. - oid (`str`): - The OID / SHA of the commit, as a hexadecimal string. - """ - - summary: str - oid: str - - -@dataclass -class DiscussionTitleChange(DiscussionEvent): - """A rename event in a Discussion / Pull Request. - - Subclass of [`DiscussionEvent`]. - - Attributes: - id (`str`): - The ID of the event. An hexadecimal string. - type (`str`): - The type of the event. - created_at (`datetime`): - A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime) - object holding the creation timestamp for the event. - author (`str`): - The username of the Discussion / Pull Request author. - Can be `"deleted"` if the user has been deleted since. - old_title (`str`): - The previous title for the Discussion / Pull Request. - new_title (`str`): - The new title. - """ - - old_title: str - new_title: str - - -def deserialize_event(event: dict) -> DiscussionEvent: - """Instantiates a [`DiscussionEvent`] from a dict""" - event_id: str = event["id"] - event_type: str = event["type"] - created_at = parse_datetime(event["createdAt"]) - - common_args = dict( - id=event_id, - type=event_type, - created_at=created_at, - author=event.get("author", {}).get("name", "deleted"), - _event=event, - ) - - if event_type == "comment": - return DiscussionComment( - **common_args, - edited=event["data"]["edited"], - hidden=event["data"]["hidden"], - content=event["data"]["latest"]["raw"], - ) - if event_type == "status-change": - return DiscussionStatusChange( - **common_args, - new_status=event["data"]["status"], - ) - if event_type == "commit": - return DiscussionCommit( - **common_args, - summary=event["data"]["subject"], - oid=event["data"]["oid"], - ) - if event_type == "title-change": - return DiscussionTitleChange( - **common_args, - old_title=event["data"]["from"], - new_title=event["data"]["to"], - ) - - return DiscussionEvent(**common_args) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/constants.py b/venv/lib/python3.8/site-packages/huggingface_hub/constants.py deleted file mode 100644 index fec3285ce97e59db47d01e340330c2ad7a553544..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/constants.py +++ /dev/null @@ -1,169 +0,0 @@ -import os -import re -from typing import Optional - - -# Possible values for env variables - -ENV_VARS_TRUE_VALUES = {"1", "ON", "YES", "TRUE"} -ENV_VARS_TRUE_AND_AUTO_VALUES = ENV_VARS_TRUE_VALUES.union({"AUTO"}) - - -def _is_true(value: Optional[str]) -> bool: - if value is None: - return False - return value.upper() in ENV_VARS_TRUE_VALUES - - -def _as_int(value: Optional[str]) -> Optional[int]: - if value is None: - return None - return int(value) - - -# Constants for file downloads - -PYTORCH_WEIGHTS_NAME = "pytorch_model.bin" -TF2_WEIGHTS_NAME = "tf_model.h5" -TF_WEIGHTS_NAME = "model.ckpt" -FLAX_WEIGHTS_NAME = "flax_model.msgpack" -CONFIG_NAME = "config.json" -REPOCARD_NAME = "README.md" - -# Git-related constants - -DEFAULT_REVISION = "main" -REGEX_COMMIT_OID = re.compile(r"[A-Fa-f0-9]{5,40}") - -HUGGINGFACE_CO_URL_HOME = "https://huggingface.co/" - -_staging_mode = _is_true(os.environ.get("HUGGINGFACE_CO_STAGING")) - -ENDPOINT = os.getenv("HF_ENDPOINT") or ("https://hub-ci.huggingface.co" if _staging_mode else "https://huggingface.co") - -HUGGINGFACE_CO_URL_TEMPLATE = ENDPOINT + "/{repo_id}/resolve/{revision}/{filename}" -HUGGINGFACE_HEADER_X_REPO_COMMIT = "X-Repo-Commit" -HUGGINGFACE_HEADER_X_LINKED_ETAG = "X-Linked-Etag" -HUGGINGFACE_HEADER_X_LINKED_SIZE = "X-Linked-Size" - -INFERENCE_ENDPOINT = os.environ.get("HF_INFERENCE_ENDPOINT", "https://api-inference.huggingface.co") - -REPO_ID_SEPARATOR = "--" -# ^ this substring is not allowed in repo_ids on hf.co -# and is the canonical one we use for serialization of repo ids elsewhere. - - -REPO_TYPE_DATASET = "dataset" -REPO_TYPE_SPACE = "space" -REPO_TYPE_MODEL = "model" -REPO_TYPES = [None, REPO_TYPE_MODEL, REPO_TYPE_DATASET, REPO_TYPE_SPACE] -SPACES_SDK_TYPES = ["gradio", "streamlit", "docker", "static"] - -REPO_TYPES_URL_PREFIXES = { - REPO_TYPE_DATASET: "datasets/", - REPO_TYPE_SPACE: "spaces/", -} -REPO_TYPES_MAPPING = { - "datasets": REPO_TYPE_DATASET, - "spaces": REPO_TYPE_SPACE, - "models": REPO_TYPE_MODEL, -} - - -# default cache -default_home = os.path.join(os.path.expanduser("~"), ".cache") -hf_cache_home = os.path.expanduser( - os.getenv( - "HF_HOME", - os.path.join(os.getenv("XDG_CACHE_HOME", default_home), "huggingface"), - ) -) - -default_cache_path = os.path.join(hf_cache_home, "hub") -default_assets_cache_path = os.path.join(hf_cache_home, "assets") - -HUGGINGFACE_HUB_CACHE = os.getenv("HUGGINGFACE_HUB_CACHE", default_cache_path) -HUGGINGFACE_ASSETS_CACHE = os.getenv("HUGGINGFACE_ASSETS_CACHE", default_assets_cache_path) - -HF_HUB_OFFLINE = _is_true(os.environ.get("HF_HUB_OFFLINE") or os.environ.get("TRANSFORMERS_OFFLINE")) - -# Opt-out from telemetry requests -HF_HUB_DISABLE_TELEMETRY = _is_true(os.environ.get("HF_HUB_DISABLE_TELEMETRY") or os.environ.get("DISABLE_TELEMETRY")) - -# In the past, token was stored in a hardcoded location -# `_OLD_HF_TOKEN_PATH` is deprecated and will be removed "at some point". -# See https://github.com/huggingface/huggingface_hub/issues/1232 -_OLD_HF_TOKEN_PATH = os.path.expanduser("~/.huggingface/token") -HF_TOKEN_PATH = os.path.join(hf_cache_home, "token") - - -# Here, `True` will disable progress bars globally without possibility of enabling it -# programmatically. `False` will enable them without possibility of disabling them. -# If environment variable is not set (None), then the user is free to enable/disable -# them programmatically. -# TL;DR: env variable has priority over code -__HF_HUB_DISABLE_PROGRESS_BARS = os.environ.get("HF_HUB_DISABLE_PROGRESS_BARS") -HF_HUB_DISABLE_PROGRESS_BARS: Optional[bool] = ( - _is_true(__HF_HUB_DISABLE_PROGRESS_BARS) if __HF_HUB_DISABLE_PROGRESS_BARS is not None else None -) - -# Disable warning on machines that do not support symlinks (e.g. Windows non-developer) -HF_HUB_DISABLE_SYMLINKS_WARNING: bool = _is_true(os.environ.get("HF_HUB_DISABLE_SYMLINKS_WARNING")) - -# Disable warning when using experimental features -HF_HUB_DISABLE_EXPERIMENTAL_WARNING: bool = _is_true(os.environ.get("HF_HUB_DISABLE_EXPERIMENTAL_WARNING")) - -# Disable sending the cached token by default is all HTTP requests to the Hub -HF_HUB_DISABLE_IMPLICIT_TOKEN: bool = _is_true(os.environ.get("HF_HUB_DISABLE_IMPLICIT_TOKEN")) - -# Enable fast-download using external dependency "hf_transfer" -# See: -# - https://pypi.org/project/hf-transfer/ -# - https://github.com/huggingface/hf_transfer (private) -HF_HUB_ENABLE_HF_TRANSFER: bool = _is_true(os.environ.get("HF_HUB_ENABLE_HF_TRANSFER")) - - -# Used if download to `local_dir` and `local_dir_use_symlinks="auto"` -# Files smaller than 5MB are copy-pasted while bigger files are symlinked. The idea is to save disk-usage by symlinking -# huge files (i.e. LFS files most of the time) while allowing small files to be manually edited in local folder. -HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD: int = ( - _as_int(os.environ.get("HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD")) or 5 * 1024 * 1024 -) - -# List frameworks that are handled by the InferenceAPI service. Useful to scan endpoints and check which models are -# deployed and running. Since 95% of the models are using the top 4 frameworks listed below, we scan only those by -# default. We still keep the full list of supported frameworks in case we want to scan all of them. -MAIN_INFERENCE_API_FRAMEWORKS = [ - "diffusers", - "sentence-transformers", - "text-generation-inference", - "transformers", -] - -ALL_INFERENCE_API_FRAMEWORKS = MAIN_INFERENCE_API_FRAMEWORKS + [ - "adapter-transformers", - "allennlp", - "asteroid", - "bertopic", - "doctr", - "espnet", - "fairseq", - "fastai", - "fasttext", - "flair", - "generic", - "k2", - "keras", - "mindspore", - "nemo", - "open_clip", - "paddlenlp", - "peft", - "pyannote-audio", - "sklearn", - "spacy", - "span-marker", - "speechbrain", - "stanza", - "timm", -] diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/fastai_utils.py b/venv/lib/python3.8/site-packages/huggingface_hub/fastai_utils.py deleted file mode 100644 index e586e8663c39e8d5bab3f57f667dbd878514e59d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/fastai_utils.py +++ /dev/null @@ -1,425 +0,0 @@ -import json -import os -from pathlib import Path -from pickle import DEFAULT_PROTOCOL, PicklingError -from typing import Any, Dict, List, Optional, Union - -from packaging import version - -from huggingface_hub import snapshot_download -from huggingface_hub.constants import CONFIG_NAME -from huggingface_hub.hf_api import HfApi -from huggingface_hub.utils import ( - SoftTemporaryDirectory, - get_fastai_version, - get_fastcore_version, - get_python_version, -) - -from .utils import logging, validate_hf_hub_args -from .utils._runtime import _PY_VERSION # noqa: F401 # for backward compatibility... - - -logger = logging.get_logger(__name__) - - -def _check_fastai_fastcore_versions( - fastai_min_version: str = "2.4", - fastcore_min_version: str = "1.3.27", -): - """ - Checks that the installed fastai and fastcore versions are compatible for pickle serialization. - - Args: - fastai_min_version (`str`, *optional*): - The minimum fastai version supported. - fastcore_min_version (`str`, *optional*): - The minimum fastcore version supported. - - - Raises the following error: - - - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError) - if the fastai or fastcore libraries are not available or are of an invalid version. - - - """ - - if (get_fastcore_version() or get_fastai_version()) == "N/A": - raise ImportError( - f"fastai>={fastai_min_version} and fastcore>={fastcore_min_version} are" - f" required. Currently using fastai=={get_fastai_version()} and" - f" fastcore=={get_fastcore_version()}." - ) - - current_fastai_version = version.Version(get_fastai_version()) - current_fastcore_version = version.Version(get_fastcore_version()) - - if current_fastai_version < version.Version(fastai_min_version): - raise ImportError( - "`push_to_hub_fastai` and `from_pretrained_fastai` require a" - f" fastai>={fastai_min_version} version, but you are using fastai version" - f" {get_fastai_version()} which is incompatible. Upgrade with `pip install" - " fastai==2.5.6`." - ) - - if current_fastcore_version < version.Version(fastcore_min_version): - raise ImportError( - "`push_to_hub_fastai` and `from_pretrained_fastai` require a" - f" fastcore>={fastcore_min_version} version, but you are using fastcore" - f" version {get_fastcore_version()} which is incompatible. Upgrade with" - " `pip install fastcore==1.3.27`." - ) - - -def _check_fastai_fastcore_pyproject_versions( - storage_folder: str, - fastai_min_version: str = "2.4", - fastcore_min_version: str = "1.3.27", -): - """ - Checks that the `pyproject.toml` file in the directory `storage_folder` has fastai and fastcore versions - that are compatible with `from_pretrained_fastai` and `push_to_hub_fastai`. If `pyproject.toml` does not exist - or does not contain versions for fastai and fastcore, then it logs a warning. - - Args: - storage_folder (`str`): - Folder to look for the `pyproject.toml` file. - fastai_min_version (`str`, *optional*): - The minimum fastai version supported. - fastcore_min_version (`str`, *optional*): - The minimum fastcore version supported. - - - Raises the following errors: - - - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError) - if the `toml` module is not installed. - - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError) - if the `pyproject.toml` indicates a lower than minimum supported version of fastai or fastcore. - - - """ - - try: - import toml - except ModuleNotFoundError: - raise ImportError( - "`push_to_hub_fastai` and `from_pretrained_fastai` require the toml module." - " Install it with `pip install toml`." - ) - - # Checks that a `pyproject.toml`, with `build-system` and `requires` sections, exists in the repository. If so, get a list of required packages. - if not os.path.isfile(f"{storage_folder}/pyproject.toml"): - logger.warning( - "There is no `pyproject.toml` in the repository that contains the fastai" - " `Learner`. The `pyproject.toml` would allow us to verify that your fastai" - " and fastcore versions are compatible with those of the model you want to" - " load." - ) - return - pyproject_toml = toml.load(f"{storage_folder}/pyproject.toml") - - if "build-system" not in pyproject_toml.keys(): - logger.warning( - "There is no `build-system` section in the pyproject.toml of the repository" - " that contains the fastai `Learner`. The `build-system` would allow us to" - " verify that your fastai and fastcore versions are compatible with those" - " of the model you want to load." - ) - return - build_system_toml = pyproject_toml["build-system"] - - if "requires" not in build_system_toml.keys(): - logger.warning( - "There is no `requires` section in the pyproject.toml of the repository" - " that contains the fastai `Learner`. The `requires` would allow us to" - " verify that your fastai and fastcore versions are compatible with those" - " of the model you want to load." - ) - return - package_versions = build_system_toml["requires"] - - # Extracts contains fastai and fastcore versions from `pyproject.toml` if available. - # If the package is specified but not the version (e.g. "fastai" instead of "fastai=2.4"), the default versions are the highest. - fastai_packages = [pck for pck in package_versions if pck.startswith("fastai")] - if len(fastai_packages) == 0: - logger.warning("The repository does not have a fastai version specified in the `pyproject.toml`.") - # fastai_version is an empty string if not specified - else: - fastai_version = str(fastai_packages[0]).partition("=")[2] - if fastai_version != "" and version.Version(fastai_version) < version.Version(fastai_min_version): - raise ImportError( - "`from_pretrained_fastai` requires" - f" fastai>={fastai_min_version} version but the model to load uses" - f" {fastai_version} which is incompatible." - ) - - fastcore_packages = [pck for pck in package_versions if pck.startswith("fastcore")] - if len(fastcore_packages) == 0: - logger.warning("The repository does not have a fastcore version specified in the `pyproject.toml`.") - # fastcore_version is an empty string if not specified - else: - fastcore_version = str(fastcore_packages[0]).partition("=")[2] - if fastcore_version != "" and version.Version(fastcore_version) < version.Version(fastcore_min_version): - raise ImportError( - "`from_pretrained_fastai` requires" - f" fastcore>={fastcore_min_version} version, but you are using fastcore" - f" version {fastcore_version} which is incompatible." - ) - - -README_TEMPLATE = """--- -tags: -- fastai ---- - -# Amazing! - -🥳 Congratulations on hosting your fastai model on the Hugging Face Hub! - -# Some next steps -1. Fill out this model card with more information (see the template below and the [documentation here](https://huggingface.co/docs/hub/model-repos))! - -2. Create a demo in Gradio or Streamlit using 🤗 Spaces ([documentation here](https://huggingface.co/docs/hub/spaces)). - -3. Join the fastai community on the [Fastai Discord](https://discord.com/invite/YKrxeNn)! - -Greetings fellow fastlearner 🤝! Don't forget to delete this content from your model card. - - ---- - - -# Model card - -## Model description -More information needed - -## Intended uses & limitations -More information needed - -## Training and evaluation data -More information needed -""" - -PYPROJECT_TEMPLATE = f"""[build-system] -requires = ["setuptools>=40.8.0", "wheel", "python={get_python_version()}", "fastai={get_fastai_version()}", "fastcore={get_fastcore_version()}"] -build-backend = "setuptools.build_meta:__legacy__" -""" - - -def _create_model_card(repo_dir: Path): - """ - Creates a model card for the repository. - - Args: - repo_dir (`Path`): - Directory where model card is created. - """ - readme_path = repo_dir / "README.md" - - if not readme_path.exists(): - with readme_path.open("w", encoding="utf-8") as f: - f.write(README_TEMPLATE) - - -def _create_model_pyproject(repo_dir: Path): - """ - Creates a `pyproject.toml` for the repository. - - Args: - repo_dir (`Path`): - Directory where `pyproject.toml` is created. - """ - pyproject_path = repo_dir / "pyproject.toml" - - if not pyproject_path.exists(): - with pyproject_path.open("w", encoding="utf-8") as f: - f.write(PYPROJECT_TEMPLATE) - - -def _save_pretrained_fastai( - learner, - save_directory: Union[str, Path], - config: Optional[Dict[str, Any]] = None, -): - """ - Saves a fastai learner to `save_directory` in pickle format using the default pickle protocol for the version of python used. - - Args: - learner (`Learner`): - The `fastai.Learner` you'd like to save. - save_directory (`str` or `Path`): - Specific directory in which you want to save the fastai learner. - config (`dict`, *optional*): - Configuration object. Will be uploaded as a .json file. Example: 'https://huggingface.co/espejelomar/fastai-pet-breeds-classification/blob/main/config.json'. - - - - Raises the following error: - - - [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError) - if the config file provided is not a dictionary. - - - """ - _check_fastai_fastcore_versions() - - os.makedirs(save_directory, exist_ok=True) - - # if the user provides config then we update it with the fastai and fastcore versions in CONFIG_TEMPLATE. - if config is not None: - if not isinstance(config, dict): - raise RuntimeError(f"Provided config should be a dict. Got: '{type(config)}'") - path = os.path.join(save_directory, CONFIG_NAME) - with open(path, "w") as f: - json.dump(config, f) - - _create_model_card(Path(save_directory)) - _create_model_pyproject(Path(save_directory)) - - # learner.export saves the model in `self.path`. - learner.path = Path(save_directory) - os.makedirs(save_directory, exist_ok=True) - try: - learner.export( - fname="model.pkl", - pickle_protocol=DEFAULT_PROTOCOL, - ) - except PicklingError: - raise PicklingError( - "You are using a lambda function, i.e., an anonymous function. `pickle`" - " cannot pickle function objects and requires that all functions have" - " names. One possible solution is to name the function." - ) - - -@validate_hf_hub_args -def from_pretrained_fastai( - repo_id: str, - revision: Optional[str] = None, -): - """ - Load pretrained fastai model from the Hub or from a local directory. - - Args: - repo_id (`str`): - The location where the pickled fastai.Learner is. It can be either of the two: - - Hosted on the Hugging Face Hub. E.g.: 'espejelomar/fatai-pet-breeds-classification' or 'distilgpt2'. - You can add a `revision` by appending `@` at the end of `repo_id`. E.g.: `dbmdz/bert-base-german-cased@main`. - Revision is the specific model version to use. Since we use a git-based system for storing models and other - artifacts on the Hugging Face Hub, it can be a branch name, a tag name, or a commit id. - - Hosted locally. `repo_id` would be a directory containing the pickle and a pyproject.toml - indicating the fastai and fastcore versions used to build the `fastai.Learner`. E.g.: `./my_model_directory/`. - revision (`str`, *optional*): - Revision at which the repo's files are downloaded. See documentation of `snapshot_download`. - - Returns: - The `fastai.Learner` model in the `repo_id` repo. - """ - _check_fastai_fastcore_versions() - - # Load the `repo_id` repo. - # `snapshot_download` returns the folder where the model was stored. - # `cache_dir` will be the default '/root/.cache/huggingface/hub' - if not os.path.isdir(repo_id): - storage_folder = snapshot_download( - repo_id=repo_id, - revision=revision, - library_name="fastai", - library_version=get_fastai_version(), - ) - else: - storage_folder = repo_id - - _check_fastai_fastcore_pyproject_versions(storage_folder) - - from fastai.learner import load_learner # type: ignore - - return load_learner(os.path.join(storage_folder, "model.pkl")) - - -@validate_hf_hub_args -def push_to_hub_fastai( - learner, - *, - repo_id: str, - commit_message: str = "Push FastAI model using huggingface_hub.", - private: bool = False, - token: Optional[str] = None, - config: Optional[dict] = None, - branch: Optional[str] = None, - create_pr: Optional[bool] = None, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - delete_patterns: Optional[Union[List[str], str]] = None, - api_endpoint: Optional[str] = None, -): - """ - Upload learner checkpoint files to the Hub. - - Use `allow_patterns` and `ignore_patterns` to precisely filter which files should be pushed to the hub. Use - `delete_patterns` to delete existing remote files in the same commit. See [`upload_folder`] reference for more - details. - - Args: - learner (`Learner`): - The `fastai.Learner' you'd like to push to the Hub. - repo_id (`str`): - The repository id for your model in Hub in the format of "namespace/repo_name". The namespace can be your individual account or an organization to which you have write access (for example, 'stanfordnlp/stanza-de'). - commit_message (`str`, *optional*): - Message to commit while pushing. Will default to :obj:`"add model"`. - private (`bool`, *optional*, defaults to `False`): - Whether or not the repository created should be private. - token (`str`, *optional*): - The Hugging Face account token to use as HTTP bearer authorization for remote files. If :obj:`None`, the token will be asked by a prompt. - config (`dict`, *optional*): - Configuration object to be saved alongside the model weights. - branch (`str`, *optional*): - The git branch on which to push the model. This defaults to - the default branch as specified in your repository, which - defaults to `"main"`. - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request from `branch` with that commit. - Defaults to `False`. - api_endpoint (`str`, *optional*): - The API endpoint to use when pushing the model to the hub. - allow_patterns (`List[str]` or `str`, *optional*): - If provided, only files matching at least one pattern are pushed. - ignore_patterns (`List[str]` or `str`, *optional*): - If provided, files matching any of the patterns are not pushed. - delete_patterns (`List[str]` or `str`, *optional*): - If provided, remote files matching any of the patterns will be deleted from the repo. - - Returns: - The url of the commit of your model in the given repository. - - - - Raises the following error: - - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if the user is not log on to the Hugging Face Hub. - - - """ - _check_fastai_fastcore_versions() - api = HfApi(endpoint=api_endpoint) - repo_id = api.create_repo(repo_id=repo_id, token=token, private=private, exist_ok=True).repo_id - - # Push the files to the repo in a single commit - with SoftTemporaryDirectory() as tmp: - saved_path = Path(tmp) / repo_id - _save_pretrained_fastai(learner, saved_path, config=config) - return api.upload_folder( - repo_id=repo_id, - token=token, - folder_path=saved_path, - commit_message=commit_message, - revision=branch, - create_pr=create_pr, - allow_patterns=allow_patterns, - ignore_patterns=ignore_patterns, - delete_patterns=delete_patterns, - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/file_download.py b/venv/lib/python3.8/site-packages/huggingface_hub/file_download.py deleted file mode 100644 index ca2e8ebf190213b601ed2dc817e8d0b4f10157ff..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/file_download.py +++ /dev/null @@ -1,1712 +0,0 @@ -import copy -import fnmatch -import io -import json -import os -import re -import shutil -import stat -import tempfile -import uuid -import warnings -from contextlib import contextmanager -from dataclasses import dataclass -from functools import partial -from hashlib import sha256 -from pathlib import Path -from typing import Any, BinaryIO, Dict, Generator, Literal, Optional, Tuple, Union -from urllib.parse import quote, urlparse - -import requests -from filelock import FileLock -from requests.exceptions import ProxyError, Timeout - -from huggingface_hub import constants - -from . import __version__ # noqa: F401 # for backward compatibility -from .constants import ( - DEFAULT_REVISION, - ENDPOINT, - HF_HUB_DISABLE_SYMLINKS_WARNING, - HF_HUB_ENABLE_HF_TRANSFER, - HUGGINGFACE_CO_URL_TEMPLATE, - HUGGINGFACE_HEADER_X_LINKED_ETAG, - HUGGINGFACE_HEADER_X_LINKED_SIZE, - HUGGINGFACE_HEADER_X_REPO_COMMIT, - HUGGINGFACE_HUB_CACHE, - REPO_ID_SEPARATOR, - REPO_TYPES, - REPO_TYPES_URL_PREFIXES, -) -from .utils import ( - EntryNotFoundError, - FileMetadataError, - GatedRepoError, - LocalEntryNotFoundError, - RepositoryNotFoundError, - RevisionNotFoundError, - SoftTemporaryDirectory, - build_hf_headers, - get_fastai_version, # noqa: F401 # for backward compatibility - get_fastcore_version, # noqa: F401 # for backward compatibility - get_graphviz_version, # noqa: F401 # for backward compatibility - get_jinja_version, # noqa: F401 # for backward compatibility - get_pydot_version, # noqa: F401 # for backward compatibility - get_tf_version, # noqa: F401 # for backward compatibility - get_torch_version, # noqa: F401 # for backward compatibility - hf_raise_for_status, - http_backoff, - is_fastai_available, # noqa: F401 # for backward compatibility - is_fastcore_available, # noqa: F401 # for backward compatibility - is_graphviz_available, # noqa: F401 # for backward compatibility - is_jinja_available, # noqa: F401 # for backward compatibility - is_pydot_available, # noqa: F401 # for backward compatibility - is_tf_available, # noqa: F401 # for backward compatibility - is_torch_available, # noqa: F401 # for backward compatibility - logging, - tqdm, - validate_hf_hub_args, -) -from .utils._headers import _http_user_agent -from .utils._runtime import _PY_VERSION # noqa: F401 # for backward compatibility -from .utils._typing import HTTP_METHOD_T - - -logger = logging.get_logger(__name__) - -# Regex to get filename from a "Content-Disposition" header for CDN-served files -HEADER_FILENAME_PATTERN = re.compile(r'filename="(?P.*?)";') - - -_are_symlinks_supported_in_dir: Dict[str, bool] = {} - - -def are_symlinks_supported(cache_dir: Union[str, Path, None] = None) -> bool: - """Return whether the symlinks are supported on the machine. - - Since symlinks support can change depending on the mounted disk, we need to check - on the precise cache folder. By default, the default HF cache directory is checked. - - Args: - cache_dir (`str`, `Path`, *optional*): - Path to the folder where cached files are stored. - - Returns: [bool] Whether symlinks are supported in the directory. - """ - # Defaults to HF cache - if cache_dir is None: - cache_dir = HUGGINGFACE_HUB_CACHE - cache_dir = str(Path(cache_dir).expanduser().resolve()) # make it unique - - # Check symlink compatibility only once (per cache directory) at first time use - if cache_dir not in _are_symlinks_supported_in_dir: - _are_symlinks_supported_in_dir[cache_dir] = True - - os.makedirs(cache_dir, exist_ok=True) - with SoftTemporaryDirectory(dir=cache_dir) as tmpdir: - src_path = Path(tmpdir) / "dummy_file_src" - src_path.touch() - dst_path = Path(tmpdir) / "dummy_file_dst" - - # Relative source path as in `_create_symlink`` - relative_src = os.path.relpath(src_path, start=os.path.dirname(dst_path)) - try: - os.symlink(relative_src, dst_path) - except OSError: - # Likely running on Windows - _are_symlinks_supported_in_dir[cache_dir] = False - - if not HF_HUB_DISABLE_SYMLINKS_WARNING: - message = ( - "`huggingface_hub` cache-system uses symlinks by default to" - " efficiently store duplicated files but your machine does not" - f" support them in {cache_dir}. Caching files will still work" - " but in a degraded version that might require more space on" - " your disk. This warning can be disabled by setting the" - " `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For" - " more details, see" - " https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations." - ) - if os.name == "nt": - message += ( - "\nTo support symlinks on Windows, you either need to" - " activate Developer Mode or to run Python as an" - " administrator. In order to see activate developer mode," - " see this article:" - " https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development" - ) - warnings.warn(message) - - return _are_symlinks_supported_in_dir[cache_dir] - - -# Return value when trying to load a file from cache but the file does not exist in the distant repo. -_CACHED_NO_EXIST = object() -_CACHED_NO_EXIST_T = Any -REGEX_COMMIT_HASH = re.compile(r"^[0-9a-f]{40}$") - - -@dataclass(frozen=True) -class HfFileMetadata: - """Data structure containing information about a file versioned on the Hub. - - Returned by [`get_hf_file_metadata`] based on a URL. - - Args: - commit_hash (`str`, *optional*): - The commit_hash related to the file. - etag (`str`, *optional*): - Etag of the file on the server. - location (`str`): - Location where to download the file. Can be a Hub url or not (CDN). - size (`size`): - Size of the file. In case of an LFS file, contains the size of the actual - LFS file, not the pointer. - """ - - commit_hash: Optional[str] - etag: Optional[str] - location: str - size: Optional[int] - - -@validate_hf_hub_args -def hf_hub_url( - repo_id: str, - filename: str, - *, - subfolder: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - endpoint: Optional[str] = None, -) -> str: - """Construct the URL of a file from the given information. - - The resolved address can either be a huggingface.co-hosted url, or a link to - Cloudfront (a Content Delivery Network, or CDN) for large files which are - more than a few MBs. - - Args: - repo_id (`str`): - A namespace (user or an organization) name and a repo name separated - by a `/`. - filename (`str`): - The name of the file in the repo. - subfolder (`str`, *optional*): - An optional value corresponding to a folder inside the repo. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if downloading from a dataset or space, - `None` or `"model"` if downloading from a model. Default is `None`. - revision (`str`, *optional*): - An optional Git revision id which can be a branch name, a tag, or a - commit hash. - endpoint (`str`, *optional*): - Hugging Face Hub base url. Will default to https://huggingface.co/. Otherwise, one can set the `HF_ENDPOINT` - environment variable. - - Example: - - ```python - >>> from huggingface_hub import hf_hub_url - - >>> hf_hub_url( - ... repo_id="julien-c/EsperBERTo-small", filename="pytorch_model.bin" - ... ) - 'https://huggingface.co/julien-c/EsperBERTo-small/resolve/main/pytorch_model.bin' - ``` - - - - Notes: - - Cloudfront is replicated over the globe so downloads are way faster for - the end user (and it also lowers our bandwidth costs). - - Cloudfront aggressively caches files by default (default TTL is 24 - hours), however this is not an issue here because we implement a - git-based versioning system on huggingface.co, which means that we store - the files on S3/Cloudfront in a content-addressable way (i.e., the file - name is its hash). Using content-addressable filenames means cache can't - ever be stale. - - In terms of client-side caching from this library, we base our caching - on the objects' entity tag (`ETag`), which is an identifier of a - specific version of a resource [1]_. An object's ETag is: its git-sha1 - if stored in git, or its sha256 if stored in git-lfs. - - - - References: - - - [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag - """ - if subfolder == "": - subfolder = None - if subfolder is not None: - filename = f"{subfolder}/{filename}" - - if repo_type not in REPO_TYPES: - raise ValueError("Invalid repo type") - - if repo_type in REPO_TYPES_URL_PREFIXES: - repo_id = REPO_TYPES_URL_PREFIXES[repo_type] + repo_id - - if revision is None: - revision = DEFAULT_REVISION - url = HUGGINGFACE_CO_URL_TEMPLATE.format( - repo_id=repo_id, revision=quote(revision, safe=""), filename=quote(filename) - ) - # Update endpoint if provided - if endpoint is not None and url.startswith(ENDPOINT): - url = endpoint + url[len(ENDPOINT) :] - return url - - -def url_to_filename(url: str, etag: Optional[str] = None) -> str: - """Generate a local filename from a url. - - Convert `url` into a hashed filename in a reproducible way. If `etag` is - specified, append its hash to the url's, delimited by a period. If the url - ends with .h5 (Keras HDF5 weights) adds '.h5' to the name so that TF 2.0 can - identify it as a HDF5 file (see - https://github.com/tensorflow/tensorflow/blob/00fad90125b18b80fe054de1055770cfb8fe4ba3/tensorflow/python/keras/engine/network.py#L1380) - - Args: - url (`str`): - The address to the file. - etag (`str`, *optional*): - The ETag of the file. - - Returns: - The generated filename. - """ - url_bytes = url.encode("utf-8") - filename = sha256(url_bytes).hexdigest() - - if etag: - etag_bytes = etag.encode("utf-8") - filename += "." + sha256(etag_bytes).hexdigest() - - if url.endswith(".h5"): - filename += ".h5" - - return filename - - -def filename_to_url( - filename, - cache_dir: Optional[str] = None, - legacy_cache_layout: bool = False, -) -> Tuple[str, str]: - """ - Return the url and etag (which may be `None`) stored for `filename`. Raise - `EnvironmentError` if `filename` or its stored metadata do not exist. - - Args: - filename (`str`): - The name of the file - cache_dir (`str`, *optional*): - The cache directory to use instead of the default one. - legacy_cache_layout (`bool`, *optional*, defaults to `False`): - If `True`, uses the legacy file cache layout i.e. just call `hf_hub_url` - then `cached_download`. This is deprecated as the new cache layout is - more powerful. - """ - if not legacy_cache_layout: - warnings.warn( - "`filename_to_url` uses the legacy way cache file layout", - FutureWarning, - ) - - if cache_dir is None: - cache_dir = HUGGINGFACE_HUB_CACHE - if isinstance(cache_dir, Path): - cache_dir = str(cache_dir) - - cache_path = os.path.join(cache_dir, filename) - if not os.path.exists(cache_path): - raise EnvironmentError(f"file {cache_path} not found") - - meta_path = cache_path + ".json" - if not os.path.exists(meta_path): - raise EnvironmentError(f"file {meta_path} not found") - - with open(meta_path, encoding="utf-8") as meta_file: - metadata = json.load(meta_file) - url = metadata["url"] - etag = metadata["etag"] - - return url, etag - - -def http_user_agent( - *, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - user_agent: Union[Dict, str, None] = None, -) -> str: - """Deprecated in favor of [`build_hf_headers`].""" - return _http_user_agent( - library_name=library_name, - library_version=library_version, - user_agent=user_agent, - ) - - -class OfflineModeIsEnabled(ConnectionError): - pass - - -def _raise_if_offline_mode_is_enabled(msg: Optional[str] = None): - """Raise a OfflineModeIsEnabled error (subclass of ConnectionError) if - HF_HUB_OFFLINE is True.""" - if constants.HF_HUB_OFFLINE: - raise OfflineModeIsEnabled( - "Offline mode is enabled." if msg is None else "Offline mode is enabled. " + str(msg) - ) - - -def _request_wrapper( - method: HTTP_METHOD_T, - url: str, - *, - max_retries: int = 0, - base_wait_time: float = 0.5, - max_wait_time: float = 2, - timeout: Optional[float] = 10.0, - follow_relative_redirects: bool = False, - **params, -) -> requests.Response: - """Wrapper around requests methods to add several features. - - What it does: - 1. Ensure offline mode is disabled (env variable `HF_HUB_OFFLINE` not set to 1). - If enabled, a `OfflineModeIsEnabled` exception is raised. - 2. Follow relative redirections if `follow_relative_redirects=True` even when - `allow_redirection` kwarg is set to False. - 3. Retry in case request fails with a `Timeout` or `ProxyError`, with exponential backoff. - - Args: - method (`str`): - HTTP method, such as 'GET' or 'HEAD'. - url (`str`): - The URL of the resource to fetch. - max_retries (`int`, *optional*, defaults to `0`): - Maximum number of retries, defaults to 0 (no retries). - base_wait_time (`float`, *optional*, defaults to `0.5`): - Duration (in seconds) to wait before retrying the first time. - Wait time between retries then grows exponentially, capped by - `max_wait_time`. - max_wait_time (`float`, *optional*, defaults to `2`): - Maximum amount of time between two retries, in seconds. - timeout (`float`, *optional*, defaults to `10`): - How many seconds to wait for the server to send data before - giving up which is passed to `requests.request`. - follow_relative_redirects (`bool`, *optional*, defaults to `False`) - If True, relative redirection (redirection to the same site) will be - resolved even when `allow_redirection` kwarg is set to False. Useful when we - want to follow a redirection to a renamed repository without following - redirection to a CDN. - **params (`dict`, *optional*): - Params to pass to `requests.request`. - """ - # 1. Check online mode - _raise_if_offline_mode_is_enabled(f"Tried to reach {url}") - - # 2. Force relative redirection - if follow_relative_redirects: - response = _request_wrapper( - method=method, - url=url, - max_retries=max_retries, - base_wait_time=base_wait_time, - max_wait_time=max_wait_time, - timeout=timeout, - follow_relative_redirects=False, - **params, - ) - - # If redirection, we redirect only relative paths. - # This is useful in case of a renamed repository. - if 300 <= response.status_code <= 399: - parsed_target = urlparse(response.headers["Location"]) - if parsed_target.netloc == "": - # This means it is a relative 'location' headers, as allowed by RFC 7231. - # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') - # We want to follow this relative redirect ! - # - # Highly inspired by `resolve_redirects` from requests library. - # See https://github.com/psf/requests/blob/main/requests/sessions.py#L159 - return _request_wrapper( - method=method, - url=urlparse(url)._replace(path=parsed_target.path).geturl(), - max_retries=max_retries, - base_wait_time=base_wait_time, - max_wait_time=max_wait_time, - timeout=timeout, - follow_relative_redirects=True, # resolve recursively - **params, - ) - return response - - # 3. Exponential backoff - return http_backoff( - method=method, - url=url, - max_retries=max_retries, - base_wait_time=base_wait_time, - max_wait_time=max_wait_time, - retry_on_exceptions=(Timeout, ProxyError), - retry_on_status_codes=(), - timeout=timeout, - **params, - ) - - -def _request_with_retry(*args, **kwargs) -> requests.Response: - """Deprecated method. Please use `_request_wrapper` instead. - - Alias to keep backward compatibility (used in Transformers). - """ - return _request_wrapper(*args, **kwargs) - - -def http_get( - url: str, - temp_file: BinaryIO, - *, - proxies=None, - resume_size: float = 0, - headers: Optional[Dict[str, str]] = None, - timeout: Optional[float] = 10.0, - max_retries: int = 0, - expected_size: Optional[int] = None, -): - """ - Download a remote file. Do not gobble up errors, and will return errors tailored to the Hugging Face Hub. - """ - if not resume_size: - if HF_HUB_ENABLE_HF_TRANSFER: - try: - # Download file using an external Rust-based package. Download is faster - # (~2x speed-up) but support less features (no progress bars). - from hf_transfer import download - - logger.debug(f"Download {url} using HF_TRANSFER.") - max_files = 100 - chunk_size = 10 * 1024 * 1024 # 10 MB - download(url, temp_file.name, max_files, chunk_size, headers=headers) - return - except ImportError: - raise ValueError( - "Fast download using 'hf_transfer' is enabled" - " (HF_HUB_ENABLE_HF_TRANSFER=1) but 'hf_transfer' package is not" - " available in your environment. Try `pip install hf_transfer`." - ) - except Exception as e: - raise RuntimeError( - "An error occurred while downloading using `hf_transfer`. Consider" - " disabling HF_HUB_ENABLE_HF_TRANSFER for better error handling." - ) from e - - headers = copy.deepcopy(headers) or {} - if resume_size > 0: - headers["Range"] = "bytes=%d-" % (resume_size,) - - r = _request_wrapper( - method="GET", - url=url, - stream=True, - proxies=proxies, - headers=headers, - timeout=timeout, - max_retries=max_retries, - ) - hf_raise_for_status(r) - content_length = r.headers.get("Content-Length") - - # NOTE: 'total' is the total number of bytes to download, not the number of bytes in the file. - # If the file is compressed, the number of bytes in the saved file will be higher than 'total'. - total = resume_size + int(content_length) if content_length is not None else None - - displayed_name = url - content_disposition = r.headers.get("Content-Disposition") - if content_disposition is not None: - match = HEADER_FILENAME_PATTERN.search(content_disposition) - if match is not None: - # Means file is on CDN - displayed_name = match.groupdict()["filename"] - - # Truncate filename if too long to display - if len(displayed_name) > 40: - displayed_name = f"(…){displayed_name[-40:]}" - - progress = tqdm( - unit="B", - unit_scale=True, - total=total, - initial=resume_size, - desc=displayed_name, - disable=bool(logger.getEffectiveLevel() == logging.NOTSET), - ) - for chunk in r.iter_content(chunk_size=10 * 1024 * 1024): - if chunk: # filter out keep-alive new chunks - progress.update(len(chunk)) - temp_file.write(chunk) - - if expected_size is not None and expected_size != temp_file.tell(): - raise EnvironmentError( - f"Consistency check failed: file should be of size {expected_size} but has size" - f" {temp_file.tell()} ({displayed_name}).\nWe are sorry for the inconvenience. Please retry download and" - " pass `force_download=True, resume_download=False` as argument.\nIf the issue persists, please let us" - " know by opening an issue on https://github.com/huggingface/huggingface_hub." - ) - - progress.close() - - -@validate_hf_hub_args -def cached_download( - url: str, - *, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - cache_dir: Union[str, Path, None] = None, - user_agent: Union[Dict, str, None] = None, - force_download: bool = False, - force_filename: Optional[str] = None, - proxies: Optional[Dict] = None, - etag_timeout: float = 10, - resume_download: bool = False, - token: Union[bool, str, None] = None, - local_files_only: bool = False, - legacy_cache_layout: bool = False, -) -> str: - """ - Download from a given URL and cache it if it's not already present in the - local cache. - - Given a URL, this function looks for the corresponding file in the local - cache. If it's not there, download it. Then return the path to the cached - file. - - Will raise errors tailored to the Hugging Face Hub. - - Args: - url (`str`): - The path to the file to be downloaded. - library_name (`str`, *optional*): - The name of the library to which the object corresponds. - library_version (`str`, *optional*): - The version of the library. - cache_dir (`str`, `Path`, *optional*): - Path to the folder where cached files are stored. - user_agent (`dict`, `str`, *optional*): - The user-agent info in the form of a dictionary or a string. - force_download (`bool`, *optional*, defaults to `False`): - Whether the file should be downloaded even if it already exists in - the local cache. - force_filename (`str`, *optional*): - Use this name instead of a generated file name. - proxies (`dict`, *optional*): - Dictionary mapping protocol to the URL of the proxy passed to - `requests.request`. - etag_timeout (`float`, *optional* defaults to `10`): - When fetching ETag, how many seconds to wait for the server to send - data before giving up which is passed to `requests.request`. - resume_download (`bool`, *optional*, defaults to `False`): - If `True`, resume a previously interrupted download. - token (`bool`, `str`, *optional*): - A token to be used for the download. - - If `True`, the token is read from the HuggingFace config - folder. - - If a string, it's used as the authentication token. - local_files_only (`bool`, *optional*, defaults to `False`): - If `True`, avoid downloading the file and return the path to the - local cached file if it exists. - legacy_cache_layout (`bool`, *optional*, defaults to `False`): - Set this parameter to `True` to mention that you'd like to continue - the old cache layout. Putting this to `True` manually will not raise - any warning when using `cached_download`. We recommend using - `hf_hub_download` to take advantage of the new cache. - - Returns: - Local path (string) of file or if networking is off, last version of - file cached on disk. - - - - Raises the following errors: - - - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - if `token=True` and the token cannot be found. - - [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) - if ETag cannot be determined. - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - [`~utils.EntryNotFoundError`] - If the file to download cannot be found. - - [`~utils.LocalEntryNotFoundError`] - If network is disabled or unavailable and file is not found in cache. - - - """ - if not legacy_cache_layout: - warnings.warn( - "'cached_download' is the legacy way to download files from the HF hub, please consider upgrading to" - " 'hf_hub_download'", - FutureWarning, - ) - - if cache_dir is None: - cache_dir = HUGGINGFACE_HUB_CACHE - if isinstance(cache_dir, Path): - cache_dir = str(cache_dir) - - os.makedirs(cache_dir, exist_ok=True) - - headers = build_hf_headers( - token=token, - library_name=library_name, - library_version=library_version, - user_agent=user_agent, - ) - - url_to_download = url - etag = None - expected_size = None - if not local_files_only: - try: - # Temporary header: we want the full (decompressed) content size returned to be able to check the - # downloaded file size - headers["Accept-Encoding"] = "identity" - r = _request_wrapper( - method="HEAD", - url=url, - headers=headers, - allow_redirects=False, - follow_relative_redirects=True, - proxies=proxies, - timeout=etag_timeout, - ) - headers.pop("Accept-Encoding", None) - hf_raise_for_status(r) - etag = r.headers.get(HUGGINGFACE_HEADER_X_LINKED_ETAG) or r.headers.get("ETag") - # We favor a custom header indicating the etag of the linked resource, and - # we fallback to the regular etag header. - # If we don't have any of those, raise an error. - if etag is None: - raise FileMetadataError( - "Distant resource does not have an ETag, we won't be able to reliably ensure reproducibility." - ) - # We get the expected size of the file, to check the download went well. - expected_size = _int_or_none(r.headers.get("Content-Length")) - # In case of a redirect, save an extra redirect on the request.get call, - # and ensure we download the exact atomic version even if it changed - # between the HEAD and the GET (unlikely, but hey). - # Useful for lfs blobs that are stored on a CDN. - if 300 <= r.status_code <= 399: - url_to_download = r.headers["Location"] - headers.pop("authorization", None) - expected_size = None # redirected -> can't know the expected size - except (requests.exceptions.SSLError, requests.exceptions.ProxyError): - # Actually raise for those subclasses of ConnectionError - raise - except ( - requests.exceptions.ConnectionError, - requests.exceptions.Timeout, - OfflineModeIsEnabled, - ): - # Otherwise, our Internet connection is down. - # etag is None - pass - - filename = force_filename if force_filename is not None else url_to_filename(url, etag) - - # get cache path to put the file - cache_path = os.path.join(cache_dir, filename) - - # etag is None == we don't have a connection or we passed local_files_only. - # try to get the last downloaded one - if etag is None: - if os.path.exists(cache_path) and not force_download: - return cache_path - else: - matching_files = [ - file - for file in fnmatch.filter(os.listdir(cache_dir), filename.split(".")[0] + ".*") - if not file.endswith(".json") and not file.endswith(".lock") - ] - if len(matching_files) > 0 and not force_download and force_filename is None: - return os.path.join(cache_dir, matching_files[-1]) - else: - # If files cannot be found and local_files_only=True, - # the models might've been found if local_files_only=False - # Notify the user about that - if local_files_only: - raise LocalEntryNotFoundError( - "Cannot find the requested files in the cached path and" - " outgoing traffic has been disabled. To enable model look-ups" - " and downloads online, set 'local_files_only' to False." - ) - else: - raise LocalEntryNotFoundError( - "Connection error, and we cannot find the requested files in" - " the cached path. Please try again or make sure your Internet" - " connection is on." - ) - - # From now on, etag is not None. - if os.path.exists(cache_path) and not force_download: - return cache_path - - # Prevent parallel downloads of the same file with a lock. - lock_path = cache_path + ".lock" - - # Some Windows versions do not allow for paths longer than 255 characters. - # In this case, we must specify it is an extended path by using the "\\?\" prefix. - if os.name == "nt" and len(os.path.abspath(lock_path)) > 255: - lock_path = "\\\\?\\" + os.path.abspath(lock_path) - - if os.name == "nt" and len(os.path.abspath(cache_path)) > 255: - cache_path = "\\\\?\\" + os.path.abspath(cache_path) - - with FileLock(lock_path): - # If the download just completed while the lock was activated. - if os.path.exists(cache_path) and not force_download: - # Even if returning early like here, the lock will be released. - return cache_path - - if resume_download: - incomplete_path = cache_path + ".incomplete" - - @contextmanager - def _resumable_file_manager() -> Generator[io.BufferedWriter, None, None]: - with open(incomplete_path, "ab") as f: - yield f - - temp_file_manager = _resumable_file_manager - if os.path.exists(incomplete_path): - resume_size = os.stat(incomplete_path).st_size - else: - resume_size = 0 - else: - temp_file_manager = partial( # type: ignore - tempfile.NamedTemporaryFile, mode="wb", dir=cache_dir, delete=False - ) - resume_size = 0 - - # Download to temporary file, then copy to cache dir once finished. - # Otherwise you get corrupt cache entries if the download gets interrupted. - with temp_file_manager() as temp_file: - logger.info("downloading %s to %s", url, temp_file.name) - - http_get( - url_to_download, - temp_file, - proxies=proxies, - resume_size=resume_size, - headers=headers, - expected_size=expected_size, - ) - - logger.info("storing %s in cache at %s", url, cache_path) - _chmod_and_replace(temp_file.name, cache_path) - - if force_filename is None: - logger.info("creating metadata file for %s", cache_path) - meta = {"url": url, "etag": etag} - meta_path = cache_path + ".json" - with open(meta_path, "w") as meta_file: - json.dump(meta, meta_file) - - return cache_path - - -def _normalize_etag(etag: Optional[str]) -> Optional[str]: - """Normalize ETag HTTP header, so it can be used to create nice filepaths. - - The HTTP spec allows two forms of ETag: - ETag: W/"" - ETag: "" - - For now, we only expect the second form from the server, but we want to be future-proof so we support both. For - more context, see `TestNormalizeEtag` tests and https://github.com/huggingface/huggingface_hub/pull/1428. - - Args: - etag (`str`, *optional*): HTTP header - - Returns: - `str` or `None`: string that can be used as a nice directory name. - Returns `None` if input is None. - """ - if etag is None: - return None - return etag.lstrip("W/").strip('"') - - -def _create_relative_symlink(src: str, dst: str, new_blob: bool = False) -> None: - """Alias method used in `transformers` conversion script.""" - return _create_symlink(src=src, dst=dst, new_blob=new_blob) - - -def _create_symlink(src: str, dst: str, new_blob: bool = False) -> None: - """Create a symbolic link named dst pointing to src. - - By default, it will try to create a symlink using a relative path. Relative paths have 2 advantages: - - If the cache_folder is moved (example: back-up on a shared drive), relative paths within the cache folder will - not brake. - - Relative paths seems to be better handled on Windows. Issue was reported 3 times in less than a week when - changing from relative to absolute paths. See https://github.com/huggingface/huggingface_hub/issues/1398, - https://github.com/huggingface/diffusers/issues/2729 and https://github.com/huggingface/transformers/pull/22228. - NOTE: The issue with absolute paths doesn't happen on admin mode. - When creating a symlink from the cache to a local folder, it is possible that a relative path cannot be created. - This happens when paths are not on the same volume. In that case, we use absolute paths. - - - The result layout looks something like - └── [ 128] snapshots - ├── [ 128] 2439f60ef33a0d46d85da5001d52aeda5b00ce9f - │ ├── [ 52] README.md -> ../../../blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812 - │ └── [ 76] pytorch_model.bin -> ../../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd - - If symlinks cannot be created on this platform (most likely to be Windows), the workaround is to avoid symlinks by - having the actual file in `dst`. If it is a new file (`new_blob=True`), we move it to `dst`. If it is not a new file - (`new_blob=False`), we don't know if the blob file is already referenced elsewhere. To avoid breaking existing - cache, the file is duplicated on the disk. - - In case symlinks are not supported, a warning message is displayed to the user once when loading `huggingface_hub`. - The warning message can be disable with the `DISABLE_SYMLINKS_WARNING` environment variable. - """ - try: - os.remove(dst) - except OSError: - pass - - abs_src = os.path.abspath(os.path.expanduser(src)) - abs_dst = os.path.abspath(os.path.expanduser(dst)) - - # Use relative_dst in priority - try: - relative_src = os.path.relpath(abs_src, os.path.dirname(abs_dst)) - except ValueError: - # Raised on Windows if src and dst are not on the same volume. This is the case when creating a symlink to a - # local_dir instead of within the cache directory. - # See https://docs.python.org/3/library/os.path.html#os.path.relpath - relative_src = None - - try: - try: - commonpath = os.path.commonpath([abs_src, abs_dst]) - _support_symlinks = are_symlinks_supported(os.path.dirname(commonpath)) - except ValueError: - # Raised if src and dst are not on the same volume. Symlinks will still work on Linux/Macos. - # See https://docs.python.org/3/library/os.path.html#os.path.commonpath - _support_symlinks = os.name != "nt" - except PermissionError: - # Permission error means src and dst are not in the same volume (e.g. destination path has been provided - # by the user via `local_dir`. Let's test symlink support there) - _support_symlinks = are_symlinks_supported(os.path.dirname(abs_dst)) - - if _support_symlinks: - src_rel_or_abs = relative_src or abs_src - logger.debug(f"Creating pointer from {src_rel_or_abs} to {abs_dst}") - try: - os.symlink(src_rel_or_abs, abs_dst) - except FileExistsError: - if os.path.islink(abs_dst) and os.path.realpath(abs_dst) == os.path.realpath(abs_src): - # `abs_dst` already exists and is a symlink to the `abs_src` blob. It is most likely that the file has - # been cached twice concurrently (exactly between `os.remove` and `os.symlink`). Do nothing. - pass - else: - # Very unlikely to happen. Means a file `dst` has been created exactly between `os.remove` and - # `os.symlink` and is not a symlink to the `abs_src` blob file. Raise exception. - raise - elif new_blob: - logger.info(f"Symlink not supported. Moving file from {abs_src} to {abs_dst}") - shutil.move(src, dst) - else: - logger.info(f"Symlink not supported. Copying file from {abs_src} to {abs_dst}") - shutil.copyfile(src, dst) - - -def _cache_commit_hash_for_specific_revision(storage_folder: str, revision: str, commit_hash: str) -> None: - """Cache reference between a revision (tag, branch or truncated commit hash) and the corresponding commit hash. - - Does nothing if `revision` is already a proper `commit_hash` or reference is already cached. - """ - if revision != commit_hash: - ref_path = Path(storage_folder) / "refs" / revision - ref_path.parent.mkdir(parents=True, exist_ok=True) - if not ref_path.exists() or commit_hash != ref_path.read_text(): - # Update ref only if has been updated. Could cause useless error in case - # repo is already cached and user doesn't have write access to cache folder. - # See https://github.com/huggingface/huggingface_hub/issues/1216. - ref_path.write_text(commit_hash) - - -@validate_hf_hub_args -def repo_folder_name(*, repo_id: str, repo_type: str) -> str: - """Return a serialized version of a hf.co repo name and type, safe for disk storage - as a single non-nested folder. - - Example: models--julien-c--EsperBERTo-small - """ - # remove all `/` occurrences to correctly convert repo to directory name - parts = [f"{repo_type}s", *repo_id.split("/")] - return REPO_ID_SEPARATOR.join(parts) - - -def _check_disk_space(expected_size: int, target_dir: Union[str, Path]) -> None: - """Check disk usage and log a warning if there is not enough disk space to download the file. - - Args: - expected_size (`int`): - The expected size of the file in bytes. - target_dir (`str`): - The directory where the file will be stored after downloading. - """ - - target_dir = Path(target_dir) # format as `Path` - for path in [target_dir] + list(target_dir.parents): # first check target_dir, then each parents one by one - try: - target_dir_free = shutil.disk_usage(path).free - if target_dir_free < expected_size: - warnings.warn( - "Not enough free disk space to download the file. " - f"The expected file size is: {expected_size / 1e6:.2f} MB. " - f"The target location {target_dir} only has {target_dir_free / 1e6:.2f} MB free disk space." - ) - return - except OSError: # raise on anything: file does not exist or space disk cannot be checked - pass - - -@validate_hf_hub_args -def hf_hub_download( - repo_id: str, - filename: str, - *, - subfolder: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - endpoint: Optional[str] = None, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - cache_dir: Union[str, Path, None] = None, - local_dir: Union[str, Path, None] = None, - local_dir_use_symlinks: Union[bool, Literal["auto"]] = "auto", - user_agent: Union[Dict, str, None] = None, - force_download: bool = False, - force_filename: Optional[str] = None, - proxies: Optional[Dict] = None, - etag_timeout: float = 10, - resume_download: bool = False, - token: Union[bool, str, None] = None, - local_files_only: bool = False, - legacy_cache_layout: bool = False, -) -> str: - """Download a given file if it's not already present in the local cache. - - The new cache file layout looks like this: - - The cache directory contains one subfolder per repo_id (namespaced by repo type) - - inside each repo folder: - - refs is a list of the latest known revision => commit_hash pairs - - blobs contains the actual file blobs (identified by their git-sha or sha256, depending on - whether they're LFS files or not) - - snapshots contains one subfolder per commit, each "commit" contains the subset of the files - that have been resolved at that particular commit. Each filename is a symlink to the blob - at that particular commit. - - If `local_dir` is provided, the file structure from the repo will be replicated in this location. You can configure - how you want to move those files: - - If `local_dir_use_symlinks="auto"` (default), files are downloaded and stored in the cache directory as blob - files. Small files (<5MB) are duplicated in `local_dir` while a symlink is created for bigger files. The goal - is to be able to manually edit and save small files without corrupting the cache while saving disk space for - binary files. The 5MB threshold can be configured with the `HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD` - environment variable. - - If `local_dir_use_symlinks=True`, files are downloaded, stored in the cache directory and symlinked in `local_dir`. - This is optimal in term of disk usage but files must not be manually edited. - - If `local_dir_use_symlinks=False` and the blob files exist in the cache directory, they are duplicated in the - local dir. This means disk usage is not optimized. - - Finally, if `local_dir_use_symlinks=False` and the blob files do not exist in the cache directory, then the - files are downloaded and directly placed under `local_dir`. This means if you need to download them again later, - they will be re-downloaded entirely. - - ``` - [ 96] . - └── [ 160] models--julien-c--EsperBERTo-small - ├── [ 160] blobs - │ ├── [321M] 403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd - │ ├── [ 398] 7cb18dc9bafbfcf74629a4b760af1b160957a83e - │ └── [1.4K] d7edf6bd2a681fb0175f7735299831ee1b22b812 - ├── [ 96] refs - │ └── [ 40] main - └── [ 128] snapshots - ├── [ 128] 2439f60ef33a0d46d85da5001d52aeda5b00ce9f - │ ├── [ 52] README.md -> ../../blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812 - │ └── [ 76] pytorch_model.bin -> ../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd - └── [ 128] bbc77c8132af1cc5cf678da3f1ddf2de43606d48 - ├── [ 52] README.md -> ../../blobs/7cb18dc9bafbfcf74629a4b760af1b160957a83e - └── [ 76] pytorch_model.bin -> ../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd - ``` - - Args: - repo_id (`str`): - A user or an organization name and a repo name separated by a `/`. - filename (`str`): - The name of the file in the repo. - subfolder (`str`, *optional*): - An optional value corresponding to a folder inside the model repo. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if downloading from a dataset or space, - `None` or `"model"` if downloading from a model. Default is `None`. - revision (`str`, *optional*): - An optional Git revision id which can be a branch name, a tag, or a - commit hash. - endpoint (`str`, *optional*): - Hugging Face Hub base url. Will default to https://huggingface.co/. Otherwise, one can set the `HF_ENDPOINT` - environment variable. - library_name (`str`, *optional*): - The name of the library to which the object corresponds. - library_version (`str`, *optional*): - The version of the library. - cache_dir (`str`, `Path`, *optional*): - Path to the folder where cached files are stored. - local_dir (`str` or `Path`, *optional*): - If provided, the downloaded file will be placed under this directory, either as a symlink (default) or - a regular file (see description for more details). - local_dir_use_symlinks (`"auto"` or `bool`, defaults to `"auto"`): - To be used with `local_dir`. If set to "auto", the cache directory will be used and the file will be either - duplicated or symlinked to the local directory depending on its size. It set to `True`, a symlink will be - created, no matter the file size. If set to `False`, the file will either be duplicated from cache (if - already exists) or downloaded from the Hub and not cached. See description for more details. - user_agent (`dict`, `str`, *optional*): - The user-agent info in the form of a dictionary or a string. - force_download (`bool`, *optional*, defaults to `False`): - Whether the file should be downloaded even if it already exists in - the local cache. - proxies (`dict`, *optional*): - Dictionary mapping protocol to the URL of the proxy passed to - `requests.request`. - etag_timeout (`float`, *optional*, defaults to `10`): - When fetching ETag, how many seconds to wait for the server to send - data before giving up which is passed to `requests.request`. - resume_download (`bool`, *optional*, defaults to `False`): - If `True`, resume a previously interrupted download. - token (`str`, `bool`, *optional*): - A token to be used for the download. - - If `True`, the token is read from the HuggingFace config - folder. - - If a string, it's used as the authentication token. - local_files_only (`bool`, *optional*, defaults to `False`): - If `True`, avoid downloading the file and return the path to the - local cached file if it exists. - legacy_cache_layout (`bool`, *optional*, defaults to `False`): - If `True`, uses the legacy file cache layout i.e. just call [`hf_hub_url`] - then `cached_download`. This is deprecated as the new cache layout is - more powerful. - - Returns: - Local path (string) of file or if networking is off, last version of - file cached on disk. - - - - Raises the following errors: - - - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - if `token=True` and the token cannot be found. - - [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) - if ETag cannot be determined. - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - [`~utils.EntryNotFoundError`] - If the file to download cannot be found. - - [`~utils.LocalEntryNotFoundError`] - If network is disabled or unavailable and file is not found in cache. - - - """ - if force_filename is not None: - warnings.warn( - "The `force_filename` parameter is deprecated as a new caching system, " - "which keeps the filenames as they are on the Hub, is now in place.", - FutureWarning, - ) - legacy_cache_layout = True - - if legacy_cache_layout: - url = hf_hub_url( - repo_id, - filename, - subfolder=subfolder, - repo_type=repo_type, - revision=revision, - endpoint=endpoint, - ) - - return cached_download( - url, - library_name=library_name, - library_version=library_version, - cache_dir=cache_dir, - user_agent=user_agent, - force_download=force_download, - force_filename=force_filename, - proxies=proxies, - etag_timeout=etag_timeout, - resume_download=resume_download, - token=token, - local_files_only=local_files_only, - legacy_cache_layout=legacy_cache_layout, - ) - - if cache_dir is None: - cache_dir = HUGGINGFACE_HUB_CACHE - if revision is None: - revision = DEFAULT_REVISION - if isinstance(cache_dir, Path): - cache_dir = str(cache_dir) - if isinstance(local_dir, Path): - local_dir = str(local_dir) - - if subfolder == "": - subfolder = None - if subfolder is not None: - # This is used to create a URL, and not a local path, hence the forward slash. - filename = f"{subfolder}/{filename}" - - if repo_type is None: - repo_type = "model" - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type: {repo_type}. Accepted repo types are: {str(REPO_TYPES)}") - - storage_folder = os.path.join(cache_dir, repo_folder_name(repo_id=repo_id, repo_type=repo_type)) - os.makedirs(storage_folder, exist_ok=True) - - # cross platform transcription of filename, to be used as a local file path. - relative_filename = os.path.join(*filename.split("/")) - if os.name == "nt": - if relative_filename.startswith("..\\") or "\\..\\" in relative_filename: - raise ValueError( - f"Invalid filename: cannot handle filename '{relative_filename}' on Windows. Please ask the repository" - " owner to rename this file." - ) - - # if user provides a commit_hash and they already have the file on disk, - # shortcut everything. - if REGEX_COMMIT_HASH.match(revision): - pointer_path = _get_pointer_path(storage_folder, revision, relative_filename) - if os.path.exists(pointer_path): - if local_dir is not None: - return _to_local_dir(pointer_path, local_dir, relative_filename, use_symlinks=local_dir_use_symlinks) - return pointer_path - - url = hf_hub_url(repo_id, filename, repo_type=repo_type, revision=revision, endpoint=endpoint) - - headers = build_hf_headers( - token=token, - library_name=library_name, - library_version=library_version, - user_agent=user_agent, - ) - - url_to_download = url - etag = None - commit_hash = None - expected_size = None - head_call_error: Optional[Exception] = None - if not local_files_only: - try: - try: - metadata = get_hf_file_metadata( - url=url, - token=token, - proxies=proxies, - timeout=etag_timeout, - ) - except EntryNotFoundError as http_error: - # Cache the non-existence of the file and raise - commit_hash = http_error.response.headers.get(HUGGINGFACE_HEADER_X_REPO_COMMIT) - if commit_hash is not None and not legacy_cache_layout: - no_exist_file_path = Path(storage_folder) / ".no_exist" / commit_hash / relative_filename - no_exist_file_path.parent.mkdir(parents=True, exist_ok=True) - no_exist_file_path.touch() - _cache_commit_hash_for_specific_revision(storage_folder, revision, commit_hash) - raise - - # Commit hash must exist - commit_hash = metadata.commit_hash - if commit_hash is None: - raise FileMetadataError( - "Distant resource does not seem to be on huggingface.co. It is possible that a configuration issue" - " prevents you from downloading resources from https://huggingface.co. Please check your firewall" - " and proxy settings and make sure your SSL certificates are updated." - ) - - # Etag must exist - etag = metadata.etag - # We favor a custom header indicating the etag of the linked resource, and - # we fallback to the regular etag header. - # If we don't have any of those, raise an error. - if etag is None: - raise FileMetadataError( - "Distant resource does not have an ETag, we won't be able to reliably ensure reproducibility." - ) - - # Expected (uncompressed) size - expected_size = metadata.size - - # In case of a redirect, save an extra redirect on the request.get call, - # and ensure we download the exact atomic version even if it changed - # between the HEAD and the GET (unlikely, but hey). - # Useful for lfs blobs that are stored on a CDN. - if metadata.location != url: - url_to_download = metadata.location - # Remove authorization header when downloading a LFS blob - headers.pop("authorization", None) - except (requests.exceptions.SSLError, requests.exceptions.ProxyError): - # Actually raise for those subclasses of ConnectionError - raise - except ( - requests.exceptions.ConnectionError, - requests.exceptions.Timeout, - OfflineModeIsEnabled, - ) as error: - # Otherwise, our Internet connection is down. - # etag is None - head_call_error = error - pass - except (RevisionNotFoundError, EntryNotFoundError): - # The repo was found but the revision or entry doesn't exist on the Hub (never existed or got deleted) - raise - except requests.HTTPError as error: - # Multiple reasons for an http error: - # - Repository is private and invalid/missing token sent - # - Repository is gated and invalid/missing token sent - # - Hub is down (error 500 or 504) - # => let's switch to 'local_files_only=True' to check if the files are already cached. - # (if it's not the case, the error will be re-raised) - head_call_error = error - pass - except FileMetadataError as error: - # Multiple reasons for a FileMetadataError: - # - Wrong network configuration (proxy, firewall, SSL certificates) - # - Inconsistency on the Hub - # => let's switch to 'local_files_only=True' to check if the files are already cached. - # (if it's not the case, the error will be re-raised) - head_call_error = error - pass - - # etag can be None for several reasons: - # 1. we passed local_files_only. - # 2. we don't have a connection - # 3. Hub is down (HTTP 500 or 504) - # 4. repo is not found -for example private or gated- and invalid/missing token sent - # 5. Hub is blocked by a firewall or proxy is not set correctly. - # => Try to get the last downloaded one from the specified revision. - # - # If the specified revision is a commit hash, look inside "snapshots". - # If the specified revision is a branch or tag, look inside "refs". - if etag is None: - # In those cases, we cannot force download. - if force_download: - raise ValueError( - "We have no connection or you passed local_files_only, so force_download is not an accepted option." - ) - - # Try to get "commit_hash" from "revision" - commit_hash = None - if REGEX_COMMIT_HASH.match(revision): - commit_hash = revision - else: - ref_path = os.path.join(storage_folder, "refs", revision) - if os.path.isfile(ref_path): - with open(ref_path) as f: - commit_hash = f.read() - - # Return pointer file if exists - if commit_hash is not None: - pointer_path = _get_pointer_path(storage_folder, commit_hash, relative_filename) - if os.path.exists(pointer_path): - if local_dir is not None: - return _to_local_dir( - pointer_path, local_dir, relative_filename, use_symlinks=local_dir_use_symlinks - ) - return pointer_path - - # If we couldn't find an appropriate file on disk, raise an error. - # If files cannot be found and local_files_only=True, - # the models might've been found if local_files_only=False - # Notify the user about that - if local_files_only: - raise LocalEntryNotFoundError( - "Cannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable" - " hf.co look-ups and downloads online, set 'local_files_only' to False." - ) - elif isinstance(head_call_error, RepositoryNotFoundError) or isinstance(head_call_error, GatedRepoError): - # Repo not found => let's raise the actual error - raise head_call_error - else: - # Otherwise: most likely a connection issue or Hub downtime => let's warn the user - raise LocalEntryNotFoundError( - "An error happened while trying to locate the file on the Hub and we cannot find the requested files" - " in the local cache. Please check your connection and try again or make sure your Internet connection" - " is on." - ) from head_call_error - - # From now on, etag and commit_hash are not None. - assert etag is not None, "etag must have been retrieved from server" - assert commit_hash is not None, "commit_hash must have been retrieved from server" - blob_path = os.path.join(storage_folder, "blobs", etag) - pointer_path = _get_pointer_path(storage_folder, commit_hash, relative_filename) - - os.makedirs(os.path.dirname(blob_path), exist_ok=True) - os.makedirs(os.path.dirname(pointer_path), exist_ok=True) - # if passed revision is not identical to commit_hash - # then revision has to be a branch name or tag name. - # In that case store a ref. - _cache_commit_hash_for_specific_revision(storage_folder, revision, commit_hash) - - if os.path.exists(pointer_path) and not force_download: - if local_dir is not None: - return _to_local_dir(pointer_path, local_dir, relative_filename, use_symlinks=local_dir_use_symlinks) - return pointer_path - - if os.path.exists(blob_path) and not force_download: - # we have the blob already, but not the pointer - if local_dir is not None: # to local dir - return _to_local_dir(blob_path, local_dir, relative_filename, use_symlinks=local_dir_use_symlinks) - else: # or in snapshot cache - _create_symlink(blob_path, pointer_path, new_blob=False) - return pointer_path - - # Prevent parallel downloads of the same file with a lock. - lock_path = blob_path + ".lock" - - # Some Windows versions do not allow for paths longer than 255 characters. - # In this case, we must specify it is an extended path by using the "\\?\" prefix. - if os.name == "nt" and len(os.path.abspath(lock_path)) > 255: - lock_path = "\\\\?\\" + os.path.abspath(lock_path) - - if os.name == "nt" and len(os.path.abspath(blob_path)) > 255: - blob_path = "\\\\?\\" + os.path.abspath(blob_path) - - with FileLock(lock_path): - # If the download just completed while the lock was activated. - if os.path.exists(pointer_path) and not force_download: - # Even if returning early like here, the lock will be released. - return pointer_path - - if resume_download: - incomplete_path = blob_path + ".incomplete" - - @contextmanager - def _resumable_file_manager() -> Generator[io.BufferedWriter, None, None]: - with open(incomplete_path, "ab") as f: - yield f - - temp_file_manager = _resumable_file_manager - if os.path.exists(incomplete_path): - resume_size = os.stat(incomplete_path).st_size - else: - resume_size = 0 - else: - temp_file_manager = partial( # type: ignore - tempfile.NamedTemporaryFile, mode="wb", dir=cache_dir, delete=False - ) - resume_size = 0 - - # Download to temporary file, then copy to cache dir once finished. - # Otherwise you get corrupt cache entries if the download gets interrupted. - with temp_file_manager() as temp_file: - logger.info("downloading %s to %s", url, temp_file.name) - - if expected_size is not None: # might be None if HTTP header not set correctly - # Check tmp path - _check_disk_space(expected_size, os.path.dirname(temp_file.name)) - - # Check destination - _check_disk_space(expected_size, os.path.dirname(blob_path)) - if local_dir is not None: - _check_disk_space(expected_size, local_dir) - - http_get( - url_to_download, - temp_file, - proxies=proxies, - resume_size=resume_size, - headers=headers, - expected_size=expected_size, - ) - - if local_dir is None: - logger.debug(f"Storing {url} in cache at {blob_path}") - _chmod_and_replace(temp_file.name, blob_path) - _create_symlink(blob_path, pointer_path, new_blob=True) - else: - local_dir_filepath = os.path.join(local_dir, relative_filename) - os.makedirs(os.path.dirname(local_dir_filepath), exist_ok=True) - - # If "auto" (default) copy-paste small files to ease manual editing but symlink big files to save disk - # In both cases, blob file is cached. - is_big_file = os.stat(temp_file.name).st_size > constants.HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD - if local_dir_use_symlinks is True or (local_dir_use_symlinks == "auto" and is_big_file): - logger.debug(f"Storing {url} in cache at {blob_path}") - _chmod_and_replace(temp_file.name, blob_path) - logger.debug("Create symlink to local dir") - _create_symlink(blob_path, local_dir_filepath, new_blob=False) - elif local_dir_use_symlinks == "auto" and not is_big_file: - logger.debug(f"Storing {url} in cache at {blob_path}") - _chmod_and_replace(temp_file.name, blob_path) - logger.debug("Duplicate in local dir (small file and use_symlink set to 'auto')") - shutil.copyfile(blob_path, local_dir_filepath) - else: - logger.debug(f"Storing {url} in local_dir at {local_dir_filepath} (not cached).") - _chmod_and_replace(temp_file.name, local_dir_filepath) - pointer_path = local_dir_filepath # for return value - - try: - os.remove(lock_path) - except OSError: - pass - - return pointer_path - - -@validate_hf_hub_args -def try_to_load_from_cache( - repo_id: str, - filename: str, - cache_dir: Union[str, Path, None] = None, - revision: Optional[str] = None, - repo_type: Optional[str] = None, -) -> Union[str, _CACHED_NO_EXIST_T, None]: - """ - Explores the cache to return the latest cached file for a given revision if found. - - This function will not raise any exception if the file in not cached. - - Args: - cache_dir (`str` or `os.PathLike`): - The folder where the cached files lie. - repo_id (`str`): - The ID of the repo on huggingface.co. - filename (`str`): - The filename to look for inside `repo_id`. - revision (`str`, *optional*): - The specific model version to use. Will default to `"main"` if it's not provided and no `commit_hash` is - provided either. - repo_type (`str`, *optional*): - The type of the repository. Will default to `"model"`. - - Returns: - `Optional[str]` or `_CACHED_NO_EXIST`: - Will return `None` if the file was not cached. Otherwise: - - The exact path to the cached file if it's found in the cache - - A special value `_CACHED_NO_EXIST` if the file does not exist at the given commit hash and this fact was - cached. - - Example: - - ```python - from huggingface_hub import try_to_load_from_cache, _CACHED_NO_EXIST - - filepath = try_to_load_from_cache() - if isinstance(filepath, str): - # file exists and is cached - ... - elif filepath is _CACHED_NO_EXIST: - # non-existence of file is cached - ... - else: - # file is not cached - ... - ``` - """ - if revision is None: - revision = "main" - if repo_type is None: - repo_type = "model" - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type: {repo_type}. Accepted repo types are: {str(REPO_TYPES)}") - if cache_dir is None: - cache_dir = HUGGINGFACE_HUB_CACHE - - object_id = repo_id.replace("/", "--") - repo_cache = os.path.join(cache_dir, f"{repo_type}s--{object_id}") - if not os.path.isdir(repo_cache): - # No cache for this model - return None - - refs_dir = os.path.join(repo_cache, "refs") - snapshots_dir = os.path.join(repo_cache, "snapshots") - no_exist_dir = os.path.join(repo_cache, ".no_exist") - - # Resolve refs (for instance to convert main to the associated commit sha) - if os.path.isdir(refs_dir): - revision_file = os.path.join(refs_dir, revision) - if os.path.isfile(revision_file): - with open(revision_file) as f: - revision = f.read() - - # Check if file is cached as "no_exist" - if os.path.isfile(os.path.join(no_exist_dir, revision, filename)): - return _CACHED_NO_EXIST - - # Check if revision folder exists - if not os.path.exists(snapshots_dir): - return None - cached_shas = os.listdir(snapshots_dir) - if revision not in cached_shas: - # No cache for this revision and we won't try to return a random revision - return None - - # Check if file exists in cache - cached_file = os.path.join(snapshots_dir, revision, filename) - return cached_file if os.path.isfile(cached_file) else None - - -@validate_hf_hub_args -def get_hf_file_metadata( - url: str, - token: Union[bool, str, None] = None, - proxies: Optional[Dict] = None, - timeout: Optional[float] = 10.0, -) -> HfFileMetadata: - """Fetch metadata of a file versioned on the Hub for a given url. - - Args: - url (`str`): - File url, for example returned by [`hf_hub_url`]. - token (`str` or `bool`, *optional*): - A token to be used for the download. - - If `True`, the token is read from the HuggingFace config - folder. - - If `False` or `None`, no token is provided. - - If a string, it's used as the authentication token. - proxies (`dict`, *optional*): - Dictionary mapping protocol to the URL of the proxy passed to - `requests.request`. - timeout (`float`, *optional*, defaults to 10): - How many seconds to wait for the server to send metadata before giving up. - - Returns: - A [`HfFileMetadata`] object containing metadata such as location, etag, size and - commit_hash. - """ - headers = build_hf_headers(token=token) - headers["Accept-Encoding"] = "identity" # prevent any compression => we want to know the real size of the file - - # Retrieve metadata - r = _request_wrapper( - method="HEAD", - url=url, - headers=headers, - allow_redirects=False, - follow_relative_redirects=True, - proxies=proxies, - timeout=timeout, - ) - hf_raise_for_status(r) - - # Return - return HfFileMetadata( - commit_hash=r.headers.get(HUGGINGFACE_HEADER_X_REPO_COMMIT), - etag=_normalize_etag( - # We favor a custom header indicating the etag of the linked resource, and - # we fallback to the regular etag header. - r.headers.get(HUGGINGFACE_HEADER_X_LINKED_ETAG) - or r.headers.get("ETag") - ), - # Either from response headers (if redirected) or defaults to request url - # Do not use directly `url`, as `_request_wrapper` might have followed relative - # redirects. - location=r.headers.get("Location") or r.request.url, # type: ignore - size=_int_or_none(r.headers.get(HUGGINGFACE_HEADER_X_LINKED_SIZE) or r.headers.get("Content-Length")), - ) - - -def _int_or_none(value: Optional[str]) -> Optional[int]: - try: - return int(value) # type: ignore - except (TypeError, ValueError): - return None - - -def _chmod_and_replace(src: str, dst: str) -> None: - """Set correct permission before moving a blob from tmp directory to cache dir. - - Do not take into account the `umask` from the process as there is no convenient way - to get it that is thread-safe. - - See: - - About umask: https://docs.python.org/3/library/os.html#os.umask - - Thread-safety: https://stackoverflow.com/a/70343066 - - About solution: https://github.com/huggingface/huggingface_hub/pull/1220#issuecomment-1326211591 - - Fix issue: https://github.com/huggingface/huggingface_hub/issues/1141 - - Fix issue: https://github.com/huggingface/huggingface_hub/issues/1215 - """ - # Get umask by creating a temporary file in the cached repo folder. - tmp_file = Path(dst).parent.parent / f"tmp_{uuid.uuid4()}" - try: - tmp_file.touch() - cache_dir_mode = Path(tmp_file).stat().st_mode - os.chmod(src, stat.S_IMODE(cache_dir_mode)) - finally: - tmp_file.unlink() - - shutil.move(src, dst) - - -def _get_pointer_path(storage_folder: str, revision: str, relative_filename: str) -> str: - # Using `os.path.abspath` instead of `Path.resolve()` to avoid resolving symlinks - snapshot_path = os.path.join(storage_folder, "snapshots") - pointer_path = os.path.join(snapshot_path, revision, relative_filename) - if Path(os.path.abspath(snapshot_path)) not in Path(os.path.abspath(pointer_path)).parents: - raise ValueError( - "Invalid pointer path: cannot create pointer path in snapshot folder if" - f" `storage_folder='{storage_folder}'`, `revision='{revision}'` and" - f" `relative_filename='{relative_filename}'`." - ) - return pointer_path - - -def _to_local_dir( - path: str, local_dir: str, relative_filename: str, use_symlinks: Union[bool, Literal["auto"]] -) -> str: - """Place a file in a local dir (different than cache_dir). - - Either symlink to blob file in cache or duplicate file depending on `use_symlinks` and file size. - """ - # Using `os.path.abspath` instead of `Path.resolve()` to avoid resolving symlinks - local_dir_filepath = os.path.join(local_dir, relative_filename) - if Path(os.path.abspath(local_dir)) not in Path(os.path.abspath(local_dir_filepath)).parents: - raise ValueError( - f"Cannot copy file '{relative_filename}' to local dir '{local_dir}': file would not be in the local" - " directory." - ) - - os.makedirs(os.path.dirname(local_dir_filepath), exist_ok=True) - real_blob_path = os.path.realpath(path) - - # If "auto" (default) copy-paste small files to ease manual editing but symlink big files to save disk - if use_symlinks == "auto": - use_symlinks = os.stat(real_blob_path).st_size > constants.HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD - - if use_symlinks: - _create_symlink(real_blob_path, local_dir_filepath, new_blob=False) - else: - shutil.copyfile(real_blob_path, local_dir_filepath) - return local_dir_filepath diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/hf_api.py b/venv/lib/python3.8/site-packages/huggingface_hub/hf_api.py deleted file mode 100644 index 23e5558933e9e7fd626d69f9253809f67fb5ff1e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/hf_api.py +++ /dev/null @@ -1,6606 +0,0 @@ -# coding=utf-8 -# Copyright 2019-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from __future__ import annotations - -import inspect -import json -import pprint -import re -import textwrap -import warnings -from concurrent.futures import Future, ThreadPoolExecutor -from dataclasses import dataclass, field -from datetime import datetime -from functools import wraps -from itertools import islice -from pathlib import Path -from typing import ( - Any, - BinaryIO, - Callable, - Dict, - Iterable, - Iterator, - List, - Literal, - Optional, - Tuple, - TypedDict, - TypeVar, - Union, - overload, -) -from urllib.parse import quote - -import requests -from requests.exceptions import HTTPError -from tqdm.auto import tqdm as base_tqdm - -from huggingface_hub.utils import ( - IGNORE_GIT_FOLDER_PATTERNS, - EntryNotFoundError, - LocalTokenNotFoundError, - RepositoryNotFoundError, - RevisionNotFoundError, - experimental, - get_session, -) - -from ._commit_api import ( - CommitOperation, - CommitOperationAdd, - CommitOperationCopy, - CommitOperationDelete, - _fetch_lfs_files_to_copy, - _fetch_upload_modes, - _prepare_commit_payload, - _upload_lfs_files, - _warn_on_overwriting_operations, -) -from ._multi_commits import ( - MULTI_COMMIT_PR_CLOSE_COMMENT_FAILURE_BAD_REQUEST_TEMPLATE, - MULTI_COMMIT_PR_CLOSE_COMMENT_FAILURE_NO_CHANGES_TEMPLATE, - MULTI_COMMIT_PR_CLOSING_COMMENT_TEMPLATE, - MULTI_COMMIT_PR_COMPLETION_COMMENT_TEMPLATE, - MultiCommitException, - MultiCommitStep, - MultiCommitStrategy, - multi_commit_create_pull_request, - multi_commit_generate_comment, - multi_commit_parse_pr_description, - plan_multi_commits, -) -from ._space_api import SpaceHardware, SpaceRuntime, SpaceStorage, SpaceVariable -from .community import ( - Discussion, - DiscussionComment, - DiscussionStatusChange, - DiscussionTitleChange, - DiscussionWithDetails, - deserialize_event, -) -from .constants import ( - DEFAULT_REVISION, - ENDPOINT, - REGEX_COMMIT_OID, - REPO_TYPE_MODEL, - REPO_TYPES, - REPO_TYPES_MAPPING, - REPO_TYPES_URL_PREFIXES, - SPACES_SDK_TYPES, -) -from .file_download import ( - get_hf_file_metadata, - hf_hub_url, -) -from .utils import ( # noqa: F401 # imported for backward compatibility - BadRequestError, - HfFolder, - HfHubHTTPError, - build_hf_headers, - filter_repo_objects, - hf_raise_for_status, - logging, - paginate, - parse_datetime, - validate_hf_hub_args, -) -from .utils._deprecation import ( - _deprecate_arguments, -) -from .utils._typing import CallableT -from .utils.endpoint_helpers import ( - AttributeDictionary, - DatasetFilter, - DatasetTags, - ModelFilter, - ModelTags, - _filter_emissions, -) - - -R = TypeVar("R") # Return type -CollectionItemType_T = Literal["model", "dataset", "space", "paper"] - -USERNAME_PLACEHOLDER = "hf_user" -_REGEX_DISCUSSION_URL = re.compile(r".*/discussions/(\d+)$") - -_CREATE_COMMIT_NO_REPO_ERROR_MESSAGE = ( - "\nNote: Creating a commit assumes that the repo already exists on the" - " Huggingface Hub. Please use `create_repo` if it's not the case." -) - -logger = logging.get_logger(__name__) - - -class ReprMixin: - """Mixin to create the __repr__ for a class""" - - def __init__(self, **kwargs) -> None: - # Store all the other fields returned by the API - # Hack to ensure backward compatibility with future versions of the API. - # See discussion in https://github.com/huggingface/huggingface_hub/pull/951#discussion_r926460408 - for k, v in kwargs.items(): - setattr(self, k, v) - - def __repr__(self): - formatted_value = pprint.pformat(self.__dict__, width=119, compact=True) - if "\n" in formatted_value: - return f"{self.__class__.__name__}: {{ \n{textwrap.indent(formatted_value, ' ')}\n}}" - else: - return f"{self.__class__.__name__}: {formatted_value}" - - -def repo_type_and_id_from_hf_id(hf_id: str, hub_url: Optional[str] = None) -> Tuple[Optional[str], Optional[str], str]: - """ - Returns the repo type and ID from a huggingface.co URL linking to a - repository - - Args: - hf_id (`str`): - An URL or ID of a repository on the HF hub. Accepted values are: - - - https://huggingface.co/// - - https://huggingface.co// - - hf://// - - hf:/// - - // - - / - - - hub_url (`str`, *optional*): - The URL of the HuggingFace Hub, defaults to https://huggingface.co - - Returns: - A tuple with three items: repo_type (`str` or `None`), namespace (`str` or - `None`) and repo_id (`str`). - - Raises: - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If URL cannot be parsed. - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If `repo_type` is unknown. - """ - input_hf_id = hf_id - hub_url = re.sub(r"https?://", "", hub_url if hub_url is not None else ENDPOINT) - is_hf_url = hub_url in hf_id and "@" not in hf_id - - HFFS_PREFIX = "hf://" - if hf_id.startswith(HFFS_PREFIX): # Remove "hf://" prefix if exists - hf_id = hf_id[len(HFFS_PREFIX) :] - - url_segments = hf_id.split("/") - is_hf_id = len(url_segments) <= 3 - - namespace: Optional[str] - if is_hf_url: - namespace, repo_id = url_segments[-2:] - if namespace == hub_url: - namespace = None - if len(url_segments) > 2 and hub_url not in url_segments[-3]: - repo_type = url_segments[-3] - elif namespace in REPO_TYPES_MAPPING: - # Mean canonical dataset or model - repo_type = REPO_TYPES_MAPPING[namespace] - namespace = None - else: - repo_type = None - elif is_hf_id: - if len(url_segments) == 3: - # Passed // or // - repo_type, namespace, repo_id = url_segments[-3:] - elif len(url_segments) == 2: - if url_segments[0] in REPO_TYPES_MAPPING: - # Passed '' or 'datasets/' for a canonical model or dataset - repo_type = REPO_TYPES_MAPPING[url_segments[0]] - namespace = None - repo_id = hf_id.split("/")[-1] - else: - # Passed / or / - namespace, repo_id = hf_id.split("/")[-2:] - repo_type = None - else: - # Passed - repo_id = url_segments[0] - namespace, repo_type = None, None - else: - raise ValueError(f"Unable to retrieve user and repo ID from the passed HF ID: {hf_id}") - - # Check if repo type is known (mapping "spaces" => "space" + empty value => `None`) - if repo_type in REPO_TYPES_MAPPING: - repo_type = REPO_TYPES_MAPPING[repo_type] - if repo_type == "": - repo_type = None - if repo_type not in REPO_TYPES: - raise ValueError(f"Unknown `repo_type`: '{repo_type}' ('{input_hf_id}')") - - return repo_type, namespace, repo_id - - -class BlobLfsInfo(TypedDict, total=False): - size: int - sha256: str - pointer_size: int - - -@dataclass -class CommitInfo: - """Data structure containing information about a newly created commit. - - Returned by [`create_commit`]. - - Args: - commit_url (`str`): - Url where to find the commit. - - commit_message (`str`): - The summary (first line) of the commit that has been created. - - commit_description (`str`): - Description of the commit that has been created. Can be empty. - - oid (`str`): - Commit hash id. Example: `"91c54ad1727ee830252e457677f467be0bfd8a57"`. - - pr_url (`str`, *optional*): - Url to the PR that has been created, if any. Populated when `create_pr=True` - is passed. - - pr_revision (`str`, *optional*): - Revision of the PR that has been created, if any. Populated when - `create_pr=True` is passed. Example: `"refs/pr/1"`. - - pr_num (`int`, *optional*): - Number of the PR discussion that has been created, if any. Populated when - `create_pr=True` is passed. Can be passed as `discussion_num` in - [`get_discussion_details`]. Example: `1`. - """ - - commit_url: str - commit_message: str - commit_description: str - oid: str - pr_url: Optional[str] = None - - # Computed from `pr_url` in `__post_init__` - pr_revision: Optional[str] = field(init=False) - pr_num: Optional[str] = field(init=False) - - def __post_init__(self): - """Populate pr-related fields after initialization. - - See https://docs.python.org/3.10/library/dataclasses.html#post-init-processing. - """ - if self.pr_url is not None: - self.pr_revision = _parse_revision_from_pr_url(self.pr_url) - self.pr_num = int(self.pr_revision.split("/")[-1]) - else: - self.pr_revision = None - self.pr_num = None - - -class RepoUrl(str): - """Subclass of `str` describing a repo URL on the Hub. - - `RepoUrl` is returned by `HfApi.create_repo`. It inherits from `str` for backward - compatibility. At initialization, the URL is parsed to populate properties: - - endpoint (`str`) - - namespace (`Optional[str]`) - - repo_name (`str`) - - repo_id (`str`) - - repo_type (`Literal["model", "dataset", "space"]`) - - url (`str`) - - Args: - url (`Any`): - String value of the repo url. - endpoint (`str`, *optional*): - Endpoint of the Hub. Defaults to . - - Example: - ```py - >>> RepoUrl('https://huggingface.co/gpt2') - RepoUrl('https://huggingface.co/gpt2', endpoint='https://huggingface.co', repo_type='model', repo_id='gpt2') - - >>> RepoUrl('https://hub-ci.huggingface.co/datasets/dummy_user/dummy_dataset', endpoint='https://hub-ci.huggingface.co') - RepoUrl('https://hub-ci.huggingface.co/datasets/dummy_user/dummy_dataset', endpoint='https://hub-ci.huggingface.co', repo_type='dataset', repo_id='dummy_user/dummy_dataset') - - >>> RepoUrl('hf://datasets/my-user/my-dataset') - RepoUrl('hf://datasets/my-user/my-dataset', endpoint='https://huggingface.co', repo_type='dataset', repo_id='user/dataset') - - >>> HfApi.create_repo("dummy_model") - RepoUrl('https://huggingface.co/Wauplin/dummy_model', endpoint='https://huggingface.co', repo_type='model', repo_id='Wauplin/dummy_model') - ``` - - Raises: - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If URL cannot be parsed. - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If `repo_type` is unknown. - """ - - def __new__(cls, url: Any, endpoint: Optional[str] = None): - return super(RepoUrl, cls).__new__(cls, url) - - def __init__(self, url: Any, endpoint: Optional[str] = None) -> None: - super().__init__() - # Parse URL - self.endpoint = endpoint or ENDPOINT - repo_type, namespace, repo_name = repo_type_and_id_from_hf_id(self, hub_url=self.endpoint) - - # Populate fields - self.namespace = namespace - self.repo_name = repo_name - self.repo_id = repo_name if namespace is None else f"{namespace}/{repo_name}" - self.repo_type = repo_type or REPO_TYPE_MODEL - self.url = str(self) # just in case it's needed - - def __repr__(self) -> str: - return f"RepoUrl('{self}', endpoint='{self.endpoint}', repo_type='{self.repo_type}', repo_id='{self.repo_id}')" - - -class RepoFile(ReprMixin): - """ - Data structure that represents a public file inside a repo, accessible from huggingface.co - - Args: - rfilename (str): - file name, relative to the repo root. This is the only attribute that's guaranteed to be here, but under - certain conditions there can certain other stuff. - size (`int`, *optional*): - The file's size, in bytes. This attribute is present when `files_metadata` argument of [`repo_info`] is set - to `True`. It's `None` otherwise. - blob_id (`str`, *optional*): - The file's git OID. This attribute is present when `files_metadata` argument of [`repo_info`] is set to - `True`. It's `None` otherwise. - lfs (`BlobLfsInfo`, *optional*): - The file's LFS metadata. This attribute is present when`files_metadata` argument of [`repo_info`] is set to - `True` and the file is stored with Git LFS. It's `None` otherwise. - """ - - def __init__( - self, - rfilename: str, - size: Optional[int] = None, - blobId: Optional[str] = None, - lfs: Optional[BlobLfsInfo] = None, - **kwargs, - ): - self.rfilename = rfilename # filename relative to the repo root - - # Optional file metadata - self.size = size - self.blob_id = blobId - self.lfs = lfs - - # Store all the other fields returned by the API - super().__init__(**kwargs) - - -class ModelInfo(ReprMixin): - """ - Info about a model accessible from huggingface.co - - Attributes: - modelId (`str`, *optional*): - ID of model repository. - sha (`str`, *optional*): - repo sha at this particular revision - lastModified (`str`, *optional*): - date of last commit to repo - tags (`List[str]`, *optional*): - List of tags. - pipeline_tag (`str`, *optional*): - Pipeline tag to identify the correct widget. - siblings (`List[RepoFile]`, *optional*): - list of ([`huggingface_hub.hf_api.RepoFile`]) objects that constitute the model. - private (`bool`, *optional*, defaults to `False`): - is the repo private - author (`str`, *optional*): - repo author - config (`Dict`, *optional*): - Model configuration information - securityStatus (`Dict`, *optional*): - Security status of the model. - Example: `{"containsInfected": False}` - kwargs (`Dict`, *optional*): - Kwargs that will be become attributes of the class. - """ - - def __init__( - self, - *, - modelId: Optional[str] = None, - sha: Optional[str] = None, - lastModified: Optional[str] = None, - tags: Optional[List[str]] = None, - pipeline_tag: Optional[str] = None, - siblings: Optional[List[Dict]] = None, - private: bool = False, - author: Optional[str] = None, - config: Optional[Dict] = None, - securityStatus: Optional[Dict] = None, - **kwargs, - ): - self.modelId = modelId - self.sha = sha - self.lastModified = lastModified - self.tags = tags - self.pipeline_tag = pipeline_tag - self.siblings = [RepoFile(**x) for x in siblings] if siblings is not None else [] - self.private = private - self.author = author - self.config = config - self.securityStatus = securityStatus - - # Store all the other fields returned by the API - super().__init__(**kwargs) - - def __str__(self): - r = f"Model Name: {self.modelId}, Tags: {self.tags}" - if self.pipeline_tag: - r += f", Task: {self.pipeline_tag}" - return r - - -class DatasetInfo(ReprMixin): - """ - Info about a dataset accessible from huggingface.co - - Attributes: - id (`str`, *optional*): - ID of dataset repository. - sha (`str`, *optional*): - repo sha at this particular revision - lastModified (`str`, *optional*): - date of last commit to repo - tags (`List[str]`, *optional*): - List of tags. - siblings (`List[RepoFile]`, *optional*): - list of [`huggingface_hub.hf_api.RepoFile`] objects that constitute the dataset. - private (`bool`, *optional*, defaults to `False`): - is the repo private - author (`str`, *optional*): - repo author - description (`str`, *optional*): - Description of the dataset - citation (`str`, *optional*): - Dataset citation - cardData (`Dict`, *optional*): - Metadata of the model card as a dictionary. - kwargs (`Dict`, *optional*): - Kwargs that will be become attributes of the class. - """ - - def __init__( - self, - *, - id: Optional[str] = None, - sha: Optional[str] = None, - lastModified: Optional[str] = None, - tags: Optional[List[str]] = None, - siblings: Optional[List[Dict]] = None, - private: bool = False, - author: Optional[str] = None, - description: Optional[str] = None, - citation: Optional[str] = None, - cardData: Optional[dict] = None, - **kwargs, - ): - self.id = id - self.sha = sha - self.lastModified = lastModified - self.tags = tags - self.private = private - self.author = author - self.description = description - self.citation = citation - self.cardData = cardData - self.siblings = [RepoFile(**x) for x in siblings] if siblings is not None else [] - # Legacy stuff, "key" is always returned with an empty string - # because of old versions of the datasets lib that need this field - kwargs.pop("key", None) - # Store all the other fields returned by the API - super().__init__(**kwargs) - - def __str__(self): - r = f"Dataset Name: {self.id}, Tags: {self.tags}" - return r - - -class SpaceInfo(ReprMixin): - """ - Info about a Space accessible from huggingface.co - - This is a "dataclass" like container that just sets on itself any attribute - passed by the server. - - Attributes: - id (`str`, *optional*): - id of space - sha (`str`, *optional*): - repo sha at this particular revision - lastModified (`str`, *optional*): - date of last commit to repo - siblings (`List[RepoFile]`, *optional*): - list of [`huggingface_hub.hf_api.RepoFIle`] objects that constitute the Space - private (`bool`, *optional*, defaults to `False`): - is the repo private - author (`str`, *optional*): - repo author - kwargs (`Dict`, *optional*): - Kwargs that will be become attributes of the class. - """ - - def __init__( - self, - *, - id: Optional[str] = None, - sha: Optional[str] = None, - lastModified: Optional[str] = None, - siblings: Optional[List[Dict]] = None, - private: bool = False, - author: Optional[str] = None, - **kwargs, - ): - self.id = id - self.sha = sha - self.lastModified = lastModified - self.siblings = [RepoFile(**x) for x in siblings] if siblings is not None else [] - self.private = private - self.author = author - # Store all the other fields returned by the API - super().__init__(**kwargs) - - -class MetricInfo(ReprMixin): - """ - Info about a public metric accessible from huggingface.co - """ - - def __init__( - self, - *, - id: Optional[str] = None, # id of metric - description: Optional[str] = None, - citation: Optional[str] = None, - **kwargs, - ): - self.id = id - self.description = description - self.citation = citation - # Legacy stuff, "key" is always returned with an empty string - # because of old versions of the datasets lib that need this field - kwargs.pop("key", None) - # Store all the other fields returned by the API - super().__init__(**kwargs) - - def __str__(self): - r = f"Metric Name: {self.id}" - return r - - -class CollectionItem(ReprMixin): - """Contains information about an item of a Collection (model, dataset, Space or paper). - - Args: - item_object_id (`str`): - Unique ID of the item in the collection. - item_id (`str`): - ID of the underlying object on the Hub. Can be either a repo_id or a paper id - e.g. `"jbilcke-hf/ai-comic-factory"`, `"2307.09288"`. - item_type (`str`): - Type of the underlying object. Can be one of `"model"`, `"dataset"`, `"space"` or `"paper"`. - position (`int`): - Position of the item in the collection. - note (`str`, *optional*): - Note associated with the item, as plain text. - kwargs (`Dict`, *optional*): - Any other attribute returned by the server. Those attributes depend on the `item_type`: "author", "private", - "lastModified", "gated", "title", "likes", "upvotes", etc. - """ - - def __init__( - self, _id: str, id: str, type: CollectionItemType_T, position: int, note: Optional[Dict] = None, **kwargs - ) -> None: - self.item_object_id: str = _id # id in database - self.item_id: str = id # repo_id or paper id - self.item_type: CollectionItemType_T = type - self.position: int = position - self.note: str = note["text"] if note is not None else None - - # Store all the other fields returned by the API - super().__init__(**kwargs) - - -class Collection(ReprMixin): - """ - Contains information about a Collection on the Hub. - - Args: - slug (`str`): - Slug of the collection. E.g. `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`. - title (`str`): - Title of the collection. E.g. `"Recent models"`. - owner (`str`): - Owner of the collection. E.g. `"TheBloke"`. - description (`str`, *optional*): - Description of the collection, as plain text. - items (`List[CollectionItem]`): - List of items in the collection. - last_updated (`datetime`): - Date of the last update of the collection. - position (`int`): - Position of the collection in the list of collections of the owner. - private (`bool`): - Whether the collection is private or not. - theme (`str`): - Theme of the collection. E.g. `"green"`. - url (`str`): - URL for the collection on the Hub. - """ - - slug: str - title: str - owner: str - description: Optional[str] - items: List[CollectionItem] - - last_updated: datetime - position: int - private: bool - theme: str - - def __init__(self, data: Dict, endpoint: Optional[str] = None) -> None: - # Collection info - self.slug = data["slug"] - self.title = data["title"] - self.owner = data["owner"]["name"] - self.description = data.get("description") - self.items = [CollectionItem(**item) for item in data["items"]] - - # Metadata - self.last_updated = parse_datetime(data["lastUpdated"]) - self.private = data["private"] - self.position = data["position"] - self.theme = data["theme"] - - # (internal) - if endpoint is None: - endpoint = ENDPOINT - self.url = f"{ENDPOINT}/collections/{self.slug}" - - -class ModelSearchArguments(AttributeDictionary): - """ - A nested namespace object holding all possible values for properties of - models currently hosted in the Hub with tab-completion. If a value starts - with a number, it will only exist in the dictionary - - Example: - - ```python - >>> args = ModelSearchArguments() - - >>> args.author.huggingface - 'huggingface' - - >>> args.language.en - 'en' - ``` - - - - `ModelSearchArguments` is a legacy class meant for exploratory purposes only. Its - initialization requires listing all models on the Hub which makes it increasingly - slower as the number of repos on the Hub increases. - - - """ - - def __init__(self, api: Optional["HfApi"] = None): - self._api = api if api is not None else HfApi() - tags = self._api.get_model_tags() - super().__init__(tags) - self._process_models() - - def _process_models(self): - def clean(s: str) -> str: - return s.replace(" ", "").replace("-", "_").replace(".", "_") - - models = self._api.list_models() - author_dict, model_name_dict = AttributeDictionary(), AttributeDictionary() - for model in models: - if "/" in model.modelId: - author, name = model.modelId.split("/") - author_dict[author] = clean(author) - else: - name = model.modelId - model_name_dict[name] = clean(name) - self["model_name"] = model_name_dict - self["author"] = author_dict - - -class DatasetSearchArguments(AttributeDictionary): - """ - A nested namespace object holding all possible values for properties of - datasets currently hosted in the Hub with tab-completion. If a value starts - with a number, it will only exist in the dictionary - - Example: - - ```python - >>> args = DatasetSearchArguments() - - >>> args.author.huggingface - 'huggingface' - - >>> args.language.en - 'language:en' - ``` - - - - `DatasetSearchArguments` is a legacy class meant for exploratory purposes only. Its - initialization requires listing all datasets on the Hub which makes it increasingly - slower as the number of repos on the Hub increases. - - - """ - - def __init__(self, api: Optional["HfApi"] = None): - self._api = api if api is not None else HfApi() - tags = self._api.get_dataset_tags() - super().__init__(tags) - self._process_models() - - def _process_models(self): - def clean(s: str): - return s.replace(" ", "").replace("-", "_").replace(".", "_") - - datasets = self._api.list_datasets() - author_dict, dataset_name_dict = AttributeDictionary(), AttributeDictionary() - for dataset in datasets: - if "/" in dataset.id: - author, name = dataset.id.split("/") - author_dict[author] = clean(author) - else: - name = dataset.id - dataset_name_dict[name] = clean(name) - self["dataset_name"] = dataset_name_dict - self["author"] = author_dict - - -@dataclass -class GitRefInfo: - """ - Contains information about a git reference for a repo on the Hub. - - Args: - name (`str`): - Name of the reference (e.g. tag name or branch name). - ref (`str`): - Full git ref on the Hub (e.g. `"refs/heads/main"` or `"refs/tags/v1.0"`). - target_commit (`str`): - OID of the target commit for the ref (e.g. `"e7da7f221d5bf496a48136c0cd264e630fe9fcc8"`) - """ - - name: str - ref: str - target_commit: str - - def __init__(self, data: Dict) -> None: - self.name = data["name"] - self.ref = data["ref"] - self.target_commit = data["targetCommit"] - - -@dataclass -class GitRefs: - """ - Contains information about all git references for a repo on the Hub. - - Object is returned by [`list_repo_refs`]. - - Args: - branches (`List[GitRefInfo]`): - A list of [`GitRefInfo`] containing information about branches on the repo. - converts (`List[GitRefInfo]`): - A list of [`GitRefInfo`] containing information about "convert" refs on the repo. - Converts are refs used (internally) to push preprocessed data in Dataset repos. - tags (`List[GitRefInfo]`): - A list of [`GitRefInfo`] containing information about tags on the repo. - """ - - branches: List[GitRefInfo] - converts: List[GitRefInfo] - tags: List[GitRefInfo] - - -@dataclass -class GitCommitInfo: - """ - Contains information about a git commit for a repo on the Hub. Check out [`list_repo_commits`] for more details. - - Args: - commit_id (`str`): - OID of the commit (e.g. `"e7da7f221d5bf496a48136c0cd264e630fe9fcc8"`) - authors (`List[str]`): - List of authors of the commit. - created_at (`datetime`): - Datetime when the commit was created. - title (`str`): - Title of the commit. This is a free-text value entered by the authors. - message (`str`): - Description of the commit. This is a free-text value entered by the authors. - formatted_title (`str`): - Title of the commit formatted as HTML. Only returned if `formatted=True` is set. - formatted_message (`str`): - Description of the commit formatted as HTML. Only returned if `formatted=True` is set. - """ - - commit_id: str - - authors: List[str] - created_at: datetime - title: str - message: str - - formatted_title: Optional[str] - formatted_message: Optional[str] - - def __init__(self, data: Dict) -> None: - self.commit_id = data["id"] - self.authors = [author["user"] for author in data["authors"]] - self.created_at = parse_datetime(data["date"]) - self.title = data["title"] - self.message = data["message"] - - self.formatted_title = data.get("formatted", {}).get("title") - self.formatted_message = data.get("formatted", {}).get("message") - - -@dataclass -class UserLikes: - """ - Contains information about a user likes on the Hub. - - Args: - user (`str`): - Name of the user for which we fetched the likes. - total (`int`): - Total number of likes. - datasets (`List[str]`): - List of datasets liked by the user (as repo_ids). - models (`List[str]`): - List of models liked by the user (as repo_ids). - spaces (`List[str]`): - List of spaces liked by the user (as repo_ids). - """ - - # Metadata - user: str - total: int - - # User likes - datasets: List[str] - models: List[str] - spaces: List[str] - - -@dataclass -class User: - """ - Contains information about a user on the Hub. - - Args: - avatar_url (`str`): - URL of the user's avatar. - username (`str`): - Name of the user on the Hub (unique). - fullname (`str`): - User's full name. - """ - - # Metadata - avatar_url: str - username: str - fullname: str - - -def future_compatible(fn: CallableT) -> CallableT: - """Wrap a method of `HfApi` to handle `run_as_future=True`. - - A method flagged as "future_compatible" will be called in a thread if `run_as_future=True` and return a - `concurrent.futures.Future` instance. Otherwise, it will be called normally and return the result. - """ - sig = inspect.signature(fn) - args_params = list(sig.parameters)[1:] # remove "self" from list - - @wraps(fn) - def _inner(self, *args, **kwargs): - # Get `run_as_future` value if provided (default to False) - if "run_as_future" in kwargs: - run_as_future = kwargs["run_as_future"] - kwargs["run_as_future"] = False # avoid recursion error - else: - run_as_future = False - for param, value in zip(args_params, args): - if param == "run_as_future": - run_as_future = value - break - - # Call the function in a thread if `run_as_future=True` - if run_as_future: - return self.run_as_future(fn, self, *args, **kwargs) - - # Otherwise, call the function normally - return fn(self, *args, **kwargs) - - _inner.is_future_compatible = True # type: ignore - return _inner # type: ignore - - -class HfApi: - def __init__( - self, - endpoint: Optional[str] = None, - token: Optional[str] = None, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - user_agent: Union[Dict, str, None] = None, - ) -> None: - """Create a HF client to interact with the Hub via HTTP. - - The client is initialized with some high-level settings used in all requests - made to the Hub (HF endpoint, authentication, user agents...). Using the `HfApi` - client is preferred but not mandatory as all of its public methods are exposed - directly at the root of `huggingface_hub`. - - Args: - endpoint (`str`, *optional*): - Hugging Face Hub base url. Will default to https://huggingface.co/. Otherwise, - one can set the `HF_ENDPOINT` environment variable. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if - not provided. - library_name (`str`, *optional*): - The name of the library that is making the HTTP request. Will be added to - the user-agent header. Example: `"transformers"`. - library_version (`str`, *optional*): - The version of the library that is making the HTTP request. Will be added - to the user-agent header. Example: `"4.24.0"`. - user_agent (`str`, `dict`, *optional*): - The user agent info in the form of a dictionary or a single string. It will - be completed with information about the installed packages. - """ - self.endpoint = endpoint if endpoint is not None else ENDPOINT - self.token = token - self.library_name = library_name - self.library_version = library_version - self.user_agent = user_agent - self._thread_pool: Optional[ThreadPoolExecutor] = None - - def run_as_future(self, fn: Callable[..., R], *args, **kwargs) -> Future[R]: - """ - Run a method in the background and return a Future instance. - - The main goal is to run methods without blocking the main thread (e.g. to push data during a training). - Background jobs are queued to preserve order but are not ran in parallel. If you need to speed-up your scripts - by parallelizing lots of call to the API, you must setup and use your own [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor). - - Note: Most-used methods like [`upload_file`], [`upload_folder`] and [`create_commit`] have a `run_as_future: bool` - argument to directly call them in the background. This is equivalent to calling `api.run_as_future(...)` on them - but less verbose. - - Args: - fn (`Callable`): - The method to run in the background. - *args, **kwargs: - Arguments with which the method will be called. - - Return: - `Future`: a [Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) instance to - get the result of the task. - - Example: - ```py - >>> from huggingface_hub import HfApi - >>> api = HfApi() - >>> future = api.run_as_future(api.whoami) # instant - >>> future.done() - False - >>> future.result() # wait until complete and return result - (...) - >>> future.done() - True - ``` - """ - if self._thread_pool is None: - self._thread_pool = ThreadPoolExecutor(max_workers=1) - self._thread_pool - return self._thread_pool.submit(fn, *args, **kwargs) - - @validate_hf_hub_args - def whoami(self, token: Optional[str] = None) -> Dict: - """ - Call HF API to know "whoami". - - Args: - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if - not provided. - """ - r = get_session().get( - f"{self.endpoint}/api/whoami-v2", - headers=self._build_hf_headers( - # If `token` is provided and not `None`, it will be used by default. - # Otherwise, the token must be retrieved from cache or env variable. - token=(token or self.token or True), - ), - ) - try: - hf_raise_for_status(r) - except HTTPError as e: - raise HTTPError( - "Invalid user token. If you didn't pass a user token, make sure you " - "are properly logged in by executing `huggingface-cli login`, and " - "if you did pass a user token, double-check it's correct.", - request=e.request, - response=e.response, - ) from e - return r.json() - - def get_token_permission(self, token: Optional[str] = None) -> Literal["read", "write", None]: - """ - Check if a given `token` is valid and return its permissions. - - For more details about tokens, please refer to https://huggingface.co/docs/hub/security-tokens#what-are-user-access-tokens. - - Args: - token (`str`, *optional*): - The token to check for validity. Defaults to the one saved locally. - - Returns: - `Literal["read", "write", None]`: Permission granted by the token ("read" or "write"). Returns `None` if no - token passed or token is invalid. - """ - try: - return self.whoami(token=token)["auth"]["accessToken"]["role"] - except (LocalTokenNotFoundError, HTTPError): - return None - - def get_model_tags(self) -> ModelTags: - """ - List all valid model tags as a nested namespace object - """ - path = f"{self.endpoint}/api/models-tags-by-type" - r = get_session().get(path) - hf_raise_for_status(r) - d = r.json() - return ModelTags(d) - - def get_dataset_tags(self) -> DatasetTags: - """ - List all valid dataset tags as a nested namespace object. - """ - path = f"{self.endpoint}/api/datasets-tags-by-type" - r = get_session().get(path) - hf_raise_for_status(r) - d = r.json() - return DatasetTags(d) - - @validate_hf_hub_args - def list_models( - self, - *, - filter: Union[ModelFilter, str, Iterable[str], None] = None, - author: Optional[str] = None, - search: Optional[str] = None, - emissions_thresholds: Optional[Tuple[float, float]] = None, - sort: Union[Literal["lastModified"], str, None] = None, - direction: Optional[Literal[-1]] = None, - limit: Optional[int] = None, - full: Optional[bool] = None, - cardData: bool = False, - fetch_config: bool = False, - token: Optional[Union[bool, str]] = None, - ) -> Iterable[ModelInfo]: - """ - List models hosted on the Huggingface Hub, given some filters. - - Args: - filter ([`ModelFilter`] or `str` or `Iterable`, *optional*): - A string or [`ModelFilter`] which can be used to identify models - on the Hub. - author (`str`, *optional*): - A string which identify the author (user or organization) of the - returned models - search (`str`, *optional*): - A string that will be contained in the returned model ids. - emissions_thresholds (`Tuple`, *optional*): - A tuple of two ints or floats representing a minimum and maximum - carbon footprint to filter the resulting models with in grams. - sort (`Literal["lastModified"]` or `str`, *optional*): - The key with which to sort the resulting models. Possible values - are the properties of the [`huggingface_hub.hf_api.ModelInfo`] class. - direction (`Literal[-1]` or `int`, *optional*): - Direction in which to sort. The value `-1` sorts by descending - order while all other values sort by ascending order. - limit (`int`, *optional*): - The limit on the number of models fetched. Leaving this option - to `None` fetches all models. - full (`bool`, *optional*): - Whether to fetch all model data, including the `lastModified`, - the `sha`, the files and the `tags`. This is set to `True` by - default when using a filter. - cardData (`bool`, *optional*): - Whether to grab the metadata for the model as well. Can contain - useful information such as carbon emissions, metrics, and - datasets trained on. - fetch_config (`bool`, *optional*): - Whether to fetch the model configs as well. This is not included - in `full` due to its size. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - `Iterable[ModelInfo]`: an iterable of [`huggingface_hub.hf_api.ModelInfo`] objects. - - Example usage with the `filter` argument: - - ```python - >>> from huggingface_hub import HfApi - - >>> api = HfApi() - - >>> # List all models - >>> api.list_models() - - >>> # Get all valid search arguments - >>> args = ModelSearchArguments() - - >>> # List only the text classification models - >>> api.list_models(filter="text-classification") - >>> # Using the `ModelFilter` - >>> filt = ModelFilter(task="text-classification") - >>> # With `ModelSearchArguments` - >>> filt = ModelFilter(task=args.pipeline_tags.TextClassification) - >>> api.list_models(filter=filt) - - >>> # Using `ModelFilter` and `ModelSearchArguments` to find text classification in both PyTorch and TensorFlow - >>> filt = ModelFilter( - ... task=args.pipeline_tags.TextClassification, - ... library=[args.library.PyTorch, args.library.TensorFlow], - ... ) - >>> api.list_models(filter=filt) - - >>> # List only models from the AllenNLP library - >>> api.list_models(filter="allennlp") - >>> # Using `ModelFilter` and `ModelSearchArguments` - >>> filt = ModelFilter(library=args.library.allennlp) - ``` - - Example usage with the `search` argument: - - ```python - >>> from huggingface_hub import HfApi - - >>> api = HfApi() - - >>> # List all models with "bert" in their name - >>> api.list_models(search="bert") - - >>> # List all models with "bert" in their name made by google - >>> api.list_models(search="bert", author="google") - ``` - """ - if emissions_thresholds is not None and cardData is None: - raise ValueError("`emissions_thresholds` were passed without setting `cardData=True`.") - - path = f"{self.endpoint}/api/models" - headers = self._build_hf_headers(token=token) - params = {} - if filter is not None: - if isinstance(filter, ModelFilter): - params = self._unpack_model_filter(filter) - else: - params.update({"filter": filter}) - params.update({"full": True}) - if author is not None: - params.update({"author": author}) - if search is not None: - params.update({"search": search}) - if sort is not None: - params.update({"sort": sort}) - if direction is not None: - params.update({"direction": direction}) - if limit is not None: - params.update({"limit": limit}) - if full is not None: - if full: - params.update({"full": True}) - elif "full" in params: - del params["full"] - if fetch_config: - params.update({"config": True}) - if cardData: - params.update({"cardData": True}) - - # `items` is a generator - items = paginate(path, params=params, headers=headers) - if limit is not None: - items = islice(items, limit) # Do not iterate over all pages - if emissions_thresholds is not None: - items = _filter_emissions(items, *emissions_thresholds) - for item in items: - yield ModelInfo(**item) - - def _unpack_model_filter(self, model_filter: ModelFilter): - """ - Unpacks a [`ModelFilter`] into something readable for `list_models` - """ - model_str = "" - - # Handling author - if model_filter.author is not None: - model_str = f"{model_filter.author}/" - - # Handling model_name - if model_filter.model_name is not None: - model_str += model_filter.model_name - - filter_list: List[str] = [] - - # Handling tasks - if model_filter.task is not None: - filter_list.extend([model_filter.task] if isinstance(model_filter.task, str) else model_filter.task) - - # Handling dataset - if model_filter.trained_dataset is not None: - if not isinstance(model_filter.trained_dataset, (list, tuple)): - model_filter.trained_dataset = [model_filter.trained_dataset] - for dataset in model_filter.trained_dataset: - if "dataset:" not in dataset: - dataset = f"dataset:{dataset}" - filter_list.append(dataset) - - # Handling library - if model_filter.library: - filter_list.extend( - [model_filter.library] if isinstance(model_filter.library, str) else model_filter.library - ) - - # Handling tags - if model_filter.tags: - filter_list.extend([model_filter.tags] if isinstance(model_filter.tags, str) else model_filter.tags) - - query_dict: Dict[str, Any] = {} - if model_str is not None: - query_dict["search"] = model_str - if isinstance(model_filter.language, list): - filter_list.extend(model_filter.language) - elif isinstance(model_filter.language, str): - filter_list.append(model_filter.language) - query_dict["filter"] = tuple(filter_list) - return query_dict - - @validate_hf_hub_args - def list_datasets( - self, - *, - filter: Union[DatasetFilter, str, Iterable[str], None] = None, - author: Optional[str] = None, - search: Optional[str] = None, - sort: Union[Literal["lastModified"], str, None] = None, - direction: Optional[Literal[-1]] = None, - limit: Optional[int] = None, - full: Optional[bool] = None, - token: Optional[str] = None, - ) -> Iterable[DatasetInfo]: - """ - List datasets hosted on the Huggingface Hub, given some filters. - - Args: - filter ([`DatasetFilter`] or `str` or `Iterable`, *optional*): - A string or [`DatasetFilter`] which can be used to identify - datasets on the hub. - author (`str`, *optional*): - A string which identify the author of the returned datasets. - search (`str`, *optional*): - A string that will be contained in the returned datasets. - sort (`Literal["lastModified"]` or `str`, *optional*): - The key with which to sort the resulting datasets. Possible - values are the properties of the [`huggingface_hub.hf_api.DatasetInfo`] class. - direction (`Literal[-1]` or `int`, *optional*): - Direction in which to sort. The value `-1` sorts by descending - order while all other values sort by ascending order. - limit (`int`, *optional*): - The limit on the number of datasets fetched. Leaving this option - to `None` fetches all datasets. - full (`bool`, *optional*): - Whether to fetch all dataset data, including the `lastModified` - and the `cardData`. Can contain useful information such as the - PapersWithCode ID. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - `Iterable[DatasetInfo]`: an iterable of [`huggingface_hub.hf_api.DatasetInfo`] objects. - - Example usage with the `filter` argument: - - ```python - >>> from huggingface_hub import HfApi - - >>> api = HfApi() - - >>> # List all datasets - >>> api.list_datasets() - - >>> # Get all valid search arguments - >>> args = DatasetSearchArguments() - - >>> # List only the text classification datasets - >>> api.list_datasets(filter="task_categories:text-classification") - >>> # Using the `DatasetFilter` - >>> filt = DatasetFilter(task_categories="text-classification") - >>> # With `DatasetSearchArguments` - >>> filt = DatasetFilter(task=args.task_categories.text_classification) - >>> api.list_models(filter=filt) - - >>> # List only the datasets in russian for language modeling - >>> api.list_datasets( - ... filter=("language:ru", "task_ids:language-modeling") - ... ) - >>> # Using the `DatasetFilter` - >>> filt = DatasetFilter(language="ru", task_ids="language-modeling") - >>> # With `DatasetSearchArguments` - >>> filt = DatasetFilter( - ... language=args.language.ru, - ... task_ids=args.task_ids.language_modeling, - ... ) - >>> api.list_datasets(filter=filt) - ``` - - Example usage with the `search` argument: - - ```python - >>> from huggingface_hub import HfApi - - >>> api = HfApi() - - >>> # List all datasets with "text" in their name - >>> api.list_datasets(search="text") - - >>> # List all datasets with "text" in their name made by google - >>> api.list_datasets(search="text", author="google") - ``` - """ - path = f"{self.endpoint}/api/datasets" - headers = self._build_hf_headers(token=token) - params = {} - if filter is not None: - if isinstance(filter, DatasetFilter): - params = self._unpack_dataset_filter(filter) - else: - params.update({"filter": filter}) - if author is not None: - params.update({"author": author}) - if search is not None: - params.update({"search": search}) - if sort is not None: - params.update({"sort": sort}) - if direction is not None: - params.update({"direction": direction}) - if limit is not None: - params.update({"limit": limit}) - if full: - params.update({"full": True}) - - items = paginate(path, params=params, headers=headers) - if limit is not None: - items = islice(items, limit) # Do not iterate over all pages - for item in items: - yield DatasetInfo(**item) - - def _unpack_dataset_filter(self, dataset_filter: DatasetFilter): - """ - Unpacks a [`DatasetFilter`] into something readable for `list_datasets` - """ - dataset_str = "" - - # Handling author - if dataset_filter.author is not None: - dataset_str = f"{dataset_filter.author}/" - - # Handling dataset_name - if dataset_filter.dataset_name is not None: - dataset_str += dataset_filter.dataset_name - - filter_list = [] - data_attributes = [ - "benchmark", - "language_creators", - "language", - "multilinguality", - "size_categories", - "task_categories", - "task_ids", - ] - - for attr in data_attributes: - curr_attr = getattr(dataset_filter, attr) - if curr_attr is not None: - if not isinstance(curr_attr, (list, tuple)): - curr_attr = [curr_attr] - for data in curr_attr: - if f"{attr}:" not in data: - data = f"{attr}:{data}" - filter_list.append(data) - - query_dict: Dict[str, Any] = {} - if dataset_str is not None: - query_dict["search"] = dataset_str - query_dict["filter"] = tuple(filter_list) - return query_dict - - def list_metrics(self) -> List[MetricInfo]: - """ - Get the public list of all the metrics on huggingface.co - - Returns: - `List[MetricInfo]`: a list of [`MetricInfo`] objects which. - """ - path = f"{self.endpoint}/api/metrics" - r = get_session().get(path) - hf_raise_for_status(r) - d = r.json() - return [MetricInfo(**x) for x in d] - - @validate_hf_hub_args - def list_spaces( - self, - *, - filter: Union[str, Iterable[str], None] = None, - author: Optional[str] = None, - search: Optional[str] = None, - sort: Union[Literal["lastModified"], str, None] = None, - direction: Optional[Literal[-1]] = None, - limit: Optional[int] = None, - datasets: Union[str, Iterable[str], None] = None, - models: Union[str, Iterable[str], None] = None, - linked: bool = False, - full: Optional[bool] = None, - token: Optional[str] = None, - ) -> Iterable[SpaceInfo]: - """ - List spaces hosted on the Huggingface Hub, given some filters. - - Args: - filter (`str` or `Iterable`, *optional*): - A string tag or list of tags that can be used to identify Spaces on the Hub. - author (`str`, *optional*): - A string which identify the author of the returned Spaces. - search (`str`, *optional*): - A string that will be contained in the returned Spaces. - sort (`Literal["lastModified"]` or `str`, *optional*): - The key with which to sort the resulting Spaces. Possible - values are the properties of the [`huggingface_hub.hf_api.SpaceInfo`]` class. - direction (`Literal[-1]` or `int`, *optional*): - Direction in which to sort. The value `-1` sorts by descending - order while all other values sort by ascending order. - limit (`int`, *optional*): - The limit on the number of Spaces fetched. Leaving this option - to `None` fetches all Spaces. - datasets (`str` or `Iterable`, *optional*): - Whether to return Spaces that make use of a dataset. - The name of a specific dataset can be passed as a string. - models (`str` or `Iterable`, *optional*): - Whether to return Spaces that make use of a model. - The name of a specific model can be passed as a string. - linked (`bool`, *optional*): - Whether to return Spaces that make use of either a model or a dataset. - full (`bool`, *optional*): - Whether to fetch all Spaces data, including the `lastModified` - and the `cardData`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - `Iterable[SpaceInfo]`: an iterable of [`huggingface_hub.hf_api.SpaceInfo`] objects. - """ - path = f"{self.endpoint}/api/spaces" - headers = self._build_hf_headers(token=token) - params: Dict[str, Any] = {} - if filter is not None: - params.update({"filter": filter}) - if author is not None: - params.update({"author": author}) - if search is not None: - params.update({"search": search}) - if sort is not None: - params.update({"sort": sort}) - if direction is not None: - params.update({"direction": direction}) - if limit is not None: - params.update({"limit": limit}) - if full: - params.update({"full": True}) - if linked: - params.update({"linked": True}) - if datasets is not None: - params.update({"datasets": datasets}) - if models is not None: - params.update({"models": models}) - - items = paginate(path, params=params, headers=headers) - if limit is not None: - items = islice(items, limit) # Do not iterate over all pages - for item in items: - yield SpaceInfo(**item) - - @validate_hf_hub_args - def like( - self, - repo_id: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> None: - """ - Like a given repo on the Hub (e.g. set as favorite). - - See also [`unlike`] and [`list_liked_repos`]. - - Args: - repo_id (`str`): - The repository to like. Example: `"user/my-cool-model"`. - - token (`str`, *optional*): - Authentication token. Will default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if liking a dataset or space, `None` or - `"model"` if liking a model. Default is `None`. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private - but not authenticated or repo does not exist. - - Example: - ```python - >>> from huggingface_hub import like, list_liked_repos, unlike - >>> like("gpt2") - >>> "gpt2" in list_liked_repos().models - True - >>> unlike("gpt2") - >>> "gpt2" in list_liked_repos().models - False - ``` - """ - if repo_type is None: - repo_type = REPO_TYPE_MODEL - response = get_session().post( - url=f"{self.endpoint}/api/{repo_type}s/{repo_id}/like", - headers=self._build_hf_headers(token=token), - ) - hf_raise_for_status(response) - - @validate_hf_hub_args - def unlike( - self, - repo_id: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> None: - """ - Unlike a given repo on the Hub (e.g. remove from favorite list). - - See also [`like`] and [`list_liked_repos`]. - - Args: - repo_id (`str`): - The repository to unlike. Example: `"user/my-cool-model"`. - - token (`str`, *optional*): - Authentication token. Will default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if unliking a dataset or space, `None` or - `"model"` if unliking a model. Default is `None`. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private - but not authenticated or repo does not exist. - - Example: - ```python - >>> from huggingface_hub import like, list_liked_repos, unlike - >>> like("gpt2") - >>> "gpt2" in list_liked_repos().models - True - >>> unlike("gpt2") - >>> "gpt2" in list_liked_repos().models - False - ``` - """ - if repo_type is None: - repo_type = REPO_TYPE_MODEL - response = get_session().delete( - url=f"{self.endpoint}/api/{repo_type}s/{repo_id}/like", headers=self._build_hf_headers(token=token) - ) - hf_raise_for_status(response) - - @validate_hf_hub_args - def list_liked_repos( - self, - user: Optional[str] = None, - *, - token: Optional[str] = None, - ) -> UserLikes: - """ - List all public repos liked by a user on huggingface.co. - - This list is public so token is optional. If `user` is not passed, it defaults to - the logged in user. - - See also [`like`] and [`unlike`]. - - Args: - user (`str`, *optional*): - Name of the user for which you want to fetch the likes. - token (`str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - Used only if `user` is not passed to implicitly determine the current - user name. - - Returns: - [`UserLikes`]: object containing the user name and 3 lists of repo ids (1 for - models, 1 for datasets and 1 for Spaces). - - Raises: - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If `user` is not passed and no token found (either from argument or from machine). - - Example: - ```python - >>> from huggingface_hub import list_liked_repos - - >>> likes = list_liked_repos("julien-c") - - >>> likes.user - "julien-c" - - >>> likes.models - ["osanseviero/streamlit_1.15", "Xhaheen/ChatGPT_HF", ...] - ``` - """ - # User is either provided explicitly or retrieved from current token. - if user is None: - me = self.whoami(token=token) - if me["type"] == "user": - user = me["name"] - else: - raise ValueError( - "Cannot list liked repos. You must provide a 'user' as input or be logged in as a user." - ) - - path = f"{self.endpoint}/api/users/{user}/likes" - headers = self._build_hf_headers(token=token) - - likes = list(paginate(path, params={}, headers=headers)) - # Looping over a list of items similar to: - # { - # 'createdAt': '2021-09-09T21:53:27.000Z', - # 'repo': { - # 'name': 'PaddlePaddle/PaddleOCR', - # 'type': 'space' - # } - # } - # Let's loop 3 times over the received list. Less efficient but more straightforward to read. - return UserLikes( - user=user, - total=len(likes), - models=[like["repo"]["name"] for like in likes if like["repo"]["type"] == "model"], - datasets=[like["repo"]["name"] for like in likes if like["repo"]["type"] == "dataset"], - spaces=[like["repo"]["name"] for like in likes if like["repo"]["type"] == "space"], - ) - - @validate_hf_hub_args - def list_repo_likers( - self, - repo_id: str, - *, - repo_type: Optional[str] = None, - token: Optional[str] = None, - ) -> List[User]: - """ - List all users who liked a given repo on the hugging Face Hub. - - See also [`like`] and [`list_liked_repos`]. - - Args: - repo_id (`str`): - The repository to retrieve . Example: `"user/my-cool-model"`. - - token (`str`, *optional*): - Authentication token. Will default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - - Returns: - `List[User]`: a list of [`User`] objects. - """ - - # Construct the API endpoint - if repo_type is None: - repo_type = REPO_TYPE_MODEL - path = f"{self.endpoint}/api/{repo_type}s/{repo_id}/likers" - headers = self._build_hf_headers(token=token) - - # Make the request - response = get_session().get(path, headers=headers) - hf_raise_for_status(response) - - # Parse the results into User objects - likers_data = response.json() - return [ - User( - username=user_data["user"], - fullname=user_data["fullname"], - avatar_url=user_data["avatarUrl"], - ) - for user_data in likers_data - ] - - @validate_hf_hub_args - def model_info( - self, - repo_id: str, - *, - revision: Optional[str] = None, - timeout: Optional[float] = None, - securityStatus: Optional[bool] = None, - files_metadata: bool = False, - token: Optional[Union[bool, str]] = None, - ) -> ModelInfo: - """ - Get info on one specific model on huggingface.co - - Model can be private if you pass an acceptable token or are logged in. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - revision (`str`, *optional*): - The revision of the model repository from which to get the - information. - timeout (`float`, *optional*): - Whether to set a timeout for the request to the Hub. - securityStatus (`bool`, *optional*): - Whether to retrieve the security status from the model - repository as well. - files_metadata (`bool`, *optional*): - Whether or not to retrieve metadata for files in the repository - (size, LFS metadata, etc). Defaults to `False`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - [`huggingface_hub.hf_api.ModelInfo`]: The model repository information. - - - - Raises the following errors: - - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - - """ - headers = self._build_hf_headers(token=token) - path = ( - f"{self.endpoint}/api/models/{repo_id}" - if revision is None - else (f"{self.endpoint}/api/models/{repo_id}/revision/{quote(revision, safe='')}") - ) - params = {} - if securityStatus: - params["securityStatus"] = True - if files_metadata: - params["blobs"] = True - r = get_session().get(path, headers=headers, timeout=timeout, params=params) - hf_raise_for_status(r) - d = r.json() - return ModelInfo(**d) - - @validate_hf_hub_args - def dataset_info( - self, - repo_id: str, - *, - revision: Optional[str] = None, - timeout: Optional[float] = None, - files_metadata: bool = False, - token: Optional[Union[bool, str]] = None, - ) -> DatasetInfo: - """ - Get info on one specific dataset on huggingface.co. - - Dataset can be private if you pass an acceptable token. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - revision (`str`, *optional*): - The revision of the dataset repository from which to get the - information. - timeout (`float`, *optional*): - Whether to set a timeout for the request to the Hub. - files_metadata (`bool`, *optional*): - Whether or not to retrieve metadata for files in the repository - (size, LFS metadata, etc). Defaults to `False`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - [`hf_api.DatasetInfo`]: The dataset repository information. - - - - Raises the following errors: - - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - - """ - headers = self._build_hf_headers(token=token) - path = ( - f"{self.endpoint}/api/datasets/{repo_id}" - if revision is None - else (f"{self.endpoint}/api/datasets/{repo_id}/revision/{quote(revision, safe='')}") - ) - params = {} - if files_metadata: - params["blobs"] = True - - r = get_session().get(path, headers=headers, timeout=timeout, params=params) - hf_raise_for_status(r) - d = r.json() - return DatasetInfo(**d) - - @validate_hf_hub_args - def space_info( - self, - repo_id: str, - *, - revision: Optional[str] = None, - timeout: Optional[float] = None, - files_metadata: bool = False, - token: Optional[Union[bool, str]] = None, - ) -> SpaceInfo: - """ - Get info on one specific Space on huggingface.co. - - Space can be private if you pass an acceptable token. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - revision (`str`, *optional*): - The revision of the space repository from which to get the - information. - timeout (`float`, *optional*): - Whether to set a timeout for the request to the Hub. - files_metadata (`bool`, *optional*): - Whether or not to retrieve metadata for files in the repository - (size, LFS metadata, etc). Defaults to `False`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - [`~hf_api.SpaceInfo`]: The space repository information. - - - - Raises the following errors: - - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - - """ - headers = self._build_hf_headers(token=token) - path = ( - f"{self.endpoint}/api/spaces/{repo_id}" - if revision is None - else (f"{self.endpoint}/api/spaces/{repo_id}/revision/{quote(revision, safe='')}") - ) - params = {} - if files_metadata: - params["blobs"] = True - - r = get_session().get(path, headers=headers, timeout=timeout, params=params) - hf_raise_for_status(r) - d = r.json() - return SpaceInfo(**d) - - @validate_hf_hub_args - def repo_info( - self, - repo_id: str, - *, - revision: Optional[str] = None, - repo_type: Optional[str] = None, - timeout: Optional[float] = None, - files_metadata: bool = False, - token: Optional[Union[bool, str]] = None, - ) -> Union[ModelInfo, DatasetInfo, SpaceInfo]: - """ - Get the info object for a given repo of a given type. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - revision (`str`, *optional*): - The revision of the repository from which to get the - information. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if getting repository info from a dataset or a space, - `None` or `"model"` if getting repository info from a model. Default is `None`. - timeout (`float`, *optional*): - Whether to set a timeout for the request to the Hub. - files_metadata (`bool`, *optional*): - Whether or not to retrieve metadata for files in the repository - (size, LFS metadata, etc). Defaults to `False`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - `Union[SpaceInfo, DatasetInfo, ModelInfo]`: The repository information, as a - [`huggingface_hub.hf_api.DatasetInfo`], [`huggingface_hub.hf_api.ModelInfo`] - or [`huggingface_hub.hf_api.SpaceInfo`] object. - - - - Raises the following errors: - - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - - """ - if repo_type is None or repo_type == "model": - method = self.model_info - elif repo_type == "dataset": - method = self.dataset_info # type: ignore - elif repo_type == "space": - method = self.space_info # type: ignore - else: - raise ValueError("Unsupported repo type.") - return method( - repo_id, - revision=revision, - token=token, - timeout=timeout, - files_metadata=files_metadata, - ) - - @validate_hf_hub_args - def repo_exists( - self, - repo_id: str, - *, - repo_type: Optional[str] = None, - token: Optional[str] = None, - ) -> bool: - """ - Checks if a repository exists on the Hugging Face Hub. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if getting repository info from a dataset or a space, - `None` or `"model"` if getting repository info from a model. Default is `None`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - True if the repository exists, False otherwise. - - - - Examples: - ```py - >>> from huggingface_hub import repo_exists - >>> repo_exists("huggingface/transformers") - True - >>> repo_exists("huggingface/not-a-repo") - False - ``` - - - """ - try: - self.repo_info(repo_id=repo_id, repo_type=repo_type, token=token) - return True - except RepositoryNotFoundError: - return False - - @validate_hf_hub_args - def file_exists( - self, - repo_id: str, - filename: str, - *, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - token: Optional[str] = None, - ) -> bool: - """ - Checks if a file exists in a repository on the Hugging Face Hub. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - filename (`str`): - The name of the file to check, for example: - `"config.json"` - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if getting repository info from a dataset or a space, - `None` or `"model"` if getting repository info from a model. Default is `None`. - revision (`str`, *optional*): - The revision of the repository from which to get the information. Defaults to `"main"` branch. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - True if the file exists, False otherwise. - - - - Examples: - ```py - >>> from huggingface_hub import file_exists - >>> file_exists("bigcode/starcoder", "config.json") - True - >>> file_exists("bigcode/starcoder", "not-a-file") - False - >>> file_exists("bigcode/not-a-repo", "config.json") - False - ``` - - - """ - url = hf_hub_url(repo_id=repo_id, repo_type=repo_type, revision=revision, filename=filename) - try: - if token is None: - token = self.token - get_hf_file_metadata(url, token=token) - return True - except (RepositoryNotFoundError, EntryNotFoundError, RevisionNotFoundError): - return False - - @validate_hf_hub_args - def list_files_info( - self, - repo_id: str, - paths: Union[List[str], str, None] = None, - *, - expand: bool = False, - revision: Optional[str] = None, - repo_type: Optional[str] = None, - token: Optional[Union[bool, str]] = None, - ) -> Iterable[RepoFile]: - """ - List files on a repo and get information about them. - - Takes as input a list of paths. Those paths can be either files or folders. Two server endpoints are called: - 1. POST "/paths-info" to get information about the provided paths. Called once. - 2. GET "/tree?recursive=True" to paginate over the input folders. Called only if a folder path is provided as - input. Will be called multiple times to follow pagination. - If no path is provided as input, step 1. is ignored and all files from the repo are listed. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated by a `/`. - paths (`Union[List[str], str, None]`, *optional*): - The paths to get information about. Paths to files are directly resolved. Paths to folders are resolved - recursively which means that information is returned about all files in the folder and its subfolders. - If `None`, all files are returned (the default). If a path do not exist, it is ignored without raising - an exception. - expand (`bool`, *optional*, defaults to `False`): - Whether to fetch more information about the files (e.g. last commit and security scan results). This - operation is more expensive for the server so only 50 results are returned per page (instead of 1000). - As pagination is implemented in `huggingface_hub`, this is transparent for you except for the time it - takes to get the results. - revision (`str`, *optional*): - The revision of the repository from which to get the information. Defaults to `"main"` branch. - repo_type (`str`, *optional*): - The type of the repository from which to get the information (`"model"`, `"dataset"` or `"space"`. - Defaults to `"model"`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). If `None` or `True` and - machine is logged in (through `huggingface-cli login` or [`~huggingface_hub.login`]), token will be - retrieved from the cache. If `False`, token is not sent in the request header. - - Returns: - `Iterable[RepoFile]`: - The information about the files, as an iterable of [`RepoFile`] objects. The order of the files is - not guaranteed. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private but not authenticated or repo - does not exist. - [`~utils.RevisionNotFoundError`]: - If revision is not found (error 404) on the repo. - - Examples: - - Get information about files on a repo. - ```py - >>> from huggingface_hub import list_files_info - >>> files_info = list_files_info("lysandre/arxiv-nlp", ["README.md", "config.json"]) - >>> files_info - - >>> list(files_info) - [ - RepoFile: {"blob_id": "43bd404b159de6fba7c2f4d3264347668d43af25", "lfs": None, "rfilename": "README.md", "size": 391}, - RepoFile: {"blob_id": "2f9618c3a19b9a61add74f70bfb121335aeef666", "lfs": None, "rfilename": "config.json", "size": 554}, - ] - ``` - - Get even more information about files on a repo (last commit and security scan results) - ```py - >>> from huggingface_hub import list_files_info - >>> files_info = list_files_info("prompthero/openjourney-v4", expand=True) - >>> list(files_info) - [ - RepoFile: { - {'blob_id': '815004af1a321eaed1d93f850b2e94b0c0678e42', - 'lastCommit': {'date': '2023-03-21T09:05:27.000Z', - 'id': '47b62b20b20e06b9de610e840282b7e6c3d51190', - 'title': 'Upload diffusers weights (#48)'}, - 'lfs': None, - 'rfilename': 'model_index.json', - 'security': {'avScan': {'virusFound': False, 'virusNames': None}, - 'blobId': '815004af1a321eaed1d93f850b2e94b0c0678e42', - 'name': 'model_index.json', - 'pickleImportScan': None, - 'repositoryId': 'models/prompthero/openjourney-v4', - 'safe': True}, - 'size': 584} - }, - RepoFile: { - {'blob_id': 'd2343d78b33ac03dade1d525538b02b130d0a3a0', - 'lastCommit': {'date': '2023-03-21T09:05:27.000Z', - 'id': '47b62b20b20e06b9de610e840282b7e6c3d51190', - 'title': 'Upload diffusers weights (#48)'}, - 'lfs': {'pointer_size': 134, - 'sha256': 'dcf4507d99b88db73f3916e2a20169fe74ada6b5582e9af56cfa80f5f3141765', - 'size': 334711857}, - 'rfilename': 'vae/diffusion_pytorch_model.bin', - 'security': {'avScan': {'virusFound': False, 'virusNames': None}, - 'blobId': 'd2343d78b33ac03dade1d525538b02b130d0a3a0', - 'name': 'vae/diffusion_pytorch_model.bin', - 'pickleImportScan': {'highestSafetyLevel': 'innocuous', - 'imports': [{'module': 'torch._utils', - 'name': '_rebuild_tensor_v2', - 'safety': 'innocuous'}, - {'module': 'collections', 'name': 'OrderedDict', 'safety': 'innocuous'}, - {'module': 'torch', 'name': 'FloatStorage', 'safety': 'innocuous'}]}, - 'repositoryId': 'models/prompthero/openjourney-v4', - 'safe': True}, - 'size': 334711857} - }, - (...) - ] - ``` - - List LFS files from the "vae/" folder in "stabilityai/stable-diffusion-2" repository. - - ```py - >>> from huggingface_hub import list_files_info - >>> [info.rfilename for info in list_files_info("stabilityai/stable-diffusion-2", "vae") if info.lfs is not None] - ['vae/diffusion_pytorch_model.bin', 'vae/diffusion_pytorch_model.safetensors'] - ``` - - List all files on a repo. - ```py - >>> from huggingface_hub import list_files_info - >>> [info.rfilename for info in list_files_info("glue", repo_type="dataset")] - ['.gitattributes', 'README.md', 'dataset_infos.json', 'glue.py'] - ``` - """ - repo_type = repo_type or REPO_TYPE_MODEL - revision = quote(revision, safe="") if revision is not None else DEFAULT_REVISION - headers = self._build_hf_headers(token=token) - - def _format_as_repo_file(info: Dict) -> RepoFile: - # Quick alias very specific to the server return type of /paths-info and /tree endpoints. Let's keep this - # logic here. - rfilename = info.pop("path") - size = info.pop("size") - blobId = info.pop("oid") - lfs = info.pop("lfs", None) - info.pop("type", None) # "file" or "folder" -> not needed in practice since we know it's a file - if lfs is not None: - lfs = BlobLfsInfo(size=lfs["size"], sha256=lfs["oid"], pointer_size=lfs["pointerSize"]) - return RepoFile(rfilename=rfilename, size=size, blobId=blobId, lfs=lfs, **info) - - folder_paths = [] - if paths is None: - # `paths` is not provided => list all files from the repo - folder_paths.append("") - elif paths == []: - # corner case: server would return a 400 error if `paths` is an empty list. Let's return early. - return - else: - # `paths` is provided => get info about those - response = get_session().post( - f"{self.endpoint}/api/{repo_type}s/{repo_id}/paths-info/{revision}", - data={ - "paths": paths if isinstance(paths, list) else [paths], - "expand": True, - }, - headers=headers, - ) - hf_raise_for_status(response) - paths_info = response.json() - - # List top-level files first - for path_info in paths_info: - if path_info["type"] == "file": - yield _format_as_repo_file(path_info) - else: - folder_paths.append(path_info["path"]) - - # List files in subdirectories - for path in folder_paths: - encoded_path = "/" + quote(path, safe="") if path else "" - tree_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/tree/{revision}{encoded_path}" - for subpath_info in paginate(path=tree_url, headers=headers, params={"recursive": True, "expand": expand}): - if subpath_info["type"] == "file": - yield _format_as_repo_file(subpath_info) - - @_deprecate_arguments(version="0.17", deprecated_args=["timeout"], custom_message="timeout is not used anymore.") - @validate_hf_hub_args - def list_repo_files( - self, - repo_id: str, - *, - revision: Optional[str] = None, - repo_type: Optional[str] = None, - timeout: Optional[float] = None, - token: Optional[Union[bool, str]] = None, - ) -> List[str]: - """ - Get the list of files in a given repo. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated by a `/`. - revision (`str`, *optional*): - The revision of the model repository from which to get the information. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or space, `None` or `"model"` if uploading to - a model. Default is `None`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). If `None` or `True` and - machine is logged in (through `huggingface-cli login` or [`~huggingface_hub.login`]), token will be - retrieved from the cache. If `False`, token is not sent in the request header. - - Returns: - `List[str]`: the list of files in a given repository. - """ - return [ - f.rfilename - for f in self.list_files_info( - repo_id=repo_id, paths=None, revision=revision, repo_type=repo_type, token=token - ) - ] - - @validate_hf_hub_args - def list_repo_refs( - self, - repo_id: str, - *, - repo_type: Optional[str] = None, - token: Optional[Union[bool, str]] = None, - ) -> GitRefs: - """ - Get the list of refs of a given repo (both tags and branches). - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if listing refs from a dataset or a Space, - `None` or `"model"` if listing from a model. Default is `None`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Example: - ```py - >>> from huggingface_hub import HfApi - >>> api = HfApi() - >>> api.list_repo_refs("gpt2") - GitRefs(branches=[GitRefInfo(name='main', ref='refs/heads/main', target_commit='e7da7f221d5bf496a48136c0cd264e630fe9fcc8')], converts=[], tags=[]) - - >>> api.list_repo_refs("bigcode/the-stack", repo_type='dataset') - GitRefs( - branches=[ - GitRefInfo(name='main', ref='refs/heads/main', target_commit='18edc1591d9ce72aa82f56c4431b3c969b210ae3'), - GitRefInfo(name='v1.1.a1', ref='refs/heads/v1.1.a1', target_commit='f9826b862d1567f3822d3d25649b0d6d22ace714') - ], - converts=[], - tags=[ - GitRefInfo(name='v1.0', ref='refs/tags/v1.0', target_commit='c37a8cd1e382064d8aced5e05543c5f7753834da') - ] - ) - ``` - - Returns: - [`GitRefs`]: object containing all information about branches and tags for a - repo on the Hub. - """ - repo_type = repo_type or REPO_TYPE_MODEL - response = get_session().get( - f"{self.endpoint}/api/{repo_type}s/{repo_id}/refs", headers=self._build_hf_headers(token=token) - ) - hf_raise_for_status(response) - data = response.json() - return GitRefs( - branches=[GitRefInfo(item) for item in data["branches"]], - converts=[GitRefInfo(item) for item in data["converts"]], - tags=[GitRefInfo(item) for item in data["tags"]], - ) - - @validate_hf_hub_args - def list_repo_commits( - self, - repo_id: str, - *, - repo_type: Optional[str] = None, - token: Optional[Union[bool, str]] = None, - revision: Optional[str] = None, - formatted: bool = False, - ) -> List[GitCommitInfo]: - """ - Get the list of commits of a given revision for a repo on the Hub. - - Commits are sorted by date (last commit first). - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated by a `/`. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if listing commits from a dataset or a Space, `None` or `"model"` if - listing from a model. Default is `None`. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the `"main"` branch. - formatted (`bool`): - Whether to return the HTML-formatted title and description of the commits. Defaults to False. - - Example: - ```py - >>> from huggingface_hub import HfApi - >>> api = HfApi() - - # Commits are sorted by date (last commit first) - >>> initial_commit = api.list_repo_commits("gpt2")[-1] - - # Initial commit is always a system commit containing the `.gitattributes` file. - >>> initial_commit - GitCommitInfo( - commit_id='9b865efde13a30c13e0a33e536cf3e4a5a9d71d8', - authors=['system'], - created_at=datetime.datetime(2019, 2, 18, 10, 36, 15, tzinfo=datetime.timezone.utc), - title='initial commit', - message='', - formatted_title=None, - formatted_message=None - ) - - # Create an empty branch by deriving from initial commit - >>> api.create_branch("gpt2", "new_empty_branch", revision=initial_commit.commit_id) - ``` - - Returns: - List[[`GitCommitInfo`]]: list of objects containing information about the commits for a repo on the Hub. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private but not authenticated or repo - does not exist. - [`~utils.RevisionNotFoundError`]: - If revision is not found (error 404) on the repo. - """ - repo_type = repo_type or REPO_TYPE_MODEL - revision = quote(revision, safe="") if revision is not None else DEFAULT_REVISION - - # Paginate over results and return the list of commits. - return [ - GitCommitInfo(item) - for item in paginate( - f"{self.endpoint}/api/{repo_type}s/{repo_id}/commits/{revision}", - headers=self._build_hf_headers(token=token), - params={"expand[]": "formatted"} if formatted else {}, - ) - ] - - @validate_hf_hub_args - def super_squash_history( - self, - repo_id: str, - *, - branch: Optional[str] = None, - commit_message: Optional[str] = None, - repo_type: Optional[str] = None, - token: Optional[str] = None, - ) -> None: - """Squash commit history on a branch for a repo on the Hub. - - Squashing the repo history is useful when you know you'll make hundreds of commits and you don't want to - clutter the history. Squashing commits can only be performed from the head of a branch. - - - - Once squashed, the commit history cannot be retrieved. This is a non-revertible operation. - - - - - - Once the history of a branch has been squashed, it is not possible to merge it back into another branch since - their history will have diverged. - - - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated by a `/`. - branch (`str`, *optional*): - The branch to squash. Defaults to the head of the `"main"` branch. - commit_message (`str`, *optional*): - The commit message to use for the squashed commit. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if listing commits from a dataset or a Space, `None` or `"model"` if - listing from a model. Default is `None`. - token (`str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). If the machine is logged in - (through `huggingface-cli login` or [`~huggingface_hub.login`]), token can be automatically retrieved - from the cache. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private but not authenticated or repo - does not exist. - [`~utils.RevisionNotFoundError`]: - If the branch to squash cannot be found. - [`~utils.BadRequestError`]: - If invalid reference for a branch. You cannot squash history on tags. - - Example: - ```py - >>> from huggingface_hub import HfApi - >>> api = HfApi() - - # Create repo - >>> repo_id = api.create_repo("test-squash").repo_id - - # Make a lot of commits. - >>> api.upload_file(repo_id=repo_id, path_in_repo="file.txt", path_or_fileobj=b"content") - >>> api.upload_file(repo_id=repo_id, path_in_repo="lfs.bin", path_or_fileobj=b"content") - >>> api.upload_file(repo_id=repo_id, path_in_repo="file.txt", path_or_fileobj=b"another_content") - - # Squash history - >>> api.super_squash_history(repo_id=repo_id) - ``` - """ - if repo_type is None: - repo_type = REPO_TYPE_MODEL - if repo_type not in REPO_TYPES: - raise ValueError("Invalid repo type") - if branch is None: - branch = DEFAULT_REVISION - - # Prepare request - url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/super-squash/{branch}" - headers = self._build_hf_headers(token=token, is_write_action=True) - commit_message = commit_message or f"Super-squash branch '{branch}' using huggingface_hub" - - # Super-squash - response = get_session().post(url=url, headers=headers, json={"message": commit_message}) - hf_raise_for_status(response) - - @validate_hf_hub_args - def create_repo( - self, - repo_id: str, - *, - token: Optional[str] = None, - private: bool = False, - repo_type: Optional[str] = None, - exist_ok: bool = False, - space_sdk: Optional[str] = None, - space_hardware: Optional[SpaceHardware] = None, - space_storage: Optional[SpaceStorage] = None, - space_sleep_time: Optional[int] = None, - space_secrets: Optional[List[Dict[str, str]]] = None, - space_variables: Optional[List[Dict[str, str]]] = None, - ) -> RepoUrl: - """Create an empty repo on the HuggingFace Hub. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - private (`bool`, *optional*, defaults to `False`): - Whether the model repo should be private. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - exist_ok (`bool`, *optional*, defaults to `False`): - If `True`, do not raise an error if repo already exists. - space_sdk (`str`, *optional*): - Choice of SDK to use if repo_type is "space". Can be "streamlit", "gradio", "docker", or "static". - space_hardware (`SpaceHardware` or `str`, *optional*): - Choice of Hardware if repo_type is "space". See [`SpaceHardware`] for a complete list. - space_storage (`SpaceStorage` or `str`, *optional*): - Choice of persistent storage tier. Example: `"small"`. See [`SpaceStorage`] for a complete list. - space_sleep_time (`int`, *optional*): - Number of seconds of inactivity to wait before a Space is put to sleep. Set to `-1` if you don't want - your Space to sleep (default behavior for upgraded hardware). For free hardware, you can't configure - the sleep time (value is fixed to 48 hours of inactivity). - See https://huggingface.co/docs/hub/spaces-gpus#sleep-time for more details. - space_secrets (`List[Dict[str, str]]`, *optional*): - A list of secret keys to set in your Space. Each item is in the form `{"key": ..., "value": ..., "description": ...}` where description is optional. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets. - space_variables (`List[Dict[str, str]]`, *optional*): - A list of public environment variables to set in your Space. Each item is in the form `{"key": ..., "value": ..., "description": ...}` where description is optional. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets-and-environment-variables. - - Returns: - [`RepoUrl`]: URL to the newly created repo. Value is a subclass of `str` containing - attributes like `endpoint`, `repo_type` and `repo_id`. - """ - organization, name = repo_id.split("/") if "/" in repo_id else (None, repo_id) - - path = f"{self.endpoint}/api/repos/create" - - if repo_type not in REPO_TYPES: - raise ValueError("Invalid repo type") - - json: Dict[str, Any] = {"name": name, "organization": organization, "private": private} - if repo_type is not None: - json["type"] = repo_type - if repo_type == "space": - if space_sdk is None: - raise ValueError( - "No space_sdk provided. `create_repo` expects space_sdk to be one" - f" of {SPACES_SDK_TYPES} when repo_type is 'space'`" - ) - if space_sdk not in SPACES_SDK_TYPES: - raise ValueError(f"Invalid space_sdk. Please choose one of {SPACES_SDK_TYPES}.") - json["sdk"] = space_sdk - - if space_sdk is not None and repo_type != "space": - warnings.warn("Ignoring provided space_sdk because repo_type is not 'space'.") - - function_args = [ - "space_hardware", - "space_storage", - "space_sleep_time", - "space_secrets", - "space_variables", - ] - json_keys = ["hardware", "storageTier", "sleepTimeSeconds", "secrets", "variables"] - values = [space_hardware, space_storage, space_sleep_time, space_secrets, space_variables] - - if repo_type == "space": - json.update({k: v for k, v in zip(json_keys, values) if v is not None}) - else: - provided_space_args = [key for key, value in zip(function_args, values) if value is not None] - - if provided_space_args: - warnings.warn(f"Ignoring provided {', '.join(provided_space_args)} because repo_type is not 'space'.") - - if getattr(self, "_lfsmultipartthresh", None): - # Testing purposes only. - # See https://github.com/huggingface/huggingface_hub/pull/733/files#r820604472 - json["lfsmultipartthresh"] = self._lfsmultipartthresh # type: ignore - headers = self._build_hf_headers(token=token, is_write_action=True) - - while True: - r = get_session().post(path, headers=headers, json=json) - if r.status_code == 409 and "Cannot create repo: another conflicting operation is in progress" in r.text: - # Since https://github.com/huggingface/moon-landing/pull/7272 (private repo), it is not possible to - # concurrently create repos on the Hub for a same user. This is rarely an issue, except when running - # tests. To avoid any inconvenience, we retry to create the repo for this specific error. - # NOTE: This could have being fixed directly in the tests but adding it here should fixed CIs for all - # dependent libraries. - # NOTE: If a fix is implemented server-side, we should be able to remove this retry mechanism. - logger.debug("Create repo failed due to a concurrency issue. Retrying...") - continue - break - - try: - hf_raise_for_status(r) - except HTTPError as err: - if exist_ok and err.response.status_code == 409: - # Repo already exists and `exist_ok=True` - pass - elif exist_ok and err.response.status_code == 403: - # No write permission on the namespace but repo might already exist - try: - self.repo_info(repo_id=repo_id, repo_type=repo_type, token=token) - if repo_type is None or repo_type == REPO_TYPE_MODEL: - return RepoUrl(f"{self.endpoint}/{repo_id}") - return RepoUrl(f"{self.endpoint}/{repo_type}/{repo_id}") - except HfHubHTTPError: - raise - else: - raise - - d = r.json() - return RepoUrl(d["url"], endpoint=self.endpoint) - - @validate_hf_hub_args - def delete_repo( - self, - repo_id: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - missing_ok: bool = False, - ) -> None: - """ - Delete a repo from the HuggingFace Hub. CAUTION: this is irreversible. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. - missing_ok (`bool`, *optional*, defaults to `False`): - If `True`, do not raise an error if repo does not exist. - - Raises: - - [`~utils.RepositoryNotFoundError`] - If the repository to delete from cannot be found and `missing_ok` is set to False (default). - """ - organization, name = repo_id.split("/") if "/" in repo_id else (None, repo_id) - - path = f"{self.endpoint}/api/repos/delete" - - if repo_type not in REPO_TYPES: - raise ValueError("Invalid repo type") - - json = {"name": name, "organization": organization} - if repo_type is not None: - json["type"] = repo_type - - headers = self._build_hf_headers(token=token, is_write_action=True) - r = get_session().delete(path, headers=headers, json=json) - try: - hf_raise_for_status(r) - except RepositoryNotFoundError: - if not missing_ok: - raise - - @validate_hf_hub_args - def update_repo_visibility( - self, - repo_id: str, - private: bool = False, - *, - token: Optional[str] = None, - organization: Optional[str] = None, - repo_type: Optional[str] = None, - name: Optional[str] = None, - ) -> Dict[str, bool]: - """Update the visibility setting of a repository. - - Args: - repo_id (`str`, *optional*): - A namespace (user or an organization) and a repo name separated - by a `/`. - private (`bool`, *optional*, defaults to `False`): - Whether the model repo should be private. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - - Returns: - The HTTP response in json. - - - - Raises the following errors: - - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - if repo_type not in REPO_TYPES: - raise ValueError("Invalid repo type") - - organization, name = repo_id.split("/") if "/" in repo_id else (None, repo_id) - - if organization is None: - namespace = self.whoami(token)["name"] - else: - namespace = organization - - if repo_type is None: - repo_type = REPO_TYPE_MODEL # default repo type - - r = get_session().put( - url=f"{self.endpoint}/api/{repo_type}s/{namespace}/{name}/settings", - headers=self._build_hf_headers(token=token, is_write_action=True), - json={"private": private}, - ) - hf_raise_for_status(r) - return r.json() - - def move_repo( - self, - from_id: str, - to_id: str, - *, - repo_type: Optional[str] = None, - token: Optional[str] = None, - ): - """ - Moving a repository from namespace1/repo_name1 to namespace2/repo_name2 - - Note there are certain limitations. For more information about moving - repositories, please see - https://hf.co/docs/hub/repositories-settings#renaming-or-transferring-a-repo. - - Args: - from_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. Original repository identifier. - to_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. Final repository identifier. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - - - - Raises the following errors: - - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - if len(from_id.split("/")) != 2: - raise ValueError(f"Invalid repo_id: {from_id}. It should have a namespace (:namespace:/:repo_name:)") - - if len(to_id.split("/")) != 2: - raise ValueError(f"Invalid repo_id: {to_id}. It should have a namespace (:namespace:/:repo_name:)") - - if repo_type is None: - repo_type = REPO_TYPE_MODEL # Hub won't accept `None`. - - json = {"fromRepo": from_id, "toRepo": to_id, "type": repo_type} - - path = f"{self.endpoint}/api/repos/move" - headers = self._build_hf_headers(token=token, is_write_action=True) - r = get_session().post(path, headers=headers, json=json) - try: - hf_raise_for_status(r) - except HfHubHTTPError as e: - e.append_to_message( - "\nFor additional documentation please see" - " https://hf.co/docs/hub/repositories-settings#renaming-or-transferring-a-repo." - ) - raise - - @overload - def create_commit( # type: ignore - self, - repo_id: str, - operations: Iterable[CommitOperation], - *, - commit_message: str, - commit_description: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - create_pr: Optional[bool] = None, - num_threads: int = 5, - parent_commit: Optional[str] = None, - run_as_future: Literal[False] = ..., - ) -> CommitInfo: - ... - - @overload - def create_commit( - self, - repo_id: str, - operations: Iterable[CommitOperation], - *, - commit_message: str, - commit_description: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - create_pr: Optional[bool] = None, - num_threads: int = 5, - parent_commit: Optional[str] = None, - run_as_future: Literal[True] = ..., - ) -> Future[CommitInfo]: - ... - - @validate_hf_hub_args - @future_compatible - def create_commit( - self, - repo_id: str, - operations: Iterable[CommitOperation], - *, - commit_message: str, - commit_description: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - create_pr: Optional[bool] = None, - num_threads: int = 5, - parent_commit: Optional[str] = None, - run_as_future: bool = False, - ) -> Union[CommitInfo, Future[CommitInfo]]: - """ - Creates a commit in the given repo, deleting & uploading files as needed. - - - - The input list of `CommitOperation` will be mutated during the commit process. Do not reuse the same objects - for multiple commits. - - - - - - `create_commit` assumes that the repo already exists on the Hub. If you get a - Client error 404, please make sure you are authenticated and that `repo_id` and - `repo_type` are set correctly. If repo does not exist, create it first using - [`~hf_api.create_repo`]. - - - - - - `create_commit` is limited to 25k LFS files and a 1GB payload for regular files. - - - - Args: - repo_id (`str`): - The repository in which the commit will be created, for example: - `"username/custom_transformers"` - - operations (`Iterable` of [`~hf_api.CommitOperation`]): - An iterable of operations to include in the commit, either: - - - [`~hf_api.CommitOperationAdd`] to upload a file - - [`~hf_api.CommitOperationDelete`] to delete a file - - [`~hf_api.CommitOperationCopy`] to copy a file - - Operation objects will be mutated to include information relative to the upload. Do not reuse the - same objects for multiple commits. - - commit_message (`str`): - The summary (first line) of the commit that will be created. - - commit_description (`str`, *optional*): - The description of the commit that will be created - - token (`str`, *optional*): - Authentication token, obtained with `HfApi.login` method. Will - default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the `"main"` branch. - - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request with that commit. Defaults to `False`. - If `revision` is not set, PR is opened against the `"main"` branch. If - `revision` is set and is a branch, PR is opened against this branch. If - `revision` is set and is not a branch name (example: a commit oid), an - `RevisionNotFoundError` is returned by the server. - - num_threads (`int`, *optional*): - Number of concurrent threads for uploading files. Defaults to 5. - Setting it to 2 means at most 2 files will be uploaded concurrently. - - parent_commit (`str`, *optional*): - The OID / SHA of the parent commit, as a hexadecimal string. - Shorthands (7 first characters) are also supported. If specified and `create_pr` is `False`, - the commit will fail if `revision` does not point to `parent_commit`. If specified and `create_pr` - is `True`, the pull request will be created from `parent_commit`. Specifying `parent_commit` - ensures the repo has not changed before committing the changes, and can be especially useful - if the repo is updated / committed to concurrently. - run_as_future (`bool`, *optional*): - Whether or not to run this method in the background. Background jobs are run sequentially without - blocking the main thread. Passing `run_as_future=True` will return a [Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) - object. Defaults to `False`. - - Returns: - [`CommitInfo`] or `Future`: - Instance of [`CommitInfo`] containing information about the newly created commit (commit hash, commit - url, pr url, commit message,...). If `run_as_future=True` is passed, returns a Future object which will - contain the result when executed. - - Raises: - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If commit message is empty. - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If parent commit is not a valid commit OID. - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If the Hub API returns an HTTP 400 error (bad request) - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If `create_pr` is `True` and revision is neither `None` nor `"main"`. - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private - but not authenticated or repo does not exist. - """ - if parent_commit is not None and not REGEX_COMMIT_OID.fullmatch(parent_commit): - raise ValueError( - f"`parent_commit` is not a valid commit OID. It must match the following regex: {REGEX_COMMIT_OID}" - ) - - if commit_message is None or len(commit_message) == 0: - raise ValueError("`commit_message` can't be empty, please pass a value.") - - commit_description = commit_description if commit_description is not None else "" - repo_type = repo_type if repo_type is not None else REPO_TYPE_MODEL - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") - revision = quote(revision, safe="") if revision is not None else DEFAULT_REVISION - create_pr = create_pr if create_pr is not None else False - - operations = list(operations) - additions = [op for op in operations if isinstance(op, CommitOperationAdd)] - copies = [op for op in operations if isinstance(op, CommitOperationCopy)] - nb_additions = len(additions) - nb_copies = len(copies) - nb_deletions = len(operations) - nb_additions - nb_copies - - for addition in additions: - if addition._is_committed: - raise ValueError( - f"CommitOperationAdd {addition} has already being committed and cannot be reused. Please create a" - " new CommitOperationAdd object if you want to create a new commit." - ) - - logger.debug( - f"About to commit to the hub: {len(additions)} addition(s), {len(copies)} copie(s) and" - f" {nb_deletions} deletion(s)." - ) - - # If updating twice the same file or update then delete a file in a single commit - _warn_on_overwriting_operations(operations) - - self.preupload_lfs_files( - repo_id=repo_id, - additions=additions, - token=token, - repo_type=repo_type, - revision=revision, - create_pr=create_pr, - num_threads=num_threads, - free_memory=False, # do not remove `CommitOperationAdd.path_or_fileobj` on LFS files for "normal" users - ) - files_to_copy = _fetch_lfs_files_to_copy( - copies=copies, - repo_type=repo_type, - repo_id=repo_id, - token=token or self.token, - revision=revision, - endpoint=self.endpoint, - ) - commit_payload = _prepare_commit_payload( - operations=operations, - files_to_copy=files_to_copy, - commit_message=commit_message, - commit_description=commit_description, - parent_commit=parent_commit, - ) - commit_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/commit/{revision}" - - def _payload_as_ndjson() -> Iterable[bytes]: - for item in commit_payload: - yield json.dumps(item).encode() - yield b"\n" - - headers = { - # See https://github.com/huggingface/huggingface_hub/issues/1085#issuecomment-1265208073 - "Content-Type": "application/x-ndjson", - **self._build_hf_headers(token=token, is_write_action=True), - } - data = b"".join(_payload_as_ndjson()) - params = {"create_pr": "1"} if create_pr else None - - try: - commit_resp = get_session().post(url=commit_url, headers=headers, data=data, params=params) - hf_raise_for_status(commit_resp, endpoint_name="commit") - except RepositoryNotFoundError as e: - e.append_to_message(_CREATE_COMMIT_NO_REPO_ERROR_MESSAGE) - raise - except EntryNotFoundError as e: - if nb_deletions > 0 and "A file with this name doesn't exist" in str(e): - e.append_to_message( - "\nMake sure to differentiate file and folder paths in delete" - " operations with a trailing '/' or using `is_folder=True/False`." - ) - raise - - # Mark additions as committed (cannot be reused in another commit) - for addition in additions: - addition._is_committed = True - - commit_data = commit_resp.json() - return CommitInfo( - commit_url=commit_data["commitUrl"], - commit_message=commit_message, - commit_description=commit_description, - oid=commit_data["commitOid"], - pr_url=commit_data["pullRequestUrl"] if create_pr else None, - ) - - @experimental - @validate_hf_hub_args - def create_commits_on_pr( - self, - *, - repo_id: str, - addition_commits: List[List[CommitOperationAdd]], - deletion_commits: List[List[CommitOperationDelete]], - commit_message: str, - commit_description: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - merge_pr: bool = True, - num_threads: int = 5, # TODO: use to multithread uploads - verbose: bool = False, - ) -> str: - """Push changes to the Hub in multiple commits. - - Commits are pushed to a draft PR branch. If the upload fails or gets interrupted, it can be resumed. Progress - is tracked in the PR description. At the end of the process, the PR is set as open and the title is updated to - match the initial commit message. If `merge_pr=True` is passed, the PR is merged automatically. - - All deletion commits are pushed first, followed by the addition commits. The order of the commits is not - guaranteed as we might implement parallel commits in the future. Be sure that your are not updating several - times the same file. - - - - `create_commits_on_pr` is experimental. Its API and behavior is subject to change in the future without prior notice. - - - - - - `create_commits_on_pr` assumes that the repo already exists on the Hub. If you get a Client error 404, please - make sure you are authenticated and that `repo_id` and `repo_type` are set correctly. If repo does not exist, - create it first using [`~hf_api.create_repo`]. - - - - Args: - repo_id (`str`): - The repository in which the commits will be pushed. Example: `"username/my-cool-model"`. - - addition_commits (`List` of `List` of [`~hf_api.CommitOperationAdd`]): - A list containing lists of [`~hf_api.CommitOperationAdd`]. Each sublist will result in a commit on the - PR. - - deletion_commits - A list containing lists of [`~hf_api.CommitOperationDelete`]. Each sublist will result in a commit on - the PR. Deletion commits are pushed before addition commits. - - commit_message (`str`): - The summary (first line) of the commit that will be created. Will also be the title of the PR. - - commit_description (`str`, *optional*): - The description of the commit that will be created. The description will be added to the PR. - - token (`str`, *optional*): - Authentication token, obtained with `HfApi.login` method. Will default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or space, `None` or `"model"` if uploading to - a model. Default is `None`. - - merge_pr (`bool`): - If set to `True`, the Pull Request is merged at the end of the process. Defaults to `True`. - - num_threads (`int`, *optional*): - Number of concurrent threads for uploading files. Defaults to 5. - - verbose (`bool`): - If set to `True`, process will run on verbose mode i.e. print information about the ongoing tasks. - Defaults to `False`. - - Returns: - `str`: URL to the created PR. - - Example: - ```python - >>> from huggingface_hub import HfApi, plan_multi_commits - >>> addition_commits, deletion_commits = plan_multi_commits( - ... operations=[ - ... CommitOperationAdd(...), - ... CommitOperationAdd(...), - ... CommitOperationDelete(...), - ... CommitOperationDelete(...), - ... CommitOperationAdd(...), - ... ], - ... ) - >>> HfApi().create_commits_on_pr( - ... repo_id="my-cool-model", - ... addition_commits=addition_commits, - ... deletion_commits=deletion_commits, - ... (...) - ... verbose=True, - ... ) - ``` - - Raises: - [`MultiCommitException`]: - If an unexpected issue occur in the process: empty commits, unexpected commits in a PR, unexpected PR - description, etc. - """ - logger = logging.get_logger(__name__ + ".create_commits_on_pr") - if verbose: - logger.setLevel("INFO") - - # 1. Get strategy ID - logger.info( - f"Will create {len(deletion_commits)} deletion commit(s) and {len(addition_commits)} addition commit(s)," - f" totalling {sum(len(ops) for ops in addition_commits+deletion_commits)} atomic operations." - ) - strategy = MultiCommitStrategy( - addition_commits=[MultiCommitStep(operations=operations) for operations in addition_commits], # type: ignore - deletion_commits=[MultiCommitStep(operations=operations) for operations in deletion_commits], # type: ignore - ) - logger.info(f"Multi-commits strategy with ID {strategy.id}.") - - # 2. Get or create a PR with this strategy ID - for discussion in self.get_repo_discussions(repo_id=repo_id, repo_type=repo_type, token=token): - # search for a draft PR with strategy ID - if discussion.is_pull_request and discussion.status == "draft" and strategy.id in discussion.title: - pr = self.get_discussion_details( - repo_id=repo_id, discussion_num=discussion.num, repo_type=repo_type, token=token - ) - logger.info(f"PR already exists: {pr.url}. Will resume process where it stopped.") - break - else: - # did not find a PR matching the strategy ID - pr = multi_commit_create_pull_request( - self, - repo_id=repo_id, - commit_message=commit_message, - commit_description=commit_description, - strategy=strategy, - token=token, - repo_type=repo_type, - ) - logger.info(f"New PR created: {pr.url}") - - # 3. Parse PR description to check consistency with strategy (e.g. same commits are scheduled) - for event in pr.events: - if isinstance(event, DiscussionComment): - pr_comment = event - break - else: - raise MultiCommitException(f"PR #{pr.num} must have at least 1 comment") - - description_commits = multi_commit_parse_pr_description(pr_comment.content) - if len(description_commits) != len(strategy.all_steps): - raise MultiCommitException( - f"Corrupted multi-commit PR #{pr.num}: got {len(description_commits)} steps in" - f" description but {len(strategy.all_steps)} in strategy." - ) - for step_id in strategy.all_steps: - if step_id not in description_commits: - raise MultiCommitException( - f"Corrupted multi-commit PR #{pr.num}: expected step {step_id} but didn't find" - f" it (have {', '.join(description_commits)})." - ) - - # 4. Retrieve commit history (and check consistency) - commits_on_main_branch = { - commit.commit_id - for commit in self.list_repo_commits( - repo_id=repo_id, repo_type=repo_type, token=token, revision=DEFAULT_REVISION - ) - } - pr_commits = [ - commit - for commit in self.list_repo_commits( - repo_id=repo_id, repo_type=repo_type, token=token, revision=pr.git_reference - ) - if commit.commit_id not in commits_on_main_branch - ] - if len(pr_commits) > 0: - logger.info(f"Found {len(pr_commits)} existing commits on the PR.") - - # At this point `pr_commits` is a list of commits pushed to the PR. We expect all of these commits (if any) to have - # a step_id as title. We raise exception if an unexpected commit has been pushed. - if len(pr_commits) > len(strategy.all_steps): - raise MultiCommitException( - f"Corrupted multi-commit PR #{pr.num}: scheduled {len(strategy.all_steps)} steps but" - f" {len(pr_commits)} commits have already been pushed to the PR." - ) - - # Check which steps are already completed - remaining_additions = {step.id: step for step in strategy.addition_commits} - remaining_deletions = {step.id: step for step in strategy.deletion_commits} - for commit in pr_commits: - if commit.title in remaining_additions: - step = remaining_additions.pop(commit.title) - step.completed = True - elif commit.title in remaining_deletions: - step = remaining_deletions.pop(commit.title) - step.completed = True - - if len(remaining_deletions) > 0 and len(remaining_additions) < len(strategy.addition_commits): - raise MultiCommitException( - f"Corrupted multi-commit PR #{pr.num}: some addition commits have already been pushed to the PR but" - " deletion commits are not all completed yet." - ) - nb_remaining = len(remaining_deletions) + len(remaining_additions) - if len(pr_commits) > 0: - logger.info( - f"{nb_remaining} commits remaining ({len(remaining_deletions)} deletion commits and" - f" {len(remaining_additions)} addition commits)" - ) - - # 5. Push remaining commits to the PR + update description - # TODO: multi-thread this - for step in list(remaining_deletions.values()) + list(remaining_additions.values()): - # Push new commit - self.create_commit( - repo_id=repo_id, - repo_type=repo_type, - token=token, - commit_message=step.id, - revision=pr.git_reference, - num_threads=num_threads, - operations=step.operations, - create_pr=False, - ) - step.completed = True - nb_remaining -= 1 - logger.info(f" step {step.id} completed (still {nb_remaining} to go).") - - # Update PR description - self.edit_discussion_comment( - repo_id=repo_id, - repo_type=repo_type, - token=token, - discussion_num=pr.num, - comment_id=pr_comment.id, - new_content=multi_commit_generate_comment( - commit_message=commit_message, commit_description=commit_description, strategy=strategy - ), - ) - logger.info("All commits have been pushed.") - - # 6. Update PR (and merge) - self.rename_discussion( - repo_id=repo_id, - repo_type=repo_type, - token=token, - discussion_num=pr.num, - new_title=commit_message, - ) - self.change_discussion_status( - repo_id=repo_id, - repo_type=repo_type, - token=token, - discussion_num=pr.num, - new_status="open", - comment=MULTI_COMMIT_PR_COMPLETION_COMMENT_TEMPLATE, - ) - logger.info("PR is now open for reviews.") - - if merge_pr: # User don't want a PR => merge it - try: - self.merge_pull_request( - repo_id=repo_id, - repo_type=repo_type, - token=token, - discussion_num=pr.num, - comment=MULTI_COMMIT_PR_CLOSING_COMMENT_TEMPLATE, - ) - logger.info("PR has been automatically merged (`merge_pr=True` was passed).") - except BadRequestError as error: - if error.server_message is not None and "no associated changes" in error.server_message: - # PR cannot be merged as no changes are associated. We close the PR without merging with a comment to - # explain. - self.change_discussion_status( - repo_id=repo_id, - repo_type=repo_type, - token=token, - discussion_num=pr.num, - comment=MULTI_COMMIT_PR_CLOSE_COMMENT_FAILURE_NO_CHANGES_TEMPLATE, - new_status="closed", - ) - logger.warning("Couldn't merge the PR: no associated changes.") - else: - # PR cannot be merged for another reason (conflicting files for example). We comment the PR to explain - # and re-raise the exception. - self.comment_discussion( - repo_id=repo_id, - repo_type=repo_type, - token=token, - discussion_num=pr.num, - comment=MULTI_COMMIT_PR_CLOSE_COMMENT_FAILURE_BAD_REQUEST_TEMPLATE.format( - error_message=error.server_message - ), - ) - raise MultiCommitException( - f"Couldn't merge Pull Request in multi-commit: {error.server_message}" - ) from error - - return pr.url - - def preupload_lfs_files( - self, - repo_id: str, - additions: Iterable[CommitOperationAdd], - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - create_pr: Optional[bool] = None, - num_threads: int = 5, - free_memory: bool = True, - ): - """Pre-upload LFS files to S3 in preparation on a future commit. - - This method is useful if you are generating the files to upload on-the-fly and you don't want to store them - in memory before uploading them all at once. - - - - This is a power-user method. You shouldn't need to call it directly to make a normal commit. - Use [`create_commit`] directly instead. - - - - - - Commit operations will be mutated during the process. In particular, the attached `path_or_fileobj` will be - removed after the upload to save memory (and replaced by an empty `bytes` object). Do not reuse the same - objects except to pass them to [`create_commit`]. If you don't want to remove the attached content from the - commit operation object, pass `free_memory=False`. - - - - Args: - repo_id (`str`): - The repository in which you will commit the files, for example: `"username/custom_transformers"`. - - operations (`Iterable` of [`CommitOperationAdd`]): - The list of files to upload. Warning: the objects in this list will be mutated to include information - relative to the upload. Do not reuse the same objects for multiple commits. - - token (`str`, *optional*): - Authentication token. Will default to the stored token. - - repo_type (`str`, *optional*): - The type of repository to upload to (e.g. `"model"` -default-, `"dataset"` or `"space"`). - - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the `"main"` branch. - - create_pr (`boolean`, *optional*): - Whether or not you plan to create a Pull Request with that commit. Defaults to `False`. - - num_threads (`int`, *optional*): - Number of concurrent threads for uploading files. Defaults to 5. - Setting it to 2 means at most 2 files will be uploaded concurrently. - - Example: - ```py - >>> from huggingface_hub import CommitOperationAdd, preupload_lfs_files, create_commit, create_repo - - >>> repo_id = create_repo("test_preupload").repo_id - - # Generate and preupload LFS files one by one - >>> operations = [] # List of all `CommitOperationAdd` objects that will be generated - >>> for i in range(5): - ... content = ... # generate binary content - ... addition = CommitOperationAdd(path_in_repo=f"shard_{i}_of_5.bin", path_or_fileobj=content) - ... preupload_lfs_files(repo_id, additions=[addition]) # upload + free memory - ... operations.append(addition) - - # Create commit - >>> create_commit(repo_id, operations=operations, commit_message="Commit all shards") - ``` - """ - repo_type = repo_type if repo_type is not None else REPO_TYPE_MODEL - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") - revision = quote(revision, safe="") if revision is not None else DEFAULT_REVISION - create_pr = create_pr if create_pr is not None else False - - # Filter out already uploaded files - new_additions = [addition for addition in additions if not addition._is_uploaded] - - # Check which new files are LFS - try: - _fetch_upload_modes( - additions=new_additions, - repo_type=repo_type, - repo_id=repo_id, - token=token or self.token, - revision=revision, - endpoint=self.endpoint, - create_pr=create_pr or False, - ) - except RepositoryNotFoundError as e: - e.append_to_message(_CREATE_COMMIT_NO_REPO_ERROR_MESSAGE) - raise - - # Filter out regular files - new_lfs_additions = [addition for addition in new_additions if addition._upload_mode == "lfs"] - - # Upload new LFS files - _upload_lfs_files( - additions=new_lfs_additions, - repo_type=repo_type, - repo_id=repo_id, - token=token or self.token, - endpoint=self.endpoint, - num_threads=num_threads, - ) - for addition in new_lfs_additions: - addition._is_uploaded = True - if free_memory: - addition.path_or_fileobj = b"" - - @overload - def upload_file( # type: ignore - self, - *, - path_or_fileobj: Union[str, Path, bytes, BinaryIO], - path_in_repo: str, - repo_id: str, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - run_as_future: Literal[False] = ..., - ) -> str: - ... - - @overload - def upload_file( - self, - *, - path_or_fileobj: Union[str, Path, bytes, BinaryIO], - path_in_repo: str, - repo_id: str, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - run_as_future: Literal[True] = ..., - ) -> Future[str]: - ... - - @validate_hf_hub_args - @future_compatible - def upload_file( - self, - *, - path_or_fileobj: Union[str, Path, bytes, BinaryIO], - path_in_repo: str, - repo_id: str, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - run_as_future: bool = False, - ) -> Union[str, Future[str]]: - """ - Upload a local file (up to 50 GB) to the given repo. The upload is done - through a HTTP post request, and doesn't require git or git-lfs to be - installed. - - Args: - path_or_fileobj (`str`, `Path`, `bytes`, or `IO`): - Path to a file on the local machine or binary data stream / - fileobj / buffer. - path_in_repo (`str`): - Relative filepath in the repo, for example: - `"checkpoints/1fec34a/weights.bin"` - repo_id (`str`): - The repository to which the file will be uploaded, for example: - `"username/custom_transformers"` - token (`str`, *optional*): - Authentication token, obtained with `HfApi.login` method. Will - default to the stored token. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the `"main"` branch. - commit_message (`str`, *optional*): - The summary / title / first line of the generated commit - commit_description (`str` *optional*) - The description of the generated commit - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request with that commit. Defaults to `False`. - If `revision` is not set, PR is opened against the `"main"` branch. If - `revision` is set and is a branch, PR is opened against this branch. If - `revision` is set and is not a branch name (example: a commit oid), an - `RevisionNotFoundError` is returned by the server. - parent_commit (`str`, *optional*): - The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. - If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. - If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. - Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be - especially useful if the repo is updated / committed to concurrently. - run_as_future (`bool`, *optional*): - Whether or not to run this method in the background. Background jobs are run sequentially without - blocking the main thread. Passing `run_as_future=True` will return a [Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) - object. Defaults to `False`. - - - Returns: - `str` or `Future`: The URL to visualize the uploaded file on the hub. If `run_as_future=True` is passed, - returns a Future object which will contain the result when executed. - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - - - - - `upload_file` assumes that the repo already exists on the Hub. If you get a - Client error 404, please make sure you are authenticated and that `repo_id` and - `repo_type` are set correctly. If repo does not exist, create it first using - [`~hf_api.create_repo`]. - - - - Example: - - ```python - >>> from huggingface_hub import upload_file - - >>> with open("./local/filepath", "rb") as fobj: - ... upload_file( - ... path_or_fileobj=fileobj, - ... path_in_repo="remote/file/path.h5", - ... repo_id="username/my-dataset", - ... repo_type="dataset", - ... token="my_token", - ... ) - "https://huggingface.co/datasets/username/my-dataset/blob/main/remote/file/path.h5" - - >>> upload_file( - ... path_or_fileobj=".\\\\local\\\\file\\\\path", - ... path_in_repo="remote/file/path.h5", - ... repo_id="username/my-model", - ... token="my_token", - ... ) - "https://huggingface.co/username/my-model/blob/main/remote/file/path.h5" - - >>> upload_file( - ... path_or_fileobj=".\\\\local\\\\file\\\\path", - ... path_in_repo="remote/file/path.h5", - ... repo_id="username/my-model", - ... token="my_token", - ... create_pr=True, - ... ) - "https://huggingface.co/username/my-model/blob/refs%2Fpr%2F1/remote/file/path.h5" - ``` - """ - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") - - commit_message = ( - commit_message if commit_message is not None else f"Upload {path_in_repo} with huggingface_hub" - ) - operation = CommitOperationAdd( - path_or_fileobj=path_or_fileobj, - path_in_repo=path_in_repo, - ) - - commit_info = self.create_commit( - repo_id=repo_id, - repo_type=repo_type, - operations=[operation], - commit_message=commit_message, - commit_description=commit_description, - token=token, - revision=revision, - create_pr=create_pr, - parent_commit=parent_commit, - ) - - if commit_info.pr_url is not None: - revision = quote(_parse_revision_from_pr_url(commit_info.pr_url), safe="") - if repo_type in REPO_TYPES_URL_PREFIXES: - repo_id = REPO_TYPES_URL_PREFIXES[repo_type] + repo_id - revision = revision if revision is not None else DEFAULT_REVISION - # Similar to `hf_hub_url` but it's "blob" instead of "resolve" - return f"{self.endpoint}/{repo_id}/blob/{revision}/{path_in_repo}" - - @overload - def upload_folder( # type: ignore - self, - *, - repo_id: str, - folder_path: Union[str, Path], - path_in_repo: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - delete_patterns: Optional[Union[List[str], str]] = None, - multi_commits: bool = False, - multi_commits_verbose: bool = False, - run_as_future: Literal[False] = ..., - ) -> str: - ... - - @overload - def upload_folder( - self, - *, - repo_id: str, - folder_path: Union[str, Path], - path_in_repo: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - delete_patterns: Optional[Union[List[str], str]] = None, - multi_commits: bool = False, - multi_commits_verbose: bool = False, - run_as_future: Literal[True] = ..., - ) -> Future[str]: - ... - - @validate_hf_hub_args - @future_compatible - def upload_folder( - self, - *, - repo_id: str, - folder_path: Union[str, Path], - path_in_repo: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - delete_patterns: Optional[Union[List[str], str]] = None, - multi_commits: bool = False, - multi_commits_verbose: bool = False, - run_as_future: bool = False, - ) -> Union[str, Future[str]]: - """ - Upload a local folder to the given repo. The upload is done through a HTTP requests, and doesn't require git or - git-lfs to be installed. - - The structure of the folder will be preserved. Files with the same name already present in the repository will - be overwritten. Others will be left untouched. - - Use the `allow_patterns` and `ignore_patterns` arguments to specify which files to upload. These parameters - accept either a single pattern or a list of patterns. Patterns are Standard Wildcards (globbing patterns) as - documented [here](https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm). If both `allow_patterns` and - `ignore_patterns` are provided, both constraints apply. By default, all files from the folder are uploaded. - - Use the `delete_patterns` argument to specify remote files you want to delete. Input type is the same as for - `allow_patterns` (see above). If `path_in_repo` is also provided, the patterns are matched against paths - relative to this folder. For example, `upload_folder(..., path_in_repo="experiment", delete_patterns="logs/*")` - will delete any remote file under `./experiment/logs/`. Note that the `.gitattributes` file will not be deleted - even if it matches the patterns. - - Any `.git/` folder present in any subdirectory will be ignored. However, please be aware that the `.gitignore` - file is not taken into account. - - Uses `HfApi.create_commit` under the hood. - - Args: - repo_id (`str`): - The repository to which the file will be uploaded, for example: - `"username/custom_transformers"` - folder_path (`str` or `Path`): - Path to the folder to upload on the local file system - path_in_repo (`str`, *optional*): - Relative path of the directory in the repo, for example: - `"checkpoints/1fec34a/results"`. Will default to the root folder of the repository. - token (`str`, *optional*): - Authentication token, obtained with `HfApi.login` method. Will - default to the stored token. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the `"main"` branch. - commit_message (`str`, *optional*): - The summary / title / first line of the generated commit. Defaults to: - `f"Upload {path_in_repo} with huggingface_hub"` - commit_description (`str` *optional*): - The description of the generated commit - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request with that commit. Defaults to `False`. If `revision` is not - set, PR is opened against the `"main"` branch. If `revision` is set and is a branch, PR is opened - against this branch. If `revision` is set and is not a branch name (example: a commit oid), an - `RevisionNotFoundError` is returned by the server. If both `multi_commits` and `create_pr` are True, - the PR created in the multi-commit process is kept opened. - parent_commit (`str`, *optional*): - The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. - If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. - If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. - Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be - especially useful if the repo is updated / committed to concurrently. - allow_patterns (`List[str]` or `str`, *optional*): - If provided, only files matching at least one pattern are uploaded. - ignore_patterns (`List[str]` or `str`, *optional*): - If provided, files matching any of the patterns are not uploaded. - delete_patterns (`List[str]` or `str`, *optional*): - If provided, remote files matching any of the patterns will be deleted from the repo while committing - new files. This is useful if you don't know which files have already been uploaded. - Note: to avoid discrepancies the `.gitattributes` file is not deleted even if it matches the pattern. - multi_commits (`bool`): - If True, changes are pushed to a PR using a multi-commit process. Defaults to `False`. - multi_commits_verbose (`bool`): - If True and `multi_commits` is used, more information will be displayed to the user. - run_as_future (`bool`, *optional*): - Whether or not to run this method in the background. Background jobs are run sequentially without - blocking the main thread. Passing `run_as_future=True` will return a [Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) - object. Defaults to `False`. - - Returns: - `str` or `Future[str]`: A URL to visualize the uploaded folder on the hub. If `run_as_future=True` is passed, - returns a Future object which will contain the result when executed. - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - - - - - `upload_folder` assumes that the repo already exists on the Hub. If you get a Client error 404, please make - sure you are authenticated and that `repo_id` and `repo_type` are set correctly. If repo does not exist, create - it first using [`~hf_api.create_repo`]. - - - - - - `multi_commits` is experimental. Its API and behavior is subject to change in the future without prior notice. - - - - Example: - - ```python - # Upload checkpoints folder except the log files - >>> upload_folder( - ... folder_path="local/checkpoints", - ... path_in_repo="remote/experiment/checkpoints", - ... repo_id="username/my-dataset", - ... repo_type="datasets", - ... token="my_token", - ... ignore_patterns="**/logs/*.txt", - ... ) - # "https://huggingface.co/datasets/username/my-dataset/tree/main/remote/experiment/checkpoints" - - # Upload checkpoints folder including logs while deleting existing logs from the repo - # Useful if you don't know exactly which log files have already being pushed - >>> upload_folder( - ... folder_path="local/checkpoints", - ... path_in_repo="remote/experiment/checkpoints", - ... repo_id="username/my-dataset", - ... repo_type="datasets", - ... token="my_token", - ... delete_patterns="**/logs/*.txt", - ... ) - "https://huggingface.co/datasets/username/my-dataset/tree/main/remote/experiment/checkpoints" - - # Upload checkpoints folder while creating a PR - >>> upload_folder( - ... folder_path="local/checkpoints", - ... path_in_repo="remote/experiment/checkpoints", - ... repo_id="username/my-dataset", - ... repo_type="datasets", - ... token="my_token", - ... create_pr=True, - ... ) - "https://huggingface.co/datasets/username/my-dataset/tree/refs%2Fpr%2F1/remote/experiment/checkpoints" - - ``` - """ - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") - - if multi_commits: - if revision is not None and revision != DEFAULT_REVISION: - raise ValueError("Cannot use `multi_commit` to commit changes other than the main branch.") - - # By default, upload folder to the root directory in repo. - if path_in_repo is None: - path_in_repo = "" - - # Do not upload .git folder - if ignore_patterns is None: - ignore_patterns = [] - elif isinstance(ignore_patterns, str): - ignore_patterns = [ignore_patterns] - ignore_patterns += IGNORE_GIT_FOLDER_PATTERNS - - delete_operations = self._prepare_upload_folder_deletions( - repo_id=repo_id, - repo_type=repo_type, - revision=DEFAULT_REVISION if create_pr else revision, - token=token, - path_in_repo=path_in_repo, - delete_patterns=delete_patterns, - ) - add_operations = _prepare_upload_folder_additions( - folder_path, - path_in_repo, - allow_patterns=allow_patterns, - ignore_patterns=ignore_patterns, - ) - - # Optimize operations: if some files will be overwritten, we don't need to delete them first - if len(add_operations) > 0: - added_paths = set(op.path_in_repo for op in add_operations) - delete_operations = [ - delete_op for delete_op in delete_operations if delete_op.path_in_repo not in added_paths - ] - commit_operations = delete_operations + add_operations - - pr_url: Optional[str] - commit_message = commit_message or "Upload folder using huggingface_hub" - if multi_commits: - addition_commits, deletion_commits = plan_multi_commits(operations=commit_operations) - pr_url = self.create_commits_on_pr( - repo_id=repo_id, - repo_type=repo_type, - addition_commits=addition_commits, - deletion_commits=deletion_commits, - commit_message=commit_message, - commit_description=commit_description, - token=token, - merge_pr=not create_pr, - verbose=multi_commits_verbose, - ) - else: - commit_info = self.create_commit( - repo_type=repo_type, - repo_id=repo_id, - operations=commit_operations, - commit_message=commit_message, - commit_description=commit_description, - token=token, - revision=revision, - create_pr=create_pr, - parent_commit=parent_commit, - ) - pr_url = commit_info.pr_url - - if create_pr and pr_url is not None: - revision = quote(_parse_revision_from_pr_url(pr_url), safe="") - if repo_type in REPO_TYPES_URL_PREFIXES: - repo_id = REPO_TYPES_URL_PREFIXES[repo_type] + repo_id - revision = revision if revision is not None else DEFAULT_REVISION - # Similar to `hf_hub_url` but it's "tree" instead of "resolve" - return f"{self.endpoint}/{repo_id}/tree/{revision}/{path_in_repo}" - - @validate_hf_hub_args - def delete_file( - self, - path_in_repo: str, - repo_id: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - ) -> CommitInfo: - """ - Deletes a file in the given repo. - - Args: - path_in_repo (`str`): - Relative filepath in the repo, for example: - `"checkpoints/1fec34a/weights.bin"` - repo_id (`str`): - The repository from which the file will be deleted, for example: - `"username/custom_transformers"` - token (`str`, *optional*): - Authentication token, obtained with `HfApi.login` method. Will - default to the stored token. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if the file is in a dataset or - space, `None` or `"model"` if in a model. Default is `None`. - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the `"main"` branch. - commit_message (`str`, *optional*): - The summary / title / first line of the generated commit. Defaults to - `f"Delete {path_in_repo} with huggingface_hub"`. - commit_description (`str` *optional*) - The description of the generated commit - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request with that commit. Defaults to `False`. - If `revision` is not set, PR is opened against the `"main"` branch. If - `revision` is set and is a branch, PR is opened against this branch. If - `revision` is set and is not a branch name (example: a commit oid), an - `RevisionNotFoundError` is returned by the server. - parent_commit (`str`, *optional*): - The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. - If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. - If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. - Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be - especially useful if the repo is updated / committed to concurrently. - - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - [`~utils.EntryNotFoundError`] - If the file to download cannot be found. - - - - """ - commit_message = ( - commit_message if commit_message is not None else f"Delete {path_in_repo} with huggingface_hub" - ) - - operations = [CommitOperationDelete(path_in_repo=path_in_repo)] - - return self.create_commit( - repo_id=repo_id, - repo_type=repo_type, - token=token, - operations=operations, - revision=revision, - commit_message=commit_message, - commit_description=commit_description, - create_pr=create_pr, - parent_commit=parent_commit, - ) - - @validate_hf_hub_args - def delete_folder( - self, - path_in_repo: str, - repo_id: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - ) -> CommitInfo: - """ - Deletes a folder in the given repo. - - Simple wrapper around [`create_commit`] method. - - Args: - path_in_repo (`str`): - Relative folder path in the repo, for example: `"checkpoints/1fec34a"`. - repo_id (`str`): - The repository from which the folder will be deleted, for example: - `"username/custom_transformers"` - token (`str`, *optional*): - Authentication token, obtained with `HfApi.login` method. Will default - to the stored token. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if the folder is in a dataset or - space, `None` or `"model"` if in a model. Default is `None`. - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the `"main"` branch. - commit_message (`str`, *optional*): - The summary / title / first line of the generated commit. Defaults to - `f"Delete folder {path_in_repo} with huggingface_hub"`. - commit_description (`str` *optional*) - The description of the generated commit. - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request with that commit. Defaults to `False`. - If `revision` is not set, PR is opened against the `"main"` branch. If - `revision` is set and is a branch, PR is opened against this branch. If - `revision` is set and is not a branch name (example: a commit oid), an - `RevisionNotFoundError` is returned by the server. - parent_commit (`str`, *optional*): - The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. - If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. - If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. - Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be - especially useful if the repo is updated / committed to concurrently. - """ - return self.create_commit( - repo_id=repo_id, - repo_type=repo_type, - token=token, - operations=[CommitOperationDelete(path_in_repo=path_in_repo, is_folder=True)], - revision=revision, - commit_message=( - commit_message if commit_message is not None else f"Delete folder {path_in_repo} with huggingface_hub" - ), - commit_description=commit_description, - create_pr=create_pr, - parent_commit=parent_commit, - ) - - @validate_hf_hub_args - def hf_hub_download( - self, - repo_id: str, - filename: str, - *, - subfolder: Optional[str] = None, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - cache_dir: Union[str, Path, None] = None, - local_dir: Union[str, Path, None] = None, - local_dir_use_symlinks: Union[bool, Literal["auto"]] = "auto", - force_download: bool = False, - force_filename: Optional[str] = None, - proxies: Optional[Dict] = None, - etag_timeout: float = 10, - resume_download: bool = False, - token: Optional[Union[str, bool]] = None, - local_files_only: bool = False, - legacy_cache_layout: bool = False, - ) -> str: - """Download a given file if it's not already present in the local cache. - - The new cache file layout looks like this: - - The cache directory contains one subfolder per repo_id (namespaced by repo type) - - inside each repo folder: - - refs is a list of the latest known revision => commit_hash pairs - - blobs contains the actual file blobs (identified by their git-sha or sha256, depending on - whether they're LFS files or not) - - snapshots contains one subfolder per commit, each "commit" contains the subset of the files - that have been resolved at that particular commit. Each filename is a symlink to the blob - at that particular commit. - - If `local_dir` is provided, the file structure from the repo will be replicated in this location. You can configure - how you want to move those files: - - If `local_dir_use_symlinks="auto"` (default), files are downloaded and stored in the cache directory as blob - files. Small files (<5MB) are duplicated in `local_dir` while a symlink is created for bigger files. The goal - is to be able to manually edit and save small files without corrupting the cache while saving disk space for - binary files. The 5MB threshold can be configured with the `HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD` - environment variable. - - If `local_dir_use_symlinks=True`, files are downloaded, stored in the cache directory and symlinked in `local_dir`. - This is optimal in term of disk usage but files must not be manually edited. - - If `local_dir_use_symlinks=False` and the blob files exist in the cache directory, they are duplicated in the - local dir. This means disk usage is not optimized. - - Finally, if `local_dir_use_symlinks=False` and the blob files do not exist in the cache directory, then the - files are downloaded and directly placed under `local_dir`. This means if you need to download them again later, - they will be re-downloaded entirely. - - ``` - [ 96] . - └── [ 160] models--julien-c--EsperBERTo-small - ├── [ 160] blobs - │ ├── [321M] 403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd - │ ├── [ 398] 7cb18dc9bafbfcf74629a4b760af1b160957a83e - │ └── [1.4K] d7edf6bd2a681fb0175f7735299831ee1b22b812 - ├── [ 96] refs - │ └── [ 40] main - └── [ 128] snapshots - ├── [ 128] 2439f60ef33a0d46d85da5001d52aeda5b00ce9f - │ ├── [ 52] README.md -> ../../blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812 - │ └── [ 76] pytorch_model.bin -> ../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd - └── [ 128] bbc77c8132af1cc5cf678da3f1ddf2de43606d48 - ├── [ 52] README.md -> ../../blobs/7cb18dc9bafbfcf74629a4b760af1b160957a83e - └── [ 76] pytorch_model.bin -> ../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd - ``` - - Args: - repo_id (`str`): - A user or an organization name and a repo name separated by a `/`. - filename (`str`): - The name of the file in the repo. - subfolder (`str`, *optional*): - An optional value corresponding to a folder inside the model repo. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if downloading from a dataset or space, - `None` or `"model"` if downloading from a model. Default is `None`. - revision (`str`, *optional*): - An optional Git revision id which can be a branch name, a tag, or a - commit hash. - endpoint (`str`, *optional*): - Hugging Face Hub base url. Will default to https://huggingface.co/. Otherwise, one can set the `HF_ENDPOINT` - environment variable. - cache_dir (`str`, `Path`, *optional*): - Path to the folder where cached files are stored. - local_dir (`str` or `Path`, *optional*): - If provided, the downloaded file will be placed under this directory, either as a symlink (default) or - a regular file (see description for more details). - local_dir_use_symlinks (`"auto"` or `bool`, defaults to `"auto"`): - To be used with `local_dir`. If set to "auto", the cache directory will be used and the file will be either - duplicated or symlinked to the local directory depending on its size. It set to `True`, a symlink will be - created, no matter the file size. If set to `False`, the file will either be duplicated from cache (if - already exists) or downloaded from the Hub and not cached. See description for more details. - force_download (`bool`, *optional*, defaults to `False`): - Whether the file should be downloaded even if it already exists in - the local cache. - proxies (`dict`, *optional*): - Dictionary mapping protocol to the URL of the proxy passed to - `requests.request`. - etag_timeout (`float`, *optional*, defaults to `10`): - When fetching ETag, how many seconds to wait for the server to send - data before giving up which is passed to `requests.request`. - resume_download (`bool`, *optional*, defaults to `False`): - If `True`, resume a previously interrupted download. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - local_files_only (`bool`, *optional*, defaults to `False`): - If `True`, avoid downloading the file and return the path to the - local cached file if it exists. - legacy_cache_layout (`bool`, *optional*, defaults to `False`): - If `True`, uses the legacy file cache layout i.e. just call [`hf_hub_url`] - then `cached_download`. This is deprecated as the new cache layout is - more powerful. - - Returns: - Local path (string) of file or if networking is off, last version of - file cached on disk. - - - - Raises the following errors: - - - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - if `token=True` and the token cannot be found. - - [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) - if ETag cannot be determined. - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - [`~utils.RevisionNotFoundError`] - If the revision to download from cannot be found. - - [`~utils.EntryNotFoundError`] - If the file to download cannot be found. - - [`~utils.LocalEntryNotFoundError`] - If network is disabled or unavailable and file is not found in cache. - - - """ - from .file_download import hf_hub_download - - if token is None: - # Cannot do `token = token or self.token` as token can be `False`. - token = self.token - - return hf_hub_download( - repo_id=repo_id, - filename=filename, - subfolder=subfolder, - repo_type=repo_type, - revision=revision, - endpoint=self.endpoint, - library_name=self.library_name, - library_version=self.library_version, - cache_dir=cache_dir, - local_dir=local_dir, - local_dir_use_symlinks=local_dir_use_symlinks, - user_agent=self.user_agent, - force_download=force_download, - force_filename=force_filename, - proxies=proxies, - etag_timeout=etag_timeout, - resume_download=resume_download, - token=token, - local_files_only=local_files_only, - legacy_cache_layout=legacy_cache_layout, - ) - - @validate_hf_hub_args - def snapshot_download( - self, - repo_id: str, - *, - repo_type: Optional[str] = None, - revision: Optional[str] = None, - cache_dir: Union[str, Path, None] = None, - local_dir: Union[str, Path, None] = None, - local_dir_use_symlinks: Union[bool, Literal["auto"]] = "auto", - proxies: Optional[Dict] = None, - etag_timeout: float = 10, - resume_download: bool = False, - force_download: bool = False, - token: Optional[Union[str, bool]] = None, - local_files_only: bool = False, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - max_workers: int = 8, - tqdm_class: Optional[base_tqdm] = None, - ) -> str: - """Download repo files. - - Download a whole snapshot of a repo's files at the specified revision. This is useful when you want all files from - a repo, because you don't know which ones you will need a priori. All files are nested inside a folder in order - to keep their actual filename relative to that folder. You can also filter which files to download using - `allow_patterns` and `ignore_patterns`. - - If `local_dir` is provided, the file structure from the repo will be replicated in this location. You can configure - how you want to move those files: - - If `local_dir_use_symlinks="auto"` (default), files are downloaded and stored in the cache directory as blob - files. Small files (<5MB) are duplicated in `local_dir` while a symlink is created for bigger files. The goal - is to be able to manually edit and save small files without corrupting the cache while saving disk space for - binary files. The 5MB threshold can be configured with the `HF_HUB_LOCAL_DIR_AUTO_SYMLINK_THRESHOLD` - environment variable. - - If `local_dir_use_symlinks=True`, files are downloaded, stored in the cache directory and symlinked in `local_dir`. - This is optimal in term of disk usage but files must not be manually edited. - - If `local_dir_use_symlinks=False` and the blob files exist in the cache directory, they are duplicated in the - local dir. This means disk usage is not optimized. - - Finally, if `local_dir_use_symlinks=False` and the blob files do not exist in the cache directory, then the - files are downloaded and directly placed under `local_dir`. This means if you need to download them again later, - they will be re-downloaded entirely. - - An alternative would be to clone the repo but this requires git and git-lfs to be installed and properly - configured. It is also not possible to filter which files to download when cloning a repository using git. - - Args: - repo_id (`str`): - A user or an organization name and a repo name separated by a `/`. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if downloading from a dataset or space, - `None` or `"model"` if downloading from a model. Default is `None`. - revision (`str`, *optional*): - An optional Git revision id which can be a branch name, a tag, or a - commit hash. - cache_dir (`str`, `Path`, *optional*): - Path to the folder where cached files are stored. - local_dir (`str` or `Path`, *optional*): - If provided, the downloaded files will be placed under this directory, either as symlinks (default) or - regular files (see description for more details). - local_dir_use_symlinks (`"auto"` or `bool`, defaults to `"auto"`): - To be used with `local_dir`. If set to "auto", the cache directory will be used and the file will be either - duplicated or symlinked to the local directory depending on its size. It set to `True`, a symlink will be - created, no matter the file size. If set to `False`, the file will either be duplicated from cache (if - already exists) or downloaded from the Hub and not cached. See description for more details. - proxies (`dict`, *optional*): - Dictionary mapping protocol to the URL of the proxy passed to - `requests.request`. - etag_timeout (`float`, *optional*, defaults to `10`): - When fetching ETag, how many seconds to wait for the server to send - data before giving up which is passed to `requests.request`. - resume_download (`bool`, *optional*, defaults to `False): - If `True`, resume a previously interrupted download. - force_download (`bool`, *optional*, defaults to `False`): - Whether the file should be downloaded even if it already exists in the local cache. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - local_files_only (`bool`, *optional*, defaults to `False`): - If `True`, avoid downloading the file and return the path to the - local cached file if it exists. - allow_patterns (`List[str]` or `str`, *optional*): - If provided, only files matching at least one pattern are downloaded. - ignore_patterns (`List[str]` or `str`, *optional*): - If provided, files matching any of the patterns are not downloaded. - max_workers (`int`, *optional*): - Number of concurrent threads to download files (1 thread = 1 file download). - Defaults to 8. - tqdm_class (`tqdm`, *optional*): - If provided, overwrites the default behavior for the progress bar. Passed - argument must inherit from `tqdm.auto.tqdm` or at least mimic its behavior. - Note that the `tqdm_class` is not passed to each individual download. - Defaults to the custom HF progress bar that can be disabled by setting - `HF_HUB_DISABLE_PROGRESS_BARS` environment variable. - - Returns: - Local folder path (string) of repo snapshot - - - - Raises the following errors: - - - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - if `token=True` and the token cannot be found. - - [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) if - ETag cannot be determined. - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - - """ - from ._snapshot_download import snapshot_download - - if token is None: - # Cannot do `token = token or self.token` as token can be `False`. - token = self.token - - return snapshot_download( - repo_id=repo_id, - repo_type=repo_type, - revision=revision, - endpoint=self.endpoint, - cache_dir=cache_dir, - local_dir=local_dir, - local_dir_use_symlinks=local_dir_use_symlinks, - library_name=self.library_name, - library_version=self.library_version, - user_agent=self.user_agent, - proxies=proxies, - etag_timeout=etag_timeout, - resume_download=resume_download, - force_download=force_download, - token=token, - local_files_only=local_files_only, - allow_patterns=allow_patterns, - ignore_patterns=ignore_patterns, - max_workers=max_workers, - tqdm_class=tqdm_class, - ) - - @validate_hf_hub_args - def create_branch( - self, - repo_id: str, - *, - branch: str, - revision: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - exist_ok: bool = False, - ) -> None: - """ - Create a new branch for a repo on the Hub, starting from the specified revision (defaults to `main`). - To find a revision suiting your needs, you can use [`list_repo_refs`] or [`list_repo_commits`]. - - Args: - repo_id (`str`): - The repository in which the branch will be created. - Example: `"user/my-cool-model"`. - - branch (`str`): - The name of the branch to create. - - revision (`str`, *optional*): - The git revision to create the branch from. It can be a branch name or - the OID/SHA of a commit, as a hexadecimal string. Defaults to the head - of the `"main"` branch. - - token (`str`, *optional*): - Authentication token. Will default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if creating a branch on a dataset or - space, `None` or `"model"` if tagging a model. Default is `None`. - - exist_ok (`bool`, *optional*, defaults to `False`): - If `True`, do not raise an error if branch already exists. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private - but not authenticated or repo does not exist. - [`~utils.BadRequestError`]: - If invalid reference for a branch. Ex: `refs/pr/5` or 'refs/foo/bar'. - [`~utils.HfHubHTTPError`]: - If the branch already exists on the repo (error 409) and `exist_ok` is - set to `False`. - """ - if repo_type is None: - repo_type = REPO_TYPE_MODEL - branch = quote(branch, safe="") - - # Prepare request - branch_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/branch/{branch}" - headers = self._build_hf_headers(token=token, is_write_action=True) - payload = {} - if revision is not None: - payload["startingPoint"] = revision - - # Create branch - response = get_session().post(url=branch_url, headers=headers, json=payload) - try: - hf_raise_for_status(response) - except HfHubHTTPError as e: - if not (e.response.status_code == 409 and exist_ok): - raise - - @validate_hf_hub_args - def delete_branch( - self, - repo_id: str, - *, - branch: str, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> None: - """ - Delete a branch from a repo on the Hub. - - Args: - repo_id (`str`): - The repository in which a branch will be deleted. - Example: `"user/my-cool-model"`. - - branch (`str`): - The name of the branch to delete. - - token (`str`, *optional*): - Authentication token. Will default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if creating a branch on a dataset or - space, `None` or `"model"` if tagging a model. Default is `None`. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private - but not authenticated or repo does not exist. - [`~utils.HfHubHTTPError`]: - If trying to delete a protected branch. Ex: `main` cannot be deleted. - [`~utils.HfHubHTTPError`]: - If trying to delete a branch that does not exist. - - """ - if repo_type is None: - repo_type = REPO_TYPE_MODEL - branch = quote(branch, safe="") - - # Prepare request - branch_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/branch/{branch}" - headers = self._build_hf_headers(token=token, is_write_action=True) - - # Delete branch - response = get_session().delete(url=branch_url, headers=headers) - hf_raise_for_status(response) - - @validate_hf_hub_args - def create_tag( - self, - repo_id: str, - *, - tag: str, - tag_message: Optional[str] = None, - revision: Optional[str] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - exist_ok: bool = False, - ) -> None: - """ - Tag a given commit of a repo on the Hub. - - Args: - repo_id (`str`): - The repository in which a commit will be tagged. - Example: `"user/my-cool-model"`. - - tag (`str`): - The name of the tag to create. - - tag_message (`str`, *optional*): - The description of the tag to create. - - revision (`str`, *optional*): - The git revision to tag. It can be a branch name or the OID/SHA of a - commit, as a hexadecimal string. Shorthands (7 first characters) are - also supported. Defaults to the head of the `"main"` branch. - - token (`str`, *optional*): - Authentication token. Will default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if tagging a dataset or - space, `None` or `"model"` if tagging a model. Default is - `None`. - - exist_ok (`bool`, *optional*, defaults to `False`): - If `True`, do not raise an error if tag already exists. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private - but not authenticated or repo does not exist. - [`~utils.RevisionNotFoundError`]: - If revision is not found (error 404) on the repo. - [`~utils.HfHubHTTPError`]: - If the branch already exists on the repo (error 409) and `exist_ok` is - set to `False`. - """ - if repo_type is None: - repo_type = REPO_TYPE_MODEL - revision = quote(revision, safe="") if revision is not None else DEFAULT_REVISION - - # Prepare request - tag_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/tag/{revision}" - headers = self._build_hf_headers(token=token, is_write_action=True) - payload = {"tag": tag} - if tag_message is not None: - payload["message"] = tag_message - - # Tag - response = get_session().post(url=tag_url, headers=headers, json=payload) - try: - hf_raise_for_status(response) - except HfHubHTTPError as e: - if not (e.response.status_code == 409 and exist_ok): - raise - - @validate_hf_hub_args - def delete_tag( - self, - repo_id: str, - *, - tag: str, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> None: - """ - Delete a tag from a repo on the Hub. - - Args: - repo_id (`str`): - The repository in which a tag will be deleted. - Example: `"user/my-cool-model"`. - - tag (`str`): - The name of the tag to delete. - - token (`str`, *optional*): - Authentication token. Will default to the stored token. - - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if tagging a dataset or space, `None` or - `"model"` if tagging a model. Default is `None`. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If repository is not found (error 404): wrong repo_id/repo_type, private - but not authenticated or repo does not exist. - [`~utils.RevisionNotFoundError`]: - If tag is not found. - """ - if repo_type is None: - repo_type = REPO_TYPE_MODEL - tag = quote(tag, safe="") - - # Prepare request - tag_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/tag/{tag}" - headers = self._build_hf_headers(token=token, is_write_action=True) - - # Un-tag - response = get_session().delete(url=tag_url, headers=headers) - hf_raise_for_status(response) - - @validate_hf_hub_args - def get_full_repo_name( - self, - model_id: str, - *, - organization: Optional[str] = None, - token: Optional[Union[bool, str]] = None, - ): - """ - Returns the repository name for a given model ID and optional - organization. - - Args: - model_id (`str`): - The name of the model. - organization (`str`, *optional*): - If passed, the repository name will be in the organization - namespace instead of the user namespace. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - - Returns: - `str`: The repository name in the user's namespace - ({username}/{model_id}) if no organization is passed, and under the - organization namespace ({organization}/{model_id}) otherwise. - """ - if organization is None: - if "/" in model_id: - username = model_id.split("/")[0] - else: - username = self.whoami(token=token)["name"] # type: ignore - return f"{username}/{model_id}" - else: - return f"{organization}/{model_id}" - - @validate_hf_hub_args - def get_repo_discussions( - self, - repo_id: str, - *, - repo_type: Optional[str] = None, - token: Optional[str] = None, - ) -> Iterator[Discussion]: - """ - Fetches Discussions and Pull Requests for the given repo. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if fetching from a dataset or - space, `None` or `"model"` if fetching from a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token). - - Returns: - `Iterator[Discussion]`: An iterator of [`Discussion`] objects. - - Example: - Collecting all discussions of a repo in a list: - - ```python - >>> from huggingface_hub import get_repo_discussions - >>> discussions_list = list(get_repo_discussions(repo_id="bert-base-uncased")) - ``` - - Iterating over discussions of a repo: - - ```python - >>> from huggingface_hub import get_repo_discussions - >>> for discussion in get_repo_discussions(repo_id="bert-base-uncased"): - ... print(discussion.num, discussion.title) - ``` - """ - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") - if repo_type is None: - repo_type = REPO_TYPE_MODEL - - headers = self._build_hf_headers(token=token) - - def _fetch_discussion_page(page_index: int): - path = f"{self.endpoint}/api/{repo_type}s/{repo_id}/discussions?p={page_index}" - resp = get_session().get(path, headers=headers) - hf_raise_for_status(resp) - paginated_discussions = resp.json() - total = paginated_discussions["count"] - start = paginated_discussions["start"] - discussions = paginated_discussions["discussions"] - has_next = (start + len(discussions)) < total - return discussions, has_next - - has_next, page_index = True, 0 - - while has_next: - discussions, has_next = _fetch_discussion_page(page_index=page_index) - for discussion in discussions: - yield Discussion( - title=discussion["title"], - num=discussion["num"], - author=discussion.get("author", {}).get("name", "deleted"), - created_at=parse_datetime(discussion["createdAt"]), - status=discussion["status"], - repo_id=discussion["repo"]["name"], - repo_type=discussion["repo"]["type"], - is_pull_request=discussion["isPullRequest"], - endpoint=self.endpoint, - ) - page_index = page_index + 1 - - @validate_hf_hub_args - def get_discussion_details( - self, - repo_id: str, - discussion_num: int, - *, - repo_type: Optional[str] = None, - token: Optional[str] = None, - ) -> DiscussionWithDetails: - """Fetches a Discussion's / Pull Request 's details from the Hub. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - discussion_num (`int`): - The number of the Discussion or Pull Request . Must be a strictly positive integer. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - - Returns: [`DiscussionWithDetails`] - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - if not isinstance(discussion_num, int) or discussion_num <= 0: - raise ValueError("Invalid discussion_num, must be a positive integer") - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") - if repo_type is None: - repo_type = REPO_TYPE_MODEL - - path = f"{self.endpoint}/api/{repo_type}s/{repo_id}/discussions/{discussion_num}" - headers = self._build_hf_headers(token=token) - resp = get_session().get(path, params={"diff": "1"}, headers=headers) - hf_raise_for_status(resp) - - discussion_details = resp.json() - is_pull_request = discussion_details["isPullRequest"] - - target_branch = discussion_details["changes"]["base"] if is_pull_request else None - conflicting_files = discussion_details["filesWithConflicts"] if is_pull_request else None - merge_commit_oid = discussion_details["changes"].get("mergeCommitId", None) if is_pull_request else None - - return DiscussionWithDetails( - title=discussion_details["title"], - num=discussion_details["num"], - author=discussion_details.get("author", {}).get("name", "deleted"), - created_at=parse_datetime(discussion_details["createdAt"]), - status=discussion_details["status"], - repo_id=discussion_details["repo"]["name"], - repo_type=discussion_details["repo"]["type"], - is_pull_request=discussion_details["isPullRequest"], - events=[deserialize_event(evt) for evt in discussion_details["events"]], - conflicting_files=conflicting_files, - target_branch=target_branch, - merge_commit_oid=merge_commit_oid, - diff=discussion_details.get("diff"), - endpoint=self.endpoint, - ) - - @validate_hf_hub_args - def create_discussion( - self, - repo_id: str, - title: str, - *, - token: Optional[str] = None, - description: Optional[str] = None, - repo_type: Optional[str] = None, - pull_request: bool = False, - ) -> DiscussionWithDetails: - """Creates a Discussion or Pull Request. - - Pull Requests created programmatically will be in `"draft"` status. - - Creating a Pull Request with changes can also be done at once with [`HfApi.create_commit`]. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - title (`str`): - The title of the discussion. It can be up to 200 characters long, - and must be at least 3 characters long. Leading and trailing whitespaces - will be stripped. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - description (`str`, *optional*): - An optional description for the Pull Request. - Defaults to `"Discussion opened with the huggingface_hub Python library"` - pull_request (`bool`, *optional*): - Whether to create a Pull Request or discussion. If `True`, creates a Pull Request. - If `False`, creates a discussion. Defaults to `False`. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - - Returns: [`DiscussionWithDetails`] - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - """ - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") - if repo_type is None: - repo_type = REPO_TYPE_MODEL - - if description is not None: - description = description.strip() - description = ( - description - if description - else ( - f"{'Pull Request' if pull_request else 'Discussion'} opened with the" - " [huggingface_hub Python" - " library](https://huggingface.co/docs/huggingface_hub)" - ) - ) - - headers = self._build_hf_headers(token=token, is_write_action=True) - resp = get_session().post( - f"{self.endpoint}/api/{repo_type}s/{repo_id}/discussions", - json={ - "title": title.strip(), - "description": description, - "pullRequest": pull_request, - }, - headers=headers, - ) - hf_raise_for_status(resp) - num = resp.json()["num"] - return self.get_discussion_details( - repo_id=repo_id, - repo_type=repo_type, - discussion_num=num, - token=token, - ) - - @validate_hf_hub_args - def create_pull_request( - self, - repo_id: str, - title: str, - *, - token: Optional[str] = None, - description: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> DiscussionWithDetails: - """Creates a Pull Request . Pull Requests created programmatically will be in `"draft"` status. - - Creating a Pull Request with changes can also be done at once with [`HfApi.create_commit`]; - - This is a wrapper around [`HfApi.create_discussion`]. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - title (`str`): - The title of the discussion. It can be up to 200 characters long, - and must be at least 3 characters long. Leading and trailing whitespaces - will be stripped. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - description (`str`, *optional*): - An optional description for the Pull Request. - Defaults to `"Discussion opened with the huggingface_hub Python library"` - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - - Returns: [`DiscussionWithDetails`] - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - """ - return self.create_discussion( - repo_id=repo_id, - title=title, - token=token, - description=description, - repo_type=repo_type, - pull_request=True, - ) - - def _post_discussion_changes( - self, - *, - repo_id: str, - discussion_num: int, - resource: str, - body: Optional[dict] = None, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> requests.Response: - """Internal utility to POST changes to a Discussion or Pull Request""" - if not isinstance(discussion_num, int) or discussion_num <= 0: - raise ValueError("Invalid discussion_num, must be a positive integer") - if repo_type not in REPO_TYPES: - raise ValueError(f"Invalid repo type, must be one of {REPO_TYPES}") - if repo_type is None: - repo_type = REPO_TYPE_MODEL - repo_id = f"{repo_type}s/{repo_id}" - - path = f"{self.endpoint}/api/{repo_id}/discussions/{discussion_num}/{resource}" - - headers = self._build_hf_headers(token=token, is_write_action=True) - resp = requests.post(path, headers=headers, json=body) - hf_raise_for_status(resp) - return resp - - @validate_hf_hub_args - def comment_discussion( - self, - repo_id: str, - discussion_num: int, - comment: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> DiscussionComment: - """Creates a new comment on the given Discussion. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - discussion_num (`int`): - The number of the Discussion or Pull Request . Must be a strictly positive integer. - comment (`str`): - The content of the comment to create. Comments support markdown formatting. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - - Returns: - [`DiscussionComment`]: the newly created comment - - - Examples: - ```python - - >>> comment = \"\"\" - ... Hello @otheruser! - ... - ... # This is a title - ... - ... **This is bold**, *this is italic* and ~this is strikethrough~ - ... And [this](http://url) is a link - ... \"\"\" - - >>> HfApi().comment_discussion( - ... repo_id="username/repo_name", - ... discussion_num=34 - ... comment=comment - ... ) - # DiscussionComment(id='deadbeef0000000', type='comment', ...) - - ``` - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - resp = self._post_discussion_changes( - repo_id=repo_id, - repo_type=repo_type, - discussion_num=discussion_num, - token=token, - resource="comment", - body={"comment": comment}, - ) - return deserialize_event(resp.json()["newMessage"]) # type: ignore - - @validate_hf_hub_args - def rename_discussion( - self, - repo_id: str, - discussion_num: int, - new_title: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> DiscussionTitleChange: - """Renames a Discussion. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - discussion_num (`int`): - The number of the Discussion or Pull Request . Must be a strictly positive integer. - new_title (`str`): - The new title for the discussion - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - - Returns: - [`DiscussionTitleChange`]: the title change event - - - Examples: - ```python - >>> new_title = "New title, fixing a typo" - >>> HfApi().rename_discussion( - ... repo_id="username/repo_name", - ... discussion_num=34 - ... new_title=new_title - ... ) - # DiscussionTitleChange(id='deadbeef0000000', type='title-change', ...) - - ``` - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - resp = self._post_discussion_changes( - repo_id=repo_id, - repo_type=repo_type, - discussion_num=discussion_num, - token=token, - resource="title", - body={"title": new_title}, - ) - return deserialize_event(resp.json()["newTitle"]) # type: ignore - - @validate_hf_hub_args - def change_discussion_status( - self, - repo_id: str, - discussion_num: int, - new_status: Literal["open", "closed"], - *, - token: Optional[str] = None, - comment: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> DiscussionStatusChange: - """Closes or re-opens a Discussion or Pull Request. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - discussion_num (`int`): - The number of the Discussion or Pull Request . Must be a strictly positive integer. - new_status (`str`): - The new status for the discussion, either `"open"` or `"closed"`. - comment (`str`, *optional*): - An optional comment to post with the status change. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - - Returns: - [`DiscussionStatusChange`]: the status change event - - - Examples: - ```python - >>> new_title = "New title, fixing a typo" - >>> HfApi().rename_discussion( - ... repo_id="username/repo_name", - ... discussion_num=34 - ... new_title=new_title - ... ) - # DiscussionStatusChange(id='deadbeef0000000', type='status-change', ...) - - ``` - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - if new_status not in ["open", "closed"]: - raise ValueError("Invalid status, valid statuses are: 'open' and 'closed'") - body: Dict[str, str] = {"status": new_status} - if comment and comment.strip(): - body["comment"] = comment.strip() - resp = self._post_discussion_changes( - repo_id=repo_id, - repo_type=repo_type, - discussion_num=discussion_num, - token=token, - resource="status", - body=body, - ) - return deserialize_event(resp.json()["newStatus"]) # type: ignore - - @validate_hf_hub_args - def merge_pull_request( - self, - repo_id: str, - discussion_num: int, - *, - token: Optional[str] = None, - comment: Optional[str] = None, - repo_type: Optional[str] = None, - ): - """Merges a Pull Request. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - discussion_num (`int`): - The number of the Discussion or Pull Request . Must be a strictly positive integer. - comment (`str`, *optional*): - An optional comment to post with the status change. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - - Returns: - [`DiscussionStatusChange`]: the status change event - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - self._post_discussion_changes( - repo_id=repo_id, - repo_type=repo_type, - discussion_num=discussion_num, - token=token, - resource="merge", - body={"comment": comment.strip()} if comment and comment.strip() else None, - ) - - @validate_hf_hub_args - def edit_discussion_comment( - self, - repo_id: str, - discussion_num: int, - comment_id: str, - new_content: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> DiscussionComment: - """Edits a comment on a Discussion / Pull Request. - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - discussion_num (`int`): - The number of the Discussion or Pull Request . Must be a strictly positive integer. - comment_id (`str`): - The ID of the comment to edit. - new_content (`str`): - The new content of the comment. Comments support markdown formatting. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - - Returns: - [`DiscussionComment`]: the edited comment - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - resp = self._post_discussion_changes( - repo_id=repo_id, - repo_type=repo_type, - discussion_num=discussion_num, - token=token, - resource=f"comment/{comment_id.lower()}/edit", - body={"content": new_content}, - ) - return deserialize_event(resp.json()["updatedComment"]) # type: ignore - - @validate_hf_hub_args - def hide_discussion_comment( - self, - repo_id: str, - discussion_num: int, - comment_id: str, - *, - token: Optional[str] = None, - repo_type: Optional[str] = None, - ) -> DiscussionComment: - """Hides a comment on a Discussion / Pull Request. - - - Hidden comments' content cannot be retrieved anymore. Hiding a comment is irreversible. - - - Args: - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - discussion_num (`int`): - The number of the Discussion or Pull Request . Must be a strictly positive integer. - comment_id (`str`): - The ID of the comment to edit. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if uploading to a dataset or - space, `None` or `"model"` if uploading to a model. Default is - `None`. - token (`str`, *optional*): - An authentication token (See https://huggingface.co/settings/token) - - Returns: - [`DiscussionComment`]: the hidden comment - - - - Raises the following errors: - - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if some parameter value is invalid - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - - """ - warnings.warn( - "Hidden comments' content cannot be retrieved anymore. Hiding a comment is irreversible.", - UserWarning, - ) - resp = self._post_discussion_changes( - repo_id=repo_id, - repo_type=repo_type, - discussion_num=discussion_num, - token=token, - resource=f"comment/{comment_id.lower()}/hide", - ) - return deserialize_event(resp.json()["updatedComment"]) # type: ignore - - @validate_hf_hub_args - def add_space_secret( - self, repo_id: str, key: str, value: str, *, description: Optional[str] = None, token: Optional[str] = None - ) -> None: - """Adds or updates a secret in a Space. - - Secrets allow to set secret keys or tokens to a Space without hardcoding them. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets. - - Args: - repo_id (`str`): - ID of the repo to update. Example: `"bigcode/in-the-stack"`. - key (`str`): - Secret key. Example: `"GITHUB_API_KEY"` - value (`str`): - Secret value. Example: `"your_github_api_key"`. - description (`str`, *optional*): - Secret description. Example: `"Github API key to access the Github API"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - """ - payload = {"key": key, "value": value} - if description is not None: - payload["description"] = description - r = get_session().post( - f"{self.endpoint}/api/spaces/{repo_id}/secrets", - headers=self._build_hf_headers(token=token), - json=payload, - ) - hf_raise_for_status(r) - - @validate_hf_hub_args - def delete_space_secret(self, repo_id: str, key: str, *, token: Optional[str] = None) -> None: - """Deletes a secret from a Space. - - Secrets allow to set secret keys or tokens to a Space without hardcoding them. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets. - - Args: - repo_id (`str`): - ID of the repo to update. Example: `"bigcode/in-the-stack"`. - key (`str`): - Secret key. Example: `"GITHUB_API_KEY"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - """ - r = get_session().delete( - f"{self.endpoint}/api/spaces/{repo_id}/secrets", - headers=self._build_hf_headers(token=token), - json={"key": key}, - ) - hf_raise_for_status(r) - - @validate_hf_hub_args - def get_space_variables(self, repo_id: str, *, token: Optional[str] = None) -> Dict[str, SpaceVariable]: - """Gets all variables from a Space. - - Variables allow to set environment variables to a Space without hardcoding them. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets-and-environment-variables - - Args: - repo_id (`str`): - ID of the repo to query. Example: `"bigcode/in-the-stack"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - """ - r = get_session().get( - f"{self.endpoint}/api/spaces/{repo_id}/variables", - headers=self._build_hf_headers(token=token), - ) - hf_raise_for_status(r) - return {k: SpaceVariable(k, v) for k, v in r.json().items()} - - @validate_hf_hub_args - def add_space_variable( - self, repo_id: str, key: str, value: str, *, description: Optional[str] = None, token: Optional[str] = None - ) -> Dict[str, SpaceVariable]: - """Adds or updates a variable in a Space. - - Variables allow to set environment variables to a Space without hardcoding them. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets-and-environment-variables - - Args: - repo_id (`str`): - ID of the repo to update. Example: `"bigcode/in-the-stack"`. - key (`str`): - Variable key. Example: `"MODEL_REPO_ID"` - value (`str`): - Variable value. Example: `"the_model_repo_id"`. - description (`str`): - Description of the variable. Example: `"Model Repo ID of the implemented model"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - """ - payload = {"key": key, "value": value} - if description is not None: - payload["description"] = description - r = get_session().post( - f"{self.endpoint}/api/spaces/{repo_id}/variables", - headers=self._build_hf_headers(token=token), - json=payload, - ) - hf_raise_for_status(r) - return {k: SpaceVariable(k, v) for k, v in r.json().items()} - - @validate_hf_hub_args - def delete_space_variable( - self, repo_id: str, key: str, *, token: Optional[str] = None - ) -> Dict[str, SpaceVariable]: - """Deletes a variable from a Space. - - Variables allow to set environment variables to a Space without hardcoding them. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets-and-environment-variables - - Args: - repo_id (`str`): - ID of the repo to update. Example: `"bigcode/in-the-stack"`. - key (`str`): - Variable key. Example: `"MODEL_REPO_ID"` - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - """ - r = get_session().delete( - f"{self.endpoint}/api/spaces/{repo_id}/variables", - headers=self._build_hf_headers(token=token), - json={"key": key}, - ) - hf_raise_for_status(r) - return {k: SpaceVariable(k, v) for k, v in r.json().items()} - - @validate_hf_hub_args - def get_space_runtime(self, repo_id: str, *, token: Optional[str] = None) -> SpaceRuntime: - """Gets runtime information about a Space. - - Args: - repo_id (`str`): - ID of the repo to update. Example: `"bigcode/in-the-stack"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if - not provided. - Returns: - [`SpaceRuntime`]: Runtime information about a Space including Space stage and hardware. - """ - r = get_session().get( - f"{self.endpoint}/api/spaces/{repo_id}/runtime", headers=self._build_hf_headers(token=token) - ) - hf_raise_for_status(r) - return SpaceRuntime(r.json()) - - @validate_hf_hub_args - def request_space_hardware( - self, - repo_id: str, - hardware: SpaceHardware, - *, - token: Optional[str] = None, - sleep_time: Optional[int] = None, - ) -> SpaceRuntime: - """Request new hardware for a Space. - - Args: - repo_id (`str`): - ID of the repo to update. Example: `"bigcode/in-the-stack"`. - hardware (`str` or [`SpaceHardware`]): - Hardware on which to run the Space. Example: `"t4-medium"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - sleep_time (`int`, *optional*): - Number of seconds of inactivity to wait before a Space is put to sleep. Set to `-1` if you don't want - your Space to sleep (default behavior for upgraded hardware). For free hardware, you can't configure - the sleep time (value is fixed to 48 hours of inactivity). - See https://huggingface.co/docs/hub/spaces-gpus#sleep-time for more details. - Returns: - [`SpaceRuntime`]: Runtime information about a Space including Space stage and hardware. - - - - It is also possible to request hardware directly when creating the Space repo! See [`create_repo`] for details. - - - """ - if sleep_time is not None and hardware == SpaceHardware.CPU_BASIC: - warnings.warn( - "If your Space runs on the default 'cpu-basic' hardware, it will go to sleep if inactive for more" - " than 48 hours. This value is not configurable. If you don't want your Space to deactivate or if" - " you want to set a custom sleep time, you need to upgrade to a paid Hardware.", - UserWarning, - ) - payload: Dict[str, Any] = {"flavor": hardware} - if sleep_time is not None: - payload["sleepTimeSeconds"] = sleep_time - r = get_session().post( - f"{self.endpoint}/api/spaces/{repo_id}/hardware", - headers=self._build_hf_headers(token=token), - json=payload, - ) - hf_raise_for_status(r) - return SpaceRuntime(r.json()) - - @validate_hf_hub_args - def set_space_sleep_time(self, repo_id: str, sleep_time: int, *, token: Optional[str] = None) -> SpaceRuntime: - """Set a custom sleep time for a Space running on upgraded hardware.. - - Your Space will go to sleep after X seconds of inactivity. You are not billed when your Space is in "sleep" - mode. If a new visitor lands on your Space, it will "wake it up". Only upgraded hardware can have a - configurable sleep time. To know more about the sleep stage, please refer to - https://huggingface.co/docs/hub/spaces-gpus#sleep-time. - - Args: - repo_id (`str`): - ID of the repo to update. Example: `"bigcode/in-the-stack"`. - sleep_time (`int`, *optional*): - Number of seconds of inactivity to wait before a Space is put to sleep. Set to `-1` if you don't want - your Space to pause (default behavior for upgraded hardware). For free hardware, you can't configure - the sleep time (value is fixed to 48 hours of inactivity). - See https://huggingface.co/docs/hub/spaces-gpus#sleep-time for more details. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - Returns: - [`SpaceRuntime`]: Runtime information about a Space including Space stage and hardware. - - - - It is also possible to set a custom sleep time when requesting hardware with [`request_space_hardware`]. - - - """ - r = get_session().post( - f"{self.endpoint}/api/spaces/{repo_id}/sleeptime", - headers=self._build_hf_headers(token=token), - json={"seconds": sleep_time}, - ) - hf_raise_for_status(r) - runtime = SpaceRuntime(r.json()) - - hardware = runtime.requested_hardware or runtime.hardware - if hardware == SpaceHardware.CPU_BASIC: - warnings.warn( - "If your Space runs on the default 'cpu-basic' hardware, it will go to sleep if inactive for more" - " than 48 hours. This value is not configurable. If you don't want your Space to deactivate or if" - " you want to set a custom sleep time, you need to upgrade to a paid Hardware.", - UserWarning, - ) - return runtime - - @validate_hf_hub_args - def pause_space(self, repo_id: str, *, token: Optional[str] = None) -> SpaceRuntime: - """Pause your Space. - - A paused Space stops executing until manually restarted by its owner. This is different from the sleeping - state in which free Spaces go after 48h of inactivity. Paused time is not billed to your account, no matter the - hardware you've selected. To restart your Space, use [`restart_space`] and go to your Space settings page. - - For more details, please visit [the docs](https://huggingface.co/docs/hub/spaces-gpus#pause). - - Args: - repo_id (`str`): - ID of the Space to pause. Example: `"Salesforce/BLIP2"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - - Returns: - [`SpaceRuntime`]: Runtime information about your Space including `stage=PAUSED` and requested hardware. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If your Space is not found (error 404). Most probably wrong repo_id or your space is private but you - are not authenticated. - [`~utils.HfHubHTTPError`]: - 403 Forbidden: only the owner of a Space can pause it. If you want to manage a Space that you don't - own, either ask the owner by opening a Discussion or duplicate the Space. - [`~utils.BadRequestError`]: - If your Space is a static Space. Static Spaces are always running and never billed. If you want to hide - a static Space, you can set it to private. - """ - r = get_session().post( - f"{self.endpoint}/api/spaces/{repo_id}/pause", headers=self._build_hf_headers(token=token) - ) - hf_raise_for_status(r) - return SpaceRuntime(r.json()) - - @validate_hf_hub_args - def restart_space( - self, repo_id: str, *, token: Optional[str] = None, factory_reboot: bool = False - ) -> SpaceRuntime: - """Restart your Space. - - This is the only way to programmatically restart a Space if you've put it on Pause (see [`pause_space`]). You - must be the owner of the Space to restart it. If you are using an upgraded hardware, your account will be - billed as soon as the Space is restarted. You can trigger a restart no matter the current state of a Space. - - For more details, please visit [the docs](https://huggingface.co/docs/hub/spaces-gpus#pause). - - Args: - repo_id (`str`): - ID of the Space to restart. Example: `"Salesforce/BLIP2"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - factory_reboot (`bool`, *optional*): - If `True`, the Space will be rebuilt from scratch without caching any requirements. - - Returns: - [`SpaceRuntime`]: Runtime information about your Space. - - Raises: - [`~utils.RepositoryNotFoundError`]: - If your Space is not found (error 404). Most probably wrong repo_id or your space is private but you - are not authenticated. - [`~utils.HfHubHTTPError`]: - 403 Forbidden: only the owner of a Space can restart it. If you want to restart a Space that you don't - own, either ask the owner by opening a Discussion or duplicate the Space. - [`~utils.BadRequestError`]: - If your Space is a static Space. Static Spaces are always running and never billed. If you want to hide - a static Space, you can set it to private. - """ - params = {} - if factory_reboot: - params["factory"] = "true" - r = get_session().post( - f"{self.endpoint}/api/spaces/{repo_id}/restart", headers=self._build_hf_headers(token=token), params=params - ) - hf_raise_for_status(r) - return SpaceRuntime(r.json()) - - @validate_hf_hub_args - def duplicate_space( - self, - from_id: str, - to_id: Optional[str] = None, - *, - private: Optional[bool] = None, - token: Optional[str] = None, - exist_ok: bool = False, - hardware: Optional[SpaceHardware] = None, - storage: Optional[SpaceStorage] = None, - sleep_time: Optional[int] = None, - secrets: Optional[List[Dict[str, str]]] = None, - variables: Optional[List[Dict[str, str]]] = None, - ) -> RepoUrl: - """Duplicate a Space. - - Programmatically duplicate a Space. The new Space will be created in your account and will be in the same state - as the original Space (running or paused). You can duplicate a Space no matter the current state of a Space. - - Args: - from_id (`str`): - ID of the Space to duplicate. Example: `"pharma/CLIP-Interrogator"`. - to_id (`str`, *optional*): - ID of the new Space. Example: `"dog/CLIP-Interrogator"`. If not provided, the new Space will have the same - name as the original Space, but in your account. - private (`bool`, *optional*): - Whether the new Space should be private or not. Defaults to the same privacy as the original Space. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - exist_ok (`bool`, *optional*, defaults to `False`): - If `True`, do not raise an error if repo already exists. - hardware (`SpaceHardware` or `str`, *optional*): - Choice of Hardware. Example: `"t4-medium"`. See [`SpaceHardware`] for a complete list. - storage (`SpaceStorage` or `str`, *optional*): - Choice of persistent storage tier. Example: `"small"`. See [`SpaceStorage`] for a complete list. - sleep_time (`int`, *optional*): - Number of seconds of inactivity to wait before a Space is put to sleep. Set to `-1` if you don't want - your Space to sleep (default behavior for upgraded hardware). For free hardware, you can't configure - the sleep time (value is fixed to 48 hours of inactivity). - See https://huggingface.co/docs/hub/spaces-gpus#sleep-time for more details. - secrets (`List[Dict[str, str]]`, *optional*): - A list of secret keys to set in your Space. Each item is in the form `{"key": ..., "value": ..., "description": ...}` where description is optional. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets. - variables (`List[Dict[str, str]]`, *optional*): - A list of public environment variables to set in your Space. Each item is in the form `{"key": ..., "value": ..., "description": ...}` where description is optional. - For more details, see https://huggingface.co/docs/hub/spaces-overview#managing-secrets-and-environment-variables. - - Returns: - [`RepoUrl`]: URL to the newly created repo. Value is a subclass of `str` containing - attributes like `endpoint`, `repo_type` and `repo_id`. - - Raises: - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the HuggingFace API returned an error - - [`~utils.RepositoryNotFoundError`] - If one of `from_id` or `to_id` cannot be found. This may be because it doesn't exist, - or because it is set to `private` and you do not have access. - - Example: - ```python - >>> from huggingface_hub import duplicate_space - - # Duplicate a Space to your account - >>> duplicate_space("multimodalart/dreambooth-training") - RepoUrl('https://huggingface.co/spaces/nateraw/dreambooth-training',...) - - # Can set custom destination id and visibility flag. - >>> duplicate_space("multimodalart/dreambooth-training", to_id="my-dreambooth", private=True) - RepoUrl('https://huggingface.co/spaces/nateraw/my-dreambooth',...) - ``` - """ - # Parse to_id if provided - parsed_to_id = RepoUrl(to_id) if to_id is not None else None - - # Infer target repo_id - to_namespace = ( # set namespace manually or default to username - parsed_to_id.namespace - if parsed_to_id is not None and parsed_to_id.namespace is not None - else self.whoami(token)["name"] - ) - to_repo_name = parsed_to_id.repo_name if to_id is not None else RepoUrl(from_id).repo_name # type: ignore - - # repository must be a valid repo_id (namespace/repo_name). - payload: Dict[str, Any] = {"repository": f"{to_namespace}/{to_repo_name}"} - - keys = ["private", "hardware", "storageTier", "sleepTimeSeconds", "secrets", "variables"] - values = [private, hardware, storage, sleep_time, secrets, variables] - payload.update({k: v for k, v in zip(keys, values) if v is not None}) - - if sleep_time is not None and hardware == SpaceHardware.CPU_BASIC: - warnings.warn( - "If your Space runs on the default 'cpu-basic' hardware, it will go to sleep if inactive for more" - " than 48 hours. This value is not configurable. If you don't want your Space to deactivate or if" - " you want to set a custom sleep time, you need to upgrade to a paid Hardware.", - UserWarning, - ) - - r = get_session().post( - f"{self.endpoint}/api/spaces/{from_id}/duplicate", - headers=self._build_hf_headers(token=token, is_write_action=True), - json=payload, - ) - - try: - hf_raise_for_status(r) - except HTTPError as err: - if exist_ok and err.response.status_code == 409: - # Repo already exists and `exist_ok=True` - pass - else: - raise - - return RepoUrl(r.json()["url"], endpoint=self.endpoint) - - @validate_hf_hub_args - def request_space_storage( - self, - repo_id: str, - storage: SpaceStorage, - *, - token: Optional[str] = None, - ) -> SpaceRuntime: - """Request persistent storage for a Space. - - Args: - repo_id (`str`): - ID of the Space to update. Example: `"HuggingFaceH4/open_llm_leaderboard"`. - storage (`str` or [`SpaceStorage`]): - Storage tier. Either 'small', 'medium', or 'large'. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - Returns: - [`SpaceRuntime`]: Runtime information about a Space including Space stage and hardware. - - - - It is not possible to decrease persistent storage after its granted. To do so, you must delete it - via [`delete_space_storage`]. - - - """ - payload: Dict[str, SpaceStorage] = {"tier": storage} - r = get_session().post( - f"{self.endpoint}/api/spaces/{repo_id}/storage", - headers=self._build_hf_headers(token=token), - json=payload, - ) - hf_raise_for_status(r) - return SpaceRuntime(r.json()) - - @validate_hf_hub_args - def delete_space_storage( - self, - repo_id: str, - *, - token: Optional[str] = None, - ) -> SpaceRuntime: - """Delete persistent storage for a Space. - - Args: - repo_id (`str`): - ID of the Space to update. Example: `"HuggingFaceH4/open_llm_leaderboard"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - Returns: - [`SpaceRuntime`]: Runtime information about a Space including Space stage and hardware. - Raises: - [`BadRequestError`] - If space has no persistent storage. - - """ - r = get_session().delete( - f"{self.endpoint}/api/spaces/{repo_id}/storage", - headers=self._build_hf_headers(token=token), - ) - hf_raise_for_status(r) - return SpaceRuntime(r.json()) - - ######################## - # Collection Endpoints # - ######################## - - def get_collection(self, collection_slug: str, *, token: Optional[str] = None) -> Collection: - """Gets information about a Collection on the Hub. - - Args: - collection_slug (`str`): - Slug of the collection of the Hub. Example: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - - Returns: [`Collection`] - - Example: - - ```py - >>> from huggingface_hub import get_collection - >>> collection = get_collection("TheBloke/recent-models-64f9a55bb3115b4f513ec026") - >>> collection.title - 'Recent models' - >>> len(collection.items) - 37 - >>> collection.items[0] - CollectionItem: { - {'item_object_id': '6507f6d5423b46492ee1413e', - 'item_id': 'TheBloke/TigerBot-70B-Chat-GPTQ', - 'author': 'TheBloke', - 'item_type': 'model', - 'lastModified': '2023-09-19T12:55:21.000Z', - (...) - }} - ``` - """ - r = get_session().get( - f"{self.endpoint}/api/collections/{collection_slug}", headers=self._build_hf_headers(token=token) - ) - hf_raise_for_status(r) - return Collection(r.json(), endpoint=self.endpoint) - - def create_collection( - self, - title: str, - *, - namespace: Optional[str] = None, - description: Optional[str] = None, - private: bool = False, - exists_ok: bool = False, - token: Optional[str] = None, - ) -> Collection: - """Create a new Collection on the Hub. - - Args: - title (`str`): - Title of the collection to create. Example: `"Recent models"`. - namespace (`str`, *optional*): - Namespace of the collection to create (username or org). Will default to the owner name. - description (`str`, *optional*): - Description of the collection to create. - private (`bool`, *optional*): - Whether the collection should be private or not. Defaults to `False` (i.e. public collection). - exists_ok (`bool`, *optional*): - If `True`, do not raise an error if collection already exists. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - - Returns: [`Collection`] - - Example: - - ```py - >>> from huggingface_hub import create_collection - >>> collection = create_collection( - ... title="ICCV 2023", - ... description="Portfolio of models, papers and demos I presented at ICCV 2023", - ... ) - >>> collection.slug - "username/iccv-2023-64f9a55bb3115b4f513ec026" - ``` - """ - if namespace is None: - namespace = self.whoami(token)["name"] - - payload = { - "title": title, - "namespace": namespace, - "private": private, - } - if description is not None: - payload["description"] = description - - r = get_session().post( - f"{self.endpoint}/api/collections", headers=self._build_hf_headers(token=token), json=payload - ) - try: - hf_raise_for_status(r) - except HTTPError as err: - if exists_ok and err.response.status_code == 409: - # Collection already exists and `exists_ok=True` - slug = r.json()["slug"] - return self.get_collection(slug, token=token) - else: - raise - return Collection(r.json(), endpoint=self.endpoint) - - def update_collection_metadata( - self, - collection_slug: str, - *, - title: Optional[str] = None, - description: Optional[str] = None, - position: Optional[int] = None, - private: Optional[bool] = None, - theme: Optional[str] = None, - token: Optional[str] = None, - ) -> Collection: - """Update metadata of a collection on the Hub. - - All arguments are optional. Only provided metadata will be updated. - - Args: - collection_slug (`str`): - Slug of the collection to update. Example: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`. - title (`str`): - Title of the collection to update. - description (`str`, *optional*): - Description of the collection to update. - position (`int`, *optional*): - New position of the collection in the list of collections of the user. - private (`bool`, *optional*): - Whether the collection should be private or not. - theme (`str`, *optional*): - Theme of the collection on the Hub. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - - Returns: [`Collection`] - - Example: - - ```py - >>> from huggingface_hub import update_collection_metadata - >>> collection = update_collection_metadata( - ... collection_slug="username/iccv-2023-64f9a55bb3115b4f513ec026", - ... title="ICCV Oct. 2023" - ... description="Portfolio of models, datasets, papers and demos I presented at ICCV Oct. 2023", - ... private=False, - ... theme="pink", - ... ) - >>> collection.slug - "username/iccv-oct-2023-64f9a55bb3115b4f513ec026" - # ^collection slug got updated but not the trailing ID - ``` - """ - payload = { - "position": position, - "private": private, - "theme": theme, - "title": title, - "description": description, - } - r = get_session().patch( - f"{self.endpoint}/api/collections/{collection_slug}", - headers=self._build_hf_headers(token=token), - # Only send not-none values to the API - json={key: value for key, value in payload.items() if value is not None}, - ) - hf_raise_for_status(r) - return Collection(r.json()["data"], endpoint=self.endpoint) - - def delete_collection( - self, collection_slug: str, *, missing_ok: bool = False, token: Optional[str] = None - ) -> None: - """Delete a collection on the Hub. - - Args: - collection_slug (`str`): - Slug of the collection to delete. Example: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`. - missing_ok (`bool`, *optional*): - If `True`, do not raise an error if collection doesn't exists. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - - Example: - - ```py - >>> from huggingface_hub import delete_collection - >>> collection = delete_collection("username/useless-collection-64f9a55bb3115b4f513ec026", missing_ok=True) - ``` - - - - This is a non-revertible action. A deleted collection cannot be restored. - - - """ - r = get_session().delete( - f"{self.endpoint}/api/collections/{collection_slug}", headers=self._build_hf_headers(token=token) - ) - try: - hf_raise_for_status(r) - except HTTPError as err: - if missing_ok and err.response.status_code == 404: - # Collection doesn't exists and `missing_ok=True` - return - else: - raise - - def add_collection_item( - self, - collection_slug: str, - item_id: str, - item_type: CollectionItemType_T, - *, - note: Optional[str] = None, - exists_ok: bool = False, - token: Optional[str] = None, - ) -> Collection: - """Add an item to a collection on the Hub. - - Args: - collection_slug (`str`): - Slug of the collection to update. Example: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`. - item_id (`str`): - ID of the item to add to the collection. It can be the ID of a repo on the Hub (e.g. `"facebook/bart-large-mnli"`) - or a paper id (e.g. `"2307.09288"`). - item_type (`str`): - Type of the item to add. Can be one of `"model"`, `"dataset"`, `"space"` or `"paper"`. - note (`str`, *optional*): - A note to attach to the item in the collection. The maximum size for a note is 500 characters. - exists_ok (`bool`, *optional*): - If `True`, do not raise an error if item already exists. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - - Returns: [`Collection`] - - Example: - - ```py - >>> from huggingface_hub import add_collection_item - >>> collection = add_collection_item( - ... collection_slug="davanstrien/climate-64f99dc2a5067f6b65531bab", - ... item_id="pierre-loic/climate-news-articles", - ... item_type="dataset" - ... ) - >>> collection.items[-1].item_id - "pierre-loic/climate-news-articles" - # ^item got added to the collection on last position - - # Add item with a note - >>> add_collection_item( - ... collection_slug="davanstrien/climate-64f99dc2a5067f6b65531bab", - ... item_id="datasets/climate_fever", - ... item_type="dataset" - ... note="This dataset adopts the FEVER methodology that consists of 1,535 real-world claims regarding climate-change collected on the internet." - ... ) - (...) - ``` - """ - payload: Dict[str, Any] = {"item": {"id": item_id, "type": item_type}} - if note is not None: - payload["note"] = note - r = get_session().post( - f"{self.endpoint}/api/collections/{collection_slug}/items", - headers=self._build_hf_headers(token=token), - json=payload, - ) - try: - hf_raise_for_status(r) - except HTTPError as err: - if exists_ok and err.response.status_code == 409: - # Item already exists and `exists_ok=True` - return self.get_collection(collection_slug, token=token) - else: - raise - return Collection(r.json(), endpoint=self.endpoint) - - def update_collection_item( - self, - collection_slug: str, - item_object_id: str, - *, - note: Optional[str] = None, - position: Optional[int] = None, - token: Optional[str] = None, - ) -> None: - """Update an item in a collection. - - Args: - collection_slug (`str`): - Slug of the collection to update. Example: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`. - item_object_id (`str`): - ID of the item in the collection. This is not the id of the item on the Hub (repo_id or paper id). - It must be retrieved from a [`CollectionItem`] object. Example: `collection.items[0]._id`. - note (`str`, *optional*): - A note to attach to the item in the collection. The maximum size for a note is 500 characters. - position (`int`, *optional*): - New position of the item in the collection. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - - Example: - - ```py - >>> from huggingface_hub import get_collection, update_collection_item - - # Get collection first - >>> collection = get_collection("TheBloke/recent-models-64f9a55bb3115b4f513ec026") - - # Update item based on its ID (add note + update position) - >>> update_collection_item( - ... collection_slug="TheBloke/recent-models-64f9a55bb3115b4f513ec026", - ... item_object_id=collection.items[-1].item_object_id, - ... note="Newly updated model!" - ... position=0, - ... ) - ``` - """ - payload = {"position": position, "note": note} - r = get_session().patch( - f"{self.endpoint}/api/collections/{collection_slug}/items/{item_object_id}", - headers=self._build_hf_headers(token=token), - # Only send not-none values to the API - json={key: value for key, value in payload.items() if value is not None}, - ) - hf_raise_for_status(r) - - def delete_collection_item( - self, - collection_slug: str, - item_object_id: str, - *, - missing_ok: bool = False, - token: Optional[str] = None, - ) -> None: - """Delete an item from a collection. - - Args: - collection_slug (`str`): - Slug of the collection to update. Example: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`. - item_object_id (`str`): - ID of the item in the collection. This is not the id of the item on the Hub (repo_id or paper id). - It must be retrieved from a [`CollectionItem`] object. Example: `collection.items[0]._id`. - missing_ok (`bool`, *optional*): - If `True`, do not raise an error if item doesn't exists. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token if not provided. - - Example: - - ```py - >>> from huggingface_hub import get_collection, delete_collection_item - - # Get collection first - >>> collection = get_collection("TheBloke/recent-models-64f9a55bb3115b4f513ec026") - - # Delete item based on its ID - >>> delete_collection_item( - ... collection_slug="TheBloke/recent-models-64f9a55bb3115b4f513ec026", - ... item_object_id=collection.items[-1].item_object_id, - ... ) - ``` - """ - r = get_session().delete( - f"{self.endpoint}/api/collections/{collection_slug}/items/{item_object_id}", - headers=self._build_hf_headers(token=token), - ) - try: - hf_raise_for_status(r) - except HTTPError as err: - if missing_ok and err.response.status_code == 404: - # Item already deleted and `missing_ok=True` - return - else: - raise - - def _build_hf_headers( - self, - token: Optional[Union[bool, str]] = None, - is_write_action: bool = False, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - user_agent: Union[Dict, str, None] = None, - ) -> Dict[str, str]: - """ - Alias for [`build_hf_headers`] that uses the token from [`HfApi`] client - when `token` is not provided. - """ - if token is None: - # Cannot do `token = token or self.token` as token can be `False`. - token = self.token - return build_hf_headers( - token=token, - is_write_action=is_write_action, - library_name=library_name or self.library_name, - library_version=library_version or self.library_version, - user_agent=user_agent or self.user_agent, - ) - - def _prepare_upload_folder_deletions( - self, - repo_id: str, - repo_type: Optional[str], - revision: Optional[str], - token: Optional[str], - path_in_repo: str, - delete_patterns: Optional[Union[List[str], str]], - ) -> List[CommitOperationDelete]: - """Generate the list of Delete operations for a commit to delete files from a repo. - - List remote files and match them against the `delete_patterns` constraints. Returns a list of [`CommitOperationDelete`] - with the matching items. - - Note: `.gitattributes` file is essential to make a repo work properly on the Hub. This file will always be - kept even if it matches the `delete_patterns` constraints. - """ - if delete_patterns is None: - # If no delete patterns, no need to list and filter remote files - return [] - - # List remote files - filenames = self.list_repo_files(repo_id=repo_id, revision=revision, repo_type=repo_type, token=token) - - # Compute relative path in repo - if path_in_repo: - path_in_repo = path_in_repo.strip("/") + "/" # harmonize - relpath_to_abspath = { - file[len(path_in_repo) :]: file for file in filenames if file.startswith(path_in_repo) - } - else: - relpath_to_abspath = {file: file for file in filenames} - - # Apply filter on relative paths and return - return [ - CommitOperationDelete(path_in_repo=relpath_to_abspath[relpath], is_folder=False) - for relpath in filter_repo_objects(relpath_to_abspath.keys(), allow_patterns=delete_patterns) - if relpath_to_abspath[relpath] != ".gitattributes" - ] - - -def _prepare_upload_folder_additions( - folder_path: Union[str, Path], - path_in_repo: str, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, -) -> List[CommitOperationAdd]: - """Generate the list of Add operations for a commit to upload a folder. - - Files not matching the `allow_patterns` (allowlist) and `ignore_patterns` (denylist) - constraints are discarded. - """ - folder_path = Path(folder_path).expanduser().resolve() - if not folder_path.is_dir(): - raise ValueError(f"Provided path: '{folder_path}' is not a directory") - - # List files from folder - relpath_to_abspath = { - path.relative_to(folder_path).as_posix(): path - for path in sorted(folder_path.glob("**/*")) # sorted to be deterministic - if path.is_file() - } - - # Filter files and return - # Patterns are applied on the path relative to `folder_path`. `path_in_repo` is prefixed after the filtering. - prefix = f"{path_in_repo.strip('/')}/" if path_in_repo else "" - return [ - CommitOperationAdd( - path_or_fileobj=relpath_to_abspath[relpath], # absolute path on disk - path_in_repo=prefix + relpath, # "absolute" path in repo - ) - for relpath in filter_repo_objects( - relpath_to_abspath.keys(), allow_patterns=allow_patterns, ignore_patterns=ignore_patterns - ) - ] - - -def _parse_revision_from_pr_url(pr_url: str) -> str: - """Safely parse revision number from a PR url. - - Example: - ```py - >>> _parse_revision_from_pr_url("https://huggingface.co/bigscience/bloom/discussions/2") - "refs/pr/2" - ``` - """ - re_match = re.match(_REGEX_DISCUSSION_URL, pr_url) - if re_match is None: - raise RuntimeError(f"Unexpected response from the hub, expected a Pull Request URL but got: '{pr_url}'") - return f"refs/pr/{re_match[1]}" - - -api = HfApi() - -whoami = api.whoami -get_token_permission = api.get_token_permission - -list_models = api.list_models -model_info = api.model_info - -list_datasets = api.list_datasets -dataset_info = api.dataset_info - -list_spaces = api.list_spaces -space_info = api.space_info - -repo_exists = api.repo_exists -file_exists = api.file_exists -repo_info = api.repo_info -list_repo_files = api.list_repo_files -list_repo_refs = api.list_repo_refs -list_repo_commits = api.list_repo_commits -list_files_info = api.list_files_info - -list_metrics = api.list_metrics - -get_model_tags = api.get_model_tags -get_dataset_tags = api.get_dataset_tags - -create_commit = api.create_commit -create_repo = api.create_repo -delete_repo = api.delete_repo -update_repo_visibility = api.update_repo_visibility -super_squash_history = api.super_squash_history -move_repo = api.move_repo -upload_file = api.upload_file -upload_folder = api.upload_folder -delete_file = api.delete_file -delete_folder = api.delete_folder -create_commits_on_pr = api.create_commits_on_pr -preupload_lfs_files = api.preupload_lfs_files -create_branch = api.create_branch -delete_branch = api.delete_branch -create_tag = api.create_tag -delete_tag = api.delete_tag -get_full_repo_name = api.get_full_repo_name - -# Background jobs -run_as_future = api.run_as_future - -# Activity API -list_liked_repos = api.list_liked_repos -list_repo_likers = api.list_repo_likers -like = api.like -unlike = api.unlike - -# Community API -get_discussion_details = api.get_discussion_details -get_repo_discussions = api.get_repo_discussions -create_discussion = api.create_discussion -create_pull_request = api.create_pull_request -change_discussion_status = api.change_discussion_status -comment_discussion = api.comment_discussion -edit_discussion_comment = api.edit_discussion_comment -rename_discussion = api.rename_discussion -merge_pull_request = api.merge_pull_request - -# Space API -add_space_secret = api.add_space_secret -delete_space_secret = api.delete_space_secret -get_space_variables = api.get_space_variables -add_space_variable = api.add_space_variable -delete_space_variable = api.delete_space_variable -get_space_runtime = api.get_space_runtime -request_space_hardware = api.request_space_hardware -set_space_sleep_time = api.set_space_sleep_time -pause_space = api.pause_space -restart_space = api.restart_space -duplicate_space = api.duplicate_space -request_space_storage = api.request_space_storage -delete_space_storage = api.delete_space_storage - -# Collections API -get_collection = api.get_collection -create_collection = api.create_collection -update_collection_metadata = api.update_collection_metadata -delete_collection = api.delete_collection -add_collection_item = api.add_collection_item -update_collection_item = api.update_collection_item -delete_collection_item = api.delete_collection_item -delete_collection_item = api.delete_collection_item diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/hf_file_system.py b/venv/lib/python3.8/site-packages/huggingface_hub/hf_file_system.py deleted file mode 100644 index f9018bda16bc99040f2363cb0ae77e8b007efbd2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/hf_file_system.py +++ /dev/null @@ -1,444 +0,0 @@ -import itertools -import os -import re -import tempfile -from dataclasses import dataclass -from datetime import datetime -from typing import Any, Dict, List, Optional, Tuple, Union -from urllib.parse import quote, unquote - -import fsspec - -from ._commit_api import CommitOperationCopy, CommitOperationDelete -from .constants import DEFAULT_REVISION, ENDPOINT, REPO_TYPE_MODEL, REPO_TYPES_MAPPING, REPO_TYPES_URL_PREFIXES -from .hf_api import HfApi -from .utils import ( - EntryNotFoundError, - HFValidationError, - RepositoryNotFoundError, - RevisionNotFoundError, - hf_raise_for_status, - http_backoff, - paginate, - parse_datetime, -) - - -# Regex used to match special revisions with "/" in them (see #1710) -SPECIAL_REFS_REVISION_REGEX = re.compile( - r""" - (^refs\/convert\/parquet) # `refs/convert/parquet` revisions - | - (^refs\/pr\/\d+) # PR revisions - """, - re.VERBOSE, -) - - -@dataclass -class HfFileSystemResolvedPath: - """Data structure containing information about a resolved Hugging Face file system path.""" - - repo_type: str - repo_id: str - revision: str - path_in_repo: str - - def unresolve(self) -> str: - return ( - f"{REPO_TYPES_URL_PREFIXES.get(self.repo_type, '') + self.repo_id}@{safe_revision(self.revision)}/{self.path_in_repo}" - .rstrip("/") - ) - - -class HfFileSystem(fsspec.AbstractFileSystem): - """ - Access a remote Hugging Face Hub repository as if were a local file system. - - Args: - endpoint (`str`, *optional*): - The endpoint to use. If not provided, the default one (https://huggingface.co) is used. - token (`str`, *optional*): - Authentication token, obtained with [`HfApi.login`] method. Will default to the stored token. - - Usage: - - ```python - >>> from huggingface_hub import HfFileSystem - - >>> fs = HfFileSystem() - - >>> # List files - >>> fs.glob("my-username/my-model/*.bin") - ['my-username/my-model/pytorch_model.bin'] - >>> fs.ls("datasets/my-username/my-dataset", detail=False) - ['datasets/my-username/my-dataset/.gitattributes', 'datasets/my-username/my-dataset/README.md', 'datasets/my-username/my-dataset/data.json'] - - >>> # Read/write files - >>> with fs.open("my-username/my-model/pytorch_model.bin") as f: - ... data = f.read() - >>> with fs.open("my-username/my-model/pytorch_model.bin", "wb") as f: - ... f.write(data) - ``` - """ - - root_marker = "" - protocol = "hf" - - def __init__( - self, - *args, - endpoint: Optional[str] = None, - token: Optional[str] = None, - **storage_options, - ): - super().__init__(*args, **storage_options) - self.endpoint = endpoint or ENDPOINT - self.token = token - self._api = HfApi(endpoint=endpoint, token=token) - # Maps (repo_type, repo_id, revision) to a 2-tuple with: - # * the 1st element indicating whether the repositoy and the revision exist - # * the 2nd element being the exception raised if the repository or revision doesn't exist - self._repo_and_revision_exists_cache: Dict[ - Tuple[str, str, Optional[str]], Tuple[bool, Optional[Exception]] - ] = {} - - def _repo_and_revision_exist( - self, repo_type: str, repo_id: str, revision: Optional[str] - ) -> Tuple[bool, Optional[Exception]]: - if (repo_type, repo_id, revision) not in self._repo_and_revision_exists_cache: - try: - self._api.repo_info(repo_id, revision=revision, repo_type=repo_type) - except (RepositoryNotFoundError, HFValidationError) as e: - self._repo_and_revision_exists_cache[(repo_type, repo_id, revision)] = False, e - self._repo_and_revision_exists_cache[(repo_type, repo_id, None)] = False, e - except RevisionNotFoundError as e: - self._repo_and_revision_exists_cache[(repo_type, repo_id, revision)] = False, e - self._repo_and_revision_exists_cache[(repo_type, repo_id, None)] = True, None - else: - self._repo_and_revision_exists_cache[(repo_type, repo_id, revision)] = True, None - self._repo_and_revision_exists_cache[(repo_type, repo_id, None)] = True, None - return self._repo_and_revision_exists_cache[(repo_type, repo_id, revision)] - - def exists(self, path, **kwargs): - """Is there a file at the given path - - Exact same implementation as in fsspec except that instead of catching all exceptions, we only catch when it's - not a `NotImplementedError` (which we do want to raise). Catching a `NotImplementedError` can lead to undesired - behavior. - - Adapted from https://github.com/fsspec/filesystem_spec/blob/f5d24b80a0768bf07a113647d7b4e74a3a2999e0/fsspec/spec.py#L649C1-L656C25 - """ - try: - self.info(path, **kwargs) - return True - except Exception as e: # noqa: E722 - if isinstance(e, NotImplementedError): - raise - # any exception allowed bar FileNotFoundError? - return False - - def resolve_path(self, path: str, revision: Optional[str] = None) -> HfFileSystemResolvedPath: - def _align_revision_in_path_with_revision( - revision_in_path: Optional[str], revision: Optional[str] - ) -> Optional[str]: - if revision is not None: - if revision_in_path is not None and revision_in_path != revision: - raise ValueError( - f'Revision specified in path ("{revision_in_path}") and in `revision` argument ("{revision}")' - " are not the same." - ) - else: - revision = revision_in_path - return revision - - path = self._strip_protocol(path) - if not path: - # can't list repositories at root - raise NotImplementedError("Access to repositories lists is not implemented.") - elif path.split("/")[0] + "/" in REPO_TYPES_URL_PREFIXES.values(): - if "/" not in path: - # can't list repositories at the repository type level - raise NotImplementedError("Access to repositories lists is not implemented.") - repo_type, path = path.split("/", 1) - repo_type = REPO_TYPES_MAPPING[repo_type] - else: - repo_type = REPO_TYPE_MODEL - if path.count("/") > 0: - if "@" in path: - repo_id, revision_in_path = path.split("@", 1) - if "/" in revision_in_path: - match = SPECIAL_REFS_REVISION_REGEX.search(revision_in_path) - if match is not None and revision in (None, match.group()): - # Handle `refs/convert/parquet` and PR revisions separately - path_in_repo = SPECIAL_REFS_REVISION_REGEX.sub("", revision_in_path).lstrip("/") - revision_in_path = match.group() - else: - revision_in_path, path_in_repo = revision_in_path.split("/", 1) - else: - path_in_repo = "" - revision_in_path = unquote(revision_in_path) - revision = _align_revision_in_path_with_revision(revision_in_path, revision) - repo_and_revision_exist, err = self._repo_and_revision_exist(repo_type, repo_id, revision) - if not repo_and_revision_exist: - raise FileNotFoundError(path) from err - else: - repo_id_with_namespace = "/".join(path.split("/")[:2]) - path_in_repo_with_namespace = "/".join(path.split("/")[2:]) - repo_id_without_namespace = path.split("/")[0] - path_in_repo_without_namespace = "/".join(path.split("/")[1:]) - repo_id = repo_id_with_namespace - path_in_repo = path_in_repo_with_namespace - repo_and_revision_exist, err = self._repo_and_revision_exist(repo_type, repo_id, revision) - if not repo_and_revision_exist: - if isinstance(err, (RepositoryNotFoundError, HFValidationError)): - repo_id = repo_id_without_namespace - path_in_repo = path_in_repo_without_namespace - repo_and_revision_exist, _ = self._repo_and_revision_exist(repo_type, repo_id, revision) - if not repo_and_revision_exist: - raise FileNotFoundError(path) from err - else: - raise FileNotFoundError(path) from err - else: - repo_id = path - path_in_repo = "" - if "@" in path: - repo_id, revision_in_path = path.split("@", 1) - revision_in_path = unquote(revision_in_path) - revision = _align_revision_in_path_with_revision(revision_in_path, revision) - repo_and_revision_exist, _ = self._repo_and_revision_exist(repo_type, repo_id, revision) - if not repo_and_revision_exist: - raise NotImplementedError("Access to repositories lists is not implemented.") - - revision = revision if revision is not None else DEFAULT_REVISION - return HfFileSystemResolvedPath(repo_type, repo_id, revision, path_in_repo) - - def invalidate_cache(self, path: Optional[str] = None) -> None: - if not path: - self.dircache.clear() - self._repository_type_and_id_exists_cache.clear() - else: - path = self.resolve_path(path).unresolve() - while path: - self.dircache.pop(path, None) - path = self._parent(path) - - def _open( - self, - path: str, - mode: str = "rb", - revision: Optional[str] = None, - **kwargs, - ) -> "HfFileSystemFile": - if mode == "ab": - raise NotImplementedError("Appending to remote files is not yet supported.") - return HfFileSystemFile(self, path, mode=mode, revision=revision, **kwargs) - - def _rm(self, path: str, revision: Optional[str] = None, **kwargs) -> None: - resolved_path = self.resolve_path(path, revision=revision) - self._api.delete_file( - path_in_repo=resolved_path.path_in_repo, - repo_id=resolved_path.repo_id, - token=self.token, - repo_type=resolved_path.repo_type, - revision=resolved_path.revision, - commit_message=kwargs.get("commit_message"), - commit_description=kwargs.get("commit_description"), - ) - self.invalidate_cache(path=resolved_path.unresolve()) - - def rm( - self, - path: str, - recursive: bool = False, - maxdepth: Optional[int] = None, - revision: Optional[str] = None, - **kwargs, - ) -> None: - resolved_path = self.resolve_path(path, revision=revision) - root_path = REPO_TYPES_URL_PREFIXES.get(resolved_path.repo_type, "") + resolved_path.repo_id - paths = self.expand_path(path, recursive=recursive, maxdepth=maxdepth, revision=resolved_path.revision) - paths_in_repo = [path[len(root_path) + 1 :] for path in paths if not self.isdir(path)] - operations = [CommitOperationDelete(path_in_repo=path_in_repo) for path_in_repo in paths_in_repo] - commit_message = f"Delete {path} " - commit_message += "recursively " if recursive else "" - commit_message += f"up to depth {maxdepth} " if maxdepth is not None else "" - # TODO: use `commit_description` to list all the deleted paths? - self._api.create_commit( - repo_id=resolved_path.repo_id, - repo_type=resolved_path.repo_type, - token=self.token, - operations=operations, - revision=resolved_path.revision, - commit_message=kwargs.get("commit_message", commit_message), - commit_description=kwargs.get("commit_description"), - ) - self.invalidate_cache(path=resolved_path.unresolve()) - - def ls( - self, path: str, detail: bool = True, refresh: bool = False, revision: Optional[str] = None, **kwargs - ) -> List[Union[str, Dict[str, Any]]]: - """List the contents of a directory.""" - resolved_path = self.resolve_path(path, revision=revision) - revision_in_path = "@" + safe_revision(resolved_path.revision) - has_revision_in_path = revision_in_path in path - path = resolved_path.unresolve() - if path not in self.dircache or refresh: - path_prefix = ( - HfFileSystemResolvedPath( - resolved_path.repo_type, resolved_path.repo_id, resolved_path.revision, "" - ).unresolve() - + "/" - ) - tree_path = path - tree_iter = self._iter_tree(tree_path, revision=resolved_path.revision) - try: - tree_item = next(tree_iter) - except EntryNotFoundError: - if "/" in resolved_path.path_in_repo: - tree_path = self._parent(path) - tree_iter = self._iter_tree(tree_path, revision=resolved_path.revision) - else: - raise - else: - tree_iter = itertools.chain([tree_item], tree_iter) - child_infos = [] - for tree_item in tree_iter: - child_info = { - "name": path_prefix + tree_item["path"], - "size": tree_item["size"], - "type": tree_item["type"], - } - if tree_item["type"] == "file": - child_info.update( - { - "blob_id": tree_item["oid"], - "lfs": tree_item.get("lfs"), - "last_modified": parse_datetime(tree_item["lastCommit"]["date"]), - }, - ) - child_infos.append(child_info) - self.dircache[tree_path] = child_infos - out = self._ls_from_cache(path) - if not has_revision_in_path: - out = [{**o, "name": o["name"].replace(revision_in_path, "", 1)} for o in out] - return out if detail else [o["name"] for o in out] - - def _iter_tree(self, path: str, revision: Optional[str] = None): - # TODO: use HfApi.list_files_info instead when it supports "lastCommit" and "expand=True" - # See https://github.com/huggingface/moon-landing/issues/5993 - resolved_path = self.resolve_path(path, revision=revision) - path = f"{self._api.endpoint}/api/{resolved_path.repo_type}s/{resolved_path.repo_id}/tree/{safe_quote(resolved_path.revision)}/{resolved_path.path_in_repo}".rstrip( - "/" - ) - headers = self._api._build_hf_headers() - yield from paginate(path, params={"expand": True}, headers=headers) - - def cp_file(self, path1: str, path2: str, revision: Optional[str] = None, **kwargs) -> None: - resolved_path1 = self.resolve_path(path1, revision=revision) - resolved_path2 = self.resolve_path(path2, revision=revision) - - same_repo = ( - resolved_path1.repo_type == resolved_path2.repo_type and resolved_path1.repo_id == resolved_path2.repo_id - ) - - # TODO: Wait for https://github.com/huggingface/huggingface_hub/issues/1083 to be resolved to simplify this logic - if same_repo and self.info(path1, revision=resolved_path1.revision)["lfs"] is not None: - commit_message = f"Copy {path1} to {path2}" - self._api.create_commit( - repo_id=resolved_path1.repo_id, - repo_type=resolved_path1.repo_type, - revision=resolved_path2.revision, - commit_message=kwargs.get("commit_message", commit_message), - commit_description=kwargs.get("commit_description", ""), - operations=[ - CommitOperationCopy( - src_path_in_repo=resolved_path1.path_in_repo, - path_in_repo=resolved_path2.path_in_repo, - src_revision=resolved_path1.revision, - ) - ], - ) - else: - with self.open(path1, "rb", revision=resolved_path1.revision) as f: - content = f.read() - commit_message = f"Copy {path1} to {path2}" - self._api.upload_file( - path_or_fileobj=content, - path_in_repo=resolved_path2.path_in_repo, - repo_id=resolved_path2.repo_id, - token=self.token, - repo_type=resolved_path2.repo_type, - revision=resolved_path2.revision, - commit_message=kwargs.get("commit_message", commit_message), - commit_description=kwargs.get("commit_description"), - ) - self.invalidate_cache(path=resolved_path1.unresolve()) - self.invalidate_cache(path=resolved_path2.unresolve()) - - def modified(self, path: str, **kwargs) -> datetime: - info = self.info(path, **kwargs) - if "last_modified" not in info: - raise IsADirectoryError(path) - return info["last_modified"] - - def info(self, path: str, **kwargs) -> Dict[str, Any]: - resolved_path = self.resolve_path(path) - if not resolved_path.path_in_repo: - revision_in_path = "@" + safe_revision(resolved_path.revision) - has_revision_in_path = revision_in_path in path - name = resolved_path.unresolve() - name = name.replace(revision_in_path, "", 1) if not has_revision_in_path else name - return {"name": name, "size": 0, "type": "directory"} - return super().info(path, **kwargs) - - -class HfFileSystemFile(fsspec.spec.AbstractBufferedFile): - def __init__(self, fs: HfFileSystem, path: str, revision: Optional[str] = None, **kwargs): - super().__init__(fs, path, **kwargs) - self.fs: HfFileSystem - self.resolved_path = fs.resolve_path(path, revision=revision) - - def _fetch_range(self, start: int, end: int) -> bytes: - headers = { - "range": f"bytes={start}-{end - 1}", - **self.fs._api._build_hf_headers(), - } - url = ( - f"{self.fs.endpoint}/{REPO_TYPES_URL_PREFIXES.get(self.resolved_path.repo_type, '') + self.resolved_path.repo_id}/resolve/{safe_quote(self.resolved_path.revision)}/{safe_quote(self.resolved_path.path_in_repo)}" - ) - r = http_backoff("GET", url, headers=headers) - hf_raise_for_status(r) - return r.content - - def _initiate_upload(self) -> None: - self.temp_file = tempfile.NamedTemporaryFile(prefix="hffs-", delete=False) - - def _upload_chunk(self, final: bool = False) -> None: - self.buffer.seek(0) - block = self.buffer.read() - self.temp_file.write(block) - if final: - self.temp_file.close() - self.fs._api.upload_file( - path_or_fileobj=self.temp_file.name, - path_in_repo=self.resolved_path.path_in_repo, - repo_id=self.resolved_path.repo_id, - token=self.fs.token, - repo_type=self.resolved_path.repo_type, - revision=self.resolved_path.revision, - commit_message=self.kwargs.get("commit_message"), - commit_description=self.kwargs.get("commit_description"), - ) - os.remove(self.temp_file.name) - self.fs.invalidate_cache( - path=self.resolved_path.unresolve(), - ) - - -def safe_revision(revision: str) -> str: - return revision if SPECIAL_REFS_REVISION_REGEX.match(revision) else safe_quote(revision) - - -def safe_quote(s: str) -> str: - return quote(s, safe="") diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/hub_mixin.py b/venv/lib/python3.8/site-packages/huggingface_hub/hub_mixin.py deleted file mode 100644 index 2fc0613b0630bc86c467781263a30e893bde9882..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/hub_mixin.py +++ /dev/null @@ -1,370 +0,0 @@ -import json -import os -from pathlib import Path -from typing import Dict, List, Optional, Type, TypeVar, Union - -import requests - -from .constants import CONFIG_NAME, PYTORCH_WEIGHTS_NAME -from .file_download import hf_hub_download, is_torch_available -from .hf_api import HfApi -from .utils import SoftTemporaryDirectory, logging, validate_hf_hub_args - - -if is_torch_available(): - import torch # type: ignore - -logger = logging.get_logger(__name__) - -# Generic variable that is either ModelHubMixin or a subclass thereof -T = TypeVar("T", bound="ModelHubMixin") - - -class ModelHubMixin: - """ - A generic mixin to integrate ANY machine learning framework with the Hub. - - To integrate your framework, your model class must inherit from this class. Custom logic for saving/loading models - have to be overwritten in [`_from_pretrained`] and [`_save_pretrained`]. [`PyTorchModelHubMixin`] is a good example - of mixin integration with the Hub. Check out our [integration guide](../guides/integrations) for more instructions. - """ - - def save_pretrained( - self, - save_directory: Union[str, Path], - *, - config: Optional[dict] = None, - repo_id: Optional[str] = None, - push_to_hub: bool = False, - **kwargs, - ) -> Optional[str]: - """ - Save weights in local directory. - - Args: - save_directory (`str` or `Path`): - Path to directory in which the model weights and configuration will be saved. - config (`dict`, *optional*): - Model configuration specified as a key/value dictionary. - push_to_hub (`bool`, *optional*, defaults to `False`): - Whether or not to push your model to the Huggingface Hub after saving it. - repo_id (`str`, *optional*): - ID of your repository on the Hub. Used only if `push_to_hub=True`. Will default to the folder name if - not provided. - kwargs: - Additional key word arguments passed along to the [`~ModelHubMixin._from_pretrained`] method. - """ - save_directory = Path(save_directory) - save_directory.mkdir(parents=True, exist_ok=True) - - # saving model weights/files - self._save_pretrained(save_directory) - - # saving config - if isinstance(config, dict): - (save_directory / CONFIG_NAME).write_text(json.dumps(config)) - - if push_to_hub: - kwargs = kwargs.copy() # soft-copy to avoid mutating input - if config is not None: # kwarg for `push_to_hub` - kwargs["config"] = config - if repo_id is None: - repo_id = save_directory.name # Defaults to `save_directory` name - return self.push_to_hub(repo_id=repo_id, **kwargs) - return None - - def _save_pretrained(self, save_directory: Path) -> None: - """ - Overwrite this method in subclass to define how to save your model. - Check out our [integration guide](../guides/integrations) for instructions. - - Args: - save_directory (`str` or `Path`): - Path to directory in which the model weights and configuration will be saved. - """ - raise NotImplementedError - - @classmethod - @validate_hf_hub_args - def from_pretrained( - cls: Type[T], - pretrained_model_name_or_path: Union[str, Path], - *, - force_download: bool = False, - resume_download: bool = False, - proxies: Optional[Dict] = None, - token: Optional[Union[str, bool]] = None, - cache_dir: Optional[Union[str, Path]] = None, - local_files_only: bool = False, - revision: Optional[str] = None, - **model_kwargs, - ) -> T: - """ - Download a model from the Huggingface Hub and instantiate it. - - Args: - pretrained_model_name_or_path (`str`, `Path`): - - Either the `model_id` (string) of a model hosted on the Hub, e.g. `bigscience/bloom`. - - Or a path to a `directory` containing model weights saved using - [`~transformers.PreTrainedModel.save_pretrained`], e.g., `../path/to/my_model_directory/`. - revision (`str`, *optional*): - Revision of the model on the Hub. Can be a branch name, a git tag or any commit id. - Defaults to the latest commit on `main` branch. - force_download (`bool`, *optional*, defaults to `False`): - Whether to force (re-)downloading the model weights and configuration files from the Hub, overriding - the existing cache. - resume_download (`bool`, *optional*, defaults to `False`): - Whether to delete incompletely received files. Will attempt to resume the download if such a file exists. - proxies (`Dict[str, str]`, *optional*): - A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', - 'http://hostname': 'foo.bar:4012'}`. The proxies are used on every request. - token (`str` or `bool`, *optional*): - The token to use as HTTP bearer authorization for remote files. By default, it will use the token - cached when running `huggingface-cli login`. - cache_dir (`str`, `Path`, *optional*): - Path to the folder where cached files are stored. - local_files_only (`bool`, *optional*, defaults to `False`): - If `True`, avoid downloading the file and return the path to the local cached file if it exists. - model_kwargs (`Dict`, *optional*): - Additional kwargs to pass to the model during initialization. - """ - model_id = pretrained_model_name_or_path - config_file: Optional[str] = None - if os.path.isdir(model_id): - if CONFIG_NAME in os.listdir(model_id): - config_file = os.path.join(model_id, CONFIG_NAME) - else: - logger.warning(f"{CONFIG_NAME} not found in {Path(model_id).resolve()}") - elif isinstance(model_id, str): - try: - config_file = hf_hub_download( - repo_id=str(model_id), - filename=CONFIG_NAME, - revision=revision, - cache_dir=cache_dir, - force_download=force_download, - proxies=proxies, - resume_download=resume_download, - token=token, - local_files_only=local_files_only, - ) - except requests.exceptions.RequestException: - logger.warning(f"{CONFIG_NAME} not found in HuggingFace Hub.") - - if config_file is not None: - with open(config_file, "r", encoding="utf-8") as f: - config = json.load(f) - model_kwargs.update({"config": config}) - - return cls._from_pretrained( - model_id=str(model_id), - revision=revision, - cache_dir=cache_dir, - force_download=force_download, - proxies=proxies, - resume_download=resume_download, - local_files_only=local_files_only, - token=token, - **model_kwargs, - ) - - @classmethod - def _from_pretrained( - cls: Type[T], - *, - model_id: str, - revision: Optional[str], - cache_dir: Optional[Union[str, Path]], - force_download: bool, - proxies: Optional[Dict], - resume_download: bool, - local_files_only: bool, - token: Optional[Union[str, bool]], - **model_kwargs, - ) -> T: - """Overwrite this method in subclass to define how to load your model from pretrained. - - Use [`hf_hub_download`] or [`snapshot_download`] to download files from the Hub before loading them. Most - args taken as input can be directly passed to those 2 methods. If needed, you can add more arguments to this - method using "model_kwargs". For example [`PyTorchModelHubMixin._from_pretrained`] takes as input a `map_location` - parameter to set on which device the model should be loaded. - - Check out our [integration guide](../guides/integrations) for more instructions. - - Args: - model_id (`str`): - ID of the model to load from the Huggingface Hub (e.g. `bigscience/bloom`). - revision (`str`, *optional*): - Revision of the model on the Hub. Can be a branch name, a git tag or any commit id. Defaults to the - latest commit on `main` branch. - force_download (`bool`, *optional*, defaults to `False`): - Whether to force (re-)downloading the model weights and configuration files from the Hub, overriding - the existing cache. - resume_download (`bool`, *optional*, defaults to `False`): - Whether to delete incompletely received files. Will attempt to resume the download if such a file exists. - proxies (`Dict[str, str]`, *optional*): - A dictionary of proxy servers to use by protocol or endpoint (e.g., `{'http': 'foo.bar:3128', - 'http://hostname': 'foo.bar:4012'}`). - token (`str` or `bool`, *optional*): - The token to use as HTTP bearer authorization for remote files. By default, it will use the token - cached when running `huggingface-cli login`. - cache_dir (`str`, `Path`, *optional*): - Path to the folder where cached files are stored. - local_files_only (`bool`, *optional*, defaults to `False`): - If `True`, avoid downloading the file and return the path to the local cached file if it exists. - model_kwargs: - Additional keyword arguments passed along to the [`~ModelHubMixin._from_pretrained`] method. - """ - raise NotImplementedError - - @validate_hf_hub_args - def push_to_hub( - self, - repo_id: str, - *, - config: Optional[dict] = None, - commit_message: str = "Push model using huggingface_hub.", - private: bool = False, - api_endpoint: Optional[str] = None, - token: Optional[str] = None, - branch: Optional[str] = None, - create_pr: Optional[bool] = None, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - delete_patterns: Optional[Union[List[str], str]] = None, - ) -> str: - """ - Upload model checkpoint to the Hub. - - Use `allow_patterns` and `ignore_patterns` to precisely filter which files should be pushed to the hub. Use - `delete_patterns` to delete existing remote files in the same commit. See [`upload_folder`] reference for more - details. - - - Args: - repo_id (`str`): - ID of the repository to push to (example: `"username/my-model"`). - config (`dict`, *optional*): - Configuration object to be saved alongside the model weights. - commit_message (`str`, *optional*): - Message to commit while pushing. - private (`bool`, *optional*, defaults to `False`): - Whether the repository created should be private. - api_endpoint (`str`, *optional*): - The API endpoint to use when pushing the model to the hub. - token (`str`, *optional*): - The token to use as HTTP bearer authorization for remote files. By default, it will use the token - cached when running `huggingface-cli login`. - branch (`str`, *optional*): - The git branch on which to push the model. This defaults to `"main"`. - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request from `branch` with that commit. Defaults to `False`. - allow_patterns (`List[str]` or `str`, *optional*): - If provided, only files matching at least one pattern are pushed. - ignore_patterns (`List[str]` or `str`, *optional*): - If provided, files matching any of the patterns are not pushed. - delete_patterns (`List[str]` or `str`, *optional*): - If provided, remote files matching any of the patterns will be deleted from the repo. - - Returns: - The url of the commit of your model in the given repository. - """ - api = HfApi(endpoint=api_endpoint, token=token) - repo_id = api.create_repo(repo_id=repo_id, private=private, exist_ok=True).repo_id - - # Push the files to the repo in a single commit - with SoftTemporaryDirectory() as tmp: - saved_path = Path(tmp) / repo_id - self.save_pretrained(saved_path, config=config) - return api.upload_folder( - repo_id=repo_id, - repo_type="model", - folder_path=saved_path, - commit_message=commit_message, - revision=branch, - create_pr=create_pr, - allow_patterns=allow_patterns, - ignore_patterns=ignore_patterns, - delete_patterns=delete_patterns, - ) - - -class PyTorchModelHubMixin(ModelHubMixin): - """ - Implementation of [`ModelHubMixin`] to provide model Hub upload/download capabilities to PyTorch models. The model - is set in evaluation mode by default using `model.eval()` (dropout modules are deactivated). To train the model, - you should first set it back in training mode with `model.train()`. - - Example: - - ```python - >>> import torch - >>> import torch.nn as nn - >>> from huggingface_hub import PyTorchModelHubMixin - - - >>> class MyModel(nn.Module, PyTorchModelHubMixin): - ... def __init__(self): - ... super().__init__() - ... self.param = nn.Parameter(torch.rand(3, 4)) - ... self.linear = nn.Linear(4, 5) - - ... def forward(self, x): - ... return self.linear(x + self.param) - >>> model = MyModel() - - # Save model weights to local directory - >>> model.save_pretrained("my-awesome-model") - - # Push model weights to the Hub - >>> model.push_to_hub("my-awesome-model") - - # Download and initialize weights from the Hub - >>> model = MyModel.from_pretrained("username/my-awesome-model") - ``` - """ - - def _save_pretrained(self, save_directory: Path) -> None: - """Save weights from a Pytorch model to a local directory.""" - model_to_save = self.module if hasattr(self, "module") else self # type: ignore - torch.save(model_to_save.state_dict(), save_directory / PYTORCH_WEIGHTS_NAME) - - @classmethod - def _from_pretrained( - cls, - *, - model_id: str, - revision: Optional[str], - cache_dir: Optional[Union[str, Path]], - force_download: bool, - proxies: Optional[Dict], - resume_download: bool, - local_files_only: bool, - token: Union[str, bool, None], - map_location: str = "cpu", - strict: bool = False, - **model_kwargs, - ): - """Load Pytorch pretrained weights and return the loaded model.""" - if os.path.isdir(model_id): - print("Loading weights from local directory") - model_file = os.path.join(model_id, PYTORCH_WEIGHTS_NAME) - else: - model_file = hf_hub_download( - repo_id=model_id, - filename=PYTORCH_WEIGHTS_NAME, - revision=revision, - cache_dir=cache_dir, - force_download=force_download, - proxies=proxies, - resume_download=resume_download, - token=token, - local_files_only=local_files_only, - ) - model = cls(**model_kwargs) - - state_dict = torch.load(model_file, map_location=torch.device(map_location)) - model.load_state_dict(state_dict, strict=strict) # type: ignore - model.eval() # type: ignore - - return model diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__init__.py b/venv/lib/python3.8/site-packages/huggingface_hub/inference/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 8898e076989808940fe4bc9e400863e52d1a5440..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_client.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_client.cpython-38.pyc deleted file mode 100644 index 1f98eb9fbee121a1fe80857929dea9e9c16a8686..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_client.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_common.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_common.cpython-38.pyc deleted file mode 100644 index c9127b0e7a6c0909caef43626ee049787bd6aa92..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_common.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_text_generation.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_text_generation.cpython-38.pyc deleted file mode 100644 index 0a83fa15f110d91baeb35617a8353da01cbb990c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_text_generation.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_types.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_types.cpython-38.pyc deleted file mode 100644 index f8a672aa999d45dffac1bbc76941605fb08f1d28..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/inference/__pycache__/_types.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_client.py b/venv/lib/python3.8/site-packages/huggingface_hub/inference/_client.py deleted file mode 100644 index b060a77510508e3426b523cf61d2b8c69332b4cd..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_client.py +++ /dev/null @@ -1,1927 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Related resources: -# https://huggingface.co/tasks -# https://huggingface.co/docs/huggingface.js/inference/README -# https://github.com/huggingface/huggingface.js/tree/main/packages/inference/src -# https://github.com/huggingface/text-generation-inference/tree/main/clients/python -# https://github.com/huggingface/text-generation-inference/blob/main/clients/python/text_generation/client.py -# https://huggingface.slack.com/archives/C03E4DQ9LAJ/p1680169099087869 -# https://github.com/huggingface/unity-api#tasks -# -# Some TODO: -# - validate inputs/options/parameters? with Pydantic for instance? or only optionally? -# - add all tasks -# -# NOTE: the philosophy of this client is "let's make it as easy as possible to use it, even if less optimized". Some -# examples of how it translates: -# - Timeout / Server unavailable is handled by the client in a single "timeout" parameter. -# - Files can be provided as bytes, file paths, or URLs and the client will try to "guess" the type. -# - Images are parsed as PIL.Image for easier manipulation. -# - Provides a "recommended model" for each task => suboptimal but user-wise quicker to get a first script running. -# - Only the main parameters are publicly exposed. Power users can always read the docs for more options. -import logging -import time -import warnings -from dataclasses import asdict -from typing import ( - TYPE_CHECKING, - Any, - Dict, - Iterable, - List, - Literal, - Optional, - Union, - overload, -) - -from requests import HTTPError -from requests.structures import CaseInsensitiveDict - -from huggingface_hub.constants import ALL_INFERENCE_API_FRAMEWORKS, INFERENCE_ENDPOINT, MAIN_INFERENCE_API_FRAMEWORKS -from huggingface_hub.inference._common import ( - TASKS_EXPECTING_IMAGES, - ContentT, - InferenceTimeoutError, - ModelStatus, - _b64_encode, - _b64_to_image, - _bytes_to_dict, - _bytes_to_image, - _bytes_to_list, - _get_recommended_model, - _import_numpy, - _is_tgi_server, - _open_as_binary, - _set_as_non_tgi, - _stream_text_generation_response, -) -from huggingface_hub.inference._text_generation import ( - TextGenerationParameters, - TextGenerationRequest, - TextGenerationResponse, - TextGenerationStreamResponse, - raise_text_generation_error, -) -from huggingface_hub.inference._types import ( - ClassificationOutput, - ConversationalOutput, - FillMaskOutput, - ImageSegmentationOutput, - ObjectDetectionOutput, - QuestionAnsweringOutput, - TableQuestionAnsweringOutput, - TokenClassificationOutput, -) -from huggingface_hub.utils import ( - BadRequestError, - build_hf_headers, - get_session, - hf_raise_for_status, -) - - -if TYPE_CHECKING: - import numpy as np - from PIL import Image - -logger = logging.getLogger(__name__) - - -class InferenceClient: - """ - Initialize a new Inference Client. - - [`InferenceClient`] aims to provide a unified experience to perform inference. The client can be used - seamlessly with either the (free) Inference API or self-hosted Inference Endpoints. - - Args: - model (`str`, `optional`): - The model to run inference with. Can be a model id hosted on the Hugging Face Hub, e.g. `bigcode/starcoder` - or a URL to a deployed Inference Endpoint. Defaults to None, in which case a recommended model is - automatically selected for the task. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token. Pass `token=False` if you don't want to send - your token to the server. - timeout (`float`, `optional`): - The maximum number of seconds to wait for a response from the server. Loading a new model in Inference - API can take up to several minutes. Defaults to None, meaning it will loop until the server is available. - headers (`Dict[str, str]`, `optional`): - Additional headers to send to the server. By default only the authorization and user-agent headers are sent. - Values in this dictionary will override the default values. - cookies (`Dict[str, str]`, `optional`): - Additional cookies to send to the server. - """ - - def __init__( - self, - model: Optional[str] = None, - token: Union[str, bool, None] = None, - timeout: Optional[float] = None, - headers: Optional[Dict[str, str]] = None, - cookies: Optional[Dict[str, str]] = None, - ) -> None: - self.model: Optional[str] = model - self.headers = CaseInsensitiveDict(build_hf_headers(token=token)) # contains 'authorization' + 'user-agent' - if headers is not None: - self.headers.update(headers) - self.cookies = cookies - self.timeout = timeout - - def __repr__(self): - return f"" - - @overload - def post( # type: ignore - self, - *, - json: Optional[Union[str, Dict, List]] = None, - data: Optional[ContentT] = None, - model: Optional[str] = None, - task: Optional[str] = None, - stream: Literal[False] = ..., - ) -> bytes: - pass - - @overload - def post( # type: ignore - self, - *, - json: Optional[Union[str, Dict, List]] = None, - data: Optional[ContentT] = None, - model: Optional[str] = None, - task: Optional[str] = None, - stream: Literal[True] = ..., - ) -> Iterable[bytes]: - pass - - def post( - self, - *, - json: Optional[Union[str, Dict, List]] = None, - data: Optional[ContentT] = None, - model: Optional[str] = None, - task: Optional[str] = None, - stream: bool = False, - ) -> Union[bytes, Iterable[bytes]]: - """ - Make a POST request to the inference server. - - Args: - json (`Union[str, Dict, List]`, *optional*): - The JSON data to send in the request body. Defaults to None. - data (`Union[str, Path, bytes, BinaryIO]`, *optional*): - The content to send in the request body. It can be raw bytes, a pointer to an opened file, a local file - path, or a URL to an online resource (image, audio file,...). If both `json` and `data` are passed, - `data` will take precedence. At least `json` or `data` must be provided. Defaults to None. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. Will override the model defined at the instance level. Defaults to None. - task (`str`, *optional*): - The task to perform on the inference. Used only to default to a recommended model if `model` is not - provided. At least `model` or `task` must be provided. Defaults to None. - stream (`bool`, *optional*): - Whether to iterate over streaming APIs. - - Returns: - bytes: The raw bytes returned by the server. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - """ - url = self._resolve_url(model, task) - - if data is not None and json is not None: - warnings.warn("Ignoring `json` as `data` is passed as binary.") - - # Set Accept header if relevant - headers = self.headers.copy() - if task in TASKS_EXPECTING_IMAGES and "Accept" not in headers: - headers["Accept"] = "image/png" - - t0 = time.time() - timeout = self.timeout - while True: - with _open_as_binary(data) as data_as_binary: - try: - response = get_session().post( - url, - json=json, - data=data_as_binary, - headers=headers, - cookies=self.cookies, - timeout=self.timeout, - stream=stream, - ) - except TimeoutError as error: - # Convert any `TimeoutError` to a `InferenceTimeoutError` - raise InferenceTimeoutError(f"Inference call timed out: {url}") from error # type: ignore - - try: - hf_raise_for_status(response) - return response.iter_lines() if stream else response.content - except HTTPError as error: - if error.response.status_code == 503: - # If Model is unavailable, either raise a TimeoutError... - if timeout is not None and time.time() - t0 > timeout: - raise InferenceTimeoutError( - f"Model not loaded on the server: {url}. Please retry with a higher timeout (current:" - f" {self.timeout}).", - request=error.request, - response=error.response, - ) from error - # ...or wait 1s and retry - logger.info(f"Waiting for model to be loaded on the server: {error}") - time.sleep(1) - if timeout is not None: - timeout = max(self.timeout - (time.time() - t0), 1) # type: ignore - continue - raise - - def audio_classification( - self, - audio: ContentT, - *, - model: Optional[str] = None, - ) -> List[ClassificationOutput]: - """ - Perform audio classification on the provided audio content. - - Args: - audio (Union[str, Path, bytes, BinaryIO]): - The audio content to classify. It can be raw audio bytes, a local audio file, or a URL pointing to an - audio file. - model (`str`, *optional*): - The model to use for audio classification. Can be a model ID hosted on the Hugging Face Hub - or a URL to a deployed Inference Endpoint. If not provided, the default recommended model for - audio classification will be used. - - Returns: - `List[Dict]`: The classification output containing the predicted label and its confidence. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.audio_classification("audio.flac") - [{'score': 0.4976358711719513, 'label': 'hap'}, {'score': 0.3677836060523987, 'label': 'neu'},...] - ``` - """ - response = self.post(data=audio, model=model, task="audio-classification") - return _bytes_to_list(response) - - def automatic_speech_recognition( - self, - audio: ContentT, - *, - model: Optional[str] = None, - ) -> str: - """ - Perform automatic speech recognition (ASR or audio-to-text) on the given audio content. - - Args: - audio (Union[str, Path, bytes, BinaryIO]): - The content to transcribe. It can be raw audio bytes, local audio file, or a URL to an audio file. - model (`str`, *optional*): - The model to use for ASR. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. If not provided, the default recommended model for ASR will be used. - - Returns: - str: The transcribed text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.automatic_speech_recognition("hello_world.flac") - "hello world" - ``` - """ - response = self.post(data=audio, model=model, task="automatic-speech-recognition") - return _bytes_to_dict(response)["text"] - - def conversational( - self, - text: str, - generated_responses: Optional[List[str]] = None, - past_user_inputs: Optional[List[str]] = None, - *, - parameters: Optional[Dict[str, Any]] = None, - model: Optional[str] = None, - ) -> ConversationalOutput: - """ - Generate conversational responses based on the given input text (i.e. chat with the API). - - Args: - text (`str`): - The last input from the user in the conversation. - generated_responses (`List[str]`, *optional*): - A list of strings corresponding to the earlier replies from the model. Defaults to None. - past_user_inputs (`List[str]`, *optional*): - A list of strings corresponding to the earlier replies from the user. Should be the same length as - `generated_responses`. Defaults to None. - parameters (`Dict[str, Any]`, *optional*): - Additional parameters for the conversational task. Defaults to None. For more details about the available - parameters, please refer to [this page](https://huggingface.co/docs/api-inference/detailed_parameters#conversational-task) - model (`str`, *optional*): - The model to use for the conversational task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended conversational model will be used. - Defaults to None. - - Returns: - `Dict`: The generated conversational output. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> output = client.conversational("Hi, who are you?") - >>> output - {'generated_text': 'I am the one who knocks.', 'conversation': {'generated_responses': ['I am the one who knocks.'], 'past_user_inputs': ['Hi, who are you?']}, 'warnings': ['Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.']} - >>> client.conversational( - ... "Wow, that's scary!", - ... generated_responses=output["conversation"]["generated_responses"], - ... past_user_inputs=output["conversation"]["past_user_inputs"], - ... ) - ``` - """ - payload: Dict[str, Any] = {"inputs": {"text": text}} - if generated_responses is not None: - payload["inputs"]["generated_responses"] = generated_responses - if past_user_inputs is not None: - payload["inputs"]["past_user_inputs"] = past_user_inputs - if parameters is not None: - payload["parameters"] = parameters - response = self.post(json=payload, model=model, task="conversational") - return _bytes_to_dict(response) # type: ignore - - def visual_question_answering( - self, - image: ContentT, - question: str, - *, - model: Optional[str] = None, - ) -> List[str]: - """ - Answering open-ended questions based on an image. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image for the context. It can be raw bytes, an image file, or a URL to an online image. - question (`str`): - Question to be answered. - model (`str`, *optional*): - The model to use for the visual question answering task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended visual question answering model will be used. - Defaults to None. - - Returns: - `List[Dict]`: a list of dictionaries containing the predicted label and associated probability. - - Raises: - `InferenceTimeoutError`: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.visual_question_answering( - ... image="https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg", - ... question="What is the animal doing?" - ... ) - [{'score': 0.778609573841095, 'answer': 'laying down'},{'score': 0.6957435607910156, 'answer': 'sitting'}, ...] - ``` - """ - payload: Dict[str, Any] = {"question": question, "image": _b64_encode(image)} - response = self.post(json=payload, model=model, task="visual-question-answering") - return _bytes_to_list(response) - - def document_question_answering( - self, - image: ContentT, - question: str, - *, - model: Optional[str] = None, - ) -> List[QuestionAnsweringOutput]: - """ - Answer questions on document images. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image for the context. It can be raw bytes, an image file, or a URL to an online image. - question (`str`): - Question to be answered. - model (`str`, *optional*): - The model to use for the document question answering task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended document question answering model will be used. - Defaults to None. - - Returns: - `List[Dict]`: a list of dictionaries containing the predicted label, associated probability, word ids, and page number. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.document_question_answering(image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png", question="What is the invoice number?") - [{'score': 0.42515629529953003, 'answer': 'us-001', 'start': 16, 'end': 16}] - ``` - """ - payload: Dict[str, Any] = {"question": question, "image": _b64_encode(image)} - response = self.post(json=payload, model=model, task="document-question-answering") - return _bytes_to_list(response) - - def feature_extraction(self, text: str, *, model: Optional[str] = None) -> "np.ndarray": - """ - Generate embeddings for a given text. - - Args: - text (`str`): - The text to embed. - model (`str`, *optional*): - The model to use for the conversational task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended conversational model will be used. - Defaults to None. - - Returns: - `np.ndarray`: The embedding representing the input text as a float32 numpy array. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.feature_extraction("Hi, who are you?") - array([[ 2.424802 , 2.93384 , 1.1750331 , ..., 1.240499, -0.13776633, -0.7889173 ], - [-0.42943227, -0.6364878 , -1.693462 , ..., 0.41978157, -2.4336355 , 0.6162071 ], - ..., - [ 0.28552425, -0.928395 , -1.2077185 , ..., 0.76810825, -2.1069427 , 0.6236161 ]], dtype=float32) - ``` - """ - response = self.post(json={"inputs": text}, model=model, task="feature-extraction") - np = _import_numpy() - return np.array(_bytes_to_dict(response), dtype="float32") - - def fill_mask(self, text: str, *, model: Optional[str] = None) -> List[FillMaskOutput]: - """ - Fill in a hole with a missing word (token to be precise). - - Args: - text (`str`): - a string to be filled from, must contain the [MASK] token (check model card for exact name of the mask). - model (`str`, *optional*): - The model to use for the fill mask task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended fill mask model will be used. - Defaults to None. - - Returns: - `List[Dict]`: a list of fill mask output dictionaries containing the predicted label, associated - probability, token reference, and completed text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.fill_mask("The goal of life is .") - [{'score': 0.06897063553333282, - 'token': 11098, - 'token_str': ' happiness', - 'sequence': 'The goal of life is happiness.'}, - {'score': 0.06554922461509705, - 'token': 45075, - 'token_str': ' immortality', - 'sequence': 'The goal of life is immortality.'}] - ``` - """ - response = self.post(json={"inputs": text}, model=model, task="fill-mask") - return _bytes_to_list(response) - - def image_classification( - self, - image: ContentT, - *, - model: Optional[str] = None, - ) -> List[ClassificationOutput]: - """ - Perform image classification on the given image using the specified model. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The image to classify. It can be raw bytes, an image file, or a URL to an online image. - model (`str`, *optional*): - The model to use for image classification. Can be a model ID hosted on the Hugging Face Hub or a URL to a - deployed Inference Endpoint. If not provided, the default recommended model for image classification will be used. - - Returns: - `List[Dict]`: a list of dictionaries containing the predicted label and associated probability. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.image_classification("https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Cute_dog.jpg/320px-Cute_dog.jpg") - [{'score': 0.9779096841812134, 'label': 'Blenheim spaniel'}, ...] - ``` - """ - response = self.post(data=image, model=model, task="image-classification") - return _bytes_to_list(response) - - def image_segmentation( - self, - image: ContentT, - *, - model: Optional[str] = None, - ) -> List[ImageSegmentationOutput]: - """ - Perform image segmentation on the given image using the specified model. - - - - You must have `PIL` installed if you want to work with images (`pip install Pillow`). - - - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The image to segment. It can be raw bytes, an image file, or a URL to an online image. - model (`str`, *optional*): - The model to use for image segmentation. Can be a model ID hosted on the Hugging Face Hub or a URL to a - deployed Inference Endpoint. If not provided, the default recommended model for image segmentation will be used. - - Returns: - `List[Dict]`: A list of dictionaries containing the segmented masks and associated attributes. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.image_segmentation("cat.jpg"): - [{'score': 0.989008, 'label': 'LABEL_184', 'mask': }, ...] - ``` - """ - - # Segment - response = self.post(data=image, model=model, task="image-segmentation") - output = _bytes_to_dict(response) - - # Parse masks as PIL Image - if not isinstance(output, list): - raise ValueError(f"Server output must be a list. Got {type(output)}: {str(output)[:200]}...") - for item in output: - item["mask"] = _b64_to_image(item["mask"]) - return output - - def image_to_image( - self, - image: ContentT, - prompt: Optional[str] = None, - *, - negative_prompt: Optional[str] = None, - height: Optional[int] = None, - width: Optional[int] = None, - num_inference_steps: Optional[int] = None, - guidance_scale: Optional[float] = None, - model: Optional[str] = None, - **kwargs, - ) -> "Image": - """ - Perform image-to-image translation using a specified model. - - - - You must have `PIL` installed if you want to work with images (`pip install Pillow`). - - - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image for translation. It can be raw bytes, an image file, or a URL to an online image. - prompt (`str`, *optional*): - The text prompt to guide the image generation. - negative_prompt (`str`, *optional*): - A negative prompt to guide the translation process. - height (`int`, *optional*): - The height in pixels of the generated image. - width (`int`, *optional*): - The width in pixels of the generated image. - num_inference_steps (`int`, *optional*): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*): - Higher guidance scale encourages to generate images that are closely linked to the text `prompt`, - usually at the expense of lower image quality. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `Image`: The translated image. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> image = client.image_to_image("cat.jpg", prompt="turn the cat into a tiger") - >>> image.save("tiger.jpg") - ``` - """ - parameters = { - "prompt": prompt, - "negative_prompt": negative_prompt, - "height": height, - "width": width, - "num_inference_steps": num_inference_steps, - "guidance_scale": guidance_scale, - **kwargs, - } - if all(parameter is None for parameter in parameters.values()): - # Either only an image to send => send as raw bytes - data = image - payload: Optional[Dict[str, Any]] = None - else: - # Or an image + some parameters => use base64 encoding - data = None - payload = {"inputs": _b64_encode(image)} - for key, value in parameters.items(): - if value is not None: - payload.setdefault("parameters", {})[key] = value - - response = self.post(json=payload, data=data, model=model, task="image-to-image") - return _bytes_to_image(response) - - def image_to_text(self, image: ContentT, *, model: Optional[str] = None) -> str: - """ - Takes an input image and return text. - - Models can have very different outputs depending on your use case (image captioning, optical character recognition - (OCR), Pix2Struct, etc). Please have a look to the model card to learn more about a model's specificities. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image to caption. It can be raw bytes, an image file, or a URL to an online image.. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `str`: The generated text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.image_to_text("cat.jpg") - 'a cat standing in a grassy field ' - >>> client.image_to_text("https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Cute_dog.jpg/320px-Cute_dog.jpg") - 'a dog laying on the grass next to a flower pot ' - ``` - """ - response = self.post(data=image, model=model, task="image-to-text") - return _bytes_to_dict(response)[0]["generated_text"] - - def list_deployed_models( - self, frameworks: Union[None, str, Literal["all"], List[str]] = None - ) -> Dict[str, List[str]]: - """ - List models currently deployed on the Inference API service. - - This helper checks deployed models framework by framework. By default, it will check the 4 main frameworks that - are supported and account for 95% of the hosted models. However, if you want a complete list of models you can - specify `frameworks="all"` as input. Alternatively, if you know before-hand which framework you are interested - in, you can also restrict to search to this one (e.g. `frameworks="text-generation-inference"`). The more - frameworks are checked, the more time it will take. - - - - This endpoint is mostly useful for discoverability. If you already know which model you want to use and want to - check its availability, you can directly use [`~InferenceClient.get_model_status`]. - - - - Args: - frameworks (`Literal["all"]` or `List[str]` or `str`, *optional*): - The frameworks to filter on. By default only a subset of the available frameworks are tested. If set to - "all", all available frameworks will be tested. It is also possible to provide a single framework or a - custom set of frameworks to check. - - Returns: - `Dict[str, List[str]]`: A dictionary mapping task names to a sorted list of model IDs. - - Example: - ```python - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - - # Discover zero-shot-classification models currently deployed - >>> models = client.list_deployed_models() - >>> models["zero-shot-classification"] - ['Narsil/deberta-large-mnli-zero-cls', 'facebook/bart-large-mnli', ...] - - # List from only 1 framework - >>> client.list_deployed_models("text-generation-inference") - {'text-generation': ['bigcode/starcoder', 'meta-llama/Llama-2-70b-chat-hf', ...], ...} - ``` - """ - # Resolve which frameworks to check - if frameworks is None: - frameworks = MAIN_INFERENCE_API_FRAMEWORKS - elif frameworks == "all": - frameworks = ALL_INFERENCE_API_FRAMEWORKS - elif isinstance(frameworks, str): - frameworks = [frameworks] - frameworks = list(set(frameworks)) - - # Fetch them iteratively - models_by_task: Dict[str, List[str]] = {} - - def _unpack_response(framework: str, items: List[Dict]) -> None: - for model in items: - if framework == "sentence-transformers": - # Model running with the `sentence-transformers` framework can work with both tasks even if not - # branded as such in the API response - models_by_task.setdefault("feature-extraction", []).append(model["model_id"]) - models_by_task.setdefault("sentence-similarity", []).append(model["model_id"]) - else: - models_by_task.setdefault(model["task"], []).append(model["model_id"]) - - for framework in frameworks: - response = get_session().get(f"{INFERENCE_ENDPOINT}/framework/{framework}", headers=self.headers) - hf_raise_for_status(response) - _unpack_response(framework, response.json()) - - # Sort alphabetically for discoverability and return - for task, models in models_by_task.items(): - models_by_task[task] = sorted(set(models), key=lambda x: x.lower()) - return models_by_task - - def object_detection( - self, - image: ContentT, - *, - model: Optional[str] = None, - ) -> List[ObjectDetectionOutput]: - """ - Perform object detection on the given image using the specified model. - - - - You must have `PIL` installed if you want to work with images (`pip install Pillow`). - - - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The image to detect objects on. It can be raw bytes, an image file, or a URL to an online image. - model (`str`, *optional*): - The model to use for object detection. Can be a model ID hosted on the Hugging Face Hub or a URL to a - deployed Inference Endpoint. If not provided, the default recommended model for object detection (DETR) will be used. - - Returns: - `List[ObjectDetectionOutput]`: A list of dictionaries containing the bounding boxes and associated attributes. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - `ValueError`: - If the request output is not a List. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.object_detection("people.jpg"): - [{"score":0.9486683011054993,"label":"person","box":{"xmin":59,"ymin":39,"xmax":420,"ymax":510}}, ... ] - ``` - """ - # detect objects - response = self.post(data=image, model=model, task="object-detection") - output = _bytes_to_dict(response) - if not isinstance(output, list): - raise ValueError(f"Server output must be a list. Got {type(output)}: {str(output)[:200]}...") - return output - - def question_answering( - self, question: str, context: str, *, model: Optional[str] = None - ) -> QuestionAnsweringOutput: - """ - Retrieve the answer to a question from a given text. - - Args: - question (`str`): - Question to be answered. - context (`str`): - The context of the question. - model (`str`): - The model to use for the question answering task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. - - Returns: - `Dict`: a dictionary of question answering output containing the score, start index, end index, and answer. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.question_answering(question="What's my name?", context="My name is Clara and I live in Berkeley.") - {'score': 0.9326562285423279, 'start': 11, 'end': 16, 'answer': 'Clara'} - ``` - """ - - payload: Dict[str, Any] = {"question": question, "context": context} - response = self.post( - json=payload, - model=model, - task="question-answering", - ) - return _bytes_to_dict(response) # type: ignore - - def sentence_similarity( - self, sentence: str, other_sentences: List[str], *, model: Optional[str] = None - ) -> List[float]: - """ - Compute the semantic similarity between a sentence and a list of other sentences by comparing their embeddings. - - Args: - sentence (`str`): - The main sentence to compare to others. - other_sentences (`List[str]`): - The list of sentences to compare to. - model (`str`, *optional*): - The model to use for the conversational task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended conversational model will be used. - Defaults to None. - - Returns: - `List[float]`: The embedding representing the input text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.sentence_similarity( - ... "Machine learning is so easy.", - ... other_sentences=[ - ... "Deep learning is so straightforward.", - ... "This is so difficult, like rocket science.", - ... "I can't believe how much I struggled with this.", - ... ], - ... ) - [0.7785726189613342, 0.45876261591911316, 0.2906220555305481] - ``` - """ - response = self.post( - json={"inputs": {"source_sentence": sentence, "sentences": other_sentences}}, - model=model, - task="sentence-similarity", - ) - return _bytes_to_list(response) - - def summarization( - self, - text: str, - *, - parameters: Optional[Dict[str, Any]] = None, - model: Optional[str] = None, - ) -> str: - """ - Generate a summary of a given text using a specified model. - - Args: - text (`str`): - The input text to summarize. - parameters (`Dict[str, Any]`, *optional*): - Additional parameters for summarization. Check out this [page](https://huggingface.co/docs/api-inference/detailed_parameters#summarization-task) - for more details. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `str`: The generated summary text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.summarization("The Eiffel tower...") - 'The Eiffel tower is one of the most famous landmarks in the world....' - ``` - """ - payload: Dict[str, Any] = {"inputs": text} - if parameters is not None: - payload["parameters"] = parameters - response = self.post(json=payload, model=model, task="summarization") - return _bytes_to_dict(response)[0]["summary_text"] - - def table_question_answering( - self, table: Dict[str, Any], query: str, *, model: Optional[str] = None - ) -> TableQuestionAnsweringOutput: - """ - Retrieve the answer to a question from information given in a table. - - Args: - table (`str`): - A table of data represented as a dict of lists where entries are headers and the lists are all the - values, all lists must have the same size. - query (`str`): - The query in plain text that you want to ask the table. - model (`str`): - The model to use for the table-question-answering task. Can be a model ID hosted on the Hugging Face - Hub or a URL to a deployed Inference Endpoint. - - Returns: - `Dict`: a dictionary of table question answering output containing the answer, coordinates, cells and the aggregator used. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> query = "How many stars does the transformers repository have?" - >>> table = {"Repository": ["Transformers", "Datasets", "Tokenizers"], "Stars": ["36542", "4512", "3934"]} - >>> client.table_question_answering(table, query, model="google/tapas-base-finetuned-wtq") - {'answer': 'AVERAGE > 36542', 'coordinates': [[0, 1]], 'cells': ['36542'], 'aggregator': 'AVERAGE'} - ``` - """ - response = self.post( - json={ - "query": query, - "table": table, - }, - model=model, - task="table-question-answering", - ) - return _bytes_to_dict(response) # type: ignore - - def tabular_classification(self, table: Dict[str, Any], *, model: str) -> List[str]: - """ - Classifying a target category (a group) based on a set of attributes. - - Args: - table (`Dict[str, Any]`): - Set of attributes to classify. - model (`str`): - The model to use for the tabular-classification task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. - - Returns: - `List`: a list of labels, one per row in the initial table. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> table = { - ... "fixed_acidity": ["7.4", "7.8", "10.3"], - ... "volatile_acidity": ["0.7", "0.88", "0.32"], - ... "citric_acid": ["0", "0", "0.45"], - ... "residual_sugar": ["1.9", "2.6", "6.4"], - ... "chlorides": ["0.076", "0.098", "0.073"], - ... "free_sulfur_dioxide": ["11", "25", "5"], - ... "total_sulfur_dioxide": ["34", "67", "13"], - ... "density": ["0.9978", "0.9968", "0.9976"], - ... "pH": ["3.51", "3.2", "3.23"], - ... "sulphates": ["0.56", "0.68", "0.82"], - ... "alcohol": ["9.4", "9.8", "12.6"], - ... } - >>> client.tabular_classification(table=table, model="julien-c/wine-quality") - ["5", "5", "5"] - ``` - """ - response = self.post(json={"table": table}, model=model, task="tabular-classification") - return _bytes_to_list(response) - - def tabular_regression(self, table: Dict[str, Any], *, model: str) -> List[float]: - """ - Predicting a numerical target value given a set of attributes/features in a table. - - Args: - table (`Dict[str, Any]`): - Set of attributes stored in a table. The attributes used to predict the target can be both numerical and categorical. - model (`str`): - The model to use for the tabular-regression task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. - - Returns: - `List`: a list of predicted numerical target values. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> table = { - ... "Height": ["11.52", "12.48", "12.3778"], - ... "Length1": ["23.2", "24", "23.9"], - ... "Length2": ["25.4", "26.3", "26.5"], - ... "Length3": ["30", "31.2", "31.1"], - ... "Species": ["Bream", "Bream", "Bream"], - ... "Width": ["4.02", "4.3056", "4.6961"], - ... } - >>> client.tabular_regression(table, model="scikit-learn/Fish-Weight") - [110, 120, 130] - ``` - """ - response = self.post(json={"table": table}, model=model, task="tabular-regression") - return _bytes_to_list(response) - - def text_classification(self, text: str, *, model: Optional[str] = None) -> List[ClassificationOutput]: - """ - Perform text classification (e.g. sentiment-analysis) on the given text. - - Args: - text (`str`): - A string to be classified. - model (`str`, *optional*): - The model to use for the text classification task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended text classification model will be used. - Defaults to None. - - Returns: - `List[Dict]`: a list of dictionaries containing the predicted label and associated probability. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.text_classification("I like you") - [{'label': 'POSITIVE', 'score': 0.9998695850372314}, {'label': 'NEGATIVE', 'score': 0.0001304351753788069}] - ``` - """ - response = self.post(json={"inputs": text}, model=model, task="text-classification") - return _bytes_to_list(response)[0] - - @overload - def text_generation( # type: ignore - self, - prompt: str, - *, - details: Literal[False] = ..., - stream: Literal[False] = ..., - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - ) -> str: - ... - - @overload - def text_generation( # type: ignore - self, - prompt: str, - *, - details: Literal[True] = ..., - stream: Literal[False] = ..., - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - ) -> TextGenerationResponse: - ... - - @overload - def text_generation( # type: ignore - self, - prompt: str, - *, - details: Literal[False] = ..., - stream: Literal[True] = ..., - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - ) -> Iterable[str]: - ... - - @overload - def text_generation( - self, - prompt: str, - *, - details: Literal[True] = ..., - stream: Literal[True] = ..., - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - ) -> Iterable[TextGenerationStreamResponse]: - ... - - def text_generation( - self, - prompt: str, - *, - details: bool = False, - stream: bool = False, - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - decoder_input_details: bool = False, - ) -> Union[str, TextGenerationResponse, Iterable[str], Iterable[TextGenerationStreamResponse]]: - """ - Given a prompt, generate the following text. - - It is recommended to have Pydantic installed in order to get inputs validated. This is preferable as it allow - early failures. - - API endpoint is supposed to run with the `text-generation-inference` backend (TGI). This backend is the - go-to solution to run large language models at scale. However, for some smaller models (e.g. "gpt2") the - default `transformers` + `api-inference` solution is still in use. Both approaches have very similar APIs, but - not exactly the same. This method is compatible with both approaches but some parameters are only available for - `text-generation-inference`. If some parameters are ignored, a warning message is triggered but the process - continues correctly. - - To learn more about the TGI project, please refer to https://github.com/huggingface/text-generation-inference. - - Args: - prompt (`str`): - Input text. - details (`bool`, *optional*): - By default, text_generation returns a string. Pass `details=True` if you want a detailed output (tokens, - probabilities, seed, finish reason, etc.). Only available for models running on with the - `text-generation-inference` backend. - stream (`bool`, *optional*): - By default, text_generation returns the full generated text. Pass `stream=True` if you want a stream of - tokens to be returned. Only available for models running on with the `text-generation-inference` - backend. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - do_sample (`bool`): - Activate logits sampling - max_new_tokens (`int`): - Maximum number of generated tokens - best_of (`int`): - Generate best_of sequences and return the one if the highest token logprobs - repetition_penalty (`float`): - The parameter for repetition penalty. 1.0 means no penalty. See [this - paper](https://arxiv.org/pdf/1909.05858.pdf) for more details. - return_full_text (`bool`): - Whether to prepend the prompt to the generated text - seed (`int`): - Random sampling seed - stop_sequences (`List[str]`): - Stop generating tokens if a member of `stop_sequences` is generated - temperature (`float`): - The value used to module the logits distribution. - top_k (`int`): - The number of highest probability vocabulary tokens to keep for top-k-filtering. - top_p (`float`): - If set to < 1, only the smallest set of most probable tokens with probabilities that add up to `top_p` or - higher are kept for generation. - truncate (`int`): - Truncate inputs tokens to the given size - typical_p (`float`): - Typical Decoding mass - See [Typical Decoding for Natural Language Generation](https://arxiv.org/abs/2202.00666) for more information - watermark (`bool`): - Watermarking with [A Watermark for Large Language Models](https://arxiv.org/abs/2301.10226) - decoder_input_details (`bool`): - Return the decoder input token logprobs and ids. You must set `details=True` as well for it to be taken - into account. Defaults to `False`. - - Returns: - `Union[str, TextGenerationResponse, Iterable[str], Iterable[TextGenerationStreamResponse]]`: - Generated text returned from the server: - - if `stream=False` and `details=False`, the generated text is returned as a `str` (default) - - if `stream=True` and `details=False`, the generated text is returned token by token as a `Iterable[str]` - - if `stream=False` and `details=True`, the generated text is returned with more details as a [`~huggingface_hub.inference._text_generation.TextGenerationResponse`] - - if `details=True` and `stream=True`, the generated text is returned token by token as a iterable of [`~huggingface_hub.inference._text_generation.TextGenerationStreamResponse`] - - Raises: - `ValidationError`: - If input values are not valid. No HTTP call is made to the server. - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - - # Case 1: generate text - >>> client.text_generation("The huggingface_hub library is ", max_new_tokens=12) - '100% open source and built to be easy to use.' - - # Case 2: iterate over the generated tokens. Useful for large generation. - >>> for token in client.text_generation("The huggingface_hub library is ", max_new_tokens=12, stream=True): - ... print(token) - 100 - % - open - source - and - built - to - be - easy - to - use - . - - # Case 3: get more details about the generation process. - >>> client.text_generation("The huggingface_hub library is ", max_new_tokens=12, details=True) - TextGenerationResponse( - generated_text='100% open source and built to be easy to use.', - details=Details( - finish_reason=, - generated_tokens=12, - seed=None, - prefill=[ - InputToken(id=487, text='The', logprob=None), - InputToken(id=53789, text=' hugging', logprob=-13.171875), - (...) - InputToken(id=204, text=' ', logprob=-7.0390625) - ], - tokens=[ - Token(id=1425, text='100', logprob=-1.0175781, special=False), - Token(id=16, text='%', logprob=-0.0463562, special=False), - (...) - Token(id=25, text='.', logprob=-0.5703125, special=False) - ], - best_of_sequences=None - ) - ) - - # Case 4: iterate over the generated tokens with more details. - # Last object is more complete, containing the full generated text and the finish reason. - >>> for details in client.text_generation("The huggingface_hub library is ", max_new_tokens=12, details=True, stream=True): - ... print(details) - ... - TextGenerationStreamResponse(token=Token(id=1425, text='100', logprob=-1.0175781, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=16, text='%', logprob=-0.0463562, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=1314, text=' open', logprob=-1.3359375, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=3178, text=' source', logprob=-0.28100586, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=273, text=' and', logprob=-0.5961914, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=3426, text=' built', logprob=-1.9423828, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=271, text=' to', logprob=-1.4121094, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=314, text=' be', logprob=-1.5224609, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=1833, text=' easy', logprob=-2.1132812, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=271, text=' to', logprob=-0.08520508, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=745, text=' use', logprob=-0.39453125, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token( - id=25, - text='.', - logprob=-0.5703125, - special=False), - generated_text='100% open source and built to be easy to use.', - details=StreamDetails(finish_reason=, generated_tokens=12, seed=None) - ) - ``` - """ - # NOTE: Text-generation integration is taken from the text-generation-inference project. It has more features - # like input/output validation (if Pydantic is installed). See `_text_generation.py` header for more details. - - if decoder_input_details and not details: - warnings.warn( - "`decoder_input_details=True` has been passed to the server but `details=False` is set meaning that" - " the output from the server will be truncated." - ) - decoder_input_details = False - - # Validate parameters - parameters = TextGenerationParameters( - best_of=best_of, - details=details, - do_sample=do_sample, - max_new_tokens=max_new_tokens, - repetition_penalty=repetition_penalty, - return_full_text=return_full_text, - seed=seed, - stop=stop_sequences if stop_sequences is not None else [], - temperature=temperature, - top_k=top_k, - top_p=top_p, - truncate=truncate, - typical_p=typical_p, - watermark=watermark, - decoder_input_details=decoder_input_details, - ) - request = TextGenerationRequest(inputs=prompt, stream=stream, parameters=parameters) - payload = asdict(request) - - # Remove some parameters if not a TGI server - if not _is_tgi_server(model): - ignored_parameters = [] - for key in "watermark", "stop", "details", "decoder_input_details": - if payload["parameters"][key] is not None: - ignored_parameters.append(key) - del payload["parameters"][key] - if len(ignored_parameters) > 0: - warnings.warn( - "API endpoint/model for text-generation is not served via TGI. Ignoring parameters" - f" {ignored_parameters}.", - UserWarning, - ) - if details: - warnings.warn( - "API endpoint/model for text-generation is not served via TGI. Parameter `details=True` will" - " be ignored meaning only the generated text will be returned.", - UserWarning, - ) - details = False - if stream: - raise ValueError( - "API endpoint/model for text-generation is not served via TGI. Cannot return output as a stream." - " Please pass `stream=False` as input." - ) - - # Handle errors separately for more precise error messages - try: - bytes_output = self.post(json=payload, model=model, task="text-generation", stream=stream) # type: ignore - except HTTPError as e: - if isinstance(e, BadRequestError) and "The following `model_kwargs` are not used by the model" in str(e): - _set_as_non_tgi(model) - return self.text_generation( # type: ignore - prompt=prompt, - details=details, - stream=stream, - model=model, - do_sample=do_sample, - max_new_tokens=max_new_tokens, - best_of=best_of, - repetition_penalty=repetition_penalty, - return_full_text=return_full_text, - seed=seed, - stop_sequences=stop_sequences, - temperature=temperature, - top_k=top_k, - top_p=top_p, - truncate=truncate, - typical_p=typical_p, - watermark=watermark, - decoder_input_details=decoder_input_details, - ) - raise_text_generation_error(e) - - # Parse output - if stream: - return _stream_text_generation_response(bytes_output, details) # type: ignore - - data = _bytes_to_dict(bytes_output)[0] - return TextGenerationResponse(**data) if details else data["generated_text"] - - def text_to_image( - self, - prompt: str, - *, - negative_prompt: Optional[str] = None, - height: Optional[float] = None, - width: Optional[float] = None, - num_inference_steps: Optional[float] = None, - guidance_scale: Optional[float] = None, - model: Optional[str] = None, - **kwargs, - ) -> "Image": - """ - Generate an image based on a given text using a specified model. - - - - You must have `PIL` installed if you want to work with images (`pip install Pillow`). - - - - Args: - prompt (`str`): - The prompt to generate an image from. - negative_prompt (`str`, *optional*): - An optional negative prompt for the image generation. - height (`float`, *optional*): - The height in pixels of the image to generate. - width (`float`, *optional*): - The width in pixels of the image to generate. - num_inference_steps (`int`, *optional*): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*): - Higher guidance scale encourages to generate images that are closely linked to the text `prompt`, - usually at the expense of lower image quality. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `Image`: The generated image. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - - >>> image = client.text_to_image("An astronaut riding a horse on the moon.") - >>> image.save("astronaut.png") - - >>> image = client.text_to_image( - ... "An astronaut riding a horse on the moon.", - ... negative_prompt="low resolution, blurry", - ... model="stabilityai/stable-diffusion-2-1", - ... ) - >>> image.save("better_astronaut.png") - ``` - """ - payload = {"inputs": prompt} - parameters = { - "negative_prompt": negative_prompt, - "height": height, - "width": width, - "num_inference_steps": num_inference_steps, - "guidance_scale": guidance_scale, - **kwargs, - } - for key, value in parameters.items(): - if value is not None: - payload.setdefault("parameters", {})[key] = value # type: ignore - response = self.post(json=payload, model=model, task="text-to-image") - return _bytes_to_image(response) - - def text_to_speech(self, text: str, *, model: Optional[str] = None) -> bytes: - """ - Synthesize an audio of a voice pronouncing a given text. - - Args: - text (`str`): - The text to synthesize. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `bytes`: The generated audio. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from pathlib import Path - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - - >>> audio = client.text_to_speech("Hello world") - >>> Path("hello_world.flac").write_bytes(audio) - ``` - """ - return self.post(json={"inputs": text}, model=model, task="text-to-speech") - - def token_classification(self, text: str, *, model: Optional[str] = None) -> List[TokenClassificationOutput]: - """ - Perform token classification on the given text. - Usually used for sentence parsing, either grammatical, or Named Entity Recognition (NER) to understand keywords contained within text. - - Args: - text (`str`): - A string to be classified. - model (`str`, *optional*): - The model to use for the token classification task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended token classification model will be used. - Defaults to None. - - Returns: - `List[Dict]`: List of token classification outputs containing the entity group, confidence score, word, start and end index. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.token_classification("My name is Sarah Jessica Parker but you can call me Jessica") - [{'entity_group': 'PER', - 'score': 0.9971321225166321, - 'word': 'Sarah Jessica Parker', - 'start': 11, - 'end': 31}, - {'entity_group': 'PER', - 'score': 0.9773476123809814, - 'word': 'Jessica', - 'start': 52, - 'end': 59}] - ``` - """ - payload: Dict[str, Any] = {"inputs": text} - response = self.post( - json=payload, - model=model, - task="token-classification", - ) - return _bytes_to_list(response) - - def translation(self, text: str, *, model: Optional[str] = None) -> str: - """ - Convert text from one language to another. - - Check out https://huggingface.co/tasks/translation for more information on how to choose the best model for - your specific use case. Source and target languages usually depends on the model. - - Args: - text (`str`): - A string to be translated. - model (`str`, *optional*): - The model to use for the translation task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended translation model will be used. - Defaults to None. - - Returns: - `str`: The generated translated text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.translation("My name is Wolfgang and I live in Berlin") - 'Mein Name ist Wolfgang und ich lebe in Berlin.' - >>> client.translation("My name is Wolfgang and I live in Berlin", model="Helsinki-NLP/opus-mt-en-fr") - "Je m'appelle Wolfgang et je vis à Berlin." - ``` - """ - response = self.post(json={"inputs": text}, model=model, task="translation") - return _bytes_to_dict(response)[0]["translation_text"] - - def zero_shot_classification( - self, text: str, labels: List[str], *, multi_label: bool = False, model: Optional[str] = None - ) -> List[ClassificationOutput]: - """ - Provide as input a text and a set of candidate labels to classify the input text. - - Args: - text (`str`): - The input text to classify. - labels (`List[str]`): - List of string possible labels. There must be at least 2 labels. - multi_label (`bool`): - Boolean that is set to True if classes can overlap. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `List[Dict]`: List of classification outputs containing the predicted labels and their confidence. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> text = ( - ... "A new model offers an explanation for how the Galilean satellites formed around the solar system's" - ... "largest world. Konstantin Batygin did not set out to solve one of the solar system's most puzzling" - ... " mysteries when he went for a run up a hill in Nice, France." - ... ) - >>> labels = ["space & cosmos", "scientific discovery", "microbiology", "robots", "archeology"] - >>> client.zero_shot_classification(text, labels) - [ - {"label": "scientific discovery", "score": 0.7961668968200684}, - {"label": "space & cosmos", "score": 0.18570658564567566}, - {"label": "microbiology", "score": 0.00730885099619627}, - {"label": "archeology", "score": 0.006258360575884581}, - {"label": "robots", "score": 0.004559356719255447}, - ] - >>> client.zero_shot_classification(text, labels, multi_label=True) - [ - {"label": "scientific discovery", "score": 0.9829297661781311}, - {"label": "space & cosmos", "score": 0.755190908908844}, - {"label": "microbiology", "score": 0.0005462635890580714}, - {"label": "archeology", "score": 0.00047131875180639327}, - {"label": "robots", "score": 0.00030448526376858354}, - ] - ``` - """ - # Raise ValueError if input is less than 2 labels - if len(labels) < 2: - raise ValueError("You must specify at least 2 classes to compare.") - - response = self.post( - json={ - "inputs": text, - "parameters": { - "candidate_labels": ",".join(labels), - "multi_label": multi_label, - }, - }, - model=model, - task="zero-shot-classification", - ) - output = _bytes_to_dict(response) - return [{"label": label, "score": score} for label, score in zip(output["labels"], output["scores"])] - - def zero_shot_image_classification( - self, image: ContentT, labels: List[str], *, model: Optional[str] = None - ) -> List[ClassificationOutput]: - """ - Provide input image and text labels to predict text labels for the image. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image to caption. It can be raw bytes, an image file, or a URL to an online image. - labels (`List[str]`): - List of string possible labels. There must be at least 2 labels. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `List[Dict]`: List of classification outputs containing the predicted labels and their confidence. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `HTTPError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - - >>> client.zero_shot_image_classification( - ... "https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Cute_dog.jpg/320px-Cute_dog.jpg", - ... labels=["dog", "cat", "horse"], - ... ) - [{"label": "dog", "score": 0.956}, ...] - ``` - """ - # Raise ValueError if input is less than 2 labels - if len(labels) < 2: - raise ValueError("You must specify at least 2 classes to compare.") - - response = self.post( - json={"image": _b64_encode(image), "parameters": {"candidate_labels": ",".join(labels)}}, - model=model, - task="zero-shot-image-classification", - ) - return _bytes_to_list(response) - - def _resolve_url(self, model: Optional[str] = None, task: Optional[str] = None) -> str: - model = model or self.model - - # If model is already a URL, ignore `task` and return directly - if model is not None and (model.startswith("http://") or model.startswith("https://")): - return model - - # # If no model but task is set => fetch the recommended one for this task - if model is None: - if task is None: - raise ValueError( - "You must specify at least a model (repo_id or URL) or a task, either when instantiating" - " `InferenceClient` or when making a request." - ) - model = _get_recommended_model(task) - - # Compute InferenceAPI url - return ( - # Feature-extraction and sentence-similarity are the only cases where we handle models with several tasks. - f"{INFERENCE_ENDPOINT}/pipeline/{task}/{model}" - if task in ("feature-extraction", "sentence-similarity") - # Otherwise, we use the default endpoint - else f"{INFERENCE_ENDPOINT}/models/{model}" - ) - - def get_model_status(self, model: Optional[str] = None) -> ModelStatus: - """ - Get the status of a model hosted on the Inference API. - - - - This endpoint is mostly useful when you already know which model you want to use and want to check its - availability. If you want to discover already deployed models, you should rather use [`~InferenceClient.list_deployed_models`]. - - - - Args: - model (`str`, *optional*): - Identifier of the model for witch the status gonna be checked. If model is not provided, - the model associated with this instance of [`InferenceClient`] will be used. Only InferenceAPI service can be checked so the - identifier cannot be a URL. - - - Returns: - [`ModelStatus`]: An instance of ModelStatus dataclass, containing information, - about the state of the model: load, state, compute type and framework. - - Example: - ```py - >>> from huggingface_hub import InferenceClient - >>> client = InferenceClient() - >>> client.get_model_status("bigcode/starcoder") - ModelStatus(loaded=True, state='Loaded', compute_type='gpu', framework='text-generation-inference') - ``` - """ - model = model or self.model - if model is None: - raise ValueError("Model id not provided.") - if model.startswith("https://"): - raise NotImplementedError("Model status is only available for Inference API endpoints.") - url = f"{INFERENCE_ENDPOINT}/status/{model}" - - response = get_session().get(url, headers=self.headers) - hf_raise_for_status(response) - response_data = response.json() - - if "error" in response_data: - raise ValueError(response_data["error"]) - - return ModelStatus( - loaded=response_data["loaded"], - state=response_data["state"], - compute_type=response_data["compute_type"], - framework=response_data["framework"], - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_common.py b/venv/lib/python3.8/site-packages/huggingface_hub/inference/_common.py deleted file mode 100644 index 5973083a712b84748867b8aecf532e4998731052..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_common.py +++ /dev/null @@ -1,335 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities used by both the sync and async inference clients.""" -import base64 -import io -import json -import logging -from contextlib import contextmanager -from dataclasses import dataclass -from pathlib import Path -from typing import ( - TYPE_CHECKING, - Any, - AsyncIterable, - BinaryIO, - ContextManager, - Dict, - Generator, - Iterable, - List, - Literal, - Optional, - Set, - Union, - overload, -) - -from requests import HTTPError - -from ..constants import ENDPOINT -from ..utils import ( - build_hf_headers, - get_session, - hf_raise_for_status, - is_aiohttp_available, - is_numpy_available, - is_pillow_available, -) -from ._text_generation import TextGenerationStreamResponse, _parse_text_generation_error - - -if TYPE_CHECKING: - from aiohttp import ClientResponse, ClientSession - from PIL import Image - -# TYPES -UrlT = str -PathT = Union[str, Path] -BinaryT = Union[bytes, BinaryIO] -ContentT = Union[BinaryT, PathT, UrlT] - -# Use to set a Accept: image/png header -TASKS_EXPECTING_IMAGES = {"text-to-image", "image-to-image"} - -logger = logging.getLogger(__name__) - - -# Add dataclass for ModelStatus. We use this dataclass in get_model_status function. -@dataclass -class ModelStatus: - """ - This Dataclass represents the the model status in the Hugging Face Inference API. - - Args: - loaded (`bool`): - If the model is currently loaded. - state (`str`): - The current state of the model. This can be 'Loaded', 'Loadable', 'TooBig' - compute_type (`str`): - The type of compute resource the model is using or will use, such as 'gpu' or 'cpu'. - framework (`str`): - The name of the framework that the model was built with, such as 'transformers' - or 'text-generation-inference'. - """ - - loaded: bool - state: str - compute_type: str - framework: str - - -class InferenceTimeoutError(HTTPError, TimeoutError): - """Error raised when a model is unavailable or the request times out.""" - - -## IMPORT UTILS - - -def _import_aiohttp(): - # Make sure `aiohttp` is installed on the machine. - if not is_aiohttp_available(): - raise ImportError("Please install aiohttp to use `AsyncInferenceClient` (`pip install aiohttp`).") - import aiohttp - - return aiohttp - - -def _import_numpy(): - """Make sure `numpy` is installed on the machine.""" - if not is_numpy_available(): - raise ImportError("Please install numpy to use deal with embeddings (`pip install numpy`).") - import numpy - - return numpy - - -def _import_pil_image(): - """Make sure `PIL` is installed on the machine.""" - if not is_pillow_available(): - raise ImportError( - "Please install Pillow to use deal with images (`pip install Pillow`). If you don't want the image to be" - " post-processed, use `client.post(...)` and get the raw response from the server." - ) - from PIL import Image - - return Image - - -## RECOMMENDED MODELS - -# Will be globally fetched only once (see '_fetch_recommended_models') -_RECOMMENDED_MODELS: Optional[Dict[str, Optional[str]]] = None - - -def _get_recommended_model(task: str) -> str: - model = _fetch_recommended_models().get(task) - if model is None: - raise ValueError( - f"Task {task} has no recommended task. Please specify a model explicitly. Visit" - " https://huggingface.co/tasks for more info." - ) - logger.info( - f"Using recommended model {model} for task {task}. Note that it is encouraged to explicitly set" - f" `model='{model}'` as the recommended models list might get updated without prior notice." - ) - return model - - -def _fetch_recommended_models() -> Dict[str, Optional[str]]: - global _RECOMMENDED_MODELS - if _RECOMMENDED_MODELS is None: - response = get_session().get(f"{ENDPOINT}/api/tasks", headers=build_hf_headers()) - hf_raise_for_status(response) - _RECOMMENDED_MODELS = { - task: _first_or_none(details["widgetModels"]) for task, details in response.json().items() - } - return _RECOMMENDED_MODELS - - -def _first_or_none(items: List[Any]) -> Optional[Any]: - try: - return items[0] or None - except IndexError: - return None - - -## ENCODING / DECODING UTILS - - -@overload -def _open_as_binary(content: ContentT) -> ContextManager[BinaryT]: - ... # means "if input is not None, output is not None" - - -@overload -def _open_as_binary(content: Literal[None]) -> ContextManager[Literal[None]]: - ... # means "if input is None, output is None" - - -@contextmanager # type: ignore -def _open_as_binary(content: Optional[ContentT]) -> Generator[Optional[BinaryT], None, None]: - """Open `content` as a binary file, either from a URL, a local path, or raw bytes. - - Do nothing if `content` is None, - - TODO: handle a PIL.Image as input - TODO: handle base64 as input - """ - # If content is a string => must be either a URL or a path - if isinstance(content, str): - if content.startswith("https://") or content.startswith("http://"): - logger.debug(f"Downloading content from {content}") - yield get_session().get(content).content # TODO: retrieve as stream and pipe to post request ? - return - content = Path(content) - if not content.exists(): - raise FileNotFoundError( - f"File not found at {content}. If `data` is a string, it must either be a URL or a path to a local" - " file. To pass raw content, please encode it as bytes first." - ) - - # If content is a Path => open it - if isinstance(content, Path): - logger.debug(f"Opening content from {content}") - with content.open("rb") as f: - yield f - else: - # Otherwise: already a file-like object or None - yield content - - -def _b64_encode(content: ContentT) -> str: - """Encode a raw file (image, audio) into base64. Can be byes, an opened file, a path or a URL.""" - with _open_as_binary(content) as data: - data_as_bytes = data if isinstance(data, bytes) else data.read() - return base64.b64encode(data_as_bytes).decode() - - -def _b64_to_image(encoded_image: str) -> "Image": - """Parse a base64-encoded string into a PIL Image.""" - Image = _import_pil_image() - return Image.open(io.BytesIO(base64.b64decode(encoded_image))) - - -def _bytes_to_list(content: bytes) -> List: - """Parse bytes from a Response object into a Python list. - - Expects the response body to be JSON-encoded data. - - NOTE: This is exactly the same implementation as `_bytes_to_dict` and will not complain if the returned data is a - dictionary. The only advantage of having both is to help the user (and mypy) understand what kind of data to expect. - """ - return json.loads(content.decode()) - - -def _bytes_to_dict(content: bytes) -> Dict: - """Parse bytes from a Response object into a Python dictionary. - - Expects the response body to be JSON-encoded data. - - NOTE: This is exactly the same implementation as `_bytes_to_list` and will not complain if the returned data is a - list. The only advantage of having both is to help the user (and mypy) understand what kind of data to expect. - """ - return json.loads(content.decode()) - - -def _bytes_to_image(content: bytes) -> "Image": - """Parse bytes from a Response object into a PIL Image. - - Expects the response body to be raw bytes. To deal with b64 encoded images, use `_b64_to_image` instead. - """ - Image = _import_pil_image() - return Image.open(io.BytesIO(content)) - - -## STREAMING UTILS - - -def _stream_text_generation_response( - bytes_output_as_lines: Iterable[bytes], details: bool -) -> Union[Iterable[str], Iterable[TextGenerationStreamResponse]]: - # Parse ServerSentEvents - for byte_payload in bytes_output_as_lines: - # Skip line - if byte_payload == b"\n": - continue - - payload = byte_payload.decode("utf-8") - - # Event data - if payload.startswith("data:"): - # Decode payload - json_payload = json.loads(payload.lstrip("data:").rstrip("/n")) - # Either an error as being returned - if json_payload.get("error") is not None: - raise _parse_text_generation_error(json_payload["error"], json_payload.get("error_type")) - # Or parse token payload - output = TextGenerationStreamResponse(**json_payload) - yield output.token.text if not details else output - - -async def _async_stream_text_generation_response( - bytes_output_as_lines: AsyncIterable[bytes], details: bool -) -> Union[AsyncIterable[str], AsyncIterable[TextGenerationStreamResponse]]: - # Parse ServerSentEvents - async for byte_payload in bytes_output_as_lines: - # Skip line - if byte_payload == b"\n": - continue - - payload = byte_payload.decode("utf-8") - - # Event data - if payload.startswith("data:"): - # Decode payload - json_payload = json.loads(payload.lstrip("data:").rstrip("/n")) - # Either an error as being returned - if json_payload.get("error") is not None: - raise _parse_text_generation_error(json_payload["error"], json_payload.get("error_type")) - # Or parse token payload - output = TextGenerationStreamResponse(**json_payload) - yield output.token.text if not details else output - - -async def _async_yield_from(client: "ClientSession", response: "ClientResponse") -> AsyncIterable[bytes]: - async for byte_payload in response.content: - yield byte_payload - await client.close() - - -# "TGI servers" are servers running with the `text-generation-inference` backend. -# This backend is the go-to solution to run large language models at scale. However, -# for some smaller models (e.g. "gpt2") the default `transformers` + `api-inference` -# solution is still in use. -# -# Both approaches have very similar APIs, but not exactly the same. What we do first in -# the `text_generation` method is to assume the model is served via TGI. If we realize -# it's not the case (i.e. we receive an HTTP 400 Bad Request), we fallback to the -# default API with a warning message. We remember for each model if it's a TGI server -# or not using `_NON_TGI_SERVERS` global variable. -# -# For more details, see https://github.com/huggingface/text-generation-inference and -# https://huggingface.co/docs/api-inference/detailed_parameters#text-generation-task. - -_NON_TGI_SERVERS: Set[Optional[str]] = set() - - -def _set_as_non_tgi(model: Optional[str]) -> None: - _NON_TGI_SERVERS.add(model) - - -def _is_tgi_server(model: Optional[str]) -> bool: - return model not in _NON_TGI_SERVERS diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/__init__.py b/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 04700539292097cd8214a834a2f0278a61864e97..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-38.pyc deleted file mode 100644 index b449344fa0b705a4657afe5f33c50262e3da3c78..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/_async_client.py b/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/_async_client.py deleted file mode 100644 index 3ab4faf43650d8ef404e206b5e31392808de6e26..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_generated/_async_client.py +++ /dev/null @@ -1,1959 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# WARNING -# This entire file has been adapted from the sync-client code in `src/huggingface_hub/inference/_client.py`. -# Any change in InferenceClient will be automatically reflected in AsyncInferenceClient. -# To re-generate the code, run `make style` or `python ./utils/generate_async_inference_client.py --update`. -# WARNING -import asyncio -import logging -import time -import warnings -from dataclasses import asdict -from typing import ( - TYPE_CHECKING, - Any, - AsyncIterable, - Dict, - List, - Literal, - Optional, - Union, - overload, -) - -from requests.structures import CaseInsensitiveDict - -from huggingface_hub.constants import ALL_INFERENCE_API_FRAMEWORKS, INFERENCE_ENDPOINT, MAIN_INFERENCE_API_FRAMEWORKS -from huggingface_hub.inference._common import ( - TASKS_EXPECTING_IMAGES, - ContentT, - InferenceTimeoutError, - ModelStatus, - _async_stream_text_generation_response, - _b64_encode, - _b64_to_image, - _bytes_to_dict, - _bytes_to_image, - _bytes_to_list, - _get_recommended_model, - _import_numpy, - _is_tgi_server, - _open_as_binary, - _set_as_non_tgi, -) -from huggingface_hub.inference._text_generation import ( - TextGenerationParameters, - TextGenerationRequest, - TextGenerationResponse, - TextGenerationStreamResponse, - raise_text_generation_error, -) -from huggingface_hub.inference._types import ( - ClassificationOutput, - ConversationalOutput, - FillMaskOutput, - ImageSegmentationOutput, - ObjectDetectionOutput, - QuestionAnsweringOutput, - TableQuestionAnsweringOutput, - TokenClassificationOutput, -) -from huggingface_hub.utils import ( - build_hf_headers, -) - -from .._common import _async_yield_from, _import_aiohttp - - -if TYPE_CHECKING: - import numpy as np - from PIL import Image - -logger = logging.getLogger(__name__) - - -class AsyncInferenceClient: - """ - Initialize a new Inference Client. - - [`InferenceClient`] aims to provide a unified experience to perform inference. The client can be used - seamlessly with either the (free) Inference API or self-hosted Inference Endpoints. - - Args: - model (`str`, `optional`): - The model to run inference with. Can be a model id hosted on the Hugging Face Hub, e.g. `bigcode/starcoder` - or a URL to a deployed Inference Endpoint. Defaults to None, in which case a recommended model is - automatically selected for the task. - token (`str`, *optional*): - Hugging Face token. Will default to the locally saved token. Pass `token=False` if you don't want to send - your token to the server. - timeout (`float`, `optional`): - The maximum number of seconds to wait for a response from the server. Loading a new model in Inference - API can take up to several minutes. Defaults to None, meaning it will loop until the server is available. - headers (`Dict[str, str]`, `optional`): - Additional headers to send to the server. By default only the authorization and user-agent headers are sent. - Values in this dictionary will override the default values. - cookies (`Dict[str, str]`, `optional`): - Additional cookies to send to the server. - """ - - def __init__( - self, - model: Optional[str] = None, - token: Union[str, bool, None] = None, - timeout: Optional[float] = None, - headers: Optional[Dict[str, str]] = None, - cookies: Optional[Dict[str, str]] = None, - ) -> None: - self.model: Optional[str] = model - self.headers = CaseInsensitiveDict(build_hf_headers(token=token)) # contains 'authorization' + 'user-agent' - if headers is not None: - self.headers.update(headers) - self.cookies = cookies - self.timeout = timeout - - def __repr__(self): - return f"" - - @overload - async def post( # type: ignore - self, - *, - json: Optional[Union[str, Dict, List]] = None, - data: Optional[ContentT] = None, - model: Optional[str] = None, - task: Optional[str] = None, - stream: Literal[False] = ..., - ) -> bytes: - pass - - @overload - async def post( # type: ignore - self, - *, - json: Optional[Union[str, Dict, List]] = None, - data: Optional[ContentT] = None, - model: Optional[str] = None, - task: Optional[str] = None, - stream: Literal[True] = ..., - ) -> AsyncIterable[bytes]: - pass - - async def post( - self, - *, - json: Optional[Union[str, Dict, List]] = None, - data: Optional[ContentT] = None, - model: Optional[str] = None, - task: Optional[str] = None, - stream: bool = False, - ) -> Union[bytes, AsyncIterable[bytes]]: - """ - Make a POST request to the inference server. - - Args: - json (`Union[str, Dict, List]`, *optional*): - The JSON data to send in the request body. Defaults to None. - data (`Union[str, Path, bytes, BinaryIO]`, *optional*): - The content to send in the request body. It can be raw bytes, a pointer to an opened file, a local file - path, or a URL to an online resource (image, audio file,...). If both `json` and `data` are passed, - `data` will take precedence. At least `json` or `data` must be provided. Defaults to None. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. Will override the model defined at the instance level. Defaults to None. - task (`str`, *optional*): - The task to perform on the inference. Used only to default to a recommended model if `model` is not - provided. At least `model` or `task` must be provided. Defaults to None. - stream (`bool`, *optional*): - Whether to iterate over streaming APIs. - - Returns: - bytes: The raw bytes returned by the server. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - """ - - aiohttp = _import_aiohttp() - - url = self._resolve_url(model, task) - - if data is not None and json is not None: - warnings.warn("Ignoring `json` as `data` is passed as binary.") - - # Set Accept header if relevant - headers = self.headers.copy() - if task in TASKS_EXPECTING_IMAGES and "Accept" not in headers: - headers["Accept"] = "image/png" - - t0 = time.time() - timeout = self.timeout - while True: - with _open_as_binary(data) as data_as_binary: - # Do not use context manager as we don't want to close the connection immediately when returning - # a stream - client = aiohttp.ClientSession( - headers=headers, cookies=self.cookies, timeout=aiohttp.ClientTimeout(self.timeout) - ) - - try: - response = await client.post(url, json=json, data=data_as_binary) - response_error_payload = None - if response.status != 200: - try: - response_error_payload = await response.json() # get payload before connection closed - except Exception: - pass - response.raise_for_status() - if stream: - return _async_yield_from(client, response) - else: - content = await response.read() - await client.close() - return content - except asyncio.TimeoutError as error: - await client.close() - # Convert any `TimeoutError` to a `InferenceTimeoutError` - raise InferenceTimeoutError(f"Inference call timed out: {url}") from error # type: ignore - except aiohttp.ClientResponseError as error: - error.response_error_payload = response_error_payload - await client.close() - if response.status == 503: - # If Model is unavailable, either raise a TimeoutError... - if timeout is not None and time.time() - t0 > timeout: - raise InferenceTimeoutError( - f"Model not loaded on the server: {url}. Please retry with a higher timeout" - f" (current: {self.timeout}).", - request=error.request, - response=error.response, - ) from error - # ...or wait 1s and retry - logger.info(f"Waiting for model to be loaded on the server: {error}") - time.sleep(1) - if timeout is not None: - timeout = max(self.timeout - (time.time() - t0), 1) # type: ignore - continue - raise error - - async def audio_classification( - self, - audio: ContentT, - *, - model: Optional[str] = None, - ) -> List[ClassificationOutput]: - """ - Perform audio classification on the provided audio content. - - Args: - audio (Union[str, Path, bytes, BinaryIO]): - The audio content to classify. It can be raw audio bytes, a local audio file, or a URL pointing to an - audio file. - model (`str`, *optional*): - The model to use for audio classification. Can be a model ID hosted on the Hugging Face Hub - or a URL to a deployed Inference Endpoint. If not provided, the default recommended model for - audio classification will be used. - - Returns: - `List[Dict]`: The classification output containing the predicted label and its confidence. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.audio_classification("audio.flac") - [{'score': 0.4976358711719513, 'label': 'hap'}, {'score': 0.3677836060523987, 'label': 'neu'},...] - ``` - """ - response = await self.post(data=audio, model=model, task="audio-classification") - return _bytes_to_list(response) - - async def automatic_speech_recognition( - self, - audio: ContentT, - *, - model: Optional[str] = None, - ) -> str: - """ - Perform automatic speech recognition (ASR or audio-to-text) on the given audio content. - - Args: - audio (Union[str, Path, bytes, BinaryIO]): - The content to transcribe. It can be raw audio bytes, local audio file, or a URL to an audio file. - model (`str`, *optional*): - The model to use for ASR. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. If not provided, the default recommended model for ASR will be used. - - Returns: - str: The transcribed text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.automatic_speech_recognition("hello_world.flac") - "hello world" - ``` - """ - response = await self.post(data=audio, model=model, task="automatic-speech-recognition") - return _bytes_to_dict(response)["text"] - - async def conversational( - self, - text: str, - generated_responses: Optional[List[str]] = None, - past_user_inputs: Optional[List[str]] = None, - *, - parameters: Optional[Dict[str, Any]] = None, - model: Optional[str] = None, - ) -> ConversationalOutput: - """ - Generate conversational responses based on the given input text (i.e. chat with the API). - - Args: - text (`str`): - The last input from the user in the conversation. - generated_responses (`List[str]`, *optional*): - A list of strings corresponding to the earlier replies from the model. Defaults to None. - past_user_inputs (`List[str]`, *optional*): - A list of strings corresponding to the earlier replies from the user. Should be the same length as - `generated_responses`. Defaults to None. - parameters (`Dict[str, Any]`, *optional*): - Additional parameters for the conversational task. Defaults to None. For more details about the available - parameters, please refer to [this page](https://huggingface.co/docs/api-inference/detailed_parameters#conversational-task) - model (`str`, *optional*): - The model to use for the conversational task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended conversational model will be used. - Defaults to None. - - Returns: - `Dict`: The generated conversational output. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> output = await client.conversational("Hi, who are you?") - >>> output - {'generated_text': 'I am the one who knocks.', 'conversation': {'generated_responses': ['I am the one who knocks.'], 'past_user_inputs': ['Hi, who are you?']}, 'warnings': ['Setting `pad_token_id` to `eos_token_id`:50256 async for open-end generation.']} - >>> await client.conversational( - ... "Wow, that's scary!", - ... generated_responses=output["conversation"]["generated_responses"], - ... past_user_inputs=output["conversation"]["past_user_inputs"], - ... ) - ``` - """ - payload: Dict[str, Any] = {"inputs": {"text": text}} - if generated_responses is not None: - payload["inputs"]["generated_responses"] = generated_responses - if past_user_inputs is not None: - payload["inputs"]["past_user_inputs"] = past_user_inputs - if parameters is not None: - payload["parameters"] = parameters - response = await self.post(json=payload, model=model, task="conversational") - return _bytes_to_dict(response) # type: ignore - - async def visual_question_answering( - self, - image: ContentT, - question: str, - *, - model: Optional[str] = None, - ) -> List[str]: - """ - Answering open-ended questions based on an image. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image for the context. It can be raw bytes, an image file, or a URL to an online image. - question (`str`): - Question to be answered. - model (`str`, *optional*): - The model to use for the visual question answering task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended visual question answering model will be used. - Defaults to None. - - Returns: - `List[Dict]`: a list of dictionaries containing the predicted label and associated probability. - - Raises: - `InferenceTimeoutError`: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.visual_question_answering( - ... image="https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg", - ... question="What is the animal doing?" - ... ) - [{'score': 0.778609573841095, 'answer': 'laying down'},{'score': 0.6957435607910156, 'answer': 'sitting'}, ...] - ``` - """ - payload: Dict[str, Any] = {"question": question, "image": _b64_encode(image)} - response = await self.post(json=payload, model=model, task="visual-question-answering") - return _bytes_to_list(response) - - async def document_question_answering( - self, - image: ContentT, - question: str, - *, - model: Optional[str] = None, - ) -> List[QuestionAnsweringOutput]: - """ - Answer questions on document images. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image for the context. It can be raw bytes, an image file, or a URL to an online image. - question (`str`): - Question to be answered. - model (`str`, *optional*): - The model to use for the document question answering task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended document question answering model will be used. - Defaults to None. - - Returns: - `List[Dict]`: a list of dictionaries containing the predicted label, associated probability, word ids, and page number. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.document_question_answering(image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png", question="What is the invoice number?") - [{'score': 0.42515629529953003, 'answer': 'us-001', 'start': 16, 'end': 16}] - ``` - """ - payload: Dict[str, Any] = {"question": question, "image": _b64_encode(image)} - response = await self.post(json=payload, model=model, task="document-question-answering") - return _bytes_to_list(response) - - async def feature_extraction(self, text: str, *, model: Optional[str] = None) -> "np.ndarray": - """ - Generate embeddings for a given text. - - Args: - text (`str`): - The text to embed. - model (`str`, *optional*): - The model to use for the conversational task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended conversational model will be used. - Defaults to None. - - Returns: - `np.ndarray`: The embedding representing the input text as a float32 numpy array. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.feature_extraction("Hi, who are you?") - array([[ 2.424802 , 2.93384 , 1.1750331 , ..., 1.240499, -0.13776633, -0.7889173 ], - [-0.42943227, -0.6364878 , -1.693462 , ..., 0.41978157, -2.4336355 , 0.6162071 ], - ..., - [ 0.28552425, -0.928395 , -1.2077185 , ..., 0.76810825, -2.1069427 , 0.6236161 ]], dtype=float32) - ``` - """ - response = await self.post(json={"inputs": text}, model=model, task="feature-extraction") - np = _import_numpy() - return np.array(_bytes_to_dict(response), dtype="float32") - - async def fill_mask(self, text: str, *, model: Optional[str] = None) -> List[FillMaskOutput]: - """ - Fill in a hole with a missing word (token to be precise). - - Args: - text (`str`): - a string to be filled from, must contain the [MASK] token (check model card for exact name of the mask). - model (`str`, *optional*): - The model to use for the fill mask task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended fill mask model will be used. - Defaults to None. - - Returns: - `List[Dict]`: a list of fill mask output dictionaries containing the predicted label, associated - probability, token reference, and completed text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.fill_mask("The goal of life is .") - [{'score': 0.06897063553333282, - 'token': 11098, - 'token_str': ' happiness', - 'sequence': 'The goal of life is happiness.'}, - {'score': 0.06554922461509705, - 'token': 45075, - 'token_str': ' immortality', - 'sequence': 'The goal of life is immortality.'}] - ``` - """ - response = await self.post(json={"inputs": text}, model=model, task="fill-mask") - return _bytes_to_list(response) - - async def image_classification( - self, - image: ContentT, - *, - model: Optional[str] = None, - ) -> List[ClassificationOutput]: - """ - Perform image classification on the given image using the specified model. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The image to classify. It can be raw bytes, an image file, or a URL to an online image. - model (`str`, *optional*): - The model to use for image classification. Can be a model ID hosted on the Hugging Face Hub or a URL to a - deployed Inference Endpoint. If not provided, the default recommended model for image classification will be used. - - Returns: - `List[Dict]`: a list of dictionaries containing the predicted label and associated probability. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.image_classification("https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Cute_dog.jpg/320px-Cute_dog.jpg") - [{'score': 0.9779096841812134, 'label': 'Blenheim spaniel'}, ...] - ``` - """ - response = await self.post(data=image, model=model, task="image-classification") - return _bytes_to_list(response) - - async def image_segmentation( - self, - image: ContentT, - *, - model: Optional[str] = None, - ) -> List[ImageSegmentationOutput]: - """ - Perform image segmentation on the given image using the specified model. - - - - You must have `PIL` installed if you want to work with images (`pip install Pillow`). - - - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The image to segment. It can be raw bytes, an image file, or a URL to an online image. - model (`str`, *optional*): - The model to use for image segmentation. Can be a model ID hosted on the Hugging Face Hub or a URL to a - deployed Inference Endpoint. If not provided, the default recommended model for image segmentation will be used. - - Returns: - `List[Dict]`: A list of dictionaries containing the segmented masks and associated attributes. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.image_segmentation("cat.jpg"): - [{'score': 0.989008, 'label': 'LABEL_184', 'mask': }, ...] - ``` - """ - - # Segment - response = await self.post(data=image, model=model, task="image-segmentation") - output = _bytes_to_dict(response) - - # Parse masks as PIL Image - if not isinstance(output, list): - raise ValueError(f"Server output must be a list. Got {type(output)}: {str(output)[:200]}...") - for item in output: - item["mask"] = _b64_to_image(item["mask"]) - return output - - async def image_to_image( - self, - image: ContentT, - prompt: Optional[str] = None, - *, - negative_prompt: Optional[str] = None, - height: Optional[int] = None, - width: Optional[int] = None, - num_inference_steps: Optional[int] = None, - guidance_scale: Optional[float] = None, - model: Optional[str] = None, - **kwargs, - ) -> "Image": - """ - Perform image-to-image translation using a specified model. - - - - You must have `PIL` installed if you want to work with images (`pip install Pillow`). - - - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image for translation. It can be raw bytes, an image file, or a URL to an online image. - prompt (`str`, *optional*): - The text prompt to guide the image generation. - negative_prompt (`str`, *optional*): - A negative prompt to guide the translation process. - height (`int`, *optional*): - The height in pixels of the generated image. - width (`int`, *optional*): - The width in pixels of the generated image. - num_inference_steps (`int`, *optional*): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*): - Higher guidance scale encourages to generate images that are closely linked to the text `prompt`, - usually at the expense of lower image quality. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `Image`: The translated image. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> image = await client.image_to_image("cat.jpg", prompt="turn the cat into a tiger") - >>> image.save("tiger.jpg") - ``` - """ - parameters = { - "prompt": prompt, - "negative_prompt": negative_prompt, - "height": height, - "width": width, - "num_inference_steps": num_inference_steps, - "guidance_scale": guidance_scale, - **kwargs, - } - if all(parameter is None for parameter in parameters.values()): - # Either only an image to send => send as raw bytes - data = image - payload: Optional[Dict[str, Any]] = None - else: - # Or an image + some parameters => use base64 encoding - data = None - payload = {"inputs": _b64_encode(image)} - for key, value in parameters.items(): - if value is not None: - payload.setdefault("parameters", {})[key] = value - - response = await self.post(json=payload, data=data, model=model, task="image-to-image") - return _bytes_to_image(response) - - async def image_to_text(self, image: ContentT, *, model: Optional[str] = None) -> str: - """ - Takes an input image and return text. - - Models can have very different outputs depending on your use case (image captioning, optical character recognition - (OCR), Pix2Struct, etc). Please have a look to the model card to learn more about a model's specificities. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image to caption. It can be raw bytes, an image file, or a URL to an online image.. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `str`: The generated text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.image_to_text("cat.jpg") - 'a cat standing in a grassy field ' - >>> await client.image_to_text("https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Cute_dog.jpg/320px-Cute_dog.jpg") - 'a dog laying on the grass next to a flower pot ' - ``` - """ - response = await self.post(data=image, model=model, task="image-to-text") - return _bytes_to_dict(response)[0]["generated_text"] - - async def list_deployed_models( - self, frameworks: Union[None, str, Literal["all"], List[str]] = None - ) -> Dict[str, List[str]]: - """ - List models currently deployed on the Inference API service. - - This helper checks deployed models framework by framework. By default, it will check the 4 main frameworks that - are supported and account for 95% of the hosted models. However, if you want a complete list of models you can - specify `frameworks="all"` as input. Alternatively, if you know before-hand which framework you are interested - in, you can also restrict to search to this one (e.g. `frameworks="text-generation-inference"`). The more - frameworks are checked, the more time it will take. - - - - This endpoint is mostly useful for discoverability. If you already know which model you want to use and want to - check its availability, you can directly use [`~InferenceClient.get_model_status`]. - - - - Args: - frameworks (`Literal["all"]` or `List[str]` or `str`, *optional*): - The frameworks to filter on. By default only a subset of the available frameworks are tested. If set to - "all", all available frameworks will be tested. It is also possible to provide a single framework or a - custom set of frameworks to check. - - Returns: - `Dict[str, List[str]]`: A dictionary mapping task names to a sorted list of model IDs. - - Example: - ```py - # Must be run in an async contextthon - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - - # Discover zero-shot-classification models currently deployed - >>> models = await client.list_deployed_models() - >>> models["zero-shot-classification"] - ['Narsil/deberta-large-mnli-zero-cls', 'facebook/bart-large-mnli', ...] - - # List from only 1 framework - >>> await client.list_deployed_models("text-generation-inference") - {'text-generation': ['bigcode/starcoder', 'meta-llama/Llama-2-70b-chat-hf', ...], ...} - ``` - """ - # Resolve which frameworks to check - if frameworks is None: - frameworks = MAIN_INFERENCE_API_FRAMEWORKS - elif frameworks == "all": - frameworks = ALL_INFERENCE_API_FRAMEWORKS - elif isinstance(frameworks, str): - frameworks = [frameworks] - frameworks = list(set(frameworks)) - - # Fetch them iteratively - models_by_task: Dict[str, List[str]] = {} - - def _unpack_response(framework: str, items: List[Dict]) -> None: - for model in items: - if framework == "sentence-transformers": - # Model running with the `sentence-transformers` framework can work with both tasks even if not - # branded as such in the API response - models_by_task.setdefault("feature-extraction", []).append(model["model_id"]) - models_by_task.setdefault("sentence-similarity", []).append(model["model_id"]) - else: - models_by_task.setdefault(model["task"], []).append(model["model_id"]) - - async def _fetch_framework(framework: str) -> None: - async with _import_aiohttp().ClientSession(headers=self.headers) as client: - response = await client.get(f"{INFERENCE_ENDPOINT}/framework/{framework}") - response.raise_for_status() - _unpack_response(framework, await response.json()) - - import asyncio - - await asyncio.gather(*[_fetch_framework(framework) for framework in frameworks]) - - # Sort alphabetically for discoverability and return - for task, models in models_by_task.items(): - models_by_task[task] = sorted(set(models), key=lambda x: x.lower()) - return models_by_task - - async def object_detection( - self, - image: ContentT, - *, - model: Optional[str] = None, - ) -> List[ObjectDetectionOutput]: - """ - Perform object detection on the given image using the specified model. - - - - You must have `PIL` installed if you want to work with images (`pip install Pillow`). - - - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The image to detect objects on. It can be raw bytes, an image file, or a URL to an online image. - model (`str`, *optional*): - The model to use for object detection. Can be a model ID hosted on the Hugging Face Hub or a URL to a - deployed Inference Endpoint. If not provided, the default recommended model for object detection (DETR) will be used. - - Returns: - `List[ObjectDetectionOutput]`: A list of dictionaries containing the bounding boxes and associated attributes. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - `ValueError`: - If the request output is not a List. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.object_detection("people.jpg"): - [{"score":0.9486683011054993,"label":"person","box":{"xmin":59,"ymin":39,"xmax":420,"ymax":510}}, ... ] - ``` - """ - # detect objects - response = await self.post(data=image, model=model, task="object-detection") - output = _bytes_to_dict(response) - if not isinstance(output, list): - raise ValueError(f"Server output must be a list. Got {type(output)}: {str(output)[:200]}...") - return output - - async def question_answering( - self, question: str, context: str, *, model: Optional[str] = None - ) -> QuestionAnsweringOutput: - """ - Retrieve the answer to a question from a given text. - - Args: - question (`str`): - Question to be answered. - context (`str`): - The context of the question. - model (`str`): - The model to use for the question answering task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. - - Returns: - `Dict`: a dictionary of question answering output containing the score, start index, end index, and answer. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.question_answering(question="What's my name?", context="My name is Clara and I live in Berkeley.") - {'score': 0.9326562285423279, 'start': 11, 'end': 16, 'answer': 'Clara'} - ``` - """ - - payload: Dict[str, Any] = {"question": question, "context": context} - response = await self.post( - json=payload, - model=model, - task="question-answering", - ) - return _bytes_to_dict(response) # type: ignore - - async def sentence_similarity( - self, sentence: str, other_sentences: List[str], *, model: Optional[str] = None - ) -> List[float]: - """ - Compute the semantic similarity between a sentence and a list of other sentences by comparing their embeddings. - - Args: - sentence (`str`): - The main sentence to compare to others. - other_sentences (`List[str]`): - The list of sentences to compare to. - model (`str`, *optional*): - The model to use for the conversational task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended conversational model will be used. - Defaults to None. - - Returns: - `List[float]`: The embedding representing the input text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.sentence_similarity( - ... "Machine learning is so easy.", - ... other_sentences=[ - ... "Deep learning is so straightforward.", - ... "This is so difficult, like rocket science.", - ... "I can't believe how much I struggled with this.", - ... ], - ... ) - [0.7785726189613342, 0.45876261591911316, 0.2906220555305481] - ``` - """ - response = await self.post( - json={"inputs": {"source_sentence": sentence, "sentences": other_sentences}}, - model=model, - task="sentence-similarity", - ) - return _bytes_to_list(response) - - async def summarization( - self, - text: str, - *, - parameters: Optional[Dict[str, Any]] = None, - model: Optional[str] = None, - ) -> str: - """ - Generate a summary of a given text using a specified model. - - Args: - text (`str`): - The input text to summarize. - parameters (`Dict[str, Any]`, *optional*): - Additional parameters for summarization. Check out this [page](https://huggingface.co/docs/api-inference/detailed_parameters#summarization-task) - for more details. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `str`: The generated summary text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.summarization("The Eiffel tower...") - 'The Eiffel tower is one of the most famous landmarks in the world....' - ``` - """ - payload: Dict[str, Any] = {"inputs": text} - if parameters is not None: - payload["parameters"] = parameters - response = await self.post(json=payload, model=model, task="summarization") - return _bytes_to_dict(response)[0]["summary_text"] - - async def table_question_answering( - self, table: Dict[str, Any], query: str, *, model: Optional[str] = None - ) -> TableQuestionAnsweringOutput: - """ - Retrieve the answer to a question from information given in a table. - - Args: - table (`str`): - A table of data represented as a dict of lists where entries are headers and the lists are all the - values, all lists must have the same size. - query (`str`): - The query in plain text that you want to ask the table. - model (`str`): - The model to use for the table-question-answering task. Can be a model ID hosted on the Hugging Face - Hub or a URL to a deployed Inference Endpoint. - - Returns: - `Dict`: a dictionary of table question answering output containing the answer, coordinates, cells and the aggregator used. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> query = "How many stars does the transformers repository have?" - >>> table = {"Repository": ["Transformers", "Datasets", "Tokenizers"], "Stars": ["36542", "4512", "3934"]} - >>> await client.table_question_answering(table, query, model="google/tapas-base-finetuned-wtq") - {'answer': 'AVERAGE > 36542', 'coordinates': [[0, 1]], 'cells': ['36542'], 'aggregator': 'AVERAGE'} - ``` - """ - response = await self.post( - json={ - "query": query, - "table": table, - }, - model=model, - task="table-question-answering", - ) - return _bytes_to_dict(response) # type: ignore - - async def tabular_classification(self, table: Dict[str, Any], *, model: str) -> List[str]: - """ - Classifying a target category (a group) based on a set of attributes. - - Args: - table (`Dict[str, Any]`): - Set of attributes to classify. - model (`str`): - The model to use for the tabular-classification task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. - - Returns: - `List`: a list of labels, one per row in the initial table. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> table = { - ... "fixed_acidity": ["7.4", "7.8", "10.3"], - ... "volatile_acidity": ["0.7", "0.88", "0.32"], - ... "citric_acid": ["0", "0", "0.45"], - ... "residual_sugar": ["1.9", "2.6", "6.4"], - ... "chlorides": ["0.076", "0.098", "0.073"], - ... "free_sulfur_dioxide": ["11", "25", "5"], - ... "total_sulfur_dioxide": ["34", "67", "13"], - ... "density": ["0.9978", "0.9968", "0.9976"], - ... "pH": ["3.51", "3.2", "3.23"], - ... "sulphates": ["0.56", "0.68", "0.82"], - ... "alcohol": ["9.4", "9.8", "12.6"], - ... } - >>> await client.tabular_classification(table=table, model="julien-c/wine-quality") - ["5", "5", "5"] - ``` - """ - response = await self.post(json={"table": table}, model=model, task="tabular-classification") - return _bytes_to_list(response) - - async def tabular_regression(self, table: Dict[str, Any], *, model: str) -> List[float]: - """ - Predicting a numerical target value given a set of attributes/features in a table. - - Args: - table (`Dict[str, Any]`): - Set of attributes stored in a table. The attributes used to predict the target can be both numerical and categorical. - model (`str`): - The model to use for the tabular-regression task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. - - Returns: - `List`: a list of predicted numerical target values. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> table = { - ... "Height": ["11.52", "12.48", "12.3778"], - ... "Length1": ["23.2", "24", "23.9"], - ... "Length2": ["25.4", "26.3", "26.5"], - ... "Length3": ["30", "31.2", "31.1"], - ... "Species": ["Bream", "Bream", "Bream"], - ... "Width": ["4.02", "4.3056", "4.6961"], - ... } - >>> await client.tabular_regression(table, model="scikit-learn/Fish-Weight") - [110, 120, 130] - ``` - """ - response = await self.post(json={"table": table}, model=model, task="tabular-regression") - return _bytes_to_list(response) - - async def text_classification(self, text: str, *, model: Optional[str] = None) -> List[ClassificationOutput]: - """ - Perform text classification (e.g. sentiment-analysis) on the given text. - - Args: - text (`str`): - A string to be classified. - model (`str`, *optional*): - The model to use for the text classification task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended text classification model will be used. - Defaults to None. - - Returns: - `List[Dict]`: a list of dictionaries containing the predicted label and associated probability. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.text_classification("I like you") - [{'label': 'POSITIVE', 'score': 0.9998695850372314}, {'label': 'NEGATIVE', 'score': 0.0001304351753788069}] - ``` - """ - response = await self.post(json={"inputs": text}, model=model, task="text-classification") - return _bytes_to_list(response)[0] - - @overload - async def text_generation( # type: ignore - self, - prompt: str, - *, - details: Literal[False] = ..., - stream: Literal[False] = ..., - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - ) -> str: - ... - - @overload - async def text_generation( # type: ignore - self, - prompt: str, - *, - details: Literal[True] = ..., - stream: Literal[False] = ..., - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - ) -> TextGenerationResponse: - ... - - @overload - async def text_generation( # type: ignore - self, - prompt: str, - *, - details: Literal[False] = ..., - stream: Literal[True] = ..., - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - ) -> AsyncIterable[str]: - ... - - @overload - async def text_generation( - self, - prompt: str, - *, - details: Literal[True] = ..., - stream: Literal[True] = ..., - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - ) -> AsyncIterable[TextGenerationStreamResponse]: - ... - - async def text_generation( - self, - prompt: str, - *, - details: bool = False, - stream: bool = False, - model: Optional[str] = None, - do_sample: bool = False, - max_new_tokens: int = 20, - best_of: Optional[int] = None, - repetition_penalty: Optional[float] = None, - return_full_text: bool = False, - seed: Optional[int] = None, - stop_sequences: Optional[List[str]] = None, - temperature: Optional[float] = None, - top_k: Optional[int] = None, - top_p: Optional[float] = None, - truncate: Optional[int] = None, - typical_p: Optional[float] = None, - watermark: bool = False, - decoder_input_details: bool = False, - ) -> Union[str, TextGenerationResponse, AsyncIterable[str], AsyncIterable[TextGenerationStreamResponse]]: - """ - Given a prompt, generate the following text. - - It is recommended to have Pydantic installed in order to get inputs validated. This is preferable as it allow - early failures. - - API endpoint is supposed to run with the `text-generation-inference` backend (TGI). This backend is the - go-to solution to run large language models at scale. However, for some smaller models (e.g. "gpt2") the - default `transformers` + `api-inference` solution is still in use. Both approaches have very similar APIs, but - not exactly the same. This method is compatible with both approaches but some parameters are only available for - `text-generation-inference`. If some parameters are ignored, a warning message is triggered but the process - continues correctly. - - To learn more about the TGI project, please refer to https://github.com/huggingface/text-generation-inference. - - Args: - prompt (`str`): - Input text. - details (`bool`, *optional*): - By default, text_generation returns a string. Pass `details=True` if you want a detailed output (tokens, - probabilities, seed, finish reason, etc.). Only available for models running on with the - `text-generation-inference` backend. - stream (`bool`, *optional*): - By default, text_generation returns the full generated text. Pass `stream=True` if you want a stream of - tokens to be returned. Only available for models running on with the `text-generation-inference` - backend. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - do_sample (`bool`): - Activate logits sampling - max_new_tokens (`int`): - Maximum number of generated tokens - best_of (`int`): - Generate best_of sequences and return the one if the highest token logprobs - repetition_penalty (`float`): - The parameter for repetition penalty. 1.0 means no penalty. See [this - paper](https://arxiv.org/pdf/1909.05858.pdf) for more details. - return_full_text (`bool`): - Whether to prepend the prompt to the generated text - seed (`int`): - Random sampling seed - stop_sequences (`List[str]`): - Stop generating tokens if a member of `stop_sequences` is generated - temperature (`float`): - The value used to module the logits distribution. - top_k (`int`): - The number of highest probability vocabulary tokens to keep for top-k-filtering. - top_p (`float`): - If set to < 1, only the smallest set of most probable tokens with probabilities that add up to `top_p` or - higher are kept for generation. - truncate (`int`): - Truncate inputs tokens to the given size - typical_p (`float`): - Typical Decoding mass - See [Typical Decoding for Natural Language Generation](https://arxiv.org/abs/2202.00666) for more information - watermark (`bool`): - Watermarking with [A Watermark for Large Language Models](https://arxiv.org/abs/2301.10226) - decoder_input_details (`bool`): - Return the decoder input token logprobs and ids. You must set `details=True` as well for it to be taken - into account. Defaults to `False`. - - Returns: - `Union[str, TextGenerationResponse, Iterable[str], Iterable[TextGenerationStreamResponse]]`: - Generated text returned from the server: - - if `stream=False` and `details=False`, the generated text is returned as a `str` (default) - - if `stream=True` and `details=False`, the generated text is returned token by token as a `Iterable[str]` - - if `stream=False` and `details=True`, the generated text is returned with more details as a [`~huggingface_hub.inference._text_generation.TextGenerationResponse`] - - if `details=True` and `stream=True`, the generated text is returned token by token as a iterable of [`~huggingface_hub.inference._text_generation.TextGenerationStreamResponse`] - - Raises: - `ValidationError`: - If input values are not valid. No HTTP call is made to the server. - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - - # Case 1: generate text - >>> await client.text_generation("The huggingface_hub library is ", max_new_tokens=12) - '100% open source and built to be easy to use.' - - # Case 2: iterate over the generated tokens. Useful async for large generation. - >>> async for token in await client.text_generation("The huggingface_hub library is ", max_new_tokens=12, stream=True): - ... print(token) - 100 - % - open - source - and - built - to - be - easy - to - use - . - - # Case 3: get more details about the generation process. - >>> await client.text_generation("The huggingface_hub library is ", max_new_tokens=12, details=True) - TextGenerationResponse( - generated_text='100% open source and built to be easy to use.', - details=Details( - finish_reason=, - generated_tokens=12, - seed=None, - prefill=[ - InputToken(id=487, text='The', logprob=None), - InputToken(id=53789, text=' hugging', logprob=-13.171875), - (...) - InputToken(id=204, text=' ', logprob=-7.0390625) - ], - tokens=[ - Token(id=1425, text='100', logprob=-1.0175781, special=False), - Token(id=16, text='%', logprob=-0.0463562, special=False), - (...) - Token(id=25, text='.', logprob=-0.5703125, special=False) - ], - best_of_sequences=None - ) - ) - - # Case 4: iterate over the generated tokens with more details. - # Last object is more complete, containing the full generated text and the finish reason. - >>> async for details in await client.text_generation("The huggingface_hub library is ", max_new_tokens=12, details=True, stream=True): - ... print(details) - ... - TextGenerationStreamResponse(token=Token(id=1425, text='100', logprob=-1.0175781, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=16, text='%', logprob=-0.0463562, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=1314, text=' open', logprob=-1.3359375, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=3178, text=' source', logprob=-0.28100586, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=273, text=' and', logprob=-0.5961914, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=3426, text=' built', logprob=-1.9423828, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=271, text=' to', logprob=-1.4121094, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=314, text=' be', logprob=-1.5224609, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=1833, text=' easy', logprob=-2.1132812, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=271, text=' to', logprob=-0.08520508, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token(id=745, text=' use', logprob=-0.39453125, special=False), generated_text=None, details=None) - TextGenerationStreamResponse(token=Token( - id=25, - text='.', - logprob=-0.5703125, - special=False), - generated_text='100% open source and built to be easy to use.', - details=StreamDetails(finish_reason=, generated_tokens=12, seed=None) - ) - ``` - """ - # NOTE: Text-generation integration is taken from the text-generation-inference project. It has more features - # like input/output validation (if Pydantic is installed). See `_text_generation.py` header for more details. - - if decoder_input_details and not details: - warnings.warn( - "`decoder_input_details=True` has been passed to the server but `details=False` is set meaning that" - " the output from the server will be truncated." - ) - decoder_input_details = False - - # Validate parameters - parameters = TextGenerationParameters( - best_of=best_of, - details=details, - do_sample=do_sample, - max_new_tokens=max_new_tokens, - repetition_penalty=repetition_penalty, - return_full_text=return_full_text, - seed=seed, - stop=stop_sequences if stop_sequences is not None else [], - temperature=temperature, - top_k=top_k, - top_p=top_p, - truncate=truncate, - typical_p=typical_p, - watermark=watermark, - decoder_input_details=decoder_input_details, - ) - request = TextGenerationRequest(inputs=prompt, stream=stream, parameters=parameters) - payload = asdict(request) - - # Remove some parameters if not a TGI server - if not _is_tgi_server(model): - ignored_parameters = [] - for key in "watermark", "stop", "details", "decoder_input_details": - if payload["parameters"][key] is not None: - ignored_parameters.append(key) - del payload["parameters"][key] - if len(ignored_parameters) > 0: - warnings.warn( - "API endpoint/model for text-generation is not served via TGI. Ignoring parameters" - f" {ignored_parameters}.", - UserWarning, - ) - if details: - warnings.warn( - "API endpoint/model for text-generation is not served via TGI. Parameter `details=True` will" - " be ignored meaning only the generated text will be returned.", - UserWarning, - ) - details = False - if stream: - raise ValueError( - "API endpoint/model for text-generation is not served via TGI. Cannot return output as a stream." - " Please pass `stream=False` as input." - ) - - # Handle errors separately for more precise error messages - try: - bytes_output = await self.post(json=payload, model=model, task="text-generation", stream=stream) # type: ignore - except _import_aiohttp().ClientResponseError as e: - error_message = getattr(e, "response_error_payload", {}).get("error", "") - if e.code == 400 and "The following `model_kwargs` are not used by the model" in error_message: - _set_as_non_tgi(model) - return await self.text_generation( # type: ignore - prompt=prompt, - details=details, - stream=stream, - model=model, - do_sample=do_sample, - max_new_tokens=max_new_tokens, - best_of=best_of, - repetition_penalty=repetition_penalty, - return_full_text=return_full_text, - seed=seed, - stop_sequences=stop_sequences, - temperature=temperature, - top_k=top_k, - top_p=top_p, - truncate=truncate, - typical_p=typical_p, - watermark=watermark, - decoder_input_details=decoder_input_details, - ) - raise_text_generation_error(e) - - # Parse output - if stream: - return _async_stream_text_generation_response(bytes_output, details) # type: ignore - - data = _bytes_to_dict(bytes_output)[0] - return TextGenerationResponse(**data) if details else data["generated_text"] - - async def text_to_image( - self, - prompt: str, - *, - negative_prompt: Optional[str] = None, - height: Optional[float] = None, - width: Optional[float] = None, - num_inference_steps: Optional[float] = None, - guidance_scale: Optional[float] = None, - model: Optional[str] = None, - **kwargs, - ) -> "Image": - """ - Generate an image based on a given text using a specified model. - - - - You must have `PIL` installed if you want to work with images (`pip install Pillow`). - - - - Args: - prompt (`str`): - The prompt to generate an image from. - negative_prompt (`str`, *optional*): - An optional negative prompt for the image generation. - height (`float`, *optional*): - The height in pixels of the image to generate. - width (`float`, *optional*): - The width in pixels of the image to generate. - num_inference_steps (`int`, *optional*): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*): - Higher guidance scale encourages to generate images that are closely linked to the text `prompt`, - usually at the expense of lower image quality. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `Image`: The generated image. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - - >>> image = await client.text_to_image("An astronaut riding a horse on the moon.") - >>> image.save("astronaut.png") - - >>> image = await client.text_to_image( - ... "An astronaut riding a horse on the moon.", - ... negative_prompt="low resolution, blurry", - ... model="stabilityai/stable-diffusion-2-1", - ... ) - >>> image.save("better_astronaut.png") - ``` - """ - payload = {"inputs": prompt} - parameters = { - "negative_prompt": negative_prompt, - "height": height, - "width": width, - "num_inference_steps": num_inference_steps, - "guidance_scale": guidance_scale, - **kwargs, - } - for key, value in parameters.items(): - if value is not None: - payload.setdefault("parameters", {})[key] = value # type: ignore - response = await self.post(json=payload, model=model, task="text-to-image") - return _bytes_to_image(response) - - async def text_to_speech(self, text: str, *, model: Optional[str] = None) -> bytes: - """ - Synthesize an audio of a voice pronouncing a given text. - - Args: - text (`str`): - The text to synthesize. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `bytes`: The generated audio. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from pathlib import Path - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - - >>> audio = await client.text_to_speech("Hello world") - >>> Path("hello_world.flac").write_bytes(audio) - ``` - """ - return await self.post(json={"inputs": text}, model=model, task="text-to-speech") - - async def token_classification(self, text: str, *, model: Optional[str] = None) -> List[TokenClassificationOutput]: - """ - Perform token classification on the given text. - Usually used for sentence parsing, either grammatical, or Named Entity Recognition (NER) to understand keywords contained within text. - - Args: - text (`str`): - A string to be classified. - model (`str`, *optional*): - The model to use for the token classification task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended token classification model will be used. - Defaults to None. - - Returns: - `List[Dict]`: List of token classification outputs containing the entity group, confidence score, word, start and end index. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.token_classification("My name is Sarah Jessica Parker but you can call me Jessica") - [{'entity_group': 'PER', - 'score': 0.9971321225166321, - 'word': 'Sarah Jessica Parker', - 'start': 11, - 'end': 31}, - {'entity_group': 'PER', - 'score': 0.9773476123809814, - 'word': 'Jessica', - 'start': 52, - 'end': 59}] - ``` - """ - payload: Dict[str, Any] = {"inputs": text} - response = await self.post( - json=payload, - model=model, - task="token-classification", - ) - return _bytes_to_list(response) - - async def translation(self, text: str, *, model: Optional[str] = None) -> str: - """ - Convert text from one language to another. - - Check out https://huggingface.co/tasks/translation for more information on how to choose the best model for - your specific use case. Source and target languages usually depends on the model. - - Args: - text (`str`): - A string to be translated. - model (`str`, *optional*): - The model to use for the translation task. Can be a model ID hosted on the Hugging Face Hub or a URL to - a deployed Inference Endpoint. If not provided, the default recommended translation model will be used. - Defaults to None. - - Returns: - `str`: The generated translated text. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.translation("My name is Wolfgang and I live in Berlin") - 'Mein Name ist Wolfgang und ich lebe in Berlin.' - >>> await client.translation("My name is Wolfgang and I live in Berlin", model="Helsinki-NLP/opus-mt-en-fr") - "Je m'appelle Wolfgang et je vis à Berlin." - ``` - """ - response = await self.post(json={"inputs": text}, model=model, task="translation") - return _bytes_to_dict(response)[0]["translation_text"] - - async def zero_shot_classification( - self, text: str, labels: List[str], *, multi_label: bool = False, model: Optional[str] = None - ) -> List[ClassificationOutput]: - """ - Provide as input a text and a set of candidate labels to classify the input text. - - Args: - text (`str`): - The input text to classify. - labels (`List[str]`): - List of string possible labels. There must be at least 2 labels. - multi_label (`bool`): - Boolean that is set to True if classes can overlap. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `List[Dict]`: List of classification outputs containing the predicted labels and their confidence. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> text = ( - ... "A new model offers an explanation async for how the Galilean satellites formed around the solar system's" - ... "largest world. Konstantin Batygin did not set out to solve one of the solar system's most puzzling" - ... " mysteries when he went async for a run up a hill in Nice, France." - ... ) - >>> labels = ["space & cosmos", "scientific discovery", "microbiology", "robots", "archeology"] - >>> await client.zero_shot_classification(text, labels) - [ - {"label": "scientific discovery", "score": 0.7961668968200684}, - {"label": "space & cosmos", "score": 0.18570658564567566}, - {"label": "microbiology", "score": 0.00730885099619627}, - {"label": "archeology", "score": 0.006258360575884581}, - {"label": "robots", "score": 0.004559356719255447}, - ] - >>> await client.zero_shot_classification(text, labels, multi_label=True) - [ - {"label": "scientific discovery", "score": 0.9829297661781311}, - {"label": "space & cosmos", "score": 0.755190908908844}, - {"label": "microbiology", "score": 0.0005462635890580714}, - {"label": "archeology", "score": 0.00047131875180639327}, - {"label": "robots", "score": 0.00030448526376858354}, - ] - ``` - """ - # Raise ValueError if input is less than 2 labels - if len(labels) < 2: - raise ValueError("You must specify at least 2 classes to compare.") - - response = await self.post( - json={ - "inputs": text, - "parameters": { - "candidate_labels": ",".join(labels), - "multi_label": multi_label, - }, - }, - model=model, - task="zero-shot-classification", - ) - output = _bytes_to_dict(response) - return [{"label": label, "score": score} for label, score in zip(output["labels"], output["scores"])] - - async def zero_shot_image_classification( - self, image: ContentT, labels: List[str], *, model: Optional[str] = None - ) -> List[ClassificationOutput]: - """ - Provide input image and text labels to predict text labels for the image. - - Args: - image (`Union[str, Path, bytes, BinaryIO]`): - The input image to caption. It can be raw bytes, an image file, or a URL to an online image. - labels (`List[str]`): - List of string possible labels. There must be at least 2 labels. - model (`str`, *optional*): - The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed - Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None. - - Returns: - `List[Dict]`: List of classification outputs containing the predicted labels and their confidence. - - Raises: - [`InferenceTimeoutError`]: - If the model is unavailable or the request times out. - `aiohttp.ClientResponseError`: - If the request fails with an HTTP error status code other than HTTP 503. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - - >>> await client.zero_shot_image_classification( - ... "https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Cute_dog.jpg/320px-Cute_dog.jpg", - ... labels=["dog", "cat", "horse"], - ... ) - [{"label": "dog", "score": 0.956}, ...] - ``` - """ - # Raise ValueError if input is less than 2 labels - if len(labels) < 2: - raise ValueError("You must specify at least 2 classes to compare.") - - response = await self.post( - json={"image": _b64_encode(image), "parameters": {"candidate_labels": ",".join(labels)}}, - model=model, - task="zero-shot-image-classification", - ) - return _bytes_to_list(response) - - def _resolve_url(self, model: Optional[str] = None, task: Optional[str] = None) -> str: - model = model or self.model - - # If model is already a URL, ignore `task` and return directly - if model is not None and (model.startswith("http://") or model.startswith("https://")): - return model - - # # If no model but task is set => fetch the recommended one for this task - if model is None: - if task is None: - raise ValueError( - "You must specify at least a model (repo_id or URL) or a task, either when instantiating" - " `InferenceClient` or when making a request." - ) - model = _get_recommended_model(task) - - # Compute InferenceAPI url - return ( - # Feature-extraction and sentence-similarity are the only cases where we handle models with several tasks. - f"{INFERENCE_ENDPOINT}/pipeline/{task}/{model}" - if task in ("feature-extraction", "sentence-similarity") - # Otherwise, we use the default endpoint - else f"{INFERENCE_ENDPOINT}/models/{model}" - ) - - async def get_model_status(self, model: Optional[str] = None) -> ModelStatus: - """ - Get the status of a model hosted on the Inference API. - - - - This endpoint is mostly useful when you already know which model you want to use and want to check its - availability. If you want to discover already deployed models, you should rather use [`~InferenceClient.list_deployed_models`]. - - - - Args: - model (`str`, *optional*): - Identifier of the model for witch the status gonna be checked. If model is not provided, - the model associated with this instance of [`InferenceClient`] will be used. Only InferenceAPI service can be checked so the - identifier cannot be a URL. - - - Returns: - [`ModelStatus`]: An instance of ModelStatus dataclass, containing information, - about the state of the model: load, state, compute type and framework. - - Example: - ```py - # Must be run in an async context - >>> from huggingface_hub import AsyncInferenceClient - >>> client = AsyncInferenceClient() - >>> await client.get_model_status("bigcode/starcoder") - ModelStatus(loaded=True, state='Loaded', compute_type='gpu', framework='text-generation-inference') - ``` - """ - model = model or self.model - if model is None: - raise ValueError("Model id not provided.") - if model.startswith("https://"): - raise NotImplementedError("Model status is only available for Inference API endpoints.") - url = f"{INFERENCE_ENDPOINT}/status/{model}" - - async with _import_aiohttp().ClientSession(headers=self.headers) as client: - response = await client.get(url) - response.raise_for_status() - response_data = await response.json() - - if "error" in response_data: - raise ValueError(response_data["error"]) - - return ModelStatus( - loaded=response_data["loaded"], - state=response_data["state"], - compute_type=response_data["compute_type"], - framework=response_data["framework"], - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_text_generation.py b/venv/lib/python3.8/site-packages/huggingface_hub/inference/_text_generation.py deleted file mode 100644 index a67c127b87e218b9c81273ef1eb0a857e5f0d861..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_text_generation.py +++ /dev/null @@ -1,490 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Original implementation taken from the `text-generation` Python client (see https://pypi.org/project/text-generation/ -# and https://github.com/huggingface/text-generation-inference/tree/main/clients/python) -# -# Changes compared to original implementation: -# - use pydantic.dataclasses instead of BaseModel -# - default to Python's dataclasses if Pydantic is not installed (same implementation but no validation) -# - added default values for all parameters (not needed in BaseModel but dataclasses yes) -# - integrated in `huggingface_hub.InferenceClient`` -# - added `stream: bool` and `details: bool` in the `text_generation` method instead of having different methods for each use case - -from dataclasses import field -from enum import Enum -from typing import List, NoReturn, Optional - -from requests import HTTPError - -from ..utils import is_pydantic_available - - -if is_pydantic_available(): - from pydantic import validator - from pydantic.dataclasses import dataclass -else: - # No validation if Pydantic is not installed - from dataclasses import dataclass # type: ignore - - def validator(x): # type: ignore - return lambda y: y - - -@dataclass -class TextGenerationParameters: - """ - Parameters for text generation. - - Args: - do_sample (`bool`, *optional*): - Activate logits sampling. Defaults to False. - max_new_tokens (`int`, *optional*): - Maximum number of generated tokens. Defaults to 20. - repetition_penalty (`Optional[float]`, *optional*): - The parameter for repetition penalty. A value of 1.0 means no penalty. See [this paper](https://arxiv.org/pdf/1909.05858.pdf) - for more details. Defaults to None. - return_full_text (`bool`, *optional*): - Whether to prepend the prompt to the generated text. Defaults to False. - stop (`List[str]`, *optional*): - Stop generating tokens if a member of `stop_sequences` is generated. Defaults to an empty list. - seed (`Optional[int]`, *optional*): - Random sampling seed. Defaults to None. - temperature (`Optional[float]`, *optional*): - The value used to modulate the logits distribution. Defaults to None. - top_k (`Optional[int]`, *optional*): - The number of highest probability vocabulary tokens to keep for top-k-filtering. Defaults to None. - top_p (`Optional[float]`, *optional*): - If set to a value less than 1, only the smallest set of most probable tokens with probabilities that add up - to `top_p` or higher are kept for generation. Defaults to None. - truncate (`Optional[int]`, *optional*): - Truncate input tokens to the given size. Defaults to None. - typical_p (`Optional[float]`, *optional*): - Typical Decoding mass. See [Typical Decoding for Natural Language Generation](https://arxiv.org/abs/2202.00666) - for more information. Defaults to None. - best_of (`Optional[int]`, *optional*): - Generate `best_of` sequences and return the one with the highest token logprobs. Defaults to None. - watermark (`bool`, *optional*): - Watermarking with [A Watermark for Large Language Models](https://arxiv.org/abs/2301.10226). Defaults to False. - details (`bool`, *optional*): - Get generation details. Defaults to False. - decoder_input_details (`bool`, *optional*): - Get decoder input token logprobs and ids. Defaults to False. - """ - - # Activate logits sampling - do_sample: bool = False - # Maximum number of generated tokens - max_new_tokens: int = 20 - # The parameter for repetition penalty. 1.0 means no penalty. - # See [this paper](https://arxiv.org/pdf/1909.05858.pdf) for more details. - repetition_penalty: Optional[float] = None - # Whether to prepend the prompt to the generated text - return_full_text: bool = False - # Stop generating tokens if a member of `stop_sequences` is generated - stop: List[str] = field(default_factory=lambda: []) - # Random sampling seed - seed: Optional[int] = None - # The value used to module the logits distribution. - temperature: Optional[float] = None - # The number of highest probability vocabulary tokens to keep for top-k-filtering. - top_k: Optional[int] = None - # If set to < 1, only the smallest set of most probable tokens with probabilities that add up to `top_p` or - # higher are kept for generation. - top_p: Optional[float] = None - # truncate inputs tokens to the given size - truncate: Optional[int] = None - # Typical Decoding mass - # See [Typical Decoding for Natural Language Generation](https://arxiv.org/abs/2202.00666) for more information - typical_p: Optional[float] = None - # Generate best_of sequences and return the one if the highest token logprobs - best_of: Optional[int] = None - # Watermarking with [A Watermark for Large Language Models](https://arxiv.org/abs/2301.10226) - watermark: bool = False - # Get generation details - details: bool = False - # Get decoder input token logprobs and ids - decoder_input_details: bool = False - - @validator("best_of") - def valid_best_of(cls, field_value, values): - if field_value is not None: - if field_value <= 0: - raise ValueError("`best_of` must be strictly positive") - if field_value > 1 and values["seed"] is not None: - raise ValueError("`seed` must not be set when `best_of` is > 1") - sampling = ( - values["do_sample"] - | (values["temperature"] is not None) - | (values["top_k"] is not None) - | (values["top_p"] is not None) - | (values["typical_p"] is not None) - ) - if field_value > 1 and not sampling: - raise ValueError("you must use sampling when `best_of` is > 1") - - return field_value - - @validator("repetition_penalty") - def valid_repetition_penalty(cls, v): - if v is not None and v <= 0: - raise ValueError("`repetition_penalty` must be strictly positive") - return v - - @validator("seed") - def valid_seed(cls, v): - if v is not None and v < 0: - raise ValueError("`seed` must be positive") - return v - - @validator("temperature") - def valid_temp(cls, v): - if v is not None and v <= 0: - raise ValueError("`temperature` must be strictly positive") - return v - - @validator("top_k") - def valid_top_k(cls, v): - if v is not None and v <= 0: - raise ValueError("`top_k` must be strictly positive") - return v - - @validator("top_p") - def valid_top_p(cls, v): - if v is not None and (v <= 0 or v >= 1.0): - raise ValueError("`top_p` must be > 0.0 and < 1.0") - return v - - @validator("truncate") - def valid_truncate(cls, v): - if v is not None and v <= 0: - raise ValueError("`truncate` must be strictly positive") - return v - - @validator("typical_p") - def valid_typical_p(cls, v): - if v is not None and (v <= 0 or v >= 1.0): - raise ValueError("`typical_p` must be > 0.0 and < 1.0") - return v - - -@dataclass -class TextGenerationRequest: - """ - Request object for text generation (only for internal use). - - Args: - inputs (`str`): - The prompt for text generation. - parameters (`Optional[TextGenerationParameters]`, *optional*): - Generation parameters. - stream (`bool`, *optional*): - Whether to stream output tokens. Defaults to False. - """ - - # Prompt - inputs: str - # Generation parameters - parameters: Optional[TextGenerationParameters] = None - # Whether to stream output tokens - stream: bool = False - - @validator("inputs") - def valid_input(cls, v): - if not v: - raise ValueError("`inputs` cannot be empty") - return v - - @validator("stream") - def valid_best_of_stream(cls, field_value, values): - parameters = values["parameters"] - if parameters is not None and parameters.best_of is not None and parameters.best_of > 1 and field_value: - raise ValueError("`best_of` != 1 is not supported when `stream` == True") - return field_value - - -# Decoder input tokens -@dataclass -class InputToken: - """ - Represents an input token. - - Args: - id (`int`): - Token ID from the model tokenizer. - text (`str`): - Token text. - logprob (`float` or `None`): - Log probability of the token. Optional since the logprob of the first token cannot be computed. - """ - - # Token ID from the model tokenizer - id: int - # Token text - text: str - # Logprob - # Optional since the logprob of the first token cannot be computed - logprob: Optional[float] = None - - -# Generated tokens -@dataclass -class Token: - """ - Represents a token. - - Args: - id (`int`): - Token ID from the model tokenizer. - text (`str`): - Token text. - logprob (`float`): - Log probability of the token. - special (`bool`): - Indicates whether the token is a special token. It can be used to ignore - tokens when concatenating. - """ - - # Token ID from the model tokenizer - id: int - # Token text - text: str - # Logprob - logprob: float - # Is the token a special token - # Can be used to ignore tokens when concatenating - special: bool - - -# Generation finish reason -class FinishReason(str, Enum): - # number of generated tokens == `max_new_tokens` - Length = "length" - # the model generated its end of sequence token - EndOfSequenceToken = "eos_token" - # the model generated a text included in `stop_sequences` - StopSequence = "stop_sequence" - - -# Additional sequences when using the `best_of` parameter -@dataclass -class BestOfSequence: - """ - Represents a best-of sequence generated during text generation. - - Args: - generated_text (`str`): - The generated text. - finish_reason (`FinishReason`): - The reason for the generation to finish, represented by a `FinishReason` value. - generated_tokens (`int`): - The number of generated tokens in the sequence. - seed (`Optional[int]`): - The sampling seed if sampling was activated. - prefill (`List[InputToken]`): - The decoder input tokens. Empty if `decoder_input_details` is False. Defaults to an empty list. - tokens (`List[Token]`): - The generated tokens. Defaults to an empty list. - """ - - # Generated text - generated_text: str - # Generation finish reason - finish_reason: FinishReason - # Number of generated tokens - generated_tokens: int - # Sampling seed if sampling was activated - seed: Optional[int] = None - # Decoder input tokens, empty if decoder_input_details is False - prefill: List[InputToken] = field(default_factory=lambda: []) - # Generated tokens - tokens: List[Token] = field(default_factory=lambda: []) - - -# `generate` details -@dataclass -class Details: - """ - Represents details of a text generation. - - Args: - finish_reason (`FinishReason`): - The reason for the generation to finish, represented by a `FinishReason` value. - generated_tokens (`int`): - The number of generated tokens. - seed (`Optional[int]`): - The sampling seed if sampling was activated. - prefill (`List[InputToken]`, *optional*): - The decoder input tokens. Empty if `decoder_input_details` is False. Defaults to an empty list. - tokens (`List[Token]`): - The generated tokens. Defaults to an empty list. - best_of_sequences (`Optional[List[BestOfSequence]]`): - Additional sequences when using the `best_of` parameter. - """ - - # Generation finish reason - finish_reason: FinishReason - # Number of generated tokens - generated_tokens: int - # Sampling seed if sampling was activated - seed: Optional[int] = None - # Decoder input tokens, empty if decoder_input_details is False - prefill: List[InputToken] = field(default_factory=lambda: []) - # Generated tokens - tokens: List[Token] = field(default_factory=lambda: []) - # Additional sequences when using the `best_of` parameter - best_of_sequences: Optional[List[BestOfSequence]] = None - - -# `generate` return value -@dataclass -class TextGenerationResponse: - """ - Represents a response for text generation. - - Only returned when `details=True`, otherwise a string is returned. - - Args: - generated_text (`str`): - The generated text. - details (`Optional[Details]`): - Generation details. Returned only if `details=True` is sent to the server. - """ - - # Generated text - generated_text: str - # Generation details - details: Optional[Details] = None - - -# `generate_stream` details -@dataclass -class StreamDetails: - """ - Represents details of a text generation stream. - - Args: - finish_reason (`FinishReason`): - The reason for the generation to finish, represented by a `FinishReason` value. - generated_tokens (`int`): - The number of generated tokens. - seed (`Optional[int]`): - The sampling seed if sampling was activated. - """ - - # Generation finish reason - finish_reason: FinishReason - # Number of generated tokens - generated_tokens: int - # Sampling seed if sampling was activated - seed: Optional[int] = None - - -# `generate_stream` return value -@dataclass -class TextGenerationStreamResponse: - """ - Represents a response for streaming text generation. - - Only returned when `details=True` and `stream=True`. - - Args: - token (`Token`): - The generated token. - generated_text (`Optional[str]`, *optional*): - The complete generated text. Only available when the generation is finished. - details (`Optional[StreamDetails]`, *optional*): - Generation details. Only available when the generation is finished. - """ - - # Generated token - token: Token - # Complete generated text - # Only available when the generation is finished - generated_text: Optional[str] = None - # Generation details - # Only available when the generation is finished - details: Optional[StreamDetails] = None - - -# TEXT GENERATION ERRORS -# ---------------------- -# Text-generation errors are parsed separately to handle as much as possible the errors returned by the text generation -# inference project (https://github.com/huggingface/text-generation-inference). -# ---------------------- - - -class TextGenerationError(HTTPError): - """Generic error raised if text-generation went wrong.""" - - -# Text Generation Inference Errors -class ValidationError(TextGenerationError): - """Server-side validation error.""" - - -class GenerationError(TextGenerationError): - pass - - -class OverloadedError(TextGenerationError): - pass - - -class IncompleteGenerationError(TextGenerationError): - pass - - -class UnknownError(TextGenerationError): - pass - - -def raise_text_generation_error(http_error: HTTPError) -> NoReturn: - """ - Try to parse text-generation-inference error message and raise HTTPError in any case. - - Args: - error (`HTTPError`): - The HTTPError that have been raised. - """ - # Try to parse a Text Generation Inference error - - try: - # Hacky way to retrieve payload in case of aiohttp error - payload = getattr(http_error, "response_error_payload", None) or http_error.response.json() - error = payload.get("error") - error_type = payload.get("error_type") - except Exception: # no payload - raise http_error - - # If error_type => more information than `hf_raise_for_status` - if error_type is not None: - exception = _parse_text_generation_error(error, error_type) - raise exception from http_error - - # Otherwise, fallback to default error - raise http_error - - -def _parse_text_generation_error(error: Optional[str], error_type: Optional[str]) -> TextGenerationError: - if error_type == "generation": - return GenerationError(error) # type: ignore - if error_type == "incomplete_generation": - return IncompleteGenerationError(error) # type: ignore - if error_type == "overloaded": - return OverloadedError(error) # type: ignore - if error_type == "validation": - return ValidationError(error) # type: ignore - return UnknownError(error) # type: ignore diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_types.py b/venv/lib/python3.8/site-packages/huggingface_hub/inference/_types.py deleted file mode 100644 index fb5537b9240cba26f04d5385a15cfa954c9d1d91..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/inference/_types.py +++ /dev/null @@ -1,183 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from typing import TYPE_CHECKING, List, TypedDict - - -if TYPE_CHECKING: - from PIL import Image - - -class ClassificationOutput(TypedDict): - """Dictionary containing the output of a [`~InferenceClient.audio_classification`] and [`~InferenceClient.image_classification`] task. - - Args: - label (`str`): - The label predicted by the model. - score (`float`): - The score of the label predicted by the model. - """ - - label: str - score: float - - -class ConversationalOutputConversation(TypedDict): - """Dictionary containing the "conversation" part of a [`~InferenceClient.conversational`] task. - - Args: - generated_responses (`List[str]`): - A list of the responses from the model. - past_user_inputs (`List[str]`): - A list of the inputs from the user. Must be the same length as `generated_responses`. - """ - - generated_responses: List[str] - past_user_inputs: List[str] - - -class ConversationalOutput(TypedDict): - """Dictionary containing the output of a [`~InferenceClient.conversational`] task. - - Args: - generated_text (`str`): - The last response from the model. - conversation (`ConversationalOutputConversation`): - The past conversation. - warnings (`List[str]`): - A list of warnings associated with the process. - """ - - conversation: ConversationalOutputConversation - generated_text: str - warnings: List[str] - - -class FillMaskOutput(TypedDict): - """Dictionary containing information about a [`~InferenceClient.fill_mask`] task. - - Args: - score (`float`): - The probability of the token. - token (`int`): - The id of the token. - token_str (`str`): - The string representation of the token. - sequence (`str`): - The actual sequence of tokens that ran against the model (may contain special tokens). - """ - - score: float - token: int - token_str: str - sequence: str - - -class ImageSegmentationOutput(TypedDict): - """Dictionary containing information about a [`~InferenceClient.image_segmentation`] task. In practice, image segmentation returns a - list of `ImageSegmentationOutput` with 1 item per mask. - - Args: - label (`str`): - The label corresponding to the mask. - mask (`Image`): - An Image object representing the mask predicted by the model. - score (`float`): - The score associated with the label for this mask. - """ - - label: str - mask: "Image" - score: float - - -class ObjectDetectionOutput(TypedDict): - """Dictionary containing information about a [`~InferenceClient.object_detection`] task. - - Args: - label (`str`): - The label corresponding to the detected object. - box (`dict`): - A dict response of bounding box coordinates of - the detected object: xmin, ymin, xmax, ymax - score (`float`): - The score corresponding to the detected object. - """ - - label: str - box: dict - score: float - - -class QuestionAnsweringOutput(TypedDict): - """Dictionary containing information about a [`~InferenceClient.question_answering`] task. - - Args: - score (`float`): - A float that represents how likely that the answer is correct. - start (`int`): - The index (string wise) of the start of the answer within context. - end (`int`): - The index (string wise) of the end of the answer within context. - answer (`str`): - A string that is the answer within the text. - """ - - score: float - start: int - end: int - answer: str - - -class TableQuestionAnsweringOutput(TypedDict): - """Dictionary containing information about a [`~InferenceClient.table_question_answering`] task. - - Args: - answer (`str`): - The plaintext answer. - coordinates (`List[List[int]]`): - A list of coordinates of the cells referenced in the answer. - cells (`List[int]`): - A list of coordinates of the cells contents. - aggregator (`str`): - The aggregator used to get the answer. - """ - - answer: str - coordinates: List[List[int]] - cells: List[List[int]] - aggregator: str - - -class TokenClassificationOutput(TypedDict): - """Dictionary containing the output of a [`~InferenceClient.token_classification`] task. - - Args: - entity_group (`str`): - The type for the entity being recognized (model specific). - score (`float`): - The score of the label predicted by the model. - word (`str`): - The string that was captured. - start (`int`): - The offset stringwise where the answer is located. Useful to disambiguate if word occurs multiple times. - end (`int`): - The offset stringwise where the answer is located. Useful to disambiguate if word occurs multiple times. - """ - - entity_group: str - score: float - word: str - start: int - end: int diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/inference_api.py b/venv/lib/python3.8/site-packages/huggingface_hub/inference_api.py deleted file mode 100644 index 1dd3b36924f1182b28eb0be5b64111e66293cbaf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/inference_api.py +++ /dev/null @@ -1,217 +0,0 @@ -import io -from typing import Any, Dict, List, Optional, Union - -from .constants import INFERENCE_ENDPOINT -from .hf_api import HfApi -from .utils import build_hf_headers, get_session, is_pillow_available, logging, validate_hf_hub_args -from .utils._deprecation import _deprecate_method - - -logger = logging.get_logger(__name__) - - -ALL_TASKS = [ - # NLP - "text-classification", - "token-classification", - "table-question-answering", - "question-answering", - "zero-shot-classification", - "translation", - "summarization", - "conversational", - "feature-extraction", - "text-generation", - "text2text-generation", - "fill-mask", - "sentence-similarity", - # Audio - "text-to-speech", - "automatic-speech-recognition", - "audio-to-audio", - "audio-classification", - "voice-activity-detection", - # Computer vision - "image-classification", - "object-detection", - "image-segmentation", - "text-to-image", - "image-to-image", - # Others - "tabular-classification", - "tabular-regression", -] - - -class InferenceApi: - """Client to configure requests and make calls to the HuggingFace Inference API. - - Example: - - ```python - >>> from huggingface_hub.inference_api import InferenceApi - - >>> # Mask-fill example - >>> inference = InferenceApi("bert-base-uncased") - >>> inference(inputs="The goal of life is [MASK].") - [{'sequence': 'the goal of life is life.', 'score': 0.10933292657136917, 'token': 2166, 'token_str': 'life'}] - - >>> # Question Answering example - >>> inference = InferenceApi("deepset/roberta-base-squad2") - >>> inputs = { - ... "question": "What's my name?", - ... "context": "My name is Clara and I live in Berkeley.", - ... } - >>> inference(inputs) - {'score': 0.9326569437980652, 'start': 11, 'end': 16, 'answer': 'Clara'} - - >>> # Zero-shot example - >>> inference = InferenceApi("typeform/distilbert-base-uncased-mnli") - >>> inputs = "Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!" - >>> params = {"candidate_labels": ["refund", "legal", "faq"]} - >>> inference(inputs, params) - {'sequence': 'Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!', 'labels': ['refund', 'faq', 'legal'], 'scores': [0.9378499388694763, 0.04914155602455139, 0.013008488342165947]} - - >>> # Overriding configured task - >>> inference = InferenceApi("bert-base-uncased", task="feature-extraction") - - >>> # Text-to-image - >>> inference = InferenceApi("stabilityai/stable-diffusion-2-1") - >>> inference("cat") - - - >>> # Return as raw response to parse the output yourself - >>> inference = InferenceApi("mio/amadeus") - >>> response = inference("hello world", raw_response=True) - >>> response.headers - {"Content-Type": "audio/flac", ...} - >>> response.content # raw bytes from server - b'(...)' - ``` - """ - - @validate_hf_hub_args - @_deprecate_method( - version="0.19.0", - message=( - "`InferenceApi` client is deprecated in favor of the more feature-complete `InferenceClient`. Check out" - " this guide to learn how to convert your script to use it:" - " https://huggingface.co/docs/huggingface_hub/guides/inference#legacy-inferenceapi-client." - ), - ) - def __init__( - self, - repo_id: str, - task: Optional[str] = None, - token: Optional[str] = None, - gpu: bool = False, - ): - """Inits headers and API call information. - - Args: - repo_id (``str``): - Id of repository (e.g. `user/bert-base-uncased`). - task (``str``, `optional`, defaults ``None``): - Whether to force a task instead of using task specified in the - repository. - token (`str`, `optional`): - The API token to use as HTTP bearer authorization. This is not - the authentication token. You can find the token in - https://huggingface.co/settings/token. Alternatively, you can - find both your organizations and personal API tokens using - `HfApi().whoami(token)`. - gpu (`bool`, `optional`, defaults `False`): - Whether to use GPU instead of CPU for inference(requires Startup - plan at least). - """ - self.options = {"wait_for_model": True, "use_gpu": gpu} - self.headers = build_hf_headers(token=token) - - # Configure task - model_info = HfApi(token=token).model_info(repo_id=repo_id) - if not model_info.pipeline_tag and not task: - raise ValueError( - "Task not specified in the repository. Please add it to the model card" - " using pipeline_tag" - " (https://huggingface.co/docs#how-is-a-models-type-of-inference-api-and-widget-determined)" - ) - - if task and task != model_info.pipeline_tag: - if task not in ALL_TASKS: - raise ValueError(f"Invalid task {task}. Make sure it's valid.") - - logger.warning( - "You're using a different task than the one specified in the" - " repository. Be sure to know what you're doing :)" - ) - self.task = task - else: - assert model_info.pipeline_tag is not None, "Pipeline tag cannot be None" - self.task = model_info.pipeline_tag - - self.api_url = f"{INFERENCE_ENDPOINT}/pipeline/{self.task}/{repo_id}" - - def __repr__(self): - # Do not add headers to repr to avoid leaking token. - return f"InferenceAPI(api_url='{self.api_url}', task='{self.task}', options={self.options})" - - def __call__( - self, - inputs: Optional[Union[str, Dict, List[str], List[List[str]]]] = None, - params: Optional[Dict] = None, - data: Optional[bytes] = None, - raw_response: bool = False, - ) -> Any: - """Make a call to the Inference API. - - Args: - inputs (`str` or `Dict` or `List[str]` or `List[List[str]]`, *optional*): - Inputs for the prediction. - params (`Dict`, *optional*): - Additional parameters for the models. Will be sent as `parameters` in the - payload. - data (`bytes`, *optional*): - Bytes content of the request. In this case, leave `inputs` and `params` empty. - raw_response (`bool`, defaults to `False`): - If `True`, the raw `Response` object is returned. You can parse its content - as preferred. By default, the content is parsed into a more practical format - (json dictionary or PIL Image for example). - """ - # Build payload - payload: Dict[str, Any] = { - "options": self.options, - } - if inputs: - payload["inputs"] = inputs - if params: - payload["parameters"] = params - - # Make API call - response = get_session().post(self.api_url, headers=self.headers, json=payload, data=data) - - # Let the user handle the response - if raw_response: - return response - - # By default, parse the response for the user. - content_type = response.headers.get("Content-Type") or "" - if content_type.startswith("image"): - if not is_pillow_available(): - raise ImportError( - f"Task '{self.task}' returned as image but Pillow is not installed." - " Please install it (`pip install Pillow`) or pass" - " `raw_response=True` to get the raw `Response` object and parse" - " the image by yourself." - ) - - from PIL import Image - - return Image.open(io.BytesIO(response.content)) - elif content_type == "application/json": - return response.json() - else: - raise NotImplementedError( - f"{content_type} output type is not implemented yet. You can pass" - " `raw_response=True` to get the raw `Response` object and parse the" - " output by yourself." - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/keras_mixin.py b/venv/lib/python3.8/site-packages/huggingface_hub/keras_mixin.py deleted file mode 100644 index 32ea4091e0c3f19abc09d81456e9df9d52454da2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/keras_mixin.py +++ /dev/null @@ -1,481 +0,0 @@ -import collections.abc as collections -import json -import os -import warnings -from pathlib import Path -from shutil import copytree -from typing import Any, Dict, List, Optional, Union - -from huggingface_hub import ModelHubMixin, snapshot_download -from huggingface_hub.utils import ( - get_tf_version, - is_graphviz_available, - is_pydot_available, - is_tf_available, - yaml_dump, -) - -from .constants import CONFIG_NAME -from .hf_api import HfApi -from .utils import SoftTemporaryDirectory, logging, validate_hf_hub_args - - -logger = logging.get_logger(__name__) - -if is_tf_available(): - import tensorflow as tf # type: ignore - - -def _flatten_dict(dictionary, parent_key=""): - """Flatten a nested dictionary. - Reference: https://stackoverflow.com/a/6027615/10319735 - - Args: - dictionary (`dict`): - The nested dictionary to be flattened. - parent_key (`str`): - The parent key to be prefixed to the children keys. - Necessary for recursing over the nested dictionary. - - Returns: - The flattened dictionary. - """ - items = [] - for key, value in dictionary.items(): - new_key = f"{parent_key}.{key}" if parent_key else key - if isinstance(value, collections.MutableMapping): - items.extend( - _flatten_dict( - value, - new_key, - ).items() - ) - else: - items.append((new_key, value)) - return dict(items) - - -def _create_hyperparameter_table(model): - """Parse hyperparameter dictionary into a markdown table.""" - if model.optimizer is not None: - optimizer_params = model.optimizer.get_config() - # flatten the configuration - optimizer_params = _flatten_dict(optimizer_params) - optimizer_params["training_precision"] = tf.keras.mixed_precision.global_policy().name - table = "| Hyperparameters | Value |\n| :-- | :-- |\n" - for key, value in optimizer_params.items(): - table += f"| {key} | {value} |\n" - else: - table = None - return table - - -def _plot_network(model, save_directory): - tf.keras.utils.plot_model( - model, - to_file=f"{save_directory}/model.png", - show_shapes=False, - show_dtype=False, - show_layer_names=True, - rankdir="TB", - expand_nested=False, - dpi=96, - layer_range=None, - ) - - -def _create_model_card( - model, - repo_dir: Path, - plot_model: bool = True, - metadata: Optional[dict] = None, -): - """ - Creates a model card for the repository. - """ - hyperparameters = _create_hyperparameter_table(model) - if plot_model and is_graphviz_available() and is_pydot_available(): - _plot_network(model, repo_dir) - if metadata is None: - metadata = {} - readme_path = f"{repo_dir}/README.md" - metadata["library_name"] = "keras" - model_card: str = "---\n" - model_card += yaml_dump(metadata, default_flow_style=False) - model_card += "---\n" - model_card += "\n## Model description\n\nMore information needed\n" - model_card += "\n## Intended uses & limitations\n\nMore information needed\n" - model_card += "\n## Training and evaluation data\n\nMore information needed\n" - if hyperparameters is not None: - model_card += "\n## Training procedure\n" - model_card += "\n### Training hyperparameters\n" - model_card += "\nThe following hyperparameters were used during training:\n\n" - model_card += hyperparameters - model_card += "\n" - if plot_model and os.path.exists(f"{repo_dir}/model.png"): - model_card += "\n ## Model Plot\n" - model_card += "\n
" - model_card += "\nView Model Plot\n" - path_to_plot = "./model.png" - model_card += f"\n![Model Image]({path_to_plot})\n" - model_card += "\n
" - - if os.path.exists(readme_path): - with open(readme_path, "r", encoding="utf8") as f: - readme = f.read() - else: - readme = model_card - with open(readme_path, "w", encoding="utf-8") as f: - f.write(readme) - - -def save_pretrained_keras( - model, - save_directory: Union[str, Path], - config: Optional[Dict[str, Any]] = None, - include_optimizer: bool = False, - plot_model: bool = True, - tags: Optional[Union[list, str]] = None, - **model_save_kwargs, -): - """ - Saves a Keras model to save_directory in SavedModel format. Use this if - you're using the Functional or Sequential APIs. - - Args: - model (`Keras.Model`): - The [Keras - model](https://www.tensorflow.org/api_docs/python/tf/keras/Model) - you'd like to save. The model must be compiled and built. - save_directory (`str` or `Path`): - Specify directory in which you want to save the Keras model. - config (`dict`, *optional*): - Configuration object to be saved alongside the model weights. - include_optimizer(`bool`, *optional*, defaults to `False`): - Whether or not to include optimizer in serialization. - plot_model (`bool`, *optional*, defaults to `True`): - Setting this to `True` will plot the model and put it in the model - card. Requires graphviz and pydot to be installed. - tags (Union[`str`,`list`], *optional*): - List of tags that are related to model or string of a single tag. See example tags - [here](https://github.com/huggingface/hub-docs/blame/main/modelcard.md). - model_save_kwargs(`dict`, *optional*): - model_save_kwargs will be passed to - [`tf.keras.models.save_model()`](https://www.tensorflow.org/api_docs/python/tf/keras/models/save_model). - """ - if is_tf_available(): - import tensorflow as tf - else: - raise ImportError("Called a Tensorflow-specific function but could not import it.") - - if not model.built: - raise ValueError("Model should be built before trying to save") - - save_directory = Path(save_directory) - save_directory.mkdir(parents=True, exist_ok=True) - - # saving config - if config: - if not isinstance(config, dict): - raise RuntimeError(f"Provided config to save_pretrained_keras should be a dict. Got: '{type(config)}'") - - with (save_directory / CONFIG_NAME).open("w") as f: - json.dump(config, f) - - metadata = {} - if isinstance(tags, list): - metadata["tags"] = tags - elif isinstance(tags, str): - metadata["tags"] = [tags] - - task_name = model_save_kwargs.pop("task_name", None) - if task_name is not None: - warnings.warn( - "`task_name` input argument is deprecated. Pass `tags` instead.", - FutureWarning, - ) - if "tags" in metadata: - metadata["tags"].append(task_name) - else: - metadata["tags"] = [task_name] - - if model.history is not None: - if model.history.history != {}: - path = save_directory / "history.json" - if path.exists(): - warnings.warn( - "`history.json` file already exists, it will be overwritten by the history of this version.", - UserWarning, - ) - with path.open("w", encoding="utf-8") as f: - json.dump(model.history.history, f, indent=2, sort_keys=True) - - _create_model_card(model, save_directory, plot_model, metadata) - tf.keras.models.save_model(model, save_directory, include_optimizer=include_optimizer, **model_save_kwargs) - - -def from_pretrained_keras(*args, **kwargs) -> "KerasModelHubMixin": - r""" - Instantiate a pretrained Keras model from a pre-trained model from the Hub. - The model is expected to be in `SavedModel` format. - - Args: - pretrained_model_name_or_path (`str` or `os.PathLike`): - Can be either: - - A string, the `model id` of a pretrained model hosted inside a - model repo on huggingface.co. Valid model ids can be located - at the root-level, like `bert-base-uncased`, or namespaced - under a user or organization name, like - `dbmdz/bert-base-german-cased`. - - You can add `revision` by appending `@` at the end of model_id - simply like this: `dbmdz/bert-base-german-cased@main` Revision - is the specific model version to use. It can be a branch name, - a tag name, or a commit id, since we use a git-based system - for storing models and other artifacts on huggingface.co, so - `revision` can be any identifier allowed by git. - - A path to a `directory` containing model weights saved using - [`~transformers.PreTrainedModel.save_pretrained`], e.g., - `./my_model_directory/`. - - `None` if you are both providing the configuration and state - dictionary (resp. with keyword arguments `config` and - `state_dict`). - force_download (`bool`, *optional*, defaults to `False`): - Whether to force the (re-)download of the model weights and - configuration files, overriding the cached versions if they exist. - resume_download (`bool`, *optional*, defaults to `False`): - Whether to delete incompletely received files. Will attempt to - resume the download if such a file exists. - proxies (`Dict[str, str]`, *optional*): - A dictionary of proxy servers to use by protocol or endpoint, e.g., - `{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}`. The - proxies are used on each request. - token (`str` or `bool`, *optional*): - The token to use as HTTP bearer authorization for remote files. If - `True`, will use the token generated when running `transformers-cli - login` (stored in `~/.huggingface`). - cache_dir (`Union[str, os.PathLike]`, *optional*): - Path to a directory in which a downloaded pretrained model - configuration should be cached if the standard cache should not be - used. - local_files_only(`bool`, *optional*, defaults to `False`): - Whether to only look at local files (i.e., do not try to download - the model). - model_kwargs (`Dict`, *optional*): - model_kwargs will be passed to the model during initialization - - - - Passing `token=True` is required when you want to use a private - model. - - - """ - return KerasModelHubMixin.from_pretrained(*args, **kwargs) - - -@validate_hf_hub_args -def push_to_hub_keras( - model, - repo_id: str, - *, - config: Optional[dict] = None, - commit_message: str = "Push Keras model using huggingface_hub.", - private: bool = False, - api_endpoint: Optional[str] = None, - token: Optional[str] = None, - branch: Optional[str] = None, - create_pr: Optional[bool] = None, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - delete_patterns: Optional[Union[List[str], str]] = None, - log_dir: Optional[str] = None, - include_optimizer: bool = False, - tags: Optional[Union[list, str]] = None, - plot_model: bool = True, - **model_save_kwargs, -): - """ - Upload model checkpoint to the Hub. - - Use `allow_patterns` and `ignore_patterns` to precisely filter which files should be pushed to the hub. Use - `delete_patterns` to delete existing remote files in the same commit. See [`upload_folder`] reference for more - details. - - Args: - model (`Keras.Model`): - The [Keras model](`https://www.tensorflow.org/api_docs/python/tf/keras/Model`) you'd like to push to the - Hub. The model must be compiled and built. - repo_id (`str`): - ID of the repository to push to (example: `"username/my-model"`). - commit_message (`str`, *optional*, defaults to "Add Keras model"): - Message to commit while pushing. - private (`bool`, *optional*, defaults to `False`): - Whether the repository created should be private. - api_endpoint (`str`, *optional*): - The API endpoint to use when pushing the model to the hub. - token (`str`, *optional*): - The token to use as HTTP bearer authorization for remote files. If - not set, will use the token set when logging in with - `huggingface-cli login` (stored in `~/.huggingface`). - branch (`str`, *optional*): - The git branch on which to push the model. This defaults to - the default branch as specified in your repository, which - defaults to `"main"`. - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request from `branch` with that commit. - Defaults to `False`. - config (`dict`, *optional*): - Configuration object to be saved alongside the model weights. - allow_patterns (`List[str]` or `str`, *optional*): - If provided, only files matching at least one pattern are pushed. - ignore_patterns (`List[str]` or `str`, *optional*): - If provided, files matching any of the patterns are not pushed. - delete_patterns (`List[str]` or `str`, *optional*): - If provided, remote files matching any of the patterns will be deleted from the repo. - log_dir (`str`, *optional*): - TensorBoard logging directory to be pushed. The Hub automatically - hosts and displays a TensorBoard instance if log files are included - in the repository. - include_optimizer (`bool`, *optional*, defaults to `False`): - Whether or not to include optimizer during serialization. - tags (Union[`list`, `str`], *optional*): - List of tags that are related to model or string of a single tag. See example tags - [here](https://github.com/huggingface/hub-docs/blame/main/modelcard.md). - plot_model (`bool`, *optional*, defaults to `True`): - Setting this to `True` will plot the model and put it in the model - card. Requires graphviz and pydot to be installed. - model_save_kwargs(`dict`, *optional*): - model_save_kwargs will be passed to - [`tf.keras.models.save_model()`](https://www.tensorflow.org/api_docs/python/tf/keras/models/save_model). - - Returns: - The url of the commit of your model in the given repository. - """ - api = HfApi(endpoint=api_endpoint) - repo_id = api.create_repo(repo_id=repo_id, token=token, private=private, exist_ok=True).repo_id - - # Push the files to the repo in a single commit - with SoftTemporaryDirectory() as tmp: - saved_path = Path(tmp) / repo_id - save_pretrained_keras( - model, - saved_path, - config=config, - include_optimizer=include_optimizer, - tags=tags, - plot_model=plot_model, - **model_save_kwargs, - ) - - # If `log_dir` provided, delete remote logs and upload new ones - if log_dir is not None: - delete_patterns = ( - [] - if delete_patterns is None - else ( - [delete_patterns] # convert `delete_patterns` to a list - if isinstance(delete_patterns, str) - else delete_patterns - ) - ) - delete_patterns.append("logs/*") - copytree(log_dir, saved_path / "logs") - - return api.upload_folder( - repo_type="model", - repo_id=repo_id, - folder_path=saved_path, - commit_message=commit_message, - token=token, - revision=branch, - create_pr=create_pr, - allow_patterns=allow_patterns, - ignore_patterns=ignore_patterns, - delete_patterns=delete_patterns, - ) - - -class KerasModelHubMixin(ModelHubMixin): - """ - Implementation of [`ModelHubMixin`] to provide model Hub upload/download - capabilities to Keras models. - - - ```python - >>> import tensorflow as tf - >>> from huggingface_hub import KerasModelHubMixin - - - >>> class MyModel(tf.keras.Model, KerasModelHubMixin): - ... def __init__(self, **kwargs): - ... super().__init__() - ... self.config = kwargs.pop("config", None) - ... self.dummy_inputs = ... - ... self.layer = ... - - ... def call(self, *args): - ... return ... - - - >>> # Initialize and compile the model as you normally would - >>> model = MyModel() - >>> model.compile(...) - >>> # Build the graph by training it or passing dummy inputs - >>> _ = model(model.dummy_inputs) - >>> # Save model weights to local directory - >>> model.save_pretrained("my-awesome-model") - >>> # Push model weights to the Hub - >>> model.push_to_hub("my-awesome-model") - >>> # Download and initialize weights from the Hub - >>> model = MyModel.from_pretrained("username/super-cool-model") - ``` - """ - - def _save_pretrained(self, save_directory): - save_pretrained_keras(self, save_directory) - - @classmethod - def _from_pretrained( - cls, - model_id, - revision, - cache_dir, - force_download, - proxies, - resume_download, - local_files_only, - token, - **model_kwargs, - ): - """Here we just call [`from_pretrained_keras`] function so both the mixin and - functional APIs stay in sync. - - TODO - Some args above aren't used since we are calling - snapshot_download instead of hf_hub_download. - """ - if is_tf_available(): - import tensorflow as tf - else: - raise ImportError("Called a TensorFlow-specific function but could not import it.") - - # TODO - Figure out what to do about these config values. Config is not going to be needed to load model - cfg = model_kwargs.pop("config", None) - - # Root is either a local filepath matching model_id or a cached snapshot - if not os.path.isdir(model_id): - storage_folder = snapshot_download( - repo_id=model_id, - revision=revision, - cache_dir=cache_dir, - library_name="keras", - library_version=get_tf_version(), - ) - else: - storage_folder = model_id - - model = tf.keras.models.load_model(storage_folder, **model_kwargs) - - # For now, we add a new attribute, config, to store the config loaded from the hub/a local dir. - model.config = cfg - - return model diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/lfs.py b/venv/lib/python3.8/site-packages/huggingface_hub/lfs.py deleted file mode 100644 index c3c890044d470a80e255e7fd80cedf21b2eb2522..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/lfs.py +++ /dev/null @@ -1,495 +0,0 @@ -# coding=utf-8 -# Copyright 2019-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Git LFS related type definitions and utilities""" -import io -import os -import re -import warnings -from contextlib import AbstractContextManager -from dataclasses import dataclass -from math import ceil -from os.path import getsize -from pathlib import Path -from typing import TYPE_CHECKING, BinaryIO, Dict, Iterable, List, Optional, Tuple, TypedDict - -from requests.auth import HTTPBasicAuth - -from huggingface_hub.constants import ENDPOINT, HF_HUB_ENABLE_HF_TRANSFER, REPO_TYPES_URL_PREFIXES -from huggingface_hub.utils import get_session - -from .utils import get_token_to_send, hf_raise_for_status, http_backoff, logging, validate_hf_hub_args -from .utils.sha import sha256, sha_fileobj - - -if TYPE_CHECKING: - from ._commit_api import CommitOperationAdd - -logger = logging.get_logger(__name__) - -OID_REGEX = re.compile(r"^[0-9a-f]{40}$") - -LFS_MULTIPART_UPLOAD_COMMAND = "lfs-multipart-upload" - -LFS_HEADERS = { - "Accept": "application/vnd.git-lfs+json", - "Content-Type": "application/vnd.git-lfs+json", -} - - -@dataclass -class UploadInfo: - """ - Dataclass holding required information to determine whether a blob - should be uploaded to the hub using the LFS protocol or the regular protocol - - Args: - sha256 (`bytes`): - SHA256 hash of the blob - size (`int`): - Size in bytes of the blob - sample (`bytes`): - First 512 bytes of the blob - """ - - sha256: bytes - size: int - sample: bytes - - @classmethod - def from_path(cls, path: str): - size = getsize(path) - with io.open(path, "rb") as file: - sample = file.peek(512)[:512] - sha = sha_fileobj(file) - return cls(size=size, sha256=sha, sample=sample) - - @classmethod - def from_bytes(cls, data: bytes): - sha = sha256(data).digest() - return cls(size=len(data), sample=data[:512], sha256=sha) - - @classmethod - def from_fileobj(cls, fileobj: BinaryIO): - sample = fileobj.read(512) - fileobj.seek(0, io.SEEK_SET) - sha = sha_fileobj(fileobj) - size = fileobj.tell() - fileobj.seek(0, io.SEEK_SET) - return cls(size=size, sha256=sha, sample=sample) - - -@validate_hf_hub_args -def post_lfs_batch_info( - upload_infos: Iterable[UploadInfo], - token: Optional[str], - repo_type: str, - repo_id: str, - endpoint: Optional[str] = None, -) -> Tuple[List[dict], List[dict]]: - """ - Requests the LFS batch endpoint to retrieve upload instructions - - Learn more: https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md - - Args: - upload_infos (`Iterable` of `UploadInfo`): - `UploadInfo` for the files that are being uploaded, typically obtained - from `CommitOperationAdd.upload_info` - repo_type (`str`): - Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`. - repo_id (`str`): - A namespace (user or an organization) and a repo name separated - by a `/`. - token (`str`, *optional*): - An authentication token ( See https://huggingface.co/settings/tokens ) - - Returns: - `LfsBatchInfo`: 2-tuple: - - First element is the list of upload instructions from the server - - Second element is an list of errors, if any - - Raises: - `ValueError`: If an argument is invalid or the server response is malformed - - `HTTPError`: If the server returned an error - """ - endpoint = endpoint if endpoint is not None else ENDPOINT - url_prefix = "" - if repo_type in REPO_TYPES_URL_PREFIXES: - url_prefix = REPO_TYPES_URL_PREFIXES[repo_type] - batch_url = f"{endpoint}/{url_prefix}{repo_id}.git/info/lfs/objects/batch" - resp = get_session().post( - batch_url, - headers=LFS_HEADERS, - json={ - "operation": "upload", - "transfers": ["basic", "multipart"], - "objects": [ - { - "oid": upload.sha256.hex(), - "size": upload.size, - } - for upload in upload_infos - ], - "hash_algo": "sha256", - }, - auth=HTTPBasicAuth( - "access_token", - get_token_to_send(token or True), # type: ignore # Token must be provided or retrieved - ), - ) - hf_raise_for_status(resp) - batch_info = resp.json() - - objects = batch_info.get("objects", None) - if not isinstance(objects, list): - raise ValueError("Malformed response from server") - - return ( - [_validate_batch_actions(obj) for obj in objects if "error" not in obj], - [_validate_batch_error(obj) for obj in objects if "error" in obj], - ) - - -class PayloadPartT(TypedDict): - partNumber: int - etag: str - - -class CompletionPayloadT(TypedDict): - """Payload that will be sent to the Hub when uploading multi-part.""" - - oid: str - parts: List[PayloadPartT] - - -def lfs_upload(operation: "CommitOperationAdd", lfs_batch_action: Dict, token: Optional[str]) -> None: - """ - Handles uploading a given object to the Hub with the LFS protocol. - - Can be a No-op if the content of the file is already present on the hub large file storage. - - Args: - operation (`CommitOperationAdd`): - The add operation triggering this upload. - lfs_batch_action (`dict`): - Upload instructions from the LFS batch endpoint for this object. See [`~utils.lfs.post_lfs_batch_info`] for - more details. - token (`str`, *optional*): - A [user access token](https://hf.co/settings/tokens) to authenticate requests against the Hub - - Raises: - - `ValueError` if `lfs_batch_action` is improperly formatted - - `HTTPError` if the upload resulted in an error - """ - # 0. If LFS file is already present, skip upload - _validate_batch_actions(lfs_batch_action) - actions = lfs_batch_action.get("actions") - if actions is None: - # The file was already uploaded - logger.debug(f"Content of file {operation.path_in_repo} is already present upstream - skipping upload") - return - - # 1. Validate server response (check required keys in dict) - upload_action = lfs_batch_action["actions"]["upload"] - _validate_lfs_action(upload_action) - verify_action = lfs_batch_action["actions"].get("verify") - if verify_action is not None: - _validate_lfs_action(verify_action) - - # 2. Upload file (either single part or multi-part) - header = upload_action.get("header", {}) - chunk_size = header.get("chunk_size") - if chunk_size is not None: - try: - chunk_size = int(chunk_size) - except (ValueError, TypeError): - raise ValueError( - f"Malformed response from LFS batch endpoint: `chunk_size` should be an integer. Got '{chunk_size}'." - ) - _upload_multi_part(operation=operation, header=header, chunk_size=chunk_size, upload_url=upload_action["href"]) - else: - _upload_single_part(operation=operation, upload_url=upload_action["href"]) - - # 3. Verify upload went well - if verify_action is not None: - _validate_lfs_action(verify_action) - verify_resp = get_session().post( - verify_action["href"], - auth=HTTPBasicAuth(username="USER", password=get_token_to_send(token or True)), # type: ignore - json={"oid": operation.upload_info.sha256.hex(), "size": operation.upload_info.size}, - ) - hf_raise_for_status(verify_resp) - logger.debug(f"{operation.path_in_repo}: Upload successful") - - -def _validate_lfs_action(lfs_action: dict): - """validates response from the LFS batch endpoint""" - if not ( - isinstance(lfs_action.get("href"), str) - and (lfs_action.get("header") is None or isinstance(lfs_action.get("header"), dict)) - ): - raise ValueError("lfs_action is improperly formatted") - return lfs_action - - -def _validate_batch_actions(lfs_batch_actions: dict): - """validates response from the LFS batch endpoint""" - if not (isinstance(lfs_batch_actions.get("oid"), str) and isinstance(lfs_batch_actions.get("size"), int)): - raise ValueError("lfs_batch_actions is improperly formatted") - - upload_action = lfs_batch_actions.get("actions", {}).get("upload") - verify_action = lfs_batch_actions.get("actions", {}).get("verify") - if upload_action is not None: - _validate_lfs_action(upload_action) - if verify_action is not None: - _validate_lfs_action(verify_action) - return lfs_batch_actions - - -def _validate_batch_error(lfs_batch_error: dict): - """validates response from the LFS batch endpoint""" - if not (isinstance(lfs_batch_error.get("oid"), str) and isinstance(lfs_batch_error.get("size"), int)): - raise ValueError("lfs_batch_error is improperly formatted") - error_info = lfs_batch_error.get("error") - if not ( - isinstance(error_info, dict) - and isinstance(error_info.get("message"), str) - and isinstance(error_info.get("code"), int) - ): - raise ValueError("lfs_batch_error is improperly formatted") - return lfs_batch_error - - -def _upload_single_part(operation: "CommitOperationAdd", upload_url: str) -> None: - """ - Uploads `fileobj` as a single PUT HTTP request (basic LFS transfer protocol) - - Args: - upload_url (`str`): - The URL to PUT the file to. - fileobj: - The file-like object holding the data to upload. - - Returns: `requests.Response` - - Raises: `requests.HTTPError` if the upload resulted in an error - """ - with operation.as_file(with_tqdm=True) as fileobj: - response = http_backoff("PUT", upload_url, data=fileobj) - hf_raise_for_status(response) - - -def _upload_multi_part(operation: "CommitOperationAdd", header: Dict, chunk_size: int, upload_url: str) -> None: - """ - Uploads file using HF multipart LFS transfer protocol. - """ - # 1. Get upload URLs for each part - sorted_parts_urls = _get_sorted_parts_urls(header=header, upload_info=operation.upload_info, chunk_size=chunk_size) - - # 2. Upload parts (either with hf_transfer or in pure Python) - use_hf_transfer = HF_HUB_ENABLE_HF_TRANSFER - if ( - HF_HUB_ENABLE_HF_TRANSFER - and not isinstance(operation.path_or_fileobj, str) - and not isinstance(operation.path_or_fileobj, Path) - ): - warnings.warn( - "hf_transfer is enabled but does not support uploading from bytes or BinaryIO, falling back to regular" - " upload" - ) - use_hf_transfer = False - - response_headers = ( - _upload_parts_hf_transfer(operation=operation, sorted_parts_urls=sorted_parts_urls, chunk_size=chunk_size) - if use_hf_transfer - else _upload_parts_iteratively(operation=operation, sorted_parts_urls=sorted_parts_urls, chunk_size=chunk_size) - ) - - # 3. Send completion request - completion_res = get_session().post( - upload_url, - json=_get_completion_payload(response_headers, operation.upload_info.sha256.hex()), - headers=LFS_HEADERS, - ) - hf_raise_for_status(completion_res) - - -def _get_sorted_parts_urls(header: Dict, upload_info: UploadInfo, chunk_size: int) -> List[str]: - sorted_part_upload_urls = [ - upload_url - for _, upload_url in sorted( - [ - (int(part_num, 10), upload_url) - for part_num, upload_url in header.items() - if part_num.isdigit() and len(part_num) > 0 - ], - key=lambda t: t[0], - ) - ] - num_parts = len(sorted_part_upload_urls) - if num_parts != ceil(upload_info.size / chunk_size): - raise ValueError("Invalid server response to upload large LFS file") - return sorted_part_upload_urls - - -def _get_completion_payload(response_headers: List[Dict], oid: str) -> CompletionPayloadT: - parts: List[PayloadPartT] = [] - for part_number, header in enumerate(response_headers): - etag = header.get("etag") - if etag is None or etag == "": - raise ValueError(f"Invalid etag (`{etag}`) returned for part {part_number + 1}") - parts.append( - { - "partNumber": part_number + 1, - "etag": etag, - } - ) - return {"oid": oid, "parts": parts} - - -def _upload_parts_iteratively( - operation: "CommitOperationAdd", sorted_parts_urls: List[str], chunk_size: int -) -> List[Dict]: - headers = [] - with operation.as_file(with_tqdm=True) as fileobj: - for part_idx, part_upload_url in enumerate(sorted_parts_urls): - with SliceFileObj( - fileobj, - seek_from=chunk_size * part_idx, - read_limit=chunk_size, - ) as fileobj_slice: - part_upload_res = http_backoff("PUT", part_upload_url, data=fileobj_slice) - hf_raise_for_status(part_upload_res) - headers.append(part_upload_res.headers) - return headers # type: ignore - - -def _upload_parts_hf_transfer( - operation: "CommitOperationAdd", sorted_parts_urls: List[str], chunk_size: int -) -> List[Dict]: - # Upload file using an external Rust-based package. Upload is faster but support less features (no progress bars). - try: - from hf_transfer import multipart_upload - except ImportError: - raise ValueError( - "Fast uploading using 'hf_transfer' is enabled (HF_HUB_ENABLE_HF_TRANSFER=1) but 'hf_transfer' package is" - " not available in your environment. Try `pip install hf_transfer`." - ) - - try: - return multipart_upload( - file_path=operation.path_or_fileobj, - parts_urls=sorted_parts_urls, - chunk_size=chunk_size, - max_files=128, - parallel_failures=127, # could be removed - max_retries=5, - ) - except Exception as e: - raise RuntimeError( - "An error occurred while uploading using `hf_transfer`. Consider disabling HF_HUB_ENABLE_HF_TRANSFER for" - " better error handling." - ) from e - - -class SliceFileObj(AbstractContextManager): - """ - Utility context manager to read a *slice* of a seekable file-like object as a seekable, file-like object. - - This is NOT thread safe - - Inspired by stackoverflow.com/a/29838711/593036 - - Credits to @julien-c - - Args: - fileobj (`BinaryIO`): - A file-like object to slice. MUST implement `tell()` and `seek()` (and `read()` of course). - `fileobj` will be reset to its original position when exiting the context manager. - seek_from (`int`): - The start of the slice (offset from position 0 in bytes). - read_limit (`int`): - The maximum number of bytes to read from the slice. - - Attributes: - previous_position (`int`): - The previous position - - Examples: - - Reading 200 bytes with an offset of 128 bytes from a file (ie bytes 128 to 327): - ```python - >>> with open("path/to/file", "rb") as file: - ... with SliceFileObj(file, seek_from=128, read_limit=200) as fslice: - ... fslice.read(...) - ``` - - Reading a file in chunks of 512 bytes - ```python - >>> import os - >>> chunk_size = 512 - >>> file_size = os.getsize("path/to/file") - >>> with open("path/to/file", "rb") as file: - ... for chunk_idx in range(ceil(file_size / chunk_size)): - ... with SliceFileObj(file, seek_from=chunk_idx * chunk_size, read_limit=chunk_size) as fslice: - ... chunk = fslice.read(...) - - ``` - """ - - def __init__(self, fileobj: BinaryIO, seek_from: int, read_limit: int): - self.fileobj = fileobj - self.seek_from = seek_from - self.read_limit = read_limit - - def __enter__(self): - self._previous_position = self.fileobj.tell() - end_of_stream = self.fileobj.seek(0, os.SEEK_END) - self._len = min(self.read_limit, end_of_stream - self.seek_from) - # ^^ The actual number of bytes that can be read from the slice - self.fileobj.seek(self.seek_from, io.SEEK_SET) - return self - - def __exit__(self, exc_type, exc_value, traceback): - self.fileobj.seek(self._previous_position, io.SEEK_SET) - - def read(self, n: int = -1): - pos = self.tell() - if pos >= self._len: - return b"" - remaining_amount = self._len - pos - data = self.fileobj.read(remaining_amount if n < 0 else min(n, remaining_amount)) - return data - - def tell(self) -> int: - return self.fileobj.tell() - self.seek_from - - def seek(self, offset: int, whence: int = os.SEEK_SET) -> int: - start = self.seek_from - end = start + self._len - if whence in (os.SEEK_SET, os.SEEK_END): - offset = start + offset if whence == os.SEEK_SET else end + offset - offset = max(start, min(offset, end)) - whence = os.SEEK_SET - elif whence == os.SEEK_CUR: - cur_pos = self.fileobj.tell() - offset = max(start - cur_pos, min(offset, end - cur_pos)) - else: - raise ValueError(f"whence value {whence} is not supported") - return self.fileobj.seek(offset, whence) - self.seek_from - - def __iter__(self): - yield self.read(n=4 * 1024 * 1024) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/repocard.py b/venv/lib/python3.8/site-packages/huggingface_hub/repocard.py deleted file mode 100644 index f07366006953dea2fca67ef360d2524ec04be653..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/repocard.py +++ /dev/null @@ -1,820 +0,0 @@ -import os -import re -from pathlib import Path -from typing import Any, Dict, Literal, Optional, Type, Union - -import requests -import yaml - -from huggingface_hub.file_download import hf_hub_download -from huggingface_hub.hf_api import upload_file -from huggingface_hub.repocard_data import ( - CardData, - DatasetCardData, - EvalResult, - ModelCardData, - SpaceCardData, - eval_results_to_model_index, - model_index_to_eval_results, -) -from huggingface_hub.utils import get_session, is_jinja_available, yaml_dump - -from .constants import REPOCARD_NAME -from .utils import EntryNotFoundError, SoftTemporaryDirectory, validate_hf_hub_args -from .utils.logging import get_logger - - -TEMPLATE_MODELCARD_PATH = Path(__file__).parent / "templates" / "modelcard_template.md" -TEMPLATE_DATASETCARD_PATH = Path(__file__).parent / "templates" / "datasetcard_template.md" - -# exact same regex as in the Hub server. Please keep in sync. -# See https://github.com/huggingface/moon-landing/blob/main/server/lib/ViewMarkdown.ts#L18 -REGEX_YAML_BLOCK = re.compile(r"^(\s*---[\r\n]+)([\S\s]*?)([\r\n]+---(\r\n|\n|$))") - -logger = get_logger(__name__) - - -class RepoCard: - card_data_class = CardData - default_template_path = TEMPLATE_MODELCARD_PATH - repo_type = "model" - - def __init__(self, content: str, ignore_metadata_errors: bool = False): - """Initialize a RepoCard from string content. The content should be a - Markdown file with a YAML block at the beginning and a Markdown body. - - Args: - content (`str`): The content of the Markdown file. - - Example: - ```python - >>> from huggingface_hub.repocard import RepoCard - >>> text = ''' - ... --- - ... language: en - ... license: mit - ... --- - ... - ... # My repo - ... ''' - >>> card = RepoCard(text) - >>> card.data.to_dict() - {'language': 'en', 'license': 'mit'} - >>> card.text - '\\n# My repo\\n' - - ``` - - Raises the following error: - - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - when the content of the repo card metadata is not a dictionary. - - - """ - - # Set the content of the RepoCard, as well as underlying .data and .text attributes. - # See the `content` property setter for more details. - self.ignore_metadata_errors = ignore_metadata_errors - self.content = content - - @property - def content(self): - """The content of the RepoCard, including the YAML block and the Markdown body.""" - line_break = _detect_line_ending(self._content) or "\n" - return f"---{line_break}{self.data.to_yaml(line_break=line_break)}{line_break}---{line_break}{self.text}" - - @content.setter - def content(self, content: str): - """Set the content of the RepoCard.""" - self._content = content - - match = REGEX_YAML_BLOCK.search(content) - if match: - # Metadata found in the YAML block - yaml_block = match.group(2) - self.text = content[match.end() :] - data_dict = yaml.safe_load(yaml_block) - - if data_dict is None: - data_dict = {} - - # The YAML block's data should be a dictionary - if not isinstance(data_dict, dict): - raise ValueError("repo card metadata block should be a dict") - else: - # Model card without metadata... create empty metadata - logger.warning("Repo card metadata block was not found. Setting CardData to empty.") - data_dict = {} - self.text = content - - self.data = self.card_data_class(**data_dict, ignore_metadata_errors=self.ignore_metadata_errors) - - def __str__(self): - return self.content - - def save(self, filepath: Union[Path, str]): - r"""Save a RepoCard to a file. - - Args: - filepath (`Union[Path, str]`): Filepath to the markdown file to save. - - Example: - ```python - >>> from huggingface_hub.repocard import RepoCard - >>> card = RepoCard("---\nlanguage: en\n---\n# This is a test repo card") - >>> card.save("/tmp/test.md") - - ``` - """ - filepath = Path(filepath) - filepath.parent.mkdir(parents=True, exist_ok=True) - # Preserve newlines as in the existing file. - with open(filepath, mode="w", newline="", encoding="utf-8") as f: - f.write(str(self)) - - @classmethod - def load( - cls, - repo_id_or_path: Union[str, Path], - repo_type: Optional[str] = None, - token: Optional[str] = None, - ignore_metadata_errors: bool = False, - ): - """Initialize a RepoCard from a Hugging Face Hub repo's README.md or a local filepath. - - Args: - repo_id_or_path (`Union[str, Path]`): - The repo ID associated with a Hugging Face Hub repo or a local filepath. - repo_type (`str`, *optional*): - The type of Hugging Face repo to push to. Defaults to None, which will use use "model". Other options - are "dataset" and "space". Not used when loading from a local filepath. If this is called from a child - class, the default value will be the child class's `repo_type`. - token (`str`, *optional*): - Authentication token, obtained with `huggingface_hub.HfApi.login` method. Will default to the stored token. - ignore_metadata_errors (`str`): - If True, errors while parsing the metadata section will be ignored. Some information might be lost during - the process. Use it at your own risk. - - Returns: - [`huggingface_hub.repocard.RepoCard`]: The RepoCard (or subclass) initialized from the repo's - README.md file or filepath. - - Example: - ```python - >>> from huggingface_hub.repocard import RepoCard - >>> card = RepoCard.load("nateraw/food") - >>> assert card.data.tags == ["generated_from_trainer", "image-classification", "pytorch"] - - ``` - """ - - if Path(repo_id_or_path).exists(): - card_path = Path(repo_id_or_path) - elif isinstance(repo_id_or_path, str): - card_path = Path( - hf_hub_download( - repo_id_or_path, - REPOCARD_NAME, - repo_type=repo_type or cls.repo_type, - token=token, - ) - ) - else: - raise ValueError(f"Cannot load RepoCard: path not found on disk ({repo_id_or_path}).") - - # Preserve newlines in the existing file. - with card_path.open(mode="r", newline="", encoding="utf-8") as f: - return cls(f.read(), ignore_metadata_errors=ignore_metadata_errors) - - def validate(self, repo_type: Optional[str] = None): - """Validates card against Hugging Face Hub's card validation logic. - Using this function requires access to the internet, so it is only called - internally by [`huggingface_hub.repocard.RepoCard.push_to_hub`]. - - Args: - repo_type (`str`, *optional*, defaults to "model"): - The type of Hugging Face repo to push to. Options are "model", "dataset", and "space". - If this function is called from a child class, the default will be the child class's `repo_type`. - - - Raises the following errors: - - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if the card fails validation checks. - - [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) - if the request to the Hub API fails for any other reason. - - - """ - - # If repo type is provided, otherwise, use the repo type of the card. - repo_type = repo_type or self.repo_type - - body = { - "repoType": repo_type, - "content": str(self), - } - headers = {"Accept": "text/plain"} - - try: - r = get_session().post("https://huggingface.co/api/validate-yaml", body, headers=headers) - r.raise_for_status() - except requests.exceptions.HTTPError as exc: - if r.status_code == 400: - raise ValueError(r.text) - else: - raise exc - - def push_to_hub( - self, - repo_id: str, - token: Optional[str] = None, - repo_type: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - revision: Optional[str] = None, - create_pr: Optional[bool] = None, - parent_commit: Optional[str] = None, - ): - """Push a RepoCard to a Hugging Face Hub repo. - - Args: - repo_id (`str`): - The repo ID of the Hugging Face Hub repo to push to. Example: "nateraw/food". - token (`str`, *optional*): - Authentication token, obtained with `huggingface_hub.HfApi.login` method. Will default to - the stored token. - repo_type (`str`, *optional*, defaults to "model"): - The type of Hugging Face repo to push to. Options are "model", "dataset", and "space". If this - function is called by a child class, it will default to the child class's `repo_type`. - commit_message (`str`, *optional*): - The summary / title / first line of the generated commit. - commit_description (`str`, *optional*) - The description of the generated commit. - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the `"main"` branch. - create_pr (`bool`, *optional*): - Whether or not to create a Pull Request with this commit. Defaults to `False`. - parent_commit (`str`, *optional*): - The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. - If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. - If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. - Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be - especially useful if the repo is updated / committed to concurrently. - Returns: - `str`: URL of the commit which updated the card metadata. - """ - - # If repo type is provided, otherwise, use the repo type of the card. - repo_type = repo_type or self.repo_type - - # Validate card before pushing to hub - self.validate(repo_type=repo_type) - - with SoftTemporaryDirectory() as tmpdir: - tmp_path = Path(tmpdir) / REPOCARD_NAME - tmp_path.write_text(str(self)) - url = upload_file( - path_or_fileobj=str(tmp_path), - path_in_repo=REPOCARD_NAME, - repo_id=repo_id, - token=token, - repo_type=repo_type, - commit_message=commit_message, - commit_description=commit_description, - create_pr=create_pr, - revision=revision, - parent_commit=parent_commit, - ) - return url - - @classmethod - def from_template( - cls, - card_data: CardData, - template_path: Optional[str] = None, - **template_kwargs, - ): - """Initialize a RepoCard from a template. By default, it uses the default template. - - Templates are Jinja2 templates that can be customized by passing keyword arguments. - - Args: - card_data (`huggingface_hub.CardData`): - A huggingface_hub.CardData instance containing the metadata you want to include in the YAML - header of the repo card on the Hugging Face Hub. - template_path (`str`, *optional*): - A path to a markdown file with optional Jinja template variables that can be filled - in with `template_kwargs`. Defaults to the default template. - - Returns: - [`huggingface_hub.repocard.RepoCard`]: A RepoCard instance with the specified card data and content from the - template. - """ - if is_jinja_available(): - import jinja2 - else: - raise ImportError( - "Using RepoCard.from_template requires Jinja2 to be installed. Please" - " install it with `pip install Jinja2`." - ) - - kwargs = card_data.to_dict().copy() - kwargs.update(template_kwargs) # Template_kwargs have priority - template = jinja2.Template(Path(template_path or cls.default_template_path).read_text()) - content = template.render(card_data=card_data.to_yaml(), **kwargs) - return cls(content) - - -class ModelCard(RepoCard): - card_data_class = ModelCardData - default_template_path = TEMPLATE_MODELCARD_PATH - repo_type = "model" - - @classmethod - def from_template( # type: ignore # violates Liskov property but easier to use - cls, - card_data: ModelCardData, - template_path: Optional[str] = None, - **template_kwargs, - ): - """Initialize a ModelCard from a template. By default, it uses the default template, which can be found here: - https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md - - Templates are Jinja2 templates that can be customized by passing keyword arguments. - - Args: - card_data (`huggingface_hub.ModelCardData`): - A huggingface_hub.ModelCardData instance containing the metadata you want to include in the YAML - header of the model card on the Hugging Face Hub. - template_path (`str`, *optional*): - A path to a markdown file with optional Jinja template variables that can be filled - in with `template_kwargs`. Defaults to the default template. - - Returns: - [`huggingface_hub.ModelCard`]: A ModelCard instance with the specified card data and content from the - template. - - Example: - ```python - >>> from huggingface_hub import ModelCard, ModelCardData, EvalResult - - >>> # Using the Default Template - >>> card_data = ModelCardData( - ... language='en', - ... license='mit', - ... library_name='timm', - ... tags=['image-classification', 'resnet'], - ... datasets=['beans'], - ... metrics=['accuracy'], - ... ) - >>> card = ModelCard.from_template( - ... card_data, - ... model_description='This model does x + y...' - ... ) - - >>> # Including Evaluation Results - >>> card_data = ModelCardData( - ... language='en', - ... tags=['image-classification', 'resnet'], - ... eval_results=[ - ... EvalResult( - ... task_type='image-classification', - ... dataset_type='beans', - ... dataset_name='Beans', - ... metric_type='accuracy', - ... metric_value=0.9, - ... ), - ... ], - ... model_name='my-cool-model', - ... ) - >>> card = ModelCard.from_template(card_data) - - >>> # Using a Custom Template - >>> card_data = ModelCardData( - ... language='en', - ... tags=['image-classification', 'resnet'] - ... ) - >>> card = ModelCard.from_template( - ... card_data=card_data, - ... template_path='./src/huggingface_hub/templates/modelcard_template.md', - ... custom_template_var='custom value', # will be replaced in template if it exists - ... ) - - ``` - """ - return super().from_template(card_data, template_path, **template_kwargs) - - -class DatasetCard(RepoCard): - card_data_class = DatasetCardData - default_template_path = TEMPLATE_DATASETCARD_PATH - repo_type = "dataset" - - @classmethod - def from_template( # type: ignore # violates Liskov property but easier to use - cls, - card_data: DatasetCardData, - template_path: Optional[str] = None, - **template_kwargs, - ): - """Initialize a DatasetCard from a template. By default, it uses the default template, which can be found here: - https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/datasetcard_template.md - - Templates are Jinja2 templates that can be customized by passing keyword arguments. - - Args: - card_data (`huggingface_hub.DatasetCardData`): - A huggingface_hub.DatasetCardData instance containing the metadata you want to include in the YAML - header of the dataset card on the Hugging Face Hub. - template_path (`str`, *optional*): - A path to a markdown file with optional Jinja template variables that can be filled - in with `template_kwargs`. Defaults to the default template. - - Returns: - [`huggingface_hub.DatasetCard`]: A DatasetCard instance with the specified card data and content from the - template. - - Example: - ```python - >>> from huggingface_hub import DatasetCard, DatasetCardData - - >>> # Using the Default Template - >>> card_data = DatasetCardData( - ... language='en', - ... license='mit', - ... annotations_creators='crowdsourced', - ... task_categories=['text-classification'], - ... task_ids=['sentiment-classification', 'text-scoring'], - ... multilinguality='monolingual', - ... pretty_name='My Text Classification Dataset', - ... ) - >>> card = DatasetCard.from_template( - ... card_data, - ... pretty_name=card_data.pretty_name, - ... ) - - >>> # Using a Custom Template - >>> card_data = DatasetCardData( - ... language='en', - ... license='mit', - ... ) - >>> card = DatasetCard.from_template( - ... card_data=card_data, - ... template_path='./src/huggingface_hub/templates/datasetcard_template.md', - ... custom_template_var='custom value', # will be replaced in template if it exists - ... ) - - ``` - """ - return super().from_template(card_data, template_path, **template_kwargs) - - -class SpaceCard(RepoCard): - card_data_class = SpaceCardData - default_template_path = TEMPLATE_MODELCARD_PATH - repo_type = "space" - - -def _detect_line_ending(content: str) -> Literal["\r", "\n", "\r\n", None]: # noqa: F722 - """Detect the line ending of a string. Used by RepoCard to avoid making huge diff on newlines. - - Uses same implementation as in Hub server, keep it in sync. - - Returns: - str: The detected line ending of the string. - """ - cr = content.count("\r") - lf = content.count("\n") - crlf = content.count("\r\n") - if cr + lf == 0: - return None - if crlf == cr and crlf == lf: - return "\r\n" - if cr > lf: - return "\r" - else: - return "\n" - - -def metadata_load(local_path: Union[str, Path]) -> Optional[Dict]: - content = Path(local_path).read_text() - match = REGEX_YAML_BLOCK.search(content) - if match: - yaml_block = match.group(2) - data = yaml.safe_load(yaml_block) - if data is None or isinstance(data, dict): - return data - raise ValueError("repo card metadata block should be a dict") - else: - return None - - -def metadata_save(local_path: Union[str, Path], data: Dict) -> None: - """ - Save the metadata dict in the upper YAML part Trying to preserve newlines as - in the existing file. Docs about open() with newline="" parameter: - https://docs.python.org/3/library/functions.html?highlight=open#open Does - not work with "^M" linebreaks, which are replaced by \n - """ - line_break = "\n" - content = "" - # try to detect existing newline character - if os.path.exists(local_path): - with open(local_path, "r", newline="", encoding="utf8") as readme: - content = readme.read() - if isinstance(readme.newlines, tuple): - line_break = readme.newlines[0] - elif isinstance(readme.newlines, str): - line_break = readme.newlines - - # creates a new file if it not - with open(local_path, "w", newline="", encoding="utf8") as readme: - data_yaml = yaml_dump(data, sort_keys=False, line_break=line_break) - # sort_keys: keep dict order - match = REGEX_YAML_BLOCK.search(content) - if match: - output = content[: match.start()] + f"---{line_break}{data_yaml}---{line_break}" + content[match.end() :] - else: - output = f"---{line_break}{data_yaml}---{line_break}{content}" - - readme.write(output) - readme.close() - - -def metadata_eval_result( - *, - model_pretty_name: str, - task_pretty_name: str, - task_id: str, - metrics_pretty_name: str, - metrics_id: str, - metrics_value: Any, - dataset_pretty_name: str, - dataset_id: str, - metrics_config: Optional[str] = None, - metrics_verified: bool = False, - dataset_config: Optional[str] = None, - dataset_split: Optional[str] = None, - dataset_revision: Optional[str] = None, - metrics_verification_token: Optional[str] = None, -) -> Dict: - """ - Creates a metadata dict with the result from a model evaluated on a dataset. - - Args: - model_pretty_name (`str`): - The name of the model in natural language. - task_pretty_name (`str`): - The name of a task in natural language. - task_id (`str`): - Example: automatic-speech-recognition. A task id. - metrics_pretty_name (`str`): - A name for the metric in natural language. Example: Test WER. - metrics_id (`str`): - Example: wer. A metric id from https://hf.co/metrics. - metrics_value (`Any`): - The value from the metric. Example: 20.0 or "20.0 ± 1.2". - dataset_pretty_name (`str`): - The name of the dataset in natural language. - dataset_id (`str`): - Example: common_voice. A dataset id from https://hf.co/datasets. - metrics_config (`str`, *optional*): - The name of the metric configuration used in `load_metric()`. - Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`. - metrics_verified (`bool`, *optional*, defaults to `False`): - Indicates whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. Automatically computed by Hugging Face, do not set. - dataset_config (`str`, *optional*): - Example: fr. The name of the dataset configuration used in `load_dataset()`. - dataset_split (`str`, *optional*): - Example: test. The name of the dataset split used in `load_dataset()`. - dataset_revision (`str`, *optional*): - Example: 5503434ddd753f426f4b38109466949a1217c2bb. The name of the dataset dataset revision - used in `load_dataset()`. - metrics_verification_token (`bool`, *optional*): - A JSON Web Token that is used to verify whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. - - Returns: - `dict`: a metadata dict with the result from a model evaluated on a dataset. - - Example: - ```python - >>> from huggingface_hub import metadata_eval_result - >>> results = metadata_eval_result( - ... model_pretty_name="RoBERTa fine-tuned on ReactionGIF", - ... task_pretty_name="Text Classification", - ... task_id="text-classification", - ... metrics_pretty_name="Accuracy", - ... metrics_id="accuracy", - ... metrics_value=0.2662102282047272, - ... dataset_pretty_name="ReactionJPEG", - ... dataset_id="julien-c/reactionjpeg", - ... dataset_config="default", - ... dataset_split="test", - ... ) - >>> results == { - ... 'model-index': [ - ... { - ... 'name': 'RoBERTa fine-tuned on ReactionGIF', - ... 'results': [ - ... { - ... 'task': { - ... 'type': 'text-classification', - ... 'name': 'Text Classification' - ... }, - ... 'dataset': { - ... 'name': 'ReactionJPEG', - ... 'type': 'julien-c/reactionjpeg', - ... 'config': 'default', - ... 'split': 'test' - ... }, - ... 'metrics': [ - ... { - ... 'type': 'accuracy', - ... 'value': 0.2662102282047272, - ... 'name': 'Accuracy', - ... 'verified': False - ... } - ... ] - ... } - ... ] - ... } - ... ] - ... } - True - - ``` - """ - - return { - "model-index": eval_results_to_model_index( - model_name=model_pretty_name, - eval_results=[ - EvalResult( - task_name=task_pretty_name, - task_type=task_id, - metric_name=metrics_pretty_name, - metric_type=metrics_id, - metric_value=metrics_value, - dataset_name=dataset_pretty_name, - dataset_type=dataset_id, - metric_config=metrics_config, - verified=metrics_verified, - verify_token=metrics_verification_token, - dataset_config=dataset_config, - dataset_split=dataset_split, - dataset_revision=dataset_revision, - ) - ], - ) - } - - -@validate_hf_hub_args -def metadata_update( - repo_id: str, - metadata: Dict, - *, - repo_type: Optional[str] = None, - overwrite: bool = False, - token: Optional[str] = None, - commit_message: Optional[str] = None, - commit_description: Optional[str] = None, - revision: Optional[str] = None, - create_pr: bool = False, - parent_commit: Optional[str] = None, -) -> str: - """ - Updates the metadata in the README.md of a repository on the Hugging Face Hub. - If the README.md file doesn't exist yet, a new one is created with metadata and an - the default ModelCard or DatasetCard template. For `space` repo, an error is thrown - as a Space cannot exist without a `README.md` file. - - Args: - repo_id (`str`): - The name of the repository. - metadata (`dict`): - A dictionary containing the metadata to be updated. - repo_type (`str`, *optional*): - Set to `"dataset"` or `"space"` if updating to a dataset or space, - `None` or `"model"` if updating to a model. Default is `None`. - overwrite (`bool`, *optional*, defaults to `False`): - If set to `True` an existing field can be overwritten, otherwise - attempting to overwrite an existing field will cause an error. - token (`str`, *optional*): - The Hugging Face authentication token. - commit_message (`str`, *optional*): - The summary / title / first line of the generated commit. Defaults to - `f"Update metadata with huggingface_hub"` - commit_description (`str` *optional*) - The description of the generated commit - revision (`str`, *optional*): - The git revision to commit from. Defaults to the head of the - `"main"` branch. - create_pr (`boolean`, *optional*): - Whether or not to create a Pull Request from `revision` with that commit. - Defaults to `False`. - parent_commit (`str`, *optional*): - The OID / SHA of the parent commit, as a hexadecimal string. Shorthands (7 first characters) are also supported. - If specified and `create_pr` is `False`, the commit will fail if `revision` does not point to `parent_commit`. - If specified and `create_pr` is `True`, the pull request will be created from `parent_commit`. - Specifying `parent_commit` ensures the repo has not changed before committing the changes, and can be - especially useful if the repo is updated / committed to concurrently. - Returns: - `str`: URL of the commit which updated the card metadata. - - Example: - ```python - >>> from huggingface_hub import metadata_update - >>> metadata = {'model-index': [{'name': 'RoBERTa fine-tuned on ReactionGIF', - ... 'results': [{'dataset': {'name': 'ReactionGIF', - ... 'type': 'julien-c/reactiongif'}, - ... 'metrics': [{'name': 'Recall', - ... 'type': 'recall', - ... 'value': 0.7762102282047272}], - ... 'task': {'name': 'Text Classification', - ... 'type': 'text-classification'}}]}]} - >>> url = metadata_update("hf-internal-testing/reactiongif-roberta-card", metadata) - - ``` - """ - commit_message = commit_message if commit_message is not None else "Update metadata with huggingface_hub" - - # Card class given repo_type - card_class: Type[RepoCard] - if repo_type is None or repo_type == "model": - card_class = ModelCard - elif repo_type == "dataset": - card_class = DatasetCard - elif repo_type == "space": - card_class = RepoCard - else: - raise ValueError(f"Unknown repo_type: {repo_type}") - - # Either load repo_card from the Hub or create an empty one. - # NOTE: Will not create the repo if it doesn't exist. - try: - card = card_class.load(repo_id, token=token, repo_type=repo_type) - except EntryNotFoundError: - if repo_type == "space": - raise ValueError("Cannot update metadata on a Space that doesn't contain a `README.md` file.") - - # Initialize a ModelCard or DatasetCard from default template and no data. - card = card_class.from_template(CardData()) - - for key, value in metadata.items(): - if key == "model-index": - # if the new metadata doesn't include a name, either use existing one or repo name - if "name" not in value[0]: - value[0]["name"] = getattr(card, "model_name", repo_id) - model_name, new_results = model_index_to_eval_results(value) - if card.data.eval_results is None: - card.data.eval_results = new_results - card.data.model_name = model_name - else: - existing_results = card.data.eval_results - - # Iterate over new results - # Iterate over existing results - # If both results describe the same metric but value is different: - # If overwrite=True: overwrite the metric value - # Else: raise ValueError - # Else: append new result to existing ones. - for new_result in new_results: - result_found = False - for existing_result in existing_results: - if new_result.is_equal_except_value(existing_result): - if new_result != existing_result and not overwrite: - raise ValueError( - "You passed a new value for the existing metric" - f" 'name: {new_result.metric_name}, type: " - f"{new_result.metric_type}'. Set `overwrite=True`" - " to overwrite existing metrics." - ) - result_found = True - existing_result.metric_value = new_result.metric_value - if existing_result.verified is True: - existing_result.verify_token = new_result.verify_token - if not result_found: - card.data.eval_results.append(new_result) - else: - # Any metadata that is not a result metric - if card.data.get(key) is not None and not overwrite and card.data.get(key) != value: - raise ValueError( - f"You passed a new value for the existing meta data field '{key}'." - " Set `overwrite=True` to overwrite existing metadata." - ) - else: - card.data[key] = value - - return card.push_to_hub( - repo_id, - token=token, - repo_type=repo_type, - commit_message=commit_message, - commit_description=commit_description, - create_pr=create_pr, - revision=revision, - parent_commit=parent_commit, - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/repocard_data.py b/venv/lib/python3.8/site-packages/huggingface_hub/repocard_data.py deleted file mode 100644 index df1cf2836b6ffa0b9cbc31d42a1e82277c402242..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/repocard_data.py +++ /dev/null @@ -1,681 +0,0 @@ -import copy -from collections import defaultdict -from dataclasses import dataclass -from typing import Any, Dict, List, Optional, Tuple, Union - -from huggingface_hub.utils import yaml_dump - -from .utils.logging import get_logger - - -logger = get_logger(__name__) - - -@dataclass -class EvalResult: - """ - Flattened representation of individual evaluation results found in model-index of Model Cards. - - For more information on the model-index spec, see https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1. - - Args: - task_type (`str`): - The task identifier. Example: "image-classification". - dataset_type (`str`): - The dataset identifier. Example: "common_voice". Use dataset id from https://hf.co/datasets. - dataset_name (`str`): - A pretty name for the dataset. Example: "Common Voice (French)". - metric_type (`str`): - The metric identifier. Example: "wer". Use metric id from https://hf.co/metrics. - metric_value (`Any`): - The metric value. Example: 0.9 or "20.0 ± 1.2". - task_name (`str`, *optional*): - A pretty name for the task. Example: "Speech Recognition". - dataset_config (`str`, *optional*): - The name of the dataset configuration used in `load_dataset()`. - Example: fr in `load_dataset("common_voice", "fr")`. See the `datasets` docs for more info: - https://hf.co/docs/datasets/package_reference/loading_methods#datasets.load_dataset.name - dataset_split (`str`, *optional*): - The split used in `load_dataset()`. Example: "test". - dataset_revision (`str`, *optional*): - The revision (AKA Git Sha) of the dataset used in `load_dataset()`. - Example: 5503434ddd753f426f4b38109466949a1217c2bb - dataset_args (`Dict[str, Any]`, *optional*): - The arguments passed during `Metric.compute()`. Example for `bleu`: `{"max_order": 4}` - metric_name (`str`, *optional*): - A pretty name for the metric. Example: "Test WER". - metric_config (`str`, *optional*): - The name of the metric configuration used in `load_metric()`. - Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`. - See the `datasets` docs for more info: https://huggingface.co/docs/datasets/v2.1.0/en/loading#load-configurations - metric_args (`Dict[str, Any]`, *optional*): - The arguments passed during `Metric.compute()`. Example for `bleu`: max_order: 4 - verified (`bool`, *optional*): - Indicates whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. Automatically computed by Hugging Face, do not set. - verify_token (`str`, *optional*): - A JSON Web Token that is used to verify whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. - """ - - # Required - - # The task identifier - # Example: automatic-speech-recognition - task_type: str - - # The dataset identifier - # Example: common_voice. Use dataset id from https://hf.co/datasets - dataset_type: str - - # A pretty name for the dataset. - # Example: Common Voice (French) - dataset_name: str - - # The metric identifier - # Example: wer. Use metric id from https://hf.co/metrics - metric_type: str - - # Value of the metric. - # Example: 20.0 or "20.0 ± 1.2" - metric_value: Any - - # Optional - - # A pretty name for the task. - # Example: Speech Recognition - task_name: Optional[str] = None - - # The name of the dataset configuration used in `load_dataset()`. - # Example: fr in `load_dataset("common_voice", "fr")`. - # See the `datasets` docs for more info: - # https://huggingface.co/docs/datasets/package_reference/loading_methods#datasets.load_dataset.name - dataset_config: Optional[str] = None - - # The split used in `load_dataset()`. - # Example: test - dataset_split: Optional[str] = None - - # The revision (AKA Git Sha) of the dataset used in `load_dataset()`. - # Example: 5503434ddd753f426f4b38109466949a1217c2bb - dataset_revision: Optional[str] = None - - # The arguments passed during `Metric.compute()`. - # Example for `bleu`: max_order: 4 - dataset_args: Optional[Dict[str, Any]] = None - - # A pretty name for the metric. - # Example: Test WER - metric_name: Optional[str] = None - - # The name of the metric configuration used in `load_metric()`. - # Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`. - # See the `datasets` docs for more info: https://huggingface.co/docs/datasets/v2.1.0/en/loading#load-configurations - metric_config: Optional[str] = None - - # The arguments passed during `Metric.compute()`. - # Example for `bleu`: max_order: 4 - metric_args: Optional[Dict[str, Any]] = None - - # Indicates whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. Automatically computed by Hugging Face, do not set. - verified: Optional[bool] = None - - # A JSON Web Token that is used to verify whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. - verify_token: Optional[str] = None - - @property - def unique_identifier(self) -> tuple: - """Returns a tuple that uniquely identifies this evaluation.""" - return ( - self.task_type, - self.dataset_type, - self.dataset_config, - self.dataset_split, - self.dataset_revision, - ) - - def is_equal_except_value(self, other: "EvalResult") -> bool: - """ - Return True if `self` and `other` describe exactly the same metric but with a - different value. - """ - for key, _ in self.__dict__.items(): - if key == "metric_value": - continue - # For metrics computed by Hugging Face's evaluation service, `verify_token` is derived from `metric_value`, - # so we exclude it here in the comparison. - if key != "verify_token" and getattr(self, key) != getattr(other, key): - return False - return True - - -@dataclass -class CardData: - """Structure containing metadata from a RepoCard. - - [`CardData`] is the parent class of [`ModelCardData`] and [`DatasetCardData`]. - - Metadata can be exported as a dictionary or YAML. Export can be customized to alter the representation of the data - (example: flatten evaluation results). `CardData` behaves as a dictionary (can get, pop, set values) but do not - inherit from `dict` to allow this export step. - """ - - def __init__(self, ignore_metadata_errors: bool = False, **kwargs): - self.__dict__.update(kwargs) - - def to_dict(self) -> Dict[str, Any]: - """Converts CardData to a dict. - - Returns: - `dict`: CardData represented as a dictionary ready to be dumped to a YAML - block for inclusion in a README.md file. - """ - - data_dict = copy.deepcopy(self.__dict__) - self._to_dict(data_dict) - return _remove_none(data_dict) - - def _to_dict(self, data_dict): - """Use this method in child classes to alter the dict representation of the data. Alter the dict in-place. - - Args: - data_dict (`dict`): The raw dict representation of the card data. - """ - pass - - def to_yaml(self, line_break=None) -> str: - """Dumps CardData to a YAML block for inclusion in a README.md file. - - Args: - line_break (str, *optional*): - The line break to use when dumping to yaml. - - Returns: - `str`: CardData represented as a YAML block. - """ - return yaml_dump(self.to_dict(), sort_keys=False, line_break=line_break).strip() - - def __repr__(self): - return self.to_yaml() - - def get(self, key: str, default: Any = None) -> Any: - """Get value for a given metadata key.""" - return self.__dict__.get(key, default) - - def pop(self, key: str, default: Any = None) -> Any: - """Pop value for a given metadata key.""" - return self.__dict__.pop(key, default) - - def __getitem__(self, key: str) -> Any: - """Get value for a given metadata key.""" - return self.__dict__[key] - - def __setitem__(self, key: str, value: Any) -> None: - """Set value for a given metadata key.""" - self.__dict__[key] = value - - def __contains__(self, key: str) -> bool: - """Check if a given metadata key is set.""" - return key in self.__dict__ - - -class ModelCardData(CardData): - """Model Card Metadata that is used by Hugging Face Hub when included at the top of your README.md - - Args: - language (`Union[str, List[str]]`, *optional*): - Language of model's training data or metadata. It must be an ISO 639-1, 639-2 or - 639-3 code (two/three letters), or a special value like "code", "multilingual". Defaults to `None`. - license (`str`, *optional*): - License of this model. Example: apache-2.0 or any license from - https://huggingface.co/docs/hub/repositories-licenses. Defaults to None. - library_name (`str`, *optional*): - Name of library used by this model. Example: keras or any library from - https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Libraries.ts. - Defaults to None. - tags (`List[str]`, *optional*): - List of tags to add to your model that can be used when filtering on the Hugging - Face Hub. Defaults to None. - datasets (`List[str]`, *optional*): - List of datasets that were used to train this model. Should be a dataset ID - found on https://hf.co/datasets. Defaults to None. - metrics (`List[str]`, *optional*): - List of metrics used to evaluate this model. Should be a metric name that can be found - at https://hf.co/metrics. Example: 'accuracy'. Defaults to None. - eval_results (`Union[List[EvalResult], EvalResult]`, *optional*): - List of `huggingface_hub.EvalResult` that define evaluation results of the model. If provided, - `model_name` is used to as a name on PapersWithCode's leaderboards. Defaults to `None`. - model_name (`str`, *optional*): - A name for this model. It is used along with - `eval_results` to construct the `model-index` within the card's metadata. The name - you supply here is what will be used on PapersWithCode's leaderboards. If None is provided - then the repo name is used as a default. Defaults to None. - ignore_metadata_errors (`str`): - If True, errors while parsing the metadata section will be ignored. Some information might be lost during - the process. Use it at your own risk. - kwargs (`dict`, *optional*): - Additional metadata that will be added to the model card. Defaults to None. - - Example: - ```python - >>> from huggingface_hub import ModelCardData - >>> card_data = ModelCardData( - ... language="en", - ... license="mit", - ... library_name="timm", - ... tags=['image-classification', 'resnet'], - ... ) - >>> card_data.to_dict() - {'language': 'en', 'license': 'mit', 'library_name': 'timm', 'tags': ['image-classification', 'resnet']} - - ``` - """ - - def __init__( - self, - *, - language: Optional[Union[str, List[str]]] = None, - license: Optional[str] = None, - library_name: Optional[str] = None, - tags: Optional[List[str]] = None, - datasets: Optional[List[str]] = None, - metrics: Optional[List[str]] = None, - eval_results: Optional[List[EvalResult]] = None, - model_name: Optional[str] = None, - ignore_metadata_errors: bool = False, - **kwargs, - ): - self.language = language - self.license = license - self.library_name = library_name - self.tags = tags - self.datasets = datasets - self.metrics = metrics - self.eval_results = eval_results - self.model_name = model_name - - model_index = kwargs.pop("model-index", None) - if model_index: - try: - model_name, eval_results = model_index_to_eval_results(model_index) - self.model_name = model_name - self.eval_results = eval_results - except KeyError as error: - if ignore_metadata_errors: - logger.warning("Invalid model-index. Not loading eval results into CardData.") - else: - raise ValueError( - f"Invalid `model_index` in metadata cannot be parsed: KeyError {error}. Pass" - " `ignore_metadata_errors=True` to ignore this error while loading a Model Card. Warning:" - " some information will be lost. Use it at your own risk." - ) - - super().__init__(**kwargs) - - if self.eval_results: - if type(self.eval_results) == EvalResult: - self.eval_results = [self.eval_results] - if self.model_name is None: - raise ValueError("Passing `eval_results` requires `model_name` to be set.") - - def _to_dict(self, data_dict): - """Format the internal data dict. In this case, we convert eval results to a valid model index""" - if self.eval_results is not None: - data_dict["model-index"] = eval_results_to_model_index(self.model_name, self.eval_results) - del data_dict["eval_results"], data_dict["model_name"] - - -class DatasetCardData(CardData): - """Dataset Card Metadata that is used by Hugging Face Hub when included at the top of your README.md - - Args: - language (`List[str]`, *optional*): - Language of dataset's data or metadata. It must be an ISO 639-1, 639-2 or - 639-3 code (two/three letters), or a special value like "code", "multilingual". - license (`Union[str, List[str]]`, *optional*): - License(s) of this dataset. Example: apache-2.0 or any license from - https://huggingface.co/docs/hub/repositories-licenses. - annotations_creators (`Union[str, List[str]]`, *optional*): - How the annotations for the dataset were created. - Options are: 'found', 'crowdsourced', 'expert-generated', 'machine-generated', 'no-annotation', 'other'. - language_creators (`Union[str, List[str]]`, *optional*): - How the text-based data in the dataset was created. - Options are: 'found', 'crowdsourced', 'expert-generated', 'machine-generated', 'other' - multilinguality (`Union[str, List[str]]`, *optional*): - Whether the dataset is multilingual. - Options are: 'monolingual', 'multilingual', 'translation', 'other'. - size_categories (`Union[str, List[str]]`, *optional*): - The number of examples in the dataset. Options are: 'n<1K', '1K1T', and 'other'. - source_datasets (`List[str]]`, *optional*): - Indicates whether the dataset is an original dataset or extended from another existing dataset. - Options are: 'original' and 'extended'. - task_categories (`Union[str, List[str]]`, *optional*): - What categories of task does the dataset support? - task_ids (`Union[str, List[str]]`, *optional*): - What specific tasks does the dataset support? - paperswithcode_id (`str`, *optional*): - ID of the dataset on PapersWithCode. - pretty_name (`str`, *optional*): - A more human-readable name for the dataset. (ex. "Cats vs. Dogs") - train_eval_index (`Dict`, *optional*): - A dictionary that describes the necessary spec for doing evaluation on the Hub. - If not provided, it will be gathered from the 'train-eval-index' key of the kwargs. - config_names (`Union[str, List[str]]`, *optional*): - A list of the available dataset configs for the dataset. - """ - - def __init__( - self, - *, - language: Optional[Union[str, List[str]]] = None, - license: Optional[Union[str, List[str]]] = None, - annotations_creators: Optional[Union[str, List[str]]] = None, - language_creators: Optional[Union[str, List[str]]] = None, - multilinguality: Optional[Union[str, List[str]]] = None, - size_categories: Optional[Union[str, List[str]]] = None, - source_datasets: Optional[List[str]] = None, - task_categories: Optional[Union[str, List[str]]] = None, - task_ids: Optional[Union[str, List[str]]] = None, - paperswithcode_id: Optional[str] = None, - pretty_name: Optional[str] = None, - train_eval_index: Optional[Dict] = None, - config_names: Optional[Union[str, List[str]]] = None, - ignore_metadata_errors: bool = False, - **kwargs, - ): - self.annotations_creators = annotations_creators - self.language_creators = language_creators - self.language = language - self.license = license - self.multilinguality = multilinguality - self.size_categories = size_categories - self.source_datasets = source_datasets - self.task_categories = task_categories - self.task_ids = task_ids - self.paperswithcode_id = paperswithcode_id - self.pretty_name = pretty_name - self.config_names = config_names - - # TODO - maybe handle this similarly to EvalResult? - self.train_eval_index = train_eval_index or kwargs.pop("train-eval-index", None) - super().__init__(**kwargs) - - def _to_dict(self, data_dict): - data_dict["train-eval-index"] = data_dict.pop("train_eval_index") - - -class SpaceCardData(CardData): - """Space Card Metadata that is used by Hugging Face Hub when included at the top of your README.md - - To get an exhaustive reference of Spaces configuration, please visit https://huggingface.co/docs/hub/spaces-config-reference#spaces-configuration-reference. - - Args: - title (`str`, *optional*) - Title of the Space. - sdk (`str`, *optional*) - SDK of the Space (one of `gradio`, `streamlit`, `docker`, or `static`). - sdk_version (`str`, *optional*) - Version of the used SDK (if Gradio/Streamlit sdk). - python_version (`str`, *optional*) - Python version used in the Space (if Gradio/Streamlit sdk). - app_file (`str`, *optional*) - Path to your main application file (which contains either gradio or streamlit Python code, or static html code). - Path is relative to the root of the repository. - app_port (`str`, *optional*) - Port on which your application is running. Used only if sdk is `docker`. - license (`str`, *optional*) - License of this model. Example: apache-2.0 or any license from - https://huggingface.co/docs/hub/repositories-licenses. - duplicated_from (`str`, *optional*) - ID of the original Space if this is a duplicated Space. - models (List[`str`], *optional*) - List of models related to this Space. Should be a dataset ID found on https://hf.co/models. - datasets (`List[str]`, *optional*) - List of datasets related to this Space. Should be a dataset ID found on https://hf.co/datasets. - tags (`List[str]`, *optional*) - List of tags to add to your Space that can be used when filtering on the Hub. - ignore_metadata_errors (`str`): - If True, errors while parsing the metadata section will be ignored. Some information might be lost during - the process. Use it at your own risk. - kwargs (`dict`, *optional*): - Additional metadata that will be added to the space card. - - Example: - ```python - >>> from huggingface_hub import SpaceCardData - >>> card_data = SpaceCardData( - ... title="Dreambooth Training", - ... license="mit", - ... sdk="gradio", - ... duplicated_from="multimodalart/dreambooth-training" - ... ) - >>> card_data.to_dict() - {'title': 'Dreambooth Training', 'sdk': 'gradio', 'license': 'mit', 'duplicated_from': 'multimodalart/dreambooth-training'} - ``` - """ - - def __init__( - self, - *, - title: Optional[str] = None, - sdk: Optional[str] = None, - sdk_version: Optional[str] = None, - python_version: Optional[str] = None, - app_file: Optional[str] = None, - app_port: Optional[int] = None, - license: Optional[str] = None, - duplicated_from: Optional[str] = None, - models: Optional[List[str]] = None, - datasets: Optional[List[str]] = None, - tags: Optional[List[str]] = None, - ignore_metadata_errors: bool = False, - **kwargs, - ): - self.title = title - self.sdk = sdk - self.sdk_version = sdk_version - self.python_version = python_version - self.app_file = app_file - self.app_port = app_port - self.license = license - self.duplicated_from = duplicated_from - self.models = models - self.datasets = datasets - self.tags = tags - super().__init__(**kwargs) - - -def model_index_to_eval_results(model_index: List[Dict[str, Any]]) -> Tuple[str, List[EvalResult]]: - """Takes in a model index and returns the model name and a list of `huggingface_hub.EvalResult` objects. - - A detailed spec of the model index can be found here: - https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1 - - Args: - model_index (`List[Dict[str, Any]]`): - A model index data structure, likely coming from a README.md file on the - Hugging Face Hub. - - Returns: - model_name (`str`): - The name of the model as found in the model index. This is used as the - identifier for the model on leaderboards like PapersWithCode. - eval_results (`List[EvalResult]`): - A list of `huggingface_hub.EvalResult` objects containing the metrics - reported in the provided model_index. - - Example: - ```python - >>> from huggingface_hub.repocard_data import model_index_to_eval_results - >>> # Define a minimal model index - >>> model_index = [ - ... { - ... "name": "my-cool-model", - ... "results": [ - ... { - ... "task": { - ... "type": "image-classification" - ... }, - ... "dataset": { - ... "type": "beans", - ... "name": "Beans" - ... }, - ... "metrics": [ - ... { - ... "type": "accuracy", - ... "value": 0.9 - ... } - ... ] - ... } - ... ] - ... } - ... ] - >>> model_name, eval_results = model_index_to_eval_results(model_index) - >>> model_name - 'my-cool-model' - >>> eval_results[0].task_type - 'image-classification' - >>> eval_results[0].metric_type - 'accuracy' - - ``` - """ - - eval_results = [] - for elem in model_index: - name = elem["name"] - results = elem["results"] - for result in results: - task_type = result["task"]["type"] - task_name = result["task"].get("name") - dataset_type = result["dataset"]["type"] - dataset_name = result["dataset"]["name"] - dataset_config = result["dataset"].get("config") - dataset_split = result["dataset"].get("split") - dataset_revision = result["dataset"].get("revision") - dataset_args = result["dataset"].get("args") - - for metric in result["metrics"]: - metric_type = metric["type"] - metric_value = metric["value"] - metric_name = metric.get("name") - metric_args = metric.get("args") - metric_config = metric.get("config") - verified = metric.get("verified") - verify_token = metric.get("verifyToken") - - eval_result = EvalResult( - task_type=task_type, # Required - dataset_type=dataset_type, # Required - dataset_name=dataset_name, # Required - metric_type=metric_type, # Required - metric_value=metric_value, # Required - task_name=task_name, - dataset_config=dataset_config, - dataset_split=dataset_split, - dataset_revision=dataset_revision, - dataset_args=dataset_args, - metric_name=metric_name, - metric_args=metric_args, - metric_config=metric_config, - verified=verified, - verify_token=verify_token, - ) - eval_results.append(eval_result) - return name, eval_results - - -def _remove_none(obj): - """ - Recursively remove `None` values from a dict. Borrowed from: https://stackoverflow.com/a/20558778 - """ - if isinstance(obj, (list, tuple, set)): - return type(obj)(_remove_none(x) for x in obj if x is not None) - elif isinstance(obj, dict): - return type(obj)((_remove_none(k), _remove_none(v)) for k, v in obj.items() if k is not None and v is not None) - else: - return obj - - -def eval_results_to_model_index(model_name: str, eval_results: List[EvalResult]) -> List[Dict[str, Any]]: - """Takes in given model name and list of `huggingface_hub.EvalResult` and returns a - valid model-index that will be compatible with the format expected by the - Hugging Face Hub. - - Args: - model_name (`str`): - Name of the model (ex. "my-cool-model"). This is used as the identifier - for the model on leaderboards like PapersWithCode. - eval_results (`List[EvalResult]`): - List of `huggingface_hub.EvalResult` objects containing the metrics to be - reported in the model-index. - - Returns: - model_index (`List[Dict[str, Any]]`): The eval_results converted to a model-index. - - Example: - ```python - >>> from huggingface_hub.repocard_data import eval_results_to_model_index, EvalResult - >>> # Define minimal eval_results - >>> eval_results = [ - ... EvalResult( - ... task_type="image-classification", # Required - ... dataset_type="beans", # Required - ... dataset_name="Beans", # Required - ... metric_type="accuracy", # Required - ... metric_value=0.9, # Required - ... ) - ... ] - >>> eval_results_to_model_index("my-cool-model", eval_results) - [{'name': 'my-cool-model', 'results': [{'task': {'type': 'image-classification'}, 'dataset': {'name': 'Beans', 'type': 'beans'}, 'metrics': [{'type': 'accuracy', 'value': 0.9}]}]}] - - ``` - """ - - # Metrics are reported on a unique task-and-dataset basis. - # Here, we make a map of those pairs and the associated EvalResults. - task_and_ds_types_map = defaultdict(list) - for eval_result in eval_results: - task_and_ds_types_map[eval_result.unique_identifier].append(eval_result) - - # Use the map from above to generate the model index data. - model_index_data = [] - for results in task_and_ds_types_map.values(): - # All items from `results` share same metadata - sample_result = results[0] - data = { - "task": { - "type": sample_result.task_type, - "name": sample_result.task_name, - }, - "dataset": { - "name": sample_result.dataset_name, - "type": sample_result.dataset_type, - "config": sample_result.dataset_config, - "split": sample_result.dataset_split, - "revision": sample_result.dataset_revision, - "args": sample_result.dataset_args, - }, - "metrics": [ - { - "type": result.metric_type, - "value": result.metric_value, - "name": result.metric_name, - "config": result.metric_config, - "args": result.metric_args, - "verified": result.verified, - "verifyToken": result.verify_token, - } - for result in results - ], - } - model_index_data.append(data) - - # TODO - Check if there cases where this list is longer than one? - # Finally, the model index itself is list of dicts. - model_index = [ - { - "name": model_name, - "results": model_index_data, - } - ] - return _remove_none(model_index) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/repository.py b/venv/lib/python3.8/site-packages/huggingface_hub/repository.py deleted file mode 100644 index d13b287aac35320ff5e7447f6fe820d45e9b8945..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/repository.py +++ /dev/null @@ -1,1460 +0,0 @@ -import atexit -import os -import re -import subprocess -import threading -import time -from contextlib import contextmanager -from pathlib import Path -from typing import Callable, Dict, Iterator, List, Optional, Tuple, TypedDict, Union -from urllib.parse import urlparse - -from huggingface_hub.constants import REPO_TYPES_URL_PREFIXES, REPOCARD_NAME -from huggingface_hub.repocard import metadata_load, metadata_save - -from .hf_api import HfApi, repo_type_and_id_from_hf_id -from .lfs import LFS_MULTIPART_UPLOAD_COMMAND -from .utils import ( - HfFolder, - SoftTemporaryDirectory, - logging, - run_subprocess, - tqdm, - validate_hf_hub_args, -) - - -logger = logging.get_logger(__name__) - - -class CommandInProgress: - """ - Utility to follow commands launched asynchronously. - """ - - def __init__( - self, - title: str, - is_done_method: Callable, - status_method: Callable, - process: subprocess.Popen, - post_method: Optional[Callable] = None, - ): - self.title = title - self._is_done = is_done_method - self._status = status_method - self._process = process - self._stderr = "" - self._stdout = "" - self._post_method = post_method - - @property - def is_done(self) -> bool: - """ - Whether the process is done. - """ - result = self._is_done() - - if result and self._post_method is not None: - self._post_method() - self._post_method = None - - return result - - @property - def status(self) -> int: - """ - The exit code/status of the current action. Will return `0` if the - command has completed successfully, and a number between 1 and 255 if - the process errored-out. - - Will return -1 if the command is still ongoing. - """ - return self._status() - - @property - def failed(self) -> bool: - """ - Whether the process errored-out. - """ - return self.status > 0 - - @property - def stderr(self) -> str: - """ - The current output message on the standard error. - """ - if self._process.stderr is not None: - self._stderr += self._process.stderr.read() - return self._stderr - - @property - def stdout(self) -> str: - """ - The current output message on the standard output. - """ - if self._process.stdout is not None: - self._stdout += self._process.stdout.read() - return self._stdout - - def __repr__(self): - status = self.status - - if status == -1: - status = "running" - - return ( - f"[{self.title} command, status code: {status}," - f" {'in progress.' if not self.is_done else 'finished.'} PID:" - f" {self._process.pid}]" - ) - - -def is_git_repo(folder: Union[str, Path]) -> bool: - """ - Check if the folder is the root or part of a git repository - - Args: - folder (`str`): - The folder in which to run the command. - - Returns: - `bool`: `True` if the repository is part of a repository, `False` - otherwise. - """ - folder_exists = os.path.exists(os.path.join(folder, ".git")) - git_branch = subprocess.run("git branch".split(), cwd=folder, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - return folder_exists and git_branch.returncode == 0 - - -def is_local_clone(folder: Union[str, Path], remote_url: str) -> bool: - """ - Check if the folder is a local clone of the remote_url - - Args: - folder (`str` or `Path`): - The folder in which to run the command. - remote_url (`str`): - The url of a git repository. - - Returns: - `bool`: `True` if the repository is a local clone of the remote - repository specified, `False` otherwise. - """ - if not is_git_repo(folder): - return False - - remotes = run_subprocess("git remote -v", folder).stdout - - # Remove token for the test with remotes. - remote_url = re.sub(r"https://.*@", "https://", remote_url) - remotes = [re.sub(r"https://.*@", "https://", remote) for remote in remotes.split()] - return remote_url in remotes - - -def is_tracked_with_lfs(filename: Union[str, Path]) -> bool: - """ - Check if the file passed is tracked with git-lfs. - - Args: - filename (`str` or `Path`): - The filename to check. - - Returns: - `bool`: `True` if the file passed is tracked with git-lfs, `False` - otherwise. - """ - folder = Path(filename).parent - filename = Path(filename).name - - try: - p = run_subprocess("git check-attr -a".split() + [filename], folder) - attributes = p.stdout.strip() - except subprocess.CalledProcessError as exc: - if not is_git_repo(folder): - return False - else: - raise OSError(exc.stderr) - - if len(attributes) == 0: - return False - - found_lfs_tag = {"diff": False, "merge": False, "filter": False} - - for attribute in attributes.split("\n"): - for tag in found_lfs_tag.keys(): - if tag in attribute and "lfs" in attribute: - found_lfs_tag[tag] = True - - return all(found_lfs_tag.values()) - - -def is_git_ignored(filename: Union[str, Path]) -> bool: - """ - Check if file is git-ignored. Supports nested .gitignore files. - - Args: - filename (`str` or `Path`): - The filename to check. - - Returns: - `bool`: `True` if the file passed is ignored by `git`, `False` - otherwise. - """ - folder = Path(filename).parent - filename = Path(filename).name - - try: - p = run_subprocess("git check-ignore".split() + [filename], folder, check=False) - # Will return exit code 1 if not gitignored - is_ignored = not bool(p.returncode) - except subprocess.CalledProcessError as exc: - raise OSError(exc.stderr) - - return is_ignored - - -def is_binary_file(filename: Union[str, Path]) -> bool: - """ - Check if file is a binary file. - - Args: - filename (`str` or `Path`): - The filename to check. - - Returns: - `bool`: `True` if the file passed is a binary file, `False` otherwise. - """ - try: - with open(filename, "rb") as f: - content = f.read(10 * (1024**2)) # Read a maximum of 10MB - - # Code sample taken from the following stack overflow thread - # https://stackoverflow.com/questions/898669/how-can-i-detect-if-a-file-is-binary-non-text-in-python/7392391#7392391 - text_chars = bytearray({7, 8, 9, 10, 12, 13, 27} | set(range(0x20, 0x100)) - {0x7F}) - return bool(content.translate(None, text_chars)) - except UnicodeDecodeError: - return True - - -def files_to_be_staged(pattern: str = ".", folder: Union[str, Path, None] = None) -> List[str]: - """ - Returns a list of filenames that are to be staged. - - Args: - pattern (`str` or `Path`): - The pattern of filenames to check. Put `.` to get all files. - folder (`str` or `Path`): - The folder in which to run the command. - - Returns: - `List[str]`: List of files that are to be staged. - """ - try: - p = run_subprocess("git ls-files --exclude-standard -mo".split() + [pattern], folder) - if len(p.stdout.strip()): - files = p.stdout.strip().split("\n") - else: - files = [] - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - return files - - -def is_tracked_upstream(folder: Union[str, Path]) -> bool: - """ - Check if the current checked-out branch is tracked upstream. - - Args: - folder (`str` or `Path`): - The folder in which to run the command. - - Returns: - `bool`: `True` if the current checked-out branch is tracked upstream, - `False` otherwise. - """ - try: - run_subprocess("git rev-parse --symbolic-full-name --abbrev-ref @{u}", folder) - return True - except subprocess.CalledProcessError as exc: - if "HEAD" in exc.stderr: - raise OSError("No branch checked out") - - return False - - -def commits_to_push(folder: Union[str, Path], upstream: Optional[str] = None) -> int: - """ - Check the number of commits that would be pushed upstream - - Args: - folder (`str` or `Path`): - The folder in which to run the command. - upstream (`str`, *optional*): - The name of the upstream repository with which the comparison should be - made. - - Returns: - `int`: Number of commits that would be pushed upstream were a `git - push` to proceed. - """ - try: - result = run_subprocess(f"git cherry -v {upstream or ''}", folder) - return len(result.stdout.split("\n")) - 1 - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - -class PbarT(TypedDict): - # Used to store an opened progress bar in `_lfs_log_progress` - bar: tqdm - past_bytes: int - - -@contextmanager -def _lfs_log_progress(): - """ - This is a context manager that will log the Git LFS progress of cleaning, - smudging, pulling and pushing. - """ - - if logger.getEffectiveLevel() >= logging.ERROR: - try: - yield - except Exception: - pass - return - - def output_progress(stopping_event: threading.Event): - """ - To be launched as a separate thread with an event meaning it should stop - the tail. - """ - # Key is tuple(state, filename), value is a dict(tqdm bar and a previous value) - pbars: Dict[Tuple[str, str], PbarT] = {} - - def close_pbars(): - for pbar in pbars.values(): - pbar["bar"].update(pbar["bar"].total - pbar["past_bytes"]) - pbar["bar"].refresh() - pbar["bar"].close() - - def tail_file(filename) -> Iterator[str]: - """ - Creates a generator to be iterated through, which will return each - line one by one. Will stop tailing the file if the stopping_event is - set. - """ - with open(filename, "r") as file: - current_line = "" - while True: - if stopping_event.is_set(): - close_pbars() - break - - line_bit = file.readline() - if line_bit is not None and not len(line_bit.strip()) == 0: - current_line += line_bit - if current_line.endswith("\n"): - yield current_line - current_line = "" - else: - time.sleep(1) - - # If the file isn't created yet, wait for a few seconds before trying again. - # Can be interrupted with the stopping_event. - while not os.path.exists(os.environ["GIT_LFS_PROGRESS"]): - if stopping_event.is_set(): - close_pbars() - return - - time.sleep(2) - - for line in tail_file(os.environ["GIT_LFS_PROGRESS"]): - try: - state, file_progress, byte_progress, filename = line.split() - except ValueError as error: - # Try/except to ease debugging. See https://github.com/huggingface/huggingface_hub/issues/1373. - raise ValueError(f"Cannot unpack LFS progress line:\n{line}") from error - description = f"{state.capitalize()} file {filename}" - - current_bytes, total_bytes = byte_progress.split("/") - current_bytes_int = int(current_bytes) - total_bytes_int = int(total_bytes) - - pbar = pbars.get((state, filename)) - if pbar is None: - # Initialize progress bar - pbars[(state, filename)] = { - "bar": tqdm( - desc=description, - initial=current_bytes_int, - total=total_bytes_int, - unit="B", - unit_scale=True, - unit_divisor=1024, - ), - "past_bytes": int(current_bytes), - } - else: - # Update progress bar - pbar["bar"].update(current_bytes_int - pbar["past_bytes"]) - pbar["past_bytes"] = current_bytes_int - - current_lfs_progress_value = os.environ.get("GIT_LFS_PROGRESS", "") - - with SoftTemporaryDirectory() as tmpdir: - os.environ["GIT_LFS_PROGRESS"] = os.path.join(tmpdir, "lfs_progress") - logger.debug(f"Following progress in {os.environ['GIT_LFS_PROGRESS']}") - - exit_event = threading.Event() - x = threading.Thread(target=output_progress, args=(exit_event,), daemon=True) - x.start() - - try: - yield - finally: - exit_event.set() - x.join() - - os.environ["GIT_LFS_PROGRESS"] = current_lfs_progress_value - - -class Repository: - """ - Helper class to wrap the git and git-lfs commands. - - The aim is to facilitate interacting with huggingface.co hosted model or - dataset repos, though not a lot here (if any) is actually specific to - huggingface.co. - """ - - command_queue: List[CommandInProgress] - - @validate_hf_hub_args - def __init__( - self, - local_dir: Union[str, Path], - clone_from: Optional[str] = None, - repo_type: Optional[str] = None, - token: Union[bool, str] = True, - git_user: Optional[str] = None, - git_email: Optional[str] = None, - revision: Optional[str] = None, - skip_lfs_files: bool = False, - client: Optional[HfApi] = None, - ): - """ - Instantiate a local clone of a git repo. - - If `clone_from` is set, the repo will be cloned from an existing remote repository. - If the remote repo does not exist, a `EnvironmentError` exception will be thrown. - Please create the remote repo first using [`create_repo`]. - - `Repository` uses the local git credentials by default. If explicitly set, the `token` - or the `git_user`/`git_email` pair will be used instead. - - Args: - local_dir (`str` or `Path`): - path (e.g. `'my_trained_model/'`) to the local directory, where - the `Repository` will be initialized. - clone_from (`str`, *optional*): - Either a repository url or `repo_id`. - Example: - - `"https://huggingface.co/philschmid/playground-tests"` - - `"philschmid/playground-tests"` - repo_type (`str`, *optional*): - To set when cloning a repo from a repo_id. Default is model. - token (`bool` or `str`, *optional*): - A valid authentication token (see https://huggingface.co/settings/token). - If `None` or `True` and machine is logged in (through `huggingface-cli login` - or [`~huggingface_hub.login`]), token will be retrieved from the cache. - If `False`, token is not sent in the request header. - git_user (`str`, *optional*): - will override the `git config user.name` for committing and - pushing files to the hub. - git_email (`str`, *optional*): - will override the `git config user.email` for committing and - pushing files to the hub. - revision (`str`, *optional*): - Revision to checkout after initializing the repository. If the - revision doesn't exist, a branch will be created with that - revision name from the default branch's current HEAD. - skip_lfs_files (`bool`, *optional*, defaults to `False`): - whether to skip git-LFS files or not. - client (`HfApi`, *optional*): - Instance of [`HfApi`] to use when calling the HF Hub API. A new - instance will be created if this is left to `None`. - - Raises: - - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - if the remote repository set in `clone_from` does not exist. - """ - if isinstance(local_dir, Path): - local_dir = str(local_dir) - os.makedirs(local_dir, exist_ok=True) - self.local_dir = os.path.join(os.getcwd(), local_dir) - self._repo_type = repo_type - self.command_queue = [] - self.skip_lfs_files = skip_lfs_files - self.client = client if client is not None else HfApi() - - self.check_git_versions() - - if isinstance(token, str): - self.huggingface_token: Optional[str] = token - elif token is False: - self.huggingface_token = None - else: - # if `True` -> explicit use of the cached token - # if `None` -> implicit use of the cached token - self.huggingface_token = HfFolder.get_token() - - if clone_from is not None: - self.clone_from(repo_url=clone_from) - else: - if is_git_repo(self.local_dir): - logger.debug("[Repository] is a valid git repo") - else: - raise ValueError("If not specifying `clone_from`, you need to pass Repository a valid git clone.") - - if self.huggingface_token is not None and (git_email is None or git_user is None): - user = self.client.whoami(self.huggingface_token) - - if git_email is None: - git_email = user["email"] - - if git_user is None: - git_user = user["fullname"] - - if git_user is not None or git_email is not None: - self.git_config_username_and_email(git_user, git_email) - - self.lfs_enable_largefiles() - self.git_credential_helper_store() - - if revision is not None: - self.git_checkout(revision, create_branch_ok=True) - - # This ensures that all commands exit before exiting the Python runtime. - # This will ensure all pushes register on the hub, even if other errors happen in subsequent operations. - atexit.register(self.wait_for_commands) - - @property - def current_branch(self) -> str: - """ - Returns the current checked out branch. - - Returns: - `str`: Current checked out branch. - """ - try: - result = run_subprocess("git rev-parse --abbrev-ref HEAD", self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - return result - - def check_git_versions(self): - """ - Checks that `git` and `git-lfs` can be run. - - Raises: - - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - if `git` or `git-lfs` are not installed. - """ - try: - git_version = run_subprocess("git --version", self.local_dir).stdout.strip() - except FileNotFoundError: - raise EnvironmentError("Looks like you do not have git installed, please install.") - - try: - lfs_version = run_subprocess("git-lfs --version", self.local_dir).stdout.strip() - except FileNotFoundError: - raise EnvironmentError( - "Looks like you do not have git-lfs installed, please install." - " You can install from https://git-lfs.github.com/." - " Then run `git lfs install` (you only have to do this once)." - ) - logger.info(git_version + "\n" + lfs_version) - - @validate_hf_hub_args - def clone_from(self, repo_url: str, token: Union[bool, str, None] = None): - """ - Clone from a remote. If the folder already exists, will try to clone the - repository within it. - - If this folder is a git repository with linked history, will try to - update the repository. - - Args: - repo_url (`str`): - The URL from which to clone the repository - token (`Union[str, bool]`, *optional*): - Whether to use the authentication token. It can be: - - a string which is the token itself - - `False`, which would not use the authentication token - - `True`, which would fetch the authentication token from the - local folder and use it (you should be logged in for this to - work). - - `None`, which would retrieve the value of - `self.huggingface_token`. - - - - Raises the following error: - - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - if an organization token (starts with "api_org") is passed. Use must use - your own personal access token (see https://hf.co/settings/tokens). - - - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - if you are trying to clone the repository in a non-empty folder, or if the - `git` operations raise errors. - - - """ - token = ( - token # str -> use it - if isinstance(token, str) - else ( - None # `False` -> explicit no token - if token is False - else self.huggingface_token # `None` or `True` -> use default - ) - ) - if token is not None and token.startswith("api_org"): - raise ValueError( - "You must use your personal access token, not an Organization token" - " (see https://hf.co/settings/tokens)." - ) - - hub_url = self.client.endpoint - if hub_url in repo_url or ("http" not in repo_url and len(repo_url.split("/")) <= 2): - repo_type, namespace, repo_name = repo_type_and_id_from_hf_id(repo_url, hub_url=hub_url) - repo_id = f"{namespace}/{repo_name}" if namespace is not None else repo_name - - if repo_type is not None: - self._repo_type = repo_type - - repo_url = hub_url + "/" - - if self._repo_type in REPO_TYPES_URL_PREFIXES: - repo_url += REPO_TYPES_URL_PREFIXES[self._repo_type] - - if token is not None: - # Add token in git url when provided - scheme = urlparse(repo_url).scheme - repo_url = repo_url.replace(f"{scheme}://", f"{scheme}://user:{token}@") - - repo_url += repo_id - - # For error messages, it's cleaner to show the repo url without the token. - clean_repo_url = re.sub(r"(https?)://.*@", r"\1://", repo_url) - try: - run_subprocess("git lfs install", self.local_dir) - - # checks if repository is initialized in a empty repository or in one with files - if len(os.listdir(self.local_dir)) == 0: - logger.warning(f"Cloning {clean_repo_url} into local empty directory.") - - with _lfs_log_progress(): - env = os.environ.copy() - - if self.skip_lfs_files: - env.update({"GIT_LFS_SKIP_SMUDGE": "1"}) - - run_subprocess( - # 'git lfs clone' is deprecated (will display a warning in the terminal) - # but we still use it as it provides a nicer UX when downloading large - # files (shows progress). - f"{'git clone' if self.skip_lfs_files else 'git lfs clone'} {repo_url} .", - self.local_dir, - env=env, - ) - else: - # Check if the folder is the root of a git repository - if not is_git_repo(self.local_dir): - raise EnvironmentError( - "Tried to clone a repository in a non-empty folder that isn't" - f" a git repository ('{self.local_dir}'). If you really want to" - f" do this, do it manually:\n cd {self.local_dir} && git init" - " && git remote add origin && git pull origin main\n or clone" - " repo to a new folder and move your existing files there" - " afterwards." - ) - - if is_local_clone(self.local_dir, repo_url): - logger.warning( - f"{self.local_dir} is already a clone of {clean_repo_url}." - " Make sure you pull the latest changes with" - " `repo.git_pull()`." - ) - else: - output = run_subprocess("git remote get-url origin", self.local_dir, check=False) - - error_msg = ( - f"Tried to clone {clean_repo_url} in an unrelated git" - " repository.\nIf you believe this is an error, please add" - f" a remote with the following URL: {clean_repo_url}." - ) - if output.returncode == 0: - clean_local_remote_url = re.sub(r"https://.*@", "https://", output.stdout) - error_msg += f"\nLocal path has its origin defined as: {clean_local_remote_url}" - raise EnvironmentError(error_msg) - - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def git_config_username_and_email(self, git_user: Optional[str] = None, git_email: Optional[str] = None): - """ - Sets git username and email (only in the current repo). - - Args: - git_user (`str`, *optional*): - The username to register through `git`. - git_email (`str`, *optional*): - The email to register through `git`. - """ - try: - if git_user is not None: - run_subprocess("git config user.name".split() + [git_user], self.local_dir) - - if git_email is not None: - run_subprocess(f"git config user.email {git_email}".split(), self.local_dir) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def git_credential_helper_store(self): - """ - Sets the git credential helper to `store` - """ - try: - run_subprocess("git config credential.helper store", self.local_dir) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def git_head_hash(self) -> str: - """ - Get commit sha on top of HEAD. - - Returns: - `str`: The current checked out commit SHA. - """ - try: - p = run_subprocess("git rev-parse HEAD", self.local_dir) - return p.stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def git_remote_url(self) -> str: - """ - Get URL to origin remote. - - Returns: - `str`: The URL of the `origin` remote. - """ - try: - p = run_subprocess("git config --get remote.origin.url", self.local_dir) - url = p.stdout.strip() - # Strip basic auth info. - return re.sub(r"https://.*@", "https://", url) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def git_head_commit_url(self) -> str: - """ - Get URL to last commit on HEAD. We assume it's been pushed, and the url - scheme is the same one as for GitHub or HuggingFace. - - Returns: - `str`: The URL to the current checked-out commit. - """ - sha = self.git_head_hash() - url = self.git_remote_url() - if url.endswith("/"): - url = url[:-1] - return f"{url}/commit/{sha}" - - def list_deleted_files(self) -> List[str]: - """ - Returns a list of the files that are deleted in the working directory or - index. - - Returns: - `List[str]`: A list of files that have been deleted in the working - directory or index. - """ - try: - git_status = run_subprocess("git status -s", self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - if len(git_status) == 0: - return [] - - # Receives a status like the following - # D .gitignore - # D new_file.json - # AD new_file1.json - # ?? new_file2.json - # ?? new_file4.json - - # Strip each line of whitespaces - modified_files_statuses = [status.strip() for status in git_status.split("\n")] - - # Only keep files that are deleted using the D prefix - deleted_files_statuses = [status for status in modified_files_statuses if "D" in status.split()[0]] - - # Remove the D prefix and strip to keep only the relevant filename - deleted_files = [status.split()[-1].strip() for status in deleted_files_statuses] - - return deleted_files - - def lfs_track(self, patterns: Union[str, List[str]], filename: bool = False): - """ - Tell git-lfs to track files according to a pattern. - - Setting the `filename` argument to `True` will treat the arguments as - literal filenames, not as patterns. Any special glob characters in the - filename will be escaped when writing to the `.gitattributes` file. - - Args: - patterns (`Union[str, List[str]]`): - The pattern, or list of patterns, to track with git-lfs. - filename (`bool`, *optional*, defaults to `False`): - Whether to use the patterns as literal filenames. - """ - if isinstance(patterns, str): - patterns = [patterns] - try: - for pattern in patterns: - run_subprocess( - f"git lfs track {'--filename' if filename else ''} {pattern}", - self.local_dir, - ) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def lfs_untrack(self, patterns: Union[str, List[str]]): - """ - Tell git-lfs to untrack those files. - - Args: - patterns (`Union[str, List[str]]`): - The pattern, or list of patterns, to untrack with git-lfs. - """ - if isinstance(patterns, str): - patterns = [patterns] - try: - for pattern in patterns: - run_subprocess("git lfs untrack".split() + [pattern], self.local_dir) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def lfs_enable_largefiles(self): - """ - HF-specific. This enables upload support of files >5GB. - """ - try: - lfs_config = "git config lfs.customtransfer.multipart" - run_subprocess(f"{lfs_config}.path huggingface-cli", self.local_dir) - run_subprocess( - f"{lfs_config}.args {LFS_MULTIPART_UPLOAD_COMMAND}", - self.local_dir, - ) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def auto_track_binary_files(self, pattern: str = ".") -> List[str]: - """ - Automatically track binary files with git-lfs. - - Args: - pattern (`str`, *optional*, defaults to "."): - The pattern with which to track files that are binary. - - Returns: - `List[str]`: List of filenames that are now tracked due to being - binary files - """ - files_to_be_tracked_with_lfs = [] - - deleted_files = self.list_deleted_files() - - for filename in files_to_be_staged(pattern, folder=self.local_dir): - if filename in deleted_files: - continue - - path_to_file = os.path.join(os.getcwd(), self.local_dir, filename) - - if not (is_tracked_with_lfs(path_to_file) or is_git_ignored(path_to_file)): - size_in_mb = os.path.getsize(path_to_file) / (1024 * 1024) - - if size_in_mb >= 10: - logger.warning( - "Parsing a large file to check if binary or not. Tracking large" - " files using `repository.auto_track_large_files` is" - " recommended so as to not load the full file in memory." - ) - - is_binary = is_binary_file(path_to_file) - - if is_binary: - self.lfs_track(filename) - files_to_be_tracked_with_lfs.append(filename) - - # Cleanup the .gitattributes if files were deleted - self.lfs_untrack(deleted_files) - - return files_to_be_tracked_with_lfs - - def auto_track_large_files(self, pattern: str = ".") -> List[str]: - """ - Automatically track large files (files that weigh more than 10MBs) with - git-lfs. - - Args: - pattern (`str`, *optional*, defaults to "."): - The pattern with which to track files that are above 10MBs. - - Returns: - `List[str]`: List of filenames that are now tracked due to their - size. - """ - files_to_be_tracked_with_lfs = [] - - deleted_files = self.list_deleted_files() - - for filename in files_to_be_staged(pattern, folder=self.local_dir): - if filename in deleted_files: - continue - - path_to_file = os.path.join(os.getcwd(), self.local_dir, filename) - size_in_mb = os.path.getsize(path_to_file) / (1024 * 1024) - - if size_in_mb >= 10 and not is_tracked_with_lfs(path_to_file) and not is_git_ignored(path_to_file): - self.lfs_track(filename) - files_to_be_tracked_with_lfs.append(filename) - - # Cleanup the .gitattributes if files were deleted - self.lfs_untrack(deleted_files) - - return files_to_be_tracked_with_lfs - - def lfs_prune(self, recent=False): - """ - git lfs prune - - Args: - recent (`bool`, *optional*, defaults to `False`): - Whether to prune files even if they were referenced by recent - commits. See the following - [link](https://github.com/git-lfs/git-lfs/blob/f3d43f0428a84fc4f1e5405b76b5a73ec2437e65/docs/man/git-lfs-prune.1.ronn#recent-files) - for more information. - """ - try: - with _lfs_log_progress(): - result = run_subprocess(f"git lfs prune {'--recent' if recent else ''}", self.local_dir) - logger.info(result.stdout) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def git_pull(self, rebase: bool = False, lfs: bool = False): - """ - git pull - - Args: - rebase (`bool`, *optional*, defaults to `False`): - Whether to rebase the current branch on top of the upstream - branch after fetching. - lfs (`bool`, *optional*, defaults to `False`): - Whether to fetch the LFS files too. This option only changes the - behavior when a repository was cloned without fetching the LFS - files; calling `repo.git_pull(lfs=True)` will then fetch the LFS - file from the remote repository. - """ - command = "git pull" if not lfs else "git lfs pull" - if rebase: - command += " --rebase" - try: - with _lfs_log_progress(): - result = run_subprocess(command, self.local_dir) - logger.info(result.stdout) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def git_add(self, pattern: str = ".", auto_lfs_track: bool = False): - """ - git add - - Setting the `auto_lfs_track` parameter to `True` will automatically - track files that are larger than 10MB with `git-lfs`. - - Args: - pattern (`str`, *optional*, defaults to "."): - The pattern with which to add files to staging. - auto_lfs_track (`bool`, *optional*, defaults to `False`): - Whether to automatically track large and binary files with - git-lfs. Any file over 10MB in size, or in binary format, will - be automatically tracked. - """ - if auto_lfs_track: - # Track files according to their size (>=10MB) - tracked_files = self.auto_track_large_files(pattern) - - # Read the remaining files and track them if they're binary - tracked_files.extend(self.auto_track_binary_files(pattern)) - - if tracked_files: - logger.warning( - f"Adding files tracked by Git LFS: {tracked_files}. This may take a" - " bit of time if the files are large." - ) - - try: - result = run_subprocess("git add -v".split() + [pattern], self.local_dir) - logger.info(f"Adding to index:\n{result.stdout}\n") - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def git_commit(self, commit_message: str = "commit files to HF hub"): - """ - git commit - - Args: - commit_message (`str`, *optional*, defaults to "commit files to HF hub"): - The message attributed to the commit. - """ - try: - result = run_subprocess("git commit -v -m".split() + [commit_message], self.local_dir) - logger.info(f"Committed:\n{result.stdout}\n") - except subprocess.CalledProcessError as exc: - if len(exc.stderr) > 0: - raise EnvironmentError(exc.stderr) - else: - raise EnvironmentError(exc.stdout) - - def git_push( - self, - upstream: Optional[str] = None, - blocking: bool = True, - auto_lfs_prune: bool = False, - ) -> Union[str, Tuple[str, CommandInProgress]]: - """ - git push - - If used without setting `blocking`, will return url to commit on remote - repo. If used with `blocking=True`, will return a tuple containing the - url to commit and the command object to follow for information about the - process. - - Args: - upstream (`str`, *optional*): - Upstream to which this should push. If not specified, will push - to the lastly defined upstream or to the default one (`origin - main`). - blocking (`bool`, *optional*, defaults to `True`): - Whether the function should return only when the push has - finished. Setting this to `False` will return an - `CommandInProgress` object which has an `is_done` property. This - property will be set to `True` when the push is finished. - auto_lfs_prune (`bool`, *optional*, defaults to `False`): - Whether to automatically prune files once they have been pushed - to the remote. - """ - command = "git push" - - if upstream: - command += f" --set-upstream {upstream}" - - number_of_commits = commits_to_push(self.local_dir, upstream) - - if number_of_commits > 1: - logger.warning(f"Several commits ({number_of_commits}) will be pushed upstream.") - if blocking: - logger.warning("The progress bars may be unreliable.") - - try: - with _lfs_log_progress(): - process = subprocess.Popen( - command.split(), - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - encoding="utf-8", - cwd=self.local_dir, - ) - - if blocking: - stdout, stderr = process.communicate() - return_code = process.poll() - process.kill() - - if len(stderr): - logger.warning(stderr) - - if return_code: - raise subprocess.CalledProcessError(return_code, process.args, output=stdout, stderr=stderr) - - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - if not blocking: - - def status_method(): - status = process.poll() - if status is None: - return -1 - else: - return status - - command_in_progress = CommandInProgress( - "push", - is_done_method=lambda: process.poll() is not None, - status_method=status_method, - process=process, - post_method=self.lfs_prune if auto_lfs_prune else None, - ) - - self.command_queue.append(command_in_progress) - - return self.git_head_commit_url(), command_in_progress - - if auto_lfs_prune: - self.lfs_prune() - - return self.git_head_commit_url() - - def git_checkout(self, revision: str, create_branch_ok: bool = False): - """ - git checkout a given revision - - Specifying `create_branch_ok` to `True` will create the branch to the - given revision if that revision doesn't exist. - - Args: - revision (`str`): - The revision to checkout. - create_branch_ok (`str`, *optional*, defaults to `False`): - Whether creating a branch named with the `revision` passed at - the current checked-out reference if `revision` isn't an - existing revision is allowed. - """ - try: - result = run_subprocess(f"git checkout {revision}", self.local_dir) - logger.warning(f"Checked out {revision} from {self.current_branch}.") - logger.warning(result.stdout) - except subprocess.CalledProcessError as exc: - if not create_branch_ok: - raise EnvironmentError(exc.stderr) - else: - try: - result = run_subprocess(f"git checkout -b {revision}", self.local_dir) - logger.warning( - f"Revision `{revision}` does not exist. Created and checked out branch `{revision}`." - ) - logger.warning(result.stdout) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def tag_exists(self, tag_name: str, remote: Optional[str] = None) -> bool: - """ - Check if a tag exists or not. - - Args: - tag_name (`str`): - The name of the tag to check. - remote (`str`, *optional*): - Whether to check if the tag exists on a remote. This parameter - should be the identifier of the remote. - - Returns: - `bool`: Whether the tag exists. - """ - if remote: - try: - result = run_subprocess(f"git ls-remote origin refs/tags/{tag_name}", self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - return len(result) != 0 - else: - try: - git_tags = run_subprocess("git tag", self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - git_tags = git_tags.split("\n") - return tag_name in git_tags - - def delete_tag(self, tag_name: str, remote: Optional[str] = None) -> bool: - """ - Delete a tag, both local and remote, if it exists - - Args: - tag_name (`str`): - The tag name to delete. - remote (`str`, *optional*): - The remote on which to delete the tag. - - Returns: - `bool`: `True` if deleted, `False` if the tag didn't exist. - If remote is not passed, will just be updated locally - """ - delete_locally = True - delete_remotely = True - - if not self.tag_exists(tag_name): - delete_locally = False - - if not self.tag_exists(tag_name, remote=remote): - delete_remotely = False - - if delete_locally: - try: - run_subprocess(["git", "tag", "-d", tag_name], self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - if remote and delete_remotely: - try: - run_subprocess(f"git push {remote} --delete {tag_name}", self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - return True - - def add_tag(self, tag_name: str, message: Optional[str] = None, remote: Optional[str] = None): - """ - Add a tag at the current head and push it - - If remote is None, will just be updated locally - - If no message is provided, the tag will be lightweight. if a message is - provided, the tag will be annotated. - - Args: - tag_name (`str`): - The name of the tag to be added. - message (`str`, *optional*): - The message that accompanies the tag. The tag will turn into an - annotated tag if a message is passed. - remote (`str`, *optional*): - The remote on which to add the tag. - """ - if message: - tag_args = ["git", "tag", "-a", tag_name, "-m", message] - else: - tag_args = ["git", "tag", tag_name] - - try: - run_subprocess(tag_args, self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - if remote: - try: - run_subprocess(f"git push {remote} {tag_name}", self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - def is_repo_clean(self) -> bool: - """ - Return whether or not the git status is clean or not - - Returns: - `bool`: `True` if the git status is clean, `False` otherwise. - """ - try: - git_status = run_subprocess("git status --porcelain", self.local_dir).stdout.strip() - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - return len(git_status) == 0 - - def push_to_hub( - self, - commit_message: str = "commit files to HF hub", - blocking: bool = True, - clean_ok: bool = True, - auto_lfs_prune: bool = False, - ) -> Union[None, str, Tuple[str, CommandInProgress]]: - """ - Helper to add, commit, and push files to remote repository on the - HuggingFace Hub. Will automatically track large files (>10MB). - - Args: - commit_message (`str`): - Message to use for the commit. - blocking (`bool`, *optional*, defaults to `True`): - Whether the function should return only when the `git push` has - finished. - clean_ok (`bool`, *optional*, defaults to `True`): - If True, this function will return None if the repo is - untouched. Default behavior is to fail because the git command - fails. - auto_lfs_prune (`bool`, *optional*, defaults to `False`): - Whether to automatically prune files once they have been pushed - to the remote. - """ - if clean_ok and self.is_repo_clean(): - logger.info("Repo currently clean. Ignoring push_to_hub") - return None - self.git_add(auto_lfs_track=True) - self.git_commit(commit_message) - return self.git_push( - upstream=f"origin {self.current_branch}", - blocking=blocking, - auto_lfs_prune=auto_lfs_prune, - ) - - @contextmanager - def commit( - self, - commit_message: str, - branch: Optional[str] = None, - track_large_files: bool = True, - blocking: bool = True, - auto_lfs_prune: bool = False, - ): - """ - Context manager utility to handle committing to a repository. This - automatically tracks large files (>10Mb) with git-lfs. Set the - `track_large_files` argument to `False` if you wish to ignore that - behavior. - - Args: - commit_message (`str`): - Message to use for the commit. - branch (`str`, *optional*): - The branch on which the commit will appear. This branch will be - checked-out before any operation. - track_large_files (`bool`, *optional*, defaults to `True`): - Whether to automatically track large files or not. Will do so by - default. - blocking (`bool`, *optional*, defaults to `True`): - Whether the function should return only when the `git push` has - finished. - auto_lfs_prune (`bool`, defaults to `True`): - Whether to automatically prune files once they have been pushed - to the remote. - - Examples: - - ```python - >>> with Repository( - ... "text-files", - ... clone_from="/text-files", - ... token=True, - >>> ).commit("My first file :)"): - ... with open("file.txt", "w+") as f: - ... f.write(json.dumps({"hey": 8})) - - >>> import torch - - >>> model = torch.nn.Transformer() - >>> with Repository( - ... "torch-model", - ... clone_from="/torch-model", - ... token=True, - >>> ).commit("My cool model :)"): - ... torch.save(model.state_dict(), "model.pt") - ``` - - """ - - files_to_stage = files_to_be_staged(".", folder=self.local_dir) - - if len(files_to_stage): - if len(files_to_stage) > 5: - files_in_msg = str(files_to_stage[:5])[:-1] + ", ...]" - - logger.error( - "There exists some updated files in the local repository that are not" - f" committed: {files_in_msg}. This may lead to errors if checking out" - " a branch. These files and their modifications will be added to the" - " current commit." - ) - - if branch is not None: - self.git_checkout(branch, create_branch_ok=True) - - if is_tracked_upstream(self.local_dir): - logger.warning("Pulling changes ...") - self.git_pull(rebase=True) - else: - logger.warning(f"The current branch has no upstream branch. Will push to 'origin {self.current_branch}'") - - current_working_directory = os.getcwd() - os.chdir(os.path.join(current_working_directory, self.local_dir)) - - try: - yield self - finally: - self.git_add(auto_lfs_track=track_large_files) - - try: - self.git_commit(commit_message) - except OSError as e: - # If no changes are detected, there is nothing to commit. - if "nothing to commit" not in str(e): - raise e - - try: - self.git_push( - upstream=f"origin {self.current_branch}", - blocking=blocking, - auto_lfs_prune=auto_lfs_prune, - ) - except OSError as e: - # If no changes are detected, there is nothing to commit. - if "could not read Username" in str(e): - raise OSError("Couldn't authenticate user for push. Did you set `token` to `True`?") from e - else: - raise e - - os.chdir(current_working_directory) - - def repocard_metadata_load(self) -> Optional[Dict]: - filepath = os.path.join(self.local_dir, REPOCARD_NAME) - if os.path.isfile(filepath): - return metadata_load(filepath) - return None - - def repocard_metadata_save(self, data: Dict) -> None: - return metadata_save(os.path.join(self.local_dir, REPOCARD_NAME), data) - - @property - def commands_failed(self): - """ - Returns the asynchronous commands that failed. - """ - return [c for c in self.command_queue if c.status > 0] - - @property - def commands_in_progress(self): - """ - Returns the asynchronous commands that are currently in progress. - """ - return [c for c in self.command_queue if not c.is_done] - - def wait_for_commands(self): - """ - Blocking method: blocks all subsequent execution until all commands have - been processed. - """ - index = 0 - for command_failed in self.commands_failed: - logger.error(f"The {command_failed.title} command with PID {command_failed._process.pid} failed.") - logger.error(command_failed.stderr) - - while self.commands_in_progress: - if index % 10 == 0: - logger.warning( - f"Waiting for the following commands to finish before shutting down: {self.commands_in_progress}." - ) - - index += 1 - - time.sleep(1) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/templates/datasetcard_template.md b/venv/lib/python3.8/site-packages/huggingface_hub/templates/datasetcard_template.md deleted file mode 100644 index f8cb4c80bfe647627589bb2a0b58273c8478cd00..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/templates/datasetcard_template.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -# For reference on dataset card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/datasetcard.md?plain=1 -# Doc / guide: https://huggingface.co/docs/hub/datasets-cards -{{ card_data }} ---- - -# Dataset Card for {{ pretty_name | default("Dataset Name", true) }} - - - -{{ dataset_summary | default("", true) }} - -## Dataset Details - -### Dataset Description - - - -{{ dataset_description | default("", true) }} - -- **Curated by:** {{ curators | default("[More Information Needed]", true)}} -- **Funded by [optional]:** {{ funded_by | default("[More Information Needed]", true)}} -- **Shared by [optional]:** {{ shared_by | default("[More Information Needed]", true)}} -- **Language(s) (NLP):** {{ language | default("[More Information Needed]", true)}} -- **License:** {{ license | default("[More Information Needed]", true)}} - -### Dataset Sources [optional] - - - -- **Repository:** {{ repo | default("[More Information Needed]", true)}} -- **Paper [optional]:** {{ paper | default("[More Information Needed]", true)}} -- **Demo [optional]:** {{ demo | default("[More Information Needed]", true)}} - -## Uses - - - -### Direct Use - - - -{{ direct_use | default("[More Information Needed]", true)}} - -### Out-of-Scope Use - - - -{{ out_of_scope_use | default("[More Information Needed]", true)}} - -## Dataset Structure - - - -{{ dataset_structure | default("[More Information Needed]", true)}} - -## Dataset Creation - -### Curation Rationale - - - -{{ curation_rationale_section | default("[More Information Needed]", true)}} - -### Source Data - - - -#### Data Collection and Processing - - - -{{ data_collection_and_processing_section | default("[More Information Needed]", true)}} - -#### Who are the source data producers? - - - -{{ source_data_producers_section | default("[More Information Needed]", true)}} - -### Annotations [optional] - - - -#### Annotation process - - - -{{ annotation_process_section | default("[More Information Needed]", true)}} - -#### Who are the annotators? - - - -{{ who_are_annotators_section | default("[More Information Needed]", true)}} - -#### Personal and Sensitive Information - - - -{{ personal_and_sensitive_information | default("[More Information Needed]", true)}} - -## Bias, Risks, and Limitations - - - -{{ bias_risks_limitations | default("[More Information Needed]", true)}} - -### Recommendations - - - -{{ bias_recommendations | default("Users should be made aware of the risks, biases and limitations of the dataset. More information needed for further recommendations.", true)}} - -## Citation [optional] - - - -**BibTeX:** - -{{ citation_bibtex | default("[More Information Needed]", true)}} - -**APA:** - -{{ citation_apa | default("[More Information Needed]", true)}} - -## Glossary [optional] - - - -{{ glossary | default("[More Information Needed]", true)}} - -## More Information [optional] - -{{ more_information | default("[More Information Needed]", true)}} - -## Dataset Card Authors [optional] - -{{ dataset_card_authors | default("[More Information Needed]", true)}} - -## Dataset Card Contact - -{{ dataset_card_contact | default("[More Information Needed]", true)}} \ No newline at end of file diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/templates/modelcard_template.md b/venv/lib/python3.8/site-packages/huggingface_hub/templates/modelcard_template.md deleted file mode 100644 index 8c9243fbd65ddcc69ac4c54b14fc23b41dda920e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/templates/modelcard_template.md +++ /dev/null @@ -1,203 +0,0 @@ ---- -# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1 -# Doc / guide: https://huggingface.co/docs/hub/model-cards -{{ card_data }} ---- - -# Model Card for {{ model_id | default("Model ID", true) }} - - - -{{ model_summary | default("", true) }} - -## Model Details - -### Model Description - - - -{{ model_description | default("", true) }} - -- **Developed by:** {{ developers | default("[More Information Needed]", true)}} -- **Funded by [optional]:** {{ funded_by | default("[More Information Needed]", true)}} -- **Shared by [optional]:** {{ shared_by | default("[More Information Needed]", true)}} -- **Model type:** {{ model_type | default("[More Information Needed]", true)}} -- **Language(s) (NLP):** {{ language | default("[More Information Needed]", true)}} -- **License:** {{ license | default("[More Information Needed]", true)}} -- **Finetuned from model [optional]:** {{ finetuned_from | default("[More Information Needed]", true)}} - -### Model Sources [optional] - - - -- **Repository:** {{ repo | default("[More Information Needed]", true)}} -- **Paper [optional]:** {{ paper | default("[More Information Needed]", true)}} -- **Demo [optional]:** {{ demo | default("[More Information Needed]", true)}} - -## Uses - - - -### Direct Use - - - -{{ direct_use | default("[More Information Needed]", true)}} - -### Downstream Use [optional] - - - -{{ downstream_use | default("[More Information Needed]", true)}} - -### Out-of-Scope Use - - - -{{ out_of_scope_use | default("[More Information Needed]", true)}} - -## Bias, Risks, and Limitations - - - -{{ bias_risks_limitations | default("[More Information Needed]", true)}} - -### Recommendations - - - -{{ bias_recommendations | default("Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.", true)}} - -## How to Get Started with the Model - -Use the code below to get started with the model. - -{{ get_started_code | default("[More Information Needed]", true)}} - -## Training Details - -### Training Data - - - -{{ training_data | default("[More Information Needed]", true)}} - -### Training Procedure - - - -#### Preprocessing [optional] - -{{ preprocessing | default("[More Information Needed]", true)}} - - -#### Training Hyperparameters - -- **Training regime:** {{ training_regime | default("[More Information Needed]", true)}} - -#### Speeds, Sizes, Times [optional] - - - -{{ speeds_sizes_times | default("[More Information Needed]", true)}} - -## Evaluation - - - -### Testing Data, Factors & Metrics - -#### Testing Data - - - -{{ testing_data | default("[More Information Needed]", true)}} - -#### Factors - - - -{{ testing_factors | default("[More Information Needed]", true)}} - -#### Metrics - - - -{{ testing_metrics | default("[More Information Needed]", true)}} - -### Results - -{{ results | default("[More Information Needed]", true)}} - -#### Summary - -{{ results_summary | default("", true) }} - -## Model Examination [optional] - - - -{{ model_examination | default("[More Information Needed]", true)}} - -## Environmental Impact - - - -Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). - -- **Hardware Type:** {{ hardware | default("[More Information Needed]", true)}} -- **Hours used:** {{ hours_used | default("[More Information Needed]", true)}} -- **Cloud Provider:** {{ cloud_provider | default("[More Information Needed]", true)}} -- **Compute Region:** {{ cloud_region | default("[More Information Needed]", true)}} -- **Carbon Emitted:** {{ co2_emitted | default("[More Information Needed]", true)}} - -## Technical Specifications [optional] - -### Model Architecture and Objective - -{{ model_specs | default("[More Information Needed]", true)}} - -### Compute Infrastructure - -{{ compute_infrastructure | default("[More Information Needed]", true)}} - -#### Hardware - -{{ hardware | default("[More Information Needed]", true)}} - -#### Software - -{{ software | default("[More Information Needed]", true)}} - -## Citation [optional] - - - -**BibTeX:** - -{{ citation_bibtex | default("[More Information Needed]", true)}} - -**APA:** - -{{ citation_apa | default("[More Information Needed]", true)}} - -## Glossary [optional] - - - -{{ glossary | default("[More Information Needed]", true)}} - -## More Information [optional] - -{{ more_information | default("[More Information Needed]", true)}} - -## Model Card Authors [optional] - -{{ model_card_authors | default("[More Information Needed]", true)}} - -## Model Card Contact - -{{ model_card_contact | default("[More Information Needed]", true)}} - - - diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__init__.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__init__.py deleted file mode 100644 index 5a98531465b20538d806cd107333dd6393914bf8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__init__.py +++ /dev/null @@ -1,100 +0,0 @@ -# flake8: noqa -#!/usr/bin/env python -# coding=utf-8 -# Copyright 2021 The HuggingFace Inc. team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License - -from . import tqdm as _tqdm # _tqdm is the module -from ._cache_assets import cached_assets_path -from ._cache_manager import ( - CachedFileInfo, - CachedRepoInfo, - CachedRevisionInfo, - CacheNotFound, - CorruptedCacheException, - DeleteCacheStrategy, - HFCacheInfo, - scan_cache_dir, -) -from ._chunk_utils import chunk_iterable -from ._datetime import parse_datetime -from ._errors import ( - BadRequestError, - EntryNotFoundError, - FileMetadataError, - GatedRepoError, - HfHubHTTPError, - LocalEntryNotFoundError, - RepositoryNotFoundError, - RevisionNotFoundError, - hf_raise_for_status, -) -from ._fixes import SoftTemporaryDirectory, yaml_dump -from ._git_credential import list_credential_helpers, set_git_credential, unset_git_credential -from ._headers import build_hf_headers, get_token_to_send, LocalTokenNotFoundError -from ._hf_folder import HfFolder -from ._http import configure_http_backend, get_session, http_backoff -from ._pagination import paginate -from ._paths import filter_repo_objects, IGNORE_GIT_FOLDER_PATTERNS -from ._experimental import experimental -from ._runtime import ( - dump_environment_info, - get_aiohttp_version, - get_fastai_version, - get_fastcore_version, - get_gradio_version, - get_graphviz_version, - get_hf_hub_version, - get_hf_transfer_version, - get_jinja_version, - get_numpy_version, - get_pillow_version, - get_pydantic_version, - get_pydot_version, - get_python_version, - get_tensorboard_version, - get_tf_version, - get_torch_version, - is_aiohttp_available, - is_fastai_available, - is_fastcore_available, - is_numpy_available, - is_google_colab, - is_gradio_available, - is_graphviz_available, - is_hf_transfer_available, - is_jinja_available, - is_notebook, - is_pillow_available, - is_pydantic_available, - is_pydot_available, - is_tensorboard_available, - is_tf_available, - is_torch_available, -) -from ._subprocess import capture_output, run_interactive_subprocess, run_subprocess -from ._validators import ( - HFValidationError, - smoothly_deprecate_use_auth_token, - validate_hf_hub_args, - validate_repo_id, -) -from .tqdm import ( - are_progress_bars_disabled, - disable_progress_bars, - enable_progress_bars, - tqdm, - tqdm_stream_file, -) -from ._telemetry import send_telemetry diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 6db7ed89c913b2a8d04207cd71d6e8e21a6b39ec..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_cache_assets.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_cache_assets.cpython-38.pyc deleted file mode 100644 index 1d267f0dbe7e32ad7849805706019a496e617888..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_cache_assets.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_cache_manager.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_cache_manager.cpython-38.pyc deleted file mode 100644 index 346e79e20c73a99e1a0180210a96411e28966190..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_cache_manager.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_chunk_utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_chunk_utils.cpython-38.pyc deleted file mode 100644 index f3afc6e16c07622ef6672e45efe9770ca51baec1..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_chunk_utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_datetime.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_datetime.cpython-38.pyc deleted file mode 100644 index b7d7dbd18e87ca7f4dfb97fb35e45e4572fa735d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_datetime.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_deprecation.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_deprecation.cpython-38.pyc deleted file mode 100644 index ce74d19a0c4207897b584b59be20b53e70e26472..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_deprecation.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_errors.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_errors.cpython-38.pyc deleted file mode 100644 index 1e18973ccba1fcba92856c0fd2a02e8dc100110b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_errors.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_experimental.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_experimental.cpython-38.pyc deleted file mode 100644 index 97abc6ff6033119576cecfd51981e014fd17d9f0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_experimental.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_fixes.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_fixes.cpython-38.pyc deleted file mode 100644 index 2d156895327f9806b4f5048e3dfaec6a6205f15e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_fixes.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_git_credential.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_git_credential.cpython-38.pyc deleted file mode 100644 index 4f243f12c0ad6245b9afed2dbbf5f9dd3c62f991..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_git_credential.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_headers.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_headers.cpython-38.pyc deleted file mode 100644 index 7e3696e2fe22c3592a62e3949952007221545dce..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_headers.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_hf_folder.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_hf_folder.cpython-38.pyc deleted file mode 100644 index 545c2b6701b8bca068973394fa558e45f156afca..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_hf_folder.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_http.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_http.cpython-38.pyc deleted file mode 100644 index b4d93724ef98b1d0451dc5fa3a432d2975862fff..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_http.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_pagination.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_pagination.cpython-38.pyc deleted file mode 100644 index 19212be9d1e2f2eb53e32c9343edd908027d0762..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_pagination.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_paths.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_paths.cpython-38.pyc deleted file mode 100644 index 96c06561b15fbf865b7df7a722a46d8fcd2420b6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_paths.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_runtime.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_runtime.cpython-38.pyc deleted file mode 100644 index 9ffa8458ea0854355af95f3f8b0d647794e96d24..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_runtime.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_subprocess.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_subprocess.cpython-38.pyc deleted file mode 100644 index 226e043806c2d09fa04daed5d072988e77a91d93..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_subprocess.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_telemetry.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_telemetry.cpython-38.pyc deleted file mode 100644 index 1f00d1df5a19b78d80d552d8b804b940df7e7512..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_telemetry.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_typing.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_typing.cpython-38.pyc deleted file mode 100644 index b6e7ac34cb15d2106d3ff4771259d522592e4c71..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_typing.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_validators.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_validators.cpython-38.pyc deleted file mode 100644 index 5cde9d958e4c7694fae486a9748e9933dc0c917c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/_validators.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-38.pyc deleted file mode 100644 index 8c6c6b2561ba1f4175a1b3851f34df04fc4113c9..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/logging.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/logging.cpython-38.pyc deleted file mode 100644 index 93a852cf0efb4f99aff3f29e6caa2fed65f54535..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/logging.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/sha.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/sha.cpython-38.pyc deleted file mode 100644 index e2db358b276021ebdec8fcd49d8b4852f059d15b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/sha.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/tqdm.cpython-38.pyc b/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/tqdm.cpython-38.pyc deleted file mode 100644 index a19135a82d204e3b2b0fee7ae09d4e196d079c8e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/huggingface_hub/utils/__pycache__/tqdm.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_cache_assets.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_cache_assets.py deleted file mode 100644 index d6a6421e3b0ff0261079094ea2e2df5de212bce7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_cache_assets.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding=utf-8 -# Copyright 2019-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from pathlib import Path -from typing import Union - -from ..constants import HUGGINGFACE_ASSETS_CACHE - - -def cached_assets_path( - library_name: str, - namespace: str = "default", - subfolder: str = "default", - *, - assets_dir: Union[str, Path, None] = None, -): - """Return a folder path to cache arbitrary files. - - `huggingface_hub` provides a canonical folder path to store assets. This is the - recommended way to integrate cache in a downstream library as it will benefit from - the builtins tools to scan and delete the cache properly. - - The distinction is made between files cached from the Hub and assets. Files from the - Hub are cached in a git-aware manner and entirely managed by `huggingface_hub`. See - [related documentation](https://huggingface.co/docs/huggingface_hub/how-to-cache). - All other files that a downstream library caches are considered to be "assets" - (files downloaded from external sources, extracted from a .tar archive, preprocessed - for training,...). - - Once the folder path is generated, it is guaranteed to exist and to be a directory. - The path is based on 3 levels of depth: the library name, a namespace and a - subfolder. Those 3 levels grants flexibility while allowing `huggingface_hub` to - expect folders when scanning/deleting parts of the assets cache. Within a library, - it is expected that all namespaces share the same subset of subfolder names but this - is not a mandatory rule. The downstream library has then full control on which file - structure to adopt within its cache. Namespace and subfolder are optional (would - default to a `"default/"` subfolder) but library name is mandatory as we want every - downstream library to manage its own cache. - - Expected tree: - ```text - assets/ - └── datasets/ - │ ├── SQuAD/ - │ │ ├── downloaded/ - │ │ ├── extracted/ - │ │ └── processed/ - │ ├── Helsinki-NLP--tatoeba_mt/ - │ ├── downloaded/ - │ ├── extracted/ - │ └── processed/ - └── transformers/ - ├── default/ - │ ├── something/ - ├── bert-base-cased/ - │ ├── default/ - │ └── training/ - hub/ - └── models--julien-c--EsperBERTo-small/ - ├── blobs/ - │ ├── (...) - │ ├── (...) - ├── refs/ - │ └── (...) - └── [ 128] snapshots/ - ├── 2439f60ef33a0d46d85da5001d52aeda5b00ce9f/ - │ ├── (...) - └── bbc77c8132af1cc5cf678da3f1ddf2de43606d48/ - └── (...) - ``` - - - Args: - library_name (`str`): - Name of the library that will manage the cache folder. Example: `"dataset"`. - namespace (`str`, *optional*, defaults to "default"): - Namespace to which the data belongs. Example: `"SQuAD"`. - subfolder (`str`, *optional*, defaults to "default"): - Subfolder in which the data will be stored. Example: `extracted`. - assets_dir (`str`, `Path`, *optional*): - Path to the folder where assets are cached. This must not be the same folder - where Hub files are cached. Defaults to `HF_HOME / "assets"` if not provided. - Can also be set with `HUGGINGFACE_ASSETS_CACHE` environment variable. - - Returns: - Path to the cache folder (`Path`). - - Example: - ```py - >>> from huggingface_hub import cached_assets_path - - >>> cached_assets_path(library_name="datasets", namespace="SQuAD", subfolder="download") - PosixPath('/home/wauplin/.cache/huggingface/extra/datasets/SQuAD/download') - - >>> cached_assets_path(library_name="datasets", namespace="SQuAD", subfolder="extracted") - PosixPath('/home/wauplin/.cache/huggingface/extra/datasets/SQuAD/extracted') - - >>> cached_assets_path(library_name="datasets", namespace="Helsinki-NLP/tatoeba_mt") - PosixPath('/home/wauplin/.cache/huggingface/extra/datasets/Helsinki-NLP--tatoeba_mt/default') - - >>> cached_assets_path(library_name="datasets", assets_dir="/tmp/tmp123456") - PosixPath('/tmp/tmp123456/datasets/default/default') - ``` - """ - # Resolve assets_dir - if assets_dir is None: - assets_dir = HUGGINGFACE_ASSETS_CACHE - assets_dir = Path(assets_dir).expanduser().resolve() - - # Avoid names that could create path issues - for part in (" ", "/", "\\"): - library_name = library_name.replace(part, "--") - namespace = namespace.replace(part, "--") - subfolder = subfolder.replace(part, "--") - - # Path to subfolder is created - path = assets_dir / library_name / namespace / subfolder - try: - path.mkdir(exist_ok=True, parents=True) - except (FileExistsError, NotADirectoryError): - raise ValueError(f"Corrupted assets folder: cannot create directory because of an existing file ({path}).") - - # Return - return path diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_cache_manager.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_cache_manager.py deleted file mode 100644 index 16314ae472fc2d1bcb8bf15275122e7a94e8e132..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_cache_manager.py +++ /dev/null @@ -1,807 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to manage the HF cache directory.""" -import os -import shutil -import time -from collections import defaultdict -from dataclasses import dataclass -from pathlib import Path -from typing import Dict, FrozenSet, List, Literal, Optional, Set, Union - -from ..constants import HUGGINGFACE_HUB_CACHE -from . import logging - - -logger = logging.get_logger(__name__) - -REPO_TYPE_T = Literal["model", "dataset", "space"] - - -class CacheNotFound(Exception): - """Exception thrown when the Huggingface cache is not found.""" - - cache_dir: Union[str, Path] - - def __init__(self, msg: str, cache_dir: Union[str, Path], *args, **kwargs): - super().__init__(msg, *args, **kwargs) - self.cache_dir = cache_dir - - -class CorruptedCacheException(Exception): - """Exception for any unexpected structure in the Huggingface cache-system.""" - - -@dataclass(frozen=True) -class CachedFileInfo: - """Frozen data structure holding information about a single cached file. - - Args: - file_name (`str`): - Name of the file. Example: `config.json`. - file_path (`Path`): - Path of the file in the `snapshots` directory. The file path is a symlink - referring to a blob in the `blobs` folder. - blob_path (`Path`): - Path of the blob file. This is equivalent to `file_path.resolve()`. - size_on_disk (`int`): - Size of the blob file in bytes. - blob_last_accessed (`float`): - Timestamp of the last time the blob file has been accessed (from any - revision). - blob_last_modified (`float`): - Timestamp of the last time the blob file has been modified/created. - - - - `blob_last_accessed` and `blob_last_modified` reliability can depend on the OS you - are using. See [python documentation](https://docs.python.org/3/library/os.html#os.stat_result) - for more details. - - - """ - - file_name: str - file_path: Path - blob_path: Path - size_on_disk: int - - blob_last_accessed: float - blob_last_modified: float - - @property - def blob_last_accessed_str(self) -> str: - """ - (property) Timestamp of the last time the blob file has been accessed (from any - revision), returned as a human-readable string. - - Example: "2 weeks ago". - """ - return _format_timesince(self.blob_last_accessed) - - @property - def blob_last_modified_str(self) -> str: - """ - (property) Timestamp of the last time the blob file has been modified, returned - as a human-readable string. - - Example: "2 weeks ago". - """ - return _format_timesince(self.blob_last_modified) - - @property - def size_on_disk_str(self) -> str: - """ - (property) Size of the blob file as a human-readable string. - - Example: "42.2K". - """ - return _format_size(self.size_on_disk) - - -@dataclass(frozen=True) -class CachedRevisionInfo: - """Frozen data structure holding information about a revision. - - A revision correspond to a folder in the `snapshots` folder and is populated with - the exact tree structure as the repo on the Hub but contains only symlinks. A - revision can be either referenced by 1 or more `refs` or be "detached" (no refs). - - Args: - commit_hash (`str`): - Hash of the revision (unique). - Example: `"9338f7b671827df886678df2bdd7cc7b4f36dffd"`. - snapshot_path (`Path`): - Path to the revision directory in the `snapshots` folder. It contains the - exact tree structure as the repo on the Hub. - files: (`FrozenSet[CachedFileInfo]`): - Set of [`~CachedFileInfo`] describing all files contained in the snapshot. - refs (`FrozenSet[str]`): - Set of `refs` pointing to this revision. If the revision has no `refs`, it - is considered detached. - Example: `{"main", "2.4.0"}` or `{"refs/pr/1"}`. - size_on_disk (`int`): - Sum of the blob file sizes that are symlink-ed by the revision. - last_modified (`float`): - Timestamp of the last time the revision has been created/modified. - - - - `last_accessed` cannot be determined correctly on a single revision as blob files - are shared across revisions. - - - - - - `size_on_disk` is not necessarily the sum of all file sizes because of possible - duplicated files. Besides, only blobs are taken into account, not the (negligible) - size of folders and symlinks. - - - """ - - commit_hash: str - snapshot_path: Path - size_on_disk: int - files: FrozenSet[CachedFileInfo] - refs: FrozenSet[str] - - last_modified: float - - @property - def last_modified_str(self) -> str: - """ - (property) Timestamp of the last time the revision has been modified, returned - as a human-readable string. - - Example: "2 weeks ago". - """ - return _format_timesince(self.last_modified) - - @property - def size_on_disk_str(self) -> str: - """ - (property) Sum of the blob file sizes as a human-readable string. - - Example: "42.2K". - """ - return _format_size(self.size_on_disk) - - @property - def nb_files(self) -> int: - """ - (property) Total number of files in the revision. - """ - return len(self.files) - - -@dataclass(frozen=True) -class CachedRepoInfo: - """Frozen data structure holding information about a cached repository. - - Args: - repo_id (`str`): - Repo id of the repo on the Hub. Example: `"google/fleurs"`. - repo_type (`Literal["dataset", "model", "space"]`): - Type of the cached repo. - repo_path (`Path`): - Local path to the cached repo. - size_on_disk (`int`): - Sum of the blob file sizes in the cached repo. - nb_files (`int`): - Total number of blob files in the cached repo. - revisions (`FrozenSet[CachedRevisionInfo]`): - Set of [`~CachedRevisionInfo`] describing all revisions cached in the repo. - last_accessed (`float`): - Timestamp of the last time a blob file of the repo has been accessed. - last_modified (`float`): - Timestamp of the last time a blob file of the repo has been modified/created. - - - - `size_on_disk` is not necessarily the sum of all revisions sizes because of - duplicated files. Besides, only blobs are taken into account, not the (negligible) - size of folders and symlinks. - - - - - - `last_accessed` and `last_modified` reliability can depend on the OS you are using. - See [python documentation](https://docs.python.org/3/library/os.html#os.stat_result) - for more details. - - - """ - - repo_id: str - repo_type: REPO_TYPE_T - repo_path: Path - size_on_disk: int - nb_files: int - revisions: FrozenSet[CachedRevisionInfo] - - last_accessed: float - last_modified: float - - @property - def last_accessed_str(self) -> str: - """ - (property) Last time a blob file of the repo has been accessed, returned as a - human-readable string. - - Example: "2 weeks ago". - """ - return _format_timesince(self.last_accessed) - - @property - def last_modified_str(self) -> str: - """ - (property) Last time a blob file of the repo has been modified, returned as a - human-readable string. - - Example: "2 weeks ago". - """ - return _format_timesince(self.last_modified) - - @property - def size_on_disk_str(self) -> str: - """ - (property) Sum of the blob file sizes as a human-readable string. - - Example: "42.2K". - """ - return _format_size(self.size_on_disk) - - @property - def refs(self) -> Dict[str, CachedRevisionInfo]: - """ - (property) Mapping between `refs` and revision data structures. - """ - return {ref: revision for revision in self.revisions for ref in revision.refs} - - -@dataclass(frozen=True) -class DeleteCacheStrategy: - """Frozen data structure holding the strategy to delete cached revisions. - - This object is not meant to be instantiated programmatically but to be returned by - [`~utils.HFCacheInfo.delete_revisions`]. See documentation for usage example. - - Args: - expected_freed_size (`float`): - Expected freed size once strategy is executed. - blobs (`FrozenSet[Path]`): - Set of blob file paths to be deleted. - refs (`FrozenSet[Path]`): - Set of reference file paths to be deleted. - repos (`FrozenSet[Path]`): - Set of entire repo paths to be deleted. - snapshots (`FrozenSet[Path]`): - Set of snapshots to be deleted (directory of symlinks). - """ - - expected_freed_size: int - blobs: FrozenSet[Path] - refs: FrozenSet[Path] - repos: FrozenSet[Path] - snapshots: FrozenSet[Path] - - @property - def expected_freed_size_str(self) -> str: - """ - (property) Expected size that will be freed as a human-readable string. - - Example: "42.2K". - """ - return _format_size(self.expected_freed_size) - - def execute(self) -> None: - """Execute the defined strategy. - - - - If this method is interrupted, the cache might get corrupted. Deletion order is - implemented so that references and symlinks are deleted before the actual blob - files. - - - - - - This method is irreversible. If executed, cached files are erased and must be - downloaded again. - - - """ - # Deletion order matters. Blobs are deleted in last so that the user can't end - # up in a state where a `ref`` refers to a missing snapshot or a snapshot - # symlink refers to a deleted blob. - - # Delete entire repos - for path in self.repos: - _try_delete_path(path, path_type="repo") - - # Delete snapshot directories - for path in self.snapshots: - _try_delete_path(path, path_type="snapshot") - - # Delete refs files - for path in self.refs: - _try_delete_path(path, path_type="ref") - - # Delete blob files - for path in self.blobs: - _try_delete_path(path, path_type="blob") - - logger.info(f"Cache deletion done. Saved {self.expected_freed_size_str}.") - - -@dataclass(frozen=True) -class HFCacheInfo: - """Frozen data structure holding information about the entire cache-system. - - This data structure is returned by [`scan_cache_dir`] and is immutable. - - Args: - size_on_disk (`int`): - Sum of all valid repo sizes in the cache-system. - repos (`FrozenSet[CachedRepoInfo]`): - Set of [`~CachedRepoInfo`] describing all valid cached repos found on the - cache-system while scanning. - warnings (`List[CorruptedCacheException]`): - List of [`~CorruptedCacheException`] that occurred while scanning the cache. - Those exceptions are captured so that the scan can continue. Corrupted repos - are skipped from the scan. - - - - Here `size_on_disk` is equal to the sum of all repo sizes (only blobs). However if - some cached repos are corrupted, their sizes are not taken into account. - - - """ - - size_on_disk: int - repos: FrozenSet[CachedRepoInfo] - warnings: List[CorruptedCacheException] - - @property - def size_on_disk_str(self) -> str: - """ - (property) Sum of all valid repo sizes in the cache-system as a human-readable - string. - - Example: "42.2K". - """ - return _format_size(self.size_on_disk) - - def delete_revisions(self, *revisions: str) -> DeleteCacheStrategy: - """Prepare the strategy to delete one or more revisions cached locally. - - Input revisions can be any revision hash. If a revision hash is not found in the - local cache, a warning is thrown but no error is raised. Revisions can be from - different cached repos since hashes are unique across repos, - - Examples: - ```py - >>> from huggingface_hub import scan_cache_dir - >>> cache_info = scan_cache_dir() - >>> delete_strategy = cache_info.delete_revisions( - ... "81fd1d6e7847c99f5862c9fb81387956d99ec7aa" - ... ) - >>> print(f"Will free {delete_strategy.expected_freed_size_str}.") - Will free 7.9K. - >>> delete_strategy.execute() - Cache deletion done. Saved 7.9K. - ``` - - ```py - >>> from huggingface_hub import scan_cache_dir - >>> scan_cache_dir().delete_revisions( - ... "81fd1d6e7847c99f5862c9fb81387956d99ec7aa", - ... "e2983b237dccf3ab4937c97fa717319a9ca1a96d", - ... "6c0e6080953db56375760c0471a8c5f2929baf11", - ... ).execute() - Cache deletion done. Saved 8.6G. - ``` - - - - `delete_revisions` returns a [`~utils.DeleteCacheStrategy`] object that needs to - be executed. The [`~utils.DeleteCacheStrategy`] is not meant to be modified but - allows having a dry run before actually executing the deletion. - - - """ - hashes_to_delete: Set[str] = set(revisions) - - repos_with_revisions: Dict[CachedRepoInfo, Set[CachedRevisionInfo]] = defaultdict(set) - - for repo in self.repos: - for revision in repo.revisions: - if revision.commit_hash in hashes_to_delete: - repos_with_revisions[repo].add(revision) - hashes_to_delete.remove(revision.commit_hash) - - if len(hashes_to_delete) > 0: - logger.warning(f"Revision(s) not found - cannot delete them: {', '.join(hashes_to_delete)}") - - delete_strategy_blobs: Set[Path] = set() - delete_strategy_refs: Set[Path] = set() - delete_strategy_repos: Set[Path] = set() - delete_strategy_snapshots: Set[Path] = set() - delete_strategy_expected_freed_size = 0 - - for affected_repo, revisions_to_delete in repos_with_revisions.items(): - other_revisions = affected_repo.revisions - revisions_to_delete - - # If no other revisions, it means all revisions are deleted - # -> delete the entire cached repo - if len(other_revisions) == 0: - delete_strategy_repos.add(affected_repo.repo_path) - delete_strategy_expected_freed_size += affected_repo.size_on_disk - continue - - # Some revisions of the repo will be deleted but not all. We need to filter - # which blob files will not be linked anymore. - for revision_to_delete in revisions_to_delete: - # Snapshot dir - delete_strategy_snapshots.add(revision_to_delete.snapshot_path) - - # Refs dir - for ref in revision_to_delete.refs: - delete_strategy_refs.add(affected_repo.repo_path / "refs" / ref) - - # Blobs dir - for file in revision_to_delete.files: - if file.blob_path not in delete_strategy_blobs: - is_file_alone = True - for revision in other_revisions: - for rev_file in revision.files: - if file.blob_path == rev_file.blob_path: - is_file_alone = False - break - if not is_file_alone: - break - - # Blob file not referenced by remaining revisions -> delete - if is_file_alone: - delete_strategy_blobs.add(file.blob_path) - delete_strategy_expected_freed_size += file.size_on_disk - - # Return the strategy instead of executing it. - return DeleteCacheStrategy( - blobs=frozenset(delete_strategy_blobs), - refs=frozenset(delete_strategy_refs), - repos=frozenset(delete_strategy_repos), - snapshots=frozenset(delete_strategy_snapshots), - expected_freed_size=delete_strategy_expected_freed_size, - ) - - -def scan_cache_dir(cache_dir: Optional[Union[str, Path]] = None) -> HFCacheInfo: - """Scan the entire HF cache-system and return a [`~HFCacheInfo`] structure. - - Use `scan_cache_dir` in order to programmatically scan your cache-system. The cache - will be scanned repo by repo. If a repo is corrupted, a [`~CorruptedCacheException`] - will be thrown internally but captured and returned in the [`~HFCacheInfo`] - structure. Only valid repos get a proper report. - - ```py - >>> from huggingface_hub import scan_cache_dir - - >>> hf_cache_info = scan_cache_dir() - HFCacheInfo( - size_on_disk=3398085269, - repos=frozenset({ - CachedRepoInfo( - repo_id='t5-small', - repo_type='model', - repo_path=PosixPath(...), - size_on_disk=970726914, - nb_files=11, - revisions=frozenset({ - CachedRevisionInfo( - commit_hash='d78aea13fa7ecd06c29e3e46195d6341255065d5', - size_on_disk=970726339, - snapshot_path=PosixPath(...), - files=frozenset({ - CachedFileInfo( - file_name='config.json', - size_on_disk=1197 - file_path=PosixPath(...), - blob_path=PosixPath(...), - ), - CachedFileInfo(...), - ... - }), - ), - CachedRevisionInfo(...), - ... - }), - ), - CachedRepoInfo(...), - ... - }), - warnings=[ - CorruptedCacheException("Snapshots dir doesn't exist in cached repo: ..."), - CorruptedCacheException(...), - ... - ], - ) - ``` - - You can also print a detailed report directly from the `huggingface-cli` using: - ```text - > huggingface-cli scan-cache - REPO ID REPO TYPE SIZE ON DISK NB FILES REFS LOCAL PATH - --------------------------- --------- ------------ -------- ------------------- ------------------------------------------------------------------------- - glue dataset 116.3K 15 1.17.0, main, 2.4.0 /Users/lucain/.cache/huggingface/hub/datasets--glue - google/fleurs dataset 64.9M 6 main, refs/pr/1 /Users/lucain/.cache/huggingface/hub/datasets--google--fleurs - Jean-Baptiste/camembert-ner model 441.0M 7 main /Users/lucain/.cache/huggingface/hub/models--Jean-Baptiste--camembert-ner - bert-base-cased model 1.9G 13 main /Users/lucain/.cache/huggingface/hub/models--bert-base-cased - t5-base model 10.1K 3 main /Users/lucain/.cache/huggingface/hub/models--t5-base - t5-small model 970.7M 11 refs/pr/1, main /Users/lucain/.cache/huggingface/hub/models--t5-small - - Done in 0.0s. Scanned 6 repo(s) for a total of 3.4G. - Got 1 warning(s) while scanning. Use -vvv to print details. - ``` - - Args: - cache_dir (`str` or `Path`, `optional`): - Cache directory to cache. Defaults to the default HF cache directory. - - - - Raises: - - `CacheNotFound` - If the cache directory does not exist. - - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If the cache directory is a file, instead of a directory. - - - - Returns: a [`~HFCacheInfo`] object. - """ - if cache_dir is None: - cache_dir = HUGGINGFACE_HUB_CACHE - - cache_dir = Path(cache_dir).expanduser().resolve() - if not cache_dir.exists(): - raise CacheNotFound( - f"Cache directory not found: {cache_dir}. Please use `cache_dir`" - " argument or set `HUGGINGFACE_HUB_CACHE` environment variable.", - cache_dir=cache_dir, - ) - - if cache_dir.is_file(): - raise ValueError( - f"Scan cache expects a directory but found a file: {cache_dir}. Please use" - " `cache_dir` argument or set `HUGGINGFACE_HUB_CACHE` environment" - " variable." - ) - - repos: Set[CachedRepoInfo] = set() - warnings: List[CorruptedCacheException] = [] - for repo_path in cache_dir.iterdir(): - try: - repos.add(_scan_cached_repo(repo_path)) - except CorruptedCacheException as e: - warnings.append(e) - - return HFCacheInfo( - repos=frozenset(repos), - size_on_disk=sum(repo.size_on_disk for repo in repos), - warnings=warnings, - ) - - -def _scan_cached_repo(repo_path: Path) -> CachedRepoInfo: - """Scan a single cache repo and return information about it. - - Any unexpected behavior will raise a [`~CorruptedCacheException`]. - """ - if not repo_path.is_dir(): - raise CorruptedCacheException(f"Repo path is not a directory: {repo_path}") - - if "--" not in repo_path.name: - raise CorruptedCacheException(f"Repo path is not a valid HuggingFace cache directory: {repo_path}") - - repo_type, repo_id = repo_path.name.split("--", maxsplit=1) - repo_type = repo_type[:-1] # "models" -> "model" - repo_id = repo_id.replace("--", "/") # google/fleurs -> "google/fleurs" - - if repo_type not in {"dataset", "model", "space"}: - raise CorruptedCacheException( - f"Repo type must be `dataset`, `model` or `space`, found `{repo_type}` ({repo_path})." - ) - - blob_stats: Dict[Path, os.stat_result] = {} # Key is blob_path, value is blob stats - - snapshots_path = repo_path / "snapshots" - refs_path = repo_path / "refs" - - if not snapshots_path.exists() or not snapshots_path.is_dir(): - raise CorruptedCacheException(f"Snapshots dir doesn't exist in cached repo: {snapshots_path}") - - # Scan over `refs` directory - - # key is revision hash, value is set of refs - refs_by_hash: Dict[str, Set[str]] = defaultdict(set) - if refs_path.exists(): - # Example of `refs` directory - # ── refs - # ├── main - # └── refs - # └── pr - # └── 1 - if refs_path.is_file(): - raise CorruptedCacheException(f"Refs directory cannot be a file: {refs_path}") - - for ref_path in refs_path.glob("**/*"): - # glob("**/*") iterates over all files and directories -> skip directories - if ref_path.is_dir(): - continue - - ref_name = str(ref_path.relative_to(refs_path)) - with ref_path.open() as f: - commit_hash = f.read() - - refs_by_hash[commit_hash].add(ref_name) - - # Scan snapshots directory - cached_revisions: Set[CachedRevisionInfo] = set() - for revision_path in snapshots_path.iterdir(): - if revision_path.is_file(): - raise CorruptedCacheException(f"Snapshots folder corrupted. Found a file: {revision_path}") - - cached_files = set() - for file_path in revision_path.glob("**/*"): - # glob("**/*") iterates over all files and directories -> skip directories - if file_path.is_dir(): - continue - - blob_path = Path(file_path).resolve() - if not blob_path.exists(): - raise CorruptedCacheException(f"Blob missing (broken symlink): {blob_path}") - - if blob_path not in blob_stats: - blob_stats[blob_path] = blob_path.stat() - - cached_files.add( - CachedFileInfo( - file_name=file_path.name, - file_path=file_path, - size_on_disk=blob_stats[blob_path].st_size, - blob_path=blob_path, - blob_last_accessed=blob_stats[blob_path].st_atime, - blob_last_modified=blob_stats[blob_path].st_mtime, - ) - ) - - # Last modified is either the last modified blob file or the revision folder - # itself if it is empty - if len(cached_files) > 0: - revision_last_modified = max(blob_stats[file.blob_path].st_mtime for file in cached_files) - else: - revision_last_modified = revision_path.stat().st_mtime - - cached_revisions.add( - CachedRevisionInfo( - commit_hash=revision_path.name, - files=frozenset(cached_files), - refs=frozenset(refs_by_hash.pop(revision_path.name, set())), - size_on_disk=sum( - blob_stats[blob_path].st_size for blob_path in set(file.blob_path for file in cached_files) - ), - snapshot_path=revision_path, - last_modified=revision_last_modified, - ) - ) - - # Check that all refs referred to an existing revision - if len(refs_by_hash) > 0: - raise CorruptedCacheException( - f"Reference(s) refer to missing commit hashes: {dict(refs_by_hash)} ({repo_path})." - ) - - # Last modified is either the last modified blob file or the repo folder itself if - # no blob files has been found. Same for last accessed. - if len(blob_stats) > 0: - repo_last_accessed = max(stat.st_atime for stat in blob_stats.values()) - repo_last_modified = max(stat.st_mtime for stat in blob_stats.values()) - else: - repo_stats = repo_path.stat() - repo_last_accessed = repo_stats.st_atime - repo_last_modified = repo_stats.st_mtime - - # Build and return frozen structure - return CachedRepoInfo( - nb_files=len(blob_stats), - repo_id=repo_id, - repo_path=repo_path, - repo_type=repo_type, # type: ignore - revisions=frozenset(cached_revisions), - size_on_disk=sum(stat.st_size for stat in blob_stats.values()), - last_accessed=repo_last_accessed, - last_modified=repo_last_modified, - ) - - -def _format_size(num: int) -> str: - """Format size in bytes into a human-readable string. - - Taken from https://stackoverflow.com/a/1094933 - """ - num_f = float(num) - for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]: - if abs(num_f) < 1000.0: - return f"{num_f:3.1f}{unit}" - num_f /= 1000.0 - return f"{num_f:.1f}Y" - - -_TIMESINCE_CHUNKS = ( - # Label, divider, max value - ("second", 1, 60), - ("minute", 60, 60), - ("hour", 60 * 60, 24), - ("day", 60 * 60 * 24, 6), - ("week", 60 * 60 * 24 * 7, 6), - ("month", 60 * 60 * 24 * 30, 11), - ("year", 60 * 60 * 24 * 365, None), -) - - -def _format_timesince(ts: float) -> str: - """Format timestamp in seconds into a human-readable string, relative to now. - - Vaguely inspired by Django's `timesince` formatter. - """ - delta = time.time() - ts - if delta < 20: - return "a few seconds ago" - for label, divider, max_value in _TIMESINCE_CHUNKS: # noqa: B007 - value = round(delta / divider) - if max_value is not None and value <= max_value: - break - return f"{value} {label}{'s' if value > 1 else ''} ago" - - -def _try_delete_path(path: Path, path_type: str) -> None: - """Try to delete a local file or folder. - - If the path does not exists, error is logged as a warning and then ignored. - - Args: - path (`Path`) - Path to delete. Can be a file or a folder. - path_type (`str`) - What path are we deleting ? Only for logging purposes. Example: "snapshot". - """ - logger.info(f"Delete {path_type}: {path}") - try: - if path.is_file(): - os.remove(path) - else: - shutil.rmtree(path) - except FileNotFoundError: - logger.warning(f"Couldn't delete {path_type}: file not found ({path})", exc_info=True) - except PermissionError: - logger.warning(f"Couldn't delete {path_type}: permission denied ({path})", exc_info=True) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_chunk_utils.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_chunk_utils.py deleted file mode 100644 index 5ff0b8125ece381b1270754669ae8e708c370f61..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_chunk_utils.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains a utility to iterate by chunks over an iterator.""" -import itertools -from typing import Iterable, TypeVar - - -T = TypeVar("T") - - -def chunk_iterable(iterable: Iterable[T], chunk_size: int) -> Iterable[Iterable[T]]: - """Iterates over an iterator chunk by chunk. - - Taken from https://stackoverflow.com/a/8998040. - See also https://github.com/huggingface/huggingface_hub/pull/920#discussion_r938793088. - - Args: - iterable (`Iterable`): - The iterable on which we want to iterate. - chunk_size (`int`): - Size of the chunks. Must be a strictly positive integer (e.g. >0). - - Example: - - ```python - >>> from huggingface_hub.utils import chunk_iterable - - >>> for items in chunk_iterable(range(17), chunk_size=8): - ... print(items) - # [0, 1, 2, 3, 4, 5, 6, 7] - # [8, 9, 10, 11, 12, 13, 14, 15] - # [16] # smaller last chunk - ``` - - Raises: - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If `chunk_size` <= 0. - - - The last chunk can be smaller than `chunk_size`. - - """ - if not isinstance(chunk_size, int) or chunk_size <= 0: - raise ValueError("`chunk_size` must be a strictly positive integer (>0).") - - iterator = iter(iterable) - while True: - try: - next_item = next(iterator) - except StopIteration: - return - yield itertools.chain((next_item,), itertools.islice(iterator, chunk_size - 1)) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_datetime.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_datetime.py deleted file mode 100644 index 57c3524d08857b37ca4f7e1c4901fd50d5be3404..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_datetime.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to handle datetimes in Huggingface Hub.""" -from datetime import datetime, timedelta, timezone - - -# Local machine offset compared to UTC. -# Taken from https://stackoverflow.com/a/3168394. -# `utcoffset()` returns `None` if no offset -> empty timedelta. -UTC_OFFSET = datetime.now(timezone.utc).astimezone().utcoffset() or timedelta() - - -def parse_datetime(date_string: str) -> datetime: - """ - Parses a date_string returned from the server to a datetime object. - - This parser is a weak-parser is the sense that it handles only a single format of - date_string. It is expected that the server format will never change. The - implementation depends only on the standard lib to avoid an external dependency - (python-dateutil). See full discussion about this decision on PR: - https://github.com/huggingface/huggingface_hub/pull/999. - - Example: - ```py - > parse_datetime('2022-08-19T07:19:38.123Z') - datetime.datetime(2022, 8, 19, 7, 19, 38, 123000, tzinfo=timezone.utc) - ``` - - Args: - date_string (`str`): - A string representing a datetime returned by the Hub server. - String is expected to follow '%Y-%m-%dT%H:%M:%S.%fZ' pattern. - - Returns: - A python datetime object. - - Raises: - :class:`ValueError`: - If `date_string` cannot be parsed. - """ - try: - # Datetime ending with a Z means "UTC". Here we parse the date as local machine - # timezone and then move it to the appropriate UTC timezone. - # See https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC) - # Taken from https://stackoverflow.com/a/3168394. - - dt = datetime.strptime(date_string, "%Y-%m-%dT%H:%M:%S.%fZ") - dt += UTC_OFFSET # By default, datetime is not timezoned -> move to UTC time - return dt.astimezone(timezone.utc) # Set explicit timezone - except ValueError as e: - raise ValueError( - f"Cannot parse '{date_string}' as a datetime. Date string is expected to" - " follow '%Y-%m-%dT%H:%M:%S.%fZ' pattern." - ) from e diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_deprecation.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_deprecation.py deleted file mode 100644 index 9572f14b9085aa8a354e009f9363c001d88fb83c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_deprecation.py +++ /dev/null @@ -1,132 +0,0 @@ -import warnings -from functools import wraps -from inspect import Parameter, signature -from typing import Iterable, Optional - - -def _deprecate_positional_args(*, version: str): - """Decorator for methods that issues warnings for positional arguments. - Using the keyword-only argument syntax in pep 3102, arguments after the - * will issue a warning when passed as a positional argument. - - Args: - version (`str`): - The version when positional arguments will result in error. - """ - - def _inner_deprecate_positional_args(f): - sig = signature(f) - kwonly_args = [] - all_args = [] - for name, param in sig.parameters.items(): - if param.kind == Parameter.POSITIONAL_OR_KEYWORD: - all_args.append(name) - elif param.kind == Parameter.KEYWORD_ONLY: - kwonly_args.append(name) - - @wraps(f) - def inner_f(*args, **kwargs): - extra_args = len(args) - len(all_args) - if extra_args <= 0: - return f(*args, **kwargs) - # extra_args > 0 - args_msg = [ - f"{name}='{arg}'" if isinstance(arg, str) else f"{name}={arg}" - for name, arg in zip(kwonly_args[:extra_args], args[-extra_args:]) - ] - args_msg = ", ".join(args_msg) - warnings.warn( - f"Deprecated positional argument(s) used in '{f.__name__}': pass" - f" {args_msg} as keyword args. From version {version} passing these" - " as positional arguments will result in an error,", - FutureWarning, - ) - kwargs.update(zip(sig.parameters, args)) - return f(**kwargs) - - return inner_f - - return _inner_deprecate_positional_args - - -def _deprecate_arguments( - *, - version: str, - deprecated_args: Iterable[str], - custom_message: Optional[str] = None, -): - """Decorator to issue warnings when using deprecated arguments. - - TODO: could be useful to be able to set a custom error message. - - Args: - version (`str`): - The version when deprecated arguments will result in error. - deprecated_args (`List[str]`): - List of the arguments to be deprecated. - custom_message (`str`, *optional*): - Warning message that is raised. If not passed, a default warning message - will be created. - """ - - def _inner_deprecate_positional_args(f): - sig = signature(f) - - @wraps(f) - def inner_f(*args, **kwargs): - # Check for used deprecated arguments - used_deprecated_args = [] - for _, parameter in zip(args, sig.parameters.values()): - if parameter.name in deprecated_args: - used_deprecated_args.append(parameter.name) - for kwarg_name, kwarg_value in kwargs.items(): - if ( - # If argument is deprecated but still used - kwarg_name in deprecated_args - # And then the value is not the default value - and kwarg_value != sig.parameters[kwarg_name].default - ): - used_deprecated_args.append(kwarg_name) - - # Warn and proceed - if len(used_deprecated_args) > 0: - message = ( - f"Deprecated argument(s) used in '{f.__name__}':" - f" {', '.join(used_deprecated_args)}. Will not be supported from" - f" version '{version}'." - ) - if custom_message is not None: - message += "\n\n" + custom_message - warnings.warn(message, FutureWarning) - return f(*args, **kwargs) - - return inner_f - - return _inner_deprecate_positional_args - - -def _deprecate_method(*, version: str, message: Optional[str] = None): - """Decorator to issue warnings when using a deprecated method. - - Args: - version (`str`): - The version when deprecated arguments will result in error. - message (`str`, *optional*): - Warning message that is raised. If not passed, a default warning message - will be created. - """ - - def _inner_deprecate_method(f): - @wraps(f) - def inner_f(*args, **kwargs): - warning_message = ( - f"'{f.__name__}' (from '{f.__module__}') is deprecated and will be removed from version '{version}'." - ) - if message is not None: - warning_message += " " + message - warnings.warn(warning_message, FutureWarning) - return f(*args, **kwargs) - - return inner_f - - return _inner_deprecate_method diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py deleted file mode 100644 index bfb199bb1292503a5d6f6c4087c60ca65dd8dee5..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py +++ /dev/null @@ -1,346 +0,0 @@ -from typing import Optional - -from requests import HTTPError, Response - -from ._fixes import JSONDecodeError - - -class FileMetadataError(OSError): - """Error triggered when the metadata of a file on the Hub cannot be retrieved (missing ETag or commit_hash). - - Inherits from `OSError` for backward compatibility. - """ - - -class HfHubHTTPError(HTTPError): - """ - HTTPError to inherit from for any custom HTTP Error raised in HF Hub. - - Any HTTPError is converted at least into a `HfHubHTTPError`. If some information is - sent back by the server, it will be added to the error message. - - Added details: - - Request id from "X-Request-Id" header if exists. - - Server error message from the header "X-Error-Message". - - Server error message if we can found one in the response body. - - Example: - ```py - import requests - from huggingface_hub.utils import get_session, hf_raise_for_status, HfHubHTTPError - - response = get_session().post(...) - try: - hf_raise_for_status(response) - except HfHubHTTPError as e: - print(str(e)) # formatted message - e.request_id, e.server_message # details returned by server - - # Complete the error message with additional information once it's raised - e.append_to_message("\n`create_commit` expects the repository to exist.") - raise - ``` - """ - - request_id: Optional[str] = None - server_message: Optional[str] = None - - def __init__(self, message: str, response: Optional[Response] = None): - # Parse server information if any. - if response is not None: - self.request_id = response.headers.get("X-Request-Id") - try: - server_data = response.json() - except JSONDecodeError: - server_data = {} - - # Retrieve server error message from multiple sources - server_message_from_headers = response.headers.get("X-Error-Message") - server_message_from_body = server_data.get("error") - server_multiple_messages_from_body = "\n".join( - error["message"] for error in server_data.get("errors", []) if "message" in error - ) - - # Concatenate error messages - _server_message = "" - if server_message_from_headers is not None: # from headers - _server_message += server_message_from_headers + "\n" - if server_message_from_body is not None: # from body "error" - if isinstance(server_message_from_body, list): - server_message_from_body = "\n".join(server_message_from_body) - if server_message_from_body not in _server_message: - _server_message += server_message_from_body + "\n" - if server_multiple_messages_from_body is not None: # from body "errors" - if server_multiple_messages_from_body not in _server_message: - _server_message += server_multiple_messages_from_body + "\n" - _server_message = _server_message.strip() - - # Set message to `HfHubHTTPError` (if any) - if _server_message != "": - self.server_message = _server_message - - super().__init__( - _format_error_message( - message, - request_id=self.request_id, - server_message=self.server_message, - ), - response=response, # type: ignore - request=response.request if response is not None else None, # type: ignore - ) - - def append_to_message(self, additional_message: str) -> None: - """Append additional information to the `HfHubHTTPError` initial message.""" - self.args = (self.args[0] + additional_message,) + self.args[1:] - - -class RepositoryNotFoundError(HfHubHTTPError): - """ - Raised when trying to access a hf.co URL with an invalid repository name, or - with a private repo name the user does not have access to. - - Example: - - ```py - >>> from huggingface_hub import model_info - >>> model_info("") - (...) - huggingface_hub.utils._errors.RepositoryNotFoundError: 401 Client Error. (Request ID: PvMw_VjBMjVdMz53WKIzP) - - Repository Not Found for url: https://huggingface.co/api/models/%3Cnon_existent_repository%3E. - Please make sure you specified the correct `repo_id` and `repo_type`. - If the repo is private, make sure you are authenticated. - Invalid username or password. - ``` - """ - - -class GatedRepoError(RepositoryNotFoundError): - """ - Raised when trying to access a gated repository for which the user is not on the - authorized list. - - Note: derives from `RepositoryNotFoundError` to ensure backward compatibility. - - Example: - - ```py - >>> from huggingface_hub import model_info - >>> model_info("") - (...) - huggingface_hub.utils._errors.GatedRepoError: 403 Client Error. (Request ID: ViT1Bf7O_026LGSQuVqfa) - - Cannot access gated repo for url https://huggingface.co/api/models/ardent-figment/gated-model. - Access to model ardent-figment/gated-model is restricted and you are not in the authorized list. - Visit https://huggingface.co/ardent-figment/gated-model to ask for access. - ``` - """ - - -class RevisionNotFoundError(HfHubHTTPError): - """ - Raised when trying to access a hf.co URL with a valid repository but an invalid - revision. - - Example: - - ```py - >>> from huggingface_hub import hf_hub_download - >>> hf_hub_download('bert-base-cased', 'config.json', revision='') - (...) - huggingface_hub.utils._errors.RevisionNotFoundError: 404 Client Error. (Request ID: Mwhe_c3Kt650GcdKEFomX) - - Revision Not Found for url: https://huggingface.co/bert-base-cased/resolve/%3Cnon-existent-revision%3E/config.json. - ``` - """ - - -class EntryNotFoundError(HfHubHTTPError): - """ - Raised when trying to access a hf.co URL with a valid repository and revision - but an invalid filename. - - Example: - - ```py - >>> from huggingface_hub import hf_hub_download - >>> hf_hub_download('bert-base-cased', '') - (...) - huggingface_hub.utils._errors.EntryNotFoundError: 404 Client Error. (Request ID: 53pNl6M0MxsnG5Sw8JA6x) - - Entry Not Found for url: https://huggingface.co/bert-base-cased/resolve/main/%3Cnon-existent-file%3E. - ``` - """ - - -class LocalEntryNotFoundError(EntryNotFoundError, FileNotFoundError, ValueError): - """ - Raised when trying to access a file that is not on the disk when network is - disabled or unavailable (connection issue). The entry may exist on the Hub. - - Note: `ValueError` type is to ensure backward compatibility. - Note: `LocalEntryNotFoundError` derives from `HTTPError` because of `EntryNotFoundError` - even when it is not a network issue. - - Example: - - ```py - >>> from huggingface_hub import hf_hub_download - >>> hf_hub_download('bert-base-cased', '', local_files_only=True) - (...) - huggingface_hub.utils._errors.LocalEntryNotFoundError: Cannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable hf.co look-ups and downloads online, set 'local_files_only' to False. - ``` - """ - - def __init__(self, message: str): - super().__init__(message, response=None) - - -class BadRequestError(HfHubHTTPError, ValueError): - """ - Raised by `hf_raise_for_status` when the server returns a HTTP 400 error. - - Example: - - ```py - >>> resp = requests.post("hf.co/api/check", ...) - >>> hf_raise_for_status(resp, endpoint_name="check") - huggingface_hub.utils._errors.BadRequestError: Bad request for check endpoint: {details} (Request ID: XXX) - ``` - """ - - -def hf_raise_for_status(response: Response, endpoint_name: Optional[str] = None) -> None: - """ - Internal version of `response.raise_for_status()` that will refine a - potential HTTPError. Raised exception will be an instance of `HfHubHTTPError`. - - This helper is meant to be the unique method to raise_for_status when making a call - to the Hugging Face Hub. - - Example: - ```py - import requests - from huggingface_hub.utils import get_session, hf_raise_for_status, HfHubHTTPError - - response = get_session().post(...) - try: - hf_raise_for_status(response) - except HfHubHTTPError as e: - print(str(e)) # formatted message - e.request_id, e.server_message # details returned by server - - # Complete the error message with additional information once it's raised - e.append_to_message("\n`create_commit` expects the repository to exist.") - raise - ``` - - Args: - response (`Response`): - Response from the server. - endpoint_name (`str`, *optional*): - Name of the endpoint that has been called. If provided, the error message - will be more complete. - - - - Raises when the request has failed: - - - [`~utils.RepositoryNotFoundError`] - If the repository to download from cannot be found. This may be because it - doesn't exist, because `repo_type` is not set correctly, or because the repo - is `private` and you do not have access. - - [`~utils.GatedRepoError`] - If the repository exists but is gated and the user is not on the authorized - list. - - [`~utils.RevisionNotFoundError`] - If the repository exists but the revision couldn't be find. - - [`~utils.EntryNotFoundError`] - If the repository exists but the entry (e.g. the requested file) couldn't be - find. - - [`~utils.BadRequestError`] - If request failed with a HTTP 400 BadRequest error. - - [`~utils.HfHubHTTPError`] - If request failed for a reason not listed above. - - - """ - try: - response.raise_for_status() - except HTTPError as e: - error_code = response.headers.get("X-Error-Code") - - if error_code == "RevisionNotFound": - message = f"{response.status_code} Client Error." + "\n\n" + f"Revision Not Found for url: {response.url}." - raise RevisionNotFoundError(message, response) from e - - elif error_code == "EntryNotFound": - message = f"{response.status_code} Client Error." + "\n\n" + f"Entry Not Found for url: {response.url}." - raise EntryNotFoundError(message, response) from e - - elif error_code == "GatedRepo": - message = ( - f"{response.status_code} Client Error." + "\n\n" + f"Cannot access gated repo for url {response.url}." - ) - raise GatedRepoError(message, response) from e - - elif ( - response.status_code == 401 - and response.request.url is not None - and "/api/collections" in response.request.url - ): - # Collection not found. We don't raise a custom error for this. - # This prevent from raising a misleading `RepositoryNotFoundError` (see below). - pass - - elif error_code == "RepoNotFound" or response.status_code == 401: - # 401 is misleading as it is returned for: - # - private and gated repos if user is not authenticated - # - missing repos - # => for now, we process them as `RepoNotFound` anyway. - # See https://gist.github.com/Wauplin/46c27ad266b15998ce56a6603796f0b9 - message = ( - f"{response.status_code} Client Error." - + "\n\n" - + f"Repository Not Found for url: {response.url}." - + "\nPlease make sure you specified the correct `repo_id` and" - " `repo_type`.\nIf you are trying to access a private or gated repo," - " make sure you are authenticated." - ) - raise RepositoryNotFoundError(message, response) from e - - elif response.status_code == 400: - message = ( - f"\n\nBad request for {endpoint_name} endpoint:" if endpoint_name is not None else "\n\nBad request:" - ) - raise BadRequestError(message, response=response) from e - - # Convert `HTTPError` into a `HfHubHTTPError` to display request information - # as well (request id and/or server error message) - raise HfHubHTTPError(str(e), response=response) from e - - -def _format_error_message(message: str, request_id: Optional[str], server_message: Optional[str]) -> str: - """ - Format the `HfHubHTTPError` error message based on initial message and information - returned by the server. - - Used when initializing `HfHubHTTPError`. - """ - # Add message from response body - if server_message is not None and len(server_message) > 0 and server_message.lower() not in message.lower(): - if "\n\n" in message: - message += "\n" + server_message - else: - message += "\n\n" + server_message - - # Add Request ID - if request_id is not None and str(request_id).lower() not in message.lower(): - request_id_message = f" (Request ID: {request_id})" - if "\n" in message: - newline_index = message.index("\n") - message = message[:newline_index] + request_id_message + message[newline_index:] - else: - message += request_id_message - - return message diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_experimental.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_experimental.py deleted file mode 100644 index 34162d22aca71b8a0d2513bc08e9e0a5325109c0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_experimental.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# Copyright 2023-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to flag a feature as "experimental" in Huggingface Hub.""" -import warnings -from functools import wraps -from typing import Callable - -from .. import constants - - -def experimental(fn: Callable) -> Callable: - """Decorator to flag a feature as experimental. - - An experimental feature trigger a warning when used as it might be subject to breaking changes in the future. - Warnings can be disabled by setting the environment variable `HF_EXPERIMENTAL_WARNING` to `0`. - - Args: - fn (`Callable`): - The function to flag as experimental. - - Returns: - `Callable`: The decorated function. - - Example: - - ```python - >>> from huggingface_hub.utils import experimental - - >>> @experimental - ... def my_function(): - ... print("Hello world!") - - >>> my_function() - UserWarning: 'my_function' is experimental and might be subject to breaking changes in the future. You can disable - this warning by setting `HF_HUB_DISABLE_EXPERIMENTAL_WARNING=1` as environment variable. - Hello world! - ``` - """ - # For classes, put the "experimental" around the "__new__" method => __new__ will be removed in warning message - name = fn.__qualname__[: -len(".__new__")] if fn.__qualname__.endswith(".__new__") else fn.__qualname__ - - @wraps(fn) - def _inner_fn(*args, **kwargs): - if not constants.HF_HUB_DISABLE_EXPERIMENTAL_WARNING: - warnings.warn( - f"'{name}' is experimental and might be subject to breaking changes in the future." - " You can disable this warning by setting `HF_HUB_DISABLE_EXPERIMENTAL_WARNING=1` as environment" - " variable.", - UserWarning, - ) - return fn(*args, **kwargs) - - return _inner_fn diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_fixes.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_fixes.py deleted file mode 100644 index ff4f9e2d70e323e108fbd7bade2fbed3f5595cbe..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_fixes.py +++ /dev/null @@ -1,77 +0,0 @@ -# JSONDecodeError was introduced in requests=2.27 released in 2022. -# This allows us to support older requests for users -# More information: https://github.com/psf/requests/pull/5856 -try: - from requests import JSONDecodeError # type: ignore # noqa: F401 -except ImportError: - try: - from simplejson import JSONDecodeError # type: ignore # noqa: F401 - except ImportError: - from json import JSONDecodeError # type: ignore # noqa: F401 - -import contextlib -import os -import shutil -import stat -import tempfile -from functools import partial -from pathlib import Path -from typing import Callable, Generator, Optional, Union - -import yaml - - -# Wrap `yaml.dump` to set `allow_unicode=True` by default. -# -# Example: -# ```py -# >>> yaml.dump({"emoji": "👀", "some unicode": "日本か"}) -# 'emoji: "\\U0001F440"\nsome unicode: "\\u65E5\\u672C\\u304B"\n' -# -# >>> yaml_dump({"emoji": "👀", "some unicode": "日本か"}) -# 'emoji: "👀"\nsome unicode: "日本か"\n' -# ``` -yaml_dump: Callable[..., str] = partial(yaml.dump, stream=None, allow_unicode=True) # type: ignore - - -@contextlib.contextmanager -def SoftTemporaryDirectory( - suffix: Optional[str] = None, - prefix: Optional[str] = None, - dir: Optional[Union[Path, str]] = None, - **kwargs, -) -> Generator[str, None, None]: - """ - Context manager to create a temporary directory and safely delete it. - - If tmp directory cannot be deleted normally, we set the WRITE permission and retry. - If cleanup still fails, we give up but don't raise an exception. This is equivalent - to `tempfile.TemporaryDirectory(..., ignore_cleanup_errors=True)` introduced in - Python 3.10. - - See https://www.scivision.dev/python-tempfile-permission-error-windows/. - """ - tmpdir = tempfile.TemporaryDirectory(prefix=prefix, suffix=suffix, dir=dir, **kwargs) - yield tmpdir.name - - try: - # First once with normal cleanup - shutil.rmtree(tmpdir.name) - except Exception: - # If failed, try to set write permission and retry - try: - shutil.rmtree(tmpdir.name, onerror=_set_write_permission_and_retry) - except Exception: - pass - - # And finally, cleanup the tmpdir. - # If it fails again, give up but do not throw error - try: - tmpdir.cleanup() - except Exception: - pass - - -def _set_write_permission_and_retry(func, path, excinfo): - os.chmod(path, stat.S_IWRITE) - func(path) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_git_credential.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_git_credential.py deleted file mode 100644 index fc287b2a77236df4024b53bccc2559a99a79b8f7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_git_credential.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to manage Git credentials.""" -import subprocess -from typing import List, Optional - -from ..constants import ENDPOINT -from ._subprocess import run_interactive_subprocess, run_subprocess - - -def list_credential_helpers(folder: Optional[str] = None) -> List[str]: - """Return the list of git credential helpers configured. - - See https://git-scm.com/docs/gitcredentials. - - Credentials are saved in all configured helpers (store, cache, macOS keychain,...). - Calls "`git credential approve`" internally. See https://git-scm.com/docs/git-credential. - - Args: - folder (`str`, *optional*): - The folder in which to check the configured helpers. - """ - try: - output = run_subprocess("git config --list", folder=folder).stdout - # NOTE: If user has set an helper for a custom URL, it will not we caught here. - # Example: `credential.https://hf-proxy.robus.us.kg.helper=store` - # See: https://github.com/huggingface/huggingface_hub/pull/1138#discussion_r1013324508 - return sorted( # Sort for nice printing - { # Might have some duplicates - line.split("=")[-1].split()[0] for line in output.split("\n") if "credential.helper" in line - } - ) - except subprocess.CalledProcessError as exc: - raise EnvironmentError(exc.stderr) - - -def set_git_credential(token: str, username: str = "hf_user", folder: Optional[str] = None) -> None: - """Save a username/token pair in git credential for HF Hub registry. - - Credentials are saved in all configured helpers (store, cache, macOS keychain,...). - Calls "`git credential approve`" internally. See https://git-scm.com/docs/git-credential. - - Args: - username (`str`, defaults to `"hf_user"`): - A git username. Defaults to `"hf_user"`, the default user used in the Hub. - token (`str`, defaults to `"hf_user"`): - A git password. In practice, the User Access Token for the Hub. - See https://huggingface.co/settings/tokens. - folder (`str`, *optional*): - The folder in which to check the configured helpers. - """ - with run_interactive_subprocess("git credential approve", folder=folder) as ( - stdin, - _, - ): - stdin.write(f"url={ENDPOINT}\nusername={username.lower()}\npassword={token}\n\n") - stdin.flush() - - -def unset_git_credential(username: str = "hf_user", folder: Optional[str] = None) -> None: - """Erase credentials from git credential for HF Hub registry. - - Credentials are erased from the configured helpers (store, cache, macOS - keychain,...), if any. If `username` is not provided, any credential configured for - HF Hub endpoint is erased. - Calls "`git credential erase`" internally. See https://git-scm.com/docs/git-credential. - - Args: - username (`str`, defaults to `"hf_user"`): - A git username. Defaults to `"hf_user"`, the default user used in the Hub. - folder (`str`, *optional*): - The folder in which to check the configured helpers. - """ - with run_interactive_subprocess("git credential reject", folder=folder) as ( - stdin, - _, - ): - standard_input = f"url={ENDPOINT}\n" - if username is not None: - standard_input += f"username={username.lower()}\n" - standard_input += "\n" - - stdin.write(standard_input) - stdin.flush() diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_headers.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_headers.py deleted file mode 100644 index 846cca3f1d3c3f000de92840a89fb11e35f2083f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_headers.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to handle headers to send in calls to Huggingface Hub.""" -from typing import Dict, Optional, Union - -from .. import constants -from ._hf_folder import HfFolder -from ._runtime import ( - get_fastai_version, - get_fastcore_version, - get_hf_hub_version, - get_python_version, - get_tf_version, - get_torch_version, - is_fastai_available, - is_fastcore_available, - is_tf_available, - is_torch_available, -) -from ._validators import validate_hf_hub_args - - -class LocalTokenNotFoundError(EnvironmentError): - """Raised if local token is required but not found.""" - - -@validate_hf_hub_args -def build_hf_headers( - *, - token: Optional[Union[bool, str]] = None, - is_write_action: bool = False, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - user_agent: Union[Dict, str, None] = None, -) -> Dict[str, str]: - """ - Build headers dictionary to send in a HF Hub call. - - By default, authorization token is always provided either from argument (explicit - use) or retrieved from the cache (implicit use). To explicitly avoid sending the - token to the Hub, set `token=False` or set the `HF_HUB_DISABLE_IMPLICIT_TOKEN` - environment variable. - - In case of an API call that requires write access, an error is thrown if token is - `None` or token is an organization token (starting with `"api_org***"`). - - In addition to the auth header, a user-agent is added to provide information about - the installed packages (versions of python, huggingface_hub, torch, tensorflow, - fastai and fastcore). - - Args: - token (`str`, `bool`, *optional*): - The token to be sent in authorization header for the Hub call: - - if a string, it is used as the Hugging Face token - - if `True`, the token is read from the machine (cache or env variable) - - if `False`, authorization header is not set - - if `None`, the token is read from the machine only except if - `HF_HUB_DISABLE_IMPLICIT_TOKEN` env variable is set. - is_write_action (`bool`, default to `False`): - Set to True if the API call requires a write access. If `True`, the token - will be validated (cannot be `None`, cannot start by `"api_org***"`). - library_name (`str`, *optional*): - The name of the library that is making the HTTP request. Will be added to - the user-agent header. - library_version (`str`, *optional*): - The version of the library that is making the HTTP request. Will be added - to the user-agent header. - user_agent (`str`, `dict`, *optional*): - The user agent info in the form of a dictionary or a single string. It will - be completed with information about the installed packages. - - Returns: - A `Dict` of headers to pass in your API call. - - Example: - ```py - >>> build_hf_headers(token="hf_***") # explicit token - {"authorization": "Bearer hf_***", "user-agent": ""} - - >>> build_hf_headers(token=True) # explicitly use cached token - {"authorization": "Bearer hf_***",...} - - >>> build_hf_headers(token=False) # explicitly don't use cached token - {"user-agent": ...} - - >>> build_hf_headers() # implicit use of the cached token - {"authorization": "Bearer hf_***",...} - - # HF_HUB_DISABLE_IMPLICIT_TOKEN=True # to set as env variable - >>> build_hf_headers() # token is not sent - {"user-agent": ...} - - >>> build_hf_headers(token="api_org_***", is_write_action=True) - ValueError: You must use your personal account token for write-access methods. - - >>> build_hf_headers(library_name="transformers", library_version="1.2.3") - {"authorization": ..., "user-agent": "transformers/1.2.3; hf_hub/0.10.2; python/3.10.4; tensorflow/1.55"} - ``` - - Raises: - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If organization token is passed and "write" access is required. - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) - If "write" access is required but token is not passed and not saved locally. - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError) - If `token=True` but token is not saved locally. - """ - # Get auth token to send - token_to_send = get_token_to_send(token) - _validate_token_to_send(token_to_send, is_write_action=is_write_action) - - # Combine headers - headers = { - "user-agent": _http_user_agent( - library_name=library_name, - library_version=library_version, - user_agent=user_agent, - ) - } - if token_to_send is not None: - headers["authorization"] = f"Bearer {token_to_send}" - return headers - - -def get_token_to_send(token: Optional[Union[bool, str]]) -> Optional[str]: - """Select the token to send from either `token` or the cache.""" - # Case token is explicitly provided - if isinstance(token, str): - return token - - # Case token is explicitly forbidden - if token is False: - return None - - # Token is not provided: we get it from local cache - cached_token = HfFolder().get_token() - - # Case token is explicitly required - if token is True: - if cached_token is None: - raise LocalTokenNotFoundError( - "Token is required (`token=True`), but no token found. You" - " need to provide a token or be logged in to Hugging Face with" - " `huggingface-cli login` or `huggingface_hub.login`. See" - " https://huggingface.co/settings/tokens." - ) - return cached_token - - # Case implicit use of the token is forbidden by env variable - if constants.HF_HUB_DISABLE_IMPLICIT_TOKEN: - return None - - # Otherwise: we use the cached token as the user has not explicitly forbidden it - return cached_token - - -def _validate_token_to_send(token: Optional[str], is_write_action: bool) -> None: - if is_write_action: - if token is None: - raise ValueError( - "Token is required (write-access action) but no token found. You need" - " to provide a token or be logged in to Hugging Face with" - " `huggingface-cli login` or `huggingface_hub.login`. See" - " https://huggingface.co/settings/tokens." - ) - if token.startswith("api_org"): - raise ValueError( - "You must use your personal account token for write-access methods. To" - " generate a write-access token, go to" - " https://huggingface.co/settings/tokens" - ) - - -def _http_user_agent( - *, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - user_agent: Union[Dict, str, None] = None, -) -> str: - """Format a user-agent string containing information about the installed packages. - - Args: - library_name (`str`, *optional*): - The name of the library that is making the HTTP request. - library_version (`str`, *optional*): - The version of the library that is making the HTTP request. - user_agent (`str`, `dict`, *optional*): - The user agent info in the form of a dictionary or a single string. - - Returns: - The formatted user-agent string. - """ - if library_name is not None: - ua = f"{library_name}/{library_version}" - else: - ua = "unknown/None" - ua += f"; hf_hub/{get_hf_hub_version()}" - ua += f"; python/{get_python_version()}" - - if not constants.HF_HUB_DISABLE_TELEMETRY: - if is_torch_available(): - ua += f"; torch/{get_torch_version()}" - if is_tf_available(): - ua += f"; tensorflow/{get_tf_version()}" - if is_fastai_available(): - ua += f"; fastai/{get_fastai_version()}" - if is_fastcore_available(): - ua += f"; fastcore/{get_fastcore_version()}" - - if isinstance(user_agent, dict): - ua += "; " + "; ".join(f"{k}/{v}" for k, v in user_agent.items()) - elif isinstance(user_agent, str): - ua += "; " + user_agent - - return _deduplicate_user_agent(ua) - - -def _deduplicate_user_agent(user_agent: str) -> str: - """Deduplicate redundant information in the generated user-agent.""" - # Split around ";" > Strip whitespaces > Store as dict keys (ensure unicity) > format back as string - # Order is implicitly preserved by dictionary structure (see https://stackoverflow.com/a/53657523). - return "; ".join({key.strip(): None for key in user_agent.split(";")}.keys()) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_hf_folder.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_hf_folder.py deleted file mode 100644 index 77daced7e8a337deddbf96a08647952eb7f44997..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_hf_folder.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contain helper class to retrieve/store token from/to local cache.""" -import os -import warnings -from pathlib import Path -from typing import Optional - -from .. import constants - - -class HfFolder: - path_token = Path(constants.HF_TOKEN_PATH) - # Private attribute. Will be removed in v0.15 - _old_path_token = Path(constants._OLD_HF_TOKEN_PATH) - - @classmethod - def save_token(cls, token: str) -> None: - """ - Save token, creating folder as needed. - - Token is saved in the huggingface home folder. You can configure it by setting - the `HF_HOME` environment variable. - - Args: - token (`str`): - The token to save to the [`HfFolder`] - """ - cls.path_token.parent.mkdir(parents=True, exist_ok=True) - cls.path_token.write_text(token) - - @classmethod - def get_token(cls) -> Optional[str]: - """ - Get token or None if not existent. - - Note that a token can be also provided using the `HUGGING_FACE_HUB_TOKEN` environment variable. - - Token is saved in the huggingface home folder. You can configure it by setting - the `HF_HOME` environment variable. Previous location was `~/.huggingface/token`. - If token is found in old location but not in new location, it is copied there first. - For more details, see https://github.com/huggingface/huggingface_hub/issues/1232. - - Returns: - `str` or `None`: The token, `None` if it doesn't exist. - """ - # 0. Check if token exist in old path but not new location - try: - cls._copy_to_new_path_and_warn() - except Exception: # if not possible (e.g. PermissionError), do not raise - pass - - # 1. Is it set by environment variable ? - token: Optional[str] = os.environ.get("HUGGING_FACE_HUB_TOKEN") - if token is not None: - token = token.replace("\r", "").replace("\n", "").strip() - return token - - # 2. Is it set in token path ? - try: - token = cls.path_token.read_text() - token = token.replace("\r", "").replace("\n", "").strip() - return token - except FileNotFoundError: - return None - - @classmethod - def delete_token(cls) -> None: - """ - Deletes the token from storage. Does not fail if token does not exist. - """ - try: - cls.path_token.unlink() - except FileNotFoundError: - pass - - try: - cls._old_path_token.unlink() - except FileNotFoundError: - pass - - @classmethod - def _copy_to_new_path_and_warn(cls): - if cls._old_path_token.exists() and not cls.path_token.exists(): - cls.save_token(cls._old_path_token.read_text()) - warnings.warn( - f"A token has been found in `{cls._old_path_token}`. This is the old" - " path where tokens were stored. The new location is" - f" `{cls.path_token}` which is configurable using `HF_HOME` environment" - " variable. Your token has been copied to this new location. You can" - " now safely delete the old token file manually or use" - " `huggingface-cli logout`." - ) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_http.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_http.py deleted file mode 100644 index 0674ddc31fc72316a4b5ad48b446dffa68206d1e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_http.py +++ /dev/null @@ -1,281 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to handle HTTP requests in Huggingface Hub.""" -import io -import os -import threading -import time -import uuid -from functools import lru_cache -from http import HTTPStatus -from typing import Callable, Tuple, Type, Union - -import requests -from requests import Response -from requests.adapters import HTTPAdapter -from requests.exceptions import ProxyError, Timeout -from requests.models import PreparedRequest - -from . import logging -from ._typing import HTTP_METHOD_T - - -logger = logging.get_logger(__name__) - -# Both headers are used by the Hub to debug failed requests. -# `X_AMZN_TRACE_ID` is better as it also works to debug on Cloudfront and ALB. -# If `X_AMZN_TRACE_ID` is set, the Hub will use it as well. -X_AMZN_TRACE_ID = "X-Amzn-Trace-Id" -X_REQUEST_ID = "x-request-id" - - -class UniqueRequestIdAdapter(HTTPAdapter): - X_AMZN_TRACE_ID = "X-Amzn-Trace-Id" - - def add_headers(self, request, **kwargs): - super().add_headers(request, **kwargs) - - # Add random request ID => easier for server-side debug - if X_AMZN_TRACE_ID not in request.headers: - request.headers[X_AMZN_TRACE_ID] = request.headers.get(X_REQUEST_ID) or str(uuid.uuid4()) - - # Add debug log - has_token = str(request.headers.get("authorization", "")).startswith("Bearer hf_") - logger.debug( - f"Request {request.headers[X_AMZN_TRACE_ID]}: {request.method} {request.url} (authenticated: {has_token})" - ) - - def send(self, request: PreparedRequest, *args, **kwargs) -> Response: - """Catch any RequestException to append request id to the error message for debugging.""" - try: - return super().send(request, *args, **kwargs) - except requests.RequestException as e: - request_id = request.headers.get(X_AMZN_TRACE_ID) - if request_id is not None: - # Taken from https://stackoverflow.com/a/58270258 - e.args = (*e.args, f"(Request ID: {request_id})") - raise - - -def _default_backend_factory() -> requests.Session: - session = requests.Session() - session.mount("http://", UniqueRequestIdAdapter()) - session.mount("https://", UniqueRequestIdAdapter()) - return session - - -BACKEND_FACTORY_T = Callable[[], requests.Session] -_GLOBAL_BACKEND_FACTORY: BACKEND_FACTORY_T = _default_backend_factory - - -def configure_http_backend(backend_factory: BACKEND_FACTORY_T = _default_backend_factory) -> None: - """ - Configure the HTTP backend by providing a `backend_factory`. Any HTTP calls made by `huggingface_hub` will use a - Session object instantiated by this factory. This can be useful if you are running your scripts in a specific - environment requiring custom configuration (e.g. custom proxy or certifications). - - Use [`get_session`] to get a configured Session. Since `requests.Session` is not guaranteed to be thread-safe, - `huggingface_hub` creates 1 Session instance per thread. They are all instantiated using the same `backend_factory` - set in [`configure_http_backend`]. A LRU cache is used to cache the created sessions (and connections) between - calls. Max size is 128 to avoid memory leaks if thousands of threads are spawned. - - See [this issue](https://github.com/psf/requests/issues/2766) to know more about thread-safety in `requests`. - - Example: - ```py - import requests - from huggingface_hub import configure_http_backend, get_session - - # Create a factory function that returns a Session with configured proxies - def backend_factory() -> requests.Session: - session = requests.Session() - session.proxies = {"http": "http://10.10.1.10:3128", "https": "https://10.10.1.11:1080"} - return session - - # Set it as the default session factory - configure_http_backend(backend_factory=backend_factory) - - # In practice, this is mostly done internally in `huggingface_hub` - session = get_session() - ``` - """ - global _GLOBAL_BACKEND_FACTORY - _GLOBAL_BACKEND_FACTORY = backend_factory - _get_session_from_cache.cache_clear() - - -def get_session() -> requests.Session: - """ - Get a `requests.Session` object, using the session factory from the user. - - Use [`get_session`] to get a configured Session. Since `requests.Session` is not guaranteed to be thread-safe, - `huggingface_hub` creates 1 Session instance per thread. They are all instantiated using the same `backend_factory` - set in [`configure_http_backend`]. A LRU cache is used to cache the created sessions (and connections) between - calls. Max size is 128 to avoid memory leaks if thousands of threads are spawned. - - See [this issue](https://github.com/psf/requests/issues/2766) to know more about thread-safety in `requests`. - - Example: - ```py - import requests - from huggingface_hub import configure_http_backend, get_session - - # Create a factory function that returns a Session with configured proxies - def backend_factory() -> requests.Session: - session = requests.Session() - session.proxies = {"http": "http://10.10.1.10:3128", "https": "https://10.10.1.11:1080"} - return session - - # Set it as the default session factory - configure_http_backend(backend_factory=backend_factory) - - # In practice, this is mostly done internally in `huggingface_hub` - session = get_session() - ``` - """ - return _get_session_from_cache(process_id=os.getpid(), thread_id=threading.get_ident()) - - -@lru_cache -def _get_session_from_cache(process_id: int, thread_id: int) -> requests.Session: - """ - Create a new session per thread using global factory. Using LRU cache (maxsize 128) to avoid memory leaks when - using thousands of threads. Cache is cleared when `configure_http_backend` is called. - """ - return _GLOBAL_BACKEND_FACTORY() - - -def http_backoff( - method: HTTP_METHOD_T, - url: str, - *, - max_retries: int = 5, - base_wait_time: float = 1, - max_wait_time: float = 8, - retry_on_exceptions: Union[Type[Exception], Tuple[Type[Exception], ...]] = ( - Timeout, - ProxyError, - ), - retry_on_status_codes: Union[int, Tuple[int, ...]] = HTTPStatus.SERVICE_UNAVAILABLE, - **kwargs, -) -> Response: - """Wrapper around requests to retry calls on an endpoint, with exponential backoff. - - Endpoint call is retried on exceptions (ex: connection timeout, proxy error,...) - and/or on specific status codes (ex: service unavailable). If the call failed more - than `max_retries`, the exception is thrown or `raise_for_status` is called on the - response object. - - Re-implement mechanisms from the `backoff` library to avoid adding an external - dependencies to `hugging_face_hub`. See https://github.com/litl/backoff. - - Args: - method (`Literal["GET", "OPTIONS", "HEAD", "POST", "PUT", "PATCH", "DELETE"]`): - HTTP method to perform. - url (`str`): - The URL of the resource to fetch. - max_retries (`int`, *optional*, defaults to `5`): - Maximum number of retries, defaults to 5 (no retries). - base_wait_time (`float`, *optional*, defaults to `1`): - Duration (in seconds) to wait before retrying the first time. - Wait time between retries then grows exponentially, capped by - `max_wait_time`. - max_wait_time (`float`, *optional*, defaults to `8`): - Maximum duration (in seconds) to wait before retrying. - retry_on_exceptions (`Type[Exception]` or `Tuple[Type[Exception]]`, *optional*, defaults to `(Timeout, ProxyError,)`): - Define which exceptions must be caught to retry the request. Can be a single - type or a tuple of types. - By default, retry on `Timeout` and `ProxyError`. - retry_on_status_codes (`int` or `Tuple[int]`, *optional*, defaults to `503`): - Define on which status codes the request must be retried. By default, only - HTTP 503 Service Unavailable is retried. - **kwargs (`dict`, *optional*): - kwargs to pass to `requests.request`. - - Example: - ``` - >>> from huggingface_hub.utils import http_backoff - - # Same usage as "requests.request". - >>> response = http_backoff("GET", "https://www.google.com") - >>> response.raise_for_status() - - # If you expect a Gateway Timeout from time to time - >>> http_backoff("PUT", upload_url, data=data, retry_on_status_codes=504) - >>> response.raise_for_status() - ``` - - - - When using `requests` it is possible to stream data by passing an iterator to the - `data` argument. On http backoff this is a problem as the iterator is not reset - after a failed call. This issue is mitigated for file objects or any IO streams - by saving the initial position of the cursor (with `data.tell()`) and resetting the - cursor between each call (with `data.seek()`). For arbitrary iterators, http backoff - will fail. If this is a hard constraint for you, please let us know by opening an - issue on [Github](https://github.com/huggingface/huggingface_hub). - - - """ - if isinstance(retry_on_exceptions, type): # Tuple from single exception type - retry_on_exceptions = (retry_on_exceptions,) - - if isinstance(retry_on_status_codes, int): # Tuple from single status code - retry_on_status_codes = (retry_on_status_codes,) - - nb_tries = 0 - sleep_time = base_wait_time - - # If `data` is used and is a file object (or any IO), it will be consumed on the - # first HTTP request. We need to save the initial position so that the full content - # of the file is re-sent on http backoff. See warning tip in docstring. - io_obj_initial_pos = None - if "data" in kwargs and isinstance(kwargs["data"], io.IOBase): - io_obj_initial_pos = kwargs["data"].tell() - - session = get_session() - while True: - nb_tries += 1 - try: - # If `data` is used and is a file object (or any IO), set back cursor to - # initial position. - if io_obj_initial_pos is not None: - kwargs["data"].seek(io_obj_initial_pos) - - # Perform request and return if status_code is not in the retry list. - response = session.request(method=method, url=url, **kwargs) - if response.status_code not in retry_on_status_codes: - return response - - # Wrong status code returned (HTTP 503 for instance) - logger.warning(f"HTTP Error {response.status_code} thrown while requesting {method} {url}") - if nb_tries > max_retries: - response.raise_for_status() # Will raise uncaught exception - # We return response to avoid infinite loop in the corner case where the - # user ask for retry on a status code that doesn't raise_for_status. - return response - - except retry_on_exceptions as err: - logger.warning(f"'{err}' thrown while requesting {method} {url}") - - if nb_tries > max_retries: - raise err - - # Sleep for X seconds - logger.warning(f"Retrying in {sleep_time}s [Retry {nb_tries}/{max_retries}].") - time.sleep(sleep_time) - - # Update sleep time for next retry - sleep_time = min(max_wait_time, sleep_time * 2) # Exponential backoff diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_pagination.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_pagination.py deleted file mode 100644 index ad9048ac55b518a1a54fe0431ac375d203bd1554..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_pagination.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to handle pagination on Huggingface Hub.""" -from typing import Dict, Iterable, Optional - -import requests - -from . import get_session, hf_raise_for_status, logging - - -logger = logging.get_logger(__name__) - - -def paginate(path: str, params: Dict, headers: Dict) -> Iterable: - """Fetch a list of models/datasets/spaces and paginate through results. - - This is using the same "Link" header format as GitHub. - See: - - https://requests.readthedocs.io/en/latest/api/#requests.Response.links - - https://docs.github.com/en/rest/guides/traversing-with-pagination#link-header - """ - session = get_session() - r = session.get(path, params=params, headers=headers) - hf_raise_for_status(r) - yield from r.json() - - # Follow pages - # Next link already contains query params - next_page = _get_next_page(r) - while next_page is not None: - logger.debug(f"Pagination detected. Requesting next page: {next_page}") - r = session.get(next_page, headers=headers) - hf_raise_for_status(r) - yield from r.json() - next_page = _get_next_page(r) - - -def _get_next_page(response: requests.Response) -> Optional[str]: - return response.links.get("next", {}).get("url") diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_paths.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_paths.py deleted file mode 100644 index 0a994bf5e93fa773148dbe0941fcdb5532fbc15a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_paths.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to handle paths in Huggingface Hub.""" -from fnmatch import fnmatch -from pathlib import Path -from typing import Callable, Generator, Iterable, List, Optional, TypeVar, Union - - -T = TypeVar("T") - -IGNORE_GIT_FOLDER_PATTERNS = [".git", ".git/*", "*/.git", "**/.git/**"] - - -def filter_repo_objects( - items: Iterable[T], - *, - allow_patterns: Optional[Union[List[str], str]] = None, - ignore_patterns: Optional[Union[List[str], str]] = None, - key: Optional[Callable[[T], str]] = None, -) -> Generator[T, None, None]: - """Filter repo objects based on an allowlist and a denylist. - - Input must be a list of paths (`str` or `Path`) or a list of arbitrary objects. - In the later case, `key` must be provided and specifies a function of one argument - that is used to extract a path from each element in iterable. - - Patterns are Unix shell-style wildcards which are NOT regular expressions. See - https://docs.python.org/3/library/fnmatch.html for more details. - - Args: - items (`Iterable`): - List of items to filter. - allow_patterns (`str` or `List[str]`, *optional*): - Patterns constituting the allowlist. If provided, item paths must match at - least one pattern from the allowlist. - ignore_patterns (`str` or `List[str]`, *optional*): - Patterns constituting the denylist. If provided, item paths must not match - any patterns from the denylist. - key (`Callable[[T], str]`, *optional*): - Single-argument function to extract a path from each item. If not provided, - the `items` must already be `str` or `Path`. - - Returns: - Filtered list of objects, as a generator. - - Raises: - :class:`ValueError`: - If `key` is not provided and items are not `str` or `Path`. - - Example usage with paths: - ```python - >>> # Filter only PDFs that are not hidden. - >>> list(filter_repo_objects( - ... ["aaa.PDF", "bbb.jpg", ".ccc.pdf", ".ddd.png"], - ... allow_patterns=["*.pdf"], - ... ignore_patterns=[".*"], - ... )) - ["aaa.pdf"] - ``` - - Example usage with objects: - ```python - >>> list(filter_repo_objects( - ... [ - ... CommitOperationAdd(path_or_fileobj="/tmp/aaa.pdf", path_in_repo="aaa.pdf") - ... CommitOperationAdd(path_or_fileobj="/tmp/bbb.jpg", path_in_repo="bbb.jpg") - ... CommitOperationAdd(path_or_fileobj="/tmp/.ccc.pdf", path_in_repo=".ccc.pdf") - ... CommitOperationAdd(path_or_fileobj="/tmp/.ddd.png", path_in_repo=".ddd.png") - ... ], - ... allow_patterns=["*.pdf"], - ... ignore_patterns=[".*"], - ... key=lambda x: x.repo_in_path - ... )) - [CommitOperationAdd(path_or_fileobj="/tmp/aaa.pdf", path_in_repo="aaa.pdf")] - ``` - """ - if isinstance(allow_patterns, str): - allow_patterns = [allow_patterns] - - if isinstance(ignore_patterns, str): - ignore_patterns = [ignore_patterns] - - if key is None: - - def _identity(item: T) -> str: - if isinstance(item, str): - return item - if isinstance(item, Path): - return str(item) - raise ValueError(f"Please provide `key` argument in `filter_repo_objects`: `{item}` is not a string.") - - key = _identity # Items must be `str` or `Path`, otherwise raise ValueError - - for item in items: - path = key(item) - - # Skip if there's an allowlist and path doesn't match any - if allow_patterns is not None and not any(fnmatch(path, r) for r in allow_patterns): - continue - - # Skip if there's a denylist and path matches any - if ignore_patterns is not None and any(fnmatch(path, r) for r in ignore_patterns): - continue - - yield item diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_runtime.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_runtime.py deleted file mode 100644 index 969a38e6b1ed52010d8707be47882cd0f8b40e12..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_runtime.py +++ /dev/null @@ -1,321 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Check presence of installed packages at runtime.""" -import importlib.metadata -import platform -import sys -from typing import Any, Dict - -from .. import __version__, constants - - -_PY_VERSION: str = sys.version.split()[0].rstrip("+") - -_package_versions = {} - -_CANDIDATES = { - "aiohttp": {"aiohttp"}, - "fastai": {"fastai"}, - "fastcore": {"fastcore"}, - "gradio": {"gradio"}, - "graphviz": {"graphviz"}, - "hf_transfer": {"hf_transfer"}, - "jinja": {"Jinja2"}, - "numpy": {"numpy"}, - "pillow": {"Pillow"}, - "pydantic": {"pydantic"}, - "pydot": {"pydot"}, - "tensorboard": {"tensorboardX"}, - "tensorflow": ( - "tensorflow", - "tensorflow-cpu", - "tensorflow-gpu", - "tf-nightly", - "tf-nightly-cpu", - "tf-nightly-gpu", - "intel-tensorflow", - "intel-tensorflow-avx512", - "tensorflow-rocm", - "tensorflow-macos", - ), - "torch": {"torch"}, -} - -# Check once at runtime -for candidate_name, package_names in _CANDIDATES.items(): - _package_versions[candidate_name] = "N/A" - for name in package_names: - try: - _package_versions[candidate_name] = importlib.metadata.version(name) - break - except importlib.metadata.PackageNotFoundError: - pass - - -def _get_version(package_name: str) -> str: - return _package_versions.get(package_name, "N/A") - - -def _is_available(package_name: str) -> bool: - return _get_version(package_name) != "N/A" - - -# Python -def get_python_version() -> str: - return _PY_VERSION - - -# Huggingface Hub -def get_hf_hub_version() -> str: - return __version__ - - -# aiohttp -def is_aiohttp_available() -> bool: - return _is_available("aiohttp") - - -def get_aiohttp_version() -> str: - return _get_version("aiohttp") - - -# FastAI -def is_fastai_available() -> bool: - return _is_available("fastai") - - -def get_fastai_version() -> str: - return _get_version("fastai") - - -# Fastcore -def is_fastcore_available() -> bool: - return _is_available("fastcore") - - -def get_fastcore_version() -> str: - return _get_version("fastcore") - - -# FastAI -def is_gradio_available() -> bool: - return _is_available("gradio") - - -def get_gradio_version() -> str: - return _get_version("gradio") - - -# Graphviz -def is_graphviz_available() -> bool: - return _is_available("graphviz") - - -def get_graphviz_version() -> str: - return _get_version("graphviz") - - -# hf_transfer -def is_hf_transfer_available() -> bool: - return _is_available("hf_transfer") - - -def get_hf_transfer_version() -> str: - return _get_version("hf_transfer") - - -# Numpy -def is_numpy_available() -> bool: - return _is_available("numpy") - - -def get_numpy_version() -> str: - return _get_version("numpy") - - -# Jinja -def is_jinja_available() -> bool: - return _is_available("jinja") - - -def get_jinja_version() -> str: - return _get_version("jinja") - - -# Pillow -def is_pillow_available() -> bool: - return _is_available("pillow") - - -def get_pillow_version() -> str: - return _get_version("pillow") - - -# Pydantic -def is_pydantic_available() -> bool: - return _is_available("pydantic") - - -def get_pydantic_version() -> str: - return _get_version("pydantic") - - -# Pydot -def is_pydot_available() -> bool: - return _is_available("pydot") - - -def get_pydot_version() -> str: - return _get_version("pydot") - - -# Tensorboard -def is_tensorboard_available() -> bool: - return _is_available("tensorboard") - - -def get_tensorboard_version() -> str: - return _get_version("tensorboard") - - -# Tensorflow -def is_tf_available() -> bool: - return _is_available("tensorflow") - - -def get_tf_version() -> str: - return _get_version("tensorflow") - - -# Torch -def is_torch_available() -> bool: - return _is_available("torch") - - -def get_torch_version() -> str: - return _get_version("torch") - - -# Shell-related helpers -try: - # Set to `True` if script is running in a Google Colab notebook. - # If running in Google Colab, git credential store is set globally which makes the - # warning disappear. See https://github.com/huggingface/huggingface_hub/issues/1043 - # - # Taken from https://stackoverflow.com/a/63519730. - _is_google_colab = "google.colab" in str(get_ipython()) # type: ignore # noqa: F821 -except NameError: - _is_google_colab = False - - -def is_notebook() -> bool: - """Return `True` if code is executed in a notebook (Jupyter, Colab, QTconsole). - - Taken from https://stackoverflow.com/a/39662359. - Adapted to make it work with Google colab as well. - """ - try: - shell_class = get_ipython().__class__ # type: ignore # noqa: F821 - for parent_class in shell_class.__mro__: # e.g. "is subclass of" - if parent_class.__name__ == "ZMQInteractiveShell": - return True # Jupyter notebook, Google colab or qtconsole - return False - except NameError: - return False # Probably standard Python interpreter - - -def is_google_colab() -> bool: - """Return `True` if code is executed in a Google colab. - - Taken from https://stackoverflow.com/a/63519730. - """ - return _is_google_colab - - -def dump_environment_info() -> Dict[str, Any]: - """Dump information about the machine to help debugging issues. - - Similar helper exist in: - - `datasets` (https://github.com/huggingface/datasets/blob/main/src/datasets/commands/env.py) - - `diffusers` (https://github.com/huggingface/diffusers/blob/main/src/diffusers/commands/env.py) - - `transformers` (https://github.com/huggingface/transformers/blob/main/src/transformers/commands/env.py) - """ - from huggingface_hub import HfFolder, whoami - from huggingface_hub.utils import list_credential_helpers - - token = HfFolder().get_token() - - # Generic machine info - info: Dict[str, Any] = { - "huggingface_hub version": get_hf_hub_version(), - "Platform": platform.platform(), - "Python version": get_python_version(), - } - - # Interpreter info - try: - shell_class = get_ipython().__class__ # type: ignore # noqa: F821 - info["Running in iPython ?"] = "Yes" - info["iPython shell"] = shell_class.__name__ - except NameError: - info["Running in iPython ?"] = "No" - info["Running in notebook ?"] = "Yes" if is_notebook() else "No" - info["Running in Google Colab ?"] = "Yes" if is_google_colab() else "No" - - # Login info - info["Token path ?"] = HfFolder().path_token - info["Has saved token ?"] = token is not None - if token is not None: - try: - info["Who am I ?"] = whoami()["name"] - except Exception: - pass - - try: - info["Configured git credential helpers"] = ", ".join(list_credential_helpers()) - except Exception: - pass - - # Installed dependencies - info["FastAI"] = get_fastai_version() - info["Tensorflow"] = get_tf_version() - info["Torch"] = get_torch_version() - info["Jinja2"] = get_jinja_version() - info["Graphviz"] = get_graphviz_version() - info["Pydot"] = get_pydot_version() - info["Pillow"] = get_pillow_version() - info["hf_transfer"] = get_hf_transfer_version() - info["gradio"] = get_gradio_version() - info["tensorboard"] = get_tensorboard_version() - info["numpy"] = get_numpy_version() - info["pydantic"] = get_pydantic_version() - info["aiohttp"] = get_aiohttp_version() - - # Environment variables - info["ENDPOINT"] = constants.ENDPOINT - info["HUGGINGFACE_HUB_CACHE"] = constants.HUGGINGFACE_HUB_CACHE - info["HUGGINGFACE_ASSETS_CACHE"] = constants.HUGGINGFACE_ASSETS_CACHE - info["HF_TOKEN_PATH"] = constants.HF_TOKEN_PATH - info["HF_HUB_OFFLINE"] = constants.HF_HUB_OFFLINE - info["HF_HUB_DISABLE_TELEMETRY"] = constants.HF_HUB_DISABLE_TELEMETRY - info["HF_HUB_DISABLE_PROGRESS_BARS"] = constants.HF_HUB_DISABLE_PROGRESS_BARS - info["HF_HUB_DISABLE_SYMLINKS_WARNING"] = constants.HF_HUB_DISABLE_SYMLINKS_WARNING - info["HF_HUB_DISABLE_EXPERIMENTAL_WARNING"] = constants.HF_HUB_DISABLE_EXPERIMENTAL_WARNING - info["HF_HUB_DISABLE_IMPLICIT_TOKEN"] = constants.HF_HUB_DISABLE_IMPLICIT_TOKEN - info["HF_HUB_ENABLE_HF_TRANSFER"] = constants.HF_HUB_ENABLE_HF_TRANSFER - - print("\nCopy-and-paste the text below in your GitHub issue.\n") - print("\n".join([f"- {prop}: {val}" for prop, val in info.items()]) + "\n") - return info diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_subprocess.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_subprocess.py deleted file mode 100644 index 5ec7936549c11f432c2b98a2f88a7a87d1b38772..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_subprocess.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python -# coding=utf-8 -# Copyright 2021 The HuggingFace Inc. team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License -"""Contains utilities to easily handle subprocesses in `huggingface_hub`.""" -import os -import subprocess -import sys -from contextlib import contextmanager -from io import StringIO -from pathlib import Path -from typing import IO, Generator, List, Optional, Tuple, Union - -from .logging import get_logger - - -logger = get_logger(__name__) - - -@contextmanager -def capture_output() -> Generator[StringIO, None, None]: - """Capture output that is printed to terminal. - - Taken from https://stackoverflow.com/a/34738440 - - Example: - ```py - >>> with capture_output() as output: - ... print("hello world") - >>> assert output.getvalue() == "hello world\n" - ``` - """ - output = StringIO() - previous_output = sys.stdout - sys.stdout = output - yield output - sys.stdout = previous_output - - -def run_subprocess( - command: Union[str, List[str]], - folder: Optional[Union[str, Path]] = None, - check=True, - **kwargs, -) -> subprocess.CompletedProcess: - """ - Method to run subprocesses. Calling this will capture the `stderr` and `stdout`, - please call `subprocess.run` manually in case you would like for them not to - be captured. - - Args: - command (`str` or `List[str]`): - The command to execute as a string or list of strings. - folder (`str`, *optional*): - The folder in which to run the command. Defaults to current working - directory (from `os.getcwd()`). - check (`bool`, *optional*, defaults to `True`): - Setting `check` to `True` will raise a `subprocess.CalledProcessError` - when the subprocess has a non-zero exit code. - kwargs (`Dict[str]`): - Keyword arguments to be passed to the `subprocess.run` underlying command. - - Returns: - `subprocess.CompletedProcess`: The completed process. - """ - if isinstance(command, str): - command = command.split() - - if isinstance(folder, Path): - folder = str(folder) - - return subprocess.run( - command, - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - check=check, - encoding="utf-8", - errors="replace", # if not utf-8, replace char by � - cwd=folder or os.getcwd(), - **kwargs, - ) - - -@contextmanager -def run_interactive_subprocess( - command: Union[str, List[str]], - folder: Optional[Union[str, Path]] = None, - **kwargs, -) -> Generator[Tuple[IO[str], IO[str]], None, None]: - """Run a subprocess in an interactive mode in a context manager. - - Args: - command (`str` or `List[str]`): - The command to execute as a string or list of strings. - folder (`str`, *optional*): - The folder in which to run the command. Defaults to current working - directory (from `os.getcwd()`). - kwargs (`Dict[str]`): - Keyword arguments to be passed to the `subprocess.run` underlying command. - - Returns: - `Tuple[IO[str], IO[str]]`: A tuple with `stdin` and `stdout` to interact - with the process (input and output are utf-8 encoded). - - Example: - ```python - with _interactive_subprocess("git credential-store get") as (stdin, stdout): - # Write to stdin - stdin.write("url=hf.co\nusername=obama\n".encode("utf-8")) - stdin.flush() - - # Read from stdout - output = stdout.read().decode("utf-8") - ``` - """ - if isinstance(command, str): - command = command.split() - - with subprocess.Popen( - command, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - encoding="utf-8", - errors="replace", # if not utf-8, replace char by � - cwd=folder or os.getcwd(), - **kwargs, - ) as process: - assert process.stdin is not None, "subprocess is opened as subprocess.PIPE" - assert process.stdout is not None, "subprocess is opened as subprocess.PIPE" - yield process.stdin, process.stdout diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_telemetry.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_telemetry.py deleted file mode 100644 index 5de988e2795188324f69232d1beb68191591715d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_telemetry.py +++ /dev/null @@ -1,118 +0,0 @@ -from queue import Queue -from threading import Lock, Thread -from typing import Dict, Optional, Union -from urllib.parse import quote - -from .. import constants, logging -from . import build_hf_headers, get_session, hf_raise_for_status - - -logger = logging.get_logger(__name__) - -# Telemetry is sent by a separate thread to avoid blocking the main thread. -# A daemon thread is started once and consume tasks from the _TELEMETRY_QUEUE. -# If the thread stops for some reason -shouldn't happen-, we restart a new one. -_TELEMETRY_THREAD: Optional[Thread] = None -_TELEMETRY_THREAD_LOCK = Lock() # Lock to avoid starting multiple threads in parallel -_TELEMETRY_QUEUE: Queue = Queue() - - -def send_telemetry( - topic: str, - *, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - user_agent: Union[Dict, str, None] = None, -) -> None: - """ - Sends telemetry that helps tracking usage of different HF libraries. - - This usage data helps us debug issues and prioritize new features. However, we understand that not everyone wants - to share additional information, and we respect your privacy. You can disable telemetry collection by setting the - `HF_HUB_DISABLE_TELEMETRY=1` as environment variable. Telemetry is also disabled in offline mode (i.e. when setting - `HF_HUB_OFFLINE=1`). - - Telemetry collection is run in a separate thread to minimize impact for the user. - - Args: - topic (`str`): - Name of the topic that is monitored. The topic is directly used to build the URL. If you want to monitor - subtopics, just use "/" separation. Examples: "gradio", "transformers/examples",... - library_name (`str`, *optional*): - The name of the library that is making the HTTP request. Will be added to the user-agent header. - library_version (`str`, *optional*): - The version of the library that is making the HTTP request. Will be added to the user-agent header. - user_agent (`str`, `dict`, *optional*): - The user agent info in the form of a dictionary or a single string. It will be completed with information about the installed packages. - - Example: - ```py - >>> from huggingface_hub.utils import send_telemetry - - # Send telemetry without library information - >>> send_telemetry("ping") - - # Send telemetry to subtopic with library information - >>> send_telemetry("gradio/local_link", library_name="gradio", library_version="3.22.1") - - # Send telemetry with additional data - >>> send_telemetry( - ... topic="examples", - ... library_name="transformers", - ... library_version="4.26.0", - ... user_agent={"pipeline": "text_classification", "framework": "flax"}, - ... ) - ``` - """ - if constants.HF_HUB_OFFLINE or constants.HF_HUB_DISABLE_TELEMETRY: - return - - _start_telemetry_thread() # starts thread only if doesn't exist yet - _TELEMETRY_QUEUE.put( - {"topic": topic, "library_name": library_name, "library_version": library_version, "user_agent": user_agent} - ) - - -def _start_telemetry_thread(): - """Start a daemon thread to consume tasks from the telemetry queue. - - If the thread is interrupted, start a new one. - """ - with _TELEMETRY_THREAD_LOCK: # avoid to start multiple threads if called concurrently - global _TELEMETRY_THREAD - if _TELEMETRY_THREAD is None or not _TELEMETRY_THREAD.is_alive(): - _TELEMETRY_THREAD = Thread(target=_telemetry_worker, daemon=True) - _TELEMETRY_THREAD.start() - - -def _telemetry_worker(): - """Wait for a task and consume it.""" - while True: - kwargs = _TELEMETRY_QUEUE.get() - _send_telemetry_in_thread(**kwargs) - _TELEMETRY_QUEUE.task_done() - - -def _send_telemetry_in_thread( - topic: str, - *, - library_name: Optional[str] = None, - library_version: Optional[str] = None, - user_agent: Union[Dict, str, None] = None, -) -> None: - """Contains the actual data sending data to the Hub.""" - path = "/".join(quote(part) for part in topic.split("/") if len(part) > 0) - try: - r = get_session().head( - f"{constants.ENDPOINT}/api/telemetry/{path}", - headers=build_hf_headers( - token=False, # no need to send a token for telemetry - library_name=library_name, - library_version=library_version, - user_agent=user_agent, - ), - ) - hf_raise_for_status(r) - except Exception as e: - # We don't want to error in case of connection errors of any kind. - logger.debug(f"Error while sending telemetry: {e}") diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_typing.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_typing.py deleted file mode 100644 index 56f2ceed6bb718bbbc119c873caa1b240f5702ac..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_typing.py +++ /dev/null @@ -1,22 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Handle typing imports based on system compatibility.""" -from typing import Callable, Literal, TypeVar - - -HTTP_METHOD_T = Literal["GET", "OPTIONS", "HEAD", "POST", "PUT", "PATCH", "DELETE"] - -# type hint meaning "function signature not changed by decorator" -CallableT = TypeVar("CallableT", bound=Callable) diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py deleted file mode 100644 index 5dd64fa51435b97142bb61cfe12f9369e6f1488b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py +++ /dev/null @@ -1,230 +0,0 @@ -# coding=utf-8 -# Copyright 2022-present, the HuggingFace Inc. team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Contains utilities to validate argument values in `huggingface_hub`.""" -import inspect -import re -import warnings -from functools import wraps -from itertools import chain -from typing import Any, Dict - -from ._typing import CallableT - - -REPO_ID_REGEX = re.compile( - r""" - ^ - (\b[\w\-.]+\b/)? # optional namespace (username or organization) - \b # starts with a word boundary - [\w\-.]{1,96} # repo_name: alphanumeric + . _ - - \b # ends with a word boundary - $ - """, - flags=re.VERBOSE, -) - - -class HFValidationError(ValueError): - """Generic exception thrown by `huggingface_hub` validators. - - Inherits from [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError). - """ - - -def validate_hf_hub_args(fn: CallableT) -> CallableT: - """Validate values received as argument for any public method of `huggingface_hub`. - - The goal of this decorator is to harmonize validation of arguments reused - everywhere. By default, all defined validators are tested. - - Validators: - - [`~utils.validate_repo_id`]: `repo_id` must be `"repo_name"` - or `"namespace/repo_name"`. Namespace is a username or an organization. - - [`~utils.smoothly_deprecate_use_auth_token`]: Use `token` instead of - `use_auth_token` (only if `use_auth_token` is not expected by the decorated - function - in practice, always the case in `huggingface_hub`). - - Example: - ```py - >>> from huggingface_hub.utils import validate_hf_hub_args - - >>> @validate_hf_hub_args - ... def my_cool_method(repo_id: str): - ... print(repo_id) - - >>> my_cool_method(repo_id="valid_repo_id") - valid_repo_id - - >>> my_cool_method("other..repo..id") - huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'. - - >>> my_cool_method(repo_id="other..repo..id") - huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'. - - >>> @validate_hf_hub_args - ... def my_cool_auth_method(token: str): - ... print(token) - - >>> my_cool_auth_method(token="a token") - "a token" - - >>> my_cool_auth_method(use_auth_token="a use_auth_token") - "a use_auth_token" - - >>> my_cool_auth_method(token="a token", use_auth_token="a use_auth_token") - UserWarning: Both `token` and `use_auth_token` are passed (...) - "a token" - ``` - - Raises: - [`~utils.HFValidationError`]: - If an input is not valid. - """ - # TODO: add an argument to opt-out validation for specific argument? - signature = inspect.signature(fn) - - # Should the validator switch `use_auth_token` values to `token`? In practice, always - # True in `huggingface_hub`. Might not be the case in a downstream library. - check_use_auth_token = "use_auth_token" not in signature.parameters and "token" in signature.parameters - - @wraps(fn) - def _inner_fn(*args, **kwargs): - has_token = False - for arg_name, arg_value in chain( - zip(signature.parameters, args), # Args values - kwargs.items(), # Kwargs values - ): - if arg_name in ["repo_id", "from_id", "to_id"]: - validate_repo_id(arg_value) - - elif arg_name == "token" and arg_value is not None: - has_token = True - - if check_use_auth_token: - kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs) - - return fn(*args, **kwargs) - - return _inner_fn # type: ignore - - -def validate_repo_id(repo_id: str) -> None: - """Validate `repo_id` is valid. - - This is not meant to replace the proper validation made on the Hub but rather to - avoid local inconsistencies whenever possible (example: passing `repo_type` in the - `repo_id` is forbidden). - - Rules: - - Between 1 and 96 characters. - - Either "repo_name" or "namespace/repo_name" - - [a-zA-Z0-9] or "-", "_", "." - - "--" and ".." are forbidden - - Valid: `"foo"`, `"foo/bar"`, `"123"`, `"Foo-BAR_foo.bar123"` - - Not valid: `"datasets/foo/bar"`, `".repo_id"`, `"foo--bar"`, `"foo.git"` - - Example: - ```py - >>> from huggingface_hub.utils import validate_repo_id - >>> validate_repo_id(repo_id="valid_repo_id") - >>> validate_repo_id(repo_id="other..repo..id") - huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'. - ``` - - Discussed in https://github.com/huggingface/huggingface_hub/issues/1008. - In moon-landing (internal repository): - - https://github.com/huggingface/moon-landing/blob/main/server/lib/Names.ts#L27 - - https://github.com/huggingface/moon-landing/blob/main/server/views/components/NewRepoForm/NewRepoForm.svelte#L138 - """ - if not isinstance(repo_id, str): - # Typically, a Path is not a repo_id - raise HFValidationError(f"Repo id must be a string, not {type(repo_id)}: '{repo_id}'.") - - if repo_id.count("/") > 1: - raise HFValidationError( - "Repo id must be in the form 'repo_name' or 'namespace/repo_name':" - f" '{repo_id}'. Use `repo_type` argument if needed." - ) - - if not REPO_ID_REGEX.match(repo_id): - raise HFValidationError( - "Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are" - " forbidden, '-' and '.' cannot start or end the name, max length is 96:" - f" '{repo_id}'." - ) - - if "--" in repo_id or ".." in repo_id: - raise HFValidationError(f"Cannot have -- or .. in repo_id: '{repo_id}'.") - - if repo_id.endswith(".git"): - raise HFValidationError(f"Repo_id cannot end by '.git': '{repo_id}'.") - - -def smoothly_deprecate_use_auth_token(fn_name: str, has_token: bool, kwargs: Dict[str, Any]) -> Dict[str, Any]: - """Smoothly deprecate `use_auth_token` in the `huggingface_hub` codebase. - - The long-term goal is to remove any mention of `use_auth_token` in the codebase in - favor of a unique and less verbose `token` argument. This will be done a few steps: - - 0. Step 0: methods that require a read-access to the Hub use the `use_auth_token` - argument (`str`, `bool` or `None`). Methods requiring write-access have a `token` - argument (`str`, `None`). This implicit rule exists to be able to not send the - token when not necessary (`use_auth_token=False`) even if logged in. - - 1. Step 1: we want to harmonize everything and use `token` everywhere (supporting - `token=False` for read-only methods). In order not to break existing code, if - `use_auth_token` is passed to a function, the `use_auth_token` value is passed - as `token` instead, without any warning. - a. Corner case: if both `use_auth_token` and `token` values are passed, a warning - is thrown and the `use_auth_token` value is ignored. - - 2. Step 2: Once it is release, we should push downstream libraries to switch from - `use_auth_token` to `token` as much as possible, but without throwing a warning - (e.g. manually create issues on the corresponding repos). - - 3. Step 3: After a transitional period (6 months e.g. until April 2023?), we update - `huggingface_hub` to throw a warning on `use_auth_token`. Hopefully, very few - users will be impacted as it would have already been fixed. - In addition, unit tests in `huggingface_hub` must be adapted to expect warnings - to be thrown (but still use `use_auth_token` as before). - - 4. Step 4: After a normal deprecation cycle (3 releases ?), remove this validator. - `use_auth_token` will definitely not be supported. - In addition, we update unit tests in `huggingface_hub` to use `token` everywhere. - - This has been discussed in: - - https://github.com/huggingface/huggingface_hub/issues/1094. - - https://github.com/huggingface/huggingface_hub/pull/928 - - (related) https://github.com/huggingface/huggingface_hub/pull/1064 - """ - new_kwargs = kwargs.copy() # do not mutate input ! - - use_auth_token = new_kwargs.pop("use_auth_token", None) # remove from kwargs - if use_auth_token is not None: - if has_token: - warnings.warn( - "Both `token` and `use_auth_token` are passed to" - f" `{fn_name}` with non-None values. `token` is now the" - " preferred argument to pass a User Access Token." - " `use_auth_token` value will be ignored." - ) - else: - # `token` argument is not passed and a non-None value is passed in - # `use_auth_token` => use `use_auth_token` value as `token` kwarg. - new_kwargs["token"] = use_auth_token - - return new_kwargs diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/endpoint_helpers.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/endpoint_helpers.py deleted file mode 100644 index decc0f03d9c0480e297b2fa48ca8f96d95ccaab5..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/endpoint_helpers.py +++ /dev/null @@ -1,371 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" -Helpful utility functions and classes in relation to exploring API endpoints -with the aim for a user-friendly interface. -""" -import math -import re -from dataclasses import dataclass -from typing import TYPE_CHECKING, Iterable, List, Optional, Union - - -if TYPE_CHECKING: - from ..hf_api import ModelInfo - - -def _filter_emissions( - models: Iterable["ModelInfo"], - minimum_threshold: Optional[float] = None, - maximum_threshold: Optional[float] = None, -) -> Iterable["ModelInfo"]: - """Filters a list of models for those that include an emission tag and limit them to between two thresholds - - Args: - models (Iterable of `ModelInfo`): - A list of models to filter. - minimum_threshold (`float`, *optional*): - A minimum carbon threshold to filter by, such as 1. - maximum_threshold (`float`, *optional*): - A maximum carbon threshold to filter by, such as 10. - """ - if minimum_threshold is None and maximum_threshold is None: - raise ValueError("Both `minimum_threshold` and `maximum_threshold` cannot both be `None`") - if minimum_threshold is None: - minimum_threshold = -1 - if maximum_threshold is None: - maximum_threshold = math.inf - - for model in models: - card_data = getattr(model, "cardData", None) - if card_data is None or not isinstance(card_data, dict): - continue - - # Get CO2 emission metadata - emission = card_data.get("co2_eq_emissions", None) - if isinstance(emission, dict): - emission = emission["emissions"] - if not emission: - continue - - # Filter out if value is missing or out of range - matched = re.search(r"\d+\.\d+|\d+", str(emission)) - if matched is None: - continue - - emission_value = float(matched.group(0)) - if emission_value >= minimum_threshold and emission_value <= maximum_threshold: - yield model - - -@dataclass -class DatasetFilter: - """ - A class that converts human-readable dataset search parameters into ones - compatible with the REST API. For all parameters capitalization does not - matter. - - Args: - author (`str`, *optional*): - A string or list of strings that can be used to identify datasets on - the Hub by the original uploader (author or organization), such as - `facebook` or `huggingface`. - benchmark (`str` or `List`, *optional*): - A string or list of strings that can be used to identify datasets on - the Hub by their official benchmark. - dataset_name (`str`, *optional*): - A string or list of strings that can be used to identify datasets on - the Hub by its name, such as `SQAC` or `wikineural` - language_creators (`str` or `List`, *optional*): - A string or list of strings that can be used to identify datasets on - the Hub with how the data was curated, such as `crowdsourced` or - `machine_generated`. - language (`str` or `List`, *optional*): - A string or list of strings representing a two-character language to - filter datasets by on the Hub. - multilinguality (`str` or `List`, *optional*): - A string or list of strings representing a filter for datasets that - contain multiple languages. - size_categories (`str` or `List`, *optional*): - A string or list of strings that can be used to identify datasets on - the Hub by the size of the dataset such as `100K>> from huggingface_hub import DatasetFilter - - >>> # Using author - >>> new_filter = DatasetFilter(author="facebook") - - >>> # Using benchmark - >>> new_filter = DatasetFilter(benchmark="raft") - - >>> # Using dataset_name - >>> new_filter = DatasetFilter(dataset_name="wikineural") - - >>> # Using language_creator - >>> new_filter = DatasetFilter(language_creator="crowdsourced") - - >>> # Using language - >>> new_filter = DatasetFilter(language="en") - - >>> # Using multilinguality - >>> new_filter = DatasetFilter(multilinguality="multilingual") - - >>> # Using size_categories - >>> new_filter = DatasetFilter(size_categories="100K>> # Using task_categories - >>> new_filter = DatasetFilter(task_categories="audio_classification") - - >>> # Using task_ids - >>> new_filter = DatasetFilter(task_ids="paraphrase") - ``` - """ - - author: Optional[str] = None - benchmark: Optional[Union[str, List[str]]] = None - dataset_name: Optional[str] = None - language_creators: Optional[Union[str, List[str]]] = None - language: Optional[Union[str, List[str]]] = None - multilinguality: Optional[Union[str, List[str]]] = None - size_categories: Optional[Union[str, List[str]]] = None - task_categories: Optional[Union[str, List[str]]] = None - task_ids: Optional[Union[str, List[str]]] = None - - -@dataclass -class ModelFilter: - """ - A class that converts human-readable model search parameters into ones - compatible with the REST API. For all parameters capitalization does not - matter. - - Args: - author (`str`, *optional*): - A string that can be used to identify models on the Hub by the - original uploader (author or organization), such as `facebook` or - `huggingface`. - library (`str` or `List`, *optional*): - A string or list of strings of foundational libraries models were - originally trained from, such as pytorch, tensorflow, or allennlp. - language (`str` or `List`, *optional*): - A string or list of strings of languages, both by name and country - code, such as "en" or "English" - model_name (`str`, *optional*): - A string that contain complete or partial names for models on the - Hub, such as "bert" or "bert-base-cased" - task (`str` or `List`, *optional*): - A string or list of strings of tasks models were designed for, such - as: "fill-mask" or "automatic-speech-recognition" - tags (`str` or `List`, *optional*): - A string tag or a list of tags to filter models on the Hub by, such - as `text-generation` or `spacy`. - trained_dataset (`str` or `List`, *optional*): - A string tag or a list of string tags of the trained dataset for a - model on the Hub. - - - ```python - >>> from huggingface_hub import ModelFilter - - >>> # For the author_or_organization - >>> new_filter = ModelFilter(author_or_organization="facebook") - - >>> # For the library - >>> new_filter = ModelFilter(library="pytorch") - - >>> # For the language - >>> new_filter = ModelFilter(language="french") - - >>> # For the model_name - >>> new_filter = ModelFilter(model_name="bert") - - >>> # For the task - >>> new_filter = ModelFilter(task="text-classification") - - >>> # Retrieving tags using the `HfApi.get_model_tags` method - >>> from huggingface_hub import HfApi - - >>> api = HfApi() - # To list model tags - - >>> api.get_model_tags() - # To list dataset tags - - >>> api.get_dataset_tags() - >>> new_filter = ModelFilter(tags="benchmark:raft") - - >>> # Related to the dataset - >>> new_filter = ModelFilter(trained_dataset="common_voice") - ``` - """ - - author: Optional[str] = None - library: Optional[Union[str, List[str]]] = None - language: Optional[Union[str, List[str]]] = None - model_name: Optional[str] = None - task: Optional[Union[str, List[str]]] = None - trained_dataset: Optional[Union[str, List[str]]] = None - tags: Optional[Union[str, List[str]]] = None - - -class AttributeDictionary(dict): - """ - `dict` subclass that also provides access to keys as attributes - - If a key starts with a number, it will exist in the dictionary but not as an - attribute - - Example: - - ```python - >>> d = AttributeDictionary() - >>> d["test"] = "a" - >>> print(d.test) # prints "a" - ``` - - """ - - def __getattr__(self, k): - if k in self: - return self[k] - else: - raise AttributeError(k) - - def __setattr__(self, k, v): - (self.__setitem__, super().__setattr__)[k[0] == "_"](k, v) - - def __delattr__(self, k): - if k in self: - del self[k] - else: - raise AttributeError(k) - - def __dir__(self): - keys = sorted(self.keys()) - keys = [key for key in keys if key.replace("_", "").isalpha()] - return super().__dir__() + keys - - def __repr__(self): - repr_str = "Available Attributes or Keys:\n" - for key in sorted(self.keys()): - repr_str += f" * {key}" - if not key.replace("_", "").isalpha(): - repr_str += " (Key only)" - repr_str += "\n" - return repr_str - - -class GeneralTags(AttributeDictionary): - """ - A namespace object holding all tags, filtered by `keys` If a tag starts with - a number, it will only exist in the dictionary - - Example: - ```python - >>> a.b["1a"] # will work - >>> a["b"]["1a"] # will work - >>> # a.b.1a # will not work - ``` - - Args: - tag_dictionary (`dict`): - A dictionary of tags returned from the /api/***-tags-by-type api - endpoint - keys (`list`): - A list of keys to unpack the `tag_dictionary` with, such as - `["library","language"]` - """ - - def __init__(self, tag_dictionary: dict, keys: Optional[list] = None): - self._tag_dictionary = tag_dictionary - if keys is None: - keys = list(self._tag_dictionary.keys()) - for key in keys: - self._unpack_and_assign_dictionary(key) - - def _unpack_and_assign_dictionary(self, key: str): - "Assign nested attributes to `self.key` containing information as an `AttributeDictionary`" - ref = AttributeDictionary() - setattr(self, key, ref) - for item in self._tag_dictionary.get(key, []): - label = item["label"].replace(" ", "").replace("-", "_").replace(".", "_") - ref[label] = item["id"] - self[key] = ref - - -class ModelTags(GeneralTags): - """ - A namespace object holding all available model tags If a tag starts with a - number, it will only exist in the dictionary - - Example: - - ```python - >>> a.dataset["1_5BArabicCorpus"] # will work - >>> a["dataset"]["1_5BArabicCorpus"] # will work - >>> # o.dataset.1_5BArabicCorpus # will not work - ``` - - Args: - model_tag_dictionary (`dict`): - A dictionary of valid model tags, returned from the - /api/models-tags-by-type api endpoint - """ - - def __init__(self, model_tag_dictionary: dict): - keys = ["library", "language", "license", "dataset", "pipeline_tag"] - super().__init__(model_tag_dictionary, keys) - - -class DatasetTags(GeneralTags): - """ - A namespace object holding all available dataset tags If a tag starts with a - number, it will only exist in the dictionary - - Example - - ```python - >>> a.size_categories["100K>> a["size_categories"]["100K>> # o.size_categories.100K str: - return __name__.split(".")[0] - - -def _get_library_root_logger() -> logging.Logger: - return logging.getLogger(_get_library_name()) - - -def _get_default_logging_level(): - """ - If HUGGINGFACE_HUB_VERBOSITY env var is set to one of the valid choices - return that as the new default level. If it is not - fall back to - `_default_log_level` - """ - env_level_str = os.getenv("HUGGINGFACE_HUB_VERBOSITY", None) - if env_level_str: - if env_level_str in log_levels: - return log_levels[env_level_str] - else: - logging.getLogger().warning( - f"Unknown option HUGGINGFACE_HUB_VERBOSITY={env_level_str}, " - f"has to be one of: { ', '.join(log_levels.keys()) }" - ) - return _default_log_level - - -def _configure_library_root_logger() -> None: - library_root_logger = _get_library_root_logger() - library_root_logger.addHandler(logging.StreamHandler()) - library_root_logger.setLevel(_get_default_logging_level()) - - -def _reset_library_root_logger() -> None: - library_root_logger = _get_library_root_logger() - library_root_logger.setLevel(logging.NOTSET) - - -def get_logger(name: Optional[str] = None) -> logging.Logger: - """ - Returns a logger with the specified name. This function is not supposed - to be directly accessed by library users. - - Args: - name (`str`, *optional*): - The name of the logger to get, usually the filename - - Example: - - ```python - >>> from huggingface_hub import get_logger - - >>> logger = get_logger(__file__) - >>> logger.set_verbosity_info() - ``` - """ - - if name is None: - name = _get_library_name() - - return logging.getLogger(name) - - -def get_verbosity() -> int: - """Return the current level for the HuggingFace Hub's root logger. - - Returns: - Logging level, e.g., `huggingface_hub.logging.DEBUG` and - `huggingface_hub.logging.INFO`. - - - - HuggingFace Hub has following logging levels: - - - `huggingface_hub.logging.CRITICAL`, `huggingface_hub.logging.FATAL` - - `huggingface_hub.logging.ERROR` - - `huggingface_hub.logging.WARNING`, `huggingface_hub.logging.WARN` - - `huggingface_hub.logging.INFO` - - `huggingface_hub.logging.DEBUG` - - - """ - return _get_library_root_logger().getEffectiveLevel() - - -def set_verbosity(verbosity: int) -> None: - """ - Sets the level for the HuggingFace Hub's root logger. - - Args: - verbosity (`int`): - Logging level, e.g., `huggingface_hub.logging.DEBUG` and - `huggingface_hub.logging.INFO`. - """ - _get_library_root_logger().setLevel(verbosity) - - -def set_verbosity_info(): - """ - Sets the verbosity to `logging.INFO`. - """ - return set_verbosity(INFO) - - -def set_verbosity_warning(): - """ - Sets the verbosity to `logging.WARNING`. - """ - return set_verbosity(WARNING) - - -def set_verbosity_debug(): - """ - Sets the verbosity to `logging.DEBUG`. - """ - return set_verbosity(DEBUG) - - -def set_verbosity_error(): - """ - Sets the verbosity to `logging.ERROR`. - """ - return set_verbosity(ERROR) - - -def disable_propagation() -> None: - """ - Disable propagation of the library log outputs. Note that log propagation is - disabled by default. - """ - _get_library_root_logger().propagate = False - - -def enable_propagation() -> None: - """ - Enable propagation of the library log outputs. Please disable the - HuggingFace Hub's default handler to prevent double logging if the root - logger has been configured. - """ - _get_library_root_logger().propagate = True - - -_configure_library_root_logger() diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/sha.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/sha.py deleted file mode 100644 index 157ccb0379eb1c80389d8e06135f305d11889caf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/sha.py +++ /dev/null @@ -1,27 +0,0 @@ -"""Utilities to efficiently compute the SHA 256 hash of a bunch of bytes.""" -from hashlib import sha256 -from typing import BinaryIO, Optional - - -def sha_fileobj(fileobj: BinaryIO, chunk_size: Optional[int] = None) -> bytes: - """ - Computes the sha256 hash of the given file object, by chunks of size `chunk_size`. - - Args: - fileobj (file-like object): - The File object to compute sha256 for, typically obtained with `open(path, "rb")` - chunk_size (`int`, *optional*): - The number of bytes to read from `fileobj` at once, defaults to 1MB. - - Returns: - `bytes`: `fileobj`'s sha256 hash as bytes - """ - chunk_size = chunk_size if chunk_size is not None else 1024 * 1024 - - sha = sha256() - while True: - chunk = fileobj.read(chunk_size) - sha.update(chunk) - if not chunk: - break - return sha.digest() diff --git a/venv/lib/python3.8/site-packages/huggingface_hub/utils/tqdm.py b/venv/lib/python3.8/site-packages/huggingface_hub/utils/tqdm.py deleted file mode 100644 index cae9adb389a6e3777ce0fb2e5f0156b4746dbd3d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/huggingface_hub/utils/tqdm.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env python -# coding=utf-8 -# Copyright 2021 The HuggingFace Inc. team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License -"""Utility helpers to handle progress bars in `huggingface_hub`. - -Example: - 1. Use `huggingface_hub.utils.tqdm` as you would use `tqdm.tqdm` or `tqdm.auto.tqdm`. - 2. To disable progress bars, either use `disable_progress_bars()` helper or set the - environment variable `HF_HUB_DISABLE_PROGRESS_BARS` to 1. - 3. To re-enable progress bars, use `enable_progress_bars()`. - 4. To check whether progress bars are disabled, use `are_progress_bars_disabled()`. - -NOTE: Environment variable `HF_HUB_DISABLE_PROGRESS_BARS` has the priority. - -Example: - ```py - from huggingface_hub.utils import ( - are_progress_bars_disabled, - disable_progress_bars, - enable_progress_bars, - tqdm, - ) - - # Disable progress bars globally - disable_progress_bars() - - # Use as normal `tqdm` - for _ in tqdm(range(5)): - do_something() - - # Still not showing progress bars, as `disable=False` is overwritten to `True`. - for _ in tqdm(range(5), disable=False): - do_something() - - are_progress_bars_disabled() # True - - # Re-enable progress bars globally - enable_progress_bars() - - # Progress bar will be shown ! - for _ in tqdm(range(5)): - do_something() - ``` -""" -import io -import warnings -from contextlib import contextmanager -from pathlib import Path -from typing import Iterator, Optional, Union - -from tqdm.auto import tqdm as old_tqdm - -from ..constants import HF_HUB_DISABLE_PROGRESS_BARS - - -# `HF_HUB_DISABLE_PROGRESS_BARS` is `Optional[bool]` while `_hf_hub_progress_bars_disabled` -# is a `bool`. If `HF_HUB_DISABLE_PROGRESS_BARS` is set to True or False, it has priority. -# If `HF_HUB_DISABLE_PROGRESS_BARS` is None, it means the user have not set the -# environment variable and is free to enable/disable progress bars programmatically. -# TL;DR: env variable has priority over code. -# -# By default, progress bars are enabled. -_hf_hub_progress_bars_disabled: bool = HF_HUB_DISABLE_PROGRESS_BARS or False - - -def disable_progress_bars() -> None: - """ - Disable globally progress bars used in `huggingface_hub` except if `HF_HUB_DISABLE_PROGRESS_BARS` environment - variable has been set. - - Use [`~utils.enable_progress_bars`] to re-enable them. - """ - if HF_HUB_DISABLE_PROGRESS_BARS is False: - warnings.warn( - "Cannot disable progress bars: environment variable `HF_HUB_DISABLE_PROGRESS_BARS=0` is set and has" - " priority." - ) - return - global _hf_hub_progress_bars_disabled - _hf_hub_progress_bars_disabled = True - - -def enable_progress_bars() -> None: - """ - Enable globally progress bars used in `huggingface_hub` except if `HF_HUB_DISABLE_PROGRESS_BARS` environment - variable has been set. - - Use [`~utils.disable_progress_bars`] to disable them. - """ - if HF_HUB_DISABLE_PROGRESS_BARS is True: - warnings.warn( - "Cannot enable progress bars: environment variable `HF_HUB_DISABLE_PROGRESS_BARS=1` is set and has" - " priority." - ) - return - global _hf_hub_progress_bars_disabled - _hf_hub_progress_bars_disabled = False - - -def are_progress_bars_disabled() -> bool: - """Return whether progress bars are globally disabled or not. - - Progress bars used in `huggingface_hub` can be enable or disabled globally using [`~utils.enable_progress_bars`] - and [`~utils.disable_progress_bars`] or by setting `HF_HUB_DISABLE_PROGRESS_BARS` as environment variable. - """ - global _hf_hub_progress_bars_disabled - return _hf_hub_progress_bars_disabled - - -class tqdm(old_tqdm): - """ - Class to override `disable` argument in case progress bars are globally disabled. - - Taken from https://github.com/tqdm/tqdm/issues/619#issuecomment-619639324. - """ - - def __init__(self, *args, **kwargs): - if are_progress_bars_disabled(): - kwargs["disable"] = True - super().__init__(*args, **kwargs) - - def __delattr__(self, attr: str) -> None: - """Fix for https://github.com/huggingface/huggingface_hub/issues/1603""" - try: - super().__delattr__(attr) - except AttributeError: - if attr != "_lock": - raise - - -@contextmanager -def tqdm_stream_file(path: Union[Path, str]) -> Iterator[io.BufferedReader]: - """ - Open a file as binary and wrap the `read` method to display a progress bar when it's streamed. - - First implemented in `transformers` in 2019 but removed when switched to git-lfs. Used in `huggingface_hub` to show - progress bar when uploading an LFS file to the Hub. See github.com/huggingface/transformers/pull/2078#discussion_r354739608 - for implementation details. - - Note: currently implementation handles only files stored on disk as it is the most common use case. Could be - extended to stream any `BinaryIO` object but we might have to debug some corner cases. - - Example: - ```py - >>> with tqdm_stream_file("config.json") as f: - >>> requests.put(url, data=f) - config.json: 100%|█████████████████████████| 8.19k/8.19k [00:02<00:00, 3.72kB/s] - ``` - """ - if isinstance(path, str): - path = Path(path) - - with path.open("rb") as f: - total_size = path.stat().st_size - pbar = tqdm( - unit="B", - unit_scale=True, - total=total_size, - initial=0, - desc=path.name, - ) - - f_read = f.read - - def _inner_read(size: Optional[int] = -1) -> bytes: - data = f_read(size) - pbar.update(len(data)) - return data - - f.read = _inner_read # type: ignore - - yield f - - pbar.close() diff --git a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/idna-3.4.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/LICENSE.md b/venv/lib/python3.8/site-packages/idna-3.4.dist-info/LICENSE.md deleted file mode 100644 index b6f87326ffb36158c33f5e6dc9d6175262050cea..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/LICENSE.md +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2013-2021, Kim Davies -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/METADATA b/venv/lib/python3.8/site-packages/idna-3.4.dist-info/METADATA deleted file mode 100644 index 07f6193b0fd00f3d86a82d800e544bb3755c998e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/METADATA +++ /dev/null @@ -1,242 +0,0 @@ -Metadata-Version: 2.1 -Name: idna -Version: 3.4 -Summary: Internationalized Domain Names in Applications (IDNA) -Author-email: Kim Davies -Requires-Python: >=3.5 -Description-Content-Type: text/x-rst -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: System Administrators -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Internet :: Name Service (DNS) -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Utilities -Project-URL: Changelog, https://github.com/kjd/idna/blob/master/HISTORY.rst -Project-URL: Issue tracker, https://github.com/kjd/idna/issues -Project-URL: Source, https://github.com/kjd/idna - -Internationalized Domain Names in Applications (IDNA) -===================================================== - -Support for the Internationalized Domain Names in -Applications (IDNA) protocol as specified in `RFC 5891 -`_. This is the latest version of -the protocol and is sometimes referred to as “IDNA 2008”. - -This library also provides support for Unicode Technical -Standard 46, `Unicode IDNA Compatibility Processing -`_. - -This acts as a suitable replacement for the “encodings.idna” -module that comes with the Python standard library, but which -only supports the older superseded IDNA specification (`RFC 3490 -`_). - -Basic functions are simply executed: - -.. code-block:: pycon - - >>> import idna - >>> idna.encode('ドメイン.テスト') - b'xn--eckwd4c7c.xn--zckzah' - >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) - ドメイン.テスト - - -Installation ------------- - -This package is available for installation from PyPI: - -.. code-block:: bash - - $ python3 -m pip install idna - - -Usage ------ - -For typical usage, the ``encode`` and ``decode`` functions will take a -domain name argument and perform a conversion to A-labels or U-labels -respectively. - -.. code-block:: pycon - - >>> import idna - >>> idna.encode('ドメイン.テスト') - b'xn--eckwd4c7c.xn--zckzah' - >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) - ドメイン.テスト - -You may use the codec encoding and decoding methods using the -``idna.codec`` module: - -.. code-block:: pycon - - >>> import idna.codec - >>> print('домен.испытание'.encode('idna')) - b'xn--d1acufc.xn--80akhbyknj4f' - >>> print(b'xn--d1acufc.xn--80akhbyknj4f'.decode('idna')) - домен.испытание - -Conversions can be applied at a per-label basis using the ``ulabel`` or -``alabel`` functions if necessary: - -.. code-block:: pycon - - >>> idna.alabel('测试') - b'xn--0zwm56d' - -Compatibility Mapping (UTS #46) -+++++++++++++++++++++++++++++++ - -As described in `RFC 5895 `_, the -IDNA specification does not normalize input from different potential -ways a user may input a domain name. This functionality, known as -a “mapping”, is considered by the specification to be a local -user-interface issue distinct from IDNA conversion functionality. - -This library provides one such mapping, that was developed by the -Unicode Consortium. Known as `Unicode IDNA Compatibility Processing -`_, it provides for both a regular -mapping for typical applications, as well as a transitional mapping to -help migrate from older IDNA 2003 applications. - -For example, “Königsgäßchen” is not a permissible label as *LATIN -CAPITAL LETTER K* is not allowed (nor are capital letters in general). -UTS 46 will convert this into lower case prior to applying the IDNA -conversion. - -.. code-block:: pycon - - >>> import idna - >>> idna.encode('Königsgäßchen') - ... - idna.core.InvalidCodepoint: Codepoint U+004B at position 1 of 'Königsgäßchen' not allowed - >>> idna.encode('Königsgäßchen', uts46=True) - b'xn--knigsgchen-b4a3dun' - >>> print(idna.decode('xn--knigsgchen-b4a3dun')) - königsgäßchen - -Transitional processing provides conversions to help transition from -the older 2003 standard to the current standard. For example, in the -original IDNA specification, the *LATIN SMALL LETTER SHARP S* (ß) was -converted into two *LATIN SMALL LETTER S* (ss), whereas in the current -IDNA specification this conversion is not performed. - -.. code-block:: pycon - - >>> idna.encode('Königsgäßchen', uts46=True, transitional=True) - 'xn--knigsgsschen-lcb0w' - -Implementors should use transitional processing with caution, only in -rare cases where conversion from legacy labels to current labels must be -performed (i.e. IDNA implementations that pre-date 2008). For typical -applications that just need to convert labels, transitional processing -is unlikely to be beneficial and could produce unexpected incompatible -results. - -``encodings.idna`` Compatibility -++++++++++++++++++++++++++++++++ - -Function calls from the Python built-in ``encodings.idna`` module are -mapped to their IDNA 2008 equivalents using the ``idna.compat`` module. -Simply substitute the ``import`` clause in your code to refer to the new -module name. - -Exceptions ----------- - -All errors raised during the conversion following the specification -should raise an exception derived from the ``idna.IDNAError`` base -class. - -More specific exceptions that may be generated as ``idna.IDNABidiError`` -when the error reflects an illegal combination of left-to-right and -right-to-left characters in a label; ``idna.InvalidCodepoint`` when -a specific codepoint is an illegal character in an IDN label (i.e. -INVALID); and ``idna.InvalidCodepointContext`` when the codepoint is -illegal based on its positional context (i.e. it is CONTEXTO or CONTEXTJ -but the contextual requirements are not satisfied.) - -Building and Diagnostics ------------------------- - -The IDNA and UTS 46 functionality relies upon pre-calculated lookup -tables for performance. These tables are derived from computing against -eligibility criteria in the respective standards. These tables are -computed using the command-line script ``tools/idna-data``. - -This tool will fetch relevant codepoint data from the Unicode repository -and perform the required calculations to identify eligibility. There are -three main modes: - -* ``idna-data make-libdata``. Generates ``idnadata.py`` and - ``uts46data.py``, the pre-calculated lookup tables using for IDNA and - UTS 46 conversions. Implementors who wish to track this library against - a different Unicode version may use this tool to manually generate a - different version of the ``idnadata.py`` and ``uts46data.py`` files. - -* ``idna-data make-table``. Generate a table of the IDNA disposition - (e.g. PVALID, CONTEXTJ, CONTEXTO) in the format found in Appendix - B.1 of RFC 5892 and the pre-computed tables published by `IANA - `_. - -* ``idna-data U+0061``. Prints debugging output on the various - properties associated with an individual Unicode codepoint (in this - case, U+0061), that are used to assess the IDNA and UTS 46 status of a - codepoint. This is helpful in debugging or analysis. - -The tool accepts a number of arguments, described using ``idna-data --h``. Most notably, the ``--version`` argument allows the specification -of the version of Unicode to use in computing the table data. For -example, ``idna-data --version 9.0.0 make-libdata`` will generate -library data against Unicode 9.0.0. - - -Additional Notes ----------------- - -* **Packages**. The latest tagged release version is published in the - `Python Package Index `_. - -* **Version support**. This library supports Python 3.5 and higher. - As this library serves as a low-level toolkit for a variety of - applications, many of which strive for broad compatibility with older - Python versions, there is no rush to remove older intepreter support. - Removing support for older versions should be well justified in that the - maintenance burden has become too high. - -* **Python 2**. Python 2 is supported by version 2.x of this library. - While active development of the version 2.x series has ended, notable - issues being corrected may be backported to 2.x. Use "idna<3" in your - requirements file if you need this library for a Python 2 application. - -* **Testing**. The library has a test suite based on each rule of the - IDNA specification, as well as tests that are provided as part of the - Unicode Technical Standard 46, `Unicode IDNA Compatibility Processing - `_. - -* **Emoji**. It is an occasional request to support emoji domains in - this library. Encoding of symbols like emoji is expressly prohibited by - the technical standard IDNA 2008 and emoji domains are broadly phased - out across the domain industry due to associated security risks. For - now, applications that wish need to support these non-compliant labels - may wish to consider trying the encode/decode operation in this library - first, and then falling back to using `encodings.idna`. See `the Github - project `_ for more discussion. - diff --git a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/RECORD b/venv/lib/python3.8/site-packages/idna-3.4.dist-info/RECORD deleted file mode 100644 index ee42cd71a80cfd0d8a0999e08250317cbe667e74..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/RECORD +++ /dev/null @@ -1,22 +0,0 @@ -idna-3.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -idna-3.4.dist-info/LICENSE.md,sha256=otbk2UC9JNvnuWRc3hmpeSzFHbeuDVrNMBrIYMqj6DY,1523 -idna-3.4.dist-info/METADATA,sha256=8aLSf9MFS7oB26pZh2hprg7eJp0UJSc-3rpf_evp4DA,9830 -idna-3.4.dist-info/RECORD,, -idna-3.4.dist-info/WHEEL,sha256=4TfKIB_xu-04bc2iKz6_zFt-gEFEEDU_31HGhqzOCE8,81 -idna/__init__.py,sha256=KJQN1eQBr8iIK5SKrJ47lXvxG0BJ7Lm38W4zT0v_8lk,849 -idna/__pycache__/__init__.cpython-38.pyc,, -idna/__pycache__/codec.cpython-38.pyc,, -idna/__pycache__/compat.cpython-38.pyc,, -idna/__pycache__/core.cpython-38.pyc,, -idna/__pycache__/idnadata.cpython-38.pyc,, -idna/__pycache__/intranges.cpython-38.pyc,, -idna/__pycache__/package_data.cpython-38.pyc,, -idna/__pycache__/uts46data.cpython-38.pyc,, -idna/codec.py,sha256=6ly5odKfqrytKT9_7UrlGklHnf1DSK2r9C6cSM4sa28,3374 -idna/compat.py,sha256=0_sOEUMT4CVw9doD3vyRhX80X19PwqFoUBs7gWsFME4,321 -idna/core.py,sha256=1JxchwKzkxBSn7R_oCE12oBu3eVux0VzdxolmIad24M,12950 -idna/idnadata.py,sha256=xUjqKqiJV8Ho_XzBpAtv5JFoVPSupK-SUXvtjygUHqw,44375 -idna/intranges.py,sha256=YBr4fRYuWH7kTKS2tXlFjM24ZF1Pdvcir-aywniInqg,1881 -idna/package_data.py,sha256=C_jHJzmX8PI4xq0jpzmcTMxpb5lDsq4o5VyxQzlVrZE,21 -idna/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -idna/uts46data.py,sha256=zvjZU24s58_uAS850Mcd0NnD0X7_gCMAMjzWNIeUJdc,206539 diff --git a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/WHEEL b/venv/lib/python3.8/site-packages/idna-3.4.dist-info/WHEEL deleted file mode 100644 index 668ba4d0151c5c76ed6e758061daa8c1b0bf5d21..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna-3.4.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.7.1 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/venv/lib/python3.8/site-packages/idna/__init__.py b/venv/lib/python3.8/site-packages/idna/__init__.py deleted file mode 100644 index a40eeafcc914108ca79c5d83d6e81da1b29c6e80..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna/__init__.py +++ /dev/null @@ -1,44 +0,0 @@ -from .package_data import __version__ -from .core import ( - IDNABidiError, - IDNAError, - InvalidCodepoint, - InvalidCodepointContext, - alabel, - check_bidi, - check_hyphen_ok, - check_initial_combiner, - check_label, - check_nfc, - decode, - encode, - ulabel, - uts46_remap, - valid_contextj, - valid_contexto, - valid_label_length, - valid_string_length, -) -from .intranges import intranges_contain - -__all__ = [ - "IDNABidiError", - "IDNAError", - "InvalidCodepoint", - "InvalidCodepointContext", - "alabel", - "check_bidi", - "check_hyphen_ok", - "check_initial_combiner", - "check_label", - "check_nfc", - "decode", - "encode", - "intranges_contain", - "ulabel", - "uts46_remap", - "valid_contextj", - "valid_contexto", - "valid_label_length", - "valid_string_length", -] diff --git a/venv/lib/python3.8/site-packages/idna/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/idna/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 0d1734d5e78f9124d72a1f9ee0e848776a558835..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/idna/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/idna/__pycache__/codec.cpython-38.pyc b/venv/lib/python3.8/site-packages/idna/__pycache__/codec.cpython-38.pyc deleted file mode 100644 index b363dbc6a17c86b5c6026b787978769f0a795627..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/idna/__pycache__/codec.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/idna/__pycache__/compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/idna/__pycache__/compat.cpython-38.pyc deleted file mode 100644 index f2aa9f740526a3757ecaebd46543c106b63ae80c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/idna/__pycache__/compat.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/idna/__pycache__/core.cpython-38.pyc b/venv/lib/python3.8/site-packages/idna/__pycache__/core.cpython-38.pyc deleted file mode 100644 index 8150ecd900093c3450758d5d9d173910127462bc..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/idna/__pycache__/core.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/idna/__pycache__/idnadata.cpython-38.pyc b/venv/lib/python3.8/site-packages/idna/__pycache__/idnadata.cpython-38.pyc deleted file mode 100644 index 8937d23f3f919c63a8aae7f319e9cf7b15a916ec..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/idna/__pycache__/idnadata.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/idna/__pycache__/intranges.cpython-38.pyc b/venv/lib/python3.8/site-packages/idna/__pycache__/intranges.cpython-38.pyc deleted file mode 100644 index 9e94dbd974ffadb8ba0f953dc7cdb0b6c2238e25..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/idna/__pycache__/intranges.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/idna/__pycache__/package_data.cpython-38.pyc b/venv/lib/python3.8/site-packages/idna/__pycache__/package_data.cpython-38.pyc deleted file mode 100644 index b841100d83c0809de92e1d9bb198f14b6170e865..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/idna/__pycache__/package_data.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/idna/__pycache__/uts46data.cpython-38.pyc b/venv/lib/python3.8/site-packages/idna/__pycache__/uts46data.cpython-38.pyc deleted file mode 100644 index d70b368f60e1a9c696430dd0625bdae207f3de9a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/idna/__pycache__/uts46data.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/idna/codec.py b/venv/lib/python3.8/site-packages/idna/codec.py deleted file mode 100644 index 1ca9ba62c208527b796b49306f4b8c95eb868a51..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna/codec.py +++ /dev/null @@ -1,112 +0,0 @@ -from .core import encode, decode, alabel, ulabel, IDNAError -import codecs -import re -from typing import Tuple, Optional - -_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]') - -class Codec(codecs.Codec): - - def encode(self, data: str, errors: str = 'strict') -> Tuple[bytes, int]: - if errors != 'strict': - raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) - - if not data: - return b"", 0 - - return encode(data), len(data) - - def decode(self, data: bytes, errors: str = 'strict') -> Tuple[str, int]: - if errors != 'strict': - raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) - - if not data: - return '', 0 - - return decode(data), len(data) - -class IncrementalEncoder(codecs.BufferedIncrementalEncoder): - def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[str, int]: # type: ignore - if errors != 'strict': - raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) - - if not data: - return "", 0 - - labels = _unicode_dots_re.split(data) - trailing_dot = '' - if labels: - if not labels[-1]: - trailing_dot = '.' - del labels[-1] - elif not final: - # Keep potentially unfinished label until the next call - del labels[-1] - if labels: - trailing_dot = '.' - - result = [] - size = 0 - for label in labels: - result.append(alabel(label)) - if size: - size += 1 - size += len(label) - - # Join with U+002E - result_str = '.'.join(result) + trailing_dot # type: ignore - size += len(trailing_dot) - return result_str, size - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def _buffer_decode(self, data: str, errors: str, final: bool) -> Tuple[str, int]: # type: ignore - if errors != 'strict': - raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) - - if not data: - return ('', 0) - - labels = _unicode_dots_re.split(data) - trailing_dot = '' - if labels: - if not labels[-1]: - trailing_dot = '.' - del labels[-1] - elif not final: - # Keep potentially unfinished label until the next call - del labels[-1] - if labels: - trailing_dot = '.' - - result = [] - size = 0 - for label in labels: - result.append(ulabel(label)) - if size: - size += 1 - size += len(label) - - result_str = '.'.join(result) + trailing_dot - size += len(trailing_dot) - return (result_str, size) - - -class StreamWriter(Codec, codecs.StreamWriter): - pass - - -class StreamReader(Codec, codecs.StreamReader): - pass - - -def getregentry() -> codecs.CodecInfo: - # Compatibility as a search_function for codecs.register() - return codecs.CodecInfo( - name='idna', - encode=Codec().encode, # type: ignore - decode=Codec().decode, # type: ignore - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/venv/lib/python3.8/site-packages/idna/compat.py b/venv/lib/python3.8/site-packages/idna/compat.py deleted file mode 100644 index 786e6bda63699b72d588ba91dd73df017570aee5..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna/compat.py +++ /dev/null @@ -1,13 +0,0 @@ -from .core import * -from .codec import * -from typing import Any, Union - -def ToASCII(label: str) -> bytes: - return encode(label) - -def ToUnicode(label: Union[bytes, bytearray]) -> str: - return decode(label) - -def nameprep(s: Any) -> None: - raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol') - diff --git a/venv/lib/python3.8/site-packages/idna/core.py b/venv/lib/python3.8/site-packages/idna/core.py deleted file mode 100644 index 4f3003711020eac05ef5a19ab29ba5670d89f642..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna/core.py +++ /dev/null @@ -1,400 +0,0 @@ -from . import idnadata -import bisect -import unicodedata -import re -from typing import Union, Optional -from .intranges import intranges_contain - -_virama_combining_class = 9 -_alabel_prefix = b'xn--' -_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]') - -class IDNAError(UnicodeError): - """ Base exception for all IDNA-encoding related problems """ - pass - - -class IDNABidiError(IDNAError): - """ Exception when bidirectional requirements are not satisfied """ - pass - - -class InvalidCodepoint(IDNAError): - """ Exception when a disallowed or unallocated codepoint is used """ - pass - - -class InvalidCodepointContext(IDNAError): - """ Exception when the codepoint is not valid in the context it is used """ - pass - - -def _combining_class(cp: int) -> int: - v = unicodedata.combining(chr(cp)) - if v == 0: - if not unicodedata.name(chr(cp)): - raise ValueError('Unknown character in unicodedata') - return v - -def _is_script(cp: str, script: str) -> bool: - return intranges_contain(ord(cp), idnadata.scripts[script]) - -def _punycode(s: str) -> bytes: - return s.encode('punycode') - -def _unot(s: int) -> str: - return 'U+{:04X}'.format(s) - - -def valid_label_length(label: Union[bytes, str]) -> bool: - if len(label) > 63: - return False - return True - - -def valid_string_length(label: Union[bytes, str], trailing_dot: bool) -> bool: - if len(label) > (254 if trailing_dot else 253): - return False - return True - - -def check_bidi(label: str, check_ltr: bool = False) -> bool: - # Bidi rules should only be applied if string contains RTL characters - bidi_label = False - for (idx, cp) in enumerate(label, 1): - direction = unicodedata.bidirectional(cp) - if direction == '': - # String likely comes from a newer version of Unicode - raise IDNABidiError('Unknown directionality in label {} at position {}'.format(repr(label), idx)) - if direction in ['R', 'AL', 'AN']: - bidi_label = True - if not bidi_label and not check_ltr: - return True - - # Bidi rule 1 - direction = unicodedata.bidirectional(label[0]) - if direction in ['R', 'AL']: - rtl = True - elif direction == 'L': - rtl = False - else: - raise IDNABidiError('First codepoint in label {} must be directionality L, R or AL'.format(repr(label))) - - valid_ending = False - number_type = None # type: Optional[str] - for (idx, cp) in enumerate(label, 1): - direction = unicodedata.bidirectional(cp) - - if rtl: - # Bidi rule 2 - if not direction in ['R', 'AL', 'AN', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']: - raise IDNABidiError('Invalid direction for codepoint at position {} in a right-to-left label'.format(idx)) - # Bidi rule 3 - if direction in ['R', 'AL', 'EN', 'AN']: - valid_ending = True - elif direction != 'NSM': - valid_ending = False - # Bidi rule 4 - if direction in ['AN', 'EN']: - if not number_type: - number_type = direction - else: - if number_type != direction: - raise IDNABidiError('Can not mix numeral types in a right-to-left label') - else: - # Bidi rule 5 - if not direction in ['L', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']: - raise IDNABidiError('Invalid direction for codepoint at position {} in a left-to-right label'.format(idx)) - # Bidi rule 6 - if direction in ['L', 'EN']: - valid_ending = True - elif direction != 'NSM': - valid_ending = False - - if not valid_ending: - raise IDNABidiError('Label ends with illegal codepoint directionality') - - return True - - -def check_initial_combiner(label: str) -> bool: - if unicodedata.category(label[0])[0] == 'M': - raise IDNAError('Label begins with an illegal combining character') - return True - - -def check_hyphen_ok(label: str) -> bool: - if label[2:4] == '--': - raise IDNAError('Label has disallowed hyphens in 3rd and 4th position') - if label[0] == '-' or label[-1] == '-': - raise IDNAError('Label must not start or end with a hyphen') - return True - - -def check_nfc(label: str) -> None: - if unicodedata.normalize('NFC', label) != label: - raise IDNAError('Label must be in Normalization Form C') - - -def valid_contextj(label: str, pos: int) -> bool: - cp_value = ord(label[pos]) - - if cp_value == 0x200c: - - if pos > 0: - if _combining_class(ord(label[pos - 1])) == _virama_combining_class: - return True - - ok = False - for i in range(pos-1, -1, -1): - joining_type = idnadata.joining_types.get(ord(label[i])) - if joining_type == ord('T'): - continue - if joining_type in [ord('L'), ord('D')]: - ok = True - break - - if not ok: - return False - - ok = False - for i in range(pos+1, len(label)): - joining_type = idnadata.joining_types.get(ord(label[i])) - if joining_type == ord('T'): - continue - if joining_type in [ord('R'), ord('D')]: - ok = True - break - return ok - - if cp_value == 0x200d: - - if pos > 0: - if _combining_class(ord(label[pos - 1])) == _virama_combining_class: - return True - return False - - else: - - return False - - -def valid_contexto(label: str, pos: int, exception: bool = False) -> bool: - cp_value = ord(label[pos]) - - if cp_value == 0x00b7: - if 0 < pos < len(label)-1: - if ord(label[pos - 1]) == 0x006c and ord(label[pos + 1]) == 0x006c: - return True - return False - - elif cp_value == 0x0375: - if pos < len(label)-1 and len(label) > 1: - return _is_script(label[pos + 1], 'Greek') - return False - - elif cp_value == 0x05f3 or cp_value == 0x05f4: - if pos > 0: - return _is_script(label[pos - 1], 'Hebrew') - return False - - elif cp_value == 0x30fb: - for cp in label: - if cp == '\u30fb': - continue - if _is_script(cp, 'Hiragana') or _is_script(cp, 'Katakana') or _is_script(cp, 'Han'): - return True - return False - - elif 0x660 <= cp_value <= 0x669: - for cp in label: - if 0x6f0 <= ord(cp) <= 0x06f9: - return False - return True - - elif 0x6f0 <= cp_value <= 0x6f9: - for cp in label: - if 0x660 <= ord(cp) <= 0x0669: - return False - return True - - return False - - -def check_label(label: Union[str, bytes, bytearray]) -> None: - if isinstance(label, (bytes, bytearray)): - label = label.decode('utf-8') - if len(label) == 0: - raise IDNAError('Empty Label') - - check_nfc(label) - check_hyphen_ok(label) - check_initial_combiner(label) - - for (pos, cp) in enumerate(label): - cp_value = ord(cp) - if intranges_contain(cp_value, idnadata.codepoint_classes['PVALID']): - continue - elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']): - try: - if not valid_contextj(label, pos): - raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format( - _unot(cp_value), pos+1, repr(label))) - except ValueError: - raise IDNAError('Unknown codepoint adjacent to joiner {} at position {} in {}'.format( - _unot(cp_value), pos+1, repr(label))) - elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']): - if not valid_contexto(label, pos): - raise InvalidCodepointContext('Codepoint {} not allowed at position {} in {}'.format(_unot(cp_value), pos+1, repr(label))) - else: - raise InvalidCodepoint('Codepoint {} at position {} of {} not allowed'.format(_unot(cp_value), pos+1, repr(label))) - - check_bidi(label) - - -def alabel(label: str) -> bytes: - try: - label_bytes = label.encode('ascii') - ulabel(label_bytes) - if not valid_label_length(label_bytes): - raise IDNAError('Label too long') - return label_bytes - except UnicodeEncodeError: - pass - - if not label: - raise IDNAError('No Input') - - label = str(label) - check_label(label) - label_bytes = _punycode(label) - label_bytes = _alabel_prefix + label_bytes - - if not valid_label_length(label_bytes): - raise IDNAError('Label too long') - - return label_bytes - - -def ulabel(label: Union[str, bytes, bytearray]) -> str: - if not isinstance(label, (bytes, bytearray)): - try: - label_bytes = label.encode('ascii') - except UnicodeEncodeError: - check_label(label) - return label - else: - label_bytes = label - - label_bytes = label_bytes.lower() - if label_bytes.startswith(_alabel_prefix): - label_bytes = label_bytes[len(_alabel_prefix):] - if not label_bytes: - raise IDNAError('Malformed A-label, no Punycode eligible content found') - if label_bytes.decode('ascii')[-1] == '-': - raise IDNAError('A-label must not end with a hyphen') - else: - check_label(label_bytes) - return label_bytes.decode('ascii') - - try: - label = label_bytes.decode('punycode') - except UnicodeError: - raise IDNAError('Invalid A-label') - check_label(label) - return label - - -def uts46_remap(domain: str, std3_rules: bool = True, transitional: bool = False) -> str: - """Re-map the characters in the string according to UTS46 processing.""" - from .uts46data import uts46data - output = '' - - for pos, char in enumerate(domain): - code_point = ord(char) - try: - uts46row = uts46data[code_point if code_point < 256 else - bisect.bisect_left(uts46data, (code_point, 'Z')) - 1] - status = uts46row[1] - replacement = None # type: Optional[str] - if len(uts46row) == 3: - replacement = uts46row[2] # type: ignore - if (status == 'V' or - (status == 'D' and not transitional) or - (status == '3' and not std3_rules and replacement is None)): - output += char - elif replacement is not None and (status == 'M' or - (status == '3' and not std3_rules) or - (status == 'D' and transitional)): - output += replacement - elif status != 'I': - raise IndexError() - except IndexError: - raise InvalidCodepoint( - 'Codepoint {} not allowed at position {} in {}'.format( - _unot(code_point), pos + 1, repr(domain))) - - return unicodedata.normalize('NFC', output) - - -def encode(s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False, transitional: bool = False) -> bytes: - if isinstance(s, (bytes, bytearray)): - try: - s = s.decode('ascii') - except UnicodeDecodeError: - raise IDNAError('should pass a unicode string to the function rather than a byte string.') - if uts46: - s = uts46_remap(s, std3_rules, transitional) - trailing_dot = False - result = [] - if strict: - labels = s.split('.') - else: - labels = _unicode_dots_re.split(s) - if not labels or labels == ['']: - raise IDNAError('Empty domain') - if labels[-1] == '': - del labels[-1] - trailing_dot = True - for label in labels: - s = alabel(label) - if s: - result.append(s) - else: - raise IDNAError('Empty label') - if trailing_dot: - result.append(b'') - s = b'.'.join(result) - if not valid_string_length(s, trailing_dot): - raise IDNAError('Domain too long') - return s - - -def decode(s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False) -> str: - try: - if isinstance(s, (bytes, bytearray)): - s = s.decode('ascii') - except UnicodeDecodeError: - raise IDNAError('Invalid ASCII in A-label') - if uts46: - s = uts46_remap(s, std3_rules, False) - trailing_dot = False - result = [] - if not strict: - labels = _unicode_dots_re.split(s) - else: - labels = s.split('.') - if not labels or labels == ['']: - raise IDNAError('Empty domain') - if not labels[-1]: - del labels[-1] - trailing_dot = True - for label in labels: - s = ulabel(label) - if s: - result.append(s) - else: - raise IDNAError('Empty label') - if trailing_dot: - result.append('') - return '.'.join(result) diff --git a/venv/lib/python3.8/site-packages/idna/idnadata.py b/venv/lib/python3.8/site-packages/idna/idnadata.py deleted file mode 100644 index 67db4625829680298b2a5a9032a379d870a00700..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna/idnadata.py +++ /dev/null @@ -1,2151 +0,0 @@ -# This file is automatically generated by tools/idna-data - -__version__ = '15.0.0' -scripts = { - 'Greek': ( - 0x37000000374, - 0x37500000378, - 0x37a0000037e, - 0x37f00000380, - 0x38400000385, - 0x38600000387, - 0x3880000038b, - 0x38c0000038d, - 0x38e000003a2, - 0x3a3000003e2, - 0x3f000000400, - 0x1d2600001d2b, - 0x1d5d00001d62, - 0x1d6600001d6b, - 0x1dbf00001dc0, - 0x1f0000001f16, - 0x1f1800001f1e, - 0x1f2000001f46, - 0x1f4800001f4e, - 0x1f5000001f58, - 0x1f5900001f5a, - 0x1f5b00001f5c, - 0x1f5d00001f5e, - 0x1f5f00001f7e, - 0x1f8000001fb5, - 0x1fb600001fc5, - 0x1fc600001fd4, - 0x1fd600001fdc, - 0x1fdd00001ff0, - 0x1ff200001ff5, - 0x1ff600001fff, - 0x212600002127, - 0xab650000ab66, - 0x101400001018f, - 0x101a0000101a1, - 0x1d2000001d246, - ), - 'Han': ( - 0x2e8000002e9a, - 0x2e9b00002ef4, - 0x2f0000002fd6, - 0x300500003006, - 0x300700003008, - 0x30210000302a, - 0x30380000303c, - 0x340000004dc0, - 0x4e000000a000, - 0xf9000000fa6e, - 0xfa700000fada, - 0x16fe200016fe4, - 0x16ff000016ff2, - 0x200000002a6e0, - 0x2a7000002b73a, - 0x2b7400002b81e, - 0x2b8200002cea2, - 0x2ceb00002ebe1, - 0x2f8000002fa1e, - 0x300000003134b, - 0x31350000323b0, - ), - 'Hebrew': ( - 0x591000005c8, - 0x5d0000005eb, - 0x5ef000005f5, - 0xfb1d0000fb37, - 0xfb380000fb3d, - 0xfb3e0000fb3f, - 0xfb400000fb42, - 0xfb430000fb45, - 0xfb460000fb50, - ), - 'Hiragana': ( - 0x304100003097, - 0x309d000030a0, - 0x1b0010001b120, - 0x1b1320001b133, - 0x1b1500001b153, - 0x1f2000001f201, - ), - 'Katakana': ( - 0x30a1000030fb, - 0x30fd00003100, - 0x31f000003200, - 0x32d0000032ff, - 0x330000003358, - 0xff660000ff70, - 0xff710000ff9e, - 0x1aff00001aff4, - 0x1aff50001affc, - 0x1affd0001afff, - 0x1b0000001b001, - 0x1b1200001b123, - 0x1b1550001b156, - 0x1b1640001b168, - ), -} -joining_types = { - 0x600: 85, - 0x601: 85, - 0x602: 85, - 0x603: 85, - 0x604: 85, - 0x605: 85, - 0x608: 85, - 0x60b: 85, - 0x620: 68, - 0x621: 85, - 0x622: 82, - 0x623: 82, - 0x624: 82, - 0x625: 82, - 0x626: 68, - 0x627: 82, - 0x628: 68, - 0x629: 82, - 0x62a: 68, - 0x62b: 68, - 0x62c: 68, - 0x62d: 68, - 0x62e: 68, - 0x62f: 82, - 0x630: 82, - 0x631: 82, - 0x632: 82, - 0x633: 68, - 0x634: 68, - 0x635: 68, - 0x636: 68, - 0x637: 68, - 0x638: 68, - 0x639: 68, - 0x63a: 68, - 0x63b: 68, - 0x63c: 68, - 0x63d: 68, - 0x63e: 68, - 0x63f: 68, - 0x640: 67, - 0x641: 68, - 0x642: 68, - 0x643: 68, - 0x644: 68, - 0x645: 68, - 0x646: 68, - 0x647: 68, - 0x648: 82, - 0x649: 68, - 0x64a: 68, - 0x66e: 68, - 0x66f: 68, - 0x671: 82, - 0x672: 82, - 0x673: 82, - 0x674: 85, - 0x675: 82, - 0x676: 82, - 0x677: 82, - 0x678: 68, - 0x679: 68, - 0x67a: 68, - 0x67b: 68, - 0x67c: 68, - 0x67d: 68, - 0x67e: 68, - 0x67f: 68, - 0x680: 68, - 0x681: 68, - 0x682: 68, - 0x683: 68, - 0x684: 68, - 0x685: 68, - 0x686: 68, - 0x687: 68, - 0x688: 82, - 0x689: 82, - 0x68a: 82, - 0x68b: 82, - 0x68c: 82, - 0x68d: 82, - 0x68e: 82, - 0x68f: 82, - 0x690: 82, - 0x691: 82, - 0x692: 82, - 0x693: 82, - 0x694: 82, - 0x695: 82, - 0x696: 82, - 0x697: 82, - 0x698: 82, - 0x699: 82, - 0x69a: 68, - 0x69b: 68, - 0x69c: 68, - 0x69d: 68, - 0x69e: 68, - 0x69f: 68, - 0x6a0: 68, - 0x6a1: 68, - 0x6a2: 68, - 0x6a3: 68, - 0x6a4: 68, - 0x6a5: 68, - 0x6a6: 68, - 0x6a7: 68, - 0x6a8: 68, - 0x6a9: 68, - 0x6aa: 68, - 0x6ab: 68, - 0x6ac: 68, - 0x6ad: 68, - 0x6ae: 68, - 0x6af: 68, - 0x6b0: 68, - 0x6b1: 68, - 0x6b2: 68, - 0x6b3: 68, - 0x6b4: 68, - 0x6b5: 68, - 0x6b6: 68, - 0x6b7: 68, - 0x6b8: 68, - 0x6b9: 68, - 0x6ba: 68, - 0x6bb: 68, - 0x6bc: 68, - 0x6bd: 68, - 0x6be: 68, - 0x6bf: 68, - 0x6c0: 82, - 0x6c1: 68, - 0x6c2: 68, - 0x6c3: 82, - 0x6c4: 82, - 0x6c5: 82, - 0x6c6: 82, - 0x6c7: 82, - 0x6c8: 82, - 0x6c9: 82, - 0x6ca: 82, - 0x6cb: 82, - 0x6cc: 68, - 0x6cd: 82, - 0x6ce: 68, - 0x6cf: 82, - 0x6d0: 68, - 0x6d1: 68, - 0x6d2: 82, - 0x6d3: 82, - 0x6d5: 82, - 0x6dd: 85, - 0x6ee: 82, - 0x6ef: 82, - 0x6fa: 68, - 0x6fb: 68, - 0x6fc: 68, - 0x6ff: 68, - 0x70f: 84, - 0x710: 82, - 0x712: 68, - 0x713: 68, - 0x714: 68, - 0x715: 82, - 0x716: 82, - 0x717: 82, - 0x718: 82, - 0x719: 82, - 0x71a: 68, - 0x71b: 68, - 0x71c: 68, - 0x71d: 68, - 0x71e: 82, - 0x71f: 68, - 0x720: 68, - 0x721: 68, - 0x722: 68, - 0x723: 68, - 0x724: 68, - 0x725: 68, - 0x726: 68, - 0x727: 68, - 0x728: 82, - 0x729: 68, - 0x72a: 82, - 0x72b: 68, - 0x72c: 82, - 0x72d: 68, - 0x72e: 68, - 0x72f: 82, - 0x74d: 82, - 0x74e: 68, - 0x74f: 68, - 0x750: 68, - 0x751: 68, - 0x752: 68, - 0x753: 68, - 0x754: 68, - 0x755: 68, - 0x756: 68, - 0x757: 68, - 0x758: 68, - 0x759: 82, - 0x75a: 82, - 0x75b: 82, - 0x75c: 68, - 0x75d: 68, - 0x75e: 68, - 0x75f: 68, - 0x760: 68, - 0x761: 68, - 0x762: 68, - 0x763: 68, - 0x764: 68, - 0x765: 68, - 0x766: 68, - 0x767: 68, - 0x768: 68, - 0x769: 68, - 0x76a: 68, - 0x76b: 82, - 0x76c: 82, - 0x76d: 68, - 0x76e: 68, - 0x76f: 68, - 0x770: 68, - 0x771: 82, - 0x772: 68, - 0x773: 82, - 0x774: 82, - 0x775: 68, - 0x776: 68, - 0x777: 68, - 0x778: 82, - 0x779: 82, - 0x77a: 68, - 0x77b: 68, - 0x77c: 68, - 0x77d: 68, - 0x77e: 68, - 0x77f: 68, - 0x7ca: 68, - 0x7cb: 68, - 0x7cc: 68, - 0x7cd: 68, - 0x7ce: 68, - 0x7cf: 68, - 0x7d0: 68, - 0x7d1: 68, - 0x7d2: 68, - 0x7d3: 68, - 0x7d4: 68, - 0x7d5: 68, - 0x7d6: 68, - 0x7d7: 68, - 0x7d8: 68, - 0x7d9: 68, - 0x7da: 68, - 0x7db: 68, - 0x7dc: 68, - 0x7dd: 68, - 0x7de: 68, - 0x7df: 68, - 0x7e0: 68, - 0x7e1: 68, - 0x7e2: 68, - 0x7e3: 68, - 0x7e4: 68, - 0x7e5: 68, - 0x7e6: 68, - 0x7e7: 68, - 0x7e8: 68, - 0x7e9: 68, - 0x7ea: 68, - 0x7fa: 67, - 0x840: 82, - 0x841: 68, - 0x842: 68, - 0x843: 68, - 0x844: 68, - 0x845: 68, - 0x846: 82, - 0x847: 82, - 0x848: 68, - 0x849: 82, - 0x84a: 68, - 0x84b: 68, - 0x84c: 68, - 0x84d: 68, - 0x84e: 68, - 0x84f: 68, - 0x850: 68, - 0x851: 68, - 0x852: 68, - 0x853: 68, - 0x854: 82, - 0x855: 68, - 0x856: 82, - 0x857: 82, - 0x858: 82, - 0x860: 68, - 0x861: 85, - 0x862: 68, - 0x863: 68, - 0x864: 68, - 0x865: 68, - 0x866: 85, - 0x867: 82, - 0x868: 68, - 0x869: 82, - 0x86a: 82, - 0x870: 82, - 0x871: 82, - 0x872: 82, - 0x873: 82, - 0x874: 82, - 0x875: 82, - 0x876: 82, - 0x877: 82, - 0x878: 82, - 0x879: 82, - 0x87a: 82, - 0x87b: 82, - 0x87c: 82, - 0x87d: 82, - 0x87e: 82, - 0x87f: 82, - 0x880: 82, - 0x881: 82, - 0x882: 82, - 0x883: 67, - 0x884: 67, - 0x885: 67, - 0x886: 68, - 0x887: 85, - 0x888: 85, - 0x889: 68, - 0x88a: 68, - 0x88b: 68, - 0x88c: 68, - 0x88d: 68, - 0x88e: 82, - 0x890: 85, - 0x891: 85, - 0x8a0: 68, - 0x8a1: 68, - 0x8a2: 68, - 0x8a3: 68, - 0x8a4: 68, - 0x8a5: 68, - 0x8a6: 68, - 0x8a7: 68, - 0x8a8: 68, - 0x8a9: 68, - 0x8aa: 82, - 0x8ab: 82, - 0x8ac: 82, - 0x8ad: 85, - 0x8ae: 82, - 0x8af: 68, - 0x8b0: 68, - 0x8b1: 82, - 0x8b2: 82, - 0x8b3: 68, - 0x8b4: 68, - 0x8b5: 68, - 0x8b6: 68, - 0x8b7: 68, - 0x8b8: 68, - 0x8b9: 82, - 0x8ba: 68, - 0x8bb: 68, - 0x8bc: 68, - 0x8bd: 68, - 0x8be: 68, - 0x8bf: 68, - 0x8c0: 68, - 0x8c1: 68, - 0x8c2: 68, - 0x8c3: 68, - 0x8c4: 68, - 0x8c5: 68, - 0x8c6: 68, - 0x8c7: 68, - 0x8c8: 68, - 0x8e2: 85, - 0x1806: 85, - 0x1807: 68, - 0x180a: 67, - 0x180e: 85, - 0x1820: 68, - 0x1821: 68, - 0x1822: 68, - 0x1823: 68, - 0x1824: 68, - 0x1825: 68, - 0x1826: 68, - 0x1827: 68, - 0x1828: 68, - 0x1829: 68, - 0x182a: 68, - 0x182b: 68, - 0x182c: 68, - 0x182d: 68, - 0x182e: 68, - 0x182f: 68, - 0x1830: 68, - 0x1831: 68, - 0x1832: 68, - 0x1833: 68, - 0x1834: 68, - 0x1835: 68, - 0x1836: 68, - 0x1837: 68, - 0x1838: 68, - 0x1839: 68, - 0x183a: 68, - 0x183b: 68, - 0x183c: 68, - 0x183d: 68, - 0x183e: 68, - 0x183f: 68, - 0x1840: 68, - 0x1841: 68, - 0x1842: 68, - 0x1843: 68, - 0x1844: 68, - 0x1845: 68, - 0x1846: 68, - 0x1847: 68, - 0x1848: 68, - 0x1849: 68, - 0x184a: 68, - 0x184b: 68, - 0x184c: 68, - 0x184d: 68, - 0x184e: 68, - 0x184f: 68, - 0x1850: 68, - 0x1851: 68, - 0x1852: 68, - 0x1853: 68, - 0x1854: 68, - 0x1855: 68, - 0x1856: 68, - 0x1857: 68, - 0x1858: 68, - 0x1859: 68, - 0x185a: 68, - 0x185b: 68, - 0x185c: 68, - 0x185d: 68, - 0x185e: 68, - 0x185f: 68, - 0x1860: 68, - 0x1861: 68, - 0x1862: 68, - 0x1863: 68, - 0x1864: 68, - 0x1865: 68, - 0x1866: 68, - 0x1867: 68, - 0x1868: 68, - 0x1869: 68, - 0x186a: 68, - 0x186b: 68, - 0x186c: 68, - 0x186d: 68, - 0x186e: 68, - 0x186f: 68, - 0x1870: 68, - 0x1871: 68, - 0x1872: 68, - 0x1873: 68, - 0x1874: 68, - 0x1875: 68, - 0x1876: 68, - 0x1877: 68, - 0x1878: 68, - 0x1880: 85, - 0x1881: 85, - 0x1882: 85, - 0x1883: 85, - 0x1884: 85, - 0x1885: 84, - 0x1886: 84, - 0x1887: 68, - 0x1888: 68, - 0x1889: 68, - 0x188a: 68, - 0x188b: 68, - 0x188c: 68, - 0x188d: 68, - 0x188e: 68, - 0x188f: 68, - 0x1890: 68, - 0x1891: 68, - 0x1892: 68, - 0x1893: 68, - 0x1894: 68, - 0x1895: 68, - 0x1896: 68, - 0x1897: 68, - 0x1898: 68, - 0x1899: 68, - 0x189a: 68, - 0x189b: 68, - 0x189c: 68, - 0x189d: 68, - 0x189e: 68, - 0x189f: 68, - 0x18a0: 68, - 0x18a1: 68, - 0x18a2: 68, - 0x18a3: 68, - 0x18a4: 68, - 0x18a5: 68, - 0x18a6: 68, - 0x18a7: 68, - 0x18a8: 68, - 0x18aa: 68, - 0x200c: 85, - 0x200d: 67, - 0x202f: 85, - 0x2066: 85, - 0x2067: 85, - 0x2068: 85, - 0x2069: 85, - 0xa840: 68, - 0xa841: 68, - 0xa842: 68, - 0xa843: 68, - 0xa844: 68, - 0xa845: 68, - 0xa846: 68, - 0xa847: 68, - 0xa848: 68, - 0xa849: 68, - 0xa84a: 68, - 0xa84b: 68, - 0xa84c: 68, - 0xa84d: 68, - 0xa84e: 68, - 0xa84f: 68, - 0xa850: 68, - 0xa851: 68, - 0xa852: 68, - 0xa853: 68, - 0xa854: 68, - 0xa855: 68, - 0xa856: 68, - 0xa857: 68, - 0xa858: 68, - 0xa859: 68, - 0xa85a: 68, - 0xa85b: 68, - 0xa85c: 68, - 0xa85d: 68, - 0xa85e: 68, - 0xa85f: 68, - 0xa860: 68, - 0xa861: 68, - 0xa862: 68, - 0xa863: 68, - 0xa864: 68, - 0xa865: 68, - 0xa866: 68, - 0xa867: 68, - 0xa868: 68, - 0xa869: 68, - 0xa86a: 68, - 0xa86b: 68, - 0xa86c: 68, - 0xa86d: 68, - 0xa86e: 68, - 0xa86f: 68, - 0xa870: 68, - 0xa871: 68, - 0xa872: 76, - 0xa873: 85, - 0x10ac0: 68, - 0x10ac1: 68, - 0x10ac2: 68, - 0x10ac3: 68, - 0x10ac4: 68, - 0x10ac5: 82, - 0x10ac6: 85, - 0x10ac7: 82, - 0x10ac8: 85, - 0x10ac9: 82, - 0x10aca: 82, - 0x10acb: 85, - 0x10acc: 85, - 0x10acd: 76, - 0x10ace: 82, - 0x10acf: 82, - 0x10ad0: 82, - 0x10ad1: 82, - 0x10ad2: 82, - 0x10ad3: 68, - 0x10ad4: 68, - 0x10ad5: 68, - 0x10ad6: 68, - 0x10ad7: 76, - 0x10ad8: 68, - 0x10ad9: 68, - 0x10ada: 68, - 0x10adb: 68, - 0x10adc: 68, - 0x10add: 82, - 0x10ade: 68, - 0x10adf: 68, - 0x10ae0: 68, - 0x10ae1: 82, - 0x10ae2: 85, - 0x10ae3: 85, - 0x10ae4: 82, - 0x10aeb: 68, - 0x10aec: 68, - 0x10aed: 68, - 0x10aee: 68, - 0x10aef: 82, - 0x10b80: 68, - 0x10b81: 82, - 0x10b82: 68, - 0x10b83: 82, - 0x10b84: 82, - 0x10b85: 82, - 0x10b86: 68, - 0x10b87: 68, - 0x10b88: 68, - 0x10b89: 82, - 0x10b8a: 68, - 0x10b8b: 68, - 0x10b8c: 82, - 0x10b8d: 68, - 0x10b8e: 82, - 0x10b8f: 82, - 0x10b90: 68, - 0x10b91: 82, - 0x10ba9: 82, - 0x10baa: 82, - 0x10bab: 82, - 0x10bac: 82, - 0x10bad: 68, - 0x10bae: 68, - 0x10baf: 85, - 0x10d00: 76, - 0x10d01: 68, - 0x10d02: 68, - 0x10d03: 68, - 0x10d04: 68, - 0x10d05: 68, - 0x10d06: 68, - 0x10d07: 68, - 0x10d08: 68, - 0x10d09: 68, - 0x10d0a: 68, - 0x10d0b: 68, - 0x10d0c: 68, - 0x10d0d: 68, - 0x10d0e: 68, - 0x10d0f: 68, - 0x10d10: 68, - 0x10d11: 68, - 0x10d12: 68, - 0x10d13: 68, - 0x10d14: 68, - 0x10d15: 68, - 0x10d16: 68, - 0x10d17: 68, - 0x10d18: 68, - 0x10d19: 68, - 0x10d1a: 68, - 0x10d1b: 68, - 0x10d1c: 68, - 0x10d1d: 68, - 0x10d1e: 68, - 0x10d1f: 68, - 0x10d20: 68, - 0x10d21: 68, - 0x10d22: 82, - 0x10d23: 68, - 0x10f30: 68, - 0x10f31: 68, - 0x10f32: 68, - 0x10f33: 82, - 0x10f34: 68, - 0x10f35: 68, - 0x10f36: 68, - 0x10f37: 68, - 0x10f38: 68, - 0x10f39: 68, - 0x10f3a: 68, - 0x10f3b: 68, - 0x10f3c: 68, - 0x10f3d: 68, - 0x10f3e: 68, - 0x10f3f: 68, - 0x10f40: 68, - 0x10f41: 68, - 0x10f42: 68, - 0x10f43: 68, - 0x10f44: 68, - 0x10f45: 85, - 0x10f51: 68, - 0x10f52: 68, - 0x10f53: 68, - 0x10f54: 82, - 0x10f70: 68, - 0x10f71: 68, - 0x10f72: 68, - 0x10f73: 68, - 0x10f74: 82, - 0x10f75: 82, - 0x10f76: 68, - 0x10f77: 68, - 0x10f78: 68, - 0x10f79: 68, - 0x10f7a: 68, - 0x10f7b: 68, - 0x10f7c: 68, - 0x10f7d: 68, - 0x10f7e: 68, - 0x10f7f: 68, - 0x10f80: 68, - 0x10f81: 68, - 0x10fb0: 68, - 0x10fb1: 85, - 0x10fb2: 68, - 0x10fb3: 68, - 0x10fb4: 82, - 0x10fb5: 82, - 0x10fb6: 82, - 0x10fb7: 85, - 0x10fb8: 68, - 0x10fb9: 82, - 0x10fba: 82, - 0x10fbb: 68, - 0x10fbc: 68, - 0x10fbd: 82, - 0x10fbe: 68, - 0x10fbf: 68, - 0x10fc0: 85, - 0x10fc1: 68, - 0x10fc2: 82, - 0x10fc3: 82, - 0x10fc4: 68, - 0x10fc5: 85, - 0x10fc6: 85, - 0x10fc7: 85, - 0x10fc8: 85, - 0x10fc9: 82, - 0x10fca: 68, - 0x10fcb: 76, - 0x110bd: 85, - 0x110cd: 85, - 0x1e900: 68, - 0x1e901: 68, - 0x1e902: 68, - 0x1e903: 68, - 0x1e904: 68, - 0x1e905: 68, - 0x1e906: 68, - 0x1e907: 68, - 0x1e908: 68, - 0x1e909: 68, - 0x1e90a: 68, - 0x1e90b: 68, - 0x1e90c: 68, - 0x1e90d: 68, - 0x1e90e: 68, - 0x1e90f: 68, - 0x1e910: 68, - 0x1e911: 68, - 0x1e912: 68, - 0x1e913: 68, - 0x1e914: 68, - 0x1e915: 68, - 0x1e916: 68, - 0x1e917: 68, - 0x1e918: 68, - 0x1e919: 68, - 0x1e91a: 68, - 0x1e91b: 68, - 0x1e91c: 68, - 0x1e91d: 68, - 0x1e91e: 68, - 0x1e91f: 68, - 0x1e920: 68, - 0x1e921: 68, - 0x1e922: 68, - 0x1e923: 68, - 0x1e924: 68, - 0x1e925: 68, - 0x1e926: 68, - 0x1e927: 68, - 0x1e928: 68, - 0x1e929: 68, - 0x1e92a: 68, - 0x1e92b: 68, - 0x1e92c: 68, - 0x1e92d: 68, - 0x1e92e: 68, - 0x1e92f: 68, - 0x1e930: 68, - 0x1e931: 68, - 0x1e932: 68, - 0x1e933: 68, - 0x1e934: 68, - 0x1e935: 68, - 0x1e936: 68, - 0x1e937: 68, - 0x1e938: 68, - 0x1e939: 68, - 0x1e93a: 68, - 0x1e93b: 68, - 0x1e93c: 68, - 0x1e93d: 68, - 0x1e93e: 68, - 0x1e93f: 68, - 0x1e940: 68, - 0x1e941: 68, - 0x1e942: 68, - 0x1e943: 68, - 0x1e94b: 84, -} -codepoint_classes = { - 'PVALID': ( - 0x2d0000002e, - 0x300000003a, - 0x610000007b, - 0xdf000000f7, - 0xf800000100, - 0x10100000102, - 0x10300000104, - 0x10500000106, - 0x10700000108, - 0x1090000010a, - 0x10b0000010c, - 0x10d0000010e, - 0x10f00000110, - 0x11100000112, - 0x11300000114, - 0x11500000116, - 0x11700000118, - 0x1190000011a, - 0x11b0000011c, - 0x11d0000011e, - 0x11f00000120, - 0x12100000122, - 0x12300000124, - 0x12500000126, - 0x12700000128, - 0x1290000012a, - 0x12b0000012c, - 0x12d0000012e, - 0x12f00000130, - 0x13100000132, - 0x13500000136, - 0x13700000139, - 0x13a0000013b, - 0x13c0000013d, - 0x13e0000013f, - 0x14200000143, - 0x14400000145, - 0x14600000147, - 0x14800000149, - 0x14b0000014c, - 0x14d0000014e, - 0x14f00000150, - 0x15100000152, - 0x15300000154, - 0x15500000156, - 0x15700000158, - 0x1590000015a, - 0x15b0000015c, - 0x15d0000015e, - 0x15f00000160, - 0x16100000162, - 0x16300000164, - 0x16500000166, - 0x16700000168, - 0x1690000016a, - 0x16b0000016c, - 0x16d0000016e, - 0x16f00000170, - 0x17100000172, - 0x17300000174, - 0x17500000176, - 0x17700000178, - 0x17a0000017b, - 0x17c0000017d, - 0x17e0000017f, - 0x18000000181, - 0x18300000184, - 0x18500000186, - 0x18800000189, - 0x18c0000018e, - 0x19200000193, - 0x19500000196, - 0x1990000019c, - 0x19e0000019f, - 0x1a1000001a2, - 0x1a3000001a4, - 0x1a5000001a6, - 0x1a8000001a9, - 0x1aa000001ac, - 0x1ad000001ae, - 0x1b0000001b1, - 0x1b4000001b5, - 0x1b6000001b7, - 0x1b9000001bc, - 0x1bd000001c4, - 0x1ce000001cf, - 0x1d0000001d1, - 0x1d2000001d3, - 0x1d4000001d5, - 0x1d6000001d7, - 0x1d8000001d9, - 0x1da000001db, - 0x1dc000001de, - 0x1df000001e0, - 0x1e1000001e2, - 0x1e3000001e4, - 0x1e5000001e6, - 0x1e7000001e8, - 0x1e9000001ea, - 0x1eb000001ec, - 0x1ed000001ee, - 0x1ef000001f1, - 0x1f5000001f6, - 0x1f9000001fa, - 0x1fb000001fc, - 0x1fd000001fe, - 0x1ff00000200, - 0x20100000202, - 0x20300000204, - 0x20500000206, - 0x20700000208, - 0x2090000020a, - 0x20b0000020c, - 0x20d0000020e, - 0x20f00000210, - 0x21100000212, - 0x21300000214, - 0x21500000216, - 0x21700000218, - 0x2190000021a, - 0x21b0000021c, - 0x21d0000021e, - 0x21f00000220, - 0x22100000222, - 0x22300000224, - 0x22500000226, - 0x22700000228, - 0x2290000022a, - 0x22b0000022c, - 0x22d0000022e, - 0x22f00000230, - 0x23100000232, - 0x2330000023a, - 0x23c0000023d, - 0x23f00000241, - 0x24200000243, - 0x24700000248, - 0x2490000024a, - 0x24b0000024c, - 0x24d0000024e, - 0x24f000002b0, - 0x2b9000002c2, - 0x2c6000002d2, - 0x2ec000002ed, - 0x2ee000002ef, - 0x30000000340, - 0x34200000343, - 0x3460000034f, - 0x35000000370, - 0x37100000372, - 0x37300000374, - 0x37700000378, - 0x37b0000037e, - 0x39000000391, - 0x3ac000003cf, - 0x3d7000003d8, - 0x3d9000003da, - 0x3db000003dc, - 0x3dd000003de, - 0x3df000003e0, - 0x3e1000003e2, - 0x3e3000003e4, - 0x3e5000003e6, - 0x3e7000003e8, - 0x3e9000003ea, - 0x3eb000003ec, - 0x3ed000003ee, - 0x3ef000003f0, - 0x3f3000003f4, - 0x3f8000003f9, - 0x3fb000003fd, - 0x43000000460, - 0x46100000462, - 0x46300000464, - 0x46500000466, - 0x46700000468, - 0x4690000046a, - 0x46b0000046c, - 0x46d0000046e, - 0x46f00000470, - 0x47100000472, - 0x47300000474, - 0x47500000476, - 0x47700000478, - 0x4790000047a, - 0x47b0000047c, - 0x47d0000047e, - 0x47f00000480, - 0x48100000482, - 0x48300000488, - 0x48b0000048c, - 0x48d0000048e, - 0x48f00000490, - 0x49100000492, - 0x49300000494, - 0x49500000496, - 0x49700000498, - 0x4990000049a, - 0x49b0000049c, - 0x49d0000049e, - 0x49f000004a0, - 0x4a1000004a2, - 0x4a3000004a4, - 0x4a5000004a6, - 0x4a7000004a8, - 0x4a9000004aa, - 0x4ab000004ac, - 0x4ad000004ae, - 0x4af000004b0, - 0x4b1000004b2, - 0x4b3000004b4, - 0x4b5000004b6, - 0x4b7000004b8, - 0x4b9000004ba, - 0x4bb000004bc, - 0x4bd000004be, - 0x4bf000004c0, - 0x4c2000004c3, - 0x4c4000004c5, - 0x4c6000004c7, - 0x4c8000004c9, - 0x4ca000004cb, - 0x4cc000004cd, - 0x4ce000004d0, - 0x4d1000004d2, - 0x4d3000004d4, - 0x4d5000004d6, - 0x4d7000004d8, - 0x4d9000004da, - 0x4db000004dc, - 0x4dd000004de, - 0x4df000004e0, - 0x4e1000004e2, - 0x4e3000004e4, - 0x4e5000004e6, - 0x4e7000004e8, - 0x4e9000004ea, - 0x4eb000004ec, - 0x4ed000004ee, - 0x4ef000004f0, - 0x4f1000004f2, - 0x4f3000004f4, - 0x4f5000004f6, - 0x4f7000004f8, - 0x4f9000004fa, - 0x4fb000004fc, - 0x4fd000004fe, - 0x4ff00000500, - 0x50100000502, - 0x50300000504, - 0x50500000506, - 0x50700000508, - 0x5090000050a, - 0x50b0000050c, - 0x50d0000050e, - 0x50f00000510, - 0x51100000512, - 0x51300000514, - 0x51500000516, - 0x51700000518, - 0x5190000051a, - 0x51b0000051c, - 0x51d0000051e, - 0x51f00000520, - 0x52100000522, - 0x52300000524, - 0x52500000526, - 0x52700000528, - 0x5290000052a, - 0x52b0000052c, - 0x52d0000052e, - 0x52f00000530, - 0x5590000055a, - 0x56000000587, - 0x58800000589, - 0x591000005be, - 0x5bf000005c0, - 0x5c1000005c3, - 0x5c4000005c6, - 0x5c7000005c8, - 0x5d0000005eb, - 0x5ef000005f3, - 0x6100000061b, - 0x62000000640, - 0x64100000660, - 0x66e00000675, - 0x679000006d4, - 0x6d5000006dd, - 0x6df000006e9, - 0x6ea000006f0, - 0x6fa00000700, - 0x7100000074b, - 0x74d000007b2, - 0x7c0000007f6, - 0x7fd000007fe, - 0x8000000082e, - 0x8400000085c, - 0x8600000086b, - 0x87000000888, - 0x8890000088f, - 0x898000008e2, - 0x8e300000958, - 0x96000000964, - 0x96600000970, - 0x97100000984, - 0x9850000098d, - 0x98f00000991, - 0x993000009a9, - 0x9aa000009b1, - 0x9b2000009b3, - 0x9b6000009ba, - 0x9bc000009c5, - 0x9c7000009c9, - 0x9cb000009cf, - 0x9d7000009d8, - 0x9e0000009e4, - 0x9e6000009f2, - 0x9fc000009fd, - 0x9fe000009ff, - 0xa0100000a04, - 0xa0500000a0b, - 0xa0f00000a11, - 0xa1300000a29, - 0xa2a00000a31, - 0xa3200000a33, - 0xa3500000a36, - 0xa3800000a3a, - 0xa3c00000a3d, - 0xa3e00000a43, - 0xa4700000a49, - 0xa4b00000a4e, - 0xa5100000a52, - 0xa5c00000a5d, - 0xa6600000a76, - 0xa8100000a84, - 0xa8500000a8e, - 0xa8f00000a92, - 0xa9300000aa9, - 0xaaa00000ab1, - 0xab200000ab4, - 0xab500000aba, - 0xabc00000ac6, - 0xac700000aca, - 0xacb00000ace, - 0xad000000ad1, - 0xae000000ae4, - 0xae600000af0, - 0xaf900000b00, - 0xb0100000b04, - 0xb0500000b0d, - 0xb0f00000b11, - 0xb1300000b29, - 0xb2a00000b31, - 0xb3200000b34, - 0xb3500000b3a, - 0xb3c00000b45, - 0xb4700000b49, - 0xb4b00000b4e, - 0xb5500000b58, - 0xb5f00000b64, - 0xb6600000b70, - 0xb7100000b72, - 0xb8200000b84, - 0xb8500000b8b, - 0xb8e00000b91, - 0xb9200000b96, - 0xb9900000b9b, - 0xb9c00000b9d, - 0xb9e00000ba0, - 0xba300000ba5, - 0xba800000bab, - 0xbae00000bba, - 0xbbe00000bc3, - 0xbc600000bc9, - 0xbca00000bce, - 0xbd000000bd1, - 0xbd700000bd8, - 0xbe600000bf0, - 0xc0000000c0d, - 0xc0e00000c11, - 0xc1200000c29, - 0xc2a00000c3a, - 0xc3c00000c45, - 0xc4600000c49, - 0xc4a00000c4e, - 0xc5500000c57, - 0xc5800000c5b, - 0xc5d00000c5e, - 0xc6000000c64, - 0xc6600000c70, - 0xc8000000c84, - 0xc8500000c8d, - 0xc8e00000c91, - 0xc9200000ca9, - 0xcaa00000cb4, - 0xcb500000cba, - 0xcbc00000cc5, - 0xcc600000cc9, - 0xcca00000cce, - 0xcd500000cd7, - 0xcdd00000cdf, - 0xce000000ce4, - 0xce600000cf0, - 0xcf100000cf4, - 0xd0000000d0d, - 0xd0e00000d11, - 0xd1200000d45, - 0xd4600000d49, - 0xd4a00000d4f, - 0xd5400000d58, - 0xd5f00000d64, - 0xd6600000d70, - 0xd7a00000d80, - 0xd8100000d84, - 0xd8500000d97, - 0xd9a00000db2, - 0xdb300000dbc, - 0xdbd00000dbe, - 0xdc000000dc7, - 0xdca00000dcb, - 0xdcf00000dd5, - 0xdd600000dd7, - 0xdd800000de0, - 0xde600000df0, - 0xdf200000df4, - 0xe0100000e33, - 0xe3400000e3b, - 0xe4000000e4f, - 0xe5000000e5a, - 0xe8100000e83, - 0xe8400000e85, - 0xe8600000e8b, - 0xe8c00000ea4, - 0xea500000ea6, - 0xea700000eb3, - 0xeb400000ebe, - 0xec000000ec5, - 0xec600000ec7, - 0xec800000ecf, - 0xed000000eda, - 0xede00000ee0, - 0xf0000000f01, - 0xf0b00000f0c, - 0xf1800000f1a, - 0xf2000000f2a, - 0xf3500000f36, - 0xf3700000f38, - 0xf3900000f3a, - 0xf3e00000f43, - 0xf4400000f48, - 0xf4900000f4d, - 0xf4e00000f52, - 0xf5300000f57, - 0xf5800000f5c, - 0xf5d00000f69, - 0xf6a00000f6d, - 0xf7100000f73, - 0xf7400000f75, - 0xf7a00000f81, - 0xf8200000f85, - 0xf8600000f93, - 0xf9400000f98, - 0xf9900000f9d, - 0xf9e00000fa2, - 0xfa300000fa7, - 0xfa800000fac, - 0xfad00000fb9, - 0xfba00000fbd, - 0xfc600000fc7, - 0x10000000104a, - 0x10500000109e, - 0x10d0000010fb, - 0x10fd00001100, - 0x120000001249, - 0x124a0000124e, - 0x125000001257, - 0x125800001259, - 0x125a0000125e, - 0x126000001289, - 0x128a0000128e, - 0x1290000012b1, - 0x12b2000012b6, - 0x12b8000012bf, - 0x12c0000012c1, - 0x12c2000012c6, - 0x12c8000012d7, - 0x12d800001311, - 0x131200001316, - 0x13180000135b, - 0x135d00001360, - 0x138000001390, - 0x13a0000013f6, - 0x14010000166d, - 0x166f00001680, - 0x16810000169b, - 0x16a0000016eb, - 0x16f1000016f9, - 0x170000001716, - 0x171f00001735, - 0x174000001754, - 0x17600000176d, - 0x176e00001771, - 0x177200001774, - 0x1780000017b4, - 0x17b6000017d4, - 0x17d7000017d8, - 0x17dc000017de, - 0x17e0000017ea, - 0x18100000181a, - 0x182000001879, - 0x1880000018ab, - 0x18b0000018f6, - 0x19000000191f, - 0x19200000192c, - 0x19300000193c, - 0x19460000196e, - 0x197000001975, - 0x1980000019ac, - 0x19b0000019ca, - 0x19d0000019da, - 0x1a0000001a1c, - 0x1a2000001a5f, - 0x1a6000001a7d, - 0x1a7f00001a8a, - 0x1a9000001a9a, - 0x1aa700001aa8, - 0x1ab000001abe, - 0x1abf00001acf, - 0x1b0000001b4d, - 0x1b5000001b5a, - 0x1b6b00001b74, - 0x1b8000001bf4, - 0x1c0000001c38, - 0x1c4000001c4a, - 0x1c4d00001c7e, - 0x1cd000001cd3, - 0x1cd400001cfb, - 0x1d0000001d2c, - 0x1d2f00001d30, - 0x1d3b00001d3c, - 0x1d4e00001d4f, - 0x1d6b00001d78, - 0x1d7900001d9b, - 0x1dc000001e00, - 0x1e0100001e02, - 0x1e0300001e04, - 0x1e0500001e06, - 0x1e0700001e08, - 0x1e0900001e0a, - 0x1e0b00001e0c, - 0x1e0d00001e0e, - 0x1e0f00001e10, - 0x1e1100001e12, - 0x1e1300001e14, - 0x1e1500001e16, - 0x1e1700001e18, - 0x1e1900001e1a, - 0x1e1b00001e1c, - 0x1e1d00001e1e, - 0x1e1f00001e20, - 0x1e2100001e22, - 0x1e2300001e24, - 0x1e2500001e26, - 0x1e2700001e28, - 0x1e2900001e2a, - 0x1e2b00001e2c, - 0x1e2d00001e2e, - 0x1e2f00001e30, - 0x1e3100001e32, - 0x1e3300001e34, - 0x1e3500001e36, - 0x1e3700001e38, - 0x1e3900001e3a, - 0x1e3b00001e3c, - 0x1e3d00001e3e, - 0x1e3f00001e40, - 0x1e4100001e42, - 0x1e4300001e44, - 0x1e4500001e46, - 0x1e4700001e48, - 0x1e4900001e4a, - 0x1e4b00001e4c, - 0x1e4d00001e4e, - 0x1e4f00001e50, - 0x1e5100001e52, - 0x1e5300001e54, - 0x1e5500001e56, - 0x1e5700001e58, - 0x1e5900001e5a, - 0x1e5b00001e5c, - 0x1e5d00001e5e, - 0x1e5f00001e60, - 0x1e6100001e62, - 0x1e6300001e64, - 0x1e6500001e66, - 0x1e6700001e68, - 0x1e6900001e6a, - 0x1e6b00001e6c, - 0x1e6d00001e6e, - 0x1e6f00001e70, - 0x1e7100001e72, - 0x1e7300001e74, - 0x1e7500001e76, - 0x1e7700001e78, - 0x1e7900001e7a, - 0x1e7b00001e7c, - 0x1e7d00001e7e, - 0x1e7f00001e80, - 0x1e8100001e82, - 0x1e8300001e84, - 0x1e8500001e86, - 0x1e8700001e88, - 0x1e8900001e8a, - 0x1e8b00001e8c, - 0x1e8d00001e8e, - 0x1e8f00001e90, - 0x1e9100001e92, - 0x1e9300001e94, - 0x1e9500001e9a, - 0x1e9c00001e9e, - 0x1e9f00001ea0, - 0x1ea100001ea2, - 0x1ea300001ea4, - 0x1ea500001ea6, - 0x1ea700001ea8, - 0x1ea900001eaa, - 0x1eab00001eac, - 0x1ead00001eae, - 0x1eaf00001eb0, - 0x1eb100001eb2, - 0x1eb300001eb4, - 0x1eb500001eb6, - 0x1eb700001eb8, - 0x1eb900001eba, - 0x1ebb00001ebc, - 0x1ebd00001ebe, - 0x1ebf00001ec0, - 0x1ec100001ec2, - 0x1ec300001ec4, - 0x1ec500001ec6, - 0x1ec700001ec8, - 0x1ec900001eca, - 0x1ecb00001ecc, - 0x1ecd00001ece, - 0x1ecf00001ed0, - 0x1ed100001ed2, - 0x1ed300001ed4, - 0x1ed500001ed6, - 0x1ed700001ed8, - 0x1ed900001eda, - 0x1edb00001edc, - 0x1edd00001ede, - 0x1edf00001ee0, - 0x1ee100001ee2, - 0x1ee300001ee4, - 0x1ee500001ee6, - 0x1ee700001ee8, - 0x1ee900001eea, - 0x1eeb00001eec, - 0x1eed00001eee, - 0x1eef00001ef0, - 0x1ef100001ef2, - 0x1ef300001ef4, - 0x1ef500001ef6, - 0x1ef700001ef8, - 0x1ef900001efa, - 0x1efb00001efc, - 0x1efd00001efe, - 0x1eff00001f08, - 0x1f1000001f16, - 0x1f2000001f28, - 0x1f3000001f38, - 0x1f4000001f46, - 0x1f5000001f58, - 0x1f6000001f68, - 0x1f7000001f71, - 0x1f7200001f73, - 0x1f7400001f75, - 0x1f7600001f77, - 0x1f7800001f79, - 0x1f7a00001f7b, - 0x1f7c00001f7d, - 0x1fb000001fb2, - 0x1fb600001fb7, - 0x1fc600001fc7, - 0x1fd000001fd3, - 0x1fd600001fd8, - 0x1fe000001fe3, - 0x1fe400001fe8, - 0x1ff600001ff7, - 0x214e0000214f, - 0x218400002185, - 0x2c3000002c60, - 0x2c6100002c62, - 0x2c6500002c67, - 0x2c6800002c69, - 0x2c6a00002c6b, - 0x2c6c00002c6d, - 0x2c7100002c72, - 0x2c7300002c75, - 0x2c7600002c7c, - 0x2c8100002c82, - 0x2c8300002c84, - 0x2c8500002c86, - 0x2c8700002c88, - 0x2c8900002c8a, - 0x2c8b00002c8c, - 0x2c8d00002c8e, - 0x2c8f00002c90, - 0x2c9100002c92, - 0x2c9300002c94, - 0x2c9500002c96, - 0x2c9700002c98, - 0x2c9900002c9a, - 0x2c9b00002c9c, - 0x2c9d00002c9e, - 0x2c9f00002ca0, - 0x2ca100002ca2, - 0x2ca300002ca4, - 0x2ca500002ca6, - 0x2ca700002ca8, - 0x2ca900002caa, - 0x2cab00002cac, - 0x2cad00002cae, - 0x2caf00002cb0, - 0x2cb100002cb2, - 0x2cb300002cb4, - 0x2cb500002cb6, - 0x2cb700002cb8, - 0x2cb900002cba, - 0x2cbb00002cbc, - 0x2cbd00002cbe, - 0x2cbf00002cc0, - 0x2cc100002cc2, - 0x2cc300002cc4, - 0x2cc500002cc6, - 0x2cc700002cc8, - 0x2cc900002cca, - 0x2ccb00002ccc, - 0x2ccd00002cce, - 0x2ccf00002cd0, - 0x2cd100002cd2, - 0x2cd300002cd4, - 0x2cd500002cd6, - 0x2cd700002cd8, - 0x2cd900002cda, - 0x2cdb00002cdc, - 0x2cdd00002cde, - 0x2cdf00002ce0, - 0x2ce100002ce2, - 0x2ce300002ce5, - 0x2cec00002ced, - 0x2cee00002cf2, - 0x2cf300002cf4, - 0x2d0000002d26, - 0x2d2700002d28, - 0x2d2d00002d2e, - 0x2d3000002d68, - 0x2d7f00002d97, - 0x2da000002da7, - 0x2da800002daf, - 0x2db000002db7, - 0x2db800002dbf, - 0x2dc000002dc7, - 0x2dc800002dcf, - 0x2dd000002dd7, - 0x2dd800002ddf, - 0x2de000002e00, - 0x2e2f00002e30, - 0x300500003008, - 0x302a0000302e, - 0x303c0000303d, - 0x304100003097, - 0x30990000309b, - 0x309d0000309f, - 0x30a1000030fb, - 0x30fc000030ff, - 0x310500003130, - 0x31a0000031c0, - 0x31f000003200, - 0x340000004dc0, - 0x4e000000a48d, - 0xa4d00000a4fe, - 0xa5000000a60d, - 0xa6100000a62c, - 0xa6410000a642, - 0xa6430000a644, - 0xa6450000a646, - 0xa6470000a648, - 0xa6490000a64a, - 0xa64b0000a64c, - 0xa64d0000a64e, - 0xa64f0000a650, - 0xa6510000a652, - 0xa6530000a654, - 0xa6550000a656, - 0xa6570000a658, - 0xa6590000a65a, - 0xa65b0000a65c, - 0xa65d0000a65e, - 0xa65f0000a660, - 0xa6610000a662, - 0xa6630000a664, - 0xa6650000a666, - 0xa6670000a668, - 0xa6690000a66a, - 0xa66b0000a66c, - 0xa66d0000a670, - 0xa6740000a67e, - 0xa67f0000a680, - 0xa6810000a682, - 0xa6830000a684, - 0xa6850000a686, - 0xa6870000a688, - 0xa6890000a68a, - 0xa68b0000a68c, - 0xa68d0000a68e, - 0xa68f0000a690, - 0xa6910000a692, - 0xa6930000a694, - 0xa6950000a696, - 0xa6970000a698, - 0xa6990000a69a, - 0xa69b0000a69c, - 0xa69e0000a6e6, - 0xa6f00000a6f2, - 0xa7170000a720, - 0xa7230000a724, - 0xa7250000a726, - 0xa7270000a728, - 0xa7290000a72a, - 0xa72b0000a72c, - 0xa72d0000a72e, - 0xa72f0000a732, - 0xa7330000a734, - 0xa7350000a736, - 0xa7370000a738, - 0xa7390000a73a, - 0xa73b0000a73c, - 0xa73d0000a73e, - 0xa73f0000a740, - 0xa7410000a742, - 0xa7430000a744, - 0xa7450000a746, - 0xa7470000a748, - 0xa7490000a74a, - 0xa74b0000a74c, - 0xa74d0000a74e, - 0xa74f0000a750, - 0xa7510000a752, - 0xa7530000a754, - 0xa7550000a756, - 0xa7570000a758, - 0xa7590000a75a, - 0xa75b0000a75c, - 0xa75d0000a75e, - 0xa75f0000a760, - 0xa7610000a762, - 0xa7630000a764, - 0xa7650000a766, - 0xa7670000a768, - 0xa7690000a76a, - 0xa76b0000a76c, - 0xa76d0000a76e, - 0xa76f0000a770, - 0xa7710000a779, - 0xa77a0000a77b, - 0xa77c0000a77d, - 0xa77f0000a780, - 0xa7810000a782, - 0xa7830000a784, - 0xa7850000a786, - 0xa7870000a789, - 0xa78c0000a78d, - 0xa78e0000a790, - 0xa7910000a792, - 0xa7930000a796, - 0xa7970000a798, - 0xa7990000a79a, - 0xa79b0000a79c, - 0xa79d0000a79e, - 0xa79f0000a7a0, - 0xa7a10000a7a2, - 0xa7a30000a7a4, - 0xa7a50000a7a6, - 0xa7a70000a7a8, - 0xa7a90000a7aa, - 0xa7af0000a7b0, - 0xa7b50000a7b6, - 0xa7b70000a7b8, - 0xa7b90000a7ba, - 0xa7bb0000a7bc, - 0xa7bd0000a7be, - 0xa7bf0000a7c0, - 0xa7c10000a7c2, - 0xa7c30000a7c4, - 0xa7c80000a7c9, - 0xa7ca0000a7cb, - 0xa7d10000a7d2, - 0xa7d30000a7d4, - 0xa7d50000a7d6, - 0xa7d70000a7d8, - 0xa7d90000a7da, - 0xa7f20000a7f5, - 0xa7f60000a7f8, - 0xa7fa0000a828, - 0xa82c0000a82d, - 0xa8400000a874, - 0xa8800000a8c6, - 0xa8d00000a8da, - 0xa8e00000a8f8, - 0xa8fb0000a8fc, - 0xa8fd0000a92e, - 0xa9300000a954, - 0xa9800000a9c1, - 0xa9cf0000a9da, - 0xa9e00000a9ff, - 0xaa000000aa37, - 0xaa400000aa4e, - 0xaa500000aa5a, - 0xaa600000aa77, - 0xaa7a0000aac3, - 0xaadb0000aade, - 0xaae00000aaf0, - 0xaaf20000aaf7, - 0xab010000ab07, - 0xab090000ab0f, - 0xab110000ab17, - 0xab200000ab27, - 0xab280000ab2f, - 0xab300000ab5b, - 0xab600000ab69, - 0xabc00000abeb, - 0xabec0000abee, - 0xabf00000abfa, - 0xac000000d7a4, - 0xfa0e0000fa10, - 0xfa110000fa12, - 0xfa130000fa15, - 0xfa1f0000fa20, - 0xfa210000fa22, - 0xfa230000fa25, - 0xfa270000fa2a, - 0xfb1e0000fb1f, - 0xfe200000fe30, - 0xfe730000fe74, - 0x100000001000c, - 0x1000d00010027, - 0x100280001003b, - 0x1003c0001003e, - 0x1003f0001004e, - 0x100500001005e, - 0x10080000100fb, - 0x101fd000101fe, - 0x102800001029d, - 0x102a0000102d1, - 0x102e0000102e1, - 0x1030000010320, - 0x1032d00010341, - 0x103420001034a, - 0x103500001037b, - 0x103800001039e, - 0x103a0000103c4, - 0x103c8000103d0, - 0x104280001049e, - 0x104a0000104aa, - 0x104d8000104fc, - 0x1050000010528, - 0x1053000010564, - 0x10597000105a2, - 0x105a3000105b2, - 0x105b3000105ba, - 0x105bb000105bd, - 0x1060000010737, - 0x1074000010756, - 0x1076000010768, - 0x1078000010786, - 0x10787000107b1, - 0x107b2000107bb, - 0x1080000010806, - 0x1080800010809, - 0x1080a00010836, - 0x1083700010839, - 0x1083c0001083d, - 0x1083f00010856, - 0x1086000010877, - 0x108800001089f, - 0x108e0000108f3, - 0x108f4000108f6, - 0x1090000010916, - 0x109200001093a, - 0x10980000109b8, - 0x109be000109c0, - 0x10a0000010a04, - 0x10a0500010a07, - 0x10a0c00010a14, - 0x10a1500010a18, - 0x10a1900010a36, - 0x10a3800010a3b, - 0x10a3f00010a40, - 0x10a6000010a7d, - 0x10a8000010a9d, - 0x10ac000010ac8, - 0x10ac900010ae7, - 0x10b0000010b36, - 0x10b4000010b56, - 0x10b6000010b73, - 0x10b8000010b92, - 0x10c0000010c49, - 0x10cc000010cf3, - 0x10d0000010d28, - 0x10d3000010d3a, - 0x10e8000010eaa, - 0x10eab00010ead, - 0x10eb000010eb2, - 0x10efd00010f1d, - 0x10f2700010f28, - 0x10f3000010f51, - 0x10f7000010f86, - 0x10fb000010fc5, - 0x10fe000010ff7, - 0x1100000011047, - 0x1106600011076, - 0x1107f000110bb, - 0x110c2000110c3, - 0x110d0000110e9, - 0x110f0000110fa, - 0x1110000011135, - 0x1113600011140, - 0x1114400011148, - 0x1115000011174, - 0x1117600011177, - 0x11180000111c5, - 0x111c9000111cd, - 0x111ce000111db, - 0x111dc000111dd, - 0x1120000011212, - 0x1121300011238, - 0x1123e00011242, - 0x1128000011287, - 0x1128800011289, - 0x1128a0001128e, - 0x1128f0001129e, - 0x1129f000112a9, - 0x112b0000112eb, - 0x112f0000112fa, - 0x1130000011304, - 0x113050001130d, - 0x1130f00011311, - 0x1131300011329, - 0x1132a00011331, - 0x1133200011334, - 0x113350001133a, - 0x1133b00011345, - 0x1134700011349, - 0x1134b0001134e, - 0x1135000011351, - 0x1135700011358, - 0x1135d00011364, - 0x113660001136d, - 0x1137000011375, - 0x114000001144b, - 0x114500001145a, - 0x1145e00011462, - 0x11480000114c6, - 0x114c7000114c8, - 0x114d0000114da, - 0x11580000115b6, - 0x115b8000115c1, - 0x115d8000115de, - 0x1160000011641, - 0x1164400011645, - 0x116500001165a, - 0x11680000116b9, - 0x116c0000116ca, - 0x117000001171b, - 0x1171d0001172c, - 0x117300001173a, - 0x1174000011747, - 0x118000001183b, - 0x118c0000118ea, - 0x118ff00011907, - 0x119090001190a, - 0x1190c00011914, - 0x1191500011917, - 0x1191800011936, - 0x1193700011939, - 0x1193b00011944, - 0x119500001195a, - 0x119a0000119a8, - 0x119aa000119d8, - 0x119da000119e2, - 0x119e3000119e5, - 0x11a0000011a3f, - 0x11a4700011a48, - 0x11a5000011a9a, - 0x11a9d00011a9e, - 0x11ab000011af9, - 0x11c0000011c09, - 0x11c0a00011c37, - 0x11c3800011c41, - 0x11c5000011c5a, - 0x11c7200011c90, - 0x11c9200011ca8, - 0x11ca900011cb7, - 0x11d0000011d07, - 0x11d0800011d0a, - 0x11d0b00011d37, - 0x11d3a00011d3b, - 0x11d3c00011d3e, - 0x11d3f00011d48, - 0x11d5000011d5a, - 0x11d6000011d66, - 0x11d6700011d69, - 0x11d6a00011d8f, - 0x11d9000011d92, - 0x11d9300011d99, - 0x11da000011daa, - 0x11ee000011ef7, - 0x11f0000011f11, - 0x11f1200011f3b, - 0x11f3e00011f43, - 0x11f5000011f5a, - 0x11fb000011fb1, - 0x120000001239a, - 0x1248000012544, - 0x12f9000012ff1, - 0x1300000013430, - 0x1344000013456, - 0x1440000014647, - 0x1680000016a39, - 0x16a4000016a5f, - 0x16a6000016a6a, - 0x16a7000016abf, - 0x16ac000016aca, - 0x16ad000016aee, - 0x16af000016af5, - 0x16b0000016b37, - 0x16b4000016b44, - 0x16b5000016b5a, - 0x16b6300016b78, - 0x16b7d00016b90, - 0x16e6000016e80, - 0x16f0000016f4b, - 0x16f4f00016f88, - 0x16f8f00016fa0, - 0x16fe000016fe2, - 0x16fe300016fe5, - 0x16ff000016ff2, - 0x17000000187f8, - 0x1880000018cd6, - 0x18d0000018d09, - 0x1aff00001aff4, - 0x1aff50001affc, - 0x1affd0001afff, - 0x1b0000001b123, - 0x1b1320001b133, - 0x1b1500001b153, - 0x1b1550001b156, - 0x1b1640001b168, - 0x1b1700001b2fc, - 0x1bc000001bc6b, - 0x1bc700001bc7d, - 0x1bc800001bc89, - 0x1bc900001bc9a, - 0x1bc9d0001bc9f, - 0x1cf000001cf2e, - 0x1cf300001cf47, - 0x1da000001da37, - 0x1da3b0001da6d, - 0x1da750001da76, - 0x1da840001da85, - 0x1da9b0001daa0, - 0x1daa10001dab0, - 0x1df000001df1f, - 0x1df250001df2b, - 0x1e0000001e007, - 0x1e0080001e019, - 0x1e01b0001e022, - 0x1e0230001e025, - 0x1e0260001e02b, - 0x1e0300001e06e, - 0x1e08f0001e090, - 0x1e1000001e12d, - 0x1e1300001e13e, - 0x1e1400001e14a, - 0x1e14e0001e14f, - 0x1e2900001e2af, - 0x1e2c00001e2fa, - 0x1e4d00001e4fa, - 0x1e7e00001e7e7, - 0x1e7e80001e7ec, - 0x1e7ed0001e7ef, - 0x1e7f00001e7ff, - 0x1e8000001e8c5, - 0x1e8d00001e8d7, - 0x1e9220001e94c, - 0x1e9500001e95a, - 0x200000002a6e0, - 0x2a7000002b73a, - 0x2b7400002b81e, - 0x2b8200002cea2, - 0x2ceb00002ebe1, - 0x300000003134b, - 0x31350000323b0, - ), - 'CONTEXTJ': ( - 0x200c0000200e, - ), - 'CONTEXTO': ( - 0xb7000000b8, - 0x37500000376, - 0x5f3000005f5, - 0x6600000066a, - 0x6f0000006fa, - 0x30fb000030fc, - ), -} diff --git a/venv/lib/python3.8/site-packages/idna/intranges.py b/venv/lib/python3.8/site-packages/idna/intranges.py deleted file mode 100644 index 6a43b0475347cb50d0d65ada1000a82eeca9e882..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna/intranges.py +++ /dev/null @@ -1,54 +0,0 @@ -""" -Given a list of integers, made up of (hopefully) a small number of long runs -of consecutive integers, compute a representation of the form -((start1, end1), (start2, end2) ...). Then answer the question "was x present -in the original list?" in time O(log(# runs)). -""" - -import bisect -from typing import List, Tuple - -def intranges_from_list(list_: List[int]) -> Tuple[int, ...]: - """Represent a list of integers as a sequence of ranges: - ((start_0, end_0), (start_1, end_1), ...), such that the original - integers are exactly those x such that start_i <= x < end_i for some i. - - Ranges are encoded as single integers (start << 32 | end), not as tuples. - """ - - sorted_list = sorted(list_) - ranges = [] - last_write = -1 - for i in range(len(sorted_list)): - if i+1 < len(sorted_list): - if sorted_list[i] == sorted_list[i+1]-1: - continue - current_range = sorted_list[last_write+1:i+1] - ranges.append(_encode_range(current_range[0], current_range[-1] + 1)) - last_write = i - - return tuple(ranges) - -def _encode_range(start: int, end: int) -> int: - return (start << 32) | end - -def _decode_range(r: int) -> Tuple[int, int]: - return (r >> 32), (r & ((1 << 32) - 1)) - - -def intranges_contain(int_: int, ranges: Tuple[int, ...]) -> bool: - """Determine if `int_` falls into one of the ranges in `ranges`.""" - tuple_ = _encode_range(int_, 0) - pos = bisect.bisect_left(ranges, tuple_) - # we could be immediately ahead of a tuple (start, end) - # with start < int_ <= end - if pos > 0: - left, right = _decode_range(ranges[pos-1]) - if left <= int_ < right: - return True - # or we could be immediately behind a tuple (int_, end) - if pos < len(ranges): - left, _ = _decode_range(ranges[pos]) - if left == int_: - return True - return False diff --git a/venv/lib/python3.8/site-packages/idna/package_data.py b/venv/lib/python3.8/site-packages/idna/package_data.py deleted file mode 100644 index 8501893bd153b7216524084cad23e90aeac0b1f8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna/package_data.py +++ /dev/null @@ -1,2 +0,0 @@ -__version__ = '3.4' - diff --git a/venv/lib/python3.8/site-packages/idna/py.typed b/venv/lib/python3.8/site-packages/idna/py.typed deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/idna/uts46data.py b/venv/lib/python3.8/site-packages/idna/uts46data.py deleted file mode 100644 index 186796c17b25c1e766112ef4d9f16bb2dea4b306..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/idna/uts46data.py +++ /dev/null @@ -1,8600 +0,0 @@ -# This file is automatically generated by tools/idna-data -# vim: set fileencoding=utf-8 : - -from typing import List, Tuple, Union - - -"""IDNA Mapping Table from UTS46.""" - - -__version__ = '15.0.0' -def _seg_0() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x0, '3'), - (0x1, '3'), - (0x2, '3'), - (0x3, '3'), - (0x4, '3'), - (0x5, '3'), - (0x6, '3'), - (0x7, '3'), - (0x8, '3'), - (0x9, '3'), - (0xA, '3'), - (0xB, '3'), - (0xC, '3'), - (0xD, '3'), - (0xE, '3'), - (0xF, '3'), - (0x10, '3'), - (0x11, '3'), - (0x12, '3'), - (0x13, '3'), - (0x14, '3'), - (0x15, '3'), - (0x16, '3'), - (0x17, '3'), - (0x18, '3'), - (0x19, '3'), - (0x1A, '3'), - (0x1B, '3'), - (0x1C, '3'), - (0x1D, '3'), - (0x1E, '3'), - (0x1F, '3'), - (0x20, '3'), - (0x21, '3'), - (0x22, '3'), - (0x23, '3'), - (0x24, '3'), - (0x25, '3'), - (0x26, '3'), - (0x27, '3'), - (0x28, '3'), - (0x29, '3'), - (0x2A, '3'), - (0x2B, '3'), - (0x2C, '3'), - (0x2D, 'V'), - (0x2E, 'V'), - (0x2F, '3'), - (0x30, 'V'), - (0x31, 'V'), - (0x32, 'V'), - (0x33, 'V'), - (0x34, 'V'), - (0x35, 'V'), - (0x36, 'V'), - (0x37, 'V'), - (0x38, 'V'), - (0x39, 'V'), - (0x3A, '3'), - (0x3B, '3'), - (0x3C, '3'), - (0x3D, '3'), - (0x3E, '3'), - (0x3F, '3'), - (0x40, '3'), - (0x41, 'M', 'a'), - (0x42, 'M', 'b'), - (0x43, 'M', 'c'), - (0x44, 'M', 'd'), - (0x45, 'M', 'e'), - (0x46, 'M', 'f'), - (0x47, 'M', 'g'), - (0x48, 'M', 'h'), - (0x49, 'M', 'i'), - (0x4A, 'M', 'j'), - (0x4B, 'M', 'k'), - (0x4C, 'M', 'l'), - (0x4D, 'M', 'm'), - (0x4E, 'M', 'n'), - (0x4F, 'M', 'o'), - (0x50, 'M', 'p'), - (0x51, 'M', 'q'), - (0x52, 'M', 'r'), - (0x53, 'M', 's'), - (0x54, 'M', 't'), - (0x55, 'M', 'u'), - (0x56, 'M', 'v'), - (0x57, 'M', 'w'), - (0x58, 'M', 'x'), - (0x59, 'M', 'y'), - (0x5A, 'M', 'z'), - (0x5B, '3'), - (0x5C, '3'), - (0x5D, '3'), - (0x5E, '3'), - (0x5F, '3'), - (0x60, '3'), - (0x61, 'V'), - (0x62, 'V'), - (0x63, 'V'), - ] - -def _seg_1() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x64, 'V'), - (0x65, 'V'), - (0x66, 'V'), - (0x67, 'V'), - (0x68, 'V'), - (0x69, 'V'), - (0x6A, 'V'), - (0x6B, 'V'), - (0x6C, 'V'), - (0x6D, 'V'), - (0x6E, 'V'), - (0x6F, 'V'), - (0x70, 'V'), - (0x71, 'V'), - (0x72, 'V'), - (0x73, 'V'), - (0x74, 'V'), - (0x75, 'V'), - (0x76, 'V'), - (0x77, 'V'), - (0x78, 'V'), - (0x79, 'V'), - (0x7A, 'V'), - (0x7B, '3'), - (0x7C, '3'), - (0x7D, '3'), - (0x7E, '3'), - (0x7F, '3'), - (0x80, 'X'), - (0x81, 'X'), - (0x82, 'X'), - (0x83, 'X'), - (0x84, 'X'), - (0x85, 'X'), - (0x86, 'X'), - (0x87, 'X'), - (0x88, 'X'), - (0x89, 'X'), - (0x8A, 'X'), - (0x8B, 'X'), - (0x8C, 'X'), - (0x8D, 'X'), - (0x8E, 'X'), - (0x8F, 'X'), - (0x90, 'X'), - (0x91, 'X'), - (0x92, 'X'), - (0x93, 'X'), - (0x94, 'X'), - (0x95, 'X'), - (0x96, 'X'), - (0x97, 'X'), - (0x98, 'X'), - (0x99, 'X'), - (0x9A, 'X'), - (0x9B, 'X'), - (0x9C, 'X'), - (0x9D, 'X'), - (0x9E, 'X'), - (0x9F, 'X'), - (0xA0, '3', ' '), - (0xA1, 'V'), - (0xA2, 'V'), - (0xA3, 'V'), - (0xA4, 'V'), - (0xA5, 'V'), - (0xA6, 'V'), - (0xA7, 'V'), - (0xA8, '3', ' ̈'), - (0xA9, 'V'), - (0xAA, 'M', 'a'), - (0xAB, 'V'), - (0xAC, 'V'), - (0xAD, 'I'), - (0xAE, 'V'), - (0xAF, '3', ' ̄'), - (0xB0, 'V'), - (0xB1, 'V'), - (0xB2, 'M', '2'), - (0xB3, 'M', '3'), - (0xB4, '3', ' ́'), - (0xB5, 'M', 'μ'), - (0xB6, 'V'), - (0xB7, 'V'), - (0xB8, '3', ' ̧'), - (0xB9, 'M', '1'), - (0xBA, 'M', 'o'), - (0xBB, 'V'), - (0xBC, 'M', '1⁄4'), - (0xBD, 'M', '1⁄2'), - (0xBE, 'M', '3⁄4'), - (0xBF, 'V'), - (0xC0, 'M', 'à'), - (0xC1, 'M', 'á'), - (0xC2, 'M', 'â'), - (0xC3, 'M', 'ã'), - (0xC4, 'M', 'ä'), - (0xC5, 'M', 'å'), - (0xC6, 'M', 'æ'), - (0xC7, 'M', 'ç'), - ] - -def _seg_2() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xC8, 'M', 'è'), - (0xC9, 'M', 'é'), - (0xCA, 'M', 'ê'), - (0xCB, 'M', 'ë'), - (0xCC, 'M', 'ì'), - (0xCD, 'M', 'í'), - (0xCE, 'M', 'î'), - (0xCF, 'M', 'ï'), - (0xD0, 'M', 'ð'), - (0xD1, 'M', 'ñ'), - (0xD2, 'M', 'ò'), - (0xD3, 'M', 'ó'), - (0xD4, 'M', 'ô'), - (0xD5, 'M', 'õ'), - (0xD6, 'M', 'ö'), - (0xD7, 'V'), - (0xD8, 'M', 'ø'), - (0xD9, 'M', 'ù'), - (0xDA, 'M', 'ú'), - (0xDB, 'M', 'û'), - (0xDC, 'M', 'ü'), - (0xDD, 'M', 'ý'), - (0xDE, 'M', 'þ'), - (0xDF, 'D', 'ss'), - (0xE0, 'V'), - (0xE1, 'V'), - (0xE2, 'V'), - (0xE3, 'V'), - (0xE4, 'V'), - (0xE5, 'V'), - (0xE6, 'V'), - (0xE7, 'V'), - (0xE8, 'V'), - (0xE9, 'V'), - (0xEA, 'V'), - (0xEB, 'V'), - (0xEC, 'V'), - (0xED, 'V'), - (0xEE, 'V'), - (0xEF, 'V'), - (0xF0, 'V'), - (0xF1, 'V'), - (0xF2, 'V'), - (0xF3, 'V'), - (0xF4, 'V'), - (0xF5, 'V'), - (0xF6, 'V'), - (0xF7, 'V'), - (0xF8, 'V'), - (0xF9, 'V'), - (0xFA, 'V'), - (0xFB, 'V'), - (0xFC, 'V'), - (0xFD, 'V'), - (0xFE, 'V'), - (0xFF, 'V'), - (0x100, 'M', 'ā'), - (0x101, 'V'), - (0x102, 'M', 'ă'), - (0x103, 'V'), - (0x104, 'M', 'ą'), - (0x105, 'V'), - (0x106, 'M', 'ć'), - (0x107, 'V'), - (0x108, 'M', 'ĉ'), - (0x109, 'V'), - (0x10A, 'M', 'ċ'), - (0x10B, 'V'), - (0x10C, 'M', 'č'), - (0x10D, 'V'), - (0x10E, 'M', 'ď'), - (0x10F, 'V'), - (0x110, 'M', 'đ'), - (0x111, 'V'), - (0x112, 'M', 'ē'), - (0x113, 'V'), - (0x114, 'M', 'ĕ'), - (0x115, 'V'), - (0x116, 'M', 'ė'), - (0x117, 'V'), - (0x118, 'M', 'ę'), - (0x119, 'V'), - (0x11A, 'M', 'ě'), - (0x11B, 'V'), - (0x11C, 'M', 'ĝ'), - (0x11D, 'V'), - (0x11E, 'M', 'ğ'), - (0x11F, 'V'), - (0x120, 'M', 'ġ'), - (0x121, 'V'), - (0x122, 'M', 'ģ'), - (0x123, 'V'), - (0x124, 'M', 'ĥ'), - (0x125, 'V'), - (0x126, 'M', 'ħ'), - (0x127, 'V'), - (0x128, 'M', 'ĩ'), - (0x129, 'V'), - (0x12A, 'M', 'ī'), - (0x12B, 'V'), - ] - -def _seg_3() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x12C, 'M', 'ĭ'), - (0x12D, 'V'), - (0x12E, 'M', 'į'), - (0x12F, 'V'), - (0x130, 'M', 'i̇'), - (0x131, 'V'), - (0x132, 'M', 'ij'), - (0x134, 'M', 'ĵ'), - (0x135, 'V'), - (0x136, 'M', 'ķ'), - (0x137, 'V'), - (0x139, 'M', 'ĺ'), - (0x13A, 'V'), - (0x13B, 'M', 'ļ'), - (0x13C, 'V'), - (0x13D, 'M', 'ľ'), - (0x13E, 'V'), - (0x13F, 'M', 'l·'), - (0x141, 'M', 'ł'), - (0x142, 'V'), - (0x143, 'M', 'ń'), - (0x144, 'V'), - (0x145, 'M', 'ņ'), - (0x146, 'V'), - (0x147, 'M', 'ň'), - (0x148, 'V'), - (0x149, 'M', 'ʼn'), - (0x14A, 'M', 'ŋ'), - (0x14B, 'V'), - (0x14C, 'M', 'ō'), - (0x14D, 'V'), - (0x14E, 'M', 'ŏ'), - (0x14F, 'V'), - (0x150, 'M', 'ő'), - (0x151, 'V'), - (0x152, 'M', 'œ'), - (0x153, 'V'), - (0x154, 'M', 'ŕ'), - (0x155, 'V'), - (0x156, 'M', 'ŗ'), - (0x157, 'V'), - (0x158, 'M', 'ř'), - (0x159, 'V'), - (0x15A, 'M', 'ś'), - (0x15B, 'V'), - (0x15C, 'M', 'ŝ'), - (0x15D, 'V'), - (0x15E, 'M', 'ş'), - (0x15F, 'V'), - (0x160, 'M', 'š'), - (0x161, 'V'), - (0x162, 'M', 'ţ'), - (0x163, 'V'), - (0x164, 'M', 'ť'), - (0x165, 'V'), - (0x166, 'M', 'ŧ'), - (0x167, 'V'), - (0x168, 'M', 'ũ'), - (0x169, 'V'), - (0x16A, 'M', 'ū'), - (0x16B, 'V'), - (0x16C, 'M', 'ŭ'), - (0x16D, 'V'), - (0x16E, 'M', 'ů'), - (0x16F, 'V'), - (0x170, 'M', 'ű'), - (0x171, 'V'), - (0x172, 'M', 'ų'), - (0x173, 'V'), - (0x174, 'M', 'ŵ'), - (0x175, 'V'), - (0x176, 'M', 'ŷ'), - (0x177, 'V'), - (0x178, 'M', 'ÿ'), - (0x179, 'M', 'ź'), - (0x17A, 'V'), - (0x17B, 'M', 'ż'), - (0x17C, 'V'), - (0x17D, 'M', 'ž'), - (0x17E, 'V'), - (0x17F, 'M', 's'), - (0x180, 'V'), - (0x181, 'M', 'ɓ'), - (0x182, 'M', 'ƃ'), - (0x183, 'V'), - (0x184, 'M', 'ƅ'), - (0x185, 'V'), - (0x186, 'M', 'ɔ'), - (0x187, 'M', 'ƈ'), - (0x188, 'V'), - (0x189, 'M', 'ɖ'), - (0x18A, 'M', 'ɗ'), - (0x18B, 'M', 'ƌ'), - (0x18C, 'V'), - (0x18E, 'M', 'ǝ'), - (0x18F, 'M', 'ə'), - (0x190, 'M', 'ɛ'), - (0x191, 'M', 'ƒ'), - (0x192, 'V'), - (0x193, 'M', 'ɠ'), - ] - -def _seg_4() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x194, 'M', 'ɣ'), - (0x195, 'V'), - (0x196, 'M', 'ɩ'), - (0x197, 'M', 'ɨ'), - (0x198, 'M', 'ƙ'), - (0x199, 'V'), - (0x19C, 'M', 'ɯ'), - (0x19D, 'M', 'ɲ'), - (0x19E, 'V'), - (0x19F, 'M', 'ɵ'), - (0x1A0, 'M', 'ơ'), - (0x1A1, 'V'), - (0x1A2, 'M', 'ƣ'), - (0x1A3, 'V'), - (0x1A4, 'M', 'ƥ'), - (0x1A5, 'V'), - (0x1A6, 'M', 'ʀ'), - (0x1A7, 'M', 'ƨ'), - (0x1A8, 'V'), - (0x1A9, 'M', 'ʃ'), - (0x1AA, 'V'), - (0x1AC, 'M', 'ƭ'), - (0x1AD, 'V'), - (0x1AE, 'M', 'ʈ'), - (0x1AF, 'M', 'ư'), - (0x1B0, 'V'), - (0x1B1, 'M', 'ʊ'), - (0x1B2, 'M', 'ʋ'), - (0x1B3, 'M', 'ƴ'), - (0x1B4, 'V'), - (0x1B5, 'M', 'ƶ'), - (0x1B6, 'V'), - (0x1B7, 'M', 'ʒ'), - (0x1B8, 'M', 'ƹ'), - (0x1B9, 'V'), - (0x1BC, 'M', 'ƽ'), - (0x1BD, 'V'), - (0x1C4, 'M', 'dž'), - (0x1C7, 'M', 'lj'), - (0x1CA, 'M', 'nj'), - (0x1CD, 'M', 'ǎ'), - (0x1CE, 'V'), - (0x1CF, 'M', 'ǐ'), - (0x1D0, 'V'), - (0x1D1, 'M', 'ǒ'), - (0x1D2, 'V'), - (0x1D3, 'M', 'ǔ'), - (0x1D4, 'V'), - (0x1D5, 'M', 'ǖ'), - (0x1D6, 'V'), - (0x1D7, 'M', 'ǘ'), - (0x1D8, 'V'), - (0x1D9, 'M', 'ǚ'), - (0x1DA, 'V'), - (0x1DB, 'M', 'ǜ'), - (0x1DC, 'V'), - (0x1DE, 'M', 'ǟ'), - (0x1DF, 'V'), - (0x1E0, 'M', 'ǡ'), - (0x1E1, 'V'), - (0x1E2, 'M', 'ǣ'), - (0x1E3, 'V'), - (0x1E4, 'M', 'ǥ'), - (0x1E5, 'V'), - (0x1E6, 'M', 'ǧ'), - (0x1E7, 'V'), - (0x1E8, 'M', 'ǩ'), - (0x1E9, 'V'), - (0x1EA, 'M', 'ǫ'), - (0x1EB, 'V'), - (0x1EC, 'M', 'ǭ'), - (0x1ED, 'V'), - (0x1EE, 'M', 'ǯ'), - (0x1EF, 'V'), - (0x1F1, 'M', 'dz'), - (0x1F4, 'M', 'ǵ'), - (0x1F5, 'V'), - (0x1F6, 'M', 'ƕ'), - (0x1F7, 'M', 'ƿ'), - (0x1F8, 'M', 'ǹ'), - (0x1F9, 'V'), - (0x1FA, 'M', 'ǻ'), - (0x1FB, 'V'), - (0x1FC, 'M', 'ǽ'), - (0x1FD, 'V'), - (0x1FE, 'M', 'ǿ'), - (0x1FF, 'V'), - (0x200, 'M', 'ȁ'), - (0x201, 'V'), - (0x202, 'M', 'ȃ'), - (0x203, 'V'), - (0x204, 'M', 'ȅ'), - (0x205, 'V'), - (0x206, 'M', 'ȇ'), - (0x207, 'V'), - (0x208, 'M', 'ȉ'), - (0x209, 'V'), - (0x20A, 'M', 'ȋ'), - (0x20B, 'V'), - (0x20C, 'M', 'ȍ'), - ] - -def _seg_5() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x20D, 'V'), - (0x20E, 'M', 'ȏ'), - (0x20F, 'V'), - (0x210, 'M', 'ȑ'), - (0x211, 'V'), - (0x212, 'M', 'ȓ'), - (0x213, 'V'), - (0x214, 'M', 'ȕ'), - (0x215, 'V'), - (0x216, 'M', 'ȗ'), - (0x217, 'V'), - (0x218, 'M', 'ș'), - (0x219, 'V'), - (0x21A, 'M', 'ț'), - (0x21B, 'V'), - (0x21C, 'M', 'ȝ'), - (0x21D, 'V'), - (0x21E, 'M', 'ȟ'), - (0x21F, 'V'), - (0x220, 'M', 'ƞ'), - (0x221, 'V'), - (0x222, 'M', 'ȣ'), - (0x223, 'V'), - (0x224, 'M', 'ȥ'), - (0x225, 'V'), - (0x226, 'M', 'ȧ'), - (0x227, 'V'), - (0x228, 'M', 'ȩ'), - (0x229, 'V'), - (0x22A, 'M', 'ȫ'), - (0x22B, 'V'), - (0x22C, 'M', 'ȭ'), - (0x22D, 'V'), - (0x22E, 'M', 'ȯ'), - (0x22F, 'V'), - (0x230, 'M', 'ȱ'), - (0x231, 'V'), - (0x232, 'M', 'ȳ'), - (0x233, 'V'), - (0x23A, 'M', 'ⱥ'), - (0x23B, 'M', 'ȼ'), - (0x23C, 'V'), - (0x23D, 'M', 'ƚ'), - (0x23E, 'M', 'ⱦ'), - (0x23F, 'V'), - (0x241, 'M', 'ɂ'), - (0x242, 'V'), - (0x243, 'M', 'ƀ'), - (0x244, 'M', 'ʉ'), - (0x245, 'M', 'ʌ'), - (0x246, 'M', 'ɇ'), - (0x247, 'V'), - (0x248, 'M', 'ɉ'), - (0x249, 'V'), - (0x24A, 'M', 'ɋ'), - (0x24B, 'V'), - (0x24C, 'M', 'ɍ'), - (0x24D, 'V'), - (0x24E, 'M', 'ɏ'), - (0x24F, 'V'), - (0x2B0, 'M', 'h'), - (0x2B1, 'M', 'ɦ'), - (0x2B2, 'M', 'j'), - (0x2B3, 'M', 'r'), - (0x2B4, 'M', 'ɹ'), - (0x2B5, 'M', 'ɻ'), - (0x2B6, 'M', 'ʁ'), - (0x2B7, 'M', 'w'), - (0x2B8, 'M', 'y'), - (0x2B9, 'V'), - (0x2D8, '3', ' ̆'), - (0x2D9, '3', ' ̇'), - (0x2DA, '3', ' ̊'), - (0x2DB, '3', ' ̨'), - (0x2DC, '3', ' ̃'), - (0x2DD, '3', ' ̋'), - (0x2DE, 'V'), - (0x2E0, 'M', 'ɣ'), - (0x2E1, 'M', 'l'), - (0x2E2, 'M', 's'), - (0x2E3, 'M', 'x'), - (0x2E4, 'M', 'ʕ'), - (0x2E5, 'V'), - (0x340, 'M', '̀'), - (0x341, 'M', '́'), - (0x342, 'V'), - (0x343, 'M', '̓'), - (0x344, 'M', '̈́'), - (0x345, 'M', 'ι'), - (0x346, 'V'), - (0x34F, 'I'), - (0x350, 'V'), - (0x370, 'M', 'ͱ'), - (0x371, 'V'), - (0x372, 'M', 'ͳ'), - (0x373, 'V'), - (0x374, 'M', 'ʹ'), - (0x375, 'V'), - (0x376, 'M', 'ͷ'), - (0x377, 'V'), - ] - -def _seg_6() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x378, 'X'), - (0x37A, '3', ' ι'), - (0x37B, 'V'), - (0x37E, '3', ';'), - (0x37F, 'M', 'ϳ'), - (0x380, 'X'), - (0x384, '3', ' ́'), - (0x385, '3', ' ̈́'), - (0x386, 'M', 'ά'), - (0x387, 'M', '·'), - (0x388, 'M', 'έ'), - (0x389, 'M', 'ή'), - (0x38A, 'M', 'ί'), - (0x38B, 'X'), - (0x38C, 'M', 'ό'), - (0x38D, 'X'), - (0x38E, 'M', 'ύ'), - (0x38F, 'M', 'ώ'), - (0x390, 'V'), - (0x391, 'M', 'α'), - (0x392, 'M', 'β'), - (0x393, 'M', 'γ'), - (0x394, 'M', 'δ'), - (0x395, 'M', 'ε'), - (0x396, 'M', 'ζ'), - (0x397, 'M', 'η'), - (0x398, 'M', 'θ'), - (0x399, 'M', 'ι'), - (0x39A, 'M', 'κ'), - (0x39B, 'M', 'λ'), - (0x39C, 'M', 'μ'), - (0x39D, 'M', 'ν'), - (0x39E, 'M', 'ξ'), - (0x39F, 'M', 'ο'), - (0x3A0, 'M', 'π'), - (0x3A1, 'M', 'ρ'), - (0x3A2, 'X'), - (0x3A3, 'M', 'σ'), - (0x3A4, 'M', 'τ'), - (0x3A5, 'M', 'υ'), - (0x3A6, 'M', 'φ'), - (0x3A7, 'M', 'χ'), - (0x3A8, 'M', 'ψ'), - (0x3A9, 'M', 'ω'), - (0x3AA, 'M', 'ϊ'), - (0x3AB, 'M', 'ϋ'), - (0x3AC, 'V'), - (0x3C2, 'D', 'σ'), - (0x3C3, 'V'), - (0x3CF, 'M', 'ϗ'), - (0x3D0, 'M', 'β'), - (0x3D1, 'M', 'θ'), - (0x3D2, 'M', 'υ'), - (0x3D3, 'M', 'ύ'), - (0x3D4, 'M', 'ϋ'), - (0x3D5, 'M', 'φ'), - (0x3D6, 'M', 'π'), - (0x3D7, 'V'), - (0x3D8, 'M', 'ϙ'), - (0x3D9, 'V'), - (0x3DA, 'M', 'ϛ'), - (0x3DB, 'V'), - (0x3DC, 'M', 'ϝ'), - (0x3DD, 'V'), - (0x3DE, 'M', 'ϟ'), - (0x3DF, 'V'), - (0x3E0, 'M', 'ϡ'), - (0x3E1, 'V'), - (0x3E2, 'M', 'ϣ'), - (0x3E3, 'V'), - (0x3E4, 'M', 'ϥ'), - (0x3E5, 'V'), - (0x3E6, 'M', 'ϧ'), - (0x3E7, 'V'), - (0x3E8, 'M', 'ϩ'), - (0x3E9, 'V'), - (0x3EA, 'M', 'ϫ'), - (0x3EB, 'V'), - (0x3EC, 'M', 'ϭ'), - (0x3ED, 'V'), - (0x3EE, 'M', 'ϯ'), - (0x3EF, 'V'), - (0x3F0, 'M', 'κ'), - (0x3F1, 'M', 'ρ'), - (0x3F2, 'M', 'σ'), - (0x3F3, 'V'), - (0x3F4, 'M', 'θ'), - (0x3F5, 'M', 'ε'), - (0x3F6, 'V'), - (0x3F7, 'M', 'ϸ'), - (0x3F8, 'V'), - (0x3F9, 'M', 'σ'), - (0x3FA, 'M', 'ϻ'), - (0x3FB, 'V'), - (0x3FD, 'M', 'ͻ'), - (0x3FE, 'M', 'ͼ'), - (0x3FF, 'M', 'ͽ'), - (0x400, 'M', 'ѐ'), - (0x401, 'M', 'ё'), - (0x402, 'M', 'ђ'), - ] - -def _seg_7() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x403, 'M', 'ѓ'), - (0x404, 'M', 'є'), - (0x405, 'M', 'ѕ'), - (0x406, 'M', 'і'), - (0x407, 'M', 'ї'), - (0x408, 'M', 'ј'), - (0x409, 'M', 'љ'), - (0x40A, 'M', 'њ'), - (0x40B, 'M', 'ћ'), - (0x40C, 'M', 'ќ'), - (0x40D, 'M', 'ѝ'), - (0x40E, 'M', 'ў'), - (0x40F, 'M', 'џ'), - (0x410, 'M', 'а'), - (0x411, 'M', 'б'), - (0x412, 'M', 'в'), - (0x413, 'M', 'г'), - (0x414, 'M', 'д'), - (0x415, 'M', 'е'), - (0x416, 'M', 'ж'), - (0x417, 'M', 'з'), - (0x418, 'M', 'и'), - (0x419, 'M', 'й'), - (0x41A, 'M', 'к'), - (0x41B, 'M', 'л'), - (0x41C, 'M', 'м'), - (0x41D, 'M', 'н'), - (0x41E, 'M', 'о'), - (0x41F, 'M', 'п'), - (0x420, 'M', 'р'), - (0x421, 'M', 'с'), - (0x422, 'M', 'т'), - (0x423, 'M', 'у'), - (0x424, 'M', 'ф'), - (0x425, 'M', 'х'), - (0x426, 'M', 'ц'), - (0x427, 'M', 'ч'), - (0x428, 'M', 'ш'), - (0x429, 'M', 'щ'), - (0x42A, 'M', 'ъ'), - (0x42B, 'M', 'ы'), - (0x42C, 'M', 'ь'), - (0x42D, 'M', 'э'), - (0x42E, 'M', 'ю'), - (0x42F, 'M', 'я'), - (0x430, 'V'), - (0x460, 'M', 'ѡ'), - (0x461, 'V'), - (0x462, 'M', 'ѣ'), - (0x463, 'V'), - (0x464, 'M', 'ѥ'), - (0x465, 'V'), - (0x466, 'M', 'ѧ'), - (0x467, 'V'), - (0x468, 'M', 'ѩ'), - (0x469, 'V'), - (0x46A, 'M', 'ѫ'), - (0x46B, 'V'), - (0x46C, 'M', 'ѭ'), - (0x46D, 'V'), - (0x46E, 'M', 'ѯ'), - (0x46F, 'V'), - (0x470, 'M', 'ѱ'), - (0x471, 'V'), - (0x472, 'M', 'ѳ'), - (0x473, 'V'), - (0x474, 'M', 'ѵ'), - (0x475, 'V'), - (0x476, 'M', 'ѷ'), - (0x477, 'V'), - (0x478, 'M', 'ѹ'), - (0x479, 'V'), - (0x47A, 'M', 'ѻ'), - (0x47B, 'V'), - (0x47C, 'M', 'ѽ'), - (0x47D, 'V'), - (0x47E, 'M', 'ѿ'), - (0x47F, 'V'), - (0x480, 'M', 'ҁ'), - (0x481, 'V'), - (0x48A, 'M', 'ҋ'), - (0x48B, 'V'), - (0x48C, 'M', 'ҍ'), - (0x48D, 'V'), - (0x48E, 'M', 'ҏ'), - (0x48F, 'V'), - (0x490, 'M', 'ґ'), - (0x491, 'V'), - (0x492, 'M', 'ғ'), - (0x493, 'V'), - (0x494, 'M', 'ҕ'), - (0x495, 'V'), - (0x496, 'M', 'җ'), - (0x497, 'V'), - (0x498, 'M', 'ҙ'), - (0x499, 'V'), - (0x49A, 'M', 'қ'), - (0x49B, 'V'), - (0x49C, 'M', 'ҝ'), - (0x49D, 'V'), - ] - -def _seg_8() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x49E, 'M', 'ҟ'), - (0x49F, 'V'), - (0x4A0, 'M', 'ҡ'), - (0x4A1, 'V'), - (0x4A2, 'M', 'ң'), - (0x4A3, 'V'), - (0x4A4, 'M', 'ҥ'), - (0x4A5, 'V'), - (0x4A6, 'M', 'ҧ'), - (0x4A7, 'V'), - (0x4A8, 'M', 'ҩ'), - (0x4A9, 'V'), - (0x4AA, 'M', 'ҫ'), - (0x4AB, 'V'), - (0x4AC, 'M', 'ҭ'), - (0x4AD, 'V'), - (0x4AE, 'M', 'ү'), - (0x4AF, 'V'), - (0x4B0, 'M', 'ұ'), - (0x4B1, 'V'), - (0x4B2, 'M', 'ҳ'), - (0x4B3, 'V'), - (0x4B4, 'M', 'ҵ'), - (0x4B5, 'V'), - (0x4B6, 'M', 'ҷ'), - (0x4B7, 'V'), - (0x4B8, 'M', 'ҹ'), - (0x4B9, 'V'), - (0x4BA, 'M', 'һ'), - (0x4BB, 'V'), - (0x4BC, 'M', 'ҽ'), - (0x4BD, 'V'), - (0x4BE, 'M', 'ҿ'), - (0x4BF, 'V'), - (0x4C0, 'X'), - (0x4C1, 'M', 'ӂ'), - (0x4C2, 'V'), - (0x4C3, 'M', 'ӄ'), - (0x4C4, 'V'), - (0x4C5, 'M', 'ӆ'), - (0x4C6, 'V'), - (0x4C7, 'M', 'ӈ'), - (0x4C8, 'V'), - (0x4C9, 'M', 'ӊ'), - (0x4CA, 'V'), - (0x4CB, 'M', 'ӌ'), - (0x4CC, 'V'), - (0x4CD, 'M', 'ӎ'), - (0x4CE, 'V'), - (0x4D0, 'M', 'ӑ'), - (0x4D1, 'V'), - (0x4D2, 'M', 'ӓ'), - (0x4D3, 'V'), - (0x4D4, 'M', 'ӕ'), - (0x4D5, 'V'), - (0x4D6, 'M', 'ӗ'), - (0x4D7, 'V'), - (0x4D8, 'M', 'ә'), - (0x4D9, 'V'), - (0x4DA, 'M', 'ӛ'), - (0x4DB, 'V'), - (0x4DC, 'M', 'ӝ'), - (0x4DD, 'V'), - (0x4DE, 'M', 'ӟ'), - (0x4DF, 'V'), - (0x4E0, 'M', 'ӡ'), - (0x4E1, 'V'), - (0x4E2, 'M', 'ӣ'), - (0x4E3, 'V'), - (0x4E4, 'M', 'ӥ'), - (0x4E5, 'V'), - (0x4E6, 'M', 'ӧ'), - (0x4E7, 'V'), - (0x4E8, 'M', 'ө'), - (0x4E9, 'V'), - (0x4EA, 'M', 'ӫ'), - (0x4EB, 'V'), - (0x4EC, 'M', 'ӭ'), - (0x4ED, 'V'), - (0x4EE, 'M', 'ӯ'), - (0x4EF, 'V'), - (0x4F0, 'M', 'ӱ'), - (0x4F1, 'V'), - (0x4F2, 'M', 'ӳ'), - (0x4F3, 'V'), - (0x4F4, 'M', 'ӵ'), - (0x4F5, 'V'), - (0x4F6, 'M', 'ӷ'), - (0x4F7, 'V'), - (0x4F8, 'M', 'ӹ'), - (0x4F9, 'V'), - (0x4FA, 'M', 'ӻ'), - (0x4FB, 'V'), - (0x4FC, 'M', 'ӽ'), - (0x4FD, 'V'), - (0x4FE, 'M', 'ӿ'), - (0x4FF, 'V'), - (0x500, 'M', 'ԁ'), - (0x501, 'V'), - (0x502, 'M', 'ԃ'), - ] - -def _seg_9() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x503, 'V'), - (0x504, 'M', 'ԅ'), - (0x505, 'V'), - (0x506, 'M', 'ԇ'), - (0x507, 'V'), - (0x508, 'M', 'ԉ'), - (0x509, 'V'), - (0x50A, 'M', 'ԋ'), - (0x50B, 'V'), - (0x50C, 'M', 'ԍ'), - (0x50D, 'V'), - (0x50E, 'M', 'ԏ'), - (0x50F, 'V'), - (0x510, 'M', 'ԑ'), - (0x511, 'V'), - (0x512, 'M', 'ԓ'), - (0x513, 'V'), - (0x514, 'M', 'ԕ'), - (0x515, 'V'), - (0x516, 'M', 'ԗ'), - (0x517, 'V'), - (0x518, 'M', 'ԙ'), - (0x519, 'V'), - (0x51A, 'M', 'ԛ'), - (0x51B, 'V'), - (0x51C, 'M', 'ԝ'), - (0x51D, 'V'), - (0x51E, 'M', 'ԟ'), - (0x51F, 'V'), - (0x520, 'M', 'ԡ'), - (0x521, 'V'), - (0x522, 'M', 'ԣ'), - (0x523, 'V'), - (0x524, 'M', 'ԥ'), - (0x525, 'V'), - (0x526, 'M', 'ԧ'), - (0x527, 'V'), - (0x528, 'M', 'ԩ'), - (0x529, 'V'), - (0x52A, 'M', 'ԫ'), - (0x52B, 'V'), - (0x52C, 'M', 'ԭ'), - (0x52D, 'V'), - (0x52E, 'M', 'ԯ'), - (0x52F, 'V'), - (0x530, 'X'), - (0x531, 'M', 'ա'), - (0x532, 'M', 'բ'), - (0x533, 'M', 'գ'), - (0x534, 'M', 'դ'), - (0x535, 'M', 'ե'), - (0x536, 'M', 'զ'), - (0x537, 'M', 'է'), - (0x538, 'M', 'ը'), - (0x539, 'M', 'թ'), - (0x53A, 'M', 'ժ'), - (0x53B, 'M', 'ի'), - (0x53C, 'M', 'լ'), - (0x53D, 'M', 'խ'), - (0x53E, 'M', 'ծ'), - (0x53F, 'M', 'կ'), - (0x540, 'M', 'հ'), - (0x541, 'M', 'ձ'), - (0x542, 'M', 'ղ'), - (0x543, 'M', 'ճ'), - (0x544, 'M', 'մ'), - (0x545, 'M', 'յ'), - (0x546, 'M', 'ն'), - (0x547, 'M', 'շ'), - (0x548, 'M', 'ո'), - (0x549, 'M', 'չ'), - (0x54A, 'M', 'պ'), - (0x54B, 'M', 'ջ'), - (0x54C, 'M', 'ռ'), - (0x54D, 'M', 'ս'), - (0x54E, 'M', 'վ'), - (0x54F, 'M', 'տ'), - (0x550, 'M', 'ր'), - (0x551, 'M', 'ց'), - (0x552, 'M', 'ւ'), - (0x553, 'M', 'փ'), - (0x554, 'M', 'ք'), - (0x555, 'M', 'օ'), - (0x556, 'M', 'ֆ'), - (0x557, 'X'), - (0x559, 'V'), - (0x587, 'M', 'եւ'), - (0x588, 'V'), - (0x58B, 'X'), - (0x58D, 'V'), - (0x590, 'X'), - (0x591, 'V'), - (0x5C8, 'X'), - (0x5D0, 'V'), - (0x5EB, 'X'), - (0x5EF, 'V'), - (0x5F5, 'X'), - (0x606, 'V'), - (0x61C, 'X'), - (0x61D, 'V'), - ] - -def _seg_10() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x675, 'M', 'اٴ'), - (0x676, 'M', 'وٴ'), - (0x677, 'M', 'ۇٴ'), - (0x678, 'M', 'يٴ'), - (0x679, 'V'), - (0x6DD, 'X'), - (0x6DE, 'V'), - (0x70E, 'X'), - (0x710, 'V'), - (0x74B, 'X'), - (0x74D, 'V'), - (0x7B2, 'X'), - (0x7C0, 'V'), - (0x7FB, 'X'), - (0x7FD, 'V'), - (0x82E, 'X'), - (0x830, 'V'), - (0x83F, 'X'), - (0x840, 'V'), - (0x85C, 'X'), - (0x85E, 'V'), - (0x85F, 'X'), - (0x860, 'V'), - (0x86B, 'X'), - (0x870, 'V'), - (0x88F, 'X'), - (0x898, 'V'), - (0x8E2, 'X'), - (0x8E3, 'V'), - (0x958, 'M', 'क़'), - (0x959, 'M', 'ख़'), - (0x95A, 'M', 'ग़'), - (0x95B, 'M', 'ज़'), - (0x95C, 'M', 'ड़'), - (0x95D, 'M', 'ढ़'), - (0x95E, 'M', 'फ़'), - (0x95F, 'M', 'य़'), - (0x960, 'V'), - (0x984, 'X'), - (0x985, 'V'), - (0x98D, 'X'), - (0x98F, 'V'), - (0x991, 'X'), - (0x993, 'V'), - (0x9A9, 'X'), - (0x9AA, 'V'), - (0x9B1, 'X'), - (0x9B2, 'V'), - (0x9B3, 'X'), - (0x9B6, 'V'), - (0x9BA, 'X'), - (0x9BC, 'V'), - (0x9C5, 'X'), - (0x9C7, 'V'), - (0x9C9, 'X'), - (0x9CB, 'V'), - (0x9CF, 'X'), - (0x9D7, 'V'), - (0x9D8, 'X'), - (0x9DC, 'M', 'ড়'), - (0x9DD, 'M', 'ঢ়'), - (0x9DE, 'X'), - (0x9DF, 'M', 'য়'), - (0x9E0, 'V'), - (0x9E4, 'X'), - (0x9E6, 'V'), - (0x9FF, 'X'), - (0xA01, 'V'), - (0xA04, 'X'), - (0xA05, 'V'), - (0xA0B, 'X'), - (0xA0F, 'V'), - (0xA11, 'X'), - (0xA13, 'V'), - (0xA29, 'X'), - (0xA2A, 'V'), - (0xA31, 'X'), - (0xA32, 'V'), - (0xA33, 'M', 'ਲ਼'), - (0xA34, 'X'), - (0xA35, 'V'), - (0xA36, 'M', 'ਸ਼'), - (0xA37, 'X'), - (0xA38, 'V'), - (0xA3A, 'X'), - (0xA3C, 'V'), - (0xA3D, 'X'), - (0xA3E, 'V'), - (0xA43, 'X'), - (0xA47, 'V'), - (0xA49, 'X'), - (0xA4B, 'V'), - (0xA4E, 'X'), - (0xA51, 'V'), - (0xA52, 'X'), - (0xA59, 'M', 'ਖ਼'), - (0xA5A, 'M', 'ਗ਼'), - (0xA5B, 'M', 'ਜ਼'), - (0xA5C, 'V'), - (0xA5D, 'X'), - ] - -def _seg_11() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA5E, 'M', 'ਫ਼'), - (0xA5F, 'X'), - (0xA66, 'V'), - (0xA77, 'X'), - (0xA81, 'V'), - (0xA84, 'X'), - (0xA85, 'V'), - (0xA8E, 'X'), - (0xA8F, 'V'), - (0xA92, 'X'), - (0xA93, 'V'), - (0xAA9, 'X'), - (0xAAA, 'V'), - (0xAB1, 'X'), - (0xAB2, 'V'), - (0xAB4, 'X'), - (0xAB5, 'V'), - (0xABA, 'X'), - (0xABC, 'V'), - (0xAC6, 'X'), - (0xAC7, 'V'), - (0xACA, 'X'), - (0xACB, 'V'), - (0xACE, 'X'), - (0xAD0, 'V'), - (0xAD1, 'X'), - (0xAE0, 'V'), - (0xAE4, 'X'), - (0xAE6, 'V'), - (0xAF2, 'X'), - (0xAF9, 'V'), - (0xB00, 'X'), - (0xB01, 'V'), - (0xB04, 'X'), - (0xB05, 'V'), - (0xB0D, 'X'), - (0xB0F, 'V'), - (0xB11, 'X'), - (0xB13, 'V'), - (0xB29, 'X'), - (0xB2A, 'V'), - (0xB31, 'X'), - (0xB32, 'V'), - (0xB34, 'X'), - (0xB35, 'V'), - (0xB3A, 'X'), - (0xB3C, 'V'), - (0xB45, 'X'), - (0xB47, 'V'), - (0xB49, 'X'), - (0xB4B, 'V'), - (0xB4E, 'X'), - (0xB55, 'V'), - (0xB58, 'X'), - (0xB5C, 'M', 'ଡ଼'), - (0xB5D, 'M', 'ଢ଼'), - (0xB5E, 'X'), - (0xB5F, 'V'), - (0xB64, 'X'), - (0xB66, 'V'), - (0xB78, 'X'), - (0xB82, 'V'), - (0xB84, 'X'), - (0xB85, 'V'), - (0xB8B, 'X'), - (0xB8E, 'V'), - (0xB91, 'X'), - (0xB92, 'V'), - (0xB96, 'X'), - (0xB99, 'V'), - (0xB9B, 'X'), - (0xB9C, 'V'), - (0xB9D, 'X'), - (0xB9E, 'V'), - (0xBA0, 'X'), - (0xBA3, 'V'), - (0xBA5, 'X'), - (0xBA8, 'V'), - (0xBAB, 'X'), - (0xBAE, 'V'), - (0xBBA, 'X'), - (0xBBE, 'V'), - (0xBC3, 'X'), - (0xBC6, 'V'), - (0xBC9, 'X'), - (0xBCA, 'V'), - (0xBCE, 'X'), - (0xBD0, 'V'), - (0xBD1, 'X'), - (0xBD7, 'V'), - (0xBD8, 'X'), - (0xBE6, 'V'), - (0xBFB, 'X'), - (0xC00, 'V'), - (0xC0D, 'X'), - (0xC0E, 'V'), - (0xC11, 'X'), - (0xC12, 'V'), - (0xC29, 'X'), - (0xC2A, 'V'), - ] - -def _seg_12() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xC3A, 'X'), - (0xC3C, 'V'), - (0xC45, 'X'), - (0xC46, 'V'), - (0xC49, 'X'), - (0xC4A, 'V'), - (0xC4E, 'X'), - (0xC55, 'V'), - (0xC57, 'X'), - (0xC58, 'V'), - (0xC5B, 'X'), - (0xC5D, 'V'), - (0xC5E, 'X'), - (0xC60, 'V'), - (0xC64, 'X'), - (0xC66, 'V'), - (0xC70, 'X'), - (0xC77, 'V'), - (0xC8D, 'X'), - (0xC8E, 'V'), - (0xC91, 'X'), - (0xC92, 'V'), - (0xCA9, 'X'), - (0xCAA, 'V'), - (0xCB4, 'X'), - (0xCB5, 'V'), - (0xCBA, 'X'), - (0xCBC, 'V'), - (0xCC5, 'X'), - (0xCC6, 'V'), - (0xCC9, 'X'), - (0xCCA, 'V'), - (0xCCE, 'X'), - (0xCD5, 'V'), - (0xCD7, 'X'), - (0xCDD, 'V'), - (0xCDF, 'X'), - (0xCE0, 'V'), - (0xCE4, 'X'), - (0xCE6, 'V'), - (0xCF0, 'X'), - (0xCF1, 'V'), - (0xCF4, 'X'), - (0xD00, 'V'), - (0xD0D, 'X'), - (0xD0E, 'V'), - (0xD11, 'X'), - (0xD12, 'V'), - (0xD45, 'X'), - (0xD46, 'V'), - (0xD49, 'X'), - (0xD4A, 'V'), - (0xD50, 'X'), - (0xD54, 'V'), - (0xD64, 'X'), - (0xD66, 'V'), - (0xD80, 'X'), - (0xD81, 'V'), - (0xD84, 'X'), - (0xD85, 'V'), - (0xD97, 'X'), - (0xD9A, 'V'), - (0xDB2, 'X'), - (0xDB3, 'V'), - (0xDBC, 'X'), - (0xDBD, 'V'), - (0xDBE, 'X'), - (0xDC0, 'V'), - (0xDC7, 'X'), - (0xDCA, 'V'), - (0xDCB, 'X'), - (0xDCF, 'V'), - (0xDD5, 'X'), - (0xDD6, 'V'), - (0xDD7, 'X'), - (0xDD8, 'V'), - (0xDE0, 'X'), - (0xDE6, 'V'), - (0xDF0, 'X'), - (0xDF2, 'V'), - (0xDF5, 'X'), - (0xE01, 'V'), - (0xE33, 'M', 'ํา'), - (0xE34, 'V'), - (0xE3B, 'X'), - (0xE3F, 'V'), - (0xE5C, 'X'), - (0xE81, 'V'), - (0xE83, 'X'), - (0xE84, 'V'), - (0xE85, 'X'), - (0xE86, 'V'), - (0xE8B, 'X'), - (0xE8C, 'V'), - (0xEA4, 'X'), - (0xEA5, 'V'), - (0xEA6, 'X'), - (0xEA7, 'V'), - (0xEB3, 'M', 'ໍາ'), - (0xEB4, 'V'), - ] - -def _seg_13() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xEBE, 'X'), - (0xEC0, 'V'), - (0xEC5, 'X'), - (0xEC6, 'V'), - (0xEC7, 'X'), - (0xEC8, 'V'), - (0xECF, 'X'), - (0xED0, 'V'), - (0xEDA, 'X'), - (0xEDC, 'M', 'ຫນ'), - (0xEDD, 'M', 'ຫມ'), - (0xEDE, 'V'), - (0xEE0, 'X'), - (0xF00, 'V'), - (0xF0C, 'M', '་'), - (0xF0D, 'V'), - (0xF43, 'M', 'གྷ'), - (0xF44, 'V'), - (0xF48, 'X'), - (0xF49, 'V'), - (0xF4D, 'M', 'ཌྷ'), - (0xF4E, 'V'), - (0xF52, 'M', 'དྷ'), - (0xF53, 'V'), - (0xF57, 'M', 'བྷ'), - (0xF58, 'V'), - (0xF5C, 'M', 'ཛྷ'), - (0xF5D, 'V'), - (0xF69, 'M', 'ཀྵ'), - (0xF6A, 'V'), - (0xF6D, 'X'), - (0xF71, 'V'), - (0xF73, 'M', 'ཱི'), - (0xF74, 'V'), - (0xF75, 'M', 'ཱུ'), - (0xF76, 'M', 'ྲྀ'), - (0xF77, 'M', 'ྲཱྀ'), - (0xF78, 'M', 'ླྀ'), - (0xF79, 'M', 'ླཱྀ'), - (0xF7A, 'V'), - (0xF81, 'M', 'ཱྀ'), - (0xF82, 'V'), - (0xF93, 'M', 'ྒྷ'), - (0xF94, 'V'), - (0xF98, 'X'), - (0xF99, 'V'), - (0xF9D, 'M', 'ྜྷ'), - (0xF9E, 'V'), - (0xFA2, 'M', 'ྡྷ'), - (0xFA3, 'V'), - (0xFA7, 'M', 'ྦྷ'), - (0xFA8, 'V'), - (0xFAC, 'M', 'ྫྷ'), - (0xFAD, 'V'), - (0xFB9, 'M', 'ྐྵ'), - (0xFBA, 'V'), - (0xFBD, 'X'), - (0xFBE, 'V'), - (0xFCD, 'X'), - (0xFCE, 'V'), - (0xFDB, 'X'), - (0x1000, 'V'), - (0x10A0, 'X'), - (0x10C7, 'M', 'ⴧ'), - (0x10C8, 'X'), - (0x10CD, 'M', 'ⴭ'), - (0x10CE, 'X'), - (0x10D0, 'V'), - (0x10FC, 'M', 'ნ'), - (0x10FD, 'V'), - (0x115F, 'X'), - (0x1161, 'V'), - (0x1249, 'X'), - (0x124A, 'V'), - (0x124E, 'X'), - (0x1250, 'V'), - (0x1257, 'X'), - (0x1258, 'V'), - (0x1259, 'X'), - (0x125A, 'V'), - (0x125E, 'X'), - (0x1260, 'V'), - (0x1289, 'X'), - (0x128A, 'V'), - (0x128E, 'X'), - (0x1290, 'V'), - (0x12B1, 'X'), - (0x12B2, 'V'), - (0x12B6, 'X'), - (0x12B8, 'V'), - (0x12BF, 'X'), - (0x12C0, 'V'), - (0x12C1, 'X'), - (0x12C2, 'V'), - (0x12C6, 'X'), - (0x12C8, 'V'), - (0x12D7, 'X'), - (0x12D8, 'V'), - (0x1311, 'X'), - (0x1312, 'V'), - ] - -def _seg_14() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1316, 'X'), - (0x1318, 'V'), - (0x135B, 'X'), - (0x135D, 'V'), - (0x137D, 'X'), - (0x1380, 'V'), - (0x139A, 'X'), - (0x13A0, 'V'), - (0x13F6, 'X'), - (0x13F8, 'M', 'Ᏸ'), - (0x13F9, 'M', 'Ᏹ'), - (0x13FA, 'M', 'Ᏺ'), - (0x13FB, 'M', 'Ᏻ'), - (0x13FC, 'M', 'Ᏼ'), - (0x13FD, 'M', 'Ᏽ'), - (0x13FE, 'X'), - (0x1400, 'V'), - (0x1680, 'X'), - (0x1681, 'V'), - (0x169D, 'X'), - (0x16A0, 'V'), - (0x16F9, 'X'), - (0x1700, 'V'), - (0x1716, 'X'), - (0x171F, 'V'), - (0x1737, 'X'), - (0x1740, 'V'), - (0x1754, 'X'), - (0x1760, 'V'), - (0x176D, 'X'), - (0x176E, 'V'), - (0x1771, 'X'), - (0x1772, 'V'), - (0x1774, 'X'), - (0x1780, 'V'), - (0x17B4, 'X'), - (0x17B6, 'V'), - (0x17DE, 'X'), - (0x17E0, 'V'), - (0x17EA, 'X'), - (0x17F0, 'V'), - (0x17FA, 'X'), - (0x1800, 'V'), - (0x1806, 'X'), - (0x1807, 'V'), - (0x180B, 'I'), - (0x180E, 'X'), - (0x180F, 'I'), - (0x1810, 'V'), - (0x181A, 'X'), - (0x1820, 'V'), - (0x1879, 'X'), - (0x1880, 'V'), - (0x18AB, 'X'), - (0x18B0, 'V'), - (0x18F6, 'X'), - (0x1900, 'V'), - (0x191F, 'X'), - (0x1920, 'V'), - (0x192C, 'X'), - (0x1930, 'V'), - (0x193C, 'X'), - (0x1940, 'V'), - (0x1941, 'X'), - (0x1944, 'V'), - (0x196E, 'X'), - (0x1970, 'V'), - (0x1975, 'X'), - (0x1980, 'V'), - (0x19AC, 'X'), - (0x19B0, 'V'), - (0x19CA, 'X'), - (0x19D0, 'V'), - (0x19DB, 'X'), - (0x19DE, 'V'), - (0x1A1C, 'X'), - (0x1A1E, 'V'), - (0x1A5F, 'X'), - (0x1A60, 'V'), - (0x1A7D, 'X'), - (0x1A7F, 'V'), - (0x1A8A, 'X'), - (0x1A90, 'V'), - (0x1A9A, 'X'), - (0x1AA0, 'V'), - (0x1AAE, 'X'), - (0x1AB0, 'V'), - (0x1ACF, 'X'), - (0x1B00, 'V'), - (0x1B4D, 'X'), - (0x1B50, 'V'), - (0x1B7F, 'X'), - (0x1B80, 'V'), - (0x1BF4, 'X'), - (0x1BFC, 'V'), - (0x1C38, 'X'), - (0x1C3B, 'V'), - (0x1C4A, 'X'), - (0x1C4D, 'V'), - (0x1C80, 'M', 'в'), - ] - -def _seg_15() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1C81, 'M', 'д'), - (0x1C82, 'M', 'о'), - (0x1C83, 'M', 'с'), - (0x1C84, 'M', 'т'), - (0x1C86, 'M', 'ъ'), - (0x1C87, 'M', 'ѣ'), - (0x1C88, 'M', 'ꙋ'), - (0x1C89, 'X'), - (0x1C90, 'M', 'ა'), - (0x1C91, 'M', 'ბ'), - (0x1C92, 'M', 'გ'), - (0x1C93, 'M', 'დ'), - (0x1C94, 'M', 'ე'), - (0x1C95, 'M', 'ვ'), - (0x1C96, 'M', 'ზ'), - (0x1C97, 'M', 'თ'), - (0x1C98, 'M', 'ი'), - (0x1C99, 'M', 'კ'), - (0x1C9A, 'M', 'ლ'), - (0x1C9B, 'M', 'მ'), - (0x1C9C, 'M', 'ნ'), - (0x1C9D, 'M', 'ო'), - (0x1C9E, 'M', 'პ'), - (0x1C9F, 'M', 'ჟ'), - (0x1CA0, 'M', 'რ'), - (0x1CA1, 'M', 'ს'), - (0x1CA2, 'M', 'ტ'), - (0x1CA3, 'M', 'უ'), - (0x1CA4, 'M', 'ფ'), - (0x1CA5, 'M', 'ქ'), - (0x1CA6, 'M', 'ღ'), - (0x1CA7, 'M', 'ყ'), - (0x1CA8, 'M', 'შ'), - (0x1CA9, 'M', 'ჩ'), - (0x1CAA, 'M', 'ც'), - (0x1CAB, 'M', 'ძ'), - (0x1CAC, 'M', 'წ'), - (0x1CAD, 'M', 'ჭ'), - (0x1CAE, 'M', 'ხ'), - (0x1CAF, 'M', 'ჯ'), - (0x1CB0, 'M', 'ჰ'), - (0x1CB1, 'M', 'ჱ'), - (0x1CB2, 'M', 'ჲ'), - (0x1CB3, 'M', 'ჳ'), - (0x1CB4, 'M', 'ჴ'), - (0x1CB5, 'M', 'ჵ'), - (0x1CB6, 'M', 'ჶ'), - (0x1CB7, 'M', 'ჷ'), - (0x1CB8, 'M', 'ჸ'), - (0x1CB9, 'M', 'ჹ'), - (0x1CBA, 'M', 'ჺ'), - (0x1CBB, 'X'), - (0x1CBD, 'M', 'ჽ'), - (0x1CBE, 'M', 'ჾ'), - (0x1CBF, 'M', 'ჿ'), - (0x1CC0, 'V'), - (0x1CC8, 'X'), - (0x1CD0, 'V'), - (0x1CFB, 'X'), - (0x1D00, 'V'), - (0x1D2C, 'M', 'a'), - (0x1D2D, 'M', 'æ'), - (0x1D2E, 'M', 'b'), - (0x1D2F, 'V'), - (0x1D30, 'M', 'd'), - (0x1D31, 'M', 'e'), - (0x1D32, 'M', 'ǝ'), - (0x1D33, 'M', 'g'), - (0x1D34, 'M', 'h'), - (0x1D35, 'M', 'i'), - (0x1D36, 'M', 'j'), - (0x1D37, 'M', 'k'), - (0x1D38, 'M', 'l'), - (0x1D39, 'M', 'm'), - (0x1D3A, 'M', 'n'), - (0x1D3B, 'V'), - (0x1D3C, 'M', 'o'), - (0x1D3D, 'M', 'ȣ'), - (0x1D3E, 'M', 'p'), - (0x1D3F, 'M', 'r'), - (0x1D40, 'M', 't'), - (0x1D41, 'M', 'u'), - (0x1D42, 'M', 'w'), - (0x1D43, 'M', 'a'), - (0x1D44, 'M', 'ɐ'), - (0x1D45, 'M', 'ɑ'), - (0x1D46, 'M', 'ᴂ'), - (0x1D47, 'M', 'b'), - (0x1D48, 'M', 'd'), - (0x1D49, 'M', 'e'), - (0x1D4A, 'M', 'ə'), - (0x1D4B, 'M', 'ɛ'), - (0x1D4C, 'M', 'ɜ'), - (0x1D4D, 'M', 'g'), - (0x1D4E, 'V'), - (0x1D4F, 'M', 'k'), - (0x1D50, 'M', 'm'), - (0x1D51, 'M', 'ŋ'), - (0x1D52, 'M', 'o'), - (0x1D53, 'M', 'ɔ'), - ] - -def _seg_16() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D54, 'M', 'ᴖ'), - (0x1D55, 'M', 'ᴗ'), - (0x1D56, 'M', 'p'), - (0x1D57, 'M', 't'), - (0x1D58, 'M', 'u'), - (0x1D59, 'M', 'ᴝ'), - (0x1D5A, 'M', 'ɯ'), - (0x1D5B, 'M', 'v'), - (0x1D5C, 'M', 'ᴥ'), - (0x1D5D, 'M', 'β'), - (0x1D5E, 'M', 'γ'), - (0x1D5F, 'M', 'δ'), - (0x1D60, 'M', 'φ'), - (0x1D61, 'M', 'χ'), - (0x1D62, 'M', 'i'), - (0x1D63, 'M', 'r'), - (0x1D64, 'M', 'u'), - (0x1D65, 'M', 'v'), - (0x1D66, 'M', 'β'), - (0x1D67, 'M', 'γ'), - (0x1D68, 'M', 'ρ'), - (0x1D69, 'M', 'φ'), - (0x1D6A, 'M', 'χ'), - (0x1D6B, 'V'), - (0x1D78, 'M', 'н'), - (0x1D79, 'V'), - (0x1D9B, 'M', 'ɒ'), - (0x1D9C, 'M', 'c'), - (0x1D9D, 'M', 'ɕ'), - (0x1D9E, 'M', 'ð'), - (0x1D9F, 'M', 'ɜ'), - (0x1DA0, 'M', 'f'), - (0x1DA1, 'M', 'ɟ'), - (0x1DA2, 'M', 'ɡ'), - (0x1DA3, 'M', 'ɥ'), - (0x1DA4, 'M', 'ɨ'), - (0x1DA5, 'M', 'ɩ'), - (0x1DA6, 'M', 'ɪ'), - (0x1DA7, 'M', 'ᵻ'), - (0x1DA8, 'M', 'ʝ'), - (0x1DA9, 'M', 'ɭ'), - (0x1DAA, 'M', 'ᶅ'), - (0x1DAB, 'M', 'ʟ'), - (0x1DAC, 'M', 'ɱ'), - (0x1DAD, 'M', 'ɰ'), - (0x1DAE, 'M', 'ɲ'), - (0x1DAF, 'M', 'ɳ'), - (0x1DB0, 'M', 'ɴ'), - (0x1DB1, 'M', 'ɵ'), - (0x1DB2, 'M', 'ɸ'), - (0x1DB3, 'M', 'ʂ'), - (0x1DB4, 'M', 'ʃ'), - (0x1DB5, 'M', 'ƫ'), - (0x1DB6, 'M', 'ʉ'), - (0x1DB7, 'M', 'ʊ'), - (0x1DB8, 'M', 'ᴜ'), - (0x1DB9, 'M', 'ʋ'), - (0x1DBA, 'M', 'ʌ'), - (0x1DBB, 'M', 'z'), - (0x1DBC, 'M', 'ʐ'), - (0x1DBD, 'M', 'ʑ'), - (0x1DBE, 'M', 'ʒ'), - (0x1DBF, 'M', 'θ'), - (0x1DC0, 'V'), - (0x1E00, 'M', 'ḁ'), - (0x1E01, 'V'), - (0x1E02, 'M', 'ḃ'), - (0x1E03, 'V'), - (0x1E04, 'M', 'ḅ'), - (0x1E05, 'V'), - (0x1E06, 'M', 'ḇ'), - (0x1E07, 'V'), - (0x1E08, 'M', 'ḉ'), - (0x1E09, 'V'), - (0x1E0A, 'M', 'ḋ'), - (0x1E0B, 'V'), - (0x1E0C, 'M', 'ḍ'), - (0x1E0D, 'V'), - (0x1E0E, 'M', 'ḏ'), - (0x1E0F, 'V'), - (0x1E10, 'M', 'ḑ'), - (0x1E11, 'V'), - (0x1E12, 'M', 'ḓ'), - (0x1E13, 'V'), - (0x1E14, 'M', 'ḕ'), - (0x1E15, 'V'), - (0x1E16, 'M', 'ḗ'), - (0x1E17, 'V'), - (0x1E18, 'M', 'ḙ'), - (0x1E19, 'V'), - (0x1E1A, 'M', 'ḛ'), - (0x1E1B, 'V'), - (0x1E1C, 'M', 'ḝ'), - (0x1E1D, 'V'), - (0x1E1E, 'M', 'ḟ'), - (0x1E1F, 'V'), - (0x1E20, 'M', 'ḡ'), - (0x1E21, 'V'), - (0x1E22, 'M', 'ḣ'), - (0x1E23, 'V'), - ] - -def _seg_17() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E24, 'M', 'ḥ'), - (0x1E25, 'V'), - (0x1E26, 'M', 'ḧ'), - (0x1E27, 'V'), - (0x1E28, 'M', 'ḩ'), - (0x1E29, 'V'), - (0x1E2A, 'M', 'ḫ'), - (0x1E2B, 'V'), - (0x1E2C, 'M', 'ḭ'), - (0x1E2D, 'V'), - (0x1E2E, 'M', 'ḯ'), - (0x1E2F, 'V'), - (0x1E30, 'M', 'ḱ'), - (0x1E31, 'V'), - (0x1E32, 'M', 'ḳ'), - (0x1E33, 'V'), - (0x1E34, 'M', 'ḵ'), - (0x1E35, 'V'), - (0x1E36, 'M', 'ḷ'), - (0x1E37, 'V'), - (0x1E38, 'M', 'ḹ'), - (0x1E39, 'V'), - (0x1E3A, 'M', 'ḻ'), - (0x1E3B, 'V'), - (0x1E3C, 'M', 'ḽ'), - (0x1E3D, 'V'), - (0x1E3E, 'M', 'ḿ'), - (0x1E3F, 'V'), - (0x1E40, 'M', 'ṁ'), - (0x1E41, 'V'), - (0x1E42, 'M', 'ṃ'), - (0x1E43, 'V'), - (0x1E44, 'M', 'ṅ'), - (0x1E45, 'V'), - (0x1E46, 'M', 'ṇ'), - (0x1E47, 'V'), - (0x1E48, 'M', 'ṉ'), - (0x1E49, 'V'), - (0x1E4A, 'M', 'ṋ'), - (0x1E4B, 'V'), - (0x1E4C, 'M', 'ṍ'), - (0x1E4D, 'V'), - (0x1E4E, 'M', 'ṏ'), - (0x1E4F, 'V'), - (0x1E50, 'M', 'ṑ'), - (0x1E51, 'V'), - (0x1E52, 'M', 'ṓ'), - (0x1E53, 'V'), - (0x1E54, 'M', 'ṕ'), - (0x1E55, 'V'), - (0x1E56, 'M', 'ṗ'), - (0x1E57, 'V'), - (0x1E58, 'M', 'ṙ'), - (0x1E59, 'V'), - (0x1E5A, 'M', 'ṛ'), - (0x1E5B, 'V'), - (0x1E5C, 'M', 'ṝ'), - (0x1E5D, 'V'), - (0x1E5E, 'M', 'ṟ'), - (0x1E5F, 'V'), - (0x1E60, 'M', 'ṡ'), - (0x1E61, 'V'), - (0x1E62, 'M', 'ṣ'), - (0x1E63, 'V'), - (0x1E64, 'M', 'ṥ'), - (0x1E65, 'V'), - (0x1E66, 'M', 'ṧ'), - (0x1E67, 'V'), - (0x1E68, 'M', 'ṩ'), - (0x1E69, 'V'), - (0x1E6A, 'M', 'ṫ'), - (0x1E6B, 'V'), - (0x1E6C, 'M', 'ṭ'), - (0x1E6D, 'V'), - (0x1E6E, 'M', 'ṯ'), - (0x1E6F, 'V'), - (0x1E70, 'M', 'ṱ'), - (0x1E71, 'V'), - (0x1E72, 'M', 'ṳ'), - (0x1E73, 'V'), - (0x1E74, 'M', 'ṵ'), - (0x1E75, 'V'), - (0x1E76, 'M', 'ṷ'), - (0x1E77, 'V'), - (0x1E78, 'M', 'ṹ'), - (0x1E79, 'V'), - (0x1E7A, 'M', 'ṻ'), - (0x1E7B, 'V'), - (0x1E7C, 'M', 'ṽ'), - (0x1E7D, 'V'), - (0x1E7E, 'M', 'ṿ'), - (0x1E7F, 'V'), - (0x1E80, 'M', 'ẁ'), - (0x1E81, 'V'), - (0x1E82, 'M', 'ẃ'), - (0x1E83, 'V'), - (0x1E84, 'M', 'ẅ'), - (0x1E85, 'V'), - (0x1E86, 'M', 'ẇ'), - (0x1E87, 'V'), - ] - -def _seg_18() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E88, 'M', 'ẉ'), - (0x1E89, 'V'), - (0x1E8A, 'M', 'ẋ'), - (0x1E8B, 'V'), - (0x1E8C, 'M', 'ẍ'), - (0x1E8D, 'V'), - (0x1E8E, 'M', 'ẏ'), - (0x1E8F, 'V'), - (0x1E90, 'M', 'ẑ'), - (0x1E91, 'V'), - (0x1E92, 'M', 'ẓ'), - (0x1E93, 'V'), - (0x1E94, 'M', 'ẕ'), - (0x1E95, 'V'), - (0x1E9A, 'M', 'aʾ'), - (0x1E9B, 'M', 'ṡ'), - (0x1E9C, 'V'), - (0x1E9E, 'M', 'ss'), - (0x1E9F, 'V'), - (0x1EA0, 'M', 'ạ'), - (0x1EA1, 'V'), - (0x1EA2, 'M', 'ả'), - (0x1EA3, 'V'), - (0x1EA4, 'M', 'ấ'), - (0x1EA5, 'V'), - (0x1EA6, 'M', 'ầ'), - (0x1EA7, 'V'), - (0x1EA8, 'M', 'ẩ'), - (0x1EA9, 'V'), - (0x1EAA, 'M', 'ẫ'), - (0x1EAB, 'V'), - (0x1EAC, 'M', 'ậ'), - (0x1EAD, 'V'), - (0x1EAE, 'M', 'ắ'), - (0x1EAF, 'V'), - (0x1EB0, 'M', 'ằ'), - (0x1EB1, 'V'), - (0x1EB2, 'M', 'ẳ'), - (0x1EB3, 'V'), - (0x1EB4, 'M', 'ẵ'), - (0x1EB5, 'V'), - (0x1EB6, 'M', 'ặ'), - (0x1EB7, 'V'), - (0x1EB8, 'M', 'ẹ'), - (0x1EB9, 'V'), - (0x1EBA, 'M', 'ẻ'), - (0x1EBB, 'V'), - (0x1EBC, 'M', 'ẽ'), - (0x1EBD, 'V'), - (0x1EBE, 'M', 'ế'), - (0x1EBF, 'V'), - (0x1EC0, 'M', 'ề'), - (0x1EC1, 'V'), - (0x1EC2, 'M', 'ể'), - (0x1EC3, 'V'), - (0x1EC4, 'M', 'ễ'), - (0x1EC5, 'V'), - (0x1EC6, 'M', 'ệ'), - (0x1EC7, 'V'), - (0x1EC8, 'M', 'ỉ'), - (0x1EC9, 'V'), - (0x1ECA, 'M', 'ị'), - (0x1ECB, 'V'), - (0x1ECC, 'M', 'ọ'), - (0x1ECD, 'V'), - (0x1ECE, 'M', 'ỏ'), - (0x1ECF, 'V'), - (0x1ED0, 'M', 'ố'), - (0x1ED1, 'V'), - (0x1ED2, 'M', 'ồ'), - (0x1ED3, 'V'), - (0x1ED4, 'M', 'ổ'), - (0x1ED5, 'V'), - (0x1ED6, 'M', 'ỗ'), - (0x1ED7, 'V'), - (0x1ED8, 'M', 'ộ'), - (0x1ED9, 'V'), - (0x1EDA, 'M', 'ớ'), - (0x1EDB, 'V'), - (0x1EDC, 'M', 'ờ'), - (0x1EDD, 'V'), - (0x1EDE, 'M', 'ở'), - (0x1EDF, 'V'), - (0x1EE0, 'M', 'ỡ'), - (0x1EE1, 'V'), - (0x1EE2, 'M', 'ợ'), - (0x1EE3, 'V'), - (0x1EE4, 'M', 'ụ'), - (0x1EE5, 'V'), - (0x1EE6, 'M', 'ủ'), - (0x1EE7, 'V'), - (0x1EE8, 'M', 'ứ'), - (0x1EE9, 'V'), - (0x1EEA, 'M', 'ừ'), - (0x1EEB, 'V'), - (0x1EEC, 'M', 'ử'), - (0x1EED, 'V'), - (0x1EEE, 'M', 'ữ'), - (0x1EEF, 'V'), - (0x1EF0, 'M', 'ự'), - ] - -def _seg_19() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EF1, 'V'), - (0x1EF2, 'M', 'ỳ'), - (0x1EF3, 'V'), - (0x1EF4, 'M', 'ỵ'), - (0x1EF5, 'V'), - (0x1EF6, 'M', 'ỷ'), - (0x1EF7, 'V'), - (0x1EF8, 'M', 'ỹ'), - (0x1EF9, 'V'), - (0x1EFA, 'M', 'ỻ'), - (0x1EFB, 'V'), - (0x1EFC, 'M', 'ỽ'), - (0x1EFD, 'V'), - (0x1EFE, 'M', 'ỿ'), - (0x1EFF, 'V'), - (0x1F08, 'M', 'ἀ'), - (0x1F09, 'M', 'ἁ'), - (0x1F0A, 'M', 'ἂ'), - (0x1F0B, 'M', 'ἃ'), - (0x1F0C, 'M', 'ἄ'), - (0x1F0D, 'M', 'ἅ'), - (0x1F0E, 'M', 'ἆ'), - (0x1F0F, 'M', 'ἇ'), - (0x1F10, 'V'), - (0x1F16, 'X'), - (0x1F18, 'M', 'ἐ'), - (0x1F19, 'M', 'ἑ'), - (0x1F1A, 'M', 'ἒ'), - (0x1F1B, 'M', 'ἓ'), - (0x1F1C, 'M', 'ἔ'), - (0x1F1D, 'M', 'ἕ'), - (0x1F1E, 'X'), - (0x1F20, 'V'), - (0x1F28, 'M', 'ἠ'), - (0x1F29, 'M', 'ἡ'), - (0x1F2A, 'M', 'ἢ'), - (0x1F2B, 'M', 'ἣ'), - (0x1F2C, 'M', 'ἤ'), - (0x1F2D, 'M', 'ἥ'), - (0x1F2E, 'M', 'ἦ'), - (0x1F2F, 'M', 'ἧ'), - (0x1F30, 'V'), - (0x1F38, 'M', 'ἰ'), - (0x1F39, 'M', 'ἱ'), - (0x1F3A, 'M', 'ἲ'), - (0x1F3B, 'M', 'ἳ'), - (0x1F3C, 'M', 'ἴ'), - (0x1F3D, 'M', 'ἵ'), - (0x1F3E, 'M', 'ἶ'), - (0x1F3F, 'M', 'ἷ'), - (0x1F40, 'V'), - (0x1F46, 'X'), - (0x1F48, 'M', 'ὀ'), - (0x1F49, 'M', 'ὁ'), - (0x1F4A, 'M', 'ὂ'), - (0x1F4B, 'M', 'ὃ'), - (0x1F4C, 'M', 'ὄ'), - (0x1F4D, 'M', 'ὅ'), - (0x1F4E, 'X'), - (0x1F50, 'V'), - (0x1F58, 'X'), - (0x1F59, 'M', 'ὑ'), - (0x1F5A, 'X'), - (0x1F5B, 'M', 'ὓ'), - (0x1F5C, 'X'), - (0x1F5D, 'M', 'ὕ'), - (0x1F5E, 'X'), - (0x1F5F, 'M', 'ὗ'), - (0x1F60, 'V'), - (0x1F68, 'M', 'ὠ'), - (0x1F69, 'M', 'ὡ'), - (0x1F6A, 'M', 'ὢ'), - (0x1F6B, 'M', 'ὣ'), - (0x1F6C, 'M', 'ὤ'), - (0x1F6D, 'M', 'ὥ'), - (0x1F6E, 'M', 'ὦ'), - (0x1F6F, 'M', 'ὧ'), - (0x1F70, 'V'), - (0x1F71, 'M', 'ά'), - (0x1F72, 'V'), - (0x1F73, 'M', 'έ'), - (0x1F74, 'V'), - (0x1F75, 'M', 'ή'), - (0x1F76, 'V'), - (0x1F77, 'M', 'ί'), - (0x1F78, 'V'), - (0x1F79, 'M', 'ό'), - (0x1F7A, 'V'), - (0x1F7B, 'M', 'ύ'), - (0x1F7C, 'V'), - (0x1F7D, 'M', 'ώ'), - (0x1F7E, 'X'), - (0x1F80, 'M', 'ἀι'), - (0x1F81, 'M', 'ἁι'), - (0x1F82, 'M', 'ἂι'), - (0x1F83, 'M', 'ἃι'), - (0x1F84, 'M', 'ἄι'), - (0x1F85, 'M', 'ἅι'), - (0x1F86, 'M', 'ἆι'), - (0x1F87, 'M', 'ἇι'), - ] - -def _seg_20() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1F88, 'M', 'ἀι'), - (0x1F89, 'M', 'ἁι'), - (0x1F8A, 'M', 'ἂι'), - (0x1F8B, 'M', 'ἃι'), - (0x1F8C, 'M', 'ἄι'), - (0x1F8D, 'M', 'ἅι'), - (0x1F8E, 'M', 'ἆι'), - (0x1F8F, 'M', 'ἇι'), - (0x1F90, 'M', 'ἠι'), - (0x1F91, 'M', 'ἡι'), - (0x1F92, 'M', 'ἢι'), - (0x1F93, 'M', 'ἣι'), - (0x1F94, 'M', 'ἤι'), - (0x1F95, 'M', 'ἥι'), - (0x1F96, 'M', 'ἦι'), - (0x1F97, 'M', 'ἧι'), - (0x1F98, 'M', 'ἠι'), - (0x1F99, 'M', 'ἡι'), - (0x1F9A, 'M', 'ἢι'), - (0x1F9B, 'M', 'ἣι'), - (0x1F9C, 'M', 'ἤι'), - (0x1F9D, 'M', 'ἥι'), - (0x1F9E, 'M', 'ἦι'), - (0x1F9F, 'M', 'ἧι'), - (0x1FA0, 'M', 'ὠι'), - (0x1FA1, 'M', 'ὡι'), - (0x1FA2, 'M', 'ὢι'), - (0x1FA3, 'M', 'ὣι'), - (0x1FA4, 'M', 'ὤι'), - (0x1FA5, 'M', 'ὥι'), - (0x1FA6, 'M', 'ὦι'), - (0x1FA7, 'M', 'ὧι'), - (0x1FA8, 'M', 'ὠι'), - (0x1FA9, 'M', 'ὡι'), - (0x1FAA, 'M', 'ὢι'), - (0x1FAB, 'M', 'ὣι'), - (0x1FAC, 'M', 'ὤι'), - (0x1FAD, 'M', 'ὥι'), - (0x1FAE, 'M', 'ὦι'), - (0x1FAF, 'M', 'ὧι'), - (0x1FB0, 'V'), - (0x1FB2, 'M', 'ὰι'), - (0x1FB3, 'M', 'αι'), - (0x1FB4, 'M', 'άι'), - (0x1FB5, 'X'), - (0x1FB6, 'V'), - (0x1FB7, 'M', 'ᾶι'), - (0x1FB8, 'M', 'ᾰ'), - (0x1FB9, 'M', 'ᾱ'), - (0x1FBA, 'M', 'ὰ'), - (0x1FBB, 'M', 'ά'), - (0x1FBC, 'M', 'αι'), - (0x1FBD, '3', ' ̓'), - (0x1FBE, 'M', 'ι'), - (0x1FBF, '3', ' ̓'), - (0x1FC0, '3', ' ͂'), - (0x1FC1, '3', ' ̈͂'), - (0x1FC2, 'M', 'ὴι'), - (0x1FC3, 'M', 'ηι'), - (0x1FC4, 'M', 'ήι'), - (0x1FC5, 'X'), - (0x1FC6, 'V'), - (0x1FC7, 'M', 'ῆι'), - (0x1FC8, 'M', 'ὲ'), - (0x1FC9, 'M', 'έ'), - (0x1FCA, 'M', 'ὴ'), - (0x1FCB, 'M', 'ή'), - (0x1FCC, 'M', 'ηι'), - (0x1FCD, '3', ' ̓̀'), - (0x1FCE, '3', ' ̓́'), - (0x1FCF, '3', ' ̓͂'), - (0x1FD0, 'V'), - (0x1FD3, 'M', 'ΐ'), - (0x1FD4, 'X'), - (0x1FD6, 'V'), - (0x1FD8, 'M', 'ῐ'), - (0x1FD9, 'M', 'ῑ'), - (0x1FDA, 'M', 'ὶ'), - (0x1FDB, 'M', 'ί'), - (0x1FDC, 'X'), - (0x1FDD, '3', ' ̔̀'), - (0x1FDE, '3', ' ̔́'), - (0x1FDF, '3', ' ̔͂'), - (0x1FE0, 'V'), - (0x1FE3, 'M', 'ΰ'), - (0x1FE4, 'V'), - (0x1FE8, 'M', 'ῠ'), - (0x1FE9, 'M', 'ῡ'), - (0x1FEA, 'M', 'ὺ'), - (0x1FEB, 'M', 'ύ'), - (0x1FEC, 'M', 'ῥ'), - (0x1FED, '3', ' ̈̀'), - (0x1FEE, '3', ' ̈́'), - (0x1FEF, '3', '`'), - (0x1FF0, 'X'), - (0x1FF2, 'M', 'ὼι'), - (0x1FF3, 'M', 'ωι'), - (0x1FF4, 'M', 'ώι'), - (0x1FF5, 'X'), - (0x1FF6, 'V'), - ] - -def _seg_21() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1FF7, 'M', 'ῶι'), - (0x1FF8, 'M', 'ὸ'), - (0x1FF9, 'M', 'ό'), - (0x1FFA, 'M', 'ὼ'), - (0x1FFB, 'M', 'ώ'), - (0x1FFC, 'M', 'ωι'), - (0x1FFD, '3', ' ́'), - (0x1FFE, '3', ' ̔'), - (0x1FFF, 'X'), - (0x2000, '3', ' '), - (0x200B, 'I'), - (0x200C, 'D', ''), - (0x200E, 'X'), - (0x2010, 'V'), - (0x2011, 'M', '‐'), - (0x2012, 'V'), - (0x2017, '3', ' ̳'), - (0x2018, 'V'), - (0x2024, 'X'), - (0x2027, 'V'), - (0x2028, 'X'), - (0x202F, '3', ' '), - (0x2030, 'V'), - (0x2033, 'M', '′′'), - (0x2034, 'M', '′′′'), - (0x2035, 'V'), - (0x2036, 'M', '‵‵'), - (0x2037, 'M', '‵‵‵'), - (0x2038, 'V'), - (0x203C, '3', '!!'), - (0x203D, 'V'), - (0x203E, '3', ' ̅'), - (0x203F, 'V'), - (0x2047, '3', '??'), - (0x2048, '3', '?!'), - (0x2049, '3', '!?'), - (0x204A, 'V'), - (0x2057, 'M', '′′′′'), - (0x2058, 'V'), - (0x205F, '3', ' '), - (0x2060, 'I'), - (0x2061, 'X'), - (0x2064, 'I'), - (0x2065, 'X'), - (0x2070, 'M', '0'), - (0x2071, 'M', 'i'), - (0x2072, 'X'), - (0x2074, 'M', '4'), - (0x2075, 'M', '5'), - (0x2076, 'M', '6'), - (0x2077, 'M', '7'), - (0x2078, 'M', '8'), - (0x2079, 'M', '9'), - (0x207A, '3', '+'), - (0x207B, 'M', '−'), - (0x207C, '3', '='), - (0x207D, '3', '('), - (0x207E, '3', ')'), - (0x207F, 'M', 'n'), - (0x2080, 'M', '0'), - (0x2081, 'M', '1'), - (0x2082, 'M', '2'), - (0x2083, 'M', '3'), - (0x2084, 'M', '4'), - (0x2085, 'M', '5'), - (0x2086, 'M', '6'), - (0x2087, 'M', '7'), - (0x2088, 'M', '8'), - (0x2089, 'M', '9'), - (0x208A, '3', '+'), - (0x208B, 'M', '−'), - (0x208C, '3', '='), - (0x208D, '3', '('), - (0x208E, '3', ')'), - (0x208F, 'X'), - (0x2090, 'M', 'a'), - (0x2091, 'M', 'e'), - (0x2092, 'M', 'o'), - (0x2093, 'M', 'x'), - (0x2094, 'M', 'ə'), - (0x2095, 'M', 'h'), - (0x2096, 'M', 'k'), - (0x2097, 'M', 'l'), - (0x2098, 'M', 'm'), - (0x2099, 'M', 'n'), - (0x209A, 'M', 'p'), - (0x209B, 'M', 's'), - (0x209C, 'M', 't'), - (0x209D, 'X'), - (0x20A0, 'V'), - (0x20A8, 'M', 'rs'), - (0x20A9, 'V'), - (0x20C1, 'X'), - (0x20D0, 'V'), - (0x20F1, 'X'), - (0x2100, '3', 'a/c'), - (0x2101, '3', 'a/s'), - (0x2102, 'M', 'c'), - (0x2103, 'M', '°c'), - (0x2104, 'V'), - ] - -def _seg_22() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2105, '3', 'c/o'), - (0x2106, '3', 'c/u'), - (0x2107, 'M', 'ɛ'), - (0x2108, 'V'), - (0x2109, 'M', '°f'), - (0x210A, 'M', 'g'), - (0x210B, 'M', 'h'), - (0x210F, 'M', 'ħ'), - (0x2110, 'M', 'i'), - (0x2112, 'M', 'l'), - (0x2114, 'V'), - (0x2115, 'M', 'n'), - (0x2116, 'M', 'no'), - (0x2117, 'V'), - (0x2119, 'M', 'p'), - (0x211A, 'M', 'q'), - (0x211B, 'M', 'r'), - (0x211E, 'V'), - (0x2120, 'M', 'sm'), - (0x2121, 'M', 'tel'), - (0x2122, 'M', 'tm'), - (0x2123, 'V'), - (0x2124, 'M', 'z'), - (0x2125, 'V'), - (0x2126, 'M', 'ω'), - (0x2127, 'V'), - (0x2128, 'M', 'z'), - (0x2129, 'V'), - (0x212A, 'M', 'k'), - (0x212B, 'M', 'å'), - (0x212C, 'M', 'b'), - (0x212D, 'M', 'c'), - (0x212E, 'V'), - (0x212F, 'M', 'e'), - (0x2131, 'M', 'f'), - (0x2132, 'X'), - (0x2133, 'M', 'm'), - (0x2134, 'M', 'o'), - (0x2135, 'M', 'א'), - (0x2136, 'M', 'ב'), - (0x2137, 'M', 'ג'), - (0x2138, 'M', 'ד'), - (0x2139, 'M', 'i'), - (0x213A, 'V'), - (0x213B, 'M', 'fax'), - (0x213C, 'M', 'π'), - (0x213D, 'M', 'γ'), - (0x213F, 'M', 'π'), - (0x2140, 'M', '∑'), - (0x2141, 'V'), - (0x2145, 'M', 'd'), - (0x2147, 'M', 'e'), - (0x2148, 'M', 'i'), - (0x2149, 'M', 'j'), - (0x214A, 'V'), - (0x2150, 'M', '1⁄7'), - (0x2151, 'M', '1⁄9'), - (0x2152, 'M', '1⁄10'), - (0x2153, 'M', '1⁄3'), - (0x2154, 'M', '2⁄3'), - (0x2155, 'M', '1⁄5'), - (0x2156, 'M', '2⁄5'), - (0x2157, 'M', '3⁄5'), - (0x2158, 'M', '4⁄5'), - (0x2159, 'M', '1⁄6'), - (0x215A, 'M', '5⁄6'), - (0x215B, 'M', '1⁄8'), - (0x215C, 'M', '3⁄8'), - (0x215D, 'M', '5⁄8'), - (0x215E, 'M', '7⁄8'), - (0x215F, 'M', '1⁄'), - (0x2160, 'M', 'i'), - (0x2161, 'M', 'ii'), - (0x2162, 'M', 'iii'), - (0x2163, 'M', 'iv'), - (0x2164, 'M', 'v'), - (0x2165, 'M', 'vi'), - (0x2166, 'M', 'vii'), - (0x2167, 'M', 'viii'), - (0x2168, 'M', 'ix'), - (0x2169, 'M', 'x'), - (0x216A, 'M', 'xi'), - (0x216B, 'M', 'xii'), - (0x216C, 'M', 'l'), - (0x216D, 'M', 'c'), - (0x216E, 'M', 'd'), - (0x216F, 'M', 'm'), - (0x2170, 'M', 'i'), - (0x2171, 'M', 'ii'), - (0x2172, 'M', 'iii'), - (0x2173, 'M', 'iv'), - (0x2174, 'M', 'v'), - (0x2175, 'M', 'vi'), - (0x2176, 'M', 'vii'), - (0x2177, 'M', 'viii'), - (0x2178, 'M', 'ix'), - (0x2179, 'M', 'x'), - (0x217A, 'M', 'xi'), - (0x217B, 'M', 'xii'), - (0x217C, 'M', 'l'), - ] - -def _seg_23() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x217D, 'M', 'c'), - (0x217E, 'M', 'd'), - (0x217F, 'M', 'm'), - (0x2180, 'V'), - (0x2183, 'X'), - (0x2184, 'V'), - (0x2189, 'M', '0⁄3'), - (0x218A, 'V'), - (0x218C, 'X'), - (0x2190, 'V'), - (0x222C, 'M', '∫∫'), - (0x222D, 'M', '∫∫∫'), - (0x222E, 'V'), - (0x222F, 'M', '∮∮'), - (0x2230, 'M', '∮∮∮'), - (0x2231, 'V'), - (0x2260, '3'), - (0x2261, 'V'), - (0x226E, '3'), - (0x2270, 'V'), - (0x2329, 'M', '〈'), - (0x232A, 'M', '〉'), - (0x232B, 'V'), - (0x2427, 'X'), - (0x2440, 'V'), - (0x244B, 'X'), - (0x2460, 'M', '1'), - (0x2461, 'M', '2'), - (0x2462, 'M', '3'), - (0x2463, 'M', '4'), - (0x2464, 'M', '5'), - (0x2465, 'M', '6'), - (0x2466, 'M', '7'), - (0x2467, 'M', '8'), - (0x2468, 'M', '9'), - (0x2469, 'M', '10'), - (0x246A, 'M', '11'), - (0x246B, 'M', '12'), - (0x246C, 'M', '13'), - (0x246D, 'M', '14'), - (0x246E, 'M', '15'), - (0x246F, 'M', '16'), - (0x2470, 'M', '17'), - (0x2471, 'M', '18'), - (0x2472, 'M', '19'), - (0x2473, 'M', '20'), - (0x2474, '3', '(1)'), - (0x2475, '3', '(2)'), - (0x2476, '3', '(3)'), - (0x2477, '3', '(4)'), - (0x2478, '3', '(5)'), - (0x2479, '3', '(6)'), - (0x247A, '3', '(7)'), - (0x247B, '3', '(8)'), - (0x247C, '3', '(9)'), - (0x247D, '3', '(10)'), - (0x247E, '3', '(11)'), - (0x247F, '3', '(12)'), - (0x2480, '3', '(13)'), - (0x2481, '3', '(14)'), - (0x2482, '3', '(15)'), - (0x2483, '3', '(16)'), - (0x2484, '3', '(17)'), - (0x2485, '3', '(18)'), - (0x2486, '3', '(19)'), - (0x2487, '3', '(20)'), - (0x2488, 'X'), - (0x249C, '3', '(a)'), - (0x249D, '3', '(b)'), - (0x249E, '3', '(c)'), - (0x249F, '3', '(d)'), - (0x24A0, '3', '(e)'), - (0x24A1, '3', '(f)'), - (0x24A2, '3', '(g)'), - (0x24A3, '3', '(h)'), - (0x24A4, '3', '(i)'), - (0x24A5, '3', '(j)'), - (0x24A6, '3', '(k)'), - (0x24A7, '3', '(l)'), - (0x24A8, '3', '(m)'), - (0x24A9, '3', '(n)'), - (0x24AA, '3', '(o)'), - (0x24AB, '3', '(p)'), - (0x24AC, '3', '(q)'), - (0x24AD, '3', '(r)'), - (0x24AE, '3', '(s)'), - (0x24AF, '3', '(t)'), - (0x24B0, '3', '(u)'), - (0x24B1, '3', '(v)'), - (0x24B2, '3', '(w)'), - (0x24B3, '3', '(x)'), - (0x24B4, '3', '(y)'), - (0x24B5, '3', '(z)'), - (0x24B6, 'M', 'a'), - (0x24B7, 'M', 'b'), - (0x24B8, 'M', 'c'), - (0x24B9, 'M', 'd'), - (0x24BA, 'M', 'e'), - (0x24BB, 'M', 'f'), - (0x24BC, 'M', 'g'), - ] - -def _seg_24() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x24BD, 'M', 'h'), - (0x24BE, 'M', 'i'), - (0x24BF, 'M', 'j'), - (0x24C0, 'M', 'k'), - (0x24C1, 'M', 'l'), - (0x24C2, 'M', 'm'), - (0x24C3, 'M', 'n'), - (0x24C4, 'M', 'o'), - (0x24C5, 'M', 'p'), - (0x24C6, 'M', 'q'), - (0x24C7, 'M', 'r'), - (0x24C8, 'M', 's'), - (0x24C9, 'M', 't'), - (0x24CA, 'M', 'u'), - (0x24CB, 'M', 'v'), - (0x24CC, 'M', 'w'), - (0x24CD, 'M', 'x'), - (0x24CE, 'M', 'y'), - (0x24CF, 'M', 'z'), - (0x24D0, 'M', 'a'), - (0x24D1, 'M', 'b'), - (0x24D2, 'M', 'c'), - (0x24D3, 'M', 'd'), - (0x24D4, 'M', 'e'), - (0x24D5, 'M', 'f'), - (0x24D6, 'M', 'g'), - (0x24D7, 'M', 'h'), - (0x24D8, 'M', 'i'), - (0x24D9, 'M', 'j'), - (0x24DA, 'M', 'k'), - (0x24DB, 'M', 'l'), - (0x24DC, 'M', 'm'), - (0x24DD, 'M', 'n'), - (0x24DE, 'M', 'o'), - (0x24DF, 'M', 'p'), - (0x24E0, 'M', 'q'), - (0x24E1, 'M', 'r'), - (0x24E2, 'M', 's'), - (0x24E3, 'M', 't'), - (0x24E4, 'M', 'u'), - (0x24E5, 'M', 'v'), - (0x24E6, 'M', 'w'), - (0x24E7, 'M', 'x'), - (0x24E8, 'M', 'y'), - (0x24E9, 'M', 'z'), - (0x24EA, 'M', '0'), - (0x24EB, 'V'), - (0x2A0C, 'M', '∫∫∫∫'), - (0x2A0D, 'V'), - (0x2A74, '3', '::='), - (0x2A75, '3', '=='), - (0x2A76, '3', '==='), - (0x2A77, 'V'), - (0x2ADC, 'M', '⫝̸'), - (0x2ADD, 'V'), - (0x2B74, 'X'), - (0x2B76, 'V'), - (0x2B96, 'X'), - (0x2B97, 'V'), - (0x2C00, 'M', 'ⰰ'), - (0x2C01, 'M', 'ⰱ'), - (0x2C02, 'M', 'ⰲ'), - (0x2C03, 'M', 'ⰳ'), - (0x2C04, 'M', 'ⰴ'), - (0x2C05, 'M', 'ⰵ'), - (0x2C06, 'M', 'ⰶ'), - (0x2C07, 'M', 'ⰷ'), - (0x2C08, 'M', 'ⰸ'), - (0x2C09, 'M', 'ⰹ'), - (0x2C0A, 'M', 'ⰺ'), - (0x2C0B, 'M', 'ⰻ'), - (0x2C0C, 'M', 'ⰼ'), - (0x2C0D, 'M', 'ⰽ'), - (0x2C0E, 'M', 'ⰾ'), - (0x2C0F, 'M', 'ⰿ'), - (0x2C10, 'M', 'ⱀ'), - (0x2C11, 'M', 'ⱁ'), - (0x2C12, 'M', 'ⱂ'), - (0x2C13, 'M', 'ⱃ'), - (0x2C14, 'M', 'ⱄ'), - (0x2C15, 'M', 'ⱅ'), - (0x2C16, 'M', 'ⱆ'), - (0x2C17, 'M', 'ⱇ'), - (0x2C18, 'M', 'ⱈ'), - (0x2C19, 'M', 'ⱉ'), - (0x2C1A, 'M', 'ⱊ'), - (0x2C1B, 'M', 'ⱋ'), - (0x2C1C, 'M', 'ⱌ'), - (0x2C1D, 'M', 'ⱍ'), - (0x2C1E, 'M', 'ⱎ'), - (0x2C1F, 'M', 'ⱏ'), - (0x2C20, 'M', 'ⱐ'), - (0x2C21, 'M', 'ⱑ'), - (0x2C22, 'M', 'ⱒ'), - (0x2C23, 'M', 'ⱓ'), - (0x2C24, 'M', 'ⱔ'), - (0x2C25, 'M', 'ⱕ'), - (0x2C26, 'M', 'ⱖ'), - (0x2C27, 'M', 'ⱗ'), - (0x2C28, 'M', 'ⱘ'), - ] - -def _seg_25() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2C29, 'M', 'ⱙ'), - (0x2C2A, 'M', 'ⱚ'), - (0x2C2B, 'M', 'ⱛ'), - (0x2C2C, 'M', 'ⱜ'), - (0x2C2D, 'M', 'ⱝ'), - (0x2C2E, 'M', 'ⱞ'), - (0x2C2F, 'M', 'ⱟ'), - (0x2C30, 'V'), - (0x2C60, 'M', 'ⱡ'), - (0x2C61, 'V'), - (0x2C62, 'M', 'ɫ'), - (0x2C63, 'M', 'ᵽ'), - (0x2C64, 'M', 'ɽ'), - (0x2C65, 'V'), - (0x2C67, 'M', 'ⱨ'), - (0x2C68, 'V'), - (0x2C69, 'M', 'ⱪ'), - (0x2C6A, 'V'), - (0x2C6B, 'M', 'ⱬ'), - (0x2C6C, 'V'), - (0x2C6D, 'M', 'ɑ'), - (0x2C6E, 'M', 'ɱ'), - (0x2C6F, 'M', 'ɐ'), - (0x2C70, 'M', 'ɒ'), - (0x2C71, 'V'), - (0x2C72, 'M', 'ⱳ'), - (0x2C73, 'V'), - (0x2C75, 'M', 'ⱶ'), - (0x2C76, 'V'), - (0x2C7C, 'M', 'j'), - (0x2C7D, 'M', 'v'), - (0x2C7E, 'M', 'ȿ'), - (0x2C7F, 'M', 'ɀ'), - (0x2C80, 'M', 'ⲁ'), - (0x2C81, 'V'), - (0x2C82, 'M', 'ⲃ'), - (0x2C83, 'V'), - (0x2C84, 'M', 'ⲅ'), - (0x2C85, 'V'), - (0x2C86, 'M', 'ⲇ'), - (0x2C87, 'V'), - (0x2C88, 'M', 'ⲉ'), - (0x2C89, 'V'), - (0x2C8A, 'M', 'ⲋ'), - (0x2C8B, 'V'), - (0x2C8C, 'M', 'ⲍ'), - (0x2C8D, 'V'), - (0x2C8E, 'M', 'ⲏ'), - (0x2C8F, 'V'), - (0x2C90, 'M', 'ⲑ'), - (0x2C91, 'V'), - (0x2C92, 'M', 'ⲓ'), - (0x2C93, 'V'), - (0x2C94, 'M', 'ⲕ'), - (0x2C95, 'V'), - (0x2C96, 'M', 'ⲗ'), - (0x2C97, 'V'), - (0x2C98, 'M', 'ⲙ'), - (0x2C99, 'V'), - (0x2C9A, 'M', 'ⲛ'), - (0x2C9B, 'V'), - (0x2C9C, 'M', 'ⲝ'), - (0x2C9D, 'V'), - (0x2C9E, 'M', 'ⲟ'), - (0x2C9F, 'V'), - (0x2CA0, 'M', 'ⲡ'), - (0x2CA1, 'V'), - (0x2CA2, 'M', 'ⲣ'), - (0x2CA3, 'V'), - (0x2CA4, 'M', 'ⲥ'), - (0x2CA5, 'V'), - (0x2CA6, 'M', 'ⲧ'), - (0x2CA7, 'V'), - (0x2CA8, 'M', 'ⲩ'), - (0x2CA9, 'V'), - (0x2CAA, 'M', 'ⲫ'), - (0x2CAB, 'V'), - (0x2CAC, 'M', 'ⲭ'), - (0x2CAD, 'V'), - (0x2CAE, 'M', 'ⲯ'), - (0x2CAF, 'V'), - (0x2CB0, 'M', 'ⲱ'), - (0x2CB1, 'V'), - (0x2CB2, 'M', 'ⲳ'), - (0x2CB3, 'V'), - (0x2CB4, 'M', 'ⲵ'), - (0x2CB5, 'V'), - (0x2CB6, 'M', 'ⲷ'), - (0x2CB7, 'V'), - (0x2CB8, 'M', 'ⲹ'), - (0x2CB9, 'V'), - (0x2CBA, 'M', 'ⲻ'), - (0x2CBB, 'V'), - (0x2CBC, 'M', 'ⲽ'), - (0x2CBD, 'V'), - (0x2CBE, 'M', 'ⲿ'), - (0x2CBF, 'V'), - (0x2CC0, 'M', 'ⳁ'), - (0x2CC1, 'V'), - (0x2CC2, 'M', 'ⳃ'), - ] - -def _seg_26() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2CC3, 'V'), - (0x2CC4, 'M', 'ⳅ'), - (0x2CC5, 'V'), - (0x2CC6, 'M', 'ⳇ'), - (0x2CC7, 'V'), - (0x2CC8, 'M', 'ⳉ'), - (0x2CC9, 'V'), - (0x2CCA, 'M', 'ⳋ'), - (0x2CCB, 'V'), - (0x2CCC, 'M', 'ⳍ'), - (0x2CCD, 'V'), - (0x2CCE, 'M', 'ⳏ'), - (0x2CCF, 'V'), - (0x2CD0, 'M', 'ⳑ'), - (0x2CD1, 'V'), - (0x2CD2, 'M', 'ⳓ'), - (0x2CD3, 'V'), - (0x2CD4, 'M', 'ⳕ'), - (0x2CD5, 'V'), - (0x2CD6, 'M', 'ⳗ'), - (0x2CD7, 'V'), - (0x2CD8, 'M', 'ⳙ'), - (0x2CD9, 'V'), - (0x2CDA, 'M', 'ⳛ'), - (0x2CDB, 'V'), - (0x2CDC, 'M', 'ⳝ'), - (0x2CDD, 'V'), - (0x2CDE, 'M', 'ⳟ'), - (0x2CDF, 'V'), - (0x2CE0, 'M', 'ⳡ'), - (0x2CE1, 'V'), - (0x2CE2, 'M', 'ⳣ'), - (0x2CE3, 'V'), - (0x2CEB, 'M', 'ⳬ'), - (0x2CEC, 'V'), - (0x2CED, 'M', 'ⳮ'), - (0x2CEE, 'V'), - (0x2CF2, 'M', 'ⳳ'), - (0x2CF3, 'V'), - (0x2CF4, 'X'), - (0x2CF9, 'V'), - (0x2D26, 'X'), - (0x2D27, 'V'), - (0x2D28, 'X'), - (0x2D2D, 'V'), - (0x2D2E, 'X'), - (0x2D30, 'V'), - (0x2D68, 'X'), - (0x2D6F, 'M', 'ⵡ'), - (0x2D70, 'V'), - (0x2D71, 'X'), - (0x2D7F, 'V'), - (0x2D97, 'X'), - (0x2DA0, 'V'), - (0x2DA7, 'X'), - (0x2DA8, 'V'), - (0x2DAF, 'X'), - (0x2DB0, 'V'), - (0x2DB7, 'X'), - (0x2DB8, 'V'), - (0x2DBF, 'X'), - (0x2DC0, 'V'), - (0x2DC7, 'X'), - (0x2DC8, 'V'), - (0x2DCF, 'X'), - (0x2DD0, 'V'), - (0x2DD7, 'X'), - (0x2DD8, 'V'), - (0x2DDF, 'X'), - (0x2DE0, 'V'), - (0x2E5E, 'X'), - (0x2E80, 'V'), - (0x2E9A, 'X'), - (0x2E9B, 'V'), - (0x2E9F, 'M', '母'), - (0x2EA0, 'V'), - (0x2EF3, 'M', '龟'), - (0x2EF4, 'X'), - (0x2F00, 'M', '一'), - (0x2F01, 'M', '丨'), - (0x2F02, 'M', '丶'), - (0x2F03, 'M', '丿'), - (0x2F04, 'M', '乙'), - (0x2F05, 'M', '亅'), - (0x2F06, 'M', '二'), - (0x2F07, 'M', '亠'), - (0x2F08, 'M', '人'), - (0x2F09, 'M', '儿'), - (0x2F0A, 'M', '入'), - (0x2F0B, 'M', '八'), - (0x2F0C, 'M', '冂'), - (0x2F0D, 'M', '冖'), - (0x2F0E, 'M', '冫'), - (0x2F0F, 'M', '几'), - (0x2F10, 'M', '凵'), - (0x2F11, 'M', '刀'), - (0x2F12, 'M', '力'), - (0x2F13, 'M', '勹'), - (0x2F14, 'M', '匕'), - (0x2F15, 'M', '匚'), - ] - -def _seg_27() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F16, 'M', '匸'), - (0x2F17, 'M', '十'), - (0x2F18, 'M', '卜'), - (0x2F19, 'M', '卩'), - (0x2F1A, 'M', '厂'), - (0x2F1B, 'M', '厶'), - (0x2F1C, 'M', '又'), - (0x2F1D, 'M', '口'), - (0x2F1E, 'M', '囗'), - (0x2F1F, 'M', '土'), - (0x2F20, 'M', '士'), - (0x2F21, 'M', '夂'), - (0x2F22, 'M', '夊'), - (0x2F23, 'M', '夕'), - (0x2F24, 'M', '大'), - (0x2F25, 'M', '女'), - (0x2F26, 'M', '子'), - (0x2F27, 'M', '宀'), - (0x2F28, 'M', '寸'), - (0x2F29, 'M', '小'), - (0x2F2A, 'M', '尢'), - (0x2F2B, 'M', '尸'), - (0x2F2C, 'M', '屮'), - (0x2F2D, 'M', '山'), - (0x2F2E, 'M', '巛'), - (0x2F2F, 'M', '工'), - (0x2F30, 'M', '己'), - (0x2F31, 'M', '巾'), - (0x2F32, 'M', '干'), - (0x2F33, 'M', '幺'), - (0x2F34, 'M', '广'), - (0x2F35, 'M', '廴'), - (0x2F36, 'M', '廾'), - (0x2F37, 'M', '弋'), - (0x2F38, 'M', '弓'), - (0x2F39, 'M', '彐'), - (0x2F3A, 'M', '彡'), - (0x2F3B, 'M', '彳'), - (0x2F3C, 'M', '心'), - (0x2F3D, 'M', '戈'), - (0x2F3E, 'M', '戶'), - (0x2F3F, 'M', '手'), - (0x2F40, 'M', '支'), - (0x2F41, 'M', '攴'), - (0x2F42, 'M', '文'), - (0x2F43, 'M', '斗'), - (0x2F44, 'M', '斤'), - (0x2F45, 'M', '方'), - (0x2F46, 'M', '无'), - (0x2F47, 'M', '日'), - (0x2F48, 'M', '曰'), - (0x2F49, 'M', '月'), - (0x2F4A, 'M', '木'), - (0x2F4B, 'M', '欠'), - (0x2F4C, 'M', '止'), - (0x2F4D, 'M', '歹'), - (0x2F4E, 'M', '殳'), - (0x2F4F, 'M', '毋'), - (0x2F50, 'M', '比'), - (0x2F51, 'M', '毛'), - (0x2F52, 'M', '氏'), - (0x2F53, 'M', '气'), - (0x2F54, 'M', '水'), - (0x2F55, 'M', '火'), - (0x2F56, 'M', '爪'), - (0x2F57, 'M', '父'), - (0x2F58, 'M', '爻'), - (0x2F59, 'M', '爿'), - (0x2F5A, 'M', '片'), - (0x2F5B, 'M', '牙'), - (0x2F5C, 'M', '牛'), - (0x2F5D, 'M', '犬'), - (0x2F5E, 'M', '玄'), - (0x2F5F, 'M', '玉'), - (0x2F60, 'M', '瓜'), - (0x2F61, 'M', '瓦'), - (0x2F62, 'M', '甘'), - (0x2F63, 'M', '生'), - (0x2F64, 'M', '用'), - (0x2F65, 'M', '田'), - (0x2F66, 'M', '疋'), - (0x2F67, 'M', '疒'), - (0x2F68, 'M', '癶'), - (0x2F69, 'M', '白'), - (0x2F6A, 'M', '皮'), - (0x2F6B, 'M', '皿'), - (0x2F6C, 'M', '目'), - (0x2F6D, 'M', '矛'), - (0x2F6E, 'M', '矢'), - (0x2F6F, 'M', '石'), - (0x2F70, 'M', '示'), - (0x2F71, 'M', '禸'), - (0x2F72, 'M', '禾'), - (0x2F73, 'M', '穴'), - (0x2F74, 'M', '立'), - (0x2F75, 'M', '竹'), - (0x2F76, 'M', '米'), - (0x2F77, 'M', '糸'), - (0x2F78, 'M', '缶'), - (0x2F79, 'M', '网'), - ] - -def _seg_28() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F7A, 'M', '羊'), - (0x2F7B, 'M', '羽'), - (0x2F7C, 'M', '老'), - (0x2F7D, 'M', '而'), - (0x2F7E, 'M', '耒'), - (0x2F7F, 'M', '耳'), - (0x2F80, 'M', '聿'), - (0x2F81, 'M', '肉'), - (0x2F82, 'M', '臣'), - (0x2F83, 'M', '自'), - (0x2F84, 'M', '至'), - (0x2F85, 'M', '臼'), - (0x2F86, 'M', '舌'), - (0x2F87, 'M', '舛'), - (0x2F88, 'M', '舟'), - (0x2F89, 'M', '艮'), - (0x2F8A, 'M', '色'), - (0x2F8B, 'M', '艸'), - (0x2F8C, 'M', '虍'), - (0x2F8D, 'M', '虫'), - (0x2F8E, 'M', '血'), - (0x2F8F, 'M', '行'), - (0x2F90, 'M', '衣'), - (0x2F91, 'M', '襾'), - (0x2F92, 'M', '見'), - (0x2F93, 'M', '角'), - (0x2F94, 'M', '言'), - (0x2F95, 'M', '谷'), - (0x2F96, 'M', '豆'), - (0x2F97, 'M', '豕'), - (0x2F98, 'M', '豸'), - (0x2F99, 'M', '貝'), - (0x2F9A, 'M', '赤'), - (0x2F9B, 'M', '走'), - (0x2F9C, 'M', '足'), - (0x2F9D, 'M', '身'), - (0x2F9E, 'M', '車'), - (0x2F9F, 'M', '辛'), - (0x2FA0, 'M', '辰'), - (0x2FA1, 'M', '辵'), - (0x2FA2, 'M', '邑'), - (0x2FA3, 'M', '酉'), - (0x2FA4, 'M', '釆'), - (0x2FA5, 'M', '里'), - (0x2FA6, 'M', '金'), - (0x2FA7, 'M', '長'), - (0x2FA8, 'M', '門'), - (0x2FA9, 'M', '阜'), - (0x2FAA, 'M', '隶'), - (0x2FAB, 'M', '隹'), - (0x2FAC, 'M', '雨'), - (0x2FAD, 'M', '靑'), - (0x2FAE, 'M', '非'), - (0x2FAF, 'M', '面'), - (0x2FB0, 'M', '革'), - (0x2FB1, 'M', '韋'), - (0x2FB2, 'M', '韭'), - (0x2FB3, 'M', '音'), - (0x2FB4, 'M', '頁'), - (0x2FB5, 'M', '風'), - (0x2FB6, 'M', '飛'), - (0x2FB7, 'M', '食'), - (0x2FB8, 'M', '首'), - (0x2FB9, 'M', '香'), - (0x2FBA, 'M', '馬'), - (0x2FBB, 'M', '骨'), - (0x2FBC, 'M', '高'), - (0x2FBD, 'M', '髟'), - (0x2FBE, 'M', '鬥'), - (0x2FBF, 'M', '鬯'), - (0x2FC0, 'M', '鬲'), - (0x2FC1, 'M', '鬼'), - (0x2FC2, 'M', '魚'), - (0x2FC3, 'M', '鳥'), - (0x2FC4, 'M', '鹵'), - (0x2FC5, 'M', '鹿'), - (0x2FC6, 'M', '麥'), - (0x2FC7, 'M', '麻'), - (0x2FC8, 'M', '黃'), - (0x2FC9, 'M', '黍'), - (0x2FCA, 'M', '黑'), - (0x2FCB, 'M', '黹'), - (0x2FCC, 'M', '黽'), - (0x2FCD, 'M', '鼎'), - (0x2FCE, 'M', '鼓'), - (0x2FCF, 'M', '鼠'), - (0x2FD0, 'M', '鼻'), - (0x2FD1, 'M', '齊'), - (0x2FD2, 'M', '齒'), - (0x2FD3, 'M', '龍'), - (0x2FD4, 'M', '龜'), - (0x2FD5, 'M', '龠'), - (0x2FD6, 'X'), - (0x3000, '3', ' '), - (0x3001, 'V'), - (0x3002, 'M', '.'), - (0x3003, 'V'), - (0x3036, 'M', '〒'), - (0x3037, 'V'), - (0x3038, 'M', '十'), - ] - -def _seg_29() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3039, 'M', '卄'), - (0x303A, 'M', '卅'), - (0x303B, 'V'), - (0x3040, 'X'), - (0x3041, 'V'), - (0x3097, 'X'), - (0x3099, 'V'), - (0x309B, '3', ' ゙'), - (0x309C, '3', ' ゚'), - (0x309D, 'V'), - (0x309F, 'M', 'より'), - (0x30A0, 'V'), - (0x30FF, 'M', 'コト'), - (0x3100, 'X'), - (0x3105, 'V'), - (0x3130, 'X'), - (0x3131, 'M', 'ᄀ'), - (0x3132, 'M', 'ᄁ'), - (0x3133, 'M', 'ᆪ'), - (0x3134, 'M', 'ᄂ'), - (0x3135, 'M', 'ᆬ'), - (0x3136, 'M', 'ᆭ'), - (0x3137, 'M', 'ᄃ'), - (0x3138, 'M', 'ᄄ'), - (0x3139, 'M', 'ᄅ'), - (0x313A, 'M', 'ᆰ'), - (0x313B, 'M', 'ᆱ'), - (0x313C, 'M', 'ᆲ'), - (0x313D, 'M', 'ᆳ'), - (0x313E, 'M', 'ᆴ'), - (0x313F, 'M', 'ᆵ'), - (0x3140, 'M', 'ᄚ'), - (0x3141, 'M', 'ᄆ'), - (0x3142, 'M', 'ᄇ'), - (0x3143, 'M', 'ᄈ'), - (0x3144, 'M', 'ᄡ'), - (0x3145, 'M', 'ᄉ'), - (0x3146, 'M', 'ᄊ'), - (0x3147, 'M', 'ᄋ'), - (0x3148, 'M', 'ᄌ'), - (0x3149, 'M', 'ᄍ'), - (0x314A, 'M', 'ᄎ'), - (0x314B, 'M', 'ᄏ'), - (0x314C, 'M', 'ᄐ'), - (0x314D, 'M', 'ᄑ'), - (0x314E, 'M', 'ᄒ'), - (0x314F, 'M', 'ᅡ'), - (0x3150, 'M', 'ᅢ'), - (0x3151, 'M', 'ᅣ'), - (0x3152, 'M', 'ᅤ'), - (0x3153, 'M', 'ᅥ'), - (0x3154, 'M', 'ᅦ'), - (0x3155, 'M', 'ᅧ'), - (0x3156, 'M', 'ᅨ'), - (0x3157, 'M', 'ᅩ'), - (0x3158, 'M', 'ᅪ'), - (0x3159, 'M', 'ᅫ'), - (0x315A, 'M', 'ᅬ'), - (0x315B, 'M', 'ᅭ'), - (0x315C, 'M', 'ᅮ'), - (0x315D, 'M', 'ᅯ'), - (0x315E, 'M', 'ᅰ'), - (0x315F, 'M', 'ᅱ'), - (0x3160, 'M', 'ᅲ'), - (0x3161, 'M', 'ᅳ'), - (0x3162, 'M', 'ᅴ'), - (0x3163, 'M', 'ᅵ'), - (0x3164, 'X'), - (0x3165, 'M', 'ᄔ'), - (0x3166, 'M', 'ᄕ'), - (0x3167, 'M', 'ᇇ'), - (0x3168, 'M', 'ᇈ'), - (0x3169, 'M', 'ᇌ'), - (0x316A, 'M', 'ᇎ'), - (0x316B, 'M', 'ᇓ'), - (0x316C, 'M', 'ᇗ'), - (0x316D, 'M', 'ᇙ'), - (0x316E, 'M', 'ᄜ'), - (0x316F, 'M', 'ᇝ'), - (0x3170, 'M', 'ᇟ'), - (0x3171, 'M', 'ᄝ'), - (0x3172, 'M', 'ᄞ'), - (0x3173, 'M', 'ᄠ'), - (0x3174, 'M', 'ᄢ'), - (0x3175, 'M', 'ᄣ'), - (0x3176, 'M', 'ᄧ'), - (0x3177, 'M', 'ᄩ'), - (0x3178, 'M', 'ᄫ'), - (0x3179, 'M', 'ᄬ'), - (0x317A, 'M', 'ᄭ'), - (0x317B, 'M', 'ᄮ'), - (0x317C, 'M', 'ᄯ'), - (0x317D, 'M', 'ᄲ'), - (0x317E, 'M', 'ᄶ'), - (0x317F, 'M', 'ᅀ'), - (0x3180, 'M', 'ᅇ'), - (0x3181, 'M', 'ᅌ'), - (0x3182, 'M', 'ᇱ'), - (0x3183, 'M', 'ᇲ'), - (0x3184, 'M', 'ᅗ'), - ] - -def _seg_30() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3185, 'M', 'ᅘ'), - (0x3186, 'M', 'ᅙ'), - (0x3187, 'M', 'ᆄ'), - (0x3188, 'M', 'ᆅ'), - (0x3189, 'M', 'ᆈ'), - (0x318A, 'M', 'ᆑ'), - (0x318B, 'M', 'ᆒ'), - (0x318C, 'M', 'ᆔ'), - (0x318D, 'M', 'ᆞ'), - (0x318E, 'M', 'ᆡ'), - (0x318F, 'X'), - (0x3190, 'V'), - (0x3192, 'M', '一'), - (0x3193, 'M', '二'), - (0x3194, 'M', '三'), - (0x3195, 'M', '四'), - (0x3196, 'M', '上'), - (0x3197, 'M', '中'), - (0x3198, 'M', '下'), - (0x3199, 'M', '甲'), - (0x319A, 'M', '乙'), - (0x319B, 'M', '丙'), - (0x319C, 'M', '丁'), - (0x319D, 'M', '天'), - (0x319E, 'M', '地'), - (0x319F, 'M', '人'), - (0x31A0, 'V'), - (0x31E4, 'X'), - (0x31F0, 'V'), - (0x3200, '3', '(ᄀ)'), - (0x3201, '3', '(ᄂ)'), - (0x3202, '3', '(ᄃ)'), - (0x3203, '3', '(ᄅ)'), - (0x3204, '3', '(ᄆ)'), - (0x3205, '3', '(ᄇ)'), - (0x3206, '3', '(ᄉ)'), - (0x3207, '3', '(ᄋ)'), - (0x3208, '3', '(ᄌ)'), - (0x3209, '3', '(ᄎ)'), - (0x320A, '3', '(ᄏ)'), - (0x320B, '3', '(ᄐ)'), - (0x320C, '3', '(ᄑ)'), - (0x320D, '3', '(ᄒ)'), - (0x320E, '3', '(가)'), - (0x320F, '3', '(나)'), - (0x3210, '3', '(다)'), - (0x3211, '3', '(라)'), - (0x3212, '3', '(마)'), - (0x3213, '3', '(바)'), - (0x3214, '3', '(사)'), - (0x3215, '3', '(아)'), - (0x3216, '3', '(자)'), - (0x3217, '3', '(차)'), - (0x3218, '3', '(카)'), - (0x3219, '3', '(타)'), - (0x321A, '3', '(파)'), - (0x321B, '3', '(하)'), - (0x321C, '3', '(주)'), - (0x321D, '3', '(오전)'), - (0x321E, '3', '(오후)'), - (0x321F, 'X'), - (0x3220, '3', '(一)'), - (0x3221, '3', '(二)'), - (0x3222, '3', '(三)'), - (0x3223, '3', '(四)'), - (0x3224, '3', '(五)'), - (0x3225, '3', '(六)'), - (0x3226, '3', '(七)'), - (0x3227, '3', '(八)'), - (0x3228, '3', '(九)'), - (0x3229, '3', '(十)'), - (0x322A, '3', '(月)'), - (0x322B, '3', '(火)'), - (0x322C, '3', '(水)'), - (0x322D, '3', '(木)'), - (0x322E, '3', '(金)'), - (0x322F, '3', '(土)'), - (0x3230, '3', '(日)'), - (0x3231, '3', '(株)'), - (0x3232, '3', '(有)'), - (0x3233, '3', '(社)'), - (0x3234, '3', '(名)'), - (0x3235, '3', '(特)'), - (0x3236, '3', '(財)'), - (0x3237, '3', '(祝)'), - (0x3238, '3', '(労)'), - (0x3239, '3', '(代)'), - (0x323A, '3', '(呼)'), - (0x323B, '3', '(学)'), - (0x323C, '3', '(監)'), - (0x323D, '3', '(企)'), - (0x323E, '3', '(資)'), - (0x323F, '3', '(協)'), - (0x3240, '3', '(祭)'), - (0x3241, '3', '(休)'), - (0x3242, '3', '(自)'), - (0x3243, '3', '(至)'), - (0x3244, 'M', '問'), - (0x3245, 'M', '幼'), - (0x3246, 'M', '文'), - ] - -def _seg_31() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3247, 'M', '箏'), - (0x3248, 'V'), - (0x3250, 'M', 'pte'), - (0x3251, 'M', '21'), - (0x3252, 'M', '22'), - (0x3253, 'M', '23'), - (0x3254, 'M', '24'), - (0x3255, 'M', '25'), - (0x3256, 'M', '26'), - (0x3257, 'M', '27'), - (0x3258, 'M', '28'), - (0x3259, 'M', '29'), - (0x325A, 'M', '30'), - (0x325B, 'M', '31'), - (0x325C, 'M', '32'), - (0x325D, 'M', '33'), - (0x325E, 'M', '34'), - (0x325F, 'M', '35'), - (0x3260, 'M', 'ᄀ'), - (0x3261, 'M', 'ᄂ'), - (0x3262, 'M', 'ᄃ'), - (0x3263, 'M', 'ᄅ'), - (0x3264, 'M', 'ᄆ'), - (0x3265, 'M', 'ᄇ'), - (0x3266, 'M', 'ᄉ'), - (0x3267, 'M', 'ᄋ'), - (0x3268, 'M', 'ᄌ'), - (0x3269, 'M', 'ᄎ'), - (0x326A, 'M', 'ᄏ'), - (0x326B, 'M', 'ᄐ'), - (0x326C, 'M', 'ᄑ'), - (0x326D, 'M', 'ᄒ'), - (0x326E, 'M', '가'), - (0x326F, 'M', '나'), - (0x3270, 'M', '다'), - (0x3271, 'M', '라'), - (0x3272, 'M', '마'), - (0x3273, 'M', '바'), - (0x3274, 'M', '사'), - (0x3275, 'M', '아'), - (0x3276, 'M', '자'), - (0x3277, 'M', '차'), - (0x3278, 'M', '카'), - (0x3279, 'M', '타'), - (0x327A, 'M', '파'), - (0x327B, 'M', '하'), - (0x327C, 'M', '참고'), - (0x327D, 'M', '주의'), - (0x327E, 'M', '우'), - (0x327F, 'V'), - (0x3280, 'M', '一'), - (0x3281, 'M', '二'), - (0x3282, 'M', '三'), - (0x3283, 'M', '四'), - (0x3284, 'M', '五'), - (0x3285, 'M', '六'), - (0x3286, 'M', '七'), - (0x3287, 'M', '八'), - (0x3288, 'M', '九'), - (0x3289, 'M', '十'), - (0x328A, 'M', '月'), - (0x328B, 'M', '火'), - (0x328C, 'M', '水'), - (0x328D, 'M', '木'), - (0x328E, 'M', '金'), - (0x328F, 'M', '土'), - (0x3290, 'M', '日'), - (0x3291, 'M', '株'), - (0x3292, 'M', '有'), - (0x3293, 'M', '社'), - (0x3294, 'M', '名'), - (0x3295, 'M', '特'), - (0x3296, 'M', '財'), - (0x3297, 'M', '祝'), - (0x3298, 'M', '労'), - (0x3299, 'M', '秘'), - (0x329A, 'M', '男'), - (0x329B, 'M', '女'), - (0x329C, 'M', '適'), - (0x329D, 'M', '優'), - (0x329E, 'M', '印'), - (0x329F, 'M', '注'), - (0x32A0, 'M', '項'), - (0x32A1, 'M', '休'), - (0x32A2, 'M', '写'), - (0x32A3, 'M', '正'), - (0x32A4, 'M', '上'), - (0x32A5, 'M', '中'), - (0x32A6, 'M', '下'), - (0x32A7, 'M', '左'), - (0x32A8, 'M', '右'), - (0x32A9, 'M', '医'), - (0x32AA, 'M', '宗'), - (0x32AB, 'M', '学'), - (0x32AC, 'M', '監'), - (0x32AD, 'M', '企'), - (0x32AE, 'M', '資'), - (0x32AF, 'M', '協'), - (0x32B0, 'M', '夜'), - (0x32B1, 'M', '36'), - ] - -def _seg_32() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x32B2, 'M', '37'), - (0x32B3, 'M', '38'), - (0x32B4, 'M', '39'), - (0x32B5, 'M', '40'), - (0x32B6, 'M', '41'), - (0x32B7, 'M', '42'), - (0x32B8, 'M', '43'), - (0x32B9, 'M', '44'), - (0x32BA, 'M', '45'), - (0x32BB, 'M', '46'), - (0x32BC, 'M', '47'), - (0x32BD, 'M', '48'), - (0x32BE, 'M', '49'), - (0x32BF, 'M', '50'), - (0x32C0, 'M', '1月'), - (0x32C1, 'M', '2月'), - (0x32C2, 'M', '3月'), - (0x32C3, 'M', '4月'), - (0x32C4, 'M', '5月'), - (0x32C5, 'M', '6月'), - (0x32C6, 'M', '7月'), - (0x32C7, 'M', '8月'), - (0x32C8, 'M', '9月'), - (0x32C9, 'M', '10月'), - (0x32CA, 'M', '11月'), - (0x32CB, 'M', '12月'), - (0x32CC, 'M', 'hg'), - (0x32CD, 'M', 'erg'), - (0x32CE, 'M', 'ev'), - (0x32CF, 'M', 'ltd'), - (0x32D0, 'M', 'ア'), - (0x32D1, 'M', 'イ'), - (0x32D2, 'M', 'ウ'), - (0x32D3, 'M', 'エ'), - (0x32D4, 'M', 'オ'), - (0x32D5, 'M', 'カ'), - (0x32D6, 'M', 'キ'), - (0x32D7, 'M', 'ク'), - (0x32D8, 'M', 'ケ'), - (0x32D9, 'M', 'コ'), - (0x32DA, 'M', 'サ'), - (0x32DB, 'M', 'シ'), - (0x32DC, 'M', 'ス'), - (0x32DD, 'M', 'セ'), - (0x32DE, 'M', 'ソ'), - (0x32DF, 'M', 'タ'), - (0x32E0, 'M', 'チ'), - (0x32E1, 'M', 'ツ'), - (0x32E2, 'M', 'テ'), - (0x32E3, 'M', 'ト'), - (0x32E4, 'M', 'ナ'), - (0x32E5, 'M', 'ニ'), - (0x32E6, 'M', 'ヌ'), - (0x32E7, 'M', 'ネ'), - (0x32E8, 'M', 'ノ'), - (0x32E9, 'M', 'ハ'), - (0x32EA, 'M', 'ヒ'), - (0x32EB, 'M', 'フ'), - (0x32EC, 'M', 'ヘ'), - (0x32ED, 'M', 'ホ'), - (0x32EE, 'M', 'マ'), - (0x32EF, 'M', 'ミ'), - (0x32F0, 'M', 'ム'), - (0x32F1, 'M', 'メ'), - (0x32F2, 'M', 'モ'), - (0x32F3, 'M', 'ヤ'), - (0x32F4, 'M', 'ユ'), - (0x32F5, 'M', 'ヨ'), - (0x32F6, 'M', 'ラ'), - (0x32F7, 'M', 'リ'), - (0x32F8, 'M', 'ル'), - (0x32F9, 'M', 'レ'), - (0x32FA, 'M', 'ロ'), - (0x32FB, 'M', 'ワ'), - (0x32FC, 'M', 'ヰ'), - (0x32FD, 'M', 'ヱ'), - (0x32FE, 'M', 'ヲ'), - (0x32FF, 'M', '令和'), - (0x3300, 'M', 'アパート'), - (0x3301, 'M', 'アルファ'), - (0x3302, 'M', 'アンペア'), - (0x3303, 'M', 'アール'), - (0x3304, 'M', 'イニング'), - (0x3305, 'M', 'インチ'), - (0x3306, 'M', 'ウォン'), - (0x3307, 'M', 'エスクード'), - (0x3308, 'M', 'エーカー'), - (0x3309, 'M', 'オンス'), - (0x330A, 'M', 'オーム'), - (0x330B, 'M', 'カイリ'), - (0x330C, 'M', 'カラット'), - (0x330D, 'M', 'カロリー'), - (0x330E, 'M', 'ガロン'), - (0x330F, 'M', 'ガンマ'), - (0x3310, 'M', 'ギガ'), - (0x3311, 'M', 'ギニー'), - (0x3312, 'M', 'キュリー'), - (0x3313, 'M', 'ギルダー'), - (0x3314, 'M', 'キロ'), - (0x3315, 'M', 'キログラム'), - ] - -def _seg_33() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3316, 'M', 'キロメートル'), - (0x3317, 'M', 'キロワット'), - (0x3318, 'M', 'グラム'), - (0x3319, 'M', 'グラムトン'), - (0x331A, 'M', 'クルゼイロ'), - (0x331B, 'M', 'クローネ'), - (0x331C, 'M', 'ケース'), - (0x331D, 'M', 'コルナ'), - (0x331E, 'M', 'コーポ'), - (0x331F, 'M', 'サイクル'), - (0x3320, 'M', 'サンチーム'), - (0x3321, 'M', 'シリング'), - (0x3322, 'M', 'センチ'), - (0x3323, 'M', 'セント'), - (0x3324, 'M', 'ダース'), - (0x3325, 'M', 'デシ'), - (0x3326, 'M', 'ドル'), - (0x3327, 'M', 'トン'), - (0x3328, 'M', 'ナノ'), - (0x3329, 'M', 'ノット'), - (0x332A, 'M', 'ハイツ'), - (0x332B, 'M', 'パーセント'), - (0x332C, 'M', 'パーツ'), - (0x332D, 'M', 'バーレル'), - (0x332E, 'M', 'ピアストル'), - (0x332F, 'M', 'ピクル'), - (0x3330, 'M', 'ピコ'), - (0x3331, 'M', 'ビル'), - (0x3332, 'M', 'ファラッド'), - (0x3333, 'M', 'フィート'), - (0x3334, 'M', 'ブッシェル'), - (0x3335, 'M', 'フラン'), - (0x3336, 'M', 'ヘクタール'), - (0x3337, 'M', 'ペソ'), - (0x3338, 'M', 'ペニヒ'), - (0x3339, 'M', 'ヘルツ'), - (0x333A, 'M', 'ペンス'), - (0x333B, 'M', 'ページ'), - (0x333C, 'M', 'ベータ'), - (0x333D, 'M', 'ポイント'), - (0x333E, 'M', 'ボルト'), - (0x333F, 'M', 'ホン'), - (0x3340, 'M', 'ポンド'), - (0x3341, 'M', 'ホール'), - (0x3342, 'M', 'ホーン'), - (0x3343, 'M', 'マイクロ'), - (0x3344, 'M', 'マイル'), - (0x3345, 'M', 'マッハ'), - (0x3346, 'M', 'マルク'), - (0x3347, 'M', 'マンション'), - (0x3348, 'M', 'ミクロン'), - (0x3349, 'M', 'ミリ'), - (0x334A, 'M', 'ミリバール'), - (0x334B, 'M', 'メガ'), - (0x334C, 'M', 'メガトン'), - (0x334D, 'M', 'メートル'), - (0x334E, 'M', 'ヤード'), - (0x334F, 'M', 'ヤール'), - (0x3350, 'M', 'ユアン'), - (0x3351, 'M', 'リットル'), - (0x3352, 'M', 'リラ'), - (0x3353, 'M', 'ルピー'), - (0x3354, 'M', 'ルーブル'), - (0x3355, 'M', 'レム'), - (0x3356, 'M', 'レントゲン'), - (0x3357, 'M', 'ワット'), - (0x3358, 'M', '0点'), - (0x3359, 'M', '1点'), - (0x335A, 'M', '2点'), - (0x335B, 'M', '3点'), - (0x335C, 'M', '4点'), - (0x335D, 'M', '5点'), - (0x335E, 'M', '6点'), - (0x335F, 'M', '7点'), - (0x3360, 'M', '8点'), - (0x3361, 'M', '9点'), - (0x3362, 'M', '10点'), - (0x3363, 'M', '11点'), - (0x3364, 'M', '12点'), - (0x3365, 'M', '13点'), - (0x3366, 'M', '14点'), - (0x3367, 'M', '15点'), - (0x3368, 'M', '16点'), - (0x3369, 'M', '17点'), - (0x336A, 'M', '18点'), - (0x336B, 'M', '19点'), - (0x336C, 'M', '20点'), - (0x336D, 'M', '21点'), - (0x336E, 'M', '22点'), - (0x336F, 'M', '23点'), - (0x3370, 'M', '24点'), - (0x3371, 'M', 'hpa'), - (0x3372, 'M', 'da'), - (0x3373, 'M', 'au'), - (0x3374, 'M', 'bar'), - (0x3375, 'M', 'ov'), - (0x3376, 'M', 'pc'), - (0x3377, 'M', 'dm'), - (0x3378, 'M', 'dm2'), - (0x3379, 'M', 'dm3'), - ] - -def _seg_34() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x337A, 'M', 'iu'), - (0x337B, 'M', '平成'), - (0x337C, 'M', '昭和'), - (0x337D, 'M', '大正'), - (0x337E, 'M', '明治'), - (0x337F, 'M', '株式会社'), - (0x3380, 'M', 'pa'), - (0x3381, 'M', 'na'), - (0x3382, 'M', 'μa'), - (0x3383, 'M', 'ma'), - (0x3384, 'M', 'ka'), - (0x3385, 'M', 'kb'), - (0x3386, 'M', 'mb'), - (0x3387, 'M', 'gb'), - (0x3388, 'M', 'cal'), - (0x3389, 'M', 'kcal'), - (0x338A, 'M', 'pf'), - (0x338B, 'M', 'nf'), - (0x338C, 'M', 'μf'), - (0x338D, 'M', 'μg'), - (0x338E, 'M', 'mg'), - (0x338F, 'M', 'kg'), - (0x3390, 'M', 'hz'), - (0x3391, 'M', 'khz'), - (0x3392, 'M', 'mhz'), - (0x3393, 'M', 'ghz'), - (0x3394, 'M', 'thz'), - (0x3395, 'M', 'μl'), - (0x3396, 'M', 'ml'), - (0x3397, 'M', 'dl'), - (0x3398, 'M', 'kl'), - (0x3399, 'M', 'fm'), - (0x339A, 'M', 'nm'), - (0x339B, 'M', 'μm'), - (0x339C, 'M', 'mm'), - (0x339D, 'M', 'cm'), - (0x339E, 'M', 'km'), - (0x339F, 'M', 'mm2'), - (0x33A0, 'M', 'cm2'), - (0x33A1, 'M', 'm2'), - (0x33A2, 'M', 'km2'), - (0x33A3, 'M', 'mm3'), - (0x33A4, 'M', 'cm3'), - (0x33A5, 'M', 'm3'), - (0x33A6, 'M', 'km3'), - (0x33A7, 'M', 'm∕s'), - (0x33A8, 'M', 'm∕s2'), - (0x33A9, 'M', 'pa'), - (0x33AA, 'M', 'kpa'), - (0x33AB, 'M', 'mpa'), - (0x33AC, 'M', 'gpa'), - (0x33AD, 'M', 'rad'), - (0x33AE, 'M', 'rad∕s'), - (0x33AF, 'M', 'rad∕s2'), - (0x33B0, 'M', 'ps'), - (0x33B1, 'M', 'ns'), - (0x33B2, 'M', 'μs'), - (0x33B3, 'M', 'ms'), - (0x33B4, 'M', 'pv'), - (0x33B5, 'M', 'nv'), - (0x33B6, 'M', 'μv'), - (0x33B7, 'M', 'mv'), - (0x33B8, 'M', 'kv'), - (0x33B9, 'M', 'mv'), - (0x33BA, 'M', 'pw'), - (0x33BB, 'M', 'nw'), - (0x33BC, 'M', 'μw'), - (0x33BD, 'M', 'mw'), - (0x33BE, 'M', 'kw'), - (0x33BF, 'M', 'mw'), - (0x33C0, 'M', 'kω'), - (0x33C1, 'M', 'mω'), - (0x33C2, 'X'), - (0x33C3, 'M', 'bq'), - (0x33C4, 'M', 'cc'), - (0x33C5, 'M', 'cd'), - (0x33C6, 'M', 'c∕kg'), - (0x33C7, 'X'), - (0x33C8, 'M', 'db'), - (0x33C9, 'M', 'gy'), - (0x33CA, 'M', 'ha'), - (0x33CB, 'M', 'hp'), - (0x33CC, 'M', 'in'), - (0x33CD, 'M', 'kk'), - (0x33CE, 'M', 'km'), - (0x33CF, 'M', 'kt'), - (0x33D0, 'M', 'lm'), - (0x33D1, 'M', 'ln'), - (0x33D2, 'M', 'log'), - (0x33D3, 'M', 'lx'), - (0x33D4, 'M', 'mb'), - (0x33D5, 'M', 'mil'), - (0x33D6, 'M', 'mol'), - (0x33D7, 'M', 'ph'), - (0x33D8, 'X'), - (0x33D9, 'M', 'ppm'), - (0x33DA, 'M', 'pr'), - (0x33DB, 'M', 'sr'), - (0x33DC, 'M', 'sv'), - (0x33DD, 'M', 'wb'), - ] - -def _seg_35() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x33DE, 'M', 'v∕m'), - (0x33DF, 'M', 'a∕m'), - (0x33E0, 'M', '1日'), - (0x33E1, 'M', '2日'), - (0x33E2, 'M', '3日'), - (0x33E3, 'M', '4日'), - (0x33E4, 'M', '5日'), - (0x33E5, 'M', '6日'), - (0x33E6, 'M', '7日'), - (0x33E7, 'M', '8日'), - (0x33E8, 'M', '9日'), - (0x33E9, 'M', '10日'), - (0x33EA, 'M', '11日'), - (0x33EB, 'M', '12日'), - (0x33EC, 'M', '13日'), - (0x33ED, 'M', '14日'), - (0x33EE, 'M', '15日'), - (0x33EF, 'M', '16日'), - (0x33F0, 'M', '17日'), - (0x33F1, 'M', '18日'), - (0x33F2, 'M', '19日'), - (0x33F3, 'M', '20日'), - (0x33F4, 'M', '21日'), - (0x33F5, 'M', '22日'), - (0x33F6, 'M', '23日'), - (0x33F7, 'M', '24日'), - (0x33F8, 'M', '25日'), - (0x33F9, 'M', '26日'), - (0x33FA, 'M', '27日'), - (0x33FB, 'M', '28日'), - (0x33FC, 'M', '29日'), - (0x33FD, 'M', '30日'), - (0x33FE, 'M', '31日'), - (0x33FF, 'M', 'gal'), - (0x3400, 'V'), - (0xA48D, 'X'), - (0xA490, 'V'), - (0xA4C7, 'X'), - (0xA4D0, 'V'), - (0xA62C, 'X'), - (0xA640, 'M', 'ꙁ'), - (0xA641, 'V'), - (0xA642, 'M', 'ꙃ'), - (0xA643, 'V'), - (0xA644, 'M', 'ꙅ'), - (0xA645, 'V'), - (0xA646, 'M', 'ꙇ'), - (0xA647, 'V'), - (0xA648, 'M', 'ꙉ'), - (0xA649, 'V'), - (0xA64A, 'M', 'ꙋ'), - (0xA64B, 'V'), - (0xA64C, 'M', 'ꙍ'), - (0xA64D, 'V'), - (0xA64E, 'M', 'ꙏ'), - (0xA64F, 'V'), - (0xA650, 'M', 'ꙑ'), - (0xA651, 'V'), - (0xA652, 'M', 'ꙓ'), - (0xA653, 'V'), - (0xA654, 'M', 'ꙕ'), - (0xA655, 'V'), - (0xA656, 'M', 'ꙗ'), - (0xA657, 'V'), - (0xA658, 'M', 'ꙙ'), - (0xA659, 'V'), - (0xA65A, 'M', 'ꙛ'), - (0xA65B, 'V'), - (0xA65C, 'M', 'ꙝ'), - (0xA65D, 'V'), - (0xA65E, 'M', 'ꙟ'), - (0xA65F, 'V'), - (0xA660, 'M', 'ꙡ'), - (0xA661, 'V'), - (0xA662, 'M', 'ꙣ'), - (0xA663, 'V'), - (0xA664, 'M', 'ꙥ'), - (0xA665, 'V'), - (0xA666, 'M', 'ꙧ'), - (0xA667, 'V'), - (0xA668, 'M', 'ꙩ'), - (0xA669, 'V'), - (0xA66A, 'M', 'ꙫ'), - (0xA66B, 'V'), - (0xA66C, 'M', 'ꙭ'), - (0xA66D, 'V'), - (0xA680, 'M', 'ꚁ'), - (0xA681, 'V'), - (0xA682, 'M', 'ꚃ'), - (0xA683, 'V'), - (0xA684, 'M', 'ꚅ'), - (0xA685, 'V'), - (0xA686, 'M', 'ꚇ'), - (0xA687, 'V'), - (0xA688, 'M', 'ꚉ'), - (0xA689, 'V'), - (0xA68A, 'M', 'ꚋ'), - (0xA68B, 'V'), - (0xA68C, 'M', 'ꚍ'), - (0xA68D, 'V'), - ] - -def _seg_36() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA68E, 'M', 'ꚏ'), - (0xA68F, 'V'), - (0xA690, 'M', 'ꚑ'), - (0xA691, 'V'), - (0xA692, 'M', 'ꚓ'), - (0xA693, 'V'), - (0xA694, 'M', 'ꚕ'), - (0xA695, 'V'), - (0xA696, 'M', 'ꚗ'), - (0xA697, 'V'), - (0xA698, 'M', 'ꚙ'), - (0xA699, 'V'), - (0xA69A, 'M', 'ꚛ'), - (0xA69B, 'V'), - (0xA69C, 'M', 'ъ'), - (0xA69D, 'M', 'ь'), - (0xA69E, 'V'), - (0xA6F8, 'X'), - (0xA700, 'V'), - (0xA722, 'M', 'ꜣ'), - (0xA723, 'V'), - (0xA724, 'M', 'ꜥ'), - (0xA725, 'V'), - (0xA726, 'M', 'ꜧ'), - (0xA727, 'V'), - (0xA728, 'M', 'ꜩ'), - (0xA729, 'V'), - (0xA72A, 'M', 'ꜫ'), - (0xA72B, 'V'), - (0xA72C, 'M', 'ꜭ'), - (0xA72D, 'V'), - (0xA72E, 'M', 'ꜯ'), - (0xA72F, 'V'), - (0xA732, 'M', 'ꜳ'), - (0xA733, 'V'), - (0xA734, 'M', 'ꜵ'), - (0xA735, 'V'), - (0xA736, 'M', 'ꜷ'), - (0xA737, 'V'), - (0xA738, 'M', 'ꜹ'), - (0xA739, 'V'), - (0xA73A, 'M', 'ꜻ'), - (0xA73B, 'V'), - (0xA73C, 'M', 'ꜽ'), - (0xA73D, 'V'), - (0xA73E, 'M', 'ꜿ'), - (0xA73F, 'V'), - (0xA740, 'M', 'ꝁ'), - (0xA741, 'V'), - (0xA742, 'M', 'ꝃ'), - (0xA743, 'V'), - (0xA744, 'M', 'ꝅ'), - (0xA745, 'V'), - (0xA746, 'M', 'ꝇ'), - (0xA747, 'V'), - (0xA748, 'M', 'ꝉ'), - (0xA749, 'V'), - (0xA74A, 'M', 'ꝋ'), - (0xA74B, 'V'), - (0xA74C, 'M', 'ꝍ'), - (0xA74D, 'V'), - (0xA74E, 'M', 'ꝏ'), - (0xA74F, 'V'), - (0xA750, 'M', 'ꝑ'), - (0xA751, 'V'), - (0xA752, 'M', 'ꝓ'), - (0xA753, 'V'), - (0xA754, 'M', 'ꝕ'), - (0xA755, 'V'), - (0xA756, 'M', 'ꝗ'), - (0xA757, 'V'), - (0xA758, 'M', 'ꝙ'), - (0xA759, 'V'), - (0xA75A, 'M', 'ꝛ'), - (0xA75B, 'V'), - (0xA75C, 'M', 'ꝝ'), - (0xA75D, 'V'), - (0xA75E, 'M', 'ꝟ'), - (0xA75F, 'V'), - (0xA760, 'M', 'ꝡ'), - (0xA761, 'V'), - (0xA762, 'M', 'ꝣ'), - (0xA763, 'V'), - (0xA764, 'M', 'ꝥ'), - (0xA765, 'V'), - (0xA766, 'M', 'ꝧ'), - (0xA767, 'V'), - (0xA768, 'M', 'ꝩ'), - (0xA769, 'V'), - (0xA76A, 'M', 'ꝫ'), - (0xA76B, 'V'), - (0xA76C, 'M', 'ꝭ'), - (0xA76D, 'V'), - (0xA76E, 'M', 'ꝯ'), - (0xA76F, 'V'), - (0xA770, 'M', 'ꝯ'), - (0xA771, 'V'), - (0xA779, 'M', 'ꝺ'), - (0xA77A, 'V'), - (0xA77B, 'M', 'ꝼ'), - ] - -def _seg_37() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA77C, 'V'), - (0xA77D, 'M', 'ᵹ'), - (0xA77E, 'M', 'ꝿ'), - (0xA77F, 'V'), - (0xA780, 'M', 'ꞁ'), - (0xA781, 'V'), - (0xA782, 'M', 'ꞃ'), - (0xA783, 'V'), - (0xA784, 'M', 'ꞅ'), - (0xA785, 'V'), - (0xA786, 'M', 'ꞇ'), - (0xA787, 'V'), - (0xA78B, 'M', 'ꞌ'), - (0xA78C, 'V'), - (0xA78D, 'M', 'ɥ'), - (0xA78E, 'V'), - (0xA790, 'M', 'ꞑ'), - (0xA791, 'V'), - (0xA792, 'M', 'ꞓ'), - (0xA793, 'V'), - (0xA796, 'M', 'ꞗ'), - (0xA797, 'V'), - (0xA798, 'M', 'ꞙ'), - (0xA799, 'V'), - (0xA79A, 'M', 'ꞛ'), - (0xA79B, 'V'), - (0xA79C, 'M', 'ꞝ'), - (0xA79D, 'V'), - (0xA79E, 'M', 'ꞟ'), - (0xA79F, 'V'), - (0xA7A0, 'M', 'ꞡ'), - (0xA7A1, 'V'), - (0xA7A2, 'M', 'ꞣ'), - (0xA7A3, 'V'), - (0xA7A4, 'M', 'ꞥ'), - (0xA7A5, 'V'), - (0xA7A6, 'M', 'ꞧ'), - (0xA7A7, 'V'), - (0xA7A8, 'M', 'ꞩ'), - (0xA7A9, 'V'), - (0xA7AA, 'M', 'ɦ'), - (0xA7AB, 'M', 'ɜ'), - (0xA7AC, 'M', 'ɡ'), - (0xA7AD, 'M', 'ɬ'), - (0xA7AE, 'M', 'ɪ'), - (0xA7AF, 'V'), - (0xA7B0, 'M', 'ʞ'), - (0xA7B1, 'M', 'ʇ'), - (0xA7B2, 'M', 'ʝ'), - (0xA7B3, 'M', 'ꭓ'), - (0xA7B4, 'M', 'ꞵ'), - (0xA7B5, 'V'), - (0xA7B6, 'M', 'ꞷ'), - (0xA7B7, 'V'), - (0xA7B8, 'M', 'ꞹ'), - (0xA7B9, 'V'), - (0xA7BA, 'M', 'ꞻ'), - (0xA7BB, 'V'), - (0xA7BC, 'M', 'ꞽ'), - (0xA7BD, 'V'), - (0xA7BE, 'M', 'ꞿ'), - (0xA7BF, 'V'), - (0xA7C0, 'M', 'ꟁ'), - (0xA7C1, 'V'), - (0xA7C2, 'M', 'ꟃ'), - (0xA7C3, 'V'), - (0xA7C4, 'M', 'ꞔ'), - (0xA7C5, 'M', 'ʂ'), - (0xA7C6, 'M', 'ᶎ'), - (0xA7C7, 'M', 'ꟈ'), - (0xA7C8, 'V'), - (0xA7C9, 'M', 'ꟊ'), - (0xA7CA, 'V'), - (0xA7CB, 'X'), - (0xA7D0, 'M', 'ꟑ'), - (0xA7D1, 'V'), - (0xA7D2, 'X'), - (0xA7D3, 'V'), - (0xA7D4, 'X'), - (0xA7D5, 'V'), - (0xA7D6, 'M', 'ꟗ'), - (0xA7D7, 'V'), - (0xA7D8, 'M', 'ꟙ'), - (0xA7D9, 'V'), - (0xA7DA, 'X'), - (0xA7F2, 'M', 'c'), - (0xA7F3, 'M', 'f'), - (0xA7F4, 'M', 'q'), - (0xA7F5, 'M', 'ꟶ'), - (0xA7F6, 'V'), - (0xA7F8, 'M', 'ħ'), - (0xA7F9, 'M', 'œ'), - (0xA7FA, 'V'), - (0xA82D, 'X'), - (0xA830, 'V'), - (0xA83A, 'X'), - (0xA840, 'V'), - (0xA878, 'X'), - (0xA880, 'V'), - (0xA8C6, 'X'), - ] - -def _seg_38() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA8CE, 'V'), - (0xA8DA, 'X'), - (0xA8E0, 'V'), - (0xA954, 'X'), - (0xA95F, 'V'), - (0xA97D, 'X'), - (0xA980, 'V'), - (0xA9CE, 'X'), - (0xA9CF, 'V'), - (0xA9DA, 'X'), - (0xA9DE, 'V'), - (0xA9FF, 'X'), - (0xAA00, 'V'), - (0xAA37, 'X'), - (0xAA40, 'V'), - (0xAA4E, 'X'), - (0xAA50, 'V'), - (0xAA5A, 'X'), - (0xAA5C, 'V'), - (0xAAC3, 'X'), - (0xAADB, 'V'), - (0xAAF7, 'X'), - (0xAB01, 'V'), - (0xAB07, 'X'), - (0xAB09, 'V'), - (0xAB0F, 'X'), - (0xAB11, 'V'), - (0xAB17, 'X'), - (0xAB20, 'V'), - (0xAB27, 'X'), - (0xAB28, 'V'), - (0xAB2F, 'X'), - (0xAB30, 'V'), - (0xAB5C, 'M', 'ꜧ'), - (0xAB5D, 'M', 'ꬷ'), - (0xAB5E, 'M', 'ɫ'), - (0xAB5F, 'M', 'ꭒ'), - (0xAB60, 'V'), - (0xAB69, 'M', 'ʍ'), - (0xAB6A, 'V'), - (0xAB6C, 'X'), - (0xAB70, 'M', 'Ꭰ'), - (0xAB71, 'M', 'Ꭱ'), - (0xAB72, 'M', 'Ꭲ'), - (0xAB73, 'M', 'Ꭳ'), - (0xAB74, 'M', 'Ꭴ'), - (0xAB75, 'M', 'Ꭵ'), - (0xAB76, 'M', 'Ꭶ'), - (0xAB77, 'M', 'Ꭷ'), - (0xAB78, 'M', 'Ꭸ'), - (0xAB79, 'M', 'Ꭹ'), - (0xAB7A, 'M', 'Ꭺ'), - (0xAB7B, 'M', 'Ꭻ'), - (0xAB7C, 'M', 'Ꭼ'), - (0xAB7D, 'M', 'Ꭽ'), - (0xAB7E, 'M', 'Ꭾ'), - (0xAB7F, 'M', 'Ꭿ'), - (0xAB80, 'M', 'Ꮀ'), - (0xAB81, 'M', 'Ꮁ'), - (0xAB82, 'M', 'Ꮂ'), - (0xAB83, 'M', 'Ꮃ'), - (0xAB84, 'M', 'Ꮄ'), - (0xAB85, 'M', 'Ꮅ'), - (0xAB86, 'M', 'Ꮆ'), - (0xAB87, 'M', 'Ꮇ'), - (0xAB88, 'M', 'Ꮈ'), - (0xAB89, 'M', 'Ꮉ'), - (0xAB8A, 'M', 'Ꮊ'), - (0xAB8B, 'M', 'Ꮋ'), - (0xAB8C, 'M', 'Ꮌ'), - (0xAB8D, 'M', 'Ꮍ'), - (0xAB8E, 'M', 'Ꮎ'), - (0xAB8F, 'M', 'Ꮏ'), - (0xAB90, 'M', 'Ꮐ'), - (0xAB91, 'M', 'Ꮑ'), - (0xAB92, 'M', 'Ꮒ'), - (0xAB93, 'M', 'Ꮓ'), - (0xAB94, 'M', 'Ꮔ'), - (0xAB95, 'M', 'Ꮕ'), - (0xAB96, 'M', 'Ꮖ'), - (0xAB97, 'M', 'Ꮗ'), - (0xAB98, 'M', 'Ꮘ'), - (0xAB99, 'M', 'Ꮙ'), - (0xAB9A, 'M', 'Ꮚ'), - (0xAB9B, 'M', 'Ꮛ'), - (0xAB9C, 'M', 'Ꮜ'), - (0xAB9D, 'M', 'Ꮝ'), - (0xAB9E, 'M', 'Ꮞ'), - (0xAB9F, 'M', 'Ꮟ'), - (0xABA0, 'M', 'Ꮠ'), - (0xABA1, 'M', 'Ꮡ'), - (0xABA2, 'M', 'Ꮢ'), - (0xABA3, 'M', 'Ꮣ'), - (0xABA4, 'M', 'Ꮤ'), - (0xABA5, 'M', 'Ꮥ'), - (0xABA6, 'M', 'Ꮦ'), - (0xABA7, 'M', 'Ꮧ'), - (0xABA8, 'M', 'Ꮨ'), - (0xABA9, 'M', 'Ꮩ'), - (0xABAA, 'M', 'Ꮪ'), - ] - -def _seg_39() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xABAB, 'M', 'Ꮫ'), - (0xABAC, 'M', 'Ꮬ'), - (0xABAD, 'M', 'Ꮭ'), - (0xABAE, 'M', 'Ꮮ'), - (0xABAF, 'M', 'Ꮯ'), - (0xABB0, 'M', 'Ꮰ'), - (0xABB1, 'M', 'Ꮱ'), - (0xABB2, 'M', 'Ꮲ'), - (0xABB3, 'M', 'Ꮳ'), - (0xABB4, 'M', 'Ꮴ'), - (0xABB5, 'M', 'Ꮵ'), - (0xABB6, 'M', 'Ꮶ'), - (0xABB7, 'M', 'Ꮷ'), - (0xABB8, 'M', 'Ꮸ'), - (0xABB9, 'M', 'Ꮹ'), - (0xABBA, 'M', 'Ꮺ'), - (0xABBB, 'M', 'Ꮻ'), - (0xABBC, 'M', 'Ꮼ'), - (0xABBD, 'M', 'Ꮽ'), - (0xABBE, 'M', 'Ꮾ'), - (0xABBF, 'M', 'Ꮿ'), - (0xABC0, 'V'), - (0xABEE, 'X'), - (0xABF0, 'V'), - (0xABFA, 'X'), - (0xAC00, 'V'), - (0xD7A4, 'X'), - (0xD7B0, 'V'), - (0xD7C7, 'X'), - (0xD7CB, 'V'), - (0xD7FC, 'X'), - (0xF900, 'M', '豈'), - (0xF901, 'M', '更'), - (0xF902, 'M', '車'), - (0xF903, 'M', '賈'), - (0xF904, 'M', '滑'), - (0xF905, 'M', '串'), - (0xF906, 'M', '句'), - (0xF907, 'M', '龜'), - (0xF909, 'M', '契'), - (0xF90A, 'M', '金'), - (0xF90B, 'M', '喇'), - (0xF90C, 'M', '奈'), - (0xF90D, 'M', '懶'), - (0xF90E, 'M', '癩'), - (0xF90F, 'M', '羅'), - (0xF910, 'M', '蘿'), - (0xF911, 'M', '螺'), - (0xF912, 'M', '裸'), - (0xF913, 'M', '邏'), - (0xF914, 'M', '樂'), - (0xF915, 'M', '洛'), - (0xF916, 'M', '烙'), - (0xF917, 'M', '珞'), - (0xF918, 'M', '落'), - (0xF919, 'M', '酪'), - (0xF91A, 'M', '駱'), - (0xF91B, 'M', '亂'), - (0xF91C, 'M', '卵'), - (0xF91D, 'M', '欄'), - (0xF91E, 'M', '爛'), - (0xF91F, 'M', '蘭'), - (0xF920, 'M', '鸞'), - (0xF921, 'M', '嵐'), - (0xF922, 'M', '濫'), - (0xF923, 'M', '藍'), - (0xF924, 'M', '襤'), - (0xF925, 'M', '拉'), - (0xF926, 'M', '臘'), - (0xF927, 'M', '蠟'), - (0xF928, 'M', '廊'), - (0xF929, 'M', '朗'), - (0xF92A, 'M', '浪'), - (0xF92B, 'M', '狼'), - (0xF92C, 'M', '郎'), - (0xF92D, 'M', '來'), - (0xF92E, 'M', '冷'), - (0xF92F, 'M', '勞'), - (0xF930, 'M', '擄'), - (0xF931, 'M', '櫓'), - (0xF932, 'M', '爐'), - (0xF933, 'M', '盧'), - (0xF934, 'M', '老'), - (0xF935, 'M', '蘆'), - (0xF936, 'M', '虜'), - (0xF937, 'M', '路'), - (0xF938, 'M', '露'), - (0xF939, 'M', '魯'), - (0xF93A, 'M', '鷺'), - (0xF93B, 'M', '碌'), - (0xF93C, 'M', '祿'), - (0xF93D, 'M', '綠'), - (0xF93E, 'M', '菉'), - (0xF93F, 'M', '錄'), - (0xF940, 'M', '鹿'), - (0xF941, 'M', '論'), - (0xF942, 'M', '壟'), - (0xF943, 'M', '弄'), - (0xF944, 'M', '籠'), - (0xF945, 'M', '聾'), - ] - -def _seg_40() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xF946, 'M', '牢'), - (0xF947, 'M', '磊'), - (0xF948, 'M', '賂'), - (0xF949, 'M', '雷'), - (0xF94A, 'M', '壘'), - (0xF94B, 'M', '屢'), - (0xF94C, 'M', '樓'), - (0xF94D, 'M', '淚'), - (0xF94E, 'M', '漏'), - (0xF94F, 'M', '累'), - (0xF950, 'M', '縷'), - (0xF951, 'M', '陋'), - (0xF952, 'M', '勒'), - (0xF953, 'M', '肋'), - (0xF954, 'M', '凜'), - (0xF955, 'M', '凌'), - (0xF956, 'M', '稜'), - (0xF957, 'M', '綾'), - (0xF958, 'M', '菱'), - (0xF959, 'M', '陵'), - (0xF95A, 'M', '讀'), - (0xF95B, 'M', '拏'), - (0xF95C, 'M', '樂'), - (0xF95D, 'M', '諾'), - (0xF95E, 'M', '丹'), - (0xF95F, 'M', '寧'), - (0xF960, 'M', '怒'), - (0xF961, 'M', '率'), - (0xF962, 'M', '異'), - (0xF963, 'M', '北'), - (0xF964, 'M', '磻'), - (0xF965, 'M', '便'), - (0xF966, 'M', '復'), - (0xF967, 'M', '不'), - (0xF968, 'M', '泌'), - (0xF969, 'M', '數'), - (0xF96A, 'M', '索'), - (0xF96B, 'M', '參'), - (0xF96C, 'M', '塞'), - (0xF96D, 'M', '省'), - (0xF96E, 'M', '葉'), - (0xF96F, 'M', '說'), - (0xF970, 'M', '殺'), - (0xF971, 'M', '辰'), - (0xF972, 'M', '沈'), - (0xF973, 'M', '拾'), - (0xF974, 'M', '若'), - (0xF975, 'M', '掠'), - (0xF976, 'M', '略'), - (0xF977, 'M', '亮'), - (0xF978, 'M', '兩'), - (0xF979, 'M', '凉'), - (0xF97A, 'M', '梁'), - (0xF97B, 'M', '糧'), - (0xF97C, 'M', '良'), - (0xF97D, 'M', '諒'), - (0xF97E, 'M', '量'), - (0xF97F, 'M', '勵'), - (0xF980, 'M', '呂'), - (0xF981, 'M', '女'), - (0xF982, 'M', '廬'), - (0xF983, 'M', '旅'), - (0xF984, 'M', '濾'), - (0xF985, 'M', '礪'), - (0xF986, 'M', '閭'), - (0xF987, 'M', '驪'), - (0xF988, 'M', '麗'), - (0xF989, 'M', '黎'), - (0xF98A, 'M', '力'), - (0xF98B, 'M', '曆'), - (0xF98C, 'M', '歷'), - (0xF98D, 'M', '轢'), - (0xF98E, 'M', '年'), - (0xF98F, 'M', '憐'), - (0xF990, 'M', '戀'), - (0xF991, 'M', '撚'), - (0xF992, 'M', '漣'), - (0xF993, 'M', '煉'), - (0xF994, 'M', '璉'), - (0xF995, 'M', '秊'), - (0xF996, 'M', '練'), - (0xF997, 'M', '聯'), - (0xF998, 'M', '輦'), - (0xF999, 'M', '蓮'), - (0xF99A, 'M', '連'), - (0xF99B, 'M', '鍊'), - (0xF99C, 'M', '列'), - (0xF99D, 'M', '劣'), - (0xF99E, 'M', '咽'), - (0xF99F, 'M', '烈'), - (0xF9A0, 'M', '裂'), - (0xF9A1, 'M', '說'), - (0xF9A2, 'M', '廉'), - (0xF9A3, 'M', '念'), - (0xF9A4, 'M', '捻'), - (0xF9A5, 'M', '殮'), - (0xF9A6, 'M', '簾'), - (0xF9A7, 'M', '獵'), - (0xF9A8, 'M', '令'), - (0xF9A9, 'M', '囹'), - ] - -def _seg_41() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xF9AA, 'M', '寧'), - (0xF9AB, 'M', '嶺'), - (0xF9AC, 'M', '怜'), - (0xF9AD, 'M', '玲'), - (0xF9AE, 'M', '瑩'), - (0xF9AF, 'M', '羚'), - (0xF9B0, 'M', '聆'), - (0xF9B1, 'M', '鈴'), - (0xF9B2, 'M', '零'), - (0xF9B3, 'M', '靈'), - (0xF9B4, 'M', '領'), - (0xF9B5, 'M', '例'), - (0xF9B6, 'M', '禮'), - (0xF9B7, 'M', '醴'), - (0xF9B8, 'M', '隸'), - (0xF9B9, 'M', '惡'), - (0xF9BA, 'M', '了'), - (0xF9BB, 'M', '僚'), - (0xF9BC, 'M', '寮'), - (0xF9BD, 'M', '尿'), - (0xF9BE, 'M', '料'), - (0xF9BF, 'M', '樂'), - (0xF9C0, 'M', '燎'), - (0xF9C1, 'M', '療'), - (0xF9C2, 'M', '蓼'), - (0xF9C3, 'M', '遼'), - (0xF9C4, 'M', '龍'), - (0xF9C5, 'M', '暈'), - (0xF9C6, 'M', '阮'), - (0xF9C7, 'M', '劉'), - (0xF9C8, 'M', '杻'), - (0xF9C9, 'M', '柳'), - (0xF9CA, 'M', '流'), - (0xF9CB, 'M', '溜'), - (0xF9CC, 'M', '琉'), - (0xF9CD, 'M', '留'), - (0xF9CE, 'M', '硫'), - (0xF9CF, 'M', '紐'), - (0xF9D0, 'M', '類'), - (0xF9D1, 'M', '六'), - (0xF9D2, 'M', '戮'), - (0xF9D3, 'M', '陸'), - (0xF9D4, 'M', '倫'), - (0xF9D5, 'M', '崙'), - (0xF9D6, 'M', '淪'), - (0xF9D7, 'M', '輪'), - (0xF9D8, 'M', '律'), - (0xF9D9, 'M', '慄'), - (0xF9DA, 'M', '栗'), - (0xF9DB, 'M', '率'), - (0xF9DC, 'M', '隆'), - (0xF9DD, 'M', '利'), - (0xF9DE, 'M', '吏'), - (0xF9DF, 'M', '履'), - (0xF9E0, 'M', '易'), - (0xF9E1, 'M', '李'), - (0xF9E2, 'M', '梨'), - (0xF9E3, 'M', '泥'), - (0xF9E4, 'M', '理'), - (0xF9E5, 'M', '痢'), - (0xF9E6, 'M', '罹'), - (0xF9E7, 'M', '裏'), - (0xF9E8, 'M', '裡'), - (0xF9E9, 'M', '里'), - (0xF9EA, 'M', '離'), - (0xF9EB, 'M', '匿'), - (0xF9EC, 'M', '溺'), - (0xF9ED, 'M', '吝'), - (0xF9EE, 'M', '燐'), - (0xF9EF, 'M', '璘'), - (0xF9F0, 'M', '藺'), - (0xF9F1, 'M', '隣'), - (0xF9F2, 'M', '鱗'), - (0xF9F3, 'M', '麟'), - (0xF9F4, 'M', '林'), - (0xF9F5, 'M', '淋'), - (0xF9F6, 'M', '臨'), - (0xF9F7, 'M', '立'), - (0xF9F8, 'M', '笠'), - (0xF9F9, 'M', '粒'), - (0xF9FA, 'M', '狀'), - (0xF9FB, 'M', '炙'), - (0xF9FC, 'M', '識'), - (0xF9FD, 'M', '什'), - (0xF9FE, 'M', '茶'), - (0xF9FF, 'M', '刺'), - (0xFA00, 'M', '切'), - (0xFA01, 'M', '度'), - (0xFA02, 'M', '拓'), - (0xFA03, 'M', '糖'), - (0xFA04, 'M', '宅'), - (0xFA05, 'M', '洞'), - (0xFA06, 'M', '暴'), - (0xFA07, 'M', '輻'), - (0xFA08, 'M', '行'), - (0xFA09, 'M', '降'), - (0xFA0A, 'M', '見'), - (0xFA0B, 'M', '廓'), - (0xFA0C, 'M', '兀'), - (0xFA0D, 'M', '嗀'), - ] - -def _seg_42() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFA0E, 'V'), - (0xFA10, 'M', '塚'), - (0xFA11, 'V'), - (0xFA12, 'M', '晴'), - (0xFA13, 'V'), - (0xFA15, 'M', '凞'), - (0xFA16, 'M', '猪'), - (0xFA17, 'M', '益'), - (0xFA18, 'M', '礼'), - (0xFA19, 'M', '神'), - (0xFA1A, 'M', '祥'), - (0xFA1B, 'M', '福'), - (0xFA1C, 'M', '靖'), - (0xFA1D, 'M', '精'), - (0xFA1E, 'M', '羽'), - (0xFA1F, 'V'), - (0xFA20, 'M', '蘒'), - (0xFA21, 'V'), - (0xFA22, 'M', '諸'), - (0xFA23, 'V'), - (0xFA25, 'M', '逸'), - (0xFA26, 'M', '都'), - (0xFA27, 'V'), - (0xFA2A, 'M', '飯'), - (0xFA2B, 'M', '飼'), - (0xFA2C, 'M', '館'), - (0xFA2D, 'M', '鶴'), - (0xFA2E, 'M', '郞'), - (0xFA2F, 'M', '隷'), - (0xFA30, 'M', '侮'), - (0xFA31, 'M', '僧'), - (0xFA32, 'M', '免'), - (0xFA33, 'M', '勉'), - (0xFA34, 'M', '勤'), - (0xFA35, 'M', '卑'), - (0xFA36, 'M', '喝'), - (0xFA37, 'M', '嘆'), - (0xFA38, 'M', '器'), - (0xFA39, 'M', '塀'), - (0xFA3A, 'M', '墨'), - (0xFA3B, 'M', '層'), - (0xFA3C, 'M', '屮'), - (0xFA3D, 'M', '悔'), - (0xFA3E, 'M', '慨'), - (0xFA3F, 'M', '憎'), - (0xFA40, 'M', '懲'), - (0xFA41, 'M', '敏'), - (0xFA42, 'M', '既'), - (0xFA43, 'M', '暑'), - (0xFA44, 'M', '梅'), - (0xFA45, 'M', '海'), - (0xFA46, 'M', '渚'), - (0xFA47, 'M', '漢'), - (0xFA48, 'M', '煮'), - (0xFA49, 'M', '爫'), - (0xFA4A, 'M', '琢'), - (0xFA4B, 'M', '碑'), - (0xFA4C, 'M', '社'), - (0xFA4D, 'M', '祉'), - (0xFA4E, 'M', '祈'), - (0xFA4F, 'M', '祐'), - (0xFA50, 'M', '祖'), - (0xFA51, 'M', '祝'), - (0xFA52, 'M', '禍'), - (0xFA53, 'M', '禎'), - (0xFA54, 'M', '穀'), - (0xFA55, 'M', '突'), - (0xFA56, 'M', '節'), - (0xFA57, 'M', '練'), - (0xFA58, 'M', '縉'), - (0xFA59, 'M', '繁'), - (0xFA5A, 'M', '署'), - (0xFA5B, 'M', '者'), - (0xFA5C, 'M', '臭'), - (0xFA5D, 'M', '艹'), - (0xFA5F, 'M', '著'), - (0xFA60, 'M', '褐'), - (0xFA61, 'M', '視'), - (0xFA62, 'M', '謁'), - (0xFA63, 'M', '謹'), - (0xFA64, 'M', '賓'), - (0xFA65, 'M', '贈'), - (0xFA66, 'M', '辶'), - (0xFA67, 'M', '逸'), - (0xFA68, 'M', '難'), - (0xFA69, 'M', '響'), - (0xFA6A, 'M', '頻'), - (0xFA6B, 'M', '恵'), - (0xFA6C, 'M', '𤋮'), - (0xFA6D, 'M', '舘'), - (0xFA6E, 'X'), - (0xFA70, 'M', '並'), - (0xFA71, 'M', '况'), - (0xFA72, 'M', '全'), - (0xFA73, 'M', '侀'), - (0xFA74, 'M', '充'), - (0xFA75, 'M', '冀'), - (0xFA76, 'M', '勇'), - (0xFA77, 'M', '勺'), - (0xFA78, 'M', '喝'), - ] - -def _seg_43() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFA79, 'M', '啕'), - (0xFA7A, 'M', '喙'), - (0xFA7B, 'M', '嗢'), - (0xFA7C, 'M', '塚'), - (0xFA7D, 'M', '墳'), - (0xFA7E, 'M', '奄'), - (0xFA7F, 'M', '奔'), - (0xFA80, 'M', '婢'), - (0xFA81, 'M', '嬨'), - (0xFA82, 'M', '廒'), - (0xFA83, 'M', '廙'), - (0xFA84, 'M', '彩'), - (0xFA85, 'M', '徭'), - (0xFA86, 'M', '惘'), - (0xFA87, 'M', '慎'), - (0xFA88, 'M', '愈'), - (0xFA89, 'M', '憎'), - (0xFA8A, 'M', '慠'), - (0xFA8B, 'M', '懲'), - (0xFA8C, 'M', '戴'), - (0xFA8D, 'M', '揄'), - (0xFA8E, 'M', '搜'), - (0xFA8F, 'M', '摒'), - (0xFA90, 'M', '敖'), - (0xFA91, 'M', '晴'), - (0xFA92, 'M', '朗'), - (0xFA93, 'M', '望'), - (0xFA94, 'M', '杖'), - (0xFA95, 'M', '歹'), - (0xFA96, 'M', '殺'), - (0xFA97, 'M', '流'), - (0xFA98, 'M', '滛'), - (0xFA99, 'M', '滋'), - (0xFA9A, 'M', '漢'), - (0xFA9B, 'M', '瀞'), - (0xFA9C, 'M', '煮'), - (0xFA9D, 'M', '瞧'), - (0xFA9E, 'M', '爵'), - (0xFA9F, 'M', '犯'), - (0xFAA0, 'M', '猪'), - (0xFAA1, 'M', '瑱'), - (0xFAA2, 'M', '甆'), - (0xFAA3, 'M', '画'), - (0xFAA4, 'M', '瘝'), - (0xFAA5, 'M', '瘟'), - (0xFAA6, 'M', '益'), - (0xFAA7, 'M', '盛'), - (0xFAA8, 'M', '直'), - (0xFAA9, 'M', '睊'), - (0xFAAA, 'M', '着'), - (0xFAAB, 'M', '磌'), - (0xFAAC, 'M', '窱'), - (0xFAAD, 'M', '節'), - (0xFAAE, 'M', '类'), - (0xFAAF, 'M', '絛'), - (0xFAB0, 'M', '練'), - (0xFAB1, 'M', '缾'), - (0xFAB2, 'M', '者'), - (0xFAB3, 'M', '荒'), - (0xFAB4, 'M', '華'), - (0xFAB5, 'M', '蝹'), - (0xFAB6, 'M', '襁'), - (0xFAB7, 'M', '覆'), - (0xFAB8, 'M', '視'), - (0xFAB9, 'M', '調'), - (0xFABA, 'M', '諸'), - (0xFABB, 'M', '請'), - (0xFABC, 'M', '謁'), - (0xFABD, 'M', '諾'), - (0xFABE, 'M', '諭'), - (0xFABF, 'M', '謹'), - (0xFAC0, 'M', '變'), - (0xFAC1, 'M', '贈'), - (0xFAC2, 'M', '輸'), - (0xFAC3, 'M', '遲'), - (0xFAC4, 'M', '醙'), - (0xFAC5, 'M', '鉶'), - (0xFAC6, 'M', '陼'), - (0xFAC7, 'M', '難'), - (0xFAC8, 'M', '靖'), - (0xFAC9, 'M', '韛'), - (0xFACA, 'M', '響'), - (0xFACB, 'M', '頋'), - (0xFACC, 'M', '頻'), - (0xFACD, 'M', '鬒'), - (0xFACE, 'M', '龜'), - (0xFACF, 'M', '𢡊'), - (0xFAD0, 'M', '𢡄'), - (0xFAD1, 'M', '𣏕'), - (0xFAD2, 'M', '㮝'), - (0xFAD3, 'M', '䀘'), - (0xFAD4, 'M', '䀹'), - (0xFAD5, 'M', '𥉉'), - (0xFAD6, 'M', '𥳐'), - (0xFAD7, 'M', '𧻓'), - (0xFAD8, 'M', '齃'), - (0xFAD9, 'M', '龎'), - (0xFADA, 'X'), - (0xFB00, 'M', 'ff'), - (0xFB01, 'M', 'fi'), - ] - -def _seg_44() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFB02, 'M', 'fl'), - (0xFB03, 'M', 'ffi'), - (0xFB04, 'M', 'ffl'), - (0xFB05, 'M', 'st'), - (0xFB07, 'X'), - (0xFB13, 'M', 'մն'), - (0xFB14, 'M', 'մե'), - (0xFB15, 'M', 'մի'), - (0xFB16, 'M', 'վն'), - (0xFB17, 'M', 'մխ'), - (0xFB18, 'X'), - (0xFB1D, 'M', 'יִ'), - (0xFB1E, 'V'), - (0xFB1F, 'M', 'ײַ'), - (0xFB20, 'M', 'ע'), - (0xFB21, 'M', 'א'), - (0xFB22, 'M', 'ד'), - (0xFB23, 'M', 'ה'), - (0xFB24, 'M', 'כ'), - (0xFB25, 'M', 'ל'), - (0xFB26, 'M', 'ם'), - (0xFB27, 'M', 'ר'), - (0xFB28, 'M', 'ת'), - (0xFB29, '3', '+'), - (0xFB2A, 'M', 'שׁ'), - (0xFB2B, 'M', 'שׂ'), - (0xFB2C, 'M', 'שּׁ'), - (0xFB2D, 'M', 'שּׂ'), - (0xFB2E, 'M', 'אַ'), - (0xFB2F, 'M', 'אָ'), - (0xFB30, 'M', 'אּ'), - (0xFB31, 'M', 'בּ'), - (0xFB32, 'M', 'גּ'), - (0xFB33, 'M', 'דּ'), - (0xFB34, 'M', 'הּ'), - (0xFB35, 'M', 'וּ'), - (0xFB36, 'M', 'זּ'), - (0xFB37, 'X'), - (0xFB38, 'M', 'טּ'), - (0xFB39, 'M', 'יּ'), - (0xFB3A, 'M', 'ךּ'), - (0xFB3B, 'M', 'כּ'), - (0xFB3C, 'M', 'לּ'), - (0xFB3D, 'X'), - (0xFB3E, 'M', 'מּ'), - (0xFB3F, 'X'), - (0xFB40, 'M', 'נּ'), - (0xFB41, 'M', 'סּ'), - (0xFB42, 'X'), - (0xFB43, 'M', 'ףּ'), - (0xFB44, 'M', 'פּ'), - (0xFB45, 'X'), - (0xFB46, 'M', 'צּ'), - (0xFB47, 'M', 'קּ'), - (0xFB48, 'M', 'רּ'), - (0xFB49, 'M', 'שּ'), - (0xFB4A, 'M', 'תּ'), - (0xFB4B, 'M', 'וֹ'), - (0xFB4C, 'M', 'בֿ'), - (0xFB4D, 'M', 'כֿ'), - (0xFB4E, 'M', 'פֿ'), - (0xFB4F, 'M', 'אל'), - (0xFB50, 'M', 'ٱ'), - (0xFB52, 'M', 'ٻ'), - (0xFB56, 'M', 'پ'), - (0xFB5A, 'M', 'ڀ'), - (0xFB5E, 'M', 'ٺ'), - (0xFB62, 'M', 'ٿ'), - (0xFB66, 'M', 'ٹ'), - (0xFB6A, 'M', 'ڤ'), - (0xFB6E, 'M', 'ڦ'), - (0xFB72, 'M', 'ڄ'), - (0xFB76, 'M', 'ڃ'), - (0xFB7A, 'M', 'چ'), - (0xFB7E, 'M', 'ڇ'), - (0xFB82, 'M', 'ڍ'), - (0xFB84, 'M', 'ڌ'), - (0xFB86, 'M', 'ڎ'), - (0xFB88, 'M', 'ڈ'), - (0xFB8A, 'M', 'ژ'), - (0xFB8C, 'M', 'ڑ'), - (0xFB8E, 'M', 'ک'), - (0xFB92, 'M', 'گ'), - (0xFB96, 'M', 'ڳ'), - (0xFB9A, 'M', 'ڱ'), - (0xFB9E, 'M', 'ں'), - (0xFBA0, 'M', 'ڻ'), - (0xFBA4, 'M', 'ۀ'), - (0xFBA6, 'M', 'ہ'), - (0xFBAA, 'M', 'ھ'), - (0xFBAE, 'M', 'ے'), - (0xFBB0, 'M', 'ۓ'), - (0xFBB2, 'V'), - (0xFBC3, 'X'), - (0xFBD3, 'M', 'ڭ'), - (0xFBD7, 'M', 'ۇ'), - (0xFBD9, 'M', 'ۆ'), - (0xFBDB, 'M', 'ۈ'), - (0xFBDD, 'M', 'ۇٴ'), - (0xFBDE, 'M', 'ۋ'), - ] - -def _seg_45() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFBE0, 'M', 'ۅ'), - (0xFBE2, 'M', 'ۉ'), - (0xFBE4, 'M', 'ې'), - (0xFBE8, 'M', 'ى'), - (0xFBEA, 'M', 'ئا'), - (0xFBEC, 'M', 'ئە'), - (0xFBEE, 'M', 'ئو'), - (0xFBF0, 'M', 'ئۇ'), - (0xFBF2, 'M', 'ئۆ'), - (0xFBF4, 'M', 'ئۈ'), - (0xFBF6, 'M', 'ئې'), - (0xFBF9, 'M', 'ئى'), - (0xFBFC, 'M', 'ی'), - (0xFC00, 'M', 'ئج'), - (0xFC01, 'M', 'ئح'), - (0xFC02, 'M', 'ئم'), - (0xFC03, 'M', 'ئى'), - (0xFC04, 'M', 'ئي'), - (0xFC05, 'M', 'بج'), - (0xFC06, 'M', 'بح'), - (0xFC07, 'M', 'بخ'), - (0xFC08, 'M', 'بم'), - (0xFC09, 'M', 'بى'), - (0xFC0A, 'M', 'بي'), - (0xFC0B, 'M', 'تج'), - (0xFC0C, 'M', 'تح'), - (0xFC0D, 'M', 'تخ'), - (0xFC0E, 'M', 'تم'), - (0xFC0F, 'M', 'تى'), - (0xFC10, 'M', 'تي'), - (0xFC11, 'M', 'ثج'), - (0xFC12, 'M', 'ثم'), - (0xFC13, 'M', 'ثى'), - (0xFC14, 'M', 'ثي'), - (0xFC15, 'M', 'جح'), - (0xFC16, 'M', 'جم'), - (0xFC17, 'M', 'حج'), - (0xFC18, 'M', 'حم'), - (0xFC19, 'M', 'خج'), - (0xFC1A, 'M', 'خح'), - (0xFC1B, 'M', 'خم'), - (0xFC1C, 'M', 'سج'), - (0xFC1D, 'M', 'سح'), - (0xFC1E, 'M', 'سخ'), - (0xFC1F, 'M', 'سم'), - (0xFC20, 'M', 'صح'), - (0xFC21, 'M', 'صم'), - (0xFC22, 'M', 'ضج'), - (0xFC23, 'M', 'ضح'), - (0xFC24, 'M', 'ضخ'), - (0xFC25, 'M', 'ضم'), - (0xFC26, 'M', 'طح'), - (0xFC27, 'M', 'طم'), - (0xFC28, 'M', 'ظم'), - (0xFC29, 'M', 'عج'), - (0xFC2A, 'M', 'عم'), - (0xFC2B, 'M', 'غج'), - (0xFC2C, 'M', 'غم'), - (0xFC2D, 'M', 'فج'), - (0xFC2E, 'M', 'فح'), - (0xFC2F, 'M', 'فخ'), - (0xFC30, 'M', 'فم'), - (0xFC31, 'M', 'فى'), - (0xFC32, 'M', 'في'), - (0xFC33, 'M', 'قح'), - (0xFC34, 'M', 'قم'), - (0xFC35, 'M', 'قى'), - (0xFC36, 'M', 'قي'), - (0xFC37, 'M', 'كا'), - (0xFC38, 'M', 'كج'), - (0xFC39, 'M', 'كح'), - (0xFC3A, 'M', 'كخ'), - (0xFC3B, 'M', 'كل'), - (0xFC3C, 'M', 'كم'), - (0xFC3D, 'M', 'كى'), - (0xFC3E, 'M', 'كي'), - (0xFC3F, 'M', 'لج'), - (0xFC40, 'M', 'لح'), - (0xFC41, 'M', 'لخ'), - (0xFC42, 'M', 'لم'), - (0xFC43, 'M', 'لى'), - (0xFC44, 'M', 'لي'), - (0xFC45, 'M', 'مج'), - (0xFC46, 'M', 'مح'), - (0xFC47, 'M', 'مخ'), - (0xFC48, 'M', 'مم'), - (0xFC49, 'M', 'مى'), - (0xFC4A, 'M', 'مي'), - (0xFC4B, 'M', 'نج'), - (0xFC4C, 'M', 'نح'), - (0xFC4D, 'M', 'نخ'), - (0xFC4E, 'M', 'نم'), - (0xFC4F, 'M', 'نى'), - (0xFC50, 'M', 'ني'), - (0xFC51, 'M', 'هج'), - (0xFC52, 'M', 'هم'), - (0xFC53, 'M', 'هى'), - (0xFC54, 'M', 'هي'), - (0xFC55, 'M', 'يج'), - (0xFC56, 'M', 'يح'), - ] - -def _seg_46() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFC57, 'M', 'يخ'), - (0xFC58, 'M', 'يم'), - (0xFC59, 'M', 'يى'), - (0xFC5A, 'M', 'يي'), - (0xFC5B, 'M', 'ذٰ'), - (0xFC5C, 'M', 'رٰ'), - (0xFC5D, 'M', 'ىٰ'), - (0xFC5E, '3', ' ٌّ'), - (0xFC5F, '3', ' ٍّ'), - (0xFC60, '3', ' َّ'), - (0xFC61, '3', ' ُّ'), - (0xFC62, '3', ' ِّ'), - (0xFC63, '3', ' ّٰ'), - (0xFC64, 'M', 'ئر'), - (0xFC65, 'M', 'ئز'), - (0xFC66, 'M', 'ئم'), - (0xFC67, 'M', 'ئن'), - (0xFC68, 'M', 'ئى'), - (0xFC69, 'M', 'ئي'), - (0xFC6A, 'M', 'بر'), - (0xFC6B, 'M', 'بز'), - (0xFC6C, 'M', 'بم'), - (0xFC6D, 'M', 'بن'), - (0xFC6E, 'M', 'بى'), - (0xFC6F, 'M', 'بي'), - (0xFC70, 'M', 'تر'), - (0xFC71, 'M', 'تز'), - (0xFC72, 'M', 'تم'), - (0xFC73, 'M', 'تن'), - (0xFC74, 'M', 'تى'), - (0xFC75, 'M', 'تي'), - (0xFC76, 'M', 'ثر'), - (0xFC77, 'M', 'ثز'), - (0xFC78, 'M', 'ثم'), - (0xFC79, 'M', 'ثن'), - (0xFC7A, 'M', 'ثى'), - (0xFC7B, 'M', 'ثي'), - (0xFC7C, 'M', 'فى'), - (0xFC7D, 'M', 'في'), - (0xFC7E, 'M', 'قى'), - (0xFC7F, 'M', 'قي'), - (0xFC80, 'M', 'كا'), - (0xFC81, 'M', 'كل'), - (0xFC82, 'M', 'كم'), - (0xFC83, 'M', 'كى'), - (0xFC84, 'M', 'كي'), - (0xFC85, 'M', 'لم'), - (0xFC86, 'M', 'لى'), - (0xFC87, 'M', 'لي'), - (0xFC88, 'M', 'ما'), - (0xFC89, 'M', 'مم'), - (0xFC8A, 'M', 'نر'), - (0xFC8B, 'M', 'نز'), - (0xFC8C, 'M', 'نم'), - (0xFC8D, 'M', 'نن'), - (0xFC8E, 'M', 'نى'), - (0xFC8F, 'M', 'ني'), - (0xFC90, 'M', 'ىٰ'), - (0xFC91, 'M', 'ير'), - (0xFC92, 'M', 'يز'), - (0xFC93, 'M', 'يم'), - (0xFC94, 'M', 'ين'), - (0xFC95, 'M', 'يى'), - (0xFC96, 'M', 'يي'), - (0xFC97, 'M', 'ئج'), - (0xFC98, 'M', 'ئح'), - (0xFC99, 'M', 'ئخ'), - (0xFC9A, 'M', 'ئم'), - (0xFC9B, 'M', 'ئه'), - (0xFC9C, 'M', 'بج'), - (0xFC9D, 'M', 'بح'), - (0xFC9E, 'M', 'بخ'), - (0xFC9F, 'M', 'بم'), - (0xFCA0, 'M', 'به'), - (0xFCA1, 'M', 'تج'), - (0xFCA2, 'M', 'تح'), - (0xFCA3, 'M', 'تخ'), - (0xFCA4, 'M', 'تم'), - (0xFCA5, 'M', 'ته'), - (0xFCA6, 'M', 'ثم'), - (0xFCA7, 'M', 'جح'), - (0xFCA8, 'M', 'جم'), - (0xFCA9, 'M', 'حج'), - (0xFCAA, 'M', 'حم'), - (0xFCAB, 'M', 'خج'), - (0xFCAC, 'M', 'خم'), - (0xFCAD, 'M', 'سج'), - (0xFCAE, 'M', 'سح'), - (0xFCAF, 'M', 'سخ'), - (0xFCB0, 'M', 'سم'), - (0xFCB1, 'M', 'صح'), - (0xFCB2, 'M', 'صخ'), - (0xFCB3, 'M', 'صم'), - (0xFCB4, 'M', 'ضج'), - (0xFCB5, 'M', 'ضح'), - (0xFCB6, 'M', 'ضخ'), - (0xFCB7, 'M', 'ضم'), - (0xFCB8, 'M', 'طح'), - (0xFCB9, 'M', 'ظم'), - (0xFCBA, 'M', 'عج'), - ] - -def _seg_47() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFCBB, 'M', 'عم'), - (0xFCBC, 'M', 'غج'), - (0xFCBD, 'M', 'غم'), - (0xFCBE, 'M', 'فج'), - (0xFCBF, 'M', 'فح'), - (0xFCC0, 'M', 'فخ'), - (0xFCC1, 'M', 'فم'), - (0xFCC2, 'M', 'قح'), - (0xFCC3, 'M', 'قم'), - (0xFCC4, 'M', 'كج'), - (0xFCC5, 'M', 'كح'), - (0xFCC6, 'M', 'كخ'), - (0xFCC7, 'M', 'كل'), - (0xFCC8, 'M', 'كم'), - (0xFCC9, 'M', 'لج'), - (0xFCCA, 'M', 'لح'), - (0xFCCB, 'M', 'لخ'), - (0xFCCC, 'M', 'لم'), - (0xFCCD, 'M', 'له'), - (0xFCCE, 'M', 'مج'), - (0xFCCF, 'M', 'مح'), - (0xFCD0, 'M', 'مخ'), - (0xFCD1, 'M', 'مم'), - (0xFCD2, 'M', 'نج'), - (0xFCD3, 'M', 'نح'), - (0xFCD4, 'M', 'نخ'), - (0xFCD5, 'M', 'نم'), - (0xFCD6, 'M', 'نه'), - (0xFCD7, 'M', 'هج'), - (0xFCD8, 'M', 'هم'), - (0xFCD9, 'M', 'هٰ'), - (0xFCDA, 'M', 'يج'), - (0xFCDB, 'M', 'يح'), - (0xFCDC, 'M', 'يخ'), - (0xFCDD, 'M', 'يم'), - (0xFCDE, 'M', 'يه'), - (0xFCDF, 'M', 'ئم'), - (0xFCE0, 'M', 'ئه'), - (0xFCE1, 'M', 'بم'), - (0xFCE2, 'M', 'به'), - (0xFCE3, 'M', 'تم'), - (0xFCE4, 'M', 'ته'), - (0xFCE5, 'M', 'ثم'), - (0xFCE6, 'M', 'ثه'), - (0xFCE7, 'M', 'سم'), - (0xFCE8, 'M', 'سه'), - (0xFCE9, 'M', 'شم'), - (0xFCEA, 'M', 'شه'), - (0xFCEB, 'M', 'كل'), - (0xFCEC, 'M', 'كم'), - (0xFCED, 'M', 'لم'), - (0xFCEE, 'M', 'نم'), - (0xFCEF, 'M', 'نه'), - (0xFCF0, 'M', 'يم'), - (0xFCF1, 'M', 'يه'), - (0xFCF2, 'M', 'ـَّ'), - (0xFCF3, 'M', 'ـُّ'), - (0xFCF4, 'M', 'ـِّ'), - (0xFCF5, 'M', 'طى'), - (0xFCF6, 'M', 'طي'), - (0xFCF7, 'M', 'عى'), - (0xFCF8, 'M', 'عي'), - (0xFCF9, 'M', 'غى'), - (0xFCFA, 'M', 'غي'), - (0xFCFB, 'M', 'سى'), - (0xFCFC, 'M', 'سي'), - (0xFCFD, 'M', 'شى'), - (0xFCFE, 'M', 'شي'), - (0xFCFF, 'M', 'حى'), - (0xFD00, 'M', 'حي'), - (0xFD01, 'M', 'جى'), - (0xFD02, 'M', 'جي'), - (0xFD03, 'M', 'خى'), - (0xFD04, 'M', 'خي'), - (0xFD05, 'M', 'صى'), - (0xFD06, 'M', 'صي'), - (0xFD07, 'M', 'ضى'), - (0xFD08, 'M', 'ضي'), - (0xFD09, 'M', 'شج'), - (0xFD0A, 'M', 'شح'), - (0xFD0B, 'M', 'شخ'), - (0xFD0C, 'M', 'شم'), - (0xFD0D, 'M', 'شر'), - (0xFD0E, 'M', 'سر'), - (0xFD0F, 'M', 'صر'), - (0xFD10, 'M', 'ضر'), - (0xFD11, 'M', 'طى'), - (0xFD12, 'M', 'طي'), - (0xFD13, 'M', 'عى'), - (0xFD14, 'M', 'عي'), - (0xFD15, 'M', 'غى'), - (0xFD16, 'M', 'غي'), - (0xFD17, 'M', 'سى'), - (0xFD18, 'M', 'سي'), - (0xFD19, 'M', 'شى'), - (0xFD1A, 'M', 'شي'), - (0xFD1B, 'M', 'حى'), - (0xFD1C, 'M', 'حي'), - (0xFD1D, 'M', 'جى'), - (0xFD1E, 'M', 'جي'), - ] - -def _seg_48() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFD1F, 'M', 'خى'), - (0xFD20, 'M', 'خي'), - (0xFD21, 'M', 'صى'), - (0xFD22, 'M', 'صي'), - (0xFD23, 'M', 'ضى'), - (0xFD24, 'M', 'ضي'), - (0xFD25, 'M', 'شج'), - (0xFD26, 'M', 'شح'), - (0xFD27, 'M', 'شخ'), - (0xFD28, 'M', 'شم'), - (0xFD29, 'M', 'شر'), - (0xFD2A, 'M', 'سر'), - (0xFD2B, 'M', 'صر'), - (0xFD2C, 'M', 'ضر'), - (0xFD2D, 'M', 'شج'), - (0xFD2E, 'M', 'شح'), - (0xFD2F, 'M', 'شخ'), - (0xFD30, 'M', 'شم'), - (0xFD31, 'M', 'سه'), - (0xFD32, 'M', 'شه'), - (0xFD33, 'M', 'طم'), - (0xFD34, 'M', 'سج'), - (0xFD35, 'M', 'سح'), - (0xFD36, 'M', 'سخ'), - (0xFD37, 'M', 'شج'), - (0xFD38, 'M', 'شح'), - (0xFD39, 'M', 'شخ'), - (0xFD3A, 'M', 'طم'), - (0xFD3B, 'M', 'ظم'), - (0xFD3C, 'M', 'اً'), - (0xFD3E, 'V'), - (0xFD50, 'M', 'تجم'), - (0xFD51, 'M', 'تحج'), - (0xFD53, 'M', 'تحم'), - (0xFD54, 'M', 'تخم'), - (0xFD55, 'M', 'تمج'), - (0xFD56, 'M', 'تمح'), - (0xFD57, 'M', 'تمخ'), - (0xFD58, 'M', 'جمح'), - (0xFD5A, 'M', 'حمي'), - (0xFD5B, 'M', 'حمى'), - (0xFD5C, 'M', 'سحج'), - (0xFD5D, 'M', 'سجح'), - (0xFD5E, 'M', 'سجى'), - (0xFD5F, 'M', 'سمح'), - (0xFD61, 'M', 'سمج'), - (0xFD62, 'M', 'سمم'), - (0xFD64, 'M', 'صحح'), - (0xFD66, 'M', 'صمم'), - (0xFD67, 'M', 'شحم'), - (0xFD69, 'M', 'شجي'), - (0xFD6A, 'M', 'شمخ'), - (0xFD6C, 'M', 'شمم'), - (0xFD6E, 'M', 'ضحى'), - (0xFD6F, 'M', 'ضخم'), - (0xFD71, 'M', 'طمح'), - (0xFD73, 'M', 'طمم'), - (0xFD74, 'M', 'طمي'), - (0xFD75, 'M', 'عجم'), - (0xFD76, 'M', 'عمم'), - (0xFD78, 'M', 'عمى'), - (0xFD79, 'M', 'غمم'), - (0xFD7A, 'M', 'غمي'), - (0xFD7B, 'M', 'غمى'), - (0xFD7C, 'M', 'فخم'), - (0xFD7E, 'M', 'قمح'), - (0xFD7F, 'M', 'قمم'), - (0xFD80, 'M', 'لحم'), - (0xFD81, 'M', 'لحي'), - (0xFD82, 'M', 'لحى'), - (0xFD83, 'M', 'لجج'), - (0xFD85, 'M', 'لخم'), - (0xFD87, 'M', 'لمح'), - (0xFD89, 'M', 'محج'), - (0xFD8A, 'M', 'محم'), - (0xFD8B, 'M', 'محي'), - (0xFD8C, 'M', 'مجح'), - (0xFD8D, 'M', 'مجم'), - (0xFD8E, 'M', 'مخج'), - (0xFD8F, 'M', 'مخم'), - (0xFD90, 'X'), - (0xFD92, 'M', 'مجخ'), - (0xFD93, 'M', 'همج'), - (0xFD94, 'M', 'همم'), - (0xFD95, 'M', 'نحم'), - (0xFD96, 'M', 'نحى'), - (0xFD97, 'M', 'نجم'), - (0xFD99, 'M', 'نجى'), - (0xFD9A, 'M', 'نمي'), - (0xFD9B, 'M', 'نمى'), - (0xFD9C, 'M', 'يمم'), - (0xFD9E, 'M', 'بخي'), - (0xFD9F, 'M', 'تجي'), - (0xFDA0, 'M', 'تجى'), - (0xFDA1, 'M', 'تخي'), - (0xFDA2, 'M', 'تخى'), - (0xFDA3, 'M', 'تمي'), - (0xFDA4, 'M', 'تمى'), - (0xFDA5, 'M', 'جمي'), - (0xFDA6, 'M', 'جحى'), - ] - -def _seg_49() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFDA7, 'M', 'جمى'), - (0xFDA8, 'M', 'سخى'), - (0xFDA9, 'M', 'صحي'), - (0xFDAA, 'M', 'شحي'), - (0xFDAB, 'M', 'ضحي'), - (0xFDAC, 'M', 'لجي'), - (0xFDAD, 'M', 'لمي'), - (0xFDAE, 'M', 'يحي'), - (0xFDAF, 'M', 'يجي'), - (0xFDB0, 'M', 'يمي'), - (0xFDB1, 'M', 'ممي'), - (0xFDB2, 'M', 'قمي'), - (0xFDB3, 'M', 'نحي'), - (0xFDB4, 'M', 'قمح'), - (0xFDB5, 'M', 'لحم'), - (0xFDB6, 'M', 'عمي'), - (0xFDB7, 'M', 'كمي'), - (0xFDB8, 'M', 'نجح'), - (0xFDB9, 'M', 'مخي'), - (0xFDBA, 'M', 'لجم'), - (0xFDBB, 'M', 'كمم'), - (0xFDBC, 'M', 'لجم'), - (0xFDBD, 'M', 'نجح'), - (0xFDBE, 'M', 'جحي'), - (0xFDBF, 'M', 'حجي'), - (0xFDC0, 'M', 'مجي'), - (0xFDC1, 'M', 'فمي'), - (0xFDC2, 'M', 'بحي'), - (0xFDC3, 'M', 'كمم'), - (0xFDC4, 'M', 'عجم'), - (0xFDC5, 'M', 'صمم'), - (0xFDC6, 'M', 'سخي'), - (0xFDC7, 'M', 'نجي'), - (0xFDC8, 'X'), - (0xFDCF, 'V'), - (0xFDD0, 'X'), - (0xFDF0, 'M', 'صلے'), - (0xFDF1, 'M', 'قلے'), - (0xFDF2, 'M', 'الله'), - (0xFDF3, 'M', 'اكبر'), - (0xFDF4, 'M', 'محمد'), - (0xFDF5, 'M', 'صلعم'), - (0xFDF6, 'M', 'رسول'), - (0xFDF7, 'M', 'عليه'), - (0xFDF8, 'M', 'وسلم'), - (0xFDF9, 'M', 'صلى'), - (0xFDFA, '3', 'صلى الله عليه وسلم'), - (0xFDFB, '3', 'جل جلاله'), - (0xFDFC, 'M', 'ریال'), - (0xFDFD, 'V'), - (0xFE00, 'I'), - (0xFE10, '3', ','), - (0xFE11, 'M', '、'), - (0xFE12, 'X'), - (0xFE13, '3', ':'), - (0xFE14, '3', ';'), - (0xFE15, '3', '!'), - (0xFE16, '3', '?'), - (0xFE17, 'M', '〖'), - (0xFE18, 'M', '〗'), - (0xFE19, 'X'), - (0xFE20, 'V'), - (0xFE30, 'X'), - (0xFE31, 'M', '—'), - (0xFE32, 'M', '–'), - (0xFE33, '3', '_'), - (0xFE35, '3', '('), - (0xFE36, '3', ')'), - (0xFE37, '3', '{'), - (0xFE38, '3', '}'), - (0xFE39, 'M', '〔'), - (0xFE3A, 'M', '〕'), - (0xFE3B, 'M', '【'), - (0xFE3C, 'M', '】'), - (0xFE3D, 'M', '《'), - (0xFE3E, 'M', '》'), - (0xFE3F, 'M', '〈'), - (0xFE40, 'M', '〉'), - (0xFE41, 'M', '「'), - (0xFE42, 'M', '」'), - (0xFE43, 'M', '『'), - (0xFE44, 'M', '』'), - (0xFE45, 'V'), - (0xFE47, '3', '['), - (0xFE48, '3', ']'), - (0xFE49, '3', ' ̅'), - (0xFE4D, '3', '_'), - (0xFE50, '3', ','), - (0xFE51, 'M', '、'), - (0xFE52, 'X'), - (0xFE54, '3', ';'), - (0xFE55, '3', ':'), - (0xFE56, '3', '?'), - (0xFE57, '3', '!'), - (0xFE58, 'M', '—'), - (0xFE59, '3', '('), - (0xFE5A, '3', ')'), - (0xFE5B, '3', '{'), - (0xFE5C, '3', '}'), - (0xFE5D, 'M', '〔'), - ] - -def _seg_50() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFE5E, 'M', '〕'), - (0xFE5F, '3', '#'), - (0xFE60, '3', '&'), - (0xFE61, '3', '*'), - (0xFE62, '3', '+'), - (0xFE63, 'M', '-'), - (0xFE64, '3', '<'), - (0xFE65, '3', '>'), - (0xFE66, '3', '='), - (0xFE67, 'X'), - (0xFE68, '3', '\\'), - (0xFE69, '3', '$'), - (0xFE6A, '3', '%'), - (0xFE6B, '3', '@'), - (0xFE6C, 'X'), - (0xFE70, '3', ' ً'), - (0xFE71, 'M', 'ـً'), - (0xFE72, '3', ' ٌ'), - (0xFE73, 'V'), - (0xFE74, '3', ' ٍ'), - (0xFE75, 'X'), - (0xFE76, '3', ' َ'), - (0xFE77, 'M', 'ـَ'), - (0xFE78, '3', ' ُ'), - (0xFE79, 'M', 'ـُ'), - (0xFE7A, '3', ' ِ'), - (0xFE7B, 'M', 'ـِ'), - (0xFE7C, '3', ' ّ'), - (0xFE7D, 'M', 'ـّ'), - (0xFE7E, '3', ' ْ'), - (0xFE7F, 'M', 'ـْ'), - (0xFE80, 'M', 'ء'), - (0xFE81, 'M', 'آ'), - (0xFE83, 'M', 'أ'), - (0xFE85, 'M', 'ؤ'), - (0xFE87, 'M', 'إ'), - (0xFE89, 'M', 'ئ'), - (0xFE8D, 'M', 'ا'), - (0xFE8F, 'M', 'ب'), - (0xFE93, 'M', 'ة'), - (0xFE95, 'M', 'ت'), - (0xFE99, 'M', 'ث'), - (0xFE9D, 'M', 'ج'), - (0xFEA1, 'M', 'ح'), - (0xFEA5, 'M', 'خ'), - (0xFEA9, 'M', 'د'), - (0xFEAB, 'M', 'ذ'), - (0xFEAD, 'M', 'ر'), - (0xFEAF, 'M', 'ز'), - (0xFEB1, 'M', 'س'), - (0xFEB5, 'M', 'ش'), - (0xFEB9, 'M', 'ص'), - (0xFEBD, 'M', 'ض'), - (0xFEC1, 'M', 'ط'), - (0xFEC5, 'M', 'ظ'), - (0xFEC9, 'M', 'ع'), - (0xFECD, 'M', 'غ'), - (0xFED1, 'M', 'ف'), - (0xFED5, 'M', 'ق'), - (0xFED9, 'M', 'ك'), - (0xFEDD, 'M', 'ل'), - (0xFEE1, 'M', 'م'), - (0xFEE5, 'M', 'ن'), - (0xFEE9, 'M', 'ه'), - (0xFEED, 'M', 'و'), - (0xFEEF, 'M', 'ى'), - (0xFEF1, 'M', 'ي'), - (0xFEF5, 'M', 'لآ'), - (0xFEF7, 'M', 'لأ'), - (0xFEF9, 'M', 'لإ'), - (0xFEFB, 'M', 'لا'), - (0xFEFD, 'X'), - (0xFEFF, 'I'), - (0xFF00, 'X'), - (0xFF01, '3', '!'), - (0xFF02, '3', '"'), - (0xFF03, '3', '#'), - (0xFF04, '3', '$'), - (0xFF05, '3', '%'), - (0xFF06, '3', '&'), - (0xFF07, '3', '\''), - (0xFF08, '3', '('), - (0xFF09, '3', ')'), - (0xFF0A, '3', '*'), - (0xFF0B, '3', '+'), - (0xFF0C, '3', ','), - (0xFF0D, 'M', '-'), - (0xFF0E, 'M', '.'), - (0xFF0F, '3', '/'), - (0xFF10, 'M', '0'), - (0xFF11, 'M', '1'), - (0xFF12, 'M', '2'), - (0xFF13, 'M', '3'), - (0xFF14, 'M', '4'), - (0xFF15, 'M', '5'), - (0xFF16, 'M', '6'), - (0xFF17, 'M', '7'), - (0xFF18, 'M', '8'), - (0xFF19, 'M', '9'), - (0xFF1A, '3', ':'), - ] - -def _seg_51() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFF1B, '3', ';'), - (0xFF1C, '3', '<'), - (0xFF1D, '3', '='), - (0xFF1E, '3', '>'), - (0xFF1F, '3', '?'), - (0xFF20, '3', '@'), - (0xFF21, 'M', 'a'), - (0xFF22, 'M', 'b'), - (0xFF23, 'M', 'c'), - (0xFF24, 'M', 'd'), - (0xFF25, 'M', 'e'), - (0xFF26, 'M', 'f'), - (0xFF27, 'M', 'g'), - (0xFF28, 'M', 'h'), - (0xFF29, 'M', 'i'), - (0xFF2A, 'M', 'j'), - (0xFF2B, 'M', 'k'), - (0xFF2C, 'M', 'l'), - (0xFF2D, 'M', 'm'), - (0xFF2E, 'M', 'n'), - (0xFF2F, 'M', 'o'), - (0xFF30, 'M', 'p'), - (0xFF31, 'M', 'q'), - (0xFF32, 'M', 'r'), - (0xFF33, 'M', 's'), - (0xFF34, 'M', 't'), - (0xFF35, 'M', 'u'), - (0xFF36, 'M', 'v'), - (0xFF37, 'M', 'w'), - (0xFF38, 'M', 'x'), - (0xFF39, 'M', 'y'), - (0xFF3A, 'M', 'z'), - (0xFF3B, '3', '['), - (0xFF3C, '3', '\\'), - (0xFF3D, '3', ']'), - (0xFF3E, '3', '^'), - (0xFF3F, '3', '_'), - (0xFF40, '3', '`'), - (0xFF41, 'M', 'a'), - (0xFF42, 'M', 'b'), - (0xFF43, 'M', 'c'), - (0xFF44, 'M', 'd'), - (0xFF45, 'M', 'e'), - (0xFF46, 'M', 'f'), - (0xFF47, 'M', 'g'), - (0xFF48, 'M', 'h'), - (0xFF49, 'M', 'i'), - (0xFF4A, 'M', 'j'), - (0xFF4B, 'M', 'k'), - (0xFF4C, 'M', 'l'), - (0xFF4D, 'M', 'm'), - (0xFF4E, 'M', 'n'), - (0xFF4F, 'M', 'o'), - (0xFF50, 'M', 'p'), - (0xFF51, 'M', 'q'), - (0xFF52, 'M', 'r'), - (0xFF53, 'M', 's'), - (0xFF54, 'M', 't'), - (0xFF55, 'M', 'u'), - (0xFF56, 'M', 'v'), - (0xFF57, 'M', 'w'), - (0xFF58, 'M', 'x'), - (0xFF59, 'M', 'y'), - (0xFF5A, 'M', 'z'), - (0xFF5B, '3', '{'), - (0xFF5C, '3', '|'), - (0xFF5D, '3', '}'), - (0xFF5E, '3', '~'), - (0xFF5F, 'M', '⦅'), - (0xFF60, 'M', '⦆'), - (0xFF61, 'M', '.'), - (0xFF62, 'M', '「'), - (0xFF63, 'M', '」'), - (0xFF64, 'M', '、'), - (0xFF65, 'M', '・'), - (0xFF66, 'M', 'ヲ'), - (0xFF67, 'M', 'ァ'), - (0xFF68, 'M', 'ィ'), - (0xFF69, 'M', 'ゥ'), - (0xFF6A, 'M', 'ェ'), - (0xFF6B, 'M', 'ォ'), - (0xFF6C, 'M', 'ャ'), - (0xFF6D, 'M', 'ュ'), - (0xFF6E, 'M', 'ョ'), - (0xFF6F, 'M', 'ッ'), - (0xFF70, 'M', 'ー'), - (0xFF71, 'M', 'ア'), - (0xFF72, 'M', 'イ'), - (0xFF73, 'M', 'ウ'), - (0xFF74, 'M', 'エ'), - (0xFF75, 'M', 'オ'), - (0xFF76, 'M', 'カ'), - (0xFF77, 'M', 'キ'), - (0xFF78, 'M', 'ク'), - (0xFF79, 'M', 'ケ'), - (0xFF7A, 'M', 'コ'), - (0xFF7B, 'M', 'サ'), - (0xFF7C, 'M', 'シ'), - (0xFF7D, 'M', 'ス'), - (0xFF7E, 'M', 'セ'), - ] - -def _seg_52() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFF7F, 'M', 'ソ'), - (0xFF80, 'M', 'タ'), - (0xFF81, 'M', 'チ'), - (0xFF82, 'M', 'ツ'), - (0xFF83, 'M', 'テ'), - (0xFF84, 'M', 'ト'), - (0xFF85, 'M', 'ナ'), - (0xFF86, 'M', 'ニ'), - (0xFF87, 'M', 'ヌ'), - (0xFF88, 'M', 'ネ'), - (0xFF89, 'M', 'ノ'), - (0xFF8A, 'M', 'ハ'), - (0xFF8B, 'M', 'ヒ'), - (0xFF8C, 'M', 'フ'), - (0xFF8D, 'M', 'ヘ'), - (0xFF8E, 'M', 'ホ'), - (0xFF8F, 'M', 'マ'), - (0xFF90, 'M', 'ミ'), - (0xFF91, 'M', 'ム'), - (0xFF92, 'M', 'メ'), - (0xFF93, 'M', 'モ'), - (0xFF94, 'M', 'ヤ'), - (0xFF95, 'M', 'ユ'), - (0xFF96, 'M', 'ヨ'), - (0xFF97, 'M', 'ラ'), - (0xFF98, 'M', 'リ'), - (0xFF99, 'M', 'ル'), - (0xFF9A, 'M', 'レ'), - (0xFF9B, 'M', 'ロ'), - (0xFF9C, 'M', 'ワ'), - (0xFF9D, 'M', 'ン'), - (0xFF9E, 'M', '゙'), - (0xFF9F, 'M', '゚'), - (0xFFA0, 'X'), - (0xFFA1, 'M', 'ᄀ'), - (0xFFA2, 'M', 'ᄁ'), - (0xFFA3, 'M', 'ᆪ'), - (0xFFA4, 'M', 'ᄂ'), - (0xFFA5, 'M', 'ᆬ'), - (0xFFA6, 'M', 'ᆭ'), - (0xFFA7, 'M', 'ᄃ'), - (0xFFA8, 'M', 'ᄄ'), - (0xFFA9, 'M', 'ᄅ'), - (0xFFAA, 'M', 'ᆰ'), - (0xFFAB, 'M', 'ᆱ'), - (0xFFAC, 'M', 'ᆲ'), - (0xFFAD, 'M', 'ᆳ'), - (0xFFAE, 'M', 'ᆴ'), - (0xFFAF, 'M', 'ᆵ'), - (0xFFB0, 'M', 'ᄚ'), - (0xFFB1, 'M', 'ᄆ'), - (0xFFB2, 'M', 'ᄇ'), - (0xFFB3, 'M', 'ᄈ'), - (0xFFB4, 'M', 'ᄡ'), - (0xFFB5, 'M', 'ᄉ'), - (0xFFB6, 'M', 'ᄊ'), - (0xFFB7, 'M', 'ᄋ'), - (0xFFB8, 'M', 'ᄌ'), - (0xFFB9, 'M', 'ᄍ'), - (0xFFBA, 'M', 'ᄎ'), - (0xFFBB, 'M', 'ᄏ'), - (0xFFBC, 'M', 'ᄐ'), - (0xFFBD, 'M', 'ᄑ'), - (0xFFBE, 'M', 'ᄒ'), - (0xFFBF, 'X'), - (0xFFC2, 'M', 'ᅡ'), - (0xFFC3, 'M', 'ᅢ'), - (0xFFC4, 'M', 'ᅣ'), - (0xFFC5, 'M', 'ᅤ'), - (0xFFC6, 'M', 'ᅥ'), - (0xFFC7, 'M', 'ᅦ'), - (0xFFC8, 'X'), - (0xFFCA, 'M', 'ᅧ'), - (0xFFCB, 'M', 'ᅨ'), - (0xFFCC, 'M', 'ᅩ'), - (0xFFCD, 'M', 'ᅪ'), - (0xFFCE, 'M', 'ᅫ'), - (0xFFCF, 'M', 'ᅬ'), - (0xFFD0, 'X'), - (0xFFD2, 'M', 'ᅭ'), - (0xFFD3, 'M', 'ᅮ'), - (0xFFD4, 'M', 'ᅯ'), - (0xFFD5, 'M', 'ᅰ'), - (0xFFD6, 'M', 'ᅱ'), - (0xFFD7, 'M', 'ᅲ'), - (0xFFD8, 'X'), - (0xFFDA, 'M', 'ᅳ'), - (0xFFDB, 'M', 'ᅴ'), - (0xFFDC, 'M', 'ᅵ'), - (0xFFDD, 'X'), - (0xFFE0, 'M', '¢'), - (0xFFE1, 'M', '£'), - (0xFFE2, 'M', '¬'), - (0xFFE3, '3', ' ̄'), - (0xFFE4, 'M', '¦'), - (0xFFE5, 'M', '¥'), - (0xFFE6, 'M', '₩'), - (0xFFE7, 'X'), - (0xFFE8, 'M', '│'), - (0xFFE9, 'M', '←'), - ] - -def _seg_53() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFFEA, 'M', '↑'), - (0xFFEB, 'M', '→'), - (0xFFEC, 'M', '↓'), - (0xFFED, 'M', '■'), - (0xFFEE, 'M', '○'), - (0xFFEF, 'X'), - (0x10000, 'V'), - (0x1000C, 'X'), - (0x1000D, 'V'), - (0x10027, 'X'), - (0x10028, 'V'), - (0x1003B, 'X'), - (0x1003C, 'V'), - (0x1003E, 'X'), - (0x1003F, 'V'), - (0x1004E, 'X'), - (0x10050, 'V'), - (0x1005E, 'X'), - (0x10080, 'V'), - (0x100FB, 'X'), - (0x10100, 'V'), - (0x10103, 'X'), - (0x10107, 'V'), - (0x10134, 'X'), - (0x10137, 'V'), - (0x1018F, 'X'), - (0x10190, 'V'), - (0x1019D, 'X'), - (0x101A0, 'V'), - (0x101A1, 'X'), - (0x101D0, 'V'), - (0x101FE, 'X'), - (0x10280, 'V'), - (0x1029D, 'X'), - (0x102A0, 'V'), - (0x102D1, 'X'), - (0x102E0, 'V'), - (0x102FC, 'X'), - (0x10300, 'V'), - (0x10324, 'X'), - (0x1032D, 'V'), - (0x1034B, 'X'), - (0x10350, 'V'), - (0x1037B, 'X'), - (0x10380, 'V'), - (0x1039E, 'X'), - (0x1039F, 'V'), - (0x103C4, 'X'), - (0x103C8, 'V'), - (0x103D6, 'X'), - (0x10400, 'M', '𐐨'), - (0x10401, 'M', '𐐩'), - (0x10402, 'M', '𐐪'), - (0x10403, 'M', '𐐫'), - (0x10404, 'M', '𐐬'), - (0x10405, 'M', '𐐭'), - (0x10406, 'M', '𐐮'), - (0x10407, 'M', '𐐯'), - (0x10408, 'M', '𐐰'), - (0x10409, 'M', '𐐱'), - (0x1040A, 'M', '𐐲'), - (0x1040B, 'M', '𐐳'), - (0x1040C, 'M', '𐐴'), - (0x1040D, 'M', '𐐵'), - (0x1040E, 'M', '𐐶'), - (0x1040F, 'M', '𐐷'), - (0x10410, 'M', '𐐸'), - (0x10411, 'M', '𐐹'), - (0x10412, 'M', '𐐺'), - (0x10413, 'M', '𐐻'), - (0x10414, 'M', '𐐼'), - (0x10415, 'M', '𐐽'), - (0x10416, 'M', '𐐾'), - (0x10417, 'M', '𐐿'), - (0x10418, 'M', '𐑀'), - (0x10419, 'M', '𐑁'), - (0x1041A, 'M', '𐑂'), - (0x1041B, 'M', '𐑃'), - (0x1041C, 'M', '𐑄'), - (0x1041D, 'M', '𐑅'), - (0x1041E, 'M', '𐑆'), - (0x1041F, 'M', '𐑇'), - (0x10420, 'M', '𐑈'), - (0x10421, 'M', '𐑉'), - (0x10422, 'M', '𐑊'), - (0x10423, 'M', '𐑋'), - (0x10424, 'M', '𐑌'), - (0x10425, 'M', '𐑍'), - (0x10426, 'M', '𐑎'), - (0x10427, 'M', '𐑏'), - (0x10428, 'V'), - (0x1049E, 'X'), - (0x104A0, 'V'), - (0x104AA, 'X'), - (0x104B0, 'M', '𐓘'), - (0x104B1, 'M', '𐓙'), - (0x104B2, 'M', '𐓚'), - (0x104B3, 'M', '𐓛'), - (0x104B4, 'M', '𐓜'), - (0x104B5, 'M', '𐓝'), - ] - -def _seg_54() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x104B6, 'M', '𐓞'), - (0x104B7, 'M', '𐓟'), - (0x104B8, 'M', '𐓠'), - (0x104B9, 'M', '𐓡'), - (0x104BA, 'M', '𐓢'), - (0x104BB, 'M', '𐓣'), - (0x104BC, 'M', '𐓤'), - (0x104BD, 'M', '𐓥'), - (0x104BE, 'M', '𐓦'), - (0x104BF, 'M', '𐓧'), - (0x104C0, 'M', '𐓨'), - (0x104C1, 'M', '𐓩'), - (0x104C2, 'M', '𐓪'), - (0x104C3, 'M', '𐓫'), - (0x104C4, 'M', '𐓬'), - (0x104C5, 'M', '𐓭'), - (0x104C6, 'M', '𐓮'), - (0x104C7, 'M', '𐓯'), - (0x104C8, 'M', '𐓰'), - (0x104C9, 'M', '𐓱'), - (0x104CA, 'M', '𐓲'), - (0x104CB, 'M', '𐓳'), - (0x104CC, 'M', '𐓴'), - (0x104CD, 'M', '𐓵'), - (0x104CE, 'M', '𐓶'), - (0x104CF, 'M', '𐓷'), - (0x104D0, 'M', '𐓸'), - (0x104D1, 'M', '𐓹'), - (0x104D2, 'M', '𐓺'), - (0x104D3, 'M', '𐓻'), - (0x104D4, 'X'), - (0x104D8, 'V'), - (0x104FC, 'X'), - (0x10500, 'V'), - (0x10528, 'X'), - (0x10530, 'V'), - (0x10564, 'X'), - (0x1056F, 'V'), - (0x10570, 'M', '𐖗'), - (0x10571, 'M', '𐖘'), - (0x10572, 'M', '𐖙'), - (0x10573, 'M', '𐖚'), - (0x10574, 'M', '𐖛'), - (0x10575, 'M', '𐖜'), - (0x10576, 'M', '𐖝'), - (0x10577, 'M', '𐖞'), - (0x10578, 'M', '𐖟'), - (0x10579, 'M', '𐖠'), - (0x1057A, 'M', '𐖡'), - (0x1057B, 'X'), - (0x1057C, 'M', '𐖣'), - (0x1057D, 'M', '𐖤'), - (0x1057E, 'M', '𐖥'), - (0x1057F, 'M', '𐖦'), - (0x10580, 'M', '𐖧'), - (0x10581, 'M', '𐖨'), - (0x10582, 'M', '𐖩'), - (0x10583, 'M', '𐖪'), - (0x10584, 'M', '𐖫'), - (0x10585, 'M', '𐖬'), - (0x10586, 'M', '𐖭'), - (0x10587, 'M', '𐖮'), - (0x10588, 'M', '𐖯'), - (0x10589, 'M', '𐖰'), - (0x1058A, 'M', '𐖱'), - (0x1058B, 'X'), - (0x1058C, 'M', '𐖳'), - (0x1058D, 'M', '𐖴'), - (0x1058E, 'M', '𐖵'), - (0x1058F, 'M', '𐖶'), - (0x10590, 'M', '𐖷'), - (0x10591, 'M', '𐖸'), - (0x10592, 'M', '𐖹'), - (0x10593, 'X'), - (0x10594, 'M', '𐖻'), - (0x10595, 'M', '𐖼'), - (0x10596, 'X'), - (0x10597, 'V'), - (0x105A2, 'X'), - (0x105A3, 'V'), - (0x105B2, 'X'), - (0x105B3, 'V'), - (0x105BA, 'X'), - (0x105BB, 'V'), - (0x105BD, 'X'), - (0x10600, 'V'), - (0x10737, 'X'), - (0x10740, 'V'), - (0x10756, 'X'), - (0x10760, 'V'), - (0x10768, 'X'), - (0x10780, 'V'), - (0x10781, 'M', 'ː'), - (0x10782, 'M', 'ˑ'), - (0x10783, 'M', 'æ'), - (0x10784, 'M', 'ʙ'), - (0x10785, 'M', 'ɓ'), - (0x10786, 'X'), - (0x10787, 'M', 'ʣ'), - (0x10788, 'M', 'ꭦ'), - ] - -def _seg_55() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x10789, 'M', 'ʥ'), - (0x1078A, 'M', 'ʤ'), - (0x1078B, 'M', 'ɖ'), - (0x1078C, 'M', 'ɗ'), - (0x1078D, 'M', 'ᶑ'), - (0x1078E, 'M', 'ɘ'), - (0x1078F, 'M', 'ɞ'), - (0x10790, 'M', 'ʩ'), - (0x10791, 'M', 'ɤ'), - (0x10792, 'M', 'ɢ'), - (0x10793, 'M', 'ɠ'), - (0x10794, 'M', 'ʛ'), - (0x10795, 'M', 'ħ'), - (0x10796, 'M', 'ʜ'), - (0x10797, 'M', 'ɧ'), - (0x10798, 'M', 'ʄ'), - (0x10799, 'M', 'ʪ'), - (0x1079A, 'M', 'ʫ'), - (0x1079B, 'M', 'ɬ'), - (0x1079C, 'M', '𝼄'), - (0x1079D, 'M', 'ꞎ'), - (0x1079E, 'M', 'ɮ'), - (0x1079F, 'M', '𝼅'), - (0x107A0, 'M', 'ʎ'), - (0x107A1, 'M', '𝼆'), - (0x107A2, 'M', 'ø'), - (0x107A3, 'M', 'ɶ'), - (0x107A4, 'M', 'ɷ'), - (0x107A5, 'M', 'q'), - (0x107A6, 'M', 'ɺ'), - (0x107A7, 'M', '𝼈'), - (0x107A8, 'M', 'ɽ'), - (0x107A9, 'M', 'ɾ'), - (0x107AA, 'M', 'ʀ'), - (0x107AB, 'M', 'ʨ'), - (0x107AC, 'M', 'ʦ'), - (0x107AD, 'M', 'ꭧ'), - (0x107AE, 'M', 'ʧ'), - (0x107AF, 'M', 'ʈ'), - (0x107B0, 'M', 'ⱱ'), - (0x107B1, 'X'), - (0x107B2, 'M', 'ʏ'), - (0x107B3, 'M', 'ʡ'), - (0x107B4, 'M', 'ʢ'), - (0x107B5, 'M', 'ʘ'), - (0x107B6, 'M', 'ǀ'), - (0x107B7, 'M', 'ǁ'), - (0x107B8, 'M', 'ǂ'), - (0x107B9, 'M', '𝼊'), - (0x107BA, 'M', '𝼞'), - (0x107BB, 'X'), - (0x10800, 'V'), - (0x10806, 'X'), - (0x10808, 'V'), - (0x10809, 'X'), - (0x1080A, 'V'), - (0x10836, 'X'), - (0x10837, 'V'), - (0x10839, 'X'), - (0x1083C, 'V'), - (0x1083D, 'X'), - (0x1083F, 'V'), - (0x10856, 'X'), - (0x10857, 'V'), - (0x1089F, 'X'), - (0x108A7, 'V'), - (0x108B0, 'X'), - (0x108E0, 'V'), - (0x108F3, 'X'), - (0x108F4, 'V'), - (0x108F6, 'X'), - (0x108FB, 'V'), - (0x1091C, 'X'), - (0x1091F, 'V'), - (0x1093A, 'X'), - (0x1093F, 'V'), - (0x10940, 'X'), - (0x10980, 'V'), - (0x109B8, 'X'), - (0x109BC, 'V'), - (0x109D0, 'X'), - (0x109D2, 'V'), - (0x10A04, 'X'), - (0x10A05, 'V'), - (0x10A07, 'X'), - (0x10A0C, 'V'), - (0x10A14, 'X'), - (0x10A15, 'V'), - (0x10A18, 'X'), - (0x10A19, 'V'), - (0x10A36, 'X'), - (0x10A38, 'V'), - (0x10A3B, 'X'), - (0x10A3F, 'V'), - (0x10A49, 'X'), - (0x10A50, 'V'), - (0x10A59, 'X'), - (0x10A60, 'V'), - (0x10AA0, 'X'), - (0x10AC0, 'V'), - ] - -def _seg_56() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x10AE7, 'X'), - (0x10AEB, 'V'), - (0x10AF7, 'X'), - (0x10B00, 'V'), - (0x10B36, 'X'), - (0x10B39, 'V'), - (0x10B56, 'X'), - (0x10B58, 'V'), - (0x10B73, 'X'), - (0x10B78, 'V'), - (0x10B92, 'X'), - (0x10B99, 'V'), - (0x10B9D, 'X'), - (0x10BA9, 'V'), - (0x10BB0, 'X'), - (0x10C00, 'V'), - (0x10C49, 'X'), - (0x10C80, 'M', '𐳀'), - (0x10C81, 'M', '𐳁'), - (0x10C82, 'M', '𐳂'), - (0x10C83, 'M', '𐳃'), - (0x10C84, 'M', '𐳄'), - (0x10C85, 'M', '𐳅'), - (0x10C86, 'M', '𐳆'), - (0x10C87, 'M', '𐳇'), - (0x10C88, 'M', '𐳈'), - (0x10C89, 'M', '𐳉'), - (0x10C8A, 'M', '𐳊'), - (0x10C8B, 'M', '𐳋'), - (0x10C8C, 'M', '𐳌'), - (0x10C8D, 'M', '𐳍'), - (0x10C8E, 'M', '𐳎'), - (0x10C8F, 'M', '𐳏'), - (0x10C90, 'M', '𐳐'), - (0x10C91, 'M', '𐳑'), - (0x10C92, 'M', '𐳒'), - (0x10C93, 'M', '𐳓'), - (0x10C94, 'M', '𐳔'), - (0x10C95, 'M', '𐳕'), - (0x10C96, 'M', '𐳖'), - (0x10C97, 'M', '𐳗'), - (0x10C98, 'M', '𐳘'), - (0x10C99, 'M', '𐳙'), - (0x10C9A, 'M', '𐳚'), - (0x10C9B, 'M', '𐳛'), - (0x10C9C, 'M', '𐳜'), - (0x10C9D, 'M', '𐳝'), - (0x10C9E, 'M', '𐳞'), - (0x10C9F, 'M', '𐳟'), - (0x10CA0, 'M', '𐳠'), - (0x10CA1, 'M', '𐳡'), - (0x10CA2, 'M', '𐳢'), - (0x10CA3, 'M', '𐳣'), - (0x10CA4, 'M', '𐳤'), - (0x10CA5, 'M', '𐳥'), - (0x10CA6, 'M', '𐳦'), - (0x10CA7, 'M', '𐳧'), - (0x10CA8, 'M', '𐳨'), - (0x10CA9, 'M', '𐳩'), - (0x10CAA, 'M', '𐳪'), - (0x10CAB, 'M', '𐳫'), - (0x10CAC, 'M', '𐳬'), - (0x10CAD, 'M', '𐳭'), - (0x10CAE, 'M', '𐳮'), - (0x10CAF, 'M', '𐳯'), - (0x10CB0, 'M', '𐳰'), - (0x10CB1, 'M', '𐳱'), - (0x10CB2, 'M', '𐳲'), - (0x10CB3, 'X'), - (0x10CC0, 'V'), - (0x10CF3, 'X'), - (0x10CFA, 'V'), - (0x10D28, 'X'), - (0x10D30, 'V'), - (0x10D3A, 'X'), - (0x10E60, 'V'), - (0x10E7F, 'X'), - (0x10E80, 'V'), - (0x10EAA, 'X'), - (0x10EAB, 'V'), - (0x10EAE, 'X'), - (0x10EB0, 'V'), - (0x10EB2, 'X'), - (0x10EFD, 'V'), - (0x10F28, 'X'), - (0x10F30, 'V'), - (0x10F5A, 'X'), - (0x10F70, 'V'), - (0x10F8A, 'X'), - (0x10FB0, 'V'), - (0x10FCC, 'X'), - (0x10FE0, 'V'), - (0x10FF7, 'X'), - (0x11000, 'V'), - (0x1104E, 'X'), - (0x11052, 'V'), - (0x11076, 'X'), - (0x1107F, 'V'), - (0x110BD, 'X'), - (0x110BE, 'V'), - ] - -def _seg_57() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x110C3, 'X'), - (0x110D0, 'V'), - (0x110E9, 'X'), - (0x110F0, 'V'), - (0x110FA, 'X'), - (0x11100, 'V'), - (0x11135, 'X'), - (0x11136, 'V'), - (0x11148, 'X'), - (0x11150, 'V'), - (0x11177, 'X'), - (0x11180, 'V'), - (0x111E0, 'X'), - (0x111E1, 'V'), - (0x111F5, 'X'), - (0x11200, 'V'), - (0x11212, 'X'), - (0x11213, 'V'), - (0x11242, 'X'), - (0x11280, 'V'), - (0x11287, 'X'), - (0x11288, 'V'), - (0x11289, 'X'), - (0x1128A, 'V'), - (0x1128E, 'X'), - (0x1128F, 'V'), - (0x1129E, 'X'), - (0x1129F, 'V'), - (0x112AA, 'X'), - (0x112B0, 'V'), - (0x112EB, 'X'), - (0x112F0, 'V'), - (0x112FA, 'X'), - (0x11300, 'V'), - (0x11304, 'X'), - (0x11305, 'V'), - (0x1130D, 'X'), - (0x1130F, 'V'), - (0x11311, 'X'), - (0x11313, 'V'), - (0x11329, 'X'), - (0x1132A, 'V'), - (0x11331, 'X'), - (0x11332, 'V'), - (0x11334, 'X'), - (0x11335, 'V'), - (0x1133A, 'X'), - (0x1133B, 'V'), - (0x11345, 'X'), - (0x11347, 'V'), - (0x11349, 'X'), - (0x1134B, 'V'), - (0x1134E, 'X'), - (0x11350, 'V'), - (0x11351, 'X'), - (0x11357, 'V'), - (0x11358, 'X'), - (0x1135D, 'V'), - (0x11364, 'X'), - (0x11366, 'V'), - (0x1136D, 'X'), - (0x11370, 'V'), - (0x11375, 'X'), - (0x11400, 'V'), - (0x1145C, 'X'), - (0x1145D, 'V'), - (0x11462, 'X'), - (0x11480, 'V'), - (0x114C8, 'X'), - (0x114D0, 'V'), - (0x114DA, 'X'), - (0x11580, 'V'), - (0x115B6, 'X'), - (0x115B8, 'V'), - (0x115DE, 'X'), - (0x11600, 'V'), - (0x11645, 'X'), - (0x11650, 'V'), - (0x1165A, 'X'), - (0x11660, 'V'), - (0x1166D, 'X'), - (0x11680, 'V'), - (0x116BA, 'X'), - (0x116C0, 'V'), - (0x116CA, 'X'), - (0x11700, 'V'), - (0x1171B, 'X'), - (0x1171D, 'V'), - (0x1172C, 'X'), - (0x11730, 'V'), - (0x11747, 'X'), - (0x11800, 'V'), - (0x1183C, 'X'), - (0x118A0, 'M', '𑣀'), - (0x118A1, 'M', '𑣁'), - (0x118A2, 'M', '𑣂'), - (0x118A3, 'M', '𑣃'), - (0x118A4, 'M', '𑣄'), - (0x118A5, 'M', '𑣅'), - (0x118A6, 'M', '𑣆'), - ] - -def _seg_58() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x118A7, 'M', '𑣇'), - (0x118A8, 'M', '𑣈'), - (0x118A9, 'M', '𑣉'), - (0x118AA, 'M', '𑣊'), - (0x118AB, 'M', '𑣋'), - (0x118AC, 'M', '𑣌'), - (0x118AD, 'M', '𑣍'), - (0x118AE, 'M', '𑣎'), - (0x118AF, 'M', '𑣏'), - (0x118B0, 'M', '𑣐'), - (0x118B1, 'M', '𑣑'), - (0x118B2, 'M', '𑣒'), - (0x118B3, 'M', '𑣓'), - (0x118B4, 'M', '𑣔'), - (0x118B5, 'M', '𑣕'), - (0x118B6, 'M', '𑣖'), - (0x118B7, 'M', '𑣗'), - (0x118B8, 'M', '𑣘'), - (0x118B9, 'M', '𑣙'), - (0x118BA, 'M', '𑣚'), - (0x118BB, 'M', '𑣛'), - (0x118BC, 'M', '𑣜'), - (0x118BD, 'M', '𑣝'), - (0x118BE, 'M', '𑣞'), - (0x118BF, 'M', '𑣟'), - (0x118C0, 'V'), - (0x118F3, 'X'), - (0x118FF, 'V'), - (0x11907, 'X'), - (0x11909, 'V'), - (0x1190A, 'X'), - (0x1190C, 'V'), - (0x11914, 'X'), - (0x11915, 'V'), - (0x11917, 'X'), - (0x11918, 'V'), - (0x11936, 'X'), - (0x11937, 'V'), - (0x11939, 'X'), - (0x1193B, 'V'), - (0x11947, 'X'), - (0x11950, 'V'), - (0x1195A, 'X'), - (0x119A0, 'V'), - (0x119A8, 'X'), - (0x119AA, 'V'), - (0x119D8, 'X'), - (0x119DA, 'V'), - (0x119E5, 'X'), - (0x11A00, 'V'), - (0x11A48, 'X'), - (0x11A50, 'V'), - (0x11AA3, 'X'), - (0x11AB0, 'V'), - (0x11AF9, 'X'), - (0x11B00, 'V'), - (0x11B0A, 'X'), - (0x11C00, 'V'), - (0x11C09, 'X'), - (0x11C0A, 'V'), - (0x11C37, 'X'), - (0x11C38, 'V'), - (0x11C46, 'X'), - (0x11C50, 'V'), - (0x11C6D, 'X'), - (0x11C70, 'V'), - (0x11C90, 'X'), - (0x11C92, 'V'), - (0x11CA8, 'X'), - (0x11CA9, 'V'), - (0x11CB7, 'X'), - (0x11D00, 'V'), - (0x11D07, 'X'), - (0x11D08, 'V'), - (0x11D0A, 'X'), - (0x11D0B, 'V'), - (0x11D37, 'X'), - (0x11D3A, 'V'), - (0x11D3B, 'X'), - (0x11D3C, 'V'), - (0x11D3E, 'X'), - (0x11D3F, 'V'), - (0x11D48, 'X'), - (0x11D50, 'V'), - (0x11D5A, 'X'), - (0x11D60, 'V'), - (0x11D66, 'X'), - (0x11D67, 'V'), - (0x11D69, 'X'), - (0x11D6A, 'V'), - (0x11D8F, 'X'), - (0x11D90, 'V'), - (0x11D92, 'X'), - (0x11D93, 'V'), - (0x11D99, 'X'), - (0x11DA0, 'V'), - (0x11DAA, 'X'), - (0x11EE0, 'V'), - (0x11EF9, 'X'), - (0x11F00, 'V'), - ] - -def _seg_59() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x11F11, 'X'), - (0x11F12, 'V'), - (0x11F3B, 'X'), - (0x11F3E, 'V'), - (0x11F5A, 'X'), - (0x11FB0, 'V'), - (0x11FB1, 'X'), - (0x11FC0, 'V'), - (0x11FF2, 'X'), - (0x11FFF, 'V'), - (0x1239A, 'X'), - (0x12400, 'V'), - (0x1246F, 'X'), - (0x12470, 'V'), - (0x12475, 'X'), - (0x12480, 'V'), - (0x12544, 'X'), - (0x12F90, 'V'), - (0x12FF3, 'X'), - (0x13000, 'V'), - (0x13430, 'X'), - (0x13440, 'V'), - (0x13456, 'X'), - (0x14400, 'V'), - (0x14647, 'X'), - (0x16800, 'V'), - (0x16A39, 'X'), - (0x16A40, 'V'), - (0x16A5F, 'X'), - (0x16A60, 'V'), - (0x16A6A, 'X'), - (0x16A6E, 'V'), - (0x16ABF, 'X'), - (0x16AC0, 'V'), - (0x16ACA, 'X'), - (0x16AD0, 'V'), - (0x16AEE, 'X'), - (0x16AF0, 'V'), - (0x16AF6, 'X'), - (0x16B00, 'V'), - (0x16B46, 'X'), - (0x16B50, 'V'), - (0x16B5A, 'X'), - (0x16B5B, 'V'), - (0x16B62, 'X'), - (0x16B63, 'V'), - (0x16B78, 'X'), - (0x16B7D, 'V'), - (0x16B90, 'X'), - (0x16E40, 'M', '𖹠'), - (0x16E41, 'M', '𖹡'), - (0x16E42, 'M', '𖹢'), - (0x16E43, 'M', '𖹣'), - (0x16E44, 'M', '𖹤'), - (0x16E45, 'M', '𖹥'), - (0x16E46, 'M', '𖹦'), - (0x16E47, 'M', '𖹧'), - (0x16E48, 'M', '𖹨'), - (0x16E49, 'M', '𖹩'), - (0x16E4A, 'M', '𖹪'), - (0x16E4B, 'M', '𖹫'), - (0x16E4C, 'M', '𖹬'), - (0x16E4D, 'M', '𖹭'), - (0x16E4E, 'M', '𖹮'), - (0x16E4F, 'M', '𖹯'), - (0x16E50, 'M', '𖹰'), - (0x16E51, 'M', '𖹱'), - (0x16E52, 'M', '𖹲'), - (0x16E53, 'M', '𖹳'), - (0x16E54, 'M', '𖹴'), - (0x16E55, 'M', '𖹵'), - (0x16E56, 'M', '𖹶'), - (0x16E57, 'M', '𖹷'), - (0x16E58, 'M', '𖹸'), - (0x16E59, 'M', '𖹹'), - (0x16E5A, 'M', '𖹺'), - (0x16E5B, 'M', '𖹻'), - (0x16E5C, 'M', '𖹼'), - (0x16E5D, 'M', '𖹽'), - (0x16E5E, 'M', '𖹾'), - (0x16E5F, 'M', '𖹿'), - (0x16E60, 'V'), - (0x16E9B, 'X'), - (0x16F00, 'V'), - (0x16F4B, 'X'), - (0x16F4F, 'V'), - (0x16F88, 'X'), - (0x16F8F, 'V'), - (0x16FA0, 'X'), - (0x16FE0, 'V'), - (0x16FE5, 'X'), - (0x16FF0, 'V'), - (0x16FF2, 'X'), - (0x17000, 'V'), - (0x187F8, 'X'), - (0x18800, 'V'), - (0x18CD6, 'X'), - (0x18D00, 'V'), - (0x18D09, 'X'), - (0x1AFF0, 'V'), - ] - -def _seg_60() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1AFF4, 'X'), - (0x1AFF5, 'V'), - (0x1AFFC, 'X'), - (0x1AFFD, 'V'), - (0x1AFFF, 'X'), - (0x1B000, 'V'), - (0x1B123, 'X'), - (0x1B132, 'V'), - (0x1B133, 'X'), - (0x1B150, 'V'), - (0x1B153, 'X'), - (0x1B155, 'V'), - (0x1B156, 'X'), - (0x1B164, 'V'), - (0x1B168, 'X'), - (0x1B170, 'V'), - (0x1B2FC, 'X'), - (0x1BC00, 'V'), - (0x1BC6B, 'X'), - (0x1BC70, 'V'), - (0x1BC7D, 'X'), - (0x1BC80, 'V'), - (0x1BC89, 'X'), - (0x1BC90, 'V'), - (0x1BC9A, 'X'), - (0x1BC9C, 'V'), - (0x1BCA0, 'I'), - (0x1BCA4, 'X'), - (0x1CF00, 'V'), - (0x1CF2E, 'X'), - (0x1CF30, 'V'), - (0x1CF47, 'X'), - (0x1CF50, 'V'), - (0x1CFC4, 'X'), - (0x1D000, 'V'), - (0x1D0F6, 'X'), - (0x1D100, 'V'), - (0x1D127, 'X'), - (0x1D129, 'V'), - (0x1D15E, 'M', '𝅗𝅥'), - (0x1D15F, 'M', '𝅘𝅥'), - (0x1D160, 'M', '𝅘𝅥𝅮'), - (0x1D161, 'M', '𝅘𝅥𝅯'), - (0x1D162, 'M', '𝅘𝅥𝅰'), - (0x1D163, 'M', '𝅘𝅥𝅱'), - (0x1D164, 'M', '𝅘𝅥𝅲'), - (0x1D165, 'V'), - (0x1D173, 'X'), - (0x1D17B, 'V'), - (0x1D1BB, 'M', '𝆹𝅥'), - (0x1D1BC, 'M', '𝆺𝅥'), - (0x1D1BD, 'M', '𝆹𝅥𝅮'), - (0x1D1BE, 'M', '𝆺𝅥𝅮'), - (0x1D1BF, 'M', '𝆹𝅥𝅯'), - (0x1D1C0, 'M', '𝆺𝅥𝅯'), - (0x1D1C1, 'V'), - (0x1D1EB, 'X'), - (0x1D200, 'V'), - (0x1D246, 'X'), - (0x1D2C0, 'V'), - (0x1D2D4, 'X'), - (0x1D2E0, 'V'), - (0x1D2F4, 'X'), - (0x1D300, 'V'), - (0x1D357, 'X'), - (0x1D360, 'V'), - (0x1D379, 'X'), - (0x1D400, 'M', 'a'), - (0x1D401, 'M', 'b'), - (0x1D402, 'M', 'c'), - (0x1D403, 'M', 'd'), - (0x1D404, 'M', 'e'), - (0x1D405, 'M', 'f'), - (0x1D406, 'M', 'g'), - (0x1D407, 'M', 'h'), - (0x1D408, 'M', 'i'), - (0x1D409, 'M', 'j'), - (0x1D40A, 'M', 'k'), - (0x1D40B, 'M', 'l'), - (0x1D40C, 'M', 'm'), - (0x1D40D, 'M', 'n'), - (0x1D40E, 'M', 'o'), - (0x1D40F, 'M', 'p'), - (0x1D410, 'M', 'q'), - (0x1D411, 'M', 'r'), - (0x1D412, 'M', 's'), - (0x1D413, 'M', 't'), - (0x1D414, 'M', 'u'), - (0x1D415, 'M', 'v'), - (0x1D416, 'M', 'w'), - (0x1D417, 'M', 'x'), - (0x1D418, 'M', 'y'), - (0x1D419, 'M', 'z'), - (0x1D41A, 'M', 'a'), - (0x1D41B, 'M', 'b'), - (0x1D41C, 'M', 'c'), - (0x1D41D, 'M', 'd'), - (0x1D41E, 'M', 'e'), - (0x1D41F, 'M', 'f'), - (0x1D420, 'M', 'g'), - ] - -def _seg_61() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D421, 'M', 'h'), - (0x1D422, 'M', 'i'), - (0x1D423, 'M', 'j'), - (0x1D424, 'M', 'k'), - (0x1D425, 'M', 'l'), - (0x1D426, 'M', 'm'), - (0x1D427, 'M', 'n'), - (0x1D428, 'M', 'o'), - (0x1D429, 'M', 'p'), - (0x1D42A, 'M', 'q'), - (0x1D42B, 'M', 'r'), - (0x1D42C, 'M', 's'), - (0x1D42D, 'M', 't'), - (0x1D42E, 'M', 'u'), - (0x1D42F, 'M', 'v'), - (0x1D430, 'M', 'w'), - (0x1D431, 'M', 'x'), - (0x1D432, 'M', 'y'), - (0x1D433, 'M', 'z'), - (0x1D434, 'M', 'a'), - (0x1D435, 'M', 'b'), - (0x1D436, 'M', 'c'), - (0x1D437, 'M', 'd'), - (0x1D438, 'M', 'e'), - (0x1D439, 'M', 'f'), - (0x1D43A, 'M', 'g'), - (0x1D43B, 'M', 'h'), - (0x1D43C, 'M', 'i'), - (0x1D43D, 'M', 'j'), - (0x1D43E, 'M', 'k'), - (0x1D43F, 'M', 'l'), - (0x1D440, 'M', 'm'), - (0x1D441, 'M', 'n'), - (0x1D442, 'M', 'o'), - (0x1D443, 'M', 'p'), - (0x1D444, 'M', 'q'), - (0x1D445, 'M', 'r'), - (0x1D446, 'M', 's'), - (0x1D447, 'M', 't'), - (0x1D448, 'M', 'u'), - (0x1D449, 'M', 'v'), - (0x1D44A, 'M', 'w'), - (0x1D44B, 'M', 'x'), - (0x1D44C, 'M', 'y'), - (0x1D44D, 'M', 'z'), - (0x1D44E, 'M', 'a'), - (0x1D44F, 'M', 'b'), - (0x1D450, 'M', 'c'), - (0x1D451, 'M', 'd'), - (0x1D452, 'M', 'e'), - (0x1D453, 'M', 'f'), - (0x1D454, 'M', 'g'), - (0x1D455, 'X'), - (0x1D456, 'M', 'i'), - (0x1D457, 'M', 'j'), - (0x1D458, 'M', 'k'), - (0x1D459, 'M', 'l'), - (0x1D45A, 'M', 'm'), - (0x1D45B, 'M', 'n'), - (0x1D45C, 'M', 'o'), - (0x1D45D, 'M', 'p'), - (0x1D45E, 'M', 'q'), - (0x1D45F, 'M', 'r'), - (0x1D460, 'M', 's'), - (0x1D461, 'M', 't'), - (0x1D462, 'M', 'u'), - (0x1D463, 'M', 'v'), - (0x1D464, 'M', 'w'), - (0x1D465, 'M', 'x'), - (0x1D466, 'M', 'y'), - (0x1D467, 'M', 'z'), - (0x1D468, 'M', 'a'), - (0x1D469, 'M', 'b'), - (0x1D46A, 'M', 'c'), - (0x1D46B, 'M', 'd'), - (0x1D46C, 'M', 'e'), - (0x1D46D, 'M', 'f'), - (0x1D46E, 'M', 'g'), - (0x1D46F, 'M', 'h'), - (0x1D470, 'M', 'i'), - (0x1D471, 'M', 'j'), - (0x1D472, 'M', 'k'), - (0x1D473, 'M', 'l'), - (0x1D474, 'M', 'm'), - (0x1D475, 'M', 'n'), - (0x1D476, 'M', 'o'), - (0x1D477, 'M', 'p'), - (0x1D478, 'M', 'q'), - (0x1D479, 'M', 'r'), - (0x1D47A, 'M', 's'), - (0x1D47B, 'M', 't'), - (0x1D47C, 'M', 'u'), - (0x1D47D, 'M', 'v'), - (0x1D47E, 'M', 'w'), - (0x1D47F, 'M', 'x'), - (0x1D480, 'M', 'y'), - (0x1D481, 'M', 'z'), - (0x1D482, 'M', 'a'), - (0x1D483, 'M', 'b'), - (0x1D484, 'M', 'c'), - ] - -def _seg_62() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D485, 'M', 'd'), - (0x1D486, 'M', 'e'), - (0x1D487, 'M', 'f'), - (0x1D488, 'M', 'g'), - (0x1D489, 'M', 'h'), - (0x1D48A, 'M', 'i'), - (0x1D48B, 'M', 'j'), - (0x1D48C, 'M', 'k'), - (0x1D48D, 'M', 'l'), - (0x1D48E, 'M', 'm'), - (0x1D48F, 'M', 'n'), - (0x1D490, 'M', 'o'), - (0x1D491, 'M', 'p'), - (0x1D492, 'M', 'q'), - (0x1D493, 'M', 'r'), - (0x1D494, 'M', 's'), - (0x1D495, 'M', 't'), - (0x1D496, 'M', 'u'), - (0x1D497, 'M', 'v'), - (0x1D498, 'M', 'w'), - (0x1D499, 'M', 'x'), - (0x1D49A, 'M', 'y'), - (0x1D49B, 'M', 'z'), - (0x1D49C, 'M', 'a'), - (0x1D49D, 'X'), - (0x1D49E, 'M', 'c'), - (0x1D49F, 'M', 'd'), - (0x1D4A0, 'X'), - (0x1D4A2, 'M', 'g'), - (0x1D4A3, 'X'), - (0x1D4A5, 'M', 'j'), - (0x1D4A6, 'M', 'k'), - (0x1D4A7, 'X'), - (0x1D4A9, 'M', 'n'), - (0x1D4AA, 'M', 'o'), - (0x1D4AB, 'M', 'p'), - (0x1D4AC, 'M', 'q'), - (0x1D4AD, 'X'), - (0x1D4AE, 'M', 's'), - (0x1D4AF, 'M', 't'), - (0x1D4B0, 'M', 'u'), - (0x1D4B1, 'M', 'v'), - (0x1D4B2, 'M', 'w'), - (0x1D4B3, 'M', 'x'), - (0x1D4B4, 'M', 'y'), - (0x1D4B5, 'M', 'z'), - (0x1D4B6, 'M', 'a'), - (0x1D4B7, 'M', 'b'), - (0x1D4B8, 'M', 'c'), - (0x1D4B9, 'M', 'd'), - (0x1D4BA, 'X'), - (0x1D4BB, 'M', 'f'), - (0x1D4BC, 'X'), - (0x1D4BD, 'M', 'h'), - (0x1D4BE, 'M', 'i'), - (0x1D4BF, 'M', 'j'), - (0x1D4C0, 'M', 'k'), - (0x1D4C1, 'M', 'l'), - (0x1D4C2, 'M', 'm'), - (0x1D4C3, 'M', 'n'), - (0x1D4C4, 'X'), - (0x1D4C5, 'M', 'p'), - (0x1D4C6, 'M', 'q'), - (0x1D4C7, 'M', 'r'), - (0x1D4C8, 'M', 's'), - (0x1D4C9, 'M', 't'), - (0x1D4CA, 'M', 'u'), - (0x1D4CB, 'M', 'v'), - (0x1D4CC, 'M', 'w'), - (0x1D4CD, 'M', 'x'), - (0x1D4CE, 'M', 'y'), - (0x1D4CF, 'M', 'z'), - (0x1D4D0, 'M', 'a'), - (0x1D4D1, 'M', 'b'), - (0x1D4D2, 'M', 'c'), - (0x1D4D3, 'M', 'd'), - (0x1D4D4, 'M', 'e'), - (0x1D4D5, 'M', 'f'), - (0x1D4D6, 'M', 'g'), - (0x1D4D7, 'M', 'h'), - (0x1D4D8, 'M', 'i'), - (0x1D4D9, 'M', 'j'), - (0x1D4DA, 'M', 'k'), - (0x1D4DB, 'M', 'l'), - (0x1D4DC, 'M', 'm'), - (0x1D4DD, 'M', 'n'), - (0x1D4DE, 'M', 'o'), - (0x1D4DF, 'M', 'p'), - (0x1D4E0, 'M', 'q'), - (0x1D4E1, 'M', 'r'), - (0x1D4E2, 'M', 's'), - (0x1D4E3, 'M', 't'), - (0x1D4E4, 'M', 'u'), - (0x1D4E5, 'M', 'v'), - (0x1D4E6, 'M', 'w'), - (0x1D4E7, 'M', 'x'), - (0x1D4E8, 'M', 'y'), - (0x1D4E9, 'M', 'z'), - (0x1D4EA, 'M', 'a'), - (0x1D4EB, 'M', 'b'), - ] - -def _seg_63() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D4EC, 'M', 'c'), - (0x1D4ED, 'M', 'd'), - (0x1D4EE, 'M', 'e'), - (0x1D4EF, 'M', 'f'), - (0x1D4F0, 'M', 'g'), - (0x1D4F1, 'M', 'h'), - (0x1D4F2, 'M', 'i'), - (0x1D4F3, 'M', 'j'), - (0x1D4F4, 'M', 'k'), - (0x1D4F5, 'M', 'l'), - (0x1D4F6, 'M', 'm'), - (0x1D4F7, 'M', 'n'), - (0x1D4F8, 'M', 'o'), - (0x1D4F9, 'M', 'p'), - (0x1D4FA, 'M', 'q'), - (0x1D4FB, 'M', 'r'), - (0x1D4FC, 'M', 's'), - (0x1D4FD, 'M', 't'), - (0x1D4FE, 'M', 'u'), - (0x1D4FF, 'M', 'v'), - (0x1D500, 'M', 'w'), - (0x1D501, 'M', 'x'), - (0x1D502, 'M', 'y'), - (0x1D503, 'M', 'z'), - (0x1D504, 'M', 'a'), - (0x1D505, 'M', 'b'), - (0x1D506, 'X'), - (0x1D507, 'M', 'd'), - (0x1D508, 'M', 'e'), - (0x1D509, 'M', 'f'), - (0x1D50A, 'M', 'g'), - (0x1D50B, 'X'), - (0x1D50D, 'M', 'j'), - (0x1D50E, 'M', 'k'), - (0x1D50F, 'M', 'l'), - (0x1D510, 'M', 'm'), - (0x1D511, 'M', 'n'), - (0x1D512, 'M', 'o'), - (0x1D513, 'M', 'p'), - (0x1D514, 'M', 'q'), - (0x1D515, 'X'), - (0x1D516, 'M', 's'), - (0x1D517, 'M', 't'), - (0x1D518, 'M', 'u'), - (0x1D519, 'M', 'v'), - (0x1D51A, 'M', 'w'), - (0x1D51B, 'M', 'x'), - (0x1D51C, 'M', 'y'), - (0x1D51D, 'X'), - (0x1D51E, 'M', 'a'), - (0x1D51F, 'M', 'b'), - (0x1D520, 'M', 'c'), - (0x1D521, 'M', 'd'), - (0x1D522, 'M', 'e'), - (0x1D523, 'M', 'f'), - (0x1D524, 'M', 'g'), - (0x1D525, 'M', 'h'), - (0x1D526, 'M', 'i'), - (0x1D527, 'M', 'j'), - (0x1D528, 'M', 'k'), - (0x1D529, 'M', 'l'), - (0x1D52A, 'M', 'm'), - (0x1D52B, 'M', 'n'), - (0x1D52C, 'M', 'o'), - (0x1D52D, 'M', 'p'), - (0x1D52E, 'M', 'q'), - (0x1D52F, 'M', 'r'), - (0x1D530, 'M', 's'), - (0x1D531, 'M', 't'), - (0x1D532, 'M', 'u'), - (0x1D533, 'M', 'v'), - (0x1D534, 'M', 'w'), - (0x1D535, 'M', 'x'), - (0x1D536, 'M', 'y'), - (0x1D537, 'M', 'z'), - (0x1D538, 'M', 'a'), - (0x1D539, 'M', 'b'), - (0x1D53A, 'X'), - (0x1D53B, 'M', 'd'), - (0x1D53C, 'M', 'e'), - (0x1D53D, 'M', 'f'), - (0x1D53E, 'M', 'g'), - (0x1D53F, 'X'), - (0x1D540, 'M', 'i'), - (0x1D541, 'M', 'j'), - (0x1D542, 'M', 'k'), - (0x1D543, 'M', 'l'), - (0x1D544, 'M', 'm'), - (0x1D545, 'X'), - (0x1D546, 'M', 'o'), - (0x1D547, 'X'), - (0x1D54A, 'M', 's'), - (0x1D54B, 'M', 't'), - (0x1D54C, 'M', 'u'), - (0x1D54D, 'M', 'v'), - (0x1D54E, 'M', 'w'), - (0x1D54F, 'M', 'x'), - (0x1D550, 'M', 'y'), - (0x1D551, 'X'), - (0x1D552, 'M', 'a'), - ] - -def _seg_64() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D553, 'M', 'b'), - (0x1D554, 'M', 'c'), - (0x1D555, 'M', 'd'), - (0x1D556, 'M', 'e'), - (0x1D557, 'M', 'f'), - (0x1D558, 'M', 'g'), - (0x1D559, 'M', 'h'), - (0x1D55A, 'M', 'i'), - (0x1D55B, 'M', 'j'), - (0x1D55C, 'M', 'k'), - (0x1D55D, 'M', 'l'), - (0x1D55E, 'M', 'm'), - (0x1D55F, 'M', 'n'), - (0x1D560, 'M', 'o'), - (0x1D561, 'M', 'p'), - (0x1D562, 'M', 'q'), - (0x1D563, 'M', 'r'), - (0x1D564, 'M', 's'), - (0x1D565, 'M', 't'), - (0x1D566, 'M', 'u'), - (0x1D567, 'M', 'v'), - (0x1D568, 'M', 'w'), - (0x1D569, 'M', 'x'), - (0x1D56A, 'M', 'y'), - (0x1D56B, 'M', 'z'), - (0x1D56C, 'M', 'a'), - (0x1D56D, 'M', 'b'), - (0x1D56E, 'M', 'c'), - (0x1D56F, 'M', 'd'), - (0x1D570, 'M', 'e'), - (0x1D571, 'M', 'f'), - (0x1D572, 'M', 'g'), - (0x1D573, 'M', 'h'), - (0x1D574, 'M', 'i'), - (0x1D575, 'M', 'j'), - (0x1D576, 'M', 'k'), - (0x1D577, 'M', 'l'), - (0x1D578, 'M', 'm'), - (0x1D579, 'M', 'n'), - (0x1D57A, 'M', 'o'), - (0x1D57B, 'M', 'p'), - (0x1D57C, 'M', 'q'), - (0x1D57D, 'M', 'r'), - (0x1D57E, 'M', 's'), - (0x1D57F, 'M', 't'), - (0x1D580, 'M', 'u'), - (0x1D581, 'M', 'v'), - (0x1D582, 'M', 'w'), - (0x1D583, 'M', 'x'), - (0x1D584, 'M', 'y'), - (0x1D585, 'M', 'z'), - (0x1D586, 'M', 'a'), - (0x1D587, 'M', 'b'), - (0x1D588, 'M', 'c'), - (0x1D589, 'M', 'd'), - (0x1D58A, 'M', 'e'), - (0x1D58B, 'M', 'f'), - (0x1D58C, 'M', 'g'), - (0x1D58D, 'M', 'h'), - (0x1D58E, 'M', 'i'), - (0x1D58F, 'M', 'j'), - (0x1D590, 'M', 'k'), - (0x1D591, 'M', 'l'), - (0x1D592, 'M', 'm'), - (0x1D593, 'M', 'n'), - (0x1D594, 'M', 'o'), - (0x1D595, 'M', 'p'), - (0x1D596, 'M', 'q'), - (0x1D597, 'M', 'r'), - (0x1D598, 'M', 's'), - (0x1D599, 'M', 't'), - (0x1D59A, 'M', 'u'), - (0x1D59B, 'M', 'v'), - (0x1D59C, 'M', 'w'), - (0x1D59D, 'M', 'x'), - (0x1D59E, 'M', 'y'), - (0x1D59F, 'M', 'z'), - (0x1D5A0, 'M', 'a'), - (0x1D5A1, 'M', 'b'), - (0x1D5A2, 'M', 'c'), - (0x1D5A3, 'M', 'd'), - (0x1D5A4, 'M', 'e'), - (0x1D5A5, 'M', 'f'), - (0x1D5A6, 'M', 'g'), - (0x1D5A7, 'M', 'h'), - (0x1D5A8, 'M', 'i'), - (0x1D5A9, 'M', 'j'), - (0x1D5AA, 'M', 'k'), - (0x1D5AB, 'M', 'l'), - (0x1D5AC, 'M', 'm'), - (0x1D5AD, 'M', 'n'), - (0x1D5AE, 'M', 'o'), - (0x1D5AF, 'M', 'p'), - (0x1D5B0, 'M', 'q'), - (0x1D5B1, 'M', 'r'), - (0x1D5B2, 'M', 's'), - (0x1D5B3, 'M', 't'), - (0x1D5B4, 'M', 'u'), - (0x1D5B5, 'M', 'v'), - (0x1D5B6, 'M', 'w'), - ] - -def _seg_65() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D5B7, 'M', 'x'), - (0x1D5B8, 'M', 'y'), - (0x1D5B9, 'M', 'z'), - (0x1D5BA, 'M', 'a'), - (0x1D5BB, 'M', 'b'), - (0x1D5BC, 'M', 'c'), - (0x1D5BD, 'M', 'd'), - (0x1D5BE, 'M', 'e'), - (0x1D5BF, 'M', 'f'), - (0x1D5C0, 'M', 'g'), - (0x1D5C1, 'M', 'h'), - (0x1D5C2, 'M', 'i'), - (0x1D5C3, 'M', 'j'), - (0x1D5C4, 'M', 'k'), - (0x1D5C5, 'M', 'l'), - (0x1D5C6, 'M', 'm'), - (0x1D5C7, 'M', 'n'), - (0x1D5C8, 'M', 'o'), - (0x1D5C9, 'M', 'p'), - (0x1D5CA, 'M', 'q'), - (0x1D5CB, 'M', 'r'), - (0x1D5CC, 'M', 's'), - (0x1D5CD, 'M', 't'), - (0x1D5CE, 'M', 'u'), - (0x1D5CF, 'M', 'v'), - (0x1D5D0, 'M', 'w'), - (0x1D5D1, 'M', 'x'), - (0x1D5D2, 'M', 'y'), - (0x1D5D3, 'M', 'z'), - (0x1D5D4, 'M', 'a'), - (0x1D5D5, 'M', 'b'), - (0x1D5D6, 'M', 'c'), - (0x1D5D7, 'M', 'd'), - (0x1D5D8, 'M', 'e'), - (0x1D5D9, 'M', 'f'), - (0x1D5DA, 'M', 'g'), - (0x1D5DB, 'M', 'h'), - (0x1D5DC, 'M', 'i'), - (0x1D5DD, 'M', 'j'), - (0x1D5DE, 'M', 'k'), - (0x1D5DF, 'M', 'l'), - (0x1D5E0, 'M', 'm'), - (0x1D5E1, 'M', 'n'), - (0x1D5E2, 'M', 'o'), - (0x1D5E3, 'M', 'p'), - (0x1D5E4, 'M', 'q'), - (0x1D5E5, 'M', 'r'), - (0x1D5E6, 'M', 's'), - (0x1D5E7, 'M', 't'), - (0x1D5E8, 'M', 'u'), - (0x1D5E9, 'M', 'v'), - (0x1D5EA, 'M', 'w'), - (0x1D5EB, 'M', 'x'), - (0x1D5EC, 'M', 'y'), - (0x1D5ED, 'M', 'z'), - (0x1D5EE, 'M', 'a'), - (0x1D5EF, 'M', 'b'), - (0x1D5F0, 'M', 'c'), - (0x1D5F1, 'M', 'd'), - (0x1D5F2, 'M', 'e'), - (0x1D5F3, 'M', 'f'), - (0x1D5F4, 'M', 'g'), - (0x1D5F5, 'M', 'h'), - (0x1D5F6, 'M', 'i'), - (0x1D5F7, 'M', 'j'), - (0x1D5F8, 'M', 'k'), - (0x1D5F9, 'M', 'l'), - (0x1D5FA, 'M', 'm'), - (0x1D5FB, 'M', 'n'), - (0x1D5FC, 'M', 'o'), - (0x1D5FD, 'M', 'p'), - (0x1D5FE, 'M', 'q'), - (0x1D5FF, 'M', 'r'), - (0x1D600, 'M', 's'), - (0x1D601, 'M', 't'), - (0x1D602, 'M', 'u'), - (0x1D603, 'M', 'v'), - (0x1D604, 'M', 'w'), - (0x1D605, 'M', 'x'), - (0x1D606, 'M', 'y'), - (0x1D607, 'M', 'z'), - (0x1D608, 'M', 'a'), - (0x1D609, 'M', 'b'), - (0x1D60A, 'M', 'c'), - (0x1D60B, 'M', 'd'), - (0x1D60C, 'M', 'e'), - (0x1D60D, 'M', 'f'), - (0x1D60E, 'M', 'g'), - (0x1D60F, 'M', 'h'), - (0x1D610, 'M', 'i'), - (0x1D611, 'M', 'j'), - (0x1D612, 'M', 'k'), - (0x1D613, 'M', 'l'), - (0x1D614, 'M', 'm'), - (0x1D615, 'M', 'n'), - (0x1D616, 'M', 'o'), - (0x1D617, 'M', 'p'), - (0x1D618, 'M', 'q'), - (0x1D619, 'M', 'r'), - (0x1D61A, 'M', 's'), - ] - -def _seg_66() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D61B, 'M', 't'), - (0x1D61C, 'M', 'u'), - (0x1D61D, 'M', 'v'), - (0x1D61E, 'M', 'w'), - (0x1D61F, 'M', 'x'), - (0x1D620, 'M', 'y'), - (0x1D621, 'M', 'z'), - (0x1D622, 'M', 'a'), - (0x1D623, 'M', 'b'), - (0x1D624, 'M', 'c'), - (0x1D625, 'M', 'd'), - (0x1D626, 'M', 'e'), - (0x1D627, 'M', 'f'), - (0x1D628, 'M', 'g'), - (0x1D629, 'M', 'h'), - (0x1D62A, 'M', 'i'), - (0x1D62B, 'M', 'j'), - (0x1D62C, 'M', 'k'), - (0x1D62D, 'M', 'l'), - (0x1D62E, 'M', 'm'), - (0x1D62F, 'M', 'n'), - (0x1D630, 'M', 'o'), - (0x1D631, 'M', 'p'), - (0x1D632, 'M', 'q'), - (0x1D633, 'M', 'r'), - (0x1D634, 'M', 's'), - (0x1D635, 'M', 't'), - (0x1D636, 'M', 'u'), - (0x1D637, 'M', 'v'), - (0x1D638, 'M', 'w'), - (0x1D639, 'M', 'x'), - (0x1D63A, 'M', 'y'), - (0x1D63B, 'M', 'z'), - (0x1D63C, 'M', 'a'), - (0x1D63D, 'M', 'b'), - (0x1D63E, 'M', 'c'), - (0x1D63F, 'M', 'd'), - (0x1D640, 'M', 'e'), - (0x1D641, 'M', 'f'), - (0x1D642, 'M', 'g'), - (0x1D643, 'M', 'h'), - (0x1D644, 'M', 'i'), - (0x1D645, 'M', 'j'), - (0x1D646, 'M', 'k'), - (0x1D647, 'M', 'l'), - (0x1D648, 'M', 'm'), - (0x1D649, 'M', 'n'), - (0x1D64A, 'M', 'o'), - (0x1D64B, 'M', 'p'), - (0x1D64C, 'M', 'q'), - (0x1D64D, 'M', 'r'), - (0x1D64E, 'M', 's'), - (0x1D64F, 'M', 't'), - (0x1D650, 'M', 'u'), - (0x1D651, 'M', 'v'), - (0x1D652, 'M', 'w'), - (0x1D653, 'M', 'x'), - (0x1D654, 'M', 'y'), - (0x1D655, 'M', 'z'), - (0x1D656, 'M', 'a'), - (0x1D657, 'M', 'b'), - (0x1D658, 'M', 'c'), - (0x1D659, 'M', 'd'), - (0x1D65A, 'M', 'e'), - (0x1D65B, 'M', 'f'), - (0x1D65C, 'M', 'g'), - (0x1D65D, 'M', 'h'), - (0x1D65E, 'M', 'i'), - (0x1D65F, 'M', 'j'), - (0x1D660, 'M', 'k'), - (0x1D661, 'M', 'l'), - (0x1D662, 'M', 'm'), - (0x1D663, 'M', 'n'), - (0x1D664, 'M', 'o'), - (0x1D665, 'M', 'p'), - (0x1D666, 'M', 'q'), - (0x1D667, 'M', 'r'), - (0x1D668, 'M', 's'), - (0x1D669, 'M', 't'), - (0x1D66A, 'M', 'u'), - (0x1D66B, 'M', 'v'), - (0x1D66C, 'M', 'w'), - (0x1D66D, 'M', 'x'), - (0x1D66E, 'M', 'y'), - (0x1D66F, 'M', 'z'), - (0x1D670, 'M', 'a'), - (0x1D671, 'M', 'b'), - (0x1D672, 'M', 'c'), - (0x1D673, 'M', 'd'), - (0x1D674, 'M', 'e'), - (0x1D675, 'M', 'f'), - (0x1D676, 'M', 'g'), - (0x1D677, 'M', 'h'), - (0x1D678, 'M', 'i'), - (0x1D679, 'M', 'j'), - (0x1D67A, 'M', 'k'), - (0x1D67B, 'M', 'l'), - (0x1D67C, 'M', 'm'), - (0x1D67D, 'M', 'n'), - (0x1D67E, 'M', 'o'), - ] - -def _seg_67() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D67F, 'M', 'p'), - (0x1D680, 'M', 'q'), - (0x1D681, 'M', 'r'), - (0x1D682, 'M', 's'), - (0x1D683, 'M', 't'), - (0x1D684, 'M', 'u'), - (0x1D685, 'M', 'v'), - (0x1D686, 'M', 'w'), - (0x1D687, 'M', 'x'), - (0x1D688, 'M', 'y'), - (0x1D689, 'M', 'z'), - (0x1D68A, 'M', 'a'), - (0x1D68B, 'M', 'b'), - (0x1D68C, 'M', 'c'), - (0x1D68D, 'M', 'd'), - (0x1D68E, 'M', 'e'), - (0x1D68F, 'M', 'f'), - (0x1D690, 'M', 'g'), - (0x1D691, 'M', 'h'), - (0x1D692, 'M', 'i'), - (0x1D693, 'M', 'j'), - (0x1D694, 'M', 'k'), - (0x1D695, 'M', 'l'), - (0x1D696, 'M', 'm'), - (0x1D697, 'M', 'n'), - (0x1D698, 'M', 'o'), - (0x1D699, 'M', 'p'), - (0x1D69A, 'M', 'q'), - (0x1D69B, 'M', 'r'), - (0x1D69C, 'M', 's'), - (0x1D69D, 'M', 't'), - (0x1D69E, 'M', 'u'), - (0x1D69F, 'M', 'v'), - (0x1D6A0, 'M', 'w'), - (0x1D6A1, 'M', 'x'), - (0x1D6A2, 'M', 'y'), - (0x1D6A3, 'M', 'z'), - (0x1D6A4, 'M', 'ı'), - (0x1D6A5, 'M', 'ȷ'), - (0x1D6A6, 'X'), - (0x1D6A8, 'M', 'α'), - (0x1D6A9, 'M', 'β'), - (0x1D6AA, 'M', 'γ'), - (0x1D6AB, 'M', 'δ'), - (0x1D6AC, 'M', 'ε'), - (0x1D6AD, 'M', 'ζ'), - (0x1D6AE, 'M', 'η'), - (0x1D6AF, 'M', 'θ'), - (0x1D6B0, 'M', 'ι'), - (0x1D6B1, 'M', 'κ'), - (0x1D6B2, 'M', 'λ'), - (0x1D6B3, 'M', 'μ'), - (0x1D6B4, 'M', 'ν'), - (0x1D6B5, 'M', 'ξ'), - (0x1D6B6, 'M', 'ο'), - (0x1D6B7, 'M', 'π'), - (0x1D6B8, 'M', 'ρ'), - (0x1D6B9, 'M', 'θ'), - (0x1D6BA, 'M', 'σ'), - (0x1D6BB, 'M', 'τ'), - (0x1D6BC, 'M', 'υ'), - (0x1D6BD, 'M', 'φ'), - (0x1D6BE, 'M', 'χ'), - (0x1D6BF, 'M', 'ψ'), - (0x1D6C0, 'M', 'ω'), - (0x1D6C1, 'M', '∇'), - (0x1D6C2, 'M', 'α'), - (0x1D6C3, 'M', 'β'), - (0x1D6C4, 'M', 'γ'), - (0x1D6C5, 'M', 'δ'), - (0x1D6C6, 'M', 'ε'), - (0x1D6C7, 'M', 'ζ'), - (0x1D6C8, 'M', 'η'), - (0x1D6C9, 'M', 'θ'), - (0x1D6CA, 'M', 'ι'), - (0x1D6CB, 'M', 'κ'), - (0x1D6CC, 'M', 'λ'), - (0x1D6CD, 'M', 'μ'), - (0x1D6CE, 'M', 'ν'), - (0x1D6CF, 'M', 'ξ'), - (0x1D6D0, 'M', 'ο'), - (0x1D6D1, 'M', 'π'), - (0x1D6D2, 'M', 'ρ'), - (0x1D6D3, 'M', 'σ'), - (0x1D6D5, 'M', 'τ'), - (0x1D6D6, 'M', 'υ'), - (0x1D6D7, 'M', 'φ'), - (0x1D6D8, 'M', 'χ'), - (0x1D6D9, 'M', 'ψ'), - (0x1D6DA, 'M', 'ω'), - (0x1D6DB, 'M', '∂'), - (0x1D6DC, 'M', 'ε'), - (0x1D6DD, 'M', 'θ'), - (0x1D6DE, 'M', 'κ'), - (0x1D6DF, 'M', 'φ'), - (0x1D6E0, 'M', 'ρ'), - (0x1D6E1, 'M', 'π'), - (0x1D6E2, 'M', 'α'), - (0x1D6E3, 'M', 'β'), - (0x1D6E4, 'M', 'γ'), - ] - -def _seg_68() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D6E5, 'M', 'δ'), - (0x1D6E6, 'M', 'ε'), - (0x1D6E7, 'M', 'ζ'), - (0x1D6E8, 'M', 'η'), - (0x1D6E9, 'M', 'θ'), - (0x1D6EA, 'M', 'ι'), - (0x1D6EB, 'M', 'κ'), - (0x1D6EC, 'M', 'λ'), - (0x1D6ED, 'M', 'μ'), - (0x1D6EE, 'M', 'ν'), - (0x1D6EF, 'M', 'ξ'), - (0x1D6F0, 'M', 'ο'), - (0x1D6F1, 'M', 'π'), - (0x1D6F2, 'M', 'ρ'), - (0x1D6F3, 'M', 'θ'), - (0x1D6F4, 'M', 'σ'), - (0x1D6F5, 'M', 'τ'), - (0x1D6F6, 'M', 'υ'), - (0x1D6F7, 'M', 'φ'), - (0x1D6F8, 'M', 'χ'), - (0x1D6F9, 'M', 'ψ'), - (0x1D6FA, 'M', 'ω'), - (0x1D6FB, 'M', '∇'), - (0x1D6FC, 'M', 'α'), - (0x1D6FD, 'M', 'β'), - (0x1D6FE, 'M', 'γ'), - (0x1D6FF, 'M', 'δ'), - (0x1D700, 'M', 'ε'), - (0x1D701, 'M', 'ζ'), - (0x1D702, 'M', 'η'), - (0x1D703, 'M', 'θ'), - (0x1D704, 'M', 'ι'), - (0x1D705, 'M', 'κ'), - (0x1D706, 'M', 'λ'), - (0x1D707, 'M', 'μ'), - (0x1D708, 'M', 'ν'), - (0x1D709, 'M', 'ξ'), - (0x1D70A, 'M', 'ο'), - (0x1D70B, 'M', 'π'), - (0x1D70C, 'M', 'ρ'), - (0x1D70D, 'M', 'σ'), - (0x1D70F, 'M', 'τ'), - (0x1D710, 'M', 'υ'), - (0x1D711, 'M', 'φ'), - (0x1D712, 'M', 'χ'), - (0x1D713, 'M', 'ψ'), - (0x1D714, 'M', 'ω'), - (0x1D715, 'M', '∂'), - (0x1D716, 'M', 'ε'), - (0x1D717, 'M', 'θ'), - (0x1D718, 'M', 'κ'), - (0x1D719, 'M', 'φ'), - (0x1D71A, 'M', 'ρ'), - (0x1D71B, 'M', 'π'), - (0x1D71C, 'M', 'α'), - (0x1D71D, 'M', 'β'), - (0x1D71E, 'M', 'γ'), - (0x1D71F, 'M', 'δ'), - (0x1D720, 'M', 'ε'), - (0x1D721, 'M', 'ζ'), - (0x1D722, 'M', 'η'), - (0x1D723, 'M', 'θ'), - (0x1D724, 'M', 'ι'), - (0x1D725, 'M', 'κ'), - (0x1D726, 'M', 'λ'), - (0x1D727, 'M', 'μ'), - (0x1D728, 'M', 'ν'), - (0x1D729, 'M', 'ξ'), - (0x1D72A, 'M', 'ο'), - (0x1D72B, 'M', 'π'), - (0x1D72C, 'M', 'ρ'), - (0x1D72D, 'M', 'θ'), - (0x1D72E, 'M', 'σ'), - (0x1D72F, 'M', 'τ'), - (0x1D730, 'M', 'υ'), - (0x1D731, 'M', 'φ'), - (0x1D732, 'M', 'χ'), - (0x1D733, 'M', 'ψ'), - (0x1D734, 'M', 'ω'), - (0x1D735, 'M', '∇'), - (0x1D736, 'M', 'α'), - (0x1D737, 'M', 'β'), - (0x1D738, 'M', 'γ'), - (0x1D739, 'M', 'δ'), - (0x1D73A, 'M', 'ε'), - (0x1D73B, 'M', 'ζ'), - (0x1D73C, 'M', 'η'), - (0x1D73D, 'M', 'θ'), - (0x1D73E, 'M', 'ι'), - (0x1D73F, 'M', 'κ'), - (0x1D740, 'M', 'λ'), - (0x1D741, 'M', 'μ'), - (0x1D742, 'M', 'ν'), - (0x1D743, 'M', 'ξ'), - (0x1D744, 'M', 'ο'), - (0x1D745, 'M', 'π'), - (0x1D746, 'M', 'ρ'), - (0x1D747, 'M', 'σ'), - (0x1D749, 'M', 'τ'), - (0x1D74A, 'M', 'υ'), - ] - -def _seg_69() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D74B, 'M', 'φ'), - (0x1D74C, 'M', 'χ'), - (0x1D74D, 'M', 'ψ'), - (0x1D74E, 'M', 'ω'), - (0x1D74F, 'M', '∂'), - (0x1D750, 'M', 'ε'), - (0x1D751, 'M', 'θ'), - (0x1D752, 'M', 'κ'), - (0x1D753, 'M', 'φ'), - (0x1D754, 'M', 'ρ'), - (0x1D755, 'M', 'π'), - (0x1D756, 'M', 'α'), - (0x1D757, 'M', 'β'), - (0x1D758, 'M', 'γ'), - (0x1D759, 'M', 'δ'), - (0x1D75A, 'M', 'ε'), - (0x1D75B, 'M', 'ζ'), - (0x1D75C, 'M', 'η'), - (0x1D75D, 'M', 'θ'), - (0x1D75E, 'M', 'ι'), - (0x1D75F, 'M', 'κ'), - (0x1D760, 'M', 'λ'), - (0x1D761, 'M', 'μ'), - (0x1D762, 'M', 'ν'), - (0x1D763, 'M', 'ξ'), - (0x1D764, 'M', 'ο'), - (0x1D765, 'M', 'π'), - (0x1D766, 'M', 'ρ'), - (0x1D767, 'M', 'θ'), - (0x1D768, 'M', 'σ'), - (0x1D769, 'M', 'τ'), - (0x1D76A, 'M', 'υ'), - (0x1D76B, 'M', 'φ'), - (0x1D76C, 'M', 'χ'), - (0x1D76D, 'M', 'ψ'), - (0x1D76E, 'M', 'ω'), - (0x1D76F, 'M', '∇'), - (0x1D770, 'M', 'α'), - (0x1D771, 'M', 'β'), - (0x1D772, 'M', 'γ'), - (0x1D773, 'M', 'δ'), - (0x1D774, 'M', 'ε'), - (0x1D775, 'M', 'ζ'), - (0x1D776, 'M', 'η'), - (0x1D777, 'M', 'θ'), - (0x1D778, 'M', 'ι'), - (0x1D779, 'M', 'κ'), - (0x1D77A, 'M', 'λ'), - (0x1D77B, 'M', 'μ'), - (0x1D77C, 'M', 'ν'), - (0x1D77D, 'M', 'ξ'), - (0x1D77E, 'M', 'ο'), - (0x1D77F, 'M', 'π'), - (0x1D780, 'M', 'ρ'), - (0x1D781, 'M', 'σ'), - (0x1D783, 'M', 'τ'), - (0x1D784, 'M', 'υ'), - (0x1D785, 'M', 'φ'), - (0x1D786, 'M', 'χ'), - (0x1D787, 'M', 'ψ'), - (0x1D788, 'M', 'ω'), - (0x1D789, 'M', '∂'), - (0x1D78A, 'M', 'ε'), - (0x1D78B, 'M', 'θ'), - (0x1D78C, 'M', 'κ'), - (0x1D78D, 'M', 'φ'), - (0x1D78E, 'M', 'ρ'), - (0x1D78F, 'M', 'π'), - (0x1D790, 'M', 'α'), - (0x1D791, 'M', 'β'), - (0x1D792, 'M', 'γ'), - (0x1D793, 'M', 'δ'), - (0x1D794, 'M', 'ε'), - (0x1D795, 'M', 'ζ'), - (0x1D796, 'M', 'η'), - (0x1D797, 'M', 'θ'), - (0x1D798, 'M', 'ι'), - (0x1D799, 'M', 'κ'), - (0x1D79A, 'M', 'λ'), - (0x1D79B, 'M', 'μ'), - (0x1D79C, 'M', 'ν'), - (0x1D79D, 'M', 'ξ'), - (0x1D79E, 'M', 'ο'), - (0x1D79F, 'M', 'π'), - (0x1D7A0, 'M', 'ρ'), - (0x1D7A1, 'M', 'θ'), - (0x1D7A2, 'M', 'σ'), - (0x1D7A3, 'M', 'τ'), - (0x1D7A4, 'M', 'υ'), - (0x1D7A5, 'M', 'φ'), - (0x1D7A6, 'M', 'χ'), - (0x1D7A7, 'M', 'ψ'), - (0x1D7A8, 'M', 'ω'), - (0x1D7A9, 'M', '∇'), - (0x1D7AA, 'M', 'α'), - (0x1D7AB, 'M', 'β'), - (0x1D7AC, 'M', 'γ'), - (0x1D7AD, 'M', 'δ'), - (0x1D7AE, 'M', 'ε'), - (0x1D7AF, 'M', 'ζ'), - ] - -def _seg_70() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D7B0, 'M', 'η'), - (0x1D7B1, 'M', 'θ'), - (0x1D7B2, 'M', 'ι'), - (0x1D7B3, 'M', 'κ'), - (0x1D7B4, 'M', 'λ'), - (0x1D7B5, 'M', 'μ'), - (0x1D7B6, 'M', 'ν'), - (0x1D7B7, 'M', 'ξ'), - (0x1D7B8, 'M', 'ο'), - (0x1D7B9, 'M', 'π'), - (0x1D7BA, 'M', 'ρ'), - (0x1D7BB, 'M', 'σ'), - (0x1D7BD, 'M', 'τ'), - (0x1D7BE, 'M', 'υ'), - (0x1D7BF, 'M', 'φ'), - (0x1D7C0, 'M', 'χ'), - (0x1D7C1, 'M', 'ψ'), - (0x1D7C2, 'M', 'ω'), - (0x1D7C3, 'M', '∂'), - (0x1D7C4, 'M', 'ε'), - (0x1D7C5, 'M', 'θ'), - (0x1D7C6, 'M', 'κ'), - (0x1D7C7, 'M', 'φ'), - (0x1D7C8, 'M', 'ρ'), - (0x1D7C9, 'M', 'π'), - (0x1D7CA, 'M', 'ϝ'), - (0x1D7CC, 'X'), - (0x1D7CE, 'M', '0'), - (0x1D7CF, 'M', '1'), - (0x1D7D0, 'M', '2'), - (0x1D7D1, 'M', '3'), - (0x1D7D2, 'M', '4'), - (0x1D7D3, 'M', '5'), - (0x1D7D4, 'M', '6'), - (0x1D7D5, 'M', '7'), - (0x1D7D6, 'M', '8'), - (0x1D7D7, 'M', '9'), - (0x1D7D8, 'M', '0'), - (0x1D7D9, 'M', '1'), - (0x1D7DA, 'M', '2'), - (0x1D7DB, 'M', '3'), - (0x1D7DC, 'M', '4'), - (0x1D7DD, 'M', '5'), - (0x1D7DE, 'M', '6'), - (0x1D7DF, 'M', '7'), - (0x1D7E0, 'M', '8'), - (0x1D7E1, 'M', '9'), - (0x1D7E2, 'M', '0'), - (0x1D7E3, 'M', '1'), - (0x1D7E4, 'M', '2'), - (0x1D7E5, 'M', '3'), - (0x1D7E6, 'M', '4'), - (0x1D7E7, 'M', '5'), - (0x1D7E8, 'M', '6'), - (0x1D7E9, 'M', '7'), - (0x1D7EA, 'M', '8'), - (0x1D7EB, 'M', '9'), - (0x1D7EC, 'M', '0'), - (0x1D7ED, 'M', '1'), - (0x1D7EE, 'M', '2'), - (0x1D7EF, 'M', '3'), - (0x1D7F0, 'M', '4'), - (0x1D7F1, 'M', '5'), - (0x1D7F2, 'M', '6'), - (0x1D7F3, 'M', '7'), - (0x1D7F4, 'M', '8'), - (0x1D7F5, 'M', '9'), - (0x1D7F6, 'M', '0'), - (0x1D7F7, 'M', '1'), - (0x1D7F8, 'M', '2'), - (0x1D7F9, 'M', '3'), - (0x1D7FA, 'M', '4'), - (0x1D7FB, 'M', '5'), - (0x1D7FC, 'M', '6'), - (0x1D7FD, 'M', '7'), - (0x1D7FE, 'M', '8'), - (0x1D7FF, 'M', '9'), - (0x1D800, 'V'), - (0x1DA8C, 'X'), - (0x1DA9B, 'V'), - (0x1DAA0, 'X'), - (0x1DAA1, 'V'), - (0x1DAB0, 'X'), - (0x1DF00, 'V'), - (0x1DF1F, 'X'), - (0x1DF25, 'V'), - (0x1DF2B, 'X'), - (0x1E000, 'V'), - (0x1E007, 'X'), - (0x1E008, 'V'), - (0x1E019, 'X'), - (0x1E01B, 'V'), - (0x1E022, 'X'), - (0x1E023, 'V'), - (0x1E025, 'X'), - (0x1E026, 'V'), - (0x1E02B, 'X'), - (0x1E030, 'M', 'а'), - (0x1E031, 'M', 'б'), - (0x1E032, 'M', 'в'), - ] - -def _seg_71() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E033, 'M', 'г'), - (0x1E034, 'M', 'д'), - (0x1E035, 'M', 'е'), - (0x1E036, 'M', 'ж'), - (0x1E037, 'M', 'з'), - (0x1E038, 'M', 'и'), - (0x1E039, 'M', 'к'), - (0x1E03A, 'M', 'л'), - (0x1E03B, 'M', 'м'), - (0x1E03C, 'M', 'о'), - (0x1E03D, 'M', 'п'), - (0x1E03E, 'M', 'р'), - (0x1E03F, 'M', 'с'), - (0x1E040, 'M', 'т'), - (0x1E041, 'M', 'у'), - (0x1E042, 'M', 'ф'), - (0x1E043, 'M', 'х'), - (0x1E044, 'M', 'ц'), - (0x1E045, 'M', 'ч'), - (0x1E046, 'M', 'ш'), - (0x1E047, 'M', 'ы'), - (0x1E048, 'M', 'э'), - (0x1E049, 'M', 'ю'), - (0x1E04A, 'M', 'ꚉ'), - (0x1E04B, 'M', 'ә'), - (0x1E04C, 'M', 'і'), - (0x1E04D, 'M', 'ј'), - (0x1E04E, 'M', 'ө'), - (0x1E04F, 'M', 'ү'), - (0x1E050, 'M', 'ӏ'), - (0x1E051, 'M', 'а'), - (0x1E052, 'M', 'б'), - (0x1E053, 'M', 'в'), - (0x1E054, 'M', 'г'), - (0x1E055, 'M', 'д'), - (0x1E056, 'M', 'е'), - (0x1E057, 'M', 'ж'), - (0x1E058, 'M', 'з'), - (0x1E059, 'M', 'и'), - (0x1E05A, 'M', 'к'), - (0x1E05B, 'M', 'л'), - (0x1E05C, 'M', 'о'), - (0x1E05D, 'M', 'п'), - (0x1E05E, 'M', 'с'), - (0x1E05F, 'M', 'у'), - (0x1E060, 'M', 'ф'), - (0x1E061, 'M', 'х'), - (0x1E062, 'M', 'ц'), - (0x1E063, 'M', 'ч'), - (0x1E064, 'M', 'ш'), - (0x1E065, 'M', 'ъ'), - (0x1E066, 'M', 'ы'), - (0x1E067, 'M', 'ґ'), - (0x1E068, 'M', 'і'), - (0x1E069, 'M', 'ѕ'), - (0x1E06A, 'M', 'џ'), - (0x1E06B, 'M', 'ҫ'), - (0x1E06C, 'M', 'ꙑ'), - (0x1E06D, 'M', 'ұ'), - (0x1E06E, 'X'), - (0x1E08F, 'V'), - (0x1E090, 'X'), - (0x1E100, 'V'), - (0x1E12D, 'X'), - (0x1E130, 'V'), - (0x1E13E, 'X'), - (0x1E140, 'V'), - (0x1E14A, 'X'), - (0x1E14E, 'V'), - (0x1E150, 'X'), - (0x1E290, 'V'), - (0x1E2AF, 'X'), - (0x1E2C0, 'V'), - (0x1E2FA, 'X'), - (0x1E2FF, 'V'), - (0x1E300, 'X'), - (0x1E4D0, 'V'), - (0x1E4FA, 'X'), - (0x1E7E0, 'V'), - (0x1E7E7, 'X'), - (0x1E7E8, 'V'), - (0x1E7EC, 'X'), - (0x1E7ED, 'V'), - (0x1E7EF, 'X'), - (0x1E7F0, 'V'), - (0x1E7FF, 'X'), - (0x1E800, 'V'), - (0x1E8C5, 'X'), - (0x1E8C7, 'V'), - (0x1E8D7, 'X'), - (0x1E900, 'M', '𞤢'), - (0x1E901, 'M', '𞤣'), - (0x1E902, 'M', '𞤤'), - (0x1E903, 'M', '𞤥'), - (0x1E904, 'M', '𞤦'), - (0x1E905, 'M', '𞤧'), - (0x1E906, 'M', '𞤨'), - (0x1E907, 'M', '𞤩'), - (0x1E908, 'M', '𞤪'), - (0x1E909, 'M', '𞤫'), - ] - -def _seg_72() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E90A, 'M', '𞤬'), - (0x1E90B, 'M', '𞤭'), - (0x1E90C, 'M', '𞤮'), - (0x1E90D, 'M', '𞤯'), - (0x1E90E, 'M', '𞤰'), - (0x1E90F, 'M', '𞤱'), - (0x1E910, 'M', '𞤲'), - (0x1E911, 'M', '𞤳'), - (0x1E912, 'M', '𞤴'), - (0x1E913, 'M', '𞤵'), - (0x1E914, 'M', '𞤶'), - (0x1E915, 'M', '𞤷'), - (0x1E916, 'M', '𞤸'), - (0x1E917, 'M', '𞤹'), - (0x1E918, 'M', '𞤺'), - (0x1E919, 'M', '𞤻'), - (0x1E91A, 'M', '𞤼'), - (0x1E91B, 'M', '𞤽'), - (0x1E91C, 'M', '𞤾'), - (0x1E91D, 'M', '𞤿'), - (0x1E91E, 'M', '𞥀'), - (0x1E91F, 'M', '𞥁'), - (0x1E920, 'M', '𞥂'), - (0x1E921, 'M', '𞥃'), - (0x1E922, 'V'), - (0x1E94C, 'X'), - (0x1E950, 'V'), - (0x1E95A, 'X'), - (0x1E95E, 'V'), - (0x1E960, 'X'), - (0x1EC71, 'V'), - (0x1ECB5, 'X'), - (0x1ED01, 'V'), - (0x1ED3E, 'X'), - (0x1EE00, 'M', 'ا'), - (0x1EE01, 'M', 'ب'), - (0x1EE02, 'M', 'ج'), - (0x1EE03, 'M', 'د'), - (0x1EE04, 'X'), - (0x1EE05, 'M', 'و'), - (0x1EE06, 'M', 'ز'), - (0x1EE07, 'M', 'ح'), - (0x1EE08, 'M', 'ط'), - (0x1EE09, 'M', 'ي'), - (0x1EE0A, 'M', 'ك'), - (0x1EE0B, 'M', 'ل'), - (0x1EE0C, 'M', 'م'), - (0x1EE0D, 'M', 'ن'), - (0x1EE0E, 'M', 'س'), - (0x1EE0F, 'M', 'ع'), - (0x1EE10, 'M', 'ف'), - (0x1EE11, 'M', 'ص'), - (0x1EE12, 'M', 'ق'), - (0x1EE13, 'M', 'ر'), - (0x1EE14, 'M', 'ش'), - (0x1EE15, 'M', 'ت'), - (0x1EE16, 'M', 'ث'), - (0x1EE17, 'M', 'خ'), - (0x1EE18, 'M', 'ذ'), - (0x1EE19, 'M', 'ض'), - (0x1EE1A, 'M', 'ظ'), - (0x1EE1B, 'M', 'غ'), - (0x1EE1C, 'M', 'ٮ'), - (0x1EE1D, 'M', 'ں'), - (0x1EE1E, 'M', 'ڡ'), - (0x1EE1F, 'M', 'ٯ'), - (0x1EE20, 'X'), - (0x1EE21, 'M', 'ب'), - (0x1EE22, 'M', 'ج'), - (0x1EE23, 'X'), - (0x1EE24, 'M', 'ه'), - (0x1EE25, 'X'), - (0x1EE27, 'M', 'ح'), - (0x1EE28, 'X'), - (0x1EE29, 'M', 'ي'), - (0x1EE2A, 'M', 'ك'), - (0x1EE2B, 'M', 'ل'), - (0x1EE2C, 'M', 'م'), - (0x1EE2D, 'M', 'ن'), - (0x1EE2E, 'M', 'س'), - (0x1EE2F, 'M', 'ع'), - (0x1EE30, 'M', 'ف'), - (0x1EE31, 'M', 'ص'), - (0x1EE32, 'M', 'ق'), - (0x1EE33, 'X'), - (0x1EE34, 'M', 'ش'), - (0x1EE35, 'M', 'ت'), - (0x1EE36, 'M', 'ث'), - (0x1EE37, 'M', 'خ'), - (0x1EE38, 'X'), - (0x1EE39, 'M', 'ض'), - (0x1EE3A, 'X'), - (0x1EE3B, 'M', 'غ'), - (0x1EE3C, 'X'), - (0x1EE42, 'M', 'ج'), - (0x1EE43, 'X'), - (0x1EE47, 'M', 'ح'), - (0x1EE48, 'X'), - (0x1EE49, 'M', 'ي'), - (0x1EE4A, 'X'), - ] - -def _seg_73() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EE4B, 'M', 'ل'), - (0x1EE4C, 'X'), - (0x1EE4D, 'M', 'ن'), - (0x1EE4E, 'M', 'س'), - (0x1EE4F, 'M', 'ع'), - (0x1EE50, 'X'), - (0x1EE51, 'M', 'ص'), - (0x1EE52, 'M', 'ق'), - (0x1EE53, 'X'), - (0x1EE54, 'M', 'ش'), - (0x1EE55, 'X'), - (0x1EE57, 'M', 'خ'), - (0x1EE58, 'X'), - (0x1EE59, 'M', 'ض'), - (0x1EE5A, 'X'), - (0x1EE5B, 'M', 'غ'), - (0x1EE5C, 'X'), - (0x1EE5D, 'M', 'ں'), - (0x1EE5E, 'X'), - (0x1EE5F, 'M', 'ٯ'), - (0x1EE60, 'X'), - (0x1EE61, 'M', 'ب'), - (0x1EE62, 'M', 'ج'), - (0x1EE63, 'X'), - (0x1EE64, 'M', 'ه'), - (0x1EE65, 'X'), - (0x1EE67, 'M', 'ح'), - (0x1EE68, 'M', 'ط'), - (0x1EE69, 'M', 'ي'), - (0x1EE6A, 'M', 'ك'), - (0x1EE6B, 'X'), - (0x1EE6C, 'M', 'م'), - (0x1EE6D, 'M', 'ن'), - (0x1EE6E, 'M', 'س'), - (0x1EE6F, 'M', 'ع'), - (0x1EE70, 'M', 'ف'), - (0x1EE71, 'M', 'ص'), - (0x1EE72, 'M', 'ق'), - (0x1EE73, 'X'), - (0x1EE74, 'M', 'ش'), - (0x1EE75, 'M', 'ت'), - (0x1EE76, 'M', 'ث'), - (0x1EE77, 'M', 'خ'), - (0x1EE78, 'X'), - (0x1EE79, 'M', 'ض'), - (0x1EE7A, 'M', 'ظ'), - (0x1EE7B, 'M', 'غ'), - (0x1EE7C, 'M', 'ٮ'), - (0x1EE7D, 'X'), - (0x1EE7E, 'M', 'ڡ'), - (0x1EE7F, 'X'), - (0x1EE80, 'M', 'ا'), - (0x1EE81, 'M', 'ب'), - (0x1EE82, 'M', 'ج'), - (0x1EE83, 'M', 'د'), - (0x1EE84, 'M', 'ه'), - (0x1EE85, 'M', 'و'), - (0x1EE86, 'M', 'ز'), - (0x1EE87, 'M', 'ح'), - (0x1EE88, 'M', 'ط'), - (0x1EE89, 'M', 'ي'), - (0x1EE8A, 'X'), - (0x1EE8B, 'M', 'ل'), - (0x1EE8C, 'M', 'م'), - (0x1EE8D, 'M', 'ن'), - (0x1EE8E, 'M', 'س'), - (0x1EE8F, 'M', 'ع'), - (0x1EE90, 'M', 'ف'), - (0x1EE91, 'M', 'ص'), - (0x1EE92, 'M', 'ق'), - (0x1EE93, 'M', 'ر'), - (0x1EE94, 'M', 'ش'), - (0x1EE95, 'M', 'ت'), - (0x1EE96, 'M', 'ث'), - (0x1EE97, 'M', 'خ'), - (0x1EE98, 'M', 'ذ'), - (0x1EE99, 'M', 'ض'), - (0x1EE9A, 'M', 'ظ'), - (0x1EE9B, 'M', 'غ'), - (0x1EE9C, 'X'), - (0x1EEA1, 'M', 'ب'), - (0x1EEA2, 'M', 'ج'), - (0x1EEA3, 'M', 'د'), - (0x1EEA4, 'X'), - (0x1EEA5, 'M', 'و'), - (0x1EEA6, 'M', 'ز'), - (0x1EEA7, 'M', 'ح'), - (0x1EEA8, 'M', 'ط'), - (0x1EEA9, 'M', 'ي'), - (0x1EEAA, 'X'), - (0x1EEAB, 'M', 'ل'), - (0x1EEAC, 'M', 'م'), - (0x1EEAD, 'M', 'ن'), - (0x1EEAE, 'M', 'س'), - (0x1EEAF, 'M', 'ع'), - (0x1EEB0, 'M', 'ف'), - (0x1EEB1, 'M', 'ص'), - (0x1EEB2, 'M', 'ق'), - (0x1EEB3, 'M', 'ر'), - (0x1EEB4, 'M', 'ش'), - ] - -def _seg_74() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EEB5, 'M', 'ت'), - (0x1EEB6, 'M', 'ث'), - (0x1EEB7, 'M', 'خ'), - (0x1EEB8, 'M', 'ذ'), - (0x1EEB9, 'M', 'ض'), - (0x1EEBA, 'M', 'ظ'), - (0x1EEBB, 'M', 'غ'), - (0x1EEBC, 'X'), - (0x1EEF0, 'V'), - (0x1EEF2, 'X'), - (0x1F000, 'V'), - (0x1F02C, 'X'), - (0x1F030, 'V'), - (0x1F094, 'X'), - (0x1F0A0, 'V'), - (0x1F0AF, 'X'), - (0x1F0B1, 'V'), - (0x1F0C0, 'X'), - (0x1F0C1, 'V'), - (0x1F0D0, 'X'), - (0x1F0D1, 'V'), - (0x1F0F6, 'X'), - (0x1F101, '3', '0,'), - (0x1F102, '3', '1,'), - (0x1F103, '3', '2,'), - (0x1F104, '3', '3,'), - (0x1F105, '3', '4,'), - (0x1F106, '3', '5,'), - (0x1F107, '3', '6,'), - (0x1F108, '3', '7,'), - (0x1F109, '3', '8,'), - (0x1F10A, '3', '9,'), - (0x1F10B, 'V'), - (0x1F110, '3', '(a)'), - (0x1F111, '3', '(b)'), - (0x1F112, '3', '(c)'), - (0x1F113, '3', '(d)'), - (0x1F114, '3', '(e)'), - (0x1F115, '3', '(f)'), - (0x1F116, '3', '(g)'), - (0x1F117, '3', '(h)'), - (0x1F118, '3', '(i)'), - (0x1F119, '3', '(j)'), - (0x1F11A, '3', '(k)'), - (0x1F11B, '3', '(l)'), - (0x1F11C, '3', '(m)'), - (0x1F11D, '3', '(n)'), - (0x1F11E, '3', '(o)'), - (0x1F11F, '3', '(p)'), - (0x1F120, '3', '(q)'), - (0x1F121, '3', '(r)'), - (0x1F122, '3', '(s)'), - (0x1F123, '3', '(t)'), - (0x1F124, '3', '(u)'), - (0x1F125, '3', '(v)'), - (0x1F126, '3', '(w)'), - (0x1F127, '3', '(x)'), - (0x1F128, '3', '(y)'), - (0x1F129, '3', '(z)'), - (0x1F12A, 'M', '〔s〕'), - (0x1F12B, 'M', 'c'), - (0x1F12C, 'M', 'r'), - (0x1F12D, 'M', 'cd'), - (0x1F12E, 'M', 'wz'), - (0x1F12F, 'V'), - (0x1F130, 'M', 'a'), - (0x1F131, 'M', 'b'), - (0x1F132, 'M', 'c'), - (0x1F133, 'M', 'd'), - (0x1F134, 'M', 'e'), - (0x1F135, 'M', 'f'), - (0x1F136, 'M', 'g'), - (0x1F137, 'M', 'h'), - (0x1F138, 'M', 'i'), - (0x1F139, 'M', 'j'), - (0x1F13A, 'M', 'k'), - (0x1F13B, 'M', 'l'), - (0x1F13C, 'M', 'm'), - (0x1F13D, 'M', 'n'), - (0x1F13E, 'M', 'o'), - (0x1F13F, 'M', 'p'), - (0x1F140, 'M', 'q'), - (0x1F141, 'M', 'r'), - (0x1F142, 'M', 's'), - (0x1F143, 'M', 't'), - (0x1F144, 'M', 'u'), - (0x1F145, 'M', 'v'), - (0x1F146, 'M', 'w'), - (0x1F147, 'M', 'x'), - (0x1F148, 'M', 'y'), - (0x1F149, 'M', 'z'), - (0x1F14A, 'M', 'hv'), - (0x1F14B, 'M', 'mv'), - (0x1F14C, 'M', 'sd'), - (0x1F14D, 'M', 'ss'), - (0x1F14E, 'M', 'ppv'), - (0x1F14F, 'M', 'wc'), - (0x1F150, 'V'), - (0x1F16A, 'M', 'mc'), - (0x1F16B, 'M', 'md'), - ] - -def _seg_75() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1F16C, 'M', 'mr'), - (0x1F16D, 'V'), - (0x1F190, 'M', 'dj'), - (0x1F191, 'V'), - (0x1F1AE, 'X'), - (0x1F1E6, 'V'), - (0x1F200, 'M', 'ほか'), - (0x1F201, 'M', 'ココ'), - (0x1F202, 'M', 'サ'), - (0x1F203, 'X'), - (0x1F210, 'M', '手'), - (0x1F211, 'M', '字'), - (0x1F212, 'M', '双'), - (0x1F213, 'M', 'デ'), - (0x1F214, 'M', '二'), - (0x1F215, 'M', '多'), - (0x1F216, 'M', '解'), - (0x1F217, 'M', '天'), - (0x1F218, 'M', '交'), - (0x1F219, 'M', '映'), - (0x1F21A, 'M', '無'), - (0x1F21B, 'M', '料'), - (0x1F21C, 'M', '前'), - (0x1F21D, 'M', '後'), - (0x1F21E, 'M', '再'), - (0x1F21F, 'M', '新'), - (0x1F220, 'M', '初'), - (0x1F221, 'M', '終'), - (0x1F222, 'M', '生'), - (0x1F223, 'M', '販'), - (0x1F224, 'M', '声'), - (0x1F225, 'M', '吹'), - (0x1F226, 'M', '演'), - (0x1F227, 'M', '投'), - (0x1F228, 'M', '捕'), - (0x1F229, 'M', '一'), - (0x1F22A, 'M', '三'), - (0x1F22B, 'M', '遊'), - (0x1F22C, 'M', '左'), - (0x1F22D, 'M', '中'), - (0x1F22E, 'M', '右'), - (0x1F22F, 'M', '指'), - (0x1F230, 'M', '走'), - (0x1F231, 'M', '打'), - (0x1F232, 'M', '禁'), - (0x1F233, 'M', '空'), - (0x1F234, 'M', '合'), - (0x1F235, 'M', '満'), - (0x1F236, 'M', '有'), - (0x1F237, 'M', '月'), - (0x1F238, 'M', '申'), - (0x1F239, 'M', '割'), - (0x1F23A, 'M', '営'), - (0x1F23B, 'M', '配'), - (0x1F23C, 'X'), - (0x1F240, 'M', '〔本〕'), - (0x1F241, 'M', '〔三〕'), - (0x1F242, 'M', '〔二〕'), - (0x1F243, 'M', '〔安〕'), - (0x1F244, 'M', '〔点〕'), - (0x1F245, 'M', '〔打〕'), - (0x1F246, 'M', '〔盗〕'), - (0x1F247, 'M', '〔勝〕'), - (0x1F248, 'M', '〔敗〕'), - (0x1F249, 'X'), - (0x1F250, 'M', '得'), - (0x1F251, 'M', '可'), - (0x1F252, 'X'), - (0x1F260, 'V'), - (0x1F266, 'X'), - (0x1F300, 'V'), - (0x1F6D8, 'X'), - (0x1F6DC, 'V'), - (0x1F6ED, 'X'), - (0x1F6F0, 'V'), - (0x1F6FD, 'X'), - (0x1F700, 'V'), - (0x1F777, 'X'), - (0x1F77B, 'V'), - (0x1F7DA, 'X'), - (0x1F7E0, 'V'), - (0x1F7EC, 'X'), - (0x1F7F0, 'V'), - (0x1F7F1, 'X'), - (0x1F800, 'V'), - (0x1F80C, 'X'), - (0x1F810, 'V'), - (0x1F848, 'X'), - (0x1F850, 'V'), - (0x1F85A, 'X'), - (0x1F860, 'V'), - (0x1F888, 'X'), - (0x1F890, 'V'), - (0x1F8AE, 'X'), - (0x1F8B0, 'V'), - (0x1F8B2, 'X'), - (0x1F900, 'V'), - (0x1FA54, 'X'), - (0x1FA60, 'V'), - (0x1FA6E, 'X'), - ] - -def _seg_76() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1FA70, 'V'), - (0x1FA7D, 'X'), - (0x1FA80, 'V'), - (0x1FA89, 'X'), - (0x1FA90, 'V'), - (0x1FABE, 'X'), - (0x1FABF, 'V'), - (0x1FAC6, 'X'), - (0x1FACE, 'V'), - (0x1FADC, 'X'), - (0x1FAE0, 'V'), - (0x1FAE9, 'X'), - (0x1FAF0, 'V'), - (0x1FAF9, 'X'), - (0x1FB00, 'V'), - (0x1FB93, 'X'), - (0x1FB94, 'V'), - (0x1FBCB, 'X'), - (0x1FBF0, 'M', '0'), - (0x1FBF1, 'M', '1'), - (0x1FBF2, 'M', '2'), - (0x1FBF3, 'M', '3'), - (0x1FBF4, 'M', '4'), - (0x1FBF5, 'M', '5'), - (0x1FBF6, 'M', '6'), - (0x1FBF7, 'M', '7'), - (0x1FBF8, 'M', '8'), - (0x1FBF9, 'M', '9'), - (0x1FBFA, 'X'), - (0x20000, 'V'), - (0x2A6E0, 'X'), - (0x2A700, 'V'), - (0x2B73A, 'X'), - (0x2B740, 'V'), - (0x2B81E, 'X'), - (0x2B820, 'V'), - (0x2CEA2, 'X'), - (0x2CEB0, 'V'), - (0x2EBE1, 'X'), - (0x2F800, 'M', '丽'), - (0x2F801, 'M', '丸'), - (0x2F802, 'M', '乁'), - (0x2F803, 'M', '𠄢'), - (0x2F804, 'M', '你'), - (0x2F805, 'M', '侮'), - (0x2F806, 'M', '侻'), - (0x2F807, 'M', '倂'), - (0x2F808, 'M', '偺'), - (0x2F809, 'M', '備'), - (0x2F80A, 'M', '僧'), - (0x2F80B, 'M', '像'), - (0x2F80C, 'M', '㒞'), - (0x2F80D, 'M', '𠘺'), - (0x2F80E, 'M', '免'), - (0x2F80F, 'M', '兔'), - (0x2F810, 'M', '兤'), - (0x2F811, 'M', '具'), - (0x2F812, 'M', '𠔜'), - (0x2F813, 'M', '㒹'), - (0x2F814, 'M', '內'), - (0x2F815, 'M', '再'), - (0x2F816, 'M', '𠕋'), - (0x2F817, 'M', '冗'), - (0x2F818, 'M', '冤'), - (0x2F819, 'M', '仌'), - (0x2F81A, 'M', '冬'), - (0x2F81B, 'M', '况'), - (0x2F81C, 'M', '𩇟'), - (0x2F81D, 'M', '凵'), - (0x2F81E, 'M', '刃'), - (0x2F81F, 'M', '㓟'), - (0x2F820, 'M', '刻'), - (0x2F821, 'M', '剆'), - (0x2F822, 'M', '割'), - (0x2F823, 'M', '剷'), - (0x2F824, 'M', '㔕'), - (0x2F825, 'M', '勇'), - (0x2F826, 'M', '勉'), - (0x2F827, 'M', '勤'), - (0x2F828, 'M', '勺'), - (0x2F829, 'M', '包'), - (0x2F82A, 'M', '匆'), - (0x2F82B, 'M', '北'), - (0x2F82C, 'M', '卉'), - (0x2F82D, 'M', '卑'), - (0x2F82E, 'M', '博'), - (0x2F82F, 'M', '即'), - (0x2F830, 'M', '卽'), - (0x2F831, 'M', '卿'), - (0x2F834, 'M', '𠨬'), - (0x2F835, 'M', '灰'), - (0x2F836, 'M', '及'), - (0x2F837, 'M', '叟'), - (0x2F838, 'M', '𠭣'), - (0x2F839, 'M', '叫'), - (0x2F83A, 'M', '叱'), - (0x2F83B, 'M', '吆'), - (0x2F83C, 'M', '咞'), - (0x2F83D, 'M', '吸'), - (0x2F83E, 'M', '呈'), - ] - -def _seg_77() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F83F, 'M', '周'), - (0x2F840, 'M', '咢'), - (0x2F841, 'M', '哶'), - (0x2F842, 'M', '唐'), - (0x2F843, 'M', '啓'), - (0x2F844, 'M', '啣'), - (0x2F845, 'M', '善'), - (0x2F847, 'M', '喙'), - (0x2F848, 'M', '喫'), - (0x2F849, 'M', '喳'), - (0x2F84A, 'M', '嗂'), - (0x2F84B, 'M', '圖'), - (0x2F84C, 'M', '嘆'), - (0x2F84D, 'M', '圗'), - (0x2F84E, 'M', '噑'), - (0x2F84F, 'M', '噴'), - (0x2F850, 'M', '切'), - (0x2F851, 'M', '壮'), - (0x2F852, 'M', '城'), - (0x2F853, 'M', '埴'), - (0x2F854, 'M', '堍'), - (0x2F855, 'M', '型'), - (0x2F856, 'M', '堲'), - (0x2F857, 'M', '報'), - (0x2F858, 'M', '墬'), - (0x2F859, 'M', '𡓤'), - (0x2F85A, 'M', '売'), - (0x2F85B, 'M', '壷'), - (0x2F85C, 'M', '夆'), - (0x2F85D, 'M', '多'), - (0x2F85E, 'M', '夢'), - (0x2F85F, 'M', '奢'), - (0x2F860, 'M', '𡚨'), - (0x2F861, 'M', '𡛪'), - (0x2F862, 'M', '姬'), - (0x2F863, 'M', '娛'), - (0x2F864, 'M', '娧'), - (0x2F865, 'M', '姘'), - (0x2F866, 'M', '婦'), - (0x2F867, 'M', '㛮'), - (0x2F868, 'X'), - (0x2F869, 'M', '嬈'), - (0x2F86A, 'M', '嬾'), - (0x2F86C, 'M', '𡧈'), - (0x2F86D, 'M', '寃'), - (0x2F86E, 'M', '寘'), - (0x2F86F, 'M', '寧'), - (0x2F870, 'M', '寳'), - (0x2F871, 'M', '𡬘'), - (0x2F872, 'M', '寿'), - (0x2F873, 'M', '将'), - (0x2F874, 'X'), - (0x2F875, 'M', '尢'), - (0x2F876, 'M', '㞁'), - (0x2F877, 'M', '屠'), - (0x2F878, 'M', '屮'), - (0x2F879, 'M', '峀'), - (0x2F87A, 'M', '岍'), - (0x2F87B, 'M', '𡷤'), - (0x2F87C, 'M', '嵃'), - (0x2F87D, 'M', '𡷦'), - (0x2F87E, 'M', '嵮'), - (0x2F87F, 'M', '嵫'), - (0x2F880, 'M', '嵼'), - (0x2F881, 'M', '巡'), - (0x2F882, 'M', '巢'), - (0x2F883, 'M', '㠯'), - (0x2F884, 'M', '巽'), - (0x2F885, 'M', '帨'), - (0x2F886, 'M', '帽'), - (0x2F887, 'M', '幩'), - (0x2F888, 'M', '㡢'), - (0x2F889, 'M', '𢆃'), - (0x2F88A, 'M', '㡼'), - (0x2F88B, 'M', '庰'), - (0x2F88C, 'M', '庳'), - (0x2F88D, 'M', '庶'), - (0x2F88E, 'M', '廊'), - (0x2F88F, 'M', '𪎒'), - (0x2F890, 'M', '廾'), - (0x2F891, 'M', '𢌱'), - (0x2F893, 'M', '舁'), - (0x2F894, 'M', '弢'), - (0x2F896, 'M', '㣇'), - (0x2F897, 'M', '𣊸'), - (0x2F898, 'M', '𦇚'), - (0x2F899, 'M', '形'), - (0x2F89A, 'M', '彫'), - (0x2F89B, 'M', '㣣'), - (0x2F89C, 'M', '徚'), - (0x2F89D, 'M', '忍'), - (0x2F89E, 'M', '志'), - (0x2F89F, 'M', '忹'), - (0x2F8A0, 'M', '悁'), - (0x2F8A1, 'M', '㤺'), - (0x2F8A2, 'M', '㤜'), - (0x2F8A3, 'M', '悔'), - (0x2F8A4, 'M', '𢛔'), - (0x2F8A5, 'M', '惇'), - (0x2F8A6, 'M', '慈'), - ] - -def _seg_78() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F8A7, 'M', '慌'), - (0x2F8A8, 'M', '慎'), - (0x2F8A9, 'M', '慌'), - (0x2F8AA, 'M', '慺'), - (0x2F8AB, 'M', '憎'), - (0x2F8AC, 'M', '憲'), - (0x2F8AD, 'M', '憤'), - (0x2F8AE, 'M', '憯'), - (0x2F8AF, 'M', '懞'), - (0x2F8B0, 'M', '懲'), - (0x2F8B1, 'M', '懶'), - (0x2F8B2, 'M', '成'), - (0x2F8B3, 'M', '戛'), - (0x2F8B4, 'M', '扝'), - (0x2F8B5, 'M', '抱'), - (0x2F8B6, 'M', '拔'), - (0x2F8B7, 'M', '捐'), - (0x2F8B8, 'M', '𢬌'), - (0x2F8B9, 'M', '挽'), - (0x2F8BA, 'M', '拼'), - (0x2F8BB, 'M', '捨'), - (0x2F8BC, 'M', '掃'), - (0x2F8BD, 'M', '揤'), - (0x2F8BE, 'M', '𢯱'), - (0x2F8BF, 'M', '搢'), - (0x2F8C0, 'M', '揅'), - (0x2F8C1, 'M', '掩'), - (0x2F8C2, 'M', '㨮'), - (0x2F8C3, 'M', '摩'), - (0x2F8C4, 'M', '摾'), - (0x2F8C5, 'M', '撝'), - (0x2F8C6, 'M', '摷'), - (0x2F8C7, 'M', '㩬'), - (0x2F8C8, 'M', '敏'), - (0x2F8C9, 'M', '敬'), - (0x2F8CA, 'M', '𣀊'), - (0x2F8CB, 'M', '旣'), - (0x2F8CC, 'M', '書'), - (0x2F8CD, 'M', '晉'), - (0x2F8CE, 'M', '㬙'), - (0x2F8CF, 'M', '暑'), - (0x2F8D0, 'M', '㬈'), - (0x2F8D1, 'M', '㫤'), - (0x2F8D2, 'M', '冒'), - (0x2F8D3, 'M', '冕'), - (0x2F8D4, 'M', '最'), - (0x2F8D5, 'M', '暜'), - (0x2F8D6, 'M', '肭'), - (0x2F8D7, 'M', '䏙'), - (0x2F8D8, 'M', '朗'), - (0x2F8D9, 'M', '望'), - (0x2F8DA, 'M', '朡'), - (0x2F8DB, 'M', '杞'), - (0x2F8DC, 'M', '杓'), - (0x2F8DD, 'M', '𣏃'), - (0x2F8DE, 'M', '㭉'), - (0x2F8DF, 'M', '柺'), - (0x2F8E0, 'M', '枅'), - (0x2F8E1, 'M', '桒'), - (0x2F8E2, 'M', '梅'), - (0x2F8E3, 'M', '𣑭'), - (0x2F8E4, 'M', '梎'), - (0x2F8E5, 'M', '栟'), - (0x2F8E6, 'M', '椔'), - (0x2F8E7, 'M', '㮝'), - (0x2F8E8, 'M', '楂'), - (0x2F8E9, 'M', '榣'), - (0x2F8EA, 'M', '槪'), - (0x2F8EB, 'M', '檨'), - (0x2F8EC, 'M', '𣚣'), - (0x2F8ED, 'M', '櫛'), - (0x2F8EE, 'M', '㰘'), - (0x2F8EF, 'M', '次'), - (0x2F8F0, 'M', '𣢧'), - (0x2F8F1, 'M', '歔'), - (0x2F8F2, 'M', '㱎'), - (0x2F8F3, 'M', '歲'), - (0x2F8F4, 'M', '殟'), - (0x2F8F5, 'M', '殺'), - (0x2F8F6, 'M', '殻'), - (0x2F8F7, 'M', '𣪍'), - (0x2F8F8, 'M', '𡴋'), - (0x2F8F9, 'M', '𣫺'), - (0x2F8FA, 'M', '汎'), - (0x2F8FB, 'M', '𣲼'), - (0x2F8FC, 'M', '沿'), - (0x2F8FD, 'M', '泍'), - (0x2F8FE, 'M', '汧'), - (0x2F8FF, 'M', '洖'), - (0x2F900, 'M', '派'), - (0x2F901, 'M', '海'), - (0x2F902, 'M', '流'), - (0x2F903, 'M', '浩'), - (0x2F904, 'M', '浸'), - (0x2F905, 'M', '涅'), - (0x2F906, 'M', '𣴞'), - (0x2F907, 'M', '洴'), - (0x2F908, 'M', '港'), - (0x2F909, 'M', '湮'), - (0x2F90A, 'M', '㴳'), - ] - -def _seg_79() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F90B, 'M', '滋'), - (0x2F90C, 'M', '滇'), - (0x2F90D, 'M', '𣻑'), - (0x2F90E, 'M', '淹'), - (0x2F90F, 'M', '潮'), - (0x2F910, 'M', '𣽞'), - (0x2F911, 'M', '𣾎'), - (0x2F912, 'M', '濆'), - (0x2F913, 'M', '瀹'), - (0x2F914, 'M', '瀞'), - (0x2F915, 'M', '瀛'), - (0x2F916, 'M', '㶖'), - (0x2F917, 'M', '灊'), - (0x2F918, 'M', '災'), - (0x2F919, 'M', '灷'), - (0x2F91A, 'M', '炭'), - (0x2F91B, 'M', '𠔥'), - (0x2F91C, 'M', '煅'), - (0x2F91D, 'M', '𤉣'), - (0x2F91E, 'M', '熜'), - (0x2F91F, 'X'), - (0x2F920, 'M', '爨'), - (0x2F921, 'M', '爵'), - (0x2F922, 'M', '牐'), - (0x2F923, 'M', '𤘈'), - (0x2F924, 'M', '犀'), - (0x2F925, 'M', '犕'), - (0x2F926, 'M', '𤜵'), - (0x2F927, 'M', '𤠔'), - (0x2F928, 'M', '獺'), - (0x2F929, 'M', '王'), - (0x2F92A, 'M', '㺬'), - (0x2F92B, 'M', '玥'), - (0x2F92C, 'M', '㺸'), - (0x2F92E, 'M', '瑇'), - (0x2F92F, 'M', '瑜'), - (0x2F930, 'M', '瑱'), - (0x2F931, 'M', '璅'), - (0x2F932, 'M', '瓊'), - (0x2F933, 'M', '㼛'), - (0x2F934, 'M', '甤'), - (0x2F935, 'M', '𤰶'), - (0x2F936, 'M', '甾'), - (0x2F937, 'M', '𤲒'), - (0x2F938, 'M', '異'), - (0x2F939, 'M', '𢆟'), - (0x2F93A, 'M', '瘐'), - (0x2F93B, 'M', '𤾡'), - (0x2F93C, 'M', '𤾸'), - (0x2F93D, 'M', '𥁄'), - (0x2F93E, 'M', '㿼'), - (0x2F93F, 'M', '䀈'), - (0x2F940, 'M', '直'), - (0x2F941, 'M', '𥃳'), - (0x2F942, 'M', '𥃲'), - (0x2F943, 'M', '𥄙'), - (0x2F944, 'M', '𥄳'), - (0x2F945, 'M', '眞'), - (0x2F946, 'M', '真'), - (0x2F948, 'M', '睊'), - (0x2F949, 'M', '䀹'), - (0x2F94A, 'M', '瞋'), - (0x2F94B, 'M', '䁆'), - (0x2F94C, 'M', '䂖'), - (0x2F94D, 'M', '𥐝'), - (0x2F94E, 'M', '硎'), - (0x2F94F, 'M', '碌'), - (0x2F950, 'M', '磌'), - (0x2F951, 'M', '䃣'), - (0x2F952, 'M', '𥘦'), - (0x2F953, 'M', '祖'), - (0x2F954, 'M', '𥚚'), - (0x2F955, 'M', '𥛅'), - (0x2F956, 'M', '福'), - (0x2F957, 'M', '秫'), - (0x2F958, 'M', '䄯'), - (0x2F959, 'M', '穀'), - (0x2F95A, 'M', '穊'), - (0x2F95B, 'M', '穏'), - (0x2F95C, 'M', '𥥼'), - (0x2F95D, 'M', '𥪧'), - (0x2F95F, 'X'), - (0x2F960, 'M', '䈂'), - (0x2F961, 'M', '𥮫'), - (0x2F962, 'M', '篆'), - (0x2F963, 'M', '築'), - (0x2F964, 'M', '䈧'), - (0x2F965, 'M', '𥲀'), - (0x2F966, 'M', '糒'), - (0x2F967, 'M', '䊠'), - (0x2F968, 'M', '糨'), - (0x2F969, 'M', '糣'), - (0x2F96A, 'M', '紀'), - (0x2F96B, 'M', '𥾆'), - (0x2F96C, 'M', '絣'), - (0x2F96D, 'M', '䌁'), - (0x2F96E, 'M', '緇'), - (0x2F96F, 'M', '縂'), - (0x2F970, 'M', '繅'), - (0x2F971, 'M', '䌴'), - ] - -def _seg_80() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F972, 'M', '𦈨'), - (0x2F973, 'M', '𦉇'), - (0x2F974, 'M', '䍙'), - (0x2F975, 'M', '𦋙'), - (0x2F976, 'M', '罺'), - (0x2F977, 'M', '𦌾'), - (0x2F978, 'M', '羕'), - (0x2F979, 'M', '翺'), - (0x2F97A, 'M', '者'), - (0x2F97B, 'M', '𦓚'), - (0x2F97C, 'M', '𦔣'), - (0x2F97D, 'M', '聠'), - (0x2F97E, 'M', '𦖨'), - (0x2F97F, 'M', '聰'), - (0x2F980, 'M', '𣍟'), - (0x2F981, 'M', '䏕'), - (0x2F982, 'M', '育'), - (0x2F983, 'M', '脃'), - (0x2F984, 'M', '䐋'), - (0x2F985, 'M', '脾'), - (0x2F986, 'M', '媵'), - (0x2F987, 'M', '𦞧'), - (0x2F988, 'M', '𦞵'), - (0x2F989, 'M', '𣎓'), - (0x2F98A, 'M', '𣎜'), - (0x2F98B, 'M', '舁'), - (0x2F98C, 'M', '舄'), - (0x2F98D, 'M', '辞'), - (0x2F98E, 'M', '䑫'), - (0x2F98F, 'M', '芑'), - (0x2F990, 'M', '芋'), - (0x2F991, 'M', '芝'), - (0x2F992, 'M', '劳'), - (0x2F993, 'M', '花'), - (0x2F994, 'M', '芳'), - (0x2F995, 'M', '芽'), - (0x2F996, 'M', '苦'), - (0x2F997, 'M', '𦬼'), - (0x2F998, 'M', '若'), - (0x2F999, 'M', '茝'), - (0x2F99A, 'M', '荣'), - (0x2F99B, 'M', '莭'), - (0x2F99C, 'M', '茣'), - (0x2F99D, 'M', '莽'), - (0x2F99E, 'M', '菧'), - (0x2F99F, 'M', '著'), - (0x2F9A0, 'M', '荓'), - (0x2F9A1, 'M', '菊'), - (0x2F9A2, 'M', '菌'), - (0x2F9A3, 'M', '菜'), - (0x2F9A4, 'M', '𦰶'), - (0x2F9A5, 'M', '𦵫'), - (0x2F9A6, 'M', '𦳕'), - (0x2F9A7, 'M', '䔫'), - (0x2F9A8, 'M', '蓱'), - (0x2F9A9, 'M', '蓳'), - (0x2F9AA, 'M', '蔖'), - (0x2F9AB, 'M', '𧏊'), - (0x2F9AC, 'M', '蕤'), - (0x2F9AD, 'M', '𦼬'), - (0x2F9AE, 'M', '䕝'), - (0x2F9AF, 'M', '䕡'), - (0x2F9B0, 'M', '𦾱'), - (0x2F9B1, 'M', '𧃒'), - (0x2F9B2, 'M', '䕫'), - (0x2F9B3, 'M', '虐'), - (0x2F9B4, 'M', '虜'), - (0x2F9B5, 'M', '虧'), - (0x2F9B6, 'M', '虩'), - (0x2F9B7, 'M', '蚩'), - (0x2F9B8, 'M', '蚈'), - (0x2F9B9, 'M', '蜎'), - (0x2F9BA, 'M', '蛢'), - (0x2F9BB, 'M', '蝹'), - (0x2F9BC, 'M', '蜨'), - (0x2F9BD, 'M', '蝫'), - (0x2F9BE, 'M', '螆'), - (0x2F9BF, 'X'), - (0x2F9C0, 'M', '蟡'), - (0x2F9C1, 'M', '蠁'), - (0x2F9C2, 'M', '䗹'), - (0x2F9C3, 'M', '衠'), - (0x2F9C4, 'M', '衣'), - (0x2F9C5, 'M', '𧙧'), - (0x2F9C6, 'M', '裗'), - (0x2F9C7, 'M', '裞'), - (0x2F9C8, 'M', '䘵'), - (0x2F9C9, 'M', '裺'), - (0x2F9CA, 'M', '㒻'), - (0x2F9CB, 'M', '𧢮'), - (0x2F9CC, 'M', '𧥦'), - (0x2F9CD, 'M', '䚾'), - (0x2F9CE, 'M', '䛇'), - (0x2F9CF, 'M', '誠'), - (0x2F9D0, 'M', '諭'), - (0x2F9D1, 'M', '變'), - (0x2F9D2, 'M', '豕'), - (0x2F9D3, 'M', '𧲨'), - (0x2F9D4, 'M', '貫'), - (0x2F9D5, 'M', '賁'), - ] - -def _seg_81() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F9D6, 'M', '贛'), - (0x2F9D7, 'M', '起'), - (0x2F9D8, 'M', '𧼯'), - (0x2F9D9, 'M', '𠠄'), - (0x2F9DA, 'M', '跋'), - (0x2F9DB, 'M', '趼'), - (0x2F9DC, 'M', '跰'), - (0x2F9DD, 'M', '𠣞'), - (0x2F9DE, 'M', '軔'), - (0x2F9DF, 'M', '輸'), - (0x2F9E0, 'M', '𨗒'), - (0x2F9E1, 'M', '𨗭'), - (0x2F9E2, 'M', '邔'), - (0x2F9E3, 'M', '郱'), - (0x2F9E4, 'M', '鄑'), - (0x2F9E5, 'M', '𨜮'), - (0x2F9E6, 'M', '鄛'), - (0x2F9E7, 'M', '鈸'), - (0x2F9E8, 'M', '鋗'), - (0x2F9E9, 'M', '鋘'), - (0x2F9EA, 'M', '鉼'), - (0x2F9EB, 'M', '鏹'), - (0x2F9EC, 'M', '鐕'), - (0x2F9ED, 'M', '𨯺'), - (0x2F9EE, 'M', '開'), - (0x2F9EF, 'M', '䦕'), - (0x2F9F0, 'M', '閷'), - (0x2F9F1, 'M', '𨵷'), - (0x2F9F2, 'M', '䧦'), - (0x2F9F3, 'M', '雃'), - (0x2F9F4, 'M', '嶲'), - (0x2F9F5, 'M', '霣'), - (0x2F9F6, 'M', '𩅅'), - (0x2F9F7, 'M', '𩈚'), - (0x2F9F8, 'M', '䩮'), - (0x2F9F9, 'M', '䩶'), - (0x2F9FA, 'M', '韠'), - (0x2F9FB, 'M', '𩐊'), - (0x2F9FC, 'M', '䪲'), - (0x2F9FD, 'M', '𩒖'), - (0x2F9FE, 'M', '頋'), - (0x2FA00, 'M', '頩'), - (0x2FA01, 'M', '𩖶'), - (0x2FA02, 'M', '飢'), - (0x2FA03, 'M', '䬳'), - (0x2FA04, 'M', '餩'), - (0x2FA05, 'M', '馧'), - (0x2FA06, 'M', '駂'), - (0x2FA07, 'M', '駾'), - (0x2FA08, 'M', '䯎'), - (0x2FA09, 'M', '𩬰'), - (0x2FA0A, 'M', '鬒'), - (0x2FA0B, 'M', '鱀'), - (0x2FA0C, 'M', '鳽'), - (0x2FA0D, 'M', '䳎'), - (0x2FA0E, 'M', '䳭'), - (0x2FA0F, 'M', '鵧'), - (0x2FA10, 'M', '𪃎'), - (0x2FA11, 'M', '䳸'), - (0x2FA12, 'M', '𪄅'), - (0x2FA13, 'M', '𪈎'), - (0x2FA14, 'M', '𪊑'), - (0x2FA15, 'M', '麻'), - (0x2FA16, 'M', '䵖'), - (0x2FA17, 'M', '黹'), - (0x2FA18, 'M', '黾'), - (0x2FA19, 'M', '鼅'), - (0x2FA1A, 'M', '鼏'), - (0x2FA1B, 'M', '鼖'), - (0x2FA1C, 'M', '鼻'), - (0x2FA1D, 'M', '𪘀'), - (0x2FA1E, 'X'), - (0x30000, 'V'), - (0x3134B, 'X'), - (0x31350, 'V'), - (0x323B0, 'X'), - (0xE0100, 'I'), - (0xE01F0, 'X'), - ] - -uts46data = tuple( - _seg_0() - + _seg_1() - + _seg_2() - + _seg_3() - + _seg_4() - + _seg_5() - + _seg_6() - + _seg_7() - + _seg_8() - + _seg_9() - + _seg_10() - + _seg_11() - + _seg_12() - + _seg_13() - + _seg_14() - + _seg_15() - + _seg_16() - + _seg_17() - + _seg_18() - + _seg_19() - + _seg_20() - + _seg_21() - + _seg_22() - + _seg_23() - + _seg_24() - + _seg_25() - + _seg_26() - + _seg_27() - + _seg_28() - + _seg_29() - + _seg_30() - + _seg_31() - + _seg_32() - + _seg_33() - + _seg_34() - + _seg_35() - + _seg_36() - + _seg_37() - + _seg_38() - + _seg_39() - + _seg_40() - + _seg_41() - + _seg_42() - + _seg_43() - + _seg_44() - + _seg_45() - + _seg_46() - + _seg_47() - + _seg_48() - + _seg_49() - + _seg_50() - + _seg_51() - + _seg_52() - + _seg_53() - + _seg_54() - + _seg_55() - + _seg_56() - + _seg_57() - + _seg_58() - + _seg_59() - + _seg_60() - + _seg_61() - + _seg_62() - + _seg_63() - + _seg_64() - + _seg_65() - + _seg_66() - + _seg_67() - + _seg_68() - + _seg_69() - + _seg_70() - + _seg_71() - + _seg_72() - + _seg_73() - + _seg_74() - + _seg_75() - + _seg_76() - + _seg_77() - + _seg_78() - + _seg_79() - + _seg_80() - + _seg_81() -) # type: Tuple[Union[Tuple[int, str], Tuple[int, str, str]], ...] diff --git a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE b/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE deleted file mode 100644 index 6f62d44e4ef733c0e713afcd2371fed7f2b3de67..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -This software is made available under the terms of *either* of the licenses -found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made -under the terms of *both* these licenses. diff --git a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE.APACHE b/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE.APACHE deleted file mode 100644 index f433b1a53f5b830a205fd2df78e2b34974656c7b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE.APACHE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE.BSD b/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE.BSD deleted file mode 100644 index 42ce7b75c92fb01a3f6ed17eea363f756b7da582..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/LICENSE.BSD +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) Donald Stufft and individual contributors. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/METADATA b/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/METADATA deleted file mode 100644 index 54db5b5da47f8857ab734dbe09db3b3a91eec956..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/METADATA +++ /dev/null @@ -1,102 +0,0 @@ -Metadata-Version: 2.1 -Name: packaging -Version: 23.2 -Summary: Core utilities for Python packages -Author-email: Donald Stufft -Requires-Python: >=3.7 -Description-Content-Type: text/x-rst -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: License :: OSI Approved :: BSD License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Typing :: Typed -Project-URL: Documentation, https://packaging.pypa.io/ -Project-URL: Source, https://github.com/pypa/packaging - -packaging -========= - -.. start-intro - -Reusable core utilities for various Python Packaging -`interoperability specifications `_. - -This library provides utilities that implement the interoperability -specifications which have clearly one correct behaviour (eg: :pep:`440`) -or benefit greatly from having a single shared implementation (eg: :pep:`425`). - -.. end-intro - -The ``packaging`` project includes the following: version handling, specifiers, -markers, requirements, tags, utilities. - -Documentation -------------- - -The `documentation`_ provides information and the API for the following: - -- Version Handling -- Specifiers -- Markers -- Requirements -- Tags -- Utilities - -Installation ------------- - -Use ``pip`` to install these utilities:: - - pip install packaging - -The ``packaging`` library uses calendar-based versioning (``YY.N``). - -Discussion ----------- - -If you run into bugs, you can file them in our `issue tracker`_. - -You can also join ``#pypa`` on Freenode to ask questions or get involved. - - -.. _`documentation`: https://packaging.pypa.io/ -.. _`issue tracker`: https://github.com/pypa/packaging/issues - - -Code of Conduct ---------------- - -Everyone interacting in the packaging project's codebases, issue trackers, chat -rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_. - -.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md - -Contributing ------------- - -The ``CONTRIBUTING.rst`` file outlines how to contribute to this project as -well as how to report a potential security issue. The documentation for this -project also covers information about `project development`_ and `security`_. - -.. _`project development`: https://packaging.pypa.io/en/latest/development/ -.. _`security`: https://packaging.pypa.io/en/latest/security/ - -Project History ---------------- - -Please review the ``CHANGELOG.rst`` file or the `Changelog documentation`_ for -recent changes and project history. - -.. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/ - diff --git a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/RECORD b/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/RECORD deleted file mode 100644 index 49dae9e220c2e408583955a8856c2deb7da1f0f2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/RECORD +++ /dev/null @@ -1,36 +0,0 @@ -packaging-23.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -packaging-23.2.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197 -packaging-23.2.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174 -packaging-23.2.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344 -packaging-23.2.dist-info/METADATA,sha256=s1dJQ86EjZBul_UCkQNGdHcbLts6Zg4_mxCqk60X6xs,3203 -packaging-23.2.dist-info/RECORD,, -packaging-23.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81 -packaging/__init__.py,sha256=EhCMuCSz60IgQJ93b_4wJyAoHpU9J-uddG4QaMT0Pu4,496 -packaging/__pycache__/__init__.cpython-38.pyc,, -packaging/__pycache__/_elffile.cpython-38.pyc,, -packaging/__pycache__/_manylinux.cpython-38.pyc,, -packaging/__pycache__/_musllinux.cpython-38.pyc,, -packaging/__pycache__/_parser.cpython-38.pyc,, -packaging/__pycache__/_structures.cpython-38.pyc,, -packaging/__pycache__/_tokenizer.cpython-38.pyc,, -packaging/__pycache__/markers.cpython-38.pyc,, -packaging/__pycache__/metadata.cpython-38.pyc,, -packaging/__pycache__/requirements.cpython-38.pyc,, -packaging/__pycache__/specifiers.cpython-38.pyc,, -packaging/__pycache__/tags.cpython-38.pyc,, -packaging/__pycache__/utils.cpython-38.pyc,, -packaging/__pycache__/version.cpython-38.pyc,, -packaging/_elffile.py,sha256=hbmK8OD6Z7fY6hwinHEUcD1by7czkGiNYu7ShnFEk2k,3266 -packaging/_manylinux.py,sha256=Rq6ppXAxH8XFtNf6tC-B-1SKuvCODPBvcCoSulMtbtk,9526 -packaging/_musllinux.py,sha256=kgmBGLFybpy8609-KTvzmt2zChCPWYvhp5BWP4JX7dE,2676 -packaging/_parser.py,sha256=5DhK_zYJE4U4yzSkgEBT4F7tT2xZ6Pkx4gSRKyvXneQ,10382 -packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431 -packaging/_tokenizer.py,sha256=alCtbwXhOFAmFGZ6BQ-wCTSFoRAJ2z-ysIf7__MTJ_k,5292 -packaging/markers.py,sha256=eH-txS2zq1HdNpTd9LcZUcVIwewAiNU0grmq5wjKnOk,8208 -packaging/metadata.py,sha256=ToxjINOmSn8mbEeXRSVNMidEJsPUYHEYFnnN4MaqvH0,32750 -packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -packaging/requirements.py,sha256=wswG4mXHSgE9w4NjNnlSvgLGo6yYvfHVEFnWhuEmXxg,2952 -packaging/specifiers.py,sha256=ZOpqL_w_Kj6ZF_OWdliQUzhEyHlDbi6989kr-sF5GHs,39206 -packaging/tags.py,sha256=pkG6gQ28RlhS09VzymVhVpGrWF5doHXfK1VxG9cdhoY,18355 -packaging/utils.py,sha256=XgdmP3yx9-wQEFjO7OvMj9RjEf5JlR5HFFR69v7SQ9E,5268 -packaging/version.py,sha256=XjRBLNK17UMDgLeP8UHnqwiY3TdSi03xFQURtec211A,16236 diff --git a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/WHEEL b/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/WHEEL deleted file mode 100644 index 3b5e64b5e6c4a210201d1676a891fd57b15cda99..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging-23.2.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.9.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/venv/lib/python3.8/site-packages/packaging/__init__.py b/venv/lib/python3.8/site-packages/packaging/__init__.py deleted file mode 100644 index 22809cfd5dc25792d77070c269fc8d111a12eed0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -__title__ = "packaging" -__summary__ = "Core utilities for Python packages" -__uri__ = "https://github.com/pypa/packaging" - -__version__ = "23.2" - -__author__ = "Donald Stufft and individual contributors" -__email__ = "donald@stufft.io" - -__license__ = "BSD-2-Clause or Apache-2.0" -__copyright__ = "2014 %s" % __author__ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 11585cdfac551bc41cb5e713f8fc029653794508..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/_elffile.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/_elffile.cpython-38.pyc deleted file mode 100644 index 6d4094cd6a91e47d41231303a42d0cd15fba62dd..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/_elffile.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/_manylinux.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/_manylinux.cpython-38.pyc deleted file mode 100644 index 750aa6536e74c9e7749c488303d328616e9c6746..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/_manylinux.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/_musllinux.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/_musllinux.cpython-38.pyc deleted file mode 100644 index f41455d058f16f66fc8480fd292ecb4f9e20cb00..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/_musllinux.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/_parser.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/_parser.cpython-38.pyc deleted file mode 100644 index 832f29527e8922dff7ee43b10150b36c736befe7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/_parser.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/_structures.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/_structures.cpython-38.pyc deleted file mode 100644 index 3a544485aaf81bd9812898d4767d524011354e1f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/_structures.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/_tokenizer.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/_tokenizer.cpython-38.pyc deleted file mode 100644 index 2fa388030f00a1983d5ccd78a9f949c45d25d51f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/_tokenizer.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/markers.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/markers.cpython-38.pyc deleted file mode 100644 index 4cb69138691a0fbc259ef64dede52beed9583365..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/markers.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/metadata.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/metadata.cpython-38.pyc deleted file mode 100644 index 421c7ebc836124dab12e9b617c60045849ac380d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/metadata.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/requirements.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/requirements.cpython-38.pyc deleted file mode 100644 index 8c155ca2a1c476c0a7010932b4b40ebf10946437..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/requirements.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/specifiers.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/specifiers.cpython-38.pyc deleted file mode 100644 index 1ab8cd3283b24d02fe8862f437f3073dbc0b34d5..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/specifiers.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/tags.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/tags.cpython-38.pyc deleted file mode 100644 index 7cd110ee431b218585ff7297e483ac30647bb11b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/tags.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/utils.cpython-38.pyc deleted file mode 100644 index 6dbea20dbde16d5c27763cd5c347999e3cfd53d6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/__pycache__/version.cpython-38.pyc b/venv/lib/python3.8/site-packages/packaging/__pycache__/version.cpython-38.pyc deleted file mode 100644 index 9d4002dd1d569243147220d4687e34c94999ec2d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/packaging/__pycache__/version.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/packaging/_elffile.py b/venv/lib/python3.8/site-packages/packaging/_elffile.py deleted file mode 100644 index 6fb19b30bb53c18f38a9ef02dd7c4478670fb962..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/_elffile.py +++ /dev/null @@ -1,108 +0,0 @@ -""" -ELF file parser. - -This provides a class ``ELFFile`` that parses an ELF executable in a similar -interface to ``ZipFile``. Only the read interface is implemented. - -Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca -ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html -""" - -import enum -import os -import struct -from typing import IO, Optional, Tuple - - -class ELFInvalid(ValueError): - pass - - -class EIClass(enum.IntEnum): - C32 = 1 - C64 = 2 - - -class EIData(enum.IntEnum): - Lsb = 1 - Msb = 2 - - -class EMachine(enum.IntEnum): - I386 = 3 - S390 = 22 - Arm = 40 - X8664 = 62 - AArc64 = 183 - - -class ELFFile: - """ - Representation of an ELF executable. - """ - - def __init__(self, f: IO[bytes]) -> None: - self._f = f - - try: - ident = self._read("16B") - except struct.error: - raise ELFInvalid("unable to parse identification") - magic = bytes(ident[:4]) - if magic != b"\x7fELF": - raise ELFInvalid(f"invalid magic: {magic!r}") - - self.capacity = ident[4] # Format for program header (bitness). - self.encoding = ident[5] # Data structure encoding (endianness). - - try: - # e_fmt: Format for program header. - # p_fmt: Format for section header. - # p_idx: Indexes to find p_type, p_offset, and p_filesz. - e_fmt, self._p_fmt, self._p_idx = { - (1, 1): ("HHIIIIIHHH", ">IIIIIIII", (0, 1, 4)), # 32-bit MSB. - (2, 1): ("HHIQQQIHHH", ">IIQQQQQQ", (0, 2, 5)), # 64-bit MSB. - }[(self.capacity, self.encoding)] - except KeyError: - raise ELFInvalid( - f"unrecognized capacity ({self.capacity}) or " - f"encoding ({self.encoding})" - ) - - try: - ( - _, - self.machine, # Architecture type. - _, - _, - self._e_phoff, # Offset of program header. - _, - self.flags, # Processor-specific flags. - _, - self._e_phentsize, # Size of section. - self._e_phnum, # Number of sections. - ) = self._read(e_fmt) - except struct.error as e: - raise ELFInvalid("unable to parse machine and section information") from e - - def _read(self, fmt: str) -> Tuple[int, ...]: - return struct.unpack(fmt, self._f.read(struct.calcsize(fmt))) - - @property - def interpreter(self) -> Optional[str]: - """ - The path recorded in the ``PT_INTERP`` section header. - """ - for index in range(self._e_phnum): - self._f.seek(self._e_phoff + self._e_phentsize * index) - try: - data = self._read(self._p_fmt) - except struct.error: - continue - if data[self._p_idx[0]] != 3: # Not PT_INTERP. - continue - self._f.seek(data[self._p_idx[1]]) - return os.fsdecode(self._f.read(data[self._p_idx[2]])).strip("\0") - return None diff --git a/venv/lib/python3.8/site-packages/packaging/_manylinux.py b/venv/lib/python3.8/site-packages/packaging/_manylinux.py deleted file mode 100644 index 3705d50db9193e445056ebc6270faab2319a04db..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/_manylinux.py +++ /dev/null @@ -1,252 +0,0 @@ -import collections -import contextlib -import functools -import os -import re -import sys -import warnings -from typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple - -from ._elffile import EIClass, EIData, ELFFile, EMachine - -EF_ARM_ABIMASK = 0xFF000000 -EF_ARM_ABI_VER5 = 0x05000000 -EF_ARM_ABI_FLOAT_HARD = 0x00000400 - - -# `os.PathLike` not a generic type until Python 3.9, so sticking with `str` -# as the type for `path` until then. -@contextlib.contextmanager -def _parse_elf(path: str) -> Generator[Optional[ELFFile], None, None]: - try: - with open(path, "rb") as f: - yield ELFFile(f) - except (OSError, TypeError, ValueError): - yield None - - -def _is_linux_armhf(executable: str) -> bool: - # hard-float ABI can be detected from the ELF header of the running - # process - # https://static.docs.arm.com/ihi0044/g/aaelf32.pdf - with _parse_elf(executable) as f: - return ( - f is not None - and f.capacity == EIClass.C32 - and f.encoding == EIData.Lsb - and f.machine == EMachine.Arm - and f.flags & EF_ARM_ABIMASK == EF_ARM_ABI_VER5 - and f.flags & EF_ARM_ABI_FLOAT_HARD == EF_ARM_ABI_FLOAT_HARD - ) - - -def _is_linux_i686(executable: str) -> bool: - with _parse_elf(executable) as f: - return ( - f is not None - and f.capacity == EIClass.C32 - and f.encoding == EIData.Lsb - and f.machine == EMachine.I386 - ) - - -def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool: - if "armv7l" in archs: - return _is_linux_armhf(executable) - if "i686" in archs: - return _is_linux_i686(executable) - allowed_archs = {"x86_64", "aarch64", "ppc64", "ppc64le", "s390x", "loongarch64"} - return any(arch in allowed_archs for arch in archs) - - -# If glibc ever changes its major version, we need to know what the last -# minor version was, so we can build the complete list of all versions. -# For now, guess what the highest minor version might be, assume it will -# be 50 for testing. Once this actually happens, update the dictionary -# with the actual value. -_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50) - - -class _GLibCVersion(NamedTuple): - major: int - minor: int - - -def _glibc_version_string_confstr() -> Optional[str]: - """ - Primary implementation of glibc_version_string using os.confstr. - """ - # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely - # to be broken or missing. This strategy is used in the standard library - # platform module. - # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183 - try: - # Should be a string like "glibc 2.17". - version_string: str = getattr(os, "confstr")("CS_GNU_LIBC_VERSION") - assert version_string is not None - _, version = version_string.rsplit() - except (AssertionError, AttributeError, OSError, ValueError): - # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)... - return None - return version - - -def _glibc_version_string_ctypes() -> Optional[str]: - """ - Fallback implementation of glibc_version_string using ctypes. - """ - try: - import ctypes - except ImportError: - return None - - # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen - # manpage says, "If filename is NULL, then the returned handle is for the - # main program". This way we can let the linker do the work to figure out - # which libc our process is actually using. - # - # We must also handle the special case where the executable is not a - # dynamically linked executable. This can occur when using musl libc, - # for example. In this situation, dlopen() will error, leading to an - # OSError. Interestingly, at least in the case of musl, there is no - # errno set on the OSError. The single string argument used to construct - # OSError comes from libc itself and is therefore not portable to - # hard code here. In any case, failure to call dlopen() means we - # can proceed, so we bail on our attempt. - try: - process_namespace = ctypes.CDLL(None) - except OSError: - return None - - try: - gnu_get_libc_version = process_namespace.gnu_get_libc_version - except AttributeError: - # Symbol doesn't exist -> therefore, we are not linked to - # glibc. - return None - - # Call gnu_get_libc_version, which returns a string like "2.5" - gnu_get_libc_version.restype = ctypes.c_char_p - version_str: str = gnu_get_libc_version() - # py2 / py3 compatibility: - if not isinstance(version_str, str): - version_str = version_str.decode("ascii") - - return version_str - - -def _glibc_version_string() -> Optional[str]: - """Returns glibc version string, or None if not using glibc.""" - return _glibc_version_string_confstr() or _glibc_version_string_ctypes() - - -def _parse_glibc_version(version_str: str) -> Tuple[int, int]: - """Parse glibc version. - - We use a regexp instead of str.split because we want to discard any - random junk that might come after the minor version -- this might happen - in patched/forked versions of glibc (e.g. Linaro's version of glibc - uses version strings like "2.20-2014.11"). See gh-3588. - """ - m = re.match(r"(?P[0-9]+)\.(?P[0-9]+)", version_str) - if not m: - warnings.warn( - f"Expected glibc version with 2 components major.minor," - f" got: {version_str}", - RuntimeWarning, - ) - return -1, -1 - return int(m.group("major")), int(m.group("minor")) - - -@functools.lru_cache() -def _get_glibc_version() -> Tuple[int, int]: - version_str = _glibc_version_string() - if version_str is None: - return (-1, -1) - return _parse_glibc_version(version_str) - - -# From PEP 513, PEP 600 -def _is_compatible(arch: str, version: _GLibCVersion) -> bool: - sys_glibc = _get_glibc_version() - if sys_glibc < version: - return False - # Check for presence of _manylinux module. - try: - import _manylinux # noqa - except ImportError: - return True - if hasattr(_manylinux, "manylinux_compatible"): - result = _manylinux.manylinux_compatible(version[0], version[1], arch) - if result is not None: - return bool(result) - return True - if version == _GLibCVersion(2, 5): - if hasattr(_manylinux, "manylinux1_compatible"): - return bool(_manylinux.manylinux1_compatible) - if version == _GLibCVersion(2, 12): - if hasattr(_manylinux, "manylinux2010_compatible"): - return bool(_manylinux.manylinux2010_compatible) - if version == _GLibCVersion(2, 17): - if hasattr(_manylinux, "manylinux2014_compatible"): - return bool(_manylinux.manylinux2014_compatible) - return True - - -_LEGACY_MANYLINUX_MAP = { - # CentOS 7 w/ glibc 2.17 (PEP 599) - (2, 17): "manylinux2014", - # CentOS 6 w/ glibc 2.12 (PEP 571) - (2, 12): "manylinux2010", - # CentOS 5 w/ glibc 2.5 (PEP 513) - (2, 5): "manylinux1", -} - - -def platform_tags(archs: Sequence[str]) -> Iterator[str]: - """Generate manylinux tags compatible to the current platform. - - :param archs: Sequence of compatible architectures. - The first one shall be the closest to the actual architecture and be the part of - platform tag after the ``linux_`` prefix, e.g. ``x86_64``. - The ``linux_`` prefix is assumed as a prerequisite for the current platform to - be manylinux-compatible. - - :returns: An iterator of compatible manylinux tags. - """ - if not _have_compatible_abi(sys.executable, archs): - return - # Oldest glibc to be supported regardless of architecture is (2, 17). - too_old_glibc2 = _GLibCVersion(2, 16) - if set(archs) & {"x86_64", "i686"}: - # On x86/i686 also oldest glibc to be supported is (2, 5). - too_old_glibc2 = _GLibCVersion(2, 4) - current_glibc = _GLibCVersion(*_get_glibc_version()) - glibc_max_list = [current_glibc] - # We can assume compatibility across glibc major versions. - # https://sourceware.org/bugzilla/show_bug.cgi?id=24636 - # - # Build a list of maximum glibc versions so that we can - # output the canonical list of all glibc from current_glibc - # down to too_old_glibc2, including all intermediary versions. - for glibc_major in range(current_glibc.major - 1, 1, -1): - glibc_minor = _LAST_GLIBC_MINOR[glibc_major] - glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor)) - for arch in archs: - for glibc_max in glibc_max_list: - if glibc_max.major == too_old_glibc2.major: - min_minor = too_old_glibc2.minor - else: - # For other glibc major versions oldest supported is (x, 0). - min_minor = -1 - for glibc_minor in range(glibc_max.minor, min_minor, -1): - glibc_version = _GLibCVersion(glibc_max.major, glibc_minor) - tag = "manylinux_{}_{}".format(*glibc_version) - if _is_compatible(arch, glibc_version): - yield f"{tag}_{arch}" - # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags. - if glibc_version in _LEGACY_MANYLINUX_MAP: - legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version] - if _is_compatible(arch, glibc_version): - yield f"{legacy_tag}_{arch}" diff --git a/venv/lib/python3.8/site-packages/packaging/_musllinux.py b/venv/lib/python3.8/site-packages/packaging/_musllinux.py deleted file mode 100644 index 86419df9d7087f3f8b6d0096f32a52c24b05e7c1..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/_musllinux.py +++ /dev/null @@ -1,83 +0,0 @@ -"""PEP 656 support. - -This module implements logic to detect if the currently running Python is -linked against musl, and what musl version is used. -""" - -import functools -import re -import subprocess -import sys -from typing import Iterator, NamedTuple, Optional, Sequence - -from ._elffile import ELFFile - - -class _MuslVersion(NamedTuple): - major: int - minor: int - - -def _parse_musl_version(output: str) -> Optional[_MuslVersion]: - lines = [n for n in (n.strip() for n in output.splitlines()) if n] - if len(lines) < 2 or lines[0][:4] != "musl": - return None - m = re.match(r"Version (\d+)\.(\d+)", lines[1]) - if not m: - return None - return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2))) - - -@functools.lru_cache() -def _get_musl_version(executable: str) -> Optional[_MuslVersion]: - """Detect currently-running musl runtime version. - - This is done by checking the specified executable's dynamic linking - information, and invoking the loader to parse its output for a version - string. If the loader is musl, the output would be something like:: - - musl libc (x86_64) - Version 1.2.2 - Dynamic Program Loader - """ - try: - with open(executable, "rb") as f: - ld = ELFFile(f).interpreter - except (OSError, TypeError, ValueError): - return None - if ld is None or "musl" not in ld: - return None - proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True) - return _parse_musl_version(proc.stderr) - - -def platform_tags(archs: Sequence[str]) -> Iterator[str]: - """Generate musllinux tags compatible to the current platform. - - :param archs: Sequence of compatible architectures. - The first one shall be the closest to the actual architecture and be the part of - platform tag after the ``linux_`` prefix, e.g. ``x86_64``. - The ``linux_`` prefix is assumed as a prerequisite for the current platform to - be musllinux-compatible. - - :returns: An iterator of compatible musllinux tags. - """ - sys_musl = _get_musl_version(sys.executable) - if sys_musl is None: # Python not dynamically linked against musl. - return - for arch in archs: - for minor in range(sys_musl.minor, -1, -1): - yield f"musllinux_{sys_musl.major}_{minor}_{arch}" - - -if __name__ == "__main__": # pragma: no cover - import sysconfig - - plat = sysconfig.get_platform() - assert plat.startswith("linux-"), "not linux" - - print("plat:", plat) - print("musl:", _get_musl_version(sys.executable)) - print("tags:", end=" ") - for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])): - print(t, end="\n ") diff --git a/venv/lib/python3.8/site-packages/packaging/_parser.py b/venv/lib/python3.8/site-packages/packaging/_parser.py deleted file mode 100644 index 4576981c2dd7552d8b37dedf92d0f7466857ac41..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/_parser.py +++ /dev/null @@ -1,359 +0,0 @@ -"""Handwritten parser of dependency specifiers. - -The docstring for each __parse_* function contains ENBF-inspired grammar representing -the implementation. -""" - -import ast -from typing import Any, List, NamedTuple, Optional, Tuple, Union - -from ._tokenizer import DEFAULT_RULES, Tokenizer - - -class Node: - def __init__(self, value: str) -> None: - self.value = value - - def __str__(self) -> str: - return self.value - - def __repr__(self) -> str: - return f"<{self.__class__.__name__}('{self}')>" - - def serialize(self) -> str: - raise NotImplementedError - - -class Variable(Node): - def serialize(self) -> str: - return str(self) - - -class Value(Node): - def serialize(self) -> str: - return f'"{self}"' - - -class Op(Node): - def serialize(self) -> str: - return str(self) - - -MarkerVar = Union[Variable, Value] -MarkerItem = Tuple[MarkerVar, Op, MarkerVar] -# MarkerAtom = Union[MarkerItem, List["MarkerAtom"]] -# MarkerList = List[Union["MarkerList", MarkerAtom, str]] -# mypy does not support recursive type definition -# https://github.com/python/mypy/issues/731 -MarkerAtom = Any -MarkerList = List[Any] - - -class ParsedRequirement(NamedTuple): - name: str - url: str - extras: List[str] - specifier: str - marker: Optional[MarkerList] - - -# -------------------------------------------------------------------------------------- -# Recursive descent parser for dependency specifier -# -------------------------------------------------------------------------------------- -def parse_requirement(source: str) -> ParsedRequirement: - return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES)) - - -def _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement: - """ - requirement = WS? IDENTIFIER WS? extras WS? requirement_details - """ - tokenizer.consume("WS") - - name_token = tokenizer.expect( - "IDENTIFIER", expected="package name at the start of dependency specifier" - ) - name = name_token.text - tokenizer.consume("WS") - - extras = _parse_extras(tokenizer) - tokenizer.consume("WS") - - url, specifier, marker = _parse_requirement_details(tokenizer) - tokenizer.expect("END", expected="end of dependency specifier") - - return ParsedRequirement(name, url, extras, specifier, marker) - - -def _parse_requirement_details( - tokenizer: Tokenizer, -) -> Tuple[str, str, Optional[MarkerList]]: - """ - requirement_details = AT URL (WS requirement_marker?)? - | specifier WS? (requirement_marker)? - """ - - specifier = "" - url = "" - marker = None - - if tokenizer.check("AT"): - tokenizer.read() - tokenizer.consume("WS") - - url_start = tokenizer.position - url = tokenizer.expect("URL", expected="URL after @").text - if tokenizer.check("END", peek=True): - return (url, specifier, marker) - - tokenizer.expect("WS", expected="whitespace after URL") - - # The input might end after whitespace. - if tokenizer.check("END", peek=True): - return (url, specifier, marker) - - marker = _parse_requirement_marker( - tokenizer, span_start=url_start, after="URL and whitespace" - ) - else: - specifier_start = tokenizer.position - specifier = _parse_specifier(tokenizer) - tokenizer.consume("WS") - - if tokenizer.check("END", peek=True): - return (url, specifier, marker) - - marker = _parse_requirement_marker( - tokenizer, - span_start=specifier_start, - after=( - "version specifier" - if specifier - else "name and no valid version specifier" - ), - ) - - return (url, specifier, marker) - - -def _parse_requirement_marker( - tokenizer: Tokenizer, *, span_start: int, after: str -) -> MarkerList: - """ - requirement_marker = SEMICOLON marker WS? - """ - - if not tokenizer.check("SEMICOLON"): - tokenizer.raise_syntax_error( - f"Expected end or semicolon (after {after})", - span_start=span_start, - ) - tokenizer.read() - - marker = _parse_marker(tokenizer) - tokenizer.consume("WS") - - return marker - - -def _parse_extras(tokenizer: Tokenizer) -> List[str]: - """ - extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)? - """ - if not tokenizer.check("LEFT_BRACKET", peek=True): - return [] - - with tokenizer.enclosing_tokens( - "LEFT_BRACKET", - "RIGHT_BRACKET", - around="extras", - ): - tokenizer.consume("WS") - extras = _parse_extras_list(tokenizer) - tokenizer.consume("WS") - - return extras - - -def _parse_extras_list(tokenizer: Tokenizer) -> List[str]: - """ - extras_list = identifier (wsp* ',' wsp* identifier)* - """ - extras: List[str] = [] - - if not tokenizer.check("IDENTIFIER"): - return extras - - extras.append(tokenizer.read().text) - - while True: - tokenizer.consume("WS") - if tokenizer.check("IDENTIFIER", peek=True): - tokenizer.raise_syntax_error("Expected comma between extra names") - elif not tokenizer.check("COMMA"): - break - - tokenizer.read() - tokenizer.consume("WS") - - extra_token = tokenizer.expect("IDENTIFIER", expected="extra name after comma") - extras.append(extra_token.text) - - return extras - - -def _parse_specifier(tokenizer: Tokenizer) -> str: - """ - specifier = LEFT_PARENTHESIS WS? version_many WS? RIGHT_PARENTHESIS - | WS? version_many WS? - """ - with tokenizer.enclosing_tokens( - "LEFT_PARENTHESIS", - "RIGHT_PARENTHESIS", - around="version specifier", - ): - tokenizer.consume("WS") - parsed_specifiers = _parse_version_many(tokenizer) - tokenizer.consume("WS") - - return parsed_specifiers - - -def _parse_version_many(tokenizer: Tokenizer) -> str: - """ - version_many = (SPECIFIER (WS? COMMA WS? SPECIFIER)*)? - """ - parsed_specifiers = "" - while tokenizer.check("SPECIFIER"): - span_start = tokenizer.position - parsed_specifiers += tokenizer.read().text - if tokenizer.check("VERSION_PREFIX_TRAIL", peek=True): - tokenizer.raise_syntax_error( - ".* suffix can only be used with `==` or `!=` operators", - span_start=span_start, - span_end=tokenizer.position + 1, - ) - if tokenizer.check("VERSION_LOCAL_LABEL_TRAIL", peek=True): - tokenizer.raise_syntax_error( - "Local version label can only be used with `==` or `!=` operators", - span_start=span_start, - span_end=tokenizer.position, - ) - tokenizer.consume("WS") - if not tokenizer.check("COMMA"): - break - parsed_specifiers += tokenizer.read().text - tokenizer.consume("WS") - - return parsed_specifiers - - -# -------------------------------------------------------------------------------------- -# Recursive descent parser for marker expression -# -------------------------------------------------------------------------------------- -def parse_marker(source: str) -> MarkerList: - return _parse_full_marker(Tokenizer(source, rules=DEFAULT_RULES)) - - -def _parse_full_marker(tokenizer: Tokenizer) -> MarkerList: - retval = _parse_marker(tokenizer) - tokenizer.expect("END", expected="end of marker expression") - return retval - - -def _parse_marker(tokenizer: Tokenizer) -> MarkerList: - """ - marker = marker_atom (BOOLOP marker_atom)+ - """ - expression = [_parse_marker_atom(tokenizer)] - while tokenizer.check("BOOLOP"): - token = tokenizer.read() - expr_right = _parse_marker_atom(tokenizer) - expression.extend((token.text, expr_right)) - return expression - - -def _parse_marker_atom(tokenizer: Tokenizer) -> MarkerAtom: - """ - marker_atom = WS? LEFT_PARENTHESIS WS? marker WS? RIGHT_PARENTHESIS WS? - | WS? marker_item WS? - """ - - tokenizer.consume("WS") - if tokenizer.check("LEFT_PARENTHESIS", peek=True): - with tokenizer.enclosing_tokens( - "LEFT_PARENTHESIS", - "RIGHT_PARENTHESIS", - around="marker expression", - ): - tokenizer.consume("WS") - marker: MarkerAtom = _parse_marker(tokenizer) - tokenizer.consume("WS") - else: - marker = _parse_marker_item(tokenizer) - tokenizer.consume("WS") - return marker - - -def _parse_marker_item(tokenizer: Tokenizer) -> MarkerItem: - """ - marker_item = WS? marker_var WS? marker_op WS? marker_var WS? - """ - tokenizer.consume("WS") - marker_var_left = _parse_marker_var(tokenizer) - tokenizer.consume("WS") - marker_op = _parse_marker_op(tokenizer) - tokenizer.consume("WS") - marker_var_right = _parse_marker_var(tokenizer) - tokenizer.consume("WS") - return (marker_var_left, marker_op, marker_var_right) - - -def _parse_marker_var(tokenizer: Tokenizer) -> MarkerVar: - """ - marker_var = VARIABLE | QUOTED_STRING - """ - if tokenizer.check("VARIABLE"): - return process_env_var(tokenizer.read().text.replace(".", "_")) - elif tokenizer.check("QUOTED_STRING"): - return process_python_str(tokenizer.read().text) - else: - tokenizer.raise_syntax_error( - message="Expected a marker variable or quoted string" - ) - - -def process_env_var(env_var: str) -> Variable: - if ( - env_var == "platform_python_implementation" - or env_var == "python_implementation" - ): - return Variable("platform_python_implementation") - else: - return Variable(env_var) - - -def process_python_str(python_str: str) -> Value: - value = ast.literal_eval(python_str) - return Value(str(value)) - - -def _parse_marker_op(tokenizer: Tokenizer) -> Op: - """ - marker_op = IN | NOT IN | OP - """ - if tokenizer.check("IN"): - tokenizer.read() - return Op("in") - elif tokenizer.check("NOT"): - tokenizer.read() - tokenizer.expect("WS", expected="whitespace after 'not'") - tokenizer.expect("IN", expected="'in' after 'not'") - return Op("not in") - elif tokenizer.check("OP"): - return Op(tokenizer.read().text) - else: - return tokenizer.raise_syntax_error( - "Expected marker operator, one of " - "<=, <, !=, ==, >=, >, ~=, ===, in, not in" - ) diff --git a/venv/lib/python3.8/site-packages/packaging/_structures.py b/venv/lib/python3.8/site-packages/packaging/_structures.py deleted file mode 100644 index 90a6465f9682c886363eea5327dac64bf623a6ff..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/_structures.py +++ /dev/null @@ -1,61 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - - -class InfinityType: - def __repr__(self) -> str: - return "Infinity" - - def __hash__(self) -> int: - return hash(repr(self)) - - def __lt__(self, other: object) -> bool: - return False - - def __le__(self, other: object) -> bool: - return False - - def __eq__(self, other: object) -> bool: - return isinstance(other, self.__class__) - - def __gt__(self, other: object) -> bool: - return True - - def __ge__(self, other: object) -> bool: - return True - - def __neg__(self: object) -> "NegativeInfinityType": - return NegativeInfinity - - -Infinity = InfinityType() - - -class NegativeInfinityType: - def __repr__(self) -> str: - return "-Infinity" - - def __hash__(self) -> int: - return hash(repr(self)) - - def __lt__(self, other: object) -> bool: - return True - - def __le__(self, other: object) -> bool: - return True - - def __eq__(self, other: object) -> bool: - return isinstance(other, self.__class__) - - def __gt__(self, other: object) -> bool: - return False - - def __ge__(self, other: object) -> bool: - return False - - def __neg__(self: object) -> InfinityType: - return Infinity - - -NegativeInfinity = NegativeInfinityType() diff --git a/venv/lib/python3.8/site-packages/packaging/_tokenizer.py b/venv/lib/python3.8/site-packages/packaging/_tokenizer.py deleted file mode 100644 index dd0d648d49a7c1a62d25ce5c9107aa448a8a22d1..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/_tokenizer.py +++ /dev/null @@ -1,192 +0,0 @@ -import contextlib -import re -from dataclasses import dataclass -from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union - -from .specifiers import Specifier - - -@dataclass -class Token: - name: str - text: str - position: int - - -class ParserSyntaxError(Exception): - """The provided source text could not be parsed correctly.""" - - def __init__( - self, - message: str, - *, - source: str, - span: Tuple[int, int], - ) -> None: - self.span = span - self.message = message - self.source = source - - super().__init__() - - def __str__(self) -> str: - marker = " " * self.span[0] + "~" * (self.span[1] - self.span[0]) + "^" - return "\n ".join([self.message, self.source, marker]) - - -DEFAULT_RULES: "Dict[str, Union[str, re.Pattern[str]]]" = { - "LEFT_PARENTHESIS": r"\(", - "RIGHT_PARENTHESIS": r"\)", - "LEFT_BRACKET": r"\[", - "RIGHT_BRACKET": r"\]", - "SEMICOLON": r";", - "COMMA": r",", - "QUOTED_STRING": re.compile( - r""" - ( - ('[^']*') - | - ("[^"]*") - ) - """, - re.VERBOSE, - ), - "OP": r"(===|==|~=|!=|<=|>=|<|>)", - "BOOLOP": r"\b(or|and)\b", - "IN": r"\bin\b", - "NOT": r"\bnot\b", - "VARIABLE": re.compile( - r""" - \b( - python_version - |python_full_version - |os[._]name - |sys[._]platform - |platform_(release|system) - |platform[._](version|machine|python_implementation) - |python_implementation - |implementation_(name|version) - |extra - )\b - """, - re.VERBOSE, - ), - "SPECIFIER": re.compile( - Specifier._operator_regex_str + Specifier._version_regex_str, - re.VERBOSE | re.IGNORECASE, - ), - "AT": r"\@", - "URL": r"[^ \t]+", - "IDENTIFIER": r"\b[a-zA-Z0-9][a-zA-Z0-9._-]*\b", - "VERSION_PREFIX_TRAIL": r"\.\*", - "VERSION_LOCAL_LABEL_TRAIL": r"\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*", - "WS": r"[ \t]+", - "END": r"$", -} - - -class Tokenizer: - """Context-sensitive token parsing. - - Provides methods to examine the input stream to check whether the next token - matches. - """ - - def __init__( - self, - source: str, - *, - rules: "Dict[str, Union[str, re.Pattern[str]]]", - ) -> None: - self.source = source - self.rules: Dict[str, re.Pattern[str]] = { - name: re.compile(pattern) for name, pattern in rules.items() - } - self.next_token: Optional[Token] = None - self.position = 0 - - def consume(self, name: str) -> None: - """Move beyond provided token name, if at current position.""" - if self.check(name): - self.read() - - def check(self, name: str, *, peek: bool = False) -> bool: - """Check whether the next token has the provided name. - - By default, if the check succeeds, the token *must* be read before - another check. If `peek` is set to `True`, the token is not loaded and - would need to be checked again. - """ - assert ( - self.next_token is None - ), f"Cannot check for {name!r}, already have {self.next_token!r}" - assert name in self.rules, f"Unknown token name: {name!r}" - - expression = self.rules[name] - - match = expression.match(self.source, self.position) - if match is None: - return False - if not peek: - self.next_token = Token(name, match[0], self.position) - return True - - def expect(self, name: str, *, expected: str) -> Token: - """Expect a certain token name next, failing with a syntax error otherwise. - - The token is *not* read. - """ - if not self.check(name): - raise self.raise_syntax_error(f"Expected {expected}") - return self.read() - - def read(self) -> Token: - """Consume the next token and return it.""" - token = self.next_token - assert token is not None - - self.position += len(token.text) - self.next_token = None - - return token - - def raise_syntax_error( - self, - message: str, - *, - span_start: Optional[int] = None, - span_end: Optional[int] = None, - ) -> NoReturn: - """Raise ParserSyntaxError at the given position.""" - span = ( - self.position if span_start is None else span_start, - self.position if span_end is None else span_end, - ) - raise ParserSyntaxError( - message, - source=self.source, - span=span, - ) - - @contextlib.contextmanager - def enclosing_tokens( - self, open_token: str, close_token: str, *, around: str - ) -> Iterator[None]: - if self.check(open_token): - open_position = self.position - self.read() - else: - open_position = None - - yield - - if open_position is None: - return - - if not self.check(close_token): - self.raise_syntax_error( - f"Expected matching {close_token} for {open_token}, after {around}", - span_start=open_position, - ) - - self.read() diff --git a/venv/lib/python3.8/site-packages/packaging/markers.py b/venv/lib/python3.8/site-packages/packaging/markers.py deleted file mode 100644 index 8b98fca7233be6dd9324cd2b6d71b6a8ac91a6cb..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/markers.py +++ /dev/null @@ -1,252 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -import operator -import os -import platform -import sys -from typing import Any, Callable, Dict, List, Optional, Tuple, Union - -from ._parser import ( - MarkerAtom, - MarkerList, - Op, - Value, - Variable, - parse_marker as _parse_marker, -) -from ._tokenizer import ParserSyntaxError -from .specifiers import InvalidSpecifier, Specifier -from .utils import canonicalize_name - -__all__ = [ - "InvalidMarker", - "UndefinedComparison", - "UndefinedEnvironmentName", - "Marker", - "default_environment", -] - -Operator = Callable[[str, str], bool] - - -class InvalidMarker(ValueError): - """ - An invalid marker was found, users should refer to PEP 508. - """ - - -class UndefinedComparison(ValueError): - """ - An invalid operation was attempted on a value that doesn't support it. - """ - - -class UndefinedEnvironmentName(ValueError): - """ - A name was attempted to be used that does not exist inside of the - environment. - """ - - -def _normalize_extra_values(results: Any) -> Any: - """ - Normalize extra values. - """ - if isinstance(results[0], tuple): - lhs, op, rhs = results[0] - if isinstance(lhs, Variable) and lhs.value == "extra": - normalized_extra = canonicalize_name(rhs.value) - rhs = Value(normalized_extra) - elif isinstance(rhs, Variable) and rhs.value == "extra": - normalized_extra = canonicalize_name(lhs.value) - lhs = Value(normalized_extra) - results[0] = lhs, op, rhs - return results - - -def _format_marker( - marker: Union[List[str], MarkerAtom, str], first: Optional[bool] = True -) -> str: - - assert isinstance(marker, (list, tuple, str)) - - # Sometimes we have a structure like [[...]] which is a single item list - # where the single item is itself it's own list. In that case we want skip - # the rest of this function so that we don't get extraneous () on the - # outside. - if ( - isinstance(marker, list) - and len(marker) == 1 - and isinstance(marker[0], (list, tuple)) - ): - return _format_marker(marker[0]) - - if isinstance(marker, list): - inner = (_format_marker(m, first=False) for m in marker) - if first: - return " ".join(inner) - else: - return "(" + " ".join(inner) + ")" - elif isinstance(marker, tuple): - return " ".join([m.serialize() for m in marker]) - else: - return marker - - -_operators: Dict[str, Operator] = { - "in": lambda lhs, rhs: lhs in rhs, - "not in": lambda lhs, rhs: lhs not in rhs, - "<": operator.lt, - "<=": operator.le, - "==": operator.eq, - "!=": operator.ne, - ">=": operator.ge, - ">": operator.gt, -} - - -def _eval_op(lhs: str, op: Op, rhs: str) -> bool: - try: - spec = Specifier("".join([op.serialize(), rhs])) - except InvalidSpecifier: - pass - else: - return spec.contains(lhs, prereleases=True) - - oper: Optional[Operator] = _operators.get(op.serialize()) - if oper is None: - raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.") - - return oper(lhs, rhs) - - -def _normalize(*values: str, key: str) -> Tuple[str, ...]: - # PEP 685 – Comparison of extra names for optional distribution dependencies - # https://peps.python.org/pep-0685/ - # > When comparing extra names, tools MUST normalize the names being - # > compared using the semantics outlined in PEP 503 for names - if key == "extra": - return tuple(canonicalize_name(v) for v in values) - - # other environment markers don't have such standards - return values - - -def _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool: - groups: List[List[bool]] = [[]] - - for marker in markers: - assert isinstance(marker, (list, tuple, str)) - - if isinstance(marker, list): - groups[-1].append(_evaluate_markers(marker, environment)) - elif isinstance(marker, tuple): - lhs, op, rhs = marker - - if isinstance(lhs, Variable): - environment_key = lhs.value - lhs_value = environment[environment_key] - rhs_value = rhs.value - else: - lhs_value = lhs.value - environment_key = rhs.value - rhs_value = environment[environment_key] - - lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key) - groups[-1].append(_eval_op(lhs_value, op, rhs_value)) - else: - assert marker in ["and", "or"] - if marker == "or": - groups.append([]) - - return any(all(item) for item in groups) - - -def format_full_version(info: "sys._version_info") -> str: - version = "{0.major}.{0.minor}.{0.micro}".format(info) - kind = info.releaselevel - if kind != "final": - version += kind[0] + str(info.serial) - return version - - -def default_environment() -> Dict[str, str]: - iver = format_full_version(sys.implementation.version) - implementation_name = sys.implementation.name - return { - "implementation_name": implementation_name, - "implementation_version": iver, - "os_name": os.name, - "platform_machine": platform.machine(), - "platform_release": platform.release(), - "platform_system": platform.system(), - "platform_version": platform.version(), - "python_full_version": platform.python_version(), - "platform_python_implementation": platform.python_implementation(), - "python_version": ".".join(platform.python_version_tuple()[:2]), - "sys_platform": sys.platform, - } - - -class Marker: - def __init__(self, marker: str) -> None: - # Note: We create a Marker object without calling this constructor in - # packaging.requirements.Requirement. If any additional logic is - # added here, make sure to mirror/adapt Requirement. - try: - self._markers = _normalize_extra_values(_parse_marker(marker)) - # The attribute `_markers` can be described in terms of a recursive type: - # MarkerList = List[Union[Tuple[Node, ...], str, MarkerList]] - # - # For example, the following expression: - # python_version > "3.6" or (python_version == "3.6" and os_name == "unix") - # - # is parsed into: - # [ - # (, ')>, ), - # 'and', - # [ - # (, , ), - # 'or', - # (, , ) - # ] - # ] - except ParserSyntaxError as e: - raise InvalidMarker(str(e)) from e - - def __str__(self) -> str: - return _format_marker(self._markers) - - def __repr__(self) -> str: - return f"" - - def __hash__(self) -> int: - return hash((self.__class__.__name__, str(self))) - - def __eq__(self, other: Any) -> bool: - if not isinstance(other, Marker): - return NotImplemented - - return str(self) == str(other) - - def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool: - """Evaluate a marker. - - Return the boolean from evaluating the given marker against the - environment. environment is an optional argument to override all or - part of the determined environment. - - The environment is determined from the current Python process. - """ - current_environment = default_environment() - current_environment["extra"] = "" - if environment is not None: - current_environment.update(environment) - # The API used to allow setting extra to None. We need to handle this - # case for backwards compatibility. - if current_environment["extra"] is None: - current_environment["extra"] = "" - - return _evaluate_markers(self._markers, current_environment) diff --git a/venv/lib/python3.8/site-packages/packaging/metadata.py b/venv/lib/python3.8/site-packages/packaging/metadata.py deleted file mode 100644 index 7b0e6a9c3263cdafba53f6d2ecc713ca7955b15a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/metadata.py +++ /dev/null @@ -1,822 +0,0 @@ -import email.feedparser -import email.header -import email.message -import email.parser -import email.policy -import sys -import typing -from typing import ( - Any, - Callable, - Dict, - Generic, - List, - Optional, - Tuple, - Type, - Union, - cast, -) - -from . import requirements, specifiers, utils, version as version_module - -T = typing.TypeVar("T") -if sys.version_info[:2] >= (3, 8): # pragma: no cover - from typing import Literal, TypedDict -else: # pragma: no cover - if typing.TYPE_CHECKING: - from typing_extensions import Literal, TypedDict - else: - try: - from typing_extensions import Literal, TypedDict - except ImportError: - - class Literal: - def __init_subclass__(*_args, **_kwargs): - pass - - class TypedDict: - def __init_subclass__(*_args, **_kwargs): - pass - - -try: - ExceptionGroup = __builtins__.ExceptionGroup # type: ignore[attr-defined] -except AttributeError: - - class ExceptionGroup(Exception): # type: ignore[no-redef] # noqa: N818 - """A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11. - - If :external:exc:`ExceptionGroup` is already defined by Python itself, - that version is used instead. - """ - - message: str - exceptions: List[Exception] - - def __init__(self, message: str, exceptions: List[Exception]) -> None: - self.message = message - self.exceptions = exceptions - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({self.message!r}, {self.exceptions!r})" - - -class InvalidMetadata(ValueError): - """A metadata field contains invalid data.""" - - field: str - """The name of the field that contains invalid data.""" - - def __init__(self, field: str, message: str) -> None: - self.field = field - super().__init__(message) - - -# The RawMetadata class attempts to make as few assumptions about the underlying -# serialization formats as possible. The idea is that as long as a serialization -# formats offer some very basic primitives in *some* way then we can support -# serializing to and from that format. -class RawMetadata(TypedDict, total=False): - """A dictionary of raw core metadata. - - Each field in core metadata maps to a key of this dictionary (when data is - provided). The key is lower-case and underscores are used instead of dashes - compared to the equivalent core metadata field. Any core metadata field that - can be specified multiple times or can hold multiple values in a single - field have a key with a plural name. See :class:`Metadata` whose attributes - match the keys of this dictionary. - - Core metadata fields that can be specified multiple times are stored as a - list or dict depending on which is appropriate for the field. Any fields - which hold multiple values in a single field are stored as a list. - - """ - - # Metadata 1.0 - PEP 241 - metadata_version: str - name: str - version: str - platforms: List[str] - summary: str - description: str - keywords: List[str] - home_page: str - author: str - author_email: str - license: str - - # Metadata 1.1 - PEP 314 - supported_platforms: List[str] - download_url: str - classifiers: List[str] - requires: List[str] - provides: List[str] - obsoletes: List[str] - - # Metadata 1.2 - PEP 345 - maintainer: str - maintainer_email: str - requires_dist: List[str] - provides_dist: List[str] - obsoletes_dist: List[str] - requires_python: str - requires_external: List[str] - project_urls: Dict[str, str] - - # Metadata 2.0 - # PEP 426 attempted to completely revamp the metadata format - # but got stuck without ever being able to build consensus on - # it and ultimately ended up withdrawn. - # - # However, a number of tools had started emitting METADATA with - # `2.0` Metadata-Version, so for historical reasons, this version - # was skipped. - - # Metadata 2.1 - PEP 566 - description_content_type: str - provides_extra: List[str] - - # Metadata 2.2 - PEP 643 - dynamic: List[str] - - # Metadata 2.3 - PEP 685 - # No new fields were added in PEP 685, just some edge case were - # tightened up to provide better interoptability. - - -_STRING_FIELDS = { - "author", - "author_email", - "description", - "description_content_type", - "download_url", - "home_page", - "license", - "maintainer", - "maintainer_email", - "metadata_version", - "name", - "requires_python", - "summary", - "version", -} - -_LIST_FIELDS = { - "classifiers", - "dynamic", - "obsoletes", - "obsoletes_dist", - "platforms", - "provides", - "provides_dist", - "provides_extra", - "requires", - "requires_dist", - "requires_external", - "supported_platforms", -} - -_DICT_FIELDS = { - "project_urls", -} - - -def _parse_keywords(data: str) -> List[str]: - """Split a string of comma-separate keyboards into a list of keywords.""" - return [k.strip() for k in data.split(",")] - - -def _parse_project_urls(data: List[str]) -> Dict[str, str]: - """Parse a list of label/URL string pairings separated by a comma.""" - urls = {} - for pair in data: - # Our logic is slightly tricky here as we want to try and do - # *something* reasonable with malformed data. - # - # The main thing that we have to worry about, is data that does - # not have a ',' at all to split the label from the Value. There - # isn't a singular right answer here, and we will fail validation - # later on (if the caller is validating) so it doesn't *really* - # matter, but since the missing value has to be an empty str - # and our return value is dict[str, str], if we let the key - # be the missing value, then they'd have multiple '' values that - # overwrite each other in a accumulating dict. - # - # The other potentional issue is that it's possible to have the - # same label multiple times in the metadata, with no solid "right" - # answer with what to do in that case. As such, we'll do the only - # thing we can, which is treat the field as unparseable and add it - # to our list of unparsed fields. - parts = [p.strip() for p in pair.split(",", 1)] - parts.extend([""] * (max(0, 2 - len(parts)))) # Ensure 2 items - - # TODO: The spec doesn't say anything about if the keys should be - # considered case sensitive or not... logically they should - # be case-preserving and case-insensitive, but doing that - # would open up more cases where we might have duplicate - # entries. - label, url = parts - if label in urls: - # The label already exists in our set of urls, so this field - # is unparseable, and we can just add the whole thing to our - # unparseable data and stop processing it. - raise KeyError("duplicate labels in project urls") - urls[label] = url - - return urls - - -def _get_payload(msg: email.message.Message, source: Union[bytes, str]) -> str: - """Get the body of the message.""" - # If our source is a str, then our caller has managed encodings for us, - # and we don't need to deal with it. - if isinstance(source, str): - payload: str = msg.get_payload() - return payload - # If our source is a bytes, then we're managing the encoding and we need - # to deal with it. - else: - bpayload: bytes = msg.get_payload(decode=True) - try: - return bpayload.decode("utf8", "strict") - except UnicodeDecodeError: - raise ValueError("payload in an invalid encoding") - - -# The various parse_FORMAT functions here are intended to be as lenient as -# possible in their parsing, while still returning a correctly typed -# RawMetadata. -# -# To aid in this, we also generally want to do as little touching of the -# data as possible, except where there are possibly some historic holdovers -# that make valid data awkward to work with. -# -# While this is a lower level, intermediate format than our ``Metadata`` -# class, some light touch ups can make a massive difference in usability. - -# Map METADATA fields to RawMetadata. -_EMAIL_TO_RAW_MAPPING = { - "author": "author", - "author-email": "author_email", - "classifier": "classifiers", - "description": "description", - "description-content-type": "description_content_type", - "download-url": "download_url", - "dynamic": "dynamic", - "home-page": "home_page", - "keywords": "keywords", - "license": "license", - "maintainer": "maintainer", - "maintainer-email": "maintainer_email", - "metadata-version": "metadata_version", - "name": "name", - "obsoletes": "obsoletes", - "obsoletes-dist": "obsoletes_dist", - "platform": "platforms", - "project-url": "project_urls", - "provides": "provides", - "provides-dist": "provides_dist", - "provides-extra": "provides_extra", - "requires": "requires", - "requires-dist": "requires_dist", - "requires-external": "requires_external", - "requires-python": "requires_python", - "summary": "summary", - "supported-platform": "supported_platforms", - "version": "version", -} -_RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()} - - -def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[str]]]: - """Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``). - - This function returns a two-item tuple of dicts. The first dict is of - recognized fields from the core metadata specification. Fields that can be - parsed and translated into Python's built-in types are converted - appropriately. All other fields are left as-is. Fields that are allowed to - appear multiple times are stored as lists. - - The second dict contains all other fields from the metadata. This includes - any unrecognized fields. It also includes any fields which are expected to - be parsed into a built-in type but were not formatted appropriately. Finally, - any fields that are expected to appear only once but are repeated are - included in this dict. - - """ - raw: Dict[str, Union[str, List[str], Dict[str, str]]] = {} - unparsed: Dict[str, List[str]] = {} - - if isinstance(data, str): - parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data) - else: - parsed = email.parser.BytesParser(policy=email.policy.compat32).parsebytes(data) - - # We have to wrap parsed.keys() in a set, because in the case of multiple - # values for a key (a list), the key will appear multiple times in the - # list of keys, but we're avoiding that by using get_all(). - for name in frozenset(parsed.keys()): - # Header names in RFC are case insensitive, so we'll normalize to all - # lower case to make comparisons easier. - name = name.lower() - - # We use get_all() here, even for fields that aren't multiple use, - # because otherwise someone could have e.g. two Name fields, and we - # would just silently ignore it rather than doing something about it. - headers = parsed.get_all(name) or [] - - # The way the email module works when parsing bytes is that it - # unconditionally decodes the bytes as ascii using the surrogateescape - # handler. When you pull that data back out (such as with get_all() ), - # it looks to see if the str has any surrogate escapes, and if it does - # it wraps it in a Header object instead of returning the string. - # - # As such, we'll look for those Header objects, and fix up the encoding. - value = [] - # Flag if we have run into any issues processing the headers, thus - # signalling that the data belongs in 'unparsed'. - valid_encoding = True - for h in headers: - # It's unclear if this can return more types than just a Header or - # a str, so we'll just assert here to make sure. - assert isinstance(h, (email.header.Header, str)) - - # If it's a header object, we need to do our little dance to get - # the real data out of it. In cases where there is invalid data - # we're going to end up with mojibake, but there's no obvious, good - # way around that without reimplementing parts of the Header object - # ourselves. - # - # That should be fine since, if mojibacked happens, this key is - # going into the unparsed dict anyways. - if isinstance(h, email.header.Header): - # The Header object stores it's data as chunks, and each chunk - # can be independently encoded, so we'll need to check each - # of them. - chunks: List[Tuple[bytes, Optional[str]]] = [] - for bin, encoding in email.header.decode_header(h): - try: - bin.decode("utf8", "strict") - except UnicodeDecodeError: - # Enable mojibake. - encoding = "latin1" - valid_encoding = False - else: - encoding = "utf8" - chunks.append((bin, encoding)) - - # Turn our chunks back into a Header object, then let that - # Header object do the right thing to turn them into a - # string for us. - value.append(str(email.header.make_header(chunks))) - # This is already a string, so just add it. - else: - value.append(h) - - # We've processed all of our values to get them into a list of str, - # but we may have mojibake data, in which case this is an unparsed - # field. - if not valid_encoding: - unparsed[name] = value - continue - - raw_name = _EMAIL_TO_RAW_MAPPING.get(name) - if raw_name is None: - # This is a bit of a weird situation, we've encountered a key that - # we don't know what it means, so we don't know whether it's meant - # to be a list or not. - # - # Since we can't really tell one way or another, we'll just leave it - # as a list, even though it may be a single item list, because that's - # what makes the most sense for email headers. - unparsed[name] = value - continue - - # If this is one of our string fields, then we'll check to see if our - # value is a list of a single item. If it is then we'll assume that - # it was emitted as a single string, and unwrap the str from inside - # the list. - # - # If it's any other kind of data, then we haven't the faintest clue - # what we should parse it as, and we have to just add it to our list - # of unparsed stuff. - if raw_name in _STRING_FIELDS and len(value) == 1: - raw[raw_name] = value[0] - # If this is one of our list of string fields, then we can just assign - # the value, since email *only* has strings, and our get_all() call - # above ensures that this is a list. - elif raw_name in _LIST_FIELDS: - raw[raw_name] = value - # Special Case: Keywords - # The keywords field is implemented in the metadata spec as a str, - # but it conceptually is a list of strings, and is serialized using - # ", ".join(keywords), so we'll do some light data massaging to turn - # this into what it logically is. - elif raw_name == "keywords" and len(value) == 1: - raw[raw_name] = _parse_keywords(value[0]) - # Special Case: Project-URL - # The project urls is implemented in the metadata spec as a list of - # specially-formatted strings that represent a key and a value, which - # is fundamentally a mapping, however the email format doesn't support - # mappings in a sane way, so it was crammed into a list of strings - # instead. - # - # We will do a little light data massaging to turn this into a map as - # it logically should be. - elif raw_name == "project_urls": - try: - raw[raw_name] = _parse_project_urls(value) - except KeyError: - unparsed[name] = value - # Nothing that we've done has managed to parse this, so it'll just - # throw it in our unparseable data and move on. - else: - unparsed[name] = value - - # We need to support getting the Description from the message payload in - # addition to getting it from the the headers. This does mean, though, there - # is the possibility of it being set both ways, in which case we put both - # in 'unparsed' since we don't know which is right. - try: - payload = _get_payload(parsed, data) - except ValueError: - unparsed.setdefault("description", []).append( - parsed.get_payload(decode=isinstance(data, bytes)) - ) - else: - if payload: - # Check to see if we've already got a description, if so then both - # it, and this body move to unparseable. - if "description" in raw: - description_header = cast(str, raw.pop("description")) - unparsed.setdefault("description", []).extend( - [description_header, payload] - ) - elif "description" in unparsed: - unparsed["description"].append(payload) - else: - raw["description"] = payload - - # We need to cast our `raw` to a metadata, because a TypedDict only support - # literal key names, but we're computing our key names on purpose, but the - # way this function is implemented, our `TypedDict` can only have valid key - # names. - return cast(RawMetadata, raw), unparsed - - -_NOT_FOUND = object() - - -# Keep the two values in sync. -_VALID_METADATA_VERSIONS = ["1.0", "1.1", "1.2", "2.1", "2.2", "2.3"] -_MetadataVersion = Literal["1.0", "1.1", "1.2", "2.1", "2.2", "2.3"] - -_REQUIRED_ATTRS = frozenset(["metadata_version", "name", "version"]) - - -class _Validator(Generic[T]): - """Validate a metadata field. - - All _process_*() methods correspond to a core metadata field. The method is - called with the field's raw value. If the raw value is valid it is returned - in its "enriched" form (e.g. ``version.Version`` for the ``Version`` field). - If the raw value is invalid, :exc:`InvalidMetadata` is raised (with a cause - as appropriate). - """ - - name: str - raw_name: str - added: _MetadataVersion - - def __init__( - self, - *, - added: _MetadataVersion = "1.0", - ) -> None: - self.added = added - - def __set_name__(self, _owner: "Metadata", name: str) -> None: - self.name = name - self.raw_name = _RAW_TO_EMAIL_MAPPING[name] - - def __get__(self, instance: "Metadata", _owner: Type["Metadata"]) -> T: - # With Python 3.8, the caching can be replaced with functools.cached_property(). - # No need to check the cache as attribute lookup will resolve into the - # instance's __dict__ before __get__ is called. - cache = instance.__dict__ - try: - value = instance._raw[self.name] # type: ignore[literal-required] - except KeyError: - if self.name in _STRING_FIELDS: - value = "" - elif self.name in _LIST_FIELDS: - value = [] - elif self.name in _DICT_FIELDS: - value = {} - else: # pragma: no cover - assert False - - try: - converter: Callable[[Any], T] = getattr(self, f"_process_{self.name}") - except AttributeError: - pass - else: - value = converter(value) - - cache[self.name] = value - try: - del instance._raw[self.name] # type: ignore[misc] - except KeyError: - pass - - return cast(T, value) - - def _invalid_metadata( - self, msg: str, cause: Optional[Exception] = None - ) -> InvalidMetadata: - exc = InvalidMetadata( - self.raw_name, msg.format_map({"field": repr(self.raw_name)}) - ) - exc.__cause__ = cause - return exc - - def _process_metadata_version(self, value: str) -> _MetadataVersion: - # Implicitly makes Metadata-Version required. - if value not in _VALID_METADATA_VERSIONS: - raise self._invalid_metadata(f"{value!r} is not a valid metadata version") - return cast(_MetadataVersion, value) - - def _process_name(self, value: str) -> str: - if not value: - raise self._invalid_metadata("{field} is a required field") - # Validate the name as a side-effect. - try: - utils.canonicalize_name(value, validate=True) - except utils.InvalidName as exc: - raise self._invalid_metadata( - f"{value!r} is invalid for {{field}}", cause=exc - ) - else: - return value - - def _process_version(self, value: str) -> version_module.Version: - if not value: - raise self._invalid_metadata("{field} is a required field") - try: - return version_module.parse(value) - except version_module.InvalidVersion as exc: - raise self._invalid_metadata( - f"{value!r} is invalid for {{field}}", cause=exc - ) - - def _process_summary(self, value: str) -> str: - """Check the field contains no newlines.""" - if "\n" in value: - raise self._invalid_metadata("{field} must be a single line") - return value - - def _process_description_content_type(self, value: str) -> str: - content_types = {"text/plain", "text/x-rst", "text/markdown"} - message = email.message.EmailMessage() - message["content-type"] = value - - content_type, parameters = ( - # Defaults to `text/plain` if parsing failed. - message.get_content_type().lower(), - message["content-type"].params, - ) - # Check if content-type is valid or defaulted to `text/plain` and thus was - # not parseable. - if content_type not in content_types or content_type not in value.lower(): - raise self._invalid_metadata( - f"{{field}} must be one of {list(content_types)}, not {value!r}" - ) - - charset = parameters.get("charset", "UTF-8") - if charset != "UTF-8": - raise self._invalid_metadata( - f"{{field}} can only specify the UTF-8 charset, not {list(charset)}" - ) - - markdown_variants = {"GFM", "CommonMark"} - variant = parameters.get("variant", "GFM") # Use an acceptable default. - if content_type == "text/markdown" and variant not in markdown_variants: - raise self._invalid_metadata( - f"valid Markdown variants for {{field}} are {list(markdown_variants)}, " - f"not {variant!r}", - ) - return value - - def _process_dynamic(self, value: List[str]) -> List[str]: - for dynamic_field in map(str.lower, value): - if dynamic_field in {"name", "version", "metadata-version"}: - raise self._invalid_metadata( - f"{value!r} is not allowed as a dynamic field" - ) - elif dynamic_field not in _EMAIL_TO_RAW_MAPPING: - raise self._invalid_metadata(f"{value!r} is not a valid dynamic field") - return list(map(str.lower, value)) - - def _process_provides_extra( - self, - value: List[str], - ) -> List[utils.NormalizedName]: - normalized_names = [] - try: - for name in value: - normalized_names.append(utils.canonicalize_name(name, validate=True)) - except utils.InvalidName as exc: - raise self._invalid_metadata( - f"{name!r} is invalid for {{field}}", cause=exc - ) - else: - return normalized_names - - def _process_requires_python(self, value: str) -> specifiers.SpecifierSet: - try: - return specifiers.SpecifierSet(value) - except specifiers.InvalidSpecifier as exc: - raise self._invalid_metadata( - f"{value!r} is invalid for {{field}}", cause=exc - ) - - def _process_requires_dist( - self, - value: List[str], - ) -> List[requirements.Requirement]: - reqs = [] - try: - for req in value: - reqs.append(requirements.Requirement(req)) - except requirements.InvalidRequirement as exc: - raise self._invalid_metadata(f"{req!r} is invalid for {{field}}", cause=exc) - else: - return reqs - - -class Metadata: - """Representation of distribution metadata. - - Compared to :class:`RawMetadata`, this class provides objects representing - metadata fields instead of only using built-in types. Any invalid metadata - will cause :exc:`InvalidMetadata` to be raised (with a - :py:attr:`~BaseException.__cause__` attribute as appropriate). - """ - - _raw: RawMetadata - - @classmethod - def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata": - """Create an instance from :class:`RawMetadata`. - - If *validate* is true, all metadata will be validated. All exceptions - related to validation will be gathered and raised as an :class:`ExceptionGroup`. - """ - ins = cls() - ins._raw = data.copy() # Mutations occur due to caching enriched values. - - if validate: - exceptions: List[InvalidMetadata] = [] - try: - metadata_version = ins.metadata_version - metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version) - except InvalidMetadata as metadata_version_exc: - exceptions.append(metadata_version_exc) - metadata_version = None - - # Make sure to check for the fields that are present, the required - # fields (so their absence can be reported). - fields_to_check = frozenset(ins._raw) | _REQUIRED_ATTRS - # Remove fields that have already been checked. - fields_to_check -= {"metadata_version"} - - for key in fields_to_check: - try: - if metadata_version: - # Can't use getattr() as that triggers descriptor protocol which - # will fail due to no value for the instance argument. - try: - field_metadata_version = cls.__dict__[key].added - except KeyError: - exc = InvalidMetadata(key, f"unrecognized field: {key!r}") - exceptions.append(exc) - continue - field_age = _VALID_METADATA_VERSIONS.index( - field_metadata_version - ) - if field_age > metadata_age: - field = _RAW_TO_EMAIL_MAPPING[key] - exc = InvalidMetadata( - field, - "{field} introduced in metadata version " - "{field_metadata_version}, not {metadata_version}", - ) - exceptions.append(exc) - continue - getattr(ins, key) - except InvalidMetadata as exc: - exceptions.append(exc) - - if exceptions: - raise ExceptionGroup("invalid metadata", exceptions) - - return ins - - @classmethod - def from_email( - cls, data: Union[bytes, str], *, validate: bool = True - ) -> "Metadata": - """Parse metadata from email headers. - - If *validate* is true, the metadata will be validated. All exceptions - related to validation will be gathered and raised as an :class:`ExceptionGroup`. - """ - exceptions: list[InvalidMetadata] = [] - raw, unparsed = parse_email(data) - - if validate: - for unparsed_key in unparsed: - if unparsed_key in _EMAIL_TO_RAW_MAPPING: - message = f"{unparsed_key!r} has invalid data" - else: - message = f"unrecognized field: {unparsed_key!r}" - exceptions.append(InvalidMetadata(unparsed_key, message)) - - if exceptions: - raise ExceptionGroup("unparsed", exceptions) - - try: - return cls.from_raw(raw, validate=validate) - except ExceptionGroup as exc_group: - exceptions.extend(exc_group.exceptions) - raise ExceptionGroup("invalid or unparsed metadata", exceptions) from None - - metadata_version: _Validator[_MetadataVersion] = _Validator() - """:external:ref:`core-metadata-metadata-version` - (required; validated to be a valid metadata version)""" - name: _Validator[str] = _Validator() - """:external:ref:`core-metadata-name` - (required; validated using :func:`~packaging.utils.canonicalize_name` and its - *validate* parameter)""" - version: _Validator[version_module.Version] = _Validator() - """:external:ref:`core-metadata-version` (required)""" - dynamic: _Validator[List[str]] = _Validator( - added="2.2", - ) - """:external:ref:`core-metadata-dynamic` - (validated against core metadata field names and lowercased)""" - platforms: _Validator[List[str]] = _Validator() - """:external:ref:`core-metadata-platform`""" - supported_platforms: _Validator[List[str]] = _Validator(added="1.1") - """:external:ref:`core-metadata-supported-platform`""" - summary: _Validator[str] = _Validator() - """:external:ref:`core-metadata-summary` (validated to contain no newlines)""" - description: _Validator[str] = _Validator() # TODO 2.1: can be in body - """:external:ref:`core-metadata-description`""" - description_content_type: _Validator[str] = _Validator(added="2.1") - """:external:ref:`core-metadata-description-content-type` (validated)""" - keywords: _Validator[List[str]] = _Validator() - """:external:ref:`core-metadata-keywords`""" - home_page: _Validator[str] = _Validator() - """:external:ref:`core-metadata-home-page`""" - download_url: _Validator[str] = _Validator(added="1.1") - """:external:ref:`core-metadata-download-url`""" - author: _Validator[str] = _Validator() - """:external:ref:`core-metadata-author`""" - author_email: _Validator[str] = _Validator() - """:external:ref:`core-metadata-author-email`""" - maintainer: _Validator[str] = _Validator(added="1.2") - """:external:ref:`core-metadata-maintainer`""" - maintainer_email: _Validator[str] = _Validator(added="1.2") - """:external:ref:`core-metadata-maintainer-email`""" - license: _Validator[str] = _Validator() - """:external:ref:`core-metadata-license`""" - classifiers: _Validator[List[str]] = _Validator(added="1.1") - """:external:ref:`core-metadata-classifier`""" - requires_dist: _Validator[List[requirements.Requirement]] = _Validator(added="1.2") - """:external:ref:`core-metadata-requires-dist`""" - requires_python: _Validator[specifiers.SpecifierSet] = _Validator(added="1.2") - """:external:ref:`core-metadata-requires-python`""" - # Because `Requires-External` allows for non-PEP 440 version specifiers, we - # don't do any processing on the values. - requires_external: _Validator[List[str]] = _Validator(added="1.2") - """:external:ref:`core-metadata-requires-external`""" - project_urls: _Validator[Dict[str, str]] = _Validator(added="1.2") - """:external:ref:`core-metadata-project-url`""" - # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation - # regardless of metadata version. - provides_extra: _Validator[List[utils.NormalizedName]] = _Validator( - added="2.1", - ) - """:external:ref:`core-metadata-provides-extra`""" - provides_dist: _Validator[List[str]] = _Validator(added="1.2") - """:external:ref:`core-metadata-provides-dist`""" - obsoletes_dist: _Validator[List[str]] = _Validator(added="1.2") - """:external:ref:`core-metadata-obsoletes-dist`""" - requires: _Validator[List[str]] = _Validator(added="1.1") - """``Requires`` (deprecated)""" - provides: _Validator[List[str]] = _Validator(added="1.1") - """``Provides`` (deprecated)""" - obsoletes: _Validator[List[str]] = _Validator(added="1.1") - """``Obsoletes`` (deprecated)""" diff --git a/venv/lib/python3.8/site-packages/packaging/py.typed b/venv/lib/python3.8/site-packages/packaging/py.typed deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/packaging/requirements.py b/venv/lib/python3.8/site-packages/packaging/requirements.py deleted file mode 100644 index 0c00eba331b736fbd266ecfc5d2761f3efa700e0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/requirements.py +++ /dev/null @@ -1,90 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -from typing import Any, Iterator, Optional, Set - -from ._parser import parse_requirement as _parse_requirement -from ._tokenizer import ParserSyntaxError -from .markers import Marker, _normalize_extra_values -from .specifiers import SpecifierSet -from .utils import canonicalize_name - - -class InvalidRequirement(ValueError): - """ - An invalid requirement was found, users should refer to PEP 508. - """ - - -class Requirement: - """Parse a requirement. - - Parse a given requirement string into its parts, such as name, specifier, - URL, and extras. Raises InvalidRequirement on a badly-formed requirement - string. - """ - - # TODO: Can we test whether something is contained within a requirement? - # If so how do we do that? Do we need to test against the _name_ of - # the thing as well as the version? What about the markers? - # TODO: Can we normalize the name and extra name? - - def __init__(self, requirement_string: str) -> None: - try: - parsed = _parse_requirement(requirement_string) - except ParserSyntaxError as e: - raise InvalidRequirement(str(e)) from e - - self.name: str = parsed.name - self.url: Optional[str] = parsed.url or None - self.extras: Set[str] = set(parsed.extras if parsed.extras else []) - self.specifier: SpecifierSet = SpecifierSet(parsed.specifier) - self.marker: Optional[Marker] = None - if parsed.marker is not None: - self.marker = Marker.__new__(Marker) - self.marker._markers = _normalize_extra_values(parsed.marker) - - def _iter_parts(self, name: str) -> Iterator[str]: - yield name - - if self.extras: - formatted_extras = ",".join(sorted(self.extras)) - yield f"[{formatted_extras}]" - - if self.specifier: - yield str(self.specifier) - - if self.url: - yield f"@ {self.url}" - if self.marker: - yield " " - - if self.marker: - yield f"; {self.marker}" - - def __str__(self) -> str: - return "".join(self._iter_parts(self.name)) - - def __repr__(self) -> str: - return f"" - - def __hash__(self) -> int: - return hash( - ( - self.__class__.__name__, - *self._iter_parts(canonicalize_name(self.name)), - ) - ) - - def __eq__(self, other: Any) -> bool: - if not isinstance(other, Requirement): - return NotImplemented - - return ( - canonicalize_name(self.name) == canonicalize_name(other.name) - and self.extras == other.extras - and self.specifier == other.specifier - and self.url == other.url - and self.marker == other.marker - ) diff --git a/venv/lib/python3.8/site-packages/packaging/specifiers.py b/venv/lib/python3.8/site-packages/packaging/specifiers.py deleted file mode 100644 index ba8fe37b7f7fd0f1e46666e3644b6394dcaff644..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/specifiers.py +++ /dev/null @@ -1,1008 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -""" -.. testsetup:: - - from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier - from packaging.version import Version -""" - -import abc -import itertools -import re -from typing import ( - Callable, - Iterable, - Iterator, - List, - Optional, - Set, - Tuple, - TypeVar, - Union, -) - -from .utils import canonicalize_version -from .version import Version - -UnparsedVersion = Union[Version, str] -UnparsedVersionVar = TypeVar("UnparsedVersionVar", bound=UnparsedVersion) -CallableOperator = Callable[[Version, str], bool] - - -def _coerce_version(version: UnparsedVersion) -> Version: - if not isinstance(version, Version): - version = Version(version) - return version - - -class InvalidSpecifier(ValueError): - """ - Raised when attempting to create a :class:`Specifier` with a specifier - string that is invalid. - - >>> Specifier("lolwat") - Traceback (most recent call last): - ... - packaging.specifiers.InvalidSpecifier: Invalid specifier: 'lolwat' - """ - - -class BaseSpecifier(metaclass=abc.ABCMeta): - @abc.abstractmethod - def __str__(self) -> str: - """ - Returns the str representation of this Specifier-like object. This - should be representative of the Specifier itself. - """ - - @abc.abstractmethod - def __hash__(self) -> int: - """ - Returns a hash value for this Specifier-like object. - """ - - @abc.abstractmethod - def __eq__(self, other: object) -> bool: - """ - Returns a boolean representing whether or not the two Specifier-like - objects are equal. - - :param other: The other object to check against. - """ - - @property - @abc.abstractmethod - def prereleases(self) -> Optional[bool]: - """Whether or not pre-releases as a whole are allowed. - - This can be set to either ``True`` or ``False`` to explicitly enable or disable - prereleases or it can be set to ``None`` (the default) to use default semantics. - """ - - @prereleases.setter - def prereleases(self, value: bool) -> None: - """Setter for :attr:`prereleases`. - - :param value: The value to set. - """ - - @abc.abstractmethod - def contains(self, item: str, prereleases: Optional[bool] = None) -> bool: - """ - Determines if the given item is contained within this specifier. - """ - - @abc.abstractmethod - def filter( - self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None - ) -> Iterator[UnparsedVersionVar]: - """ - Takes an iterable of items and filters them so that only items which - are contained within this specifier are allowed in it. - """ - - -class Specifier(BaseSpecifier): - """This class abstracts handling of version specifiers. - - .. tip:: - - It is generally not required to instantiate this manually. You should instead - prefer to work with :class:`SpecifierSet` instead, which can parse - comma-separated version specifiers (which is what package metadata contains). - """ - - _operator_regex_str = r""" - (?P(~=|==|!=|<=|>=|<|>|===)) - """ - _version_regex_str = r""" - (?P - (?: - # The identity operators allow for an escape hatch that will - # do an exact string match of the version you wish to install. - # This will not be parsed by PEP 440 and we cannot determine - # any semantic meaning from it. This operator is discouraged - # but included entirely as an escape hatch. - (?<====) # Only match for the identity operator - \s* - [^\s;)]* # The arbitrary version can be just about anything, - # we match everything except for whitespace, a - # semi-colon for marker support, and a closing paren - # since versions can be enclosed in them. - ) - | - (?: - # The (non)equality operators allow for wild card and local - # versions to be specified so we have to define these two - # operators separately to enable that. - (?<===|!=) # Only match for equals and not equals - - \s* - v? - (?:[0-9]+!)? # epoch - [0-9]+(?:\.[0-9]+)* # release - - # You cannot use a wild card and a pre-release, post-release, a dev or - # local version together so group them with a | and make them optional. - (?: - \.\* # Wild card syntax of .* - | - (?: # pre release - [-_\.]? - (alpha|beta|preview|pre|a|b|c|rc) - [-_\.]? - [0-9]* - )? - (?: # post release - (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) - )? - (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release - (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local - )? - ) - | - (?: - # The compatible operator requires at least two digits in the - # release segment. - (?<=~=) # Only match for the compatible operator - - \s* - v? - (?:[0-9]+!)? # epoch - [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) - (?: # pre release - [-_\.]? - (alpha|beta|preview|pre|a|b|c|rc) - [-_\.]? - [0-9]* - )? - (?: # post release - (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) - )? - (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release - ) - | - (?: - # All other operators only allow a sub set of what the - # (non)equality operators do. Specifically they do not allow - # local versions to be specified nor do they allow the prefix - # matching wild cards. - (?=": "greater_than_equal", - "<": "less_than", - ">": "greater_than", - "===": "arbitrary", - } - - def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None: - """Initialize a Specifier instance. - - :param spec: - The string representation of a specifier which will be parsed and - normalized before use. - :param prereleases: - This tells the specifier if it should accept prerelease versions if - applicable or not. The default of ``None`` will autodetect it from the - given specifiers. - :raises InvalidSpecifier: - If the given specifier is invalid (i.e. bad syntax). - """ - match = self._regex.search(spec) - if not match: - raise InvalidSpecifier(f"Invalid specifier: '{spec}'") - - self._spec: Tuple[str, str] = ( - match.group("operator").strip(), - match.group("version").strip(), - ) - - # Store whether or not this Specifier should accept prereleases - self._prereleases = prereleases - - # https://github.com/python/mypy/pull/13475#pullrequestreview-1079784515 - @property # type: ignore[override] - def prereleases(self) -> bool: - # If there is an explicit prereleases set for this, then we'll just - # blindly use that. - if self._prereleases is not None: - return self._prereleases - - # Look at all of our specifiers and determine if they are inclusive - # operators, and if they are if they are including an explicit - # prerelease. - operator, version = self._spec - if operator in ["==", ">=", "<=", "~=", "==="]: - # The == specifier can include a trailing .*, if it does we - # want to remove before parsing. - if operator == "==" and version.endswith(".*"): - version = version[:-2] - - # Parse the version, and if it is a pre-release than this - # specifier allows pre-releases. - if Version(version).is_prerelease: - return True - - return False - - @prereleases.setter - def prereleases(self, value: bool) -> None: - self._prereleases = value - - @property - def operator(self) -> str: - """The operator of this specifier. - - >>> Specifier("==1.2.3").operator - '==' - """ - return self._spec[0] - - @property - def version(self) -> str: - """The version of this specifier. - - >>> Specifier("==1.2.3").version - '1.2.3' - """ - return self._spec[1] - - def __repr__(self) -> str: - """A representation of the Specifier that shows all internal state. - - >>> Specifier('>=1.0.0') - =1.0.0')> - >>> Specifier('>=1.0.0', prereleases=False) - =1.0.0', prereleases=False)> - >>> Specifier('>=1.0.0', prereleases=True) - =1.0.0', prereleases=True)> - """ - pre = ( - f", prereleases={self.prereleases!r}" - if self._prereleases is not None - else "" - ) - - return f"<{self.__class__.__name__}({str(self)!r}{pre})>" - - def __str__(self) -> str: - """A string representation of the Specifier that can be round-tripped. - - >>> str(Specifier('>=1.0.0')) - '>=1.0.0' - >>> str(Specifier('>=1.0.0', prereleases=False)) - '>=1.0.0' - """ - return "{}{}".format(*self._spec) - - @property - def _canonical_spec(self) -> Tuple[str, str]: - canonical_version = canonicalize_version( - self._spec[1], - strip_trailing_zero=(self._spec[0] != "~="), - ) - return self._spec[0], canonical_version - - def __hash__(self) -> int: - return hash(self._canonical_spec) - - def __eq__(self, other: object) -> bool: - """Whether or not the two Specifier-like objects are equal. - - :param other: The other object to check against. - - The value of :attr:`prereleases` is ignored. - - >>> Specifier("==1.2.3") == Specifier("== 1.2.3.0") - True - >>> (Specifier("==1.2.3", prereleases=False) == - ... Specifier("==1.2.3", prereleases=True)) - True - >>> Specifier("==1.2.3") == "==1.2.3" - True - >>> Specifier("==1.2.3") == Specifier("==1.2.4") - False - >>> Specifier("==1.2.3") == Specifier("~=1.2.3") - False - """ - if isinstance(other, str): - try: - other = self.__class__(str(other)) - except InvalidSpecifier: - return NotImplemented - elif not isinstance(other, self.__class__): - return NotImplemented - - return self._canonical_spec == other._canonical_spec - - def _get_operator(self, op: str) -> CallableOperator: - operator_callable: CallableOperator = getattr( - self, f"_compare_{self._operators[op]}" - ) - return operator_callable - - def _compare_compatible(self, prospective: Version, spec: str) -> bool: - - # Compatible releases have an equivalent combination of >= and ==. That - # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to - # implement this in terms of the other specifiers instead of - # implementing it ourselves. The only thing we need to do is construct - # the other specifiers. - - # We want everything but the last item in the version, but we want to - # ignore suffix segments. - prefix = ".".join( - list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1] - ) - - # Add the prefix notation to the end of our string - prefix += ".*" - - return self._get_operator(">=")(prospective, spec) and self._get_operator("==")( - prospective, prefix - ) - - def _compare_equal(self, prospective: Version, spec: str) -> bool: - - # We need special logic to handle prefix matching - if spec.endswith(".*"): - # In the case of prefix matching we want to ignore local segment. - normalized_prospective = canonicalize_version( - prospective.public, strip_trailing_zero=False - ) - # Get the normalized version string ignoring the trailing .* - normalized_spec = canonicalize_version(spec[:-2], strip_trailing_zero=False) - # Split the spec out by dots, and pretend that there is an implicit - # dot in between a release segment and a pre-release segment. - split_spec = _version_split(normalized_spec) - - # Split the prospective version out by dots, and pretend that there - # is an implicit dot in between a release segment and a pre-release - # segment. - split_prospective = _version_split(normalized_prospective) - - # 0-pad the prospective version before shortening it to get the correct - # shortened version. - padded_prospective, _ = _pad_version(split_prospective, split_spec) - - # Shorten the prospective version to be the same length as the spec - # so that we can determine if the specifier is a prefix of the - # prospective version or not. - shortened_prospective = padded_prospective[: len(split_spec)] - - return shortened_prospective == split_spec - else: - # Convert our spec string into a Version - spec_version = Version(spec) - - # If the specifier does not have a local segment, then we want to - # act as if the prospective version also does not have a local - # segment. - if not spec_version.local: - prospective = Version(prospective.public) - - return prospective == spec_version - - def _compare_not_equal(self, prospective: Version, spec: str) -> bool: - return not self._compare_equal(prospective, spec) - - def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool: - - # NB: Local version identifiers are NOT permitted in the version - # specifier, so local version labels can be universally removed from - # the prospective version. - return Version(prospective.public) <= Version(spec) - - def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool: - - # NB: Local version identifiers are NOT permitted in the version - # specifier, so local version labels can be universally removed from - # the prospective version. - return Version(prospective.public) >= Version(spec) - - def _compare_less_than(self, prospective: Version, spec_str: str) -> bool: - - # Convert our spec to a Version instance, since we'll want to work with - # it as a version. - spec = Version(spec_str) - - # Check to see if the prospective version is less than the spec - # version. If it's not we can short circuit and just return False now - # instead of doing extra unneeded work. - if not prospective < spec: - return False - - # This special case is here so that, unless the specifier itself - # includes is a pre-release version, that we do not accept pre-release - # versions for the version mentioned in the specifier (e.g. <3.1 should - # not match 3.1.dev0, but should match 3.0.dev0). - if not spec.is_prerelease and prospective.is_prerelease: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # If we've gotten to here, it means that prospective version is both - # less than the spec version *and* it's not a pre-release of the same - # version in the spec. - return True - - def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool: - - # Convert our spec to a Version instance, since we'll want to work with - # it as a version. - spec = Version(spec_str) - - # Check to see if the prospective version is greater than the spec - # version. If it's not we can short circuit and just return False now - # instead of doing extra unneeded work. - if not prospective > spec: - return False - - # This special case is here so that, unless the specifier itself - # includes is a post-release version, that we do not accept - # post-release versions for the version mentioned in the specifier - # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0). - if not spec.is_postrelease and prospective.is_postrelease: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # Ensure that we do not allow a local version of the version mentioned - # in the specifier, which is technically greater than, to match. - if prospective.local is not None: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # If we've gotten to here, it means that prospective version is both - # greater than the spec version *and* it's not a pre-release of the - # same version in the spec. - return True - - def _compare_arbitrary(self, prospective: Version, spec: str) -> bool: - return str(prospective).lower() == str(spec).lower() - - def __contains__(self, item: Union[str, Version]) -> bool: - """Return whether or not the item is contained in this specifier. - - :param item: The item to check for. - - This is used for the ``in`` operator and behaves the same as - :meth:`contains` with no ``prereleases`` argument passed. - - >>> "1.2.3" in Specifier(">=1.2.3") - True - >>> Version("1.2.3") in Specifier(">=1.2.3") - True - >>> "1.0.0" in Specifier(">=1.2.3") - False - >>> "1.3.0a1" in Specifier(">=1.2.3") - False - >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True) - True - """ - return self.contains(item) - - def contains( - self, item: UnparsedVersion, prereleases: Optional[bool] = None - ) -> bool: - """Return whether or not the item is contained in this specifier. - - :param item: - The item to check for, which can be a version string or a - :class:`Version` instance. - :param prereleases: - Whether or not to match prereleases with this Specifier. If set to - ``None`` (the default), it uses :attr:`prereleases` to determine - whether or not prereleases are allowed. - - >>> Specifier(">=1.2.3").contains("1.2.3") - True - >>> Specifier(">=1.2.3").contains(Version("1.2.3")) - True - >>> Specifier(">=1.2.3").contains("1.0.0") - False - >>> Specifier(">=1.2.3").contains("1.3.0a1") - False - >>> Specifier(">=1.2.3", prereleases=True).contains("1.3.0a1") - True - >>> Specifier(">=1.2.3").contains("1.3.0a1", prereleases=True) - True - """ - - # Determine if prereleases are to be allowed or not. - if prereleases is None: - prereleases = self.prereleases - - # Normalize item to a Version, this allows us to have a shortcut for - # "2.0" in Specifier(">=2") - normalized_item = _coerce_version(item) - - # Determine if we should be supporting prereleases in this specifier - # or not, if we do not support prereleases than we can short circuit - # logic if this version is a prereleases. - if normalized_item.is_prerelease and not prereleases: - return False - - # Actually do the comparison to determine if this item is contained - # within this Specifier or not. - operator_callable: CallableOperator = self._get_operator(self.operator) - return operator_callable(normalized_item, self.version) - - def filter( - self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None - ) -> Iterator[UnparsedVersionVar]: - """Filter items in the given iterable, that match the specifier. - - :param iterable: - An iterable that can contain version strings and :class:`Version` instances. - The items in the iterable will be filtered according to the specifier. - :param prereleases: - Whether or not to allow prereleases in the returned iterator. If set to - ``None`` (the default), it will be intelligently decide whether to allow - prereleases or not (based on the :attr:`prereleases` attribute, and - whether the only versions matching are prereleases). - - This method is smarter than just ``filter(Specifier().contains, [...])`` - because it implements the rule from :pep:`440` that a prerelease item - SHOULD be accepted if no other versions match the given specifier. - - >>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) - ['1.3'] - >>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")])) - ['1.2.3', '1.3', ] - >>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"])) - ['1.5a1'] - >>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) - ['1.3', '1.5a1'] - >>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) - ['1.3', '1.5a1'] - """ - - yielded = False - found_prereleases = [] - - kw = {"prereleases": prereleases if prereleases is not None else True} - - # Attempt to iterate over all the values in the iterable and if any of - # them match, yield them. - for version in iterable: - parsed_version = _coerce_version(version) - - if self.contains(parsed_version, **kw): - # If our version is a prerelease, and we were not set to allow - # prereleases, then we'll store it for later in case nothing - # else matches this specifier. - if parsed_version.is_prerelease and not ( - prereleases or self.prereleases - ): - found_prereleases.append(version) - # Either this is not a prerelease, or we should have been - # accepting prereleases from the beginning. - else: - yielded = True - yield version - - # Now that we've iterated over everything, determine if we've yielded - # any values, and if we have not and we have any prereleases stored up - # then we will go ahead and yield the prereleases. - if not yielded and found_prereleases: - for version in found_prereleases: - yield version - - -_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$") - - -def _version_split(version: str) -> List[str]: - result: List[str] = [] - for item in version.split("."): - match = _prefix_regex.search(item) - if match: - result.extend(match.groups()) - else: - result.append(item) - return result - - -def _is_not_suffix(segment: str) -> bool: - return not any( - segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post") - ) - - -def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str]]: - left_split, right_split = [], [] - - # Get the release segment of our versions - left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left))) - right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right))) - - # Get the rest of our versions - left_split.append(left[len(left_split[0]) :]) - right_split.append(right[len(right_split[0]) :]) - - # Insert our padding - left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0]))) - right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0]))) - - return (list(itertools.chain(*left_split)), list(itertools.chain(*right_split))) - - -class SpecifierSet(BaseSpecifier): - """This class abstracts handling of a set of version specifiers. - - It can be passed a single specifier (``>=3.0``), a comma-separated list of - specifiers (``>=3.0,!=3.1``), or no specifier at all. - """ - - def __init__( - self, specifiers: str = "", prereleases: Optional[bool] = None - ) -> None: - """Initialize a SpecifierSet instance. - - :param specifiers: - The string representation of a specifier or a comma-separated list of - specifiers which will be parsed and normalized before use. - :param prereleases: - This tells the SpecifierSet if it should accept prerelease versions if - applicable or not. The default of ``None`` will autodetect it from the - given specifiers. - - :raises InvalidSpecifier: - If the given ``specifiers`` are not parseable than this exception will be - raised. - """ - - # Split on `,` to break each individual specifier into it's own item, and - # strip each item to remove leading/trailing whitespace. - split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()] - - # Parsed each individual specifier, attempting first to make it a - # Specifier. - parsed: Set[Specifier] = set() - for specifier in split_specifiers: - parsed.add(Specifier(specifier)) - - # Turn our parsed specifiers into a frozen set and save them for later. - self._specs = frozenset(parsed) - - # Store our prereleases value so we can use it later to determine if - # we accept prereleases or not. - self._prereleases = prereleases - - @property - def prereleases(self) -> Optional[bool]: - # If we have been given an explicit prerelease modifier, then we'll - # pass that through here. - if self._prereleases is not None: - return self._prereleases - - # If we don't have any specifiers, and we don't have a forced value, - # then we'll just return None since we don't know if this should have - # pre-releases or not. - if not self._specs: - return None - - # Otherwise we'll see if any of the given specifiers accept - # prereleases, if any of them do we'll return True, otherwise False. - return any(s.prereleases for s in self._specs) - - @prereleases.setter - def prereleases(self, value: bool) -> None: - self._prereleases = value - - def __repr__(self) -> str: - """A representation of the specifier set that shows all internal state. - - Note that the ordering of the individual specifiers within the set may not - match the input string. - - >>> SpecifierSet('>=1.0.0,!=2.0.0') - =1.0.0')> - >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=False) - =1.0.0', prereleases=False)> - >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=True) - =1.0.0', prereleases=True)> - """ - pre = ( - f", prereleases={self.prereleases!r}" - if self._prereleases is not None - else "" - ) - - return f"" - - def __str__(self) -> str: - """A string representation of the specifier set that can be round-tripped. - - Note that the ordering of the individual specifiers within the set may not - match the input string. - - >>> str(SpecifierSet(">=1.0.0,!=1.0.1")) - '!=1.0.1,>=1.0.0' - >>> str(SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False)) - '!=1.0.1,>=1.0.0' - """ - return ",".join(sorted(str(s) for s in self._specs)) - - def __hash__(self) -> int: - return hash(self._specs) - - def __and__(self, other: Union["SpecifierSet", str]) -> "SpecifierSet": - """Return a SpecifierSet which is a combination of the two sets. - - :param other: The other object to combine with. - - >>> SpecifierSet(">=1.0.0,!=1.0.1") & '<=2.0.0,!=2.0.1' - =1.0.0')> - >>> SpecifierSet(">=1.0.0,!=1.0.1") & SpecifierSet('<=2.0.0,!=2.0.1') - =1.0.0')> - """ - if isinstance(other, str): - other = SpecifierSet(other) - elif not isinstance(other, SpecifierSet): - return NotImplemented - - specifier = SpecifierSet() - specifier._specs = frozenset(self._specs | other._specs) - - if self._prereleases is None and other._prereleases is not None: - specifier._prereleases = other._prereleases - elif self._prereleases is not None and other._prereleases is None: - specifier._prereleases = self._prereleases - elif self._prereleases == other._prereleases: - specifier._prereleases = self._prereleases - else: - raise ValueError( - "Cannot combine SpecifierSets with True and False prerelease " - "overrides." - ) - - return specifier - - def __eq__(self, other: object) -> bool: - """Whether or not the two SpecifierSet-like objects are equal. - - :param other: The other object to check against. - - The value of :attr:`prereleases` is ignored. - - >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.1") - True - >>> (SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False) == - ... SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)) - True - >>> SpecifierSet(">=1.0.0,!=1.0.1") == ">=1.0.0,!=1.0.1" - True - >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0") - False - >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.2") - False - """ - if isinstance(other, (str, Specifier)): - other = SpecifierSet(str(other)) - elif not isinstance(other, SpecifierSet): - return NotImplemented - - return self._specs == other._specs - - def __len__(self) -> int: - """Returns the number of specifiers in this specifier set.""" - return len(self._specs) - - def __iter__(self) -> Iterator[Specifier]: - """ - Returns an iterator over all the underlying :class:`Specifier` instances - in this specifier set. - - >>> sorted(SpecifierSet(">=1.0.0,!=1.0.1"), key=str) - [, =1.0.0')>] - """ - return iter(self._specs) - - def __contains__(self, item: UnparsedVersion) -> bool: - """Return whether or not the item is contained in this specifier. - - :param item: The item to check for. - - This is used for the ``in`` operator and behaves the same as - :meth:`contains` with no ``prereleases`` argument passed. - - >>> "1.2.3" in SpecifierSet(">=1.0.0,!=1.0.1") - True - >>> Version("1.2.3") in SpecifierSet(">=1.0.0,!=1.0.1") - True - >>> "1.0.1" in SpecifierSet(">=1.0.0,!=1.0.1") - False - >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1") - False - >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True) - True - """ - return self.contains(item) - - def contains( - self, - item: UnparsedVersion, - prereleases: Optional[bool] = None, - installed: Optional[bool] = None, - ) -> bool: - """Return whether or not the item is contained in this SpecifierSet. - - :param item: - The item to check for, which can be a version string or a - :class:`Version` instance. - :param prereleases: - Whether or not to match prereleases with this SpecifierSet. If set to - ``None`` (the default), it uses :attr:`prereleases` to determine - whether or not prereleases are allowed. - - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3") - True - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3")) - True - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1") - False - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1") - False - >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True).contains("1.3.0a1") - True - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True) - True - """ - # Ensure that our item is a Version instance. - if not isinstance(item, Version): - item = Version(item) - - # Determine if we're forcing a prerelease or not, if we're not forcing - # one for this particular filter call, then we'll use whatever the - # SpecifierSet thinks for whether or not we should support prereleases. - if prereleases is None: - prereleases = self.prereleases - - # We can determine if we're going to allow pre-releases by looking to - # see if any of the underlying items supports them. If none of them do - # and this item is a pre-release then we do not allow it and we can - # short circuit that here. - # Note: This means that 1.0.dev1 would not be contained in something - # like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0 - if not prereleases and item.is_prerelease: - return False - - if installed and item.is_prerelease: - item = Version(item.base_version) - - # We simply dispatch to the underlying specs here to make sure that the - # given version is contained within all of them. - # Note: This use of all() here means that an empty set of specifiers - # will always return True, this is an explicit design decision. - return all(s.contains(item, prereleases=prereleases) for s in self._specs) - - def filter( - self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None - ) -> Iterator[UnparsedVersionVar]: - """Filter items in the given iterable, that match the specifiers in this set. - - :param iterable: - An iterable that can contain version strings and :class:`Version` instances. - The items in the iterable will be filtered according to the specifier. - :param prereleases: - Whether or not to allow prereleases in the returned iterator. If set to - ``None`` (the default), it will be intelligently decide whether to allow - prereleases or not (based on the :attr:`prereleases` attribute, and - whether the only versions matching are prereleases). - - This method is smarter than just ``filter(SpecifierSet(...).contains, [...])`` - because it implements the rule from :pep:`440` that a prerelease item - SHOULD be accepted if no other versions match the given specifier. - - >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) - ['1.3'] - >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", Version("1.4")])) - ['1.3', ] - >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.5a1"])) - [] - >>> list(SpecifierSet(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) - ['1.3', '1.5a1'] - >>> list(SpecifierSet(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) - ['1.3', '1.5a1'] - - An "empty" SpecifierSet will filter items based on the presence of prerelease - versions in the set. - - >>> list(SpecifierSet("").filter(["1.3", "1.5a1"])) - ['1.3'] - >>> list(SpecifierSet("").filter(["1.5a1"])) - ['1.5a1'] - >>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"])) - ['1.3', '1.5a1'] - >>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True)) - ['1.3', '1.5a1'] - """ - # Determine if we're forcing a prerelease or not, if we're not forcing - # one for this particular filter call, then we'll use whatever the - # SpecifierSet thinks for whether or not we should support prereleases. - if prereleases is None: - prereleases = self.prereleases - - # If we have any specifiers, then we want to wrap our iterable in the - # filter method for each one, this will act as a logical AND amongst - # each specifier. - if self._specs: - for spec in self._specs: - iterable = spec.filter(iterable, prereleases=bool(prereleases)) - return iter(iterable) - # If we do not have any specifiers, then we need to have a rough filter - # which will filter out any pre-releases, unless there are no final - # releases. - else: - filtered: List[UnparsedVersionVar] = [] - found_prereleases: List[UnparsedVersionVar] = [] - - for item in iterable: - parsed_version = _coerce_version(item) - - # Store any item which is a pre-release for later unless we've - # already found a final version or we are accepting prereleases - if parsed_version.is_prerelease and not prereleases: - if not filtered: - found_prereleases.append(item) - else: - filtered.append(item) - - # If we've found no items except for pre-releases, then we'll go - # ahead and use the pre-releases - if not filtered and found_prereleases and prereleases is None: - return iter(found_prereleases) - - return iter(filtered) diff --git a/venv/lib/python3.8/site-packages/packaging/tags.py b/venv/lib/python3.8/site-packages/packaging/tags.py deleted file mode 100644 index 37f33b1ef849ed9e22a6dd44395c61654a9b7d7a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/tags.py +++ /dev/null @@ -1,553 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -import logging -import platform -import struct -import subprocess -import sys -import sysconfig -from importlib.machinery import EXTENSION_SUFFIXES -from typing import ( - Dict, - FrozenSet, - Iterable, - Iterator, - List, - Optional, - Sequence, - Tuple, - Union, - cast, -) - -from . import _manylinux, _musllinux - -logger = logging.getLogger(__name__) - -PythonVersion = Sequence[int] -MacVersion = Tuple[int, int] - -INTERPRETER_SHORT_NAMES: Dict[str, str] = { - "python": "py", # Generic. - "cpython": "cp", - "pypy": "pp", - "ironpython": "ip", - "jython": "jy", -} - - -_32_BIT_INTERPRETER = struct.calcsize("P") == 4 - - -class Tag: - """ - A representation of the tag triple for a wheel. - - Instances are considered immutable and thus are hashable. Equality checking - is also supported. - """ - - __slots__ = ["_interpreter", "_abi", "_platform", "_hash"] - - def __init__(self, interpreter: str, abi: str, platform: str) -> None: - self._interpreter = interpreter.lower() - self._abi = abi.lower() - self._platform = platform.lower() - # The __hash__ of every single element in a Set[Tag] will be evaluated each time - # that a set calls its `.disjoint()` method, which may be called hundreds of - # times when scanning a page of links for packages with tags matching that - # Set[Tag]. Pre-computing the value here produces significant speedups for - # downstream consumers. - self._hash = hash((self._interpreter, self._abi, self._platform)) - - @property - def interpreter(self) -> str: - return self._interpreter - - @property - def abi(self) -> str: - return self._abi - - @property - def platform(self) -> str: - return self._platform - - def __eq__(self, other: object) -> bool: - if not isinstance(other, Tag): - return NotImplemented - - return ( - (self._hash == other._hash) # Short-circuit ASAP for perf reasons. - and (self._platform == other._platform) - and (self._abi == other._abi) - and (self._interpreter == other._interpreter) - ) - - def __hash__(self) -> int: - return self._hash - - def __str__(self) -> str: - return f"{self._interpreter}-{self._abi}-{self._platform}" - - def __repr__(self) -> str: - return f"<{self} @ {id(self)}>" - - -def parse_tag(tag: str) -> FrozenSet[Tag]: - """ - Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances. - - Returning a set is required due to the possibility that the tag is a - compressed tag set. - """ - tags = set() - interpreters, abis, platforms = tag.split("-") - for interpreter in interpreters.split("."): - for abi in abis.split("."): - for platform_ in platforms.split("."): - tags.add(Tag(interpreter, abi, platform_)) - return frozenset(tags) - - -def _get_config_var(name: str, warn: bool = False) -> Union[int, str, None]: - value: Union[int, str, None] = sysconfig.get_config_var(name) - if value is None and warn: - logger.debug( - "Config variable '%s' is unset, Python ABI tag may be incorrect", name - ) - return value - - -def _normalize_string(string: str) -> str: - return string.replace(".", "_").replace("-", "_").replace(" ", "_") - - -def _abi3_applies(python_version: PythonVersion) -> bool: - """ - Determine if the Python version supports abi3. - - PEP 384 was first implemented in Python 3.2. - """ - return len(python_version) > 1 and tuple(python_version) >= (3, 2) - - -def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]: - py_version = tuple(py_version) # To allow for version comparison. - abis = [] - version = _version_nodot(py_version[:2]) - debug = pymalloc = ucs4 = "" - with_debug = _get_config_var("Py_DEBUG", warn) - has_refcount = hasattr(sys, "gettotalrefcount") - # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled - # extension modules is the best option. - # https://github.com/pypa/pip/issues/3383#issuecomment-173267692 - has_ext = "_d.pyd" in EXTENSION_SUFFIXES - if with_debug or (with_debug is None and (has_refcount or has_ext)): - debug = "d" - if py_version < (3, 8): - with_pymalloc = _get_config_var("WITH_PYMALLOC", warn) - if with_pymalloc or with_pymalloc is None: - pymalloc = "m" - if py_version < (3, 3): - unicode_size = _get_config_var("Py_UNICODE_SIZE", warn) - if unicode_size == 4 or ( - unicode_size is None and sys.maxunicode == 0x10FFFF - ): - ucs4 = "u" - elif debug: - # Debug builds can also load "normal" extension modules. - # We can also assume no UCS-4 or pymalloc requirement. - abis.append(f"cp{version}") - abis.insert( - 0, - "cp{version}{debug}{pymalloc}{ucs4}".format( - version=version, debug=debug, pymalloc=pymalloc, ucs4=ucs4 - ), - ) - return abis - - -def cpython_tags( - python_version: Optional[PythonVersion] = None, - abis: Optional[Iterable[str]] = None, - platforms: Optional[Iterable[str]] = None, - *, - warn: bool = False, -) -> Iterator[Tag]: - """ - Yields the tags for a CPython interpreter. - - The tags consist of: - - cp-- - - cp-abi3- - - cp-none- - - cp-abi3- # Older Python versions down to 3.2. - - If python_version only specifies a major version then user-provided ABIs and - the 'none' ABItag will be used. - - If 'abi3' or 'none' are specified in 'abis' then they will be yielded at - their normal position and not at the beginning. - """ - if not python_version: - python_version = sys.version_info[:2] - - interpreter = f"cp{_version_nodot(python_version[:2])}" - - if abis is None: - if len(python_version) > 1: - abis = _cpython_abis(python_version, warn) - else: - abis = [] - abis = list(abis) - # 'abi3' and 'none' are explicitly handled later. - for explicit_abi in ("abi3", "none"): - try: - abis.remove(explicit_abi) - except ValueError: - pass - - platforms = list(platforms or platform_tags()) - for abi in abis: - for platform_ in platforms: - yield Tag(interpreter, abi, platform_) - if _abi3_applies(python_version): - yield from (Tag(interpreter, "abi3", platform_) for platform_ in platforms) - yield from (Tag(interpreter, "none", platform_) for platform_ in platforms) - - if _abi3_applies(python_version): - for minor_version in range(python_version[1] - 1, 1, -1): - for platform_ in platforms: - interpreter = "cp{version}".format( - version=_version_nodot((python_version[0], minor_version)) - ) - yield Tag(interpreter, "abi3", platform_) - - -def _generic_abi() -> List[str]: - """ - Return the ABI tag based on EXT_SUFFIX. - """ - # The following are examples of `EXT_SUFFIX`. - # We want to keep the parts which are related to the ABI and remove the - # parts which are related to the platform: - # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310 - # - mac: '.cpython-310-darwin.so' => cp310 - # - win: '.cp310-win_amd64.pyd' => cp310 - # - win: '.pyd' => cp37 (uses _cpython_abis()) - # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73 - # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib' - # => graalpy_38_native - - ext_suffix = _get_config_var("EXT_SUFFIX", warn=True) - if not isinstance(ext_suffix, str) or ext_suffix[0] != ".": - raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')") - parts = ext_suffix.split(".") - if len(parts) < 3: - # CPython3.7 and earlier uses ".pyd" on Windows. - return _cpython_abis(sys.version_info[:2]) - soabi = parts[1] - if soabi.startswith("cpython"): - # non-windows - abi = "cp" + soabi.split("-")[1] - elif soabi.startswith("cp"): - # windows - abi = soabi.split("-")[0] - elif soabi.startswith("pypy"): - abi = "-".join(soabi.split("-")[:2]) - elif soabi.startswith("graalpy"): - abi = "-".join(soabi.split("-")[:3]) - elif soabi: - # pyston, ironpython, others? - abi = soabi - else: - return [] - return [_normalize_string(abi)] - - -def generic_tags( - interpreter: Optional[str] = None, - abis: Optional[Iterable[str]] = None, - platforms: Optional[Iterable[str]] = None, - *, - warn: bool = False, -) -> Iterator[Tag]: - """ - Yields the tags for a generic interpreter. - - The tags consist of: - - -- - - The "none" ABI will be added if it was not explicitly provided. - """ - if not interpreter: - interp_name = interpreter_name() - interp_version = interpreter_version(warn=warn) - interpreter = "".join([interp_name, interp_version]) - if abis is None: - abis = _generic_abi() - else: - abis = list(abis) - platforms = list(platforms or platform_tags()) - if "none" not in abis: - abis.append("none") - for abi in abis: - for platform_ in platforms: - yield Tag(interpreter, abi, platform_) - - -def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]: - """ - Yields Python versions in descending order. - - After the latest version, the major-only version will be yielded, and then - all previous versions of that major version. - """ - if len(py_version) > 1: - yield f"py{_version_nodot(py_version[:2])}" - yield f"py{py_version[0]}" - if len(py_version) > 1: - for minor in range(py_version[1] - 1, -1, -1): - yield f"py{_version_nodot((py_version[0], minor))}" - - -def compatible_tags( - python_version: Optional[PythonVersion] = None, - interpreter: Optional[str] = None, - platforms: Optional[Iterable[str]] = None, -) -> Iterator[Tag]: - """ - Yields the sequence of tags that are compatible with a specific version of Python. - - The tags consist of: - - py*-none- - - -none-any # ... if `interpreter` is provided. - - py*-none-any - """ - if not python_version: - python_version = sys.version_info[:2] - platforms = list(platforms or platform_tags()) - for version in _py_interpreter_range(python_version): - for platform_ in platforms: - yield Tag(version, "none", platform_) - if interpreter: - yield Tag(interpreter, "none", "any") - for version in _py_interpreter_range(python_version): - yield Tag(version, "none", "any") - - -def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str: - if not is_32bit: - return arch - - if arch.startswith("ppc"): - return "ppc" - - return "i386" - - -def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]: - formats = [cpu_arch] - if cpu_arch == "x86_64": - if version < (10, 4): - return [] - formats.extend(["intel", "fat64", "fat32"]) - - elif cpu_arch == "i386": - if version < (10, 4): - return [] - formats.extend(["intel", "fat32", "fat"]) - - elif cpu_arch == "ppc64": - # TODO: Need to care about 32-bit PPC for ppc64 through 10.2? - if version > (10, 5) or version < (10, 4): - return [] - formats.append("fat64") - - elif cpu_arch == "ppc": - if version > (10, 6): - return [] - formats.extend(["fat32", "fat"]) - - if cpu_arch in {"arm64", "x86_64"}: - formats.append("universal2") - - if cpu_arch in {"x86_64", "i386", "ppc64", "ppc", "intel"}: - formats.append("universal") - - return formats - - -def mac_platforms( - version: Optional[MacVersion] = None, arch: Optional[str] = None -) -> Iterator[str]: - """ - Yields the platform tags for a macOS system. - - The `version` parameter is a two-item tuple specifying the macOS version to - generate platform tags for. The `arch` parameter is the CPU architecture to - generate platform tags for. Both parameters default to the appropriate value - for the current system. - """ - version_str, _, cpu_arch = platform.mac_ver() - if version is None: - version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) - if version == (10, 16): - # When built against an older macOS SDK, Python will report macOS 10.16 - # instead of the real version. - version_str = subprocess.run( - [ - sys.executable, - "-sS", - "-c", - "import platform; print(platform.mac_ver()[0])", - ], - check=True, - env={"SYSTEM_VERSION_COMPAT": "0"}, - stdout=subprocess.PIPE, - text=True, - ).stdout - version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) - else: - version = version - if arch is None: - arch = _mac_arch(cpu_arch) - else: - arch = arch - - if (10, 0) <= version and version < (11, 0): - # Prior to Mac OS 11, each yearly release of Mac OS bumped the - # "minor" version number. The major version was always 10. - for minor_version in range(version[1], -1, -1): - compat_version = 10, minor_version - binary_formats = _mac_binary_formats(compat_version, arch) - for binary_format in binary_formats: - yield "macosx_{major}_{minor}_{binary_format}".format( - major=10, minor=minor_version, binary_format=binary_format - ) - - if version >= (11, 0): - # Starting with Mac OS 11, each yearly release bumps the major version - # number. The minor versions are now the midyear updates. - for major_version in range(version[0], 10, -1): - compat_version = major_version, 0 - binary_formats = _mac_binary_formats(compat_version, arch) - for binary_format in binary_formats: - yield "macosx_{major}_{minor}_{binary_format}".format( - major=major_version, minor=0, binary_format=binary_format - ) - - if version >= (11, 0): - # Mac OS 11 on x86_64 is compatible with binaries from previous releases. - # Arm64 support was introduced in 11.0, so no Arm binaries from previous - # releases exist. - # - # However, the "universal2" binary format can have a - # macOS version earlier than 11.0 when the x86_64 part of the binary supports - # that version of macOS. - if arch == "x86_64": - for minor_version in range(16, 3, -1): - compat_version = 10, minor_version - binary_formats = _mac_binary_formats(compat_version, arch) - for binary_format in binary_formats: - yield "macosx_{major}_{minor}_{binary_format}".format( - major=compat_version[0], - minor=compat_version[1], - binary_format=binary_format, - ) - else: - for minor_version in range(16, 3, -1): - compat_version = 10, minor_version - binary_format = "universal2" - yield "macosx_{major}_{minor}_{binary_format}".format( - major=compat_version[0], - minor=compat_version[1], - binary_format=binary_format, - ) - - -def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]: - linux = _normalize_string(sysconfig.get_platform()) - if not linux.startswith("linux_"): - # we should never be here, just yield the sysconfig one and return - yield linux - return - if is_32bit: - if linux == "linux_x86_64": - linux = "linux_i686" - elif linux == "linux_aarch64": - linux = "linux_armv8l" - _, arch = linux.split("_", 1) - archs = {"armv8l": ["armv8l", "armv7l"]}.get(arch, [arch]) - yield from _manylinux.platform_tags(archs) - yield from _musllinux.platform_tags(archs) - for arch in archs: - yield f"linux_{arch}" - - -def _generic_platforms() -> Iterator[str]: - yield _normalize_string(sysconfig.get_platform()) - - -def platform_tags() -> Iterator[str]: - """ - Provides the platform tags for this installation. - """ - if platform.system() == "Darwin": - return mac_platforms() - elif platform.system() == "Linux": - return _linux_platforms() - else: - return _generic_platforms() - - -def interpreter_name() -> str: - """ - Returns the name of the running interpreter. - - Some implementations have a reserved, two-letter abbreviation which will - be returned when appropriate. - """ - name = sys.implementation.name - return INTERPRETER_SHORT_NAMES.get(name) or name - - -def interpreter_version(*, warn: bool = False) -> str: - """ - Returns the version of the running interpreter. - """ - version = _get_config_var("py_version_nodot", warn=warn) - if version: - version = str(version) - else: - version = _version_nodot(sys.version_info[:2]) - return version - - -def _version_nodot(version: PythonVersion) -> str: - return "".join(map(str, version)) - - -def sys_tags(*, warn: bool = False) -> Iterator[Tag]: - """ - Returns the sequence of tag triples for the running interpreter. - - The order of the sequence corresponds to priority order for the - interpreter, from most to least important. - """ - - interp_name = interpreter_name() - if interp_name == "cp": - yield from cpython_tags(warn=warn) - else: - yield from generic_tags() - - if interp_name == "pp": - interp = "pp3" - elif interp_name == "cp": - interp = "cp" + interpreter_version(warn=warn) - else: - interp = None - yield from compatible_tags(interpreter=interp) diff --git a/venv/lib/python3.8/site-packages/packaging/utils.py b/venv/lib/python3.8/site-packages/packaging/utils.py deleted file mode 100644 index c2c2f75aa806282d322c76c2117c0f0fdfb09d25..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/utils.py +++ /dev/null @@ -1,172 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -import re -from typing import FrozenSet, NewType, Tuple, Union, cast - -from .tags import Tag, parse_tag -from .version import InvalidVersion, Version - -BuildTag = Union[Tuple[()], Tuple[int, str]] -NormalizedName = NewType("NormalizedName", str) - - -class InvalidName(ValueError): - """ - An invalid distribution name; users should refer to the packaging user guide. - """ - - -class InvalidWheelFilename(ValueError): - """ - An invalid wheel filename was found, users should refer to PEP 427. - """ - - -class InvalidSdistFilename(ValueError): - """ - An invalid sdist filename was found, users should refer to the packaging user guide. - """ - - -# Core metadata spec for `Name` -_validate_regex = re.compile( - r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE -) -_canonicalize_regex = re.compile(r"[-_.]+") -_normalized_regex = re.compile(r"^([a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9])$") -# PEP 427: The build number must start with a digit. -_build_tag_regex = re.compile(r"(\d+)(.*)") - - -def canonicalize_name(name: str, *, validate: bool = False) -> NormalizedName: - if validate and not _validate_regex.match(name): - raise InvalidName(f"name is invalid: {name!r}") - # This is taken from PEP 503. - value = _canonicalize_regex.sub("-", name).lower() - return cast(NormalizedName, value) - - -def is_normalized_name(name: str) -> bool: - return _normalized_regex.match(name) is not None - - -def canonicalize_version( - version: Union[Version, str], *, strip_trailing_zero: bool = True -) -> str: - """ - This is very similar to Version.__str__, but has one subtle difference - with the way it handles the release segment. - """ - if isinstance(version, str): - try: - parsed = Version(version) - except InvalidVersion: - # Legacy versions cannot be normalized - return version - else: - parsed = version - - parts = [] - - # Epoch - if parsed.epoch != 0: - parts.append(f"{parsed.epoch}!") - - # Release segment - release_segment = ".".join(str(x) for x in parsed.release) - if strip_trailing_zero: - # NB: This strips trailing '.0's to normalize - release_segment = re.sub(r"(\.0)+$", "", release_segment) - parts.append(release_segment) - - # Pre-release - if parsed.pre is not None: - parts.append("".join(str(x) for x in parsed.pre)) - - # Post-release - if parsed.post is not None: - parts.append(f".post{parsed.post}") - - # Development release - if parsed.dev is not None: - parts.append(f".dev{parsed.dev}") - - # Local version segment - if parsed.local is not None: - parts.append(f"+{parsed.local}") - - return "".join(parts) - - -def parse_wheel_filename( - filename: str, -) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]: - if not filename.endswith(".whl"): - raise InvalidWheelFilename( - f"Invalid wheel filename (extension must be '.whl'): {filename}" - ) - - filename = filename[:-4] - dashes = filename.count("-") - if dashes not in (4, 5): - raise InvalidWheelFilename( - f"Invalid wheel filename (wrong number of parts): {filename}" - ) - - parts = filename.split("-", dashes - 2) - name_part = parts[0] - # See PEP 427 for the rules on escaping the project name. - if "__" in name_part or re.match(r"^[\w\d._]*$", name_part, re.UNICODE) is None: - raise InvalidWheelFilename(f"Invalid project name: {filename}") - name = canonicalize_name(name_part) - - try: - version = Version(parts[1]) - except InvalidVersion as e: - raise InvalidWheelFilename( - f"Invalid wheel filename (invalid version): {filename}" - ) from e - - if dashes == 5: - build_part = parts[2] - build_match = _build_tag_regex.match(build_part) - if build_match is None: - raise InvalidWheelFilename( - f"Invalid build number: {build_part} in '{filename}'" - ) - build = cast(BuildTag, (int(build_match.group(1)), build_match.group(2))) - else: - build = () - tags = parse_tag(parts[-1]) - return (name, version, build, tags) - - -def parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]: - if filename.endswith(".tar.gz"): - file_stem = filename[: -len(".tar.gz")] - elif filename.endswith(".zip"): - file_stem = filename[: -len(".zip")] - else: - raise InvalidSdistFilename( - f"Invalid sdist filename (extension must be '.tar.gz' or '.zip'):" - f" {filename}" - ) - - # We are requiring a PEP 440 version, which cannot contain dashes, - # so we split on the last dash. - name_part, sep, version_part = file_stem.rpartition("-") - if not sep: - raise InvalidSdistFilename(f"Invalid sdist filename: {filename}") - - name = canonicalize_name(name_part) - - try: - version = Version(version_part) - except InvalidVersion as e: - raise InvalidSdistFilename( - f"Invalid sdist filename (invalid version): {filename}" - ) from e - - return (name, version) diff --git a/venv/lib/python3.8/site-packages/packaging/version.py b/venv/lib/python3.8/site-packages/packaging/version.py deleted file mode 100644 index 5faab9bd0dcf28847960162b2b4f13a8a556ef20..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/packaging/version.py +++ /dev/null @@ -1,563 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -""" -.. testsetup:: - - from packaging.version import parse, Version -""" - -import itertools -import re -from typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union - -from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType - -__all__ = ["VERSION_PATTERN", "parse", "Version", "InvalidVersion"] - -LocalType = Tuple[Union[int, str], ...] - -CmpPrePostDevType = Union[InfinityType, NegativeInfinityType, Tuple[str, int]] -CmpLocalType = Union[ - NegativeInfinityType, - Tuple[Union[Tuple[int, str], Tuple[NegativeInfinityType, Union[int, str]]], ...], -] -CmpKey = Tuple[ - int, - Tuple[int, ...], - CmpPrePostDevType, - CmpPrePostDevType, - CmpPrePostDevType, - CmpLocalType, -] -VersionComparisonMethod = Callable[[CmpKey, CmpKey], bool] - - -class _Version(NamedTuple): - epoch: int - release: Tuple[int, ...] - dev: Optional[Tuple[str, int]] - pre: Optional[Tuple[str, int]] - post: Optional[Tuple[str, int]] - local: Optional[LocalType] - - -def parse(version: str) -> "Version": - """Parse the given version string. - - >>> parse('1.0.dev1') - - - :param version: The version string to parse. - :raises InvalidVersion: When the version string is not a valid version. - """ - return Version(version) - - -class InvalidVersion(ValueError): - """Raised when a version string is not a valid version. - - >>> Version("invalid") - Traceback (most recent call last): - ... - packaging.version.InvalidVersion: Invalid version: 'invalid' - """ - - -class _BaseVersion: - _key: Tuple[Any, ...] - - def __hash__(self) -> int: - return hash(self._key) - - # Please keep the duplicated `isinstance` check - # in the six comparisons hereunder - # unless you find a way to avoid adding overhead function calls. - def __lt__(self, other: "_BaseVersion") -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key < other._key - - def __le__(self, other: "_BaseVersion") -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key <= other._key - - def __eq__(self, other: object) -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key == other._key - - def __ge__(self, other: "_BaseVersion") -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key >= other._key - - def __gt__(self, other: "_BaseVersion") -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key > other._key - - def __ne__(self, other: object) -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key != other._key - - -# Deliberately not anchored to the start and end of the string, to make it -# easier for 3rd party code to reuse -_VERSION_PATTERN = r""" - v? - (?: - (?:(?P[0-9]+)!)? # epoch - (?P[0-9]+(?:\.[0-9]+)*) # release segment - (?P
                                          # pre-release
-            [-_\.]?
-            (?Palpha|a|beta|b|preview|pre|c|rc)
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-        (?P                                         # post release
-            (?:-(?P[0-9]+))
-            |
-            (?:
-                [-_\.]?
-                (?Ppost|rev|r)
-                [-_\.]?
-                (?P[0-9]+)?
-            )
-        )?
-        (?P                                          # dev release
-            [-_\.]?
-            (?Pdev)
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-    )
-    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
-"""
-
-VERSION_PATTERN = _VERSION_PATTERN
-"""
-A string containing the regular expression used to match a valid version.
-
-The pattern is not anchored at either end, and is intended for embedding in larger
-expressions (for example, matching a version number as part of a file name). The
-regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``
-flags set.
-
-:meta hide-value:
-"""
-
-
-class Version(_BaseVersion):
-    """This class abstracts handling of a project's versions.
-
-    A :class:`Version` instance is comparison aware and can be compared and
-    sorted using the standard Python interfaces.
-
-    >>> v1 = Version("1.0a5")
-    >>> v2 = Version("1.0")
-    >>> v1
-    
-    >>> v2
-    
-    >>> v1 < v2
-    True
-    >>> v1 == v2
-    False
-    >>> v1 > v2
-    False
-    >>> v1 >= v2
-    False
-    >>> v1 <= v2
-    True
-    """
-
-    _regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
-    _key: CmpKey
-
-    def __init__(self, version: str) -> None:
-        """Initialize a Version object.
-
-        :param version:
-            The string representation of a version which will be parsed and normalized
-            before use.
-        :raises InvalidVersion:
-            If the ``version`` does not conform to PEP 440 in any way then this
-            exception will be raised.
-        """
-
-        # Validate the version and parse it into pieces
-        match = self._regex.search(version)
-        if not match:
-            raise InvalidVersion(f"Invalid version: '{version}'")
-
-        # Store the parsed out pieces of the version
-        self._version = _Version(
-            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
-            release=tuple(int(i) for i in match.group("release").split(".")),
-            pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
-            post=_parse_letter_version(
-                match.group("post_l"), match.group("post_n1") or match.group("post_n2")
-            ),
-            dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
-            local=_parse_local_version(match.group("local")),
-        )
-
-        # Generate a key which will be used for sorting
-        self._key = _cmpkey(
-            self._version.epoch,
-            self._version.release,
-            self._version.pre,
-            self._version.post,
-            self._version.dev,
-            self._version.local,
-        )
-
-    def __repr__(self) -> str:
-        """A representation of the Version that shows all internal state.
-
-        >>> Version('1.0.0')
-        
-        """
-        return f""
-
-    def __str__(self) -> str:
-        """A string representation of the version that can be rounded-tripped.
-
-        >>> str(Version("1.0a5"))
-        '1.0a5'
-        """
-        parts = []
-
-        # Epoch
-        if self.epoch != 0:
-            parts.append(f"{self.epoch}!")
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self.release))
-
-        # Pre-release
-        if self.pre is not None:
-            parts.append("".join(str(x) for x in self.pre))
-
-        # Post-release
-        if self.post is not None:
-            parts.append(f".post{self.post}")
-
-        # Development release
-        if self.dev is not None:
-            parts.append(f".dev{self.dev}")
-
-        # Local version segment
-        if self.local is not None:
-            parts.append(f"+{self.local}")
-
-        return "".join(parts)
-
-    @property
-    def epoch(self) -> int:
-        """The epoch of the version.
-
-        >>> Version("2.0.0").epoch
-        0
-        >>> Version("1!2.0.0").epoch
-        1
-        """
-        return self._version.epoch
-
-    @property
-    def release(self) -> Tuple[int, ...]:
-        """The components of the "release" segment of the version.
-
-        >>> Version("1.2.3").release
-        (1, 2, 3)
-        >>> Version("2.0.0").release
-        (2, 0, 0)
-        >>> Version("1!2.0.0.post0").release
-        (2, 0, 0)
-
-        Includes trailing zeroes but not the epoch or any pre-release / development /
-        post-release suffixes.
-        """
-        return self._version.release
-
-    @property
-    def pre(self) -> Optional[Tuple[str, int]]:
-        """The pre-release segment of the version.
-
-        >>> print(Version("1.2.3").pre)
-        None
-        >>> Version("1.2.3a1").pre
-        ('a', 1)
-        >>> Version("1.2.3b1").pre
-        ('b', 1)
-        >>> Version("1.2.3rc1").pre
-        ('rc', 1)
-        """
-        return self._version.pre
-
-    @property
-    def post(self) -> Optional[int]:
-        """The post-release number of the version.
-
-        >>> print(Version("1.2.3").post)
-        None
-        >>> Version("1.2.3.post1").post
-        1
-        """
-        return self._version.post[1] if self._version.post else None
-
-    @property
-    def dev(self) -> Optional[int]:
-        """The development number of the version.
-
-        >>> print(Version("1.2.3").dev)
-        None
-        >>> Version("1.2.3.dev1").dev
-        1
-        """
-        return self._version.dev[1] if self._version.dev else None
-
-    @property
-    def local(self) -> Optional[str]:
-        """The local version segment of the version.
-
-        >>> print(Version("1.2.3").local)
-        None
-        >>> Version("1.2.3+abc").local
-        'abc'
-        """
-        if self._version.local:
-            return ".".join(str(x) for x in self._version.local)
-        else:
-            return None
-
-    @property
-    def public(self) -> str:
-        """The public portion of the version.
-
-        >>> Version("1.2.3").public
-        '1.2.3'
-        >>> Version("1.2.3+abc").public
-        '1.2.3'
-        >>> Version("1.2.3+abc.dev1").public
-        '1.2.3'
-        """
-        return str(self).split("+", 1)[0]
-
-    @property
-    def base_version(self) -> str:
-        """The "base version" of the version.
-
-        >>> Version("1.2.3").base_version
-        '1.2.3'
-        >>> Version("1.2.3+abc").base_version
-        '1.2.3'
-        >>> Version("1!1.2.3+abc.dev1").base_version
-        '1!1.2.3'
-
-        The "base version" is the public version of the project without any pre or post
-        release markers.
-        """
-        parts = []
-
-        # Epoch
-        if self.epoch != 0:
-            parts.append(f"{self.epoch}!")
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self.release))
-
-        return "".join(parts)
-
-    @property
-    def is_prerelease(self) -> bool:
-        """Whether this version is a pre-release.
-
-        >>> Version("1.2.3").is_prerelease
-        False
-        >>> Version("1.2.3a1").is_prerelease
-        True
-        >>> Version("1.2.3b1").is_prerelease
-        True
-        >>> Version("1.2.3rc1").is_prerelease
-        True
-        >>> Version("1.2.3dev1").is_prerelease
-        True
-        """
-        return self.dev is not None or self.pre is not None
-
-    @property
-    def is_postrelease(self) -> bool:
-        """Whether this version is a post-release.
-
-        >>> Version("1.2.3").is_postrelease
-        False
-        >>> Version("1.2.3.post1").is_postrelease
-        True
-        """
-        return self.post is not None
-
-    @property
-    def is_devrelease(self) -> bool:
-        """Whether this version is a development release.
-
-        >>> Version("1.2.3").is_devrelease
-        False
-        >>> Version("1.2.3.dev1").is_devrelease
-        True
-        """
-        return self.dev is not None
-
-    @property
-    def major(self) -> int:
-        """The first item of :attr:`release` or ``0`` if unavailable.
-
-        >>> Version("1.2.3").major
-        1
-        """
-        return self.release[0] if len(self.release) >= 1 else 0
-
-    @property
-    def minor(self) -> int:
-        """The second item of :attr:`release` or ``0`` if unavailable.
-
-        >>> Version("1.2.3").minor
-        2
-        >>> Version("1").minor
-        0
-        """
-        return self.release[1] if len(self.release) >= 2 else 0
-
-    @property
-    def micro(self) -> int:
-        """The third item of :attr:`release` or ``0`` if unavailable.
-
-        >>> Version("1.2.3").micro
-        3
-        >>> Version("1").micro
-        0
-        """
-        return self.release[2] if len(self.release) >= 3 else 0
-
-
-def _parse_letter_version(
-    letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
-) -> Optional[Tuple[str, int]]:
-
-    if letter:
-        # We consider there to be an implicit 0 in a pre-release if there is
-        # not a numeral associated with it.
-        if number is None:
-            number = 0
-
-        # We normalize any letters to their lower case form
-        letter = letter.lower()
-
-        # We consider some words to be alternate spellings of other words and
-        # in those cases we want to normalize the spellings to our preferred
-        # spelling.
-        if letter == "alpha":
-            letter = "a"
-        elif letter == "beta":
-            letter = "b"
-        elif letter in ["c", "pre", "preview"]:
-            letter = "rc"
-        elif letter in ["rev", "r"]:
-            letter = "post"
-
-        return letter, int(number)
-    if not letter and number:
-        # We assume if we are given a number, but we are not given a letter
-        # then this is using the implicit post release syntax (e.g. 1.0-1)
-        letter = "post"
-
-        return letter, int(number)
-
-    return None
-
-
-_local_version_separators = re.compile(r"[\._-]")
-
-
-def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
-    """
-    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
-    """
-    if local is not None:
-        return tuple(
-            part.lower() if not part.isdigit() else int(part)
-            for part in _local_version_separators.split(local)
-        )
-    return None
-
-
-def _cmpkey(
-    epoch: int,
-    release: Tuple[int, ...],
-    pre: Optional[Tuple[str, int]],
-    post: Optional[Tuple[str, int]],
-    dev: Optional[Tuple[str, int]],
-    local: Optional[LocalType],
-) -> CmpKey:
-
-    # When we compare a release version, we want to compare it with all of the
-    # trailing zeros removed. So we'll use a reverse the list, drop all the now
-    # leading zeros until we come to something non zero, then take the rest
-    # re-reverse it back into the correct order and make it a tuple and use
-    # that for our sorting key.
-    _release = tuple(
-        reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
-    )
-
-    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
-    # We'll do this by abusing the pre segment, but we _only_ want to do this
-    # if there is not a pre or a post segment. If we have one of those then
-    # the normal sorting rules will handle this case correctly.
-    if pre is None and post is None and dev is not None:
-        _pre: CmpPrePostDevType = NegativeInfinity
-    # Versions without a pre-release (except as noted above) should sort after
-    # those with one.
-    elif pre is None:
-        _pre = Infinity
-    else:
-        _pre = pre
-
-    # Versions without a post segment should sort before those with one.
-    if post is None:
-        _post: CmpPrePostDevType = NegativeInfinity
-
-    else:
-        _post = post
-
-    # Versions without a development segment should sort after those with one.
-    if dev is None:
-        _dev: CmpPrePostDevType = Infinity
-
-    else:
-        _dev = dev
-
-    if local is None:
-        # Versions without a local segment should sort before those with one.
-        _local: CmpLocalType = NegativeInfinity
-    else:
-        # Versions with a local segment need that segment parsed to implement
-        # the sorting rules in PEP440.
-        # - Alpha numeric segments sort before numeric segments
-        # - Alpha numeric segments sort lexicographically
-        # - Numeric segments sort numerically
-        # - Shorter versions sort before longer versions when the prefixes
-        #   match exactly
-        _local = tuple(
-            (i, "") if isinstance(i, int) else (NegativeInfinity, i) for i in local
-        )
-
-    return epoch, _release, _pre, _post, _dev, _local
diff --git a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/LICENSE.txt b/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/LICENSE.txt
deleted file mode 100644
index 737fec5c5352af3d9a6a47a0670da4bdb52c5725..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/LICENSE.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2008-2019 The pip developers (see AUTHORS.txt file)
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/METADATA b/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/METADATA
deleted file mode 100644
index 5183c4e68338e1f31d47c924c974b5d85f917770..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/METADATA
+++ /dev/null
@@ -1,84 +0,0 @@
-Metadata-Version: 2.1
-Name: pip
-Version: 20.0.2
-Summary: The PyPA recommended tool for installing Python packages.
-Home-page: https://pip.pypa.io/
-Author: The pip developers
-Author-email: pypa-dev@groups.google.com
-License: MIT
-Project-URL: Documentation, https://pip.pypa.io
-Project-URL: Source, https://github.com/pypa/pip
-Keywords: distutils easy_install egg setuptools wheel virtualenv
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Topic :: Software Development :: Build Tools
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Programming Language :: Python :: 3.7
-Classifier: Programming Language :: Python :: 3.8
-Classifier: Programming Language :: Python :: Implementation :: CPython
-Classifier: Programming Language :: Python :: Implementation :: PyPy
-Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*
-
-pip - The Python Package Installer
-==================================
-
-.. image:: https://img.shields.io/pypi/v/pip.svg
-   :target: https://pypi.org/project/pip/
-
-.. image:: https://readthedocs.org/projects/pip/badge/?version=latest
-   :target: https://pip.pypa.io/en/latest
-
-pip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.
-
-Please take a look at our documentation for how to install and use pip:
-
-* `Installation`_
-* `Usage`_
-
-Updates are released regularly, with a new version every 3 months. More details can be found in our documentation:
-
-* `Release notes`_
-* `Release process`_
-
-If you find bugs, need help, or want to talk to the developers please use our mailing lists or chat rooms:
-
-* `Issue tracking`_
-* `Discourse channel`_
-* `User IRC`_
-
-If you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:
-
-* `GitHub page`_
-* `Dev documentation`_
-* `Dev mailing list`_
-* `Dev IRC`_
-
-Code of Conduct
----------------
-
-Everyone interacting in the pip project's codebases, issue trackers, chat
-rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_.
-
-.. _package installer: https://packaging.python.org/guides/tool-recommendations/
-.. _Python Package Index: https://pypi.org
-.. _Installation: https://pip.pypa.io/en/stable/installing.html
-.. _Usage: https://pip.pypa.io/en/stable/
-.. _Release notes: https://pip.pypa.io/en/stable/news.html
-.. _Release process: https://pip.pypa.io/en/latest/development/release-process/
-.. _GitHub page: https://github.com/pypa/pip
-.. _Dev documentation: https://pip.pypa.io/en/latest/development
-.. _Issue tracking: https://github.com/pypa/pip/issues
-.. _Discourse channel: https://discuss.python.org/c/packaging
-.. _Dev mailing list: https://groups.google.com/forum/#!forum/pypa-dev
-.. _User IRC: https://webchat.freenode.net/?channels=%23pypa
-.. _Dev IRC: https://webchat.freenode.net/?channels=%23pypa-dev
-.. _PyPA Code of Conduct: https://www.pypa.io/en/latest/code-of-conduct/
-
-
diff --git a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/RECORD b/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/RECORD
deleted file mode 100644
index 8b0df3cbbb8b85dfbe5c90e3d38827ae07c68f7d..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/RECORD
+++ /dev/null
@@ -1,246 +0,0 @@
-../../../bin/pip,sha256=p6kFWnSwGppCvlqUJwc1o7JU2UAI1UqXTeaQ_VzMEVU,258
-../../../bin/pip3,sha256=p6kFWnSwGppCvlqUJwc1o7JU2UAI1UqXTeaQ_VzMEVU,258
-../../../bin/pip3.8,sha256=p6kFWnSwGppCvlqUJwc1o7JU2UAI1UqXTeaQ_VzMEVU,258
-pip-20.0.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-pip-20.0.2.dist-info/LICENSE.txt,sha256=W6Ifuwlk-TatfRU2LR7W1JMcyMj5_y1NkRkOEJvnRDE,1090
-pip-20.0.2.dist-info/METADATA,sha256=MSgjT2JTt8usp4Hopp5AGEmc-7sKR2Jd7HTMJqCoRhw,3352
-pip-20.0.2.dist-info/RECORD,,
-pip-20.0.2.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
-pip-20.0.2.dist-info/entry_points.txt,sha256=HtfDOwpUlr9s73jqLQ6wF9V0_0qvUXJwCBz7Vwx0Ue0,125
-pip-20.0.2.dist-info/top_level.txt,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-pip/__init__.py,sha256=U1AM82iShMaw90K6Yq0Q2-AZ1EsOcqQLQRB-rxwFtII,455
-pip/__main__.py,sha256=NM95x7KuQr-lwPoTjAC0d_QzLJsJjpmAoxZg0mP8s98,632
-pip/__pycache__/__init__.cpython-38.pyc,,
-pip/__pycache__/__main__.cpython-38.pyc,,
-pip/_internal/__init__.py,sha256=j5fiII6yCeZjpW7_7wAVRMM4DwE-gyARGVU4yAADDeE,517
-pip/_internal/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/__pycache__/build_env.cpython-38.pyc,,
-pip/_internal/__pycache__/cache.cpython-38.pyc,,
-pip/_internal/__pycache__/configuration.cpython-38.pyc,,
-pip/_internal/__pycache__/exceptions.cpython-38.pyc,,
-pip/_internal/__pycache__/legacy_resolve.cpython-38.pyc,,
-pip/_internal/__pycache__/locations.cpython-38.pyc,,
-pip/_internal/__pycache__/main.cpython-38.pyc,,
-pip/_internal/__pycache__/pep425tags.cpython-38.pyc,,
-pip/_internal/__pycache__/pyproject.cpython-38.pyc,,
-pip/_internal/__pycache__/self_outdated_check.cpython-38.pyc,,
-pip/_internal/__pycache__/wheel_builder.cpython-38.pyc,,
-pip/_internal/build_env.py,sha256=--aNgzIdYrCOclHMwoAdpclCpfdFE_jooRuCy5gczwg,7532
-pip/_internal/cache.py,sha256=16GrnDRLBQNlfKWIuIF6Sa-EFS78kez_w1WEjT3ykTI,11605
-pip/_internal/cli/__init__.py,sha256=FkHBgpxxb-_gd6r1FjnNhfMOzAUYyXoXKJ6abijfcFU,132
-pip/_internal/cli/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/autocompletion.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/base_command.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/cmdoptions.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/command_context.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/main.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/main_parser.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/parser.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/req_command.cpython-38.pyc,,
-pip/_internal/cli/__pycache__/status_codes.cpython-38.pyc,,
-pip/_internal/cli/autocompletion.py,sha256=ekGNtcDI0p7rFVc-7s4T9Tbss4Jgb7vsB649XJIblRg,6547
-pip/_internal/cli/base_command.py,sha256=v6yl5XNRqye8BT9ep8wvpMu6lylP_Hu6D95r_HqbpbQ,7948
-pip/_internal/cli/cmdoptions.py,sha256=f1TVHuu_fR3lLlMo6b367H_GsWFv26tLI9cAS-kZfE0,28114
-pip/_internal/cli/command_context.py,sha256=ygMVoTy2jpNilKT-6416gFSQpaBtrKRBbVbi2fy__EU,975
-pip/_internal/cli/main.py,sha256=8iq3bHe5lxJTB2EvKOqZ38NS0MmoS79_S1kgj4QuH8A,2610
-pip/_internal/cli/main_parser.py,sha256=W9OWeryh7ZkqELohaFh0Ko9sB98ZkSeDmnYbOZ1imBc,2819
-pip/_internal/cli/parser.py,sha256=O9djTuYQuSfObiY-NU6p4MJCfWsRUnDpE2YGA_fwols,9487
-pip/_internal/cli/req_command.py,sha256=pAUAglpTn0mUA6lRs7KN71yOm1KDabD0ySVTQTqWTSA,12463
-pip/_internal/cli/status_codes.py,sha256=F6uDG6Gj7RNKQJUDnd87QKqI16Us-t-B0wPF_4QMpWc,156
-pip/_internal/commands/__init__.py,sha256=uTSj58QlrSKeXqCUSdL-eAf_APzx5BHy1ABxb0j5ZNE,3714
-pip/_internal/commands/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/check.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/completion.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/configuration.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/debug.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/download.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/freeze.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/hash.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/help.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/install.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/list.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/search.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/show.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/uninstall.cpython-38.pyc,,
-pip/_internal/commands/__pycache__/wheel.cpython-38.pyc,,
-pip/_internal/commands/check.py,sha256=mgLNYT3bd6Kmynwh4zzcBmVlFZ-urMo40jTgk6U405E,1505
-pip/_internal/commands/completion.py,sha256=UFQvq0Q4_B96z1bvnQyMOq82aPSu05RejbLmqeTZjC0,2975
-pip/_internal/commands/configuration.py,sha256=6riioZjMhsNSEct7dE-X8SobGodk3WERKJvuyjBje4Q,7226
-pip/_internal/commands/debug.py,sha256=a8llax2hRkxgK-tvwdJgaCaZCYPIx0fDvrlMDoYr8bQ,4209
-pip/_internal/commands/download.py,sha256=zX_0-IeFb4C8dxSmGHxk-6H5kehtyTSsdWpjNpAhSww,5007
-pip/_internal/commands/freeze.py,sha256=QS-4ib8jbKJ2wrDaDbTuyaB3Y_iJ5CQC2gAVHuAv9QU,3481
-pip/_internal/commands/hash.py,sha256=47teimfAPhpkaVbSDaafck51BT3XXYuL83lAqc5lOcE,1735
-pip/_internal/commands/help.py,sha256=Nhecq--ydFn80Gm1Zvbf9943EcRJfO0TnXUhsF0RO7s,1181
-pip/_internal/commands/install.py,sha256=T4P3J1rw7CQrZX4OUamtcoWMkTrJBfUe6gWpTfZW1bQ,27286
-pip/_internal/commands/list.py,sha256=2l0JiqHxjxDHNTCb2HZOjwwdo4duS1R0MsqZb6HSMKk,10660
-pip/_internal/commands/search.py,sha256=7Il8nKZ9mM7qF5jlnBoPvSIFY9f-0-5IbYoX3miTuZY,5148
-pip/_internal/commands/show.py,sha256=Vzsj2oX0JBl94MPyF3LV8YoMcigl8B2UsMM8zp0pH2s,6792
-pip/_internal/commands/uninstall.py,sha256=8mldFbrQecSoWDZRqxBgJkrlvx6Y9Iy7cs-2BIgtXt4,2983
-pip/_internal/commands/wheel.py,sha256=TMU5ZhjLo7BIZQApGPsYfoCsbGTnvP-N9jkgPJXhj1Y,7170
-pip/_internal/configuration.py,sha256=MgKrLFBJBkF3t2VJM4tvlnEspfSuS4scp_LhHWh53nY,14222
-pip/_internal/distributions/__init__.py,sha256=ECBUW5Gtu9TjJwyFLvim-i6kUMYVuikNh9I5asL6tbA,959
-pip/_internal/distributions/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/distributions/__pycache__/base.cpython-38.pyc,,
-pip/_internal/distributions/__pycache__/installed.cpython-38.pyc,,
-pip/_internal/distributions/__pycache__/sdist.cpython-38.pyc,,
-pip/_internal/distributions/__pycache__/wheel.cpython-38.pyc,,
-pip/_internal/distributions/base.py,sha256=ruprpM_L2T2HNi3KLUHlbHimZ1sWVw-3Q0Lb8O7TDAI,1425
-pip/_internal/distributions/installed.py,sha256=YqlkBKr6TVP1MAYS6SG8ojud21wVOYLMZ8jMLJe9MSU,760
-pip/_internal/distributions/sdist.py,sha256=D4XTMlCwgPlK69l62GLYkNSVTVe99fR5iAcVt2EbGok,4086
-pip/_internal/distributions/wheel.py,sha256=95uD-TfaYoq3KiKBdzk9YMN4RRqJ28LNoSTS2K46gek,1294
-pip/_internal/exceptions.py,sha256=6YRuwXAK6F1iyUWKIkCIpWWN2khkAn1sZOgrFA9S8Ro,10247
-pip/_internal/index/__init__.py,sha256=vpt-JeTZefh8a-FC22ZeBSXFVbuBcXSGiILhQZJaNpQ,30
-pip/_internal/index/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/index/__pycache__/collector.cpython-38.pyc,,
-pip/_internal/index/__pycache__/package_finder.cpython-38.pyc,,
-pip/_internal/index/collector.py,sha256=YS7Ix4oylU7ZbPTPFugh-244GSRqMvdHsGUG6nmz2gE,17892
-pip/_internal/index/package_finder.py,sha256=2Rg75AOpLj8BN1jyL8EI-Iw-Hv6ibJkrYVARCht3bX8,37542
-pip/_internal/legacy_resolve.py,sha256=L7R72I7CjVgJlPTggmA1j4b-H8NmxNu_dKVhrpGXGps,16277
-pip/_internal/locations.py,sha256=VifFEqhc7FWFV8QGoEM3CpECRY8Doq7kTytytxsEgx0,6734
-pip/_internal/main.py,sha256=IVBnUQ-FG7DK6617uEXRB5_QJqspAsBFmTmTesYkbdQ,437
-pip/_internal/models/__init__.py,sha256=3DHUd_qxpPozfzouoqa9g9ts1Czr5qaHfFxbnxriepM,63
-pip/_internal/models/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/models/__pycache__/candidate.cpython-38.pyc,,
-pip/_internal/models/__pycache__/format_control.cpython-38.pyc,,
-pip/_internal/models/__pycache__/index.cpython-38.pyc,,
-pip/_internal/models/__pycache__/link.cpython-38.pyc,,
-pip/_internal/models/__pycache__/scheme.cpython-38.pyc,,
-pip/_internal/models/__pycache__/search_scope.cpython-38.pyc,,
-pip/_internal/models/__pycache__/selection_prefs.cpython-38.pyc,,
-pip/_internal/models/__pycache__/target_python.cpython-38.pyc,,
-pip/_internal/models/__pycache__/wheel.cpython-38.pyc,,
-pip/_internal/models/candidate.py,sha256=Y58Bcm6oXUj0iS-yhmerlGo5CQJI2p0Ww9h6hR9zQDw,1150
-pip/_internal/models/format_control.py,sha256=ICzVjjGwfZYdX-eLLKHjMHLutEJlAGpfj09OG_eMqac,2673
-pip/_internal/models/index.py,sha256=K59A8-hVhBM20Xkahr4dTwP7OjkJyEqXH11UwHFVgqM,1060
-pip/_internal/models/link.py,sha256=y0H2ZOk0P6d1lfGUL2Pl09xFgZcRt5HwN2LElMifOpI,6827
-pip/_internal/models/scheme.py,sha256=vvhBrrno7eVDXcdKHiZWwxhPHf4VG5uSCEkC0QDR2RU,679
-pip/_internal/models/search_scope.py,sha256=2LXbU4wV8LwqdtXQXNXFYKv-IxiDI_QwSz9ZgbwtAfk,3898
-pip/_internal/models/selection_prefs.py,sha256=rPeif2KKjhTPXeMoQYffjqh10oWpXhdkxRDaPT1HO8k,1908
-pip/_internal/models/target_python.py,sha256=c-cFi6zCuo5HYbXNS3rVVpKRaHVh5yQlYEjEW23SidQ,3799
-pip/_internal/models/wheel.py,sha256=UQJyd3V1TTTcFLrsOXHKpoxO5PJfPaIC9y9NbOLNfvc,2791
-pip/_internal/network/__init__.py,sha256=jf6Tt5nV_7zkARBrKojIXItgejvoegVJVKUbhAa5Ioc,50
-pip/_internal/network/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/network/__pycache__/auth.cpython-38.pyc,,
-pip/_internal/network/__pycache__/cache.cpython-38.pyc,,
-pip/_internal/network/__pycache__/download.cpython-38.pyc,,
-pip/_internal/network/__pycache__/session.cpython-38.pyc,,
-pip/_internal/network/__pycache__/utils.cpython-38.pyc,,
-pip/_internal/network/__pycache__/xmlrpc.cpython-38.pyc,,
-pip/_internal/network/auth.py,sha256=K3G1ukKb3PiH8w_UnpXTz8qQsTULO-qdbfOE9zTo1fE,11119
-pip/_internal/network/cache.py,sha256=51CExcRkXWrgMZ7WsrZ6cmijKfViD5tVgKbBvJHO1IE,2394
-pip/_internal/network/download.py,sha256=3D9vdJmVwmCUMxzC-TaVI_GvVOpQna3BLEYNPCSx3Fc,6260
-pip/_internal/network/session.py,sha256=u1IXQfv21R1xv86ulyiB58-be4sYm90eFB0Wp8fVMYw,14702
-pip/_internal/network/utils.py,sha256=iiixo1OeaQ3niUWiBjg59PN6f1w7vvTww1vFriTD_IU,1959
-pip/_internal/network/xmlrpc.py,sha256=AL115M3vFJ8xiHVJneb8Hi0ZFeRvdPhblC89w25OG5s,1597
-pip/_internal/operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-pip/_internal/operations/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/operations/__pycache__/check.cpython-38.pyc,,
-pip/_internal/operations/__pycache__/freeze.cpython-38.pyc,,
-pip/_internal/operations/__pycache__/prepare.cpython-38.pyc,,
-pip/_internal/operations/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-pip/_internal/operations/build/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/operations/build/__pycache__/metadata.cpython-38.pyc,,
-pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-38.pyc,,
-pip/_internal/operations/build/__pycache__/wheel.cpython-38.pyc,,
-pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-38.pyc,,
-pip/_internal/operations/build/metadata.py,sha256=yHMi5gHYXcXyHcvUPWHdO-UyOo3McFWljn_nHfM1O9c,1307
-pip/_internal/operations/build/metadata_legacy.py,sha256=4n6N7BTysqVmEpITzT2UVClyt0Peij_Im8Qm965IWB4,3957
-pip/_internal/operations/build/wheel.py,sha256=ntltdNP6D2Tpr4V0agssu6rE0F9LaBpJkYT6zSdhEbw,1469
-pip/_internal/operations/build/wheel_legacy.py,sha256=DYSxQKutwSZnmNvWkwsl2HzE2XQBxV0i0wTphjtUe90,3349
-pip/_internal/operations/check.py,sha256=a6uHG0daoWpmSPCdL7iYJaGQYZ-CRvPvTnCv2PnIIs0,5353
-pip/_internal/operations/freeze.py,sha256=td4BeRnW10EXFTZrx6VgygO3CrjqD5B9f0BGzjQm-Ew,10180
-pip/_internal/operations/install/__init__.py,sha256=mX7hyD2GNBO2mFGokDQ30r_GXv7Y_PLdtxcUv144e-s,51
-pip/_internal/operations/install/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/operations/install/__pycache__/editable_legacy.cpython-38.pyc,,
-pip/_internal/operations/install/__pycache__/legacy.cpython-38.pyc,,
-pip/_internal/operations/install/__pycache__/wheel.cpython-38.pyc,,
-pip/_internal/operations/install/editable_legacy.py,sha256=rJ_xs2qtDUjpY2-n6eYlVyZiNoKbOtZXZrYrcnIELt4,1488
-pip/_internal/operations/install/legacy.py,sha256=eBV8gHbO9sBlBc-4nuR3Sd2nikHgEcnC9khfeLiypio,4566
-pip/_internal/operations/install/wheel.py,sha256=xdCjH6uIUyg39Pf8tUaMFUN4a7eozJAFMb_wKcgQlsY,23012
-pip/_internal/operations/prepare.py,sha256=ro2teBlbBpkRJhBKraP9CoJgVLpueSk62ziWhRToXww,20942
-pip/_internal/pep425tags.py,sha256=SlIQokevkoKnXhoK3PZvXiDoj8hFKoJ7thDifDtga3k,5490
-pip/_internal/pyproject.py,sha256=VJKsrXORGiGoDPVKCQhuu4tWlQSTOhoiRlVLRNu4rx4,7400
-pip/_internal/req/__init__.py,sha256=UVaYPlHZVGRBQQPjvGC_6jJDQtewXm0ws-8Lxhg_TiY,2671
-pip/_internal/req/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/req/__pycache__/constructors.cpython-38.pyc,,
-pip/_internal/req/__pycache__/req_file.cpython-38.pyc,,
-pip/_internal/req/__pycache__/req_install.cpython-38.pyc,,
-pip/_internal/req/__pycache__/req_set.cpython-38.pyc,,
-pip/_internal/req/__pycache__/req_tracker.cpython-38.pyc,,
-pip/_internal/req/__pycache__/req_uninstall.cpython-38.pyc,,
-pip/_internal/req/constructors.py,sha256=w5-kWWVCqlSqcIBitw86yq7XGMPpKrHDfQZSE2mJ_xc,14388
-pip/_internal/req/req_file.py,sha256=ECqRUicCw5Y08R1YynZAAp8dSKQhDXoc1Q-mY3a9b6I,18485
-pip/_internal/req/req_install.py,sha256=wjsIr4lDpbVSLqANKJI9mXwRVHaRxcnj8q30UiHoLRA,30442
-pip/_internal/req/req_set.py,sha256=GsrKmupRKhNMhjkofVfCEHEHfgEvYBxClaQH5xLBQHg,8066
-pip/_internal/req/req_tracker.py,sha256=27fvVG8Y2MJS1KpU2rBMnQyUEMHG4lkHT_bzbzQK-c0,4723
-pip/_internal/req/req_uninstall.py,sha256=DWnOsuyYGju6-sylyoCm7GtUNevn9qMAVhjAGLcdXUE,23609
-pip/_internal/self_outdated_check.py,sha256=3KO1pTJUuYaiV9X0t87I9PimkGL82HbhLWbocqKZpBU,8009
-pip/_internal/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-pip/_internal/utils/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/appdirs.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/compat.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/deprecation.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/distutils_args.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/encoding.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/entrypoints.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/filesystem.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/filetypes.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/glibc.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/hashes.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/inject_securetransport.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/logging.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/marker_files.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/misc.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/models.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/packaging.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/pkg_resources.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/setuptools_build.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/subprocess.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/temp_dir.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/typing.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/ui.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/unpacking.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/urls.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/virtualenv.cpython-38.pyc,,
-pip/_internal/utils/__pycache__/wheel.cpython-38.pyc,,
-pip/_internal/utils/appdirs.py,sha256=PVo_7-IQWHa9qNuNbWSFiF2QGqeLbSAR4eLcYYhQ9ek,1307
-pip/_internal/utils/compat.py,sha256=D7FKGLBdQwWH-dHIGaoWMawDZWBYApvtJVL1kFPJ930,8869
-pip/_internal/utils/deprecation.py,sha256=pBnNogoA4UGTxa_JDnPXBRRYpKMbExAhXpBwAwklOBs,3318
-pip/_internal/utils/distutils_args.py,sha256=a56mblNxk9BGifbpEETG61mmBrqhjtjRkJ4HYn-oOEE,1350
-pip/_internal/utils/encoding.py,sha256=hxZz0t3Whw3d4MHQEiofxalTlfKwxFdLc8fpeGfhKo8,1320
-pip/_internal/utils/entrypoints.py,sha256=vHcNpnksCv6mllihU6hfifdsKPEjwcaJ1aLIXEaynaU,1152
-pip/_internal/utils/filesystem.py,sha256=PXa3vMcz4mbEKtkD0joFI8pBwddLQxhfPFOkVH5xjfE,5255
-pip/_internal/utils/filetypes.py,sha256=R2FwzoeX7b-rZALOXx5cuO8VPPMhUQ4ne7wm3n3IcWA,571
-pip/_internal/utils/glibc.py,sha256=LOeNGgawCKS-4ke9fii78fwXD73dtNav3uxz1Bf-Ab8,3297
-pip/_internal/utils/hashes.py,sha256=my-wSnAWEDvl_8rQaOQcVIWjwh1-f_QiEvGy9TPf53U,3942
-pip/_internal/utils/inject_securetransport.py,sha256=M17ZlFVY66ApgeASVjKKLKNz0LAfk-SyU0HZ4ZB6MmI,810
-pip/_internal/utils/logging.py,sha256=aJL7NldPhS5KGFof6Qt3o3MG5cjm5TOoo7bGRu9_wsg,13033
-pip/_internal/utils/marker_files.py,sha256=CO5djQlrPIozJpJybViH_insoAaBGY1aqEt6-cC-iW0,741
-pip/_internal/utils/misc.py,sha256=uIb58Hiu_g2HRORo2aMcgnW_7R5d-5wUAuoW0fA2ZME,26085
-pip/_internal/utils/models.py,sha256=IA0hw_T4awQzui0kqfIEASm5yLtgZAB08ag59Nip5G8,1148
-pip/_internal/utils/packaging.py,sha256=VtiwcAAL7LBi7tGL2je7LeW4bE11KMHGCsJ1NZY5XtM,3035
-pip/_internal/utils/pkg_resources.py,sha256=ZX-k7V5q_aNWyDse92nN7orN1aCpRLsaxzpkBZ1XKzU,1254
-pip/_internal/utils/setuptools_build.py,sha256=DouaVolV9olDDFIIN9IszaL-FHdNaZt10ufOZFH9ZAU,5070
-pip/_internal/utils/subprocess.py,sha256=Ph3x5eHQBxFotyGhpZN8asSMBud-BBkmgaNfARG-di8,9922
-pip/_internal/utils/temp_dir.py,sha256=87Ib8aNic_hoSDEmUYJHTQIn5-prL2AYL5u_yZ3s4sI,7768
-pip/_internal/utils/typing.py,sha256=xkYwOeHlf4zsHXBDC4310HtEqwhQcYXFPq2h35Tcrl0,1401
-pip/_internal/utils/ui.py,sha256=0FNxXlGtbpPtTviv2oXS9t8bQG_NBdfUgP4GbubhS9U,13911
-pip/_internal/utils/unpacking.py,sha256=M944JTSiapBOSKLWu7lbawpVHSE7flfzZTEr3TAG7v8,9438
-pip/_internal/utils/urls.py,sha256=aNV9wq5ClUmrz6sG-al7hEWJ4ToitOy7l82CmFGFNW8,1481
-pip/_internal/utils/virtualenv.py,sha256=Q3S1WPlI7JWpGOT2jUVJ8l2chm_k7VPJ9cHA_cUluEU,3396
-pip/_internal/utils/wheel.py,sha256=grTRwZtMQwApwbbSPmRVLtac6FKy6SVKeCXNkWyyePA,7302
-pip/_internal/vcs/__init__.py,sha256=viJxJRqRE_mVScum85bgQIXAd6o0ozFt18VpC-qIJrM,617
-pip/_internal/vcs/__pycache__/__init__.cpython-38.pyc,,
-pip/_internal/vcs/__pycache__/bazaar.cpython-38.pyc,,
-pip/_internal/vcs/__pycache__/git.cpython-38.pyc,,
-pip/_internal/vcs/__pycache__/mercurial.cpython-38.pyc,,
-pip/_internal/vcs/__pycache__/subversion.cpython-38.pyc,,
-pip/_internal/vcs/__pycache__/versioncontrol.cpython-38.pyc,,
-pip/_internal/vcs/bazaar.py,sha256=84q1-kj1_nJ9AMzMu8RmMp-riRZu81M7K9kowcYgi3U,3957
-pip/_internal/vcs/git.py,sha256=CdLz3DTsZsLMLPZpEuUwiS40npvDaVB1CNRzoXgcuJQ,14352
-pip/_internal/vcs/mercurial.py,sha256=2mg7BdYI_Fe00fF6omaNccFQLPHBsDBG5CAEzvqn5sA,5110
-pip/_internal/vcs/subversion.py,sha256=Fpwy71AmuqXnoKi6h1SrXRtPjEMn8fieuM1O4j01IBg,12292
-pip/_internal/vcs/versioncontrol.py,sha256=nqoaM1_rzx24WnHtihXA8RcPpnUae0sV2sR_LS_5HFA,22600
-pip/_internal/wheel_builder.py,sha256=gr9jE14W5ZuYblpldo-tpRuyG0e0AVmHLttImuAvXlE,9441
-pip/_vendor/__init__.py,sha256=RcHf8jwLPL0ZEaa6uMhTSfyCrA_TpWgDWAW5br9xD7Y,4975
-pip/_vendor/__pycache__/__init__.cpython-38.pyc,,
diff --git a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/WHEEL b/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/WHEEL
deleted file mode 100644
index ef99c6cf3283b50a273ac4c6d009a0aa85597070..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/WHEEL
+++ /dev/null
@@ -1,6 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.34.2)
-Root-Is-Purelib: true
-Tag: py2-none-any
-Tag: py3-none-any
-
diff --git a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/entry_points.txt b/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/entry_points.txt
deleted file mode 100644
index d48bd8a85e683c7a9607f3f418f50d11445bdf40..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/entry_points.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-[console_scripts]
-pip = pip._internal.cli.main:main
-pip3 = pip._internal.cli.main:main
-pip3.8 = pip._internal.cli.main:main
-
diff --git a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/top_level.txt
deleted file mode 100644
index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip-20.0.2.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/venv/lib/python3.8/site-packages/pip/__init__.py b/venv/lib/python3.8/site-packages/pip/__init__.py
deleted file mode 100644
index 827a4e20a7b0a7824ae863f97f0b0c1c38408030..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/__init__.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional
-
-
-__version__ = "20.0.2"
-
-
-def main(args=None):
-    # type: (Optional[List[str]]) -> int
-    """This is an internal API only meant for use by pip's own console scripts.
-
-    For additional details, see https://github.com/pypa/pip/issues/7498.
-    """
-    from pip._internal.utils.entrypoints import _wrapper
-
-    return _wrapper(args)
diff --git a/venv/lib/python3.8/site-packages/pip/__main__.py b/venv/lib/python3.8/site-packages/pip/__main__.py
deleted file mode 100644
index e83b9e056b321828cbc8990f719ebb4a729c9bea..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/__main__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from __future__ import absolute_import
-
-import os
-import sys
-
-# If we are running from a wheel, add the wheel to sys.path
-# This allows the usage python pip-*.whl/pip install pip-*.whl
-if __package__ == '':
-    # __file__ is pip-*.whl/pip/__main__.py
-    # first dirname call strips of '/__main__.py', second strips off '/pip'
-    # Resulting path is the name of the wheel itself
-    # Add that to sys.path so we can import pip
-    path = os.path.dirname(os.path.dirname(__file__))
-    sys.path.insert(0, path)
-
-from pip._internal.cli.main import main as _main  # isort:skip # noqa
-
-if __name__ == '__main__':
-    sys.exit(_main())
diff --git a/venv/lib/python3.8/site-packages/pip/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 76a94b0c16bcd80510839a7e3ba6cc73e9368549..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/__pycache__/__main__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/__pycache__/__main__.cpython-38.pyc
deleted file mode 100644
index 173a72fc7764ea247c4f04e1398c6b05fa17aedb..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/__pycache__/__main__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/__init__.py
deleted file mode 100644
index 3aa8a4693ff0893a87364964f06bad8075e4834b..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/__init__.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-import pip._internal.utils.inject_securetransport  # noqa
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, List
-
-
-def main(args=None):
-    # type: (Optional[List[str]]) -> int
-    """This is preserved for old console scripts that may still be referencing
-    it.
-
-    For additional details, see https://github.com/pypa/pip/issues/7498.
-    """
-    from pip._internal.utils.entrypoints import _wrapper
-
-    return _wrapper(args)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 63e7d5f720d6407cf3a5597f61e5db9a6ec6ab1f..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/build_env.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/build_env.cpython-38.pyc
deleted file mode 100644
index 9323417baaf928a6700905885494a44989b8e698..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/build_env.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/cache.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/cache.cpython-38.pyc
deleted file mode 100644
index ad68455c9880c2c6172f312a4e6f6e4c8a37c5eb..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/cache.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/configuration.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/configuration.cpython-38.pyc
deleted file mode 100644
index 286aa828a4705878b36e2b4c400c83bdd9c293f9..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/configuration.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/exceptions.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/exceptions.cpython-38.pyc
deleted file mode 100644
index 25ce7ff415c85f55d1d6469dffd410e3bf8af501..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/exceptions.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/legacy_resolve.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/legacy_resolve.cpython-38.pyc
deleted file mode 100644
index 7e4db43d1cda0f15fe5e19ca62fc13cfe6d1b5fa..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/legacy_resolve.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/locations.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/locations.cpython-38.pyc
deleted file mode 100644
index c0bfc9af84dd48f1af4bbb66b6367962311bd246..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/locations.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/main.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/main.cpython-38.pyc
deleted file mode 100644
index e11ff134ebeb8ce68849e7747d80cd305b26a701..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/main.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/pep425tags.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/pep425tags.cpython-38.pyc
deleted file mode 100644
index d44b8eaed4d075d5eef28cb9993a0c0dab5b21d5..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/pep425tags.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/pyproject.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/pyproject.cpython-38.pyc
deleted file mode 100644
index feaf1e4f1ae5ea083619ece00e4bdd6163147aba..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/pyproject.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-38.pyc
deleted file mode 100644
index 85788a14702787b73193f20a3258c68805efc177..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-38.pyc
deleted file mode 100644
index 2e8b82dd8a8cd88bbfa07e5f6cc0105255d86475..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/build_env.py b/venv/lib/python3.8/site-packages/pip/_internal/build_env.py
deleted file mode 100644
index f55f0e6b8d9e73ff9b751ce2f0c2513123d17100..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/build_env.py
+++ /dev/null
@@ -1,221 +0,0 @@
-"""Build Environment used for isolation during sdist building
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-# mypy: disallow-untyped-defs=False
-
-import logging
-import os
-import sys
-import textwrap
-from collections import OrderedDict
-from distutils.sysconfig import get_python_lib
-from sysconfig import get_paths
-
-from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
-
-from pip import __file__ as pip_location
-from pip._internal.utils.subprocess import call_subprocess
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.ui import open_spinner
-
-if MYPY_CHECK_RUNNING:
-    from typing import Tuple, Set, Iterable, Optional, List
-    from pip._internal.index.package_finder import PackageFinder
-
-logger = logging.getLogger(__name__)
-
-
-class _Prefix:
-
-    def __init__(self, path):
-        # type: (str) -> None
-        self.path = path
-        self.setup = False
-        self.bin_dir = get_paths(
-            'nt' if os.name == 'nt' else 'posix_prefix',
-            vars={'base': path, 'platbase': path}
-        )['scripts']
-        # Note: prefer distutils' sysconfig to get the
-        # library paths so PyPy is correctly supported.
-        purelib = get_python_lib(plat_specific=False, prefix=path)
-        platlib = get_python_lib(plat_specific=True, prefix=path)
-        if purelib == platlib:
-            self.lib_dirs = [purelib]
-        else:
-            self.lib_dirs = [purelib, platlib]
-
-
-class BuildEnvironment(object):
-    """Creates and manages an isolated environment to install build deps
-    """
-
-    def __init__(self):
-        # type: () -> None
-        self._temp_dir = TempDirectory(kind="build-env")
-
-        self._prefixes = OrderedDict((
-            (name, _Prefix(os.path.join(self._temp_dir.path, name)))
-            for name in ('normal', 'overlay')
-        ))
-
-        self._bin_dirs = []  # type: List[str]
-        self._lib_dirs = []  # type: List[str]
-        for prefix in reversed(list(self._prefixes.values())):
-            self._bin_dirs.append(prefix.bin_dir)
-            self._lib_dirs.extend(prefix.lib_dirs)
-
-        # Customize site to:
-        # - ensure .pth files are honored
-        # - prevent access to system site packages
-        system_sites = {
-            os.path.normcase(site) for site in (
-                get_python_lib(plat_specific=False),
-                get_python_lib(plat_specific=True),
-            )
-        }
-        self._site_dir = os.path.join(self._temp_dir.path, 'site')
-        if not os.path.exists(self._site_dir):
-            os.mkdir(self._site_dir)
-        with open(os.path.join(self._site_dir, 'sitecustomize.py'), 'w') as fp:
-            fp.write(textwrap.dedent(
-                '''
-                import os, site, sys
-
-                # First, drop system-sites related paths.
-                original_sys_path = sys.path[:]
-                known_paths = set()
-                for path in {system_sites!r}:
-                    site.addsitedir(path, known_paths=known_paths)
-                system_paths = set(
-                    os.path.normcase(path)
-                    for path in sys.path[len(original_sys_path):]
-                )
-                original_sys_path = [
-                    path for path in original_sys_path
-                    if os.path.normcase(path) not in system_paths
-                ]
-                sys.path = original_sys_path
-
-                # Second, add lib directories.
-                # ensuring .pth file are processed.
-                for path in {lib_dirs!r}:
-                    assert not path in sys.path
-                    site.addsitedir(path)
-                '''
-            ).format(system_sites=system_sites, lib_dirs=self._lib_dirs))
-
-    def __enter__(self):
-        self._save_env = {
-            name: os.environ.get(name, None)
-            for name in ('PATH', 'PYTHONNOUSERSITE', 'PYTHONPATH')
-        }
-
-        path = self._bin_dirs[:]
-        old_path = self._save_env['PATH']
-        if old_path:
-            path.extend(old_path.split(os.pathsep))
-
-        pythonpath = [self._site_dir]
-
-        os.environ.update({
-            'PATH': os.pathsep.join(path),
-            'PYTHONNOUSERSITE': '1',
-            'PYTHONPATH': os.pathsep.join(pythonpath),
-        })
-
-    def __exit__(self, exc_type, exc_val, exc_tb):
-        for varname, old_value in self._save_env.items():
-            if old_value is None:
-                os.environ.pop(varname, None)
-            else:
-                os.environ[varname] = old_value
-
-    def cleanup(self):
-        # type: () -> None
-        self._temp_dir.cleanup()
-
-    def check_requirements(self, reqs):
-        # type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]]
-        """Return 2 sets:
-            - conflicting requirements: set of (installed, wanted) reqs tuples
-            - missing requirements: set of reqs
-        """
-        missing = set()
-        conflicting = set()
-        if reqs:
-            ws = WorkingSet(self._lib_dirs)
-            for req in reqs:
-                try:
-                    if ws.find(Requirement.parse(req)) is None:
-                        missing.add(req)
-                except VersionConflict as e:
-                    conflicting.add((str(e.args[0].as_requirement()),
-                                     str(e.args[1])))
-        return conflicting, missing
-
-    def install_requirements(
-        self,
-        finder,  # type: PackageFinder
-        requirements,  # type: Iterable[str]
-        prefix_as_string,  # type: str
-        message  # type: Optional[str]
-    ):
-        # type: (...) -> None
-        prefix = self._prefixes[prefix_as_string]
-        assert not prefix.setup
-        prefix.setup = True
-        if not requirements:
-            return
-        args = [
-            sys.executable, os.path.dirname(pip_location), 'install',
-            '--ignore-installed', '--no-user', '--prefix', prefix.path,
-            '--no-warn-script-location',
-        ]  # type: List[str]
-        if logger.getEffectiveLevel() <= logging.DEBUG:
-            args.append('-v')
-        for format_control in ('no_binary', 'only_binary'):
-            formats = getattr(finder.format_control, format_control)
-            args.extend(('--' + format_control.replace('_', '-'),
-                         ','.join(sorted(formats or {':none:'}))))
-
-        index_urls = finder.index_urls
-        if index_urls:
-            args.extend(['-i', index_urls[0]])
-            for extra_index in index_urls[1:]:
-                args.extend(['--extra-index-url', extra_index])
-        else:
-            args.append('--no-index')
-        for link in finder.find_links:
-            args.extend(['--find-links', link])
-
-        for host in finder.trusted_hosts:
-            args.extend(['--trusted-host', host])
-        if finder.allow_all_prereleases:
-            args.append('--pre')
-        args.append('--')
-        args.extend(requirements)
-        with open_spinner(message) as spinner:
-            call_subprocess(args, spinner=spinner)
-
-
-class NoOpBuildEnvironment(BuildEnvironment):
-    """A no-op drop-in replacement for BuildEnvironment
-    """
-
-    def __init__(self):
-        pass
-
-    def __enter__(self):
-        pass
-
-    def __exit__(self, exc_type, exc_val, exc_tb):
-        pass
-
-    def cleanup(self):
-        pass
-
-    def install_requirements(self, finder, requirements, prefix, message):
-        raise NotImplementedError()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cache.py b/venv/lib/python3.8/site-packages/pip/_internal/cache.py
deleted file mode 100644
index abecd78f8d988dd5856855aff3a89ab270ca73a9..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cache.py
+++ /dev/null
@@ -1,329 +0,0 @@
-"""Cache Management
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-import hashlib
-import json
-import logging
-import os
-
-from pip._vendor.packaging.tags import interpreter_name, interpreter_version
-from pip._vendor.packaging.utils import canonicalize_name
-
-from pip._internal.exceptions import InvalidWheelFilename
-from pip._internal.models.link import Link
-from pip._internal.models.wheel import Wheel
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import path_to_url
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Set, List, Any, Dict
-
-    from pip._vendor.packaging.tags import Tag
-
-    from pip._internal.models.format_control import FormatControl
-
-logger = logging.getLogger(__name__)
-
-
-def _hash_dict(d):
-    # type: (Dict[str, str]) -> str
-    """Return a stable sha224 of a dictionary."""
-    s = json.dumps(d, sort_keys=True, separators=(",", ":"), ensure_ascii=True)
-    return hashlib.sha224(s.encode("ascii")).hexdigest()
-
-
-class Cache(object):
-    """An abstract class - provides cache directories for data from links
-
-
-        :param cache_dir: The root of the cache.
-        :param format_control: An object of FormatControl class to limit
-            binaries being read from the cache.
-        :param allowed_formats: which formats of files the cache should store.
-            ('binary' and 'source' are the only allowed values)
-    """
-
-    def __init__(self, cache_dir, format_control, allowed_formats):
-        # type: (str, FormatControl, Set[str]) -> None
-        super(Cache, self).__init__()
-        assert not cache_dir or os.path.isabs(cache_dir)
-        self.cache_dir = cache_dir or None
-        self.format_control = format_control
-        self.allowed_formats = allowed_formats
-
-        _valid_formats = {"source", "binary"}
-        assert self.allowed_formats.union(_valid_formats) == _valid_formats
-
-    def _get_cache_path_parts_legacy(self, link):
-        # type: (Link) -> List[str]
-        """Get parts of part that must be os.path.joined with cache_dir
-
-        Legacy cache key (pip < 20) for compatibility with older caches.
-        """
-
-        # We want to generate an url to use as our cache key, we don't want to
-        # just re-use the URL because it might have other items in the fragment
-        # and we don't care about those.
-        key_parts = [link.url_without_fragment]
-        if link.hash_name is not None and link.hash is not None:
-            key_parts.append("=".join([link.hash_name, link.hash]))
-        key_url = "#".join(key_parts)
-
-        # Encode our key url with sha224, we'll use this because it has similar
-        # security properties to sha256, but with a shorter total output (and
-        # thus less secure). However the differences don't make a lot of
-        # difference for our use case here.
-        hashed = hashlib.sha224(key_url.encode()).hexdigest()
-
-        # We want to nest the directories some to prevent having a ton of top
-        # level directories where we might run out of sub directories on some
-        # FS.
-        parts = [hashed[:2], hashed[2:4], hashed[4:6], hashed[6:]]
-
-        return parts
-
-    def _get_cache_path_parts(self, link):
-        # type: (Link) -> List[str]
-        """Get parts of part that must be os.path.joined with cache_dir
-        """
-
-        # We want to generate an url to use as our cache key, we don't want to
-        # just re-use the URL because it might have other items in the fragment
-        # and we don't care about those.
-        key_parts = {"url": link.url_without_fragment}
-        if link.hash_name is not None and link.hash is not None:
-            key_parts[link.hash_name] = link.hash
-        if link.subdirectory_fragment:
-            key_parts["subdirectory"] = link.subdirectory_fragment
-
-        # Include interpreter name, major and minor version in cache key
-        # to cope with ill-behaved sdists that build a different wheel
-        # depending on the python version their setup.py is being run on,
-        # and don't encode the difference in compatibility tags.
-        # https://github.com/pypa/pip/issues/7296
-        key_parts["interpreter_name"] = interpreter_name()
-        key_parts["interpreter_version"] = interpreter_version()
-
-        # Encode our key url with sha224, we'll use this because it has similar
-        # security properties to sha256, but with a shorter total output (and
-        # thus less secure). However the differences don't make a lot of
-        # difference for our use case here.
-        hashed = _hash_dict(key_parts)
-
-        # We want to nest the directories some to prevent having a ton of top
-        # level directories where we might run out of sub directories on some
-        # FS.
-        parts = [hashed[:2], hashed[2:4], hashed[4:6], hashed[6:]]
-
-        return parts
-
-    def _get_candidates(self, link, canonical_package_name):
-        # type: (Link, Optional[str]) -> List[Any]
-        can_not_cache = (
-            not self.cache_dir or
-            not canonical_package_name or
-            not link
-        )
-        if can_not_cache:
-            return []
-
-        formats = self.format_control.get_allowed_formats(
-            canonical_package_name
-        )
-        if not self.allowed_formats.intersection(formats):
-            return []
-
-        candidates = []
-        path = self.get_path_for_link(link)
-        if os.path.isdir(path):
-            for candidate in os.listdir(path):
-                candidates.append((candidate, path))
-        # TODO remove legacy path lookup in pip>=21
-        legacy_path = self.get_path_for_link_legacy(link)
-        if os.path.isdir(legacy_path):
-            for candidate in os.listdir(legacy_path):
-                candidates.append((candidate, legacy_path))
-        return candidates
-
-    def get_path_for_link_legacy(self, link):
-        # type: (Link) -> str
-        raise NotImplementedError()
-
-    def get_path_for_link(self, link):
-        # type: (Link) -> str
-        """Return a directory to store cached items in for link.
-        """
-        raise NotImplementedError()
-
-    def get(
-        self,
-        link,            # type: Link
-        package_name,    # type: Optional[str]
-        supported_tags,  # type: List[Tag]
-    ):
-        # type: (...) -> Link
-        """Returns a link to a cached item if it exists, otherwise returns the
-        passed link.
-        """
-        raise NotImplementedError()
-
-    def cleanup(self):
-        # type: () -> None
-        pass
-
-
-class SimpleWheelCache(Cache):
-    """A cache of wheels for future installs.
-    """
-
-    def __init__(self, cache_dir, format_control):
-        # type: (str, FormatControl) -> None
-        super(SimpleWheelCache, self).__init__(
-            cache_dir, format_control, {"binary"}
-        )
-
-    def get_path_for_link_legacy(self, link):
-        # type: (Link) -> str
-        parts = self._get_cache_path_parts_legacy(link)
-        return os.path.join(self.cache_dir, "wheels", *parts)
-
-    def get_path_for_link(self, link):
-        # type: (Link) -> str
-        """Return a directory to store cached wheels for link
-
-        Because there are M wheels for any one sdist, we provide a directory
-        to cache them in, and then consult that directory when looking up
-        cache hits.
-
-        We only insert things into the cache if they have plausible version
-        numbers, so that we don't contaminate the cache with things that were
-        not unique. E.g. ./package might have dozens of installs done for it
-        and build a version of 0.0...and if we built and cached a wheel, we'd
-        end up using the same wheel even if the source has been edited.
-
-        :param link: The link of the sdist for which this will cache wheels.
-        """
-        parts = self._get_cache_path_parts(link)
-
-        # Store wheels within the root cache_dir
-        return os.path.join(self.cache_dir, "wheels", *parts)
-
-    def get(
-        self,
-        link,            # type: Link
-        package_name,    # type: Optional[str]
-        supported_tags,  # type: List[Tag]
-    ):
-        # type: (...) -> Link
-        candidates = []
-
-        if not package_name:
-            return link
-
-        canonical_package_name = canonicalize_name(package_name)
-        for wheel_name, wheel_dir in self._get_candidates(
-            link, canonical_package_name
-        ):
-            try:
-                wheel = Wheel(wheel_name)
-            except InvalidWheelFilename:
-                continue
-            if canonicalize_name(wheel.name) != canonical_package_name:
-                logger.debug(
-                    "Ignoring cached wheel {} for {} as it "
-                    "does not match the expected distribution name {}.".format(
-                        wheel_name, link, package_name
-                    )
-                )
-                continue
-            if not wheel.supported(supported_tags):
-                # Built for a different python/arch/etc
-                continue
-            candidates.append(
-                (
-                    wheel.support_index_min(supported_tags),
-                    wheel_name,
-                    wheel_dir,
-                )
-            )
-
-        if not candidates:
-            return link
-
-        _, wheel_name, wheel_dir = min(candidates)
-        return Link(path_to_url(os.path.join(wheel_dir, wheel_name)))
-
-
-class EphemWheelCache(SimpleWheelCache):
-    """A SimpleWheelCache that creates it's own temporary cache directory
-    """
-
-    def __init__(self, format_control):
-        # type: (FormatControl) -> None
-        self._temp_dir = TempDirectory(kind="ephem-wheel-cache")
-
-        super(EphemWheelCache, self).__init__(
-            self._temp_dir.path, format_control
-        )
-
-    def cleanup(self):
-        # type: () -> None
-        self._temp_dir.cleanup()
-
-
-class WheelCache(Cache):
-    """Wraps EphemWheelCache and SimpleWheelCache into a single Cache
-
-    This Cache allows for gracefully degradation, using the ephem wheel cache
-    when a certain link is not found in the simple wheel cache first.
-    """
-
-    def __init__(self, cache_dir, format_control):
-        # type: (str, FormatControl) -> None
-        super(WheelCache, self).__init__(
-            cache_dir, format_control, {'binary'}
-        )
-        self._wheel_cache = SimpleWheelCache(cache_dir, format_control)
-        self._ephem_cache = EphemWheelCache(format_control)
-
-    def get_path_for_link_legacy(self, link):
-        # type: (Link) -> str
-        return self._wheel_cache.get_path_for_link_legacy(link)
-
-    def get_path_for_link(self, link):
-        # type: (Link) -> str
-        return self._wheel_cache.get_path_for_link(link)
-
-    def get_ephem_path_for_link(self, link):
-        # type: (Link) -> str
-        return self._ephem_cache.get_path_for_link(link)
-
-    def get(
-        self,
-        link,            # type: Link
-        package_name,    # type: Optional[str]
-        supported_tags,  # type: List[Tag]
-    ):
-        # type: (...) -> Link
-        retval = self._wheel_cache.get(
-            link=link,
-            package_name=package_name,
-            supported_tags=supported_tags,
-        )
-        if retval is not link:
-            return retval
-
-        return self._ephem_cache.get(
-            link=link,
-            package_name=package_name,
-            supported_tags=supported_tags,
-        )
-
-    def cleanup(self):
-        # type: () -> None
-        self._wheel_cache.cleanup()
-        self._ephem_cache.cleanup()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/__init__.py
deleted file mode 100644
index e589bb917e23823e25f9fff7e0849c4d6d4a62bc..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-"""Subpackage containing all of pip's command line interface related code
-"""
-
-# This file intentionally does not import submodules
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index ca2d0b96a4cde9ecf15a9bc5ec7337b398b80e79..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-38.pyc
deleted file mode 100644
index 6b967a5327c0e2b390818524a8f88323986151ac..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-38.pyc
deleted file mode 100644
index 69d95079f722876f519789dea20edade3ff9521b..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-38.pyc
deleted file mode 100644
index b2ff3e710df78803836f458fa138c88e4ae409ee..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-38.pyc
deleted file mode 100644
index 0afc94a1149bbaab11e53c93af3ca91c889cb2e9..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/main.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/main.cpython-38.pyc
deleted file mode 100644
index 80f09c618e7906f69a47417d23006620a5681834..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/main.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-38.pyc
deleted file mode 100644
index b7b25c41cdba1e0d111cc13e42d3dce10a3301f9..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/parser.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/parser.cpython-38.pyc
deleted file mode 100644
index e69ff7880c701bf3b1a1053fca61e4063a8a7983..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/parser.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-38.pyc
deleted file mode 100644
index 1ff1a5c04f7a4c469e68a52ec2f34531626aaad1..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-38.pyc
deleted file mode 100644
index 39dabc42bfff9cd5d5e5f6c6fe744bf108dffbec..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py
deleted file mode 100644
index 329de602513d7bb868799a49d36d3f081a79e441..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py
+++ /dev/null
@@ -1,164 +0,0 @@
-"""Logic that powers autocompletion installed by ``pip completion``.
-"""
-
-import optparse
-import os
-import sys
-from itertools import chain
-
-from pip._internal.cli.main_parser import create_main_parser
-from pip._internal.commands import commands_dict, create_command
-from pip._internal.utils.misc import get_installed_distributions
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any, Iterable, List, Optional
-
-
-def autocomplete():
-    # type: () -> None
-    """Entry Point for completion of main and subcommand options.
-    """
-    # Don't complete if user hasn't sourced bash_completion file.
-    if 'PIP_AUTO_COMPLETE' not in os.environ:
-        return
-    cwords = os.environ['COMP_WORDS'].split()[1:]
-    cword = int(os.environ['COMP_CWORD'])
-    try:
-        current = cwords[cword - 1]
-    except IndexError:
-        current = ''
-
-    parser = create_main_parser()
-    subcommands = list(commands_dict)
-    options = []
-
-    # subcommand
-    subcommand_name = None  # type: Optional[str]
-    for word in cwords:
-        if word in subcommands:
-            subcommand_name = word
-            break
-    # subcommand options
-    if subcommand_name is not None:
-        # special case: 'help' subcommand has no options
-        if subcommand_name == 'help':
-            sys.exit(1)
-        # special case: list locally installed dists for show and uninstall
-        should_list_installed = (
-            subcommand_name in ['show', 'uninstall'] and
-            not current.startswith('-')
-        )
-        if should_list_installed:
-            installed = []
-            lc = current.lower()
-            for dist in get_installed_distributions(local_only=True):
-                if dist.key.startswith(lc) and dist.key not in cwords[1:]:
-                    installed.append(dist.key)
-            # if there are no dists installed, fall back to option completion
-            if installed:
-                for dist in installed:
-                    print(dist)
-                sys.exit(1)
-
-        subcommand = create_command(subcommand_name)
-
-        for opt in subcommand.parser.option_list_all:
-            if opt.help != optparse.SUPPRESS_HELP:
-                for opt_str in opt._long_opts + opt._short_opts:
-                    options.append((opt_str, opt.nargs))
-
-        # filter out previously specified options from available options
-        prev_opts = [x.split('=')[0] for x in cwords[1:cword - 1]]
-        options = [(x, v) for (x, v) in options if x not in prev_opts]
-        # filter options by current input
-        options = [(k, v) for k, v in options if k.startswith(current)]
-        # get completion type given cwords and available subcommand options
-        completion_type = get_path_completion_type(
-            cwords, cword, subcommand.parser.option_list_all,
-        )
-        # get completion files and directories if ``completion_type`` is
-        # ````, ```` or ````
-        if completion_type:
-            paths = auto_complete_paths(current, completion_type)
-            options = [(path, 0) for path in paths]
-        for option in options:
-            opt_label = option[0]
-            # append '=' to options which require args
-            if option[1] and option[0][:2] == "--":
-                opt_label += '='
-            print(opt_label)
-    else:
-        # show main parser options only when necessary
-
-        opts = [i.option_list for i in parser.option_groups]
-        opts.append(parser.option_list)
-        flattened_opts = chain.from_iterable(opts)
-        if current.startswith('-'):
-            for opt in flattened_opts:
-                if opt.help != optparse.SUPPRESS_HELP:
-                    subcommands += opt._long_opts + opt._short_opts
-        else:
-            # get completion type given cwords and all available options
-            completion_type = get_path_completion_type(cwords, cword,
-                                                       flattened_opts)
-            if completion_type:
-                subcommands = list(auto_complete_paths(current,
-                                                       completion_type))
-
-        print(' '.join([x for x in subcommands if x.startswith(current)]))
-    sys.exit(1)
-
-
-def get_path_completion_type(cwords, cword, opts):
-    # type: (List[str], int, Iterable[Any]) -> Optional[str]
-    """Get the type of path completion (``file``, ``dir``, ``path`` or None)
-
-    :param cwords: same as the environmental variable ``COMP_WORDS``
-    :param cword: same as the environmental variable ``COMP_CWORD``
-    :param opts: The available options to check
-    :return: path completion type (``file``, ``dir``, ``path`` or None)
-    """
-    if cword < 2 or not cwords[cword - 2].startswith('-'):
-        return None
-    for opt in opts:
-        if opt.help == optparse.SUPPRESS_HELP:
-            continue
-        for o in str(opt).split('/'):
-            if cwords[cword - 2].split('=')[0] == o:
-                if not opt.metavar or any(
-                        x in ('path', 'file', 'dir')
-                        for x in opt.metavar.split('/')):
-                    return opt.metavar
-    return None
-
-
-def auto_complete_paths(current, completion_type):
-    # type: (str, str) -> Iterable[str]
-    """If ``completion_type`` is ``file`` or ``path``, list all regular files
-    and directories starting with ``current``; otherwise only list directories
-    starting with ``current``.
-
-    :param current: The word to be completed
-    :param completion_type: path completion type(`file`, `path` or `dir`)i
-    :return: A generator of regular files and/or directories
-    """
-    directory, filename = os.path.split(current)
-    current_path = os.path.abspath(directory)
-    # Don't complete paths if they can't be accessed
-    if not os.access(current_path, os.R_OK):
-        return
-    filename = os.path.normcase(filename)
-    # list all files that start with ``filename``
-    file_list = (x for x in os.listdir(current_path)
-                 if os.path.normcase(x).startswith(filename))
-    for f in file_list:
-        opt = os.path.join(current_path, f)
-        comp_file = os.path.normcase(os.path.join(directory, f))
-        # complete regular files when there is not ```` after option
-        # complete directories when there is ````, ```` or
-        # ````after option
-        if completion_type != 'dir' and os.path.isfile(opt):
-            yield comp_file
-        elif os.path.isdir(opt):
-            yield os.path.join(comp_file, '')
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/base_command.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/base_command.py
deleted file mode 100644
index 628faa3eee0e441b8fed0eea9c6e4b74222ebb3f..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/base_command.py
+++ /dev/null
@@ -1,226 +0,0 @@
-"""Base Command class, and related routines"""
-
-from __future__ import absolute_import, print_function
-
-import logging
-import logging.config
-import optparse
-import os
-import platform
-import sys
-import traceback
-
-from pip._internal.cli import cmdoptions
-from pip._internal.cli.command_context import CommandContextMixIn
-from pip._internal.cli.parser import (
-    ConfigOptionParser,
-    UpdatingDefaultsHelpFormatter,
-)
-from pip._internal.cli.status_codes import (
-    ERROR,
-    PREVIOUS_BUILD_DIR_ERROR,
-    SUCCESS,
-    UNKNOWN_ERROR,
-    VIRTUALENV_NOT_FOUND,
-)
-from pip._internal.exceptions import (
-    BadCommand,
-    CommandError,
-    InstallationError,
-    PreviousBuildDirError,
-    UninstallationError,
-)
-from pip._internal.utils.deprecation import deprecated
-from pip._internal.utils.filesystem import check_path_owner
-from pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging
-from pip._internal.utils.misc import get_prog, normalize_path
-from pip._internal.utils.temp_dir import global_tempdir_manager
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.virtualenv import running_under_virtualenv
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Tuple, Any
-    from optparse import Values
-
-__all__ = ['Command']
-
-logger = logging.getLogger(__name__)
-
-
-class Command(CommandContextMixIn):
-    usage = None  # type: str
-    ignore_require_venv = False  # type: bool
-
-    def __init__(self, name, summary, isolated=False):
-        # type: (str, str, bool) -> None
-        super(Command, self).__init__()
-        parser_kw = {
-            'usage': self.usage,
-            'prog': '%s %s' % (get_prog(), name),
-            'formatter': UpdatingDefaultsHelpFormatter(),
-            'add_help_option': False,
-            'name': name,
-            'description': self.__doc__,
-            'isolated': isolated,
-        }
-
-        self.name = name
-        self.summary = summary
-        self.parser = ConfigOptionParser(**parser_kw)
-
-        # Commands should add options to this option group
-        optgroup_name = '%s Options' % self.name.capitalize()
-        self.cmd_opts = optparse.OptionGroup(self.parser, optgroup_name)
-
-        # Add the general options
-        gen_opts = cmdoptions.make_option_group(
-            cmdoptions.general_group,
-            self.parser,
-        )
-        self.parser.add_option_group(gen_opts)
-
-    def handle_pip_version_check(self, options):
-        # type: (Values) -> None
-        """
-        This is a no-op so that commands by default do not do the pip version
-        check.
-        """
-        # Make sure we do the pip version check if the index_group options
-        # are present.
-        assert not hasattr(options, 'no_index')
-
-    def run(self, options, args):
-        # type: (Values, List[Any]) -> Any
-        raise NotImplementedError
-
-    def parse_args(self, args):
-        # type: (List[str]) -> Tuple[Any, Any]
-        # factored out for testability
-        return self.parser.parse_args(args)
-
-    def main(self, args):
-        # type: (List[str]) -> int
-        try:
-            with self.main_context():
-                return self._main(args)
-        finally:
-            logging.shutdown()
-
-    def _main(self, args):
-        # type: (List[str]) -> int
-        # Intentionally set as early as possible so globally-managed temporary
-        # directories are available to the rest of the code.
-        self.enter_context(global_tempdir_manager())
-
-        options, args = self.parse_args(args)
-
-        # Set verbosity so that it can be used elsewhere.
-        self.verbosity = options.verbose - options.quiet
-
-        level_number = setup_logging(
-            verbosity=self.verbosity,
-            no_color=options.no_color,
-            user_log_file=options.log,
-        )
-
-        if (
-            sys.version_info[:2] == (2, 7) and
-            not options.no_python_version_warning
-        ):
-            message = (
-                "A future version of pip will drop support for Python 2.7. "
-                "More details about Python 2 support in pip, can be found at "
-                "https://pip.pypa.io/en/latest/development/release-process/#python-2-support"  # noqa
-            )
-            if platform.python_implementation() == "CPython":
-                message = (
-                    "Python 2.7 reached the end of its life on January "
-                    "1st, 2020. Please upgrade your Python as Python 2.7 "
-                    "is no longer maintained. "
-                ) + message
-            deprecated(message, replacement=None, gone_in=None)
-
-        if options.skip_requirements_regex:
-            deprecated(
-                "--skip-requirements-regex is unsupported and will be removed",
-                replacement=(
-                    "manage requirements/constraints files explicitly, "
-                    "possibly generating them from metadata"
-                ),
-                gone_in="20.1",
-                issue=7297,
-            )
-
-        # TODO: Try to get these passing down from the command?
-        #       without resorting to os.environ to hold these.
-        #       This also affects isolated builds and it should.
-
-        if options.no_input:
-            os.environ['PIP_NO_INPUT'] = '1'
-
-        if options.exists_action:
-            os.environ['PIP_EXISTS_ACTION'] = ' '.join(options.exists_action)
-
-        if options.require_venv and not self.ignore_require_venv:
-            # If a venv is required check if it can really be found
-            if not running_under_virtualenv():
-                logger.critical(
-                    'Could not find an activated virtualenv (required).'
-                )
-                sys.exit(VIRTUALENV_NOT_FOUND)
-
-        if options.cache_dir:
-            options.cache_dir = normalize_path(options.cache_dir)
-            if not check_path_owner(options.cache_dir):
-                logger.warning(
-                    "The directory '%s' or its parent directory is not owned "
-                    "or is not writable by the current user. The cache "
-                    "has been disabled. Check the permissions and owner of "
-                    "that directory. If executing pip with sudo, you may want "
-                    "sudo's -H flag.",
-                    options.cache_dir,
-                )
-                options.cache_dir = None
-
-        try:
-            status = self.run(options, args)
-            # FIXME: all commands should return an exit status
-            # and when it is done, isinstance is not needed anymore
-            if isinstance(status, int):
-                return status
-        except PreviousBuildDirError as exc:
-            logger.critical(str(exc))
-            logger.debug('Exception information:', exc_info=True)
-
-            return PREVIOUS_BUILD_DIR_ERROR
-        except (InstallationError, UninstallationError, BadCommand) as exc:
-            logger.critical(str(exc))
-            logger.debug('Exception information:', exc_info=True)
-
-            return ERROR
-        except CommandError as exc:
-            logger.critical('%s', exc)
-            logger.debug('Exception information:', exc_info=True)
-
-            return ERROR
-        except BrokenStdoutLoggingError:
-            # Bypass our logger and write any remaining messages to stderr
-            # because stdout no longer works.
-            print('ERROR: Pipe to stdout was broken', file=sys.stderr)
-            if level_number <= logging.DEBUG:
-                traceback.print_exc(file=sys.stderr)
-
-            return ERROR
-        except KeyboardInterrupt:
-            logger.critical('Operation cancelled by user')
-            logger.debug('Exception information:', exc_info=True)
-
-            return ERROR
-        except BaseException:
-            logger.critical('Exception:', exc_info=True)
-
-            return UNKNOWN_ERROR
-        finally:
-            self.handle_pip_version_check(options)
-
-        return SUCCESS
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py
deleted file mode 100644
index 447f3191887dba6e1893c93a0c5ee77de88f1074..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py
+++ /dev/null
@@ -1,957 +0,0 @@
-"""
-shared options and groups
-
-The principle here is to define options once, but *not* instantiate them
-globally. One reason being that options with action='append' can carry state
-between parses. pip parses general options twice internally, and shouldn't
-pass on state. To be consistent, all options will follow this design.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-import textwrap
-import warnings
-from distutils.util import strtobool
-from functools import partial
-from optparse import SUPPRESS_HELP, Option, OptionGroup
-from textwrap import dedent
-
-from pip._internal.exceptions import CommandError
-from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
-from pip._internal.models.format_control import FormatControl
-from pip._internal.models.index import PyPI
-from pip._internal.models.target_python import TargetPython
-from pip._internal.utils.hashes import STRONG_HASHES
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.ui import BAR_TYPES
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any, Callable, Dict, Optional, Tuple
-    from optparse import OptionParser, Values
-    from pip._internal.cli.parser import ConfigOptionParser
-
-logger = logging.getLogger(__name__)
-
-
-def raise_option_error(parser, option, msg):
-    # type: (OptionParser, Option, str) -> None
-    """
-    Raise an option parsing error using parser.error().
-
-    Args:
-      parser: an OptionParser instance.
-      option: an Option instance.
-      msg: the error text.
-    """
-    msg = '{} error: {}'.format(option, msg)
-    msg = textwrap.fill(' '.join(msg.split()))
-    parser.error(msg)
-
-
-def make_option_group(group, parser):
-    # type: (Dict[str, Any], ConfigOptionParser) -> OptionGroup
-    """
-    Return an OptionGroup object
-    group  -- assumed to be dict with 'name' and 'options' keys
-    parser -- an optparse Parser
-    """
-    option_group = OptionGroup(parser, group['name'])
-    for option in group['options']:
-        option_group.add_option(option())
-    return option_group
-
-
-def check_install_build_global(options, check_options=None):
-    # type: (Values, Optional[Values]) -> None
-    """Disable wheels if per-setup.py call options are set.
-
-    :param options: The OptionParser options to update.
-    :param check_options: The options to check, if not supplied defaults to
-        options.
-    """
-    if check_options is None:
-        check_options = options
-
-    def getname(n):
-        # type: (str) -> Optional[Any]
-        return getattr(check_options, n, None)
-    names = ["build_options", "global_options", "install_options"]
-    if any(map(getname, names)):
-        control = options.format_control
-        control.disallow_binaries()
-        warnings.warn(
-            'Disabling all use of wheels due to the use of --build-option '
-            '/ --global-option / --install-option.', stacklevel=2,
-        )
-
-
-def check_dist_restriction(options, check_target=False):
-    # type: (Values, bool) -> None
-    """Function for determining if custom platform options are allowed.
-
-    :param options: The OptionParser options.
-    :param check_target: Whether or not to check if --target is being used.
-    """
-    dist_restriction_set = any([
-        options.python_version,
-        options.platform,
-        options.abi,
-        options.implementation,
-    ])
-
-    binary_only = FormatControl(set(), {':all:'})
-    sdist_dependencies_allowed = (
-        options.format_control != binary_only and
-        not options.ignore_dependencies
-    )
-
-    # Installations or downloads using dist restrictions must not combine
-    # source distributions and dist-specific wheels, as they are not
-    # guaranteed to be locally compatible.
-    if dist_restriction_set and sdist_dependencies_allowed:
-        raise CommandError(
-            "When restricting platform and interpreter constraints using "
-            "--python-version, --platform, --abi, or --implementation, "
-            "either --no-deps must be set, or --only-binary=:all: must be "
-            "set and --no-binary must not be set (or must be set to "
-            ":none:)."
-        )
-
-    if check_target:
-        if dist_restriction_set and not options.target_dir:
-            raise CommandError(
-                "Can not use any platform or abi specific options unless "
-                "installing via '--target'"
-            )
-
-
-def _path_option_check(option, opt, value):
-    # type: (Option, str, str) -> str
-    return os.path.expanduser(value)
-
-
-class PipOption(Option):
-    TYPES = Option.TYPES + ("path",)
-    TYPE_CHECKER = Option.TYPE_CHECKER.copy()
-    TYPE_CHECKER["path"] = _path_option_check
-
-
-###########
-# options #
-###########
-
-help_ = partial(
-    Option,
-    '-h', '--help',
-    dest='help',
-    action='help',
-    help='Show help.',
-)  # type: Callable[..., Option]
-
-isolated_mode = partial(
-    Option,
-    "--isolated",
-    dest="isolated_mode",
-    action="store_true",
-    default=False,
-    help=(
-        "Run pip in an isolated mode, ignoring environment variables and user "
-        "configuration."
-    ),
-)  # type: Callable[..., Option]
-
-require_virtualenv = partial(
-    Option,
-    # Run only if inside a virtualenv, bail if not.
-    '--require-virtualenv', '--require-venv',
-    dest='require_venv',
-    action='store_true',
-    default=False,
-    help=SUPPRESS_HELP
-)  # type: Callable[..., Option]
-
-verbose = partial(
-    Option,
-    '-v', '--verbose',
-    dest='verbose',
-    action='count',
-    default=0,
-    help='Give more output. Option is additive, and can be used up to 3 times.'
-)  # type: Callable[..., Option]
-
-no_color = partial(
-    Option,
-    '--no-color',
-    dest='no_color',
-    action='store_true',
-    default=False,
-    help="Suppress colored output",
-)  # type: Callable[..., Option]
-
-version = partial(
-    Option,
-    '-V', '--version',
-    dest='version',
-    action='store_true',
-    help='Show version and exit.',
-)  # type: Callable[..., Option]
-
-quiet = partial(
-    Option,
-    '-q', '--quiet',
-    dest='quiet',
-    action='count',
-    default=0,
-    help=(
-        'Give less output. Option is additive, and can be used up to 3'
-        ' times (corresponding to WARNING, ERROR, and CRITICAL logging'
-        ' levels).'
-    ),
-)  # type: Callable[..., Option]
-
-progress_bar = partial(
-    Option,
-    '--progress-bar',
-    dest='progress_bar',
-    type='choice',
-    choices=list(BAR_TYPES.keys()),
-    default='on',
-    help=(
-        'Specify type of progress to be displayed [' +
-        '|'.join(BAR_TYPES.keys()) + '] (default: %default)'
-    ),
-)  # type: Callable[..., Option]
-
-log = partial(
-    PipOption,
-    "--log", "--log-file", "--local-log",
-    dest="log",
-    metavar="path",
-    type="path",
-    help="Path to a verbose appending log."
-)  # type: Callable[..., Option]
-
-no_input = partial(
-    Option,
-    # Don't ask for input
-    '--no-input',
-    dest='no_input',
-    action='store_true',
-    default=False,
-    help=SUPPRESS_HELP
-)  # type: Callable[..., Option]
-
-proxy = partial(
-    Option,
-    '--proxy',
-    dest='proxy',
-    type='str',
-    default='',
-    help="Specify a proxy in the form [user:passwd@]proxy.server:port."
-)  # type: Callable[..., Option]
-
-retries = partial(
-    Option,
-    '--retries',
-    dest='retries',
-    type='int',
-    default=5,
-    help="Maximum number of retries each connection should attempt "
-         "(default %default times).",
-)  # type: Callable[..., Option]
-
-timeout = partial(
-    Option,
-    '--timeout', '--default-timeout',
-    metavar='sec',
-    dest='timeout',
-    type='float',
-    default=15,
-    help='Set the socket timeout (default %default seconds).',
-)  # type: Callable[..., Option]
-
-skip_requirements_regex = partial(
-    Option,
-    # A regex to be used to skip requirements
-    '--skip-requirements-regex',
-    dest='skip_requirements_regex',
-    type='str',
-    default='',
-    help=SUPPRESS_HELP,
-)  # type: Callable[..., Option]
-
-
-def exists_action():
-    # type: () -> Option
-    return Option(
-        # Option when path already exist
-        '--exists-action',
-        dest='exists_action',
-        type='choice',
-        choices=['s', 'i', 'w', 'b', 'a'],
-        default=[],
-        action='append',
-        metavar='action',
-        help="Default action when a path already exists: "
-             "(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.",
-    )
-
-
-cert = partial(
-    PipOption,
-    '--cert',
-    dest='cert',
-    type='path',
-    metavar='path',
-    help="Path to alternate CA bundle.",
-)  # type: Callable[..., Option]
-
-client_cert = partial(
-    PipOption,
-    '--client-cert',
-    dest='client_cert',
-    type='path',
-    default=None,
-    metavar='path',
-    help="Path to SSL client certificate, a single file containing the "
-         "private key and the certificate in PEM format.",
-)  # type: Callable[..., Option]
-
-index_url = partial(
-    Option,
-    '-i', '--index-url', '--pypi-url',
-    dest='index_url',
-    metavar='URL',
-    default=PyPI.simple_url,
-    help="Base URL of the Python Package Index (default %default). "
-         "This should point to a repository compliant with PEP 503 "
-         "(the simple repository API) or a local directory laid out "
-         "in the same format.",
-)  # type: Callable[..., Option]
-
-
-def extra_index_url():
-    # type: () -> Option
-    return Option(
-        '--extra-index-url',
-        dest='extra_index_urls',
-        metavar='URL',
-        action='append',
-        default=[],
-        help="Extra URLs of package indexes to use in addition to "
-             "--index-url. Should follow the same rules as "
-             "--index-url.",
-    )
-
-
-no_index = partial(
-    Option,
-    '--no-index',
-    dest='no_index',
-    action='store_true',
-    default=False,
-    help='Ignore package index (only looking at --find-links URLs instead).',
-)  # type: Callable[..., Option]
-
-
-def find_links():
-    # type: () -> Option
-    return Option(
-        '-f', '--find-links',
-        dest='find_links',
-        action='append',
-        default=[],
-        metavar='url',
-        help="If a url or path to an html file, then parse for links to "
-             "archives. If a local path or file:// url that's a directory, "
-             "then look for archives in the directory listing.",
-    )
-
-
-def trusted_host():
-    # type: () -> Option
-    return Option(
-        "--trusted-host",
-        dest="trusted_hosts",
-        action="append",
-        metavar="HOSTNAME",
-        default=[],
-        help="Mark this host or host:port pair as trusted, even though it "
-             "does not have valid or any HTTPS.",
-    )
-
-
-def constraints():
-    # type: () -> Option
-    return Option(
-        '-c', '--constraint',
-        dest='constraints',
-        action='append',
-        default=[],
-        metavar='file',
-        help='Constrain versions using the given constraints file. '
-        'This option can be used multiple times.'
-    )
-
-
-def requirements():
-    # type: () -> Option
-    return Option(
-        '-r', '--requirement',
-        dest='requirements',
-        action='append',
-        default=[],
-        metavar='file',
-        help='Install from the given requirements file. '
-        'This option can be used multiple times.'
-    )
-
-
-def editable():
-    # type: () -> Option
-    return Option(
-        '-e', '--editable',
-        dest='editables',
-        action='append',
-        default=[],
-        metavar='path/url',
-        help=('Install a project in editable mode (i.e. setuptools '
-              '"develop mode") from a local project path or a VCS url.'),
-    )
-
-
-def _handle_src(option, opt_str, value, parser):
-    # type: (Option, str, str, OptionParser) -> None
-    value = os.path.abspath(value)
-    setattr(parser.values, option.dest, value)
-
-
-src = partial(
-    PipOption,
-    '--src', '--source', '--source-dir', '--source-directory',
-    dest='src_dir',
-    type='path',
-    metavar='dir',
-    default=get_src_prefix(),
-    action='callback',
-    callback=_handle_src,
-    help='Directory to check out editable projects into. '
-    'The default in a virtualenv is "/src". '
-    'The default for global installs is "/src".'
-)  # type: Callable[..., Option]
-
-
-def _get_format_control(values, option):
-    # type: (Values, Option) -> Any
-    """Get a format_control object."""
-    return getattr(values, option.dest)
-
-
-def _handle_no_binary(option, opt_str, value, parser):
-    # type: (Option, str, str, OptionParser) -> None
-    existing = _get_format_control(parser.values, option)
-    FormatControl.handle_mutual_excludes(
-        value, existing.no_binary, existing.only_binary,
-    )
-
-
-def _handle_only_binary(option, opt_str, value, parser):
-    # type: (Option, str, str, OptionParser) -> None
-    existing = _get_format_control(parser.values, option)
-    FormatControl.handle_mutual_excludes(
-        value, existing.only_binary, existing.no_binary,
-    )
-
-
-def no_binary():
-    # type: () -> Option
-    format_control = FormatControl(set(), set())
-    return Option(
-        "--no-binary", dest="format_control", action="callback",
-        callback=_handle_no_binary, type="str",
-        default=format_control,
-        help="Do not use binary packages. Can be supplied multiple times, and "
-             "each time adds to the existing value. Accepts either :all: to "
-             "disable all binary packages, :none: to empty the set, or one or "
-             "more package names with commas between them (no colons). Note "
-             "that some packages are tricky to compile and may fail to "
-             "install when this option is used on them.",
-    )
-
-
-def only_binary():
-    # type: () -> Option
-    format_control = FormatControl(set(), set())
-    return Option(
-        "--only-binary", dest="format_control", action="callback",
-        callback=_handle_only_binary, type="str",
-        default=format_control,
-        help="Do not use source packages. Can be supplied multiple times, and "
-             "each time adds to the existing value. Accepts either :all: to "
-             "disable all source packages, :none: to empty the set, or one or "
-             "more package names with commas between them. Packages without "
-             "binary distributions will fail to install when this option is "
-             "used on them.",
-    )
-
-
-platform = partial(
-    Option,
-    '--platform',
-    dest='platform',
-    metavar='platform',
-    default=None,
-    help=("Only use wheels compatible with . "
-          "Defaults to the platform of the running system."),
-)  # type: Callable[..., Option]
-
-
-# This was made a separate function for unit-testing purposes.
-def _convert_python_version(value):
-    # type: (str) -> Tuple[Tuple[int, ...], Optional[str]]
-    """
-    Convert a version string like "3", "37", or "3.7.3" into a tuple of ints.
-
-    :return: A 2-tuple (version_info, error_msg), where `error_msg` is
-        non-None if and only if there was a parsing error.
-    """
-    if not value:
-        # The empty string is the same as not providing a value.
-        return (None, None)
-
-    parts = value.split('.')
-    if len(parts) > 3:
-        return ((), 'at most three version parts are allowed')
-
-    if len(parts) == 1:
-        # Then we are in the case of "3" or "37".
-        value = parts[0]
-        if len(value) > 1:
-            parts = [value[0], value[1:]]
-
-    try:
-        version_info = tuple(int(part) for part in parts)
-    except ValueError:
-        return ((), 'each version part must be an integer')
-
-    return (version_info, None)
-
-
-def _handle_python_version(option, opt_str, value, parser):
-    # type: (Option, str, str, OptionParser) -> None
-    """
-    Handle a provided --python-version value.
-    """
-    version_info, error_msg = _convert_python_version(value)
-    if error_msg is not None:
-        msg = (
-            'invalid --python-version value: {!r}: {}'.format(
-                value, error_msg,
-            )
-        )
-        raise_option_error(parser, option=option, msg=msg)
-
-    parser.values.python_version = version_info
-
-
-python_version = partial(
-    Option,
-    '--python-version',
-    dest='python_version',
-    metavar='python_version',
-    action='callback',
-    callback=_handle_python_version, type='str',
-    default=None,
-    help=dedent("""\
-    The Python interpreter version to use for wheel and "Requires-Python"
-    compatibility checks. Defaults to a version derived from the running
-    interpreter. The version can be specified using up to three dot-separated
-    integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor
-    version can also be given as a string without dots (e.g. "37" for 3.7.0).
-    """),
-)  # type: Callable[..., Option]
-
-
-implementation = partial(
-    Option,
-    '--implementation',
-    dest='implementation',
-    metavar='implementation',
-    default=None,
-    help=("Only use wheels compatible with Python "
-          "implementation , e.g. 'pp', 'jy', 'cp', "
-          " or 'ip'. If not specified, then the current "
-          "interpreter implementation is used.  Use 'py' to force "
-          "implementation-agnostic wheels."),
-)  # type: Callable[..., Option]
-
-
-abi = partial(
-    Option,
-    '--abi',
-    dest='abi',
-    metavar='abi',
-    default=None,
-    help=("Only use wheels compatible with Python "
-          "abi , e.g. 'pypy_41'.  If not specified, then the "
-          "current interpreter abi tag is used.  Generally "
-          "you will need to specify --implementation, "
-          "--platform, and --python-version when using "
-          "this option."),
-)  # type: Callable[..., Option]
-
-
-def add_target_python_options(cmd_opts):
-    # type: (OptionGroup) -> None
-    cmd_opts.add_option(platform())
-    cmd_opts.add_option(python_version())
-    cmd_opts.add_option(implementation())
-    cmd_opts.add_option(abi())
-
-
-def make_target_python(options):
-    # type: (Values) -> TargetPython
-    target_python = TargetPython(
-        platform=options.platform,
-        py_version_info=options.python_version,
-        abi=options.abi,
-        implementation=options.implementation,
-    )
-
-    return target_python
-
-
-def prefer_binary():
-    # type: () -> Option
-    return Option(
-        "--prefer-binary",
-        dest="prefer_binary",
-        action="store_true",
-        default=False,
-        help="Prefer older binary packages over newer source packages."
-    )
-
-
-cache_dir = partial(
-    PipOption,
-    "--cache-dir",
-    dest="cache_dir",
-    default=USER_CACHE_DIR,
-    metavar="dir",
-    type='path',
-    help="Store the cache data in ."
-)  # type: Callable[..., Option]
-
-
-def _handle_no_cache_dir(option, opt, value, parser):
-    # type: (Option, str, str, OptionParser) -> None
-    """
-    Process a value provided for the --no-cache-dir option.
-
-    This is an optparse.Option callback for the --no-cache-dir option.
-    """
-    # The value argument will be None if --no-cache-dir is passed via the
-    # command-line, since the option doesn't accept arguments.  However,
-    # the value can be non-None if the option is triggered e.g. by an
-    # environment variable, like PIP_NO_CACHE_DIR=true.
-    if value is not None:
-        # Then parse the string value to get argument error-checking.
-        try:
-            strtobool(value)
-        except ValueError as exc:
-            raise_option_error(parser, option=option, msg=str(exc))
-
-    # Originally, setting PIP_NO_CACHE_DIR to a value that strtobool()
-    # converted to 0 (like "false" or "no") caused cache_dir to be disabled
-    # rather than enabled (logic would say the latter).  Thus, we disable
-    # the cache directory not just on values that parse to True, but (for
-    # backwards compatibility reasons) also on values that parse to False.
-    # In other words, always set it to False if the option is provided in
-    # some (valid) form.
-    parser.values.cache_dir = False
-
-
-no_cache = partial(
-    Option,
-    "--no-cache-dir",
-    dest="cache_dir",
-    action="callback",
-    callback=_handle_no_cache_dir,
-    help="Disable the cache.",
-)  # type: Callable[..., Option]
-
-no_deps = partial(
-    Option,
-    '--no-deps', '--no-dependencies',
-    dest='ignore_dependencies',
-    action='store_true',
-    default=False,
-    help="Don't install package dependencies.",
-)  # type: Callable[..., Option]
-
-
-def _handle_build_dir(option, opt, value, parser):
-    # type: (Option, str, str, OptionParser) -> None
-    if value:
-        value = os.path.abspath(value)
-    setattr(parser.values, option.dest, value)
-
-
-build_dir = partial(
-    PipOption,
-    '-b', '--build', '--build-dir', '--build-directory',
-    dest='build_dir',
-    type='path',
-    metavar='dir',
-    action='callback',
-    callback=_handle_build_dir,
-    help='Directory to unpack packages into and build in. Note that '
-         'an initial build still takes place in a temporary directory. '
-         'The location of temporary directories can be controlled by setting '
-         'the TMPDIR environment variable (TEMP on Windows) appropriately. '
-         'When passed, build directories are not cleaned in case of failures.'
-)  # type: Callable[..., Option]
-
-ignore_requires_python = partial(
-    Option,
-    '--ignore-requires-python',
-    dest='ignore_requires_python',
-    action='store_true',
-    help='Ignore the Requires-Python information.'
-)  # type: Callable[..., Option]
-
-no_build_isolation = partial(
-    Option,
-    '--no-build-isolation',
-    dest='build_isolation',
-    action='store_false',
-    default=True,
-    help='Disable isolation when building a modern source distribution. '
-         'Build dependencies specified by PEP 518 must be already installed '
-         'if this option is used.'
-)  # type: Callable[..., Option]
-
-
-def _handle_no_use_pep517(option, opt, value, parser):
-    # type: (Option, str, str, OptionParser) -> None
-    """
-    Process a value provided for the --no-use-pep517 option.
-
-    This is an optparse.Option callback for the no_use_pep517 option.
-    """
-    # Since --no-use-pep517 doesn't accept arguments, the value argument
-    # will be None if --no-use-pep517 is passed via the command-line.
-    # However, the value can be non-None if the option is triggered e.g.
-    # by an environment variable, for example "PIP_NO_USE_PEP517=true".
-    if value is not None:
-        msg = """A value was passed for --no-use-pep517,
-        probably using either the PIP_NO_USE_PEP517 environment variable
-        or the "no-use-pep517" config file option. Use an appropriate value
-        of the PIP_USE_PEP517 environment variable or the "use-pep517"
-        config file option instead.
-        """
-        raise_option_error(parser, option=option, msg=msg)
-
-    # Otherwise, --no-use-pep517 was passed via the command-line.
-    parser.values.use_pep517 = False
-
-
-use_pep517 = partial(
-    Option,
-    '--use-pep517',
-    dest='use_pep517',
-    action='store_true',
-    default=None,
-    help='Use PEP 517 for building source distributions '
-         '(use --no-use-pep517 to force legacy behaviour).'
-)  # type: Any
-
-no_use_pep517 = partial(
-    Option,
-    '--no-use-pep517',
-    dest='use_pep517',
-    action='callback',
-    callback=_handle_no_use_pep517,
-    default=None,
-    help=SUPPRESS_HELP
-)  # type: Any
-
-install_options = partial(
-    Option,
-    '--install-option',
-    dest='install_options',
-    action='append',
-    metavar='options',
-    help="Extra arguments to be supplied to the setup.py install "
-         "command (use like --install-option=\"--install-scripts=/usr/local/"
-         "bin\"). Use multiple --install-option options to pass multiple "
-         "options to setup.py install. If you are using an option with a "
-         "directory path, be sure to use absolute path.",
-)  # type: Callable[..., Option]
-
-global_options = partial(
-    Option,
-    '--global-option',
-    dest='global_options',
-    action='append',
-    metavar='options',
-    help="Extra global options to be supplied to the setup.py "
-         "call before the install command.",
-)  # type: Callable[..., Option]
-
-no_clean = partial(
-    Option,
-    '--no-clean',
-    action='store_true',
-    default=False,
-    help="Don't clean up build directories."
-)  # type: Callable[..., Option]
-
-pre = partial(
-    Option,
-    '--pre',
-    action='store_true',
-    default=False,
-    help="Include pre-release and development versions. By default, "
-         "pip only finds stable versions.",
-)  # type: Callable[..., Option]
-
-disable_pip_version_check = partial(
-    Option,
-    "--disable-pip-version-check",
-    dest="disable_pip_version_check",
-    action="store_true",
-    default=True,
-    help="Don't periodically check PyPI to determine whether a new version "
-         "of pip is available for download. Implied with --no-index.",
-)  # type: Callable[..., Option]
-
-
-# Deprecated, Remove later
-always_unzip = partial(
-    Option,
-    '-Z', '--always-unzip',
-    dest='always_unzip',
-    action='store_true',
-    help=SUPPRESS_HELP,
-)  # type: Callable[..., Option]
-
-
-def _handle_merge_hash(option, opt_str, value, parser):
-    # type: (Option, str, str, OptionParser) -> None
-    """Given a value spelled "algo:digest", append the digest to a list
-    pointed to in a dict by the algo name."""
-    if not parser.values.hashes:
-        parser.values.hashes = {}
-    try:
-        algo, digest = value.split(':', 1)
-    except ValueError:
-        parser.error('Arguments to %s must be a hash name '
-                     'followed by a value, like --hash=sha256:abcde...' %
-                     opt_str)
-    if algo not in STRONG_HASHES:
-        parser.error('Allowed hash algorithms for %s are %s.' %
-                     (opt_str, ', '.join(STRONG_HASHES)))
-    parser.values.hashes.setdefault(algo, []).append(digest)
-
-
-hash = partial(
-    Option,
-    '--hash',
-    # Hash values eventually end up in InstallRequirement.hashes due to
-    # __dict__ copying in process_line().
-    dest='hashes',
-    action='callback',
-    callback=_handle_merge_hash,
-    type='string',
-    help="Verify that the package's archive matches this "
-         'hash before installing. Example: --hash=sha256:abcdef...',
-)  # type: Callable[..., Option]
-
-
-require_hashes = partial(
-    Option,
-    '--require-hashes',
-    dest='require_hashes',
-    action='store_true',
-    default=False,
-    help='Require a hash to check each requirement against, for '
-         'repeatable installs. This option is implied when any package in a '
-         'requirements file has a --hash option.',
-)  # type: Callable[..., Option]
-
-
-list_path = partial(
-    PipOption,
-    '--path',
-    dest='path',
-    type='path',
-    action='append',
-    help='Restrict to the specified installation path for listing '
-         'packages (can be used multiple times).'
-)  # type: Callable[..., Option]
-
-
-def check_list_path_option(options):
-    # type: (Values) -> None
-    if options.path and (options.user or options.local):
-        raise CommandError(
-            "Cannot combine '--path' with '--user' or '--local'"
-        )
-
-
-no_python_version_warning = partial(
-    Option,
-    '--no-python-version-warning',
-    dest='no_python_version_warning',
-    action='store_true',
-    default=False,
-    help='Silence deprecation warnings for upcoming unsupported Pythons.',
-)  # type: Callable[..., Option]
-
-
-##########
-# groups #
-##########
-
-general_group = {
-    'name': 'General Options',
-    'options': [
-        help_,
-        isolated_mode,
-        require_virtualenv,
-        verbose,
-        version,
-        quiet,
-        log,
-        no_input,
-        proxy,
-        retries,
-        timeout,
-        skip_requirements_regex,
-        exists_action,
-        trusted_host,
-        cert,
-        client_cert,
-        cache_dir,
-        no_cache,
-        disable_pip_version_check,
-        no_color,
-        no_python_version_warning,
-    ]
-}  # type: Dict[str, Any]
-
-index_group = {
-    'name': 'Package Index Options',
-    'options': [
-        index_url,
-        extra_index_url,
-        no_index,
-        find_links,
-    ]
-}  # type: Dict[str, Any]
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/command_context.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/command_context.py
deleted file mode 100644
index d1a64a776062a95258d3331cdec9b987e433ddf9..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/command_context.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from contextlib import contextmanager
-
-from pip._vendor.contextlib2 import ExitStack
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Iterator, ContextManager, TypeVar
-
-    _T = TypeVar('_T', covariant=True)
-
-
-class CommandContextMixIn(object):
-    def __init__(self):
-        # type: () -> None
-        super(CommandContextMixIn, self).__init__()
-        self._in_main_context = False
-        self._main_context = ExitStack()
-
-    @contextmanager
-    def main_context(self):
-        # type: () -> Iterator[None]
-        assert not self._in_main_context
-
-        self._in_main_context = True
-        try:
-            with self._main_context:
-                yield
-        finally:
-            self._in_main_context = False
-
-    def enter_context(self, context_provider):
-        # type: (ContextManager[_T]) -> _T
-        assert self._in_main_context
-
-        return self._main_context.enter_context(context_provider)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/main.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/main.py
deleted file mode 100644
index 5e97a5103f6af5baded5758f0ee41eb1aa641cc7..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/main.py
+++ /dev/null
@@ -1,75 +0,0 @@
-"""Primary application entrypoint.
-"""
-from __future__ import absolute_import
-
-import locale
-import logging
-import os
-import sys
-
-from pip._internal.cli.autocompletion import autocomplete
-from pip._internal.cli.main_parser import parse_command
-from pip._internal.commands import create_command
-from pip._internal.exceptions import PipError
-from pip._internal.utils import deprecation
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional
-
-logger = logging.getLogger(__name__)
-
-
-# Do not import and use main() directly! Using it directly is actively
-# discouraged by pip's maintainers. The name, location and behavior of
-# this function is subject to change, so calling it directly is not
-# portable across different pip versions.
-
-# In addition, running pip in-process is unsupported and unsafe. This is
-# elaborated in detail at
-# https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program.
-# That document also provides suggestions that should work for nearly
-# all users that are considering importing and using main() directly.
-
-# However, we know that certain users will still want to invoke pip
-# in-process. If you understand and accept the implications of using pip
-# in an unsupported manner, the best approach is to use runpy to avoid
-# depending on the exact location of this entry point.
-
-# The following example shows how to use runpy to invoke pip in that
-# case:
-#
-#     sys.argv = ["pip", your, args, here]
-#     runpy.run_module("pip", run_name="__main__")
-#
-# Note that this will exit the process after running, unlike a direct
-# call to main. As it is not safe to do any processing after calling
-# main, this should not be an issue in practice.
-
-def main(args=None):
-    # type: (Optional[List[str]]) -> int
-    if args is None:
-        args = sys.argv[1:]
-
-    # Configure our deprecation warnings to be sent through loggers
-    deprecation.install_warning_logger()
-
-    autocomplete()
-
-    try:
-        cmd_name, cmd_args = parse_command(args)
-    except PipError as exc:
-        sys.stderr.write("ERROR: %s" % exc)
-        sys.stderr.write(os.linesep)
-        sys.exit(1)
-
-    # Needed for locale.getpreferredencoding(False) to work
-    # in pip._internal.utils.encoding.auto_decode
-    try:
-        locale.setlocale(locale.LC_ALL, '')
-    except locale.Error as e:
-        # setlocale can apparently crash if locale are uninitialized
-        logger.debug("Ignoring error %s when setting locale", e)
-    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
-
-    return command.main(cmd_args)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py
deleted file mode 100644
index a89821d44890ee9a89b186c66c9ce12d5ccc02dc..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py
+++ /dev/null
@@ -1,99 +0,0 @@
-"""A single place for constructing and exposing the main parser
-"""
-
-import os
-import sys
-
-from pip._internal.cli import cmdoptions
-from pip._internal.cli.parser import (
-    ConfigOptionParser,
-    UpdatingDefaultsHelpFormatter,
-)
-from pip._internal.commands import commands_dict, get_similar_commands
-from pip._internal.exceptions import CommandError
-from pip._internal.utils.misc import get_pip_version, get_prog
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Tuple, List
-
-
-__all__ = ["create_main_parser", "parse_command"]
-
-
-def create_main_parser():
-    # type: () -> ConfigOptionParser
-    """Creates and returns the main parser for pip's CLI
-    """
-
-    parser_kw = {
-        'usage': '\n%prog  [options]',
-        'add_help_option': False,
-        'formatter': UpdatingDefaultsHelpFormatter(),
-        'name': 'global',
-        'prog': get_prog(),
-    }
-
-    parser = ConfigOptionParser(**parser_kw)
-    parser.disable_interspersed_args()
-
-    parser.version = get_pip_version()
-
-    # add the general options
-    gen_opts = cmdoptions.make_option_group(cmdoptions.general_group, parser)
-    parser.add_option_group(gen_opts)
-
-    # so the help formatter knows
-    parser.main = True  # type: ignore
-
-    # create command listing for description
-    description = [''] + [
-        '%-27s %s' % (name, command_info.summary)
-        for name, command_info in commands_dict.items()
-    ]
-    parser.description = '\n'.join(description)
-
-    return parser
-
-
-def parse_command(args):
-    # type: (List[str]) -> Tuple[str, List[str]]
-    parser = create_main_parser()
-
-    # Note: parser calls disable_interspersed_args(), so the result of this
-    # call is to split the initial args into the general options before the
-    # subcommand and everything else.
-    # For example:
-    #  args: ['--timeout=5', 'install', '--user', 'INITools']
-    #  general_options: ['--timeout==5']
-    #  args_else: ['install', '--user', 'INITools']
-    general_options, args_else = parser.parse_args(args)
-
-    # --version
-    if general_options.version:
-        sys.stdout.write(parser.version)  # type: ignore
-        sys.stdout.write(os.linesep)
-        sys.exit()
-
-    # pip || pip help -> print_help()
-    if not args_else or (args_else[0] == 'help' and len(args_else) == 1):
-        parser.print_help()
-        sys.exit()
-
-    # the subcommand name
-    cmd_name = args_else[0]
-
-    if cmd_name not in commands_dict:
-        guess = get_similar_commands(cmd_name)
-
-        msg = ['unknown command "%s"' % cmd_name]
-        if guess:
-            msg.append('maybe you meant "%s"' % guess)
-
-        raise CommandError(' - '.join(msg))
-
-    # all the args without the subcommand
-    cmd_args = args[:]
-    cmd_args.remove(cmd_name)
-
-    return cmd_name, cmd_args
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/parser.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/parser.py
deleted file mode 100644
index c99456bae88d0c73ab79a671b440993c8195568d..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/parser.py
+++ /dev/null
@@ -1,265 +0,0 @@
-"""Base option parser setup"""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import optparse
-import sys
-import textwrap
-from distutils.util import strtobool
-
-from pip._vendor.six import string_types
-
-from pip._internal.cli.status_codes import UNKNOWN_ERROR
-from pip._internal.configuration import Configuration, ConfigurationError
-from pip._internal.utils.compat import get_terminal_size
-
-logger = logging.getLogger(__name__)
-
-
-class PrettyHelpFormatter(optparse.IndentedHelpFormatter):
-    """A prettier/less verbose help formatter for optparse."""
-
-    def __init__(self, *args, **kwargs):
-        # help position must be aligned with __init__.parseopts.description
-        kwargs['max_help_position'] = 30
-        kwargs['indent_increment'] = 1
-        kwargs['width'] = get_terminal_size()[0] - 2
-        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs)
-
-    def format_option_strings(self, option):
-        return self._format_option_strings(option, ' <%s>', ', ')
-
-    def _format_option_strings(self, option, mvarfmt=' <%s>', optsep=', '):
-        """
-        Return a comma-separated list of option strings and metavars.
-
-        :param option:  tuple of (short opt, long opt), e.g: ('-f', '--format')
-        :param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
-        :param optsep:  separator
-        """
-        opts = []
-
-        if option._short_opts:
-            opts.append(option._short_opts[0])
-        if option._long_opts:
-            opts.append(option._long_opts[0])
-        if len(opts) > 1:
-            opts.insert(1, optsep)
-
-        if option.takes_value():
-            metavar = option.metavar or option.dest.lower()
-            opts.append(mvarfmt % metavar.lower())
-
-        return ''.join(opts)
-
-    def format_heading(self, heading):
-        if heading == 'Options':
-            return ''
-        return heading + ':\n'
-
-    def format_usage(self, usage):
-        """
-        Ensure there is only one newline between usage and the first heading
-        if there is no description.
-        """
-        msg = '\nUsage: %s\n' % self.indent_lines(textwrap.dedent(usage), "  ")
-        return msg
-
-    def format_description(self, description):
-        # leave full control over description to us
-        if description:
-            if hasattr(self.parser, 'main'):
-                label = 'Commands'
-            else:
-                label = 'Description'
-            # some doc strings have initial newlines, some don't
-            description = description.lstrip('\n')
-            # some doc strings have final newlines and spaces, some don't
-            description = description.rstrip()
-            # dedent, then reindent
-            description = self.indent_lines(textwrap.dedent(description), "  ")
-            description = '%s:\n%s\n' % (label, description)
-            return description
-        else:
-            return ''
-
-    def format_epilog(self, epilog):
-        # leave full control over epilog to us
-        if epilog:
-            return epilog
-        else:
-            return ''
-
-    def indent_lines(self, text, indent):
-        new_lines = [indent + line for line in text.split('\n')]
-        return "\n".join(new_lines)
-
-
-class UpdatingDefaultsHelpFormatter(PrettyHelpFormatter):
-    """Custom help formatter for use in ConfigOptionParser.
-
-    This is updates the defaults before expanding them, allowing
-    them to show up correctly in the help listing.
-    """
-
-    def expand_default(self, option):
-        if self.parser is not None:
-            self.parser._update_defaults(self.parser.defaults)
-        return optparse.IndentedHelpFormatter.expand_default(self, option)
-
-
-class CustomOptionParser(optparse.OptionParser):
-
-    def insert_option_group(self, idx, *args, **kwargs):
-        """Insert an OptionGroup at a given position."""
-        group = self.add_option_group(*args, **kwargs)
-
-        self.option_groups.pop()
-        self.option_groups.insert(idx, group)
-
-        return group
-
-    @property
-    def option_list_all(self):
-        """Get a list of all options, including those in option groups."""
-        res = self.option_list[:]
-        for i in self.option_groups:
-            res.extend(i.option_list)
-
-        return res
-
-
-class ConfigOptionParser(CustomOptionParser):
-    """Custom option parser which updates its defaults by checking the
-    configuration files and environmental variables"""
-
-    def __init__(self, *args, **kwargs):
-        self.name = kwargs.pop('name')
-
-        isolated = kwargs.pop("isolated", False)
-        self.config = Configuration(isolated)
-
-        assert self.name
-        optparse.OptionParser.__init__(self, *args, **kwargs)
-
-    def check_default(self, option, key, val):
-        try:
-            return option.check_value(key, val)
-        except optparse.OptionValueError as exc:
-            print("An error occurred during configuration: %s" % exc)
-            sys.exit(3)
-
-    def _get_ordered_configuration_items(self):
-        # Configuration gives keys in an unordered manner. Order them.
-        override_order = ["global", self.name, ":env:"]
-
-        # Pool the options into different groups
-        section_items = {name: [] for name in override_order}
-        for section_key, val in self.config.items():
-            # ignore empty values
-            if not val:
-                logger.debug(
-                    "Ignoring configuration key '%s' as it's value is empty.",
-                    section_key
-                )
-                continue
-
-            section, key = section_key.split(".", 1)
-            if section in override_order:
-                section_items[section].append((key, val))
-
-        # Yield each group in their override order
-        for section in override_order:
-            for key, val in section_items[section]:
-                yield key, val
-
-    def _update_defaults(self, defaults):
-        """Updates the given defaults with values from the config files and
-        the environ. Does a little special handling for certain types of
-        options (lists)."""
-
-        # Accumulate complex default state.
-        self.values = optparse.Values(self.defaults)
-        late_eval = set()
-        # Then set the options with those values
-        for key, val in self._get_ordered_configuration_items():
-            # '--' because configuration supports only long names
-            option = self.get_option('--' + key)
-
-            # Ignore options not present in this parser. E.g. non-globals put
-            # in [global] by users that want them to apply to all applicable
-            # commands.
-            if option is None:
-                continue
-
-            if option.action in ('store_true', 'store_false', 'count'):
-                try:
-                    val = strtobool(val)
-                except ValueError:
-                    error_msg = invalid_config_error_message(
-                        option.action, key, val
-                    )
-                    self.error(error_msg)
-
-            elif option.action == 'append':
-                val = val.split()
-                val = [self.check_default(option, key, v) for v in val]
-            elif option.action == 'callback':
-                late_eval.add(option.dest)
-                opt_str = option.get_opt_string()
-                val = option.convert_value(opt_str, val)
-                # From take_action
-                args = option.callback_args or ()
-                kwargs = option.callback_kwargs or {}
-                option.callback(option, opt_str, val, self, *args, **kwargs)
-            else:
-                val = self.check_default(option, key, val)
-
-            defaults[option.dest] = val
-
-        for key in late_eval:
-            defaults[key] = getattr(self.values, key)
-        self.values = None
-        return defaults
-
-    def get_default_values(self):
-        """Overriding to make updating the defaults after instantiation of
-        the option parser possible, _update_defaults() does the dirty work."""
-        if not self.process_default_values:
-            # Old, pre-Optik 1.5 behaviour.
-            return optparse.Values(self.defaults)
-
-        # Load the configuration, or error out in case of an error
-        try:
-            self.config.load()
-        except ConfigurationError as err:
-            self.exit(UNKNOWN_ERROR, str(err))
-
-        defaults = self._update_defaults(self.defaults.copy())  # ours
-        for option in self._get_all_options():
-            default = defaults.get(option.dest)
-            if isinstance(default, string_types):
-                opt_str = option.get_opt_string()
-                defaults[option.dest] = option.check_value(opt_str, default)
-        return optparse.Values(defaults)
-
-    def error(self, msg):
-        self.print_usage(sys.stderr)
-        self.exit(UNKNOWN_ERROR, "%s\n" % msg)
-
-
-def invalid_config_error_message(action, key, val):
-    """Returns a better error message when invalid configuration option
-    is provided."""
-    if action in ('store_true', 'store_false'):
-        return ("{0} is not a valid value for {1} option, "
-                "please specify a boolean value like yes/no, "
-                "true/false or 1/0 instead.").format(val, key)
-
-    return ("{0} is not a valid value for {1} option, "
-            "please specify a numerical value like 1/0 "
-            "instead.").format(val, key)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/req_command.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/req_command.py
deleted file mode 100644
index 9383b3b8dca756dea6a37b3f71cb3e556b60dfe9..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/req_command.py
+++ /dev/null
@@ -1,333 +0,0 @@
-"""Contains the Command base classes that depend on PipSession.
-
-The classes in this module are in a separate module so the commands not
-needing download / PackageFinder capability don't unnecessarily import the
-PackageFinder machinery and all its vendored dependencies, etc.
-"""
-
-import logging
-import os
-from functools import partial
-
-from pip._internal.cli.base_command import Command
-from pip._internal.cli.command_context import CommandContextMixIn
-from pip._internal.exceptions import CommandError
-from pip._internal.index.package_finder import PackageFinder
-from pip._internal.legacy_resolve import Resolver
-from pip._internal.models.selection_prefs import SelectionPreferences
-from pip._internal.network.download import Downloader
-from pip._internal.network.session import PipSession
-from pip._internal.operations.prepare import RequirementPreparer
-from pip._internal.req.constructors import (
-    install_req_from_editable,
-    install_req_from_line,
-    install_req_from_req_string,
-)
-from pip._internal.req.req_file import parse_requirements
-from pip._internal.self_outdated_check import (
-    make_link_collector,
-    pip_self_version_check,
-)
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from optparse import Values
-    from typing import List, Optional, Tuple
-    from pip._internal.cache import WheelCache
-    from pip._internal.models.target_python import TargetPython
-    from pip._internal.req.req_set import RequirementSet
-    from pip._internal.req.req_tracker import RequirementTracker
-    from pip._internal.utils.temp_dir import TempDirectory
-
-logger = logging.getLogger(__name__)
-
-
-class SessionCommandMixin(CommandContextMixIn):
-
-    """
-    A class mixin for command classes needing _build_session().
-    """
-    def __init__(self):
-        # type: () -> None
-        super(SessionCommandMixin, self).__init__()
-        self._session = None  # Optional[PipSession]
-
-    @classmethod
-    def _get_index_urls(cls, options):
-        # type: (Values) -> Optional[List[str]]
-        """Return a list of index urls from user-provided options."""
-        index_urls = []
-        if not getattr(options, "no_index", False):
-            url = getattr(options, "index_url", None)
-            if url:
-                index_urls.append(url)
-        urls = getattr(options, "extra_index_urls", None)
-        if urls:
-            index_urls.extend(urls)
-        # Return None rather than an empty list
-        return index_urls or None
-
-    def get_default_session(self, options):
-        # type: (Values) -> PipSession
-        """Get a default-managed session."""
-        if self._session is None:
-            self._session = self.enter_context(self._build_session(options))
-            # there's no type annotation on requests.Session, so it's
-            # automatically ContextManager[Any] and self._session becomes Any,
-            # then https://github.com/python/mypy/issues/7696 kicks in
-            assert self._session is not None
-        return self._session
-
-    def _build_session(self, options, retries=None, timeout=None):
-        # type: (Values, Optional[int], Optional[int]) -> PipSession
-        assert not options.cache_dir or os.path.isabs(options.cache_dir)
-        session = PipSession(
-            cache=(
-                os.path.join(options.cache_dir, "http")
-                if options.cache_dir else None
-            ),
-            retries=retries if retries is not None else options.retries,
-            trusted_hosts=options.trusted_hosts,
-            index_urls=self._get_index_urls(options),
-        )
-
-        # Handle custom ca-bundles from the user
-        if options.cert:
-            session.verify = options.cert
-
-        # Handle SSL client certificate
-        if options.client_cert:
-            session.cert = options.client_cert
-
-        # Handle timeouts
-        if options.timeout or timeout:
-            session.timeout = (
-                timeout if timeout is not None else options.timeout
-            )
-
-        # Handle configured proxies
-        if options.proxy:
-            session.proxies = {
-                "http": options.proxy,
-                "https": options.proxy,
-            }
-
-        # Determine if we can prompt the user for authentication or not
-        session.auth.prompting = not options.no_input
-
-        return session
-
-
-class IndexGroupCommand(Command, SessionCommandMixin):
-
-    """
-    Abstract base class for commands with the index_group options.
-
-    This also corresponds to the commands that permit the pip version check.
-    """
-
-    def handle_pip_version_check(self, options):
-        # type: (Values) -> None
-        """
-        Do the pip version check if not disabled.
-
-        This overrides the default behavior of not doing the check.
-        """
-        # Make sure the index_group options are present.
-        assert hasattr(options, 'no_index')
-
-        if options.disable_pip_version_check or options.no_index:
-            return
-
-        # Otherwise, check if we're using the latest version of pip available.
-        session = self._build_session(
-            options,
-            retries=0,
-            timeout=min(5, options.timeout)
-        )
-        with session:
-            pip_self_version_check(session, options)
-
-
-class RequirementCommand(IndexGroupCommand):
-
-    @staticmethod
-    def make_requirement_preparer(
-        temp_build_dir,           # type: TempDirectory
-        options,                  # type: Values
-        req_tracker,              # type: RequirementTracker
-        session,                  # type: PipSession
-        finder,                   # type: PackageFinder
-        use_user_site,            # type: bool
-        download_dir=None,        # type: str
-        wheel_download_dir=None,  # type: str
-    ):
-        # type: (...) -> RequirementPreparer
-        """
-        Create a RequirementPreparer instance for the given parameters.
-        """
-        downloader = Downloader(session, progress_bar=options.progress_bar)
-
-        temp_build_dir_path = temp_build_dir.path
-        assert temp_build_dir_path is not None
-
-        return RequirementPreparer(
-            build_dir=temp_build_dir_path,
-            src_dir=options.src_dir,
-            download_dir=download_dir,
-            wheel_download_dir=wheel_download_dir,
-            build_isolation=options.build_isolation,
-            req_tracker=req_tracker,
-            downloader=downloader,
-            finder=finder,
-            require_hashes=options.require_hashes,
-            use_user_site=use_user_site,
-        )
-
-    @staticmethod
-    def make_resolver(
-        preparer,                            # type: RequirementPreparer
-        finder,                              # type: PackageFinder
-        options,                             # type: Values
-        wheel_cache=None,                    # type: Optional[WheelCache]
-        use_user_site=False,                 # type: bool
-        ignore_installed=True,               # type: bool
-        ignore_requires_python=False,        # type: bool
-        force_reinstall=False,               # type: bool
-        upgrade_strategy="to-satisfy-only",  # type: str
-        use_pep517=None,                     # type: Optional[bool]
-        py_version_info=None            # type: Optional[Tuple[int, ...]]
-    ):
-        # type: (...) -> Resolver
-        """
-        Create a Resolver instance for the given parameters.
-        """
-        make_install_req = partial(
-            install_req_from_req_string,
-            isolated=options.isolated_mode,
-            wheel_cache=wheel_cache,
-            use_pep517=use_pep517,
-        )
-        return Resolver(
-            preparer=preparer,
-            finder=finder,
-            make_install_req=make_install_req,
-            use_user_site=use_user_site,
-            ignore_dependencies=options.ignore_dependencies,
-            ignore_installed=ignore_installed,
-            ignore_requires_python=ignore_requires_python,
-            force_reinstall=force_reinstall,
-            upgrade_strategy=upgrade_strategy,
-            py_version_info=py_version_info,
-        )
-
-    def populate_requirement_set(
-        self,
-        requirement_set,  # type: RequirementSet
-        args,             # type: List[str]
-        options,          # type: Values
-        finder,           # type: PackageFinder
-        session,          # type: PipSession
-        wheel_cache,      # type: Optional[WheelCache]
-    ):
-        # type: (...) -> None
-        """
-        Marshal cmd line args into a requirement set.
-        """
-        for filename in options.constraints:
-            for req_to_add in parse_requirements(
-                    filename,
-                    constraint=True, finder=finder, options=options,
-                    session=session, wheel_cache=wheel_cache):
-                req_to_add.is_direct = True
-                requirement_set.add_requirement(req_to_add)
-
-        for req in args:
-            req_to_add = install_req_from_line(
-                req, None, isolated=options.isolated_mode,
-                use_pep517=options.use_pep517,
-                wheel_cache=wheel_cache
-            )
-            req_to_add.is_direct = True
-            requirement_set.add_requirement(req_to_add)
-
-        for req in options.editables:
-            req_to_add = install_req_from_editable(
-                req,
-                isolated=options.isolated_mode,
-                use_pep517=options.use_pep517,
-                wheel_cache=wheel_cache
-            )
-            req_to_add.is_direct = True
-            requirement_set.add_requirement(req_to_add)
-
-        # NOTE: options.require_hashes may be set if --require-hashes is True
-        for filename in options.requirements:
-            for req_to_add in parse_requirements(
-                    filename,
-                    finder=finder, options=options, session=session,
-                    wheel_cache=wheel_cache,
-                    use_pep517=options.use_pep517):
-                req_to_add.is_direct = True
-                requirement_set.add_requirement(req_to_add)
-
-        # If any requirement has hash options, enable hash checking.
-        requirements = (
-            requirement_set.unnamed_requirements +
-            list(requirement_set.requirements.values())
-        )
-        if any(req.has_hash_options for req in requirements):
-            options.require_hashes = True
-
-        if not (args or options.editables or options.requirements):
-            opts = {'name': self.name}
-            if options.find_links:
-                raise CommandError(
-                    'You must give at least one requirement to %(name)s '
-                    '(maybe you meant "pip %(name)s %(links)s"?)' %
-                    dict(opts, links=' '.join(options.find_links)))
-            else:
-                raise CommandError(
-                    'You must give at least one requirement to %(name)s '
-                    '(see "pip help %(name)s")' % opts)
-
-    @staticmethod
-    def trace_basic_info(finder):
-        # type: (PackageFinder) -> None
-        """
-        Trace basic information about the provided objects.
-        """
-        # Display where finder is looking for packages
-        search_scope = finder.search_scope
-        locations = search_scope.get_formatted_locations()
-        if locations:
-            logger.info(locations)
-
-    def _build_package_finder(
-        self,
-        options,               # type: Values
-        session,               # type: PipSession
-        target_python=None,    # type: Optional[TargetPython]
-        ignore_requires_python=None,  # type: Optional[bool]
-    ):
-        # type: (...) -> PackageFinder
-        """
-        Create a package finder appropriate to this requirement command.
-
-        :param ignore_requires_python: Whether to ignore incompatible
-            "Requires-Python" values in links. Defaults to False.
-        """
-        link_collector = make_link_collector(session, options=options)
-        selection_prefs = SelectionPreferences(
-            allow_yanked=True,
-            format_control=options.format_control,
-            allow_all_prereleases=options.pre,
-            prefer_binary=options.prefer_binary,
-            ignore_requires_python=ignore_requires_python,
-        )
-
-        return PackageFinder.create(
-            link_collector=link_collector,
-            selection_prefs=selection_prefs,
-            target_python=target_python,
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/cli/status_codes.py b/venv/lib/python3.8/site-packages/pip/_internal/cli/status_codes.py
deleted file mode 100644
index 275360a3175abaeab86148d61b735904f96d72f6..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/cli/status_codes.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from __future__ import absolute_import
-
-SUCCESS = 0
-ERROR = 1
-UNKNOWN_ERROR = 2
-VIRTUALENV_NOT_FOUND = 3
-PREVIOUS_BUILD_DIR_ERROR = 4
-NO_MATCHES_FOUND = 23
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/__init__.py
deleted file mode 100644
index 2a311f8fc8930735a39eee61cf701db1f2a35daa..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/__init__.py
+++ /dev/null
@@ -1,114 +0,0 @@
-"""
-Package containing all pip commands
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import importlib
-from collections import OrderedDict, namedtuple
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any
-    from pip._internal.cli.base_command import Command
-
-
-CommandInfo = namedtuple('CommandInfo', 'module_path, class_name, summary')
-
-# The ordering matters for help display.
-#    Also, even though the module path starts with the same
-# "pip._internal.commands" prefix in each case, we include the full path
-# because it makes testing easier (specifically when modifying commands_dict
-# in test setup / teardown by adding info for a FakeCommand class defined
-# in a test-related module).
-#    Finally, we need to pass an iterable of pairs here rather than a dict
-# so that the ordering won't be lost when using Python 2.7.
-commands_dict = OrderedDict([
-    ('install', CommandInfo(
-        'pip._internal.commands.install', 'InstallCommand',
-        'Install packages.',
-    )),
-    ('download', CommandInfo(
-        'pip._internal.commands.download', 'DownloadCommand',
-        'Download packages.',
-    )),
-    ('uninstall', CommandInfo(
-        'pip._internal.commands.uninstall', 'UninstallCommand',
-        'Uninstall packages.',
-    )),
-    ('freeze', CommandInfo(
-        'pip._internal.commands.freeze', 'FreezeCommand',
-        'Output installed packages in requirements format.',
-    )),
-    ('list', CommandInfo(
-        'pip._internal.commands.list', 'ListCommand',
-        'List installed packages.',
-    )),
-    ('show', CommandInfo(
-        'pip._internal.commands.show', 'ShowCommand',
-        'Show information about installed packages.',
-    )),
-    ('check', CommandInfo(
-        'pip._internal.commands.check', 'CheckCommand',
-        'Verify installed packages have compatible dependencies.',
-    )),
-    ('config', CommandInfo(
-        'pip._internal.commands.configuration', 'ConfigurationCommand',
-        'Manage local and global configuration.',
-    )),
-    ('search', CommandInfo(
-        'pip._internal.commands.search', 'SearchCommand',
-        'Search PyPI for packages.',
-    )),
-    ('wheel', CommandInfo(
-        'pip._internal.commands.wheel', 'WheelCommand',
-        'Build wheels from your requirements.',
-    )),
-    ('hash', CommandInfo(
-        'pip._internal.commands.hash', 'HashCommand',
-        'Compute hashes of package archives.',
-    )),
-    ('completion', CommandInfo(
-        'pip._internal.commands.completion', 'CompletionCommand',
-        'A helper command used for command completion.',
-    )),
-    ('debug', CommandInfo(
-        'pip._internal.commands.debug', 'DebugCommand',
-        'Show information useful for debugging.',
-    )),
-    ('help', CommandInfo(
-        'pip._internal.commands.help', 'HelpCommand',
-        'Show help for commands.',
-    )),
-])  # type: OrderedDict[str, CommandInfo]
-
-
-def create_command(name, **kwargs):
-    # type: (str, **Any) -> Command
-    """
-    Create an instance of the Command class with the given name.
-    """
-    module_path, class_name, summary = commands_dict[name]
-    module = importlib.import_module(module_path)
-    command_class = getattr(module, class_name)
-    command = command_class(name=name, summary=summary, **kwargs)
-
-    return command
-
-
-def get_similar_commands(name):
-    """Command name auto-correct."""
-    from difflib import get_close_matches
-
-    name = name.lower()
-
-    close_commands = get_close_matches(name, commands_dict.keys())
-
-    if close_commands:
-        return close_commands[0]
-    else:
-        return False
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index aa5f41a66562053eb6a52eff4824daba3be15fb0..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/check.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/check.cpython-38.pyc
deleted file mode 100644
index 10580eeca11e2a8fc8a154eb209fae6c2eae1292..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/check.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/completion.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/completion.cpython-38.pyc
deleted file mode 100644
index 4d62a0595d6023391e898dd8e725861f4fc269c5..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/completion.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-38.pyc
deleted file mode 100644
index 0c9914650e1cd26e9c30085f602d52a397451479..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/debug.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/debug.cpython-38.pyc
deleted file mode 100644
index b9603d83958ed45f03af9cbc67f59dd03ba8ea97..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/debug.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/download.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/download.cpython-38.pyc
deleted file mode 100644
index 1dba4d8a7d53a0589d290d0b8913c1f36d40d867..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/download.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-38.pyc
deleted file mode 100644
index f140a4f70eff0066d86aed88f838af88ac15825c..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/hash.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/hash.cpython-38.pyc
deleted file mode 100644
index 1222af192858aca798321441a652a198a7d2dfd3..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/hash.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/help.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/help.cpython-38.pyc
deleted file mode 100644
index 91e3f217427bcf9cf3426ae6d736a1c04429a367..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/help.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/install.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/install.cpython-38.pyc
deleted file mode 100644
index f1db23969d2b9ff1def4788061229108ac57c2d7..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/install.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/list.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/list.cpython-38.pyc
deleted file mode 100644
index 03a18e81090e9825d0df4e6c3a433198fd11a481..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/list.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/search.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/search.cpython-38.pyc
deleted file mode 100644
index f8a13b657529989c64bb657ef41ab2de84bfbab7..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/search.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/show.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/show.cpython-38.pyc
deleted file mode 100644
index 73d61004e2628d9ec6a42f82887e64183942a4b3..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/show.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-38.pyc
deleted file mode 100644
index a25a60e2bdec08b825a355a0b8f9cd3c5e86358d..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-38.pyc
deleted file mode 100644
index 0a5a8958c1ccc80afecc9efe737d4553e3f614c4..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/check.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/check.py
deleted file mode 100644
index 968944611ea7e284dac912c36d63816c7ca585b4..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/check.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-import logging
-
-from pip._internal.cli.base_command import Command
-from pip._internal.operations.check import (
-    check_package_set,
-    create_package_set_from_installed,
-)
-from pip._internal.utils.misc import write_output
-
-logger = logging.getLogger(__name__)
-
-
-class CheckCommand(Command):
-    """Verify installed packages have compatible dependencies."""
-
-    usage = """
-      %prog [options]"""
-
-    def run(self, options, args):
-        package_set, parsing_probs = create_package_set_from_installed()
-        missing, conflicting = check_package_set(package_set)
-
-        for project_name in missing:
-            version = package_set[project_name].version
-            for dependency in missing[project_name]:
-                write_output(
-                    "%s %s requires %s, which is not installed.",
-                    project_name, version, dependency[0],
-                )
-
-        for project_name in conflicting:
-            version = package_set[project_name].version
-            for dep_name, dep_version, req in conflicting[project_name]:
-                write_output(
-                    "%s %s has requirement %s, but you have %s %s.",
-                    project_name, version, req, dep_name, dep_version,
-                )
-
-        if missing or conflicting or parsing_probs:
-            return 1
-        else:
-            write_output("No broken requirements found.")
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/completion.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/completion.py
deleted file mode 100644
index c532806e3866e652063c92226716c11edbf116b1..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/completion.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import sys
-import textwrap
-
-from pip._internal.cli.base_command import Command
-from pip._internal.utils.misc import get_prog
-
-BASE_COMPLETION = """
-# pip %(shell)s completion start%(script)s# pip %(shell)s completion end
-"""
-
-COMPLETION_SCRIPTS = {
-    'bash': """
-        _pip_completion()
-        {
-            COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \\
-                           COMP_CWORD=$COMP_CWORD \\
-                           PIP_AUTO_COMPLETE=1 $1 2>/dev/null ) )
-        }
-        complete -o default -F _pip_completion %(prog)s
-    """,
-    'zsh': """
-        function _pip_completion {
-          local words cword
-          read -Ac words
-          read -cn cword
-          reply=( $( COMP_WORDS="$words[*]" \\
-                     COMP_CWORD=$(( cword-1 )) \\
-                     PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ))
-        }
-        compctl -K _pip_completion %(prog)s
-    """,
-    'fish': """
-        function __fish_complete_pip
-            set -lx COMP_WORDS (commandline -o) ""
-            set -lx COMP_CWORD ( \\
-                math (contains -i -- (commandline -t) $COMP_WORDS)-1 \\
-            )
-            set -lx PIP_AUTO_COMPLETE 1
-            string split \\  -- (eval $COMP_WORDS[1])
-        end
-        complete -fa "(__fish_complete_pip)" -c %(prog)s
-    """,
-}
-
-
-class CompletionCommand(Command):
-    """A helper command to be used for command completion."""
-
-    ignore_require_venv = True
-
-    def __init__(self, *args, **kw):
-        super(CompletionCommand, self).__init__(*args, **kw)
-
-        cmd_opts = self.cmd_opts
-
-        cmd_opts.add_option(
-            '--bash', '-b',
-            action='store_const',
-            const='bash',
-            dest='shell',
-            help='Emit completion code for bash')
-        cmd_opts.add_option(
-            '--zsh', '-z',
-            action='store_const',
-            const='zsh',
-            dest='shell',
-            help='Emit completion code for zsh')
-        cmd_opts.add_option(
-            '--fish', '-f',
-            action='store_const',
-            const='fish',
-            dest='shell',
-            help='Emit completion code for fish')
-
-        self.parser.insert_option_group(0, cmd_opts)
-
-    def run(self, options, args):
-        """Prints the completion code of the given shell"""
-        shells = COMPLETION_SCRIPTS.keys()
-        shell_options = ['--' + shell for shell in sorted(shells)]
-        if options.shell in shells:
-            script = textwrap.dedent(
-                COMPLETION_SCRIPTS.get(options.shell, '') % {
-                    'prog': get_prog(),
-                }
-            )
-            print(BASE_COMPLETION % {'script': script, 'shell': options.shell})
-        else:
-            sys.stderr.write(
-                'ERROR: You must pass %s\n' % ' or '.join(shell_options)
-            )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/configuration.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/configuration.py
deleted file mode 100644
index efcf5bb3699f9e9c3111adb6975dabaa8887b08f..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/configuration.py
+++ /dev/null
@@ -1,233 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-import logging
-import os
-import subprocess
-
-from pip._internal.cli.base_command import Command
-from pip._internal.cli.status_codes import ERROR, SUCCESS
-from pip._internal.configuration import (
-    Configuration,
-    get_configuration_files,
-    kinds,
-)
-from pip._internal.exceptions import PipError
-from pip._internal.utils.misc import get_prog, write_output
-
-logger = logging.getLogger(__name__)
-
-
-class ConfigurationCommand(Command):
-    """Manage local and global configuration.
-
-        Subcommands:
-
-        list: List the active configuration (or from the file specified)
-        edit: Edit the configuration file in an editor
-        get: Get the value associated with name
-        set: Set the name=value
-        unset: Unset the value associated with name
-
-        If none of --user, --global and --site are passed, a virtual
-        environment configuration file is used if one is active and the file
-        exists. Otherwise, all modifications happen on the to the user file by
-        default.
-    """
-
-    ignore_require_venv = True
-    usage = """
-        %prog [] list
-        %prog [] [--editor ] edit
-
-        %prog [] get name
-        %prog [] set name value
-        %prog [] unset name
-    """
-
-    def __init__(self, *args, **kwargs):
-        super(ConfigurationCommand, self).__init__(*args, **kwargs)
-
-        self.configuration = None
-
-        self.cmd_opts.add_option(
-            '--editor',
-            dest='editor',
-            action='store',
-            default=None,
-            help=(
-                'Editor to use to edit the file. Uses VISUAL or EDITOR '
-                'environment variables if not provided.'
-            )
-        )
-
-        self.cmd_opts.add_option(
-            '--global',
-            dest='global_file',
-            action='store_true',
-            default=False,
-            help='Use the system-wide configuration file only'
-        )
-
-        self.cmd_opts.add_option(
-            '--user',
-            dest='user_file',
-            action='store_true',
-            default=False,
-            help='Use the user configuration file only'
-        )
-
-        self.cmd_opts.add_option(
-            '--site',
-            dest='site_file',
-            action='store_true',
-            default=False,
-            help='Use the current environment configuration file only'
-        )
-
-        self.parser.insert_option_group(0, self.cmd_opts)
-
-    def run(self, options, args):
-        handlers = {
-            "list": self.list_values,
-            "edit": self.open_in_editor,
-            "get": self.get_name,
-            "set": self.set_name_value,
-            "unset": self.unset_name
-        }
-
-        # Determine action
-        if not args or args[0] not in handlers:
-            logger.error("Need an action ({}) to perform.".format(
-                ", ".join(sorted(handlers)))
-            )
-            return ERROR
-
-        action = args[0]
-
-        # Determine which configuration files are to be loaded
-        #    Depends on whether the command is modifying.
-        try:
-            load_only = self._determine_file(
-                options, need_value=(action in ["get", "set", "unset", "edit"])
-            )
-        except PipError as e:
-            logger.error(e.args[0])
-            return ERROR
-
-        # Load a new configuration
-        self.configuration = Configuration(
-            isolated=options.isolated_mode, load_only=load_only
-        )
-        self.configuration.load()
-
-        # Error handling happens here, not in the action-handlers.
-        try:
-            handlers[action](options, args[1:])
-        except PipError as e:
-            logger.error(e.args[0])
-            return ERROR
-
-        return SUCCESS
-
-    def _determine_file(self, options, need_value):
-        file_options = [key for key, value in (
-            (kinds.USER, options.user_file),
-            (kinds.GLOBAL, options.global_file),
-            (kinds.SITE, options.site_file),
-        ) if value]
-
-        if not file_options:
-            if not need_value:
-                return None
-            # Default to user, unless there's a site file.
-            elif any(
-                os.path.exists(site_config_file)
-                for site_config_file in get_configuration_files()[kinds.SITE]
-            ):
-                return kinds.SITE
-            else:
-                return kinds.USER
-        elif len(file_options) == 1:
-            return file_options[0]
-
-        raise PipError(
-            "Need exactly one file to operate upon "
-            "(--user, --site, --global) to perform."
-        )
-
-    def list_values(self, options, args):
-        self._get_n_args(args, "list", n=0)
-
-        for key, value in sorted(self.configuration.items()):
-            write_output("%s=%r", key, value)
-
-    def get_name(self, options, args):
-        key = self._get_n_args(args, "get [name]", n=1)
-        value = self.configuration.get_value(key)
-
-        write_output("%s", value)
-
-    def set_name_value(self, options, args):
-        key, value = self._get_n_args(args, "set [name] [value]", n=2)
-        self.configuration.set_value(key, value)
-
-        self._save_configuration()
-
-    def unset_name(self, options, args):
-        key = self._get_n_args(args, "unset [name]", n=1)
-        self.configuration.unset_value(key)
-
-        self._save_configuration()
-
-    def open_in_editor(self, options, args):
-        editor = self._determine_editor(options)
-
-        fname = self.configuration.get_file_to_edit()
-        if fname is None:
-            raise PipError("Could not determine appropriate file.")
-
-        try:
-            subprocess.check_call([editor, fname])
-        except subprocess.CalledProcessError as e:
-            raise PipError(
-                "Editor Subprocess exited with exit code {}"
-                .format(e.returncode)
-            )
-
-    def _get_n_args(self, args, example, n):
-        """Helper to make sure the command got the right number of arguments
-        """
-        if len(args) != n:
-            msg = (
-                'Got unexpected number of arguments, expected {}. '
-                '(example: "{} config {}")'
-            ).format(n, get_prog(), example)
-            raise PipError(msg)
-
-        if n == 1:
-            return args[0]
-        else:
-            return args
-
-    def _save_configuration(self):
-        # We successfully ran a modifying command. Need to save the
-        # configuration.
-        try:
-            self.configuration.save()
-        except Exception:
-            logger.error(
-                "Unable to save configuration. Please report this as a bug.",
-                exc_info=1
-            )
-            raise PipError("Internal Error.")
-
-    def _determine_editor(self, options):
-        if options.editor is not None:
-            return options.editor
-        elif "VISUAL" in os.environ:
-            return os.environ["VISUAL"]
-        elif "EDITOR" in os.environ:
-            return os.environ["EDITOR"]
-        else:
-            raise PipError("Could not determine editor to use.")
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/debug.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/debug.py
deleted file mode 100644
index fe93b3a3926653c481c77830a4775585d2c488bd..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/debug.py
+++ /dev/null
@@ -1,142 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import locale
-import logging
-import os
-import sys
-
-from pip._vendor.certifi import where
-
-from pip._internal.cli import cmdoptions
-from pip._internal.cli.base_command import Command
-from pip._internal.cli.cmdoptions import make_target_python
-from pip._internal.cli.status_codes import SUCCESS
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import get_pip_version
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any, List, Optional
-    from optparse import Values
-
-logger = logging.getLogger(__name__)
-
-
-def show_value(name, value):
-    # type: (str, Optional[str]) -> None
-    logger.info('{}: {}'.format(name, value))
-
-
-def show_sys_implementation():
-    # type: () -> None
-    logger.info('sys.implementation:')
-    if hasattr(sys, 'implementation'):
-        implementation = sys.implementation  # type: ignore
-        implementation_name = implementation.name
-    else:
-        implementation_name = ''
-
-    with indent_log():
-        show_value('name', implementation_name)
-
-
-def show_tags(options):
-    # type: (Values) -> None
-    tag_limit = 10
-
-    target_python = make_target_python(options)
-    tags = target_python.get_tags()
-
-    # Display the target options that were explicitly provided.
-    formatted_target = target_python.format_given()
-    suffix = ''
-    if formatted_target:
-        suffix = ' (target: {})'.format(formatted_target)
-
-    msg = 'Compatible tags: {}{}'.format(len(tags), suffix)
-    logger.info(msg)
-
-    if options.verbose < 1 and len(tags) > tag_limit:
-        tags_limited = True
-        tags = tags[:tag_limit]
-    else:
-        tags_limited = False
-
-    with indent_log():
-        for tag in tags:
-            logger.info(str(tag))
-
-        if tags_limited:
-            msg = (
-                '...\n'
-                '[First {tag_limit} tags shown. Pass --verbose to show all.]'
-            ).format(tag_limit=tag_limit)
-            logger.info(msg)
-
-
-def ca_bundle_info(config):
-    levels = set()
-    for key, value in config.items():
-        levels.add(key.split('.')[0])
-
-    if not levels:
-        return "Not specified"
-
-    levels_that_override_global = ['install', 'wheel', 'download']
-    global_overriding_level = [
-        level for level in levels if level in levels_that_override_global
-    ]
-    if not global_overriding_level:
-        return 'global'
-
-    levels.remove('global')
-    return ", ".join(levels)
-
-
-class DebugCommand(Command):
-    """
-    Display debug information.
-    """
-
-    usage = """
-      %prog """
-    ignore_require_venv = True
-
-    def __init__(self, *args, **kw):
-        super(DebugCommand, self).__init__(*args, **kw)
-
-        cmd_opts = self.cmd_opts
-        cmdoptions.add_target_python_options(cmd_opts)
-        self.parser.insert_option_group(0, cmd_opts)
-        self.parser.config.load()
-
-    def run(self, options, args):
-        # type: (Values, List[Any]) -> int
-        logger.warning(
-            "This command is only meant for debugging. "
-            "Do not use this with automation for parsing and getting these "
-            "details, since the output and options of this command may "
-            "change without notice."
-        )
-        show_value('pip version', get_pip_version())
-        show_value('sys.version', sys.version)
-        show_value('sys.executable', sys.executable)
-        show_value('sys.getdefaultencoding', sys.getdefaultencoding())
-        show_value('sys.getfilesystemencoding', sys.getfilesystemencoding())
-        show_value(
-            'locale.getpreferredencoding', locale.getpreferredencoding(),
-        )
-        show_value('sys.platform', sys.platform)
-        show_sys_implementation()
-
-        show_value("'cert' config value", ca_bundle_info(self.parser.config))
-        show_value("REQUESTS_CA_BUNDLE", os.environ.get('REQUESTS_CA_BUNDLE'))
-        show_value("CURL_CA_BUNDLE", os.environ.get('CURL_CA_BUNDLE'))
-        show_value("pip._vendor.certifi.where()", where())
-
-        show_tags(options)
-
-        return SUCCESS
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/download.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/download.py
deleted file mode 100644
index 24da3eb2a263217e068d815e73d0f78f64a89398..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/download.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-
-from pip._internal.cli import cmdoptions
-from pip._internal.cli.cmdoptions import make_target_python
-from pip._internal.cli.req_command import RequirementCommand
-from pip._internal.req import RequirementSet
-from pip._internal.req.req_tracker import get_requirement_tracker
-from pip._internal.utils.misc import ensure_dir, normalize_path, write_output
-from pip._internal.utils.temp_dir import TempDirectory
-
-logger = logging.getLogger(__name__)
-
-
-class DownloadCommand(RequirementCommand):
-    """
-    Download packages from:
-
-    - PyPI (and other indexes) using requirement specifiers.
-    - VCS project urls.
-    - Local project directories.
-    - Local or remote source archives.
-
-    pip also supports downloading from "requirements files", which provide
-    an easy way to specify a whole environment to be downloaded.
-    """
-
-    usage = """
-      %prog [options]  [package-index-options] ...
-      %prog [options] -r  [package-index-options] ...
-      %prog [options]  ...
-      %prog [options]  ...
-      %prog [options]  ..."""
-
-    def __init__(self, *args, **kw):
-        super(DownloadCommand, self).__init__(*args, **kw)
-
-        cmd_opts = self.cmd_opts
-
-        cmd_opts.add_option(cmdoptions.constraints())
-        cmd_opts.add_option(cmdoptions.requirements())
-        cmd_opts.add_option(cmdoptions.build_dir())
-        cmd_opts.add_option(cmdoptions.no_deps())
-        cmd_opts.add_option(cmdoptions.global_options())
-        cmd_opts.add_option(cmdoptions.no_binary())
-        cmd_opts.add_option(cmdoptions.only_binary())
-        cmd_opts.add_option(cmdoptions.prefer_binary())
-        cmd_opts.add_option(cmdoptions.src())
-        cmd_opts.add_option(cmdoptions.pre())
-        cmd_opts.add_option(cmdoptions.no_clean())
-        cmd_opts.add_option(cmdoptions.require_hashes())
-        cmd_opts.add_option(cmdoptions.progress_bar())
-        cmd_opts.add_option(cmdoptions.no_build_isolation())
-        cmd_opts.add_option(cmdoptions.use_pep517())
-        cmd_opts.add_option(cmdoptions.no_use_pep517())
-
-        cmd_opts.add_option(
-            '-d', '--dest', '--destination-dir', '--destination-directory',
-            dest='download_dir',
-            metavar='dir',
-            default=os.curdir,
-            help=("Download packages into ."),
-        )
-
-        cmdoptions.add_target_python_options(cmd_opts)
-
-        index_opts = cmdoptions.make_option_group(
-            cmdoptions.index_group,
-            self.parser,
-        )
-
-        self.parser.insert_option_group(0, index_opts)
-        self.parser.insert_option_group(0, cmd_opts)
-
-    def run(self, options, args):
-        options.ignore_installed = True
-        # editable doesn't really make sense for `pip download`, but the bowels
-        # of the RequirementSet code require that property.
-        options.editables = []
-
-        cmdoptions.check_dist_restriction(options)
-
-        options.download_dir = normalize_path(options.download_dir)
-
-        ensure_dir(options.download_dir)
-
-        session = self.get_default_session(options)
-
-        target_python = make_target_python(options)
-        finder = self._build_package_finder(
-            options=options,
-            session=session,
-            target_python=target_python,
-        )
-        build_delete = (not (options.no_clean or options.build_dir))
-
-        with get_requirement_tracker() as req_tracker, TempDirectory(
-            options.build_dir, delete=build_delete, kind="download"
-        ) as directory:
-
-            requirement_set = RequirementSet()
-            self.populate_requirement_set(
-                requirement_set,
-                args,
-                options,
-                finder,
-                session,
-                None
-            )
-
-            preparer = self.make_requirement_preparer(
-                temp_build_dir=directory,
-                options=options,
-                req_tracker=req_tracker,
-                session=session,
-                finder=finder,
-                download_dir=options.download_dir,
-                use_user_site=False,
-            )
-
-            resolver = self.make_resolver(
-                preparer=preparer,
-                finder=finder,
-                options=options,
-                py_version_info=options.python_version,
-            )
-
-            self.trace_basic_info(finder)
-
-            resolver.resolve(requirement_set)
-
-            downloaded = ' '.join([
-                req.name for req in requirement_set.successfully_downloaded
-            ])
-            if downloaded:
-                write_output('Successfully downloaded %s', downloaded)
-
-            # Clean up
-            if not options.no_clean:
-                requirement_set.cleanup_files()
-
-        return requirement_set
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/freeze.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/freeze.py
deleted file mode 100644
index e96c0833f5f1e7f643a588cf6bf30e9ca2282bc5..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/freeze.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import sys
-
-from pip._internal.cache import WheelCache
-from pip._internal.cli import cmdoptions
-from pip._internal.cli.base_command import Command
-from pip._internal.models.format_control import FormatControl
-from pip._internal.operations.freeze import freeze
-from pip._internal.utils.compat import stdlib_pkgs
-
-DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel', 'pkg-resources'}
-
-
-class FreezeCommand(Command):
-    """
-    Output installed packages in requirements format.
-
-    packages are listed in a case-insensitive sorted order.
-    """
-
-    usage = """
-      %prog [options]"""
-    log_streams = ("ext://sys.stderr", "ext://sys.stderr")
-
-    def __init__(self, *args, **kw):
-        super(FreezeCommand, self).__init__(*args, **kw)
-
-        self.cmd_opts.add_option(
-            '-r', '--requirement',
-            dest='requirements',
-            action='append',
-            default=[],
-            metavar='file',
-            help="Use the order in the given requirements file and its "
-                 "comments when generating output. This option can be "
-                 "used multiple times.")
-        self.cmd_opts.add_option(
-            '-f', '--find-links',
-            dest='find_links',
-            action='append',
-            default=[],
-            metavar='URL',
-            help='URL for finding packages, which will be added to the '
-                 'output.')
-        self.cmd_opts.add_option(
-            '-l', '--local',
-            dest='local',
-            action='store_true',
-            default=False,
-            help='If in a virtualenv that has global access, do not output '
-                 'globally-installed packages.')
-        self.cmd_opts.add_option(
-            '--user',
-            dest='user',
-            action='store_true',
-            default=False,
-            help='Only output packages installed in user-site.')
-        self.cmd_opts.add_option(cmdoptions.list_path())
-        self.cmd_opts.add_option(
-            '--all',
-            dest='freeze_all',
-            action='store_true',
-            help='Do not skip these packages in the output:'
-                 ' %s' % ', '.join(DEV_PKGS))
-        self.cmd_opts.add_option(
-            '--exclude-editable',
-            dest='exclude_editable',
-            action='store_true',
-            help='Exclude editable package from output.')
-
-        self.parser.insert_option_group(0, self.cmd_opts)
-
-    def run(self, options, args):
-        format_control = FormatControl(set(), set())
-        wheel_cache = WheelCache(options.cache_dir, format_control)
-        skip = set(stdlib_pkgs)
-        if not options.freeze_all:
-            skip.update(DEV_PKGS)
-
-        cmdoptions.check_list_path_option(options)
-
-        freeze_kwargs = dict(
-            requirement=options.requirements,
-            find_links=options.find_links,
-            local_only=options.local,
-            user_only=options.user,
-            paths=options.path,
-            skip_regex=options.skip_requirements_regex,
-            isolated=options.isolated_mode,
-            wheel_cache=wheel_cache,
-            skip=skip,
-            exclude_editable=options.exclude_editable,
-        )
-
-        try:
-            for line in freeze(**freeze_kwargs):
-                sys.stdout.write(line + '\n')
-        finally:
-            wheel_cache.cleanup()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/hash.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/hash.py
deleted file mode 100644
index 1dc7fb0eac936b625c79d20a7ec8267179a15a29..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/hash.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import hashlib
-import logging
-import sys
-
-from pip._internal.cli.base_command import Command
-from pip._internal.cli.status_codes import ERROR
-from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES
-from pip._internal.utils.misc import read_chunks, write_output
-
-logger = logging.getLogger(__name__)
-
-
-class HashCommand(Command):
-    """
-    Compute a hash of a local package archive.
-
-    These can be used with --hash in a requirements file to do repeatable
-    installs.
-    """
-
-    usage = '%prog [options]  ...'
-    ignore_require_venv = True
-
-    def __init__(self, *args, **kw):
-        super(HashCommand, self).__init__(*args, **kw)
-        self.cmd_opts.add_option(
-            '-a', '--algorithm',
-            dest='algorithm',
-            choices=STRONG_HASHES,
-            action='store',
-            default=FAVORITE_HASH,
-            help='The hash algorithm to use: one of %s' %
-                 ', '.join(STRONG_HASHES))
-        self.parser.insert_option_group(0, self.cmd_opts)
-
-    def run(self, options, args):
-        if not args:
-            self.parser.print_usage(sys.stderr)
-            return ERROR
-
-        algorithm = options.algorithm
-        for path in args:
-            write_output('%s:\n--hash=%s:%s',
-                         path, algorithm, _hash_of_file(path, algorithm))
-
-
-def _hash_of_file(path, algorithm):
-    """Return the hash digest of a file."""
-    with open(path, 'rb') as archive:
-        hash = hashlib.new(algorithm)
-        for chunk in read_chunks(archive):
-            hash.update(chunk)
-    return hash.hexdigest()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/help.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/help.py
deleted file mode 100644
index 75af999b41e676f3abca4e2278b06aa404a95479..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/help.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-from pip._internal.cli.base_command import Command
-from pip._internal.cli.status_codes import SUCCESS
-from pip._internal.exceptions import CommandError
-
-
-class HelpCommand(Command):
-    """Show help for commands"""
-
-    usage = """
-      %prog """
-    ignore_require_venv = True
-
-    def run(self, options, args):
-        from pip._internal.commands import (
-            commands_dict, create_command, get_similar_commands,
-        )
-
-        try:
-            # 'pip help' with no args is handled by pip.__init__.parseopt()
-            cmd_name = args[0]  # the command we need help for
-        except IndexError:
-            return SUCCESS
-
-        if cmd_name not in commands_dict:
-            guess = get_similar_commands(cmd_name)
-
-            msg = ['unknown command "%s"' % cmd_name]
-            if guess:
-                msg.append('maybe you meant "%s"' % guess)
-
-            raise CommandError(' - '.join(msg))
-
-        command = create_command(cmd_name)
-        command.parser.print_help()
-
-        return SUCCESS
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/install.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/install.py
deleted file mode 100644
index cb2fb280c986a60fd57ec34af5185e423169722e..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/install.py
+++ /dev/null
@@ -1,727 +0,0 @@
-# The following comment should be removed at some point in the future.
-# It's included for now because without it InstallCommand.run() has a
-# couple errors where we have to know req.name is str rather than
-# Optional[str] for the InstallRequirement req.
-# mypy: strict-optional=False
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import errno
-import logging
-import operator
-import os
-import shutil
-import site
-from optparse import SUPPRESS_HELP
-
-from pip._vendor import pkg_resources
-from pip._vendor.packaging.utils import canonicalize_name
-
-from pip._internal.cache import WheelCache
-from pip._internal.cli import cmdoptions
-from pip._internal.cli.cmdoptions import make_target_python
-from pip._internal.cli.req_command import RequirementCommand
-from pip._internal.cli.status_codes import ERROR, SUCCESS
-from pip._internal.exceptions import (
-    CommandError,
-    InstallationError,
-    PreviousBuildDirError,
-)
-from pip._internal.locations import distutils_scheme
-from pip._internal.operations.check import check_install_conflicts
-from pip._internal.req import RequirementSet, install_given_reqs
-from pip._internal.req.req_tracker import get_requirement_tracker
-from pip._internal.utils.deprecation import deprecated
-from pip._internal.utils.distutils_args import parse_distutils_args
-from pip._internal.utils.filesystem import test_writable_dir
-from pip._internal.utils.misc import (
-    ensure_dir,
-    get_installed_version,
-    protect_pip_from_modification_on_windows,
-    write_output,
-)
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.virtualenv import virtualenv_no_global
-from pip._internal.wheel_builder import build, should_build_for_install_command
-
-if MYPY_CHECK_RUNNING:
-    from optparse import Values
-    from typing import Any, Iterable, List, Optional
-
-    from pip._internal.models.format_control import FormatControl
-    from pip._internal.req.req_install import InstallRequirement
-    from pip._internal.wheel_builder import BinaryAllowedPredicate
-
-from pip._internal.locations import running_under_virtualenv
-
-logger = logging.getLogger(__name__)
-
-
-def get_check_binary_allowed(format_control):
-    # type: (FormatControl) -> BinaryAllowedPredicate
-    def check_binary_allowed(req):
-        # type: (InstallRequirement) -> bool
-        if req.use_pep517:
-            return True
-        canonical_name = canonicalize_name(req.name)
-        allowed_formats = format_control.get_allowed_formats(canonical_name)
-        return "binary" in allowed_formats
-
-    return check_binary_allowed
-
-
-class InstallCommand(RequirementCommand):
-    """
-    Install packages from:
-
-    - PyPI (and other indexes) using requirement specifiers.
-    - VCS project urls.
-    - Local project directories.
-    - Local or remote source archives.
-
-    pip also supports installing from "requirements files", which provide
-    an easy way to specify a whole environment to be installed.
-    """
-
-    usage = """
-      %prog [options]  [package-index-options] ...
-      %prog [options] -r  [package-index-options] ...
-      %prog [options] [-e]  ...
-      %prog [options] [-e]  ...
-      %prog [options]  ..."""
-
-    def __init__(self, *args, **kw):
-        super(InstallCommand, self).__init__(*args, **kw)
-
-        cmd_opts = self.cmd_opts
-
-        cmd_opts.add_option(cmdoptions.requirements())
-        cmd_opts.add_option(cmdoptions.constraints())
-        cmd_opts.add_option(cmdoptions.no_deps())
-        cmd_opts.add_option(cmdoptions.pre())
-
-        cmd_opts.add_option(cmdoptions.editable())
-        cmd_opts.add_option(
-            '-t', '--target',
-            dest='target_dir',
-            metavar='dir',
-            default=None,
-            help='Install packages into . '
-                 'By default this will not replace existing files/folders in '
-                 '. Use --upgrade to replace existing packages in  '
-                 'with new versions.'
-        )
-        cmdoptions.add_target_python_options(cmd_opts)
-
-        cmd_opts.add_option(
-            '--user',
-            dest='use_user_site',
-            action='store_true',
-            help="Install to the Python user install directory for your "
-                 "platform. Typically ~/.local/, or %APPDATA%\\Python on "
-                 "Windows. (See the Python documentation for site.USER_BASE "
-                 "for full details.)  On Debian systems, this is the "
-                 "default when running outside of a virtual environment "
-                 "and not as root.")
-
-        cmd_opts.add_option(
-            '--no-user',
-            dest='use_system_location',
-            action='store_true',
-            help=SUPPRESS_HELP)
-        cmd_opts.add_option(
-            '--root',
-            dest='root_path',
-            metavar='dir',
-            default=None,
-            help="Install everything relative to this alternate root "
-                 "directory.")
-        cmd_opts.add_option(
-            '--prefix',
-            dest='prefix_path',
-            metavar='dir',
-            default=None,
-            help="Installation prefix where lib, bin and other top-level "
-                 "folders are placed")
-
-        cmd_opts.add_option(
-            '--system',
-            dest='use_system_location',
-            action='store_true',
-            help="Install using the system scheme (overrides --user on "
-                 "Debian systems)")
-
-        cmd_opts.add_option(cmdoptions.build_dir())
-
-        cmd_opts.add_option(cmdoptions.src())
-
-        cmd_opts.add_option(
-            '-U', '--upgrade',
-            dest='upgrade',
-            action='store_true',
-            help='Upgrade all specified packages to the newest available '
-                 'version. The handling of dependencies depends on the '
-                 'upgrade-strategy used.'
-        )
-
-        cmd_opts.add_option(
-            '--upgrade-strategy',
-            dest='upgrade_strategy',
-            default='only-if-needed',
-            choices=['only-if-needed', 'eager'],
-            help='Determines how dependency upgrading should be handled '
-                 '[default: %default]. '
-                 '"eager" - dependencies are upgraded regardless of '
-                 'whether the currently installed version satisfies the '
-                 'requirements of the upgraded package(s). '
-                 '"only-if-needed" -  are upgraded only when they do not '
-                 'satisfy the requirements of the upgraded package(s).'
-        )
-
-        cmd_opts.add_option(
-            '--force-reinstall',
-            dest='force_reinstall',
-            action='store_true',
-            help='Reinstall all packages even if they are already '
-                 'up-to-date.')
-
-        cmd_opts.add_option(
-            '-I', '--ignore-installed',
-            dest='ignore_installed',
-            action='store_true',
-            help='Ignore the installed packages, overwriting them. '
-                 'This can break your system if the existing package '
-                 'is of a different version or was installed '
-                 'with a different package manager!'
-        )
-
-        cmd_opts.add_option(cmdoptions.ignore_requires_python())
-        cmd_opts.add_option(cmdoptions.no_build_isolation())
-        cmd_opts.add_option(cmdoptions.use_pep517())
-        cmd_opts.add_option(cmdoptions.no_use_pep517())
-
-        cmd_opts.add_option(cmdoptions.install_options())
-        cmd_opts.add_option(cmdoptions.global_options())
-
-        cmd_opts.add_option(
-            "--compile",
-            action="store_true",
-            dest="compile",
-            default=True,
-            help="Compile Python source files to bytecode",
-        )
-
-        cmd_opts.add_option(
-            "--no-compile",
-            action="store_false",
-            dest="compile",
-            help="Do not compile Python source files to bytecode",
-        )
-
-        cmd_opts.add_option(
-            "--no-warn-script-location",
-            action="store_false",
-            dest="warn_script_location",
-            default=True,
-            help="Do not warn when installing scripts outside PATH",
-        )
-        cmd_opts.add_option(
-            "--no-warn-conflicts",
-            action="store_false",
-            dest="warn_about_conflicts",
-            default=True,
-            help="Do not warn about broken dependencies",
-        )
-
-        cmd_opts.add_option(cmdoptions.no_binary())
-        cmd_opts.add_option(cmdoptions.only_binary())
-        cmd_opts.add_option(cmdoptions.prefer_binary())
-        cmd_opts.add_option(cmdoptions.no_clean())
-        cmd_opts.add_option(cmdoptions.require_hashes())
-        cmd_opts.add_option(cmdoptions.progress_bar())
-
-        index_opts = cmdoptions.make_option_group(
-            cmdoptions.index_group,
-            self.parser,
-        )
-
-        self.parser.insert_option_group(0, index_opts)
-        self.parser.insert_option_group(0, cmd_opts)
-
-    def run(self, options, args):
-        # type: (Values, List[Any]) -> int
-        cmdoptions.check_install_build_global(options)
-        upgrade_strategy = "to-satisfy-only"
-        if options.upgrade:
-            upgrade_strategy = options.upgrade_strategy
-
-        cmdoptions.check_dist_restriction(options, check_target=True)
-
-        if options.python_version:
-            python_versions = [options.python_version]
-        else:
-            python_versions = None
-
-        # compute install location defaults
-        if (not options.use_user_site and not options.prefix_path and not
-                options.target_dir and not options.use_system_location):
-            if not running_under_virtualenv() and os.geteuid() != 0:
-                options.use_user_site = True
-
-        if options.use_system_location:
-            options.use_user_site = False
-
-        options.src_dir = os.path.abspath(options.src_dir)
-        install_options = options.install_options or []
-
-        options.use_user_site = decide_user_install(
-            options.use_user_site,
-            prefix_path=options.prefix_path,
-            target_dir=options.target_dir,
-            root_path=options.root_path,
-            isolated_mode=options.isolated_mode,
-        )
-
-        target_temp_dir = None  # type: Optional[TempDirectory]
-        target_temp_dir_path = None  # type: Optional[str]
-        if options.target_dir:
-            options.ignore_installed = True
-            options.target_dir = os.path.abspath(options.target_dir)
-            if (os.path.exists(options.target_dir) and not
-                    os.path.isdir(options.target_dir)):
-                raise CommandError(
-                    "Target path exists but is not a directory, will not "
-                    "continue."
-                )
-
-            # Create a target directory for using with the target option
-            target_temp_dir = TempDirectory(kind="target")
-            target_temp_dir_path = target_temp_dir.path
-
-        global_options = options.global_options or []
-
-        session = self.get_default_session(options)
-
-        target_python = make_target_python(options)
-        finder = self._build_package_finder(
-            options=options,
-            session=session,
-            target_python=target_python,
-            ignore_requires_python=options.ignore_requires_python,
-        )
-        build_delete = (not (options.no_clean or options.build_dir))
-        wheel_cache = WheelCache(options.cache_dir, options.format_control)
-
-        with get_requirement_tracker() as req_tracker, TempDirectory(
-            options.build_dir, delete=build_delete, kind="install"
-        ) as directory:
-            requirement_set = RequirementSet(
-                check_supported_wheels=not options.target_dir,
-            )
-
-            try:
-                self.populate_requirement_set(
-                    requirement_set, args, options, finder, session,
-                    wheel_cache
-                )
-
-                warn_deprecated_install_options(
-                    requirement_set, options.install_options
-                )
-
-                preparer = self.make_requirement_preparer(
-                    temp_build_dir=directory,
-                    options=options,
-                    req_tracker=req_tracker,
-                    session=session,
-                    finder=finder,
-                    use_user_site=options.use_user_site,
-                )
-                resolver = self.make_resolver(
-                    preparer=preparer,
-                    finder=finder,
-                    options=options,
-                    wheel_cache=wheel_cache,
-                    use_user_site=options.use_user_site,
-                    ignore_installed=options.ignore_installed,
-                    ignore_requires_python=options.ignore_requires_python,
-                    force_reinstall=options.force_reinstall,
-                    upgrade_strategy=upgrade_strategy,
-                    use_pep517=options.use_pep517,
-                )
-
-                self.trace_basic_info(finder)
-
-                resolver.resolve(requirement_set)
-
-                try:
-                    pip_req = requirement_set.get_requirement("pip")
-                except KeyError:
-                    modifying_pip = None
-                else:
-                    # If we're not replacing an already installed pip,
-                    # we're not modifying it.
-                    modifying_pip = pip_req.satisfied_by is None
-                protect_pip_from_modification_on_windows(
-                    modifying_pip=modifying_pip
-                )
-
-                check_binary_allowed = get_check_binary_allowed(
-                    finder.format_control
-                )
-
-                reqs_to_build = [
-                    r for r in requirement_set.requirements.values()
-                    if should_build_for_install_command(
-                        r, check_binary_allowed
-                    )
-                ]
-
-                _, build_failures = build(
-                    reqs_to_build,
-                    wheel_cache=wheel_cache,
-                    build_options=[],
-                    global_options=[],
-                )
-
-                # If we're using PEP 517, we cannot do a direct install
-                # so we fail here.
-                # We don't care about failures building legacy
-                # requirements, as we'll fall through to a direct
-                # install for those.
-                pep517_build_failures = [
-                    r for r in build_failures if r.use_pep517
-                ]
-                if pep517_build_failures:
-                    raise InstallationError(
-                        "Could not build wheels for {} which use"
-                        " PEP 517 and cannot be installed directly".format(
-                            ", ".join(r.name for r in pep517_build_failures)))
-
-                to_install = resolver.get_installation_order(
-                    requirement_set
-                )
-
-                # Consistency Checking of the package set we're installing.
-                should_warn_about_conflicts = (
-                    not options.ignore_dependencies and
-                    options.warn_about_conflicts
-                )
-                if should_warn_about_conflicts:
-                    self._warn_about_conflicts(to_install)
-
-                # Don't warn about script install locations if
-                # --target has been specified
-                warn_script_location = options.warn_script_location
-                if options.target_dir:
-                    warn_script_location = False
-
-                installed = install_given_reqs(
-                    to_install,
-                    install_options,
-                    global_options,
-                    root=options.root_path,
-                    home=target_temp_dir_path,
-                    prefix=options.prefix_path,
-                    pycompile=options.compile,
-                    warn_script_location=warn_script_location,
-                    use_user_site=options.use_user_site,
-                )
-
-                lib_locations = get_lib_location_guesses(
-                    user=options.use_user_site,
-                    home=target_temp_dir_path,
-                    root=options.root_path,
-                    prefix=options.prefix_path,
-                    isolated=options.isolated_mode,
-                )
-                working_set = pkg_resources.WorkingSet(lib_locations)
-
-                installed.sort(key=operator.attrgetter('name'))
-                items = []
-                for result in installed:
-                    item = result.name
-                    try:
-                        installed_version = get_installed_version(
-                            result.name, working_set=working_set
-                        )
-                        if installed_version:
-                            item += '-' + installed_version
-                    except Exception:
-                        pass
-                    items.append(item)
-                installed_desc = ' '.join(items)
-                if installed_desc:
-                    write_output(
-                        'Successfully installed %s', installed_desc,
-                    )
-            except EnvironmentError as error:
-                show_traceback = (self.verbosity >= 1)
-
-                message = create_env_error_message(
-                    error, show_traceback, options.use_user_site,
-                )
-                logger.error(message, exc_info=show_traceback)
-
-                return ERROR
-            except PreviousBuildDirError:
-                options.no_clean = True
-                raise
-            finally:
-                # Clean up
-                if not options.no_clean:
-                    requirement_set.cleanup_files()
-                    wheel_cache.cleanup()
-
-        if options.target_dir:
-            self._handle_target_dir(
-                options.target_dir, target_temp_dir, options.upgrade
-            )
-
-        return SUCCESS
-
-    def _handle_target_dir(self, target_dir, target_temp_dir, upgrade):
-        ensure_dir(target_dir)
-
-        # Checking both purelib and platlib directories for installed
-        # packages to be moved to target directory
-        lib_dir_list = []
-
-        with target_temp_dir:
-            # Checking both purelib and platlib directories for installed
-            # packages to be moved to target directory
-            scheme = distutils_scheme('', home=target_temp_dir.path)
-            purelib_dir = scheme['purelib']
-            platlib_dir = scheme['platlib']
-            data_dir = scheme['data']
-
-            if os.path.exists(purelib_dir):
-                lib_dir_list.append(purelib_dir)
-            if os.path.exists(platlib_dir) and platlib_dir != purelib_dir:
-                lib_dir_list.append(platlib_dir)
-            if os.path.exists(data_dir):
-                lib_dir_list.append(data_dir)
-
-            for lib_dir in lib_dir_list:
-                for item in os.listdir(lib_dir):
-                    if lib_dir == data_dir:
-                        ddir = os.path.join(data_dir, item)
-                        if any(s.startswith(ddir) for s in lib_dir_list[:-1]):
-                            continue
-                    target_item_dir = os.path.join(target_dir, item)
-                    if os.path.exists(target_item_dir):
-                        if not upgrade:
-                            logger.warning(
-                                'Target directory %s already exists. Specify '
-                                '--upgrade to force replacement.',
-                                target_item_dir
-                            )
-                            continue
-                        if os.path.islink(target_item_dir):
-                            logger.warning(
-                                'Target directory %s already exists and is '
-                                'a link. Pip will not automatically replace '
-                                'links, please remove if replacement is '
-                                'desired.',
-                                target_item_dir
-                            )
-                            continue
-                        if os.path.isdir(target_item_dir):
-                            shutil.rmtree(target_item_dir)
-                        else:
-                            os.remove(target_item_dir)
-
-                    shutil.move(
-                        os.path.join(lib_dir, item),
-                        target_item_dir
-                    )
-
-    def _warn_about_conflicts(self, to_install):
-        try:
-            package_set, _dep_info = check_install_conflicts(to_install)
-        except Exception:
-            logger.error("Error checking for conflicts.", exc_info=True)
-            return
-        missing, conflicting = _dep_info
-
-        # NOTE: There is some duplication here from pip check
-        for project_name in missing:
-            version = package_set[project_name][0]
-            for dependency in missing[project_name]:
-                logger.critical(
-                    "%s %s requires %s, which is not installed.",
-                    project_name, version, dependency[1],
-                )
-
-        for project_name in conflicting:
-            version = package_set[project_name][0]
-            for dep_name, dep_version, req in conflicting[project_name]:
-                logger.critical(
-                    "%s %s has requirement %s, but you'll have %s %s which is "
-                    "incompatible.",
-                    project_name, version, req, dep_name, dep_version,
-                )
-
-
-def get_lib_location_guesses(*args, **kwargs):
-    scheme = distutils_scheme('', *args, **kwargs)
-    return [scheme['purelib'], scheme['platlib']]
-
-
-def site_packages_writable(**kwargs):
-    return all(
-        test_writable_dir(d) for d in set(get_lib_location_guesses(**kwargs))
-    )
-
-
-def decide_user_install(
-    use_user_site,  # type: Optional[bool]
-    prefix_path=None,  # type: Optional[str]
-    target_dir=None,  # type: Optional[str]
-    root_path=None,  # type: Optional[str]
-    isolated_mode=False,  # type: bool
-):
-    # type: (...) -> bool
-    """Determine whether to do a user install based on the input options.
-
-    If use_user_site is False, no additional checks are done.
-    If use_user_site is True, it is checked for compatibility with other
-    options.
-    If use_user_site is None, the default behaviour depends on the environment,
-    which is provided by the other arguments.
-    """
-    # In some cases (config from tox), use_user_site can be set to an integer
-    # rather than a bool, which 'use_user_site is False' wouldn't catch.
-    if (use_user_site is not None) and (not use_user_site):
-        logger.debug("Non-user install by explicit request")
-        return False
-
-    if use_user_site:
-        if prefix_path:
-            raise CommandError(
-                "Can not combine '--user' and '--prefix' as they imply "
-                "different installation locations"
-            )
-        if virtualenv_no_global():
-            raise InstallationError(
-                "Can not perform a '--user' install. User site-packages "
-                "are not visible in this virtualenv."
-            )
-        logger.debug("User install by explicit request")
-        return True
-
-    # If we are here, user installs have not been explicitly requested/avoided
-    assert use_user_site is None
-
-    # user install incompatible with --prefix/--target
-    if prefix_path or target_dir:
-        logger.debug("Non-user install due to --prefix or --target option")
-        return False
-
-    # If user installs are not enabled, choose a non-user install
-    if not site.ENABLE_USER_SITE:
-        logger.debug("Non-user install because user site-packages disabled")
-        return False
-
-    # If we have permission for a non-user install, do that,
-    # otherwise do a user install.
-    if site_packages_writable(root=root_path, isolated=isolated_mode):
-        logger.debug("Non-user install because site-packages writeable")
-        return False
-
-    logger.info("Defaulting to user installation because normal site-packages "
-                "is not writeable")
-    return True
-
-
-def warn_deprecated_install_options(requirement_set, options):
-    # type: (RequirementSet, Optional[List[str]]) -> None
-    """If any location-changing --install-option arguments were passed for
-    requirements or on the command-line, then show a deprecation warning.
-    """
-    def format_options(option_names):
-        # type: (Iterable[str]) -> List[str]
-        return ["--{}".format(name.replace("_", "-")) for name in option_names]
-
-    requirements = (
-        requirement_set.unnamed_requirements +
-        list(requirement_set.requirements.values())
-    )
-
-    offenders = []
-
-    for requirement in requirements:
-        install_options = requirement.options.get("install_options", [])
-        location_options = parse_distutils_args(install_options)
-        if location_options:
-            offenders.append(
-                "{!r} from {}".format(
-                    format_options(location_options.keys()), requirement
-                )
-            )
-
-    if options:
-        location_options = parse_distutils_args(options)
-        if location_options:
-            offenders.append(
-                "{!r} from command line".format(
-                    format_options(location_options.keys())
-                )
-            )
-
-    if not offenders:
-        return
-
-    deprecated(
-        reason=(
-            "Location-changing options found in --install-option: {}. "
-            "This configuration may cause unexpected behavior and is "
-            "unsupported.".format(
-                "; ".join(offenders)
-            )
-        ),
-        replacement=(
-            "using pip-level options like --user, --prefix, --root, and "
-            "--target"
-        ),
-        gone_in="20.2",
-        issue=7309,
-    )
-
-
-def create_env_error_message(error, show_traceback, using_user_site):
-    """Format an error message for an EnvironmentError
-
-    It may occur anytime during the execution of the install command.
-    """
-    parts = []
-
-    # Mention the error if we are not going to show a traceback
-    parts.append("Could not install packages due to an EnvironmentError")
-    if not show_traceback:
-        parts.append(": ")
-        parts.append(str(error))
-    else:
-        parts.append(".")
-
-    # Spilt the error indication from a helper message (if any)
-    parts[-1] += "\n"
-
-    # Suggest useful actions to the user:
-    #  (1) using user site-packages or (2) verifying the permissions
-    if error.errno == errno.EACCES:
-        user_option_part = "Consider using the `--user` option"
-        permissions_part = "Check the permissions"
-
-        if not using_user_site:
-            parts.extend([
-                user_option_part, " or ",
-                permissions_part.lower(),
-            ])
-        else:
-            parts.append(permissions_part)
-        parts.append(".\n")
-
-    return "".join(parts).strip() + "\n"
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/list.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/list.py
deleted file mode 100644
index d0062063e7be3e3fa1f09452e793eceafc1b2343..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/list.py
+++ /dev/null
@@ -1,315 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import json
-import logging
-
-from pip._vendor import six
-from pip._vendor.six.moves import zip_longest
-
-from pip._internal.cli import cmdoptions
-from pip._internal.cli.req_command import IndexGroupCommand
-from pip._internal.exceptions import CommandError
-from pip._internal.index.package_finder import PackageFinder
-from pip._internal.models.selection_prefs import SelectionPreferences
-from pip._internal.self_outdated_check import make_link_collector
-from pip._internal.utils.misc import (
-    dist_is_editable,
-    get_installed_distributions,
-    write_output,
-)
-from pip._internal.utils.packaging import get_installer
-
-from pip._vendor.packaging.version import parse
-
-logger = logging.getLogger(__name__)
-
-
-class ListCommand(IndexGroupCommand):
-    """
-    List installed packages, including editables.
-
-    Packages are listed in a case-insensitive sorted order.
-    """
-
-    usage = """
-      %prog [options]"""
-
-    def __init__(self, *args, **kw):
-        super(ListCommand, self).__init__(*args, **kw)
-
-        cmd_opts = self.cmd_opts
-
-        cmd_opts.add_option(
-            '-o', '--outdated',
-            action='store_true',
-            default=False,
-            help='List outdated packages')
-        cmd_opts.add_option(
-            '-u', '--uptodate',
-            action='store_true',
-            default=False,
-            help='List uptodate packages')
-        cmd_opts.add_option(
-            '-e', '--editable',
-            action='store_true',
-            default=False,
-            help='List editable projects.')
-        cmd_opts.add_option(
-            '-l', '--local',
-            action='store_true',
-            default=False,
-            help=('If in a virtualenv that has global access, do not list '
-                  'globally-installed packages.'),
-        )
-        self.cmd_opts.add_option(
-            '--user',
-            dest='user',
-            action='store_true',
-            default=False,
-            help='Only output packages installed in user-site.')
-        cmd_opts.add_option(cmdoptions.list_path())
-        cmd_opts.add_option(
-            '--pre',
-            action='store_true',
-            default=False,
-            help=("Include pre-release and development versions. By default, "
-                  "pip only finds stable versions."),
-        )
-
-        cmd_opts.add_option(
-            '--format',
-            action='store',
-            dest='list_format',
-            default="columns",
-            choices=('columns', 'freeze', 'json'),
-            help="Select the output format among: columns (default), freeze, "
-                 "or json",
-        )
-
-        cmd_opts.add_option(
-            '--not-required',
-            action='store_true',
-            dest='not_required',
-            help="List packages that are not dependencies of "
-                 "installed packages.",
-        )
-
-        cmd_opts.add_option(
-            '--exclude-editable',
-            action='store_false',
-            dest='include_editable',
-            help='Exclude editable package from output.',
-        )
-        cmd_opts.add_option(
-            '--include-editable',
-            action='store_true',
-            dest='include_editable',
-            help='Include editable package from output.',
-            default=True,
-        )
-        index_opts = cmdoptions.make_option_group(
-            cmdoptions.index_group, self.parser
-        )
-
-        self.parser.insert_option_group(0, index_opts)
-        self.parser.insert_option_group(0, cmd_opts)
-
-    def _build_package_finder(self, options, session):
-        """
-        Create a package finder appropriate to this list command.
-        """
-        link_collector = make_link_collector(session, options=options)
-
-        # Pass allow_yanked=False to ignore yanked versions.
-        selection_prefs = SelectionPreferences(
-            allow_yanked=False,
-            allow_all_prereleases=options.pre,
-        )
-
-        return PackageFinder.create(
-            link_collector=link_collector,
-            selection_prefs=selection_prefs,
-        )
-
-    def run(self, options, args):
-        if options.outdated and options.uptodate:
-            raise CommandError(
-                "Options --outdated and --uptodate cannot be combined.")
-
-        cmdoptions.check_list_path_option(options)
-
-        packages = get_installed_distributions(
-            local_only=options.local,
-            user_only=options.user,
-            editables_only=options.editable,
-            include_editables=options.include_editable,
-            paths=options.path,
-        )
-
-        # get_not_required must be called firstly in order to find and
-        # filter out all dependencies correctly. Otherwise a package
-        # can't be identified as requirement because some parent packages
-        # could be filtered out before.
-        if options.not_required:
-            packages = self.get_not_required(packages, options)
-
-        if options.outdated:
-            packages = self.get_outdated(packages, options)
-        elif options.uptodate:
-            packages = self.get_uptodate(packages, options)
-
-        self.output_package_listing(packages, options)
-
-    def get_outdated(self, packages, options):
-        return [
-            dist for dist in self.iter_packages_latest_infos(packages, options)
-            if parse(str(dist.latest_version)) > parse(str(dist.parsed_version))
-        ]
-
-    def get_uptodate(self, packages, options):
-        return [
-            dist for dist in self.iter_packages_latest_infos(packages, options)
-            if parse(str(dist.latest_version)) == parse(str(dist.parsed_version))
-        ]
-
-    def get_not_required(self, packages, options):
-        dep_keys = set()
-        for dist in packages:
-            dep_keys.update(requirement.key for requirement in dist.requires())
-        return {pkg for pkg in packages if pkg.key not in dep_keys}
-
-    def iter_packages_latest_infos(self, packages, options):
-        with self._build_session(options) as session:
-            finder = self._build_package_finder(options, session)
-
-            for dist in packages:
-                typ = 'unknown'
-                all_candidates = finder.find_all_candidates(dist.key)
-                if not options.pre:
-                    # Remove prereleases
-                    all_candidates = [candidate for candidate in all_candidates
-                                      if not candidate.version.is_prerelease]
-
-                evaluator = finder.make_candidate_evaluator(
-                    project_name=dist.project_name,
-                )
-                best_candidate = evaluator.sort_best_candidate(all_candidates)
-                if best_candidate is None:
-                    continue
-
-                remote_version = best_candidate.version
-                if best_candidate.link.is_wheel:
-                    typ = 'wheel'
-                else:
-                    typ = 'sdist'
-                # This is dirty but makes the rest of the code much cleaner
-                dist.latest_version = remote_version
-                dist.latest_filetype = typ
-                yield dist
-
-    def output_package_listing(self, packages, options):
-        packages = sorted(
-            packages,
-            key=lambda dist: dist.project_name.lower(),
-        )
-        if options.list_format == 'columns' and packages:
-            data, header = format_for_columns(packages, options)
-            self.output_package_listing_columns(data, header)
-        elif options.list_format == 'freeze':
-            for dist in packages:
-                if options.verbose >= 1:
-                    write_output("%s==%s (%s)", dist.project_name,
-                                 dist.version, dist.location)
-                else:
-                    write_output("%s==%s", dist.project_name, dist.version)
-        elif options.list_format == 'json':
-            write_output(format_for_json(packages, options))
-
-    def output_package_listing_columns(self, data, header):
-        # insert the header first: we need to know the size of column names
-        if len(data) > 0:
-            data.insert(0, header)
-
-        pkg_strings, sizes = tabulate(data)
-
-        # Create and add a separator.
-        if len(data) > 0:
-            pkg_strings.insert(1, " ".join(map(lambda x: '-' * x, sizes)))
-
-        for val in pkg_strings:
-            write_output(val)
-
-
-def tabulate(vals):
-    # From pfmoore on GitHub:
-    # https://github.com/pypa/pip/issues/3651#issuecomment-216932564
-    assert len(vals) > 0
-
-    sizes = [0] * max(len(x) for x in vals)
-    for row in vals:
-        sizes = [max(s, len(str(c))) for s, c in zip_longest(sizes, row)]
-
-    result = []
-    for row in vals:
-        display = " ".join([str(c).ljust(s) if c is not None else ''
-                            for s, c in zip_longest(sizes, row)])
-        result.append(display)
-
-    return result, sizes
-
-
-def format_for_columns(pkgs, options):
-    """
-    Convert the package data into something usable
-    by output_package_listing_columns.
-    """
-    running_outdated = options.outdated
-    # Adjust the header for the `pip list --outdated` case.
-    if running_outdated:
-        header = ["Package", "Version", "Latest", "Type"]
-    else:
-        header = ["Package", "Version"]
-
-    data = []
-    if options.verbose >= 1 or any(dist_is_editable(x) for x in pkgs):
-        header.append("Location")
-    if options.verbose >= 1:
-        header.append("Installer")
-
-    for proj in pkgs:
-        # if we're working on the 'outdated' list, separate out the
-        # latest_version and type
-        row = [proj.project_name, proj.version]
-
-        if running_outdated:
-            row.append(proj.latest_version)
-            row.append(proj.latest_filetype)
-
-        if options.verbose >= 1 or dist_is_editable(proj):
-            row.append(proj.location)
-        if options.verbose >= 1:
-            row.append(get_installer(proj))
-
-        data.append(row)
-
-    return data, header
-
-
-def format_for_json(packages, options):
-    data = []
-    for dist in packages:
-        info = {
-            'name': dist.project_name,
-            'version': six.text_type(dist.version),
-        }
-        if options.verbose >= 1:
-            info['location'] = dist.location
-            info['installer'] = get_installer(dist)
-        if options.outdated:
-            info['latest_version'] = six.text_type(dist.latest_version)
-            info['latest_filetype'] = dist.latest_filetype
-        data.append(info)
-    return json.dumps(data)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/search.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/search.py
deleted file mode 100644
index 2e880eec2242a0aec7a2a6b53cde16fa106fd683..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/search.py
+++ /dev/null
@@ -1,145 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import sys
-import textwrap
-from collections import OrderedDict
-
-from pip._vendor import pkg_resources
-from pip._vendor.packaging.version import parse as parse_version
-# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
-#       why we ignore the type on this import
-from pip._vendor.six.moves import xmlrpc_client  # type: ignore
-
-from pip._internal.cli.base_command import Command
-from pip._internal.cli.req_command import SessionCommandMixin
-from pip._internal.cli.status_codes import NO_MATCHES_FOUND, SUCCESS
-from pip._internal.exceptions import CommandError
-from pip._internal.models.index import PyPI
-from pip._internal.network.xmlrpc import PipXmlrpcTransport
-from pip._internal.utils.compat import get_terminal_size
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import write_output
-
-logger = logging.getLogger(__name__)
-
-
-class SearchCommand(Command, SessionCommandMixin):
-    """Search for PyPI packages whose name or summary contains ."""
-
-    usage = """
-      %prog [options] """
-    ignore_require_venv = True
-
-    def __init__(self, *args, **kw):
-        super(SearchCommand, self).__init__(*args, **kw)
-        self.cmd_opts.add_option(
-            '-i', '--index',
-            dest='index',
-            metavar='URL',
-            default=PyPI.pypi_url,
-            help='Base URL of Python Package Index (default %default)')
-
-        self.parser.insert_option_group(0, self.cmd_opts)
-
-    def run(self, options, args):
-        if not args:
-            raise CommandError('Missing required argument (search query).')
-        query = args
-        pypi_hits = self.search(query, options)
-        hits = transform_hits(pypi_hits)
-
-        terminal_width = None
-        if sys.stdout.isatty():
-            terminal_width = get_terminal_size()[0]
-
-        print_results(hits, terminal_width=terminal_width)
-        if pypi_hits:
-            return SUCCESS
-        return NO_MATCHES_FOUND
-
-    def search(self, query, options):
-        index_url = options.index
-
-        session = self.get_default_session(options)
-
-        transport = PipXmlrpcTransport(index_url, session)
-        pypi = xmlrpc_client.ServerProxy(index_url, transport)
-        hits = pypi.search({'name': query, 'summary': query}, 'or')
-        return hits
-
-
-def transform_hits(hits):
-    """
-    The list from pypi is really a list of versions. We want a list of
-    packages with the list of versions stored inline. This converts the
-    list from pypi into one we can use.
-    """
-    packages = OrderedDict()
-    for hit in hits:
-        name = hit['name']
-        summary = hit['summary']
-        version = hit['version']
-
-        if name not in packages.keys():
-            packages[name] = {
-                'name': name,
-                'summary': summary,
-                'versions': [version],
-            }
-        else:
-            packages[name]['versions'].append(version)
-
-            # if this is the highest version, replace summary and score
-            if version == highest_version(packages[name]['versions']):
-                packages[name]['summary'] = summary
-
-    return list(packages.values())
-
-
-def print_results(hits, name_column_width=None, terminal_width=None):
-    if not hits:
-        return
-    if name_column_width is None:
-        name_column_width = max([
-            len(hit['name']) + len(highest_version(hit.get('versions', ['-'])))
-            for hit in hits
-        ]) + 4
-
-    installed_packages = [p.project_name for p in pkg_resources.working_set]
-    for hit in hits:
-        name = hit['name']
-        summary = hit['summary'] or ''
-        latest = highest_version(hit.get('versions', ['-']))
-        if terminal_width is not None:
-            target_width = terminal_width - name_column_width - 5
-            if target_width > 10:
-                # wrap and indent summary to fit terminal
-                summary = textwrap.wrap(summary, target_width)
-                summary = ('\n' + ' ' * (name_column_width + 3)).join(summary)
-
-        line = '%-*s - %s' % (name_column_width,
-                              '%s (%s)' % (name, latest), summary)
-        try:
-            write_output(line)
-            if name in installed_packages:
-                dist = pkg_resources.get_distribution(name)
-                with indent_log():
-                    if dist.version == latest:
-                        write_output('INSTALLED: %s (latest)', dist.version)
-                    else:
-                        write_output('INSTALLED: %s', dist.version)
-                        if parse_version(latest).pre:
-                            write_output('LATEST:    %s (pre-release; install'
-                                         ' with "pip install --pre")', latest)
-                        else:
-                            write_output('LATEST:    %s', latest)
-        except UnicodeEncodeError:
-            pass
-
-
-def highest_version(versions):
-    return max(versions, key=parse_version)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/show.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/show.py
deleted file mode 100644
index a46b08eeb3d22852421b2b6c8b1b15ce12aaa9a3..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/show.py
+++ /dev/null
@@ -1,180 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-from email.parser import FeedParser
-
-from pip._vendor import pkg_resources
-from pip._vendor.packaging.utils import canonicalize_name
-
-from pip._internal.cli.base_command import Command
-from pip._internal.cli.status_codes import ERROR, SUCCESS
-from pip._internal.utils.misc import write_output
-
-logger = logging.getLogger(__name__)
-
-
-class ShowCommand(Command):
-    """
-    Show information about one or more installed packages.
-
-    The output is in RFC-compliant mail header format.
-    """
-
-    usage = """
-      %prog [options]  ..."""
-    ignore_require_venv = True
-
-    def __init__(self, *args, **kw):
-        super(ShowCommand, self).__init__(*args, **kw)
-        self.cmd_opts.add_option(
-            '-f', '--files',
-            dest='files',
-            action='store_true',
-            default=False,
-            help='Show the full list of installed files for each package.')
-
-        self.parser.insert_option_group(0, self.cmd_opts)
-
-    def run(self, options, args):
-        if not args:
-            logger.warning('ERROR: Please provide a package name or names.')
-            return ERROR
-        query = args
-
-        results = search_packages_info(query)
-        if not print_results(
-                results, list_files=options.files, verbose=options.verbose):
-            return ERROR
-        return SUCCESS
-
-
-def search_packages_info(query):
-    """
-    Gather details from installed distributions. Print distribution name,
-    version, location, and installed files. Installed files requires a
-    pip generated 'installed-files.txt' in the distributions '.egg-info'
-    directory.
-    """
-    installed = {}
-    for p in pkg_resources.working_set:
-        installed[canonicalize_name(p.project_name)] = p
-
-    query_names = [canonicalize_name(name) for name in query]
-    missing = sorted(
-        [name for name, pkg in zip(query, query_names) if pkg not in installed]
-    )
-    if missing:
-        logger.warning('Package(s) not found: %s', ', '.join(missing))
-
-    def get_requiring_packages(package_name):
-        canonical_name = canonicalize_name(package_name)
-        return [
-            pkg.project_name for pkg in pkg_resources.working_set
-            if canonical_name in
-               [canonicalize_name(required.name) for required in
-                pkg.requires()]
-        ]
-
-    for dist in [installed[pkg] for pkg in query_names if pkg in installed]:
-        package = {
-            'name': dist.project_name,
-            'version': dist.version,
-            'location': dist.location,
-            'requires': [dep.project_name for dep in dist.requires()],
-            'required_by': get_requiring_packages(dist.project_name)
-        }
-        file_list = None
-        metadata = None
-        if isinstance(dist, pkg_resources.DistInfoDistribution):
-            # RECORDs should be part of .dist-info metadatas
-            if dist.has_metadata('RECORD'):
-                lines = dist.get_metadata_lines('RECORD')
-                paths = [l.split(',')[0] for l in lines]
-                paths = [os.path.join(dist.location, p) for p in paths]
-                file_list = [os.path.relpath(p, dist.location) for p in paths]
-
-            if dist.has_metadata('METADATA'):
-                metadata = dist.get_metadata('METADATA')
-        else:
-            # Otherwise use pip's log for .egg-info's
-            if dist.has_metadata('installed-files.txt'):
-                paths = dist.get_metadata_lines('installed-files.txt')
-                paths = [os.path.join(dist.egg_info, p) for p in paths]
-                file_list = [os.path.relpath(p, dist.location) for p in paths]
-
-            if dist.has_metadata('PKG-INFO'):
-                metadata = dist.get_metadata('PKG-INFO')
-
-        if dist.has_metadata('entry_points.txt'):
-            entry_points = dist.get_metadata_lines('entry_points.txt')
-            package['entry_points'] = entry_points
-
-        if dist.has_metadata('INSTALLER'):
-            for line in dist.get_metadata_lines('INSTALLER'):
-                if line.strip():
-                    package['installer'] = line.strip()
-                    break
-
-        # @todo: Should pkg_resources.Distribution have a
-        # `get_pkg_info` method?
-        feed_parser = FeedParser()
-        feed_parser.feed(metadata)
-        pkg_info_dict = feed_parser.close()
-        for key in ('metadata-version', 'summary',
-                    'home-page', 'author', 'author-email', 'license'):
-            package[key] = pkg_info_dict.get(key)
-
-        # It looks like FeedParser cannot deal with repeated headers
-        classifiers = []
-        for line in metadata.splitlines():
-            if line.startswith('Classifier: '):
-                classifiers.append(line[len('Classifier: '):])
-        package['classifiers'] = classifiers
-
-        if file_list:
-            package['files'] = sorted(file_list)
-        yield package
-
-
-def print_results(distributions, list_files=False, verbose=False):
-    """
-    Print the informations from installed distributions found.
-    """
-    results_printed = False
-    for i, dist in enumerate(distributions):
-        results_printed = True
-        if i > 0:
-            write_output("---")
-
-        write_output("Name: %s", dist.get('name', ''))
-        write_output("Version: %s", dist.get('version', ''))
-        write_output("Summary: %s", dist.get('summary', ''))
-        write_output("Home-page: %s", dist.get('home-page', ''))
-        write_output("Author: %s", dist.get('author', ''))
-        write_output("Author-email: %s", dist.get('author-email', ''))
-        write_output("License: %s", dist.get('license', ''))
-        write_output("Location: %s", dist.get('location', ''))
-        write_output("Requires: %s", ', '.join(dist.get('requires', [])))
-        write_output("Required-by: %s", ', '.join(dist.get('required_by', [])))
-
-        if verbose:
-            write_output("Metadata-Version: %s",
-                         dist.get('metadata-version', ''))
-            write_output("Installer: %s", dist.get('installer', ''))
-            write_output("Classifiers:")
-            for classifier in dist.get('classifiers', []):
-                write_output("  %s", classifier)
-            write_output("Entry-points:")
-            for entry in dist.get('entry_points', []):
-                write_output("  %s", entry.strip())
-        if list_files:
-            write_output("Files:")
-            for line in dist.get('files', []):
-                write_output("  %s", line.strip())
-            if "files" not in dist:
-                write_output("Cannot locate installed-files.txt")
-    return results_printed
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py
deleted file mode 100644
index 1bde414a6c1a5f4b9ef5b990f22b334a9b0a71b6..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-from pip._vendor.packaging.utils import canonicalize_name
-
-from pip._internal.cli.base_command import Command
-from pip._internal.cli.req_command import SessionCommandMixin
-from pip._internal.exceptions import InstallationError
-from pip._internal.req import parse_requirements
-from pip._internal.req.constructors import install_req_from_line
-from pip._internal.utils.misc import protect_pip_from_modification_on_windows
-
-
-class UninstallCommand(Command, SessionCommandMixin):
-    """
-    Uninstall packages.
-
-    pip is able to uninstall most installed packages. Known exceptions are:
-
-    - Pure distutils packages installed with ``python setup.py install``, which
-      leave behind no metadata to determine what files were installed.
-    - Script wrappers installed by ``python setup.py develop``.
-    """
-
-    usage = """
-      %prog [options]  ...
-      %prog [options] -r  ..."""
-
-    def __init__(self, *args, **kw):
-        super(UninstallCommand, self).__init__(*args, **kw)
-        self.cmd_opts.add_option(
-            '-r', '--requirement',
-            dest='requirements',
-            action='append',
-            default=[],
-            metavar='file',
-            help='Uninstall all the packages listed in the given requirements '
-                 'file.  This option can be used multiple times.',
-        )
-        self.cmd_opts.add_option(
-            '-y', '--yes',
-            dest='yes',
-            action='store_true',
-            help="Don't ask for confirmation of uninstall deletions.")
-
-        self.parser.insert_option_group(0, self.cmd_opts)
-
-    def run(self, options, args):
-        session = self.get_default_session(options)
-
-        reqs_to_uninstall = {}
-        for name in args:
-            req = install_req_from_line(
-                name, isolated=options.isolated_mode,
-            )
-            if req.name:
-                reqs_to_uninstall[canonicalize_name(req.name)] = req
-        for filename in options.requirements:
-            for req in parse_requirements(
-                    filename,
-                    options=options,
-                    session=session):
-                if req.name:
-                    reqs_to_uninstall[canonicalize_name(req.name)] = req
-        if not reqs_to_uninstall:
-            raise InstallationError(
-                'You must give at least one requirement to %(name)s (see '
-                '"pip help %(name)s")' % dict(name=self.name)
-            )
-
-        protect_pip_from_modification_on_windows(
-            modifying_pip="pip" in reqs_to_uninstall
-        )
-
-        for req in reqs_to_uninstall.values():
-            uninstall_pathset = req.uninstall(
-                auto_confirm=options.yes, verbose=self.verbosity > 0,
-            )
-            if uninstall_pathset:
-                uninstall_pathset.commit()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/commands/wheel.py b/venv/lib/python3.8/site-packages/pip/_internal/commands/wheel.py
deleted file mode 100644
index eb44bcee45930d10654d5bdc6af5658aef01bc41..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/commands/wheel.py
+++ /dev/null
@@ -1,197 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-import shutil
-
-from pip._internal.cache import WheelCache
-from pip._internal.cli import cmdoptions
-from pip._internal.cli.req_command import RequirementCommand
-from pip._internal.exceptions import CommandError, PreviousBuildDirError
-from pip._internal.req import RequirementSet
-from pip._internal.req.req_tracker import get_requirement_tracker
-from pip._internal.utils.misc import ensure_dir, normalize_path
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.wheel_builder import build, should_build_for_wheel_command
-
-if MYPY_CHECK_RUNNING:
-    from optparse import Values
-    from typing import Any, List
-
-
-logger = logging.getLogger(__name__)
-
-
-class WheelCommand(RequirementCommand):
-    """
-    Build Wheel archives for your requirements and dependencies.
-
-    Wheel is a built-package format, and offers the advantage of not
-    recompiling your software during every install. For more details, see the
-    wheel docs: https://wheel.readthedocs.io/en/latest/
-
-    Requirements: setuptools>=0.8, and wheel.
-
-    'pip wheel' uses the bdist_wheel setuptools extension from the wheel
-    package to build individual wheels.
-
-    """
-
-    usage = """
-      %prog [options]  ...
-      %prog [options] -r  ...
-      %prog [options] [-e]  ...
-      %prog [options] [-e]  ...
-      %prog [options]  ..."""
-
-    def __init__(self, *args, **kw):
-        super(WheelCommand, self).__init__(*args, **kw)
-
-        cmd_opts = self.cmd_opts
-
-        cmd_opts.add_option(
-            '-w', '--wheel-dir',
-            dest='wheel_dir',
-            metavar='dir',
-            default=os.curdir,
-            help=("Build wheels into , where the default is the "
-                  "current working directory."),
-        )
-        cmd_opts.add_option(cmdoptions.no_binary())
-        cmd_opts.add_option(cmdoptions.only_binary())
-        cmd_opts.add_option(cmdoptions.prefer_binary())
-        cmd_opts.add_option(
-            '--build-option',
-            dest='build_options',
-            metavar='options',
-            action='append',
-            help="Extra arguments to be supplied to 'setup.py bdist_wheel'.",
-        )
-        cmd_opts.add_option(cmdoptions.no_build_isolation())
-        cmd_opts.add_option(cmdoptions.use_pep517())
-        cmd_opts.add_option(cmdoptions.no_use_pep517())
-        cmd_opts.add_option(cmdoptions.constraints())
-        cmd_opts.add_option(cmdoptions.editable())
-        cmd_opts.add_option(cmdoptions.requirements())
-        cmd_opts.add_option(cmdoptions.src())
-        cmd_opts.add_option(cmdoptions.ignore_requires_python())
-        cmd_opts.add_option(cmdoptions.no_deps())
-        cmd_opts.add_option(cmdoptions.build_dir())
-        cmd_opts.add_option(cmdoptions.progress_bar())
-
-        cmd_opts.add_option(
-            '--global-option',
-            dest='global_options',
-            action='append',
-            metavar='options',
-            help="Extra global options to be supplied to the setup.py "
-            "call before the 'bdist_wheel' command.")
-
-        cmd_opts.add_option(
-            '--pre',
-            action='store_true',
-            default=False,
-            help=("Include pre-release and development versions. By default, "
-                  "pip only finds stable versions."),
-        )
-
-        cmd_opts.add_option(cmdoptions.no_clean())
-        cmd_opts.add_option(cmdoptions.require_hashes())
-
-        index_opts = cmdoptions.make_option_group(
-            cmdoptions.index_group,
-            self.parser,
-        )
-
-        self.parser.insert_option_group(0, index_opts)
-        self.parser.insert_option_group(0, cmd_opts)
-
-    def run(self, options, args):
-        # type: (Values, List[Any]) -> None
-        cmdoptions.check_install_build_global(options)
-
-        session = self.get_default_session(options)
-
-        finder = self._build_package_finder(options, session)
-        build_delete = (not (options.no_clean or options.build_dir))
-        wheel_cache = WheelCache(options.cache_dir, options.format_control)
-
-        options.wheel_dir = normalize_path(options.wheel_dir)
-        ensure_dir(options.wheel_dir)
-
-        with get_requirement_tracker() as req_tracker, TempDirectory(
-            options.build_dir, delete=build_delete, kind="wheel"
-        ) as directory:
-
-            requirement_set = RequirementSet()
-
-            try:
-                self.populate_requirement_set(
-                    requirement_set, args, options, finder, session,
-                    wheel_cache
-                )
-
-                preparer = self.make_requirement_preparer(
-                    temp_build_dir=directory,
-                    options=options,
-                    req_tracker=req_tracker,
-                    session=session,
-                    finder=finder,
-                    wheel_download_dir=options.wheel_dir,
-                    use_user_site=False,
-                )
-
-                resolver = self.make_resolver(
-                    preparer=preparer,
-                    finder=finder,
-                    options=options,
-                    wheel_cache=wheel_cache,
-                    ignore_requires_python=options.ignore_requires_python,
-                    use_pep517=options.use_pep517,
-                )
-
-                self.trace_basic_info(finder)
-
-                resolver.resolve(requirement_set)
-
-                reqs_to_build = [
-                    r for r in requirement_set.requirements.values()
-                    if should_build_for_wheel_command(r)
-                ]
-
-                # build wheels
-                build_successes, build_failures = build(
-                    reqs_to_build,
-                    wheel_cache=wheel_cache,
-                    build_options=options.build_options or [],
-                    global_options=options.global_options or [],
-                )
-                for req in build_successes:
-                    assert req.link and req.link.is_wheel
-                    assert req.local_file_path
-                    # copy from cache to target directory
-                    try:
-                        shutil.copy(req.local_file_path, options.wheel_dir)
-                    except OSError as e:
-                        logger.warning(
-                            "Building wheel for %s failed: %s",
-                            req.name, e,
-                        )
-                        build_failures.append(req)
-                if len(build_failures) != 0:
-                    raise CommandError(
-                        "Failed to build one or more wheels"
-                    )
-            except PreviousBuildDirError:
-                options.no_clean = True
-                raise
-            finally:
-                if not options.no_clean:
-                    requirement_set.cleanup_files()
-                    wheel_cache.cleanup()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/configuration.py b/venv/lib/python3.8/site-packages/pip/_internal/configuration.py
deleted file mode 100644
index f09a1ae25c2b58ad5d15040efc4cbd99658e54b6..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/configuration.py
+++ /dev/null
@@ -1,422 +0,0 @@
-"""Configuration management setup
-
-Some terminology:
-- name
-  As written in config files.
-- value
-  Value associated with a name
-- key
-  Name combined with it's section (section.name)
-- variant
-  A single word describing where the configuration key-value pair came from
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-import locale
-import logging
-import os
-import sys
-
-from pip._vendor.six.moves import configparser
-
-from pip._internal.exceptions import (
-    ConfigurationError,
-    ConfigurationFileCouldNotBeLoaded,
-)
-from pip._internal.utils import appdirs
-from pip._internal.utils.compat import WINDOWS, expanduser
-from pip._internal.utils.misc import ensure_dir, enum
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Any, Dict, Iterable, List, NewType, Optional, Tuple
-    )
-
-    RawConfigParser = configparser.RawConfigParser  # Shorthand
-    Kind = NewType("Kind", str)
-
-logger = logging.getLogger(__name__)
-
-
-# NOTE: Maybe use the optionx attribute to normalize keynames.
-def _normalize_name(name):
-    # type: (str) -> str
-    """Make a name consistent regardless of source (environment or file)
-    """
-    name = name.lower().replace('_', '-')
-    if name.startswith('--'):
-        name = name[2:]  # only prefer long opts
-    return name
-
-
-def _disassemble_key(name):
-    # type: (str) -> List[str]
-    if "." not in name:
-        error_message = (
-            "Key does not contain dot separated section and key. "
-            "Perhaps you wanted to use 'global.{}' instead?"
-        ).format(name)
-        raise ConfigurationError(error_message)
-    return name.split(".", 1)
-
-
-# The kinds of configurations there are.
-kinds = enum(
-    USER="user",        # User Specific
-    GLOBAL="global",    # System Wide
-    SITE="site",        # [Virtual] Environment Specific
-    ENV="env",          # from PIP_CONFIG_FILE
-    ENV_VAR="env-var",  # from Environment Variables
-)
-
-
-CONFIG_BASENAME = 'pip.ini' if WINDOWS else 'pip.conf'
-
-
-def get_configuration_files():
-    # type: () -> Dict[Kind, List[str]]
-    global_config_files = [
-        os.path.join(path, CONFIG_BASENAME)
-        for path in appdirs.site_config_dirs('pip')
-    ]
-
-    site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME)
-    legacy_config_file = os.path.join(
-        expanduser('~'),
-        'pip' if WINDOWS else '.pip',
-        CONFIG_BASENAME,
-    )
-    new_config_file = os.path.join(
-        appdirs.user_config_dir("pip"), CONFIG_BASENAME
-    )
-    return {
-        kinds.GLOBAL: global_config_files,
-        kinds.SITE: [site_config_file],
-        kinds.USER: [legacy_config_file, new_config_file],
-    }
-
-
-class Configuration(object):
-    """Handles management of configuration.
-
-    Provides an interface to accessing and managing configuration files.
-
-    This class converts provides an API that takes "section.key-name" style
-    keys and stores the value associated with it as "key-name" under the
-    section "section".
-
-    This allows for a clean interface wherein the both the section and the
-    key-name are preserved in an easy to manage form in the configuration files
-    and the data stored is also nice.
-    """
-
-    def __init__(self, isolated, load_only=None):
-        # type: (bool, Kind) -> None
-        super(Configuration, self).__init__()
-
-        _valid_load_only = [kinds.USER, kinds.GLOBAL, kinds.SITE, None]
-        if load_only not in _valid_load_only:
-            raise ConfigurationError(
-                "Got invalid value for load_only - should be one of {}".format(
-                    ", ".join(map(repr, _valid_load_only[:-1]))
-                )
-            )
-        self.isolated = isolated  # type: bool
-        self.load_only = load_only  # type: Optional[Kind]
-
-        # The order here determines the override order.
-        self._override_order = [
-            kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR
-        ]
-
-        self._ignore_env_names = ["version", "help"]
-
-        # Because we keep track of where we got the data from
-        self._parsers = {
-            variant: [] for variant in self._override_order
-        }  # type: Dict[Kind, List[Tuple[str, RawConfigParser]]]
-        self._config = {
-            variant: {} for variant in self._override_order
-        }  # type: Dict[Kind, Dict[str, Any]]
-        self._modified_parsers = []  # type: List[Tuple[str, RawConfigParser]]
-
-    def load(self):
-        # type: () -> None
-        """Loads configuration from configuration files and environment
-        """
-        self._load_config_files()
-        if not self.isolated:
-            self._load_environment_vars()
-
-    def get_file_to_edit(self):
-        # type: () -> Optional[str]
-        """Returns the file with highest priority in configuration
-        """
-        assert self.load_only is not None, \
-            "Need to be specified a file to be editing"
-
-        try:
-            return self._get_parser_to_modify()[0]
-        except IndexError:
-            return None
-
-    def items(self):
-        # type: () -> Iterable[Tuple[str, Any]]
-        """Returns key-value pairs like dict.items() representing the loaded
-        configuration
-        """
-        return self._dictionary.items()
-
-    def get_value(self, key):
-        # type: (str) -> Any
-        """Get a value from the configuration.
-        """
-        try:
-            return self._dictionary[key]
-        except KeyError:
-            raise ConfigurationError("No such key - {}".format(key))
-
-    def set_value(self, key, value):
-        # type: (str, Any) -> None
-        """Modify a value in the configuration.
-        """
-        self._ensure_have_load_only()
-
-        fname, parser = self._get_parser_to_modify()
-
-        if parser is not None:
-            section, name = _disassemble_key(key)
-
-            # Modify the parser and the configuration
-            if not parser.has_section(section):
-                parser.add_section(section)
-            parser.set(section, name, value)
-
-        self._config[self.load_only][key] = value
-        self._mark_as_modified(fname, parser)
-
-    def unset_value(self, key):
-        # type: (str) -> None
-        """Unset a value in the configuration.
-        """
-        self._ensure_have_load_only()
-
-        if key not in self._config[self.load_only]:
-            raise ConfigurationError("No such key - {}".format(key))
-
-        fname, parser = self._get_parser_to_modify()
-
-        if parser is not None:
-            section, name = _disassemble_key(key)
-
-            # Remove the key in the parser
-            modified_something = False
-            if parser.has_section(section):
-                # Returns whether the option was removed or not
-                modified_something = parser.remove_option(section, name)
-
-            if modified_something:
-                # name removed from parser, section may now be empty
-                section_iter = iter(parser.items(section))
-                try:
-                    val = next(section_iter)
-                except StopIteration:
-                    val = None
-
-                if val is None:
-                    parser.remove_section(section)
-
-                self._mark_as_modified(fname, parser)
-            else:
-                raise ConfigurationError(
-                    "Fatal Internal error [id=1]. Please report as a bug."
-                )
-
-        del self._config[self.load_only][key]
-
-    def save(self):
-        # type: () -> None
-        """Save the current in-memory state.
-        """
-        self._ensure_have_load_only()
-
-        for fname, parser in self._modified_parsers:
-            logger.info("Writing to %s", fname)
-
-            # Ensure directory exists.
-            ensure_dir(os.path.dirname(fname))
-
-            with open(fname, "w") as f:
-                parser.write(f)
-
-    #
-    # Private routines
-    #
-
-    def _ensure_have_load_only(self):
-        # type: () -> None
-        if self.load_only is None:
-            raise ConfigurationError("Needed a specific file to be modifying.")
-        logger.debug("Will be working with %s variant only", self.load_only)
-
-    @property
-    def _dictionary(self):
-        # type: () -> Dict[str, Any]
-        """A dictionary representing the loaded configuration.
-        """
-        # NOTE: Dictionaries are not populated if not loaded. So, conditionals
-        #       are not needed here.
-        retval = {}
-
-        for variant in self._override_order:
-            retval.update(self._config[variant])
-
-        return retval
-
-    def _load_config_files(self):
-        # type: () -> None
-        """Loads configuration from configuration files
-        """
-        config_files = dict(self._iter_config_files())
-        if config_files[kinds.ENV][0:1] == [os.devnull]:
-            logger.debug(
-                "Skipping loading configuration files due to "
-                "environment's PIP_CONFIG_FILE being os.devnull"
-            )
-            return
-
-        for variant, files in config_files.items():
-            for fname in files:
-                # If there's specific variant set in `load_only`, load only
-                # that variant, not the others.
-                if self.load_only is not None and variant != self.load_only:
-                    logger.debug(
-                        "Skipping file '%s' (variant: %s)", fname, variant
-                    )
-                    continue
-
-                parser = self._load_file(variant, fname)
-
-                # Keeping track of the parsers used
-                self._parsers[variant].append((fname, parser))
-
-    def _load_file(self, variant, fname):
-        # type: (Kind, str) -> RawConfigParser
-        logger.debug("For variant '%s', will try loading '%s'", variant, fname)
-        parser = self._construct_parser(fname)
-
-        for section in parser.sections():
-            items = parser.items(section)
-            self._config[variant].update(self._normalized_keys(section, items))
-
-        return parser
-
-    def _construct_parser(self, fname):
-        # type: (str) -> RawConfigParser
-        parser = configparser.RawConfigParser()
-        # If there is no such file, don't bother reading it but create the
-        # parser anyway, to hold the data.
-        # Doing this is useful when modifying and saving files, where we don't
-        # need to construct a parser.
-        if os.path.exists(fname):
-            try:
-                parser.read(fname)
-            except UnicodeDecodeError:
-                # See https://github.com/pypa/pip/issues/4963
-                raise ConfigurationFileCouldNotBeLoaded(
-                    reason="contains invalid {} characters".format(
-                        locale.getpreferredencoding(False)
-                    ),
-                    fname=fname,
-                )
-            except configparser.Error as error:
-                # See https://github.com/pypa/pip/issues/4893
-                raise ConfigurationFileCouldNotBeLoaded(error=error)
-        return parser
-
-    def _load_environment_vars(self):
-        # type: () -> None
-        """Loads configuration from environment variables
-        """
-        self._config[kinds.ENV_VAR].update(
-            self._normalized_keys(":env:", self._get_environ_vars())
-        )
-
-    def _normalized_keys(self, section, items):
-        # type: (str, Iterable[Tuple[str, Any]]) -> Dict[str, Any]
-        """Normalizes items to construct a dictionary with normalized keys.
-
-        This routine is where the names become keys and are made the same
-        regardless of source - configuration files or environment.
-        """
-        normalized = {}
-        for name, val in items:
-            key = section + "." + _normalize_name(name)
-            normalized[key] = val
-        return normalized
-
-    def _get_environ_vars(self):
-        # type: () -> Iterable[Tuple[str, str]]
-        """Returns a generator with all environmental vars with prefix PIP_"""
-        for key, val in os.environ.items():
-            should_be_yielded = (
-                key.startswith("PIP_") and
-                key[4:].lower() not in self._ignore_env_names
-            )
-            if should_be_yielded:
-                yield key[4:].lower(), val
-
-    # XXX: This is patched in the tests.
-    def _iter_config_files(self):
-        # type: () -> Iterable[Tuple[Kind, List[str]]]
-        """Yields variant and configuration files associated with it.
-
-        This should be treated like items of a dictionary.
-        """
-        # SMELL: Move the conditions out of this function
-
-        # environment variables have the lowest priority
-        config_file = os.environ.get('PIP_CONFIG_FILE', None)
-        if config_file is not None:
-            yield kinds.ENV, [config_file]
-        else:
-            yield kinds.ENV, []
-
-        config_files = get_configuration_files()
-
-        # at the base we have any global configuration
-        yield kinds.GLOBAL, config_files[kinds.GLOBAL]
-
-        # per-user configuration next
-        should_load_user_config = not self.isolated and not (
-            config_file and os.path.exists(config_file)
-        )
-        if should_load_user_config:
-            # The legacy config file is overridden by the new config file
-            yield kinds.USER, config_files[kinds.USER]
-
-        # finally virtualenv configuration first trumping others
-        yield kinds.SITE, config_files[kinds.SITE]
-
-    def _get_parser_to_modify(self):
-        # type: () -> Tuple[str, RawConfigParser]
-        # Determine which parser to modify
-        parsers = self._parsers[self.load_only]
-        if not parsers:
-            # This should not happen if everything works correctly.
-            raise ConfigurationError(
-                "Fatal Internal error [id=2]. Please report as a bug."
-            )
-
-        # Use the highest priority parser.
-        return parsers[-1]
-
-    # XXX: This is patched in the tests.
-    def _mark_as_modified(self, fname, parser):
-        # type: (str, RawConfigParser) -> None
-        file_parser_tuple = (fname, parser)
-        if file_parser_tuple not in self._modified_parsers:
-            self._modified_parsers.append(file_parser_tuple)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/distributions/__init__.py
deleted file mode 100644
index d5c1afc5bc1ffd09c0ce46f4f2f700a1b996fe47..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__init__.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from pip._internal.distributions.sdist import SourceDistribution
-from pip._internal.distributions.wheel import WheelDistribution
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from pip._internal.distributions.base import AbstractDistribution
-    from pip._internal.req.req_install import InstallRequirement
-
-
-def make_distribution_for_install_requirement(install_req):
-    # type: (InstallRequirement) -> AbstractDistribution
-    """Returns a Distribution for the given InstallRequirement
-    """
-    # Editable requirements will always be source distributions. They use the
-    # legacy logic until we create a modern standard for them.
-    if install_req.editable:
-        return SourceDistribution(install_req)
-
-    # If it's a wheel, it's a WheelDistribution
-    if install_req.is_wheel:
-        return WheelDistribution(install_req)
-
-    # Otherwise, a SourceDistribution
-    return SourceDistribution(install_req)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 70a0b82d27e008b0894c691e65e0c50cda16875b..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/base.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/base.cpython-38.pyc
deleted file mode 100644
index fb94e81256948e52abb798e341997992c366c979..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/base.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-38.pyc
deleted file mode 100644
index f8915507568df80d8be271beccbf7e5305a04592..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-38.pyc
deleted file mode 100644
index 1c19a3a4c788b14f1253ee02bddb88a3fbc6bfe7..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-38.pyc
deleted file mode 100644
index bf72af22431f54dfaab7f365e77db7c3c070e9c7..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/base.py b/venv/lib/python3.8/site-packages/pip/_internal/distributions/base.py
deleted file mode 100644
index b836b98d162abda775f4b0c2b132eac4cf58a22d..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/distributions/base.py
+++ /dev/null
@@ -1,45 +0,0 @@
-import abc
-
-from pip._vendor.six import add_metaclass
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional
-
-    from pip._vendor.pkg_resources import Distribution
-    from pip._internal.req import InstallRequirement
-    from pip._internal.index.package_finder import PackageFinder
-
-
-@add_metaclass(abc.ABCMeta)
-class AbstractDistribution(object):
-    """A base class for handling installable artifacts.
-
-    The requirements for anything installable are as follows:
-
-     - we must be able to determine the requirement name
-       (or we can't correctly handle the non-upgrade case).
-
-     - for packages with setup requirements, we must also be able
-       to determine their requirements without installing additional
-       packages (for the same reason as run-time dependencies)
-
-     - we must be able to create a Distribution object exposing the
-       above metadata.
-    """
-
-    def __init__(self, req):
-        # type: (InstallRequirement) -> None
-        super(AbstractDistribution, self).__init__()
-        self.req = req
-
-    @abc.abstractmethod
-    def get_pkg_resources_distribution(self):
-        # type: () -> Optional[Distribution]
-        raise NotImplementedError()
-
-    @abc.abstractmethod
-    def prepare_distribution_metadata(self, finder, build_isolation):
-        # type: (PackageFinder, bool) -> None
-        raise NotImplementedError()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/installed.py b/venv/lib/python3.8/site-packages/pip/_internal/distributions/installed.py
deleted file mode 100644
index 0d15bf42405e541b5154de307c54df47b9b7e2ec..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/distributions/installed.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from pip._internal.distributions.base import AbstractDistribution
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional
-
-    from pip._vendor.pkg_resources import Distribution
-    from pip._internal.index.package_finder import PackageFinder
-
-
-class InstalledDistribution(AbstractDistribution):
-    """Represents an installed package.
-
-    This does not need any preparation as the required information has already
-    been computed.
-    """
-
-    def get_pkg_resources_distribution(self):
-        # type: () -> Optional[Distribution]
-        return self.req.satisfied_by
-
-    def prepare_distribution_metadata(self, finder, build_isolation):
-        # type: (PackageFinder, bool) -> None
-        pass
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/sdist.py b/venv/lib/python3.8/site-packages/pip/_internal/distributions/sdist.py
deleted file mode 100644
index be3d7d97a1cfe877ce549603ebe1e17c65d68803..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/distributions/sdist.py
+++ /dev/null
@@ -1,104 +0,0 @@
-import logging
-
-from pip._internal.build_env import BuildEnvironment
-from pip._internal.distributions.base import AbstractDistribution
-from pip._internal.exceptions import InstallationError
-from pip._internal.utils.subprocess import runner_with_spinner_message
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Set, Tuple
-
-    from pip._vendor.pkg_resources import Distribution
-    from pip._internal.index.package_finder import PackageFinder
-
-
-logger = logging.getLogger(__name__)
-
-
-class SourceDistribution(AbstractDistribution):
-    """Represents a source distribution.
-
-    The preparation step for these needs metadata for the packages to be
-    generated, either using PEP 517 or using the legacy `setup.py egg_info`.
-    """
-
-    def get_pkg_resources_distribution(self):
-        # type: () -> Distribution
-        return self.req.get_dist()
-
-    def prepare_distribution_metadata(self, finder, build_isolation):
-        # type: (PackageFinder, bool) -> None
-        # Load pyproject.toml, to determine whether PEP 517 is to be used
-        self.req.load_pyproject_toml()
-
-        # Set up the build isolation, if this requirement should be isolated
-        should_isolate = self.req.use_pep517 and build_isolation
-        if should_isolate:
-            self._setup_isolation(finder)
-
-        self.req.prepare_metadata()
-
-    def _setup_isolation(self, finder):
-        # type: (PackageFinder) -> None
-        def _raise_conflicts(conflicting_with, conflicting_reqs):
-            # type: (str, Set[Tuple[str, str]]) -> None
-            format_string = (
-                "Some build dependencies for {requirement} "
-                "conflict with {conflicting_with}: {description}."
-            )
-            error_message = format_string.format(
-                requirement=self.req,
-                conflicting_with=conflicting_with,
-                description=', '.join(
-                    '{} is incompatible with {}'.format(installed, wanted)
-                    for installed, wanted in sorted(conflicting)
-                )
-            )
-            raise InstallationError(error_message)
-
-        # Isolate in a BuildEnvironment and install the build-time
-        # requirements.
-        pyproject_requires = self.req.pyproject_requires
-        assert pyproject_requires is not None
-
-        self.req.build_env = BuildEnvironment()
-        self.req.build_env.install_requirements(
-            finder, pyproject_requires, 'overlay',
-            "Installing build dependencies"
-        )
-        conflicting, missing = self.req.build_env.check_requirements(
-            self.req.requirements_to_check
-        )
-        if conflicting:
-            _raise_conflicts("PEP 517/518 supported requirements",
-                             conflicting)
-        if missing:
-            logger.warning(
-                "Missing build requirements in pyproject.toml for %s.",
-                self.req,
-            )
-            logger.warning(
-                "The project does not specify a build backend, and "
-                "pip cannot fall back to setuptools without %s.",
-                " and ".join(map(repr, sorted(missing)))
-            )
-        # Install any extra build dependencies that the backend requests.
-        # This must be done in a second pass, as the pyproject.toml
-        # dependencies must be installed before we can call the backend.
-        with self.req.build_env:
-            runner = runner_with_spinner_message(
-                "Getting requirements to build wheel"
-            )
-            backend = self.req.pep517_backend
-            assert backend is not None
-            with backend.subprocess_runner(runner):
-                reqs = backend.get_requires_for_build_wheel()
-
-        conflicting, missing = self.req.build_env.check_requirements(reqs)
-        if conflicting:
-            _raise_conflicts("the backend dependencies", conflicting)
-        self.req.build_env.install_requirements(
-            finder, missing, 'normal',
-            "Installing backend dependencies"
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/distributions/wheel.py b/venv/lib/python3.8/site-packages/pip/_internal/distributions/wheel.py
deleted file mode 100644
index bf3482b151f08196c82e719a9c194dfc20e4182e..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/distributions/wheel.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from zipfile import ZipFile
-
-from pip._internal.distributions.base import AbstractDistribution
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.wheel import pkg_resources_distribution_for_wheel
-
-if MYPY_CHECK_RUNNING:
-    from pip._vendor.pkg_resources import Distribution
-    from pip._internal.index.package_finder import PackageFinder
-
-
-class WheelDistribution(AbstractDistribution):
-    """Represents a wheel distribution.
-
-    This does not need any preparation as wheels can be directly unpacked.
-    """
-
-    def get_pkg_resources_distribution(self):
-        # type: () -> Distribution
-        """Loads the metadata from the wheel file into memory and returns a
-        Distribution that uses it, not relying on the wheel file or
-        requirement.
-        """
-        # Set as part of preparation during download.
-        assert self.req.local_file_path
-        # Wheels are never unnamed.
-        assert self.req.name
-
-        with ZipFile(self.req.local_file_path, allowZip64=True) as z:
-            return pkg_resources_distribution_for_wheel(
-                z, self.req.name, self.req.local_file_path
-            )
-
-    def prepare_distribution_metadata(self, finder, build_isolation):
-        # type: (PackageFinder, bool) -> None
-        pass
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/exceptions.py b/venv/lib/python3.8/site-packages/pip/_internal/exceptions.py
deleted file mode 100644
index dddec789ef40daff2e23a8da45e1042fd210bdc7..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/exceptions.py
+++ /dev/null
@@ -1,308 +0,0 @@
-"""Exceptions used throughout package"""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-from itertools import chain, groupby, repeat
-
-from pip._vendor.six import iteritems
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional
-    from pip._vendor.pkg_resources import Distribution
-    from pip._internal.req.req_install import InstallRequirement
-
-
-class PipError(Exception):
-    """Base pip exception"""
-
-
-class ConfigurationError(PipError):
-    """General exception in configuration"""
-
-
-class InstallationError(PipError):
-    """General exception during installation"""
-
-
-class UninstallationError(PipError):
-    """General exception during uninstallation"""
-
-
-class NoneMetadataError(PipError):
-    """
-    Raised when accessing "METADATA" or "PKG-INFO" metadata for a
-    pip._vendor.pkg_resources.Distribution object and
-    `dist.has_metadata('METADATA')` returns True but
-    `dist.get_metadata('METADATA')` returns None (and similarly for
-    "PKG-INFO").
-    """
-
-    def __init__(self, dist, metadata_name):
-        # type: (Distribution, str) -> None
-        """
-        :param dist: A Distribution object.
-        :param metadata_name: The name of the metadata being accessed
-            (can be "METADATA" or "PKG-INFO").
-        """
-        self.dist = dist
-        self.metadata_name = metadata_name
-
-    def __str__(self):
-        # type: () -> str
-        # Use `dist` in the error message because its stringification
-        # includes more information, like the version and location.
-        return (
-            'None {} metadata found for distribution: {}'.format(
-                self.metadata_name, self.dist,
-            )
-        )
-
-
-class DistributionNotFound(InstallationError):
-    """Raised when a distribution cannot be found to satisfy a requirement"""
-
-
-class RequirementsFileParseError(InstallationError):
-    """Raised when a general error occurs parsing a requirements file line."""
-
-
-class BestVersionAlreadyInstalled(PipError):
-    """Raised when the most up-to-date version of a package is already
-    installed."""
-
-
-class BadCommand(PipError):
-    """Raised when virtualenv or a command is not found"""
-
-
-class CommandError(PipError):
-    """Raised when there is an error in command-line arguments"""
-
-
-class PreviousBuildDirError(PipError):
-    """Raised when there's a previous conflicting build directory"""
-
-
-class InvalidWheelFilename(InstallationError):
-    """Invalid wheel filename."""
-
-
-class UnsupportedWheel(InstallationError):
-    """Unsupported wheel."""
-
-
-class HashErrors(InstallationError):
-    """Multiple HashError instances rolled into one for reporting"""
-
-    def __init__(self):
-        self.errors = []
-
-    def append(self, error):
-        self.errors.append(error)
-
-    def __str__(self):
-        lines = []
-        self.errors.sort(key=lambda e: e.order)
-        for cls, errors_of_cls in groupby(self.errors, lambda e: e.__class__):
-            lines.append(cls.head)
-            lines.extend(e.body() for e in errors_of_cls)
-        if lines:
-            return '\n'.join(lines)
-
-    def __nonzero__(self):
-        return bool(self.errors)
-
-    def __bool__(self):
-        return self.__nonzero__()
-
-
-class HashError(InstallationError):
-    """
-    A failure to verify a package against known-good hashes
-
-    :cvar order: An int sorting hash exception classes by difficulty of
-        recovery (lower being harder), so the user doesn't bother fretting
-        about unpinned packages when he has deeper issues, like VCS
-        dependencies, to deal with. Also keeps error reports in a
-        deterministic order.
-    :cvar head: A section heading for display above potentially many
-        exceptions of this kind
-    :ivar req: The InstallRequirement that triggered this error. This is
-        pasted on after the exception is instantiated, because it's not
-        typically available earlier.
-
-    """
-    req = None  # type: Optional[InstallRequirement]
-    head = ''
-
-    def body(self):
-        """Return a summary of me for display under the heading.
-
-        This default implementation simply prints a description of the
-        triggering requirement.
-
-        :param req: The InstallRequirement that provoked this error, with
-            populate_link() having already been called
-
-        """
-        return '    %s' % self._requirement_name()
-
-    def __str__(self):
-        return '%s\n%s' % (self.head, self.body())
-
-    def _requirement_name(self):
-        """Return a description of the requirement that triggered me.
-
-        This default implementation returns long description of the req, with
-        line numbers
-
-        """
-        return str(self.req) if self.req else 'unknown package'
-
-
-class VcsHashUnsupported(HashError):
-    """A hash was provided for a version-control-system-based requirement, but
-    we don't have a method for hashing those."""
-
-    order = 0
-    head = ("Can't verify hashes for these requirements because we don't "
-            "have a way to hash version control repositories:")
-
-
-class DirectoryUrlHashUnsupported(HashError):
-    """A hash was provided for a version-control-system-based requirement, but
-    we don't have a method for hashing those."""
-
-    order = 1
-    head = ("Can't verify hashes for these file:// requirements because they "
-            "point to directories:")
-
-
-class HashMissing(HashError):
-    """A hash was needed for a requirement but is absent."""
-
-    order = 2
-    head = ('Hashes are required in --require-hashes mode, but they are '
-            'missing from some requirements. Here is a list of those '
-            'requirements along with the hashes their downloaded archives '
-            'actually had. Add lines like these to your requirements files to '
-            'prevent tampering. (If you did not enable --require-hashes '
-            'manually, note that it turns on automatically when any package '
-            'has a hash.)')
-
-    def __init__(self, gotten_hash):
-        """
-        :param gotten_hash: The hash of the (possibly malicious) archive we
-            just downloaded
-        """
-        self.gotten_hash = gotten_hash
-
-    def body(self):
-        # Dodge circular import.
-        from pip._internal.utils.hashes import FAVORITE_HASH
-
-        package = None
-        if self.req:
-            # In the case of URL-based requirements, display the original URL
-            # seen in the requirements file rather than the package name,
-            # so the output can be directly copied into the requirements file.
-            package = (self.req.original_link if self.req.original_link
-                       # In case someone feeds something downright stupid
-                       # to InstallRequirement's constructor.
-                       else getattr(self.req, 'req', None))
-        return '    %s --hash=%s:%s' % (package or 'unknown package',
-                                        FAVORITE_HASH,
-                                        self.gotten_hash)
-
-
-class HashUnpinned(HashError):
-    """A requirement had a hash specified but was not pinned to a specific
-    version."""
-
-    order = 3
-    head = ('In --require-hashes mode, all requirements must have their '
-            'versions pinned with ==. These do not:')
-
-
-class HashMismatch(HashError):
-    """
-    Distribution file hash values don't match.
-
-    :ivar package_name: The name of the package that triggered the hash
-        mismatch. Feel free to write to this after the exception is raise to
-        improve its error message.
-
-    """
-    order = 4
-    head = ('THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS '
-            'FILE. If you have updated the package versions, please update '
-            'the hashes. Otherwise, examine the package contents carefully; '
-            'someone may have tampered with them.')
-
-    def __init__(self, allowed, gots):
-        """
-        :param allowed: A dict of algorithm names pointing to lists of allowed
-            hex digests
-        :param gots: A dict of algorithm names pointing to hashes we
-            actually got from the files under suspicion
-        """
-        self.allowed = allowed
-        self.gots = gots
-
-    def body(self):
-        return '    %s:\n%s' % (self._requirement_name(),
-                                self._hash_comparison())
-
-    def _hash_comparison(self):
-        """
-        Return a comparison of actual and expected hash values.
-
-        Example::
-
-               Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
-                            or 123451234512345123451234512345123451234512345
-                    Got        bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef
-
-        """
-        def hash_then_or(hash_name):
-            # For now, all the decent hashes have 6-char names, so we can get
-            # away with hard-coding space literals.
-            return chain([hash_name], repeat('    or'))
-
-        lines = []
-        for hash_name, expecteds in iteritems(self.allowed):
-            prefix = hash_then_or(hash_name)
-            lines.extend(('        Expected %s %s' % (next(prefix), e))
-                         for e in expecteds)
-            lines.append('             Got        %s\n' %
-                         self.gots[hash_name].hexdigest())
-        return '\n'.join(lines)
-
-
-class UnsupportedPythonVersion(InstallationError):
-    """Unsupported python version according to Requires-Python package
-    metadata."""
-
-
-class ConfigurationFileCouldNotBeLoaded(ConfigurationError):
-    """When there are errors while loading a configuration file
-    """
-
-    def __init__(self, reason="could not be loaded", fname=None, error=None):
-        super(ConfigurationFileCouldNotBeLoaded, self).__init__(error)
-        self.reason = reason
-        self.fname = fname
-        self.error = error
-
-    def __str__(self):
-        if self.fname is not None:
-            message_part = " in {}.".format(self.fname)
-        else:
-            assert self.error is not None
-            message_part = ".\n{}\n".format(self.error.message)
-        return "Configuration file {}{}".format(self.reason, message_part)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/index/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/index/__init__.py
deleted file mode 100644
index 7a17b7b3b6ad49157ee41f3da304fec3d32342d3..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/index/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-"""Index interaction code
-"""
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 7a99a058a3de3fcbbc38c321da6ef1dc842557ed..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/collector.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/collector.cpython-38.pyc
deleted file mode 100644
index 8f63b752ae6cf3f4e2a1470f84ab6cdde7f859c7..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/collector.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-38.pyc
deleted file mode 100644
index 16768b2a9ff14b8089a51af256db785423b7ad87..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/index/collector.py b/venv/lib/python3.8/site-packages/pip/_internal/index/collector.py
deleted file mode 100644
index 8330793171a3946d2bdba22c81784711acfa5e75..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/index/collector.py
+++ /dev/null
@@ -1,544 +0,0 @@
-"""
-The main purpose of this module is to expose LinkCollector.collect_links().
-"""
-
-import cgi
-import itertools
-import logging
-import mimetypes
-import os
-from collections import OrderedDict
-
-from pip._vendor import html5lib, requests
-from pip._vendor.distlib.compat import unescape
-from pip._vendor.requests.exceptions import HTTPError, RetryError, SSLError
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-from pip._vendor.six.moves.urllib import request as urllib_request
-
-from pip._internal.models.link import Link
-from pip._internal.utils.filetypes import ARCHIVE_EXTENSIONS
-from pip._internal.utils.misc import redact_auth_from_url
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import path_to_url, url_to_path
-from pip._internal.vcs import is_url, vcs
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Callable, Iterable, List, MutableMapping, Optional, Sequence, Tuple,
-        Union,
-    )
-    import xml.etree.ElementTree
-
-    from pip._vendor.requests import Response
-
-    from pip._internal.models.search_scope import SearchScope
-    from pip._internal.network.session import PipSession
-
-    HTMLElement = xml.etree.ElementTree.Element
-    ResponseHeaders = MutableMapping[str, str]
-
-
-logger = logging.getLogger(__name__)
-
-
-def _match_vcs_scheme(url):
-    # type: (str) -> Optional[str]
-    """Look for VCS schemes in the URL.
-
-    Returns the matched VCS scheme, or None if there's no match.
-    """
-    for scheme in vcs.schemes:
-        if url.lower().startswith(scheme) and url[len(scheme)] in '+:':
-            return scheme
-    return None
-
-
-def _is_url_like_archive(url):
-    # type: (str) -> bool
-    """Return whether the URL looks like an archive.
-    """
-    filename = Link(url).filename
-    for bad_ext in ARCHIVE_EXTENSIONS:
-        if filename.endswith(bad_ext):
-            return True
-    return False
-
-
-class _NotHTML(Exception):
-    def __init__(self, content_type, request_desc):
-        # type: (str, str) -> None
-        super(_NotHTML, self).__init__(content_type, request_desc)
-        self.content_type = content_type
-        self.request_desc = request_desc
-
-
-def _ensure_html_header(response):
-    # type: (Response) -> None
-    """Check the Content-Type header to ensure the response contains HTML.
-
-    Raises `_NotHTML` if the content type is not text/html.
-    """
-    content_type = response.headers.get("Content-Type", "")
-    if not content_type.lower().startswith("text/html"):
-        raise _NotHTML(content_type, response.request.method)
-
-
-class _NotHTTP(Exception):
-    pass
-
-
-def _ensure_html_response(url, session):
-    # type: (str, PipSession) -> None
-    """Send a HEAD request to the URL, and ensure the response contains HTML.
-
-    Raises `_NotHTTP` if the URL is not available for a HEAD request, or
-    `_NotHTML` if the content type is not text/html.
-    """
-    scheme, netloc, path, query, fragment = urllib_parse.urlsplit(url)
-    if scheme not in {'http', 'https'}:
-        raise _NotHTTP()
-
-    resp = session.head(url, allow_redirects=True)
-    resp.raise_for_status()
-
-    _ensure_html_header(resp)
-
-
-def _get_html_response(url, session):
-    # type: (str, PipSession) -> Response
-    """Access an HTML page with GET, and return the response.
-
-    This consists of three parts:
-
-    1. If the URL looks suspiciously like an archive, send a HEAD first to
-       check the Content-Type is HTML, to avoid downloading a large file.
-       Raise `_NotHTTP` if the content type cannot be determined, or
-       `_NotHTML` if it is not HTML.
-    2. Actually perform the request. Raise HTTP exceptions on network failures.
-    3. Check the Content-Type header to make sure we got HTML, and raise
-       `_NotHTML` otherwise.
-    """
-    if _is_url_like_archive(url):
-        _ensure_html_response(url, session=session)
-
-    logger.debug('Getting page %s', redact_auth_from_url(url))
-
-    resp = session.get(
-        url,
-        headers={
-            "Accept": "text/html",
-            # We don't want to blindly returned cached data for
-            # /simple/, because authors generally expecting that
-            # twine upload && pip install will function, but if
-            # they've done a pip install in the last ~10 minutes
-            # it won't. Thus by setting this to zero we will not
-            # blindly use any cached data, however the benefit of
-            # using max-age=0 instead of no-cache, is that we will
-            # still support conditional requests, so we will still
-            # minimize traffic sent in cases where the page hasn't
-            # changed at all, we will just always incur the round
-            # trip for the conditional GET now instead of only
-            # once per 10 minutes.
-            # For more information, please see pypa/pip#5670.
-            "Cache-Control": "max-age=0",
-        },
-    )
-    resp.raise_for_status()
-
-    # The check for archives above only works if the url ends with
-    # something that looks like an archive. However that is not a
-    # requirement of an url. Unless we issue a HEAD request on every
-    # url we cannot know ahead of time for sure if something is HTML
-    # or not. However we can check after we've downloaded it.
-    _ensure_html_header(resp)
-
-    return resp
-
-
-def _get_encoding_from_headers(headers):
-    # type: (ResponseHeaders) -> Optional[str]
-    """Determine if we have any encoding information in our headers.
-    """
-    if headers and "Content-Type" in headers:
-        content_type, params = cgi.parse_header(headers["Content-Type"])
-        if "charset" in params:
-            return params['charset']
-    return None
-
-
-def _determine_base_url(document, page_url):
-    # type: (HTMLElement, str) -> str
-    """Determine the HTML document's base URL.
-
-    This looks for a ```` tag in the HTML document. If present, its href
-    attribute denotes the base URL of anchor tags in the document. If there is
-    no such tag (or if it does not have a valid href attribute), the HTML
-    file's URL is used as the base URL.
-
-    :param document: An HTML document representation. The current
-        implementation expects the result of ``html5lib.parse()``.
-    :param page_url: The URL of the HTML document.
-    """
-    for base in document.findall(".//base"):
-        href = base.get("href")
-        if href is not None:
-            return href
-    return page_url
-
-
-def _clean_link(url):
-    # type: (str) -> str
-    """Makes sure a link is fully encoded.  That is, if a ' ' shows up in
-    the link, it will be rewritten to %20 (while not over-quoting
-    % or other characters)."""
-    # Split the URL into parts according to the general structure
-    # `scheme://netloc/path;parameters?query#fragment`. Note that the
-    # `netloc` can be empty and the URI will then refer to a local
-    # filesystem path.
-    result = urllib_parse.urlparse(url)
-    # In both cases below we unquote prior to quoting to make sure
-    # nothing is double quoted.
-    if result.netloc == "":
-        # On Windows the path part might contain a drive letter which
-        # should not be quoted. On Linux where drive letters do not
-        # exist, the colon should be quoted. We rely on urllib.request
-        # to do the right thing here.
-        path = urllib_request.pathname2url(
-            urllib_request.url2pathname(result.path))
-    else:
-        # In addition to the `/` character we protect `@` so that
-        # revision strings in VCS URLs are properly parsed.
-        path = urllib_parse.quote(urllib_parse.unquote(result.path), safe="/@")
-    return urllib_parse.urlunparse(result._replace(path=path))
-
-
-def _create_link_from_element(
-    anchor,    # type: HTMLElement
-    page_url,  # type: str
-    base_url,  # type: str
-):
-    # type: (...) -> Optional[Link]
-    """
-    Convert an anchor element in a simple repository page to a Link.
-    """
-    href = anchor.get("href")
-    if not href:
-        return None
-
-    url = _clean_link(urllib_parse.urljoin(base_url, href))
-    pyrequire = anchor.get('data-requires-python')
-    pyrequire = unescape(pyrequire) if pyrequire else None
-
-    yanked_reason = anchor.get('data-yanked')
-    if yanked_reason:
-        # This is a unicode string in Python 2 (and 3).
-        yanked_reason = unescape(yanked_reason)
-
-    link = Link(
-        url,
-        comes_from=page_url,
-        requires_python=pyrequire,
-        yanked_reason=yanked_reason,
-    )
-
-    return link
-
-
-def parse_links(page):
-    # type: (HTMLPage) -> Iterable[Link]
-    """
-    Parse an HTML document, and yield its anchor elements as Link objects.
-    """
-    document = html5lib.parse(
-        page.content,
-        transport_encoding=page.encoding,
-        namespaceHTMLElements=False,
-    )
-
-    url = page.url
-    base_url = _determine_base_url(document, url)
-    for anchor in document.findall(".//a"):
-        link = _create_link_from_element(
-            anchor,
-            page_url=url,
-            base_url=base_url,
-        )
-        if link is None:
-            continue
-        yield link
-
-
-class HTMLPage(object):
-    """Represents one page, along with its URL"""
-
-    def __init__(
-        self,
-        content,   # type: bytes
-        encoding,  # type: Optional[str]
-        url,       # type: str
-    ):
-        # type: (...) -> None
-        """
-        :param encoding: the encoding to decode the given content.
-        :param url: the URL from which the HTML was downloaded.
-        """
-        self.content = content
-        self.encoding = encoding
-        self.url = url
-
-    def __str__(self):
-        # type: () -> str
-        return redact_auth_from_url(self.url)
-
-
-def _handle_get_page_fail(
-    link,  # type: Link
-    reason,  # type: Union[str, Exception]
-    meth=None  # type: Optional[Callable[..., None]]
-):
-    # type: (...) -> None
-    if meth is None:
-        meth = logger.debug
-    meth("Could not fetch URL %s: %s - skipping", link, reason)
-
-
-def _make_html_page(response):
-    # type: (Response) -> HTMLPage
-    encoding = _get_encoding_from_headers(response.headers)
-    return HTMLPage(response.content, encoding=encoding, url=response.url)
-
-
-def _get_html_page(link, session=None):
-    # type: (Link, Optional[PipSession]) -> Optional[HTMLPage]
-    if session is None:
-        raise TypeError(
-            "_get_html_page() missing 1 required keyword argument: 'session'"
-        )
-
-    url = link.url.split('#', 1)[0]
-
-    # Check for VCS schemes that do not support lookup as web pages.
-    vcs_scheme = _match_vcs_scheme(url)
-    if vcs_scheme:
-        logger.debug('Cannot look at %s URL %s', vcs_scheme, link)
-        return None
-
-    # Tack index.html onto file:// URLs that point to directories
-    scheme, _, path, _, _, _ = urllib_parse.urlparse(url)
-    if (scheme == 'file' and os.path.isdir(urllib_request.url2pathname(path))):
-        # add trailing slash if not present so urljoin doesn't trim
-        # final segment
-        if not url.endswith('/'):
-            url += '/'
-        url = urllib_parse.urljoin(url, 'index.html')
-        logger.debug(' file: URL is directory, getting %s', url)
-
-    try:
-        resp = _get_html_response(url, session=session)
-    except _NotHTTP:
-        logger.debug(
-            'Skipping page %s because it looks like an archive, and cannot '
-            'be checked by HEAD.', link,
-        )
-    except _NotHTML as exc:
-        logger.debug(
-            'Skipping page %s because the %s request got Content-Type: %s',
-            link, exc.request_desc, exc.content_type,
-        )
-    except HTTPError as exc:
-        _handle_get_page_fail(link, exc)
-    except RetryError as exc:
-        _handle_get_page_fail(link, exc)
-    except SSLError as exc:
-        reason = "There was a problem confirming the ssl certificate: "
-        reason += str(exc)
-        _handle_get_page_fail(link, reason, meth=logger.info)
-    except requests.ConnectionError as exc:
-        _handle_get_page_fail(link, "connection error: %s" % exc)
-    except requests.Timeout:
-        _handle_get_page_fail(link, "timed out")
-    else:
-        return _make_html_page(resp)
-    return None
-
-
-def _remove_duplicate_links(links):
-    # type: (Iterable[Link]) -> List[Link]
-    """
-    Return a list of links, with duplicates removed and ordering preserved.
-    """
-    # We preserve the ordering when removing duplicates because we can.
-    return list(OrderedDict.fromkeys(links))
-
-
-def group_locations(locations, expand_dir=False):
-    # type: (Sequence[str], bool) -> Tuple[List[str], List[str]]
-    """
-    Divide a list of locations into two groups: "files" (archives) and "urls."
-
-    :return: A pair of lists (files, urls).
-    """
-    files = []
-    urls = []
-
-    # puts the url for the given file path into the appropriate list
-    def sort_path(path):
-        # type: (str) -> None
-        url = path_to_url(path)
-        if mimetypes.guess_type(url, strict=False)[0] == 'text/html':
-            urls.append(url)
-        else:
-            files.append(url)
-
-    for url in locations:
-
-        is_local_path = os.path.exists(url)
-        is_file_url = url.startswith('file:')
-
-        if is_local_path or is_file_url:
-            if is_local_path:
-                path = url
-            else:
-                path = url_to_path(url)
-            if os.path.isdir(path):
-                if expand_dir:
-                    path = os.path.realpath(path)
-                    for item in os.listdir(path):
-                        sort_path(os.path.join(path, item))
-                elif is_file_url:
-                    urls.append(url)
-                else:
-                    logger.warning(
-                        "Path '{0}' is ignored: "
-                        "it is a directory.".format(path),
-                    )
-            elif os.path.isfile(path):
-                sort_path(path)
-            else:
-                logger.warning(
-                    "Url '%s' is ignored: it is neither a file "
-                    "nor a directory.", url,
-                )
-        elif is_url(url):
-            # Only add url with clear scheme
-            urls.append(url)
-        else:
-            logger.warning(
-                "Url '%s' is ignored. It is either a non-existing "
-                "path or lacks a specific scheme.", url,
-            )
-
-    return files, urls
-
-
-class CollectedLinks(object):
-
-    """
-    Encapsulates the return value of a call to LinkCollector.collect_links().
-
-    The return value includes both URLs to project pages containing package
-    links, as well as individual package Link objects collected from other
-    sources.
-
-    This info is stored separately as:
-
-    (1) links from the configured file locations,
-    (2) links from the configured find_links, and
-    (3) urls to HTML project pages, as described by the PEP 503 simple
-        repository API.
-    """
-
-    def __init__(
-        self,
-        files,         # type: List[Link]
-        find_links,    # type: List[Link]
-        project_urls,  # type: List[Link]
-    ):
-        # type: (...) -> None
-        """
-        :param files: Links from file locations.
-        :param find_links: Links from find_links.
-        :param project_urls: URLs to HTML project pages, as described by
-            the PEP 503 simple repository API.
-        """
-        self.files = files
-        self.find_links = find_links
-        self.project_urls = project_urls
-
-
-class LinkCollector(object):
-
-    """
-    Responsible for collecting Link objects from all configured locations,
-    making network requests as needed.
-
-    The class's main method is its collect_links() method.
-    """
-
-    def __init__(
-        self,
-        session,       # type: PipSession
-        search_scope,  # type: SearchScope
-    ):
-        # type: (...) -> None
-        self.search_scope = search_scope
-        self.session = session
-
-    @property
-    def find_links(self):
-        # type: () -> List[str]
-        return self.search_scope.find_links
-
-    def fetch_page(self, location):
-        # type: (Link) -> Optional[HTMLPage]
-        """
-        Fetch an HTML page containing package links.
-        """
-        return _get_html_page(location, session=self.session)
-
-    def collect_links(self, project_name):
-        # type: (str) -> CollectedLinks
-        """Find all available links for the given project name.
-
-        :return: All the Link objects (unfiltered), as a CollectedLinks object.
-        """
-        search_scope = self.search_scope
-        index_locations = search_scope.get_index_urls_locations(project_name)
-        index_file_loc, index_url_loc = group_locations(index_locations)
-        fl_file_loc, fl_url_loc = group_locations(
-            self.find_links, expand_dir=True,
-        )
-
-        file_links = [
-            Link(url) for url in itertools.chain(index_file_loc, fl_file_loc)
-        ]
-
-        # We trust every directly linked archive in find_links
-        find_link_links = [Link(url, '-f') for url in self.find_links]
-
-        # We trust every url that the user has given us whether it was given
-        # via --index-url or --find-links.
-        # We want to filter out anything that does not have a secure origin.
-        url_locations = [
-            link for link in itertools.chain(
-                (Link(url) for url in index_url_loc),
-                (Link(url) for url in fl_url_loc),
-            )
-            if self.session.is_secure_origin(link)
-        ]
-
-        url_locations = _remove_duplicate_links(url_locations)
-        lines = [
-            '{} location(s) to search for versions of {}:'.format(
-                len(url_locations), project_name,
-            ),
-        ]
-        for link in url_locations:
-            lines.append('* {}'.format(link))
-        logger.debug('\n'.join(lines))
-
-        return CollectedLinks(
-            files=file_links,
-            find_links=find_link_links,
-            project_urls=url_locations,
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/index/package_finder.py b/venv/lib/python3.8/site-packages/pip/_internal/index/package_finder.py
deleted file mode 100644
index a74d78db5a6c1738d54e784840f97daddff18776..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/index/package_finder.py
+++ /dev/null
@@ -1,1013 +0,0 @@
-"""Routines related to PyPI, indexes"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import logging
-import re
-
-from pip._vendor.packaging import specifiers
-from pip._vendor.packaging.utils import canonicalize_name
-from pip._vendor.packaging.version import parse as parse_version
-
-from pip._internal.exceptions import (
-    BestVersionAlreadyInstalled,
-    DistributionNotFound,
-    InvalidWheelFilename,
-    UnsupportedWheel,
-)
-from pip._internal.index.collector import parse_links
-from pip._internal.models.candidate import InstallationCandidate
-from pip._internal.models.format_control import FormatControl
-from pip._internal.models.link import Link
-from pip._internal.models.selection_prefs import SelectionPreferences
-from pip._internal.models.target_python import TargetPython
-from pip._internal.models.wheel import Wheel
-from pip._internal.utils.filetypes import WHEEL_EXTENSION
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import build_netloc
-from pip._internal.utils.packaging import check_requires_python
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.unpacking import SUPPORTED_EXTENSIONS
-from pip._internal.utils.urls import url_to_path
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        FrozenSet, Iterable, List, Optional, Set, Text, Tuple, Union,
-    )
-
-    from pip._vendor.packaging.tags import Tag
-    from pip._vendor.packaging.version import _BaseVersion
-
-    from pip._internal.index.collector import LinkCollector
-    from pip._internal.models.search_scope import SearchScope
-    from pip._internal.req import InstallRequirement
-    from pip._internal.utils.hashes import Hashes
-
-    BuildTag = Union[Tuple[()], Tuple[int, str]]
-    CandidateSortingKey = (
-        Tuple[int, int, int, _BaseVersion, BuildTag, Optional[int]]
-    )
-
-
-__all__ = ['FormatControl', 'BestCandidateResult', 'PackageFinder']
-
-
-logger = logging.getLogger(__name__)
-
-
-def _check_link_requires_python(
-    link,  # type: Link
-    version_info,  # type: Tuple[int, int, int]
-    ignore_requires_python=False,  # type: bool
-):
-    # type: (...) -> bool
-    """
-    Return whether the given Python version is compatible with a link's
-    "Requires-Python" value.
-
-    :param version_info: A 3-tuple of ints representing the Python
-        major-minor-micro version to check.
-    :param ignore_requires_python: Whether to ignore the "Requires-Python"
-        value if the given Python version isn't compatible.
-    """
-    try:
-        is_compatible = check_requires_python(
-            link.requires_python, version_info=version_info,
-        )
-    except specifiers.InvalidSpecifier:
-        logger.debug(
-            "Ignoring invalid Requires-Python (%r) for link: %s",
-            link.requires_python, link,
-        )
-    else:
-        if not is_compatible:
-            version = '.'.join(map(str, version_info))
-            if not ignore_requires_python:
-                logger.debug(
-                    'Link requires a different Python (%s not in: %r): %s',
-                    version, link.requires_python, link,
-                )
-                return False
-
-            logger.debug(
-                'Ignoring failed Requires-Python check (%s not in: %r) '
-                'for link: %s',
-                version, link.requires_python, link,
-            )
-
-    return True
-
-
-class LinkEvaluator(object):
-
-    """
-    Responsible for evaluating links for a particular project.
-    """
-
-    _py_version_re = re.compile(r'-py([123]\.?[0-9]?)$')
-
-    # Don't include an allow_yanked default value to make sure each call
-    # site considers whether yanked releases are allowed. This also causes
-    # that decision to be made explicit in the calling code, which helps
-    # people when reading the code.
-    def __init__(
-        self,
-        project_name,    # type: str
-        canonical_name,  # type: str
-        formats,         # type: FrozenSet[str]
-        target_python,   # type: TargetPython
-        allow_yanked,    # type: bool
-        ignore_requires_python=None,  # type: Optional[bool]
-    ):
-        # type: (...) -> None
-        """
-        :param project_name: The user supplied package name.
-        :param canonical_name: The canonical package name.
-        :param formats: The formats allowed for this package. Should be a set
-            with 'binary' or 'source' or both in it.
-        :param target_python: The target Python interpreter to use when
-            evaluating link compatibility. This is used, for example, to
-            check wheel compatibility, as well as when checking the Python
-            version, e.g. the Python version embedded in a link filename
-            (or egg fragment) and against an HTML link's optional PEP 503
-            "data-requires-python" attribute.
-        :param allow_yanked: Whether files marked as yanked (in the sense
-            of PEP 592) are permitted to be candidates for install.
-        :param ignore_requires_python: Whether to ignore incompatible
-            PEP 503 "data-requires-python" values in HTML links. Defaults
-            to False.
-        """
-        if ignore_requires_python is None:
-            ignore_requires_python = False
-
-        self._allow_yanked = allow_yanked
-        self._canonical_name = canonical_name
-        self._ignore_requires_python = ignore_requires_python
-        self._formats = formats
-        self._target_python = target_python
-
-        self.project_name = project_name
-
-    def evaluate_link(self, link):
-        # type: (Link) -> Tuple[bool, Optional[Text]]
-        """
-        Determine whether a link is a candidate for installation.
-
-        :return: A tuple (is_candidate, result), where `result` is (1) a
-            version string if `is_candidate` is True, and (2) if
-            `is_candidate` is False, an optional string to log the reason
-            the link fails to qualify.
-        """
-        version = None
-        if link.is_yanked and not self._allow_yanked:
-            reason = link.yanked_reason or ''
-            # Mark this as a unicode string to prevent "UnicodeEncodeError:
-            # 'ascii' codec can't encode character" in Python 2 when
-            # the reason contains non-ascii characters.
-            return (False, u'yanked for reason: {}'.format(reason))
-
-        if link.egg_fragment:
-            egg_info = link.egg_fragment
-            ext = link.ext
-        else:
-            egg_info, ext = link.splitext()
-            if not ext:
-                return (False, 'not a file')
-            if ext not in SUPPORTED_EXTENSIONS:
-                return (False, 'unsupported archive format: %s' % ext)
-            if "binary" not in self._formats and ext == WHEEL_EXTENSION:
-                reason = 'No binaries permitted for %s' % self.project_name
-                return (False, reason)
-            if "macosx10" in link.path and ext == '.zip':
-                return (False, 'macosx10 one')
-            if ext == WHEEL_EXTENSION:
-                try:
-                    wheel = Wheel(link.filename)
-                except InvalidWheelFilename:
-                    return (False, 'invalid wheel filename')
-                if canonicalize_name(wheel.name) != self._canonical_name:
-                    reason = 'wrong project name (not %s)' % self.project_name
-                    return (False, reason)
-
-                supported_tags = self._target_python.get_tags()
-                if not wheel.supported(supported_tags):
-                    # Include the wheel's tags in the reason string to
-                    # simplify troubleshooting compatibility issues.
-                    file_tags = wheel.get_formatted_file_tags()
-                    reason = (
-                        "none of the wheel's tags match: {}".format(
-                            ', '.join(file_tags)
-                        )
-                    )
-                    return (False, reason)
-
-                version = wheel.version
-
-        # This should be up by the self.ok_binary check, but see issue 2700.
-        if "source" not in self._formats and ext != WHEEL_EXTENSION:
-            return (False, 'No sources permitted for %s' % self.project_name)
-
-        if not version:
-            version = _extract_version_from_fragment(
-                egg_info, self._canonical_name,
-            )
-        if not version:
-            return (
-                False, 'Missing project version for %s' % self.project_name,
-            )
-
-        match = self._py_version_re.search(version)
-        if match:
-            version = version[:match.start()]
-            py_version = match.group(1)
-            if py_version != self._target_python.py_version:
-                return (False, 'Python version is incorrect')
-
-        supports_python = _check_link_requires_python(
-            link, version_info=self._target_python.py_version_info,
-            ignore_requires_python=self._ignore_requires_python,
-        )
-        if not supports_python:
-            # Return None for the reason text to suppress calling
-            # _log_skipped_link().
-            return (False, None)
-
-        logger.debug('Found link %s, version: %s', link, version)
-
-        return (True, version)
-
-
-def filter_unallowed_hashes(
-    candidates,    # type: List[InstallationCandidate]
-    hashes,        # type: Hashes
-    project_name,  # type: str
-):
-    # type: (...) -> List[InstallationCandidate]
-    """
-    Filter out candidates whose hashes aren't allowed, and return a new
-    list of candidates.
-
-    If at least one candidate has an allowed hash, then all candidates with
-    either an allowed hash or no hash specified are returned.  Otherwise,
-    the given candidates are returned.
-
-    Including the candidates with no hash specified when there is a match
-    allows a warning to be logged if there is a more preferred candidate
-    with no hash specified.  Returning all candidates in the case of no
-    matches lets pip report the hash of the candidate that would otherwise
-    have been installed (e.g. permitting the user to more easily update
-    their requirements file with the desired hash).
-    """
-    if not hashes:
-        logger.debug(
-            'Given no hashes to check %s links for project %r: '
-            'discarding no candidates',
-            len(candidates),
-            project_name,
-        )
-        # Make sure we're not returning back the given value.
-        return list(candidates)
-
-    matches_or_no_digest = []
-    # Collect the non-matches for logging purposes.
-    non_matches = []
-    match_count = 0
-    for candidate in candidates:
-        link = candidate.link
-        if not link.has_hash:
-            pass
-        elif link.is_hash_allowed(hashes=hashes):
-            match_count += 1
-        else:
-            non_matches.append(candidate)
-            continue
-
-        matches_or_no_digest.append(candidate)
-
-    if match_count:
-        filtered = matches_or_no_digest
-    else:
-        # Make sure we're not returning back the given value.
-        filtered = list(candidates)
-
-    if len(filtered) == len(candidates):
-        discard_message = 'discarding no candidates'
-    else:
-        discard_message = 'discarding {} non-matches:\n  {}'.format(
-            len(non_matches),
-            '\n  '.join(str(candidate.link) for candidate in non_matches)
-        )
-
-    logger.debug(
-        'Checked %s links for project %r against %s hashes '
-        '(%s matches, %s no digest): %s',
-        len(candidates),
-        project_name,
-        hashes.digest_count,
-        match_count,
-        len(matches_or_no_digest) - match_count,
-        discard_message
-    )
-
-    return filtered
-
-
-class CandidatePreferences(object):
-
-    """
-    Encapsulates some of the preferences for filtering and sorting
-    InstallationCandidate objects.
-    """
-
-    def __init__(
-        self,
-        prefer_binary=False,  # type: bool
-        allow_all_prereleases=False,  # type: bool
-    ):
-        # type: (...) -> None
-        """
-        :param allow_all_prereleases: Whether to allow all pre-releases.
-        """
-        self.allow_all_prereleases = allow_all_prereleases
-        self.prefer_binary = prefer_binary
-
-
-class BestCandidateResult(object):
-    """A collection of candidates, returned by `PackageFinder.find_best_candidate`.
-
-    This class is only intended to be instantiated by CandidateEvaluator's
-    `compute_best_candidate()` method.
-    """
-
-    def __init__(
-        self,
-        candidates,             # type: List[InstallationCandidate]
-        applicable_candidates,  # type: List[InstallationCandidate]
-        best_candidate,         # type: Optional[InstallationCandidate]
-    ):
-        # type: (...) -> None
-        """
-        :param candidates: A sequence of all available candidates found.
-        :param applicable_candidates: The applicable candidates.
-        :param best_candidate: The most preferred candidate found, or None
-            if no applicable candidates were found.
-        """
-        assert set(applicable_candidates) <= set(candidates)
-
-        if best_candidate is None:
-            assert not applicable_candidates
-        else:
-            assert best_candidate in applicable_candidates
-
-        self._applicable_candidates = applicable_candidates
-        self._candidates = candidates
-
-        self.best_candidate = best_candidate
-
-    def iter_all(self):
-        # type: () -> Iterable[InstallationCandidate]
-        """Iterate through all candidates.
-        """
-        return iter(self._candidates)
-
-    def iter_applicable(self):
-        # type: () -> Iterable[InstallationCandidate]
-        """Iterate through the applicable candidates.
-        """
-        return iter(self._applicable_candidates)
-
-
-class CandidateEvaluator(object):
-
-    """
-    Responsible for filtering and sorting candidates for installation based
-    on what tags are valid.
-    """
-
-    @classmethod
-    def create(
-        cls,
-        project_name,         # type: str
-        target_python=None,   # type: Optional[TargetPython]
-        prefer_binary=False,  # type: bool
-        allow_all_prereleases=False,  # type: bool
-        specifier=None,       # type: Optional[specifiers.BaseSpecifier]
-        hashes=None,          # type: Optional[Hashes]
-    ):
-        # type: (...) -> CandidateEvaluator
-        """Create a CandidateEvaluator object.
-
-        :param target_python: The target Python interpreter to use when
-            checking compatibility. If None (the default), a TargetPython
-            object will be constructed from the running Python.
-        :param specifier: An optional object implementing `filter`
-            (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable
-            versions.
-        :param hashes: An optional collection of allowed hashes.
-        """
-        if target_python is None:
-            target_python = TargetPython()
-        if specifier is None:
-            specifier = specifiers.SpecifierSet()
-
-        supported_tags = target_python.get_tags()
-
-        return cls(
-            project_name=project_name,
-            supported_tags=supported_tags,
-            specifier=specifier,
-            prefer_binary=prefer_binary,
-            allow_all_prereleases=allow_all_prereleases,
-            hashes=hashes,
-        )
-
-    def __init__(
-        self,
-        project_name,         # type: str
-        supported_tags,       # type: List[Tag]
-        specifier,            # type: specifiers.BaseSpecifier
-        prefer_binary=False,  # type: bool
-        allow_all_prereleases=False,  # type: bool
-        hashes=None,                  # type: Optional[Hashes]
-    ):
-        # type: (...) -> None
-        """
-        :param supported_tags: The PEP 425 tags supported by the target
-            Python in order of preference (most preferred first).
-        """
-        self._allow_all_prereleases = allow_all_prereleases
-        self._hashes = hashes
-        self._prefer_binary = prefer_binary
-        self._project_name = project_name
-        self._specifier = specifier
-        self._supported_tags = supported_tags
-
-    def get_applicable_candidates(
-        self,
-        candidates,  # type: List[InstallationCandidate]
-    ):
-        # type: (...) -> List[InstallationCandidate]
-        """
-        Return the applicable candidates from a list of candidates.
-        """
-        # Using None infers from the specifier instead.
-        allow_prereleases = self._allow_all_prereleases or None
-        specifier = self._specifier
-        versions = {
-            str(v) for v in specifier.filter(
-                # We turn the version object into a str here because otherwise
-                # when we're debundled but setuptools isn't, Python will see
-                # packaging.version.Version and
-                # pkg_resources._vendor.packaging.version.Version as different
-                # types. This way we'll use a str as a common data interchange
-                # format. If we stop using the pkg_resources provided specifier
-                # and start using our own, we can drop the cast to str().
-                (str(c.version) for c in candidates),
-                prereleases=allow_prereleases,
-            )
-        }
-
-        # Again, converting version to str to deal with debundling.
-        applicable_candidates = [
-            c for c in candidates if str(c.version) in versions
-        ]
-
-        filtered_applicable_candidates = filter_unallowed_hashes(
-            candidates=applicable_candidates,
-            hashes=self._hashes,
-            project_name=self._project_name,
-        )
-
-        return sorted(filtered_applicable_candidates, key=self._sort_key)
-
-    def _sort_key(self, candidate):
-        # type: (InstallationCandidate) -> CandidateSortingKey
-        """
-        Function to pass as the `key` argument to a call to sorted() to sort
-        InstallationCandidates by preference.
-
-        Returns a tuple such that tuples sorting as greater using Python's
-        default comparison operator are more preferred.
-
-        The preference is as follows:
-
-        First and foremost, candidates with allowed (matching) hashes are
-        always preferred over candidates without matching hashes. This is
-        because e.g. if the only candidate with an allowed hash is yanked,
-        we still want to use that candidate.
-
-        Second, excepting hash considerations, candidates that have been
-        yanked (in the sense of PEP 592) are always less preferred than
-        candidates that haven't been yanked. Then:
-
-        If not finding wheels, they are sorted by version only.
-        If finding wheels, then the sort order is by version, then:
-          1. existing installs
-          2. wheels ordered via Wheel.support_index_min(self._supported_tags)
-          3. source archives
-        If prefer_binary was set, then all wheels are sorted above sources.
-
-        Note: it was considered to embed this logic into the Link
-              comparison operators, but then different sdist links
-              with the same version, would have to be considered equal
-        """
-        valid_tags = self._supported_tags
-        support_num = len(valid_tags)
-        build_tag = ()  # type: BuildTag
-        binary_preference = 0
-        link = candidate.link
-        if link.is_wheel:
-            # can raise InvalidWheelFilename
-            wheel = Wheel(link.filename)
-            if not wheel.supported(valid_tags):
-                raise UnsupportedWheel(
-                    "%s is not a supported wheel for this platform. It "
-                    "can't be sorted." % wheel.filename
-                )
-            if self._prefer_binary:
-                binary_preference = 1
-            pri = -(wheel.support_index_min(valid_tags))
-            if wheel.build_tag is not None:
-                match = re.match(r'^(\d+)(.*)$', wheel.build_tag)
-                build_tag_groups = match.groups()
-                build_tag = (int(build_tag_groups[0]), build_tag_groups[1])
-        else:  # sdist
-            pri = -(support_num)
-        has_allowed_hash = int(link.is_hash_allowed(self._hashes))
-        yank_value = -1 * int(link.is_yanked)  # -1 for yanked.
-        return (
-            has_allowed_hash, yank_value, binary_preference, candidate.version,
-            build_tag, pri,
-        )
-
-    def sort_best_candidate(
-        self,
-        candidates,    # type: List[InstallationCandidate]
-    ):
-        # type: (...) -> Optional[InstallationCandidate]
-        """
-        Return the best candidate per the instance's sort order, or None if
-        no candidate is acceptable.
-        """
-        if not candidates:
-            return None
-
-        best_candidate = max(candidates, key=self._sort_key)
-
-        # Log a warning per PEP 592 if necessary before returning.
-        link = best_candidate.link
-        if link.is_yanked:
-            reason = link.yanked_reason or ''
-            msg = (
-                # Mark this as a unicode string to prevent
-                # "UnicodeEncodeError: 'ascii' codec can't encode character"
-                # in Python 2 when the reason contains non-ascii characters.
-                u'The candidate selected for download or install is a '
-                'yanked version: {candidate}\n'
-                'Reason for being yanked: {reason}'
-            ).format(candidate=best_candidate, reason=reason)
-            logger.warning(msg)
-
-        return best_candidate
-
-    def compute_best_candidate(
-        self,
-        candidates,      # type: List[InstallationCandidate]
-    ):
-        # type: (...) -> BestCandidateResult
-        """
-        Compute and return a `BestCandidateResult` instance.
-        """
-        applicable_candidates = self.get_applicable_candidates(candidates)
-
-        best_candidate = self.sort_best_candidate(applicable_candidates)
-
-        return BestCandidateResult(
-            candidates,
-            applicable_candidates=applicable_candidates,
-            best_candidate=best_candidate,
-        )
-
-
-class PackageFinder(object):
-    """This finds packages.
-
-    This is meant to match easy_install's technique for looking for
-    packages, by reading pages and looking for appropriate links.
-    """
-
-    def __init__(
-        self,
-        link_collector,       # type: LinkCollector
-        target_python,        # type: TargetPython
-        allow_yanked,         # type: bool
-        format_control=None,  # type: Optional[FormatControl]
-        candidate_prefs=None,         # type: CandidatePreferences
-        ignore_requires_python=None,  # type: Optional[bool]
-    ):
-        # type: (...) -> None
-        """
-        This constructor is primarily meant to be used by the create() class
-        method and from tests.
-
-        :param format_control: A FormatControl object, used to control
-            the selection of source packages / binary packages when consulting
-            the index and links.
-        :param candidate_prefs: Options to use when creating a
-            CandidateEvaluator object.
-        """
-        if candidate_prefs is None:
-            candidate_prefs = CandidatePreferences()
-
-        format_control = format_control or FormatControl(set(), set())
-
-        self._allow_yanked = allow_yanked
-        self._candidate_prefs = candidate_prefs
-        self._ignore_requires_python = ignore_requires_python
-        self._link_collector = link_collector
-        self._target_python = target_python
-
-        self.format_control = format_control
-
-        # These are boring links that have already been logged somehow.
-        self._logged_links = set()  # type: Set[Link]
-
-    # Don't include an allow_yanked default value to make sure each call
-    # site considers whether yanked releases are allowed. This also causes
-    # that decision to be made explicit in the calling code, which helps
-    # people when reading the code.
-    @classmethod
-    def create(
-        cls,
-        link_collector,      # type: LinkCollector
-        selection_prefs,     # type: SelectionPreferences
-        target_python=None,  # type: Optional[TargetPython]
-    ):
-        # type: (...) -> PackageFinder
-        """Create a PackageFinder.
-
-        :param selection_prefs: The candidate selection preferences, as a
-            SelectionPreferences object.
-        :param target_python: The target Python interpreter to use when
-            checking compatibility. If None (the default), a TargetPython
-            object will be constructed from the running Python.
-        """
-        if target_python is None:
-            target_python = TargetPython()
-
-        candidate_prefs = CandidatePreferences(
-            prefer_binary=selection_prefs.prefer_binary,
-            allow_all_prereleases=selection_prefs.allow_all_prereleases,
-        )
-
-        return cls(
-            candidate_prefs=candidate_prefs,
-            link_collector=link_collector,
-            target_python=target_python,
-            allow_yanked=selection_prefs.allow_yanked,
-            format_control=selection_prefs.format_control,
-            ignore_requires_python=selection_prefs.ignore_requires_python,
-        )
-
-    @property
-    def search_scope(self):
-        # type: () -> SearchScope
-        return self._link_collector.search_scope
-
-    @search_scope.setter
-    def search_scope(self, search_scope):
-        # type: (SearchScope) -> None
-        self._link_collector.search_scope = search_scope
-
-    @property
-    def find_links(self):
-        # type: () -> List[str]
-        return self._link_collector.find_links
-
-    @property
-    def index_urls(self):
-        # type: () -> List[str]
-        return self.search_scope.index_urls
-
-    @property
-    def trusted_hosts(self):
-        # type: () -> Iterable[str]
-        for host_port in self._link_collector.session.pip_trusted_origins:
-            yield build_netloc(*host_port)
-
-    @property
-    def allow_all_prereleases(self):
-        # type: () -> bool
-        return self._candidate_prefs.allow_all_prereleases
-
-    def set_allow_all_prereleases(self):
-        # type: () -> None
-        self._candidate_prefs.allow_all_prereleases = True
-
-    def make_link_evaluator(self, project_name):
-        # type: (str) -> LinkEvaluator
-        canonical_name = canonicalize_name(project_name)
-        formats = self.format_control.get_allowed_formats(canonical_name)
-
-        return LinkEvaluator(
-            project_name=project_name,
-            canonical_name=canonical_name,
-            formats=formats,
-            target_python=self._target_python,
-            allow_yanked=self._allow_yanked,
-            ignore_requires_python=self._ignore_requires_python,
-        )
-
-    def _sort_links(self, links):
-        # type: (Iterable[Link]) -> List[Link]
-        """
-        Returns elements of links in order, non-egg links first, egg links
-        second, while eliminating duplicates
-        """
-        eggs, no_eggs = [], []
-        seen = set()  # type: Set[Link]
-        for link in links:
-            if link not in seen:
-                seen.add(link)
-                if link.egg_fragment:
-                    eggs.append(link)
-                else:
-                    no_eggs.append(link)
-        return no_eggs + eggs
-
-    def _log_skipped_link(self, link, reason):
-        # type: (Link, Text) -> None
-        if link not in self._logged_links:
-            # Mark this as a unicode string to prevent "UnicodeEncodeError:
-            # 'ascii' codec can't encode character" in Python 2 when
-            # the reason contains non-ascii characters.
-            #   Also, put the link at the end so the reason is more visible
-            # and because the link string is usually very long.
-            logger.debug(u'Skipping link: %s: %s', reason, link)
-            self._logged_links.add(link)
-
-    def get_install_candidate(self, link_evaluator, link):
-        # type: (LinkEvaluator, Link) -> Optional[InstallationCandidate]
-        """
-        If the link is a candidate for install, convert it to an
-        InstallationCandidate and return it. Otherwise, return None.
-        """
-        is_candidate, result = link_evaluator.evaluate_link(link)
-        if not is_candidate:
-            if result:
-                self._log_skipped_link(link, reason=result)
-            return None
-
-        return InstallationCandidate(
-            name=link_evaluator.project_name,
-            link=link,
-            # Convert the Text result to str since InstallationCandidate
-            # accepts str.
-            version=str(result),
-        )
-
-    def evaluate_links(self, link_evaluator, links):
-        # type: (LinkEvaluator, Iterable[Link]) -> List[InstallationCandidate]
-        """
-        Convert links that are candidates to InstallationCandidate objects.
-        """
-        candidates = []
-        for link in self._sort_links(links):
-            candidate = self.get_install_candidate(link_evaluator, link)
-            if candidate is not None:
-                candidates.append(candidate)
-
-        return candidates
-
-    def process_project_url(self, project_url, link_evaluator):
-        # type: (Link, LinkEvaluator) -> List[InstallationCandidate]
-        logger.debug(
-            'Fetching project page and analyzing links: %s', project_url,
-        )
-        html_page = self._link_collector.fetch_page(project_url)
-        if html_page is None:
-            return []
-
-        page_links = list(parse_links(html_page))
-
-        with indent_log():
-            package_links = self.evaluate_links(
-                link_evaluator,
-                links=page_links,
-            )
-
-        return package_links
-
-    def find_all_candidates(self, project_name):
-        # type: (str) -> List[InstallationCandidate]
-        """Find all available InstallationCandidate for project_name
-
-        This checks index_urls and find_links.
-        All versions found are returned as an InstallationCandidate list.
-
-        See LinkEvaluator.evaluate_link() for details on which files
-        are accepted.
-        """
-        collected_links = self._link_collector.collect_links(project_name)
-
-        link_evaluator = self.make_link_evaluator(project_name)
-
-        find_links_versions = self.evaluate_links(
-            link_evaluator,
-            links=collected_links.find_links,
-        )
-
-        page_versions = []
-        for project_url in collected_links.project_urls:
-            package_links = self.process_project_url(
-                project_url, link_evaluator=link_evaluator,
-            )
-            page_versions.extend(package_links)
-
-        file_versions = self.evaluate_links(
-            link_evaluator,
-            links=collected_links.files,
-        )
-        if file_versions:
-            file_versions.sort(reverse=True)
-            logger.debug(
-                'Local files found: %s',
-                ', '.join([
-                    url_to_path(candidate.link.url)
-                    for candidate in file_versions
-                ])
-            )
-
-        # This is an intentional priority ordering
-        return file_versions + find_links_versions + page_versions
-
-    def make_candidate_evaluator(
-        self,
-        project_name,    # type: str
-        specifier=None,  # type: Optional[specifiers.BaseSpecifier]
-        hashes=None,     # type: Optional[Hashes]
-    ):
-        # type: (...) -> CandidateEvaluator
-        """Create a CandidateEvaluator object to use.
-        """
-        candidate_prefs = self._candidate_prefs
-        return CandidateEvaluator.create(
-            project_name=project_name,
-            target_python=self._target_python,
-            prefer_binary=candidate_prefs.prefer_binary,
-            allow_all_prereleases=candidate_prefs.allow_all_prereleases,
-            specifier=specifier,
-            hashes=hashes,
-        )
-
-    def find_best_candidate(
-        self,
-        project_name,       # type: str
-        specifier=None,     # type: Optional[specifiers.BaseSpecifier]
-        hashes=None,        # type: Optional[Hashes]
-    ):
-        # type: (...) -> BestCandidateResult
-        """Find matches for the given project and specifier.
-
-        :param specifier: An optional object implementing `filter`
-            (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable
-            versions.
-
-        :return: A `BestCandidateResult` instance.
-        """
-        candidates = self.find_all_candidates(project_name)
-        candidate_evaluator = self.make_candidate_evaluator(
-            project_name=project_name,
-            specifier=specifier,
-            hashes=hashes,
-        )
-        return candidate_evaluator.compute_best_candidate(candidates)
-
-    def find_requirement(self, req, upgrade):
-        # type: (InstallRequirement, bool) -> Optional[Link]
-        """Try to find a Link matching req
-
-        Expects req, an InstallRequirement and upgrade, a boolean
-        Returns a Link if found,
-        Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise
-        """
-        hashes = req.hashes(trust_internet=False)
-        best_candidate_result = self.find_best_candidate(
-            req.name, specifier=req.specifier, hashes=hashes,
-        )
-        best_candidate = best_candidate_result.best_candidate
-
-        installed_version = None    # type: Optional[_BaseVersion]
-        if req.satisfied_by is not None:
-            installed_version = parse_version(req.satisfied_by.version)
-
-        def _format_versions(cand_iter):
-            # type: (Iterable[InstallationCandidate]) -> str
-            # This repeated parse_version and str() conversion is needed to
-            # handle different vendoring sources from pip and pkg_resources.
-            # If we stop using the pkg_resources provided specifier and start
-            # using our own, we can drop the cast to str().
-            return ", ".join(sorted(
-                {str(c.version) for c in cand_iter},
-                key=parse_version,
-            )) or "none"
-
-        if installed_version is None and best_candidate is None:
-            logger.critical(
-                'Could not find a version that satisfies the requirement %s '
-                '(from versions: %s)',
-                req,
-                _format_versions(best_candidate_result.iter_all()),
-            )
-
-            raise DistributionNotFound(
-                'No matching distribution found for %s' % req
-            )
-
-        best_installed = False
-        if installed_version and (
-                best_candidate is None or
-                best_candidate.version <= installed_version):
-            best_installed = True
-
-        if not upgrade and installed_version is not None:
-            if best_installed:
-                logger.debug(
-                    'Existing installed version (%s) is most up-to-date and '
-                    'satisfies requirement',
-                    installed_version,
-                )
-            else:
-                logger.debug(
-                    'Existing installed version (%s) satisfies requirement '
-                    '(most up-to-date version is %s)',
-                    installed_version,
-                    best_candidate.version,
-                )
-            return None
-
-        if best_installed:
-            # We have an existing version, and its the best version
-            logger.debug(
-                'Installed version (%s) is most up-to-date (past versions: '
-                '%s)',
-                installed_version,
-                _format_versions(best_candidate_result.iter_applicable()),
-            )
-            raise BestVersionAlreadyInstalled
-
-        logger.debug(
-            'Using version %s (newest of versions: %s)',
-            best_candidate.version,
-            _format_versions(best_candidate_result.iter_applicable()),
-        )
-        return best_candidate.link
-
-
-def _find_name_version_sep(fragment, canonical_name):
-    # type: (str, str) -> int
-    """Find the separator's index based on the package's canonical name.
-
-    :param fragment: A + filename "fragment" (stem) or
-        egg fragment.
-    :param canonical_name: The package's canonical name.
-
-    This function is needed since the canonicalized name does not necessarily
-    have the same length as the egg info's name part. An example::
-
-    >>> fragment = 'foo__bar-1.0'
-    >>> canonical_name = 'foo-bar'
-    >>> _find_name_version_sep(fragment, canonical_name)
-    8
-    """
-    # Project name and version must be separated by one single dash. Find all
-    # occurrences of dashes; if the string in front of it matches the canonical
-    # name, this is the one separating the name and version parts.
-    for i, c in enumerate(fragment):
-        if c != "-":
-            continue
-        if canonicalize_name(fragment[:i]) == canonical_name:
-            return i
-    raise ValueError("{} does not match {}".format(fragment, canonical_name))
-
-
-def _extract_version_from_fragment(fragment, canonical_name):
-    # type: (str, str) -> Optional[str]
-    """Parse the version string from a + filename
-    "fragment" (stem) or egg fragment.
-
-    :param fragment: The string to parse. E.g. foo-2.1
-    :param canonical_name: The canonicalized name of the package this
-        belongs to.
-    """
-    try:
-        version_start = _find_name_version_sep(fragment, canonical_name) + 1
-    except ValueError:
-        return None
-    version = fragment[version_start:]
-    if not version:
-        return None
-    return version
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py b/venv/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py
deleted file mode 100644
index ca269121b60c1b792fbc1a08000c4f2e4503e706..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py
+++ /dev/null
@@ -1,430 +0,0 @@
-"""Dependency Resolution
-
-The dependency resolution in pip is performed as follows:
-
-for top-level requirements:
-    a. only one spec allowed per project, regardless of conflicts or not.
-       otherwise a "double requirement" exception is raised
-    b. they override sub-dependency requirements.
-for sub-dependencies
-    a. "first found, wins" (where the order is breadth first)
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-# mypy: disallow-untyped-defs=False
-
-import logging
-import sys
-from collections import defaultdict
-from itertools import chain
-
-from pip._vendor.packaging import specifiers
-
-from pip._internal.exceptions import (
-    BestVersionAlreadyInstalled,
-    DistributionNotFound,
-    HashError,
-    HashErrors,
-    UnsupportedPythonVersion,
-)
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import dist_in_usersite, normalize_version_info
-from pip._internal.utils.packaging import (
-    check_requires_python,
-    get_requires_python,
-)
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Callable, DefaultDict, List, Optional, Set, Tuple
-    from pip._vendor import pkg_resources
-
-    from pip._internal.distributions import AbstractDistribution
-    from pip._internal.index.package_finder import PackageFinder
-    from pip._internal.operations.prepare import RequirementPreparer
-    from pip._internal.req.req_install import InstallRequirement
-    from pip._internal.req.req_set import RequirementSet
-
-    InstallRequirementProvider = Callable[
-        [str, InstallRequirement], InstallRequirement
-    ]
-    DiscoveredDependencies = DefaultDict[str, List[InstallRequirement]]
-
-logger = logging.getLogger(__name__)
-
-
-def _check_dist_requires_python(
-    dist,  # type: pkg_resources.Distribution
-    version_info,  # type: Tuple[int, int, int]
-    ignore_requires_python=False,  # type: bool
-):
-    # type: (...) -> None
-    """
-    Check whether the given Python version is compatible with a distribution's
-    "Requires-Python" value.
-
-    :param version_info: A 3-tuple of ints representing the Python
-        major-minor-micro version to check.
-    :param ignore_requires_python: Whether to ignore the "Requires-Python"
-        value if the given Python version isn't compatible.
-
-    :raises UnsupportedPythonVersion: When the given Python version isn't
-        compatible.
-    """
-    requires_python = get_requires_python(dist)
-    try:
-        is_compatible = check_requires_python(
-            requires_python, version_info=version_info,
-        )
-    except specifiers.InvalidSpecifier as exc:
-        logger.warning(
-            "Package %r has an invalid Requires-Python: %s",
-            dist.project_name, exc,
-        )
-        return
-
-    if is_compatible:
-        return
-
-    version = '.'.join(map(str, version_info))
-    if ignore_requires_python:
-        logger.debug(
-            'Ignoring failed Requires-Python check for package %r: '
-            '%s not in %r',
-            dist.project_name, version, requires_python,
-        )
-        return
-
-    raise UnsupportedPythonVersion(
-        'Package {!r} requires a different Python: {} not in {!r}'.format(
-            dist.project_name, version, requires_python,
-        ))
-
-
-class Resolver(object):
-    """Resolves which packages need to be installed/uninstalled to perform \
-    the requested operation without breaking the requirements of any package.
-    """
-
-    _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"}
-
-    def __init__(
-        self,
-        preparer,  # type: RequirementPreparer
-        finder,  # type: PackageFinder
-        make_install_req,  # type: InstallRequirementProvider
-        use_user_site,  # type: bool
-        ignore_dependencies,  # type: bool
-        ignore_installed,  # type: bool
-        ignore_requires_python,  # type: bool
-        force_reinstall,  # type: bool
-        upgrade_strategy,  # type: str
-        py_version_info=None,  # type: Optional[Tuple[int, ...]]
-    ):
-        # type: (...) -> None
-        super(Resolver, self).__init__()
-        assert upgrade_strategy in self._allowed_strategies
-
-        if py_version_info is None:
-            py_version_info = sys.version_info[:3]
-        else:
-            py_version_info = normalize_version_info(py_version_info)
-
-        self._py_version_info = py_version_info
-
-        self.preparer = preparer
-        self.finder = finder
-
-        self.upgrade_strategy = upgrade_strategy
-        self.force_reinstall = force_reinstall
-        self.ignore_dependencies = ignore_dependencies
-        self.ignore_installed = ignore_installed
-        self.ignore_requires_python = ignore_requires_python
-        self.use_user_site = use_user_site
-        self._make_install_req = make_install_req
-
-        self._discovered_dependencies = \
-            defaultdict(list)  # type: DiscoveredDependencies
-
-    def resolve(self, requirement_set):
-        # type: (RequirementSet) -> None
-        """Resolve what operations need to be done
-
-        As a side-effect of this method, the packages (and their dependencies)
-        are downloaded, unpacked and prepared for installation. This
-        preparation is done by ``pip.operations.prepare``.
-
-        Once PyPI has static dependency metadata available, it would be
-        possible to move the preparation to become a step separated from
-        dependency resolution.
-        """
-        # If any top-level requirement has a hash specified, enter
-        # hash-checking mode, which requires hashes from all.
-        root_reqs = (
-            requirement_set.unnamed_requirements +
-            list(requirement_set.requirements.values())
-        )
-
-        # Actually prepare the files, and collect any exceptions. Most hash
-        # exceptions cannot be checked ahead of time, because
-        # req.populate_link() needs to be called before we can make decisions
-        # based on link type.
-        discovered_reqs = []  # type: List[InstallRequirement]
-        hash_errors = HashErrors()
-        for req in chain(root_reqs, discovered_reqs):
-            try:
-                discovered_reqs.extend(self._resolve_one(requirement_set, req))
-            except HashError as exc:
-                exc.req = req
-                hash_errors.append(exc)
-
-        if hash_errors:
-            raise hash_errors
-
-    def _is_upgrade_allowed(self, req):
-        # type: (InstallRequirement) -> bool
-        if self.upgrade_strategy == "to-satisfy-only":
-            return False
-        elif self.upgrade_strategy == "eager":
-            return True
-        else:
-            assert self.upgrade_strategy == "only-if-needed"
-            return req.is_direct
-
-    def _set_req_to_reinstall(self, req):
-        # type: (InstallRequirement) -> None
-        """
-        Set a requirement to be installed.
-        """
-        # Don't uninstall the conflict if doing a user install and the
-        # conflict is not a user install.
-        if not self.use_user_site or dist_in_usersite(req.satisfied_by):
-            req.should_reinstall = True
-        req.satisfied_by = None
-
-    def _check_skip_installed(self, req_to_install):
-        # type: (InstallRequirement) -> Optional[str]
-        """Check if req_to_install should be skipped.
-
-        This will check if the req is installed, and whether we should upgrade
-        or reinstall it, taking into account all the relevant user options.
-
-        After calling this req_to_install will only have satisfied_by set to
-        None if the req_to_install is to be upgraded/reinstalled etc. Any
-        other value will be a dist recording the current thing installed that
-        satisfies the requirement.
-
-        Note that for vcs urls and the like we can't assess skipping in this
-        routine - we simply identify that we need to pull the thing down,
-        then later on it is pulled down and introspected to assess upgrade/
-        reinstalls etc.
-
-        :return: A text reason for why it was skipped, or None.
-        """
-        if self.ignore_installed:
-            return None
-
-        req_to_install.check_if_exists(self.use_user_site)
-        if not req_to_install.satisfied_by:
-            return None
-
-        if self.force_reinstall:
-            self._set_req_to_reinstall(req_to_install)
-            return None
-
-        if not self._is_upgrade_allowed(req_to_install):
-            if self.upgrade_strategy == "only-if-needed":
-                return 'already satisfied, skipping upgrade'
-            return 'already satisfied'
-
-        # Check for the possibility of an upgrade.  For link-based
-        # requirements we have to pull the tree down and inspect to assess
-        # the version #, so it's handled way down.
-        if not req_to_install.link:
-            try:
-                self.finder.find_requirement(req_to_install, upgrade=True)
-            except BestVersionAlreadyInstalled:
-                # Then the best version is installed.
-                return 'already up-to-date'
-            except DistributionNotFound:
-                # No distribution found, so we squash the error.  It will
-                # be raised later when we re-try later to do the install.
-                # Why don't we just raise here?
-                pass
-
-        self._set_req_to_reinstall(req_to_install)
-        return None
-
-    def _get_abstract_dist_for(self, req):
-        # type: (InstallRequirement) -> AbstractDistribution
-        """Takes a InstallRequirement and returns a single AbstractDist \
-        representing a prepared variant of the same.
-        """
-        if req.editable:
-            return self.preparer.prepare_editable_requirement(req)
-
-        # satisfied_by is only evaluated by calling _check_skip_installed,
-        # so it must be None here.
-        assert req.satisfied_by is None
-        skip_reason = self._check_skip_installed(req)
-
-        if req.satisfied_by:
-            return self.preparer.prepare_installed_requirement(
-                req, skip_reason
-            )
-
-        upgrade_allowed = self._is_upgrade_allowed(req)
-
-        # We eagerly populate the link, since that's our "legacy" behavior.
-        require_hashes = self.preparer.require_hashes
-        req.populate_link(self.finder, upgrade_allowed, require_hashes)
-        abstract_dist = self.preparer.prepare_linked_requirement(req)
-
-        # NOTE
-        # The following portion is for determining if a certain package is
-        # going to be re-installed/upgraded or not and reporting to the user.
-        # This should probably get cleaned up in a future refactor.
-
-        # req.req is only avail after unpack for URL
-        # pkgs repeat check_if_exists to uninstall-on-upgrade
-        # (#14)
-        if not self.ignore_installed:
-            req.check_if_exists(self.use_user_site)
-
-        if req.satisfied_by:
-            should_modify = (
-                self.upgrade_strategy != "to-satisfy-only" or
-                self.force_reinstall or
-                self.ignore_installed or
-                req.link.scheme == 'file'
-            )
-            if should_modify:
-                self._set_req_to_reinstall(req)
-            else:
-                logger.info(
-                    'Requirement already satisfied (use --upgrade to upgrade):'
-                    ' %s', req,
-                )
-
-        return abstract_dist
-
-    def _resolve_one(
-        self,
-        requirement_set,  # type: RequirementSet
-        req_to_install,  # type: InstallRequirement
-    ):
-        # type: (...) -> List[InstallRequirement]
-        """Prepare a single requirements file.
-
-        :return: A list of additional InstallRequirements to also install.
-        """
-        # Tell user what we are doing for this requirement:
-        # obtain (editable), skipping, processing (local url), collecting
-        # (remote url or package name)
-        if req_to_install.constraint or req_to_install.prepared:
-            return []
-
-        req_to_install.prepared = True
-
-        # register tmp src for cleanup in case something goes wrong
-        requirement_set.reqs_to_cleanup.append(req_to_install)
-
-        abstract_dist = self._get_abstract_dist_for(req_to_install)
-
-        # Parse and return dependencies
-        dist = abstract_dist.get_pkg_resources_distribution()
-        # This will raise UnsupportedPythonVersion if the given Python
-        # version isn't compatible with the distribution's Requires-Python.
-        _check_dist_requires_python(
-            dist, version_info=self._py_version_info,
-            ignore_requires_python=self.ignore_requires_python,
-        )
-
-        more_reqs = []  # type: List[InstallRequirement]
-
-        def add_req(subreq, extras_requested):
-            sub_install_req = self._make_install_req(
-                str(subreq),
-                req_to_install,
-            )
-            parent_req_name = req_to_install.name
-            to_scan_again, add_to_parent = requirement_set.add_requirement(
-                sub_install_req,
-                parent_req_name=parent_req_name,
-                extras_requested=extras_requested,
-            )
-            if parent_req_name and add_to_parent:
-                self._discovered_dependencies[parent_req_name].append(
-                    add_to_parent
-                )
-            more_reqs.extend(to_scan_again)
-
-        with indent_log():
-            # We add req_to_install before its dependencies, so that we
-            # can refer to it when adding dependencies.
-            if not requirement_set.has_requirement(req_to_install.name):
-                # 'unnamed' requirements will get added here
-                # 'unnamed' requirements can only come from being directly
-                # provided by the user.
-                assert req_to_install.is_direct
-                requirement_set.add_requirement(
-                    req_to_install, parent_req_name=None,
-                )
-
-            if not self.ignore_dependencies:
-                if req_to_install.extras:
-                    logger.debug(
-                        "Installing extra requirements: %r",
-                        ','.join(req_to_install.extras),
-                    )
-                missing_requested = sorted(
-                    set(req_to_install.extras) - set(dist.extras)
-                )
-                for missing in missing_requested:
-                    logger.warning(
-                        '%s does not provide the extra \'%s\'',
-                        dist, missing
-                    )
-
-                available_requested = sorted(
-                    set(dist.extras) & set(req_to_install.extras)
-                )
-                for subreq in dist.requires(available_requested):
-                    add_req(subreq, extras_requested=available_requested)
-
-            if not req_to_install.editable and not req_to_install.satisfied_by:
-                # XXX: --no-install leads this to report 'Successfully
-                # downloaded' for only non-editable reqs, even though we took
-                # action on them.
-                requirement_set.successfully_downloaded.append(req_to_install)
-
-        return more_reqs
-
-    def get_installation_order(self, req_set):
-        # type: (RequirementSet) -> List[InstallRequirement]
-        """Create the installation order.
-
-        The installation order is topological - requirements are installed
-        before the requiring thing. We break cycles at an arbitrary point,
-        and make no other guarantees.
-        """
-        # The current implementation, which we may change at any point
-        # installs the user specified things in the order given, except when
-        # dependencies must come earlier to achieve topological order.
-        order = []
-        ordered_reqs = set()  # type: Set[InstallRequirement]
-
-        def schedule(req):
-            if req.satisfied_by or req in ordered_reqs:
-                return
-            if req.constraint:
-                return
-            ordered_reqs.add(req)
-            for dep in self._discovered_dependencies[req.name]:
-                schedule(dep)
-            order.append(req)
-
-        for install_req in req_set.requirements.values():
-            schedule(install_req)
-        return order
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/locations.py b/venv/lib/python3.8/site-packages/pip/_internal/locations.py
deleted file mode 100644
index 0c115531911af77f5eab69775c7cdd8e43b47e1d..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/locations.py
+++ /dev/null
@@ -1,194 +0,0 @@
-"""Locations where we look for configs, install stuff, etc"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import os
-import os.path
-import platform
-import site
-import sys
-import sysconfig
-from distutils import sysconfig as distutils_sysconfig
-from distutils.command.install import SCHEME_KEYS  # type: ignore
-from distutils.command.install import install as distutils_install_command
-
-from pip._internal.models.scheme import Scheme
-from pip._internal.utils import appdirs
-from pip._internal.utils.compat import WINDOWS
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING, cast
-from pip._internal.utils.virtualenv import running_under_virtualenv
-
-if MYPY_CHECK_RUNNING:
-    from typing import Dict, List, Optional, Union
-
-    from distutils.cmd import Command as DistutilsCommand
-
-
-# Application Directories
-USER_CACHE_DIR = appdirs.user_cache_dir("pip")
-
-
-def get_major_minor_version():
-    # type: () -> str
-    """
-    Return the major-minor version of the current Python as a string, e.g.
-    "3.7" or "3.10".
-    """
-    return '{}.{}'.format(*sys.version_info)
-
-
-def get_src_prefix():
-    # type: () -> str
-    if running_under_virtualenv():
-        src_prefix = os.path.join(sys.prefix, 'src')
-    else:
-        # FIXME: keep src in cwd for now (it is not a temporary folder)
-        try:
-            src_prefix = os.path.join(os.getcwd(), 'src')
-        except OSError:
-            # In case the current working directory has been renamed or deleted
-            sys.exit(
-                "The folder you are executing pip from can no longer be found."
-            )
-
-    # under macOS + virtualenv sys.prefix is not properly resolved
-    # it is something like /path/to/python/bin/..
-    return os.path.abspath(src_prefix)
-
-
-# FIXME doesn't account for venv linked to global site-packages
-
-site_packages = sysconfig.get_path("purelib")  # type: Optional[str]
-
-# This is because of a bug in PyPy's sysconfig module, see
-# https://bitbucket.org/pypy/pypy/issues/2506/sysconfig-returns-incorrect-paths
-# for more information.
-if platform.python_implementation().lower() == "pypy":
-    site_packages = distutils_sysconfig.get_python_lib()
-try:
-    # Use getusersitepackages if this is present, as it ensures that the
-    # value is initialised properly.
-    user_site = site.getusersitepackages()
-except AttributeError:
-    user_site = site.USER_SITE
-
-if WINDOWS:
-    bin_py = os.path.join(sys.prefix, 'Scripts')
-    bin_user = os.path.join(user_site, 'Scripts')
-    # buildout uses 'bin' on Windows too?
-    if not os.path.exists(bin_py):
-        bin_py = os.path.join(sys.prefix, 'bin')
-        bin_user = os.path.join(user_site, 'bin')
-else:
-    bin_py = os.path.join(sys.prefix, 'bin')
-    bin_user = os.path.join(user_site, 'bin')
-
-    # Forcing to use /usr/local/bin for standard macOS framework installs
-    # Also log to ~/Library/Logs/ for use with the Console.app log viewer
-    if sys.platform[:6] == 'darwin' and sys.prefix[:16] == '/System/Library/':
-        bin_py = '/usr/local/bin'
-
-
-def distutils_scheme(
-    dist_name, user=False, home=None, root=None, isolated=False, prefix=None
-):
-    # type:(str, bool, str, str, bool, str) -> Dict[str, str]
-    """
-    Return a distutils install scheme
-    """
-    from distutils.dist import Distribution
-
-    dist_args = {'name': dist_name}  # type: Dict[str, Union[str, List[str]]]
-    if isolated:
-        dist_args["script_args"] = ["--no-user-cfg"]
-
-    d = Distribution(dist_args)
-    d.parse_config_files()
-    obj = None  # type: Optional[DistutilsCommand]
-    obj = d.get_command_obj('install', create=True)
-    assert obj is not None
-    i = cast(distutils_install_command, obj)
-    # NOTE: setting user or home has the side-effect of creating the home dir
-    # or user base for installations during finalize_options()
-    # ideally, we'd prefer a scheme class that has no side-effects.
-    assert not (user and prefix), "user={} prefix={}".format(user, prefix)
-    assert not (home and prefix), "home={} prefix={}".format(home, prefix)
-    i.user = user or i.user
-    if user or home:
-        i.prefix = ""
-    i.prefix = prefix or i.prefix
-    i.home = home or i.home
-    i.root = root or i.root
-    i.finalize_options()
-
-    scheme = {}
-    for key in SCHEME_KEYS:
-        scheme[key] = getattr(i, 'install_' + key)
-
-    # install_lib specified in setup.cfg should install *everything*
-    # into there (i.e. it takes precedence over both purelib and
-    # platlib).  Note, i.install_lib is *always* set after
-    # finalize_options(); we only want to override here if the user
-    # has explicitly requested it hence going back to the config
-    if 'install_lib' in d.get_option_dict('install'):
-        scheme.update(dict(purelib=i.install_lib, platlib=i.install_lib))
-
-    if running_under_virtualenv():
-        scheme['headers'] = os.path.join(
-            sys.prefix,
-            'include',
-            'site',
-            'python{}'.format(get_major_minor_version()),
-            dist_name,
-        )
-
-        if root is not None:
-            path_no_drive = os.path.splitdrive(
-                os.path.abspath(scheme["headers"]))[1]
-            scheme["headers"] = os.path.join(
-                root,
-                path_no_drive[1:],
-            )
-
-    return scheme
-
-
-def get_scheme(
-    dist_name,  # type: str
-    user=False,  # type: bool
-    home=None,  # type: Optional[str]
-    root=None,  # type: Optional[str]
-    isolated=False,  # type: bool
-    prefix=None,  # type: Optional[str]
-):
-    # type: (...) -> Scheme
-    """
-    Get the "scheme" corresponding to the input parameters. The distutils
-    documentation provides the context for the available schemes:
-    https://docs.python.org/3/install/index.html#alternate-installation
-
-    :param dist_name: the name of the package to retrieve the scheme for, used
-        in the headers scheme path
-    :param user: indicates to use the "user" scheme
-    :param home: indicates to use the "home" scheme and provides the base
-        directory for the same
-    :param root: root under which other directories are re-based
-    :param isolated: equivalent to --no-user-cfg, i.e. do not consider
-        ~/.pydistutils.cfg (posix) or ~/pydistutils.cfg (non-posix) for
-        scheme paths
-    :param prefix: indicates to use the "prefix" scheme and provides the
-        base directory for the same
-    """
-    scheme = distutils_scheme(
-        dist_name, user, home, root, isolated, prefix
-    )
-    return Scheme(
-        platlib=scheme["platlib"],
-        purelib=scheme["purelib"],
-        headers=scheme["headers"],
-        scripts=scheme["scripts"],
-        data=scheme["data"],
-    )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/main.py b/venv/lib/python3.8/site-packages/pip/_internal/main.py
deleted file mode 100644
index 3208d5b8820eadf8a1ebe4851c984c6033c289bd..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/main.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, List
-
-
-def main(args=None):
-    # type: (Optional[List[str]]) -> int
-    """This is preserved for old console scripts that may still be referencing
-    it.
-
-    For additional details, see https://github.com/pypa/pip/issues/7498.
-    """
-    from pip._internal.utils.entrypoints import _wrapper
-
-    return _wrapper(args)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/models/__init__.py
deleted file mode 100644
index 7855226e4b500142deef8fb247cd33a9a991d122..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-"""A package that contains models that represent entities.
-"""
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 5cdbebed7894aad62dfea581d2e94bd4b9d303e5..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/candidate.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/candidate.cpython-38.pyc
deleted file mode 100644
index c53ac774fecd4ab8df2acc434e713bc2bc175382..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/candidate.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/format_control.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/format_control.cpython-38.pyc
deleted file mode 100644
index d8f1370fe8e2bfa2444c7c0ca918c45e2b9b065e..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/format_control.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/index.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/index.cpython-38.pyc
deleted file mode 100644
index 7e80d5fafff0a4f65eb08bdd83f827dd3928bead..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/index.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/link.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/link.cpython-38.pyc
deleted file mode 100644
index 1a0266dcb28cdfab3e55220b75c8de79e0659d25..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/link.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/scheme.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/scheme.cpython-38.pyc
deleted file mode 100644
index aeca948edf0747c619e745f4a8622a84646c1f6d..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/scheme.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-38.pyc
deleted file mode 100644
index e5b2cce729fad2f03d719b8d11c2f59188fa3a4c..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-38.pyc
deleted file mode 100644
index cbc01116dd80091a0ff9b891795f6b6f54cfccdd..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/target_python.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/target_python.cpython-38.pyc
deleted file mode 100644
index 1773d2becbdd8c506aa5ebf46b5f6e45d14c1d4d..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/target_python.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/wheel.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/wheel.cpython-38.pyc
deleted file mode 100644
index 2dd7290df6ff9c6fc726c1f21cf89e9819f013a6..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/models/__pycache__/wheel.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/candidate.py b/venv/lib/python3.8/site-packages/pip/_internal/models/candidate.py
deleted file mode 100644
index 1dc1a576eea788c23f5722bbb8e10ae950ef38bd..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/candidate.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from pip._vendor.packaging.version import parse as parse_version
-
-from pip._internal.utils.models import KeyBasedCompareMixin
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from pip._vendor.packaging.version import _BaseVersion
-    from pip._internal.models.link import Link
-
-
-class InstallationCandidate(KeyBasedCompareMixin):
-    """Represents a potential "candidate" for installation.
-    """
-
-    def __init__(self, name, version, link):
-        # type: (str, str, Link) -> None
-        self.name = name
-        self.version = parse_version(version)  # type: _BaseVersion
-        self.link = link
-
-        super(InstallationCandidate, self).__init__(
-            key=(self.name, self.version, self.link),
-            defining_class=InstallationCandidate
-        )
-
-    def __repr__(self):
-        # type: () -> str
-        return "".format(
-            self.name, self.version, self.link,
-        )
-
-    def __str__(self):
-        # type: () -> str
-        return '{!r} candidate (version {} at {})'.format(
-            self.name, self.version, self.link,
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/format_control.py b/venv/lib/python3.8/site-packages/pip/_internal/models/format_control.py
deleted file mode 100644
index 2e13727ca006977f3fb2df30fd1a25bb1670cf3e..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/format_control.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from pip._vendor.packaging.utils import canonicalize_name
-
-from pip._internal.exceptions import CommandError
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Set, FrozenSet
-
-
-class FormatControl(object):
-    """Helper for managing formats from which a package can be installed.
-    """
-
-    def __init__(self, no_binary=None, only_binary=None):
-        # type: (Optional[Set[str]], Optional[Set[str]]) -> None
-        if no_binary is None:
-            no_binary = set()
-        if only_binary is None:
-            only_binary = set()
-
-        self.no_binary = no_binary
-        self.only_binary = only_binary
-
-    def __eq__(self, other):
-        # type: (object) -> bool
-        return self.__dict__ == other.__dict__
-
-    def __ne__(self, other):
-        # type: (object) -> bool
-        return not self.__eq__(other)
-
-    def __repr__(self):
-        # type: () -> str
-        return "{}({}, {})".format(
-            self.__class__.__name__,
-            self.no_binary,
-            self.only_binary
-        )
-
-    @staticmethod
-    def handle_mutual_excludes(value, target, other):
-        # type: (str, Optional[Set[str]], Optional[Set[str]]) -> None
-        if value.startswith('-'):
-            raise CommandError(
-                "--no-binary / --only-binary option requires 1 argument."
-            )
-        new = value.split(',')
-        while ':all:' in new:
-            other.clear()
-            target.clear()
-            target.add(':all:')
-            del new[:new.index(':all:') + 1]
-            # Without a none, we want to discard everything as :all: covers it
-            if ':none:' not in new:
-                return
-        for name in new:
-            if name == ':none:':
-                target.clear()
-                continue
-            name = canonicalize_name(name)
-            other.discard(name)
-            target.add(name)
-
-    def get_allowed_formats(self, canonical_name):
-        # type: (str) -> FrozenSet[str]
-        result = {"binary", "source"}
-        if canonical_name in self.only_binary:
-            result.discard('source')
-        elif canonical_name in self.no_binary:
-            result.discard('binary')
-        elif ':all:' in self.only_binary:
-            result.discard('source')
-        elif ':all:' in self.no_binary:
-            result.discard('binary')
-        return frozenset(result)
-
-    def disallow_binaries(self):
-        # type: () -> None
-        self.handle_mutual_excludes(
-            ':all:', self.no_binary, self.only_binary,
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/index.py b/venv/lib/python3.8/site-packages/pip/_internal/models/index.py
deleted file mode 100644
index ead1efbda761ebed373700ce9e69797838c2b9d9..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/index.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-
-
-class PackageIndex(object):
-    """Represents a Package Index and provides easier access to endpoints
-    """
-
-    def __init__(self, url, file_storage_domain):
-        # type: (str, str) -> None
-        super(PackageIndex, self).__init__()
-        self.url = url
-        self.netloc = urllib_parse.urlsplit(url).netloc
-        self.simple_url = self._url_for_path('simple')
-        self.pypi_url = self._url_for_path('pypi')
-
-        # This is part of a temporary hack used to block installs of PyPI
-        # packages which depend on external urls only necessary until PyPI can
-        # block such packages themselves
-        self.file_storage_domain = file_storage_domain
-
-    def _url_for_path(self, path):
-        # type: (str) -> str
-        return urllib_parse.urljoin(self.url, path)
-
-
-PyPI = PackageIndex(
-    'https://pypi.org/', file_storage_domain='files.pythonhosted.org'
-)
-TestPyPI = PackageIndex(
-    'https://test.pypi.org/', file_storage_domain='test-files.pythonhosted.org'
-)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/link.py b/venv/lib/python3.8/site-packages/pip/_internal/models/link.py
deleted file mode 100644
index 34fbcbfe7e4dcc6873288db8455890ce77405405..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/link.py
+++ /dev/null
@@ -1,227 +0,0 @@
-import os
-import posixpath
-import re
-
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-
-from pip._internal.utils.filetypes import WHEEL_EXTENSION
-from pip._internal.utils.misc import (
-    redact_auth_from_url,
-    split_auth_from_netloc,
-    splitext,
-)
-from pip._internal.utils.models import KeyBasedCompareMixin
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import path_to_url, url_to_path
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Text, Tuple, Union
-    from pip._internal.index.collector import HTMLPage
-    from pip._internal.utils.hashes import Hashes
-
-
-class Link(KeyBasedCompareMixin):
-    """Represents a parsed link from a Package Index's simple URL
-    """
-
-    def __init__(
-        self,
-        url,                   # type: str
-        comes_from=None,       # type: Optional[Union[str, HTMLPage]]
-        requires_python=None,  # type: Optional[str]
-        yanked_reason=None,    # type: Optional[Text]
-    ):
-        # type: (...) -> None
-        """
-        :param url: url of the resource pointed to (href of the link)
-        :param comes_from: instance of HTMLPage where the link was found,
-            or string.
-        :param requires_python: String containing the `Requires-Python`
-            metadata field, specified in PEP 345. This may be specified by
-            a data-requires-python attribute in the HTML link tag, as
-            described in PEP 503.
-        :param yanked_reason: the reason the file has been yanked, if the
-            file has been yanked, or None if the file hasn't been yanked.
-            This is the value of the "data-yanked" attribute, if present, in
-            a simple repository HTML link. If the file has been yanked but
-            no reason was provided, this should be the empty string. See
-            PEP 592 for more information and the specification.
-        """
-
-        # url can be a UNC windows share
-        if url.startswith('\\\\'):
-            url = path_to_url(url)
-
-        self._parsed_url = urllib_parse.urlsplit(url)
-        # Store the url as a private attribute to prevent accidentally
-        # trying to set a new value.
-        self._url = url
-
-        self.comes_from = comes_from
-        self.requires_python = requires_python if requires_python else None
-        self.yanked_reason = yanked_reason
-
-        super(Link, self).__init__(key=url, defining_class=Link)
-
-    def __str__(self):
-        # type: () -> str
-        if self.requires_python:
-            rp = ' (requires-python:%s)' % self.requires_python
-        else:
-            rp = ''
-        if self.comes_from:
-            return '%s (from %s)%s' % (redact_auth_from_url(self._url),
-                                       self.comes_from, rp)
-        else:
-            return redact_auth_from_url(str(self._url))
-
-    def __repr__(self):
-        # type: () -> str
-        return '' % self
-
-    @property
-    def url(self):
-        # type: () -> str
-        return self._url
-
-    @property
-    def filename(self):
-        # type: () -> str
-        path = self.path.rstrip('/')
-        name = posixpath.basename(path)
-        if not name:
-            # Make sure we don't leak auth information if the netloc
-            # includes a username and password.
-            netloc, user_pass = split_auth_from_netloc(self.netloc)
-            return netloc
-
-        name = urllib_parse.unquote(name)
-        assert name, ('URL %r produced no filename' % self._url)
-        return name
-
-    @property
-    def file_path(self):
-        # type: () -> str
-        return url_to_path(self.url)
-
-    @property
-    def scheme(self):
-        # type: () -> str
-        return self._parsed_url.scheme
-
-    @property
-    def netloc(self):
-        # type: () -> str
-        """
-        This can contain auth information.
-        """
-        return self._parsed_url.netloc
-
-    @property
-    def path(self):
-        # type: () -> str
-        return urllib_parse.unquote(self._parsed_url.path)
-
-    def splitext(self):
-        # type: () -> Tuple[str, str]
-        return splitext(posixpath.basename(self.path.rstrip('/')))
-
-    @property
-    def ext(self):
-        # type: () -> str
-        return self.splitext()[1]
-
-    @property
-    def url_without_fragment(self):
-        # type: () -> str
-        scheme, netloc, path, query, fragment = self._parsed_url
-        return urllib_parse.urlunsplit((scheme, netloc, path, query, None))
-
-    _egg_fragment_re = re.compile(r'[#&]egg=([^&]*)')
-
-    @property
-    def egg_fragment(self):
-        # type: () -> Optional[str]
-        match = self._egg_fragment_re.search(self._url)
-        if not match:
-            return None
-        return match.group(1)
-
-    _subdirectory_fragment_re = re.compile(r'[#&]subdirectory=([^&]*)')
-
-    @property
-    def subdirectory_fragment(self):
-        # type: () -> Optional[str]
-        match = self._subdirectory_fragment_re.search(self._url)
-        if not match:
-            return None
-        return match.group(1)
-
-    _hash_re = re.compile(
-        r'(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)'
-    )
-
-    @property
-    def hash(self):
-        # type: () -> Optional[str]
-        match = self._hash_re.search(self._url)
-        if match:
-            return match.group(2)
-        return None
-
-    @property
-    def hash_name(self):
-        # type: () -> Optional[str]
-        match = self._hash_re.search(self._url)
-        if match:
-            return match.group(1)
-        return None
-
-    @property
-    def show_url(self):
-        # type: () -> str
-        return posixpath.basename(self._url.split('#', 1)[0].split('?', 1)[0])
-
-    @property
-    def is_file(self):
-        # type: () -> bool
-        return self.scheme == 'file'
-
-    def is_existing_dir(self):
-        # type: () -> bool
-        return self.is_file and os.path.isdir(self.file_path)
-
-    @property
-    def is_wheel(self):
-        # type: () -> bool
-        return self.ext == WHEEL_EXTENSION
-
-    @property
-    def is_vcs(self):
-        # type: () -> bool
-        from pip._internal.vcs import vcs
-
-        return self.scheme in vcs.all_schemes
-
-    @property
-    def is_yanked(self):
-        # type: () -> bool
-        return self.yanked_reason is not None
-
-    @property
-    def has_hash(self):
-        # type: () -> bool
-        return self.hash_name is not None
-
-    def is_hash_allowed(self, hashes):
-        # type: (Optional[Hashes]) -> bool
-        """
-        Return True if the link has a hash and it is allowed.
-        """
-        if hashes is None or not self.has_hash:
-            return False
-        # Assert non-None so mypy knows self.hash_name and self.hash are str.
-        assert self.hash_name is not None
-        assert self.hash is not None
-
-        return hashes.is_hash_allowed(self.hash_name, hex_digest=self.hash)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/scheme.py b/venv/lib/python3.8/site-packages/pip/_internal/models/scheme.py
deleted file mode 100644
index af07b4078f997b5c6005c042ac178282c49fd5e7..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/scheme.py
+++ /dev/null
@@ -1,25 +0,0 @@
-"""
-For types associated with installation schemes.
-
-For a general overview of available schemes and their context, see
-https://docs.python.org/3/install/index.html#alternate-installation.
-"""
-
-
-class Scheme(object):
-    """A Scheme holds paths which are used as the base directories for
-    artifacts associated with a Python package.
-    """
-    def __init__(
-        self,
-        platlib,  # type: str
-        purelib,  # type: str
-        headers,  # type: str
-        scripts,  # type: str
-        data,  # type: str
-    ):
-        self.platlib = platlib
-        self.purelib = purelib
-        self.headers = headers
-        self.scripts = scripts
-        self.data = data
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/search_scope.py b/venv/lib/python3.8/site-packages/pip/_internal/models/search_scope.py
deleted file mode 100644
index 138d1b6eedf8d5b58f25c821ac393408d1e73067..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/search_scope.py
+++ /dev/null
@@ -1,114 +0,0 @@
-import itertools
-import logging
-import os
-import posixpath
-
-from pip._vendor.packaging.utils import canonicalize_name
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-
-from pip._internal.models.index import PyPI
-from pip._internal.utils.compat import has_tls
-from pip._internal.utils.misc import normalize_path, redact_auth_from_url
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List
-
-
-logger = logging.getLogger(__name__)
-
-
-class SearchScope(object):
-
-    """
-    Encapsulates the locations that pip is configured to search.
-    """
-
-    @classmethod
-    def create(
-        cls,
-        find_links,  # type: List[str]
-        index_urls,  # type: List[str]
-    ):
-        # type: (...) -> SearchScope
-        """
-        Create a SearchScope object after normalizing the `find_links`.
-        """
-        # Build find_links. If an argument starts with ~, it may be
-        # a local file relative to a home directory. So try normalizing
-        # it and if it exists, use the normalized version.
-        # This is deliberately conservative - it might be fine just to
-        # blindly normalize anything starting with a ~...
-        built_find_links = []  # type: List[str]
-        for link in find_links:
-            if link.startswith('~'):
-                new_link = normalize_path(link)
-                if os.path.exists(new_link):
-                    link = new_link
-            built_find_links.append(link)
-
-        # If we don't have TLS enabled, then WARN if anyplace we're looking
-        # relies on TLS.
-        if not has_tls():
-            for link in itertools.chain(index_urls, built_find_links):
-                parsed = urllib_parse.urlparse(link)
-                if parsed.scheme == 'https':
-                    logger.warning(
-                        'pip is configured with locations that require '
-                        'TLS/SSL, however the ssl module in Python is not '
-                        'available.'
-                    )
-                    break
-
-        return cls(
-            find_links=built_find_links,
-            index_urls=index_urls,
-        )
-
-    def __init__(
-        self,
-        find_links,  # type: List[str]
-        index_urls,  # type: List[str]
-    ):
-        # type: (...) -> None
-        self.find_links = find_links
-        self.index_urls = index_urls
-
-    def get_formatted_locations(self):
-        # type: () -> str
-        lines = []
-        if self.index_urls and self.index_urls != [PyPI.simple_url]:
-            lines.append(
-                'Looking in indexes: {}'.format(', '.join(
-                    redact_auth_from_url(url) for url in self.index_urls))
-            )
-        if self.find_links:
-            lines.append(
-                'Looking in links: {}'.format(', '.join(
-                    redact_auth_from_url(url) for url in self.find_links))
-            )
-        return '\n'.join(lines)
-
-    def get_index_urls_locations(self, project_name):
-        # type: (str) -> List[str]
-        """Returns the locations found via self.index_urls
-
-        Checks the url_name on the main (first in the list) index and
-        use this url_name to produce all locations
-        """
-
-        def mkurl_pypi_url(url):
-            # type: (str) -> str
-            loc = posixpath.join(
-                url,
-                urllib_parse.quote(canonicalize_name(project_name)))
-            # For maximum compatibility with easy_install, ensure the path
-            # ends in a trailing slash.  Although this isn't in the spec
-            # (and PyPI can handle it without the slash) some other index
-            # implementations might break if they relied on easy_install's
-            # behavior.
-            if not loc.endswith('/'):
-                loc = loc + '/'
-            return loc
-
-        return [mkurl_pypi_url(url) for url in self.index_urls]
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/selection_prefs.py b/venv/lib/python3.8/site-packages/pip/_internal/models/selection_prefs.py
deleted file mode 100644
index f58fdce9cdfcb9320c09f0652ff20a9dc52f3701..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/selection_prefs.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional
-    from pip._internal.models.format_control import FormatControl
-
-
-class SelectionPreferences(object):
-
-    """
-    Encapsulates the candidate selection preferences for downloading
-    and installing files.
-    """
-
-    # Don't include an allow_yanked default value to make sure each call
-    # site considers whether yanked releases are allowed. This also causes
-    # that decision to be made explicit in the calling code, which helps
-    # people when reading the code.
-    def __init__(
-        self,
-        allow_yanked,  # type: bool
-        allow_all_prereleases=False,  # type: bool
-        format_control=None,          # type: Optional[FormatControl]
-        prefer_binary=False,          # type: bool
-        ignore_requires_python=None,  # type: Optional[bool]
-    ):
-        # type: (...) -> None
-        """Create a SelectionPreferences object.
-
-        :param allow_yanked: Whether files marked as yanked (in the sense
-            of PEP 592) are permitted to be candidates for install.
-        :param format_control: A FormatControl object or None. Used to control
-            the selection of source packages / binary packages when consulting
-            the index and links.
-        :param prefer_binary: Whether to prefer an old, but valid, binary
-            dist over a new source dist.
-        :param ignore_requires_python: Whether to ignore incompatible
-            "Requires-Python" values in links. Defaults to False.
-        """
-        if ignore_requires_python is None:
-            ignore_requires_python = False
-
-        self.allow_yanked = allow_yanked
-        self.allow_all_prereleases = allow_all_prereleases
-        self.format_control = format_control
-        self.prefer_binary = prefer_binary
-        self.ignore_requires_python = ignore_requires_python
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/target_python.py b/venv/lib/python3.8/site-packages/pip/_internal/models/target_python.py
deleted file mode 100644
index 97ae85a0945b88e63db603fbeb4d49bdc339fa6a..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/target_python.py
+++ /dev/null
@@ -1,107 +0,0 @@
-import sys
-
-from pip._internal.pep425tags import get_supported, version_info_to_nodot
-from pip._internal.utils.misc import normalize_version_info
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional, Tuple
-
-    from pip._vendor.packaging.tags import Tag
-
-
-class TargetPython(object):
-
-    """
-    Encapsulates the properties of a Python interpreter one is targeting
-    for a package install, download, etc.
-    """
-
-    def __init__(
-        self,
-        platform=None,  # type: Optional[str]
-        py_version_info=None,  # type: Optional[Tuple[int, ...]]
-        abi=None,  # type: Optional[str]
-        implementation=None,  # type: Optional[str]
-    ):
-        # type: (...) -> None
-        """
-        :param platform: A string or None. If None, searches for packages
-            that are supported by the current system. Otherwise, will find
-            packages that can be built on the platform passed in. These
-            packages will only be downloaded for distribution: they will
-            not be built locally.
-        :param py_version_info: An optional tuple of ints representing the
-            Python version information to use (e.g. `sys.version_info[:3]`).
-            This can have length 1, 2, or 3 when provided.
-        :param abi: A string or None. This is passed to pep425tags.py's
-            get_supported() function as is.
-        :param implementation: A string or None. This is passed to
-            pep425tags.py's get_supported() function as is.
-        """
-        # Store the given py_version_info for when we call get_supported().
-        self._given_py_version_info = py_version_info
-
-        if py_version_info is None:
-            py_version_info = sys.version_info[:3]
-        else:
-            py_version_info = normalize_version_info(py_version_info)
-
-        py_version = '.'.join(map(str, py_version_info[:2]))
-
-        self.abi = abi
-        self.implementation = implementation
-        self.platform = platform
-        self.py_version = py_version
-        self.py_version_info = py_version_info
-
-        # This is used to cache the return value of get_tags().
-        self._valid_tags = None  # type: Optional[List[Tag]]
-
-    def format_given(self):
-        # type: () -> str
-        """
-        Format the given, non-None attributes for display.
-        """
-        display_version = None
-        if self._given_py_version_info is not None:
-            display_version = '.'.join(
-                str(part) for part in self._given_py_version_info
-            )
-
-        key_values = [
-            ('platform', self.platform),
-            ('version_info', display_version),
-            ('abi', self.abi),
-            ('implementation', self.implementation),
-        ]
-        return ' '.join(
-            '{}={!r}'.format(key, value) for key, value in key_values
-            if value is not None
-        )
-
-    def get_tags(self):
-        # type: () -> List[Tag]
-        """
-        Return the supported PEP 425 tags to check wheel candidates against.
-
-        The tags are returned in order of preference (most preferred first).
-        """
-        if self._valid_tags is None:
-            # Pass versions=None if no py_version_info was given since
-            # versions=None uses special default logic.
-            py_version_info = self._given_py_version_info
-            if py_version_info is None:
-                version = None
-            else:
-                version = version_info_to_nodot(py_version_info)
-
-            tags = get_supported(
-                version=version,
-                platform=self.platform,
-                abi=self.abi,
-                impl=self.implementation,
-            )
-            self._valid_tags = tags
-
-        return self._valid_tags
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/models/wheel.py b/venv/lib/python3.8/site-packages/pip/_internal/models/wheel.py
deleted file mode 100644
index 34d8c2ec3c024f9638946e1dedc55edbd8029473..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/models/wheel.py
+++ /dev/null
@@ -1,78 +0,0 @@
-"""Represents a wheel file and provides access to the various parts of the
-name that have meaning.
-"""
-import re
-
-from pip._vendor.packaging.tags import Tag
-
-from pip._internal.exceptions import InvalidWheelFilename
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List
-
-
-class Wheel(object):
-    """A wheel file"""
-
-    wheel_file_re = re.compile(
-        r"""^(?P(?P[^\s-]+?)-(?P[^\s-]*?))
-        ((-(?P\d[^-]*?))?-(?P[^\s-]+?)-(?P[^\s-]+?)-(?P[^\s-]+?)
-        \.whl|\.dist-info)$""",
-        re.VERBOSE
-    )
-
-    def __init__(self, filename):
-        # type: (str) -> None
-        """
-        :raises InvalidWheelFilename: when the filename is invalid for a wheel
-        """
-        wheel_info = self.wheel_file_re.match(filename)
-        if not wheel_info:
-            raise InvalidWheelFilename(
-                "%s is not a valid wheel filename." % filename
-            )
-        self.filename = filename
-        self.name = wheel_info.group('name').replace('_', '-')
-        # we'll assume "_" means "-" due to wheel naming scheme
-        # (https://github.com/pypa/pip/issues/1150)
-        self.version = wheel_info.group('ver').replace('_', '-')
-        self.build_tag = wheel_info.group('build')
-        self.pyversions = wheel_info.group('pyver').split('.')
-        self.abis = wheel_info.group('abi').split('.')
-        self.plats = wheel_info.group('plat').split('.')
-
-        # All the tag combinations from this file
-        self.file_tags = {
-            Tag(x, y, z) for x in self.pyversions
-            for y in self.abis for z in self.plats
-        }
-
-    def get_formatted_file_tags(self):
-        # type: () -> List[str]
-        """Return the wheel's tags as a sorted list of strings."""
-        return sorted(str(tag) for tag in self.file_tags)
-
-    def support_index_min(self, tags):
-        # type: (List[Tag]) -> int
-        """Return the lowest index that one of the wheel's file_tag combinations
-        achieves in the given list of supported tags.
-
-        For example, if there are 8 supported tags and one of the file tags
-        is first in the list, then return 0.
-
-        :param tags: the PEP 425 tags to check the wheel against, in order
-            with most preferred first.
-
-        :raises ValueError: If none of the wheel's file tags match one of
-            the supported tags.
-        """
-        return min(tags.index(tag) for tag in self.file_tags if tag in tags)
-
-    def supported(self, tags):
-        # type: (List[Tag]) -> bool
-        """Return whether the wheel is compatible with one of the given tags.
-
-        :param tags: the PEP 425 tags to check the wheel against.
-        """
-        return not self.file_tags.isdisjoint(tags)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/network/__init__.py
deleted file mode 100644
index b51bde91b2e5b4e557ed9b70fc113843cc3d49ae..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/network/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-"""Contains purely network-related utilities.
-"""
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 81d9ba239fe8842c581060f56a7e927e3058d59a..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/auth.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/auth.cpython-38.pyc
deleted file mode 100644
index 44559ed3310e36e7d405a9cfb2e40af3cf26483f..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/auth.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/cache.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/cache.cpython-38.pyc
deleted file mode 100644
index a5168940fc051f616da59567aba726a2323e989f..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/cache.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/download.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/download.cpython-38.pyc
deleted file mode 100644
index 2de41f1ab74719ffb5c4d840e179210593767134..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/download.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/session.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/session.cpython-38.pyc
deleted file mode 100644
index 68f31b0ba8f294061b176b23718ccb8d6bb6da3b..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/session.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/utils.cpython-38.pyc
deleted file mode 100644
index 27c4e554b86d88a9299efac283306339b458daa9..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/utils.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-38.pyc
deleted file mode 100644
index e7c18055503236825cdd0e73bc863691b3482e1e..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/auth.py b/venv/lib/python3.8/site-packages/pip/_internal/network/auth.py
deleted file mode 100644
index 1e1da54ca59d8d42b53b51f95b876b369f76b4a1..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/network/auth.py
+++ /dev/null
@@ -1,298 +0,0 @@
-"""Network Authentication Helpers
-
-Contains interface (MultiDomainBasicAuth) and associated glue code for
-providing credentials in the context of network requests.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-import logging
-
-from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth
-from pip._vendor.requests.utils import get_netrc_auth
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-
-from pip._internal.utils.misc import (
-    ask,
-    ask_input,
-    ask_password,
-    remove_auth_from_url,
-    split_auth_netloc_from_url,
-)
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from optparse import Values
-    from typing import Dict, Optional, Tuple
-
-    from pip._internal.vcs.versioncontrol import AuthInfo
-
-    Credentials = Tuple[str, str, str]
-
-logger = logging.getLogger(__name__)
-
-try:
-    import keyring  # noqa
-except ImportError:
-    keyring = None
-except Exception as exc:
-    logger.warning(
-        "Keyring is skipped due to an exception: %s", str(exc),
-    )
-    keyring = None
-
-
-def get_keyring_auth(url, username):
-    """Return the tuple auth for a given url from keyring."""
-    if not url or not keyring:
-        return None
-
-    try:
-        try:
-            get_credential = keyring.get_credential
-        except AttributeError:
-            pass
-        else:
-            logger.debug("Getting credentials from keyring for %s", url)
-            cred = get_credential(url, username)
-            if cred is not None:
-                return cred.username, cred.password
-            return None
-
-        if username:
-            logger.debug("Getting password from keyring for %s", url)
-            password = keyring.get_password(url, username)
-            if password:
-                return username, password
-
-    except Exception as exc:
-        logger.warning(
-            "Keyring is skipped due to an exception: %s", str(exc),
-        )
-
-
-class MultiDomainBasicAuth(AuthBase):
-
-    def __init__(self, prompting=True, index_urls=None):
-        # type: (bool, Optional[Values]) -> None
-        self.prompting = prompting
-        self.index_urls = index_urls
-        self.passwords = {}  # type: Dict[str, AuthInfo]
-        # When the user is prompted to enter credentials and keyring is
-        # available, we will offer to save them. If the user accepts,
-        # this value is set to the credentials they entered. After the
-        # request authenticates, the caller should call
-        # ``save_credentials`` to save these.
-        self._credentials_to_save = None  # type: Optional[Credentials]
-
-    def _get_index_url(self, url):
-        """Return the original index URL matching the requested URL.
-
-        Cached or dynamically generated credentials may work against
-        the original index URL rather than just the netloc.
-
-        The provided url should have had its username and password
-        removed already. If the original index url had credentials then
-        they will be included in the return value.
-
-        Returns None if no matching index was found, or if --no-index
-        was specified by the user.
-        """
-        if not url or not self.index_urls:
-            return None
-
-        for u in self.index_urls:
-            prefix = remove_auth_from_url(u).rstrip("/") + "/"
-            if url.startswith(prefix):
-                return u
-
-    def _get_new_credentials(self, original_url, allow_netrc=True,
-                             allow_keyring=True):
-        """Find and return credentials for the specified URL."""
-        # Split the credentials and netloc from the url.
-        url, netloc, url_user_password = split_auth_netloc_from_url(
-            original_url,
-        )
-
-        # Start with the credentials embedded in the url
-        username, password = url_user_password
-        if username is not None and password is not None:
-            logger.debug("Found credentials in url for %s", netloc)
-            return url_user_password
-
-        # Find a matching index url for this request
-        index_url = self._get_index_url(url)
-        if index_url:
-            # Split the credentials from the url.
-            index_info = split_auth_netloc_from_url(index_url)
-            if index_info:
-                index_url, _, index_url_user_password = index_info
-                logger.debug("Found index url %s", index_url)
-
-        # If an index URL was found, try its embedded credentials
-        if index_url and index_url_user_password[0] is not None:
-            username, password = index_url_user_password
-            if username is not None and password is not None:
-                logger.debug("Found credentials in index url for %s", netloc)
-                return index_url_user_password
-
-        # Get creds from netrc if we still don't have them
-        if allow_netrc:
-            netrc_auth = get_netrc_auth(original_url)
-            if netrc_auth:
-                logger.debug("Found credentials in netrc for %s", netloc)
-                return netrc_auth
-
-        # If we don't have a password and keyring is available, use it.
-        if allow_keyring:
-            # The index url is more specific than the netloc, so try it first
-            kr_auth = (
-                get_keyring_auth(index_url, username) or
-                get_keyring_auth(netloc, username)
-            )
-            if kr_auth:
-                logger.debug("Found credentials in keyring for %s", netloc)
-                return kr_auth
-
-        return username, password
-
-    def _get_url_and_credentials(self, original_url):
-        """Return the credentials to use for the provided URL.
-
-        If allowed, netrc and keyring may be used to obtain the
-        correct credentials.
-
-        Returns (url_without_credentials, username, password). Note
-        that even if the original URL contains credentials, this
-        function may return a different username and password.
-        """
-        url, netloc, _ = split_auth_netloc_from_url(original_url)
-
-        # Use any stored credentials that we have for this netloc
-        username, password = self.passwords.get(netloc, (None, None))
-
-        if username is None and password is None:
-            # No stored credentials. Acquire new credentials without prompting
-            # the user. (e.g. from netrc, keyring, or the URL itself)
-            username, password = self._get_new_credentials(original_url)
-
-        if username is not None or password is not None:
-            # Convert the username and password if they're None, so that
-            # this netloc will show up as "cached" in the conditional above.
-            # Further, HTTPBasicAuth doesn't accept None, so it makes sense to
-            # cache the value that is going to be used.
-            username = username or ""
-            password = password or ""
-
-            # Store any acquired credentials.
-            self.passwords[netloc] = (username, password)
-
-        assert (
-            # Credentials were found
-            (username is not None and password is not None) or
-            # Credentials were not found
-            (username is None and password is None)
-        ), "Could not load credentials from url: {}".format(original_url)
-
-        return url, username, password
-
-    def __call__(self, req):
-        # Get credentials for this request
-        url, username, password = self._get_url_and_credentials(req.url)
-
-        # Set the url of the request to the url without any credentials
-        req.url = url
-
-        if username is not None and password is not None:
-            # Send the basic auth with this request
-            req = HTTPBasicAuth(username, password)(req)
-
-        # Attach a hook to handle 401 responses
-        req.register_hook("response", self.handle_401)
-
-        return req
-
-    # Factored out to allow for easy patching in tests
-    def _prompt_for_password(self, netloc):
-        username = ask_input("User for %s: " % netloc)
-        if not username:
-            return None, None
-        auth = get_keyring_auth(netloc, username)
-        if auth:
-            return auth[0], auth[1], False
-        password = ask_password("Password: ")
-        return username, password, True
-
-    # Factored out to allow for easy patching in tests
-    def _should_save_password_to_keyring(self):
-        if not keyring:
-            return False
-        return ask("Save credentials to keyring [y/N]: ", ["y", "n"]) == "y"
-
-    def handle_401(self, resp, **kwargs):
-        # We only care about 401 responses, anything else we want to just
-        #   pass through the actual response
-        if resp.status_code != 401:
-            return resp
-
-        # We are not able to prompt the user so simply return the response
-        if not self.prompting:
-            return resp
-
-        parsed = urllib_parse.urlparse(resp.url)
-
-        # Prompt the user for a new username and password
-        username, password, save = self._prompt_for_password(parsed.netloc)
-
-        # Store the new username and password to use for future requests
-        self._credentials_to_save = None
-        if username is not None and password is not None:
-            self.passwords[parsed.netloc] = (username, password)
-
-            # Prompt to save the password to keyring
-            if save and self._should_save_password_to_keyring():
-                self._credentials_to_save = (parsed.netloc, username, password)
-
-        # Consume content and release the original connection to allow our new
-        #   request to reuse the same one.
-        resp.content
-        resp.raw.release_conn()
-
-        # Add our new username and password to the request
-        req = HTTPBasicAuth(username or "", password or "")(resp.request)
-        req.register_hook("response", self.warn_on_401)
-
-        # On successful request, save the credentials that were used to
-        # keyring. (Note that if the user responded "no" above, this member
-        # is not set and nothing will be saved.)
-        if self._credentials_to_save:
-            req.register_hook("response", self.save_credentials)
-
-        # Send our new request
-        new_resp = resp.connection.send(req, **kwargs)
-        new_resp.history.append(resp)
-
-        return new_resp
-
-    def warn_on_401(self, resp, **kwargs):
-        """Response callback to warn about incorrect credentials."""
-        if resp.status_code == 401:
-            logger.warning(
-                '401 Error, Credentials not correct for %s', resp.request.url,
-            )
-
-    def save_credentials(self, resp, **kwargs):
-        """Response callback to save credentials on success."""
-        assert keyring is not None, "should never reach here without keyring"
-        if not keyring:
-            return
-
-        creds = self._credentials_to_save
-        self._credentials_to_save = None
-        if creds and resp.status_code < 400:
-            try:
-                logger.info('Saving credentials to keyring')
-                keyring.set_password(*creds)
-            except Exception:
-                logger.exception('Failed to save credentials')
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/cache.py b/venv/lib/python3.8/site-packages/pip/_internal/network/cache.py
deleted file mode 100644
index c9386e173600d58dacda2061f49d747de386a50a..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/network/cache.py
+++ /dev/null
@@ -1,81 +0,0 @@
-"""HTTP cache implementation.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-import os
-from contextlib import contextmanager
-
-from pip._vendor.cachecontrol.cache import BaseCache
-from pip._vendor.cachecontrol.caches import FileCache
-from pip._vendor.requests.models import Response
-
-from pip._internal.utils.filesystem import adjacent_tmp_file, replace
-from pip._internal.utils.misc import ensure_dir
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional
-
-
-def is_from_cache(response):
-    # type: (Response) -> bool
-    return getattr(response, "from_cache", False)
-
-
-@contextmanager
-def suppressed_cache_errors():
-    """If we can't access the cache then we can just skip caching and process
-    requests as if caching wasn't enabled.
-    """
-    try:
-        yield
-    except (OSError, IOError):
-        pass
-
-
-class SafeFileCache(BaseCache):
-    """
-    A file based cache which is safe to use even when the target directory may
-    not be accessible or writable.
-    """
-
-    def __init__(self, directory):
-        # type: (str) -> None
-        assert directory is not None, "Cache directory must not be None."
-        super(SafeFileCache, self).__init__()
-        self.directory = directory
-
-    def _get_cache_path(self, name):
-        # type: (str) -> str
-        # From cachecontrol.caches.file_cache.FileCache._fn, brought into our
-        # class for backwards-compatibility and to avoid using a non-public
-        # method.
-        hashed = FileCache.encode(name)
-        parts = list(hashed[:5]) + [hashed]
-        return os.path.join(self.directory, *parts)
-
-    def get(self, key):
-        # type: (str) -> Optional[bytes]
-        path = self._get_cache_path(key)
-        with suppressed_cache_errors():
-            with open(path, 'rb') as f:
-                return f.read()
-
-    def set(self, key, value):
-        # type: (str, bytes) -> None
-        path = self._get_cache_path(key)
-        with suppressed_cache_errors():
-            ensure_dir(os.path.dirname(path))
-
-            with adjacent_tmp_file(path) as f:
-                f.write(value)
-
-            replace(f.name, path)
-
-    def delete(self, key):
-        # type: (str) -> None
-        path = self._get_cache_path(key)
-        with suppressed_cache_errors():
-            os.remove(path)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/download.py b/venv/lib/python3.8/site-packages/pip/_internal/network/download.py
deleted file mode 100644
index c90c4bf42cfe25c7c417c3776b7d5844417b9186..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/network/download.py
+++ /dev/null
@@ -1,200 +0,0 @@
-"""Download files with progress indicators.
-"""
-import cgi
-import logging
-import mimetypes
-import os
-
-from pip._vendor import requests
-from pip._vendor.requests.models import CONTENT_CHUNK_SIZE
-
-from pip._internal.models.index import PyPI
-from pip._internal.network.cache import is_from_cache
-from pip._internal.network.utils import response_chunks
-from pip._internal.utils.misc import (
-    format_size,
-    redact_auth_from_url,
-    splitext,
-)
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.ui import DownloadProgressProvider
-
-if MYPY_CHECK_RUNNING:
-    from typing import Iterable, Optional
-
-    from pip._vendor.requests.models import Response
-
-    from pip._internal.models.link import Link
-    from pip._internal.network.session import PipSession
-
-logger = logging.getLogger(__name__)
-
-
-def _get_http_response_size(resp):
-    # type: (Response) -> Optional[int]
-    try:
-        return int(resp.headers['content-length'])
-    except (ValueError, KeyError, TypeError):
-        return None
-
-
-def _prepare_download(
-    resp,  # type: Response
-    link,  # type: Link
-    progress_bar  # type: str
-):
-    # type: (...) -> Iterable[bytes]
-    total_length = _get_http_response_size(resp)
-
-    if link.netloc == PyPI.file_storage_domain:
-        url = link.show_url
-    else:
-        url = link.url_without_fragment
-
-    logged_url = redact_auth_from_url(url)
-
-    if total_length:
-        logged_url = '{} ({})'.format(logged_url, format_size(total_length))
-
-    if is_from_cache(resp):
-        logger.info("Using cached %s", logged_url)
-    else:
-        logger.info("Downloading %s", logged_url)
-
-    if logger.getEffectiveLevel() > logging.INFO:
-        show_progress = False
-    elif is_from_cache(resp):
-        show_progress = False
-    elif not total_length:
-        show_progress = True
-    elif total_length > (40 * 1000):
-        show_progress = True
-    else:
-        show_progress = False
-
-    chunks = response_chunks(resp, CONTENT_CHUNK_SIZE)
-
-    if not show_progress:
-        return chunks
-
-    return DownloadProgressProvider(
-        progress_bar, max=total_length
-    )(chunks)
-
-
-def sanitize_content_filename(filename):
-    # type: (str) -> str
-    """
-    Sanitize the "filename" value from a Content-Disposition header.
-    """
-    return os.path.basename(filename)
-
-
-def parse_content_disposition(content_disposition, default_filename):
-    # type: (str, str) -> str
-    """
-    Parse the "filename" value from a Content-Disposition header, and
-    return the default filename if the result is empty.
-    """
-    _type, params = cgi.parse_header(content_disposition)
-    filename = params.get('filename')
-    if filename:
-        # We need to sanitize the filename to prevent directory traversal
-        # in case the filename contains ".." path parts.
-        filename = sanitize_content_filename(filename)
-    return filename or default_filename
-
-
-def _get_http_response_filename(resp, link):
-    # type: (Response, Link) -> str
-    """Get an ideal filename from the given HTTP response, falling back to
-    the link filename if not provided.
-    """
-    filename = link.filename  # fallback
-    # Have a look at the Content-Disposition header for a better guess
-    content_disposition = resp.headers.get('content-disposition')
-    if content_disposition:
-        filename = parse_content_disposition(content_disposition, filename)
-    ext = splitext(filename)[1]  # type: Optional[str]
-    if not ext:
-        ext = mimetypes.guess_extension(
-            resp.headers.get('content-type', '')
-        )
-        if ext:
-            filename += ext
-    if not ext and link.url != resp.url:
-        ext = os.path.splitext(resp.url)[1]
-        if ext:
-            filename += ext
-    return filename
-
-
-def _http_get_download(session, link):
-    # type: (PipSession, Link) -> Response
-    target_url = link.url.split('#', 1)[0]
-    resp = session.get(
-        target_url,
-        # We use Accept-Encoding: identity here because requests
-        # defaults to accepting compressed responses. This breaks in
-        # a variety of ways depending on how the server is configured.
-        # - Some servers will notice that the file isn't a compressible
-        #   file and will leave the file alone and with an empty
-        #   Content-Encoding
-        # - Some servers will notice that the file is already
-        #   compressed and will leave the file alone and will add a
-        #   Content-Encoding: gzip header
-        # - Some servers won't notice anything at all and will take
-        #   a file that's already been compressed and compress it again
-        #   and set the Content-Encoding: gzip header
-        # By setting this to request only the identity encoding We're
-        # hoping to eliminate the third case. Hopefully there does not
-        # exist a server which when given a file will notice it is
-        # already compressed and that you're not asking for a
-        # compressed file and will then decompress it before sending
-        # because if that's the case I don't think it'll ever be
-        # possible to make this work.
-        headers={"Accept-Encoding": "identity"},
-        stream=True,
-    )
-    resp.raise_for_status()
-    return resp
-
-
-class Download(object):
-    def __init__(
-        self,
-        response,  # type: Response
-        filename,  # type: str
-        chunks,  # type: Iterable[bytes]
-    ):
-        # type: (...) -> None
-        self.response = response
-        self.filename = filename
-        self.chunks = chunks
-
-
-class Downloader(object):
-    def __init__(
-        self,
-        session,  # type: PipSession
-        progress_bar,  # type: str
-    ):
-        # type: (...) -> None
-        self._session = session
-        self._progress_bar = progress_bar
-
-    def __call__(self, link):
-        # type: (Link) -> Download
-        try:
-            resp = _http_get_download(self._session, link)
-        except requests.HTTPError as e:
-            logger.critical(
-                "HTTP error %s while getting %s", e.response.status_code, link
-            )
-            raise
-
-        return Download(
-            resp,
-            _get_http_response_filename(resp, link),
-            _prepare_download(resp, link, self._progress_bar),
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/session.py b/venv/lib/python3.8/site-packages/pip/_internal/network/session.py
deleted file mode 100644
index f5eb15ef2f6245ee303b8f6297eb8c460945afca..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/network/session.py
+++ /dev/null
@@ -1,405 +0,0 @@
-"""PipSession and supporting code, containing all pip-specific
-network request configuration and behavior.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-import email.utils
-import json
-import logging
-import mimetypes
-import os
-import platform
-import sys
-import warnings
-
-from pip._vendor import requests, six, urllib3
-from pip._vendor.cachecontrol import CacheControlAdapter
-from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
-from pip._vendor.requests.models import Response
-from pip._vendor.requests.structures import CaseInsensitiveDict
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-from pip._vendor.urllib3.exceptions import InsecureRequestWarning
-
-from pip import __version__
-from pip._internal.network.auth import MultiDomainBasicAuth
-from pip._internal.network.cache import SafeFileCache
-# Import ssl from compat so the initial import occurs in only one place.
-from pip._internal.utils.compat import has_tls, ipaddress
-from pip._internal.utils.glibc import libc_ver
-from pip._internal.utils.misc import (
-    build_url_from_netloc,
-    get_installed_version,
-    parse_netloc,
-)
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import url_to_path
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Iterator, List, Optional, Tuple, Union,
-    )
-
-    from pip._internal.models.link import Link
-
-    SecureOrigin = Tuple[str, str, Optional[Union[int, str]]]
-
-
-logger = logging.getLogger(__name__)
-
-
-# Ignore warning raised when using --trusted-host.
-warnings.filterwarnings("ignore", category=InsecureRequestWarning)
-
-
-SECURE_ORIGINS = [
-    # protocol, hostname, port
-    # Taken from Chrome's list of secure origins (See: http://bit.ly/1qrySKC)
-    ("https", "*", "*"),
-    ("*", "localhost", "*"),
-    ("*", "127.0.0.0/8", "*"),
-    ("*", "::1/128", "*"),
-    ("file", "*", None),
-    # ssh is always secure.
-    ("ssh", "*", "*"),
-]  # type: List[SecureOrigin]
-
-
-# These are environment variables present when running under various
-# CI systems.  For each variable, some CI systems that use the variable
-# are indicated.  The collection was chosen so that for each of a number
-# of popular systems, at least one of the environment variables is used.
-# This list is used to provide some indication of and lower bound for
-# CI traffic to PyPI.  Thus, it is okay if the list is not comprehensive.
-# For more background, see: https://github.com/pypa/pip/issues/5499
-CI_ENVIRONMENT_VARIABLES = (
-    # Azure Pipelines
-    'BUILD_BUILDID',
-    # Jenkins
-    'BUILD_ID',
-    # AppVeyor, CircleCI, Codeship, Gitlab CI, Shippable, Travis CI
-    'CI',
-    # Explicit environment variable.
-    'PIP_IS_CI',
-)
-
-
-def looks_like_ci():
-    # type: () -> bool
-    """
-    Return whether it looks like pip is running under CI.
-    """
-    # We don't use the method of checking for a tty (e.g. using isatty())
-    # because some CI systems mimic a tty (e.g. Travis CI).  Thus that
-    # method doesn't provide definitive information in either direction.
-    return any(name in os.environ for name in CI_ENVIRONMENT_VARIABLES)
-
-
-def user_agent():
-    """
-    Return a string representing the user agent.
-    """
-    data = {
-        "installer": {"name": "pip", "version": __version__},
-        "python": platform.python_version(),
-        "implementation": {
-            "name": platform.python_implementation(),
-        },
-    }
-
-    if data["implementation"]["name"] == 'CPython':
-        data["implementation"]["version"] = platform.python_version()
-    elif data["implementation"]["name"] == 'PyPy':
-        if sys.pypy_version_info.releaselevel == 'final':
-            pypy_version_info = sys.pypy_version_info[:3]
-        else:
-            pypy_version_info = sys.pypy_version_info
-        data["implementation"]["version"] = ".".join(
-            [str(x) for x in pypy_version_info]
-        )
-    elif data["implementation"]["name"] == 'Jython':
-        # Complete Guess
-        data["implementation"]["version"] = platform.python_version()
-    elif data["implementation"]["name"] == 'IronPython':
-        # Complete Guess
-        data["implementation"]["version"] = platform.python_version()
-
-    if sys.platform.startswith("linux"):
-        from pip._vendor import distro
-        distro_infos = dict(filter(
-            lambda x: x[1],
-            zip(["name", "version", "id"], distro.linux_distribution()),
-        ))
-        libc = dict(filter(
-            lambda x: x[1],
-            zip(["lib", "version"], libc_ver()),
-        ))
-        if libc:
-            distro_infos["libc"] = libc
-        if distro_infos:
-            data["distro"] = distro_infos
-
-    if sys.platform.startswith("darwin") and platform.mac_ver()[0]:
-        data["distro"] = {"name": "macOS", "version": platform.mac_ver()[0]}
-
-    if platform.system():
-        data.setdefault("system", {})["name"] = platform.system()
-
-    if platform.release():
-        data.setdefault("system", {})["release"] = platform.release()
-
-    if platform.machine():
-        data["cpu"] = platform.machine()
-
-    if has_tls():
-        import _ssl as ssl
-        data["openssl_version"] = ssl.OPENSSL_VERSION
-
-    setuptools_version = get_installed_version("setuptools")
-    if setuptools_version is not None:
-        data["setuptools_version"] = setuptools_version
-
-    # Use None rather than False so as not to give the impression that
-    # pip knows it is not being run under CI.  Rather, it is a null or
-    # inconclusive result.  Also, we include some value rather than no
-    # value to make it easier to know that the check has been run.
-    data["ci"] = True if looks_like_ci() else None
-
-    user_data = os.environ.get("PIP_USER_AGENT_USER_DATA")
-    if user_data is not None:
-        data["user_data"] = user_data
-
-    return "{data[installer][name]}/{data[installer][version]} {json}".format(
-        data=data,
-        json=json.dumps(data, separators=(",", ":"), sort_keys=True),
-    )
-
-
-class LocalFSAdapter(BaseAdapter):
-
-    def send(self, request, stream=None, timeout=None, verify=None, cert=None,
-             proxies=None):
-        pathname = url_to_path(request.url)
-
-        resp = Response()
-        resp.status_code = 200
-        resp.url = request.url
-
-        try:
-            stats = os.stat(pathname)
-        except OSError as exc:
-            resp.status_code = 404
-            resp.raw = exc
-        else:
-            modified = email.utils.formatdate(stats.st_mtime, usegmt=True)
-            content_type = mimetypes.guess_type(pathname)[0] or "text/plain"
-            resp.headers = CaseInsensitiveDict({
-                "Content-Type": content_type,
-                "Content-Length": stats.st_size,
-                "Last-Modified": modified,
-            })
-
-            resp.raw = open(pathname, "rb")
-            resp.close = resp.raw.close
-
-        return resp
-
-    def close(self):
-        pass
-
-
-class InsecureHTTPAdapter(HTTPAdapter):
-
-    def cert_verify(self, conn, url, verify, cert):
-        super(InsecureHTTPAdapter, self).cert_verify(
-            conn=conn, url=url, verify=False, cert=cert
-        )
-
-
-class PipSession(requests.Session):
-
-    timeout = None  # type: Optional[int]
-
-    def __init__(self, *args, **kwargs):
-        """
-        :param trusted_hosts: Domains not to emit warnings for when not using
-            HTTPS.
-        """
-        retries = kwargs.pop("retries", 0)
-        cache = kwargs.pop("cache", None)
-        trusted_hosts = kwargs.pop("trusted_hosts", [])  # type: List[str]
-        index_urls = kwargs.pop("index_urls", None)
-
-        super(PipSession, self).__init__(*args, **kwargs)
-
-        # Namespace the attribute with "pip_" just in case to prevent
-        # possible conflicts with the base class.
-        self.pip_trusted_origins = []  # type: List[Tuple[str, Optional[int]]]
-
-        # Attach our User Agent to the request
-        self.headers["User-Agent"] = user_agent()
-
-        # Attach our Authentication handler to the session
-        self.auth = MultiDomainBasicAuth(index_urls=index_urls)
-
-        # Create our urllib3.Retry instance which will allow us to customize
-        # how we handle retries.
-        retries = urllib3.Retry(
-            # Set the total number of retries that a particular request can
-            # have.
-            total=retries,
-
-            # A 503 error from PyPI typically means that the Fastly -> Origin
-            # connection got interrupted in some way. A 503 error in general
-            # is typically considered a transient error so we'll go ahead and
-            # retry it.
-            # A 500 may indicate transient error in Amazon S3
-            # A 520 or 527 - may indicate transient error in CloudFlare
-            status_forcelist=[500, 503, 520, 527],
-
-            # Add a small amount of back off between failed requests in
-            # order to prevent hammering the service.
-            backoff_factor=0.25,
-        )
-
-        # We want to _only_ cache responses on securely fetched origins. We do
-        # this because we can't validate the response of an insecurely fetched
-        # origin, and we don't want someone to be able to poison the cache and
-        # require manual eviction from the cache to fix it.
-        if cache:
-            secure_adapter = CacheControlAdapter(
-                cache=SafeFileCache(cache),
-                max_retries=retries,
-            )
-        else:
-            secure_adapter = HTTPAdapter(max_retries=retries)
-
-        # Our Insecure HTTPAdapter disables HTTPS validation. It does not
-        # support caching (see above) so we'll use it for all http:// URLs as
-        # well as any https:// host that we've marked as ignoring TLS errors
-        # for.
-        insecure_adapter = InsecureHTTPAdapter(max_retries=retries)
-        # Save this for later use in add_insecure_host().
-        self._insecure_adapter = insecure_adapter
-
-        self.mount("https://", secure_adapter)
-        self.mount("http://", insecure_adapter)
-
-        # Enable file:// urls
-        self.mount("file://", LocalFSAdapter())
-
-        for host in trusted_hosts:
-            self.add_trusted_host(host, suppress_logging=True)
-
-    def add_trusted_host(self, host, source=None, suppress_logging=False):
-        # type: (str, Optional[str], bool) -> None
-        """
-        :param host: It is okay to provide a host that has previously been
-            added.
-        :param source: An optional source string, for logging where the host
-            string came from.
-        """
-        if not suppress_logging:
-            msg = 'adding trusted host: {!r}'.format(host)
-            if source is not None:
-                msg += ' (from {})'.format(source)
-            logger.info(msg)
-
-        host_port = parse_netloc(host)
-        if host_port not in self.pip_trusted_origins:
-            self.pip_trusted_origins.append(host_port)
-
-        self.mount(build_url_from_netloc(host) + '/', self._insecure_adapter)
-        if not host_port[1]:
-            # Mount wildcard ports for the same host.
-            self.mount(
-                build_url_from_netloc(host) + ':',
-                self._insecure_adapter
-            )
-
-    def iter_secure_origins(self):
-        # type: () -> Iterator[SecureOrigin]
-        for secure_origin in SECURE_ORIGINS:
-            yield secure_origin
-        for host, port in self.pip_trusted_origins:
-            yield ('*', host, '*' if port is None else port)
-
-    def is_secure_origin(self, location):
-        # type: (Link) -> bool
-        # Determine if this url used a secure transport mechanism
-        parsed = urllib_parse.urlparse(str(location))
-        origin_protocol, origin_host, origin_port = (
-            parsed.scheme, parsed.hostname, parsed.port,
-        )
-
-        # The protocol to use to see if the protocol matches.
-        # Don't count the repository type as part of the protocol: in
-        # cases such as "git+ssh", only use "ssh". (I.e., Only verify against
-        # the last scheme.)
-        origin_protocol = origin_protocol.rsplit('+', 1)[-1]
-
-        # Determine if our origin is a secure origin by looking through our
-        # hardcoded list of secure origins, as well as any additional ones
-        # configured on this PackageFinder instance.
-        for secure_origin in self.iter_secure_origins():
-            secure_protocol, secure_host, secure_port = secure_origin
-            if origin_protocol != secure_protocol and secure_protocol != "*":
-                continue
-
-            try:
-                addr = ipaddress.ip_address(
-                    None
-                    if origin_host is None
-                    else six.ensure_text(origin_host)
-                )
-                network = ipaddress.ip_network(
-                    six.ensure_text(secure_host)
-                )
-            except ValueError:
-                # We don't have both a valid address or a valid network, so
-                # we'll check this origin against hostnames.
-                if (
-                    origin_host and
-                    origin_host.lower() != secure_host.lower() and
-                    secure_host != "*"
-                ):
-                    continue
-            else:
-                # We have a valid address and network, so see if the address
-                # is contained within the network.
-                if addr not in network:
-                    continue
-
-            # Check to see if the port matches.
-            if (
-                origin_port != secure_port and
-                secure_port != "*" and
-                secure_port is not None
-            ):
-                continue
-
-            # If we've gotten here, then this origin matches the current
-            # secure origin and we should return True
-            return True
-
-        # If we've gotten to this point, then the origin isn't secure and we
-        # will not accept it as a valid location to search. We will however
-        # log a warning that we are ignoring it.
-        logger.warning(
-            "The repository located at %s is not a trusted or secure host and "
-            "is being ignored. If this repository is available via HTTPS we "
-            "recommend you use HTTPS instead, otherwise you may silence "
-            "this warning and allow it anyway with '--trusted-host %s'.",
-            origin_host,
-            origin_host,
-        )
-
-        return False
-
-    def request(self, method, url, *args, **kwargs):
-        # Allow setting a default timeout on a session
-        kwargs.setdefault("timeout", self.timeout)
-
-        # Dispatch the actual request
-        return super(PipSession, self).request(method, url, *args, **kwargs)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/utils.py b/venv/lib/python3.8/site-packages/pip/_internal/network/utils.py
deleted file mode 100644
index a19050b0f7082809f277bc74e516a9af8e537136..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/network/utils.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Iterator
-
-
-def response_chunks(response, chunk_size=CONTENT_CHUNK_SIZE):
-    # type: (Response, int) -> Iterator[bytes]
-    """Given a requests Response, provide the data chunks.
-    """
-    try:
-        # Special case for urllib3.
-        for chunk in response.raw.stream(
-            chunk_size,
-            # We use decode_content=False here because we don't
-            # want urllib3 to mess with the raw bytes we get
-            # from the server. If we decompress inside of
-            # urllib3 then we cannot verify the checksum
-            # because the checksum will be of the compressed
-            # file. This breakage will only occur if the
-            # server adds a Content-Encoding header, which
-            # depends on how the server was configured:
-            # - Some servers will notice that the file isn't a
-            #   compressible file and will leave the file alone
-            #   and with an empty Content-Encoding
-            # - Some servers will notice that the file is
-            #   already compressed and will leave the file
-            #   alone and will add a Content-Encoding: gzip
-            #   header
-            # - Some servers won't notice anything at all and
-            #   will take a file that's already been compressed
-            #   and compress it again and set the
-            #   Content-Encoding: gzip header
-            #
-            # By setting this not to decode automatically we
-            # hope to eliminate problems with the second case.
-            decode_content=False,
-        ):
-            yield chunk
-    except AttributeError:
-        # Standard file-like object.
-        while True:
-            chunk = response.raw.read(chunk_size)
-            if not chunk:
-                break
-            yield chunk
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/network/xmlrpc.py b/venv/lib/python3.8/site-packages/pip/_internal/network/xmlrpc.py
deleted file mode 100644
index 121edd93056f57c7717e6e48e2d7432cfc18ada4..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/network/xmlrpc.py
+++ /dev/null
@@ -1,44 +0,0 @@
-"""xmlrpclib.Transport implementation
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-import logging
-
-from pip._vendor import requests
-# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
-#       why we ignore the type on this import
-from pip._vendor.six.moves import xmlrpc_client  # type: ignore
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-
-logger = logging.getLogger(__name__)
-
-
-class PipXmlrpcTransport(xmlrpc_client.Transport):
-    """Provide a `xmlrpclib.Transport` implementation via a `PipSession`
-    object.
-    """
-
-    def __init__(self, index_url, session, use_datetime=False):
-        xmlrpc_client.Transport.__init__(self, use_datetime)
-        index_parts = urllib_parse.urlparse(index_url)
-        self._scheme = index_parts.scheme
-        self._session = session
-
-    def request(self, host, handler, request_body, verbose=False):
-        parts = (self._scheme, host, handler, None, None, None)
-        url = urllib_parse.urlunparse(parts)
-        try:
-            headers = {'Content-Type': 'text/xml'}
-            response = self._session.post(url, data=request_body,
-                                          headers=headers, stream=True)
-            response.raise_for_status()
-            self.verbose = verbose
-            return self.parse_response(response.raw)
-        except requests.HTTPError as exc:
-            logger.critical(
-                "HTTP error %s while getting %s",
-                exc.response.status_code, url,
-            )
-            raise
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/__init__.py
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 46dce5caddefb4eb34db04c46845972155851682..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/check.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/check.cpython-38.pyc
deleted file mode 100644
index 7836ec03e02dad31b96e75a2e94defe4bcdfbe41..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/check.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-38.pyc
deleted file mode 100644
index b85d59c431e4df8273389a3453b47391c9c0da3a..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-38.pyc
deleted file mode 100644
index a110e6fedc1320ec72690378308fe9be9482e35b..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__init__.py
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index b83e5d871cb27f0d6eb8373066ea52b77b20f800..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-38.pyc
deleted file mode 100644
index 84d8910fdf59a1e50fb4e264737b99dbedee157b..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-38.pyc
deleted file mode 100644
index fe538159c94793d673953613c52994c6738f5329..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-38.pyc
deleted file mode 100644
index ead02c1712beb49f6129083773411c255f3e0665..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-38.pyc
deleted file mode 100644
index 7497509e6e88b16d2e12e00891d73ad6648c583d..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/metadata.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/metadata.py
deleted file mode 100644
index b13fbdef93357da3d1b3b0303b49a28990736256..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/metadata.py
+++ /dev/null
@@ -1,40 +0,0 @@
-"""Metadata generation logic for source distributions.
-"""
-
-import logging
-import os
-
-from pip._internal.utils.subprocess import runner_with_spinner_message
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from pip._internal.build_env import BuildEnvironment
-    from pip._vendor.pep517.wrappers import Pep517HookCaller
-
-logger = logging.getLogger(__name__)
-
-
-def generate_metadata(build_env, backend):
-    # type: (BuildEnvironment, Pep517HookCaller) -> str
-    """Generate metadata using mechanisms described in PEP 517.
-
-    Returns the generated metadata directory.
-    """
-    metadata_tmpdir = TempDirectory(
-        kind="modern-metadata", globally_managed=True
-    )
-
-    metadata_dir = metadata_tmpdir.path
-
-    with build_env:
-        # Note that Pep517HookCaller implements a fallback for
-        # prepare_metadata_for_build_wheel, so we don't have to
-        # consider the possibility that this hook doesn't exist.
-        runner = runner_with_spinner_message("Preparing wheel metadata")
-        with backend.subprocess_runner(runner):
-            distinfo_dir = backend.prepare_metadata_for_build_wheel(
-                metadata_dir
-            )
-
-    return os.path.join(metadata_dir, distinfo_dir)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/metadata_legacy.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/metadata_legacy.py
deleted file mode 100644
index b6813f89ba7dd5ea88c59dc618ddb18701ae2194..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/metadata_legacy.py
+++ /dev/null
@@ -1,122 +0,0 @@
-"""Metadata generation logic for legacy source distributions.
-"""
-
-import logging
-import os
-
-from pip._internal.exceptions import InstallationError
-from pip._internal.utils.misc import ensure_dir
-from pip._internal.utils.setuptools_build import make_setuptools_egg_info_args
-from pip._internal.utils.subprocess import call_subprocess
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.vcs import vcs
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional
-
-    from pip._internal.build_env import BuildEnvironment
-
-logger = logging.getLogger(__name__)
-
-
-def _find_egg_info(source_directory, is_editable):
-    # type: (str, bool) -> str
-    """Find an .egg-info in `source_directory`, based on `is_editable`.
-    """
-
-    def looks_like_virtual_env(path):
-        # type: (str) -> bool
-        return (
-            os.path.lexists(os.path.join(path, 'bin', 'python')) or
-            os.path.exists(os.path.join(path, 'Scripts', 'Python.exe'))
-        )
-
-    def locate_editable_egg_info(base):
-        # type: (str) -> List[str]
-        candidates = []  # type: List[str]
-        for root, dirs, files in os.walk(base):
-            for dir_ in vcs.dirnames:
-                if dir_ in dirs:
-                    dirs.remove(dir_)
-            # Iterate over a copy of ``dirs``, since mutating
-            # a list while iterating over it can cause trouble.
-            # (See https://github.com/pypa/pip/pull/462.)
-            for dir_ in list(dirs):
-                if looks_like_virtual_env(os.path.join(root, dir_)):
-                    dirs.remove(dir_)
-                # Also don't search through tests
-                elif dir_ == 'test' or dir_ == 'tests':
-                    dirs.remove(dir_)
-            candidates.extend(os.path.join(root, dir_) for dir_ in dirs)
-        return [f for f in candidates if f.endswith('.egg-info')]
-
-    def depth_of_directory(dir_):
-        # type: (str) -> int
-        return (
-            dir_.count(os.path.sep) +
-            (os.path.altsep and dir_.count(os.path.altsep) or 0)
-        )
-
-    base = source_directory
-    if is_editable:
-        filenames = locate_editable_egg_info(base)
-    else:
-        base = os.path.join(base, 'pip-egg-info')
-        filenames = os.listdir(base)
-
-    if not filenames:
-        raise InstallationError(
-            "Files/directories not found in {}".format(base)
-        )
-
-    # If we have more than one match, we pick the toplevel one.  This
-    # can easily be the case if there is a dist folder which contains
-    # an extracted tarball for testing purposes.
-    if len(filenames) > 1:
-        filenames.sort(key=depth_of_directory)
-
-    return os.path.join(base, filenames[0])
-
-
-def generate_metadata(
-    build_env,  # type: BuildEnvironment
-    setup_py_path,  # type: str
-    source_dir,  # type: str
-    editable,  # type: bool
-    isolated,  # type: bool
-    details,  # type: str
-):
-    # type: (...) -> str
-    """Generate metadata using setup.py-based defacto mechanisms.
-
-    Returns the generated metadata directory.
-    """
-    logger.debug(
-        'Running setup.py (path:%s) egg_info for package %s',
-        setup_py_path, details,
-    )
-
-    egg_info_dir = None  # type: Optional[str]
-    # For non-editable installs, don't put the .egg-info files at the root,
-    # to avoid confusion due to the source code being considered an installed
-    # egg.
-    if not editable:
-        egg_info_dir = os.path.join(source_dir, 'pip-egg-info')
-        # setuptools complains if the target directory does not exist.
-        ensure_dir(egg_info_dir)
-
-    args = make_setuptools_egg_info_args(
-        setup_py_path,
-        egg_info_dir=egg_info_dir,
-        no_user_config=isolated,
-    )
-
-    with build_env:
-        call_subprocess(
-            args,
-            cwd=source_dir,
-            command_desc='python setup.py egg_info',
-        )
-
-    # Return the .egg-info directory.
-    return _find_egg_info(source_dir, editable)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/wheel.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/wheel.py
deleted file mode 100644
index 1266ce05c6f4fddeec7f40a00ad4d2d85f531552..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/wheel.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import logging
-import os
-
-from pip._internal.utils.subprocess import runner_with_spinner_message
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional
-    from pip._vendor.pep517.wrappers import Pep517HookCaller
-
-logger = logging.getLogger(__name__)
-
-
-def build_wheel_pep517(
-    name,  # type: str
-    backend,  # type: Pep517HookCaller
-    metadata_directory,  # type: str
-    build_options,  # type: List[str]
-    tempd,  # type: str
-):
-    # type: (...) -> Optional[str]
-    """Build one InstallRequirement using the PEP 517 build process.
-
-    Returns path to wheel if successfully built. Otherwise, returns None.
-    """
-    assert metadata_directory is not None
-    if build_options:
-        # PEP 517 does not support --build-options
-        logger.error('Cannot build wheel for %s using PEP 517 when '
-                     '--build-option is present' % (name,))
-        return None
-    try:
-        logger.debug('Destination directory: %s', tempd)
-
-        runner = runner_with_spinner_message(
-            'Building wheel for {} (PEP 517)'.format(name)
-        )
-        with backend.subprocess_runner(runner):
-            wheel_name = backend.build_wheel(
-                tempd,
-                metadata_directory=metadata_directory,
-            )
-    except Exception:
-        logger.error('Failed building wheel for %s', name)
-        return None
-    return os.path.join(tempd, wheel_name)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/wheel_legacy.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/build/wheel_legacy.py
deleted file mode 100644
index 3ebd9fe444bddc4bafae14af8dda297ddb98ce40..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/build/wheel_legacy.py
+++ /dev/null
@@ -1,115 +0,0 @@
-import logging
-import os.path
-
-from pip._internal.utils.setuptools_build import (
-    make_setuptools_bdist_wheel_args,
-)
-from pip._internal.utils.subprocess import (
-    LOG_DIVIDER,
-    call_subprocess,
-    format_command_args,
-)
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.ui import open_spinner
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional, Text
-
-logger = logging.getLogger(__name__)
-
-
-def format_command_result(
-    command_args,  # type: List[str]
-    command_output,  # type: Text
-):
-    # type: (...) -> str
-    """Format command information for logging."""
-    command_desc = format_command_args(command_args)
-    text = 'Command arguments: {}\n'.format(command_desc)
-
-    if not command_output:
-        text += 'Command output: None'
-    elif logger.getEffectiveLevel() > logging.DEBUG:
-        text += 'Command output: [use --verbose to show]'
-    else:
-        if not command_output.endswith('\n'):
-            command_output += '\n'
-        text += 'Command output:\n{}{}'.format(command_output, LOG_DIVIDER)
-
-    return text
-
-
-def get_legacy_build_wheel_path(
-    names,  # type: List[str]
-    temp_dir,  # type: str
-    name,  # type: str
-    command_args,  # type: List[str]
-    command_output,  # type: Text
-):
-    # type: (...) -> Optional[str]
-    """Return the path to the wheel in the temporary build directory."""
-    # Sort for determinism.
-    names = sorted(names)
-    if not names:
-        msg = (
-            'Legacy build of wheel for {!r} created no files.\n'
-        ).format(name)
-        msg += format_command_result(command_args, command_output)
-        logger.warning(msg)
-        return None
-
-    if len(names) > 1:
-        msg = (
-            'Legacy build of wheel for {!r} created more than one file.\n'
-            'Filenames (choosing first): {}\n'
-        ).format(name, names)
-        msg += format_command_result(command_args, command_output)
-        logger.warning(msg)
-
-    return os.path.join(temp_dir, names[0])
-
-
-def build_wheel_legacy(
-    name,  # type: str
-    setup_py_path,  # type: str
-    source_dir,  # type: str
-    global_options,  # type: List[str]
-    build_options,  # type: List[str]
-    tempd,  # type: str
-):
-    # type: (...) -> Optional[str]
-    """Build one unpacked package using the "legacy" build process.
-
-    Returns path to wheel if successfully built. Otherwise, returns None.
-    """
-    wheel_args = make_setuptools_bdist_wheel_args(
-        setup_py_path,
-        global_options=global_options,
-        build_options=build_options,
-        destination_dir=tempd,
-    )
-
-    spin_message = 'Building wheel for %s (setup.py)' % (name,)
-    with open_spinner(spin_message) as spinner:
-        logger.debug('Destination directory: %s', tempd)
-
-        try:
-            output = call_subprocess(
-                wheel_args,
-                cwd=source_dir,
-                spinner=spinner,
-            )
-        except Exception:
-            spinner.finish("error")
-            logger.error('Failed building wheel for %s', name)
-            return None
-
-        names = os.listdir(tempd)
-        wheel_path = get_legacy_build_wheel_path(
-            names=names,
-            temp_dir=tempd,
-            name=name,
-            command_args=wheel_args,
-            command_output=output,
-        )
-        return wheel_path
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/check.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/check.py
deleted file mode 100644
index b85a12306a4f9008ae072b5f2c88df5b9d1d3db3..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/check.py
+++ /dev/null
@@ -1,163 +0,0 @@
-"""Validation of dependencies of packages
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-# mypy: disallow-untyped-defs=False
-
-import logging
-from collections import namedtuple
-
-from pip._vendor.packaging.utils import canonicalize_name
-from pip._vendor.pkg_resources import RequirementParseError
-
-from pip._internal.distributions import (
-    make_distribution_for_install_requirement,
-)
-from pip._internal.utils.misc import get_installed_distributions
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-logger = logging.getLogger(__name__)
-
-if MYPY_CHECK_RUNNING:
-    from pip._internal.req.req_install import InstallRequirement
-    from typing import (
-        Any, Callable, Dict, Optional, Set, Tuple, List
-    )
-
-    # Shorthands
-    PackageSet = Dict[str, 'PackageDetails']
-    Missing = Tuple[str, Any]
-    Conflicting = Tuple[str, str, Any]
-
-    MissingDict = Dict[str, List[Missing]]
-    ConflictingDict = Dict[str, List[Conflicting]]
-    CheckResult = Tuple[MissingDict, ConflictingDict]
-
-PackageDetails = namedtuple('PackageDetails', ['version', 'requires'])
-
-
-def create_package_set_from_installed(**kwargs):
-    # type: (**Any) -> Tuple[PackageSet, bool]
-    """Converts a list of distributions into a PackageSet.
-    """
-    # Default to using all packages installed on the system
-    if kwargs == {}:
-        kwargs = {"local_only": False, "skip": ()}
-
-    package_set = {}
-    problems = False
-    for dist in get_installed_distributions(**kwargs):
-        name = canonicalize_name(dist.project_name)
-        try:
-            package_set[name] = PackageDetails(dist.version, dist.requires())
-        except RequirementParseError as e:
-            # Don't crash on broken metadata
-            logger.warning("Error parsing requirements for %s: %s", name, e)
-            problems = True
-    return package_set, problems
-
-
-def check_package_set(package_set, should_ignore=None):
-    # type: (PackageSet, Optional[Callable[[str], bool]]) -> CheckResult
-    """Check if a package set is consistent
-
-    If should_ignore is passed, it should be a callable that takes a
-    package name and returns a boolean.
-    """
-    if should_ignore is None:
-        def should_ignore(name):
-            return False
-
-    missing = {}
-    conflicting = {}
-
-    for package_name in package_set:
-        # Info about dependencies of package_name
-        missing_deps = set()  # type: Set[Missing]
-        conflicting_deps = set()  # type: Set[Conflicting]
-
-        if should_ignore(package_name):
-            continue
-
-        for req in package_set[package_name].requires:
-            name = canonicalize_name(req.project_name)  # type: str
-
-            # Check if it's missing
-            if name not in package_set:
-                missed = True
-                if req.marker is not None:
-                    missed = req.marker.evaluate()
-                if missed:
-                    missing_deps.add((name, req))
-                continue
-
-            # Check if there's a conflict
-            version = package_set[name].version  # type: str
-            if not req.specifier.contains(version, prereleases=True):
-                conflicting_deps.add((name, version, req))
-
-        if missing_deps:
-            missing[package_name] = sorted(missing_deps, key=str)
-        if conflicting_deps:
-            conflicting[package_name] = sorted(conflicting_deps, key=str)
-
-    return missing, conflicting
-
-
-def check_install_conflicts(to_install):
-    # type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]
-    """For checking if the dependency graph would be consistent after \
-    installing given requirements
-    """
-    # Start from the current state
-    package_set, _ = create_package_set_from_installed()
-    # Install packages
-    would_be_installed = _simulate_installation_of(to_install, package_set)
-
-    # Only warn about directly-dependent packages; create a whitelist of them
-    whitelist = _create_whitelist(would_be_installed, package_set)
-
-    return (
-        package_set,
-        check_package_set(
-            package_set, should_ignore=lambda name: name not in whitelist
-        )
-    )
-
-
-def _simulate_installation_of(to_install, package_set):
-    # type: (List[InstallRequirement], PackageSet) -> Set[str]
-    """Computes the version of packages after installing to_install.
-    """
-
-    # Keep track of packages that were installed
-    installed = set()
-
-    # Modify it as installing requirement_set would (assuming no errors)
-    for inst_req in to_install:
-        abstract_dist = make_distribution_for_install_requirement(inst_req)
-        dist = abstract_dist.get_pkg_resources_distribution()
-
-        name = canonicalize_name(dist.key)
-        package_set[name] = PackageDetails(dist.version, dist.requires())
-
-        installed.add(name)
-
-    return installed
-
-
-def _create_whitelist(would_be_installed, package_set):
-    # type: (Set[str], PackageSet) -> Set[str]
-    packages_affected = set(would_be_installed)
-
-    for package_name in package_set:
-        if package_name in packages_affected:
-            continue
-
-        for req in package_set[package_name].requires:
-            if canonicalize_name(req.name) in packages_affected:
-                packages_affected.add(package_name)
-                break
-
-    return packages_affected
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/freeze.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/freeze.py
deleted file mode 100644
index 36a5c339a2ab22debec595af17a520a803f2a783..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/freeze.py
+++ /dev/null
@@ -1,265 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import collections
-import logging
-import os
-import re
-
-from pip._vendor import six
-from pip._vendor.packaging.utils import canonicalize_name
-from pip._vendor.pkg_resources import RequirementParseError
-
-from pip._internal.exceptions import BadCommand, InstallationError
-from pip._internal.req.constructors import (
-    install_req_from_editable,
-    install_req_from_line,
-)
-from pip._internal.req.req_file import COMMENT_RE
-from pip._internal.utils.misc import (
-    dist_is_editable,
-    get_installed_distributions,
-)
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Iterator, Optional, List, Container, Set, Dict, Tuple, Iterable, Union
-    )
-    from pip._internal.cache import WheelCache
-    from pip._vendor.pkg_resources import (
-        Distribution, Requirement
-    )
-
-    RequirementInfo = Tuple[Optional[Union[str, Requirement]], bool, List[str]]
-
-
-logger = logging.getLogger(__name__)
-
-
-def freeze(
-    requirement=None,  # type: Optional[List[str]]
-    find_links=None,  # type: Optional[List[str]]
-    local_only=None,  # type: Optional[bool]
-    user_only=None,  # type: Optional[bool]
-    paths=None,  # type: Optional[List[str]]
-    skip_regex=None,  # type: Optional[str]
-    isolated=False,  # type: bool
-    wheel_cache=None,  # type: Optional[WheelCache]
-    exclude_editable=False,  # type: bool
-    skip=()  # type: Container[str]
-):
-    # type: (...) -> Iterator[str]
-    find_links = find_links or []
-    skip_match = None
-
-    if skip_regex:
-        skip_match = re.compile(skip_regex).search
-
-    for link in find_links:
-        yield '-f %s' % link
-    installations = {}  # type: Dict[str, FrozenRequirement]
-    for dist in get_installed_distributions(local_only=local_only,
-                                            skip=(),
-                                            user_only=user_only,
-                                            paths=paths):
-        try:
-            req = FrozenRequirement.from_dist(dist)
-        except RequirementParseError as exc:
-            # We include dist rather than dist.project_name because the
-            # dist string includes more information, like the version and
-            # location. We also include the exception message to aid
-            # troubleshooting.
-            logger.warning(
-                'Could not generate requirement for distribution %r: %s',
-                dist, exc
-            )
-            continue
-        if exclude_editable and req.editable:
-            continue
-        installations[req.canonical_name] = req
-
-    if requirement:
-        # the options that don't get turned into an InstallRequirement
-        # should only be emitted once, even if the same option is in multiple
-        # requirements files, so we need to keep track of what has been emitted
-        # so that we don't emit it again if it's seen again
-        emitted_options = set()  # type: Set[str]
-        # keep track of which files a requirement is in so that we can
-        # give an accurate warning if a requirement appears multiple times.
-        req_files = collections.defaultdict(list)  # type: Dict[str, List[str]]
-        for req_file_path in requirement:
-            with open(req_file_path) as req_file:
-                for line in req_file:
-                    if (not line.strip() or
-                            line.strip().startswith('#') or
-                            (skip_match and skip_match(line)) or
-                            line.startswith((
-                                '-r', '--requirement',
-                                '-Z', '--always-unzip',
-                                '-f', '--find-links',
-                                '-i', '--index-url',
-                                '--pre',
-                                '--trusted-host',
-                                '--process-dependency-links',
-                                '--extra-index-url'))):
-                        line = line.rstrip()
-                        if line not in emitted_options:
-                            emitted_options.add(line)
-                            yield line
-                        continue
-
-                    if line.startswith('-e') or line.startswith('--editable'):
-                        if line.startswith('-e'):
-                            line = line[2:].strip()
-                        else:
-                            line = line[len('--editable'):].strip().lstrip('=')
-                        line_req = install_req_from_editable(
-                            line,
-                            isolated=isolated,
-                            wheel_cache=wheel_cache,
-                        )
-                    else:
-                        line_req = install_req_from_line(
-                            COMMENT_RE.sub('', line).strip(),
-                            isolated=isolated,
-                            wheel_cache=wheel_cache,
-                        )
-
-                    if not line_req.name:
-                        logger.info(
-                            "Skipping line in requirement file [%s] because "
-                            "it's not clear what it would install: %s",
-                            req_file_path, line.strip(),
-                        )
-                        logger.info(
-                            "  (add #egg=PackageName to the URL to avoid"
-                            " this warning)"
-                        )
-                    else:
-                        line_req_canonical_name = canonicalize_name(
-                            line_req.name)
-                        if line_req_canonical_name not in installations:
-                            # either it's not installed, or it is installed
-                            # but has been processed already
-                            if not req_files[line_req.name]:
-                                logger.warning(
-                                    "Requirement file [%s] contains %s, but "
-                                    "package %r is not installed",
-                                    req_file_path,
-                                    COMMENT_RE.sub('', line).strip(),
-                                    line_req.name
-                                )
-                            else:
-                                req_files[line_req.name].append(req_file_path)
-                        else:
-                            yield str(installations[
-                                line_req_canonical_name]).rstrip()
-                            del installations[line_req_canonical_name]
-                            req_files[line_req.name].append(req_file_path)
-
-        # Warn about requirements that were included multiple times (in a
-        # single requirements file or in different requirements files).
-        for name, files in six.iteritems(req_files):
-            if len(files) > 1:
-                logger.warning("Requirement %s included multiple times [%s]",
-                               name, ', '.join(sorted(set(files))))
-
-        yield(
-            '## The following requirements were added by '
-            'pip freeze:'
-        )
-    for installation in sorted(
-            installations.values(), key=lambda x: x.name.lower()):
-        if installation.canonical_name not in skip:
-            yield str(installation).rstrip()
-
-
-def get_requirement_info(dist):
-    # type: (Distribution) -> RequirementInfo
-    """
-    Compute and return values (req, editable, comments) for use in
-    FrozenRequirement.from_dist().
-    """
-    if not dist_is_editable(dist):
-        return (None, False, [])
-
-    location = os.path.normcase(os.path.abspath(dist.location))
-
-    from pip._internal.vcs import vcs, RemoteNotFoundError
-    vcs_backend = vcs.get_backend_for_dir(location)
-
-    if vcs_backend is None:
-        req = dist.as_requirement()
-        logger.debug(
-            'No VCS found for editable requirement "%s" in: %r', req,
-            location,
-        )
-        comments = [
-            '# Editable install with no version control ({})'.format(req)
-        ]
-        return (location, True, comments)
-
-    try:
-        req = vcs_backend.get_src_requirement(location, dist.project_name)
-    except RemoteNotFoundError:
-        req = dist.as_requirement()
-        comments = [
-            '# Editable {} install with no remote ({})'.format(
-                type(vcs_backend).__name__, req,
-            )
-        ]
-        return (location, True, comments)
-
-    except BadCommand:
-        logger.warning(
-            'cannot determine version of editable source in %s '
-            '(%s command not found in path)',
-            location,
-            vcs_backend.name,
-        )
-        return (None, True, [])
-
-    except InstallationError as exc:
-        logger.warning(
-            "Error when trying to get requirement for VCS system %s, "
-            "falling back to uneditable format", exc
-        )
-    else:
-        if req is not None:
-            return (req, True, [])
-
-    logger.warning(
-        'Could not determine repository location of %s', location
-    )
-    comments = ['## !! Could not determine repository location']
-
-    return (None, False, comments)
-
-
-class FrozenRequirement(object):
-    def __init__(self, name, req, editable, comments=()):
-        # type: (str, Union[str, Requirement], bool, Iterable[str]) -> None
-        self.name = name
-        self.canonical_name = canonicalize_name(name)
-        self.req = req
-        self.editable = editable
-        self.comments = comments
-
-    @classmethod
-    def from_dist(cls, dist):
-        # type: (Distribution) -> FrozenRequirement
-        req, editable, comments = get_requirement_info(dist)
-        if req is None:
-            req = dist.as_requirement()
-
-        return cls(dist.project_name, req, editable, comments=comments)
-
-    def __str__(self):
-        req = self.req
-        if self.editable:
-            req = '-e %s' % req
-        return '\n'.join(list(self.comments) + [str(req)]) + '\n'
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__init__.py
deleted file mode 100644
index 24d6a5dd31fe33b03f90ed0f9ee465253686900c..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-"""For modules related to installing packages.
-"""
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 3b7fa0dfcc4cea678b71adbd434f4c8aee35ec5e..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-38.pyc
deleted file mode 100644
index 702cde45d7a135370ca6191d754d6d7852ac7880..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-38.pyc
deleted file mode 100644
index d72770cfdca9a18dbdb762cc775fb30c3ecf5943..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-38.pyc
deleted file mode 100644
index 9aa12eac62f40b306670a4b13fda8047483c1b4c..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/editable_legacy.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/install/editable_legacy.py
deleted file mode 100644
index a668a61dc60f50963186b5a358e1e581bb6bbf09..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/editable_legacy.py
+++ /dev/null
@@ -1,52 +0,0 @@
-"""Legacy editable installation process, i.e. `setup.py develop`.
-"""
-import logging
-
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.setuptools_build import make_setuptools_develop_args
-from pip._internal.utils.subprocess import call_subprocess
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional, Sequence
-
-    from pip._internal.build_env import BuildEnvironment
-
-
-logger = logging.getLogger(__name__)
-
-
-def install_editable(
-    install_options,  # type: List[str]
-    global_options,  # type: Sequence[str]
-    prefix,  # type: Optional[str]
-    home,  # type: Optional[str]
-    use_user_site,  # type: bool
-    name,  # type: str
-    setup_py_path,  # type: str
-    isolated,  # type: bool
-    build_env,  # type: BuildEnvironment
-    unpacked_source_directory,  # type: str
-):
-    # type: (...) -> None
-    """Install a package in editable mode. Most arguments are pass-through
-    to setuptools.
-    """
-    logger.info('Running setup.py develop for %s', name)
-
-    args = make_setuptools_develop_args(
-        setup_py_path,
-        global_options=global_options,
-        install_options=install_options,
-        no_user_config=isolated,
-        prefix=prefix,
-        home=home,
-        use_user_site=use_user_site,
-    )
-
-    with indent_log():
-        with build_env:
-            call_subprocess(
-                args,
-                cwd=unpacked_source_directory,
-            )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/legacy.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/install/legacy.py
deleted file mode 100644
index 2d4adc4f62c81f0dcb2cd48c340102234052fac7..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/legacy.py
+++ /dev/null
@@ -1,129 +0,0 @@
-"""Legacy installation process, i.e. `setup.py install`.
-"""
-
-import logging
-import os
-from distutils.util import change_root
-
-from pip._internal.utils.deprecation import deprecated
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import ensure_dir
-from pip._internal.utils.setuptools_build import make_setuptools_install_args
-from pip._internal.utils.subprocess import runner_with_spinner_message
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional, Sequence
-
-    from pip._internal.models.scheme import Scheme
-    from pip._internal.req.req_install import InstallRequirement
-
-
-logger = logging.getLogger(__name__)
-
-
-def install(
-    install_req,  # type: InstallRequirement
-    install_options,  # type: List[str]
-    global_options,  # type: Sequence[str]
-    root,  # type: Optional[str]
-    home,  # type: Optional[str]
-    prefix,  # type: Optional[str]
-    use_user_site,  # type: bool
-    pycompile,  # type: bool
-    scheme,  # type: Scheme
-):
-    # type: (...) -> None
-    # Extend the list of global and install options passed on to
-    # the setup.py call with the ones from the requirements file.
-    # Options specified in requirements file override those
-    # specified on the command line, since the last option given
-    # to setup.py is the one that is used.
-    global_options = list(global_options) + \
-        install_req.options.get('global_options', [])
-    install_options = list(install_options) + \
-        install_req.options.get('install_options', [])
-
-    header_dir = scheme.headers
-
-    with TempDirectory(kind="record") as temp_dir:
-        record_filename = os.path.join(temp_dir.path, 'install-record.txt')
-        install_args = make_setuptools_install_args(
-            install_req.setup_py_path,
-            global_options=global_options,
-            install_options=install_options,
-            record_filename=record_filename,
-            root=root,
-            prefix=prefix,
-            header_dir=header_dir,
-            home=home,
-            use_user_site=use_user_site,
-            no_user_config=install_req.isolated,
-            pycompile=pycompile,
-        )
-
-        runner = runner_with_spinner_message(
-            "Running setup.py install for {}".format(install_req.name)
-        )
-        with indent_log(), install_req.build_env:
-            runner(
-                cmd=install_args,
-                cwd=install_req.unpacked_source_directory,
-            )
-
-        if not os.path.exists(record_filename):
-            logger.debug('Record file %s not found', record_filename)
-            return
-        install_req.install_succeeded = True
-
-        # We intentionally do not use any encoding to read the file because
-        # setuptools writes the file using distutils.file_util.write_file,
-        # which does not specify an encoding.
-        with open(record_filename) as f:
-            record_lines = f.read().splitlines()
-
-    def prepend_root(path):
-        # type: (str) -> str
-        if root is None or not os.path.isabs(path):
-            return path
-        else:
-            return change_root(root, path)
-
-    for line in record_lines:
-        directory = os.path.dirname(line)
-        if directory.endswith('.egg-info'):
-            egg_info_dir = prepend_root(directory)
-            break
-    else:
-        deprecated(
-            reason=(
-                "{} did not indicate that it installed an "
-                ".egg-info directory. Only setup.py projects "
-                "generating .egg-info directories are supported."
-            ).format(install_req),
-            replacement=(
-                "for maintainers: updating the setup.py of {0}. "
-                "For users: contact the maintainers of {0} to let "
-                "them know to update their setup.py.".format(
-                    install_req.name
-                )
-            ),
-            gone_in="20.2",
-            issue=6998,
-        )
-        # FIXME: put the record somewhere
-        return
-    new_lines = []
-    for line in record_lines:
-        filename = line.strip()
-        if os.path.isdir(filename):
-            filename += os.path.sep
-        new_lines.append(
-            os.path.relpath(prepend_root(filename), egg_info_dir)
-        )
-    new_lines.sort()
-    ensure_dir(egg_info_dir)
-    inst_files_path = os.path.join(egg_info_dir, 'installed-files.txt')
-    with open(inst_files_path, 'w') as f:
-        f.write('\n'.join(new_lines) + '\n')
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py
deleted file mode 100644
index aac975c3ac8ebfed2f3d54e229a2d8d28d878865..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py
+++ /dev/null
@@ -1,615 +0,0 @@
-"""Support for installing and building the "wheel" binary package format.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import collections
-import compileall
-import csv
-import logging
-import os.path
-import re
-import shutil
-import stat
-import sys
-import warnings
-from base64 import urlsafe_b64encode
-from zipfile import ZipFile
-
-from pip._vendor import pkg_resources
-from pip._vendor.distlib.scripts import ScriptMaker
-from pip._vendor.distlib.util import get_export_entry
-from pip._vendor.six import StringIO
-
-from pip._internal.exceptions import InstallationError
-from pip._internal.locations import get_major_minor_version
-from pip._internal.utils.misc import captured_stdout, ensure_dir, hash_file
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.unpacking import unpack_file
-from pip._internal.utils.wheel import parse_wheel
-
-if MYPY_CHECK_RUNNING:
-    from email.message import Message
-    from typing import (
-        Dict, List, Optional, Sequence, Tuple, IO, Text, Any,
-        Iterable, Callable, Set,
-    )
-
-    from pip._internal.models.scheme import Scheme
-
-    InstalledCSVRow = Tuple[str, ...]
-
-
-logger = logging.getLogger(__name__)
-
-
-def normpath(src, p):
-    # type: (str, str) -> str
-    return os.path.relpath(src, p).replace(os.path.sep, '/')
-
-
-def rehash(path, blocksize=1 << 20):
-    # type: (str, int) -> Tuple[str, str]
-    """Return (encoded_digest, length) for path using hashlib.sha256()"""
-    h, length = hash_file(path, blocksize)
-    digest = 'sha256=' + urlsafe_b64encode(
-        h.digest()
-    ).decode('latin1').rstrip('=')
-    # unicode/str python2 issues
-    return (digest, str(length))  # type: ignore
-
-
-def open_for_csv(name, mode):
-    # type: (str, Text) -> IO[Any]
-    if sys.version_info[0] < 3:
-        nl = {}  # type: Dict[str, Any]
-        bin = 'b'
-    else:
-        nl = {'newline': ''}  # type: Dict[str, Any]
-        bin = ''
-    return open(name, mode + bin, **nl)
-
-
-def fix_script(path):
-    # type: (str) -> Optional[bool]
-    """Replace #!python with #!/path/to/python
-    Return True if file was changed.
-    """
-    # XXX RECORD hashes will need to be updated
-    if os.path.isfile(path):
-        with open(path, 'rb') as script:
-            firstline = script.readline()
-            if not firstline.startswith(b'#!python'):
-                return False
-            exename = sys.executable.encode(sys.getfilesystemencoding())
-            firstline = b'#!' + exename + os.linesep.encode("ascii")
-            rest = script.read()
-        with open(path, 'wb') as script:
-            script.write(firstline)
-            script.write(rest)
-        return True
-    return None
-
-
-def wheel_root_is_purelib(metadata):
-    # type: (Message) -> bool
-    return metadata.get("Root-Is-Purelib", "").lower() == "true"
-
-
-def get_entrypoints(filename):
-    # type: (str) -> Tuple[Dict[str, str], Dict[str, str]]
-    if not os.path.exists(filename):
-        return {}, {}
-
-    # This is done because you can pass a string to entry_points wrappers which
-    # means that they may or may not be valid INI files. The attempt here is to
-    # strip leading and trailing whitespace in order to make them valid INI
-    # files.
-    with open(filename) as fp:
-        data = StringIO()
-        for line in fp:
-            data.write(line.strip())
-            data.write("\n")
-        data.seek(0)
-
-    # get the entry points and then the script names
-    entry_points = pkg_resources.EntryPoint.parse_map(data)
-    console = entry_points.get('console_scripts', {})
-    gui = entry_points.get('gui_scripts', {})
-
-    def _split_ep(s):
-        # type: (pkg_resources.EntryPoint) -> Tuple[str, str]
-        """get the string representation of EntryPoint,
-        remove space and split on '='
-        """
-        split_parts = str(s).replace(" ", "").split("=")
-        return split_parts[0], split_parts[1]
-
-    # convert the EntryPoint objects into strings with module:function
-    console = dict(_split_ep(v) for v in console.values())
-    gui = dict(_split_ep(v) for v in gui.values())
-    return console, gui
-
-
-def message_about_scripts_not_on_PATH(scripts):
-    # type: (Sequence[str]) -> Optional[str]
-    """Determine if any scripts are not on PATH and format a warning.
-    Returns a warning message if one or more scripts are not on PATH,
-    otherwise None.
-    """
-    if not scripts:
-        return None
-
-    # Group scripts by the path they were installed in
-    grouped_by_dir = collections.defaultdict(set)  # type: Dict[str, Set[str]]
-    for destfile in scripts:
-        parent_dir = os.path.dirname(destfile)
-        script_name = os.path.basename(destfile)
-        grouped_by_dir[parent_dir].add(script_name)
-
-    # We don't want to warn for directories that are on PATH.
-    not_warn_dirs = [
-        os.path.normcase(i).rstrip(os.sep) for i in
-        os.environ.get("PATH", "").split(os.pathsep)
-    ]
-    # If an executable sits with sys.executable, we don't warn for it.
-    #     This covers the case of venv invocations without activating the venv.
-    not_warn_dirs.append(os.path.normcase(os.path.dirname(sys.executable)))
-    warn_for = {
-        parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items()
-        if os.path.normcase(parent_dir) not in not_warn_dirs
-    }  # type: Dict[str, Set[str]]
-    if not warn_for:
-        return None
-
-    # Format a message
-    msg_lines = []
-    for parent_dir, dir_scripts in warn_for.items():
-        sorted_scripts = sorted(dir_scripts)  # type: List[str]
-        if len(sorted_scripts) == 1:
-            start_text = "script {} is".format(sorted_scripts[0])
-        else:
-            start_text = "scripts {} are".format(
-                ", ".join(sorted_scripts[:-1]) + " and " + sorted_scripts[-1]
-            )
-
-        msg_lines.append(
-            "The {} installed in '{}' which is not on PATH."
-            .format(start_text, parent_dir)
-        )
-
-    last_line_fmt = (
-        "Consider adding {} to PATH or, if you prefer "
-        "to suppress this warning, use --no-warn-script-location."
-    )
-    if len(msg_lines) == 1:
-        msg_lines.append(last_line_fmt.format("this directory"))
-    else:
-        msg_lines.append(last_line_fmt.format("these directories"))
-
-    # Add a note if any directory starts with ~
-    warn_for_tilde = any(
-        i[0] == "~" for i in os.environ.get("PATH", "").split(os.pathsep) if i
-    )
-    if warn_for_tilde:
-        tilde_warning_msg = (
-            "NOTE: The current PATH contains path(s) starting with `~`, "
-            "which may not be expanded by all applications."
-        )
-        msg_lines.append(tilde_warning_msg)
-
-    # Returns the formatted multiline message
-    return "\n".join(msg_lines)
-
-
-def sorted_outrows(outrows):
-    # type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow]
-    """Return the given rows of a RECORD file in sorted order.
-
-    Each row is a 3-tuple (path, hash, size) and corresponds to a record of
-    a RECORD file (see PEP 376 and PEP 427 for details).  For the rows
-    passed to this function, the size can be an integer as an int or string,
-    or the empty string.
-    """
-    # Normally, there should only be one row per path, in which case the
-    # second and third elements don't come into play when sorting.
-    # However, in cases in the wild where a path might happen to occur twice,
-    # we don't want the sort operation to trigger an error (but still want
-    # determinism).  Since the third element can be an int or string, we
-    # coerce each element to a string to avoid a TypeError in this case.
-    # For additional background, see--
-    # https://github.com/pypa/pip/issues/5868
-    return sorted(outrows, key=lambda row: tuple(str(x) for x in row))
-
-
-def get_csv_rows_for_installed(
-    old_csv_rows,  # type: Iterable[List[str]]
-    installed,  # type: Dict[str, str]
-    changed,  # type: Set[str]
-    generated,  # type: List[str]
-    lib_dir,  # type: str
-):
-    # type: (...) -> List[InstalledCSVRow]
-    """
-    :param installed: A map from archive RECORD path to installation RECORD
-        path.
-    """
-    installed_rows = []  # type: List[InstalledCSVRow]
-    for row in old_csv_rows:
-        if len(row) > 3:
-            logger.warning(
-                'RECORD line has more than three elements: {}'.format(row)
-            )
-        # Make a copy because we are mutating the row.
-        row = list(row)
-        old_path = row[0]
-        new_path = installed.pop(old_path, old_path)
-        row[0] = new_path
-        if new_path in changed:
-            digest, length = rehash(new_path)
-            row[1] = digest
-            row[2] = length
-        installed_rows.append(tuple(row))
-    for f in generated:
-        digest, length = rehash(f)
-        installed_rows.append((normpath(f, lib_dir), digest, str(length)))
-    for f in installed:
-        installed_rows.append((installed[f], '', ''))
-    return installed_rows
-
-
-class MissingCallableSuffix(Exception):
-    pass
-
-
-def _raise_for_invalid_entrypoint(specification):
-    # type: (str) -> None
-    entry = get_export_entry(specification)
-    if entry is not None and entry.suffix is None:
-        raise MissingCallableSuffix(str(entry))
-
-
-class PipScriptMaker(ScriptMaker):
-    def make(self, specification, options=None):
-        # type: (str, Dict[str, Any]) -> List[str]
-        _raise_for_invalid_entrypoint(specification)
-        return super(PipScriptMaker, self).make(specification, options)
-
-
-def install_unpacked_wheel(
-    name,  # type: str
-    wheeldir,  # type: str
-    wheel_zip,  # type: ZipFile
-    scheme,  # type: Scheme
-    req_description,  # type: str
-    pycompile=True,  # type: bool
-    warn_script_location=True  # type: bool
-):
-    # type: (...) -> None
-    """Install a wheel.
-
-    :param name: Name of the project to install
-    :param wheeldir: Base directory of the unpacked wheel
-    :param wheel_zip: open ZipFile for wheel being installed
-    :param scheme: Distutils scheme dictating the install directories
-    :param req_description: String used in place of the requirement, for
-        logging
-    :param pycompile: Whether to byte-compile installed Python files
-    :param warn_script_location: Whether to check that scripts are installed
-        into a directory on PATH
-    :raises UnsupportedWheel:
-        * when the directory holds an unpacked wheel with incompatible
-          Wheel-Version
-        * when the .dist-info dir does not match the wheel
-    """
-    # TODO: Investigate and break this up.
-    # TODO: Look into moving this into a dedicated class for representing an
-    #       installation.
-
-    source = wheeldir.rstrip(os.path.sep) + os.path.sep
-
-    info_dir, metadata = parse_wheel(wheel_zip, name)
-
-    if wheel_root_is_purelib(metadata):
-        lib_dir = scheme.purelib
-    else:
-        lib_dir = scheme.platlib
-
-    subdirs = os.listdir(source)
-    data_dirs = [s for s in subdirs if s.endswith('.data')]
-
-    # Record details of the files moved
-    #   installed = files copied from the wheel to the destination
-    #   changed = files changed while installing (scripts #! line typically)
-    #   generated = files newly generated during the install (script wrappers)
-    installed = {}  # type: Dict[str, str]
-    changed = set()
-    generated = []  # type: List[str]
-
-    # Compile all of the pyc files that we're going to be installing
-    if pycompile:
-        with captured_stdout() as stdout:
-            with warnings.catch_warnings():
-                warnings.filterwarnings('ignore')
-                compileall.compile_dir(source, force=True, quiet=True)
-        logger.debug(stdout.getvalue())
-
-    def record_installed(srcfile, destfile, modified=False):
-        # type: (str, str, bool) -> None
-        """Map archive RECORD paths to installation RECORD paths."""
-        oldpath = normpath(srcfile, wheeldir)
-        newpath = normpath(destfile, lib_dir)
-        installed[oldpath] = newpath
-        if modified:
-            changed.add(destfile)
-
-    def clobber(
-            source,  # type: str
-            dest,  # type: str
-            is_base,  # type: bool
-            fixer=None,  # type: Optional[Callable[[str], Any]]
-            filter=None  # type: Optional[Callable[[str], bool]]
-    ):
-        # type: (...) -> None
-        ensure_dir(dest)  # common for the 'include' path
-
-        for dir, subdirs, files in os.walk(source):
-            basedir = dir[len(source):].lstrip(os.path.sep)
-            destdir = os.path.join(dest, basedir)
-            if is_base and basedir == '':
-                subdirs[:] = [s for s in subdirs if not s.endswith('.data')]
-            for f in files:
-                # Skip unwanted files
-                if filter and filter(f):
-                    continue
-                srcfile = os.path.join(dir, f)
-                destfile = os.path.join(dest, basedir, f)
-                # directory creation is lazy and after the file filtering above
-                # to ensure we don't install empty dirs; empty dirs can't be
-                # uninstalled.
-                ensure_dir(destdir)
-
-                # copyfile (called below) truncates the destination if it
-                # exists and then writes the new contents. This is fine in most
-                # cases, but can cause a segfault if pip has loaded a shared
-                # object (e.g. from pyopenssl through its vendored urllib3)
-                # Since the shared object is mmap'd an attempt to call a
-                # symbol in it will then cause a segfault. Unlinking the file
-                # allows writing of new contents while allowing the process to
-                # continue to use the old copy.
-                if os.path.exists(destfile):
-                    os.unlink(destfile)
-
-                # We use copyfile (not move, copy, or copy2) to be extra sure
-                # that we are not moving directories over (copyfile fails for
-                # directories) as well as to ensure that we are not copying
-                # over any metadata because we want more control over what
-                # metadata we actually copy over.
-                shutil.copyfile(srcfile, destfile)
-
-                # Copy over the metadata for the file, currently this only
-                # includes the atime and mtime.
-                st = os.stat(srcfile)
-                if hasattr(os, "utime"):
-                    os.utime(destfile, (st.st_atime, st.st_mtime))
-
-                # If our file is executable, then make our destination file
-                # executable.
-                if os.access(srcfile, os.X_OK):
-                    st = os.stat(srcfile)
-                    permissions = (
-                        st.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
-                    )
-                    os.chmod(destfile, permissions)
-
-                changed = False
-                if fixer:
-                    changed = fixer(destfile)
-                record_installed(srcfile, destfile, changed)
-
-    clobber(source, lib_dir, True)
-
-    dest_info_dir = os.path.join(lib_dir, info_dir)
-
-    # Get the defined entry points
-    ep_file = os.path.join(dest_info_dir, 'entry_points.txt')
-    console, gui = get_entrypoints(ep_file)
-
-    def is_entrypoint_wrapper(name):
-        # type: (str) -> bool
-        # EP, EP.exe and EP-script.py are scripts generated for
-        # entry point EP by setuptools
-        if name.lower().endswith('.exe'):
-            matchname = name[:-4]
-        elif name.lower().endswith('-script.py'):
-            matchname = name[:-10]
-        elif name.lower().endswith(".pya"):
-            matchname = name[:-4]
-        else:
-            matchname = name
-        # Ignore setuptools-generated scripts
-        return (matchname in console or matchname in gui)
-
-    for datadir in data_dirs:
-        fixer = None
-        filter = None
-        for subdir in os.listdir(os.path.join(wheeldir, datadir)):
-            fixer = None
-            if subdir == 'scripts':
-                fixer = fix_script
-                filter = is_entrypoint_wrapper
-            source = os.path.join(wheeldir, datadir, subdir)
-            dest = getattr(scheme, subdir)
-            clobber(source, dest, False, fixer=fixer, filter=filter)
-
-    maker = PipScriptMaker(None, scheme.scripts)
-
-    # Ensure old scripts are overwritten.
-    # See https://github.com/pypa/pip/issues/1800
-    maker.clobber = True
-
-    # Ensure we don't generate any variants for scripts because this is almost
-    # never what somebody wants.
-    # See https://bitbucket.org/pypa/distlib/issue/35/
-    maker.variants = {''}
-
-    # This is required because otherwise distlib creates scripts that are not
-    # executable.
-    # See https://bitbucket.org/pypa/distlib/issue/32/
-    maker.set_mode = True
-
-    scripts_to_generate = []
-
-    # Special case pip and setuptools to generate versioned wrappers
-    #
-    # The issue is that some projects (specifically, pip and setuptools) use
-    # code in setup.py to create "versioned" entry points - pip2.7 on Python
-    # 2.7, pip3.3 on Python 3.3, etc. But these entry points are baked into
-    # the wheel metadata at build time, and so if the wheel is installed with
-    # a *different* version of Python the entry points will be wrong. The
-    # correct fix for this is to enhance the metadata to be able to describe
-    # such versioned entry points, but that won't happen till Metadata 2.0 is
-    # available.
-    # In the meantime, projects using versioned entry points will either have
-    # incorrect versioned entry points, or they will not be able to distribute
-    # "universal" wheels (i.e., they will need a wheel per Python version).
-    #
-    # Because setuptools and pip are bundled with _ensurepip and virtualenv,
-    # we need to use universal wheels. So, as a stopgap until Metadata 2.0, we
-    # override the versioned entry points in the wheel and generate the
-    # correct ones. This code is purely a short-term measure until Metadata 2.0
-    # is available.
-    #
-    # To add the level of hack in this section of code, in order to support
-    # ensurepip this code will look for an ``ENSUREPIP_OPTIONS`` environment
-    # variable which will control which version scripts get installed.
-    #
-    # ENSUREPIP_OPTIONS=altinstall
-    #   - Only pipX.Y and easy_install-X.Y will be generated and installed
-    # ENSUREPIP_OPTIONS=install
-    #   - pipX.Y, pipX, easy_install-X.Y will be generated and installed. Note
-    #     that this option is technically if ENSUREPIP_OPTIONS is set and is
-    #     not altinstall
-    # DEFAULT
-    #   - The default behavior is to install pip, pipX, pipX.Y, easy_install
-    #     and easy_install-X.Y.
-    pip_script = console.pop('pip', None)
-    if pip_script:
-        if "ENSUREPIP_OPTIONS" not in os.environ:
-            scripts_to_generate.append('pip = ' + pip_script)
-
-        if os.environ.get("ENSUREPIP_OPTIONS", "") != "altinstall":
-            scripts_to_generate.append(
-                'pip%s = %s' % (sys.version_info[0], pip_script)
-            )
-
-        scripts_to_generate.append(
-            'pip%s = %s' % (get_major_minor_version(), pip_script)
-        )
-        # Delete any other versioned pip entry points
-        pip_ep = [k for k in console if re.match(r'pip(\d(\.\d)?)?$', k)]
-        for k in pip_ep:
-            del console[k]
-    easy_install_script = console.pop('easy_install', None)
-    if easy_install_script:
-        if "ENSUREPIP_OPTIONS" not in os.environ:
-            scripts_to_generate.append(
-                'easy_install = ' + easy_install_script
-            )
-
-        scripts_to_generate.append(
-            'easy_install-%s = %s' % (
-                get_major_minor_version(), easy_install_script
-            )
-        )
-        # Delete any other versioned easy_install entry points
-        easy_install_ep = [
-            k for k in console if re.match(r'easy_install(-\d\.\d)?$', k)
-        ]
-        for k in easy_install_ep:
-            del console[k]
-
-    # Generate the console and GUI entry points specified in the wheel
-    scripts_to_generate.extend(
-        '%s = %s' % kv for kv in console.items()
-    )
-
-    gui_scripts_to_generate = [
-        '%s = %s' % kv for kv in gui.items()
-    ]
-
-    generated_console_scripts = []  # type: List[str]
-
-    try:
-        generated_console_scripts = maker.make_multiple(scripts_to_generate)
-        generated.extend(generated_console_scripts)
-
-        generated.extend(
-            maker.make_multiple(gui_scripts_to_generate, {'gui': True})
-        )
-    except MissingCallableSuffix as e:
-        entry = e.args[0]
-        raise InstallationError(
-            "Invalid script entry point: {} for req: {} - A callable "
-            "suffix is required. Cf https://packaging.python.org/"
-            "specifications/entry-points/#use-for-scripts for more "
-            "information.".format(entry, req_description)
-        )
-
-    if warn_script_location:
-        msg = message_about_scripts_not_on_PATH(generated_console_scripts)
-        if msg is not None:
-            logger.warning(msg)
-
-    # Record pip as the installer
-    installer = os.path.join(dest_info_dir, 'INSTALLER')
-    temp_installer = os.path.join(dest_info_dir, 'INSTALLER.pip')
-    with open(temp_installer, 'wb') as installer_file:
-        installer_file.write(b'pip\n')
-    shutil.move(temp_installer, installer)
-    generated.append(installer)
-
-    # Record details of all files installed
-    record = os.path.join(dest_info_dir, 'RECORD')
-    temp_record = os.path.join(dest_info_dir, 'RECORD.pip')
-    with open_for_csv(record, 'r') as record_in:
-        with open_for_csv(temp_record, 'w+') as record_out:
-            reader = csv.reader(record_in)
-            outrows = get_csv_rows_for_installed(
-                reader, installed=installed, changed=changed,
-                generated=generated, lib_dir=lib_dir,
-            )
-            writer = csv.writer(record_out)
-            # Sort to simplify testing.
-            for row in sorted_outrows(outrows):
-                writer.writerow(row)
-    shutil.move(temp_record, record)
-
-
-def install_wheel(
-    name,  # type: str
-    wheel_path,  # type: str
-    scheme,  # type: Scheme
-    req_description,  # type: str
-    pycompile=True,  # type: bool
-    warn_script_location=True,  # type: bool
-    _temp_dir_for_testing=None,  # type: Optional[str]
-):
-    # type: (...) -> None
-    with TempDirectory(
-        path=_temp_dir_for_testing, kind="unpacked-wheel"
-    ) as unpacked_dir, ZipFile(wheel_path, allowZip64=True) as z:
-        unpack_file(wheel_path, unpacked_dir.path)
-        install_unpacked_wheel(
-            name=name,
-            wheeldir=unpacked_dir.path,
-            wheel_zip=z,
-            scheme=scheme,
-            req_description=req_description,
-            pycompile=pycompile,
-            warn_script_location=warn_script_location,
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/operations/prepare.py b/venv/lib/python3.8/site-packages/pip/_internal/operations/prepare.py
deleted file mode 100644
index 0b61f20524d976cd2bdc2fbc0a7e32bf13729d41..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/operations/prepare.py
+++ /dev/null
@@ -1,591 +0,0 @@
-"""Prepares a distribution for installation
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-import logging
-import mimetypes
-import os
-import shutil
-import sys
-
-from pip._vendor import requests
-from pip._vendor.six import PY2
-
-from pip._internal.distributions import (
-    make_distribution_for_install_requirement,
-)
-from pip._internal.distributions.installed import InstalledDistribution
-from pip._internal.exceptions import (
-    DirectoryUrlHashUnsupported,
-    HashMismatch,
-    HashUnpinned,
-    InstallationError,
-    PreviousBuildDirError,
-    VcsHashUnsupported,
-)
-from pip._internal.utils.filesystem import copy2_fixed
-from pip._internal.utils.hashes import MissingHashes
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.marker_files import write_delete_marker_file
-from pip._internal.utils.misc import (
-    ask_path_exists,
-    backup_dir,
-    display_path,
-    hide_url,
-    path_to_display,
-    rmtree,
-)
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.unpacking import unpack_file
-from pip._internal.vcs import vcs
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Callable, List, Optional, Tuple,
-    )
-
-    from mypy_extensions import TypedDict
-
-    from pip._internal.distributions import AbstractDistribution
-    from pip._internal.index.package_finder import PackageFinder
-    from pip._internal.models.link import Link
-    from pip._internal.network.download import Downloader
-    from pip._internal.req.req_install import InstallRequirement
-    from pip._internal.req.req_tracker import RequirementTracker
-    from pip._internal.utils.hashes import Hashes
-
-    if PY2:
-        CopytreeKwargs = TypedDict(
-            'CopytreeKwargs',
-            {
-                'ignore': Callable[[str, List[str]], List[str]],
-                'symlinks': bool,
-            },
-            total=False,
-        )
-    else:
-        CopytreeKwargs = TypedDict(
-            'CopytreeKwargs',
-            {
-                'copy_function': Callable[[str, str], None],
-                'ignore': Callable[[str, List[str]], List[str]],
-                'ignore_dangling_symlinks': bool,
-                'symlinks': bool,
-            },
-            total=False,
-        )
-
-logger = logging.getLogger(__name__)
-
-
-def _get_prepared_distribution(
-        req,  # type: InstallRequirement
-        req_tracker,  # type: RequirementTracker
-        finder,  # type: PackageFinder
-        build_isolation  # type: bool
-):
-    # type: (...) -> AbstractDistribution
-    """Prepare a distribution for installation.
-    """
-    abstract_dist = make_distribution_for_install_requirement(req)
-    with req_tracker.track(req):
-        abstract_dist.prepare_distribution_metadata(finder, build_isolation)
-    return abstract_dist
-
-
-def unpack_vcs_link(link, location):
-    # type: (Link, str) -> None
-    vcs_backend = vcs.get_backend_for_scheme(link.scheme)
-    assert vcs_backend is not None
-    vcs_backend.unpack(location, url=hide_url(link.url))
-
-
-def _copy_file(filename, location, link):
-    # type: (str, str, Link) -> None
-    copy = True
-    download_location = os.path.join(location, link.filename)
-    if os.path.exists(download_location):
-        response = ask_path_exists(
-            'The file {} exists. (i)gnore, (w)ipe, (b)ackup, (a)abort'.format(
-                display_path(download_location)
-            ),
-            ('i', 'w', 'b', 'a'),
-        )
-        if response == 'i':
-            copy = False
-        elif response == 'w':
-            logger.warning('Deleting %s', display_path(download_location))
-            os.remove(download_location)
-        elif response == 'b':
-            dest_file = backup_dir(download_location)
-            logger.warning(
-                'Backing up %s to %s',
-                display_path(download_location),
-                display_path(dest_file),
-            )
-            shutil.move(download_location, dest_file)
-        elif response == 'a':
-            sys.exit(-1)
-    if copy:
-        shutil.copy(filename, download_location)
-        logger.info('Saved %s', display_path(download_location))
-
-
-def unpack_http_url(
-    link,  # type: Link
-    location,  # type: str
-    downloader,  # type: Downloader
-    download_dir=None,  # type: Optional[str]
-    hashes=None,  # type: Optional[Hashes]
-):
-    # type: (...) -> str
-    temp_dir = TempDirectory(kind="unpack", globally_managed=True)
-    # If a download dir is specified, is the file already downloaded there?
-    already_downloaded_path = None
-    if download_dir:
-        already_downloaded_path = _check_download_dir(
-            link, download_dir, hashes
-        )
-
-    if already_downloaded_path:
-        from_path = already_downloaded_path
-        content_type = mimetypes.guess_type(from_path)[0]
-    else:
-        # let's download to a tmp dir
-        from_path, content_type = _download_http_url(
-            link, downloader, temp_dir.path, hashes
-        )
-
-    # unpack the archive to the build dir location. even when only
-    # downloading archives, they have to be unpacked to parse dependencies
-    unpack_file(from_path, location, content_type)
-
-    return from_path
-
-
-def _copy2_ignoring_special_files(src, dest):
-    # type: (str, str) -> None
-    """Copying special files is not supported, but as a convenience to users
-    we skip errors copying them. This supports tools that may create e.g.
-    socket files in the project source directory.
-    """
-    try:
-        copy2_fixed(src, dest)
-    except shutil.SpecialFileError as e:
-        # SpecialFileError may be raised due to either the source or
-        # destination. If the destination was the cause then we would actually
-        # care, but since the destination directory is deleted prior to
-        # copy we ignore all of them assuming it is caused by the source.
-        logger.warning(
-            "Ignoring special file error '%s' encountered copying %s to %s.",
-            str(e),
-            path_to_display(src),
-            path_to_display(dest),
-        )
-
-
-def _copy_source_tree(source, target):
-    # type: (str, str) -> None
-    def ignore(d, names):
-        # type: (str, List[str]) -> List[str]
-        # Pulling in those directories can potentially be very slow,
-        # exclude the following directories if they appear in the top
-        # level dir (and only it).
-        # See discussion at https://github.com/pypa/pip/pull/6770
-        return ['.tox', '.nox'] if d == source else []
-
-    kwargs = dict(ignore=ignore, symlinks=True)  # type: CopytreeKwargs
-
-    if not PY2:
-        # Python 2 does not support copy_function, so we only ignore
-        # errors on special file copy in Python 3.
-        kwargs['copy_function'] = _copy2_ignoring_special_files
-
-    shutil.copytree(source, target, **kwargs)
-
-
-def unpack_file_url(
-    link,  # type: Link
-    location,  # type: str
-    download_dir=None,  # type: Optional[str]
-    hashes=None  # type: Optional[Hashes]
-):
-    # type: (...) -> Optional[str]
-    """Unpack link into location.
-    """
-    link_path = link.file_path
-    # If it's a url to a local directory
-    if link.is_existing_dir():
-        if os.path.isdir(location):
-            rmtree(location)
-        _copy_source_tree(link_path, location)
-        return None
-
-    # If a download dir is specified, is the file already there and valid?
-    already_downloaded_path = None
-    if download_dir:
-        already_downloaded_path = _check_download_dir(
-            link, download_dir, hashes
-        )
-
-    if already_downloaded_path:
-        from_path = already_downloaded_path
-    else:
-        from_path = link_path
-
-    # If --require-hashes is off, `hashes` is either empty, the
-    # link's embedded hash, or MissingHashes; it is required to
-    # match. If --require-hashes is on, we are satisfied by any
-    # hash in `hashes` matching: a URL-based or an option-based
-    # one; no internet-sourced hash will be in `hashes`.
-    if hashes:
-        hashes.check_against_path(from_path)
-
-    content_type = mimetypes.guess_type(from_path)[0]
-
-    # unpack the archive to the build dir location. even when only downloading
-    # archives, they have to be unpacked to parse dependencies
-    unpack_file(from_path, location, content_type)
-
-    return from_path
-
-
-def unpack_url(
-    link,  # type: Link
-    location,  # type: str
-    downloader,  # type: Downloader
-    download_dir=None,  # type: Optional[str]
-    hashes=None,  # type: Optional[Hashes]
-):
-    # type: (...) -> Optional[str]
-    """Unpack link into location, downloading if required.
-
-    :param hashes: A Hashes object, one of whose embedded hashes must match,
-        or HashMismatch will be raised. If the Hashes is empty, no matches are
-        required, and unhashable types of requirements (like VCS ones, which
-        would ordinarily raise HashUnsupported) are allowed.
-    """
-    # non-editable vcs urls
-    if link.is_vcs:
-        unpack_vcs_link(link, location)
-        return None
-
-    # file urls
-    elif link.is_file:
-        return unpack_file_url(link, location, download_dir, hashes=hashes)
-
-    # http urls
-    else:
-        return unpack_http_url(
-            link,
-            location,
-            downloader,
-            download_dir,
-            hashes=hashes,
-        )
-
-
-def _download_http_url(
-    link,  # type: Link
-    downloader,  # type: Downloader
-    temp_dir,  # type: str
-    hashes,  # type: Optional[Hashes]
-):
-    # type: (...) -> Tuple[str, str]
-    """Download link url into temp_dir using provided session"""
-    download = downloader(link)
-
-    file_path = os.path.join(temp_dir, download.filename)
-    with open(file_path, 'wb') as content_file:
-        for chunk in download.chunks:
-            content_file.write(chunk)
-
-    if hashes:
-        hashes.check_against_path(file_path)
-
-    return file_path, download.response.headers.get('content-type', '')
-
-
-def _check_download_dir(link, download_dir, hashes):
-    # type: (Link, str, Optional[Hashes]) -> Optional[str]
-    """ Check download_dir for previously downloaded file with correct hash
-        If a correct file is found return its path else None
-    """
-    download_path = os.path.join(download_dir, link.filename)
-
-    if not os.path.exists(download_path):
-        return None
-
-    # If already downloaded, does its hash match?
-    logger.info('File was already downloaded %s', download_path)
-    if hashes:
-        try:
-            hashes.check_against_path(download_path)
-        except HashMismatch:
-            logger.warning(
-                'Previously-downloaded file %s has bad hash. '
-                'Re-downloading.',
-                download_path
-            )
-            os.unlink(download_path)
-            return None
-    return download_path
-
-
-class RequirementPreparer(object):
-    """Prepares a Requirement
-    """
-
-    def __init__(
-        self,
-        build_dir,  # type: str
-        download_dir,  # type: Optional[str]
-        src_dir,  # type: str
-        wheel_download_dir,  # type: Optional[str]
-        build_isolation,  # type: bool
-        req_tracker,  # type: RequirementTracker
-        downloader,  # type: Downloader
-        finder,  # type: PackageFinder
-        require_hashes,  # type: bool
-        use_user_site,  # type: bool
-    ):
-        # type: (...) -> None
-        super(RequirementPreparer, self).__init__()
-
-        self.src_dir = src_dir
-        self.build_dir = build_dir
-        self.req_tracker = req_tracker
-        self.downloader = downloader
-        self.finder = finder
-
-        # Where still-packed archives should be written to. If None, they are
-        # not saved, and are deleted immediately after unpacking.
-        self.download_dir = download_dir
-
-        # Where still-packed .whl files should be written to. If None, they are
-        # written to the download_dir parameter. Separate to download_dir to
-        # permit only keeping wheel archives for pip wheel.
-        self.wheel_download_dir = wheel_download_dir
-
-        # NOTE
-        # download_dir and wheel_download_dir overlap semantically and may
-        # be combined if we're willing to have non-wheel archives present in
-        # the wheelhouse output by 'pip wheel'.
-
-        # Is build isolation allowed?
-        self.build_isolation = build_isolation
-
-        # Should hash-checking be required?
-        self.require_hashes = require_hashes
-
-        # Should install in user site-packages?
-        self.use_user_site = use_user_site
-
-    @property
-    def _download_should_save(self):
-        # type: () -> bool
-        if not self.download_dir:
-            return False
-
-        if os.path.exists(self.download_dir):
-            return True
-
-        logger.critical('Could not find download directory')
-        raise InstallationError(
-            "Could not find or access download directory '{}'"
-            .format(self.download_dir))
-
-    def prepare_linked_requirement(
-        self,
-        req,  # type: InstallRequirement
-    ):
-        # type: (...) -> AbstractDistribution
-        """Prepare a requirement that would be obtained from req.link
-        """
-        assert req.link
-        link = req.link
-
-        # TODO: Breakup into smaller functions
-        if link.scheme == 'file':
-            path = link.file_path
-            logger.info('Processing %s', display_path(path))
-        else:
-            logger.info('Collecting %s', req.req or req)
-
-        with indent_log():
-            # @@ if filesystem packages are not marked
-            # editable in a req, a non deterministic error
-            # occurs when the script attempts to unpack the
-            # build directory
-            # Since source_dir is only set for editable requirements.
-            assert req.source_dir is None
-            req.ensure_has_source_dir(self.build_dir)
-            # If a checkout exists, it's unwise to keep going.  version
-            # inconsistencies are logged later, but do not fail the
-            # installation.
-            # FIXME: this won't upgrade when there's an existing
-            # package unpacked in `req.source_dir`
-            if os.path.exists(os.path.join(req.source_dir, 'setup.py')):
-                raise PreviousBuildDirError(
-                    "pip can't proceed with requirements '{}' due to a"
-                    " pre-existing build directory ({}). This is "
-                    "likely due to a previous installation that failed"
-                    ". pip is being responsible and not assuming it "
-                    "can delete this. Please delete it and try again."
-                    .format(req, req.source_dir)
-                )
-
-            # Now that we have the real link, we can tell what kind of
-            # requirements we have and raise some more informative errors
-            # than otherwise. (For example, we can raise VcsHashUnsupported
-            # for a VCS URL rather than HashMissing.)
-            if self.require_hashes:
-                # We could check these first 2 conditions inside
-                # unpack_url and save repetition of conditions, but then
-                # we would report less-useful error messages for
-                # unhashable requirements, complaining that there's no
-                # hash provided.
-                if link.is_vcs:
-                    raise VcsHashUnsupported()
-                elif link.is_existing_dir():
-                    raise DirectoryUrlHashUnsupported()
-                if not req.original_link and not req.is_pinned:
-                    # Unpinned packages are asking for trouble when a new
-                    # version is uploaded. This isn't a security check, but
-                    # it saves users a surprising hash mismatch in the
-                    # future.
-                    #
-                    # file:/// URLs aren't pinnable, so don't complain
-                    # about them not being pinned.
-                    raise HashUnpinned()
-
-            hashes = req.hashes(trust_internet=not self.require_hashes)
-            if self.require_hashes and not hashes:
-                # Known-good hashes are missing for this requirement, so
-                # shim it with a facade object that will provoke hash
-                # computation and then raise a HashMissing exception
-                # showing the user what the hash should be.
-                hashes = MissingHashes()
-
-            download_dir = self.download_dir
-            if link.is_wheel and self.wheel_download_dir:
-                # when doing 'pip wheel` we download wheels to a
-                # dedicated dir.
-                download_dir = self.wheel_download_dir
-
-            try:
-                local_path = unpack_url(
-                    link, req.source_dir, self.downloader, download_dir,
-                    hashes=hashes,
-                )
-            except requests.HTTPError as exc:
-                logger.critical(
-                    'Could not install requirement %s because of error %s',
-                    req,
-                    exc,
-                )
-                raise InstallationError(
-                    'Could not install requirement {} because of HTTP '
-                    'error {} for URL {}'.format(req, exc, link)
-                )
-
-            # For use in later processing, preserve the file path on the
-            # requirement.
-            if local_path:
-                req.local_file_path = local_path
-
-            if link.is_wheel:
-                if download_dir:
-                    # When downloading, we only unpack wheels to get
-                    # metadata.
-                    autodelete_unpacked = True
-                else:
-                    # When installing a wheel, we use the unpacked
-                    # wheel.
-                    autodelete_unpacked = False
-            else:
-                # We always delete unpacked sdists after pip runs.
-                autodelete_unpacked = True
-            if autodelete_unpacked:
-                write_delete_marker_file(req.source_dir)
-
-            abstract_dist = _get_prepared_distribution(
-                req, self.req_tracker, self.finder, self.build_isolation,
-            )
-
-            if download_dir:
-                if link.is_existing_dir():
-                    logger.info('Link is a directory, ignoring download_dir')
-                elif local_path and not os.path.exists(
-                    os.path.join(download_dir, link.filename)
-                ):
-                    _copy_file(local_path, download_dir, link)
-
-            if self._download_should_save:
-                # Make a .zip of the source_dir we already created.
-                if link.is_vcs:
-                    req.archive(self.download_dir)
-        return abstract_dist
-
-    def prepare_editable_requirement(
-        self,
-        req,  # type: InstallRequirement
-    ):
-        # type: (...) -> AbstractDistribution
-        """Prepare an editable requirement
-        """
-        assert req.editable, "cannot prepare a non-editable req as editable"
-
-        logger.info('Obtaining %s', req)
-
-        with indent_log():
-            if self.require_hashes:
-                raise InstallationError(
-                    'The editable requirement {} cannot be installed when '
-                    'requiring hashes, because there is no single file to '
-                    'hash.'.format(req)
-                )
-            req.ensure_has_source_dir(self.src_dir)
-            req.update_editable(not self._download_should_save)
-
-            abstract_dist = _get_prepared_distribution(
-                req, self.req_tracker, self.finder, self.build_isolation,
-            )
-
-            if self._download_should_save:
-                req.archive(self.download_dir)
-            req.check_if_exists(self.use_user_site)
-
-        return abstract_dist
-
-    def prepare_installed_requirement(
-        self,
-        req,  # type: InstallRequirement
-        skip_reason  # type: str
-    ):
-        # type: (...) -> AbstractDistribution
-        """Prepare an already-installed requirement
-        """
-        assert req.satisfied_by, "req should have been satisfied but isn't"
-        assert skip_reason is not None, (
-            "did not get skip reason skipped but req.satisfied_by "
-            "is set to {}".format(req.satisfied_by)
-        )
-        logger.info(
-            'Requirement %s: %s (%s)',
-            skip_reason, req, req.satisfied_by.version
-        )
-        with indent_log():
-            if self.require_hashes:
-                logger.debug(
-                    'Since it is already installed, we are trusting this '
-                    'package without checking its hash. To ensure a '
-                    'completely repeatable environment, install into an '
-                    'empty virtualenv.'
-                )
-            abstract_dist = InstalledDistribution(req)
-
-        return abstract_dist
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/pep425tags.py b/venv/lib/python3.8/site-packages/pip/_internal/pep425tags.py
deleted file mode 100644
index a2386ee75b893d3e52ac54cd8f35c785b47d5519..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/pep425tags.py
+++ /dev/null
@@ -1,167 +0,0 @@
-"""Generate and work with PEP 425 Compatibility Tags."""
-from __future__ import absolute_import
-
-import logging
-import re
-
-from pip._vendor.packaging.tags import (
-    Tag,
-    compatible_tags,
-    cpython_tags,
-    generic_tags,
-    interpreter_name,
-    interpreter_version,
-    mac_platforms,
-)
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional, Tuple
-
-    from pip._vendor.packaging.tags import PythonVersion
-
-logger = logging.getLogger(__name__)
-
-_osx_arch_pat = re.compile(r'(.+)_(\d+)_(\d+)_(.+)')
-
-
-def version_info_to_nodot(version_info):
-    # type: (Tuple[int, ...]) -> str
-    # Only use up to the first two numbers.
-    return ''.join(map(str, version_info[:2]))
-
-
-def _mac_platforms(arch):
-    # type: (str) -> List[str]
-    match = _osx_arch_pat.match(arch)
-    if match:
-        name, major, minor, actual_arch = match.groups()
-        mac_version = (int(major), int(minor))
-        arches = [
-            # Since we have always only checked that the platform starts
-            # with "macosx", for backwards-compatibility we extract the
-            # actual prefix provided by the user in case they provided
-            # something like "macosxcustom_". It may be good to remove
-            # this as undocumented or deprecate it in the future.
-            '{}_{}'.format(name, arch[len('macosx_'):])
-            for arch in mac_platforms(mac_version, actual_arch)
-        ]
-    else:
-        # arch pattern didn't match (?!)
-        arches = [arch]
-    return arches
-
-
-def _custom_manylinux_platforms(arch):
-    # type: (str) -> List[str]
-    arches = [arch]
-    arch_prefix, arch_sep, arch_suffix = arch.partition('_')
-    if arch_prefix == 'manylinux2014':
-        # manylinux1/manylinux2010 wheels run on most manylinux2014 systems
-        # with the exception of wheels depending on ncurses. PEP 599 states
-        # manylinux1/manylinux2010 wheels should be considered
-        # manylinux2014 wheels:
-        # https://www.python.org/dev/peps/pep-0599/#backwards-compatibility-with-manylinux2010-wheels
-        if arch_suffix in {'i686', 'x86_64'}:
-            arches.append('manylinux2010' + arch_sep + arch_suffix)
-            arches.append('manylinux1' + arch_sep + arch_suffix)
-    elif arch_prefix == 'manylinux2010':
-        # manylinux1 wheels run on most manylinux2010 systems with the
-        # exception of wheels depending on ncurses. PEP 571 states
-        # manylinux1 wheels should be considered manylinux2010 wheels:
-        # https://www.python.org/dev/peps/pep-0571/#backwards-compatibility-with-manylinux1-wheels
-        arches.append('manylinux1' + arch_sep + arch_suffix)
-    return arches
-
-
-def _get_custom_platforms(arch):
-    # type: (str) -> List[str]
-    arch_prefix, arch_sep, arch_suffix = arch.partition('_')
-    if arch.startswith('macosx'):
-        arches = _mac_platforms(arch)
-    elif arch_prefix in ['manylinux2014', 'manylinux2010']:
-        arches = _custom_manylinux_platforms(arch)
-    else:
-        arches = [arch]
-    return arches
-
-
-def _get_python_version(version):
-    # type: (str) -> PythonVersion
-    if len(version) > 1:
-        return int(version[0]), int(version[1:])
-    else:
-        return (int(version[0]),)
-
-
-def _get_custom_interpreter(implementation=None, version=None):
-    # type: (Optional[str], Optional[str]) -> str
-    if implementation is None:
-        implementation = interpreter_name()
-    if version is None:
-        version = interpreter_version()
-    return "{}{}".format(implementation, version)
-
-
-def get_supported(
-    version=None,  # type: Optional[str]
-    platform=None,  # type: Optional[str]
-    impl=None,  # type: Optional[str]
-    abi=None  # type: Optional[str]
-):
-    # type: (...) -> List[Tag]
-    """Return a list of supported tags for each version specified in
-    `versions`.
-
-    :param version: a string version, of the form "33" or "32",
-        or None. The version will be assumed to support our ABI.
-    :param platform: specify the exact platform you want valid
-        tags for, or None. If None, use the local system platform.
-    :param impl: specify the exact implementation you want valid
-        tags for, or None. If None, use the local interpreter impl.
-    :param abi: specify the exact abi you want valid
-        tags for, or None. If None, use the local interpreter abi.
-    """
-    supported = []  # type: List[Tag]
-
-    python_version = None  # type: Optional[PythonVersion]
-    if version is not None:
-        python_version = _get_python_version(version)
-
-    interpreter = _get_custom_interpreter(impl, version)
-
-    abis = None  # type: Optional[List[str]]
-    if abi is not None:
-        abis = [abi]
-
-    platforms = None  # type: Optional[List[str]]
-    if platform is not None:
-        platforms = _get_custom_platforms(platform)
-
-    is_cpython = (impl or interpreter_name()) == "cp"
-    if is_cpython:
-        supported.extend(
-            cpython_tags(
-                python_version=python_version,
-                abis=abis,
-                platforms=platforms,
-            )
-        )
-    else:
-        supported.extend(
-            generic_tags(
-                interpreter=interpreter,
-                abis=abis,
-                platforms=platforms,
-            )
-        )
-    supported.extend(
-        compatible_tags(
-            python_version=python_version,
-            interpreter=interpreter,
-            platforms=platforms,
-        )
-    )
-
-    return supported
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/pyproject.py b/venv/lib/python3.8/site-packages/pip/_internal/pyproject.py
deleted file mode 100644
index 6b4faf7a7527cecf3fdd1cb32f8193d358f3c8fe..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/pyproject.py
+++ /dev/null
@@ -1,196 +0,0 @@
-from __future__ import absolute_import
-
-import io
-import os
-import sys
-from collections import namedtuple
-
-from pip._vendor import six, toml
-from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
-
-from pip._internal.exceptions import InstallationError
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any, Optional, List
-
-
-def _is_list_of_str(obj):
-    # type: (Any) -> bool
-    return (
-        isinstance(obj, list) and
-        all(isinstance(item, six.string_types) for item in obj)
-    )
-
-
-def make_pyproject_path(unpacked_source_directory):
-    # type: (str) -> str
-    path = os.path.join(unpacked_source_directory, 'pyproject.toml')
-
-    # Python2 __file__ should not be unicode
-    if six.PY2 and isinstance(path, six.text_type):
-        path = path.encode(sys.getfilesystemencoding())
-
-    return path
-
-
-BuildSystemDetails = namedtuple('BuildSystemDetails', [
-    'requires', 'backend', 'check', 'backend_path'
-])
-
-
-def load_pyproject_toml(
-    use_pep517,  # type: Optional[bool]
-    pyproject_toml,  # type: str
-    setup_py,  # type: str
-    req_name  # type: str
-):
-    # type: (...) -> Optional[BuildSystemDetails]
-    """Load the pyproject.toml file.
-
-    Parameters:
-        use_pep517 - Has the user requested PEP 517 processing? None
-                     means the user hasn't explicitly specified.
-        pyproject_toml - Location of the project's pyproject.toml file
-        setup_py - Location of the project's setup.py file
-        req_name - The name of the requirement we're processing (for
-                   error reporting)
-
-    Returns:
-        None if we should use the legacy code path, otherwise a tuple
-        (
-            requirements from pyproject.toml,
-            name of PEP 517 backend,
-            requirements we should check are installed after setting
-                up the build environment
-            directory paths to import the backend from (backend-path),
-                relative to the project root.
-        )
-    """
-    has_pyproject = os.path.isfile(pyproject_toml)
-    has_setup = os.path.isfile(setup_py)
-
-    if has_pyproject:
-        with io.open(pyproject_toml, encoding="utf-8") as f:
-            pp_toml = toml.load(f)
-        build_system = pp_toml.get("build-system")
-    else:
-        build_system = None
-
-    # The following cases must use PEP 517
-    # We check for use_pep517 being non-None and falsey because that means
-    # the user explicitly requested --no-use-pep517.  The value 0 as
-    # opposed to False can occur when the value is provided via an
-    # environment variable or config file option (due to the quirk of
-    # strtobool() returning an integer in pip's configuration code).
-    if has_pyproject and not has_setup:
-        if use_pep517 is not None and not use_pep517:
-            raise InstallationError(
-                "Disabling PEP 517 processing is invalid: "
-                "project does not have a setup.py"
-            )
-        use_pep517 = True
-    elif build_system and "build-backend" in build_system:
-        if use_pep517 is not None and not use_pep517:
-            raise InstallationError(
-                "Disabling PEP 517 processing is invalid: "
-                "project specifies a build backend of {} "
-                "in pyproject.toml".format(
-                    build_system["build-backend"]
-                )
-            )
-        use_pep517 = True
-
-    # If we haven't worked out whether to use PEP 517 yet,
-    # and the user hasn't explicitly stated a preference,
-    # we do so if the project has a pyproject.toml file.
-    elif use_pep517 is None:
-        use_pep517 = has_pyproject
-
-    # At this point, we know whether we're going to use PEP 517.
-    assert use_pep517 is not None
-
-    # If we're using the legacy code path, there is nothing further
-    # for us to do here.
-    if not use_pep517:
-        return None
-
-    if build_system is None:
-        # Either the user has a pyproject.toml with no build-system
-        # section, or the user has no pyproject.toml, but has opted in
-        # explicitly via --use-pep517.
-        # In the absence of any explicit backend specification, we
-        # assume the setuptools backend that most closely emulates the
-        # traditional direct setup.py execution, and require wheel and
-        # a version of setuptools that supports that backend.
-
-        build_system = {
-            "requires": ["setuptools>=40.8.0", "wheel"],
-            "build-backend": "setuptools.build_meta:__legacy__",
-        }
-
-    # If we're using PEP 517, we have build system information (either
-    # from pyproject.toml, or defaulted by the code above).
-    # Note that at this point, we do not know if the user has actually
-    # specified a backend, though.
-    assert build_system is not None
-
-    # Ensure that the build-system section in pyproject.toml conforms
-    # to PEP 518.
-    error_template = (
-        "{package} has a pyproject.toml file that does not comply "
-        "with PEP 518: {reason}"
-    )
-
-    # Specifying the build-system table but not the requires key is invalid
-    if "requires" not in build_system:
-        raise InstallationError(
-            error_template.format(package=req_name, reason=(
-                "it has a 'build-system' table but not "
-                "'build-system.requires' which is mandatory in the table"
-            ))
-        )
-
-    # Error out if requires is not a list of strings
-    requires = build_system["requires"]
-    if not _is_list_of_str(requires):
-        raise InstallationError(error_template.format(
-            package=req_name,
-            reason="'build-system.requires' is not a list of strings.",
-        ))
-
-    # Each requirement must be valid as per PEP 508
-    for requirement in requires:
-        try:
-            Requirement(requirement)
-        except InvalidRequirement:
-            raise InstallationError(
-                error_template.format(
-                    package=req_name,
-                    reason=(
-                        "'build-system.requires' contains an invalid "
-                        "requirement: {!r}".format(requirement)
-                    ),
-                )
-            )
-
-    backend = build_system.get("build-backend")
-    backend_path = build_system.get("backend-path", [])
-    check = []  # type: List[str]
-    if backend is None:
-        # If the user didn't specify a backend, we assume they want to use
-        # the setuptools backend. But we can't be sure they have included
-        # a version of setuptools which supplies the backend, or wheel
-        # (which is needed by the backend) in their requirements. So we
-        # make a note to check that those requirements are present once
-        # we have set up the environment.
-        # This is quite a lot of work to check for a very specific case. But
-        # the problem is, that case is potentially quite common - projects that
-        # adopted PEP 518 early for the ability to specify requirements to
-        # execute setup.py, but never considered needing to mention the build
-        # tools themselves. The original PEP 518 code had a similar check (but
-        # implemented in a different way).
-        backend = "setuptools.build_meta:__legacy__"
-        check = ["setuptools>=40.8.0", "wheel"]
-
-    return BuildSystemDetails(requires, backend, check, backend_path)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/req/__init__.py
deleted file mode 100644
index d2d027adeec4dbedaf62f95b070d7fd9f1fbbe60..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/req/__init__.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import logging
-
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-from .req_file import parse_requirements
-from .req_install import InstallRequirement
-from .req_set import RequirementSet
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any, List, Sequence
-
-__all__ = [
-    "RequirementSet", "InstallRequirement",
-    "parse_requirements", "install_given_reqs",
-]
-
-logger = logging.getLogger(__name__)
-
-
-class InstallationResult(object):
-    def __init__(self, name):
-        # type: (str) -> None
-        self.name = name
-
-    def __repr__(self):
-        # type: () -> str
-        return "InstallationResult(name={!r})".format(self.name)
-
-
-def install_given_reqs(
-    to_install,  # type: List[InstallRequirement]
-    install_options,  # type: List[str]
-    global_options=(),  # type: Sequence[str]
-    *args,  # type: Any
-    **kwargs  # type: Any
-):
-    # type: (...) -> List[InstallationResult]
-    """
-    Install everything in the given list.
-
-    (to be called after having downloaded and unpacked the packages)
-    """
-
-    if to_install:
-        logger.info(
-            'Installing collected packages: %s',
-            ', '.join([req.name for req in to_install]),
-        )
-
-    installed = []
-
-    with indent_log():
-        for requirement in to_install:
-            if requirement.should_reinstall:
-                logger.info('Attempting uninstall: %s', requirement.name)
-                with indent_log():
-                    uninstalled_pathset = requirement.uninstall(
-                        auto_confirm=True
-                    )
-            try:
-                requirement.install(
-                    install_options,
-                    global_options,
-                    *args,
-                    **kwargs
-                )
-            except Exception:
-                should_rollback = (
-                    requirement.should_reinstall and
-                    not requirement.install_succeeded
-                )
-                # if install did not succeed, rollback previous uninstall
-                if should_rollback:
-                    uninstalled_pathset.rollback()
-                raise
-            else:
-                should_commit = (
-                    requirement.should_reinstall and
-                    requirement.install_succeeded
-                )
-                if should_commit:
-                    uninstalled_pathset.commit()
-
-            installed.append(InstallationResult(requirement.name))
-
-    return installed
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 069bca418722fc1099fa7e46dc3dfbb3c10c80c6..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/constructors.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/constructors.cpython-38.pyc
deleted file mode 100644
index aa2c33cf4c9add3adffdbb33f9be7c57bb59a590..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/constructors.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_file.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_file.cpython-38.pyc
deleted file mode 100644
index dcc45204d3a7c00c4b70d434c91f7565f05c1c1f..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_file.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_install.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_install.cpython-38.pyc
deleted file mode 100644
index ea666e00f74baf3be05032ea9de6cf99a1bcdf59..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_install.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_set.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_set.cpython-38.pyc
deleted file mode 100644
index a508232b749ca3405b822b70e4fc27e5aa2eafc5..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_set.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-38.pyc
deleted file mode 100644
index e21951eb1e1d9bf09e585203111b3630139dcb55..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-38.pyc
deleted file mode 100644
index c63360562b4cf13592b689fa424e79eff8ee2c3d..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/constructors.py b/venv/lib/python3.8/site-packages/pip/_internal/req/constructors.py
deleted file mode 100644
index 1f3cd8a104c92d804f3086bb519a9ccf24cc46de..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/req/constructors.py
+++ /dev/null
@@ -1,436 +0,0 @@
-"""Backing implementation for InstallRequirement's various constructors
-
-The idea here is that these formed a major chunk of InstallRequirement's size
-so, moving them and support code dedicated to them outside of that class
-helps creates for better understandability for the rest of the code.
-
-These are meant to be used elsewhere within pip to create instances of
-InstallRequirement.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-import logging
-import os
-import re
-
-from pip._vendor.packaging.markers import Marker
-from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
-from pip._vendor.packaging.specifiers import Specifier
-from pip._vendor.pkg_resources import RequirementParseError, parse_requirements
-
-from pip._internal.exceptions import InstallationError
-from pip._internal.models.index import PyPI, TestPyPI
-from pip._internal.models.link import Link
-from pip._internal.models.wheel import Wheel
-from pip._internal.pyproject import make_pyproject_path
-from pip._internal.req.req_install import InstallRequirement
-from pip._internal.utils.filetypes import ARCHIVE_EXTENSIONS
-from pip._internal.utils.misc import is_installable_dir, splitext
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import path_to_url
-from pip._internal.vcs import is_url, vcs
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Any, Dict, Optional, Set, Tuple, Union,
-    )
-    from pip._internal.cache import WheelCache
-
-
-__all__ = [
-    "install_req_from_editable", "install_req_from_line",
-    "parse_editable"
-]
-
-logger = logging.getLogger(__name__)
-operators = Specifier._operators.keys()
-
-
-def is_archive_file(name):
-    # type: (str) -> bool
-    """Return True if `name` is a considered as an archive file."""
-    ext = splitext(name)[1].lower()
-    if ext in ARCHIVE_EXTENSIONS:
-        return True
-    return False
-
-
-def _strip_extras(path):
-    # type: (str) -> Tuple[str, Optional[str]]
-    m = re.match(r'^(.+)(\[[^\]]+\])$', path)
-    extras = None
-    if m:
-        path_no_extras = m.group(1)
-        extras = m.group(2)
-    else:
-        path_no_extras = path
-
-    return path_no_extras, extras
-
-
-def convert_extras(extras):
-    # type: (Optional[str]) -> Set[str]
-    if not extras:
-        return set()
-    return Requirement("placeholder" + extras.lower()).extras
-
-
-def parse_editable(editable_req):
-    # type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]]
-    """Parses an editable requirement into:
-        - a requirement name
-        - an URL
-        - extras
-        - editable options
-    Accepted requirements:
-        svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
-        .[some_extra]
-    """
-
-    url = editable_req
-
-    # If a file path is specified with extras, strip off the extras.
-    url_no_extras, extras = _strip_extras(url)
-
-    if os.path.isdir(url_no_extras):
-        if not os.path.exists(os.path.join(url_no_extras, 'setup.py')):
-            msg = (
-                'File "setup.py" not found. Directory cannot be installed '
-                'in editable mode: {}'.format(os.path.abspath(url_no_extras))
-            )
-            pyproject_path = make_pyproject_path(url_no_extras)
-            if os.path.isfile(pyproject_path):
-                msg += (
-                    '\n(A "pyproject.toml" file was found, but editable '
-                    'mode currently requires a setup.py based build.)'
-                )
-            raise InstallationError(msg)
-
-        # Treating it as code that has already been checked out
-        url_no_extras = path_to_url(url_no_extras)
-
-    if url_no_extras.lower().startswith('file:'):
-        package_name = Link(url_no_extras).egg_fragment
-        if extras:
-            return (
-                package_name,
-                url_no_extras,
-                Requirement("placeholder" + extras.lower()).extras,
-            )
-        else:
-            return package_name, url_no_extras, None
-
-    for version_control in vcs:
-        if url.lower().startswith('%s:' % version_control):
-            url = '%s+%s' % (version_control, url)
-            break
-
-    if '+' not in url:
-        raise InstallationError(
-            '{} is not a valid editable requirement. '
-            'It should either be a path to a local project or a VCS URL '
-            '(beginning with svn+, git+, hg+, or bzr+).'.format(editable_req)
-        )
-
-    vc_type = url.split('+', 1)[0].lower()
-
-    if not vcs.get_backend(vc_type):
-        error_message = 'For --editable=%s only ' % editable_req + \
-            ', '.join([backend.name + '+URL' for backend in vcs.backends]) + \
-            ' is currently supported'
-        raise InstallationError(error_message)
-
-    package_name = Link(url).egg_fragment
-    if not package_name:
-        raise InstallationError(
-            "Could not detect requirement name for '%s', please specify one "
-            "with #egg=your_package_name" % editable_req
-        )
-    return package_name, url, None
-
-
-def deduce_helpful_msg(req):
-    # type: (str) -> str
-    """Returns helpful msg in case requirements file does not exist,
-    or cannot be parsed.
-
-    :params req: Requirements file path
-    """
-    msg = ""
-    if os.path.exists(req):
-        msg = " It does exist."
-        # Try to parse and check if it is a requirements file.
-        try:
-            with open(req, 'r') as fp:
-                # parse first line only
-                next(parse_requirements(fp.read()))
-                msg += " The argument you provided " + \
-                    "(%s) appears to be a" % (req) + \
-                    " requirements file. If that is the" + \
-                    " case, use the '-r' flag to install" + \
-                    " the packages specified within it."
-        except RequirementParseError:
-            logger.debug("Cannot parse '%s' as requirements \
-            file" % (req), exc_info=True)
-    else:
-        msg += " File '%s' does not exist." % (req)
-    return msg
-
-
-class RequirementParts(object):
-    def __init__(
-            self,
-            requirement,  # type: Optional[Requirement]
-            link,         # type: Optional[Link]
-            markers,      # type: Optional[Marker]
-            extras,       # type: Set[str]
-    ):
-        self.requirement = requirement
-        self.link = link
-        self.markers = markers
-        self.extras = extras
-
-
-def parse_req_from_editable(editable_req):
-    # type: (str) -> RequirementParts
-    name, url, extras_override = parse_editable(editable_req)
-
-    if name is not None:
-        try:
-            req = Requirement(name)
-        except InvalidRequirement:
-            raise InstallationError("Invalid requirement: '%s'" % name)
-    else:
-        req = None
-
-    link = Link(url)
-
-    return RequirementParts(req, link, None, extras_override)
-
-
-# ---- The actual constructors follow ----
-
-
-def install_req_from_editable(
-    editable_req,  # type: str
-    comes_from=None,  # type: Optional[str]
-    use_pep517=None,  # type: Optional[bool]
-    isolated=False,  # type: bool
-    options=None,  # type: Optional[Dict[str, Any]]
-    wheel_cache=None,  # type: Optional[WheelCache]
-    constraint=False  # type: bool
-):
-    # type: (...) -> InstallRequirement
-
-    parts = parse_req_from_editable(editable_req)
-
-    source_dir = parts.link.file_path if parts.link.scheme == 'file' else None
-
-    return InstallRequirement(
-        parts.requirement, comes_from, source_dir=source_dir,
-        editable=True,
-        link=parts.link,
-        constraint=constraint,
-        use_pep517=use_pep517,
-        isolated=isolated,
-        options=options if options else {},
-        wheel_cache=wheel_cache,
-        extras=parts.extras,
-    )
-
-
-def _looks_like_path(name):
-    # type: (str) -> bool
-    """Checks whether the string "looks like" a path on the filesystem.
-
-    This does not check whether the target actually exists, only judge from the
-    appearance.
-
-    Returns true if any of the following conditions is true:
-    * a path separator is found (either os.path.sep or os.path.altsep);
-    * a dot is found (which represents the current directory).
-    """
-    if os.path.sep in name:
-        return True
-    if os.path.altsep is not None and os.path.altsep in name:
-        return True
-    if name.startswith("."):
-        return True
-    return False
-
-
-def _get_url_from_path(path, name):
-    # type: (str, str) -> str
-    """
-    First, it checks whether a provided path is an installable directory
-    (e.g. it has a setup.py). If it is, returns the path.
-
-    If false, check if the path is an archive file (such as a .whl).
-    The function checks if the path is a file. If false, if the path has
-    an @, it will treat it as a PEP 440 URL requirement and return the path.
-    """
-    if _looks_like_path(name) and os.path.isdir(path):
-        if is_installable_dir(path):
-            return path_to_url(path)
-        raise InstallationError(
-            "Directory %r is not installable. Neither 'setup.py' "
-            "nor 'pyproject.toml' found." % name
-        )
-    if not is_archive_file(path):
-        return None
-    if os.path.isfile(path):
-        return path_to_url(path)
-    urlreq_parts = name.split('@', 1)
-    if len(urlreq_parts) >= 2 and not _looks_like_path(urlreq_parts[0]):
-        # If the path contains '@' and the part before it does not look
-        # like a path, try to treat it as a PEP 440 URL req instead.
-        return None
-    logger.warning(
-        'Requirement %r looks like a filename, but the '
-        'file does not exist',
-        name
-    )
-    return path_to_url(path)
-
-
-def parse_req_from_line(name, line_source):
-    # type: (str, Optional[str]) -> RequirementParts
-    if is_url(name):
-        marker_sep = '; '
-    else:
-        marker_sep = ';'
-    if marker_sep in name:
-        name, markers_as_string = name.split(marker_sep, 1)
-        markers_as_string = markers_as_string.strip()
-        if not markers_as_string:
-            markers = None
-        else:
-            markers = Marker(markers_as_string)
-    else:
-        markers = None
-    name = name.strip()
-    req_as_string = None
-    path = os.path.normpath(os.path.abspath(name))
-    link = None
-    extras_as_string = None
-
-    if is_url(name):
-        link = Link(name)
-    else:
-        p, extras_as_string = _strip_extras(path)
-        url = _get_url_from_path(p, name)
-        if url is not None:
-            link = Link(url)
-
-    # it's a local file, dir, or url
-    if link:
-        # Handle relative file URLs
-        if link.scheme == 'file' and re.search(r'\.\./', link.url):
-            link = Link(
-                path_to_url(os.path.normpath(os.path.abspath(link.path))))
-        # wheel file
-        if link.is_wheel:
-            wheel = Wheel(link.filename)  # can raise InvalidWheelFilename
-            req_as_string = "%s==%s" % (wheel.name, wheel.version)
-        else:
-            # set the req to the egg fragment.  when it's not there, this
-            # will become an 'unnamed' requirement
-            req_as_string = link.egg_fragment
-
-    # a requirement specifier
-    else:
-        req_as_string = name
-
-    extras = convert_extras(extras_as_string)
-
-    def with_source(text):
-        # type: (str) -> str
-        if not line_source:
-            return text
-        return '{} (from {})'.format(text, line_source)
-
-    if req_as_string is not None:
-        try:
-            req = Requirement(req_as_string)
-        except InvalidRequirement:
-            if os.path.sep in req_as_string:
-                add_msg = "It looks like a path."
-                add_msg += deduce_helpful_msg(req_as_string)
-            elif ('=' in req_as_string and
-                  not any(op in req_as_string for op in operators)):
-                add_msg = "= is not a valid operator. Did you mean == ?"
-            else:
-                add_msg = ''
-            msg = with_source(
-                'Invalid requirement: {!r}'.format(req_as_string)
-            )
-            if add_msg:
-                msg += '\nHint: {}'.format(add_msg)
-            raise InstallationError(msg)
-    else:
-        req = None
-
-    return RequirementParts(req, link, markers, extras)
-
-
-def install_req_from_line(
-    name,  # type: str
-    comes_from=None,  # type: Optional[Union[str, InstallRequirement]]
-    use_pep517=None,  # type: Optional[bool]
-    isolated=False,  # type: bool
-    options=None,  # type: Optional[Dict[str, Any]]
-    wheel_cache=None,  # type: Optional[WheelCache]
-    constraint=False,  # type: bool
-    line_source=None,  # type: Optional[str]
-):
-    # type: (...) -> InstallRequirement
-    """Creates an InstallRequirement from a name, which might be a
-    requirement, directory containing 'setup.py', filename, or URL.
-
-    :param line_source: An optional string describing where the line is from,
-        for logging purposes in case of an error.
-    """
-    parts = parse_req_from_line(name, line_source)
-
-    return InstallRequirement(
-        parts.requirement, comes_from, link=parts.link, markers=parts.markers,
-        use_pep517=use_pep517, isolated=isolated,
-        options=options if options else {},
-        wheel_cache=wheel_cache,
-        constraint=constraint,
-        extras=parts.extras,
-    )
-
-
-def install_req_from_req_string(
-    req_string,  # type: str
-    comes_from=None,  # type: Optional[InstallRequirement]
-    isolated=False,  # type: bool
-    wheel_cache=None,  # type: Optional[WheelCache]
-    use_pep517=None  # type: Optional[bool]
-):
-    # type: (...) -> InstallRequirement
-    try:
-        req = Requirement(req_string)
-    except InvalidRequirement:
-        raise InstallationError("Invalid requirement: '%s'" % req_string)
-
-    domains_not_allowed = [
-        PyPI.file_storage_domain,
-        TestPyPI.file_storage_domain,
-    ]
-    if (req.url and comes_from and comes_from.link and
-            comes_from.link.netloc in domains_not_allowed):
-        # Explicitly disallow pypi packages that depend on external urls
-        raise InstallationError(
-            "Packages installed from PyPI cannot depend on packages "
-            "which are not also hosted on PyPI.\n"
-            "%s depends on %s " % (comes_from.name, req)
-        )
-
-    return InstallRequirement(
-        req, comes_from, isolated=isolated, wheel_cache=wheel_cache,
-        use_pep517=use_pep517
-    )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/req_file.py b/venv/lib/python3.8/site-packages/pip/_internal/req/req_file.py
deleted file mode 100644
index 8c7810481ee6504faaf08a0b7d1e0790ad9cc089..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/req/req_file.py
+++ /dev/null
@@ -1,546 +0,0 @@
-"""
-Requirements file parsing
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import optparse
-import os
-import re
-import shlex
-import sys
-
-from pip._vendor.six.moves import filterfalse
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-
-from pip._internal.cli import cmdoptions
-from pip._internal.exceptions import (
-    InstallationError,
-    RequirementsFileParseError,
-)
-from pip._internal.models.search_scope import SearchScope
-from pip._internal.req.constructors import (
-    install_req_from_editable,
-    install_req_from_line,
-)
-from pip._internal.utils.encoding import auto_decode
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import get_url_scheme
-
-if MYPY_CHECK_RUNNING:
-    from optparse import Values
-    from typing import (
-        Any, Callable, Iterator, List, NoReturn, Optional, Text, Tuple,
-    )
-
-    from pip._internal.req import InstallRequirement
-    from pip._internal.cache import WheelCache
-    from pip._internal.index.package_finder import PackageFinder
-    from pip._internal.network.session import PipSession
-
-    ReqFileLines = Iterator[Tuple[int, Text]]
-
-    LineParser = Callable[[Text], Tuple[str, Values]]
-
-
-__all__ = ['parse_requirements']
-
-SCHEME_RE = re.compile(r'^(http|https|file):', re.I)
-COMMENT_RE = re.compile(r'(^|\s+)#.*$')
-
-# Matches environment variable-style values in '${MY_VARIABLE_1}' with the
-# variable name consisting of only uppercase letters, digits or the '_'
-# (underscore). This follows the POSIX standard defined in IEEE Std 1003.1,
-# 2013 Edition.
-ENV_VAR_RE = re.compile(r'(?P\$\{(?P[A-Z0-9_]+)\})')
-
-SUPPORTED_OPTIONS = [
-    cmdoptions.index_url,
-    cmdoptions.extra_index_url,
-    cmdoptions.no_index,
-    cmdoptions.constraints,
-    cmdoptions.requirements,
-    cmdoptions.editable,
-    cmdoptions.find_links,
-    cmdoptions.no_binary,
-    cmdoptions.only_binary,
-    cmdoptions.require_hashes,
-    cmdoptions.pre,
-    cmdoptions.trusted_host,
-    cmdoptions.always_unzip,  # Deprecated
-]  # type: List[Callable[..., optparse.Option]]
-
-# options to be passed to requirements
-SUPPORTED_OPTIONS_REQ = [
-    cmdoptions.install_options,
-    cmdoptions.global_options,
-    cmdoptions.hash,
-]  # type: List[Callable[..., optparse.Option]]
-
-# the 'dest' string values
-SUPPORTED_OPTIONS_REQ_DEST = [str(o().dest) for o in SUPPORTED_OPTIONS_REQ]
-
-
-class ParsedLine(object):
-    def __init__(
-        self,
-        filename,  # type: str
-        lineno,  # type: int
-        comes_from,  # type: str
-        args,  # type: str
-        opts,  # type: Values
-        constraint,  # type: bool
-    ):
-        # type: (...) -> None
-        self.filename = filename
-        self.lineno = lineno
-        self.comes_from = comes_from
-        self.args = args
-        self.opts = opts
-        self.constraint = constraint
-
-
-def parse_requirements(
-    filename,  # type: str
-    session,  # type: PipSession
-    finder=None,  # type: Optional[PackageFinder]
-    comes_from=None,  # type: Optional[str]
-    options=None,  # type: Optional[optparse.Values]
-    constraint=False,  # type: bool
-    wheel_cache=None,  # type: Optional[WheelCache]
-    use_pep517=None  # type: Optional[bool]
-):
-    # type: (...) -> Iterator[InstallRequirement]
-    """Parse a requirements file and yield InstallRequirement instances.
-
-    :param filename:    Path or url of requirements file.
-    :param session:     PipSession instance.
-    :param finder:      Instance of pip.index.PackageFinder.
-    :param comes_from:  Origin description of requirements.
-    :param options:     cli options.
-    :param constraint:  If true, parsing a constraint file rather than
-        requirements file.
-    :param wheel_cache: Instance of pip.wheel.WheelCache
-    :param use_pep517:  Value of the --use-pep517 option.
-    """
-    skip_requirements_regex = (
-        options.skip_requirements_regex if options else None
-    )
-    line_parser = get_line_parser(finder)
-    parser = RequirementsFileParser(
-        session, line_parser, comes_from, skip_requirements_regex
-    )
-
-    for parsed_line in parser.parse(filename, constraint):
-        req = handle_line(
-            parsed_line, finder, options, session, wheel_cache, use_pep517
-        )
-        if req is not None:
-            yield req
-
-
-def preprocess(content, skip_requirements_regex):
-    # type: (Text, Optional[str]) -> ReqFileLines
-    """Split, filter, and join lines, and return a line iterator
-
-    :param content: the content of the requirements file
-    :param options: cli options
-    """
-    lines_enum = enumerate(content.splitlines(), start=1)  # type: ReqFileLines
-    lines_enum = join_lines(lines_enum)
-    lines_enum = ignore_comments(lines_enum)
-    if skip_requirements_regex:
-        lines_enum = skip_regex(lines_enum, skip_requirements_regex)
-    lines_enum = expand_env_variables(lines_enum)
-    return lines_enum
-
-
-def handle_line(
-    line,  # type: ParsedLine
-    finder=None,  # type: Optional[PackageFinder]
-    options=None,  # type: Optional[optparse.Values]
-    session=None,  # type: Optional[PipSession]
-    wheel_cache=None,  # type: Optional[WheelCache]
-    use_pep517=None,  # type: Optional[bool]
-):
-    # type: (...) -> Optional[InstallRequirement]
-    """Handle a single parsed requirements line; This can result in
-    creating/yielding requirements, or updating the finder.
-
-    For lines that contain requirements, the only options that have an effect
-    are from SUPPORTED_OPTIONS_REQ, and they are scoped to the
-    requirement. Other options from SUPPORTED_OPTIONS may be present, but are
-    ignored.
-
-    For lines that do not contain requirements, the only options that have an
-    effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may
-    be present, but are ignored. These lines may contain multiple options
-    (although our docs imply only one is supported), and all our parsed and
-    affect the finder.
-    """
-
-    # preserve for the nested code path
-    line_comes_from = '%s %s (line %s)' % (
-        '-c' if line.constraint else '-r', line.filename, line.lineno,
-    )
-
-    # return a line requirement
-    if line.args:
-        isolated = options.isolated_mode if options else False
-        if options:
-            cmdoptions.check_install_build_global(options, line.opts)
-        # get the options that apply to requirements
-        req_options = {}
-        for dest in SUPPORTED_OPTIONS_REQ_DEST:
-            if dest in line.opts.__dict__ and line.opts.__dict__[dest]:
-                req_options[dest] = line.opts.__dict__[dest]
-        line_source = 'line {} of {}'.format(line.lineno, line.filename)
-        return install_req_from_line(
-            line.args,
-            comes_from=line_comes_from,
-            use_pep517=use_pep517,
-            isolated=isolated,
-            options=req_options,
-            wheel_cache=wheel_cache,
-            constraint=line.constraint,
-            line_source=line_source,
-        )
-
-    # return an editable requirement
-    elif line.opts.editables:
-        isolated = options.isolated_mode if options else False
-        return install_req_from_editable(
-            line.opts.editables[0], comes_from=line_comes_from,
-            use_pep517=use_pep517,
-            constraint=line.constraint, isolated=isolated,
-            wheel_cache=wheel_cache
-        )
-
-    # percolate hash-checking option upward
-    elif line.opts.require_hashes:
-        options.require_hashes = line.opts.require_hashes
-
-    # set finder options
-    elif finder:
-        find_links = finder.find_links
-        index_urls = finder.index_urls
-        if line.opts.index_url:
-            index_urls = [line.opts.index_url]
-        if line.opts.no_index is True:
-            index_urls = []
-        if line.opts.extra_index_urls:
-            index_urls.extend(line.opts.extra_index_urls)
-        if line.opts.find_links:
-            # FIXME: it would be nice to keep track of the source
-            # of the find_links: support a find-links local path
-            # relative to a requirements file.
-            value = line.opts.find_links[0]
-            req_dir = os.path.dirname(os.path.abspath(line.filename))
-            relative_to_reqs_file = os.path.join(req_dir, value)
-            if os.path.exists(relative_to_reqs_file):
-                value = relative_to_reqs_file
-            find_links.append(value)
-
-        search_scope = SearchScope(
-            find_links=find_links,
-            index_urls=index_urls,
-        )
-        finder.search_scope = search_scope
-
-        if line.opts.pre:
-            finder.set_allow_all_prereleases()
-
-        if session:
-            for host in line.opts.trusted_hosts or []:
-                source = 'line {} of {}'.format(line.lineno, line.filename)
-                session.add_trusted_host(host, source=source)
-
-    return None
-
-
-class RequirementsFileParser(object):
-    def __init__(
-        self,
-        session,  # type: PipSession
-        line_parser,  # type: LineParser
-        comes_from,  # type: str
-        skip_requirements_regex,  # type: Optional[str]
-    ):
-        # type: (...) -> None
-        self._session = session
-        self._line_parser = line_parser
-        self._comes_from = comes_from
-        self._skip_requirements_regex = skip_requirements_regex
-
-    def parse(self, filename, constraint):
-        # type: (str, bool) -> Iterator[ParsedLine]
-        """Parse a given file, yielding parsed lines.
-        """
-        for line in self._parse_and_recurse(filename, constraint):
-            yield line
-
-    def _parse_and_recurse(self, filename, constraint):
-        # type: (str, bool) -> Iterator[ParsedLine]
-        for line in self._parse_file(filename, constraint):
-            if (
-                not line.args and
-                not line.opts.editables and
-                (line.opts.requirements or line.opts.constraints)
-            ):
-                # parse a nested requirements file
-                if line.opts.requirements:
-                    req_path = line.opts.requirements[0]
-                    nested_constraint = False
-                else:
-                    req_path = line.opts.constraints[0]
-                    nested_constraint = True
-
-                # original file is over http
-                if SCHEME_RE.search(filename):
-                    # do a url join so relative paths work
-                    req_path = urllib_parse.urljoin(filename, req_path)
-                # original file and nested file are paths
-                elif not SCHEME_RE.search(req_path):
-                    # do a join so relative paths work
-                    req_path = os.path.join(
-                        os.path.dirname(filename), req_path,
-                    )
-
-                for inner_line in self._parse_and_recurse(
-                    req_path, nested_constraint,
-                ):
-                    yield inner_line
-            else:
-                yield line
-
-    def _parse_file(self, filename, constraint):
-        # type: (str, bool) -> Iterator[ParsedLine]
-        _, content = get_file_content(
-            filename, self._session, comes_from=self._comes_from
-        )
-
-        lines_enum = preprocess(content, self._skip_requirements_regex)
-
-        for line_number, line in lines_enum:
-            try:
-                args_str, opts = self._line_parser(line)
-            except OptionParsingError as e:
-                # add offending line
-                msg = 'Invalid requirement: %s\n%s' % (line, e.msg)
-                raise RequirementsFileParseError(msg)
-
-            yield ParsedLine(
-                filename,
-                line_number,
-                self._comes_from,
-                args_str,
-                opts,
-                constraint,
-            )
-
-
-def get_line_parser(finder):
-    # type: (Optional[PackageFinder]) -> LineParser
-    def parse_line(line):
-        # type: (Text) -> Tuple[str, Values]
-        # Build new parser for each line since it accumulates appendable
-        # options.
-        parser = build_parser()
-        defaults = parser.get_default_values()
-        defaults.index_url = None
-        if finder:
-            defaults.format_control = finder.format_control
-
-        args_str, options_str = break_args_options(line)
-        # Prior to 2.7.3, shlex cannot deal with unicode entries
-        if sys.version_info < (2, 7, 3):
-            # https://github.com/python/mypy/issues/1174
-            options_str = options_str.encode('utf8')  # type: ignore
-
-        # https://github.com/python/mypy/issues/1174
-        opts, _ = parser.parse_args(
-            shlex.split(options_str), defaults)  # type: ignore
-
-        return args_str, opts
-
-    return parse_line
-
-
-def break_args_options(line):
-    # type: (Text) -> Tuple[str, Text]
-    """Break up the line into an args and options string.  We only want to shlex
-    (and then optparse) the options, not the args.  args can contain markers
-    which are corrupted by shlex.
-    """
-    tokens = line.split(' ')
-    args = []
-    options = tokens[:]
-    for token in tokens:
-        if token.startswith('-') or token.startswith('--'):
-            break
-        else:
-            args.append(token)
-            options.pop(0)
-    return ' '.join(args), ' '.join(options)  # type: ignore
-
-
-class OptionParsingError(Exception):
-    def __init__(self, msg):
-        # type: (str) -> None
-        self.msg = msg
-
-
-def build_parser():
-    # type: () -> optparse.OptionParser
-    """
-    Return a parser for parsing requirement lines
-    """
-    parser = optparse.OptionParser(add_help_option=False)
-
-    option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS_REQ
-    for option_factory in option_factories:
-        option = option_factory()
-        parser.add_option(option)
-
-    # By default optparse sys.exits on parsing errors. We want to wrap
-    # that in our own exception.
-    def parser_exit(self, msg):
-        # type: (Any, str) -> NoReturn
-        raise OptionParsingError(msg)
-    # NOTE: mypy disallows assigning to a method
-    #       https://github.com/python/mypy/issues/2427
-    parser.exit = parser_exit  # type: ignore
-
-    return parser
-
-
-def join_lines(lines_enum):
-    # type: (ReqFileLines) -> ReqFileLines
-    """Joins a line ending in '\' with the previous line (except when following
-    comments).  The joined line takes on the index of the first line.
-    """
-    primary_line_number = None
-    new_line = []  # type: List[Text]
-    for line_number, line in lines_enum:
-        if not line.endswith('\\') or COMMENT_RE.match(line):
-            if COMMENT_RE.match(line):
-                # this ensures comments are always matched later
-                line = ' ' + line
-            if new_line:
-                new_line.append(line)
-                yield primary_line_number, ''.join(new_line)
-                new_line = []
-            else:
-                yield line_number, line
-        else:
-            if not new_line:
-                primary_line_number = line_number
-            new_line.append(line.strip('\\'))
-
-    # last line contains \
-    if new_line:
-        yield primary_line_number, ''.join(new_line)
-
-    # TODO: handle space after '\'.
-
-
-def ignore_comments(lines_enum):
-    # type: (ReqFileLines) -> ReqFileLines
-    """
-    Strips comments and filter empty lines.
-    """
-    for line_number, line in lines_enum:
-        line = COMMENT_RE.sub('', line)
-        line = line.strip()
-        if line:
-            yield line_number, line
-
-
-def skip_regex(lines_enum, pattern):
-    # type: (ReqFileLines, str) -> ReqFileLines
-    """
-    Skip lines that match the provided pattern
-
-    Note: the regex pattern is only built once
-    """
-    matcher = re.compile(pattern)
-    lines_enum = filterfalse(lambda e: matcher.search(e[1]), lines_enum)
-    return lines_enum
-
-
-def expand_env_variables(lines_enum):
-    # type: (ReqFileLines) -> ReqFileLines
-    """Replace all environment variables that can be retrieved via `os.getenv`.
-
-    The only allowed format for environment variables defined in the
-    requirement file is `${MY_VARIABLE_1}` to ensure two things:
-
-    1. Strings that contain a `$` aren't accidentally (partially) expanded.
-    2. Ensure consistency across platforms for requirement files.
-
-    These points are the result of a discussion on the `github pull
-    request #3514 `_.
-
-    Valid characters in variable names follow the `POSIX standard
-    `_ and are limited
-    to uppercase letter, digits and the `_` (underscore).
-    """
-    for line_number, line in lines_enum:
-        for env_var, var_name in ENV_VAR_RE.findall(line):
-            value = os.getenv(var_name)
-            if not value:
-                continue
-
-            line = line.replace(env_var, value)
-
-        yield line_number, line
-
-
-def get_file_content(url, session, comes_from=None):
-    # type: (str, PipSession, Optional[str]) -> Tuple[str, Text]
-    """Gets the content of a file; it may be a filename, file: URL, or
-    http: URL.  Returns (location, content).  Content is unicode.
-    Respects # -*- coding: declarations on the retrieved files.
-
-    :param url:         File path or url.
-    :param session:     PipSession instance.
-    :param comes_from:  Origin description of requirements.
-    """
-    scheme = get_url_scheme(url)
-
-    if scheme in ['http', 'https']:
-        # FIXME: catch some errors
-        resp = session.get(url)
-        resp.raise_for_status()
-        return resp.url, resp.text
-
-    elif scheme == 'file':
-        if comes_from and comes_from.startswith('http'):
-            raise InstallationError(
-                'Requirements file %s references URL %s, which is local'
-                % (comes_from, url))
-
-        path = url.split(':', 1)[1]
-        path = path.replace('\\', '/')
-        match = _url_slash_drive_re.match(path)
-        if match:
-            path = match.group(1) + ':' + path.split('|', 1)[1]
-        path = urllib_parse.unquote(path)
-        if path.startswith('/'):
-            path = '/' + path.lstrip('/')
-        url = path
-
-    try:
-        with open(url, 'rb') as f:
-            content = auto_decode(f.read())
-    except IOError as exc:
-        raise InstallationError(
-            'Could not open requirements file: %s' % str(exc)
-        )
-    return url, content
-
-
-_url_slash_drive_re = re.compile(r'/*([a-z])\|', re.I)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/req_install.py b/venv/lib/python3.8/site-packages/pip/_internal/req/req_install.py
deleted file mode 100644
index 22ac24b96d361e8202979e3cbb23309792f7e090..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/req/req_install.py
+++ /dev/null
@@ -1,830 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-import shutil
-import sys
-import zipfile
-
-from pip._vendor import pkg_resources, six
-from pip._vendor.packaging.requirements import Requirement
-from pip._vendor.packaging.utils import canonicalize_name
-from pip._vendor.packaging.version import Version
-from pip._vendor.packaging.version import parse as parse_version
-from pip._vendor.pep517.wrappers import Pep517HookCaller
-
-from pip._internal import pep425tags
-from pip._internal.build_env import NoOpBuildEnvironment
-from pip._internal.exceptions import InstallationError
-from pip._internal.locations import get_scheme
-from pip._internal.models.link import Link
-from pip._internal.operations.build.metadata import generate_metadata
-from pip._internal.operations.build.metadata_legacy import \
-    generate_metadata as generate_metadata_legacy
-from pip._internal.operations.install.editable_legacy import \
-    install_editable as install_editable_legacy
-from pip._internal.operations.install.legacy import install as install_legacy
-from pip._internal.operations.install.wheel import install_wheel
-from pip._internal.pyproject import load_pyproject_toml, make_pyproject_path
-from pip._internal.req.req_uninstall import UninstallPathSet
-from pip._internal.utils.deprecation import deprecated
-from pip._internal.utils.hashes import Hashes
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.marker_files import (
-    PIP_DELETE_MARKER_FILENAME,
-    has_delete_marker_file,
-    write_delete_marker_file,
-)
-from pip._internal.utils.misc import (
-    ask_path_exists,
-    backup_dir,
-    display_path,
-    dist_in_site_packages,
-    dist_in_usersite,
-    get_installed_version,
-    hide_url,
-    redact_auth_from_url,
-    rmtree,
-)
-from pip._internal.utils.packaging import get_metadata
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.virtualenv import running_under_virtualenv
-from pip._internal.vcs import vcs
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Any, Dict, Iterable, List, Optional, Sequence, Union,
-    )
-    from pip._internal.build_env import BuildEnvironment
-    from pip._internal.cache import WheelCache
-    from pip._internal.index.package_finder import PackageFinder
-    from pip._vendor.pkg_resources import Distribution
-    from pip._vendor.packaging.specifiers import SpecifierSet
-    from pip._vendor.packaging.markers import Marker
-
-
-logger = logging.getLogger(__name__)
-
-
-def _get_dist(metadata_directory):
-    # type: (str) -> Distribution
-    """Return a pkg_resources.Distribution for the provided
-    metadata directory.
-    """
-    dist_dir = metadata_directory.rstrip(os.sep)
-
-    # Determine the correct Distribution object type.
-    if dist_dir.endswith(".egg-info"):
-        dist_cls = pkg_resources.Distribution
-    else:
-        assert dist_dir.endswith(".dist-info")
-        dist_cls = pkg_resources.DistInfoDistribution
-
-    # Build a PathMetadata object, from path to metadata. :wink:
-    base_dir, dist_dir_name = os.path.split(dist_dir)
-    dist_name = os.path.splitext(dist_dir_name)[0]
-    metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
-
-    return dist_cls(
-        base_dir,
-        project_name=dist_name,
-        metadata=metadata,
-    )
-
-
-class InstallRequirement(object):
-    """
-    Represents something that may be installed later on, may have information
-    about where to fetch the relevant requirement and also contains logic for
-    installing the said requirement.
-    """
-
-    def __init__(
-        self,
-        req,  # type: Optional[Requirement]
-        comes_from,  # type: Optional[Union[str, InstallRequirement]]
-        source_dir=None,  # type: Optional[str]
-        editable=False,  # type: bool
-        link=None,  # type: Optional[Link]
-        markers=None,  # type: Optional[Marker]
-        use_pep517=None,  # type: Optional[bool]
-        isolated=False,  # type: bool
-        options=None,  # type: Optional[Dict[str, Any]]
-        wheel_cache=None,  # type: Optional[WheelCache]
-        constraint=False,  # type: bool
-        extras=()  # type: Iterable[str]
-    ):
-        # type: (...) -> None
-        assert req is None or isinstance(req, Requirement), req
-        self.req = req
-        self.comes_from = comes_from
-        self.constraint = constraint
-        if source_dir is None:
-            self.source_dir = None  # type: Optional[str]
-        else:
-            self.source_dir = os.path.normpath(os.path.abspath(source_dir))
-        self.editable = editable
-
-        self._wheel_cache = wheel_cache
-        if link is None and req and req.url:
-            # PEP 508 URL requirement
-            link = Link(req.url)
-        self.link = self.original_link = link
-        # Path to any downloaded or already-existing package.
-        self.local_file_path = None  # type: Optional[str]
-        if self.link and self.link.is_file:
-            self.local_file_path = self.link.file_path
-
-        if extras:
-            self.extras = extras
-        elif req:
-            self.extras = {
-                pkg_resources.safe_extra(extra) for extra in req.extras
-            }
-        else:
-            self.extras = set()
-        if markers is None and req:
-            markers = req.marker
-        self.markers = markers
-
-        # This holds the pkg_resources.Distribution object if this requirement
-        # is already available:
-        self.satisfied_by = None  # type: Optional[Distribution]
-        # Whether the installation process should try to uninstall an existing
-        # distribution before installing this requirement.
-        self.should_reinstall = False
-        # Temporary build location
-        self._temp_build_dir = None  # type: Optional[TempDirectory]
-        # Set to True after successful installation
-        self.install_succeeded = None  # type: Optional[bool]
-        self.options = options if options else {}
-        # Set to True after successful preparation of this requirement
-        self.prepared = False
-        self.is_direct = False
-
-        self.isolated = isolated
-        self.build_env = NoOpBuildEnvironment()  # type: BuildEnvironment
-
-        # For PEP 517, the directory where we request the project metadata
-        # gets stored. We need this to pass to build_wheel, so the backend
-        # can ensure that the wheel matches the metadata (see the PEP for
-        # details).
-        self.metadata_directory = None  # type: Optional[str]
-
-        # The static build requirements (from pyproject.toml)
-        self.pyproject_requires = None  # type: Optional[List[str]]
-
-        # Build requirements that we will check are available
-        self.requirements_to_check = []  # type: List[str]
-
-        # The PEP 517 backend we should use to build the project
-        self.pep517_backend = None  # type: Optional[Pep517HookCaller]
-
-        # Are we using PEP 517 for this requirement?
-        # After pyproject.toml has been loaded, the only valid values are True
-        # and False. Before loading, None is valid (meaning "use the default").
-        # Setting an explicit value before loading pyproject.toml is supported,
-        # but after loading this flag should be treated as read only.
-        self.use_pep517 = use_pep517
-
-    def __str__(self):
-        # type: () -> str
-        if self.req:
-            s = str(self.req)
-            if self.link:
-                s += ' from %s' % redact_auth_from_url(self.link.url)
-        elif self.link:
-            s = redact_auth_from_url(self.link.url)
-        else:
-            s = ''
-        if self.satisfied_by is not None:
-            s += ' in %s' % display_path(self.satisfied_by.location)
-        if self.comes_from:
-            if isinstance(self.comes_from, six.string_types):
-                comes_from = self.comes_from  # type: Optional[str]
-            else:
-                comes_from = self.comes_from.from_path()
-            if comes_from:
-                s += ' (from %s)' % comes_from
-        return s
-
-    def __repr__(self):
-        # type: () -> str
-        return '<%s object: %s editable=%r>' % (
-            self.__class__.__name__, str(self), self.editable)
-
-    def format_debug(self):
-        # type: () -> str
-        """An un-tested helper for getting state, for debugging.
-        """
-        attributes = vars(self)
-        names = sorted(attributes)
-
-        state = (
-            "{}={!r}".format(attr, attributes[attr]) for attr in sorted(names)
-        )
-        return '<{name} object: {{{state}}}>'.format(
-            name=self.__class__.__name__,
-            state=", ".join(state),
-        )
-
-    def populate_link(self, finder, upgrade, require_hashes):
-        # type: (PackageFinder, bool, bool) -> None
-        """Ensure that if a link can be found for this, that it is found.
-
-        Note that self.link may still be None - if Upgrade is False and the
-        requirement is already installed.
-
-        If require_hashes is True, don't use the wheel cache, because cached
-        wheels, always built locally, have different hashes than the files
-        downloaded from the index server and thus throw false hash mismatches.
-        Furthermore, cached wheels at present have undeterministic contents due
-        to file modification times.
-        """
-        if self.link is None:
-            self.link = finder.find_requirement(self, upgrade)
-        if self._wheel_cache is not None and not require_hashes:
-            old_link = self.link
-            supported_tags = pep425tags.get_supported()
-            self.link = self._wheel_cache.get(
-                link=self.link,
-                package_name=self.name,
-                supported_tags=supported_tags,
-            )
-            if old_link != self.link:
-                logger.debug('Using cached wheel link: %s', self.link)
-
-    # Things that are valid for all kinds of requirements?
-    @property
-    def name(self):
-        # type: () -> Optional[str]
-        if self.req is None:
-            return None
-        return six.ensure_str(pkg_resources.safe_name(self.req.name))
-
-    @property
-    def specifier(self):
-        # type: () -> SpecifierSet
-        return self.req.specifier
-
-    @property
-    def is_pinned(self):
-        # type: () -> bool
-        """Return whether I am pinned to an exact version.
-
-        For example, some-package==1.2 is pinned; some-package>1.2 is not.
-        """
-        specifiers = self.specifier
-        return (len(specifiers) == 1 and
-                next(iter(specifiers)).operator in {'==', '==='})
-
-    @property
-    def installed_version(self):
-        # type: () -> Optional[str]
-        return get_installed_version(self.name)
-
-    def match_markers(self, extras_requested=None):
-        # type: (Optional[Iterable[str]]) -> bool
-        if not extras_requested:
-            # Provide an extra to safely evaluate the markers
-            # without matching any extra
-            extras_requested = ('',)
-        if self.markers is not None:
-            return any(
-                self.markers.evaluate({'extra': extra})
-                for extra in extras_requested)
-        else:
-            return True
-
-    @property
-    def has_hash_options(self):
-        # type: () -> bool
-        """Return whether any known-good hashes are specified as options.
-
-        These activate --require-hashes mode; hashes specified as part of a
-        URL do not.
-
-        """
-        return bool(self.options.get('hashes', {}))
-
-    def hashes(self, trust_internet=True):
-        # type: (bool) -> Hashes
-        """Return a hash-comparer that considers my option- and URL-based
-        hashes to be known-good.
-
-        Hashes in URLs--ones embedded in the requirements file, not ones
-        downloaded from an index server--are almost peers with ones from
-        flags. They satisfy --require-hashes (whether it was implicitly or
-        explicitly activated) but do not activate it. md5 and sha224 are not
-        allowed in flags, which should nudge people toward good algos. We
-        always OR all hashes together, even ones from URLs.
-
-        :param trust_internet: Whether to trust URL-based (#md5=...) hashes
-            downloaded from the internet, as by populate_link()
-
-        """
-        good_hashes = self.options.get('hashes', {}).copy()
-        link = self.link if trust_internet else self.original_link
-        if link and link.hash:
-            good_hashes.setdefault(link.hash_name, []).append(link.hash)
-        return Hashes(good_hashes)
-
-    def from_path(self):
-        # type: () -> Optional[str]
-        """Format a nice indicator to show where this "comes from"
-        """
-        if self.req is None:
-            return None
-        s = str(self.req)
-        if self.comes_from:
-            if isinstance(self.comes_from, six.string_types):
-                comes_from = self.comes_from
-            else:
-                comes_from = self.comes_from.from_path()
-            if comes_from:
-                s += '->' + comes_from
-        return s
-
-    def ensure_build_location(self, build_dir):
-        # type: (str) -> str
-        assert build_dir is not None
-        if self._temp_build_dir is not None:
-            assert self._temp_build_dir.path
-            return self._temp_build_dir.path
-        if self.req is None:
-            # Some systems have /tmp as a symlink which confuses custom
-            # builds (such as numpy). Thus, we ensure that the real path
-            # is returned.
-            self._temp_build_dir = TempDirectory(kind="req-build")
-
-            return self._temp_build_dir.path
-        if self.editable:
-            name = self.name.lower()
-        else:
-            name = self.name
-        # FIXME: Is there a better place to create the build_dir? (hg and bzr
-        # need this)
-        if not os.path.exists(build_dir):
-            logger.debug('Creating directory %s', build_dir)
-            os.makedirs(build_dir)
-            write_delete_marker_file(build_dir)
-        return os.path.join(build_dir, name)
-
-    def _set_requirement(self):
-        # type: () -> None
-        """Set requirement after generating metadata.
-        """
-        assert self.req is None
-        assert self.metadata is not None
-        assert self.source_dir is not None
-
-        # Construct a Requirement object from the generated metadata
-        if isinstance(parse_version(self.metadata["Version"]), Version):
-            op = "=="
-        else:
-            op = "==="
-
-        self.req = Requirement(
-            "".join([
-                self.metadata["Name"],
-                op,
-                self.metadata["Version"],
-            ])
-        )
-
-    def warn_on_mismatching_name(self):
-        # type: () -> None
-        metadata_name = canonicalize_name(self.metadata["Name"])
-        if canonicalize_name(self.req.name) == metadata_name:
-            # Everything is fine.
-            return
-
-        # If we're here, there's a mismatch. Log a warning about it.
-        logger.warning(
-            'Generating metadata for package %s '
-            'produced metadata for project name %s. Fix your '
-            '#egg=%s fragments.',
-            self.name, metadata_name, self.name
-        )
-        self.req = Requirement(metadata_name)
-
-    def remove_temporary_source(self):
-        # type: () -> None
-        """Remove the source files from this requirement, if they are marked
-        for deletion"""
-        if self.source_dir and has_delete_marker_file(self.source_dir):
-            logger.debug('Removing source in %s', self.source_dir)
-            rmtree(self.source_dir)
-        self.source_dir = None
-        if self._temp_build_dir:
-            self._temp_build_dir.cleanup()
-            self._temp_build_dir = None
-        self.build_env.cleanup()
-
-    def check_if_exists(self, use_user_site):
-        # type: (bool) -> None
-        """Find an installed distribution that satisfies or conflicts
-        with this requirement, and set self.satisfied_by or
-        self.should_reinstall appropriately.
-        """
-        if self.req is None:
-            return
-        # get_distribution() will resolve the entire list of requirements
-        # anyway, and we've already determined that we need the requirement
-        # in question, so strip the marker so that we don't try to
-        # evaluate it.
-        no_marker = Requirement(str(self.req))
-        no_marker.marker = None
-        try:
-            self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
-        except pkg_resources.DistributionNotFound:
-            return
-        except pkg_resources.VersionConflict:
-            existing_dist = pkg_resources.get_distribution(
-                self.req.name
-            )
-            if use_user_site:
-                if dist_in_usersite(existing_dist):
-                    self.should_reinstall = True
-                elif (running_under_virtualenv() and
-                        dist_in_site_packages(existing_dist)):
-                    raise InstallationError(
-                        "Will not install to the user site because it will "
-                        "lack sys.path precedence to %s in %s" %
-                        (existing_dist.project_name, existing_dist.location)
-                    )
-            else:
-                self.should_reinstall = True
-        else:
-            if self.editable and self.satisfied_by:
-                self.should_reinstall = True
-                # when installing editables, nothing pre-existing should ever
-                # satisfy
-                self.satisfied_by = None
-
-    # Things valid for wheels
-    @property
-    def is_wheel(self):
-        # type: () -> bool
-        if not self.link:
-            return False
-        return self.link.is_wheel
-
-    # Things valid for sdists
-    @property
-    def unpacked_source_directory(self):
-        # type: () -> str
-        return os.path.join(
-            self.source_dir,
-            self.link and self.link.subdirectory_fragment or '')
-
-    @property
-    def setup_py_path(self):
-        # type: () -> str
-        assert self.source_dir, "No source dir for %s" % self
-        setup_py = os.path.join(self.unpacked_source_directory, 'setup.py')
-
-        # Python2 __file__ should not be unicode
-        if six.PY2 and isinstance(setup_py, six.text_type):
-            setup_py = setup_py.encode(sys.getfilesystemencoding())
-
-        return setup_py
-
-    @property
-    def pyproject_toml_path(self):
-        # type: () -> str
-        assert self.source_dir, "No source dir for %s" % self
-        return make_pyproject_path(self.unpacked_source_directory)
-
-    def load_pyproject_toml(self):
-        # type: () -> None
-        """Load the pyproject.toml file.
-
-        After calling this routine, all of the attributes related to PEP 517
-        processing for this requirement have been set. In particular, the
-        use_pep517 attribute can be used to determine whether we should
-        follow the PEP 517 or legacy (setup.py) code path.
-        """
-        pyproject_toml_data = load_pyproject_toml(
-            self.use_pep517,
-            self.pyproject_toml_path,
-            self.setup_py_path,
-            str(self)
-        )
-
-        if pyproject_toml_data is None:
-            self.use_pep517 = False
-            return
-
-        self.use_pep517 = True
-        requires, backend, check, backend_path = pyproject_toml_data
-        self.requirements_to_check = check
-        self.pyproject_requires = requires
-        self.pep517_backend = Pep517HookCaller(
-            self.unpacked_source_directory, backend, backend_path=backend_path,
-        )
-
-    def _generate_metadata(self):
-        # type: () -> str
-        """Invokes metadata generator functions, with the required arguments.
-        """
-        if not self.use_pep517:
-            assert self.unpacked_source_directory
-
-            return generate_metadata_legacy(
-                build_env=self.build_env,
-                setup_py_path=self.setup_py_path,
-                source_dir=self.unpacked_source_directory,
-                editable=self.editable,
-                isolated=self.isolated,
-                details=self.name or "from {}".format(self.link)
-            )
-
-        assert self.pep517_backend is not None
-
-        return generate_metadata(
-            build_env=self.build_env,
-            backend=self.pep517_backend,
-        )
-
-    def prepare_metadata(self):
-        # type: () -> None
-        """Ensure that project metadata is available.
-
-        Under PEP 517, call the backend hook to prepare the metadata.
-        Under legacy processing, call setup.py egg-info.
-        """
-        assert self.source_dir
-
-        with indent_log():
-            self.metadata_directory = self._generate_metadata()
-
-        # Act on the newly generated metadata, based on the name and version.
-        if not self.name:
-            self._set_requirement()
-        else:
-            self.warn_on_mismatching_name()
-
-        self.assert_source_matches_version()
-
-    @property
-    def metadata(self):
-        # type: () -> Any
-        if not hasattr(self, '_metadata'):
-            self._metadata = get_metadata(self.get_dist())
-
-        return self._metadata
-
-    def get_dist(self):
-        # type: () -> Distribution
-        return _get_dist(self.metadata_directory)
-
-    def assert_source_matches_version(self):
-        # type: () -> None
-        assert self.source_dir
-        version = self.metadata['version']
-        if self.req.specifier and version not in self.req.specifier:
-            logger.warning(
-                'Requested %s, but installing version %s',
-                self,
-                version,
-            )
-        else:
-            logger.debug(
-                'Source in %s has version %s, which satisfies requirement %s',
-                display_path(self.source_dir),
-                version,
-                self,
-            )
-
-    # For both source distributions and editables
-    def ensure_has_source_dir(self, parent_dir):
-        # type: (str) -> None
-        """Ensure that a source_dir is set.
-
-        This will create a temporary build dir if the name of the requirement
-        isn't known yet.
-
-        :param parent_dir: The ideal pip parent_dir for the source_dir.
-            Generally src_dir for editables and build_dir for sdists.
-        :return: self.source_dir
-        """
-        if self.source_dir is None:
-            self.source_dir = self.ensure_build_location(parent_dir)
-
-    # For editable installations
-    def update_editable(self, obtain=True):
-        # type: (bool) -> None
-        if not self.link:
-            logger.debug(
-                "Cannot update repository at %s; repository location is "
-                "unknown",
-                self.source_dir,
-            )
-            return
-        assert self.editable
-        assert self.source_dir
-        if self.link.scheme == 'file':
-            # Static paths don't get updated
-            return
-        assert '+' in self.link.url, "bad url: %r" % self.link.url
-        vc_type, url = self.link.url.split('+', 1)
-        vcs_backend = vcs.get_backend(vc_type)
-        if vcs_backend:
-            if not self.link.is_vcs:
-                reason = (
-                    "This form of VCS requirement is being deprecated: {}."
-                ).format(
-                    self.link.url
-                )
-                replacement = None
-                if self.link.url.startswith("git+git@"):
-                    replacement = (
-                        "git+https://git@example.com/..., "
-                        "git+ssh://git@example.com/..., "
-                        "or the insecure git+git://git@example.com/..."
-                    )
-                deprecated(reason, replacement, gone_in="21.0", issue=7554)
-            hidden_url = hide_url(self.link.url)
-            if obtain:
-                vcs_backend.obtain(self.source_dir, url=hidden_url)
-            else:
-                vcs_backend.export(self.source_dir, url=hidden_url)
-        else:
-            assert 0, (
-                'Unexpected version control type (in %s): %s'
-                % (self.link, vc_type))
-
-    # Top-level Actions
-    def uninstall(self, auto_confirm=False, verbose=False):
-        # type: (bool, bool) -> Optional[UninstallPathSet]
-        """
-        Uninstall the distribution currently satisfying this requirement.
-
-        Prompts before removing or modifying files unless
-        ``auto_confirm`` is True.
-
-        Refuses to delete or modify files outside of ``sys.prefix`` -
-        thus uninstallation within a virtual environment can only
-        modify that virtual environment, even if the virtualenv is
-        linked to global site-packages.
-
-        """
-        assert self.req
-        try:
-            dist = pkg_resources.get_distribution(self.req.name)
-        except pkg_resources.DistributionNotFound:
-            logger.warning("Skipping %s as it is not installed.", self.name)
-            return None
-        else:
-            logger.info('Found existing installation: %s', dist)
-
-        uninstalled_pathset = UninstallPathSet.from_dist(dist)
-        uninstalled_pathset.remove(auto_confirm, verbose)
-        return uninstalled_pathset
-
-    def _get_archive_name(self, path, parentdir, rootdir):
-        # type: (str, str, str) -> str
-
-        def _clean_zip_name(name, prefix):
-            # type: (str, str) -> str
-            assert name.startswith(prefix + os.path.sep), (
-                "name %r doesn't start with prefix %r" % (name, prefix)
-            )
-            name = name[len(prefix) + 1:]
-            name = name.replace(os.path.sep, '/')
-            return name
-
-        path = os.path.join(parentdir, path)
-        name = _clean_zip_name(path, rootdir)
-        return self.name + '/' + name
-
-    def archive(self, build_dir):
-        # type: (str) -> None
-        """Saves archive to provided build_dir.
-
-        Used for saving downloaded VCS requirements as part of `pip download`.
-        """
-        assert self.source_dir
-
-        create_archive = True
-        archive_name = '%s-%s.zip' % (self.name, self.metadata["version"])
-        archive_path = os.path.join(build_dir, archive_name)
-
-        if os.path.exists(archive_path):
-            response = ask_path_exists(
-                'The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)bort ' %
-                display_path(archive_path), ('i', 'w', 'b', 'a'))
-            if response == 'i':
-                create_archive = False
-            elif response == 'w':
-                logger.warning('Deleting %s', display_path(archive_path))
-                os.remove(archive_path)
-            elif response == 'b':
-                dest_file = backup_dir(archive_path)
-                logger.warning(
-                    'Backing up %s to %s',
-                    display_path(archive_path),
-                    display_path(dest_file),
-                )
-                shutil.move(archive_path, dest_file)
-            elif response == 'a':
-                sys.exit(-1)
-
-        if not create_archive:
-            return
-
-        zip_output = zipfile.ZipFile(
-            archive_path, 'w', zipfile.ZIP_DEFLATED, allowZip64=True,
-        )
-        with zip_output:
-            dir = os.path.normcase(
-                os.path.abspath(self.unpacked_source_directory)
-            )
-            for dirpath, dirnames, filenames in os.walk(dir):
-                if 'pip-egg-info' in dirnames:
-                    dirnames.remove('pip-egg-info')
-                for dirname in dirnames:
-                    dir_arcname = self._get_archive_name(
-                        dirname, parentdir=dirpath, rootdir=dir,
-                    )
-                    zipdir = zipfile.ZipInfo(dir_arcname + '/')
-                    zipdir.external_attr = 0x1ED << 16  # 0o755
-                    zip_output.writestr(zipdir, '')
-                for filename in filenames:
-                    if filename == PIP_DELETE_MARKER_FILENAME:
-                        continue
-                    file_arcname = self._get_archive_name(
-                        filename, parentdir=dirpath, rootdir=dir,
-                    )
-                    filename = os.path.join(dirpath, filename)
-                    zip_output.write(filename, file_arcname)
-
-        logger.info('Saved %s', display_path(archive_path))
-
-    def install(
-        self,
-        install_options,  # type: List[str]
-        global_options=None,  # type: Optional[Sequence[str]]
-        root=None,  # type: Optional[str]
-        home=None,  # type: Optional[str]
-        prefix=None,  # type: Optional[str]
-        warn_script_location=True,  # type: bool
-        use_user_site=False,  # type: bool
-        pycompile=True  # type: bool
-    ):
-        # type: (...) -> None
-        scheme = get_scheme(
-            self.name,
-            user=use_user_site,
-            home=home,
-            root=root,
-            isolated=self.isolated,
-            prefix=prefix,
-        )
-
-        global_options = global_options if global_options is not None else []
-        if self.editable:
-            install_editable_legacy(
-                install_options,
-                global_options,
-                prefix=prefix,
-                home=home,
-                use_user_site=use_user_site,
-                name=self.name,
-                setup_py_path=self.setup_py_path,
-                isolated=self.isolated,
-                build_env=self.build_env,
-                unpacked_source_directory=self.unpacked_source_directory,
-            )
-            self.install_succeeded = True
-            return
-
-        if self.is_wheel:
-            assert self.local_file_path
-            install_wheel(
-                self.name,
-                self.local_file_path,
-                scheme=scheme,
-                req_description=str(self.req),
-                pycompile=pycompile,
-                warn_script_location=warn_script_location,
-            )
-            self.install_succeeded = True
-            return
-
-        install_legacy(
-            self,
-            install_options=install_options,
-            global_options=global_options,
-            root=root,
-            home=home,
-            prefix=prefix,
-            use_user_site=use_user_site,
-            pycompile=pycompile,
-            scheme=scheme,
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/req_set.py b/venv/lib/python3.8/site-packages/pip/_internal/req/req_set.py
deleted file mode 100644
index 087ac5925f52c99345cffe693d6a392e39bd70c4..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/req/req_set.py
+++ /dev/null
@@ -1,209 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import logging
-from collections import OrderedDict
-
-from pip._vendor.packaging.utils import canonicalize_name
-
-from pip._internal import pep425tags
-from pip._internal.exceptions import InstallationError
-from pip._internal.models.wheel import Wheel
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Dict, Iterable, List, Optional, Tuple
-    from pip._internal.req.req_install import InstallRequirement
-
-
-logger = logging.getLogger(__name__)
-
-
-class RequirementSet(object):
-
-    def __init__(self, check_supported_wheels=True):
-        # type: (bool) -> None
-        """Create a RequirementSet.
-        """
-
-        self.requirements = OrderedDict()  # type: Dict[str, InstallRequirement]  # noqa: E501
-        self.check_supported_wheels = check_supported_wheels
-
-        self.unnamed_requirements = []  # type: List[InstallRequirement]
-        self.successfully_downloaded = []  # type: List[InstallRequirement]
-        self.reqs_to_cleanup = []  # type: List[InstallRequirement]
-
-    def __str__(self):
-        # type: () -> str
-        requirements = sorted(
-            (req for req in self.requirements.values() if not req.comes_from),
-            key=lambda req: canonicalize_name(req.name),
-        )
-        return ' '.join(str(req.req) for req in requirements)
-
-    def __repr__(self):
-        # type: () -> str
-        requirements = sorted(
-            self.requirements.values(),
-            key=lambda req: canonicalize_name(req.name),
-        )
-
-        format_string = '<{classname} object; {count} requirement(s): {reqs}>'
-        return format_string.format(
-            classname=self.__class__.__name__,
-            count=len(requirements),
-            reqs=', '.join(str(req.req) for req in requirements),
-        )
-
-    def add_unnamed_requirement(self, install_req):
-        # type: (InstallRequirement) -> None
-        assert not install_req.name
-        self.unnamed_requirements.append(install_req)
-
-    def add_named_requirement(self, install_req):
-        # type: (InstallRequirement) -> None
-        assert install_req.name
-
-        project_name = canonicalize_name(install_req.name)
-        self.requirements[project_name] = install_req
-
-    def add_requirement(
-        self,
-        install_req,  # type: InstallRequirement
-        parent_req_name=None,  # type: Optional[str]
-        extras_requested=None  # type: Optional[Iterable[str]]
-    ):
-        # type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]]  # noqa: E501
-        """Add install_req as a requirement to install.
-
-        :param parent_req_name: The name of the requirement that needed this
-            added. The name is used because when multiple unnamed requirements
-            resolve to the same name, we could otherwise end up with dependency
-            links that point outside the Requirements set. parent_req must
-            already be added. Note that None implies that this is a user
-            supplied requirement, vs an inferred one.
-        :param extras_requested: an iterable of extras used to evaluate the
-            environment markers.
-        :return: Additional requirements to scan. That is either [] if
-            the requirement is not applicable, or [install_req] if the
-            requirement is applicable and has just been added.
-        """
-        # If the markers do not match, ignore this requirement.
-        if not install_req.match_markers(extras_requested):
-            logger.info(
-                "Ignoring %s: markers '%s' don't match your environment",
-                install_req.name, install_req.markers,
-            )
-            return [], None
-
-        # If the wheel is not supported, raise an error.
-        # Should check this after filtering out based on environment markers to
-        # allow specifying different wheels based on the environment/OS, in a
-        # single requirements file.
-        if install_req.link and install_req.link.is_wheel:
-            wheel = Wheel(install_req.link.filename)
-            tags = pep425tags.get_supported()
-            if (self.check_supported_wheels and not wheel.supported(tags)):
-                raise InstallationError(
-                    "%s is not a supported wheel on this platform." %
-                    wheel.filename
-                )
-
-        # This next bit is really a sanity check.
-        assert install_req.is_direct == (parent_req_name is None), (
-            "a direct req shouldn't have a parent and also, "
-            "a non direct req should have a parent"
-        )
-
-        # Unnamed requirements are scanned again and the requirement won't be
-        # added as a dependency until after scanning.
-        if not install_req.name:
-            self.add_unnamed_requirement(install_req)
-            return [install_req], None
-
-        try:
-            existing_req = self.get_requirement(install_req.name)
-        except KeyError:
-            existing_req = None
-
-        has_conflicting_requirement = (
-            parent_req_name is None and
-            existing_req and
-            not existing_req.constraint and
-            existing_req.extras == install_req.extras and
-            existing_req.req.specifier != install_req.req.specifier
-        )
-        if has_conflicting_requirement:
-            raise InstallationError(
-                "Double requirement given: %s (already in %s, name=%r)"
-                % (install_req, existing_req, install_req.name)
-            )
-
-        # When no existing requirement exists, add the requirement as a
-        # dependency and it will be scanned again after.
-        if not existing_req:
-            self.add_named_requirement(install_req)
-            # We'd want to rescan this requirement later
-            return [install_req], install_req
-
-        # Assume there's no need to scan, and that we've already
-        # encountered this for scanning.
-        if install_req.constraint or not existing_req.constraint:
-            return [], existing_req
-
-        does_not_satisfy_constraint = (
-            install_req.link and
-            not (
-                existing_req.link and
-                install_req.link.path == existing_req.link.path
-            )
-        )
-        if does_not_satisfy_constraint:
-            self.reqs_to_cleanup.append(install_req)
-            raise InstallationError(
-                "Could not satisfy constraints for '%s': "
-                "installation from path or url cannot be "
-                "constrained to a version" % install_req.name,
-            )
-        # If we're now installing a constraint, mark the existing
-        # object for real installation.
-        existing_req.constraint = False
-        existing_req.extras = tuple(sorted(
-            set(existing_req.extras) | set(install_req.extras)
-        ))
-        logger.debug(
-            "Setting %s extras to: %s",
-            existing_req, existing_req.extras,
-        )
-        # Return the existing requirement for addition to the parent and
-        # scanning again.
-        return [existing_req], existing_req
-
-    def has_requirement(self, name):
-        # type: (str) -> bool
-        project_name = canonicalize_name(name)
-
-        return (
-            project_name in self.requirements and
-            not self.requirements[project_name].constraint
-        )
-
-    def get_requirement(self, name):
-        # type: (str) -> InstallRequirement
-        project_name = canonicalize_name(name)
-
-        if project_name in self.requirements:
-            return self.requirements[project_name]
-
-        raise KeyError("No project with the name %r" % name)
-
-    def cleanup_files(self):
-        # type: () -> None
-        """Clean up files, remove builds."""
-        logger.debug('Cleaning up...')
-        with indent_log():
-            for req in self.reqs_to_cleanup:
-                req.remove_temporary_source()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/req_tracker.py b/venv/lib/python3.8/site-packages/pip/_internal/req/req_tracker.py
deleted file mode 100644
index 84e0c0419fc7064b05b2de7507a38aeba3c2dfad..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/req/req_tracker.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import contextlib
-import errno
-import hashlib
-import logging
-import os
-
-from pip._vendor import contextlib2
-
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from types import TracebackType
-    from typing import Dict, Iterator, Optional, Set, Type, Union
-    from pip._internal.req.req_install import InstallRequirement
-    from pip._internal.models.link import Link
-
-logger = logging.getLogger(__name__)
-
-
-@contextlib.contextmanager
-def update_env_context_manager(**changes):
-    # type: (str) -> Iterator[None]
-    target = os.environ
-
-    # Save values from the target and change them.
-    non_existent_marker = object()
-    saved_values = {}  # type: Dict[str, Union[object, str]]
-    for name, new_value in changes.items():
-        try:
-            saved_values[name] = target[name]
-        except KeyError:
-            saved_values[name] = non_existent_marker
-        target[name] = new_value
-
-    try:
-        yield
-    finally:
-        # Restore original values in the target.
-        for name, original_value in saved_values.items():
-            if original_value is non_existent_marker:
-                del target[name]
-            else:
-                assert isinstance(original_value, str)  # for mypy
-                target[name] = original_value
-
-
-@contextlib.contextmanager
-def get_requirement_tracker():
-    # type: () -> Iterator[RequirementTracker]
-    root = os.environ.get('PIP_REQ_TRACKER')
-    with contextlib2.ExitStack() as ctx:
-        if root is None:
-            root = ctx.enter_context(
-                TempDirectory(kind='req-tracker')
-            ).path
-            ctx.enter_context(update_env_context_manager(PIP_REQ_TRACKER=root))
-            logger.debug("Initialized build tracking at %s", root)
-
-        with RequirementTracker(root) as tracker:
-            yield tracker
-
-
-class RequirementTracker(object):
-
-    def __init__(self, root):
-        # type: (str) -> None
-        self._root = root
-        self._entries = set()  # type: Set[InstallRequirement]
-        logger.debug("Created build tracker: %s", self._root)
-
-    def __enter__(self):
-        # type: () -> RequirementTracker
-        logger.debug("Entered build tracker: %s", self._root)
-        return self
-
-    def __exit__(
-        self,
-        exc_type,  # type: Optional[Type[BaseException]]
-        exc_val,  # type: Optional[BaseException]
-        exc_tb  # type: Optional[TracebackType]
-    ):
-        # type: (...) -> None
-        self.cleanup()
-
-    def _entry_path(self, link):
-        # type: (Link) -> str
-        hashed = hashlib.sha224(link.url_without_fragment.encode()).hexdigest()
-        return os.path.join(self._root, hashed)
-
-    def add(self, req):
-        # type: (InstallRequirement) -> None
-        """Add an InstallRequirement to build tracking.
-        """
-
-        # Get the file to write information about this requirement.
-        entry_path = self._entry_path(req.link)
-
-        # Try reading from the file. If it exists and can be read from, a build
-        # is already in progress, so a LookupError is raised.
-        try:
-            with open(entry_path) as fp:
-                contents = fp.read()
-        except IOError as e:
-            # if the error is anything other than "file does not exist", raise.
-            if e.errno != errno.ENOENT:
-                raise
-        else:
-            message = '%s is already being built: %s' % (req.link, contents)
-            raise LookupError(message)
-
-        # If we're here, req should really not be building already.
-        assert req not in self._entries
-
-        # Start tracking this requirement.
-        with open(entry_path, 'w') as fp:
-            fp.write(str(req))
-        self._entries.add(req)
-
-        logger.debug('Added %s to build tracker %r', req, self._root)
-
-    def remove(self, req):
-        # type: (InstallRequirement) -> None
-        """Remove an InstallRequirement from build tracking.
-        """
-
-        # Delete the created file and the corresponding entries.
-        os.unlink(self._entry_path(req.link))
-        self._entries.remove(req)
-
-        logger.debug('Removed %s from build tracker %r', req, self._root)
-
-    def cleanup(self):
-        # type: () -> None
-        for req in set(self._entries):
-            self.remove(req)
-
-        logger.debug("Removed build tracker: %r", self._root)
-
-    @contextlib.contextmanager
-    def track(self, req):
-        # type: (InstallRequirement) -> Iterator[None]
-        self.add(req)
-        yield
-        self.remove(req)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py b/venv/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py
deleted file mode 100644
index 5971b130ec029478d59ea1761630605deb4a8b39..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py
+++ /dev/null
@@ -1,644 +0,0 @@
-from __future__ import absolute_import
-
-import csv
-import functools
-import logging
-import os
-import sys
-import sysconfig
-
-from pip._vendor import pkg_resources
-
-from pip._internal.exceptions import UninstallationError
-from pip._internal.locations import bin_py, bin_user
-from pip._internal.utils.compat import WINDOWS, cache_from_source, uses_pycache
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import (
-    FakeFile,
-    ask,
-    dist_in_usersite,
-    dist_is_local,
-    egg_link_path,
-    is_local,
-    normalize_path,
-    renames,
-    rmtree,
-)
-from pip._internal.utils.temp_dir import AdjacentTempDirectory, TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple,
-    )
-    from pip._vendor.pkg_resources import Distribution
-
-logger = logging.getLogger(__name__)
-
-
-def _script_names(dist, script_name, is_gui):
-    # type: (Distribution, str, bool) -> List[str]
-    """Create the fully qualified name of the files created by
-    {console,gui}_scripts for the given ``dist``.
-    Returns the list of file names
-    """
-    if dist_in_usersite(dist):
-        bin_dir = bin_user
-    else:
-        bin_dir = bin_py
-    exe_name = os.path.join(bin_dir, script_name)
-    paths_to_remove = [exe_name]
-    if WINDOWS:
-        paths_to_remove.append(exe_name + '.exe')
-        paths_to_remove.append(exe_name + '.exe.manifest')
-        if is_gui:
-            paths_to_remove.append(exe_name + '-script.pyw')
-        else:
-            paths_to_remove.append(exe_name + '-script.py')
-    return paths_to_remove
-
-
-def _unique(fn):
-    # type: (Callable[..., Iterator[Any]]) -> Callable[..., Iterator[Any]]
-    @functools.wraps(fn)
-    def unique(*args, **kw):
-        # type: (Any, Any) -> Iterator[Any]
-        seen = set()  # type: Set[Any]
-        for item in fn(*args, **kw):
-            if item not in seen:
-                seen.add(item)
-                yield item
-    return unique
-
-
-@_unique
-def uninstallation_paths(dist):
-    # type: (Distribution) -> Iterator[str]
-    """
-    Yield all the uninstallation paths for dist based on RECORD-without-.py[co]
-
-    Yield paths to all the files in RECORD. For each .py file in RECORD, add
-    the .pyc and .pyo in the same directory.
-
-    UninstallPathSet.add() takes care of the __pycache__ .py[co].
-    """
-    r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
-    for row in r:
-        path = os.path.join(dist.location, row[0])
-        yield path
-        if path.endswith('.py'):
-            dn, fn = os.path.split(path)
-            base = fn[:-3]
-            path = os.path.join(dn, base + '.pyc')
-            yield path
-            path = os.path.join(dn, base + '.pyo')
-            yield path
-
-
-def compact(paths):
-    # type: (Iterable[str]) -> Set[str]
-    """Compact a path set to contain the minimal number of paths
-    necessary to contain all paths in the set. If /a/path/ and
-    /a/path/to/a/file.txt are both in the set, leave only the
-    shorter path."""
-
-    sep = os.path.sep
-    short_paths = set()  # type: Set[str]
-    for path in sorted(paths, key=len):
-        should_skip = any(
-            path.startswith(shortpath.rstrip("*")) and
-            path[len(shortpath.rstrip("*").rstrip(sep))] == sep
-            for shortpath in short_paths
-        )
-        if not should_skip:
-            short_paths.add(path)
-    return short_paths
-
-
-def compress_for_rename(paths):
-    # type: (Iterable[str]) -> Set[str]
-    """Returns a set containing the paths that need to be renamed.
-
-    This set may include directories when the original sequence of paths
-    included every file on disk.
-    """
-    case_map = dict((os.path.normcase(p), p) for p in paths)
-    remaining = set(case_map)
-    unchecked = sorted(set(os.path.split(p)[0]
-                           for p in case_map.values()), key=len)
-    wildcards = set()  # type: Set[str]
-
-    def norm_join(*a):
-        # type: (str) -> str
-        return os.path.normcase(os.path.join(*a))
-
-    for root in unchecked:
-        if any(os.path.normcase(root).startswith(w)
-               for w in wildcards):
-            # This directory has already been handled.
-            continue
-
-        all_files = set()  # type: Set[str]
-        all_subdirs = set()  # type: Set[str]
-        for dirname, subdirs, files in os.walk(root):
-            all_subdirs.update(norm_join(root, dirname, d)
-                               for d in subdirs)
-            all_files.update(norm_join(root, dirname, f)
-                             for f in files)
-        # If all the files we found are in our remaining set of files to
-        # remove, then remove them from the latter set and add a wildcard
-        # for the directory.
-        if not (all_files - remaining):
-            remaining.difference_update(all_files)
-            wildcards.add(root + os.sep)
-
-    return set(map(case_map.__getitem__, remaining)) | wildcards
-
-
-def compress_for_output_listing(paths):
-    # type: (Iterable[str]) -> Tuple[Set[str], Set[str]]
-    """Returns a tuple of 2 sets of which paths to display to user
-
-    The first set contains paths that would be deleted. Files of a package
-    are not added and the top-level directory of the package has a '*' added
-    at the end - to signify that all it's contents are removed.
-
-    The second set contains files that would have been skipped in the above
-    folders.
-    """
-
-    will_remove = set(paths)
-    will_skip = set()
-
-    # Determine folders and files
-    folders = set()
-    files = set()
-    for path in will_remove:
-        if path.endswith(".pyc"):
-            continue
-        if path.endswith("__init__.py") or ".dist-info" in path:
-            folders.add(os.path.dirname(path))
-        files.add(path)
-
-    # probably this one https://github.com/python/mypy/issues/390
-    _normcased_files = set(map(os.path.normcase, files))  # type: ignore
-
-    folders = compact(folders)
-
-    # This walks the tree using os.walk to not miss extra folders
-    # that might get added.
-    for folder in folders:
-        for dirpath, _, dirfiles in os.walk(folder):
-            for fname in dirfiles:
-                if fname.endswith(".pyc"):
-                    continue
-
-                file_ = os.path.join(dirpath, fname)
-                if (os.path.isfile(file_) and
-                        os.path.normcase(file_) not in _normcased_files):
-                    # We are skipping this file. Add it to the set.
-                    will_skip.add(file_)
-
-    will_remove = files | {
-        os.path.join(folder, "*") for folder in folders
-    }
-
-    return will_remove, will_skip
-
-
-class StashedUninstallPathSet(object):
-    """A set of file rename operations to stash files while
-    tentatively uninstalling them."""
-    def __init__(self):
-        # type: () -> None
-        # Mapping from source file root to [Adjacent]TempDirectory
-        # for files under that directory.
-        self._save_dirs = {}  # type: Dict[str, TempDirectory]
-        # (old path, new path) tuples for each move that may need
-        # to be undone.
-        self._moves = []  # type: List[Tuple[str, str]]
-
-    def _get_directory_stash(self, path):
-        # type: (str) -> str
-        """Stashes a directory.
-
-        Directories are stashed adjacent to their original location if
-        possible, or else moved/copied into the user's temp dir."""
-
-        try:
-            save_dir = AdjacentTempDirectory(path)  # type: TempDirectory
-        except OSError:
-            save_dir = TempDirectory(kind="uninstall")
-        self._save_dirs[os.path.normcase(path)] = save_dir
-
-        return save_dir.path
-
-    def _get_file_stash(self, path):
-        # type: (str) -> str
-        """Stashes a file.
-
-        If no root has been provided, one will be created for the directory
-        in the user's temp directory."""
-        path = os.path.normcase(path)
-        head, old_head = os.path.dirname(path), None
-        save_dir = None
-
-        while head != old_head:
-            try:
-                save_dir = self._save_dirs[head]
-                break
-            except KeyError:
-                pass
-            head, old_head = os.path.dirname(head), head
-        else:
-            # Did not find any suitable root
-            head = os.path.dirname(path)
-            save_dir = TempDirectory(kind='uninstall')
-            self._save_dirs[head] = save_dir
-
-        relpath = os.path.relpath(path, head)
-        if relpath and relpath != os.path.curdir:
-            return os.path.join(save_dir.path, relpath)
-        return save_dir.path
-
-    def stash(self, path):
-        # type: (str) -> str
-        """Stashes the directory or file and returns its new location.
-        Handle symlinks as files to avoid modifying the symlink targets.
-        """
-        path_is_dir = os.path.isdir(path) and not os.path.islink(path)
-        if path_is_dir:
-            new_path = self._get_directory_stash(path)
-        else:
-            new_path = self._get_file_stash(path)
-
-        self._moves.append((path, new_path))
-        if (path_is_dir and os.path.isdir(new_path)):
-            # If we're moving a directory, we need to
-            # remove the destination first or else it will be
-            # moved to inside the existing directory.
-            # We just created new_path ourselves, so it will
-            # be removable.
-            os.rmdir(new_path)
-        renames(path, new_path)
-        return new_path
-
-    def commit(self):
-        # type: () -> None
-        """Commits the uninstall by removing stashed files."""
-        for _, save_dir in self._save_dirs.items():
-            save_dir.cleanup()
-        self._moves = []
-        self._save_dirs = {}
-
-    def rollback(self):
-        # type: () -> None
-        """Undoes the uninstall by moving stashed files back."""
-        for p in self._moves:
-            logger.info("Moving to %s\n from %s", *p)
-
-        for new_path, path in self._moves:
-            try:
-                logger.debug('Replacing %s from %s', new_path, path)
-                if os.path.isfile(new_path) or os.path.islink(new_path):
-                    os.unlink(new_path)
-                elif os.path.isdir(new_path):
-                    rmtree(new_path)
-                renames(path, new_path)
-            except OSError as ex:
-                logger.error("Failed to restore %s", new_path)
-                logger.debug("Exception: %s", ex)
-
-        self.commit()
-
-    @property
-    def can_rollback(self):
-        # type: () -> bool
-        return bool(self._moves)
-
-
-class UninstallPathSet(object):
-    """A set of file paths to be removed in the uninstallation of a
-    requirement."""
-    def __init__(self, dist):
-        # type: (Distribution) -> None
-        self.paths = set()  # type: Set[str]
-        self._refuse = set()  # type: Set[str]
-        self.pth = {}  # type: Dict[str, UninstallPthEntries]
-        self.dist = dist
-        self._moved_paths = StashedUninstallPathSet()
-
-    def _permitted(self, path):
-        # type: (str) -> bool
-        """
-        Return True if the given path is one we are permitted to
-        remove/modify, False otherwise.
-
-        """
-        return is_local(path)
-
-    def add(self, path):
-        # type: (str) -> None
-        head, tail = os.path.split(path)
-
-        # we normalize the head to resolve parent directory symlinks, but not
-        # the tail, since we only want to uninstall symlinks, not their targets
-        path = os.path.join(normalize_path(head), os.path.normcase(tail))
-
-        if not os.path.exists(path):
-            return
-        if self._permitted(path):
-            self.paths.add(path)
-        else:
-            self._refuse.add(path)
-
-        # __pycache__ files can show up after 'installed-files.txt' is created,
-        # due to imports
-        if os.path.splitext(path)[1] == '.py' and uses_pycache:
-            self.add(cache_from_source(path))
-
-    def add_pth(self, pth_file, entry):
-        # type: (str, str) -> None
-        pth_file = normalize_path(pth_file)
-        if self._permitted(pth_file):
-            if pth_file not in self.pth:
-                self.pth[pth_file] = UninstallPthEntries(pth_file)
-            self.pth[pth_file].add(entry)
-        else:
-            self._refuse.add(pth_file)
-
-    def remove(self, auto_confirm=False, verbose=False):
-        # type: (bool, bool) -> None
-        """Remove paths in ``self.paths`` with confirmation (unless
-        ``auto_confirm`` is True)."""
-
-        if not self.paths:
-            logger.info(
-                "Can't uninstall '%s'. No files were found to uninstall.",
-                self.dist.project_name,
-            )
-            return
-
-        dist_name_version = (
-            self.dist.project_name + "-" + self.dist.version
-        )
-        logger.info('Uninstalling %s:', dist_name_version)
-
-        with indent_log():
-            if auto_confirm or self._allowed_to_proceed(verbose):
-                moved = self._moved_paths
-
-                for_rename = compress_for_rename(self.paths)
-
-                for path in sorted(compact(for_rename)):
-                    moved.stash(path)
-                    logger.debug('Removing file or directory %s', path)
-
-                for pth in self.pth.values():
-                    pth.remove()
-
-                logger.info('Successfully uninstalled %s', dist_name_version)
-
-    def _allowed_to_proceed(self, verbose):
-        # type: (bool) -> bool
-        """Display which files would be deleted and prompt for confirmation
-        """
-
-        def _display(msg, paths):
-            # type: (str, Iterable[str]) -> None
-            if not paths:
-                return
-
-            logger.info(msg)
-            with indent_log():
-                for path in sorted(compact(paths)):
-                    logger.info(path)
-
-        if not verbose:
-            will_remove, will_skip = compress_for_output_listing(self.paths)
-        else:
-            # In verbose mode, display all the files that are going to be
-            # deleted.
-            will_remove = set(self.paths)
-            will_skip = set()
-
-        _display('Would remove:', will_remove)
-        _display('Would not remove (might be manually added):', will_skip)
-        _display('Would not remove (outside of prefix):', self._refuse)
-        if verbose:
-            _display('Will actually move:', compress_for_rename(self.paths))
-
-        return ask('Proceed (y/n)? ', ('y', 'n')) == 'y'
-
-    def rollback(self):
-        # type: () -> None
-        """Rollback the changes previously made by remove()."""
-        if not self._moved_paths.can_rollback:
-            logger.error(
-                "Can't roll back %s; was not uninstalled",
-                self.dist.project_name,
-            )
-            return
-        logger.info('Rolling back uninstall of %s', self.dist.project_name)
-        self._moved_paths.rollback()
-        for pth in self.pth.values():
-            pth.rollback()
-
-    def commit(self):
-        # type: () -> None
-        """Remove temporary save dir: rollback will no longer be possible."""
-        self._moved_paths.commit()
-
-    @classmethod
-    def from_dist(cls, dist):
-        # type: (Distribution) -> UninstallPathSet
-        dist_path = normalize_path(dist.location)
-        if not dist_is_local(dist):
-            logger.info(
-                "Not uninstalling %s at %s, outside environment %s",
-                dist.key,
-                dist_path,
-                sys.prefix,
-            )
-            return cls(dist)
-
-        if dist_path in {p for p in {sysconfig.get_path("stdlib"),
-                                     sysconfig.get_path("platstdlib")}
-                         if p}:
-            logger.info(
-                "Not uninstalling %s at %s, as it is in the standard library.",
-                dist.key,
-                dist_path,
-            )
-            return cls(dist)
-
-        paths_to_remove = cls(dist)
-        develop_egg_link = egg_link_path(dist)
-        develop_egg_link_egg_info = '{}.egg-info'.format(
-            pkg_resources.to_filename(dist.project_name))
-        egg_info_exists = dist.egg_info and os.path.exists(dist.egg_info)
-        # Special case for distutils installed package
-        distutils_egg_info = getattr(dist._provider, 'path', None)
-
-        # Uninstall cases order do matter as in the case of 2 installs of the
-        # same package, pip needs to uninstall the currently detected version
-        if (egg_info_exists and dist.egg_info.endswith('.egg-info') and
-                not dist.egg_info.endswith(develop_egg_link_egg_info)):
-            # if dist.egg_info.endswith(develop_egg_link_egg_info), we
-            # are in fact in the develop_egg_link case
-            paths_to_remove.add(dist.egg_info)
-            if dist.has_metadata('installed-files.txt'):
-                for installed_file in dist.get_metadata(
-                        'installed-files.txt').splitlines():
-                    path = os.path.normpath(
-                        os.path.join(dist.egg_info, installed_file)
-                    )
-                    paths_to_remove.add(path)
-            # FIXME: need a test for this elif block
-            # occurs with --single-version-externally-managed/--record outside
-            # of pip
-            elif dist.has_metadata('top_level.txt'):
-                if dist.has_metadata('namespace_packages.txt'):
-                    namespaces = dist.get_metadata('namespace_packages.txt')
-                else:
-                    namespaces = []
-                for top_level_pkg in [
-                        p for p
-                        in dist.get_metadata('top_level.txt').splitlines()
-                        if p and p not in namespaces]:
-                    path = os.path.join(dist.location, top_level_pkg)
-                    paths_to_remove.add(path)
-                    paths_to_remove.add(path + '.py')
-                    paths_to_remove.add(path + '.pyc')
-                    paths_to_remove.add(path + '.pyo')
-
-        elif distutils_egg_info:
-            raise UninstallationError(
-                "Cannot uninstall {!r}. It is a distutils installed project "
-                "and thus we cannot accurately determine which files belong "
-                "to it which would lead to only a partial uninstall.".format(
-                    dist.project_name,
-                )
-            )
-
-        elif dist.location.endswith('.egg'):
-            # package installed by easy_install
-            # We cannot match on dist.egg_name because it can slightly vary
-            # i.e. setuptools-0.6c11-py2.6.egg vs setuptools-0.6rc11-py2.6.egg
-            paths_to_remove.add(dist.location)
-            easy_install_egg = os.path.split(dist.location)[1]
-            easy_install_pth = os.path.join(os.path.dirname(dist.location),
-                                            'easy-install.pth')
-            paths_to_remove.add_pth(easy_install_pth, './' + easy_install_egg)
-
-        elif egg_info_exists and dist.egg_info.endswith('.dist-info'):
-            for path in uninstallation_paths(dist):
-                paths_to_remove.add(path)
-
-        elif develop_egg_link:
-            # develop egg
-            with open(develop_egg_link, 'r') as fh:
-                link_pointer = os.path.normcase(fh.readline().strip())
-            assert (link_pointer == dist.location), (
-                'Egg-link %s does not match installed location of %s '
-                '(at %s)' % (link_pointer, dist.project_name, dist.location)
-            )
-            paths_to_remove.add(develop_egg_link)
-            easy_install_pth = os.path.join(os.path.dirname(develop_egg_link),
-                                            'easy-install.pth')
-            paths_to_remove.add_pth(easy_install_pth, dist.location)
-
-        else:
-            logger.debug(
-                'Not sure how to uninstall: %s - Check: %s',
-                dist, dist.location,
-            )
-
-        # find distutils scripts= scripts
-        if dist.has_metadata('scripts') and dist.metadata_isdir('scripts'):
-            for script in dist.metadata_listdir('scripts'):
-                if dist_in_usersite(dist):
-                    bin_dir = bin_user
-                else:
-                    bin_dir = bin_py
-                paths_to_remove.add(os.path.join(bin_dir, script))
-                if WINDOWS:
-                    paths_to_remove.add(os.path.join(bin_dir, script) + '.bat')
-
-        # find console_scripts
-        _scripts_to_remove = []
-        console_scripts = dist.get_entry_map(group='console_scripts')
-        for name in console_scripts.keys():
-            _scripts_to_remove.extend(_script_names(dist, name, False))
-        # find gui_scripts
-        gui_scripts = dist.get_entry_map(group='gui_scripts')
-        for name in gui_scripts.keys():
-            _scripts_to_remove.extend(_script_names(dist, name, True))
-
-        for s in _scripts_to_remove:
-            paths_to_remove.add(s)
-
-        return paths_to_remove
-
-
-class UninstallPthEntries(object):
-    def __init__(self, pth_file):
-        # type: (str) -> None
-        if not os.path.isfile(pth_file):
-            raise UninstallationError(
-                "Cannot remove entries from nonexistent file %s" % pth_file
-            )
-        self.file = pth_file
-        self.entries = set()  # type: Set[str]
-        self._saved_lines = None  # type: Optional[List[bytes]]
-
-    def add(self, entry):
-        # type: (str) -> None
-        entry = os.path.normcase(entry)
-        # On Windows, os.path.normcase converts the entry to use
-        # backslashes.  This is correct for entries that describe absolute
-        # paths outside of site-packages, but all the others use forward
-        # slashes.
-        # os.path.splitdrive is used instead of os.path.isabs because isabs
-        # treats non-absolute paths with drive letter markings like c:foo\bar
-        # as absolute paths. It also does not recognize UNC paths if they don't
-        # have more than "\\sever\share". Valid examples: "\\server\share\" or
-        # "\\server\share\folder". Python 2.7.8+ support UNC in splitdrive.
-        if WINDOWS and not os.path.splitdrive(entry)[0]:
-            entry = entry.replace('\\', '/')
-        self.entries.add(entry)
-
-    def remove(self):
-        # type: () -> None
-        logger.debug('Removing pth entries from %s:', self.file)
-        with open(self.file, 'rb') as fh:
-            # windows uses '\r\n' with py3k, but uses '\n' with py2.x
-            lines = fh.readlines()
-            self._saved_lines = lines
-        if any(b'\r\n' in line for line in lines):
-            endline = '\r\n'
-        else:
-            endline = '\n'
-        # handle missing trailing newline
-        if lines and not lines[-1].endswith(endline.encode("utf-8")):
-            lines[-1] = lines[-1] + endline.encode("utf-8")
-        for entry in self.entries:
-            try:
-                logger.debug('Removing entry: %s', entry)
-                lines.remove((entry + endline).encode("utf-8"))
-            except ValueError:
-                pass
-        with open(self.file, 'wb') as fh:
-            fh.writelines(lines)
-
-    def rollback(self):
-        # type: () -> bool
-        if self._saved_lines is None:
-            logger.error(
-                'Cannot roll back changes to %s, none were made', self.file
-            )
-            return False
-        logger.debug('Rolling %s back to previous state', self.file)
-        with open(self.file, 'wb') as fh:
-            fh.writelines(self._saved_lines)
-        return True
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/self_outdated_check.py b/venv/lib/python3.8/site-packages/pip/_internal/self_outdated_check.py
deleted file mode 100644
index 8fc3c594acf96eb8dee7e69c9d835e16cd45cec3..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/self_outdated_check.py
+++ /dev/null
@@ -1,242 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import datetime
-import hashlib
-import json
-import logging
-import os.path
-import sys
-
-from pip._vendor import pkg_resources
-from pip._vendor.packaging import version as packaging_version
-from pip._vendor.six import ensure_binary
-
-from pip._internal.index.collector import LinkCollector
-from pip._internal.index.package_finder import PackageFinder
-from pip._internal.models.search_scope import SearchScope
-from pip._internal.models.selection_prefs import SelectionPreferences
-from pip._internal.utils.filesystem import (
-    adjacent_tmp_file,
-    check_path_owner,
-    replace,
-)
-from pip._internal.utils.misc import (
-    ensure_dir,
-    get_installed_version,
-    redact_auth_from_url,
-)
-from pip._internal.utils.packaging import get_installer
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    import optparse
-    from optparse import Values
-    from typing import Any, Dict, Text, Union
-
-    from pip._internal.network.session import PipSession
-
-
-SELFCHECK_DATE_FMT = "%Y-%m-%dT%H:%M:%SZ"
-
-
-logger = logging.getLogger(__name__)
-
-
-def make_link_collector(
-    session,  # type: PipSession
-    options,  # type: Values
-    suppress_no_index=False,  # type: bool
-):
-    # type: (...) -> LinkCollector
-    """
-    :param session: The Session to use to make requests.
-    :param suppress_no_index: Whether to ignore the --no-index option
-        when constructing the SearchScope object.
-    """
-    index_urls = [options.index_url] + options.extra_index_urls
-    if options.no_index and not suppress_no_index:
-        logger.debug(
-            'Ignoring indexes: %s',
-            ','.join(redact_auth_from_url(url) for url in index_urls),
-        )
-        index_urls = []
-
-    # Make sure find_links is a list before passing to create().
-    find_links = options.find_links or []
-
-    search_scope = SearchScope.create(
-        find_links=find_links, index_urls=index_urls,
-    )
-
-    link_collector = LinkCollector(session=session, search_scope=search_scope)
-
-    return link_collector
-
-
-def _get_statefile_name(key):
-    # type: (Union[str, Text]) -> str
-    key_bytes = ensure_binary(key)
-    name = hashlib.sha224(key_bytes).hexdigest()
-    return name
-
-
-class SelfCheckState(object):
-    def __init__(self, cache_dir):
-        # type: (str) -> None
-        self.state = {}  # type: Dict[str, Any]
-        self.statefile_path = None
-
-        # Try to load the existing state
-        if cache_dir:
-            self.statefile_path = os.path.join(
-                cache_dir, "selfcheck", _get_statefile_name(self.key)
-            )
-            try:
-                with open(self.statefile_path) as statefile:
-                    self.state = json.load(statefile)
-            except (IOError, ValueError, KeyError):
-                # Explicitly suppressing exceptions, since we don't want to
-                # error out if the cache file is invalid.
-                pass
-
-    @property
-    def key(self):
-        return sys.prefix
-
-    def save(self, pypi_version, current_time):
-        # type: (str, datetime.datetime) -> None
-        # If we do not have a path to cache in, don't bother saving.
-        if not self.statefile_path:
-            return
-
-        # Check to make sure that we own the directory
-        if not check_path_owner(os.path.dirname(self.statefile_path)):
-            return
-
-        # Now that we've ensured the directory is owned by this user, we'll go
-        # ahead and make sure that all our directories are created.
-        ensure_dir(os.path.dirname(self.statefile_path))
-
-        state = {
-            # Include the key so it's easy to tell which pip wrote the
-            # file.
-            "key": self.key,
-            "last_check": current_time.strftime(SELFCHECK_DATE_FMT),
-            "pypi_version": pypi_version,
-        }
-
-        text = json.dumps(state, sort_keys=True, separators=(",", ":"))
-
-        with adjacent_tmp_file(self.statefile_path) as f:
-            f.write(ensure_binary(text))
-
-        try:
-            # Since we have a prefix-specific state file, we can just
-            # overwrite whatever is there, no need to check.
-            replace(f.name, self.statefile_path)
-        except OSError:
-            # Best effort.
-            pass
-
-
-def was_installed_by_pip(pkg):
-    # type: (str) -> bool
-    """Checks whether pkg was installed by pip
-
-    This is used not to display the upgrade message when pip is in fact
-    installed by system package manager, such as dnf on Fedora.
-    """
-    try:
-        dist = pkg_resources.get_distribution(pkg)
-        return "pip" == get_installer(dist)
-    except pkg_resources.DistributionNotFound:
-        return False
-
-
-def pip_self_version_check(session, options):
-    # type: (PipSession, optparse.Values) -> None
-    """Check for an update for pip.
-
-    Limit the frequency of checks to once per week. State is stored either in
-    the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix
-    of the pip script path.
-    """
-    installed_version = get_installed_version("pip")
-    if not installed_version:
-        return
-
-    pip_version = packaging_version.parse(installed_version)
-    pypi_version = None
-
-    try:
-        state = SelfCheckState(cache_dir=options.cache_dir)
-
-        current_time = datetime.datetime.utcnow()
-        # Determine if we need to refresh the state
-        if "last_check" in state.state and "pypi_version" in state.state:
-            last_check = datetime.datetime.strptime(
-                state.state["last_check"],
-                SELFCHECK_DATE_FMT
-            )
-            if (current_time - last_check).total_seconds() < 7 * 24 * 60 * 60:
-                pypi_version = state.state["pypi_version"]
-
-        # Refresh the version if we need to or just see if we need to warn
-        if pypi_version is None:
-            # Lets use PackageFinder to see what the latest pip version is
-            link_collector = make_link_collector(
-                session,
-                options=options,
-                suppress_no_index=True,
-            )
-
-            # Pass allow_yanked=False so we don't suggest upgrading to a
-            # yanked version.
-            selection_prefs = SelectionPreferences(
-                allow_yanked=False,
-                allow_all_prereleases=False,  # Explicitly set to False
-            )
-
-            finder = PackageFinder.create(
-                link_collector=link_collector,
-                selection_prefs=selection_prefs,
-            )
-            best_candidate = finder.find_best_candidate("pip").best_candidate
-            if best_candidate is None:
-                return
-            pypi_version = str(best_candidate.version)
-
-            # save that we've performed a check
-            state.save(pypi_version, current_time)
-
-        remote_version = packaging_version.parse(pypi_version)
-
-        local_version_is_older = (
-            pip_version < remote_version and
-            pip_version.base_version != remote_version.base_version and
-            was_installed_by_pip('pip')
-        )
-
-        # Determine if our pypi_version is older
-        if not local_version_is_older:
-            return
-
-        # We cannot tell how the current pip is available in the current
-        # command context, so be pragmatic here and suggest the command
-        # that's always available. This does not accommodate spaces in
-        # `sys.executable`.
-        pip_cmd = "{} -m pip".format(sys.executable)
-        logger.warning(
-            "You are using pip version %s; however, version %s is "
-            "available.\nYou should consider upgrading via the "
-            "'%s install --upgrade pip' command.",
-            pip_version, pypi_version, pip_cmd
-        )
-    except Exception:
-        logger.debug(
-            "There was an error checking the latest version of pip",
-            exc_info=True,
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/__init__.py
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 39461b2f31ff4d0296dd0e96d05f3024a62a66ae..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-38.pyc
deleted file mode 100644
index 6dfb6f8a3d9f71cbaace52e7713b06f7220943f2..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/compat.cpython-38.pyc
deleted file mode 100644
index 05b04a732d70f32c84d0252b784c19ef04d8fbb8..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/compat.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-38.pyc
deleted file mode 100644
index 93e4690209c17bae650f1a2dc9c036bbbc5626cf..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-38.pyc
deleted file mode 100644
index 50e0655e8b032d09a860e1e2dbca785b54bbae5c..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-38.pyc
deleted file mode 100644
index 7a01c391a4a775c82d34cb650f8c048125959c6f..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-38.pyc
deleted file mode 100644
index 63ff87cf9ac73046084e23a4d0f782bb50f07f7b..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-38.pyc
deleted file mode 100644
index 7f7d413b09b55d84596fdaed51e67afd18bf2e53..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-38.pyc
deleted file mode 100644
index 5b2ef43e30c281516b80e42d3091e715653ab4db..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-38.pyc
deleted file mode 100644
index 66275aa344f7ab9f95ca28552ae9099aeb8d3b3f..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-38.pyc
deleted file mode 100644
index e1fad3e214d6848d1db0d9569ef1d8266e4fd237..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-38.pyc
deleted file mode 100644
index 2277ce19b49c0eaedc77b07850e6c25f608a81f2..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/logging.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/logging.cpython-38.pyc
deleted file mode 100644
index 2ee2600f61bab49e3bed82c08c02c94166d32f05..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/logging.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/marker_files.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/marker_files.cpython-38.pyc
deleted file mode 100644
index 75a480a05eef6ba0c7d5c0f5e6f0dd2edeb1c0a1..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/marker_files.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/misc.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/misc.cpython-38.pyc
deleted file mode 100644
index 855d9f25e52293cf18f94e1acd43d97ff4ac65e7..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/misc.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/models.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/models.cpython-38.pyc
deleted file mode 100644
index bdf11250e40259a7291201d1065d5711901b05b2..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/models.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-38.pyc
deleted file mode 100644
index 23de4bc7c91c7d07311cdaf8f15a4d32462248e8..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-38.pyc
deleted file mode 100644
index 9ceec486b71a7def8321ed679b30523a7b8d869e..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-38.pyc
deleted file mode 100644
index 83b317f0fe1dce0dd5bad00c2feb2fb8675c0f0a..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-38.pyc
deleted file mode 100644
index ef12e7085f5256cc4b0b7db6e514a9d6bedd4eb3..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-38.pyc
deleted file mode 100644
index e70423209b77fb46f9f0cfb4e5e6a3cdbf1ecc2d..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/typing.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/typing.cpython-38.pyc
deleted file mode 100644
index 9482882a7043bfec1d36f5f727b8877bf9721158..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/typing.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/ui.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/ui.cpython-38.pyc
deleted file mode 100644
index bcc302f961147594dbdfca1d4f0dd493da0b07cf..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/ui.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-38.pyc
deleted file mode 100644
index 494abe86e3074b3123637cfc2af60f5e5d49688d..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/urls.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/urls.cpython-38.pyc
deleted file mode 100644
index f254e57ffb8604bacdf3772181357a3b9a24cc38..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/urls.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-38.pyc
deleted file mode 100644
index e67f5640786f2713a38c290b5065dc529c0ec1f2..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-38.pyc
deleted file mode 100644
index 1f68e6bf838bc6f40e6c1a300fcb5abb0bc2eb86..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/appdirs.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/appdirs.py
deleted file mode 100644
index 93d17b5a81bdeb3077ba18834a47a37c8d7f4841..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/appdirs.py
+++ /dev/null
@@ -1,44 +0,0 @@
-"""
-This code wraps the vendored appdirs module to so the return values are
-compatible for the current pip code base.
-
-The intention is to rewrite current usages gradually, keeping the tests pass,
-and eventually drop this after all usages are changed.
-"""
-
-from __future__ import absolute_import
-
-import os
-
-from pip._vendor import appdirs as _appdirs
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List
-
-
-def user_cache_dir(appname):
-    # type: (str) -> str
-    return _appdirs.user_cache_dir(appname, appauthor=False)
-
-
-def user_config_dir(appname, roaming=True):
-    # type: (str, bool) -> str
-    return _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming)
-
-
-def user_data_dir(appname, roaming=False):
-    # type: (str, bool) -> str
-    return _appdirs.user_data_dir(appname, appauthor=False, roaming=roaming)
-
-
-# for the discussion regarding site_config_dir locations
-# see 
-def site_config_dirs(appname):
-    # type: (str) -> List[str]
-    dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True)
-    if _appdirs.system not in ["win32", "darwin"]:
-        # always look in /etc directly as well
-        return dirval.split(os.pathsep) + ['/etc']
-    return [dirval]
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/compat.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/compat.py
deleted file mode 100644
index 6efa52ad2b8daece49acf69daa1196582220f4a3..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/compat.py
+++ /dev/null
@@ -1,269 +0,0 @@
-"""Stuff that differs in different Python versions and platform
-distributions."""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import, division
-
-import codecs
-import locale
-import logging
-import os
-import shutil
-import sys
-
-from pip._vendor.six import PY2, text_type
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Text, Tuple, Union
-
-try:
-    import ipaddress
-except ImportError:
-    try:
-        from pip._vendor import ipaddress  # type: ignore
-    except ImportError:
-        import ipaddr as ipaddress  # type: ignore
-        ipaddress.ip_address = ipaddress.IPAddress  # type: ignore
-        ipaddress.ip_network = ipaddress.IPNetwork  # type: ignore
-
-
-__all__ = [
-    "ipaddress", "uses_pycache", "console_to_str",
-    "get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile", "get_terminal_size",
-]
-
-
-logger = logging.getLogger(__name__)
-
-if PY2:
-    import imp
-
-    try:
-        cache_from_source = imp.cache_from_source  # type: ignore
-    except AttributeError:
-        # does not use __pycache__
-        cache_from_source = None
-
-    uses_pycache = cache_from_source is not None
-else:
-    uses_pycache = True
-    from importlib.util import cache_from_source
-
-
-if PY2:
-    # In Python 2.7, backslashreplace exists
-    # but does not support use for decoding.
-    # We implement our own replace handler for this
-    # situation, so that we can consistently use
-    # backslash replacement for all versions.
-    def backslashreplace_decode_fn(err):
-        raw_bytes = (err.object[i] for i in range(err.start, err.end))
-        # Python 2 gave us characters - convert to numeric bytes
-        raw_bytes = (ord(b) for b in raw_bytes)
-        return u"".join(u"\\x%x" % c for c in raw_bytes), err.end
-    codecs.register_error(
-        "backslashreplace_decode",
-        backslashreplace_decode_fn,
-    )
-    backslashreplace_decode = "backslashreplace_decode"
-else:
-    backslashreplace_decode = "backslashreplace"
-
-
-def has_tls():
-    # type: () -> bool
-    try:
-        import _ssl  # noqa: F401  # ignore unused
-        return True
-    except ImportError:
-        pass
-
-    from pip._vendor.urllib3.util import IS_PYOPENSSL
-    return IS_PYOPENSSL
-
-
-def str_to_display(data, desc=None):
-    # type: (Union[bytes, Text], Optional[str]) -> Text
-    """
-    For display or logging purposes, convert a bytes object (or text) to
-    text (e.g. unicode in Python 2) safe for output.
-
-    :param desc: An optional phrase describing the input data, for use in
-        the log message if a warning is logged. Defaults to "Bytes object".
-
-    This function should never error out and so can take a best effort
-    approach. It is okay to be lossy if needed since the return value is
-    just for display.
-
-    We assume the data is in the locale preferred encoding. If it won't
-    decode properly, we warn the user but decode as best we can.
-
-    We also ensure that the output can be safely written to standard output
-    without encoding errors.
-    """
-    if isinstance(data, text_type):
-        return data
-
-    # Otherwise, data is a bytes object (str in Python 2).
-    # First, get the encoding we assume. This is the preferred
-    # encoding for the locale, unless that is not found, or
-    # it is ASCII, in which case assume UTF-8
-    encoding = locale.getpreferredencoding()
-    if (not encoding) or codecs.lookup(encoding).name == "ascii":
-        encoding = "utf-8"
-
-    # Now try to decode the data - if we fail, warn the user and
-    # decode with replacement.
-    try:
-        decoded_data = data.decode(encoding)
-    except UnicodeDecodeError:
-        if desc is None:
-            desc = 'Bytes object'
-        msg_format = '{} does not appear to be encoded as %s'.format(desc)
-        logger.warning(msg_format, encoding)
-        decoded_data = data.decode(encoding, errors=backslashreplace_decode)
-
-    # Make sure we can print the output, by encoding it to the output
-    # encoding with replacement of unencodable characters, and then
-    # decoding again.
-    # We use stderr's encoding because it's less likely to be
-    # redirected and if we don't find an encoding we skip this
-    # step (on the assumption that output is wrapped by something
-    # that won't fail).
-    # The double getattr is to deal with the possibility that we're
-    # being called in a situation where sys.__stderr__ doesn't exist,
-    # or doesn't have an encoding attribute. Neither of these cases
-    # should occur in normal pip use, but there's no harm in checking
-    # in case people use pip in (unsupported) unusual situations.
-    output_encoding = getattr(getattr(sys, "__stderr__", None),
-                              "encoding", None)
-
-    if output_encoding:
-        output_encoded = decoded_data.encode(
-            output_encoding,
-            errors="backslashreplace"
-        )
-        decoded_data = output_encoded.decode(output_encoding)
-
-    return decoded_data
-
-
-def console_to_str(data):
-    # type: (bytes) -> Text
-    """Return a string, safe for output, of subprocess output.
-    """
-    return str_to_display(data, desc='Subprocess output')
-
-
-def get_path_uid(path):
-    # type: (str) -> int
-    """
-    Return path's uid.
-
-    Does not follow symlinks:
-        https://github.com/pypa/pip/pull/935#discussion_r5307003
-
-    Placed this function in compat due to differences on AIX and
-    Jython, that should eventually go away.
-
-    :raises OSError: When path is a symlink or can't be read.
-    """
-    if hasattr(os, 'O_NOFOLLOW'):
-        fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW)
-        file_uid = os.fstat(fd).st_uid
-        os.close(fd)
-    else:  # AIX and Jython
-        # WARNING: time of check vulnerability, but best we can do w/o NOFOLLOW
-        if not os.path.islink(path):
-            # older versions of Jython don't have `os.fstat`
-            file_uid = os.stat(path).st_uid
-        else:
-            # raise OSError for parity with os.O_NOFOLLOW above
-            raise OSError(
-                "%s is a symlink; Will not return uid for symlinks" % path
-            )
-    return file_uid
-
-
-def expanduser(path):
-    # type: (str) -> str
-    """
-    Expand ~ and ~user constructions.
-
-    Includes a workaround for https://bugs.python.org/issue14768
-    """
-    expanded = os.path.expanduser(path)
-    if path.startswith('~/') and expanded.startswith('//'):
-        expanded = expanded[1:]
-    return expanded
-
-
-# packages in the stdlib that may have installation metadata, but should not be
-# considered 'installed'.  this theoretically could be determined based on
-# dist.location (py27:`sysconfig.get_paths()['stdlib']`,
-# py26:sysconfig.get_config_vars('LIBDEST')), but fear platform variation may
-# make this ineffective, so hard-coding
-stdlib_pkgs = {"python", "wsgiref", "argparse"}
-
-
-# windows detection, covers cpython and ironpython
-WINDOWS = (sys.platform.startswith("win") or
-           (sys.platform == 'cli' and os.name == 'nt'))
-
-
-def samefile(file1, file2):
-    # type: (str, str) -> bool
-    """Provide an alternative for os.path.samefile on Windows/Python2"""
-    if hasattr(os.path, 'samefile'):
-        return os.path.samefile(file1, file2)
-    else:
-        path1 = os.path.normcase(os.path.abspath(file1))
-        path2 = os.path.normcase(os.path.abspath(file2))
-        return path1 == path2
-
-
-if hasattr(shutil, 'get_terminal_size'):
-    def get_terminal_size():
-        # type: () -> Tuple[int, int]
-        """
-        Returns a tuple (x, y) representing the width(x) and the height(y)
-        in characters of the terminal window.
-        """
-        return tuple(shutil.get_terminal_size())  # type: ignore
-else:
-    def get_terminal_size():
-        # type: () -> Tuple[int, int]
-        """
-        Returns a tuple (x, y) representing the width(x) and the height(y)
-        in characters of the terminal window.
-        """
-        def ioctl_GWINSZ(fd):
-            try:
-                import fcntl
-                import termios
-                import struct
-                cr = struct.unpack_from(
-                    'hh',
-                    fcntl.ioctl(fd, termios.TIOCGWINSZ, '12345678')
-                )
-            except Exception:
-                return None
-            if cr == (0, 0):
-                return None
-            return cr
-        cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
-        if not cr:
-            if sys.platform != "win32":
-                try:
-                    fd = os.open(os.ctermid(), os.O_RDONLY)
-                    cr = ioctl_GWINSZ(fd)
-                    os.close(fd)
-                except Exception:
-                    pass
-        if not cr:
-            cr = (os.environ.get('LINES', 25), os.environ.get('COLUMNS', 80))
-        return int(cr[1]), int(cr[0])
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/deprecation.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/deprecation.py
deleted file mode 100644
index 2f20cfd49d32f0bbab7b4719eb2dbdca971b751a..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/deprecation.py
+++ /dev/null
@@ -1,104 +0,0 @@
-"""
-A module that implements tooling to enable easy warnings about deprecations.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import warnings
-
-from pip._vendor.packaging.version import parse
-
-from pip import __version__ as current_version
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any, Optional
-
-
-DEPRECATION_MSG_PREFIX = "DEPRECATION: "
-
-
-class PipDeprecationWarning(Warning):
-    pass
-
-
-_original_showwarning = None  # type: Any
-
-
-# Warnings <-> Logging Integration
-def _showwarning(message, category, filename, lineno, file=None, line=None):
-    if file is not None:
-        if _original_showwarning is not None:
-            _original_showwarning(
-                message, category, filename, lineno, file, line,
-            )
-    elif issubclass(category, PipDeprecationWarning):
-        # We use a specially named logger which will handle all of the
-        # deprecation messages for pip.
-        logger = logging.getLogger("pip._internal.deprecations")
-        logger.warning(message)
-    else:
-        _original_showwarning(
-            message, category, filename, lineno, file, line,
-        )
-
-
-def install_warning_logger():
-    # type: () -> None
-    # Enable our Deprecation Warnings
-    warnings.simplefilter("default", PipDeprecationWarning, append=True)
-
-    global _original_showwarning
-
-    if _original_showwarning is None:
-        _original_showwarning = warnings.showwarning
-        warnings.showwarning = _showwarning
-
-
-def deprecated(reason, replacement, gone_in, issue=None):
-    # type: (str, Optional[str], Optional[str], Optional[int]) -> None
-    """Helper to deprecate existing functionality.
-
-    reason:
-        Textual reason shown to the user about why this functionality has
-        been deprecated.
-    replacement:
-        Textual suggestion shown to the user about what alternative
-        functionality they can use.
-    gone_in:
-        The version of pip does this functionality should get removed in.
-        Raises errors if pip's current version is greater than or equal to
-        this.
-    issue:
-        Issue number on the tracker that would serve as a useful place for
-        users to find related discussion and provide feedback.
-
-    Always pass replacement, gone_in and issue as keyword arguments for clarity
-    at the call site.
-    """
-
-    # Construct a nice message.
-    #   This is eagerly formatted as we want it to get logged as if someone
-    #   typed this entire message out.
-    sentences = [
-        (reason, DEPRECATION_MSG_PREFIX + "{}"),
-        (gone_in, "pip {} will remove support for this functionality."),
-        (replacement, "A possible replacement is {}."),
-        (issue, (
-            "You can find discussion regarding this at "
-            "https://github.com/pypa/pip/issues/{}."
-        )),
-    ]
-    message = " ".join(
-        template.format(val) for val, template in sentences if val is not None
-    )
-
-    # Raise as an error if it has to be removed.
-    if gone_in is not None and parse(current_version) >= parse(gone_in):
-        raise PipDeprecationWarning(message)
-
-    warnings.warn(message, category=PipDeprecationWarning, stacklevel=2)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/distutils_args.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/distutils_args.py
deleted file mode 100644
index e38e402d7330778385f65a440b5b39f7bcbdedb3..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/distutils_args.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from distutils.errors import DistutilsArgError
-from distutils.fancy_getopt import FancyGetopt
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Dict, List
-
-
-_options = [
-    ("exec-prefix=", None, ""),
-    ("home=", None, ""),
-    ("install-base=", None, ""),
-    ("install-data=", None, ""),
-    ("install-headers=", None, ""),
-    ("install-lib=", None, ""),
-    ("install-platlib=", None, ""),
-    ("install-purelib=", None, ""),
-    ("install-scripts=", None, ""),
-    ("prefix=", None, ""),
-    ("root=", None, ""),
-    ("user", None, ""),
-]
-
-
-# typeshed doesn't permit Tuple[str, None, str], see python/typeshed#3469.
-_distutils_getopt = FancyGetopt(_options)  # type: ignore
-
-
-def parse_distutils_args(args):
-    # type: (List[str]) -> Dict[str, str]
-    """Parse provided arguments, returning an object that has the
-    matched arguments.
-
-    Any unknown arguments are ignored.
-    """
-    result = {}
-    for arg in args:
-        try:
-            _, match = _distutils_getopt.getopt(args=[arg])
-        except DistutilsArgError:
-            # We don't care about any other options, which here may be
-            # considered unrecognized since our option list is not
-            # exhaustive.
-            pass
-        else:
-            result.update(match.__dict__)
-    return result
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/encoding.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/encoding.py
deleted file mode 100644
index ab4d4b98e3e1bca6f28db1ae114e48933a36be4e..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/encoding.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-import codecs
-import locale
-import re
-import sys
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Tuple, Text
-
-BOMS = [
-    (codecs.BOM_UTF8, 'utf-8'),
-    (codecs.BOM_UTF16, 'utf-16'),
-    (codecs.BOM_UTF16_BE, 'utf-16-be'),
-    (codecs.BOM_UTF16_LE, 'utf-16-le'),
-    (codecs.BOM_UTF32, 'utf-32'),
-    (codecs.BOM_UTF32_BE, 'utf-32-be'),
-    (codecs.BOM_UTF32_LE, 'utf-32-le'),
-]  # type: List[Tuple[bytes, Text]]
-
-ENCODING_RE = re.compile(br'coding[:=]\s*([-\w.]+)')
-
-
-def auto_decode(data):
-    # type: (bytes) -> Text
-    """Check a bytes string for a BOM to correctly detect the encoding
-
-    Fallback to locale.getpreferredencoding(False) like open() on Python3"""
-    for bom, encoding in BOMS:
-        if data.startswith(bom):
-            return data[len(bom):].decode(encoding)
-    # Lets check the first two lines as in PEP263
-    for line in data.split(b'\n')[:2]:
-        if line[0:1] == b'#' and ENCODING_RE.search(line):
-            encoding = ENCODING_RE.search(line).groups()[0].decode('ascii')
-            return data.decode(encoding)
-    return data.decode(
-        locale.getpreferredencoding(False) or sys.getdefaultencoding(),
-    )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/entrypoints.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/entrypoints.py
deleted file mode 100644
index befd01c890184c74534bfefa1abd2376f234ac42..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/entrypoints.py
+++ /dev/null
@@ -1,31 +0,0 @@
-import sys
-
-from pip._internal.cli.main import main
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, List
-
-
-def _wrapper(args=None):
-    # type: (Optional[List[str]]) -> int
-    """Central wrapper for all old entrypoints.
-
-    Historically pip has had several entrypoints defined. Because of issues
-    arising from PATH, sys.path, multiple Pythons, their interactions, and most
-    of them having a pip installed, users suffer every time an entrypoint gets
-    moved.
-
-    To alleviate this pain, and provide a mechanism for warning users and
-    directing them to an appropriate place for help, we now define all of
-    our old entrypoints as wrappers for the current one.
-    """
-    sys.stderr.write(
-        "WARNING: pip is being invoked by an old script wrapper. This will "
-        "fail in a future version of pip.\n"
-        "Please see https://github.com/pypa/pip/issues/5599 for advice on "
-        "fixing the underlying issue.\n"
-        "To avoid this problem you can invoke Python with '-m pip' instead of "
-        "running pip directly.\n"
-    )
-    return main(args)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/filesystem.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/filesystem.py
deleted file mode 100644
index 6f1537e4032617d294b26db09db1d85af4ad0dc2..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/filesystem.py
+++ /dev/null
@@ -1,171 +0,0 @@
-import errno
-import os
-import os.path
-import random
-import shutil
-import stat
-import sys
-from contextlib import contextmanager
-from tempfile import NamedTemporaryFile
-
-# NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is
-#       why we ignore the type on this import.
-from pip._vendor.retrying import retry  # type: ignore
-from pip._vendor.six import PY2
-
-from pip._internal.utils.compat import get_path_uid
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING, cast
-
-if MYPY_CHECK_RUNNING:
-    from typing import BinaryIO, Iterator
-
-    class NamedTemporaryFileResult(BinaryIO):
-        @property
-        def file(self):
-            # type: () -> BinaryIO
-            pass
-
-
-def check_path_owner(path):
-    # type: (str) -> bool
-    # If we don't have a way to check the effective uid of this process, then
-    # we'll just assume that we own the directory.
-    if sys.platform == "win32" or not hasattr(os, "geteuid"):
-        return True
-
-    assert os.path.isabs(path)
-
-    previous = None
-    while path != previous:
-        if os.path.lexists(path):
-            # Check if path is writable by current user.
-            if os.geteuid() == 0:
-                # Special handling for root user in order to handle properly
-                # cases where users use sudo without -H flag.
-                try:
-                    path_uid = get_path_uid(path)
-                except OSError:
-                    return False
-                return path_uid == 0
-            else:
-                return os.access(path, os.W_OK)
-        else:
-            previous, path = path, os.path.dirname(path)
-    return False  # assume we don't own the path
-
-
-def copy2_fixed(src, dest):
-    # type: (str, str) -> None
-    """Wrap shutil.copy2() but map errors copying socket files to
-    SpecialFileError as expected.
-
-    See also https://bugs.python.org/issue37700.
-    """
-    try:
-        shutil.copy2(src, dest)
-    except (OSError, IOError):
-        for f in [src, dest]:
-            try:
-                is_socket_file = is_socket(f)
-            except OSError:
-                # An error has already occurred. Another error here is not
-                # a problem and we can ignore it.
-                pass
-            else:
-                if is_socket_file:
-                    raise shutil.SpecialFileError("`%s` is a socket" % f)
-
-        raise
-
-
-def is_socket(path):
-    # type: (str) -> bool
-    return stat.S_ISSOCK(os.lstat(path).st_mode)
-
-
-@contextmanager
-def adjacent_tmp_file(path):
-    # type: (str) -> Iterator[NamedTemporaryFileResult]
-    """Given a path to a file, open a temp file next to it securely and ensure
-    it is written to disk after the context reaches its end.
-    """
-    with NamedTemporaryFile(
-        delete=False,
-        dir=os.path.dirname(path),
-        prefix=os.path.basename(path),
-        suffix='.tmp',
-    ) as f:
-        result = cast('NamedTemporaryFileResult', f)
-        try:
-            yield result
-        finally:
-            result.file.flush()
-            os.fsync(result.file.fileno())
-
-
-_replace_retry = retry(stop_max_delay=1000, wait_fixed=250)
-
-if PY2:
-    @_replace_retry
-    def replace(src, dest):
-        # type: (str, str) -> None
-        try:
-            os.rename(src, dest)
-        except OSError:
-            os.remove(dest)
-            os.rename(src, dest)
-
-else:
-    replace = _replace_retry(os.replace)
-
-
-# test_writable_dir and _test_writable_dir_win are copied from Flit,
-# with the author's agreement to also place them under pip's license.
-def test_writable_dir(path):
-    # type: (str) -> bool
-    """Check if a directory is writable.
-
-    Uses os.access() on POSIX, tries creating files on Windows.
-    """
-    # If the directory doesn't exist, find the closest parent that does.
-    while not os.path.isdir(path):
-        parent = os.path.dirname(path)
-        if parent == path:
-            break  # Should never get here, but infinite loops are bad
-        path = parent
-
-    if os.name == 'posix':
-        return os.access(path, os.W_OK)
-
-    return _test_writable_dir_win(path)
-
-
-def _test_writable_dir_win(path):
-    # type: (str) -> bool
-    # os.access doesn't work on Windows: http://bugs.python.org/issue2528
-    # and we can't use tempfile: http://bugs.python.org/issue22107
-    basename = 'accesstest_deleteme_fishfingers_custard_'
-    alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789'
-    for i in range(10):
-        name = basename + ''.join(random.choice(alphabet) for _ in range(6))
-        file = os.path.join(path, name)
-        try:
-            fd = os.open(file, os.O_RDWR | os.O_CREAT | os.O_EXCL)
-        except OSError as e:
-            if e.errno == errno.EEXIST:
-                continue
-            if e.errno == errno.EPERM:
-                # This could be because there's a directory with the same name.
-                # But it's highly unlikely there's a directory called that,
-                # so we'll assume it's because the parent dir is not writable.
-                return False
-            raise
-        else:
-            os.close(fd)
-            os.unlink(file)
-            return True
-
-    # This should never be reached
-    raise EnvironmentError(
-        'Unexpected condition testing for writable directory'
-    )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/filetypes.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/filetypes.py
deleted file mode 100644
index daa0ca771b77a32bf498d07803f5bffc34b1abf9..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/filetypes.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""Filetype information.
-"""
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Tuple
-
-WHEEL_EXTENSION = '.whl'
-BZ2_EXTENSIONS = ('.tar.bz2', '.tbz')  # type: Tuple[str, ...]
-XZ_EXTENSIONS = ('.tar.xz', '.txz', '.tlz',
-                 '.tar.lz', '.tar.lzma')  # type: Tuple[str, ...]
-ZIP_EXTENSIONS = ('.zip', WHEEL_EXTENSION)  # type: Tuple[str, ...]
-TAR_EXTENSIONS = ('.tar.gz', '.tgz', '.tar')  # type: Tuple[str, ...]
-ARCHIVE_EXTENSIONS = (
-    ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS
-)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/glibc.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/glibc.py
deleted file mode 100644
index 361042441384693dbeeb9424c78dedf3bdbb8a3d..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/glibc.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import os
-import sys
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Tuple
-
-
-def glibc_version_string():
-    # type: () -> Optional[str]
-    "Returns glibc version string, or None if not using glibc."
-    return glibc_version_string_confstr() or glibc_version_string_ctypes()
-
-
-def glibc_version_string_confstr():
-    # type: () -> Optional[str]
-    "Primary implementation of glibc_version_string using os.confstr."
-    # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely
-    # to be broken or missing. This strategy is used in the standard library
-    # platform module:
-    # https://github.com/python/cpython/blob/fcf1d003bf4f0100c9d0921ff3d70e1127ca1b71/Lib/platform.py#L175-L183
-    if sys.platform == "win32":
-        return None
-    try:
-        # os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17":
-        _, version = os.confstr("CS_GNU_LIBC_VERSION").split()
-    except (AttributeError, OSError, ValueError):
-        # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
-        return None
-    return version
-
-
-def glibc_version_string_ctypes():
-    # type: () -> Optional[str]
-    "Fallback implementation of glibc_version_string using ctypes."
-
-    try:
-        import ctypes
-    except ImportError:
-        return None
-
-    # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
-    # manpage says, "If filename is NULL, then the returned handle is for the
-    # main program". This way we can let the linker do the work to figure out
-    # which libc our process is actually using.
-    process_namespace = ctypes.CDLL(None)
-    try:
-        gnu_get_libc_version = process_namespace.gnu_get_libc_version
-    except AttributeError:
-        # Symbol doesn't exist -> therefore, we are not linked to
-        # glibc.
-        return None
-
-    # Call gnu_get_libc_version, which returns a string like "2.5"
-    gnu_get_libc_version.restype = ctypes.c_char_p
-    version_str = gnu_get_libc_version()
-    # py2 / py3 compatibility:
-    if not isinstance(version_str, str):
-        version_str = version_str.decode("ascii")
-
-    return version_str
-
-
-# platform.libc_ver regularly returns completely nonsensical glibc
-# versions. E.g. on my computer, platform says:
-#
-#   ~$ python2.7 -c 'import platform; print(platform.libc_ver())'
-#   ('glibc', '2.7')
-#   ~$ python3.5 -c 'import platform; print(platform.libc_ver())'
-#   ('glibc', '2.9')
-#
-# But the truth is:
-#
-#   ~$ ldd --version
-#   ldd (Debian GLIBC 2.22-11) 2.22
-#
-# This is unfortunate, because it means that the linehaul data on libc
-# versions that was generated by pip 8.1.2 and earlier is useless and
-# misleading. Solution: instead of using platform, use our code that actually
-# works.
-def libc_ver():
-    # type: () -> Tuple[str, str]
-    """Try to determine the glibc version
-
-    Returns a tuple of strings (lib, version) which default to empty strings
-    in case the lookup fails.
-    """
-    glibc_version = glibc_version_string()
-    if glibc_version is None:
-        return ("", "")
-    else:
-        return ("glibc", glibc_version)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/hashes.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/hashes.py
deleted file mode 100644
index 4c41551a25597aa646d480c7a896ab9f151fff96..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/hashes.py
+++ /dev/null
@@ -1,131 +0,0 @@
-from __future__ import absolute_import
-
-import hashlib
-
-from pip._vendor.six import iteritems, iterkeys, itervalues
-
-from pip._internal.exceptions import (
-    HashMismatch,
-    HashMissing,
-    InstallationError,
-)
-from pip._internal.utils.misc import read_chunks
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Dict, List, BinaryIO, NoReturn, Iterator
-    )
-    from pip._vendor.six import PY3
-    if PY3:
-        from hashlib import _Hash
-    else:
-        from hashlib import _hash as _Hash
-
-
-# The recommended hash algo of the moment. Change this whenever the state of
-# the art changes; it won't hurt backward compatibility.
-FAVORITE_HASH = 'sha256'
-
-
-# Names of hashlib algorithms allowed by the --hash option and ``pip hash``
-# Currently, those are the ones at least as collision-resistant as sha256.
-STRONG_HASHES = ['sha256', 'sha384', 'sha512']
-
-
-class Hashes(object):
-    """A wrapper that builds multiple hashes at once and checks them against
-    known-good values
-
-    """
-    def __init__(self, hashes=None):
-        # type: (Dict[str, List[str]]) -> None
-        """
-        :param hashes: A dict of algorithm names pointing to lists of allowed
-            hex digests
-        """
-        self._allowed = {} if hashes is None else hashes
-
-    @property
-    def digest_count(self):
-        # type: () -> int
-        return sum(len(digests) for digests in self._allowed.values())
-
-    def is_hash_allowed(
-        self,
-        hash_name,   # type: str
-        hex_digest,  # type: str
-    ):
-        # type: (...) -> bool
-        """Return whether the given hex digest is allowed."""
-        return hex_digest in self._allowed.get(hash_name, [])
-
-    def check_against_chunks(self, chunks):
-        # type: (Iterator[bytes]) -> None
-        """Check good hashes against ones built from iterable of chunks of
-        data.
-
-        Raise HashMismatch if none match.
-
-        """
-        gots = {}
-        for hash_name in iterkeys(self._allowed):
-            try:
-                gots[hash_name] = hashlib.new(hash_name)
-            except (ValueError, TypeError):
-                raise InstallationError('Unknown hash name: %s' % hash_name)
-
-        for chunk in chunks:
-            for hash in itervalues(gots):
-                hash.update(chunk)
-
-        for hash_name, got in iteritems(gots):
-            if got.hexdigest() in self._allowed[hash_name]:
-                return
-        self._raise(gots)
-
-    def _raise(self, gots):
-        # type: (Dict[str, _Hash]) -> NoReturn
-        raise HashMismatch(self._allowed, gots)
-
-    def check_against_file(self, file):
-        # type: (BinaryIO) -> None
-        """Check good hashes against a file-like object
-
-        Raise HashMismatch if none match.
-
-        """
-        return self.check_against_chunks(read_chunks(file))
-
-    def check_against_path(self, path):
-        # type: (str) -> None
-        with open(path, 'rb') as file:
-            return self.check_against_file(file)
-
-    def __nonzero__(self):
-        # type: () -> bool
-        """Return whether I know any known-good hashes."""
-        return bool(self._allowed)
-
-    def __bool__(self):
-        # type: () -> bool
-        return self.__nonzero__()
-
-
-class MissingHashes(Hashes):
-    """A workalike for Hashes used when we're missing a hash for a requirement
-
-    It computes the actual hash of the requirement and raises a HashMissing
-    exception showing it to the user.
-
-    """
-    def __init__(self):
-        # type: () -> None
-        """Don't offer the ``hashes`` kwarg."""
-        # Pass our favorite hash in to generate a "gotten hash". With the
-        # empty list, it will never match, so an error will always raise.
-        super(MissingHashes, self).__init__(hashes={FAVORITE_HASH: []})
-
-    def _raise(self, gots):
-        # type: (Dict[str, _Hash]) -> NoReturn
-        raise HashMissing(gots[FAVORITE_HASH].hexdigest())
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/inject_securetransport.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/inject_securetransport.py
deleted file mode 100644
index 5b93b1d6730518ec49afe78bdfbe74407825d8ee..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/inject_securetransport.py
+++ /dev/null
@@ -1,36 +0,0 @@
-"""A helper module that injects SecureTransport, on import.
-
-The import should be done as early as possible, to ensure all requests and
-sessions (or whatever) are created after injecting SecureTransport.
-
-Note that we only do the injection on macOS, when the linked OpenSSL is too
-old to handle TLSv1.2.
-"""
-
-import sys
-
-
-def inject_securetransport():
-    # type: () -> None
-    # Only relevant on macOS
-    if sys.platform != "darwin":
-        return
-
-    try:
-        import ssl
-    except ImportError:
-        return
-
-    # Checks for OpenSSL 1.0.1
-    if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100f:
-        return
-
-    try:
-        from pip._vendor.urllib3.contrib import securetransport
-    except (ImportError, OSError):
-        return
-
-    securetransport.inject_into_urllib3()
-
-
-inject_securetransport()
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py
deleted file mode 100644
index 7767111a6ba90278807dac5efd7a3ab59cc92fe1..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py
+++ /dev/null
@@ -1,398 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import contextlib
-import errno
-import logging
-import logging.handlers
-import os
-import sys
-from logging import Filter, getLogger
-
-from pip._vendor.six import PY2
-
-from pip._internal.utils.compat import WINDOWS
-from pip._internal.utils.deprecation import DEPRECATION_MSG_PREFIX
-from pip._internal.utils.misc import ensure_dir
-
-try:
-    import threading
-except ImportError:
-    import dummy_threading as threading  # type: ignore
-
-
-try:
-    # Use "import as" and set colorama in the else clause to avoid mypy
-    # errors and get the following correct revealed type for colorama:
-    # `Union[_importlib_modulespec.ModuleType, None]`
-    # Otherwise, we get an error like the following in the except block:
-    #  > Incompatible types in assignment (expression has type "None",
-    #   variable has type Module)
-    # TODO: eliminate the need to use "import as" once mypy addresses some
-    #  of its issues with conditional imports. Here is an umbrella issue:
-    #  https://github.com/python/mypy/issues/1297
-    from pip._vendor import colorama as _colorama
-# Lots of different errors can come from this, including SystemError and
-# ImportError.
-except Exception:
-    colorama = None
-else:
-    # Import Fore explicitly rather than accessing below as colorama.Fore
-    # to avoid the following error running mypy:
-    # > Module has no attribute "Fore"
-    # TODO: eliminate the need to import Fore once mypy addresses some of its
-    #  issues with conditional imports. This particular case could be an
-    #  instance of the following issue (but also see the umbrella issue above):
-    #  https://github.com/python/mypy/issues/3500
-    from pip._vendor.colorama import Fore
-
-    colorama = _colorama
-
-
-_log_state = threading.local()
-_log_state.indentation = 0
-subprocess_logger = getLogger('pip.subprocessor')
-
-
-class BrokenStdoutLoggingError(Exception):
-    """
-    Raised if BrokenPipeError occurs for the stdout stream while logging.
-    """
-    pass
-
-
-# BrokenPipeError does not exist in Python 2 and, in addition, manifests
-# differently in Windows and non-Windows.
-if WINDOWS:
-    # In Windows, a broken pipe can show up as EINVAL rather than EPIPE:
-    # https://bugs.python.org/issue19612
-    # https://bugs.python.org/issue30418
-    if PY2:
-        def _is_broken_pipe_error(exc_class, exc):
-            """See the docstring for non-Windows Python 3 below."""
-            return (exc_class is IOError and
-                    exc.errno in (errno.EINVAL, errno.EPIPE))
-    else:
-        # In Windows, a broken pipe IOError became OSError in Python 3.
-        def _is_broken_pipe_error(exc_class, exc):
-            """See the docstring for non-Windows Python 3 below."""
-            return ((exc_class is BrokenPipeError) or  # noqa: F821
-                    (exc_class is OSError and
-                     exc.errno in (errno.EINVAL, errno.EPIPE)))
-elif PY2:
-    def _is_broken_pipe_error(exc_class, exc):
-        """See the docstring for non-Windows Python 3 below."""
-        return (exc_class is IOError and exc.errno == errno.EPIPE)
-else:
-    # Then we are in the non-Windows Python 3 case.
-    def _is_broken_pipe_error(exc_class, exc):
-        """
-        Return whether an exception is a broken pipe error.
-
-        Args:
-          exc_class: an exception class.
-          exc: an exception instance.
-        """
-        return (exc_class is BrokenPipeError)  # noqa: F821
-
-
-@contextlib.contextmanager
-def indent_log(num=2):
-    """
-    A context manager which will cause the log output to be indented for any
-    log messages emitted inside it.
-    """
-    _log_state.indentation += num
-    try:
-        yield
-    finally:
-        _log_state.indentation -= num
-
-
-def get_indentation():
-    return getattr(_log_state, 'indentation', 0)
-
-
-class IndentingFormatter(logging.Formatter):
-
-    def __init__(self, *args, **kwargs):
-        """
-        A logging.Formatter that obeys the indent_log() context manager.
-
-        :param add_timestamp: A bool indicating output lines should be prefixed
-            with their record's timestamp.
-        """
-        self.add_timestamp = kwargs.pop("add_timestamp", False)
-        super(IndentingFormatter, self).__init__(*args, **kwargs)
-
-    def get_message_start(self, formatted, levelno):
-        """
-        Return the start of the formatted log message (not counting the
-        prefix to add to each line).
-        """
-        if levelno < logging.WARNING:
-            return ''
-        if formatted.startswith(DEPRECATION_MSG_PREFIX):
-            # Then the message already has a prefix.  We don't want it to
-            # look like "WARNING: DEPRECATION: ...."
-            return ''
-        if levelno < logging.ERROR:
-            return 'WARNING: '
-
-        return 'ERROR: '
-
-    def format(self, record):
-        """
-        Calls the standard formatter, but will indent all of the log message
-        lines by our current indentation level.
-        """
-        formatted = super(IndentingFormatter, self).format(record)
-        message_start = self.get_message_start(formatted, record.levelno)
-        formatted = message_start + formatted
-
-        prefix = ''
-        if self.add_timestamp:
-            # TODO: Use Formatter.default_time_format after dropping PY2.
-            t = self.formatTime(record, "%Y-%m-%dT%H:%M:%S")
-            prefix = '%s,%03d ' % (t, record.msecs)
-        prefix += " " * get_indentation()
-        formatted = "".join([
-            prefix + line
-            for line in formatted.splitlines(True)
-        ])
-        return formatted
-
-
-def _color_wrap(*colors):
-    def wrapped(inp):
-        return "".join(list(colors) + [inp, colorama.Style.RESET_ALL])
-    return wrapped
-
-
-class ColorizedStreamHandler(logging.StreamHandler):
-
-    # Don't build up a list of colors if we don't have colorama
-    if colorama:
-        COLORS = [
-            # This needs to be in order from highest logging level to lowest.
-            (logging.ERROR, _color_wrap(Fore.RED)),
-            (logging.WARNING, _color_wrap(Fore.YELLOW)),
-        ]
-    else:
-        COLORS = []
-
-    def __init__(self, stream=None, no_color=None):
-        logging.StreamHandler.__init__(self, stream)
-        self._no_color = no_color
-
-        if WINDOWS and colorama:
-            self.stream = colorama.AnsiToWin32(self.stream)
-
-    def _using_stdout(self):
-        """
-        Return whether the handler is using sys.stdout.
-        """
-        if WINDOWS and colorama:
-            # Then self.stream is an AnsiToWin32 object.
-            return self.stream.wrapped is sys.stdout
-
-        return self.stream is sys.stdout
-
-    def should_color(self):
-        # Don't colorize things if we do not have colorama or if told not to
-        if not colorama or self._no_color:
-            return False
-
-        real_stream = (
-            self.stream if not isinstance(self.stream, colorama.AnsiToWin32)
-            else self.stream.wrapped
-        )
-
-        # If the stream is a tty we should color it
-        if hasattr(real_stream, "isatty") and real_stream.isatty():
-            return True
-
-        # If we have an ANSI term we should color it
-        if os.environ.get("TERM") == "ANSI":
-            return True
-
-        # If anything else we should not color it
-        return False
-
-    def format(self, record):
-        msg = logging.StreamHandler.format(self, record)
-
-        if self.should_color():
-            for level, color in self.COLORS:
-                if record.levelno >= level:
-                    msg = color(msg)
-                    break
-
-        return msg
-
-    # The logging module says handleError() can be customized.
-    def handleError(self, record):
-        exc_class, exc = sys.exc_info()[:2]
-        # If a broken pipe occurred while calling write() or flush() on the
-        # stdout stream in logging's Handler.emit(), then raise our special
-        # exception so we can handle it in main() instead of logging the
-        # broken pipe error and continuing.
-        if (exc_class and self._using_stdout() and
-                _is_broken_pipe_error(exc_class, exc)):
-            raise BrokenStdoutLoggingError()
-
-        return super(ColorizedStreamHandler, self).handleError(record)
-
-
-class BetterRotatingFileHandler(logging.handlers.RotatingFileHandler):
-
-    def _open(self):
-        ensure_dir(os.path.dirname(self.baseFilename))
-        return logging.handlers.RotatingFileHandler._open(self)
-
-
-class MaxLevelFilter(Filter):
-
-    def __init__(self, level):
-        self.level = level
-
-    def filter(self, record):
-        return record.levelno < self.level
-
-
-class ExcludeLoggerFilter(Filter):
-
-    """
-    A logging Filter that excludes records from a logger (or its children).
-    """
-
-    def filter(self, record):
-        # The base Filter class allows only records from a logger (or its
-        # children).
-        return not super(ExcludeLoggerFilter, self).filter(record)
-
-
-def setup_logging(verbosity, no_color, user_log_file):
-    """Configures and sets up all of the logging
-
-    Returns the requested logging level, as its integer value.
-    """
-
-    # Determine the level to be logging at.
-    if verbosity >= 1:
-        level = "DEBUG"
-    elif verbosity == -1:
-        level = "WARNING"
-    elif verbosity == -2:
-        level = "ERROR"
-    elif verbosity <= -3:
-        level = "CRITICAL"
-    else:
-        level = "INFO"
-
-    level_number = getattr(logging, level)
-
-    # The "root" logger should match the "console" level *unless* we also need
-    # to log to a user log file.
-    include_user_log = user_log_file is not None
-    if include_user_log:
-        additional_log_file = user_log_file
-        root_level = "DEBUG"
-    else:
-        additional_log_file = "/dev/null"
-        root_level = level
-
-    # Disable any logging besides WARNING unless we have DEBUG level logging
-    # enabled for vendored libraries.
-    vendored_log_level = "WARNING" if level in ["INFO", "ERROR"] else "DEBUG"
-
-    # Shorthands for clarity
-    log_streams = {
-        "stdout": "ext://sys.stdout",
-        "stderr": "ext://sys.stderr",
-    }
-    handler_classes = {
-        "stream": "pip._internal.utils.logging.ColorizedStreamHandler",
-        "file": "pip._internal.utils.logging.BetterRotatingFileHandler",
-    }
-    handlers = ["console", "console_errors", "console_subprocess"] + (
-        ["user_log"] if include_user_log else []
-    )
-
-    logging.config.dictConfig({
-        "version": 1,
-        "disable_existing_loggers": False,
-        "filters": {
-            "exclude_warnings": {
-                "()": "pip._internal.utils.logging.MaxLevelFilter",
-                "level": logging.WARNING,
-            },
-            "restrict_to_subprocess": {
-                "()": "logging.Filter",
-                "name": subprocess_logger.name,
-            },
-            "exclude_subprocess": {
-                "()": "pip._internal.utils.logging.ExcludeLoggerFilter",
-                "name": subprocess_logger.name,
-            },
-        },
-        "formatters": {
-            "indent": {
-                "()": IndentingFormatter,
-                "format": "%(message)s",
-            },
-            "indent_with_timestamp": {
-                "()": IndentingFormatter,
-                "format": "%(message)s",
-                "add_timestamp": True,
-            },
-        },
-        "handlers": {
-            "console": {
-                "level": level,
-                "class": handler_classes["stream"],
-                "no_color": no_color,
-                "stream": log_streams["stdout"],
-                "filters": ["exclude_subprocess", "exclude_warnings"],
-                "formatter": "indent",
-            },
-            "console_errors": {
-                "level": "WARNING",
-                "class": handler_classes["stream"],
-                "no_color": no_color,
-                "stream": log_streams["stderr"],
-                "filters": ["exclude_subprocess"],
-                "formatter": "indent",
-            },
-            # A handler responsible for logging to the console messages
-            # from the "subprocessor" logger.
-            "console_subprocess": {
-                "level": level,
-                "class": handler_classes["stream"],
-                "no_color": no_color,
-                "stream": log_streams["stderr"],
-                "filters": ["restrict_to_subprocess"],
-                "formatter": "indent",
-            },
-            "user_log": {
-                "level": "DEBUG",
-                "class": handler_classes["file"],
-                "filename": additional_log_file,
-                "delay": True,
-                "formatter": "indent_with_timestamp",
-            },
-        },
-        "root": {
-            "level": root_level,
-            "handlers": handlers,
-        },
-        "loggers": {
-            "pip._vendor": {
-                "level": vendored_log_level
-            }
-        },
-    })
-
-    return level_number
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/marker_files.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/marker_files.py
deleted file mode 100644
index 42ea81405085a0000c587ad563fee30c7f37a026..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/marker_files.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import os.path
-
-DELETE_MARKER_MESSAGE = '''\
-This file is placed here by pip to indicate the source was put
-here by pip.
-
-Once this package is successfully installed this source code will be
-deleted (unless you remove this file).
-'''
-PIP_DELETE_MARKER_FILENAME = 'pip-delete-this-directory.txt'
-
-
-def has_delete_marker_file(directory):
-    # type: (str) -> bool
-    return os.path.exists(os.path.join(directory, PIP_DELETE_MARKER_FILENAME))
-
-
-def write_delete_marker_file(directory):
-    # type: (str) -> None
-    """
-    Write the pip delete marker file into this directory.
-    """
-    filepath = os.path.join(directory, PIP_DELETE_MARKER_FILENAME)
-    with open(filepath, 'w') as marker_fp:
-        marker_fp.write(DELETE_MARKER_MESSAGE)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/misc.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/misc.py
deleted file mode 100644
index 554af0bf7b9b8c03de1b2cd3f3eda09a31c60a41..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/misc.py
+++ /dev/null
@@ -1,904 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import contextlib
-import errno
-import getpass
-import hashlib
-import io
-import logging
-import os
-import posixpath
-import shutil
-import stat
-import sys
-from collections import deque
-
-from pip._vendor import pkg_resources
-# NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is
-#       why we ignore the type on this import.
-from pip._vendor.retrying import retry  # type: ignore
-from pip._vendor.six import PY2, text_type
-from pip._vendor.six.moves import input
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
-
-from pip import __version__
-from pip._internal.exceptions import CommandError
-from pip._internal.locations import (
-    get_major_minor_version,
-    site_packages,
-    user_site,
-)
-from pip._internal.utils.compat import (
-    WINDOWS,
-    expanduser,
-    stdlib_pkgs,
-    str_to_display,
-)
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING, cast
-from pip._internal.utils.virtualenv import (
-    running_under_virtualenv,
-    virtualenv_no_global,
-)
-
-if PY2:
-    from io import BytesIO as StringIO
-else:
-    from io import StringIO
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Any, AnyStr, Container, Iterable, List, Optional, Text,
-        Tuple, Union,
-    )
-    from pip._vendor.pkg_resources import Distribution
-
-    VersionInfo = Tuple[int, int, int]
-
-
-__all__ = ['rmtree', 'display_path', 'backup_dir',
-           'ask', 'splitext',
-           'format_size', 'is_installable_dir',
-           'normalize_path',
-           'renames', 'get_prog',
-           'captured_stdout', 'ensure_dir',
-           'get_installed_version', 'remove_auth_from_url']
-
-
-logger = logging.getLogger(__name__)
-
-
-def get_pip_version():
-    # type: () -> str
-    pip_pkg_dir = os.path.join(os.path.dirname(__file__), "..", "..")
-    pip_pkg_dir = os.path.abspath(pip_pkg_dir)
-
-    return (
-        'pip {} from {} (python {})'.format(
-            __version__, pip_pkg_dir, get_major_minor_version(),
-        )
-    )
-
-
-def normalize_version_info(py_version_info):
-    # type: (Tuple[int, ...]) -> Tuple[int, int, int]
-    """
-    Convert a tuple of ints representing a Python version to one of length
-    three.
-
-    :param py_version_info: a tuple of ints representing a Python version,
-        or None to specify no version. The tuple can have any length.
-
-    :return: a tuple of length three if `py_version_info` is non-None.
-        Otherwise, return `py_version_info` unchanged (i.e. None).
-    """
-    if len(py_version_info) < 3:
-        py_version_info += (3 - len(py_version_info)) * (0,)
-    elif len(py_version_info) > 3:
-        py_version_info = py_version_info[:3]
-
-    return cast('VersionInfo', py_version_info)
-
-
-def ensure_dir(path):
-    # type: (AnyStr) -> None
-    """os.path.makedirs without EEXIST."""
-    try:
-        os.makedirs(path)
-    except OSError as e:
-        # Windows can raise spurious ENOTEMPTY errors. See #6426.
-        if e.errno != errno.EEXIST and e.errno != errno.ENOTEMPTY:
-            raise
-
-
-def get_prog():
-    # type: () -> str
-    try:
-        prog = os.path.basename(sys.argv[0])
-        if prog in ('__main__.py', '-c'):
-            return "%s -m pip" % sys.executable
-        else:
-            return prog
-    except (AttributeError, TypeError, IndexError):
-        pass
-    return 'pip'
-
-
-# Retry every half second for up to 3 seconds
-@retry(stop_max_delay=3000, wait_fixed=500)
-def rmtree(dir, ignore_errors=False):
-    # type: (str, bool) -> None
-    shutil.rmtree(dir, ignore_errors=ignore_errors,
-                  onerror=rmtree_errorhandler)
-
-
-def rmtree_errorhandler(func, path, exc_info):
-    """On Windows, the files in .svn are read-only, so when rmtree() tries to
-    remove them, an exception is thrown.  We catch that here, remove the
-    read-only attribute, and hopefully continue without problems."""
-    try:
-        has_attr_readonly = not (os.stat(path).st_mode & stat.S_IWRITE)
-    except (IOError, OSError):
-        # it's equivalent to os.path.exists
-        return
-
-    if has_attr_readonly:
-        # convert to read/write
-        os.chmod(path, stat.S_IWRITE)
-        # use the original function to repeat the operation
-        func(path)
-        return
-    else:
-        raise
-
-
-def path_to_display(path):
-    # type: (Optional[Union[str, Text]]) -> Optional[Text]
-    """
-    Convert a bytes (or text) path to text (unicode in Python 2) for display
-    and logging purposes.
-
-    This function should never error out. Also, this function is mainly needed
-    for Python 2 since in Python 3 str paths are already text.
-    """
-    if path is None:
-        return None
-    if isinstance(path, text_type):
-        return path
-    # Otherwise, path is a bytes object (str in Python 2).
-    try:
-        display_path = path.decode(sys.getfilesystemencoding(), 'strict')
-    except UnicodeDecodeError:
-        # Include the full bytes to make troubleshooting easier, even though
-        # it may not be very human readable.
-        if PY2:
-            # Convert the bytes to a readable str representation using
-            # repr(), and then convert the str to unicode.
-            #   Also, we add the prefix "b" to the repr() return value both
-            # to make the Python 2 output look like the Python 3 output, and
-            # to signal to the user that this is a bytes representation.
-            display_path = str_to_display('b{!r}'.format(path))
-        else:
-            # Silence the "F821 undefined name 'ascii'" flake8 error since
-            # in Python 3 ascii() is a built-in.
-            display_path = ascii(path)  # noqa: F821
-
-    return display_path
-
-
-def display_path(path):
-    # type: (Union[str, Text]) -> str
-    """Gives the display value for a given path, making it relative to cwd
-    if possible."""
-    path = os.path.normcase(os.path.abspath(path))
-    if sys.version_info[0] == 2:
-        path = path.decode(sys.getfilesystemencoding(), 'replace')
-        path = path.encode(sys.getdefaultencoding(), 'replace')
-    if path.startswith(os.getcwd() + os.path.sep):
-        path = '.' + path[len(os.getcwd()):]
-    return path
-
-
-def backup_dir(dir, ext='.bak'):
-    # type: (str, str) -> str
-    """Figure out the name of a directory to back up the given dir to
-    (adding .bak, .bak2, etc)"""
-    n = 1
-    extension = ext
-    while os.path.exists(dir + extension):
-        n += 1
-        extension = ext + str(n)
-    return dir + extension
-
-
-def ask_path_exists(message, options):
-    # type: (str, Iterable[str]) -> str
-    for action in os.environ.get('PIP_EXISTS_ACTION', '').split():
-        if action in options:
-            return action
-    return ask(message, options)
-
-
-def _check_no_input(message):
-    # type: (str) -> None
-    """Raise an error if no input is allowed."""
-    if os.environ.get('PIP_NO_INPUT'):
-        raise Exception(
-            'No input was expected ($PIP_NO_INPUT set); question: %s' %
-            message
-        )
-
-
-def ask(message, options):
-    # type: (str, Iterable[str]) -> str
-    """Ask the message interactively, with the given possible responses"""
-    while 1:
-        _check_no_input(message)
-        response = input(message)
-        response = response.strip().lower()
-        if response not in options:
-            print(
-                'Your response (%r) was not one of the expected responses: '
-                '%s' % (response, ', '.join(options))
-            )
-        else:
-            return response
-
-
-def ask_input(message):
-    # type: (str) -> str
-    """Ask for input interactively."""
-    _check_no_input(message)
-    return input(message)
-
-
-def ask_password(message):
-    # type: (str) -> str
-    """Ask for a password interactively."""
-    _check_no_input(message)
-    return getpass.getpass(message)
-
-
-def format_size(bytes):
-    # type: (float) -> str
-    if bytes > 1000 * 1000:
-        return '%.1f MB' % (bytes / 1000.0 / 1000)
-    elif bytes > 10 * 1000:
-        return '%i kB' % (bytes / 1000)
-    elif bytes > 1000:
-        return '%.1f kB' % (bytes / 1000.0)
-    else:
-        return '%i bytes' % bytes
-
-
-def is_installable_dir(path):
-    # type: (str) -> bool
-    """Is path is a directory containing setup.py or pyproject.toml?
-    """
-    if not os.path.isdir(path):
-        return False
-    setup_py = os.path.join(path, 'setup.py')
-    if os.path.isfile(setup_py):
-        return True
-    pyproject_toml = os.path.join(path, 'pyproject.toml')
-    if os.path.isfile(pyproject_toml):
-        return True
-    return False
-
-
-def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
-    """Yield pieces of data from a file-like object until EOF."""
-    while True:
-        chunk = file.read(size)
-        if not chunk:
-            break
-        yield chunk
-
-
-def normalize_path(path, resolve_symlinks=True):
-    # type: (str, bool) -> str
-    """
-    Convert a path to its canonical, case-normalized, absolute version.
-
-    """
-    path = expanduser(path)
-    if resolve_symlinks:
-        path = os.path.realpath(path)
-    else:
-        path = os.path.abspath(path)
-    return os.path.normcase(path)
-
-
-def splitext(path):
-    # type: (str) -> Tuple[str, str]
-    """Like os.path.splitext, but take off .tar too"""
-    base, ext = posixpath.splitext(path)
-    if base.lower().endswith('.tar'):
-        ext = base[-4:] + ext
-        base = base[:-4]
-    return base, ext
-
-
-def renames(old, new):
-    # type: (str, str) -> None
-    """Like os.renames(), but handles renaming across devices."""
-    # Implementation borrowed from os.renames().
-    head, tail = os.path.split(new)
-    if head and tail and not os.path.exists(head):
-        os.makedirs(head)
-
-    shutil.move(old, new)
-
-    head, tail = os.path.split(old)
-    if head and tail:
-        try:
-            os.removedirs(head)
-        except OSError:
-            pass
-
-
-def is_local(path):
-    # type: (str) -> bool
-    """
-    Return True if this is a path pip is allowed to modify.
-
-    If we're in a virtualenv, sys.prefix points to the virtualenv's
-    prefix; only sys.prefix is considered local.
-
-    If we're not in a virtualenv, in general we can modify anything.
-    However, if the OS vendor has configured distutils to install
-    somewhere other than sys.prefix (which could be a subdirectory of
-    sys.prefix, e.g. /usr/local), we consider sys.prefix itself nonlocal
-    and the domain of the OS vendor. (In other words, everything _other
-    than_ sys.prefix is considered local.)
-
-    Caution: this function assumes the head of path has been normalized
-    with normalize_path.
-    """
-
-    path = normalize_path(path)
-    prefix = normalize_path(sys.prefix)
-
-    if running_under_virtualenv():
-        return path.startswith(normalize_path(sys.prefix))
-    else:
-        from pip._internal.locations import distutils_scheme
-        if path.startswith(prefix):
-            for local_path in distutils_scheme("").values():
-                if path.startswith(normalize_path(local_path)):
-                    return True
-            return False
-        else:
-            return True
-
-
-def dist_is_local(dist):
-    # type: (Distribution) -> bool
-    """
-    Return True if given Distribution object is installed somewhere pip
-    is allowed to modify.
-
-    """
-    return is_local(dist_location(dist))
-
-
-def dist_in_usersite(dist):
-    # type: (Distribution) -> bool
-    """
-    Return True if given Distribution is installed in user site.
-    """
-    return dist_location(dist).startswith(normalize_path(user_site))
-
-
-def dist_in_site_packages(dist):
-    # type: (Distribution) -> bool
-    """
-    Return True if given Distribution is installed in
-    sysconfig.get_python_lib().
-    """
-    return dist_location(dist).startswith(normalize_path(site_packages))
-
-
-def dist_is_editable(dist):
-    # type: (Distribution) -> bool
-    """
-    Return True if given Distribution is an editable install.
-    """
-    for path_item in sys.path:
-        egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
-        if os.path.isfile(egg_link):
-            return True
-    return False
-
-
-def get_installed_distributions(
-        local_only=True,  # type: bool
-        skip=stdlib_pkgs,  # type: Container[str]
-        include_editables=True,  # type: bool
-        editables_only=False,  # type: bool
-        user_only=False,  # type: bool
-        paths=None  # type: Optional[List[str]]
-):
-    # type: (...) -> List[Distribution]
-    """
-    Return a list of installed Distribution objects.
-
-    If ``local_only`` is True (default), only return installations
-    local to the current virtualenv, if in a virtualenv.
-
-    ``skip`` argument is an iterable of lower-case project names to
-    ignore; defaults to stdlib_pkgs
-
-    If ``include_editables`` is False, don't report editables.
-
-    If ``editables_only`` is True , only report editables.
-
-    If ``user_only`` is True , only report installations in the user
-    site directory.
-
-    If ``paths`` is set, only report the distributions present at the
-    specified list of locations.
-    """
-    if paths:
-        working_set = pkg_resources.WorkingSet(paths)
-    else:
-        working_set = pkg_resources.working_set
-
-    if local_only:
-        local_test = dist_is_local
-    else:
-        def local_test(d):
-            return True
-
-    if include_editables:
-        def editable_test(d):
-            return True
-    else:
-        def editable_test(d):
-            return not dist_is_editable(d)
-
-    if editables_only:
-        def editables_only_test(d):
-            return dist_is_editable(d)
-    else:
-        def editables_only_test(d):
-            return True
-
-    if user_only:
-        user_test = dist_in_usersite
-    else:
-        def user_test(d):
-            return True
-
-    return [d for d in working_set
-            if local_test(d) and
-            d.key not in skip and
-            editable_test(d) and
-            editables_only_test(d) and
-            user_test(d)
-            ]
-
-
-def egg_link_path(dist):
-    # type: (Distribution) -> Optional[str]
-    """
-    Return the path for the .egg-link file if it exists, otherwise, None.
-
-    There's 3 scenarios:
-    1) not in a virtualenv
-       try to find in site.USER_SITE, then site_packages
-    2) in a no-global virtualenv
-       try to find in site_packages
-    3) in a yes-global virtualenv
-       try to find in site_packages, then site.USER_SITE
-       (don't look in global location)
-
-    For #1 and #3, there could be odd cases, where there's an egg-link in 2
-    locations.
-
-    This method will just return the first one found.
-    """
-    sites = []
-    if running_under_virtualenv():
-        sites.append(site_packages)
-        if not virtualenv_no_global() and user_site:
-            sites.append(user_site)
-    else:
-        if user_site:
-            sites.append(user_site)
-        sites.append(site_packages)
-
-    for site in sites:
-        egglink = os.path.join(site, dist.project_name) + '.egg-link'
-        if os.path.isfile(egglink):
-            return egglink
-    return None
-
-
-def dist_location(dist):
-    # type: (Distribution) -> str
-    """
-    Get the site-packages location of this distribution. Generally
-    this is dist.location, except in the case of develop-installed
-    packages, where dist.location is the source code location, and we
-    want to know where the egg-link file is.
-
-    The returned location is normalized (in particular, with symlinks removed).
-    """
-    egg_link = egg_link_path(dist)
-    if egg_link:
-        return normalize_path(egg_link)
-    return normalize_path(dist.location)
-
-
-def write_output(msg, *args):
-    # type: (str, str) -> None
-    logger.info(msg, *args)
-
-
-class FakeFile(object):
-    """Wrap a list of lines in an object with readline() to make
-    ConfigParser happy."""
-    def __init__(self, lines):
-        self._gen = (l for l in lines)
-
-    def readline(self):
-        try:
-            try:
-                return next(self._gen)
-            except NameError:
-                return self._gen.next()
-        except StopIteration:
-            return ''
-
-    def __iter__(self):
-        return self._gen
-
-
-class StreamWrapper(StringIO):
-
-    @classmethod
-    def from_stream(cls, orig_stream):
-        cls.orig_stream = orig_stream
-        return cls()
-
-    # compileall.compile_dir() needs stdout.encoding to print to stdout
-    @property
-    def encoding(self):
-        return self.orig_stream.encoding
-
-
-@contextlib.contextmanager
-def captured_output(stream_name):
-    """Return a context manager used by captured_stdout/stdin/stderr
-    that temporarily replaces the sys stream *stream_name* with a StringIO.
-
-    Taken from Lib/support/__init__.py in the CPython repo.
-    """
-    orig_stdout = getattr(sys, stream_name)
-    setattr(sys, stream_name, StreamWrapper.from_stream(orig_stdout))
-    try:
-        yield getattr(sys, stream_name)
-    finally:
-        setattr(sys, stream_name, orig_stdout)
-
-
-def captured_stdout():
-    """Capture the output of sys.stdout:
-
-       with captured_stdout() as stdout:
-           print('hello')
-       self.assertEqual(stdout.getvalue(), 'hello\n')
-
-    Taken from Lib/support/__init__.py in the CPython repo.
-    """
-    return captured_output('stdout')
-
-
-def captured_stderr():
-    """
-    See captured_stdout().
-    """
-    return captured_output('stderr')
-
-
-class cached_property(object):
-    """A property that is only computed once per instance and then replaces
-       itself with an ordinary attribute. Deleting the attribute resets the
-       property.
-
-       Source: https://github.com/bottlepy/bottle/blob/0.11.5/bottle.py#L175
-    """
-
-    def __init__(self, func):
-        self.__doc__ = getattr(func, '__doc__')
-        self.func = func
-
-    def __get__(self, obj, cls):
-        if obj is None:
-            # We're being accessed from the class itself, not from an object
-            return self
-        value = obj.__dict__[self.func.__name__] = self.func(obj)
-        return value
-
-
-def get_installed_version(dist_name, working_set=None):
-    """Get the installed version of dist_name avoiding pkg_resources cache"""
-    # Create a requirement that we'll look for inside of setuptools.
-    req = pkg_resources.Requirement.parse(dist_name)
-
-    if working_set is None:
-        # We want to avoid having this cached, so we need to construct a new
-        # working set each time.
-        working_set = pkg_resources.WorkingSet()
-
-    # Get the installed distribution from our working set
-    dist = working_set.find(req)
-
-    # Check to see if we got an installed distribution or not, if we did
-    # we want to return it's version.
-    return dist.version if dist else None
-
-
-def consume(iterator):
-    """Consume an iterable at C speed."""
-    deque(iterator, maxlen=0)
-
-
-# Simulates an enum
-def enum(*sequential, **named):
-    enums = dict(zip(sequential, range(len(sequential))), **named)
-    reverse = {value: key for key, value in enums.items()}
-    enums['reverse_mapping'] = reverse
-    return type('Enum', (), enums)
-
-
-def build_netloc(host, port):
-    # type: (str, Optional[int]) -> str
-    """
-    Build a netloc from a host-port pair
-    """
-    if port is None:
-        return host
-    if ':' in host:
-        # Only wrap host with square brackets when it is IPv6
-        host = '[{}]'.format(host)
-    return '{}:{}'.format(host, port)
-
-
-def build_url_from_netloc(netloc, scheme='https'):
-    # type: (str, str) -> str
-    """
-    Build a full URL from a netloc.
-    """
-    if netloc.count(':') >= 2 and '@' not in netloc and '[' not in netloc:
-        # It must be a bare IPv6 address, so wrap it with brackets.
-        netloc = '[{}]'.format(netloc)
-    return '{}://{}'.format(scheme, netloc)
-
-
-def parse_netloc(netloc):
-    # type: (str) -> Tuple[str, Optional[int]]
-    """
-    Return the host-port pair from a netloc.
-    """
-    url = build_url_from_netloc(netloc)
-    parsed = urllib_parse.urlparse(url)
-    return parsed.hostname, parsed.port
-
-
-def split_auth_from_netloc(netloc):
-    """
-    Parse out and remove the auth information from a netloc.
-
-    Returns: (netloc, (username, password)).
-    """
-    if '@' not in netloc:
-        return netloc, (None, None)
-
-    # Split from the right because that's how urllib.parse.urlsplit()
-    # behaves if more than one @ is present (which can be checked using
-    # the password attribute of urlsplit()'s return value).
-    auth, netloc = netloc.rsplit('@', 1)
-    if ':' in auth:
-        # Split from the left because that's how urllib.parse.urlsplit()
-        # behaves if more than one : is present (which again can be checked
-        # using the password attribute of the return value)
-        user_pass = auth.split(':', 1)
-    else:
-        user_pass = auth, None
-
-    user_pass = tuple(
-        None if x is None else urllib_unquote(x) for x in user_pass
-    )
-
-    return netloc, user_pass
-
-
-def redact_netloc(netloc):
-    # type: (str) -> str
-    """
-    Replace the sensitive data in a netloc with "****", if it exists.
-
-    For example:
-        - "user:pass@example.com" returns "user:****@example.com"
-        - "accesstoken@example.com" returns "****@example.com"
-    """
-    netloc, (user, password) = split_auth_from_netloc(netloc)
-    if user is None:
-        return netloc
-    if password is None:
-        user = '****'
-        password = ''
-    else:
-        user = urllib_parse.quote(user)
-        password = ':****'
-    return '{user}{password}@{netloc}'.format(user=user,
-                                              password=password,
-                                              netloc=netloc)
-
-
-def _transform_url(url, transform_netloc):
-    """Transform and replace netloc in a url.
-
-    transform_netloc is a function taking the netloc and returning a
-    tuple. The first element of this tuple is the new netloc. The
-    entire tuple is returned.
-
-    Returns a tuple containing the transformed url as item 0 and the
-    original tuple returned by transform_netloc as item 1.
-    """
-    purl = urllib_parse.urlsplit(url)
-    netloc_tuple = transform_netloc(purl.netloc)
-    # stripped url
-    url_pieces = (
-        purl.scheme, netloc_tuple[0], purl.path, purl.query, purl.fragment
-    )
-    surl = urllib_parse.urlunsplit(url_pieces)
-    return surl, netloc_tuple
-
-
-def _get_netloc(netloc):
-    return split_auth_from_netloc(netloc)
-
-
-def _redact_netloc(netloc):
-    return (redact_netloc(netloc),)
-
-
-def split_auth_netloc_from_url(url):
-    # type: (str) -> Tuple[str, str, Tuple[str, str]]
-    """
-    Parse a url into separate netloc, auth, and url with no auth.
-
-    Returns: (url_without_auth, netloc, (username, password))
-    """
-    url_without_auth, (netloc, auth) = _transform_url(url, _get_netloc)
-    return url_without_auth, netloc, auth
-
-
-def remove_auth_from_url(url):
-    # type: (str) -> str
-    """Return a copy of url with 'username:password@' removed."""
-    # username/pass params are passed to subversion through flags
-    # and are not recognized in the url.
-    return _transform_url(url, _get_netloc)[0]
-
-
-def redact_auth_from_url(url):
-    # type: (str) -> str
-    """Replace the password in a given url with ****."""
-    return _transform_url(url, _redact_netloc)[0]
-
-
-class HiddenText(object):
-    def __init__(
-        self,
-        secret,    # type: str
-        redacted,  # type: str
-    ):
-        # type: (...) -> None
-        self.secret = secret
-        self.redacted = redacted
-
-    def __repr__(self):
-        # type: (...) -> str
-        return ''.format(str(self))
-
-    def __str__(self):
-        # type: (...) -> str
-        return self.redacted
-
-    # This is useful for testing.
-    def __eq__(self, other):
-        # type: (Any) -> bool
-        if type(self) != type(other):
-            return False
-
-        # The string being used for redaction doesn't also have to match,
-        # just the raw, original string.
-        return (self.secret == other.secret)
-
-    # We need to provide an explicit __ne__ implementation for Python 2.
-    # TODO: remove this when we drop PY2 support.
-    def __ne__(self, other):
-        # type: (Any) -> bool
-        return not self == other
-
-
-def hide_value(value):
-    # type: (str) -> HiddenText
-    return HiddenText(value, redacted='****')
-
-
-def hide_url(url):
-    # type: (str) -> HiddenText
-    redacted = redact_auth_from_url(url)
-    return HiddenText(url, redacted=redacted)
-
-
-def protect_pip_from_modification_on_windows(modifying_pip):
-    # type: (bool) -> None
-    """Protection of pip.exe from modification on Windows
-
-    On Windows, any operation modifying pip should be run as:
-        python -m pip ...
-    """
-    pip_names = [
-        "pip.exe",
-        "pip{}.exe".format(sys.version_info[0]),
-        "pip{}.{}.exe".format(*sys.version_info[:2])
-    ]
-
-    # See https://github.com/pypa/pip/issues/1299 for more discussion
-    should_show_use_python_msg = (
-        modifying_pip and
-        WINDOWS and
-        os.path.basename(sys.argv[0]) in pip_names
-    )
-
-    if should_show_use_python_msg:
-        new_command = [
-            sys.executable, "-m", "pip"
-        ] + sys.argv[1:]
-        raise CommandError(
-            'To modify pip, please run the following command:\n{}'
-            .format(" ".join(new_command))
-        )
-
-
-def is_console_interactive():
-    # type: () -> bool
-    """Is this console interactive?
-    """
-    return sys.stdin is not None and sys.stdin.isatty()
-
-
-def hash_file(path, blocksize=1 << 20):
-    # type: (str, int) -> Tuple[Any, int]
-    """Return (hash, length) for path using hashlib.sha256()
-    """
-
-    h = hashlib.sha256()
-    length = 0
-    with open(path, 'rb') as f:
-        for block in read_chunks(f, size=blocksize):
-            length += len(block)
-            h.update(block)
-    return h, length
-
-
-def is_wheel_installed():
-    """
-    Return whether the wheel package is installed.
-    """
-    try:
-        import wheel  # noqa: F401
-    except ImportError:
-        return False
-
-    return True
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/models.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/models.py
deleted file mode 100644
index 29e1441153b63446220a5e1867e691183e0d22d7..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/models.py
+++ /dev/null
@@ -1,42 +0,0 @@
-"""Utilities for defining models
-"""
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-import operator
-
-
-class KeyBasedCompareMixin(object):
-    """Provides comparison capabilities that is based on a key
-    """
-
-    def __init__(self, key, defining_class):
-        self._compare_key = key
-        self._defining_class = defining_class
-
-    def __hash__(self):
-        return hash(self._compare_key)
-
-    def __lt__(self, other):
-        return self._compare(other, operator.__lt__)
-
-    def __le__(self, other):
-        return self._compare(other, operator.__le__)
-
-    def __gt__(self, other):
-        return self._compare(other, operator.__gt__)
-
-    def __ge__(self, other):
-        return self._compare(other, operator.__ge__)
-
-    def __eq__(self, other):
-        return self._compare(other, operator.__eq__)
-
-    def __ne__(self, other):
-        return self._compare(other, operator.__ne__)
-
-    def _compare(self, other, method):
-        if not isinstance(other, self._defining_class):
-            return NotImplemented
-
-        return method(self._compare_key, other._compare_key)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/packaging.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/packaging.py
deleted file mode 100644
index 68aa86edbf012c68ceadbe67e21e5d6c9ebbc0ab..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/packaging.py
+++ /dev/null
@@ -1,94 +0,0 @@
-from __future__ import absolute_import
-
-import logging
-from email.parser import FeedParser
-
-from pip._vendor import pkg_resources
-from pip._vendor.packaging import specifiers, version
-
-from pip._internal.exceptions import NoneMetadataError
-from pip._internal.utils.misc import display_path
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Tuple
-    from email.message import Message
-    from pip._vendor.pkg_resources import Distribution
-
-
-logger = logging.getLogger(__name__)
-
-
-def check_requires_python(requires_python, version_info):
-    # type: (Optional[str], Tuple[int, ...]) -> bool
-    """
-    Check if the given Python version matches a "Requires-Python" specifier.
-
-    :param version_info: A 3-tuple of ints representing a Python
-        major-minor-micro version to check (e.g. `sys.version_info[:3]`).
-
-    :return: `True` if the given Python version satisfies the requirement.
-        Otherwise, return `False`.
-
-    :raises InvalidSpecifier: If `requires_python` has an invalid format.
-    """
-    if requires_python is None:
-        # The package provides no information
-        return True
-    requires_python_specifier = specifiers.SpecifierSet(requires_python)
-
-    python_version = version.parse('.'.join(map(str, version_info)))
-    return python_version in requires_python_specifier
-
-
-def get_metadata(dist):
-    # type: (Distribution) -> Message
-    """
-    :raises NoneMetadataError: if the distribution reports `has_metadata()`
-        True but `get_metadata()` returns None.
-    """
-    metadata_name = 'METADATA'
-    if (isinstance(dist, pkg_resources.DistInfoDistribution) and
-            dist.has_metadata(metadata_name)):
-        metadata = dist.get_metadata(metadata_name)
-    elif dist.has_metadata('PKG-INFO'):
-        metadata_name = 'PKG-INFO'
-        metadata = dist.get_metadata(metadata_name)
-    else:
-        logger.warning("No metadata found in %s", display_path(dist.location))
-        metadata = ''
-
-    if metadata is None:
-        raise NoneMetadataError(dist, metadata_name)
-
-    feed_parser = FeedParser()
-    # The following line errors out if with a "NoneType" TypeError if
-    # passed metadata=None.
-    feed_parser.feed(metadata)
-    return feed_parser.close()
-
-
-def get_requires_python(dist):
-    # type: (pkg_resources.Distribution) -> Optional[str]
-    """
-    Return the "Requires-Python" metadata for a distribution, or None
-    if not present.
-    """
-    pkg_info_dict = get_metadata(dist)
-    requires_python = pkg_info_dict.get('Requires-Python')
-
-    if requires_python is not None:
-        # Convert to a str to satisfy the type checker, since requires_python
-        # can be a Header object.
-        requires_python = str(requires_python)
-
-    return requires_python
-
-
-def get_installer(dist):
-    # type: (Distribution) -> str
-    if dist.has_metadata('INSTALLER'):
-        for line in dist.get_metadata_lines('INSTALLER'):
-            if line.strip():
-                return line.strip()
-    return ''
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/pkg_resources.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/pkg_resources.py
deleted file mode 100644
index 0bc129acc6ab582eb087be7ee186c554dc5feba1..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/pkg_resources.py
+++ /dev/null
@@ -1,44 +0,0 @@
-from pip._vendor.pkg_resources import yield_lines
-from pip._vendor.six import ensure_str
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Dict, Iterable, List
-
-
-class DictMetadata(object):
-    """IMetadataProvider that reads metadata files from a dictionary.
-    """
-    def __init__(self, metadata):
-        # type: (Dict[str, bytes]) -> None
-        self._metadata = metadata
-
-    def has_metadata(self, name):
-        # type: (str) -> bool
-        return name in self._metadata
-
-    def get_metadata(self, name):
-        # type: (str) -> str
-        try:
-            return ensure_str(self._metadata[name])
-        except UnicodeDecodeError as e:
-            # Mirrors handling done in pkg_resources.NullProvider.
-            e.reason += " in {} file".format(name)
-            raise
-
-    def get_metadata_lines(self, name):
-        # type: (str) -> Iterable[str]
-        return yield_lines(self.get_metadata(name))
-
-    def metadata_isdir(self, name):
-        # type: (str) -> bool
-        return False
-
-    def metadata_listdir(self, name):
-        # type: (str) -> List[str]
-        return []
-
-    def run_script(self, script_name, namespace):
-        # type: (str, str) -> None
-        pass
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/setuptools_build.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/setuptools_build.py
deleted file mode 100644
index 4147a650dca185dcd4491b805d0bdb0775eff924..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/setuptools_build.py
+++ /dev/null
@@ -1,181 +0,0 @@
-import sys
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional, Sequence
-
-# Shim to wrap setup.py invocation with setuptools
-#
-# We set sys.argv[0] to the path to the underlying setup.py file so
-# setuptools / distutils don't take the path to the setup.py to be "-c" when
-# invoking via the shim.  This avoids e.g. the following manifest_maker
-# warning: "warning: manifest_maker: standard file '-c' not found".
-_SETUPTOOLS_SHIM = (
-    "import sys, setuptools, tokenize; sys.argv[0] = {0!r}; __file__={0!r};"
-    "f=getattr(tokenize, 'open', open)(__file__);"
-    "code=f.read().replace('\\r\\n', '\\n');"
-    "f.close();"
-    "exec(compile(code, __file__, 'exec'))"
-)
-
-
-def make_setuptools_shim_args(
-    setup_py_path,  # type: str
-    global_options=None,  # type: Sequence[str]
-    no_user_config=False,  # type: bool
-    unbuffered_output=False  # type: bool
-):
-    # type: (...) -> List[str]
-    """
-    Get setuptools command arguments with shim wrapped setup file invocation.
-
-    :param setup_py_path: The path to setup.py to be wrapped.
-    :param global_options: Additional global options.
-    :param no_user_config: If True, disables personal user configuration.
-    :param unbuffered_output: If True, adds the unbuffered switch to the
-     argument list.
-    """
-    args = [sys.executable]
-    if unbuffered_output:
-        args += ["-u"]
-    args += ["-c", _SETUPTOOLS_SHIM.format(setup_py_path)]
-    if global_options:
-        args += global_options
-    if no_user_config:
-        args += ["--no-user-cfg"]
-    return args
-
-
-def make_setuptools_bdist_wheel_args(
-    setup_py_path,  # type: str
-    global_options,  # type: Sequence[str]
-    build_options,  # type: Sequence[str]
-    destination_dir,  # type: str
-):
-    # type: (...) -> List[str]
-    # NOTE: Eventually, we'd want to also -S to the flags here, when we're
-    # isolating. Currently, it breaks Python in virtualenvs, because it
-    # relies on site.py to find parts of the standard library outside the
-    # virtualenv.
-    args = make_setuptools_shim_args(
-        setup_py_path,
-        global_options=global_options,
-        unbuffered_output=True
-    )
-    args += ["bdist_wheel", "-d", destination_dir]
-    args += build_options
-    return args
-
-
-def make_setuptools_clean_args(
-    setup_py_path,  # type: str
-    global_options,  # type: Sequence[str]
-):
-    # type: (...) -> List[str]
-    args = make_setuptools_shim_args(
-        setup_py_path,
-        global_options=global_options,
-        unbuffered_output=True
-    )
-    args += ["clean", "--all"]
-    return args
-
-
-def make_setuptools_develop_args(
-    setup_py_path,  # type: str
-    global_options,  # type: Sequence[str]
-    install_options,  # type: Sequence[str]
-    no_user_config,  # type: bool
-    prefix,  # type: Optional[str]
-    home,  # type: Optional[str]
-    use_user_site,  # type: bool
-):
-    # type: (...) -> List[str]
-    assert not (use_user_site and prefix)
-
-    args = make_setuptools_shim_args(
-        setup_py_path,
-        global_options=global_options,
-        no_user_config=no_user_config,
-    )
-
-    args += ["develop", "--no-deps"]
-
-    args += install_options
-
-    if prefix:
-        args += ["--prefix", prefix]
-    if home is not None:
-        args += ["--home", home]
-
-    if use_user_site:
-        args += ["--user", "--prefix="]
-
-    return args
-
-
-def make_setuptools_egg_info_args(
-    setup_py_path,  # type: str
-    egg_info_dir,  # type: Optional[str]
-    no_user_config,  # type: bool
-):
-    # type: (...) -> List[str]
-    args = make_setuptools_shim_args(setup_py_path)
-    if no_user_config:
-        args += ["--no-user-cfg"]
-
-    args += ["egg_info"]
-
-    if egg_info_dir:
-        args += ["--egg-base", egg_info_dir]
-
-    return args
-
-
-def make_setuptools_install_args(
-    setup_py_path,  # type: str
-    global_options,  # type: Sequence[str]
-    install_options,  # type: Sequence[str]
-    record_filename,  # type: str
-    root,  # type: Optional[str]
-    prefix,  # type: Optional[str]
-    header_dir,  # type: Optional[str]
-    home,  # type: Optional[str]
-    use_user_site,  # type: bool
-    no_user_config,  # type: bool
-    pycompile  # type: bool
-):
-    # type: (...) -> List[str]
-    assert not (use_user_site and prefix)
-    assert not (use_user_site and root)
-
-    args = make_setuptools_shim_args(
-        setup_py_path,
-        global_options=global_options,
-        no_user_config=no_user_config,
-        unbuffered_output=True
-    )
-    args += ["install", "--record", record_filename]
-    args += ["--single-version-externally-managed"]
-
-    if root is not None:
-        args += ["--root", root]
-    if prefix is not None:
-        args += ["--prefix", prefix]
-    if home is not None:
-        args += ["--home", home]
-    if use_user_site:
-        args += ["--user", "--prefix="]
-
-    if pycompile:
-        args += ["--compile"]
-    else:
-        args += ["--no-compile"]
-
-    if header_dir:
-        args += ["--install-headers", header_dir]
-
-    args += install_options
-
-    return args
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py
deleted file mode 100644
index ea0176d341ec037e72399b43709aaa837f9c4744..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py
+++ /dev/null
@@ -1,278 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-import subprocess
-
-from pip._vendor.six.moves import shlex_quote
-
-from pip._internal.exceptions import InstallationError
-from pip._internal.utils.compat import console_to_str, str_to_display
-from pip._internal.utils.logging import subprocess_logger
-from pip._internal.utils.misc import HiddenText, path_to_display
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.ui import open_spinner
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Any, Callable, Iterable, List, Mapping, Optional, Text, Union,
-    )
-    from pip._internal.utils.ui import SpinnerInterface
-
-    CommandArgs = List[Union[str, HiddenText]]
-
-
-LOG_DIVIDER = '----------------------------------------'
-
-
-def make_command(*args):
-    # type: (Union[str, HiddenText, CommandArgs]) -> CommandArgs
-    """
-    Create a CommandArgs object.
-    """
-    command_args = []  # type: CommandArgs
-    for arg in args:
-        # Check for list instead of CommandArgs since CommandArgs is
-        # only known during type-checking.
-        if isinstance(arg, list):
-            command_args.extend(arg)
-        else:
-            # Otherwise, arg is str or HiddenText.
-            command_args.append(arg)
-
-    return command_args
-
-
-def format_command_args(args):
-    # type: (Union[List[str], CommandArgs]) -> str
-    """
-    Format command arguments for display.
-    """
-    # For HiddenText arguments, display the redacted form by calling str().
-    # Also, we don't apply str() to arguments that aren't HiddenText since
-    # this can trigger a UnicodeDecodeError in Python 2 if the argument
-    # has type unicode and includes a non-ascii character.  (The type
-    # checker doesn't ensure the annotations are correct in all cases.)
-    return ' '.join(
-        shlex_quote(str(arg)) if isinstance(arg, HiddenText)
-        else shlex_quote(arg) for arg in args
-    )
-
-
-def reveal_command_args(args):
-    # type: (Union[List[str], CommandArgs]) -> List[str]
-    """
-    Return the arguments in their raw, unredacted form.
-    """
-    return [
-        arg.secret if isinstance(arg, HiddenText) else arg for arg in args
-    ]
-
-
-def make_subprocess_output_error(
-    cmd_args,     # type: Union[List[str], CommandArgs]
-    cwd,          # type: Optional[str]
-    lines,        # type: List[Text]
-    exit_status,  # type: int
-):
-    # type: (...) -> Text
-    """
-    Create and return the error message to use to log a subprocess error
-    with command output.
-
-    :param lines: A list of lines, each ending with a newline.
-    """
-    command = format_command_args(cmd_args)
-    # Convert `command` and `cwd` to text (unicode in Python 2) so we can use
-    # them as arguments in the unicode format string below. This avoids
-    # "UnicodeDecodeError: 'ascii' codec can't decode byte ..." in Python 2
-    # if either contains a non-ascii character.
-    command_display = str_to_display(command, desc='command bytes')
-    cwd_display = path_to_display(cwd)
-
-    # We know the joined output value ends in a newline.
-    output = ''.join(lines)
-    msg = (
-        # Use a unicode string to avoid "UnicodeEncodeError: 'ascii'
-        # codec can't encode character ..." in Python 2 when a format
-        # argument (e.g. `output`) has a non-ascii character.
-        u'Command errored out with exit status {exit_status}:\n'
-        ' command: {command_display}\n'
-        '     cwd: {cwd_display}\n'
-        'Complete output ({line_count} lines):\n{output}{divider}'
-    ).format(
-        exit_status=exit_status,
-        command_display=command_display,
-        cwd_display=cwd_display,
-        line_count=len(lines),
-        output=output,
-        divider=LOG_DIVIDER,
-    )
-    return msg
-
-
-def call_subprocess(
-    cmd,  # type: Union[List[str], CommandArgs]
-    show_stdout=False,  # type: bool
-    cwd=None,  # type: Optional[str]
-    on_returncode='raise',  # type: str
-    extra_ok_returncodes=None,  # type: Optional[Iterable[int]]
-    command_desc=None,  # type: Optional[str]
-    extra_environ=None,  # type: Optional[Mapping[str, Any]]
-    unset_environ=None,  # type: Optional[Iterable[str]]
-    spinner=None,  # type: Optional[SpinnerInterface]
-    log_failed_cmd=True  # type: Optional[bool]
-):
-    # type: (...) -> Text
-    """
-    Args:
-      show_stdout: if true, use INFO to log the subprocess's stderr and
-        stdout streams.  Otherwise, use DEBUG.  Defaults to False.
-      extra_ok_returncodes: an iterable of integer return codes that are
-        acceptable, in addition to 0. Defaults to None, which means [].
-      unset_environ: an iterable of environment variable names to unset
-        prior to calling subprocess.Popen().
-      log_failed_cmd: if false, failed commands are not logged, only raised.
-    """
-    if extra_ok_returncodes is None:
-        extra_ok_returncodes = []
-    if unset_environ is None:
-        unset_environ = []
-    # Most places in pip use show_stdout=False. What this means is--
-    #
-    # - We connect the child's output (combined stderr and stdout) to a
-    #   single pipe, which we read.
-    # - We log this output to stderr at DEBUG level as it is received.
-    # - If DEBUG logging isn't enabled (e.g. if --verbose logging wasn't
-    #   requested), then we show a spinner so the user can still see the
-    #   subprocess is in progress.
-    # - If the subprocess exits with an error, we log the output to stderr
-    #   at ERROR level if it hasn't already been displayed to the console
-    #   (e.g. if --verbose logging wasn't enabled).  This way we don't log
-    #   the output to the console twice.
-    #
-    # If show_stdout=True, then the above is still done, but with DEBUG
-    # replaced by INFO.
-    if show_stdout:
-        # Then log the subprocess output at INFO level.
-        log_subprocess = subprocess_logger.info
-        used_level = logging.INFO
-    else:
-        # Then log the subprocess output using DEBUG.  This also ensures
-        # it will be logged to the log file (aka user_log), if enabled.
-        log_subprocess = subprocess_logger.debug
-        used_level = logging.DEBUG
-
-    # Whether the subprocess will be visible in the console.
-    showing_subprocess = subprocess_logger.getEffectiveLevel() <= used_level
-
-    # Only use the spinner if we're not showing the subprocess output
-    # and we have a spinner.
-    use_spinner = not showing_subprocess and spinner is not None
-
-    if command_desc is None:
-        command_desc = format_command_args(cmd)
-
-    log_subprocess("Running command %s", command_desc)
-    env = os.environ.copy()
-    if extra_environ:
-        env.update(extra_environ)
-    for name in unset_environ:
-        env.pop(name, None)
-    try:
-        proc = subprocess.Popen(
-            # Convert HiddenText objects to the underlying str.
-            reveal_command_args(cmd),
-            stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
-            stdout=subprocess.PIPE, cwd=cwd, env=env,
-        )
-        proc.stdin.close()
-    except Exception as exc:
-        if log_failed_cmd:
-            subprocess_logger.critical(
-                "Error %s while executing command %s", exc, command_desc,
-            )
-        raise
-    all_output = []
-    while True:
-        # The "line" value is a unicode string in Python 2.
-        line = console_to_str(proc.stdout.readline())
-        if not line:
-            break
-        line = line.rstrip()
-        all_output.append(line + '\n')
-
-        # Show the line immediately.
-        log_subprocess(line)
-        # Update the spinner.
-        if use_spinner:
-            spinner.spin()
-    try:
-        proc.wait()
-    finally:
-        if proc.stdout:
-            proc.stdout.close()
-    proc_had_error = (
-        proc.returncode and proc.returncode not in extra_ok_returncodes
-    )
-    if use_spinner:
-        if proc_had_error:
-            spinner.finish("error")
-        else:
-            spinner.finish("done")
-    if proc_had_error:
-        if on_returncode == 'raise':
-            if not showing_subprocess and log_failed_cmd:
-                # Then the subprocess streams haven't been logged to the
-                # console yet.
-                msg = make_subprocess_output_error(
-                    cmd_args=cmd,
-                    cwd=cwd,
-                    lines=all_output,
-                    exit_status=proc.returncode,
-                )
-                subprocess_logger.error(msg)
-            exc_msg = (
-                'Command errored out with exit status {}: {} '
-                'Check the logs for full command output.'
-            ).format(proc.returncode, command_desc)
-            raise InstallationError(exc_msg)
-        elif on_returncode == 'warn':
-            subprocess_logger.warning(
-                'Command "%s" had error code %s in %s',
-                command_desc, proc.returncode, cwd,
-            )
-        elif on_returncode == 'ignore':
-            pass
-        else:
-            raise ValueError('Invalid value: on_returncode=%s' %
-                             repr(on_returncode))
-    return ''.join(all_output)
-
-
-def runner_with_spinner_message(message):
-    # type: (str) -> Callable[..., None]
-    """Provide a subprocess_runner that shows a spinner message.
-
-    Intended for use with for pep517's Pep517HookCaller. Thus, the runner has
-    an API that matches what's expected by Pep517HookCaller.subprocess_runner.
-    """
-
-    def runner(
-        cmd,  # type: List[str]
-        cwd=None,  # type: Optional[str]
-        extra_environ=None  # type: Optional[Mapping[str, Any]]
-    ):
-        # type: (...) -> None
-        with open_spinner(message) as spinner:
-            call_subprocess(
-                cmd,
-                cwd=cwd,
-                extra_environ=extra_environ,
-                spinner=spinner,
-            )
-
-    return runner
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/temp_dir.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/temp_dir.py
deleted file mode 100644
index 65e41bc70e2d8184b8917b539726556c84f2c0df..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/temp_dir.py
+++ /dev/null
@@ -1,250 +0,0 @@
-from __future__ import absolute_import
-
-import errno
-import itertools
-import logging
-import os.path
-import tempfile
-from contextlib import contextmanager
-
-from pip._vendor.contextlib2 import ExitStack
-
-from pip._internal.utils.misc import rmtree
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any, Dict, Iterator, Optional, TypeVar
-
-    _T = TypeVar('_T', bound='TempDirectory')
-
-
-logger = logging.getLogger(__name__)
-
-
-_tempdir_manager = None  # type: Optional[ExitStack]
-
-
-@contextmanager
-def global_tempdir_manager():
-    # type: () -> Iterator[None]
-    global _tempdir_manager
-    with ExitStack() as stack:
-        old_tempdir_manager, _tempdir_manager = _tempdir_manager, stack
-        try:
-            yield
-        finally:
-            _tempdir_manager = old_tempdir_manager
-
-
-class TempDirectoryTypeRegistry(object):
-    """Manages temp directory behavior
-    """
-
-    def __init__(self):
-        # type: () -> None
-        self._should_delete = {}  # type: Dict[str, bool]
-
-    def set_delete(self, kind, value):
-        # type: (str, bool) -> None
-        """Indicate whether a TempDirectory of the given kind should be
-        auto-deleted.
-        """
-        self._should_delete[kind] = value
-
-    def get_delete(self, kind):
-        # type: (str) -> bool
-        """Get configured auto-delete flag for a given TempDirectory type,
-        default True.
-        """
-        return self._should_delete.get(kind, True)
-
-
-_tempdir_registry = None  # type: Optional[TempDirectoryTypeRegistry]
-
-
-@contextmanager
-def tempdir_registry():
-    # type: () -> Iterator[TempDirectoryTypeRegistry]
-    """Provides a scoped global tempdir registry that can be used to dictate
-    whether directories should be deleted.
-    """
-    global _tempdir_registry
-    old_tempdir_registry = _tempdir_registry
-    _tempdir_registry = TempDirectoryTypeRegistry()
-    try:
-        yield _tempdir_registry
-    finally:
-        _tempdir_registry = old_tempdir_registry
-
-
-class TempDirectory(object):
-    """Helper class that owns and cleans up a temporary directory.
-
-    This class can be used as a context manager or as an OO representation of a
-    temporary directory.
-
-    Attributes:
-        path
-            Location to the created temporary directory
-        delete
-            Whether the directory should be deleted when exiting
-            (when used as a contextmanager)
-
-    Methods:
-        cleanup()
-            Deletes the temporary directory
-
-    When used as a context manager, if the delete attribute is True, on
-    exiting the context the temporary directory is deleted.
-    """
-
-    def __init__(
-        self,
-        path=None,    # type: Optional[str]
-        delete=None,  # type: Optional[bool]
-        kind="temp",  # type: str
-        globally_managed=False,  # type: bool
-    ):
-        super(TempDirectory, self).__init__()
-
-        # If we were given an explicit directory, resolve delete option now.
-        # Otherwise we wait until cleanup and see what tempdir_registry says.
-        if path is not None and delete is None:
-            delete = False
-
-        if path is None:
-            path = self._create(kind)
-
-        self._path = path
-        self._deleted = False
-        self.delete = delete
-        self.kind = kind
-
-        if globally_managed:
-            assert _tempdir_manager is not None
-            _tempdir_manager.enter_context(self)
-
-    @property
-    def path(self):
-        # type: () -> str
-        assert not self._deleted, (
-            "Attempted to access deleted path: {}".format(self._path)
-        )
-        return self._path
-
-    def __repr__(self):
-        # type: () -> str
-        return "<{} {!r}>".format(self.__class__.__name__, self.path)
-
-    def __enter__(self):
-        # type: (_T) -> _T
-        return self
-
-    def __exit__(self, exc, value, tb):
-        # type: (Any, Any, Any) -> None
-        if self.delete is not None:
-            delete = self.delete
-        elif _tempdir_registry:
-            delete = _tempdir_registry.get_delete(self.kind)
-        else:
-            delete = True
-
-        if delete:
-            self.cleanup()
-
-    def _create(self, kind):
-        # type: (str) -> str
-        """Create a temporary directory and store its path in self.path
-        """
-        # We realpath here because some systems have their default tmpdir
-        # symlinked to another directory.  This tends to confuse build
-        # scripts, so we canonicalize the path by traversing potential
-        # symlinks here.
-        path = os.path.realpath(
-            tempfile.mkdtemp(prefix="pip-{}-".format(kind))
-        )
-        logger.debug("Created temporary directory: {}".format(path))
-        return path
-
-    def cleanup(self):
-        # type: () -> None
-        """Remove the temporary directory created and reset state
-        """
-        self._deleted = True
-        if os.path.exists(self._path):
-            rmtree(self._path)
-
-
-class AdjacentTempDirectory(TempDirectory):
-    """Helper class that creates a temporary directory adjacent to a real one.
-
-    Attributes:
-        original
-            The original directory to create a temp directory for.
-        path
-            After calling create() or entering, contains the full
-            path to the temporary directory.
-        delete
-            Whether the directory should be deleted when exiting
-            (when used as a contextmanager)
-
-    """
-    # The characters that may be used to name the temp directory
-    # We always prepend a ~ and then rotate through these until
-    # a usable name is found.
-    # pkg_resources raises a different error for .dist-info folder
-    # with leading '-' and invalid metadata
-    LEADING_CHARS = "-~.=%0123456789"
-
-    def __init__(self, original, delete=None):
-        # type: (str, Optional[bool]) -> None
-        self.original = original.rstrip('/\\')
-        super(AdjacentTempDirectory, self).__init__(delete=delete)
-
-    @classmethod
-    def _generate_names(cls, name):
-        # type: (str) -> Iterator[str]
-        """Generates a series of temporary names.
-
-        The algorithm replaces the leading characters in the name
-        with ones that are valid filesystem characters, but are not
-        valid package names (for both Python and pip definitions of
-        package).
-        """
-        for i in range(1, len(name)):
-            for candidate in itertools.combinations_with_replacement(
-                    cls.LEADING_CHARS, i - 1):
-                new_name = '~' + ''.join(candidate) + name[i:]
-                if new_name != name:
-                    yield new_name
-
-        # If we make it this far, we will have to make a longer name
-        for i in range(len(cls.LEADING_CHARS)):
-            for candidate in itertools.combinations_with_replacement(
-                    cls.LEADING_CHARS, i):
-                new_name = '~' + ''.join(candidate) + name
-                if new_name != name:
-                    yield new_name
-
-    def _create(self, kind):
-        # type: (str) -> str
-        root, name = os.path.split(self.original)
-        for candidate in self._generate_names(name):
-            path = os.path.join(root, candidate)
-            try:
-                os.mkdir(path)
-            except OSError as ex:
-                # Continue if the name exists already
-                if ex.errno != errno.EEXIST:
-                    raise
-            else:
-                path = os.path.realpath(path)
-                break
-        else:
-            # Final fallback on the default behavior.
-            path = os.path.realpath(
-                tempfile.mkdtemp(prefix="pip-{}-".format(kind))
-            )
-
-        logger.debug("Created temporary directory: {}".format(path))
-        return path
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/typing.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/typing.py
deleted file mode 100644
index 8505a29b15d5f8a3565a52796c4e39cc6b826ffc..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/typing.py
+++ /dev/null
@@ -1,38 +0,0 @@
-"""For neatly implementing static typing in pip.
-
-`mypy` - the static type analysis tool we use - uses the `typing` module, which
-provides core functionality fundamental to mypy's functioning.
-
-Generally, `typing` would be imported at runtime and used in that fashion -
-it acts as a no-op at runtime and does not have any run-time overhead by
-design.
-
-As it turns out, `typing` is not vendorable - it uses separate sources for
-Python 2/Python 3. Thus, this codebase can not expect it to be present.
-To work around this, mypy allows the typing import to be behind a False-y
-optional to prevent it from running at runtime and type-comments can be used
-to remove the need for the types to be accessible directly during runtime.
-
-This module provides the False-y guard in a nicely named fashion so that a
-curious maintainer can reach here to read this.
-
-In pip, all static-typing related imports should be guarded as follows:
-
-    from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-    if MYPY_CHECK_RUNNING:
-        from typing import ...
-
-Ref: https://github.com/python/mypy/issues/3216
-"""
-
-MYPY_CHECK_RUNNING = False
-
-
-if MYPY_CHECK_RUNNING:
-    from typing import cast
-else:
-    # typing's cast() is needed at runtime, but we don't want to import typing.
-    # Thus, we use a dummy no-op version, which we tell mypy to ignore.
-    def cast(type_, value):  # type: ignore
-        return value
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/ui.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/ui.py
deleted file mode 100644
index 87782aa641d5dfe4845f751c8fcc05658da91501..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/ui.py
+++ /dev/null
@@ -1,428 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import, division
-
-import contextlib
-import itertools
-import logging
-import sys
-import time
-from signal import SIGINT, default_int_handler, signal
-
-from pip._vendor import six
-from pip._vendor.progress import HIDE_CURSOR, SHOW_CURSOR
-from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
-from pip._vendor.progress.spinner import Spinner
-
-from pip._internal.utils.compat import WINDOWS
-from pip._internal.utils.logging import get_indentation
-from pip._internal.utils.misc import format_size
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Any, Iterator, IO
-
-try:
-    from pip._vendor import colorama
-# Lots of different errors can come from this, including SystemError and
-# ImportError.
-except Exception:
-    colorama = None
-
-logger = logging.getLogger(__name__)
-
-
-def _select_progress_class(preferred, fallback):
-    encoding = getattr(preferred.file, "encoding", None)
-
-    # If we don't know what encoding this file is in, then we'll just assume
-    # that it doesn't support unicode and use the ASCII bar.
-    if not encoding:
-        return fallback
-
-    # Collect all of the possible characters we want to use with the preferred
-    # bar.
-    characters = [
-        getattr(preferred, "empty_fill", six.text_type()),
-        getattr(preferred, "fill", six.text_type()),
-    ]
-    characters += list(getattr(preferred, "phases", []))
-
-    # Try to decode the characters we're using for the bar using the encoding
-    # of the given file, if this works then we'll assume that we can use the
-    # fancier bar and if not we'll fall back to the plaintext bar.
-    try:
-        six.text_type().join(characters).encode(encoding)
-    except UnicodeEncodeError:
-        return fallback
-    else:
-        return preferred
-
-
-_BaseBar = _select_progress_class(IncrementalBar, Bar)  # type: Any
-
-
-class InterruptibleMixin(object):
-    """
-    Helper to ensure that self.finish() gets called on keyboard interrupt.
-
-    This allows downloads to be interrupted without leaving temporary state
-    (like hidden cursors) behind.
-
-    This class is similar to the progress library's existing SigIntMixin
-    helper, but as of version 1.2, that helper has the following problems:
-
-    1. It calls sys.exit().
-    2. It discards the existing SIGINT handler completely.
-    3. It leaves its own handler in place even after an uninterrupted finish,
-       which will have unexpected delayed effects if the user triggers an
-       unrelated keyboard interrupt some time after a progress-displaying
-       download has already completed, for example.
-    """
-
-    def __init__(self, *args, **kwargs):
-        """
-        Save the original SIGINT handler for later.
-        """
-        super(InterruptibleMixin, self).__init__(*args, **kwargs)
-
-        self.original_handler = signal(SIGINT, self.handle_sigint)
-
-        # If signal() returns None, the previous handler was not installed from
-        # Python, and we cannot restore it. This probably should not happen,
-        # but if it does, we must restore something sensible instead, at least.
-        # The least bad option should be Python's default SIGINT handler, which
-        # just raises KeyboardInterrupt.
-        if self.original_handler is None:
-            self.original_handler = default_int_handler
-
-    def finish(self):
-        """
-        Restore the original SIGINT handler after finishing.
-
-        This should happen regardless of whether the progress display finishes
-        normally, or gets interrupted.
-        """
-        super(InterruptibleMixin, self).finish()
-        signal(SIGINT, self.original_handler)
-
-    def handle_sigint(self, signum, frame):
-        """
-        Call self.finish() before delegating to the original SIGINT handler.
-
-        This handler should only be in place while the progress display is
-        active.
-        """
-        self.finish()
-        self.original_handler(signum, frame)
-
-
-class SilentBar(Bar):
-
-    def update(self):
-        pass
-
-
-class BlueEmojiBar(IncrementalBar):
-
-    suffix = "%(percent)d%%"
-    bar_prefix = " "
-    bar_suffix = " "
-    phases = (u"\U0001F539", u"\U0001F537", u"\U0001F535")  # type: Any
-
-
-class DownloadProgressMixin(object):
-
-    def __init__(self, *args, **kwargs):
-        super(DownloadProgressMixin, self).__init__(*args, **kwargs)
-        self.message = (" " * (get_indentation() + 2)) + self.message
-
-    @property
-    def downloaded(self):
-        return format_size(self.index)
-
-    @property
-    def download_speed(self):
-        # Avoid zero division errors...
-        if self.avg == 0.0:
-            return "..."
-        return format_size(1 / self.avg) + "/s"
-
-    @property
-    def pretty_eta(self):
-        if self.eta:
-            return "eta %s" % self.eta_td
-        return ""
-
-    def iter(self, it):
-        for x in it:
-            yield x
-            self.next(len(x))
-        self.finish()
-
-
-class WindowsMixin(object):
-
-    def __init__(self, *args, **kwargs):
-        # The Windows terminal does not support the hide/show cursor ANSI codes
-        # even with colorama. So we'll ensure that hide_cursor is False on
-        # Windows.
-        # This call needs to go before the super() call, so that hide_cursor
-        # is set in time. The base progress bar class writes the "hide cursor"
-        # code to the terminal in its init, so if we don't set this soon
-        # enough, we get a "hide" with no corresponding "show"...
-        if WINDOWS and self.hide_cursor:
-            self.hide_cursor = False
-
-        super(WindowsMixin, self).__init__(*args, **kwargs)
-
-        # Check if we are running on Windows and we have the colorama module,
-        # if we do then wrap our file with it.
-        if WINDOWS and colorama:
-            self.file = colorama.AnsiToWin32(self.file)
-            # The progress code expects to be able to call self.file.isatty()
-            # but the colorama.AnsiToWin32() object doesn't have that, so we'll
-            # add it.
-            self.file.isatty = lambda: self.file.wrapped.isatty()
-            # The progress code expects to be able to call self.file.flush()
-            # but the colorama.AnsiToWin32() object doesn't have that, so we'll
-            # add it.
-            self.file.flush = lambda: self.file.wrapped.flush()
-
-
-class BaseDownloadProgressBar(WindowsMixin, InterruptibleMixin,
-                              DownloadProgressMixin):
-
-    file = sys.stdout
-    message = "%(percent)d%%"
-    suffix = "%(downloaded)s %(download_speed)s %(pretty_eta)s"
-
-# NOTE: The "type: ignore" comments on the following classes are there to
-#       work around https://github.com/python/typing/issues/241
-
-
-class DefaultDownloadProgressBar(BaseDownloadProgressBar,
-                                 _BaseBar):
-    pass
-
-
-class DownloadSilentBar(BaseDownloadProgressBar, SilentBar):  # type: ignore
-    pass
-
-
-class DownloadBar(BaseDownloadProgressBar,  # type: ignore
-                  Bar):
-    pass
-
-
-class DownloadFillingCirclesBar(BaseDownloadProgressBar,  # type: ignore
-                                FillingCirclesBar):
-    pass
-
-
-class DownloadBlueEmojiProgressBar(BaseDownloadProgressBar,  # type: ignore
-                                   BlueEmojiBar):
-    pass
-
-
-class DownloadProgressSpinner(WindowsMixin, InterruptibleMixin,
-                              DownloadProgressMixin, Spinner):
-
-    file = sys.stdout
-    suffix = "%(downloaded)s %(download_speed)s"
-
-    def next_phase(self):
-        if not hasattr(self, "_phaser"):
-            self._phaser = itertools.cycle(self.phases)
-        return next(self._phaser)
-
-    def update(self):
-        message = self.message % self
-        phase = self.next_phase()
-        suffix = self.suffix % self
-        line = ''.join([
-            message,
-            " " if message else "",
-            phase,
-            " " if suffix else "",
-            suffix,
-        ])
-
-        self.writeln(line)
-
-
-BAR_TYPES = {
-    "off": (DownloadSilentBar, DownloadSilentBar),
-    "on": (DefaultDownloadProgressBar, DownloadProgressSpinner),
-    "ascii": (DownloadBar, DownloadProgressSpinner),
-    "pretty": (DownloadFillingCirclesBar, DownloadProgressSpinner),
-    "emoji": (DownloadBlueEmojiProgressBar, DownloadProgressSpinner)
-}
-
-
-def DownloadProgressProvider(progress_bar, max=None):
-    if max is None or max == 0:
-        return BAR_TYPES[progress_bar][1]().iter
-    else:
-        return BAR_TYPES[progress_bar][0](max=max).iter
-
-
-################################################################
-# Generic "something is happening" spinners
-#
-# We don't even try using progress.spinner.Spinner here because it's actually
-# simpler to reimplement from scratch than to coerce their code into doing
-# what we need.
-################################################################
-
-@contextlib.contextmanager
-def hidden_cursor(file):
-    # type: (IO[Any]) -> Iterator[None]
-    # The Windows terminal does not support the hide/show cursor ANSI codes,
-    # even via colorama. So don't even try.
-    if WINDOWS:
-        yield
-    # We don't want to clutter the output with control characters if we're
-    # writing to a file, or if the user is running with --quiet.
-    # See https://github.com/pypa/pip/issues/3418
-    elif not file.isatty() or logger.getEffectiveLevel() > logging.INFO:
-        yield
-    else:
-        file.write(HIDE_CURSOR)
-        try:
-            yield
-        finally:
-            file.write(SHOW_CURSOR)
-
-
-class RateLimiter(object):
-    def __init__(self, min_update_interval_seconds):
-        # type: (float) -> None
-        self._min_update_interval_seconds = min_update_interval_seconds
-        self._last_update = 0  # type: float
-
-    def ready(self):
-        # type: () -> bool
-        now = time.time()
-        delta = now - self._last_update
-        return delta >= self._min_update_interval_seconds
-
-    def reset(self):
-        # type: () -> None
-        self._last_update = time.time()
-
-
-class SpinnerInterface(object):
-    def spin(self):
-        # type: () -> None
-        raise NotImplementedError()
-
-    def finish(self, final_status):
-        # type: (str) -> None
-        raise NotImplementedError()
-
-
-class InteractiveSpinner(SpinnerInterface):
-    def __init__(self, message, file=None, spin_chars="-\\|/",
-                 # Empirically, 8 updates/second looks nice
-                 min_update_interval_seconds=0.125):
-        self._message = message
-        if file is None:
-            file = sys.stdout
-        self._file = file
-        self._rate_limiter = RateLimiter(min_update_interval_seconds)
-        self._finished = False
-
-        self._spin_cycle = itertools.cycle(spin_chars)
-
-        self._file.write(" " * get_indentation() + self._message + " ... ")
-        self._width = 0
-
-    def _write(self, status):
-        assert not self._finished
-        # Erase what we wrote before by backspacing to the beginning, writing
-        # spaces to overwrite the old text, and then backspacing again
-        backup = "\b" * self._width
-        self._file.write(backup + " " * self._width + backup)
-        # Now we have a blank slate to add our status
-        self._file.write(status)
-        self._width = len(status)
-        self._file.flush()
-        self._rate_limiter.reset()
-
-    def spin(self):
-        # type: () -> None
-        if self._finished:
-            return
-        if not self._rate_limiter.ready():
-            return
-        self._write(next(self._spin_cycle))
-
-    def finish(self, final_status):
-        # type: (str) -> None
-        if self._finished:
-            return
-        self._write(final_status)
-        self._file.write("\n")
-        self._file.flush()
-        self._finished = True
-
-
-# Used for dumb terminals, non-interactive installs (no tty), etc.
-# We still print updates occasionally (once every 60 seconds by default) to
-# act as a keep-alive for systems like Travis-CI that take lack-of-output as
-# an indication that a task has frozen.
-class NonInteractiveSpinner(SpinnerInterface):
-    def __init__(self, message, min_update_interval_seconds=60):
-        # type: (str, float) -> None
-        self._message = message
-        self._finished = False
-        self._rate_limiter = RateLimiter(min_update_interval_seconds)
-        self._update("started")
-
-    def _update(self, status):
-        assert not self._finished
-        self._rate_limiter.reset()
-        logger.info("%s: %s", self._message, status)
-
-    def spin(self):
-        # type: () -> None
-        if self._finished:
-            return
-        if not self._rate_limiter.ready():
-            return
-        self._update("still running...")
-
-    def finish(self, final_status):
-        # type: (str) -> None
-        if self._finished:
-            return
-        self._update("finished with status '%s'" % (final_status,))
-        self._finished = True
-
-
-@contextlib.contextmanager
-def open_spinner(message):
-    # type: (str) -> Iterator[SpinnerInterface]
-    # Interactive spinner goes directly to sys.stdout rather than being routed
-    # through the logging system, but it acts like it has level INFO,
-    # i.e. it's only displayed if we're at level INFO or better.
-    # Non-interactive spinner goes through the logging system, so it is always
-    # in sync with logging configuration.
-    if sys.stdout.isatty() and logger.getEffectiveLevel() <= logging.INFO:
-        spinner = InteractiveSpinner(message)  # type: SpinnerInterface
-    else:
-        spinner = NonInteractiveSpinner(message)
-    try:
-        with hidden_cursor(sys.stdout):
-            yield spinner
-    except KeyboardInterrupt:
-        spinner.finish("canceled")
-        raise
-    except Exception:
-        spinner.finish("error")
-        raise
-    else:
-        spinner.finish("done")
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py
deleted file mode 100644
index 7252dc217bfaece6fedbaf835cecbb2a06cdcbb0..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py
+++ /dev/null
@@ -1,272 +0,0 @@
-"""Utilities related archives.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-import shutil
-import stat
-import tarfile
-import zipfile
-
-from pip._internal.exceptions import InstallationError
-from pip._internal.utils.filetypes import (
-    BZ2_EXTENSIONS,
-    TAR_EXTENSIONS,
-    XZ_EXTENSIONS,
-    ZIP_EXTENSIONS,
-)
-from pip._internal.utils.misc import ensure_dir
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Iterable, List, Optional, Text, Union
-
-
-logger = logging.getLogger(__name__)
-
-
-SUPPORTED_EXTENSIONS = ZIP_EXTENSIONS + TAR_EXTENSIONS
-
-try:
-    import bz2  # noqa
-    SUPPORTED_EXTENSIONS += BZ2_EXTENSIONS
-except ImportError:
-    logger.debug('bz2 module is not available')
-
-try:
-    # Only for Python 3.3+
-    import lzma  # noqa
-    SUPPORTED_EXTENSIONS += XZ_EXTENSIONS
-except ImportError:
-    logger.debug('lzma module is not available')
-
-
-def current_umask():
-    """Get the current umask which involves having to set it temporarily."""
-    mask = os.umask(0)
-    os.umask(mask)
-    return mask
-
-
-def split_leading_dir(path):
-    # type: (Union[str, Text]) -> List[Union[str, Text]]
-    path = path.lstrip('/').lstrip('\\')
-    if (
-        '/' in path and (
-            ('\\' in path and path.find('/') < path.find('\\')) or
-            '\\' not in path
-        )
-    ):
-        return path.split('/', 1)
-    elif '\\' in path:
-        return path.split('\\', 1)
-    else:
-        return [path, '']
-
-
-def has_leading_dir(paths):
-    # type: (Iterable[Union[str, Text]]) -> bool
-    """Returns true if all the paths have the same leading path name
-    (i.e., everything is in one subdirectory in an archive)"""
-    common_prefix = None
-    for path in paths:
-        prefix, rest = split_leading_dir(path)
-        if not prefix:
-            return False
-        elif common_prefix is None:
-            common_prefix = prefix
-        elif prefix != common_prefix:
-            return False
-    return True
-
-
-def is_within_directory(directory, target):
-    # type: ((Union[str, Text]), (Union[str, Text])) -> bool
-    """
-    Return true if the absolute path of target is within the directory
-    """
-    abs_directory = os.path.abspath(directory)
-    abs_target = os.path.abspath(target)
-
-    prefix = os.path.commonprefix([abs_directory, abs_target])
-    return prefix == abs_directory
-
-
-def unzip_file(filename, location, flatten=True):
-    # type: (str, str, bool) -> None
-    """
-    Unzip the file (with path `filename`) to the destination `location`.  All
-    files are written based on system defaults and umask (i.e. permissions are
-    not preserved), except that regular file members with any execute
-    permissions (user, group, or world) have "chmod +x" applied after being
-    written. Note that for windows, any execute changes using os.chmod are
-    no-ops per the python docs.
-    """
-    ensure_dir(location)
-    zipfp = open(filename, 'rb')
-    try:
-        zip = zipfile.ZipFile(zipfp, allowZip64=True)
-        leading = has_leading_dir(zip.namelist()) and flatten
-        for info in zip.infolist():
-            name = info.filename
-            fn = name
-            if leading:
-                fn = split_leading_dir(name)[1]
-            fn = os.path.join(location, fn)
-            dir = os.path.dirname(fn)
-            if not is_within_directory(location, fn):
-                message = (
-                    'The zip file ({}) has a file ({}) trying to install '
-                    'outside target directory ({})'
-                )
-                raise InstallationError(message.format(filename, fn, location))
-            if fn.endswith('/') or fn.endswith('\\'):
-                # A directory
-                ensure_dir(fn)
-            else:
-                ensure_dir(dir)
-                # Don't use read() to avoid allocating an arbitrarily large
-                # chunk of memory for the file's content
-                fp = zip.open(name)
-                try:
-                    with open(fn, 'wb') as destfp:
-                        shutil.copyfileobj(fp, destfp)
-                finally:
-                    fp.close()
-                    mode = info.external_attr >> 16
-                    # if mode and regular file and any execute permissions for
-                    # user/group/world?
-                    if mode and stat.S_ISREG(mode) and mode & 0o111:
-                        # make dest file have execute for user/group/world
-                        # (chmod +x) no-op on windows per python docs
-                        os.chmod(fn, (0o777 - current_umask() | 0o111))
-    finally:
-        zipfp.close()
-
-
-def untar_file(filename, location):
-    # type: (str, str) -> None
-    """
-    Untar the file (with path `filename`) to the destination `location`.
-    All files are written based on system defaults and umask (i.e. permissions
-    are not preserved), except that regular file members with any execute
-    permissions (user, group, or world) have "chmod +x" applied after being
-    written.  Note that for windows, any execute changes using os.chmod are
-    no-ops per the python docs.
-    """
-    ensure_dir(location)
-    if filename.lower().endswith('.gz') or filename.lower().endswith('.tgz'):
-        mode = 'r:gz'
-    elif filename.lower().endswith(BZ2_EXTENSIONS):
-        mode = 'r:bz2'
-    elif filename.lower().endswith(XZ_EXTENSIONS):
-        mode = 'r:xz'
-    elif filename.lower().endswith('.tar'):
-        mode = 'r'
-    else:
-        logger.warning(
-            'Cannot determine compression type for file %s', filename,
-        )
-        mode = 'r:*'
-    tar = tarfile.open(filename, mode)
-    try:
-        leading = has_leading_dir([
-            member.name for member in tar.getmembers()
-        ])
-        for member in tar.getmembers():
-            fn = member.name
-            if leading:
-                # https://github.com/python/mypy/issues/1174
-                fn = split_leading_dir(fn)[1]  # type: ignore
-            path = os.path.join(location, fn)
-            if not is_within_directory(location, path):
-                message = (
-                    'The tar file ({}) has a file ({}) trying to install '
-                    'outside target directory ({})'
-                )
-                raise InstallationError(
-                    message.format(filename, path, location)
-                )
-            if member.isdir():
-                ensure_dir(path)
-            elif member.issym():
-                try:
-                    # https://github.com/python/typeshed/issues/2673
-                    tar._extract_member(member, path)  # type: ignore
-                except Exception as exc:
-                    # Some corrupt tar files seem to produce this
-                    # (specifically bad symlinks)
-                    logger.warning(
-                        'In the tar file %s the member %s is invalid: %s',
-                        filename, member.name, exc,
-                    )
-                    continue
-            else:
-                try:
-                    fp = tar.extractfile(member)
-                except (KeyError, AttributeError) as exc:
-                    # Some corrupt tar files seem to produce this
-                    # (specifically bad symlinks)
-                    logger.warning(
-                        'In the tar file %s the member %s is invalid: %s',
-                        filename, member.name, exc,
-                    )
-                    continue
-                ensure_dir(os.path.dirname(path))
-                with open(path, 'wb') as destfp:
-                    shutil.copyfileobj(fp, destfp)
-                fp.close()
-                # Update the timestamp (useful for cython compiled files)
-                # https://github.com/python/typeshed/issues/2673
-                tar.utime(member, path)  # type: ignore
-                # member have any execute permissions for user/group/world?
-                if member.mode & 0o111:
-                    # make dest file have execute for user/group/world
-                    # no-op on windows per python docs
-                    os.chmod(path, (0o777 - current_umask() | 0o111))
-    finally:
-        tar.close()
-
-
-def unpack_file(
-        filename,  # type: str
-        location,  # type: str
-        content_type=None,  # type: Optional[str]
-):
-    # type: (...) -> None
-    filename = os.path.realpath(filename)
-    if (
-        content_type == 'application/zip' or
-        filename.lower().endswith(ZIP_EXTENSIONS) or
-        zipfile.is_zipfile(filename)
-    ):
-        unzip_file(
-            filename,
-            location,
-            flatten=not filename.endswith('.whl')
-        )
-    elif (
-        content_type == 'application/x-gzip' or
-        tarfile.is_tarfile(filename) or
-        filename.lower().endswith(
-            TAR_EXTENSIONS + BZ2_EXTENSIONS + XZ_EXTENSIONS
-        )
-    ):
-        untar_file(filename, location)
-    else:
-        # FIXME: handle?
-        # FIXME: magic signatures?
-        logger.critical(
-            'Cannot unpack file %s (downloaded from %s, content-type: %s); '
-            'cannot detect archive format',
-            filename, location, content_type,
-        )
-        raise InstallationError(
-            'Cannot determine archive format of {}'.format(location)
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/urls.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/urls.py
deleted file mode 100644
index 9ad40feb345423ea76d86cc0e4541e3de84bae34..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/urls.py
+++ /dev/null
@@ -1,54 +0,0 @@
-import os
-import sys
-
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-from pip._vendor.six.moves.urllib import request as urllib_request
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Text, Union
-
-
-def get_url_scheme(url):
-    # type: (Union[str, Text]) -> Optional[Text]
-    if ':' not in url:
-        return None
-    return url.split(':', 1)[0].lower()
-
-
-def path_to_url(path):
-    # type: (Union[str, Text]) -> str
-    """
-    Convert a path to a file: URL.  The path will be made absolute and have
-    quoted path parts.
-    """
-    path = os.path.normpath(os.path.abspath(path))
-    url = urllib_parse.urljoin('file:', urllib_request.pathname2url(path))
-    return url
-
-
-def url_to_path(url):
-    # type: (str) -> str
-    """
-    Convert a file: URL to a path.
-    """
-    assert url.startswith('file:'), (
-        "You can only turn file: urls into filenames (not %r)" % url)
-
-    _, netloc, path, _, _ = urllib_parse.urlsplit(url)
-
-    if not netloc or netloc == 'localhost':
-        # According to RFC 8089, same as empty authority.
-        netloc = ''
-    elif sys.platform == 'win32':
-        # If we have a UNC path, prepend UNC share notation.
-        netloc = '\\\\' + netloc
-    else:
-        raise ValueError(
-            'non-local file URIs are not supported on this platform: %r'
-            % url
-        )
-
-    path = urllib_request.url2pathname(netloc + path)
-    return path
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/virtualenv.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/virtualenv.py
deleted file mode 100644
index d81e6ac54bb13a898295923126a934b9ea76f641..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/virtualenv.py
+++ /dev/null
@@ -1,115 +0,0 @@
-from __future__ import absolute_import
-
-import logging
-import os
-import re
-import site
-import sys
-
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from typing import List, Optional
-
-logger = logging.getLogger(__name__)
-_INCLUDE_SYSTEM_SITE_PACKAGES_REGEX = re.compile(
-    r"include-system-site-packages\s*=\s*(?Ptrue|false)"
-)
-
-
-def _running_under_venv():
-    # type: () -> bool
-    """Checks if sys.base_prefix and sys.prefix match.
-
-    This handles PEP 405 compliant virtual environments.
-    """
-    return sys.prefix != getattr(sys, "base_prefix", sys.prefix)
-
-
-def _running_under_regular_virtualenv():
-    # type: () -> bool
-    """Checks if sys.real_prefix is set.
-
-    This handles virtual environments created with pypa's virtualenv.
-    """
-    # pypa/virtualenv case
-    return hasattr(sys, 'real_prefix')
-
-
-def running_under_virtualenv():
-    # type: () -> bool
-    """Return True if we're running inside a virtualenv, False otherwise.
-    """
-    return _running_under_venv() or _running_under_regular_virtualenv()
-
-
-def _get_pyvenv_cfg_lines():
-    # type: () -> Optional[List[str]]
-    """Reads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines
-
-    Returns None, if it could not read/access the file.
-    """
-    pyvenv_cfg_file = os.path.join(sys.prefix, 'pyvenv.cfg')
-    try:
-        with open(pyvenv_cfg_file) as f:
-            return f.read().splitlines()  # avoids trailing newlines
-    except IOError:
-        return None
-
-
-def _no_global_under_venv():
-    # type: () -> bool
-    """Check `{sys.prefix}/pyvenv.cfg` for system site-packages inclusion
-
-    PEP 405 specifies that when system site-packages are not supposed to be
-    visible from a virtual environment, `pyvenv.cfg` must contain the following
-    line:
-
-        include-system-site-packages = false
-
-    Additionally, log a warning if accessing the file fails.
-    """
-    cfg_lines = _get_pyvenv_cfg_lines()
-    if cfg_lines is None:
-        # We're not in a "sane" venv, so assume there is no system
-        # site-packages access (since that's PEP 405's default state).
-        logger.warning(
-            "Could not access 'pyvenv.cfg' despite a virtual environment "
-            "being active. Assuming global site-packages is not accessible "
-            "in this environment."
-        )
-        return True
-
-    for line in cfg_lines:
-        match = _INCLUDE_SYSTEM_SITE_PACKAGES_REGEX.match(line)
-        if match is not None and match.group('value') == 'false':
-            return True
-    return False
-
-
-def _no_global_under_regular_virtualenv():
-    # type: () -> bool
-    """Check if "no-global-site-packages.txt" exists beside site.py
-
-    This mirrors logic in pypa/virtualenv for determining whether system
-    site-packages are visible in the virtual environment.
-    """
-    site_mod_dir = os.path.dirname(os.path.abspath(site.__file__))
-    no_global_site_packages_file = os.path.join(
-        site_mod_dir, 'no-global-site-packages.txt',
-    )
-    return os.path.exists(no_global_site_packages_file)
-
-
-def virtualenv_no_global():
-    # type: () -> bool
-    """Returns a boolean, whether running in venv with no system site-packages.
-    """
-
-    if _running_under_regular_virtualenv():
-        return _no_global_under_regular_virtualenv()
-
-    if _running_under_venv():
-        return _no_global_under_venv()
-
-    return False
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/utils/wheel.py b/venv/lib/python3.8/site-packages/pip/_internal/utils/wheel.py
deleted file mode 100644
index 837e0afd7e5ca32666ffd0acdc33549d03626bcd..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/utils/wheel.py
+++ /dev/null
@@ -1,225 +0,0 @@
-"""Support functions for working with wheel files.
-"""
-
-from __future__ import absolute_import
-
-import logging
-from email.parser import Parser
-from zipfile import ZipFile
-
-from pip._vendor.packaging.utils import canonicalize_name
-from pip._vendor.pkg_resources import DistInfoDistribution
-from pip._vendor.six import PY2, ensure_str
-
-from pip._internal.exceptions import UnsupportedWheel
-from pip._internal.utils.pkg_resources import DictMetadata
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-
-if MYPY_CHECK_RUNNING:
-    from email.message import Message
-    from typing import Dict, Tuple
-
-    from pip._vendor.pkg_resources import Distribution
-
-if PY2:
-    from zipfile import BadZipfile as BadZipFile
-else:
-    from zipfile import BadZipFile
-
-
-VERSION_COMPATIBLE = (1, 0)
-
-
-logger = logging.getLogger(__name__)
-
-
-class WheelMetadata(DictMetadata):
-    """Metadata provider that maps metadata decoding exceptions to our
-    internal exception type.
-    """
-    def __init__(self, metadata, wheel_name):
-        # type: (Dict[str, bytes], str) -> None
-        super(WheelMetadata, self).__init__(metadata)
-        self._wheel_name = wheel_name
-
-    def get_metadata(self, name):
-        # type: (str) -> str
-        try:
-            return super(WheelMetadata, self).get_metadata(name)
-        except UnicodeDecodeError as e:
-            # Augment the default error with the origin of the file.
-            raise UnsupportedWheel(
-                "Error decoding metadata for {}: {}".format(
-                    self._wheel_name, e
-                )
-            )
-
-
-def pkg_resources_distribution_for_wheel(wheel_zip, name, location):
-    # type: (ZipFile, str, str) -> Distribution
-    """Get a pkg_resources distribution given a wheel.
-
-    :raises UnsupportedWheel: on any errors
-    """
-    info_dir, _ = parse_wheel(wheel_zip, name)
-
-    metadata_files = [
-        p for p in wheel_zip.namelist() if p.startswith("{}/".format(info_dir))
-    ]
-
-    metadata_text = {}  # type: Dict[str, bytes]
-    for path in metadata_files:
-        # If a flag is set, namelist entries may be unicode in Python 2.
-        # We coerce them to native str type to match the types used in the rest
-        # of the code. This cannot fail because unicode can always be encoded
-        # with UTF-8.
-        full_path = ensure_str(path)
-        _, metadata_name = full_path.split("/", 1)
-
-        try:
-            metadata_text[metadata_name] = read_wheel_metadata_file(
-                wheel_zip, full_path
-            )
-        except UnsupportedWheel as e:
-            raise UnsupportedWheel(
-                "{} has an invalid wheel, {}".format(name, str(e))
-            )
-
-    metadata = WheelMetadata(metadata_text, location)
-
-    return DistInfoDistribution(
-        location=location, metadata=metadata, project_name=name
-    )
-
-
-def parse_wheel(wheel_zip, name):
-    # type: (ZipFile, str) -> Tuple[str, Message]
-    """Extract information from the provided wheel, ensuring it meets basic
-    standards.
-
-    Returns the name of the .dist-info directory and the parsed WHEEL metadata.
-    """
-    try:
-        info_dir = wheel_dist_info_dir(wheel_zip, name)
-        metadata = wheel_metadata(wheel_zip, info_dir)
-        version = wheel_version(metadata)
-    except UnsupportedWheel as e:
-        raise UnsupportedWheel(
-            "{} has an invalid wheel, {}".format(name, str(e))
-        )
-
-    check_compatibility(version, name)
-
-    return info_dir, metadata
-
-
-def wheel_dist_info_dir(source, name):
-    # type: (ZipFile, str) -> str
-    """Returns the name of the contained .dist-info directory.
-
-    Raises AssertionError or UnsupportedWheel if not found, >1 found, or
-    it doesn't match the provided name.
-    """
-    # Zip file path separators must be /
-    subdirs = list(set(p.split("/")[0] for p in source.namelist()))
-
-    info_dirs = [s for s in subdirs if s.endswith('.dist-info')]
-
-    if not info_dirs:
-        raise UnsupportedWheel(".dist-info directory not found")
-
-    if len(info_dirs) > 1:
-        raise UnsupportedWheel(
-            "multiple .dist-info directories found: {}".format(
-                ", ".join(info_dirs)
-            )
-        )
-
-    info_dir = info_dirs[0]
-
-    info_dir_name = canonicalize_name(info_dir)
-    canonical_name = canonicalize_name(name)
-    if not info_dir_name.startswith(canonical_name):
-        raise UnsupportedWheel(
-            ".dist-info directory {!r} does not start with {!r}".format(
-                info_dir, canonical_name
-            )
-        )
-
-    # Zip file paths can be unicode or str depending on the zip entry flags,
-    # so normalize it.
-    return ensure_str(info_dir)
-
-
-def read_wheel_metadata_file(source, path):
-    # type: (ZipFile, str) -> bytes
-    try:
-        return source.read(path)
-        # BadZipFile for general corruption, KeyError for missing entry,
-        # and RuntimeError for password-protected files
-    except (BadZipFile, KeyError, RuntimeError) as e:
-        raise UnsupportedWheel(
-            "could not read {!r} file: {!r}".format(path, e)
-        )
-
-
-def wheel_metadata(source, dist_info_dir):
-    # type: (ZipFile, str) -> Message
-    """Return the WHEEL metadata of an extracted wheel, if possible.
-    Otherwise, raise UnsupportedWheel.
-    """
-    path = "{}/WHEEL".format(dist_info_dir)
-    # Zip file path separators must be /
-    wheel_contents = read_wheel_metadata_file(source, path)
-
-    try:
-        wheel_text = ensure_str(wheel_contents)
-    except UnicodeDecodeError as e:
-        raise UnsupportedWheel("error decoding {!r}: {!r}".format(path, e))
-
-    # FeedParser (used by Parser) does not raise any exceptions. The returned
-    # message may have .defects populated, but for backwards-compatibility we
-    # currently ignore them.
-    return Parser().parsestr(wheel_text)
-
-
-def wheel_version(wheel_data):
-    # type: (Message) -> Tuple[int, ...]
-    """Given WHEEL metadata, return the parsed Wheel-Version.
-    Otherwise, raise UnsupportedWheel.
-    """
-    version_text = wheel_data["Wheel-Version"]
-    if version_text is None:
-        raise UnsupportedWheel("WHEEL is missing Wheel-Version")
-
-    version = version_text.strip()
-
-    try:
-        return tuple(map(int, version.split('.')))
-    except ValueError:
-        raise UnsupportedWheel("invalid Wheel-Version: {!r}".format(version))
-
-
-def check_compatibility(version, name):
-    # type: (Tuple[int, ...], str) -> None
-    """Raises errors or warns if called with an incompatible Wheel-Version.
-
-    Pip should refuse to install a Wheel-Version that's a major series
-    ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when
-    installing a version only minor version ahead (e.g 1.2 > 1.1).
-
-    version: a 2-tuple representing a Wheel-Version (Major, Minor)
-    name: name of wheel or package to raise exception about
-
-    :raises UnsupportedWheel: when an incompatible Wheel-Version is given
-    """
-    if version[0] > VERSION_COMPATIBLE[0]:
-        raise UnsupportedWheel(
-            "%s's Wheel-Version (%s) is not compatible with this version "
-            "of pip" % (name, '.'.join(map(str, version)))
-        )
-    elif version > VERSION_COMPATIBLE:
-        logger.warning(
-            'Installing from a newer Wheel-Version (%s)',
-            '.'.join(map(str, version)),
-        )
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__init__.py b/venv/lib/python3.8/site-packages/pip/_internal/vcs/__init__.py
deleted file mode 100644
index 2a4eb1375763fa3287d171a2a1b0766d1d9d1224..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__init__.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Expose a limited set of classes and functions so callers outside of
-# the vcs package don't need to import deeper than `pip._internal.vcs`.
-# (The test directory and imports protected by MYPY_CHECK_RUNNING may
-# still need to import from a vcs sub-package.)
-# Import all vcs modules to register each VCS in the VcsSupport object.
-import pip._internal.vcs.bazaar
-import pip._internal.vcs.git
-import pip._internal.vcs.mercurial
-import pip._internal.vcs.subversion  # noqa: F401
-from pip._internal.vcs.versioncontrol import (  # noqa: F401
-    RemoteNotFoundError,
-    is_url,
-    make_vcs_requirement_url,
-    vcs,
-)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 23b23a01340d1e7d034556da56ffa7c736f26fa4..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-38.pyc
deleted file mode 100644
index 796087435c4bba0c62e573d4e767f575a840eefb..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/git.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/git.cpython-38.pyc
deleted file mode 100644
index 74ee2c47695e17619b13ffe18806de3d971c747d..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/git.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-38.pyc
deleted file mode 100644
index 72f700fb921dcb06bd85ec784c5b8dd7221de933..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-38.pyc
deleted file mode 100644
index 99bb4702e4c0f94f6cc7e339defa6da4969fca09..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-38.pyc
deleted file mode 100644
index 6cde5737e7611f581bc7d4feee842210ea11aa37..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/bazaar.py b/venv/lib/python3.8/site-packages/pip/_internal/vcs/bazaar.py
deleted file mode 100644
index 347c06f9dc7c882299bf1a829049849a06328fe5..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/vcs/bazaar.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-
-from pip._internal.utils.misc import display_path, rmtree
-from pip._internal.utils.subprocess import make_command
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import path_to_url
-from pip._internal.vcs.versioncontrol import VersionControl, vcs
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Tuple
-    from pip._internal.utils.misc import HiddenText
-    from pip._internal.vcs.versioncontrol import AuthInfo, RevOptions
-
-
-logger = logging.getLogger(__name__)
-
-
-class Bazaar(VersionControl):
-    name = 'bzr'
-    dirname = '.bzr'
-    repo_name = 'branch'
-    schemes = (
-        'bzr', 'bzr+http', 'bzr+https', 'bzr+ssh', 'bzr+sftp', 'bzr+ftp',
-        'bzr+lp',
-    )
-
-    def __init__(self, *args, **kwargs):
-        super(Bazaar, self).__init__(*args, **kwargs)
-        # This is only needed for python <2.7.5
-        # Register lp but do not expose as a scheme to support bzr+lp.
-        if getattr(urllib_parse, 'uses_fragment', None):
-            urllib_parse.uses_fragment.extend(['lp'])
-
-    @staticmethod
-    def get_base_rev_args(rev):
-        return ['-r', rev]
-
-    def export(self, location, url):
-        # type: (str, HiddenText) -> None
-        """
-        Export the Bazaar repository at the url to the destination location
-        """
-        # Remove the location to make sure Bazaar can export it correctly
-        if os.path.exists(location):
-            rmtree(location)
-
-        url, rev_options = self.get_url_rev_options(url)
-        self.run_command(
-            make_command('export', location, url, rev_options.to_args()),
-            show_stdout=False,
-        )
-
-    def fetch_new(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        rev_display = rev_options.to_display()
-        logger.info(
-            'Checking out %s%s to %s',
-            url,
-            rev_display,
-            display_path(dest),
-        )
-        cmd_args = (
-            make_command('branch', '-q', rev_options.to_args(), url, dest)
-        )
-        self.run_command(cmd_args)
-
-    def switch(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        self.run_command(make_command('switch', url), cwd=dest)
-
-    def update(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        cmd_args = make_command('pull', '-q', rev_options.to_args())
-        self.run_command(cmd_args, cwd=dest)
-
-    @classmethod
-    def get_url_rev_and_auth(cls, url):
-        # type: (str) -> Tuple[str, Optional[str], AuthInfo]
-        # hotfix the URL scheme after removing bzr+ from bzr+ssh:// readd it
-        url, rev, user_pass = super(Bazaar, cls).get_url_rev_and_auth(url)
-        if url.startswith('ssh://'):
-            url = 'bzr+' + url
-        return url, rev, user_pass
-
-    @classmethod
-    def get_remote_url(cls, location):
-        urls = cls.run_command(['info'], show_stdout=False, cwd=location)
-        for line in urls.splitlines():
-            line = line.strip()
-            for x in ('checkout of branch: ',
-                      'parent branch: '):
-                if line.startswith(x):
-                    repo = line.split(x)[1]
-                    if cls._is_local_repository(repo):
-                        return path_to_url(repo)
-                    return repo
-        return None
-
-    @classmethod
-    def get_revision(cls, location):
-        revision = cls.run_command(
-            ['revno'], show_stdout=False, cwd=location,
-        )
-        return revision.splitlines()[-1]
-
-    @classmethod
-    def is_commit_id_equal(cls, dest, name):
-        """Always assume the versions don't match"""
-        return False
-
-
-vcs.register(Bazaar)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/git.py b/venv/lib/python3.8/site-packages/pip/_internal/vcs/git.py
deleted file mode 100644
index d706064e75b6639338e197124e75dadda5811332..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/vcs/git.py
+++ /dev/null
@@ -1,395 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import os.path
-import re
-
-from pip._vendor.packaging.version import parse as parse_version
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-from pip._vendor.six.moves.urllib import request as urllib_request
-
-from pip._internal.exceptions import BadCommand
-from pip._internal.utils.misc import display_path, hide_url
-from pip._internal.utils.subprocess import make_command
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.vcs.versioncontrol import (
-    RemoteNotFoundError,
-    VersionControl,
-    find_path_to_setup_from_repo_root,
-    vcs,
-)
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Tuple
-    from pip._internal.utils.misc import HiddenText
-    from pip._internal.vcs.versioncontrol import AuthInfo, RevOptions
-
-
-urlsplit = urllib_parse.urlsplit
-urlunsplit = urllib_parse.urlunsplit
-
-
-logger = logging.getLogger(__name__)
-
-
-HASH_REGEX = re.compile('^[a-fA-F0-9]{40}$')
-
-
-def looks_like_hash(sha):
-    return bool(HASH_REGEX.match(sha))
-
-
-class Git(VersionControl):
-    name = 'git'
-    dirname = '.git'
-    repo_name = 'clone'
-    schemes = (
-        'git', 'git+http', 'git+https', 'git+ssh', 'git+git', 'git+file',
-    )
-    # Prevent the user's environment variables from interfering with pip:
-    # https://github.com/pypa/pip/issues/1130
-    unset_environ = ('GIT_DIR', 'GIT_WORK_TREE')
-    default_arg_rev = 'HEAD'
-
-    @staticmethod
-    def get_base_rev_args(rev):
-        return [rev]
-
-    def is_immutable_rev_checkout(self, url, dest):
-        # type: (str, str) -> bool
-        _, rev_options = self.get_url_rev_options(hide_url(url))
-        if not rev_options.rev:
-            return False
-        if not self.is_commit_id_equal(dest, rev_options.rev):
-            # the current commit is different from rev,
-            # which means rev was something else than a commit hash
-            return False
-        # return False in the rare case rev is both a commit hash
-        # and a tag or a branch; we don't want to cache in that case
-        # because that branch/tag could point to something else in the future
-        is_tag_or_branch = bool(
-            self.get_revision_sha(dest, rev_options.rev)[0]
-        )
-        return not is_tag_or_branch
-
-    def get_git_version(self):
-        VERSION_PFX = 'git version '
-        version = self.run_command(['version'], show_stdout=False)
-        if version.startswith(VERSION_PFX):
-            version = version[len(VERSION_PFX):].split()[0]
-        else:
-            version = ''
-        # get first 3 positions of the git version because
-        # on windows it is x.y.z.windows.t, and this parses as
-        # LegacyVersion which always smaller than a Version.
-        version = '.'.join(version.split('.')[:3])
-        return parse_version(version)
-
-    @classmethod
-    def get_current_branch(cls, location):
-        """
-        Return the current branch, or None if HEAD isn't at a branch
-        (e.g. detached HEAD).
-        """
-        # git-symbolic-ref exits with empty stdout if "HEAD" is a detached
-        # HEAD rather than a symbolic ref.  In addition, the -q causes the
-        # command to exit with status code 1 instead of 128 in this case
-        # and to suppress the message to stderr.
-        args = ['symbolic-ref', '-q', 'HEAD']
-        output = cls.run_command(
-            args, extra_ok_returncodes=(1, ), show_stdout=False, cwd=location,
-        )
-        ref = output.strip()
-
-        if ref.startswith('refs/heads/'):
-            return ref[len('refs/heads/'):]
-
-        return None
-
-    def export(self, location, url):
-        # type: (str, HiddenText) -> None
-        """Export the Git repository at the url to the destination location"""
-        if not location.endswith('/'):
-            location = location + '/'
-
-        with TempDirectory(kind="export") as temp_dir:
-            self.unpack(temp_dir.path, url=url)
-            self.run_command(
-                ['checkout-index', '-a', '-f', '--prefix', location],
-                show_stdout=False, cwd=temp_dir.path
-            )
-
-    @classmethod
-    def get_revision_sha(cls, dest, rev):
-        """
-        Return (sha_or_none, is_branch), where sha_or_none is a commit hash
-        if the revision names a remote branch or tag, otherwise None.
-
-        Args:
-          dest: the repository directory.
-          rev: the revision name.
-        """
-        # Pass rev to pre-filter the list.
-        output = cls.run_command(['show-ref', rev], cwd=dest,
-                                 show_stdout=False, on_returncode='ignore')
-        refs = {}
-        # NOTE: We do not use splitlines here since that would split on other
-        #       unicode separators, which can be maliciously used to install a
-        #       different revision.
-        for line in output.strip().split("\n"):
-            line = line.rstrip("\r")
-            if not line:
-                continue
-            try:
-                sha, ref = line.split(" ", maxsplit=2)
-            except ValueError:
-                # Include the offending line to simplify troubleshooting if
-                # this error ever occurs.
-                raise ValueError('unexpected show-ref line: {!r}'.format(line))
-
-            refs[ref] = sha
-
-        branch_ref = 'refs/remotes/origin/{}'.format(rev)
-        tag_ref = 'refs/tags/{}'.format(rev)
-
-        sha = refs.get(branch_ref)
-        if sha is not None:
-            return (sha, True)
-
-        sha = refs.get(tag_ref)
-
-        return (sha, False)
-
-    @classmethod
-    def resolve_revision(cls, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> RevOptions
-        """
-        Resolve a revision to a new RevOptions object with the SHA1 of the
-        branch, tag, or ref if found.
-
-        Args:
-          rev_options: a RevOptions object.
-        """
-        rev = rev_options.arg_rev
-        # The arg_rev property's implementation for Git ensures that the
-        # rev return value is always non-None.
-        assert rev is not None
-
-        sha, is_branch = cls.get_revision_sha(dest, rev)
-
-        if sha is not None:
-            rev_options = rev_options.make_new(sha)
-            rev_options.branch_name = rev if is_branch else None
-
-            return rev_options
-
-        # Do not show a warning for the common case of something that has
-        # the form of a Git commit hash.
-        if not looks_like_hash(rev):
-            logger.warning(
-                "Did not find branch or tag '%s', assuming revision or ref.",
-                rev,
-            )
-
-        if not rev.startswith('refs/'):
-            return rev_options
-
-        # If it looks like a ref, we have to fetch it explicitly.
-        cls.run_command(
-            make_command('fetch', '-q', url, rev_options.to_args()),
-            cwd=dest,
-        )
-        # Change the revision to the SHA of the ref we fetched
-        sha = cls.get_revision(dest, rev='FETCH_HEAD')
-        rev_options = rev_options.make_new(sha)
-
-        return rev_options
-
-    @classmethod
-    def is_commit_id_equal(cls, dest, name):
-        """
-        Return whether the current commit hash equals the given name.
-
-        Args:
-          dest: the repository directory.
-          name: a string name.
-        """
-        if not name:
-            # Then avoid an unnecessary subprocess call.
-            return False
-
-        return cls.get_revision(dest) == name
-
-    def fetch_new(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        rev_display = rev_options.to_display()
-        logger.info('Cloning %s%s to %s', url, rev_display, display_path(dest))
-        self.run_command(make_command('clone', '-q', url, dest))
-
-        if rev_options.rev:
-            # Then a specific revision was requested.
-            rev_options = self.resolve_revision(dest, url, rev_options)
-            branch_name = getattr(rev_options, 'branch_name', None)
-            if branch_name is None:
-                # Only do a checkout if the current commit id doesn't match
-                # the requested revision.
-                if not self.is_commit_id_equal(dest, rev_options.rev):
-                    cmd_args = make_command(
-                        'checkout', '-q', rev_options.to_args(),
-                    )
-                    self.run_command(cmd_args, cwd=dest)
-            elif self.get_current_branch(dest) != branch_name:
-                # Then a specific branch was requested, and that branch
-                # is not yet checked out.
-                track_branch = 'origin/{}'.format(branch_name)
-                cmd_args = [
-                    'checkout', '-b', branch_name, '--track', track_branch,
-                ]
-                self.run_command(cmd_args, cwd=dest)
-
-        #: repo may contain submodules
-        self.update_submodules(dest)
-
-    def switch(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        self.run_command(
-            make_command('config', 'remote.origin.url', url),
-            cwd=dest,
-        )
-        cmd_args = make_command('checkout', '-q', rev_options.to_args())
-        self.run_command(cmd_args, cwd=dest)
-
-        self.update_submodules(dest)
-
-    def update(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        # First fetch changes from the default remote
-        if self.get_git_version() >= parse_version('1.9.0'):
-            # fetch tags in addition to everything else
-            self.run_command(['fetch', '-q', '--tags'], cwd=dest)
-        else:
-            self.run_command(['fetch', '-q'], cwd=dest)
-        # Then reset to wanted revision (maybe even origin/master)
-        rev_options = self.resolve_revision(dest, url, rev_options)
-        cmd_args = make_command('reset', '--hard', '-q', rev_options.to_args())
-        self.run_command(cmd_args, cwd=dest)
-        #: update submodules
-        self.update_submodules(dest)
-
-    @classmethod
-    def get_remote_url(cls, location):
-        """
-        Return URL of the first remote encountered.
-
-        Raises RemoteNotFoundError if the repository does not have a remote
-        url configured.
-        """
-        # We need to pass 1 for extra_ok_returncodes since the command
-        # exits with return code 1 if there are no matching lines.
-        stdout = cls.run_command(
-            ['config', '--get-regexp', r'remote\..*\.url'],
-            extra_ok_returncodes=(1, ), show_stdout=False, cwd=location,
-        )
-        remotes = stdout.splitlines()
-        try:
-            found_remote = remotes[0]
-        except IndexError:
-            raise RemoteNotFoundError
-
-        for remote in remotes:
-            if remote.startswith('remote.origin.url '):
-                found_remote = remote
-                break
-        url = found_remote.split(' ')[1]
-        return url.strip()
-
-    @classmethod
-    def get_revision(cls, location, rev=None):
-        if rev is None:
-            rev = 'HEAD'
-        current_rev = cls.run_command(
-            ['rev-parse', rev], show_stdout=False, cwd=location,
-        )
-        return current_rev.strip()
-
-    @classmethod
-    def get_subdirectory(cls, location):
-        """
-        Return the path to setup.py, relative to the repo root.
-        Return None if setup.py is in the repo root.
-        """
-        # find the repo root
-        git_dir = cls.run_command(
-            ['rev-parse', '--git-dir'],
-            show_stdout=False, cwd=location).strip()
-        if not os.path.isabs(git_dir):
-            git_dir = os.path.join(location, git_dir)
-        repo_root = os.path.abspath(os.path.join(git_dir, '..'))
-        return find_path_to_setup_from_repo_root(location, repo_root)
-
-    @classmethod
-    def get_url_rev_and_auth(cls, url):
-        # type: (str) -> Tuple[str, Optional[str], AuthInfo]
-        """
-        Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'.
-        That's required because although they use SSH they sometimes don't
-        work with a ssh:// scheme (e.g. GitHub). But we need a scheme for
-        parsing. Hence we remove it again afterwards and return it as a stub.
-        """
-        # Works around an apparent Git bug
-        # (see https://article.gmane.org/gmane.comp.version-control.git/146500)
-        scheme, netloc, path, query, fragment = urlsplit(url)
-        if scheme.endswith('file'):
-            initial_slashes = path[:-len(path.lstrip('/'))]
-            newpath = (
-                initial_slashes +
-                urllib_request.url2pathname(path)
-                .replace('\\', '/').lstrip('/')
-            )
-            url = urlunsplit((scheme, netloc, newpath, query, fragment))
-            after_plus = scheme.find('+') + 1
-            url = scheme[:after_plus] + urlunsplit(
-                (scheme[after_plus:], netloc, newpath, query, fragment),
-            )
-
-        if '://' not in url:
-            assert 'file:' not in url
-            url = url.replace('git+', 'git+ssh://')
-            url, rev, user_pass = super(Git, cls).get_url_rev_and_auth(url)
-            url = url.replace('ssh://', '')
-        else:
-            url, rev, user_pass = super(Git, cls).get_url_rev_and_auth(url)
-
-        return url, rev, user_pass
-
-    @classmethod
-    def update_submodules(cls, location):
-        if not os.path.exists(os.path.join(location, '.gitmodules')):
-            return
-        cls.run_command(
-            ['submodule', 'update', '--init', '--recursive', '-q'],
-            cwd=location,
-        )
-
-    @classmethod
-    def controls_location(cls, location):
-        if super(Git, cls).controls_location(location):
-            return True
-        try:
-            r = cls.run_command(['rev-parse'],
-                                cwd=location,
-                                show_stdout=False,
-                                on_returncode='ignore',
-                                log_failed_cmd=False)
-            return not r
-        except BadCommand:
-            logger.debug("could not determine if %s is under git control "
-                         "because git is not available", location)
-            return False
-
-
-vcs.register(Git)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/mercurial.py b/venv/lib/python3.8/site-packages/pip/_internal/vcs/mercurial.py
deleted file mode 100644
index d9b58cfe9a4b7a437e0899945243f7e9be5215e9..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/vcs/mercurial.py
+++ /dev/null
@@ -1,155 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-
-from pip._vendor.six.moves import configparser
-
-from pip._internal.exceptions import BadCommand, InstallationError
-from pip._internal.utils.misc import display_path
-from pip._internal.utils.subprocess import make_command
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import path_to_url
-from pip._internal.vcs.versioncontrol import (
-    VersionControl,
-    find_path_to_setup_from_repo_root,
-    vcs,
-)
-
-if MYPY_CHECK_RUNNING:
-    from pip._internal.utils.misc import HiddenText
-    from pip._internal.vcs.versioncontrol import RevOptions
-
-
-logger = logging.getLogger(__name__)
-
-
-class Mercurial(VersionControl):
-    name = 'hg'
-    dirname = '.hg'
-    repo_name = 'clone'
-    schemes = (
-        'hg', 'hg+file', 'hg+http', 'hg+https', 'hg+ssh', 'hg+static-http',
-    )
-
-    @staticmethod
-    def get_base_rev_args(rev):
-        return [rev]
-
-    def export(self, location, url):
-        # type: (str, HiddenText) -> None
-        """Export the Hg repository at the url to the destination location"""
-        with TempDirectory(kind="export") as temp_dir:
-            self.unpack(temp_dir.path, url=url)
-
-            self.run_command(
-                ['archive', location], show_stdout=False, cwd=temp_dir.path
-            )
-
-    def fetch_new(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        rev_display = rev_options.to_display()
-        logger.info(
-            'Cloning hg %s%s to %s',
-            url,
-            rev_display,
-            display_path(dest),
-        )
-        self.run_command(make_command('clone', '--noupdate', '-q', url, dest))
-        self.run_command(
-            make_command('update', '-q', rev_options.to_args()),
-            cwd=dest,
-        )
-
-    def switch(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        repo_config = os.path.join(dest, self.dirname, 'hgrc')
-        config = configparser.RawConfigParser()
-        try:
-            config.read(repo_config)
-            config.set('paths', 'default', url.secret)
-            with open(repo_config, 'w') as config_file:
-                config.write(config_file)
-        except (OSError, configparser.NoSectionError) as exc:
-            logger.warning(
-                'Could not switch Mercurial repository to %s: %s', url, exc,
-            )
-        else:
-            cmd_args = make_command('update', '-q', rev_options.to_args())
-            self.run_command(cmd_args, cwd=dest)
-
-    def update(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        self.run_command(['pull', '-q'], cwd=dest)
-        cmd_args = make_command('update', '-q', rev_options.to_args())
-        self.run_command(cmd_args, cwd=dest)
-
-    @classmethod
-    def get_remote_url(cls, location):
-        url = cls.run_command(
-            ['showconfig', 'paths.default'],
-            show_stdout=False, cwd=location).strip()
-        if cls._is_local_repository(url):
-            url = path_to_url(url)
-        return url.strip()
-
-    @classmethod
-    def get_revision(cls, location):
-        """
-        Return the repository-local changeset revision number, as an integer.
-        """
-        current_revision = cls.run_command(
-            ['parents', '--template={rev}'],
-            show_stdout=False, cwd=location).strip()
-        return current_revision
-
-    @classmethod
-    def get_requirement_revision(cls, location):
-        """
-        Return the changeset identification hash, as a 40-character
-        hexadecimal string
-        """
-        current_rev_hash = cls.run_command(
-            ['parents', '--template={node}'],
-            show_stdout=False, cwd=location).strip()
-        return current_rev_hash
-
-    @classmethod
-    def is_commit_id_equal(cls, dest, name):
-        """Always assume the versions don't match"""
-        return False
-
-    @classmethod
-    def get_subdirectory(cls, location):
-        """
-        Return the path to setup.py, relative to the repo root.
-        Return None if setup.py is in the repo root.
-        """
-        # find the repo root
-        repo_root = cls.run_command(
-            ['root'], show_stdout=False, cwd=location).strip()
-        if not os.path.isabs(repo_root):
-            repo_root = os.path.abspath(os.path.join(location, repo_root))
-        return find_path_to_setup_from_repo_root(location, repo_root)
-
-    @classmethod
-    def controls_location(cls, location):
-        if super(Mercurial, cls).controls_location(location):
-            return True
-        try:
-            cls.run_command(
-                ['identify'],
-                cwd=location,
-                show_stdout=False,
-                on_returncode='raise',
-                log_failed_cmd=False)
-            return True
-        except (BadCommand, InstallationError):
-            return False
-
-
-vcs.register(Mercurial)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/subversion.py b/venv/lib/python3.8/site-packages/pip/_internal/vcs/subversion.py
deleted file mode 100644
index 6c76d1ad435ab4718c95a09aafa8a8e69a996452..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/vcs/subversion.py
+++ /dev/null
@@ -1,333 +0,0 @@
-# The following comment should be removed at some point in the future.
-# mypy: disallow-untyped-defs=False
-
-from __future__ import absolute_import
-
-import logging
-import os
-import re
-
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import (
-    display_path,
-    is_console_interactive,
-    rmtree,
-    split_auth_from_netloc,
-)
-from pip._internal.utils.subprocess import make_command
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.vcs.versioncontrol import VersionControl, vcs
-
-_svn_xml_url_re = re.compile('url="([^"]+)"')
-_svn_rev_re = re.compile(r'committed-rev="(\d+)"')
-_svn_info_xml_rev_re = re.compile(r'\s*revision="(\d+)"')
-_svn_info_xml_url_re = re.compile(r'(.*)')
-
-
-if MYPY_CHECK_RUNNING:
-    from typing import Optional, Tuple
-    from pip._internal.utils.subprocess import CommandArgs
-    from pip._internal.utils.misc import HiddenText
-    from pip._internal.vcs.versioncontrol import AuthInfo, RevOptions
-
-
-logger = logging.getLogger(__name__)
-
-
-class Subversion(VersionControl):
-    name = 'svn'
-    dirname = '.svn'
-    repo_name = 'checkout'
-    schemes = ('svn', 'svn+ssh', 'svn+http', 'svn+https', 'svn+svn')
-
-    @classmethod
-    def should_add_vcs_url_prefix(cls, remote_url):
-        return True
-
-    @staticmethod
-    def get_base_rev_args(rev):
-        return ['-r', rev]
-
-    @classmethod
-    def get_revision(cls, location):
-        """
-        Return the maximum revision for all files under a given location
-        """
-        # Note: taken from setuptools.command.egg_info
-        revision = 0
-
-        for base, dirs, files in os.walk(location):
-            if cls.dirname not in dirs:
-                dirs[:] = []
-                continue    # no sense walking uncontrolled subdirs
-            dirs.remove(cls.dirname)
-            entries_fn = os.path.join(base, cls.dirname, 'entries')
-            if not os.path.exists(entries_fn):
-                # FIXME: should we warn?
-                continue
-
-            dirurl, localrev = cls._get_svn_url_rev(base)
-
-            if base == location:
-                base = dirurl + '/'   # save the root url
-            elif not dirurl or not dirurl.startswith(base):
-                dirs[:] = []
-                continue    # not part of the same svn tree, skip it
-            revision = max(revision, localrev)
-        return revision
-
-    @classmethod
-    def get_netloc_and_auth(cls, netloc, scheme):
-        """
-        This override allows the auth information to be passed to svn via the
-        --username and --password options instead of via the URL.
-        """
-        if scheme == 'ssh':
-            # The --username and --password options can't be used for
-            # svn+ssh URLs, so keep the auth information in the URL.
-            return super(Subversion, cls).get_netloc_and_auth(netloc, scheme)
-
-        return split_auth_from_netloc(netloc)
-
-    @classmethod
-    def get_url_rev_and_auth(cls, url):
-        # type: (str) -> Tuple[str, Optional[str], AuthInfo]
-        # hotfix the URL scheme after removing svn+ from svn+ssh:// readd it
-        url, rev, user_pass = super(Subversion, cls).get_url_rev_and_auth(url)
-        if url.startswith('ssh://'):
-            url = 'svn+' + url
-        return url, rev, user_pass
-
-    @staticmethod
-    def make_rev_args(username, password):
-        # type: (Optional[str], Optional[HiddenText]) -> CommandArgs
-        extra_args = []  # type: CommandArgs
-        if username:
-            extra_args += ['--username', username]
-        if password:
-            extra_args += ['--password', password]
-
-        return extra_args
-
-    @classmethod
-    def get_remote_url(cls, location):
-        # In cases where the source is in a subdirectory, not alongside
-        # setup.py we have to look up in the location until we find a real
-        # setup.py
-        orig_location = location
-        while not os.path.exists(os.path.join(location, 'setup.py')):
-            last_location = location
-            location = os.path.dirname(location)
-            if location == last_location:
-                # We've traversed up to the root of the filesystem without
-                # finding setup.py
-                logger.warning(
-                    "Could not find setup.py for directory %s (tried all "
-                    "parent directories)",
-                    orig_location,
-                )
-                return None
-
-        return cls._get_svn_url_rev(location)[0]
-
-    @classmethod
-    def _get_svn_url_rev(cls, location):
-        from pip._internal.exceptions import InstallationError
-
-        entries_path = os.path.join(location, cls.dirname, 'entries')
-        if os.path.exists(entries_path):
-            with open(entries_path) as f:
-                data = f.read()
-        else:  # subversion >= 1.7 does not have the 'entries' file
-            data = ''
-
-        if (data.startswith('8') or
-                data.startswith('9') or
-                data.startswith('10')):
-            data = list(map(str.splitlines, data.split('\n\x0c\n')))
-            del data[0][0]  # get rid of the '8'
-            url = data[0][3]
-            revs = [int(d[9]) for d in data if len(d) > 9 and d[9]] + [0]
-        elif data.startswith('= 1.7
-                # Note that using get_remote_call_options is not necessary here
-                # because `svn info` is being run against a local directory.
-                # We don't need to worry about making sure interactive mode
-                # is being used to prompt for passwords, because passwords
-                # are only potentially needed for remote server requests.
-                xml = cls.run_command(
-                    ['info', '--xml', location],
-                    show_stdout=False,
-                )
-                url = _svn_info_xml_url_re.search(xml).group(1)
-                revs = [
-                    int(m.group(1)) for m in _svn_info_xml_rev_re.finditer(xml)
-                ]
-            except InstallationError:
-                url, revs = None, []
-
-        if revs:
-            rev = max(revs)
-        else:
-            rev = 0
-
-        return url, rev
-
-    @classmethod
-    def is_commit_id_equal(cls, dest, name):
-        """Always assume the versions don't match"""
-        return False
-
-    def __init__(self, use_interactive=None):
-        # type: (bool) -> None
-        if use_interactive is None:
-            use_interactive = is_console_interactive()
-        self.use_interactive = use_interactive
-
-        # This member is used to cache the fetched version of the current
-        # ``svn`` client.
-        # Special value definitions:
-        #   None: Not evaluated yet.
-        #   Empty tuple: Could not parse version.
-        self._vcs_version = None  # type: Optional[Tuple[int, ...]]
-
-        super(Subversion, self).__init__()
-
-    def call_vcs_version(self):
-        # type: () -> Tuple[int, ...]
-        """Query the version of the currently installed Subversion client.
-
-        :return: A tuple containing the parts of the version information or
-            ``()`` if the version returned from ``svn`` could not be parsed.
-        :raises: BadCommand: If ``svn`` is not installed.
-        """
-        # Example versions:
-        #   svn, version 1.10.3 (r1842928)
-        #      compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0
-        #   svn, version 1.7.14 (r1542130)
-        #      compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu
-        version_prefix = 'svn, version '
-        version = self.run_command(['--version'], show_stdout=False)
-        if not version.startswith(version_prefix):
-            return ()
-
-        version = version[len(version_prefix):].split()[0]
-        version_list = version.split('.')
-        try:
-            parsed_version = tuple(map(int, version_list))
-        except ValueError:
-            return ()
-
-        return parsed_version
-
-    def get_vcs_version(self):
-        # type: () -> Tuple[int, ...]
-        """Return the version of the currently installed Subversion client.
-
-        If the version of the Subversion client has already been queried,
-        a cached value will be used.
-
-        :return: A tuple containing the parts of the version information or
-            ``()`` if the version returned from ``svn`` could not be parsed.
-        :raises: BadCommand: If ``svn`` is not installed.
-        """
-        if self._vcs_version is not None:
-            # Use cached version, if available.
-            # If parsing the version failed previously (empty tuple),
-            # do not attempt to parse it again.
-            return self._vcs_version
-
-        vcs_version = self.call_vcs_version()
-        self._vcs_version = vcs_version
-        return vcs_version
-
-    def get_remote_call_options(self):
-        # type: () -> CommandArgs
-        """Return options to be used on calls to Subversion that contact the server.
-
-        These options are applicable for the following ``svn`` subcommands used
-        in this class.
-
-            - checkout
-            - export
-            - switch
-            - update
-
-        :return: A list of command line arguments to pass to ``svn``.
-        """
-        if not self.use_interactive:
-            # --non-interactive switch is available since Subversion 0.14.4.
-            # Subversion < 1.8 runs in interactive mode by default.
-            return ['--non-interactive']
-
-        svn_version = self.get_vcs_version()
-        # By default, Subversion >= 1.8 runs in non-interactive mode if
-        # stdin is not a TTY. Since that is how pip invokes SVN, in
-        # call_subprocess(), pip must pass --force-interactive to ensure
-        # the user can be prompted for a password, if required.
-        #   SVN added the --force-interactive option in SVN 1.8. Since
-        # e.g. RHEL/CentOS 7, which is supported until 2024, ships with
-        # SVN 1.7, pip should continue to support SVN 1.7. Therefore, pip
-        # can't safely add the option if the SVN version is < 1.8 (or unknown).
-        if svn_version >= (1, 8):
-            return ['--force-interactive']
-
-        return []
-
-    def export(self, location, url):
-        # type: (str, HiddenText) -> None
-        """Export the svn repository at the url to the destination location"""
-        url, rev_options = self.get_url_rev_options(url)
-
-        logger.info('Exporting svn repository %s to %s', url, location)
-        with indent_log():
-            if os.path.exists(location):
-                # Subversion doesn't like to check out over an existing
-                # directory --force fixes this, but was only added in svn 1.5
-                rmtree(location)
-            cmd_args = make_command(
-                'export', self.get_remote_call_options(),
-                rev_options.to_args(), url, location,
-            )
-            self.run_command(cmd_args, show_stdout=False)
-
-    def fetch_new(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        rev_display = rev_options.to_display()
-        logger.info(
-            'Checking out %s%s to %s',
-            url,
-            rev_display,
-            display_path(dest),
-        )
-        cmd_args = make_command(
-            'checkout', '-q', self.get_remote_call_options(),
-            rev_options.to_args(), url, dest,
-        )
-        self.run_command(cmd_args)
-
-    def switch(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        cmd_args = make_command(
-            'switch', self.get_remote_call_options(), rev_options.to_args(),
-            url, dest,
-        )
-        self.run_command(cmd_args)
-
-    def update(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        cmd_args = make_command(
-            'update', self.get_remote_call_options(), rev_options.to_args(),
-            dest,
-        )
-        self.run_command(cmd_args)
-
-
-vcs.register(Subversion)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py b/venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py
deleted file mode 100644
index 7cfd568829f27f188cf7a3cec86c3c840b8463cb..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py
+++ /dev/null
@@ -1,700 +0,0 @@
-"""Handles all VCS (version control) support"""
-
-from __future__ import absolute_import
-
-import errno
-import logging
-import os
-import shutil
-import sys
-
-from pip._vendor import pkg_resources
-from pip._vendor.six.moves.urllib import parse as urllib_parse
-
-from pip._internal.exceptions import BadCommand
-from pip._internal.utils.compat import samefile
-from pip._internal.utils.misc import (
-    ask_path_exists,
-    backup_dir,
-    display_path,
-    hide_url,
-    hide_value,
-    rmtree,
-)
-from pip._internal.utils.subprocess import call_subprocess, make_command
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import get_url_scheme
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Any, Dict, Iterable, Iterator, List, Mapping, Optional, Text, Tuple,
-        Type, Union
-    )
-    from pip._internal.utils.ui import SpinnerInterface
-    from pip._internal.utils.misc import HiddenText
-    from pip._internal.utils.subprocess import CommandArgs
-
-    AuthInfo = Tuple[Optional[str], Optional[str]]
-
-
-__all__ = ['vcs']
-
-
-logger = logging.getLogger(__name__)
-
-
-def is_url(name):
-    # type: (Union[str, Text]) -> bool
-    """
-    Return true if the name looks like a URL.
-    """
-    scheme = get_url_scheme(name)
-    if scheme is None:
-        return False
-    return scheme in ['http', 'https', 'file', 'ftp'] + vcs.all_schemes
-
-
-def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None):
-    # type: (str, str, str, Optional[str]) -> str
-    """
-    Return the URL for a VCS requirement.
-
-    Args:
-      repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
-      project_name: the (unescaped) project name.
-    """
-    egg_project_name = pkg_resources.to_filename(project_name)
-    req = '{}@{}#egg={}'.format(repo_url, rev, egg_project_name)
-    if subdir:
-        req += '&subdirectory={}'.format(subdir)
-
-    return req
-
-
-def find_path_to_setup_from_repo_root(location, repo_root):
-    # type: (str, str) -> Optional[str]
-    """
-    Find the path to `setup.py` by searching up the filesystem from `location`.
-    Return the path to `setup.py` relative to `repo_root`.
-    Return None if `setup.py` is in `repo_root` or cannot be found.
-    """
-    # find setup.py
-    orig_location = location
-    while not os.path.exists(os.path.join(location, 'setup.py')):
-        last_location = location
-        location = os.path.dirname(location)
-        if location == last_location:
-            # We've traversed up to the root of the filesystem without
-            # finding setup.py
-            logger.warning(
-                "Could not find setup.py for directory %s (tried all "
-                "parent directories)",
-                orig_location,
-            )
-            return None
-
-    if samefile(repo_root, location):
-        return None
-
-    return os.path.relpath(location, repo_root)
-
-
-class RemoteNotFoundError(Exception):
-    pass
-
-
-class RevOptions(object):
-
-    """
-    Encapsulates a VCS-specific revision to install, along with any VCS
-    install options.
-
-    Instances of this class should be treated as if immutable.
-    """
-
-    def __init__(
-        self,
-        vc_class,  # type: Type[VersionControl]
-        rev=None,  # type: Optional[str]
-        extra_args=None,  # type: Optional[CommandArgs]
-    ):
-        # type: (...) -> None
-        """
-        Args:
-          vc_class: a VersionControl subclass.
-          rev: the name of the revision to install.
-          extra_args: a list of extra options.
-        """
-        if extra_args is None:
-            extra_args = []
-
-        self.extra_args = extra_args
-        self.rev = rev
-        self.vc_class = vc_class
-        self.branch_name = None  # type: Optional[str]
-
-    def __repr__(self):
-        # type: () -> str
-        return ''.format(self.vc_class.name, self.rev)
-
-    @property
-    def arg_rev(self):
-        # type: () -> Optional[str]
-        if self.rev is None:
-            return self.vc_class.default_arg_rev
-
-        return self.rev
-
-    def to_args(self):
-        # type: () -> CommandArgs
-        """
-        Return the VCS-specific command arguments.
-        """
-        args = []  # type: CommandArgs
-        rev = self.arg_rev
-        if rev is not None:
-            args += self.vc_class.get_base_rev_args(rev)
-        args += self.extra_args
-
-        return args
-
-    def to_display(self):
-        # type: () -> str
-        if not self.rev:
-            return ''
-
-        return ' (to revision {})'.format(self.rev)
-
-    def make_new(self, rev):
-        # type: (str) -> RevOptions
-        """
-        Make a copy of the current instance, but with a new rev.
-
-        Args:
-          rev: the name of the revision for the new object.
-        """
-        return self.vc_class.make_rev_options(rev, extra_args=self.extra_args)
-
-
-class VcsSupport(object):
-    _registry = {}  # type: Dict[str, VersionControl]
-    schemes = ['ssh', 'git', 'hg', 'bzr', 'sftp', 'svn']
-
-    def __init__(self):
-        # type: () -> None
-        # Register more schemes with urlparse for various version control
-        # systems
-        urllib_parse.uses_netloc.extend(self.schemes)
-        # Python >= 2.7.4, 3.3 doesn't have uses_fragment
-        if getattr(urllib_parse, 'uses_fragment', None):
-            urllib_parse.uses_fragment.extend(self.schemes)
-        super(VcsSupport, self).__init__()
-
-    def __iter__(self):
-        # type: () -> Iterator[str]
-        return self._registry.__iter__()
-
-    @property
-    def backends(self):
-        # type: () -> List[VersionControl]
-        return list(self._registry.values())
-
-    @property
-    def dirnames(self):
-        # type: () -> List[str]
-        return [backend.dirname for backend in self.backends]
-
-    @property
-    def all_schemes(self):
-        # type: () -> List[str]
-        schemes = []  # type: List[str]
-        for backend in self.backends:
-            schemes.extend(backend.schemes)
-        return schemes
-
-    def register(self, cls):
-        # type: (Type[VersionControl]) -> None
-        if not hasattr(cls, 'name'):
-            logger.warning('Cannot register VCS %s', cls.__name__)
-            return
-        if cls.name not in self._registry:
-            self._registry[cls.name] = cls()
-            logger.debug('Registered VCS backend: %s', cls.name)
-
-    def unregister(self, name):
-        # type: (str) -> None
-        if name in self._registry:
-            del self._registry[name]
-
-    def get_backend_for_dir(self, location):
-        # type: (str) -> Optional[VersionControl]
-        """
-        Return a VersionControl object if a repository of that type is found
-        at the given directory.
-        """
-        for vcs_backend in self._registry.values():
-            if vcs_backend.controls_location(location):
-                logger.debug('Determine that %s uses VCS: %s',
-                             location, vcs_backend.name)
-                return vcs_backend
-        return None
-
-    def get_backend_for_scheme(self, scheme):
-        # type: (str) -> Optional[VersionControl]
-        """
-        Return a VersionControl object or None.
-        """
-        for vcs_backend in self._registry.values():
-            if scheme in vcs_backend.schemes:
-                return vcs_backend
-        return None
-
-    def get_backend(self, name):
-        # type: (str) -> Optional[VersionControl]
-        """
-        Return a VersionControl object or None.
-        """
-        name = name.lower()
-        return self._registry.get(name)
-
-
-vcs = VcsSupport()
-
-
-class VersionControl(object):
-    name = ''
-    dirname = ''
-    repo_name = ''
-    # List of supported schemes for this Version Control
-    schemes = ()  # type: Tuple[str, ...]
-    # Iterable of environment variable names to pass to call_subprocess().
-    unset_environ = ()  # type: Tuple[str, ...]
-    default_arg_rev = None  # type: Optional[str]
-
-    @classmethod
-    def should_add_vcs_url_prefix(cls, remote_url):
-        # type: (str) -> bool
-        """
-        Return whether the vcs prefix (e.g. "git+") should be added to a
-        repository's remote url when used in a requirement.
-        """
-        return not remote_url.lower().startswith('{}:'.format(cls.name))
-
-    @classmethod
-    def get_subdirectory(cls, location):
-        # type: (str) -> Optional[str]
-        """
-        Return the path to setup.py, relative to the repo root.
-        Return None if setup.py is in the repo root.
-        """
-        return None
-
-    @classmethod
-    def get_requirement_revision(cls, repo_dir):
-        # type: (str) -> str
-        """
-        Return the revision string that should be used in a requirement.
-        """
-        return cls.get_revision(repo_dir)
-
-    @classmethod
-    def get_src_requirement(cls, repo_dir, project_name):
-        # type: (str, str) -> Optional[str]
-        """
-        Return the requirement string to use to redownload the files
-        currently at the given repository directory.
-
-        Args:
-          project_name: the (unescaped) project name.
-
-        The return value has a form similar to the following:
-
-            {repository_url}@{revision}#egg={project_name}
-        """
-        repo_url = cls.get_remote_url(repo_dir)
-        if repo_url is None:
-            return None
-
-        if cls.should_add_vcs_url_prefix(repo_url):
-            repo_url = '{}+{}'.format(cls.name, repo_url)
-
-        revision = cls.get_requirement_revision(repo_dir)
-        subdir = cls.get_subdirectory(repo_dir)
-        req = make_vcs_requirement_url(repo_url, revision, project_name,
-                                       subdir=subdir)
-
-        return req
-
-    @staticmethod
-    def get_base_rev_args(rev):
-        # type: (str) -> List[str]
-        """
-        Return the base revision arguments for a vcs command.
-
-        Args:
-          rev: the name of a revision to install.  Cannot be None.
-        """
-        raise NotImplementedError
-
-    def is_immutable_rev_checkout(self, url, dest):
-        # type: (str, str) -> bool
-        """
-        Return true if the commit hash checked out at dest matches
-        the revision in url.
-
-        Always return False, if the VCS does not support immutable commit
-        hashes.
-
-        This method does not check if there are local uncommitted changes
-        in dest after checkout, as pip currently has no use case for that.
-        """
-        return False
-
-    @classmethod
-    def make_rev_options(cls, rev=None, extra_args=None):
-        # type: (Optional[str], Optional[CommandArgs]) -> RevOptions
-        """
-        Return a RevOptions object.
-
-        Args:
-          rev: the name of a revision to install.
-          extra_args: a list of extra options.
-        """
-        return RevOptions(cls, rev, extra_args=extra_args)
-
-    @classmethod
-    def _is_local_repository(cls, repo):
-        # type: (str) -> bool
-        """
-           posix absolute paths start with os.path.sep,
-           win32 ones start with drive (like c:\\folder)
-        """
-        drive, tail = os.path.splitdrive(repo)
-        return repo.startswith(os.path.sep) or bool(drive)
-
-    def export(self, location, url):
-        # type: (str, HiddenText) -> None
-        """
-        Export the repository at the url to the destination location
-        i.e. only download the files, without vcs informations
-
-        :param url: the repository URL starting with a vcs prefix.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def get_netloc_and_auth(cls, netloc, scheme):
-        # type: (str, str) -> Tuple[str, Tuple[Optional[str], Optional[str]]]
-        """
-        Parse the repository URL's netloc, and return the new netloc to use
-        along with auth information.
-
-        Args:
-          netloc: the original repository URL netloc.
-          scheme: the repository URL's scheme without the vcs prefix.
-
-        This is mainly for the Subversion class to override, so that auth
-        information can be provided via the --username and --password options
-        instead of through the URL.  For other subclasses like Git without
-        such an option, auth information must stay in the URL.
-
-        Returns: (netloc, (username, password)).
-        """
-        return netloc, (None, None)
-
-    @classmethod
-    def get_url_rev_and_auth(cls, url):
-        # type: (str) -> Tuple[str, Optional[str], AuthInfo]
-        """
-        Parse the repository URL to use, and return the URL, revision,
-        and auth info to use.
-
-        Returns: (url, rev, (username, password)).
-        """
-        scheme, netloc, path, query, frag = urllib_parse.urlsplit(url)
-        if '+' not in scheme:
-            raise ValueError(
-                "Sorry, {!r} is a malformed VCS url. "
-                "The format is +://, "
-                "e.g. svn+http://myrepo/svn/MyApp#egg=MyApp".format(url)
-            )
-        # Remove the vcs prefix.
-        scheme = scheme.split('+', 1)[1]
-        netloc, user_pass = cls.get_netloc_and_auth(netloc, scheme)
-        rev = None
-        if '@' in path:
-            path, rev = path.rsplit('@', 1)
-        url = urllib_parse.urlunsplit((scheme, netloc, path, query, ''))
-        return url, rev, user_pass
-
-    @staticmethod
-    def make_rev_args(username, password):
-        # type: (Optional[str], Optional[HiddenText]) -> CommandArgs
-        """
-        Return the RevOptions "extra arguments" to use in obtain().
-        """
-        return []
-
-    def get_url_rev_options(self, url):
-        # type: (HiddenText) -> Tuple[HiddenText, RevOptions]
-        """
-        Return the URL and RevOptions object to use in obtain() and in
-        some cases export(), as a tuple (url, rev_options).
-        """
-        secret_url, rev, user_pass = self.get_url_rev_and_auth(url.secret)
-        username, secret_password = user_pass
-        password = None  # type: Optional[HiddenText]
-        if secret_password is not None:
-            password = hide_value(secret_password)
-        extra_args = self.make_rev_args(username, password)
-        rev_options = self.make_rev_options(rev, extra_args=extra_args)
-
-        return hide_url(secret_url), rev_options
-
-    @staticmethod
-    def normalize_url(url):
-        # type: (str) -> str
-        """
-        Normalize a URL for comparison by unquoting it and removing any
-        trailing slash.
-        """
-        return urllib_parse.unquote(url).rstrip('/')
-
-    @classmethod
-    def compare_urls(cls, url1, url2):
-        # type: (str, str) -> bool
-        """
-        Compare two repo URLs for identity, ignoring incidental differences.
-        """
-        return (cls.normalize_url(url1) == cls.normalize_url(url2))
-
-    def fetch_new(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        """
-        Fetch a revision from a repository, in the case that this is the
-        first fetch from the repository.
-
-        Args:
-          dest: the directory to fetch the repository to.
-          rev_options: a RevOptions object.
-        """
-        raise NotImplementedError
-
-    def switch(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        """
-        Switch the repo at ``dest`` to point to ``URL``.
-
-        Args:
-          rev_options: a RevOptions object.
-        """
-        raise NotImplementedError
-
-    def update(self, dest, url, rev_options):
-        # type: (str, HiddenText, RevOptions) -> None
-        """
-        Update an already-existing repo to the given ``rev_options``.
-
-        Args:
-          rev_options: a RevOptions object.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def is_commit_id_equal(cls, dest, name):
-        # type: (str, Optional[str]) -> bool
-        """
-        Return whether the id of the current commit equals the given name.
-
-        Args:
-          dest: the repository directory.
-          name: a string name.
-        """
-        raise NotImplementedError
-
-    def obtain(self, dest, url):
-        # type: (str, HiddenText) -> None
-        """
-        Install or update in editable mode the package represented by this
-        VersionControl object.
-
-        :param dest: the repository directory in which to install or update.
-        :param url: the repository URL starting with a vcs prefix.
-        """
-        url, rev_options = self.get_url_rev_options(url)
-
-        if not os.path.exists(dest):
-            self.fetch_new(dest, url, rev_options)
-            return
-
-        rev_display = rev_options.to_display()
-        if self.is_repository_directory(dest):
-            existing_url = self.get_remote_url(dest)
-            if self.compare_urls(existing_url, url.secret):
-                logger.debug(
-                    '%s in %s exists, and has correct URL (%s)',
-                    self.repo_name.title(),
-                    display_path(dest),
-                    url,
-                )
-                if not self.is_commit_id_equal(dest, rev_options.rev):
-                    logger.info(
-                        'Updating %s %s%s',
-                        display_path(dest),
-                        self.repo_name,
-                        rev_display,
-                    )
-                    self.update(dest, url, rev_options)
-                else:
-                    logger.info('Skipping because already up-to-date.')
-                return
-
-            logger.warning(
-                '%s %s in %s exists with URL %s',
-                self.name,
-                self.repo_name,
-                display_path(dest),
-                existing_url,
-            )
-            prompt = ('(s)witch, (i)gnore, (w)ipe, (b)ackup ',
-                      ('s', 'i', 'w', 'b'))
-        else:
-            logger.warning(
-                'Directory %s already exists, and is not a %s %s.',
-                dest,
-                self.name,
-                self.repo_name,
-            )
-            # https://github.com/python/mypy/issues/1174
-            prompt = ('(i)gnore, (w)ipe, (b)ackup ',  # type: ignore
-                      ('i', 'w', 'b'))
-
-        logger.warning(
-            'The plan is to install the %s repository %s',
-            self.name,
-            url,
-        )
-        response = ask_path_exists('What to do?  %s' % prompt[0], prompt[1])
-
-        if response == 'a':
-            sys.exit(-1)
-
-        if response == 'w':
-            logger.warning('Deleting %s', display_path(dest))
-            rmtree(dest)
-            self.fetch_new(dest, url, rev_options)
-            return
-
-        if response == 'b':
-            dest_dir = backup_dir(dest)
-            logger.warning(
-                'Backing up %s to %s', display_path(dest), dest_dir,
-            )
-            shutil.move(dest, dest_dir)
-            self.fetch_new(dest, url, rev_options)
-            return
-
-        # Do nothing if the response is "i".
-        if response == 's':
-            logger.info(
-                'Switching %s %s to %s%s',
-                self.repo_name,
-                display_path(dest),
-                url,
-                rev_display,
-            )
-            self.switch(dest, url, rev_options)
-
-    def unpack(self, location, url):
-        # type: (str, HiddenText) -> None
-        """
-        Clean up current location and download the url repository
-        (and vcs infos) into location
-
-        :param url: the repository URL starting with a vcs prefix.
-        """
-        if os.path.exists(location):
-            rmtree(location)
-        self.obtain(location, url=url)
-
-    @classmethod
-    def get_remote_url(cls, location):
-        # type: (str) -> str
-        """
-        Return the url used at location
-
-        Raises RemoteNotFoundError if the repository does not have a remote
-        url configured.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def get_revision(cls, location):
-        # type: (str) -> str
-        """
-        Return the current commit id of the files at the given location.
-        """
-        raise NotImplementedError
-
-    @classmethod
-    def run_command(
-        cls,
-        cmd,  # type: Union[List[str], CommandArgs]
-        show_stdout=True,  # type: bool
-        cwd=None,  # type: Optional[str]
-        on_returncode='raise',  # type: str
-        extra_ok_returncodes=None,  # type: Optional[Iterable[int]]
-        command_desc=None,  # type: Optional[str]
-        extra_environ=None,  # type: Optional[Mapping[str, Any]]
-        spinner=None,  # type: Optional[SpinnerInterface]
-        log_failed_cmd=True  # type: bool
-    ):
-        # type: (...) -> Text
-        """
-        Run a VCS subcommand
-        This is simply a wrapper around call_subprocess that adds the VCS
-        command name, and checks that the VCS is available
-        """
-        cmd = make_command(cls.name, *cmd)
-        try:
-            return call_subprocess(cmd, show_stdout, cwd,
-                                   on_returncode=on_returncode,
-                                   extra_ok_returncodes=extra_ok_returncodes,
-                                   command_desc=command_desc,
-                                   extra_environ=extra_environ,
-                                   unset_environ=cls.unset_environ,
-                                   spinner=spinner,
-                                   log_failed_cmd=log_failed_cmd)
-        except OSError as e:
-            # errno.ENOENT = no such file or directory
-            # In other words, the VCS executable isn't available
-            if e.errno == errno.ENOENT:
-                raise BadCommand(
-                    'Cannot find command %r - do you have '
-                    '%r installed and in your '
-                    'PATH?' % (cls.name, cls.name))
-            else:
-                raise  # re-raise exception if a different error occurred
-
-    @classmethod
-    def is_repository_directory(cls, path):
-        # type: (str) -> bool
-        """
-        Return whether a directory path is a repository directory.
-        """
-        logger.debug('Checking in %s for %s (%s)...',
-                     path, cls.dirname, cls.name)
-        return os.path.exists(os.path.join(path, cls.dirname))
-
-    @classmethod
-    def controls_location(cls, location):
-        # type: (str) -> bool
-        """
-        Check if a location is controlled by the vcs.
-        It is meant to be overridden to implement smarter detection
-        mechanisms for specific vcs.
-
-        This can do more than is_repository_directory() alone.  For example,
-        the Git override checks that Git is actually available.
-        """
-        return cls.is_repository_directory(location)
diff --git a/venv/lib/python3.8/site-packages/pip/_internal/wheel_builder.py b/venv/lib/python3.8/site-packages/pip/_internal/wheel_builder.py
deleted file mode 100644
index 7c7820d4f26560dff25801dd5034b355d2823795..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_internal/wheel_builder.py
+++ /dev/null
@@ -1,305 +0,0 @@
-"""Orchestrator for building wheels from InstallRequirements.
-"""
-
-# The following comment should be removed at some point in the future.
-# mypy: strict-optional=False
-
-import logging
-import os.path
-import re
-import shutil
-
-from pip._internal.models.link import Link
-from pip._internal.operations.build.wheel import build_wheel_pep517
-from pip._internal.operations.build.wheel_legacy import build_wheel_legacy
-from pip._internal.utils.logging import indent_log
-from pip._internal.utils.misc import ensure_dir, hash_file, is_wheel_installed
-from pip._internal.utils.setuptools_build import make_setuptools_clean_args
-from pip._internal.utils.subprocess import call_subprocess
-from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING
-from pip._internal.utils.urls import path_to_url
-from pip._internal.vcs import vcs
-
-if MYPY_CHECK_RUNNING:
-    from typing import (
-        Any, Callable, Iterable, List, Optional, Pattern, Tuple,
-    )
-
-    from pip._internal.cache import WheelCache
-    from pip._internal.req.req_install import InstallRequirement
-
-    BinaryAllowedPredicate = Callable[[InstallRequirement], bool]
-    BuildResult = Tuple[List[InstallRequirement], List[InstallRequirement]]
-
-logger = logging.getLogger(__name__)
-
-
-def _contains_egg_info(
-        s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
-    # type: (str, Pattern[str]) -> bool
-    """Determine whether the string looks like an egg_info.
-
-    :param s: The string to parse. E.g. foo-2.1
-    """
-    return bool(_egg_info_re.search(s))
-
-
-def _should_build(
-    req,  # type: InstallRequirement
-    need_wheel,  # type: bool
-    check_binary_allowed,  # type: BinaryAllowedPredicate
-):
-    # type: (...) -> bool
-    """Return whether an InstallRequirement should be built into a wheel."""
-    if req.constraint:
-        # never build requirements that are merely constraints
-        return False
-    if req.is_wheel:
-        if need_wheel:
-            logger.info(
-                'Skipping %s, due to already being wheel.', req.name,
-            )
-        return False
-
-    if need_wheel:
-        # i.e. pip wheel, not pip install
-        return True
-
-    # From this point, this concerns the pip install command only
-    # (need_wheel=False).
-
-    if not req.use_pep517 and not is_wheel_installed():
-        # we don't build legacy requirements if wheel is not installed
-        return False
-
-    if req.editable or not req.source_dir:
-        return False
-
-    if not check_binary_allowed(req):
-        logger.info(
-            "Skipping wheel build for %s, due to binaries "
-            "being disabled for it.", req.name,
-        )
-        return False
-
-    return True
-
-
-def should_build_for_wheel_command(
-    req,  # type: InstallRequirement
-):
-    # type: (...) -> bool
-    return _should_build(
-        req, need_wheel=True, check_binary_allowed=_always_true
-    )
-
-
-def should_build_for_install_command(
-    req,  # type: InstallRequirement
-    check_binary_allowed,  # type: BinaryAllowedPredicate
-):
-    # type: (...) -> bool
-    return _should_build(
-        req, need_wheel=False, check_binary_allowed=check_binary_allowed
-    )
-
-
-def _should_cache(
-    req,  # type: InstallRequirement
-):
-    # type: (...) -> Optional[bool]
-    """
-    Return whether a built InstallRequirement can be stored in the persistent
-    wheel cache, assuming the wheel cache is available, and _should_build()
-    has determined a wheel needs to be built.
-    """
-    if not should_build_for_install_command(
-        req, check_binary_allowed=_always_true
-    ):
-        # never cache if pip install would not have built
-        # (editable mode, etc)
-        return False
-
-    if req.link and req.link.is_vcs:
-        # VCS checkout. Do not cache
-        # unless it points to an immutable commit hash.
-        assert not req.editable
-        assert req.source_dir
-        vcs_backend = vcs.get_backend_for_scheme(req.link.scheme)
-        assert vcs_backend
-        if vcs_backend.is_immutable_rev_checkout(req.link.url, req.source_dir):
-            return True
-        return False
-
-    base, ext = req.link.splitext()
-    if _contains_egg_info(base):
-        return True
-
-    # Otherwise, do not cache.
-    return False
-
-
-def _get_cache_dir(
-    req,  # type: InstallRequirement
-    wheel_cache,  # type: WheelCache
-):
-    # type: (...) -> str
-    """Return the persistent or temporary cache directory where the built
-    wheel need to be stored.
-    """
-    cache_available = bool(wheel_cache.cache_dir)
-    if cache_available and _should_cache(req):
-        cache_dir = wheel_cache.get_path_for_link(req.link)
-    else:
-        cache_dir = wheel_cache.get_ephem_path_for_link(req.link)
-    return cache_dir
-
-
-def _always_true(_):
-    # type: (Any) -> bool
-    return True
-
-
-def _build_one(
-    req,  # type: InstallRequirement
-    output_dir,  # type: str
-    build_options,  # type: List[str]
-    global_options,  # type: List[str]
-):
-    # type: (...) -> Optional[str]
-    """Build one wheel.
-
-    :return: The filename of the built wheel, or None if the build failed.
-    """
-    try:
-        ensure_dir(output_dir)
-    except OSError as e:
-        logger.warning(
-            "Building wheel for %s failed: %s",
-            req.name, e,
-        )
-        return None
-
-    # Install build deps into temporary directory (PEP 518)
-    with req.build_env:
-        return _build_one_inside_env(
-            req, output_dir, build_options, global_options
-        )
-
-
-def _build_one_inside_env(
-    req,  # type: InstallRequirement
-    output_dir,  # type: str
-    build_options,  # type: List[str]
-    global_options,  # type: List[str]
-):
-    # type: (...) -> Optional[str]
-    with TempDirectory(kind="wheel") as temp_dir:
-        if req.use_pep517:
-            wheel_path = build_wheel_pep517(
-                name=req.name,
-                backend=req.pep517_backend,
-                metadata_directory=req.metadata_directory,
-                build_options=build_options,
-                tempd=temp_dir.path,
-            )
-        else:
-            wheel_path = build_wheel_legacy(
-                name=req.name,
-                setup_py_path=req.setup_py_path,
-                source_dir=req.unpacked_source_directory,
-                global_options=global_options,
-                build_options=build_options,
-                tempd=temp_dir.path,
-            )
-
-        if wheel_path is not None:
-            wheel_name = os.path.basename(wheel_path)
-            dest_path = os.path.join(output_dir, wheel_name)
-            try:
-                wheel_hash, length = hash_file(wheel_path)
-                shutil.move(wheel_path, dest_path)
-                logger.info('Created wheel for %s: '
-                            'filename=%s size=%d sha256=%s',
-                            req.name, wheel_name, length,
-                            wheel_hash.hexdigest())
-                logger.info('Stored in directory: %s', output_dir)
-                return dest_path
-            except Exception as e:
-                logger.warning(
-                    "Building wheel for %s failed: %s",
-                    req.name, e,
-                )
-        # Ignore return, we can't do anything else useful.
-        if not req.use_pep517:
-            _clean_one_legacy(req, global_options)
-        return None
-
-
-def _clean_one_legacy(req, global_options):
-    # type: (InstallRequirement, List[str]) -> bool
-    clean_args = make_setuptools_clean_args(
-        req.setup_py_path,
-        global_options=global_options,
-    )
-
-    logger.info('Running setup.py clean for %s', req.name)
-    try:
-        call_subprocess(clean_args, cwd=req.source_dir)
-        return True
-    except Exception:
-        logger.error('Failed cleaning build dir for %s', req.name)
-        return False
-
-
-def build(
-    requirements,  # type: Iterable[InstallRequirement]
-    wheel_cache,  # type: WheelCache
-    build_options,  # type: List[str]
-    global_options,  # type: List[str]
-):
-    # type: (...) -> BuildResult
-    """Build wheels.
-
-    :return: The list of InstallRequirement that succeeded to build and
-        the list of InstallRequirement that failed to build.
-    """
-    if not requirements:
-        return [], []
-
-    # Build the wheels.
-    logger.info(
-        'Building wheels for collected packages: %s',
-        ', '.join(req.name for req in requirements),
-    )
-
-    with indent_log():
-        build_successes, build_failures = [], []
-        for req in requirements:
-            cache_dir = _get_cache_dir(req, wheel_cache)
-            wheel_file = _build_one(
-                req, cache_dir, build_options, global_options
-            )
-            if wheel_file:
-                # Update the link for this.
-                req.link = Link(path_to_url(wheel_file))
-                req.local_file_path = req.link.file_path
-                assert req.link.is_wheel
-                build_successes.append(req)
-            else:
-                build_failures.append(req)
-
-    # notify success/failure
-    if build_successes:
-        logger.info(
-            'Successfully built %s',
-            ' '.join([req.name for req in build_successes]),
-        )
-    if build_failures:
-        logger.info(
-            'Failed to build %s',
-            ' '.join([req.name for req in build_failures]),
-        )
-    # Return a list of requirements that failed to build
-    return build_successes, build_failures
diff --git a/venv/lib/python3.8/site-packages/pip/_vendor/__init__.py b/venv/lib/python3.8/site-packages/pip/_vendor/__init__.py
deleted file mode 100644
index e02eaef6d8ab18106bf6600e87c269b41d923fa2..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pip/_vendor/__init__.py
+++ /dev/null
@@ -1,119 +0,0 @@
-"""
-pip._vendor is for vendoring dependencies of pip to prevent needing pip to
-depend on something external.
-
-Files inside of pip._vendor should be considered immutable and should only be
-updated to versions from upstream.
-"""
-from __future__ import absolute_import
-
-import glob
-import os.path
-import sys
-
-# Downstream redistributors which have debundled our dependencies should also
-# patch this value to be true. This will trigger the additional patching
-# to cause things like "six" to be available as pip.
-DEBUNDLED = True
-
-# By default, look in this directory for a bunch of .whl files which we will
-# add to the beginning of sys.path before attempting to import anything. This
-# is done to support downstream re-distributors like Debian and Fedora who
-# wish to create their own Wheels for our dependencies to aid in debundling.
-prefix = getattr(sys, "base_prefix", sys.prefix)
-if prefix.startswith('/usr/lib/pypy'):
-    prefix = '/usr'
-WHEEL_DIR = os.path.abspath(os.path.join(prefix, 'share', 'python-wheels'))
-
-
-# Define a small helper function to alias our vendored modules to the real ones
-# if the vendored ones do not exist. This idea of this was taken from
-# https://github.com/kennethreitz/requests/pull/2567.
-def vendored(modulename):
-    vendored_name = "{0}.{1}".format(__name__, modulename)
-
-    try:
-        __import__(modulename, globals(), locals(), level=0)
-    except ImportError:
-        # We can just silently allow import failures to pass here. If we
-        # got to this point it means that ``import pip._vendor.whatever``
-        # failed and so did ``import whatever``. Since we're importing this
-        # upfront in an attempt to alias imports, not erroring here will
-        # just mean we get a regular import error whenever pip *actually*
-        # tries to import one of these modules to use it, which actually
-        # gives us a better error message than we would have otherwise
-        # gotten.
-        pass
-    else:
-        sys.modules[vendored_name] = sys.modules[modulename]
-        base, head = vendored_name.rsplit(".", 1)
-        setattr(sys.modules[base], head, sys.modules[modulename])
-
-
-# If we're operating in a debundled setup, then we want to go ahead and trigger
-# the aliasing of our vendored libraries as well as looking for wheels to add
-# to our sys.path. This will cause all of this code to be a no-op typically
-# however downstream redistributors can enable it in a consistent way across
-# all platforms.
-if DEBUNDLED:
-    # Actually look inside of WHEEL_DIR to find .whl files and add them to the
-    # front of our sys.path.
-    sys.path[:] = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path
-
-    # Actually alias all of our vendored dependencies.
-    vendored("appdirs")
-    vendored("cachecontrol")
-    vendored("colorama")
-    vendored("contextlib2")
-    vendored("distlib")
-    vendored("distro")
-    vendored("html5lib")
-    vendored("six")
-    vendored("six.moves")
-    vendored("six.moves.urllib")
-    vendored("six.moves.urllib.parse")
-    vendored("packaging")
-    vendored("packaging.version")
-    vendored("packaging.specifiers")
-    vendored("pep517")
-    vendored("pkg_resources")
-    vendored("progress")
-    vendored("retrying")
-    vendored("requests")
-    vendored("requests.exceptions")
-    vendored("requests.packages")
-    vendored("requests.packages.urllib3")
-    vendored("requests.packages.urllib3._collections")
-    vendored("requests.packages.urllib3.connection")
-    vendored("requests.packages.urllib3.connectionpool")
-    vendored("requests.packages.urllib3.contrib")
-    vendored("requests.packages.urllib3.contrib.ntlmpool")
-    vendored("requests.packages.urllib3.contrib.pyopenssl")
-    vendored("requests.packages.urllib3.exceptions")
-    vendored("requests.packages.urllib3.fields")
-    vendored("requests.packages.urllib3.filepost")
-    vendored("requests.packages.urllib3.packages")
-    try:
-        vendored("requests.packages.urllib3.packages.ordered_dict")
-        vendored("requests.packages.urllib3.packages.six")
-    except ImportError:
-        # Debian already unbundles these from requests.
-        pass
-    vendored("requests.packages.urllib3.packages.ssl_match_hostname")
-    vendored("requests.packages.urllib3.packages.ssl_match_hostname."
-             "_implementation")
-    vendored("requests.packages.urllib3.poolmanager")
-    vendored("requests.packages.urllib3.request")
-    vendored("requests.packages.urllib3.response")
-    vendored("requests.packages.urllib3.util")
-    vendored("requests.packages.urllib3.util.connection")
-    vendored("requests.packages.urllib3.util.request")
-    vendored("requests.packages.urllib3.util.response")
-    vendored("requests.packages.urllib3.util.retry")
-    vendored("requests.packages.urllib3.util.ssl_")
-    vendored("requests.packages.urllib3.util.timeout")
-    vendored("requests.packages.urllib3.util.url")
-    vendored("toml")
-    vendored("toml.encoder")
-    vendored("toml.decoder")
-    vendored("urllib3")
diff --git a/venv/lib/python3.8/site-packages/pip/_vendor/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pip/_vendor/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 260ea2980b18e9d6dba36f7ce4f30549d5a99300..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pip/_vendor/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/AUTHORS.txt b/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/AUTHORS.txt
deleted file mode 100644
index 72c87d7d38ae7bf859717c333a5ee8230f6ce624..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/AUTHORS.txt
+++ /dev/null
@@ -1,562 +0,0 @@
-A_Rog 
-Aakanksha Agrawal <11389424+rasponic@users.noreply.github.com>
-Abhinav Sagar <40603139+abhinavsagar@users.noreply.github.com>
-ABHYUDAY PRATAP SINGH 
-abs51295 
-AceGentile 
-Adam Chainz 
-Adam Tse 
-Adam Tse 
-Adam Wentz 
-admin 
-Adrien Morison 
-ahayrapetyan 
-Ahilya 
-AinsworthK 
-Akash Srivastava 
-Alan Yee 
-Albert Tugushev 
-Albert-Guan 
-albertg 
-Aleks Bunin 
-Alethea Flowers 
-Alex Gaynor 
-Alex Grönholm 
-Alex Loosley 
-Alex Morega 
-Alex Stachowiak 
-Alexander Shtyrov 
-Alexandre Conrad 
-Alexey Popravka 
-Alexey Popravka 
-Alli 
-Ami Fischman 
-Ananya Maiti 
-Anatoly Techtonik 
-Anders Kaseorg 
-Andreas Lutro 
-Andrei Geacar 
-Andrew Gaul 
-Andrey Bulgakov 
-Andrés Delfino <34587441+andresdelfino@users.noreply.github.com>
-Andrés Delfino 
-Andy Freeland 
-Andy Freeland 
-Andy Kluger 
-Ani Hayrapetyan 
-Aniruddha Basak 
-Anish Tambe 
-Anrs Hu 
-Anthony Sottile 
-Antoine Musso 
-Anton Ovchinnikov 
-Anton Patrushev 
-Antonio Alvarado Hernandez 
-Antony Lee 
-Antti Kaihola 
-Anubhav Patel 
-Anuj Godase 
-AQNOUCH Mohammed 
-AraHaan 
-Arindam Choudhury 
-Armin Ronacher 
-Artem 
-Ashley Manton 
-Ashwin Ramaswami 
-atse 
-Atsushi Odagiri 
-Avner Cohen 
-Baptiste Mispelon 
-Barney Gale 
-barneygale 
-Bartek Ogryczak 
-Bastian Venthur 
-Ben Darnell 
-Ben Hoyt 
-Ben Rosser 
-Bence Nagy 
-Benjamin Peterson 
-Benjamin VanEvery 
-Benoit Pierre 
-Berker Peksag 
-Bernardo B. Marques 
-Bernhard M. Wiedemann 
-Bertil Hatt 
-Bogdan Opanchuk 
-BorisZZZ 
-Brad Erickson 
-Bradley Ayers 
-Brandon L. Reiss 
-Brandt Bucher 
-Brett Randall 
-Brian Cristante <33549821+brcrista@users.noreply.github.com>
-Brian Cristante 
-Brian Rosner 
-BrownTruck 
-Bruno Oliveira 
-Bruno Renié 
-Bstrdsmkr 
-Buck Golemon 
-burrows 
-Bussonnier Matthias 
-c22 
-Caleb Martinez 
-Calvin Smith 
-Carl Meyer 
-Carlos Liam 
-Carol Willing 
-Carter Thayer 
-Cass 
-Chandrasekhar Atina 
-Chih-Hsuan Yen 
-Chih-Hsuan Yen 
-Chris Brinker 
-Chris Hunt 
-Chris Jerdonek 
-Chris McDonough 
-Chris Wolfe 
-Christian Heimes 
-Christian Oudard 
-Christopher Hunt 
-Christopher Snyder 
-Clark Boylan 
-Clay McClure 
-Cody 
-Cody Soyland 
-Colin Watson 
-Connor Osborn 
-Cooper Lees 
-Cooper Ry Lees 
-Cory Benfield 
-Cory Wright 
-Craig Kerstiens 
-Cristian Sorinel 
-Curtis Doty 
-cytolentino 
-Damian Quiroga 
-Dan Black 
-Dan Savilonis 
-Dan Sully 
-daniel 
-Daniel Collins 
-Daniel Hahler 
-Daniel Holth 
-Daniel Jost 
-Daniel Shaulov 
-Daniele Esposti 
-Daniele Procida 
-Danny Hermes 
-Dav Clark 
-Dave Abrahams 
-Dave Jones 
-David Aguilar 
-David Black 
-David Bordeynik 
-David Bordeynik 
-David Caro 
-David Evans 
-David Linke 
-David Pursehouse 
-David Tucker 
-David Wales 
-Davidovich 
-derwolfe 
-Desetude 
-Diego Caraballo 
-DiegoCaraballo 
-Dmitry Gladkov 
-Domen Kožar 
-Donald Stufft 
-Dongweiming 
-Douglas Thor 
-DrFeathers 
-Dustin Ingram 
-Dwayne Bailey 
-Ed Morley <501702+edmorley@users.noreply.github.com>
-Ed Morley 
-Eitan Adler 
-ekristina 
-elainechan 
-Eli Schwartz 
-Eli Schwartz 
-Emil Burzo 
-Emil Styrke 
-Endoh Takanao 
-enoch 
-Erdinc Mutlu 
-Eric Gillingham 
-Eric Hanchrow 
-Eric Hopper 
-Erik M. Bray 
-Erik Rose 
-Ernest W Durbin III 
-Ernest W. Durbin III 
-Erwin Janssen 
-Eugene Vereshchagin 
-everdimension 
-Felix Yan 
-fiber-space 
-Filip Kokosiński 
-Florian Briand 
-Florian Rathgeber 
-Francesco 
-Francesco Montesano 
-Frost Ming 
-Gabriel Curio 
-Gabriel de Perthuis 
-Garry Polley 
-gdanielson 
-Geoffrey Lehée 
-Geoffrey Sneddon 
-George Song 
-Georgi Valkov 
-Giftlin Rajaiah 
-gizmoguy1 
-gkdoc <40815324+gkdoc@users.noreply.github.com>
-Gopinath M <31352222+mgopi1990@users.noreply.github.com>
-GOTO Hayato <3532528+gh640@users.noreply.github.com>
-gpiks 
-Guilherme Espada 
-Guy Rozendorn 
-gzpan123 
-Hanjun Kim 
-Hari Charan 
-Harsh Vardhan 
-Herbert Pfennig 
-Hsiaoming Yang 
-Hugo 
-Hugo Lopes Tavares 
-Hugo van Kemenade 
-hugovk 
-Hynek Schlawack 
-Ian Bicking 
-Ian Cordasco 
-Ian Lee 
-Ian Stapleton Cordasco 
-Ian Wienand 
-Ian Wienand 
-Igor Kuzmitshov 
-Igor Sobreira 
-Ilya Baryshev 
-INADA Naoki 
-Ionel Cristian Mărieș 
-Ionel Maries Cristian 
-Ivan Pozdeev 
-Jacob Kim 
-jakirkham 
-Jakub Stasiak 
-Jakub Vysoky 
-Jakub Wilk 
-James Cleveland 
-James Cleveland 
-James Firth 
-James Polley 
-Jan Pokorný 
-Jannis Leidel 
-jarondl 
-Jason R. Coombs 
-Jay Graves 
-Jean-Christophe Fillion-Robin 
-Jeff Barber 
-Jeff Dairiki 
-Jelmer Vernooij 
-jenix21 
-Jeremy Stanley 
-Jeremy Zafran 
-Jiashuo Li 
-Jim Garrison 
-Jivan Amara 
-John Paton 
-John-Scott Atlakson 
-johnthagen 
-johnthagen 
-Jon Banafato 
-Jon Dufresne 
-Jon Parise 
-Jonas Nockert 
-Jonathan Herbert 
-Joost Molenaar 
-Jorge Niedbalski 
-Joseph Long 
-Josh Bronson 
-Josh Hansen 
-Josh Schneier 
-Juanjo Bazán 
-Julian Berman 
-Julian Gethmann 
-Julien Demoor 
-jwg4 
-Jyrki Pulliainen 
-Kai Chen 
-Kamal Bin Mustafa 
-kaustav haldar 
-keanemind 
-Keith Maxwell 
-Kelsey Hightower 
-Kenneth Belitzky 
-Kenneth Reitz 
-Kenneth Reitz 
-Kevin Burke 
-Kevin Carter 
-Kevin Frommelt 
-Kevin R Patterson 
-Kexuan Sun 
-Kit Randel 
-kpinc 
-Krishna Oza 
-Kumar McMillan 
-Kyle Persohn 
-lakshmanaram 
-Laszlo Kiss-Kollar 
-Laurent Bristiel 
-Laurie Opperman 
-Leon Sasson 
-Lev Givon 
-Lincoln de Sousa 
-Lipis 
-Loren Carvalho 
-Lucas Cimon 
-Ludovic Gasc 
-Luke Macken 
-Luo Jiebin 
-luojiebin 
-luz.paz 
-László Kiss Kollár 
-László Kiss Kollár 
-Marc Abramowitz 
-Marc Tamlyn 
-Marcus Smith 
-Mariatta 
-Mark Kohler 
-Mark Williams 
-Mark Williams 
-Markus Hametner 
-Masaki 
-Masklinn 
-Matej Stuchlik 
-Mathew Jennings 
-Mathieu Bridon 
-Matt Good 
-Matt Maker 
-Matt Robenolt 
-matthew 
-Matthew Einhorn 
-Matthew Gilliard 
-Matthew Iversen 
-Matthew Trumbell 
-Matthew Willson 
-Matthias Bussonnier 
-mattip 
-Maxim Kurnikov 
-Maxime Rouyrre 
-mayeut 
-mbaluna <44498973+mbaluna@users.noreply.github.com>
-mdebi <17590103+mdebi@users.noreply.github.com>
-memoselyk 
-Michael 
-Michael Aquilina 
-Michael E. Karpeles 
-Michael Klich 
-Michael Williamson 
-michaelpacer 
-Mickaël Schoentgen 
-Miguel Araujo Perez 
-Mihir Singh 
-Mike 
-Mike Hendricks 
-Min RK 
-MinRK 
-Miro Hrončok 
-Monica Baluna 
-montefra 
-Monty Taylor 
-Nate Coraor 
-Nathaniel J. Smith 
-Nehal J Wani 
-Neil Botelho 
-Nick Coghlan 
-Nick Stenning 
-Nick Timkovich 
-Nicolas Bock 
-Nikhil Benesch 
-Nitesh Sharma 
-Nowell Strite 
-NtaleGrey 
-nvdv 
-Ofekmeister 
-ofrinevo 
-Oliver Jeeves 
-Oliver Tonnhofer 
-Olivier Girardot 
-Olivier Grisel 
-Ollie Rutherfurd 
-OMOTO Kenji 
-Omry Yadan 
-Oren Held 
-Oscar Benjamin 
-Oz N Tiram 
-Pachwenko <32424503+Pachwenko@users.noreply.github.com>
-Patrick Dubroy 
-Patrick Jenkins 
-Patrick Lawson 
-patricktokeeffe 
-Patrik Kopkan 
-Paul Kehrer 
-Paul Moore 
-Paul Nasrat 
-Paul Oswald 
-Paul van der Linden 
-Paulus Schoutsen 
-Pavithra Eswaramoorthy <33131404+QueenCoffee@users.noreply.github.com>
-Pawel Jasinski 
-Pekka Klärck 
-Peter Lisák 
-Peter Waller 
-petr-tik 
-Phaneendra Chiruvella 
-Phil Freo 
-Phil Pennock 
-Phil Whelan 
-Philip Jägenstedt 
-Philip Molloy 
-Philippe Ombredanne 
-Pi Delport 
-Pierre-Yves Rofes 
-pip 
-Prabakaran Kumaresshan 
-Prabhjyotsing Surjit Singh Sodhi 
-Prabhu Marappan 
-Pradyun Gedam 
-Pratik Mallya 
-Preet Thakkar 
-Preston Holmes 
-Przemek Wrzos 
-Pulkit Goyal <7895pulkit@gmail.com>
-Qiangning Hong 
-Quentin Pradet 
-R. David Murray 
-Rafael Caricio 
-Ralf Schmitt 
-Razzi Abuissa 
-rdb 
-Remi Rampin 
-Remi Rampin 
-Rene Dudfield 
-Riccardo Magliocchetti 
-Richard Jones 
-RobberPhex 
-Robert Collins 
-Robert McGibbon 
-Robert T. McGibbon 
-robin elisha robinson 
-Roey Berman 
-Rohan Jain 
-Rohan Jain 
-Rohan Jain 
-Roman Bogorodskiy 
-Romuald Brunet 
-Ronny Pfannschmidt 
-Rory McCann 
-Ross Brattain 
-Roy Wellington Ⅳ 
-Roy Wellington Ⅳ 
-Ryan Wooden 
-ryneeverett 
-Sachi King 
-Salvatore Rinchiera 
-Savio Jomton 
-schlamar 
-Scott Kitterman 
-Sean 
-seanj 
-Sebastian Jordan 
-Sebastian Schaetz 
-Segev Finer 
-SeongSoo Cho 
-Sergey Vasilyev 
-Seth Woodworth 
-Shlomi Fish 
-Shovan Maity 
-Simeon Visser 
-Simon Cross 
-Simon Pichugin 
-sinoroc 
-Sorin Sbarnea 
-Stavros Korokithakis 
-Stefan Scherfke 
-Stephan Erb 
-stepshal 
-Steve (Gadget) Barnes 
-Steve Barnes 
-Steve Dower 
-Steve Kowalik 
-Steven Myint 
-stonebig 
-Stéphane Bidoul (ACSONE) 
-Stéphane Bidoul 
-Stéphane Klein 
-Sumana Harihareswara 
-Sviatoslav Sydorenko 
-Sviatoslav Sydorenko 
-Swat009 
-Takayuki SHIMIZUKAWA 
-tbeswick 
-Thijs Triemstra 
-Thomas Fenzl 
-Thomas Grainger 
-Thomas Guettler 
-Thomas Johansson 
-Thomas Kluyver 
-Thomas Smith 
-Tim D. Smith 
-Tim Gates 
-Tim Harder 
-Tim Heap 
-tim smith 
-tinruufu 
-Tom Forbes 
-Tom Freudenheim 
-Tom V 
-Tomas Orsava 
-Tomer Chachamu 
-Tony Beswick 
-Tony Zhaocheng Tan 
-TonyBeswick 
-toonarmycaptain 
-Toshio Kuratomi 
-Travis Swicegood 
-Tzu-ping Chung 
-Valentin Haenel 
-Victor Stinner 
-victorvpaulo 
-Viktor Szépe 
-Ville Skyttä 
-Vinay Sajip 
-Vincent Philippon 
-Vinicyus Macedo <7549205+vinicyusmacedo@users.noreply.github.com>
-Vitaly Babiy 
-Vladimir Rutsky 
-W. Trevor King 
-Wil Tan 
-Wilfred Hughes 
-William ML Leslie 
-William T Olson 
-Wilson Mo 
-wim glenn 
-Wolfgang Maier 
-Xavier Fernandez 
-Xavier Fernandez 
-xoviat 
-xtreak 
-YAMAMOTO Takashi 
-Yen Chi Hsuan 
-Yeray Diaz Diaz 
-Yoval P 
-Yu Jian 
-Yuan Jing Vincent Yan 
-Zearin 
-Zearin 
-Zhiping Deng 
-Zvezdan Petkovic 
-Łukasz Langa 
-Семён Марьясин 
diff --git a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/LICENSE.txt b/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/LICENSE.txt
deleted file mode 100644
index 737fec5c5352af3d9a6a47a0670da4bdb52c5725..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/LICENSE.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2008-2019 The pip developers (see AUTHORS.txt file)
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/METADATA b/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/METADATA
deleted file mode 100644
index cf6c9302c5b0495077d258b68c77e2fe11f90f8f..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/METADATA
+++ /dev/null
@@ -1,13 +0,0 @@
-Metadata-Version: 2.1
-Name: pkg_resources
-Version: 0.0.0
-Summary: UNKNOWN
-Home-page: UNKNOWN
-Author: UNKNOWN
-Author-email: UNKNOWN
-License: UNKNOWN
-Platform: UNKNOWN
-
-UNKNOWN
-
-
diff --git a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/RECORD b/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/RECORD
deleted file mode 100644
index a50e4596ae5773932b18419917e1f2fab1c9ee96..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/RECORD
+++ /dev/null
@@ -1,38 +0,0 @@
-pkg_resources-0.0.0.dist-info/AUTHORS.txt,sha256=RtqU9KfonVGhI48DAA4-yTOBUhBtQTjFhaDzHoyh7uU,21518
-pkg_resources-0.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-pkg_resources-0.0.0.dist-info/LICENSE.txt,sha256=W6Ifuwlk-TatfRU2LR7W1JMcyMj5_y1NkRkOEJvnRDE,1090
-pkg_resources-0.0.0.dist-info/METADATA,sha256=V9_WPOtD1FnuKrTGv6Ique7kAOn2lasvT8W0_iMCCCk,177
-pkg_resources-0.0.0.dist-info/RECORD,,
-pkg_resources-0.0.0.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
-pkg_resources/__init__.py,sha256=0IssxXPnaDKpYZRra8Ime0JG4hwosQljItGD0bnIkGk,108349
-pkg_resources/__pycache__/__init__.cpython-38.pyc,,
-pkg_resources/__pycache__/py31compat.cpython-38.pyc,,
-pkg_resources/_vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-pkg_resources/_vendor/__pycache__/__init__.cpython-38.pyc,,
-pkg_resources/_vendor/__pycache__/appdirs.cpython-38.pyc,,
-pkg_resources/_vendor/__pycache__/pyparsing.cpython-38.pyc,,
-pkg_resources/_vendor/__pycache__/six.cpython-38.pyc,,
-pkg_resources/_vendor/appdirs.py,sha256=MievUEuv3l_mQISH5SF0shDk_BNhHHzYiAPrT3ITN4I,24701
-pkg_resources/_vendor/packaging/__about__.py,sha256=zkcCPTN_6TcLW0Nrlg0176-R1QQ_WVPTm8sz1R4-HjM,720
-pkg_resources/_vendor/packaging/__init__.py,sha256=_vNac5TrzwsrzbOFIbF-5cHqc_Y2aPT2D7zrIR06BOo,513
-pkg_resources/_vendor/packaging/__pycache__/__about__.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/__pycache__/markers.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/__pycache__/utils.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/__pycache__/version.cpython-38.pyc,,
-pkg_resources/_vendor/packaging/_compat.py,sha256=Vi_A0rAQeHbU-a9X0tt1yQm9RqkgQbDSxzRw8WlU9kA,860
-pkg_resources/_vendor/packaging/_structures.py,sha256=RImECJ4c_wTlaTYYwZYLHEiebDMaAJmK1oPARhw1T5o,1416
-pkg_resources/_vendor/packaging/markers.py,sha256=uEcBBtGvzqltgnArqb9c4RrcInXezDLos14zbBHhWJo,8248
-pkg_resources/_vendor/packaging/requirements.py,sha256=SikL2UynbsT0qtY9ltqngndha_sfo0w6XGFhAhoSoaQ,4355
-pkg_resources/_vendor/packaging/specifiers.py,sha256=SAMRerzO3fK2IkFZCaZkuwZaL_EGqHNOz4pni4vhnN0,28025
-pkg_resources/_vendor/packaging/utils.py,sha256=3m6WvPm6NNxE8rkTGmn0r75B_GZSGg7ikafxHsBN1WA,421
-pkg_resources/_vendor/packaging/version.py,sha256=OwGnxYfr2ghNzYx59qWIBkrK3SnB6n-Zfd1XaLpnnM0,11556
-pkg_resources/_vendor/pyparsing.py,sha256=tmrp-lu-qO1i75ZzIN5A12nKRRD1Cm4Vpk-5LR9rims,232055
-pkg_resources/_vendor/six.py,sha256=A6hdJZVjI3t_geebZ9BzUvwRrIXo0lfwzQlM2LcKyas,30098
-pkg_resources/extern/__init__.py,sha256=cHiEfHuLmm6rs5Ve_ztBfMI7Lr31vss-D4wkqF5xzlI,2498
-pkg_resources/extern/__pycache__/__init__.cpython-38.pyc,,
-pkg_resources/py31compat.py,sha256=-WQ0e4c3RG_acdhwC3gLiXhP_lg4G5q7XYkZkQg0gxU,558
diff --git a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/WHEEL b/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/WHEEL
deleted file mode 100644
index ef99c6cf3283b50a273ac4c6d009a0aa85597070..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources-0.0.0.dist-info/WHEEL
+++ /dev/null
@@ -1,6 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.34.2)
-Root-Is-Purelib: true
-Tag: py2-none-any
-Tag: py3-none-any
-
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/__init__.py b/venv/lib/python3.8/site-packages/pkg_resources/__init__.py
deleted file mode 100644
index 2f5aa64a6e10832f407601d668e4ef0d9d5d0aeb..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/__init__.py
+++ /dev/null
@@ -1,3296 +0,0 @@
-# coding: utf-8
-"""
-Package resource API
---------------------
-
-A resource is a logical file contained within a package, or a logical
-subdirectory thereof.  The package resource API expects resource names
-to have their path parts separated with ``/``, *not* whatever the local
-path separator is.  Do not use os.path operations to manipulate resource
-names being passed into the API.
-
-The package resource API is designed to work with normal filesystem packages,
-.egg files, and unpacked .egg files.  It can also work in a limited way with
-.zip files and with custom PEP 302 loaders that support the ``get_data()``
-method.
-"""
-
-from __future__ import absolute_import
-
-import sys
-import os
-import io
-import time
-import re
-import types
-import zipfile
-import zipimport
-import warnings
-import stat
-import functools
-import pkgutil
-import operator
-import platform
-import collections
-import plistlib
-import email.parser
-import errno
-import tempfile
-import textwrap
-import itertools
-import inspect
-import ntpath
-import posixpath
-from pkgutil import get_importer
-
-try:
-    import _imp
-except ImportError:
-    # Python 3.2 compatibility
-    import imp as _imp
-
-try:
-    FileExistsError
-except NameError:
-    FileExistsError = OSError
-
-from pkg_resources.extern import six
-from pkg_resources.extern.six.moves import urllib, map, filter
-
-# capture these to bypass sandboxing
-from os import utime
-try:
-    from os import mkdir, rename, unlink
-    WRITE_SUPPORT = True
-except ImportError:
-    # no write support, probably under GAE
-    WRITE_SUPPORT = False
-
-from os import open as os_open
-from os.path import isdir, split
-
-try:
-    import importlib.machinery as importlib_machinery
-    # access attribute to force import under delayed import mechanisms.
-    importlib_machinery.__name__
-except ImportError:
-    importlib_machinery = None
-
-from . import py31compat
-from pkg_resources.extern import appdirs
-from pkg_resources.extern import packaging
-__import__('pkg_resources.extern.packaging.version')
-__import__('pkg_resources.extern.packaging.specifiers')
-__import__('pkg_resources.extern.packaging.requirements')
-__import__('pkg_resources.extern.packaging.markers')
-
-
-__metaclass__ = type
-
-
-if (3, 0) < sys.version_info < (3, 5):
-    raise RuntimeError("Python 3.5 or later is required")
-
-if six.PY2:
-    # Those builtin exceptions are only defined in Python 3
-    PermissionError = None
-    NotADirectoryError = None
-
-# declare some globals that will be defined later to
-# satisfy the linters.
-require = None
-working_set = None
-add_activation_listener = None
-resources_stream = None
-cleanup_resources = None
-resource_dir = None
-resource_stream = None
-set_extraction_path = None
-resource_isdir = None
-resource_string = None
-iter_entry_points = None
-resource_listdir = None
-resource_filename = None
-resource_exists = None
-_distribution_finders = None
-_namespace_handlers = None
-_namespace_packages = None
-
-
-class PEP440Warning(RuntimeWarning):
-    """
-    Used when there is an issue with a version or specifier not complying with
-    PEP 440.
-    """
-
-
-def parse_version(v):
-    try:
-        return packaging.version.Version(v)
-    except packaging.version.InvalidVersion:
-        return packaging.version.LegacyVersion(v)
-
-
-_state_vars = {}
-
-
-def _declare_state(vartype, **kw):
-    globals().update(kw)
-    _state_vars.update(dict.fromkeys(kw, vartype))
-
-
-def __getstate__():
-    state = {}
-    g = globals()
-    for k, v in _state_vars.items():
-        state[k] = g['_sget_' + v](g[k])
-    return state
-
-
-def __setstate__(state):
-    g = globals()
-    for k, v in state.items():
-        g['_sset_' + _state_vars[k]](k, g[k], v)
-    return state
-
-
-def _sget_dict(val):
-    return val.copy()
-
-
-def _sset_dict(key, ob, state):
-    ob.clear()
-    ob.update(state)
-
-
-def _sget_object(val):
-    return val.__getstate__()
-
-
-def _sset_object(key, ob, state):
-    ob.__setstate__(state)
-
-
-_sget_none = _sset_none = lambda *args: None
-
-
-def get_supported_platform():
-    """Return this platform's maximum compatible version.
-
-    distutils.util.get_platform() normally reports the minimum version
-    of Mac OS X that would be required to *use* extensions produced by
-    distutils.  But what we want when checking compatibility is to know the
-    version of Mac OS X that we are *running*.  To allow usage of packages that
-    explicitly require a newer version of Mac OS X, we must also know the
-    current version of the OS.
-
-    If this condition occurs for any other platform with a version in its
-    platform strings, this function should be extended accordingly.
-    """
-    plat = get_build_platform()
-    m = macosVersionString.match(plat)
-    if m is not None and sys.platform == "darwin":
-        try:
-            plat = 'macosx-%s-%s' % ('.'.join(_macosx_vers()[:2]), m.group(3))
-        except ValueError:
-            # not Mac OS X
-            pass
-    return plat
-
-
-__all__ = [
-    # Basic resource access and distribution/entry point discovery
-    'require', 'run_script', 'get_provider', 'get_distribution',
-    'load_entry_point', 'get_entry_map', 'get_entry_info',
-    'iter_entry_points',
-    'resource_string', 'resource_stream', 'resource_filename',
-    'resource_listdir', 'resource_exists', 'resource_isdir',
-
-    # Environmental control
-    'declare_namespace', 'working_set', 'add_activation_listener',
-    'find_distributions', 'set_extraction_path', 'cleanup_resources',
-    'get_default_cache',
-
-    # Primary implementation classes
-    'Environment', 'WorkingSet', 'ResourceManager',
-    'Distribution', 'Requirement', 'EntryPoint',
-
-    # Exceptions
-    'ResolutionError', 'VersionConflict', 'DistributionNotFound',
-    'UnknownExtra', 'ExtractionError',
-
-    # Warnings
-    'PEP440Warning',
-
-    # Parsing functions and string utilities
-    'parse_requirements', 'parse_version', 'safe_name', 'safe_version',
-    'get_platform', 'compatible_platforms', 'yield_lines', 'split_sections',
-    'safe_extra', 'to_filename', 'invalid_marker', 'evaluate_marker',
-
-    # filesystem utilities
-    'ensure_directory', 'normalize_path',
-
-    # Distribution "precedence" constants
-    'EGG_DIST', 'BINARY_DIST', 'SOURCE_DIST', 'CHECKOUT_DIST', 'DEVELOP_DIST',
-
-    # "Provider" interfaces, implementations, and registration/lookup APIs
-    'IMetadataProvider', 'IResourceProvider', 'FileMetadata',
-    'PathMetadata', 'EggMetadata', 'EmptyProvider', 'empty_provider',
-    'NullProvider', 'EggProvider', 'DefaultProvider', 'ZipProvider',
-    'register_finder', 'register_namespace_handler', 'register_loader_type',
-    'fixup_namespace_packages', 'get_importer',
-
-    # Warnings
-    'PkgResourcesDeprecationWarning',
-
-    # Deprecated/backward compatibility only
-    'run_main', 'AvailableDistributions',
-]
-
-
-class ResolutionError(Exception):
-    """Abstract base for dependency resolution errors"""
-
-    def __repr__(self):
-        return self.__class__.__name__ + repr(self.args)
-
-
-class VersionConflict(ResolutionError):
-    """
-    An already-installed version conflicts with the requested version.
-
-    Should be initialized with the installed Distribution and the requested
-    Requirement.
-    """
-
-    _template = "{self.dist} is installed but {self.req} is required"
-
-    @property
-    def dist(self):
-        return self.args[0]
-
-    @property
-    def req(self):
-        return self.args[1]
-
-    def report(self):
-        return self._template.format(**locals())
-
-    def with_context(self, required_by):
-        """
-        If required_by is non-empty, return a version of self that is a
-        ContextualVersionConflict.
-        """
-        if not required_by:
-            return self
-        args = self.args + (required_by,)
-        return ContextualVersionConflict(*args)
-
-
-class ContextualVersionConflict(VersionConflict):
-    """
-    A VersionConflict that accepts a third parameter, the set of the
-    requirements that required the installed Distribution.
-    """
-
-    _template = VersionConflict._template + ' by {self.required_by}'
-
-    @property
-    def required_by(self):
-        return self.args[2]
-
-
-class DistributionNotFound(ResolutionError):
-    """A requested distribution was not found"""
-
-    _template = ("The '{self.req}' distribution was not found "
-                 "and is required by {self.requirers_str}")
-
-    @property
-    def req(self):
-        return self.args[0]
-
-    @property
-    def requirers(self):
-        return self.args[1]
-
-    @property
-    def requirers_str(self):
-        if not self.requirers:
-            return 'the application'
-        return ', '.join(self.requirers)
-
-    def report(self):
-        return self._template.format(**locals())
-
-    def __str__(self):
-        return self.report()
-
-
-class UnknownExtra(ResolutionError):
-    """Distribution doesn't have an "extra feature" of the given name"""
-
-
-_provider_factories = {}
-
-PY_MAJOR = '{}.{}'.format(*sys.version_info)
-EGG_DIST = 3
-BINARY_DIST = 2
-SOURCE_DIST = 1
-CHECKOUT_DIST = 0
-DEVELOP_DIST = -1
-
-
-def register_loader_type(loader_type, provider_factory):
-    """Register `provider_factory` to make providers for `loader_type`
-
-    `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
-    and `provider_factory` is a function that, passed a *module* object,
-    returns an ``IResourceProvider`` for that module.
-    """
-    _provider_factories[loader_type] = provider_factory
-
-
-def get_provider(moduleOrReq):
-    """Return an IResourceProvider for the named module or requirement"""
-    if isinstance(moduleOrReq, Requirement):
-        return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
-    try:
-        module = sys.modules[moduleOrReq]
-    except KeyError:
-        __import__(moduleOrReq)
-        module = sys.modules[moduleOrReq]
-    loader = getattr(module, '__loader__', None)
-    return _find_adapter(_provider_factories, loader)(module)
-
-
-def _macosx_vers(_cache=[]):
-    if not _cache:
-        version = platform.mac_ver()[0]
-        # fallback for MacPorts
-        if version == '':
-            plist = '/System/Library/CoreServices/SystemVersion.plist'
-            if os.path.exists(plist):
-                if hasattr(plistlib, 'readPlist'):
-                    plist_content = plistlib.readPlist(plist)
-                    if 'ProductVersion' in plist_content:
-                        version = plist_content['ProductVersion']
-
-        _cache.append(version.split('.'))
-    return _cache[0]
-
-
-def _macosx_arch(machine):
-    return {'PowerPC': 'ppc', 'Power_Macintosh': 'ppc'}.get(machine, machine)
-
-
-def get_build_platform():
-    """Return this platform's string for platform-specific distributions
-
-    XXX Currently this is the same as ``distutils.util.get_platform()``, but it
-    needs some hacks for Linux and Mac OS X.
-    """
-    from sysconfig import get_platform
-
-    plat = get_platform()
-    if sys.platform == "darwin" and not plat.startswith('macosx-'):
-        try:
-            version = _macosx_vers()
-            machine = os.uname()[4].replace(" ", "_")
-            return "macosx-%d.%d-%s" % (
-                int(version[0]), int(version[1]),
-                _macosx_arch(machine),
-            )
-        except ValueError:
-            # if someone is running a non-Mac darwin system, this will fall
-            # through to the default implementation
-            pass
-    return plat
-
-
-macosVersionString = re.compile(r"macosx-(\d+)\.(\d+)-(.*)")
-darwinVersionString = re.compile(r"darwin-(\d+)\.(\d+)\.(\d+)-(.*)")
-# XXX backward compat
-get_platform = get_build_platform
-
-
-def compatible_platforms(provided, required):
-    """Can code for the `provided` platform run on the `required` platform?
-
-    Returns true if either platform is ``None``, or the platforms are equal.
-
-    XXX Needs compatibility checks for Linux and other unixy OSes.
-    """
-    if provided is None or required is None or provided == required:
-        # easy case
-        return True
-
-    # Mac OS X special cases
-    reqMac = macosVersionString.match(required)
-    if reqMac:
-        provMac = macosVersionString.match(provided)
-
-        # is this a Mac package?
-        if not provMac:
-            # this is backwards compatibility for packages built before
-            # setuptools 0.6. All packages built after this point will
-            # use the new macosx designation.
-            provDarwin = darwinVersionString.match(provided)
-            if provDarwin:
-                dversion = int(provDarwin.group(1))
-                macosversion = "%s.%s" % (reqMac.group(1), reqMac.group(2))
-                if dversion == 7 and macosversion >= "10.3" or \
-                        dversion == 8 and macosversion >= "10.4":
-                    return True
-            # egg isn't macosx or legacy darwin
-            return False
-
-        # are they the same major version and machine type?
-        if provMac.group(1) != reqMac.group(1) or \
-                provMac.group(3) != reqMac.group(3):
-            return False
-
-        # is the required OS major update >= the provided one?
-        if int(provMac.group(2)) > int(reqMac.group(2)):
-            return False
-
-        return True
-
-    # XXX Linux and other platforms' special cases should go here
-    return False
-
-
-def run_script(dist_spec, script_name):
-    """Locate distribution `dist_spec` and run its `script_name` script"""
-    ns = sys._getframe(1).f_globals
-    name = ns['__name__']
-    ns.clear()
-    ns['__name__'] = name
-    require(dist_spec)[0].run_script(script_name, ns)
-
-
-# backward compatibility
-run_main = run_script
-
-
-def get_distribution(dist):
-    """Return a current distribution object for a Requirement or string"""
-    if isinstance(dist, six.string_types):
-        dist = Requirement.parse(dist)
-    if isinstance(dist, Requirement):
-        dist = get_provider(dist)
-    if not isinstance(dist, Distribution):
-        raise TypeError("Expected string, Requirement, or Distribution", dist)
-    return dist
-
-
-def load_entry_point(dist, group, name):
-    """Return `name` entry point of `group` for `dist` or raise ImportError"""
-    return get_distribution(dist).load_entry_point(group, name)
-
-
-def get_entry_map(dist, group=None):
-    """Return the entry point map for `group`, or the full entry map"""
-    return get_distribution(dist).get_entry_map(group)
-
-
-def get_entry_info(dist, group, name):
-    """Return the EntryPoint object for `group`+`name`, or ``None``"""
-    return get_distribution(dist).get_entry_info(group, name)
-
-
-class IMetadataProvider:
-    def has_metadata(name):
-        """Does the package's distribution contain the named metadata?"""
-
-    def get_metadata(name):
-        """The named metadata resource as a string"""
-
-    def get_metadata_lines(name):
-        """Yield named metadata resource as list of non-blank non-comment lines
-
-       Leading and trailing whitespace is stripped from each line, and lines
-       with ``#`` as the first non-blank character are omitted."""
-
-    def metadata_isdir(name):
-        """Is the named metadata a directory?  (like ``os.path.isdir()``)"""
-
-    def metadata_listdir(name):
-        """List of metadata names in the directory (like ``os.listdir()``)"""
-
-    def run_script(script_name, namespace):
-        """Execute the named script in the supplied namespace dictionary"""
-
-
-class IResourceProvider(IMetadataProvider):
-    """An object that provides access to package resources"""
-
-    def get_resource_filename(manager, resource_name):
-        """Return a true filesystem path for `resource_name`
-
-        `manager` must be an ``IResourceManager``"""
-
-    def get_resource_stream(manager, resource_name):
-        """Return a readable file-like object for `resource_name`
-
-        `manager` must be an ``IResourceManager``"""
-
-    def get_resource_string(manager, resource_name):
-        """Return a string containing the contents of `resource_name`
-
-        `manager` must be an ``IResourceManager``"""
-
-    def has_resource(resource_name):
-        """Does the package contain the named resource?"""
-
-    def resource_isdir(resource_name):
-        """Is the named resource a directory?  (like ``os.path.isdir()``)"""
-
-    def resource_listdir(resource_name):
-        """List of resource names in the directory (like ``os.listdir()``)"""
-
-
-class WorkingSet:
-    """A collection of active distributions on sys.path (or a similar list)"""
-
-    def __init__(self, entries=None):
-        """Create working set from list of path entries (default=sys.path)"""
-        self.entries = []
-        self.entry_keys = {}
-        self.by_key = {}
-        self.callbacks = []
-
-        if entries is None:
-            entries = sys.path
-
-        for entry in entries:
-            self.add_entry(entry)
-
-    @classmethod
-    def _build_master(cls):
-        """
-        Prepare the master working set.
-        """
-        ws = cls()
-        try:
-            from __main__ import __requires__
-        except ImportError:
-            # The main program does not list any requirements
-            return ws
-
-        # ensure the requirements are met
-        try:
-            ws.require(__requires__)
-        except VersionConflict:
-            return cls._build_from_requirements(__requires__)
-
-        return ws
-
-    @classmethod
-    def _build_from_requirements(cls, req_spec):
-        """
-        Build a working set from a requirement spec. Rewrites sys.path.
-        """
-        # try it without defaults already on sys.path
-        # by starting with an empty path
-        ws = cls([])
-        reqs = parse_requirements(req_spec)
-        dists = ws.resolve(reqs, Environment())
-        for dist in dists:
-            ws.add(dist)
-
-        # add any missing entries from sys.path
-        for entry in sys.path:
-            if entry not in ws.entries:
-                ws.add_entry(entry)
-
-        # then copy back to sys.path
-        sys.path[:] = ws.entries
-        return ws
-
-    def add_entry(self, entry):
-        """Add a path item to ``.entries``, finding any distributions on it
-
-        ``find_distributions(entry, True)`` is used to find distributions
-        corresponding to the path entry, and they are added.  `entry` is
-        always appended to ``.entries``, even if it is already present.
-        (This is because ``sys.path`` can contain the same value more than
-        once, and the ``.entries`` of the ``sys.path`` WorkingSet should always
-        equal ``sys.path``.)
-        """
-        self.entry_keys.setdefault(entry, [])
-        self.entries.append(entry)
-        for dist in find_distributions(entry, True):
-            self.add(dist, entry, False)
-
-    def __contains__(self, dist):
-        """True if `dist` is the active distribution for its project"""
-        return self.by_key.get(dist.key) == dist
-
-    def find(self, req):
-        """Find a distribution matching requirement `req`
-
-        If there is an active distribution for the requested project, this
-        returns it as long as it meets the version requirement specified by
-        `req`.  But, if there is an active distribution for the project and it
-        does *not* meet the `req` requirement, ``VersionConflict`` is raised.
-        If there is no active distribution for the requested project, ``None``
-        is returned.
-        """
-        dist = self.by_key.get(req.key)
-        if dist is not None and dist not in req:
-            # XXX add more info
-            raise VersionConflict(dist, req)
-        return dist
-
-    def iter_entry_points(self, group, name=None):
-        """Yield entry point objects from `group` matching `name`
-
-        If `name` is None, yields all entry points in `group` from all
-        distributions in the working set, otherwise only ones matching
-        both `group` and `name` are yielded (in distribution order).
-        """
-        return (
-            entry
-            for dist in self
-            for entry in dist.get_entry_map(group).values()
-            if name is None or name == entry.name
-        )
-
-    def run_script(self, requires, script_name):
-        """Locate distribution for `requires` and run `script_name` script"""
-        ns = sys._getframe(1).f_globals
-        name = ns['__name__']
-        ns.clear()
-        ns['__name__'] = name
-        self.require(requires)[0].run_script(script_name, ns)
-
-    def __iter__(self):
-        """Yield distributions for non-duplicate projects in the working set
-
-        The yield order is the order in which the items' path entries were
-        added to the working set.
-        """
-        seen = {}
-        for item in self.entries:
-            if item not in self.entry_keys:
-                # workaround a cache issue
-                continue
-
-            for key in self.entry_keys[item]:
-                if key not in seen:
-                    seen[key] = 1
-                    yield self.by_key[key]
-
-    def add(self, dist, entry=None, insert=True, replace=False):
-        """Add `dist` to working set, associated with `entry`
-
-        If `entry` is unspecified, it defaults to the ``.location`` of `dist`.
-        On exit from this routine, `entry` is added to the end of the working
-        set's ``.entries`` (if it wasn't already present).
-
-        `dist` is only added to the working set if it's for a project that
-        doesn't already have a distribution in the set, unless `replace=True`.
-        If it's added, any callbacks registered with the ``subscribe()`` method
-        will be called.
-        """
-        if insert:
-            dist.insert_on(self.entries, entry, replace=replace)
-
-        if entry is None:
-            entry = dist.location
-        keys = self.entry_keys.setdefault(entry, [])
-        keys2 = self.entry_keys.setdefault(dist.location, [])
-        if not replace and dist.key in self.by_key:
-            # ignore hidden distros
-            return
-
-        self.by_key[dist.key] = dist
-        if dist.key not in keys:
-            keys.append(dist.key)
-        if dist.key not in keys2:
-            keys2.append(dist.key)
-        self._added_new(dist)
-
-    def resolve(self, requirements, env=None, installer=None,
-                replace_conflicting=False, extras=None):
-        """List all distributions needed to (recursively) meet `requirements`
-
-        `requirements` must be a sequence of ``Requirement`` objects.  `env`,
-        if supplied, should be an ``Environment`` instance.  If
-        not supplied, it defaults to all distributions available within any
-        entry or distribution in the working set.  `installer`, if supplied,
-        will be invoked with each requirement that cannot be met by an
-        already-installed distribution; it should return a ``Distribution`` or
-        ``None``.
-
-        Unless `replace_conflicting=True`, raises a VersionConflict exception
-        if
-        any requirements are found on the path that have the correct name but
-        the wrong version.  Otherwise, if an `installer` is supplied it will be
-        invoked to obtain the correct version of the requirement and activate
-        it.
-
-        `extras` is a list of the extras to be used with these requirements.
-        This is important because extra requirements may look like `my_req;
-        extra = "my_extra"`, which would otherwise be interpreted as a purely
-        optional requirement.  Instead, we want to be able to assert that these
-        requirements are truly required.
-        """
-
-        # set up the stack
-        requirements = list(requirements)[::-1]
-        # set of processed requirements
-        processed = {}
-        # key -> dist
-        best = {}
-        to_activate = []
-
-        req_extras = _ReqExtras()
-
-        # Mapping of requirement to set of distributions that required it;
-        # useful for reporting info about conflicts.
-        required_by = collections.defaultdict(set)
-
-        while requirements:
-            # process dependencies breadth-first
-            req = requirements.pop(0)
-            if req in processed:
-                # Ignore cyclic or redundant dependencies
-                continue
-
-            if not req_extras.markers_pass(req, extras):
-                continue
-
-            dist = best.get(req.key)
-            if dist is None:
-                # Find the best distribution and add it to the map
-                dist = self.by_key.get(req.key)
-                if dist is None or (dist not in req and replace_conflicting):
-                    ws = self
-                    if env is None:
-                        if dist is None:
-                            env = Environment(self.entries)
-                        else:
-                            # Use an empty environment and workingset to avoid
-                            # any further conflicts with the conflicting
-                            # distribution
-                            env = Environment([])
-                            ws = WorkingSet([])
-                    dist = best[req.key] = env.best_match(
-                        req, ws, installer,
-                        replace_conflicting=replace_conflicting
-                    )
-                    if dist is None:
-                        requirers = required_by.get(req, None)
-                        raise DistributionNotFound(req, requirers)
-                to_activate.append(dist)
-            if dist not in req:
-                # Oops, the "best" so far conflicts with a dependency
-                dependent_req = required_by[req]
-                raise VersionConflict(dist, req).with_context(dependent_req)
-
-            # push the new requirements onto the stack
-            new_requirements = dist.requires(req.extras)[::-1]
-            requirements.extend(new_requirements)
-
-            # Register the new requirements needed by req
-            for new_requirement in new_requirements:
-                required_by[new_requirement].add(req.project_name)
-                req_extras[new_requirement] = req.extras
-
-            processed[req] = True
-
-        # return list of distros to activate
-        return to_activate
-
-    def find_plugins(
-            self, plugin_env, full_env=None, installer=None, fallback=True):
-        """Find all activatable distributions in `plugin_env`
-
-        Example usage::
-
-            distributions, errors = working_set.find_plugins(
-                Environment(plugin_dirlist)
-            )
-            # add plugins+libs to sys.path
-            map(working_set.add, distributions)
-            # display errors
-            print('Could not load', errors)
-
-        The `plugin_env` should be an ``Environment`` instance that contains
-        only distributions that are in the project's "plugin directory" or
-        directories. The `full_env`, if supplied, should be an ``Environment``
-        contains all currently-available distributions.  If `full_env` is not
-        supplied, one is created automatically from the ``WorkingSet`` this
-        method is called on, which will typically mean that every directory on
-        ``sys.path`` will be scanned for distributions.
-
-        `installer` is a standard installer callback as used by the
-        ``resolve()`` method. The `fallback` flag indicates whether we should
-        attempt to resolve older versions of a plugin if the newest version
-        cannot be resolved.
-
-        This method returns a 2-tuple: (`distributions`, `error_info`), where
-        `distributions` is a list of the distributions found in `plugin_env`
-        that were loadable, along with any other distributions that are needed
-        to resolve their dependencies.  `error_info` is a dictionary mapping
-        unloadable plugin distributions to an exception instance describing the
-        error that occurred. Usually this will be a ``DistributionNotFound`` or
-        ``VersionConflict`` instance.
-        """
-
-        plugin_projects = list(plugin_env)
-        # scan project names in alphabetic order
-        plugin_projects.sort()
-
-        error_info = {}
-        distributions = {}
-
-        if full_env is None:
-            env = Environment(self.entries)
-            env += plugin_env
-        else:
-            env = full_env + plugin_env
-
-        shadow_set = self.__class__([])
-        # put all our entries in shadow_set
-        list(map(shadow_set.add, self))
-
-        for project_name in plugin_projects:
-
-            for dist in plugin_env[project_name]:
-
-                req = [dist.as_requirement()]
-
-                try:
-                    resolvees = shadow_set.resolve(req, env, installer)
-
-                except ResolutionError as v:
-                    # save error info
-                    error_info[dist] = v
-                    if fallback:
-                        # try the next older version of project
-                        continue
-                    else:
-                        # give up on this project, keep going
-                        break
-
-                else:
-                    list(map(shadow_set.add, resolvees))
-                    distributions.update(dict.fromkeys(resolvees))
-
-                    # success, no need to try any more versions of this project
-                    break
-
-        distributions = list(distributions)
-        distributions.sort()
-
-        return distributions, error_info
-
-    def require(self, *requirements):
-        """Ensure that distributions matching `requirements` are activated
-
-        `requirements` must be a string or a (possibly-nested) sequence
-        thereof, specifying the distributions and versions required.  The
-        return value is a sequence of the distributions that needed to be
-        activated to fulfill the requirements; all relevant distributions are
-        included, even if they were already activated in this working set.
-        """
-        needed = self.resolve(parse_requirements(requirements))
-
-        for dist in needed:
-            self.add(dist)
-
-        return needed
-
-    def subscribe(self, callback, existing=True):
-        """Invoke `callback` for all distributions
-
-        If `existing=True` (default),
-        call on all existing ones, as well.
-        """
-        if callback in self.callbacks:
-            return
-        self.callbacks.append(callback)
-        if not existing:
-            return
-        for dist in self:
-            callback(dist)
-
-    def _added_new(self, dist):
-        for callback in self.callbacks:
-            callback(dist)
-
-    def __getstate__(self):
-        return (
-            self.entries[:], self.entry_keys.copy(), self.by_key.copy(),
-            self.callbacks[:]
-        )
-
-    def __setstate__(self, e_k_b_c):
-        entries, keys, by_key, callbacks = e_k_b_c
-        self.entries = entries[:]
-        self.entry_keys = keys.copy()
-        self.by_key = by_key.copy()
-        self.callbacks = callbacks[:]
-
-
-class _ReqExtras(dict):
-    """
-    Map each requirement to the extras that demanded it.
-    """
-
-    def markers_pass(self, req, extras=None):
-        """
-        Evaluate markers for req against each extra that
-        demanded it.
-
-        Return False if the req has a marker and fails
-        evaluation. Otherwise, return True.
-        """
-        extra_evals = (
-            req.marker.evaluate({'extra': extra})
-            for extra in self.get(req, ()) + (extras or (None,))
-        )
-        return not req.marker or any(extra_evals)
-
-
-class Environment:
-    """Searchable snapshot of distributions on a search path"""
-
-    def __init__(
-            self, search_path=None, platform=get_supported_platform(),
-            python=PY_MAJOR):
-        """Snapshot distributions available on a search path
-
-        Any distributions found on `search_path` are added to the environment.
-        `search_path` should be a sequence of ``sys.path`` items.  If not
-        supplied, ``sys.path`` is used.
-
-        `platform` is an optional string specifying the name of the platform
-        that platform-specific distributions must be compatible with.  If
-        unspecified, it defaults to the current platform.  `python` is an
-        optional string naming the desired version of Python (e.g. ``'3.6'``);
-        it defaults to the current version.
-
-        You may explicitly set `platform` (and/or `python`) to ``None`` if you
-        wish to map *all* distributions, not just those compatible with the
-        running platform or Python version.
-        """
-        self._distmap = {}
-        self.platform = platform
-        self.python = python
-        self.scan(search_path)
-
-    def can_add(self, dist):
-        """Is distribution `dist` acceptable for this environment?
-
-        The distribution must match the platform and python version
-        requirements specified when this environment was created, or False
-        is returned.
-        """
-        py_compat = (
-            self.python is None
-            or dist.py_version is None
-            or dist.py_version == self.python
-        )
-        return py_compat and compatible_platforms(dist.platform, self.platform)
-
-    def remove(self, dist):
-        """Remove `dist` from the environment"""
-        self._distmap[dist.key].remove(dist)
-
-    def scan(self, search_path=None):
-        """Scan `search_path` for distributions usable in this environment
-
-        Any distributions found are added to the environment.
-        `search_path` should be a sequence of ``sys.path`` items.  If not
-        supplied, ``sys.path`` is used.  Only distributions conforming to
-        the platform/python version defined at initialization are added.
-        """
-        if search_path is None:
-            search_path = sys.path
-
-        for item in search_path:
-            for dist in find_distributions(item):
-                self.add(dist)
-
-    def __getitem__(self, project_name):
-        """Return a newest-to-oldest list of distributions for `project_name`
-
-        Uses case-insensitive `project_name` comparison, assuming all the
-        project's distributions use their project's name converted to all
-        lowercase as their key.
-
-        """
-        distribution_key = project_name.lower()
-        return self._distmap.get(distribution_key, [])
-
-    def add(self, dist):
-        """Add `dist` if we ``can_add()`` it and it has not already been added
-        """
-        if self.can_add(dist) and dist.has_version():
-            dists = self._distmap.setdefault(dist.key, [])
-            if dist not in dists:
-                dists.append(dist)
-                dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
-
-    def best_match(
-            self, req, working_set, installer=None, replace_conflicting=False):
-        """Find distribution best matching `req` and usable on `working_set`
-
-        This calls the ``find(req)`` method of the `working_set` to see if a
-        suitable distribution is already active.  (This may raise
-        ``VersionConflict`` if an unsuitable version of the project is already
-        active in the specified `working_set`.)  If a suitable distribution
-        isn't active, this method returns the newest distribution in the
-        environment that meets the ``Requirement`` in `req`.  If no suitable
-        distribution is found, and `installer` is supplied, then the result of
-        calling the environment's ``obtain(req, installer)`` method will be
-        returned.
-        """
-        try:
-            dist = working_set.find(req)
-        except VersionConflict:
-            if not replace_conflicting:
-                raise
-            dist = None
-        if dist is not None:
-            return dist
-        for dist in self[req.key]:
-            if dist in req:
-                return dist
-        # try to download/install
-        return self.obtain(req, installer)
-
-    def obtain(self, requirement, installer=None):
-        """Obtain a distribution matching `requirement` (e.g. via download)
-
-        Obtain a distro that matches requirement (e.g. via download).  In the
-        base ``Environment`` class, this routine just returns
-        ``installer(requirement)``, unless `installer` is None, in which case
-        None is returned instead.  This method is a hook that allows subclasses
-        to attempt other ways of obtaining a distribution before falling back
-        to the `installer` argument."""
-        if installer is not None:
-            return installer(requirement)
-
-    def __iter__(self):
-        """Yield the unique project names of the available distributions"""
-        for key in self._distmap.keys():
-            if self[key]:
-                yield key
-
-    def __iadd__(self, other):
-        """In-place addition of a distribution or environment"""
-        if isinstance(other, Distribution):
-            self.add(other)
-        elif isinstance(other, Environment):
-            for project in other:
-                for dist in other[project]:
-                    self.add(dist)
-        else:
-            raise TypeError("Can't add %r to environment" % (other,))
-        return self
-
-    def __add__(self, other):
-        """Add an environment or distribution to an environment"""
-        new = self.__class__([], platform=None, python=None)
-        for env in self, other:
-            new += env
-        return new
-
-
-# XXX backward compatibility
-AvailableDistributions = Environment
-
-
-class ExtractionError(RuntimeError):
-    """An error occurred extracting a resource
-
-    The following attributes are available from instances of this exception:
-
-    manager
-        The resource manager that raised this exception
-
-    cache_path
-        The base directory for resource extraction
-
-    original_error
-        The exception instance that caused extraction to fail
-    """
-
-
-class ResourceManager:
-    """Manage resource extraction and packages"""
-    extraction_path = None
-
-    def __init__(self):
-        self.cached_files = {}
-
-    def resource_exists(self, package_or_requirement, resource_name):
-        """Does the named resource exist?"""
-        return get_provider(package_or_requirement).has_resource(resource_name)
-
-    def resource_isdir(self, package_or_requirement, resource_name):
-        """Is the named resource an existing directory?"""
-        return get_provider(package_or_requirement).resource_isdir(
-            resource_name
-        )
-
-    def resource_filename(self, package_or_requirement, resource_name):
-        """Return a true filesystem path for specified resource"""
-        return get_provider(package_or_requirement).get_resource_filename(
-            self, resource_name
-        )
-
-    def resource_stream(self, package_or_requirement, resource_name):
-        """Return a readable file-like object for specified resource"""
-        return get_provider(package_or_requirement).get_resource_stream(
-            self, resource_name
-        )
-
-    def resource_string(self, package_or_requirement, resource_name):
-        """Return specified resource as a string"""
-        return get_provider(package_or_requirement).get_resource_string(
-            self, resource_name
-        )
-
-    def resource_listdir(self, package_or_requirement, resource_name):
-        """List the contents of the named resource directory"""
-        return get_provider(package_or_requirement).resource_listdir(
-            resource_name
-        )
-
-    def extraction_error(self):
-        """Give an error message for problems extracting file(s)"""
-
-        old_exc = sys.exc_info()[1]
-        cache_path = self.extraction_path or get_default_cache()
-
-        tmpl = textwrap.dedent("""
-            Can't extract file(s) to egg cache
-
-            The following error occurred while trying to extract file(s)
-            to the Python egg cache:
-
-              {old_exc}
-
-            The Python egg cache directory is currently set to:
-
-              {cache_path}
-
-            Perhaps your account does not have write access to this directory?
-            You can change the cache directory by setting the PYTHON_EGG_CACHE
-            environment variable to point to an accessible directory.
-            """).lstrip()
-        err = ExtractionError(tmpl.format(**locals()))
-        err.manager = self
-        err.cache_path = cache_path
-        err.original_error = old_exc
-        raise err
-
-    def get_cache_path(self, archive_name, names=()):
-        """Return absolute location in cache for `archive_name` and `names`
-
-        The parent directory of the resulting path will be created if it does
-        not already exist.  `archive_name` should be the base filename of the
-        enclosing egg (which may not be the name of the enclosing zipfile!),
-        including its ".egg" extension.  `names`, if provided, should be a
-        sequence of path name parts "under" the egg's extraction location.
-
-        This method should only be called by resource providers that need to
-        obtain an extraction location, and only for names they intend to
-        extract, as it tracks the generated names for possible cleanup later.
-        """
-        extract_path = self.extraction_path or get_default_cache()
-        target_path = os.path.join(extract_path, archive_name + '-tmp', *names)
-        try:
-            _bypass_ensure_directory(target_path)
-        except Exception:
-            self.extraction_error()
-
-        self._warn_unsafe_extraction_path(extract_path)
-
-        self.cached_files[target_path] = 1
-        return target_path
-
-    @staticmethod
-    def _warn_unsafe_extraction_path(path):
-        """
-        If the default extraction path is overridden and set to an insecure
-        location, such as /tmp, it opens up an opportunity for an attacker to
-        replace an extracted file with an unauthorized payload. Warn the user
-        if a known insecure location is used.
-
-        See Distribute #375 for more details.
-        """
-        if os.name == 'nt' and not path.startswith(os.environ['windir']):
-            # On Windows, permissions are generally restrictive by default
-            #  and temp directories are not writable by other users, so
-            #  bypass the warning.
-            return
-        mode = os.stat(path).st_mode
-        if mode & stat.S_IWOTH or mode & stat.S_IWGRP:
-            msg = (
-                "%s is writable by group/others and vulnerable to attack "
-                "when "
-                "used with get_resource_filename. Consider a more secure "
-                "location (set with .set_extraction_path or the "
-                "PYTHON_EGG_CACHE environment variable)." % path
-            )
-            warnings.warn(msg, UserWarning)
-
-    def postprocess(self, tempname, filename):
-        """Perform any platform-specific postprocessing of `tempname`
-
-        This is where Mac header rewrites should be done; other platforms don't
-        have anything special they should do.
-
-        Resource providers should call this method ONLY after successfully
-        extracting a compressed resource.  They must NOT call it on resources
-        that are already in the filesystem.
-
-        `tempname` is the current (temporary) name of the file, and `filename`
-        is the name it will be renamed to by the caller after this routine
-        returns.
-        """
-
-        if os.name == 'posix':
-            # Make the resource executable
-            mode = ((os.stat(tempname).st_mode) | 0o555) & 0o7777
-            os.chmod(tempname, mode)
-
-    def set_extraction_path(self, path):
-        """Set the base path where resources will be extracted to, if needed.
-
-        If you do not call this routine before any extractions take place, the
-        path defaults to the return value of ``get_default_cache()``.  (Which
-        is based on the ``PYTHON_EGG_CACHE`` environment variable, with various
-        platform-specific fallbacks.  See that routine's documentation for more
-        details.)
-
-        Resources are extracted to subdirectories of this path based upon
-        information given by the ``IResourceProvider``.  You may set this to a
-        temporary directory, but then you must call ``cleanup_resources()`` to
-        delete the extracted files when done.  There is no guarantee that
-        ``cleanup_resources()`` will be able to remove all extracted files.
-
-        (Note: you may not change the extraction path for a given resource
-        manager once resources have been extracted, unless you first call
-        ``cleanup_resources()``.)
-        """
-        if self.cached_files:
-            raise ValueError(
-                "Can't change extraction path, files already extracted"
-            )
-
-        self.extraction_path = path
-
-    def cleanup_resources(self, force=False):
-        """
-        Delete all extracted resource files and directories, returning a list
-        of the file and directory names that could not be successfully removed.
-        This function does not have any concurrency protection, so it should
-        generally only be called when the extraction path is a temporary
-        directory exclusive to a single process.  This method is not
-        automatically called; you must call it explicitly or register it as an
-        ``atexit`` function if you wish to ensure cleanup of a temporary
-        directory used for extractions.
-        """
-        # XXX
-
-
-def get_default_cache():
-    """
-    Return the ``PYTHON_EGG_CACHE`` environment variable
-    or a platform-relevant user cache dir for an app
-    named "Python-Eggs".
-    """
-    return (
-        os.environ.get('PYTHON_EGG_CACHE')
-        or appdirs.user_cache_dir(appname='Python-Eggs')
-    )
-
-
-def safe_name(name):
-    """Convert an arbitrary string to a standard distribution name
-
-    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
-    """
-    return re.sub('[^A-Za-z0-9.]+', '-', name)
-
-
-def safe_version(version):
-    """
-    Convert an arbitrary string to a standard version string
-    """
-    try:
-        # normalize the version
-        return str(packaging.version.Version(version))
-    except packaging.version.InvalidVersion:
-        version = version.replace(' ', '.')
-        return re.sub('[^A-Za-z0-9.]+', '-', version)
-
-
-def safe_extra(extra):
-    """Convert an arbitrary string to a standard 'extra' name
-
-    Any runs of non-alphanumeric characters are replaced with a single '_',
-    and the result is always lowercased.
-    """
-    return re.sub('[^A-Za-z0-9.-]+', '_', extra).lower()
-
-
-def to_filename(name):
-    """Convert a project or version name to its filename-escaped form
-
-    Any '-' characters are currently replaced with '_'.
-    """
-    return name.replace('-', '_')
-
-
-def invalid_marker(text):
-    """
-    Validate text as a PEP 508 environment marker; return an exception
-    if invalid or False otherwise.
-    """
-    try:
-        evaluate_marker(text)
-    except SyntaxError as e:
-        e.filename = None
-        e.lineno = None
-        return e
-    return False
-
-
-def evaluate_marker(text, extra=None):
-    """
-    Evaluate a PEP 508 environment marker.
-    Return a boolean indicating the marker result in this environment.
-    Raise SyntaxError if marker is invalid.
-
-    This implementation uses the 'pyparsing' module.
-    """
-    try:
-        marker = packaging.markers.Marker(text)
-        return marker.evaluate()
-    except packaging.markers.InvalidMarker as e:
-        raise SyntaxError(e)
-
-
-class NullProvider:
-    """Try to implement resources and metadata for arbitrary PEP 302 loaders"""
-
-    egg_name = None
-    egg_info = None
-    loader = None
-
-    def __init__(self, module):
-        self.loader = getattr(module, '__loader__', None)
-        self.module_path = os.path.dirname(getattr(module, '__file__', ''))
-
-    def get_resource_filename(self, manager, resource_name):
-        return self._fn(self.module_path, resource_name)
-
-    def get_resource_stream(self, manager, resource_name):
-        return io.BytesIO(self.get_resource_string(manager, resource_name))
-
-    def get_resource_string(self, manager, resource_name):
-        return self._get(self._fn(self.module_path, resource_name))
-
-    def has_resource(self, resource_name):
-        return self._has(self._fn(self.module_path, resource_name))
-
-    def _get_metadata_path(self, name):
-        return self._fn(self.egg_info, name)
-
-    def has_metadata(self, name):
-        if not self.egg_info:
-            return self.egg_info
-
-        path = self._get_metadata_path(name)
-        return self._has(path)
-
-    def get_metadata(self, name):
-        if not self.egg_info:
-            return ""
-        path = self._get_metadata_path(name)
-        value = self._get(path)
-        if six.PY2:
-            return value
-        try:
-            return value.decode('utf-8')
-        except UnicodeDecodeError as exc:
-            # Include the path in the error message to simplify
-            # troubleshooting, and without changing the exception type.
-            exc.reason += ' in {} file at path: {}'.format(name, path)
-            raise
-
-    def get_metadata_lines(self, name):
-        return yield_lines(self.get_metadata(name))
-
-    def resource_isdir(self, resource_name):
-        return self._isdir(self._fn(self.module_path, resource_name))
-
-    def metadata_isdir(self, name):
-        return self.egg_info and self._isdir(self._fn(self.egg_info, name))
-
-    def resource_listdir(self, resource_name):
-        return self._listdir(self._fn(self.module_path, resource_name))
-
-    def metadata_listdir(self, name):
-        if self.egg_info:
-            return self._listdir(self._fn(self.egg_info, name))
-        return []
-
-    def run_script(self, script_name, namespace):
-        script = 'scripts/' + script_name
-        if not self.has_metadata(script):
-            raise ResolutionError(
-                "Script {script!r} not found in metadata at {self.egg_info!r}"
-                .format(**locals()),
-            )
-        script_text = self.get_metadata(script).replace('\r\n', '\n')
-        script_text = script_text.replace('\r', '\n')
-        script_filename = self._fn(self.egg_info, script)
-        namespace['__file__'] = script_filename
-        if os.path.exists(script_filename):
-            source = open(script_filename).read()
-            code = compile(source, script_filename, 'exec')
-            exec(code, namespace, namespace)
-        else:
-            from linecache import cache
-            cache[script_filename] = (
-                len(script_text), 0, script_text.split('\n'), script_filename
-            )
-            script_code = compile(script_text, script_filename, 'exec')
-            exec(script_code, namespace, namespace)
-
-    def _has(self, path):
-        raise NotImplementedError(
-            "Can't perform this operation for unregistered loader type"
-        )
-
-    def _isdir(self, path):
-        raise NotImplementedError(
-            "Can't perform this operation for unregistered loader type"
-        )
-
-    def _listdir(self, path):
-        raise NotImplementedError(
-            "Can't perform this operation for unregistered loader type"
-        )
-
-    def _fn(self, base, resource_name):
-        self._validate_resource_path(resource_name)
-        if resource_name:
-            return os.path.join(base, *resource_name.split('/'))
-        return base
-
-    @staticmethod
-    def _validate_resource_path(path):
-        """
-        Validate the resource paths according to the docs.
-        https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access
-
-        >>> warned = getfixture('recwarn')
-        >>> warnings.simplefilter('always')
-        >>> vrp = NullProvider._validate_resource_path
-        >>> vrp('foo/bar.txt')
-        >>> bool(warned)
-        False
-        >>> vrp('../foo/bar.txt')
-        >>> bool(warned)
-        True
-        >>> warned.clear()
-        >>> vrp('/foo/bar.txt')
-        >>> bool(warned)
-        True
-        >>> vrp('foo/../../bar.txt')
-        >>> bool(warned)
-        True
-        >>> warned.clear()
-        >>> vrp('foo/f../bar.txt')
-        >>> bool(warned)
-        False
-
-        Windows path separators are straight-up disallowed.
-        >>> vrp(r'\\foo/bar.txt')
-        Traceback (most recent call last):
-        ...
-        ValueError: Use of .. or absolute path in a resource path \
-is not allowed.
-
-        >>> vrp(r'C:\\foo/bar.txt')
-        Traceback (most recent call last):
-        ...
-        ValueError: Use of .. or absolute path in a resource path \
-is not allowed.
-
-        Blank values are allowed
-
-        >>> vrp('')
-        >>> bool(warned)
-        False
-
-        Non-string values are not.
-
-        >>> vrp(None)
-        Traceback (most recent call last):
-        ...
-        AttributeError: ...
-        """
-        invalid = (
-            os.path.pardir in path.split(posixpath.sep) or
-            posixpath.isabs(path) or
-            ntpath.isabs(path)
-        )
-        if not invalid:
-            return
-
-        msg = "Use of .. or absolute path in a resource path is not allowed."
-
-        # Aggressively disallow Windows absolute paths
-        if ntpath.isabs(path) and not posixpath.isabs(path):
-            raise ValueError(msg)
-
-        # for compatibility, warn; in future
-        # raise ValueError(msg)
-        warnings.warn(
-            msg[:-1] + " and will raise exceptions in a future release.",
-            DeprecationWarning,
-            stacklevel=4,
-        )
-
-    def _get(self, path):
-        if hasattr(self.loader, 'get_data'):
-            return self.loader.get_data(path)
-        raise NotImplementedError(
-            "Can't perform this operation for loaders without 'get_data()'"
-        )
-
-
-register_loader_type(object, NullProvider)
-
-
-class EggProvider(NullProvider):
-    """Provider based on a virtual filesystem"""
-
-    def __init__(self, module):
-        NullProvider.__init__(self, module)
-        self._setup_prefix()
-
-    def _setup_prefix(self):
-        # we assume here that our metadata may be nested inside a "basket"
-        # of multiple eggs; that's why we use module_path instead of .archive
-        path = self.module_path
-        old = None
-        while path != old:
-            if _is_egg_path(path):
-                self.egg_name = os.path.basename(path)
-                self.egg_info = os.path.join(path, 'EGG-INFO')
-                self.egg_root = path
-                break
-            old = path
-            path, base = os.path.split(path)
-
-
-class DefaultProvider(EggProvider):
-    """Provides access to package resources in the filesystem"""
-
-    def _has(self, path):
-        return os.path.exists(path)
-
-    def _isdir(self, path):
-        return os.path.isdir(path)
-
-    def _listdir(self, path):
-        return os.listdir(path)
-
-    def get_resource_stream(self, manager, resource_name):
-        return open(self._fn(self.module_path, resource_name), 'rb')
-
-    def _get(self, path):
-        with open(path, 'rb') as stream:
-            return stream.read()
-
-    @classmethod
-    def _register(cls):
-        loader_names = 'SourceFileLoader', 'SourcelessFileLoader',
-        for name in loader_names:
-            loader_cls = getattr(importlib_machinery, name, type(None))
-            register_loader_type(loader_cls, cls)
-
-
-DefaultProvider._register()
-
-
-class EmptyProvider(NullProvider):
-    """Provider that returns nothing for all requests"""
-
-    module_path = None
-
-    _isdir = _has = lambda self, path: False
-
-    def _get(self, path):
-        return ''
-
-    def _listdir(self, path):
-        return []
-
-    def __init__(self):
-        pass
-
-
-empty_provider = EmptyProvider()
-
-
-class ZipManifests(dict):
-    """
-    zip manifest builder
-    """
-
-    @classmethod
-    def build(cls, path):
-        """
-        Build a dictionary similar to the zipimport directory
-        caches, except instead of tuples, store ZipInfo objects.
-
-        Use a platform-specific path separator (os.sep) for the path keys
-        for compatibility with pypy on Windows.
-        """
-        with zipfile.ZipFile(path) as zfile:
-            items = (
-                (
-                    name.replace('/', os.sep),
-                    zfile.getinfo(name),
-                )
-                for name in zfile.namelist()
-            )
-            return dict(items)
-
-    load = build
-
-
-class MemoizedZipManifests(ZipManifests):
-    """
-    Memoized zipfile manifests.
-    """
-    manifest_mod = collections.namedtuple('manifest_mod', 'manifest mtime')
-
-    def load(self, path):
-        """
-        Load a manifest at path or return a suitable manifest already loaded.
-        """
-        path = os.path.normpath(path)
-        mtime = os.stat(path).st_mtime
-
-        if path not in self or self[path].mtime != mtime:
-            manifest = self.build(path)
-            self[path] = self.manifest_mod(manifest, mtime)
-
-        return self[path].manifest
-
-
-class ZipProvider(EggProvider):
-    """Resource support for zips and eggs"""
-
-    eagers = None
-    _zip_manifests = MemoizedZipManifests()
-
-    def __init__(self, module):
-        EggProvider.__init__(self, module)
-        self.zip_pre = self.loader.archive + os.sep
-
-    def _zipinfo_name(self, fspath):
-        # Convert a virtual filename (full path to file) into a zipfile subpath
-        # usable with the zipimport directory cache for our target archive
-        fspath = fspath.rstrip(os.sep)
-        if fspath == self.loader.archive:
-            return ''
-        if fspath.startswith(self.zip_pre):
-            return fspath[len(self.zip_pre):]
-        raise AssertionError(
-            "%s is not a subpath of %s" % (fspath, self.zip_pre)
-        )
-
-    def _parts(self, zip_path):
-        # Convert a zipfile subpath into an egg-relative path part list.
-        # pseudo-fs path
-        fspath = self.zip_pre + zip_path
-        if fspath.startswith(self.egg_root + os.sep):
-            return fspath[len(self.egg_root) + 1:].split(os.sep)
-        raise AssertionError(
-            "%s is not a subpath of %s" % (fspath, self.egg_root)
-        )
-
-    @property
-    def zipinfo(self):
-        return self._zip_manifests.load(self.loader.archive)
-
-    def get_resource_filename(self, manager, resource_name):
-        if not self.egg_name:
-            raise NotImplementedError(
-                "resource_filename() only supported for .egg, not .zip"
-            )
-        # no need to lock for extraction, since we use temp names
-        zip_path = self._resource_to_zip(resource_name)
-        eagers = self._get_eager_resources()
-        if '/'.join(self._parts(zip_path)) in eagers:
-            for name in eagers:
-                self._extract_resource(manager, self._eager_to_zip(name))
-        return self._extract_resource(manager, zip_path)
-
-    @staticmethod
-    def _get_date_and_size(zip_stat):
-        size = zip_stat.file_size
-        # ymdhms+wday, yday, dst
-        date_time = zip_stat.date_time + (0, 0, -1)
-        # 1980 offset already done
-        timestamp = time.mktime(date_time)
-        return timestamp, size
-
-    def _extract_resource(self, manager, zip_path):
-
-        if zip_path in self._index():
-            for name in self._index()[zip_path]:
-                last = self._extract_resource(
-                    manager, os.path.join(zip_path, name)
-                )
-            # return the extracted directory name
-            return os.path.dirname(last)
-
-        timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
-
-        if not WRITE_SUPPORT:
-            raise IOError('"os.rename" and "os.unlink" are not supported '
-                          'on this platform')
-        try:
-
-            real_path = manager.get_cache_path(
-                self.egg_name, self._parts(zip_path)
-            )
-
-            if self._is_current(real_path, zip_path):
-                return real_path
-
-            outf, tmpnam = _mkstemp(
-                ".$extract",
-                dir=os.path.dirname(real_path),
-            )
-            os.write(outf, self.loader.get_data(zip_path))
-            os.close(outf)
-            utime(tmpnam, (timestamp, timestamp))
-            manager.postprocess(tmpnam, real_path)
-
-            try:
-                rename(tmpnam, real_path)
-
-            except os.error:
-                if os.path.isfile(real_path):
-                    if self._is_current(real_path, zip_path):
-                        # the file became current since it was checked above,
-                        #  so proceed.
-                        return real_path
-                    # Windows, del old file and retry
-                    elif os.name == 'nt':
-                        unlink(real_path)
-                        rename(tmpnam, real_path)
-                        return real_path
-                raise
-
-        except os.error:
-            # report a user-friendly error
-            manager.extraction_error()
-
-        return real_path
-
-    def _is_current(self, file_path, zip_path):
-        """
-        Return True if the file_path is current for this zip_path
-        """
-        timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
-        if not os.path.isfile(file_path):
-            return False
-        stat = os.stat(file_path)
-        if stat.st_size != size or stat.st_mtime != timestamp:
-            return False
-        # check that the contents match
-        zip_contents = self.loader.get_data(zip_path)
-        with open(file_path, 'rb') as f:
-            file_contents = f.read()
-        return zip_contents == file_contents
-
-    def _get_eager_resources(self):
-        if self.eagers is None:
-            eagers = []
-            for name in ('native_libs.txt', 'eager_resources.txt'):
-                if self.has_metadata(name):
-                    eagers.extend(self.get_metadata_lines(name))
-            self.eagers = eagers
-        return self.eagers
-
-    def _index(self):
-        try:
-            return self._dirindex
-        except AttributeError:
-            ind = {}
-            for path in self.zipinfo:
-                parts = path.split(os.sep)
-                while parts:
-                    parent = os.sep.join(parts[:-1])
-                    if parent in ind:
-                        ind[parent].append(parts[-1])
-                        break
-                    else:
-                        ind[parent] = [parts.pop()]
-            self._dirindex = ind
-            return ind
-
-    def _has(self, fspath):
-        zip_path = self._zipinfo_name(fspath)
-        return zip_path in self.zipinfo or zip_path in self._index()
-
-    def _isdir(self, fspath):
-        return self._zipinfo_name(fspath) in self._index()
-
-    def _listdir(self, fspath):
-        return list(self._index().get(self._zipinfo_name(fspath), ()))
-
-    def _eager_to_zip(self, resource_name):
-        return self._zipinfo_name(self._fn(self.egg_root, resource_name))
-
-    def _resource_to_zip(self, resource_name):
-        return self._zipinfo_name(self._fn(self.module_path, resource_name))
-
-
-register_loader_type(zipimport.zipimporter, ZipProvider)
-
-
-class FileMetadata(EmptyProvider):
-    """Metadata handler for standalone PKG-INFO files
-
-    Usage::
-
-        metadata = FileMetadata("/path/to/PKG-INFO")
-
-    This provider rejects all data and metadata requests except for PKG-INFO,
-    which is treated as existing, and will be the contents of the file at
-    the provided location.
-    """
-
-    def __init__(self, path):
-        self.path = path
-
-    def _get_metadata_path(self, name):
-        return self.path
-
-    def has_metadata(self, name):
-        return name == 'PKG-INFO' and os.path.isfile(self.path)
-
-    def get_metadata(self, name):
-        if name != 'PKG-INFO':
-            raise KeyError("No metadata except PKG-INFO is available")
-
-        with io.open(self.path, encoding='utf-8', errors="replace") as f:
-            metadata = f.read()
-        self._warn_on_replacement(metadata)
-        return metadata
-
-    def _warn_on_replacement(self, metadata):
-        # Python 2.7 compat for: replacement_char = '�'
-        replacement_char = b'\xef\xbf\xbd'.decode('utf-8')
-        if replacement_char in metadata:
-            tmpl = "{self.path} could not be properly decoded in UTF-8"
-            msg = tmpl.format(**locals())
-            warnings.warn(msg)
-
-    def get_metadata_lines(self, name):
-        return yield_lines(self.get_metadata(name))
-
-
-class PathMetadata(DefaultProvider):
-    """Metadata provider for egg directories
-
-    Usage::
-
-        # Development eggs:
-
-        egg_info = "/path/to/PackageName.egg-info"
-        base_dir = os.path.dirname(egg_info)
-        metadata = PathMetadata(base_dir, egg_info)
-        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
-        dist = Distribution(basedir, project_name=dist_name, metadata=metadata)
-
-        # Unpacked egg directories:
-
-        egg_path = "/path/to/PackageName-ver-pyver-etc.egg"
-        metadata = PathMetadata(egg_path, os.path.join(egg_path,'EGG-INFO'))
-        dist = Distribution.from_filename(egg_path, metadata=metadata)
-    """
-
-    def __init__(self, path, egg_info):
-        self.module_path = path
-        self.egg_info = egg_info
-
-
-class EggMetadata(ZipProvider):
-    """Metadata provider for .egg files"""
-
-    def __init__(self, importer):
-        """Create a metadata provider from a zipimporter"""
-
-        self.zip_pre = importer.archive + os.sep
-        self.loader = importer
-        if importer.prefix:
-            self.module_path = os.path.join(importer.archive, importer.prefix)
-        else:
-            self.module_path = importer.archive
-        self._setup_prefix()
-
-
-_declare_state('dict', _distribution_finders={})
-
-
-def register_finder(importer_type, distribution_finder):
-    """Register `distribution_finder` to find distributions in sys.path items
-
-    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
-    handler), and `distribution_finder` is a callable that, passed a path
-    item and the importer instance, yields ``Distribution`` instances found on
-    that path item.  See ``pkg_resources.find_on_path`` for an example."""
-    _distribution_finders[importer_type] = distribution_finder
-
-
-def find_distributions(path_item, only=False):
-    """Yield distributions accessible via `path_item`"""
-    importer = get_importer(path_item)
-    finder = _find_adapter(_distribution_finders, importer)
-    return finder(importer, path_item, only)
-
-
-def find_eggs_in_zip(importer, path_item, only=False):
-    """
-    Find eggs in zip files; possibly multiple nested eggs.
-    """
-    if importer.archive.endswith('.whl'):
-        # wheels are not supported with this finder
-        # they don't have PKG-INFO metadata, and won't ever contain eggs
-        return
-    metadata = EggMetadata(importer)
-    if metadata.has_metadata('PKG-INFO'):
-        yield Distribution.from_filename(path_item, metadata=metadata)
-    if only:
-        # don't yield nested distros
-        return
-    for subitem in metadata.resource_listdir(''):
-        if _is_egg_path(subitem):
-            subpath = os.path.join(path_item, subitem)
-            dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath)
-            for dist in dists:
-                yield dist
-        elif subitem.lower().endswith('.dist-info'):
-            subpath = os.path.join(path_item, subitem)
-            submeta = EggMetadata(zipimport.zipimporter(subpath))
-            submeta.egg_info = subpath
-            yield Distribution.from_location(path_item, subitem, submeta)
-
-
-register_finder(zipimport.zipimporter, find_eggs_in_zip)
-
-
-def find_nothing(importer, path_item, only=False):
-    return ()
-
-
-register_finder(object, find_nothing)
-
-
-def _by_version_descending(names):
-    """
-    Given a list of filenames, return them in descending order
-    by version number.
-
-    >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg'
-    >>> _by_version_descending(names)
-    ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar']
-    >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.egg'
-    >>> _by_version_descending(names)
-    ['Setuptools-1.2.3.egg', 'Setuptools-1.2.3b1.egg']
-    >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.post1.egg'
-    >>> _by_version_descending(names)
-    ['Setuptools-1.2.3.post1.egg', 'Setuptools-1.2.3b1.egg']
-    """
-    def _by_version(name):
-        """
-        Parse each component of the filename
-        """
-        name, ext = os.path.splitext(name)
-        parts = itertools.chain(name.split('-'), [ext])
-        return [packaging.version.parse(part) for part in parts]
-
-    return sorted(names, key=_by_version, reverse=True)
-
-
-def find_on_path(importer, path_item, only=False):
-    """Yield distributions accessible on a sys.path directory"""
-    path_item = _normalize_cached(path_item)
-
-    if _is_unpacked_egg(path_item):
-        yield Distribution.from_filename(
-            path_item, metadata=PathMetadata(
-                path_item, os.path.join(path_item, 'EGG-INFO')
-            )
-        )
-        return
-
-    entries = safe_listdir(path_item)
-
-    # for performance, before sorting by version,
-    # screen entries for only those that will yield
-    # distributions
-    filtered = (
-        entry
-        for entry in entries
-        if dist_factory(path_item, entry, only)
-    )
-
-    # scan for .egg and .egg-info in directory
-    path_item_entries = _by_version_descending(filtered)
-    for entry in path_item_entries:
-        fullpath = os.path.join(path_item, entry)
-        factory = dist_factory(path_item, entry, only)
-        for dist in factory(fullpath):
-            yield dist
-
-
-def dist_factory(path_item, entry, only):
-    """
-    Return a dist_factory for a path_item and entry
-    """
-    lower = entry.lower()
-    is_meta = any(map(lower.endswith, ('.egg-info', '.dist-info')))
-    return (
-        distributions_from_metadata
-        if is_meta else
-        find_distributions
-        if not only and _is_egg_path(entry) else
-        resolve_egg_link
-        if not only and lower.endswith('.egg-link') else
-        NoDists()
-    )
-
-
-class NoDists:
-    """
-    >>> bool(NoDists())
-    False
-
-    >>> list(NoDists()('anything'))
-    []
-    """
-    def __bool__(self):
-        return False
-    if six.PY2:
-        __nonzero__ = __bool__
-
-    def __call__(self, fullpath):
-        return iter(())
-
-
-def safe_listdir(path):
-    """
-    Attempt to list contents of path, but suppress some exceptions.
-    """
-    try:
-        return os.listdir(path)
-    except (PermissionError, NotADirectoryError):
-        pass
-    except OSError as e:
-        # Ignore the directory if does not exist, not a directory or
-        # permission denied
-        ignorable = (
-            e.errno in (errno.ENOTDIR, errno.EACCES, errno.ENOENT)
-            # Python 2 on Windows needs to be handled this way :(
-            or getattr(e, "winerror", None) == 267
-        )
-        if not ignorable:
-            raise
-    return ()
-
-
-def distributions_from_metadata(path):
-    root = os.path.dirname(path)
-    if os.path.isdir(path):
-        if len(os.listdir(path)) == 0:
-            # empty metadata dir; skip
-            return
-        metadata = PathMetadata(root, path)
-    else:
-        metadata = FileMetadata(path)
-    entry = os.path.basename(path)
-    yield Distribution.from_location(
-        root, entry, metadata, precedence=DEVELOP_DIST,
-    )
-
-
-def non_empty_lines(path):
-    """
-    Yield non-empty lines from file at path
-    """
-    with open(path) as f:
-        for line in f:
-            line = line.strip()
-            if line:
-                yield line
-
-
-def resolve_egg_link(path):
-    """
-    Given a path to an .egg-link, resolve distributions
-    present in the referenced path.
-    """
-    referenced_paths = non_empty_lines(path)
-    resolved_paths = (
-        os.path.join(os.path.dirname(path), ref)
-        for ref in referenced_paths
-    )
-    dist_groups = map(find_distributions, resolved_paths)
-    return next(dist_groups, ())
-
-
-register_finder(pkgutil.ImpImporter, find_on_path)
-
-if hasattr(importlib_machinery, 'FileFinder'):
-    register_finder(importlib_machinery.FileFinder, find_on_path)
-
-_declare_state('dict', _namespace_handlers={})
-_declare_state('dict', _namespace_packages={})
-
-
-def register_namespace_handler(importer_type, namespace_handler):
-    """Register `namespace_handler` to declare namespace packages
-
-    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
-    handler), and `namespace_handler` is a callable like this::
-
-        def namespace_handler(importer, path_entry, moduleName, module):
-            # return a path_entry to use for child packages
-
-    Namespace handlers are only called if the importer object has already
-    agreed that it can handle the relevant path item, and they should only
-    return a subpath if the module __path__ does not already contain an
-    equivalent subpath.  For an example namespace handler, see
-    ``pkg_resources.file_ns_handler``.
-    """
-    _namespace_handlers[importer_type] = namespace_handler
-
-
-def _handle_ns(packageName, path_item):
-    """Ensure that named package includes a subpath of path_item (if needed)"""
-
-    importer = get_importer(path_item)
-    if importer is None:
-        return None
-
-    # capture warnings due to #1111
-    with warnings.catch_warnings():
-        warnings.simplefilter("ignore")
-        loader = importer.find_module(packageName)
-
-    if loader is None:
-        return None
-    module = sys.modules.get(packageName)
-    if module is None:
-        module = sys.modules[packageName] = types.ModuleType(packageName)
-        module.__path__ = []
-        _set_parent_ns(packageName)
-    elif not hasattr(module, '__path__'):
-        raise TypeError("Not a package:", packageName)
-    handler = _find_adapter(_namespace_handlers, importer)
-    subpath = handler(importer, path_item, packageName, module)
-    if subpath is not None:
-        path = module.__path__
-        path.append(subpath)
-        loader.load_module(packageName)
-        _rebuild_mod_path(path, packageName, module)
-    return subpath
-
-
-def _rebuild_mod_path(orig_path, package_name, module):
-    """
-    Rebuild module.__path__ ensuring that all entries are ordered
-    corresponding to their sys.path order
-    """
-    sys_path = [_normalize_cached(p) for p in sys.path]
-
-    def safe_sys_path_index(entry):
-        """
-        Workaround for #520 and #513.
-        """
-        try:
-            return sys_path.index(entry)
-        except ValueError:
-            return float('inf')
-
-    def position_in_sys_path(path):
-        """
-        Return the ordinal of the path based on its position in sys.path
-        """
-        path_parts = path.split(os.sep)
-        module_parts = package_name.count('.') + 1
-        parts = path_parts[:-module_parts]
-        return safe_sys_path_index(_normalize_cached(os.sep.join(parts)))
-
-    new_path = sorted(orig_path, key=position_in_sys_path)
-    new_path = [_normalize_cached(p) for p in new_path]
-
-    if isinstance(module.__path__, list):
-        module.__path__[:] = new_path
-    else:
-        module.__path__ = new_path
-
-
-def declare_namespace(packageName):
-    """Declare that package 'packageName' is a namespace package"""
-
-    _imp.acquire_lock()
-    try:
-        if packageName in _namespace_packages:
-            return
-
-        path = sys.path
-        parent, _, _ = packageName.rpartition('.')
-
-        if parent:
-            declare_namespace(parent)
-            if parent not in _namespace_packages:
-                __import__(parent)
-            try:
-                path = sys.modules[parent].__path__
-            except AttributeError:
-                raise TypeError("Not a package:", parent)
-
-        # Track what packages are namespaces, so when new path items are added,
-        # they can be updated
-        _namespace_packages.setdefault(parent or None, []).append(packageName)
-        _namespace_packages.setdefault(packageName, [])
-
-        for path_item in path:
-            # Ensure all the parent's path items are reflected in the child,
-            # if they apply
-            _handle_ns(packageName, path_item)
-
-    finally:
-        _imp.release_lock()
-
-
-def fixup_namespace_packages(path_item, parent=None):
-    """Ensure that previously-declared namespace packages include path_item"""
-    _imp.acquire_lock()
-    try:
-        for package in _namespace_packages.get(parent, ()):
-            subpath = _handle_ns(package, path_item)
-            if subpath:
-                fixup_namespace_packages(subpath, package)
-    finally:
-        _imp.release_lock()
-
-
-def file_ns_handler(importer, path_item, packageName, module):
-    """Compute an ns-package subpath for a filesystem or zipfile importer"""
-
-    subpath = os.path.join(path_item, packageName.split('.')[-1])
-    normalized = _normalize_cached(subpath)
-    for item in module.__path__:
-        if _normalize_cached(item) == normalized:
-            break
-    else:
-        # Only return the path if it's not already there
-        return subpath
-
-
-register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
-register_namespace_handler(zipimport.zipimporter, file_ns_handler)
-
-if hasattr(importlib_machinery, 'FileFinder'):
-    register_namespace_handler(importlib_machinery.FileFinder, file_ns_handler)
-
-
-def null_ns_handler(importer, path_item, packageName, module):
-    return None
-
-
-register_namespace_handler(object, null_ns_handler)
-
-
-def normalize_path(filename):
-    """Normalize a file/dir name for comparison purposes"""
-    return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))
-
-
-def _cygwin_patch(filename):  # pragma: nocover
-    """
-    Contrary to POSIX 2008, on Cygwin, getcwd (3) contains
-    symlink components. Using
-    os.path.abspath() works around this limitation. A fix in os.getcwd()
-    would probably better, in Cygwin even more so, except
-    that this seems to be by design...
-    """
-    return os.path.abspath(filename) if sys.platform == 'cygwin' else filename
-
-
-def _normalize_cached(filename, _cache={}):
-    try:
-        return _cache[filename]
-    except KeyError:
-        _cache[filename] = result = normalize_path(filename)
-        return result
-
-
-def _is_egg_path(path):
-    """
-    Determine if given path appears to be an egg.
-    """
-    return path.lower().endswith('.egg')
-
-
-def _is_unpacked_egg(path):
-    """
-    Determine if given path appears to be an unpacked egg.
-    """
-    return (
-        _is_egg_path(path) and
-        os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO'))
-    )
-
-
-def _set_parent_ns(packageName):
-    parts = packageName.split('.')
-    name = parts.pop()
-    if parts:
-        parent = '.'.join(parts)
-        setattr(sys.modules[parent], name, sys.modules[packageName])
-
-
-def yield_lines(strs):
-    """Yield non-empty/non-comment lines of a string or sequence"""
-    if isinstance(strs, six.string_types):
-        for s in strs.splitlines():
-            s = s.strip()
-            # skip blank lines/comments
-            if s and not s.startswith('#'):
-                yield s
-    else:
-        for ss in strs:
-            for s in yield_lines(ss):
-                yield s
-
-
-MODULE = re.compile(r"\w+(\.\w+)*$").match
-EGG_NAME = re.compile(
-    r"""
-    (?P[^-]+) (
-        -(?P[^-]+) (
-            -py(?P[^-]+) (
-                -(?P.+)
-            )?
-        )?
-    )?
-    """,
-    re.VERBOSE | re.IGNORECASE,
-).match
-
-
-class EntryPoint:
-    """Object representing an advertised importable object"""
-
-    def __init__(self, name, module_name, attrs=(), extras=(), dist=None):
-        if not MODULE(module_name):
-            raise ValueError("Invalid module name", module_name)
-        self.name = name
-        self.module_name = module_name
-        self.attrs = tuple(attrs)
-        self.extras = tuple(extras)
-        self.dist = dist
-
-    def __str__(self):
-        s = "%s = %s" % (self.name, self.module_name)
-        if self.attrs:
-            s += ':' + '.'.join(self.attrs)
-        if self.extras:
-            s += ' [%s]' % ','.join(self.extras)
-        return s
-
-    def __repr__(self):
-        return "EntryPoint.parse(%r)" % str(self)
-
-    def load(self, require=True, *args, **kwargs):
-        """
-        Require packages for this EntryPoint, then resolve it.
-        """
-        if not require or args or kwargs:
-            warnings.warn(
-                "Parameters to load are deprecated.  Call .resolve and "
-                ".require separately.",
-                PkgResourcesDeprecationWarning,
-                stacklevel=2,
-            )
-        if require:
-            self.require(*args, **kwargs)
-        return self.resolve()
-
-    def resolve(self):
-        """
-        Resolve the entry point from its module and attrs.
-        """
-        module = __import__(self.module_name, fromlist=['__name__'], level=0)
-        try:
-            return functools.reduce(getattr, self.attrs, module)
-        except AttributeError as exc:
-            raise ImportError(str(exc))
-
-    def require(self, env=None, installer=None):
-        if self.extras and not self.dist:
-            raise UnknownExtra("Can't require() without a distribution", self)
-
-        # Get the requirements for this entry point with all its extras and
-        # then resolve them. We have to pass `extras` along when resolving so
-        # that the working set knows what extras we want. Otherwise, for
-        # dist-info distributions, the working set will assume that the
-        # requirements for that extra are purely optional and skip over them.
-        reqs = self.dist.requires(self.extras)
-        items = working_set.resolve(reqs, env, installer, extras=self.extras)
-        list(map(working_set.add, items))
-
-    pattern = re.compile(
-        r'\s*'
-        r'(?P.+?)\s*'
-        r'=\s*'
-        r'(?P[\w.]+)\s*'
-        r'(:\s*(?P[\w.]+))?\s*'
-        r'(?P\[.*\])?\s*$'
-    )
-
-    @classmethod
-    def parse(cls, src, dist=None):
-        """Parse a single entry point from string `src`
-
-        Entry point syntax follows the form::
-
-            name = some.module:some.attr [extra1, extra2]
-
-        The entry name and module name are required, but the ``:attrs`` and
-        ``[extras]`` parts are optional
-        """
-        m = cls.pattern.match(src)
-        if not m:
-            msg = "EntryPoint must be in 'name=module:attrs [extras]' format"
-            raise ValueError(msg, src)
-        res = m.groupdict()
-        extras = cls._parse_extras(res['extras'])
-        attrs = res['attr'].split('.') if res['attr'] else ()
-        return cls(res['name'], res['module'], attrs, extras, dist)
-
-    @classmethod
-    def _parse_extras(cls, extras_spec):
-        if not extras_spec:
-            return ()
-        req = Requirement.parse('x' + extras_spec)
-        if req.specs:
-            raise ValueError()
-        return req.extras
-
-    @classmethod
-    def parse_group(cls, group, lines, dist=None):
-        """Parse an entry point group"""
-        if not MODULE(group):
-            raise ValueError("Invalid group name", group)
-        this = {}
-        for line in yield_lines(lines):
-            ep = cls.parse(line, dist)
-            if ep.name in this:
-                raise ValueError("Duplicate entry point", group, ep.name)
-            this[ep.name] = ep
-        return this
-
-    @classmethod
-    def parse_map(cls, data, dist=None):
-        """Parse a map of entry point groups"""
-        if isinstance(data, dict):
-            data = data.items()
-        else:
-            data = split_sections(data)
-        maps = {}
-        for group, lines in data:
-            if group is None:
-                if not lines:
-                    continue
-                raise ValueError("Entry points must be listed in groups")
-            group = group.strip()
-            if group in maps:
-                raise ValueError("Duplicate group name", group)
-            maps[group] = cls.parse_group(group, lines, dist)
-        return maps
-
-
-def _remove_md5_fragment(location):
-    if not location:
-        return ''
-    parsed = urllib.parse.urlparse(location)
-    if parsed[-1].startswith('md5='):
-        return urllib.parse.urlunparse(parsed[:-1] + ('',))
-    return location
-
-
-def _version_from_file(lines):
-    """
-    Given an iterable of lines from a Metadata file, return
-    the value of the Version field, if present, or None otherwise.
-    """
-    def is_version_line(line):
-        return line.lower().startswith('version:')
-    version_lines = filter(is_version_line, lines)
-    line = next(iter(version_lines), '')
-    _, _, value = line.partition(':')
-    return safe_version(value.strip()) or None
-
-
-class Distribution:
-    """Wrap an actual or potential sys.path entry w/metadata"""
-    PKG_INFO = 'PKG-INFO'
-
-    def __init__(
-            self, location=None, metadata=None, project_name=None,
-            version=None, py_version=PY_MAJOR, platform=None,
-            precedence=EGG_DIST):
-        self.project_name = safe_name(project_name or 'Unknown')
-        if version is not None:
-            self._version = safe_version(version)
-        self.py_version = py_version
-        self.platform = platform
-        self.location = location
-        self.precedence = precedence
-        self._provider = metadata or empty_provider
-
-    @classmethod
-    def from_location(cls, location, basename, metadata=None, **kw):
-        project_name, version, py_version, platform = [None] * 4
-        basename, ext = os.path.splitext(basename)
-        if ext.lower() in _distributionImpl:
-            cls = _distributionImpl[ext.lower()]
-
-            match = EGG_NAME(basename)
-            if match:
-                project_name, version, py_version, platform = match.group(
-                    'name', 'ver', 'pyver', 'plat'
-                )
-        return cls(
-            location, metadata, project_name=project_name, version=version,
-            py_version=py_version, platform=platform, **kw
-        )._reload_version()
-
-    def _reload_version(self):
-        return self
-
-    @property
-    def hashcmp(self):
-        return (
-            self.parsed_version,
-            self.precedence,
-            self.key,
-            _remove_md5_fragment(self.location),
-            self.py_version or '',
-            self.platform or '',
-        )
-
-    def __hash__(self):
-        return hash(self.hashcmp)
-
-    def __lt__(self, other):
-        return self.hashcmp < other.hashcmp
-
-    def __le__(self, other):
-        return self.hashcmp <= other.hashcmp
-
-    def __gt__(self, other):
-        return self.hashcmp > other.hashcmp
-
-    def __ge__(self, other):
-        return self.hashcmp >= other.hashcmp
-
-    def __eq__(self, other):
-        if not isinstance(other, self.__class__):
-            # It's not a Distribution, so they are not equal
-            return False
-        return self.hashcmp == other.hashcmp
-
-    def __ne__(self, other):
-        return not self == other
-
-    # These properties have to be lazy so that we don't have to load any
-    # metadata until/unless it's actually needed.  (i.e., some distributions
-    # may not know their name or version without loading PKG-INFO)
-
-    @property
-    def key(self):
-        try:
-            return self._key
-        except AttributeError:
-            self._key = key = self.project_name.lower()
-            return key
-
-    @property
-    def parsed_version(self):
-        if not hasattr(self, "_parsed_version"):
-            self._parsed_version = parse_version(self.version)
-
-        return self._parsed_version
-
-    def _warn_legacy_version(self):
-        LV = packaging.version.LegacyVersion
-        is_legacy = isinstance(self._parsed_version, LV)
-        if not is_legacy:
-            return
-
-        # While an empty version is technically a legacy version and
-        # is not a valid PEP 440 version, it's also unlikely to
-        # actually come from someone and instead it is more likely that
-        # it comes from setuptools attempting to parse a filename and
-        # including it in the list. So for that we'll gate this warning
-        # on if the version is anything at all or not.
-        if not self.version:
-            return
-
-        tmpl = textwrap.dedent("""
-            '{project_name} ({version})' is being parsed as a legacy,
-            non PEP 440,
-            version. You may find odd behavior and sort order.
-            In particular it will be sorted as less than 0.0. It
-            is recommended to migrate to PEP 440 compatible
-            versions.
-            """).strip().replace('\n', ' ')
-
-        warnings.warn(tmpl.format(**vars(self)), PEP440Warning)
-
-    @property
-    def version(self):
-        try:
-            return self._version
-        except AttributeError:
-            version = self._get_version()
-            if version is None:
-                path = self._get_metadata_path_for_display(self.PKG_INFO)
-                msg = (
-                    "Missing 'Version:' header and/or {} file at path: {}"
-                ).format(self.PKG_INFO, path)
-                raise ValueError(msg, self)
-
-            return version
-
-    @property
-    def _dep_map(self):
-        """
-        A map of extra to its list of (direct) requirements
-        for this distribution, including the null extra.
-        """
-        try:
-            return self.__dep_map
-        except AttributeError:
-            self.__dep_map = self._filter_extras(self._build_dep_map())
-        return self.__dep_map
-
-    @staticmethod
-    def _filter_extras(dm):
-        """
-        Given a mapping of extras to dependencies, strip off
-        environment markers and filter out any dependencies
-        not matching the markers.
-        """
-        for extra in list(filter(None, dm)):
-            new_extra = extra
-            reqs = dm.pop(extra)
-            new_extra, _, marker = extra.partition(':')
-            fails_marker = marker and (
-                invalid_marker(marker)
-                or not evaluate_marker(marker)
-            )
-            if fails_marker:
-                reqs = []
-            new_extra = safe_extra(new_extra) or None
-
-            dm.setdefault(new_extra, []).extend(reqs)
-        return dm
-
-    def _build_dep_map(self):
-        dm = {}
-        for name in 'requires.txt', 'depends.txt':
-            for extra, reqs in split_sections(self._get_metadata(name)):
-                dm.setdefault(extra, []).extend(parse_requirements(reqs))
-        return dm
-
-    def requires(self, extras=()):
-        """List of Requirements needed for this distro if `extras` are used"""
-        dm = self._dep_map
-        deps = []
-        deps.extend(dm.get(None, ()))
-        for ext in extras:
-            try:
-                deps.extend(dm[safe_extra(ext)])
-            except KeyError:
-                raise UnknownExtra(
-                    "%s has no such extra feature %r" % (self, ext)
-                )
-        return deps
-
-    def _get_metadata_path_for_display(self, name):
-        """
-        Return the path to the given metadata file, if available.
-        """
-        try:
-            # We need to access _get_metadata_path() on the provider object
-            # directly rather than through this class's __getattr__()
-            # since _get_metadata_path() is marked private.
-            path = self._provider._get_metadata_path(name)
-
-        # Handle exceptions e.g. in case the distribution's metadata
-        # provider doesn't support _get_metadata_path().
-        except Exception:
-            return '[could not detect]'
-
-        return path
-
-    def _get_metadata(self, name):
-        if self.has_metadata(name):
-            for line in self.get_metadata_lines(name):
-                yield line
-
-    def _get_version(self):
-        lines = self._get_metadata(self.PKG_INFO)
-        version = _version_from_file(lines)
-
-        return version
-
-    def activate(self, path=None, replace=False):
-        """Ensure distribution is importable on `path` (default=sys.path)"""
-        if path is None:
-            path = sys.path
-        self.insert_on(path, replace=replace)
-        if path is sys.path:
-            fixup_namespace_packages(self.location)
-            for pkg in self._get_metadata('namespace_packages.txt'):
-                if pkg in sys.modules:
-                    declare_namespace(pkg)
-
-    def egg_name(self):
-        """Return what this distribution's standard .egg filename should be"""
-        filename = "%s-%s-py%s" % (
-            to_filename(self.project_name), to_filename(self.version),
-            self.py_version or PY_MAJOR
-        )
-
-        if self.platform:
-            filename += '-' + self.platform
-        return filename
-
-    def __repr__(self):
-        if self.location:
-            return "%s (%s)" % (self, self.location)
-        else:
-            return str(self)
-
-    def __str__(self):
-        try:
-            version = getattr(self, 'version', None)
-        except ValueError:
-            version = None
-        version = version or "[unknown version]"
-        return "%s %s" % (self.project_name, version)
-
-    def __getattr__(self, attr):
-        """Delegate all unrecognized public attributes to .metadata provider"""
-        if attr.startswith('_'):
-            raise AttributeError(attr)
-        return getattr(self._provider, attr)
-
-    def __dir__(self):
-        return list(
-            set(super(Distribution, self).__dir__())
-            | set(
-                attr for attr in self._provider.__dir__()
-                if not attr.startswith('_')
-            )
-        )
-
-    if not hasattr(object, '__dir__'):
-        # python 2.7 not supported
-        del __dir__
-
-    @classmethod
-    def from_filename(cls, filename, metadata=None, **kw):
-        return cls.from_location(
-            _normalize_cached(filename), os.path.basename(filename), metadata,
-            **kw
-        )
-
-    def as_requirement(self):
-        """Return a ``Requirement`` that matches this distribution exactly"""
-        if isinstance(self.parsed_version, packaging.version.Version):
-            spec = "%s==%s" % (self.project_name, self.parsed_version)
-        else:
-            spec = "%s===%s" % (self.project_name, self.parsed_version)
-
-        return Requirement.parse(spec)
-
-    def load_entry_point(self, group, name):
-        """Return the `name` entry point of `group` or raise ImportError"""
-        ep = self.get_entry_info(group, name)
-        if ep is None:
-            raise ImportError("Entry point %r not found" % ((group, name),))
-        return ep.load()
-
-    def get_entry_map(self, group=None):
-        """Return the entry point map for `group`, or the full entry map"""
-        try:
-            ep_map = self._ep_map
-        except AttributeError:
-            ep_map = self._ep_map = EntryPoint.parse_map(
-                self._get_metadata('entry_points.txt'), self
-            )
-        if group is not None:
-            return ep_map.get(group, {})
-        return ep_map
-
-    def get_entry_info(self, group, name):
-        """Return the EntryPoint object for `group`+`name`, or ``None``"""
-        return self.get_entry_map(group).get(name)
-
-    def insert_on(self, path, loc=None, replace=False):
-        """Ensure self.location is on path
-
-        If replace=False (default):
-            - If location is already in path anywhere, do nothing.
-            - Else:
-              - If it's an egg and its parent directory is on path,
-                insert just ahead of the parent.
-              - Else: add to the end of path.
-        If replace=True:
-            - If location is already on path anywhere (not eggs)
-              or higher priority than its parent (eggs)
-              do nothing.
-            - Else:
-              - If it's an egg and its parent directory is on path,
-                insert just ahead of the parent,
-                removing any lower-priority entries.
-              - Else: add it to the front of path.
-        """
-
-        loc = loc or self.location
-        if not loc:
-            return
-
-        nloc = _normalize_cached(loc)
-        bdir = os.path.dirname(nloc)
-        npath = [(p and _normalize_cached(p) or p) for p in path]
-
-        for p, item in enumerate(npath):
-            if item == nloc:
-                if replace:
-                    break
-                else:
-                    # don't modify path (even removing duplicates) if
-                    # found and not replace
-                    return
-            elif item == bdir and self.precedence == EGG_DIST:
-                # if it's an .egg, give it precedence over its directory
-                # UNLESS it's already been added to sys.path and replace=False
-                if (not replace) and nloc in npath[p:]:
-                    return
-                if path is sys.path:
-                    self.check_version_conflict()
-                path.insert(p, loc)
-                npath.insert(p, nloc)
-                break
-        else:
-            if path is sys.path:
-                self.check_version_conflict()
-            if replace:
-                path.insert(0, loc)
-            else:
-                path.append(loc)
-            return
-
-        # p is the spot where we found or inserted loc; now remove duplicates
-        while True:
-            try:
-                np = npath.index(nloc, p + 1)
-            except ValueError:
-                break
-            else:
-                del npath[np], path[np]
-                # ha!
-                p = np
-
-        return
-
-    def check_version_conflict(self):
-        if self.key == 'setuptools':
-            # ignore the inevitable setuptools self-conflicts  :(
-            return
-
-        nsp = dict.fromkeys(self._get_metadata('namespace_packages.txt'))
-        loc = normalize_path(self.location)
-        for modname in self._get_metadata('top_level.txt'):
-            if (modname not in sys.modules or modname in nsp
-                    or modname in _namespace_packages):
-                continue
-            if modname in ('pkg_resources', 'setuptools', 'site'):
-                continue
-            fn = getattr(sys.modules[modname], '__file__', None)
-            if fn and (normalize_path(fn).startswith(loc) or
-                       fn.startswith(self.location)):
-                continue
-            issue_warning(
-                "Module %s was already imported from %s, but %s is being added"
-                " to sys.path" % (modname, fn, self.location),
-            )
-
-    def has_version(self):
-        try:
-            self.version
-        except ValueError:
-            issue_warning("Unbuilt egg for " + repr(self))
-            return False
-        return True
-
-    def clone(self, **kw):
-        """Copy this distribution, substituting in any changed keyword args"""
-        names = 'project_name version py_version platform location precedence'
-        for attr in names.split():
-            kw.setdefault(attr, getattr(self, attr, None))
-        kw.setdefault('metadata', self._provider)
-        return self.__class__(**kw)
-
-    @property
-    def extras(self):
-        return [dep for dep in self._dep_map if dep]
-
-
-class EggInfoDistribution(Distribution):
-    def _reload_version(self):
-        """
-        Packages installed by distutils (e.g. numpy or scipy),
-        which uses an old safe_version, and so
-        their version numbers can get mangled when
-        converted to filenames (e.g., 1.11.0.dev0+2329eae to
-        1.11.0.dev0_2329eae). These distributions will not be
-        parsed properly
-        downstream by Distribution and safe_version, so
-        take an extra step and try to get the version number from
-        the metadata file itself instead of the filename.
-        """
-        md_version = self._get_version()
-        if md_version:
-            self._version = md_version
-        return self
-
-
-class DistInfoDistribution(Distribution):
-    """
-    Wrap an actual or potential sys.path entry
-    w/metadata, .dist-info style.
-    """
-    PKG_INFO = 'METADATA'
-    EQEQ = re.compile(r"([\(,])\s*(\d.*?)\s*([,\)])")
-
-    @property
-    def _parsed_pkg_info(self):
-        """Parse and cache metadata"""
-        try:
-            return self._pkg_info
-        except AttributeError:
-            metadata = self.get_metadata(self.PKG_INFO)
-            self._pkg_info = email.parser.Parser().parsestr(metadata)
-            return self._pkg_info
-
-    @property
-    def _dep_map(self):
-        try:
-            return self.__dep_map
-        except AttributeError:
-            self.__dep_map = self._compute_dependencies()
-            return self.__dep_map
-
-    def _compute_dependencies(self):
-        """Recompute this distribution's dependencies."""
-        dm = self.__dep_map = {None: []}
-
-        reqs = []
-        # Including any condition expressions
-        for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
-            reqs.extend(parse_requirements(req))
-
-        def reqs_for_extra(extra):
-            for req in reqs:
-                if not req.marker or req.marker.evaluate({'extra': extra}):
-                    yield req
-
-        common = frozenset(reqs_for_extra(None))
-        dm[None].extend(common)
-
-        for extra in self._parsed_pkg_info.get_all('Provides-Extra') or []:
-            s_extra = safe_extra(extra.strip())
-            dm[s_extra] = list(frozenset(reqs_for_extra(extra)) - common)
-
-        return dm
-
-
-_distributionImpl = {
-    '.egg': Distribution,
-    '.egg-info': EggInfoDistribution,
-    '.dist-info': DistInfoDistribution,
-}
-
-
-def issue_warning(*args, **kw):
-    level = 1
-    g = globals()
-    try:
-        # find the first stack frame that is *not* code in
-        # the pkg_resources module, to use for the warning
-        while sys._getframe(level).f_globals is g:
-            level += 1
-    except ValueError:
-        pass
-    warnings.warn(stacklevel=level + 1, *args, **kw)
-
-
-class RequirementParseError(ValueError):
-    def __str__(self):
-        return ' '.join(self.args)
-
-
-def parse_requirements(strs):
-    """Yield ``Requirement`` objects for each specification in `strs`
-
-    `strs` must be a string, or a (possibly-nested) iterable thereof.
-    """
-    # create a steppable iterator, so we can handle \-continuations
-    lines = iter(yield_lines(strs))
-
-    for line in lines:
-        # Drop comments -- a hash without a space may be in a URL.
-        if ' #' in line:
-            line = line[:line.find(' #')]
-        # If there is a line continuation, drop it, and append the next line.
-        if line.endswith('\\'):
-            line = line[:-2].strip()
-            try:
-                line += next(lines)
-            except StopIteration:
-                return
-        yield Requirement(line)
-
-
-class Requirement(packaging.requirements.Requirement):
-    def __init__(self, requirement_string):
-        """DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!"""
-        try:
-            super(Requirement, self).__init__(requirement_string)
-        except packaging.requirements.InvalidRequirement as e:
-            raise RequirementParseError(str(e))
-        self.unsafe_name = self.name
-        project_name = safe_name(self.name)
-        self.project_name, self.key = project_name, project_name.lower()
-        self.specs = [
-            (spec.operator, spec.version) for spec in self.specifier]
-        self.extras = tuple(map(safe_extra, self.extras))
-        self.hashCmp = (
-            self.key,
-            self.url,
-            self.specifier,
-            frozenset(self.extras),
-            str(self.marker) if self.marker else None,
-        )
-        self.__hash = hash(self.hashCmp)
-
-    def __eq__(self, other):
-        return (
-            isinstance(other, Requirement) and
-            self.hashCmp == other.hashCmp
-        )
-
-    def __ne__(self, other):
-        return not self == other
-
-    def __contains__(self, item):
-        if isinstance(item, Distribution):
-            if item.key != self.key:
-                return False
-
-            item = item.version
-
-        # Allow prereleases always in order to match the previous behavior of
-        # this method. In the future this should be smarter and follow PEP 440
-        # more accurately.
-        return self.specifier.contains(item, prereleases=True)
-
-    def __hash__(self):
-        return self.__hash
-
-    def __repr__(self):
-        return "Requirement.parse(%r)" % str(self)
-
-    @staticmethod
-    def parse(s):
-        req, = parse_requirements(s)
-        return req
-
-
-def _always_object(classes):
-    """
-    Ensure object appears in the mro even
-    for old-style classes.
-    """
-    if object not in classes:
-        return classes + (object,)
-    return classes
-
-
-def _find_adapter(registry, ob):
-    """Return an adapter factory for `ob` from `registry`"""
-    types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob))))
-    for t in types:
-        if t in registry:
-            return registry[t]
-
-
-def ensure_directory(path):
-    """Ensure that the parent directory of `path` exists"""
-    dirname = os.path.dirname(path)
-    py31compat.makedirs(dirname, exist_ok=True)
-
-
-def _bypass_ensure_directory(path):
-    """Sandbox-bypassing version of ensure_directory()"""
-    if not WRITE_SUPPORT:
-        raise IOError('"os.mkdir" not supported on this platform.')
-    dirname, filename = split(path)
-    if dirname and filename and not isdir(dirname):
-        _bypass_ensure_directory(dirname)
-        try:
-            mkdir(dirname, 0o755)
-        except FileExistsError:
-            pass
-
-
-def split_sections(s):
-    """Split a string or iterable thereof into (section, content) pairs
-
-    Each ``section`` is a stripped version of the section header ("[section]")
-    and each ``content`` is a list of stripped lines excluding blank lines and
-    comment-only lines.  If there are any such lines before the first section
-    header, they're returned in a first ``section`` of ``None``.
-    """
-    section = None
-    content = []
-    for line in yield_lines(s):
-        if line.startswith("["):
-            if line.endswith("]"):
-                if section or content:
-                    yield section, content
-                section = line[1:-1].strip()
-                content = []
-            else:
-                raise ValueError("Invalid section heading", line)
-        else:
-            content.append(line)
-
-    # wrap up last segment
-    yield section, content
-
-
-def _mkstemp(*args, **kw):
-    old_open = os.open
-    try:
-        # temporarily bypass sandboxing
-        os.open = os_open
-        return tempfile.mkstemp(*args, **kw)
-    finally:
-        # and then put it back
-        os.open = old_open
-
-
-# Silence the PEP440Warning by default, so that end users don't get hit by it
-# randomly just because they use pkg_resources. We want to append the rule
-# because we want earlier uses of filterwarnings to take precedence over this
-# one.
-warnings.filterwarnings("ignore", category=PEP440Warning, append=True)
-
-
-# from jaraco.functools 1.3
-def _call_aside(f, *args, **kwargs):
-    f(*args, **kwargs)
-    return f
-
-
-@_call_aside
-def _initialize(g=globals()):
-    "Set up global resource manager (deliberately not state-saved)"
-    manager = ResourceManager()
-    g['_manager'] = manager
-    g.update(
-        (name, getattr(manager, name))
-        for name in dir(manager)
-        if not name.startswith('_')
-    )
-
-
-@_call_aside
-def _initialize_master_working_set():
-    """
-    Prepare the master working set and make the ``require()``
-    API available.
-
-    This function has explicit effects on the global state
-    of pkg_resources. It is intended to be invoked once at
-    the initialization of this module.
-
-    Invocation by other packages is unsupported and done
-    at their own risk.
-    """
-    working_set = WorkingSet._build_master()
-    _declare_state('object', working_set=working_set)
-
-    require = working_set.require
-    iter_entry_points = working_set.iter_entry_points
-    add_activation_listener = working_set.subscribe
-    run_script = working_set.run_script
-    # backward compatibility
-    run_main = run_script
-    # Activate all distributions already on sys.path with replace=False and
-    # ensure that all distributions added to the working set in the future
-    # (e.g. by calling ``require()``) will get activated as well,
-    # with higher priority (replace=True).
-    tuple(
-        dist.activate(replace=False)
-        for dist in working_set
-    )
-    add_activation_listener(
-        lambda dist: dist.activate(replace=True),
-        existing=False,
-    )
-    working_set.entries = []
-    # match order
-    list(map(working_set.add_entry, sys.path))
-    globals().update(locals())
-
-class PkgResourcesDeprecationWarning(Warning):
-    """
-    Base class for warning about deprecations in ``pkg_resources``
-
-    This class is not derived from ``DeprecationWarning``, and as such is
-    visible by default.
-    """
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 8d4f52d1e65a333689fa58461497a8c4b2bd8a02..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/__pycache__/py31compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/__pycache__/py31compat.cpython-38.pyc
deleted file mode 100644
index c133075d667218dafd0633bdd62e5d5d430665ae..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/__pycache__/py31compat.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__init__.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__init__.py
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index f7d7f0b2315f4e1035d9a7fd0691a3f589224f41..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/appdirs.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/appdirs.cpython-38.pyc
deleted file mode 100644
index e6f7eac11a2a4215ff1141427ed28e52b799e0a7..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/appdirs.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/pyparsing.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/pyparsing.cpython-38.pyc
deleted file mode 100644
index 4ad459a4957e6a3b1471c60e85f3978132852ede..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/pyparsing.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/six.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/six.cpython-38.pyc
deleted file mode 100644
index f6814c641b9ca9c19e1497727446cec488602ab2..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/__pycache__/six.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/appdirs.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/appdirs.py
deleted file mode 100644
index ae67001af8b661373edeee2eb327b9f63e630d62..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/appdirs.py
+++ /dev/null
@@ -1,608 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# Copyright (c) 2005-2010 ActiveState Software Inc.
-# Copyright (c) 2013 Eddy Petrișor
-
-"""Utilities for determining application-specific dirs.
-
-See  for details and usage.
-"""
-# Dev Notes:
-# - MSDN on where to store app data files:
-#   http://support.microsoft.com/default.aspx?scid=kb;en-us;310294#XSLTH3194121123120121120120
-# - Mac OS X: http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/index.html
-# - XDG spec for Un*x: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
-
-__version_info__ = (1, 4, 3)
-__version__ = '.'.join(map(str, __version_info__))
-
-
-import sys
-import os
-
-PY3 = sys.version_info[0] == 3
-
-if PY3:
-    unicode = str
-
-if sys.platform.startswith('java'):
-    import platform
-    os_name = platform.java_ver()[3][0]
-    if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc.
-        system = 'win32'
-    elif os_name.startswith('Mac'): # "Mac OS X", etc.
-        system = 'darwin'
-    else: # "Linux", "SunOS", "FreeBSD", etc.
-        # Setting this to "linux2" is not ideal, but only Windows or Mac
-        # are actually checked for and the rest of the module expects
-        # *sys.platform* style strings.
-        system = 'linux2'
-else:
-    system = sys.platform
-
-
-
-def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
-    r"""Return full path to the user-specific data dir for this application.
-
-        "appname" is the name of application.
-            If None, just the system directory is returned.
-        "appauthor" (only used on Windows) is the name of the
-            appauthor or distributing body for this application. Typically
-            it is the owning company name. This falls back to appname. You may
-            pass False to disable it.
-        "version" is an optional version path element to append to the
-            path. You might want to use this if you want multiple versions
-            of your app to be able to run independently. If used, this
-            would typically be ".".
-            Only applied when appname is present.
-        "roaming" (boolean, default False) can be set True to use the Windows
-            roaming appdata directory. That means that for users on a Windows
-            network setup for roaming profiles, this user data will be
-            sync'd on login. See
-            
-            for a discussion of issues.
-
-    Typical user data directories are:
-        Mac OS X:               ~/Library/Application Support/
-        Unix:                   ~/.local/share/    # or in $XDG_DATA_HOME, if defined
-        Win XP (not roaming):   C:\Documents and Settings\\Application Data\\
-        Win XP (roaming):       C:\Documents and Settings\\Local Settings\Application Data\\
-        Win 7  (not roaming):   C:\Users\\AppData\Local\\
-        Win 7  (roaming):       C:\Users\\AppData\Roaming\\
-
-    For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
-    That means, by default "~/.local/share/".
-    """
-    if system == "win32":
-        if appauthor is None:
-            appauthor = appname
-        const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA"
-        path = os.path.normpath(_get_win_folder(const))
-        if appname:
-            if appauthor is not False:
-                path = os.path.join(path, appauthor, appname)
-            else:
-                path = os.path.join(path, appname)
-    elif system == 'darwin':
-        path = os.path.expanduser('~/Library/Application Support/')
-        if appname:
-            path = os.path.join(path, appname)
-    else:
-        path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share"))
-        if appname:
-            path = os.path.join(path, appname)
-    if appname and version:
-        path = os.path.join(path, version)
-    return path
-
-
-def site_data_dir(appname=None, appauthor=None, version=None, multipath=False):
-    r"""Return full path to the user-shared data dir for this application.
-
-        "appname" is the name of application.
-            If None, just the system directory is returned.
-        "appauthor" (only used on Windows) is the name of the
-            appauthor or distributing body for this application. Typically
-            it is the owning company name. This falls back to appname. You may
-            pass False to disable it.
-        "version" is an optional version path element to append to the
-            path. You might want to use this if you want multiple versions
-            of your app to be able to run independently. If used, this
-            would typically be ".".
-            Only applied when appname is present.
-        "multipath" is an optional parameter only applicable to *nix
-            which indicates that the entire list of data dirs should be
-            returned. By default, the first item from XDG_DATA_DIRS is
-            returned, or '/usr/local/share/',
-            if XDG_DATA_DIRS is not set
-
-    Typical site data directories are:
-        Mac OS X:   /Library/Application Support/
-        Unix:       /usr/local/share/ or /usr/share/
-        Win XP:     C:\Documents and Settings\All Users\Application Data\\
-        Vista:      (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
-        Win 7:      C:\ProgramData\\   # Hidden, but writeable on Win 7.
-
-    For Unix, this is using the $XDG_DATA_DIRS[0] default.
-
-    WARNING: Do not use this on Windows. See the Vista-Fail note above for why.
-    """
-    if system == "win32":
-        if appauthor is None:
-            appauthor = appname
-        path = os.path.normpath(_get_win_folder("CSIDL_COMMON_APPDATA"))
-        if appname:
-            if appauthor is not False:
-                path = os.path.join(path, appauthor, appname)
-            else:
-                path = os.path.join(path, appname)
-    elif system == 'darwin':
-        path = os.path.expanduser('/Library/Application Support')
-        if appname:
-            path = os.path.join(path, appname)
-    else:
-        # XDG default for $XDG_DATA_DIRS
-        # only first, if multipath is False
-        path = os.getenv('XDG_DATA_DIRS',
-                         os.pathsep.join(['/usr/local/share', '/usr/share']))
-        pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep)]
-        if appname:
-            if version:
-                appname = os.path.join(appname, version)
-            pathlist = [os.sep.join([x, appname]) for x in pathlist]
-
-        if multipath:
-            path = os.pathsep.join(pathlist)
-        else:
-            path = pathlist[0]
-        return path
-
-    if appname and version:
-        path = os.path.join(path, version)
-    return path
-
-
-def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):
-    r"""Return full path to the user-specific config dir for this application.
-
-        "appname" is the name of application.
-            If None, just the system directory is returned.
-        "appauthor" (only used on Windows) is the name of the
-            appauthor or distributing body for this application. Typically
-            it is the owning company name. This falls back to appname. You may
-            pass False to disable it.
-        "version" is an optional version path element to append to the
-            path. You might want to use this if you want multiple versions
-            of your app to be able to run independently. If used, this
-            would typically be ".".
-            Only applied when appname is present.
-        "roaming" (boolean, default False) can be set True to use the Windows
-            roaming appdata directory. That means that for users on a Windows
-            network setup for roaming profiles, this user data will be
-            sync'd on login. See
-            
-            for a discussion of issues.
-
-    Typical user config directories are:
-        Mac OS X:               same as user_data_dir
-        Unix:                   ~/.config/     # or in $XDG_CONFIG_HOME, if defined
-        Win *:                  same as user_data_dir
-
-    For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME.
-    That means, by default "~/.config/".
-    """
-    if system in ["win32", "darwin"]:
-        path = user_data_dir(appname, appauthor, None, roaming)
-    else:
-        path = os.getenv('XDG_CONFIG_HOME', os.path.expanduser("~/.config"))
-        if appname:
-            path = os.path.join(path, appname)
-    if appname and version:
-        path = os.path.join(path, version)
-    return path
-
-
-def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
-    r"""Return full path to the user-shared data dir for this application.
-
-        "appname" is the name of application.
-            If None, just the system directory is returned.
-        "appauthor" (only used on Windows) is the name of the
-            appauthor or distributing body for this application. Typically
-            it is the owning company name. This falls back to appname. You may
-            pass False to disable it.
-        "version" is an optional version path element to append to the
-            path. You might want to use this if you want multiple versions
-            of your app to be able to run independently. If used, this
-            would typically be ".".
-            Only applied when appname is present.
-        "multipath" is an optional parameter only applicable to *nix
-            which indicates that the entire list of config dirs should be
-            returned. By default, the first item from XDG_CONFIG_DIRS is
-            returned, or '/etc/xdg/', if XDG_CONFIG_DIRS is not set
-
-    Typical site config directories are:
-        Mac OS X:   same as site_data_dir
-        Unix:       /etc/xdg/ or $XDG_CONFIG_DIRS[i]/ for each value in
-                    $XDG_CONFIG_DIRS
-        Win *:      same as site_data_dir
-        Vista:      (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
-
-    For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False
-
-    WARNING: Do not use this on Windows. See the Vista-Fail note above for why.
-    """
-    if system in ["win32", "darwin"]:
-        path = site_data_dir(appname, appauthor)
-        if appname and version:
-            path = os.path.join(path, version)
-    else:
-        # XDG default for $XDG_CONFIG_DIRS
-        # only first, if multipath is False
-        path = os.getenv('XDG_CONFIG_DIRS', '/etc/xdg')
-        pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep)]
-        if appname:
-            if version:
-                appname = os.path.join(appname, version)
-            pathlist = [os.sep.join([x, appname]) for x in pathlist]
-
-        if multipath:
-            path = os.pathsep.join(pathlist)
-        else:
-            path = pathlist[0]
-    return path
-
-
-def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True):
-    r"""Return full path to the user-specific cache dir for this application.
-
-        "appname" is the name of application.
-            If None, just the system directory is returned.
-        "appauthor" (only used on Windows) is the name of the
-            appauthor or distributing body for this application. Typically
-            it is the owning company name. This falls back to appname. You may
-            pass False to disable it.
-        "version" is an optional version path element to append to the
-            path. You might want to use this if you want multiple versions
-            of your app to be able to run independently. If used, this
-            would typically be ".".
-            Only applied when appname is present.
-        "opinion" (boolean) can be False to disable the appending of
-            "Cache" to the base app data dir for Windows. See
-            discussion below.
-
-    Typical user cache directories are:
-        Mac OS X:   ~/Library/Caches/
-        Unix:       ~/.cache/ (XDG default)
-        Win XP:     C:\Documents and Settings\\Local Settings\Application Data\\\Cache
-        Vista:      C:\Users\\AppData\Local\\\Cache
-
-    On Windows the only suggestion in the MSDN docs is that local settings go in
-    the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming
-    app data dir (the default returned by `user_data_dir` above). Apps typically
-    put cache data somewhere *under* the given dir here. Some examples:
-        ...\Mozilla\Firefox\Profiles\\Cache
-        ...\Acme\SuperApp\Cache\1.0
-    OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value.
-    This can be disabled with the `opinion=False` option.
-    """
-    if system == "win32":
-        if appauthor is None:
-            appauthor = appname
-        path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))
-        if appname:
-            if appauthor is not False:
-                path = os.path.join(path, appauthor, appname)
-            else:
-                path = os.path.join(path, appname)
-            if opinion:
-                path = os.path.join(path, "Cache")
-    elif system == 'darwin':
-        path = os.path.expanduser('~/Library/Caches')
-        if appname:
-            path = os.path.join(path, appname)
-    else:
-        path = os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache'))
-        if appname:
-            path = os.path.join(path, appname)
-    if appname and version:
-        path = os.path.join(path, version)
-    return path
-
-
-def user_state_dir(appname=None, appauthor=None, version=None, roaming=False):
-    r"""Return full path to the user-specific state dir for this application.
-
-        "appname" is the name of application.
-            If None, just the system directory is returned.
-        "appauthor" (only used on Windows) is the name of the
-            appauthor or distributing body for this application. Typically
-            it is the owning company name. This falls back to appname. You may
-            pass False to disable it.
-        "version" is an optional version path element to append to the
-            path. You might want to use this if you want multiple versions
-            of your app to be able to run independently. If used, this
-            would typically be ".".
-            Only applied when appname is present.
-        "roaming" (boolean, default False) can be set True to use the Windows
-            roaming appdata directory. That means that for users on a Windows
-            network setup for roaming profiles, this user data will be
-            sync'd on login. See
-            
-            for a discussion of issues.
-
-    Typical user state directories are:
-        Mac OS X:  same as user_data_dir
-        Unix:      ~/.local/state/   # or in $XDG_STATE_HOME, if defined
-        Win *:     same as user_data_dir
-
-    For Unix, we follow this Debian proposal 
-    to extend the XDG spec and support $XDG_STATE_HOME.
-
-    That means, by default "~/.local/state/".
-    """
-    if system in ["win32", "darwin"]:
-        path = user_data_dir(appname, appauthor, None, roaming)
-    else:
-        path = os.getenv('XDG_STATE_HOME', os.path.expanduser("~/.local/state"))
-        if appname:
-            path = os.path.join(path, appname)
-    if appname and version:
-        path = os.path.join(path, version)
-    return path
-
-
-def user_log_dir(appname=None, appauthor=None, version=None, opinion=True):
-    r"""Return full path to the user-specific log dir for this application.
-
-        "appname" is the name of application.
-            If None, just the system directory is returned.
-        "appauthor" (only used on Windows) is the name of the
-            appauthor or distributing body for this application. Typically
-            it is the owning company name. This falls back to appname. You may
-            pass False to disable it.
-        "version" is an optional version path element to append to the
-            path. You might want to use this if you want multiple versions
-            of your app to be able to run independently. If used, this
-            would typically be ".".
-            Only applied when appname is present.
-        "opinion" (boolean) can be False to disable the appending of
-            "Logs" to the base app data dir for Windows, and "log" to the
-            base cache dir for Unix. See discussion below.
-
-    Typical user log directories are:
-        Mac OS X:   ~/Library/Logs/
-        Unix:       ~/.cache//log  # or under $XDG_CACHE_HOME if defined
-        Win XP:     C:\Documents and Settings\\Local Settings\Application Data\\\Logs
-        Vista:      C:\Users\\AppData\Local\\\Logs
-
-    On Windows the only suggestion in the MSDN docs is that local settings
-    go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in
-    examples of what some windows apps use for a logs dir.)
-
-    OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA`
-    value for Windows and appends "log" to the user cache dir for Unix.
-    This can be disabled with the `opinion=False` option.
-    """
-    if system == "darwin":
-        path = os.path.join(
-            os.path.expanduser('~/Library/Logs'),
-            appname)
-    elif system == "win32":
-        path = user_data_dir(appname, appauthor, version)
-        version = False
-        if opinion:
-            path = os.path.join(path, "Logs")
-    else:
-        path = user_cache_dir(appname, appauthor, version)
-        version = False
-        if opinion:
-            path = os.path.join(path, "log")
-    if appname and version:
-        path = os.path.join(path, version)
-    return path
-
-
-class AppDirs(object):
-    """Convenience wrapper for getting application dirs."""
-    def __init__(self, appname=None, appauthor=None, version=None,
-            roaming=False, multipath=False):
-        self.appname = appname
-        self.appauthor = appauthor
-        self.version = version
-        self.roaming = roaming
-        self.multipath = multipath
-
-    @property
-    def user_data_dir(self):
-        return user_data_dir(self.appname, self.appauthor,
-                             version=self.version, roaming=self.roaming)
-
-    @property
-    def site_data_dir(self):
-        return site_data_dir(self.appname, self.appauthor,
-                             version=self.version, multipath=self.multipath)
-
-    @property
-    def user_config_dir(self):
-        return user_config_dir(self.appname, self.appauthor,
-                               version=self.version, roaming=self.roaming)
-
-    @property
-    def site_config_dir(self):
-        return site_config_dir(self.appname, self.appauthor,
-                             version=self.version, multipath=self.multipath)
-
-    @property
-    def user_cache_dir(self):
-        return user_cache_dir(self.appname, self.appauthor,
-                              version=self.version)
-
-    @property
-    def user_state_dir(self):
-        return user_state_dir(self.appname, self.appauthor,
-                              version=self.version)
-
-    @property
-    def user_log_dir(self):
-        return user_log_dir(self.appname, self.appauthor,
-                            version=self.version)
-
-
-#---- internal support stuff
-
-def _get_win_folder_from_registry(csidl_name):
-    """This is a fallback technique at best. I'm not sure if using the
-    registry for this guarantees us the correct answer for all CSIDL_*
-    names.
-    """
-    if PY3:
-      import winreg as _winreg
-    else:
-      import _winreg
-
-    shell_folder_name = {
-        "CSIDL_APPDATA": "AppData",
-        "CSIDL_COMMON_APPDATA": "Common AppData",
-        "CSIDL_LOCAL_APPDATA": "Local AppData",
-    }[csidl_name]
-
-    key = _winreg.OpenKey(
-        _winreg.HKEY_CURRENT_USER,
-        r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
-    )
-    dir, type = _winreg.QueryValueEx(key, shell_folder_name)
-    return dir
-
-
-def _get_win_folder_with_pywin32(csidl_name):
-    from win32com.shell import shellcon, shell
-    dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0)
-    # Try to make this a unicode path because SHGetFolderPath does
-    # not return unicode strings when there is unicode data in the
-    # path.
-    try:
-        dir = unicode(dir)
-
-        # Downgrade to short path name if have highbit chars. See
-        # .
-        has_high_char = False
-        for c in dir:
-            if ord(c) > 255:
-                has_high_char = True
-                break
-        if has_high_char:
-            try:
-                import win32api
-                dir = win32api.GetShortPathName(dir)
-            except ImportError:
-                pass
-    except UnicodeError:
-        pass
-    return dir
-
-
-def _get_win_folder_with_ctypes(csidl_name):
-    import ctypes
-
-    csidl_const = {
-        "CSIDL_APPDATA": 26,
-        "CSIDL_COMMON_APPDATA": 35,
-        "CSIDL_LOCAL_APPDATA": 28,
-    }[csidl_name]
-
-    buf = ctypes.create_unicode_buffer(1024)
-    ctypes.windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
-
-    # Downgrade to short path name if have highbit chars. See
-    # .
-    has_high_char = False
-    for c in buf:
-        if ord(c) > 255:
-            has_high_char = True
-            break
-    if has_high_char:
-        buf2 = ctypes.create_unicode_buffer(1024)
-        if ctypes.windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
-            buf = buf2
-
-    return buf.value
-
-def _get_win_folder_with_jna(csidl_name):
-    import array
-    from com.sun import jna
-    from com.sun.jna.platform import win32
-
-    buf_size = win32.WinDef.MAX_PATH * 2
-    buf = array.zeros('c', buf_size)
-    shell = win32.Shell32.INSTANCE
-    shell.SHGetFolderPath(None, getattr(win32.ShlObj, csidl_name), None, win32.ShlObj.SHGFP_TYPE_CURRENT, buf)
-    dir = jna.Native.toString(buf.tostring()).rstrip("\0")
-
-    # Downgrade to short path name if have highbit chars. See
-    # .
-    has_high_char = False
-    for c in dir:
-        if ord(c) > 255:
-            has_high_char = True
-            break
-    if has_high_char:
-        buf = array.zeros('c', buf_size)
-        kernel = win32.Kernel32.INSTANCE
-        if kernel.GetShortPathName(dir, buf, buf_size):
-            dir = jna.Native.toString(buf.tostring()).rstrip("\0")
-
-    return dir
-
-if system == "win32":
-    try:
-        import win32com.shell
-        _get_win_folder = _get_win_folder_with_pywin32
-    except ImportError:
-        try:
-            from ctypes import windll
-            _get_win_folder = _get_win_folder_with_ctypes
-        except ImportError:
-            try:
-                import com.sun.jna
-                _get_win_folder = _get_win_folder_with_jna
-            except ImportError:
-                _get_win_folder = _get_win_folder_from_registry
-
-
-#---- self test code
-
-if __name__ == "__main__":
-    appname = "MyApp"
-    appauthor = "MyCompany"
-
-    props = ("user_data_dir",
-             "user_config_dir",
-             "user_cache_dir",
-             "user_state_dir",
-             "user_log_dir",
-             "site_data_dir",
-             "site_config_dir")
-
-    print("-- app dirs %s --" % __version__)
-
-    print("-- app dirs (with optional 'version')")
-    dirs = AppDirs(appname, appauthor, version="1.0")
-    for prop in props:
-        print("%s: %s" % (prop, getattr(dirs, prop)))
-
-    print("\n-- app dirs (without optional 'version')")
-    dirs = AppDirs(appname, appauthor)
-    for prop in props:
-        print("%s: %s" % (prop, getattr(dirs, prop)))
-
-    print("\n-- app dirs (without optional 'appauthor')")
-    dirs = AppDirs(appname)
-    for prop in props:
-        print("%s: %s" % (prop, getattr(dirs, prop)))
-
-    print("\n-- app dirs (with disabled 'appauthor')")
-    dirs = AppDirs(appname, appauthor=False)
-    for prop in props:
-        print("%s: %s" % (prop, getattr(dirs, prop)))
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__about__.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__about__.py
deleted file mode 100644
index 95d330ef823aa2e12f7846bc63c0955b25df6029..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__about__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-__all__ = [
-    "__title__", "__summary__", "__uri__", "__version__", "__author__",
-    "__email__", "__license__", "__copyright__",
-]
-
-__title__ = "packaging"
-__summary__ = "Core utilities for Python packages"
-__uri__ = "https://github.com/pypa/packaging"
-
-__version__ = "16.8"
-
-__author__ = "Donald Stufft and individual contributors"
-__email__ = "donald@stufft.io"
-
-__license__ = "BSD or Apache License, Version 2.0"
-__copyright__ = "Copyright 2014-2016 %s" % __author__
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__init__.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__init__.py
deleted file mode 100644
index 5ee6220203e5425f900fb5a43676c24ea377c2fa..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__init__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-from .__about__ import (
-    __author__, __copyright__, __email__, __license__, __summary__, __title__,
-    __uri__, __version__
-)
-
-__all__ = [
-    "__title__", "__summary__", "__uri__", "__version__", "__author__",
-    "__email__", "__license__", "__copyright__",
-]
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/__about__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/__about__.cpython-38.pyc
deleted file mode 100644
index 229d636cedc8ead96a4e27a321caee760a4e223b..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/__about__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-38.pyc
deleted file mode 100644
index 45f903b18152f52d7a526f0410dbab8e24a32097..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-38.pyc
deleted file mode 100644
index f1badc81606dbedee832ead1e89c4035d5d9f8a1..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-38.pyc
deleted file mode 100644
index 8c375520fc7ada5c1232f2c75fbb062d9f96a9e6..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/markers.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/markers.cpython-38.pyc
deleted file mode 100644
index 861fc406ad519bc890f0fe3e88dbac8091fe1bcb..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/markers.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-38.pyc
deleted file mode 100644
index 1abecbc97baaeee2872f75c1c09a62b52d522194..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-38.pyc
deleted file mode 100644
index c4b47a4cf480d10a94b353263a47513b54e9fe68..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/utils.cpython-38.pyc
deleted file mode 100644
index 7db6416acd5d03e31457b93e831e6aaedcd586e9..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/utils.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/version.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/version.cpython-38.pyc
deleted file mode 100644
index ae2d7a036480217d617eff4705d9c52431b0e976..0000000000000000000000000000000000000000
Binary files a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/__pycache__/version.cpython-38.pyc and /dev/null differ
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/_compat.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/_compat.py
deleted file mode 100644
index 210bb80b7e7b64cb79f7e7cdf3e42819fe3471fe..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/_compat.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-import sys
-
-
-PY2 = sys.version_info[0] == 2
-PY3 = sys.version_info[0] == 3
-
-# flake8: noqa
-
-if PY3:
-    string_types = str,
-else:
-    string_types = basestring,
-
-
-def with_metaclass(meta, *bases):
-    """
-    Create a base class with a metaclass.
-    """
-    # This requires a bit of explanation: the basic idea is to make a dummy
-    # metaclass for one level of class instantiation that replaces itself with
-    # the actual metaclass.
-    class metaclass(meta):
-        def __new__(cls, name, this_bases, d):
-            return meta(name, bases, d)
-    return type.__new__(metaclass, 'temporary_class', (), {})
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/_structures.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/_structures.py
deleted file mode 100644
index ccc27861c3a4d9efaa3db753c77c4515a627bd98..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/_structures.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-
-class Infinity(object):
-
-    def __repr__(self):
-        return "Infinity"
-
-    def __hash__(self):
-        return hash(repr(self))
-
-    def __lt__(self, other):
-        return False
-
-    def __le__(self, other):
-        return False
-
-    def __eq__(self, other):
-        return isinstance(other, self.__class__)
-
-    def __ne__(self, other):
-        return not isinstance(other, self.__class__)
-
-    def __gt__(self, other):
-        return True
-
-    def __ge__(self, other):
-        return True
-
-    def __neg__(self):
-        return NegativeInfinity
-
-Infinity = Infinity()
-
-
-class NegativeInfinity(object):
-
-    def __repr__(self):
-        return "-Infinity"
-
-    def __hash__(self):
-        return hash(repr(self))
-
-    def __lt__(self, other):
-        return True
-
-    def __le__(self, other):
-        return True
-
-    def __eq__(self, other):
-        return isinstance(other, self.__class__)
-
-    def __ne__(self, other):
-        return not isinstance(other, self.__class__)
-
-    def __gt__(self, other):
-        return False
-
-    def __ge__(self, other):
-        return False
-
-    def __neg__(self):
-        return Infinity
-
-NegativeInfinity = NegativeInfinity()
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/markers.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/markers.py
deleted file mode 100644
index 892e578edd4b992cc2996c31d9deb13af73d62c0..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/markers.py
+++ /dev/null
@@ -1,301 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-import operator
-import os
-import platform
-import sys
-
-from pkg_resources.extern.pyparsing import ParseException, ParseResults, stringStart, stringEnd
-from pkg_resources.extern.pyparsing import ZeroOrMore, Group, Forward, QuotedString
-from pkg_resources.extern.pyparsing import Literal as L  # noqa
-
-from ._compat import string_types
-from .specifiers import Specifier, InvalidSpecifier
-
-
-__all__ = [
-    "InvalidMarker", "UndefinedComparison", "UndefinedEnvironmentName",
-    "Marker", "default_environment",
-]
-
-
-class InvalidMarker(ValueError):
-    """
-    An invalid marker was found, users should refer to PEP 508.
-    """
-
-
-class UndefinedComparison(ValueError):
-    """
-    An invalid operation was attempted on a value that doesn't support it.
-    """
-
-
-class UndefinedEnvironmentName(ValueError):
-    """
-    A name was attempted to be used that does not exist inside of the
-    environment.
-    """
-
-
-class Node(object):
-
-    def __init__(self, value):
-        self.value = value
-
-    def __str__(self):
-        return str(self.value)
-
-    def __repr__(self):
-        return "<{0}({1!r})>".format(self.__class__.__name__, str(self))
-
-    def serialize(self):
-        raise NotImplementedError
-
-
-class Variable(Node):
-
-    def serialize(self):
-        return str(self)
-
-
-class Value(Node):
-
-    def serialize(self):
-        return '"{0}"'.format(self)
-
-
-class Op(Node):
-
-    def serialize(self):
-        return str(self)
-
-
-VARIABLE = (
-    L("implementation_version") |
-    L("platform_python_implementation") |
-    L("implementation_name") |
-    L("python_full_version") |
-    L("platform_release") |
-    L("platform_version") |
-    L("platform_machine") |
-    L("platform_system") |
-    L("python_version") |
-    L("sys_platform") |
-    L("os_name") |
-    L("os.name") |  # PEP-345
-    L("sys.platform") |  # PEP-345
-    L("platform.version") |  # PEP-345
-    L("platform.machine") |  # PEP-345
-    L("platform.python_implementation") |  # PEP-345
-    L("python_implementation") |  # undocumented setuptools legacy
-    L("extra")
-)
-ALIASES = {
-    'os.name': 'os_name',
-    'sys.platform': 'sys_platform',
-    'platform.version': 'platform_version',
-    'platform.machine': 'platform_machine',
-    'platform.python_implementation': 'platform_python_implementation',
-    'python_implementation': 'platform_python_implementation'
-}
-VARIABLE.setParseAction(lambda s, l, t: Variable(ALIASES.get(t[0], t[0])))
-
-VERSION_CMP = (
-    L("===") |
-    L("==") |
-    L(">=") |
-    L("<=") |
-    L("!=") |
-    L("~=") |
-    L(">") |
-    L("<")
-)
-
-MARKER_OP = VERSION_CMP | L("not in") | L("in")
-MARKER_OP.setParseAction(lambda s, l, t: Op(t[0]))
-
-MARKER_VALUE = QuotedString("'") | QuotedString('"')
-MARKER_VALUE.setParseAction(lambda s, l, t: Value(t[0]))
-
-BOOLOP = L("and") | L("or")
-
-MARKER_VAR = VARIABLE | MARKER_VALUE
-
-MARKER_ITEM = Group(MARKER_VAR + MARKER_OP + MARKER_VAR)
-MARKER_ITEM.setParseAction(lambda s, l, t: tuple(t[0]))
-
-LPAREN = L("(").suppress()
-RPAREN = L(")").suppress()
-
-MARKER_EXPR = Forward()
-MARKER_ATOM = MARKER_ITEM | Group(LPAREN + MARKER_EXPR + RPAREN)
-MARKER_EXPR << MARKER_ATOM + ZeroOrMore(BOOLOP + MARKER_EXPR)
-
-MARKER = stringStart + MARKER_EXPR + stringEnd
-
-
-def _coerce_parse_result(results):
-    if isinstance(results, ParseResults):
-        return [_coerce_parse_result(i) for i in results]
-    else:
-        return results
-
-
-def _format_marker(marker, first=True):
-    assert isinstance(marker, (list, tuple, string_types))
-
-    # Sometimes we have a structure like [[...]] which is a single item list
-    # where the single item is itself it's own list. In that case we want skip
-    # the rest of this function so that we don't get extraneous () on the
-    # outside.
-    if (isinstance(marker, list) and len(marker) == 1 and
-            isinstance(marker[0], (list, tuple))):
-        return _format_marker(marker[0])
-
-    if isinstance(marker, list):
-        inner = (_format_marker(m, first=False) for m in marker)
-        if first:
-            return " ".join(inner)
-        else:
-            return "(" + " ".join(inner) + ")"
-    elif isinstance(marker, tuple):
-        return " ".join([m.serialize() for m in marker])
-    else:
-        return marker
-
-
-_operators = {
-    "in": lambda lhs, rhs: lhs in rhs,
-    "not in": lambda lhs, rhs: lhs not in rhs,
-    "<": operator.lt,
-    "<=": operator.le,
-    "==": operator.eq,
-    "!=": operator.ne,
-    ">=": operator.ge,
-    ">": operator.gt,
-}
-
-
-def _eval_op(lhs, op, rhs):
-    try:
-        spec = Specifier("".join([op.serialize(), rhs]))
-    except InvalidSpecifier:
-        pass
-    else:
-        return spec.contains(lhs)
-
-    oper = _operators.get(op.serialize())
-    if oper is None:
-        raise UndefinedComparison(
-            "Undefined {0!r} on {1!r} and {2!r}.".format(op, lhs, rhs)
-        )
-
-    return oper(lhs, rhs)
-
-
-_undefined = object()
-
-
-def _get_env(environment, name):
-    value = environment.get(name, _undefined)
-
-    if value is _undefined:
-        raise UndefinedEnvironmentName(
-            "{0!r} does not exist in evaluation environment.".format(name)
-        )
-
-    return value
-
-
-def _evaluate_markers(markers, environment):
-    groups = [[]]
-
-    for marker in markers:
-        assert isinstance(marker, (list, tuple, string_types))
-
-        if isinstance(marker, list):
-            groups[-1].append(_evaluate_markers(marker, environment))
-        elif isinstance(marker, tuple):
-            lhs, op, rhs = marker
-
-            if isinstance(lhs, Variable):
-                lhs_value = _get_env(environment, lhs.value)
-                rhs_value = rhs.value
-            else:
-                lhs_value = lhs.value
-                rhs_value = _get_env(environment, rhs.value)
-
-            groups[-1].append(_eval_op(lhs_value, op, rhs_value))
-        else:
-            assert marker in ["and", "or"]
-            if marker == "or":
-                groups.append([])
-
-    return any(all(item) for item in groups)
-
-
-def format_full_version(info):
-    version = '{0.major}.{0.minor}.{0.micro}'.format(info)
-    kind = info.releaselevel
-    if kind != 'final':
-        version += kind[0] + str(info.serial)
-    return version
-
-
-def default_environment():
-    if hasattr(sys, 'implementation'):
-        iver = format_full_version(sys.implementation.version)
-        implementation_name = sys.implementation.name
-    else:
-        iver = '0'
-        implementation_name = ''
-
-    return {
-        "implementation_name": implementation_name,
-        "implementation_version": iver,
-        "os_name": os.name,
-        "platform_machine": platform.machine(),
-        "platform_release": platform.release(),
-        "platform_system": platform.system(),
-        "platform_version": platform.version(),
-        "python_full_version": platform.python_version(),
-        "platform_python_implementation": platform.python_implementation(),
-        "python_version": platform.python_version()[:3],
-        "sys_platform": sys.platform,
-    }
-
-
-class Marker(object):
-
-    def __init__(self, marker):
-        try:
-            self._markers = _coerce_parse_result(MARKER.parseString(marker))
-        except ParseException as e:
-            err_str = "Invalid marker: {0!r}, parse error at {1!r}".format(
-                marker, marker[e.loc:e.loc + 8])
-            raise InvalidMarker(err_str)
-
-    def __str__(self):
-        return _format_marker(self._markers)
-
-    def __repr__(self):
-        return "".format(str(self))
-
-    def evaluate(self, environment=None):
-        """Evaluate a marker.
-
-        Return the boolean from evaluating the given marker against the
-        environment. environment is an optional argument to override all or
-        part of the determined environment.
-
-        The environment is determined from the current Python process.
-        """
-        current_environment = default_environment()
-        if environment is not None:
-            current_environment.update(environment)
-
-        return _evaluate_markers(self._markers, current_environment)
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/requirements.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/requirements.py
deleted file mode 100644
index 0c8c4a3852fd37053fd552846aa7787805c30a48..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/requirements.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-import string
-import re
-
-from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
-from pkg_resources.extern.pyparsing import ZeroOrMore, Word, Optional, Regex, Combine
-from pkg_resources.extern.pyparsing import Literal as L  # noqa
-from pkg_resources.extern.six.moves.urllib import parse as urlparse
-
-from .markers import MARKER_EXPR, Marker
-from .specifiers import LegacySpecifier, Specifier, SpecifierSet
-
-
-class InvalidRequirement(ValueError):
-    """
-    An invalid requirement was found, users should refer to PEP 508.
-    """
-
-
-ALPHANUM = Word(string.ascii_letters + string.digits)
-
-LBRACKET = L("[").suppress()
-RBRACKET = L("]").suppress()
-LPAREN = L("(").suppress()
-RPAREN = L(")").suppress()
-COMMA = L(",").suppress()
-SEMICOLON = L(";").suppress()
-AT = L("@").suppress()
-
-PUNCTUATION = Word("-_.")
-IDENTIFIER_END = ALPHANUM | (ZeroOrMore(PUNCTUATION) + ALPHANUM)
-IDENTIFIER = Combine(ALPHANUM + ZeroOrMore(IDENTIFIER_END))
-
-NAME = IDENTIFIER("name")
-EXTRA = IDENTIFIER
-
-URI = Regex(r'[^ ]+')("url")
-URL = (AT + URI)
-
-EXTRAS_LIST = EXTRA + ZeroOrMore(COMMA + EXTRA)
-EXTRAS = (LBRACKET + Optional(EXTRAS_LIST) + RBRACKET)("extras")
-
-VERSION_PEP440 = Regex(Specifier._regex_str, re.VERBOSE | re.IGNORECASE)
-VERSION_LEGACY = Regex(LegacySpecifier._regex_str, re.VERBOSE | re.IGNORECASE)
-
-VERSION_ONE = VERSION_PEP440 ^ VERSION_LEGACY
-VERSION_MANY = Combine(VERSION_ONE + ZeroOrMore(COMMA + VERSION_ONE),
-                       joinString=",", adjacent=False)("_raw_spec")
-_VERSION_SPEC = Optional(((LPAREN + VERSION_MANY + RPAREN) | VERSION_MANY))
-_VERSION_SPEC.setParseAction(lambda s, l, t: t._raw_spec or '')
-
-VERSION_SPEC = originalTextFor(_VERSION_SPEC)("specifier")
-VERSION_SPEC.setParseAction(lambda s, l, t: t[1])
-
-MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
-MARKER_EXPR.setParseAction(
-    lambda s, l, t: Marker(s[t._original_start:t._original_end])
-)
-MARKER_SEPERATOR = SEMICOLON
-MARKER = MARKER_SEPERATOR + MARKER_EXPR
-
-VERSION_AND_MARKER = VERSION_SPEC + Optional(MARKER)
-URL_AND_MARKER = URL + Optional(MARKER)
-
-NAMED_REQUIREMENT = \
-    NAME + Optional(EXTRAS) + (URL_AND_MARKER | VERSION_AND_MARKER)
-
-REQUIREMENT = stringStart + NAMED_REQUIREMENT + stringEnd
-
-
-class Requirement(object):
-    """Parse a requirement.
-
-    Parse a given requirement string into its parts, such as name, specifier,
-    URL, and extras. Raises InvalidRequirement on a badly-formed requirement
-    string.
-    """
-
-    # TODO: Can we test whether something is contained within a requirement?
-    #       If so how do we do that? Do we need to test against the _name_ of
-    #       the thing as well as the version? What about the markers?
-    # TODO: Can we normalize the name and extra name?
-
-    def __init__(self, requirement_string):
-        try:
-            req = REQUIREMENT.parseString(requirement_string)
-        except ParseException as e:
-            raise InvalidRequirement(
-                "Invalid requirement, parse error at \"{0!r}\"".format(
-                    requirement_string[e.loc:e.loc + 8]))
-
-        self.name = req.name
-        if req.url:
-            parsed_url = urlparse.urlparse(req.url)
-            if not (parsed_url.scheme and parsed_url.netloc) or (
-                    not parsed_url.scheme and not parsed_url.netloc):
-                raise InvalidRequirement("Invalid URL given")
-            self.url = req.url
-        else:
-            self.url = None
-        self.extras = set(req.extras.asList() if req.extras else [])
-        self.specifier = SpecifierSet(req.specifier)
-        self.marker = req.marker if req.marker else None
-
-    def __str__(self):
-        parts = [self.name]
-
-        if self.extras:
-            parts.append("[{0}]".format(",".join(sorted(self.extras))))
-
-        if self.specifier:
-            parts.append(str(self.specifier))
-
-        if self.url:
-            parts.append("@ {0}".format(self.url))
-
-        if self.marker:
-            parts.append("; {0}".format(self.marker))
-
-        return "".join(parts)
-
-    def __repr__(self):
-        return "".format(str(self))
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/specifiers.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/specifiers.py
deleted file mode 100644
index 7f5a76cfd63f47dcce29b3ea82f59d10f4e8d771..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/specifiers.py
+++ /dev/null
@@ -1,774 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-import abc
-import functools
-import itertools
-import re
-
-from ._compat import string_types, with_metaclass
-from .version import Version, LegacyVersion, parse
-
-
-class InvalidSpecifier(ValueError):
-    """
-    An invalid specifier was found, users should refer to PEP 440.
-    """
-
-
-class BaseSpecifier(with_metaclass(abc.ABCMeta, object)):
-
-    @abc.abstractmethod
-    def __str__(self):
-        """
-        Returns the str representation of this Specifier like object. This
-        should be representative of the Specifier itself.
-        """
-
-    @abc.abstractmethod
-    def __hash__(self):
-        """
-        Returns a hash value for this Specifier like object.
-        """
-
-    @abc.abstractmethod
-    def __eq__(self, other):
-        """
-        Returns a boolean representing whether or not the two Specifier like
-        objects are equal.
-        """
-
-    @abc.abstractmethod
-    def __ne__(self, other):
-        """
-        Returns a boolean representing whether or not the two Specifier like
-        objects are not equal.
-        """
-
-    @abc.abstractproperty
-    def prereleases(self):
-        """
-        Returns whether or not pre-releases as a whole are allowed by this
-        specifier.
-        """
-
-    @prereleases.setter
-    def prereleases(self, value):
-        """
-        Sets whether or not pre-releases as a whole are allowed by this
-        specifier.
-        """
-
-    @abc.abstractmethod
-    def contains(self, item, prereleases=None):
-        """
-        Determines if the given item is contained within this specifier.
-        """
-
-    @abc.abstractmethod
-    def filter(self, iterable, prereleases=None):
-        """
-        Takes an iterable of items and filters them so that only items which
-        are contained within this specifier are allowed in it.
-        """
-
-
-class _IndividualSpecifier(BaseSpecifier):
-
-    _operators = {}
-
-    def __init__(self, spec="", prereleases=None):
-        match = self._regex.search(spec)
-        if not match:
-            raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
-
-        self._spec = (
-            match.group("operator").strip(),
-            match.group("version").strip(),
-        )
-
-        # Store whether or not this Specifier should accept prereleases
-        self._prereleases = prereleases
-
-    def __repr__(self):
-        pre = (
-            ", prereleases={0!r}".format(self.prereleases)
-            if self._prereleases is not None
-            else ""
-        )
-
-        return "<{0}({1!r}{2})>".format(
-            self.__class__.__name__,
-            str(self),
-            pre,
-        )
-
-    def __str__(self):
-        return "{0}{1}".format(*self._spec)
-
-    def __hash__(self):
-        return hash(self._spec)
-
-    def __eq__(self, other):
-        if isinstance(other, string_types):
-            try:
-                other = self.__class__(other)
-            except InvalidSpecifier:
-                return NotImplemented
-        elif not isinstance(other, self.__class__):
-            return NotImplemented
-
-        return self._spec == other._spec
-
-    def __ne__(self, other):
-        if isinstance(other, string_types):
-            try:
-                other = self.__class__(other)
-            except InvalidSpecifier:
-                return NotImplemented
-        elif not isinstance(other, self.__class__):
-            return NotImplemented
-
-        return self._spec != other._spec
-
-    def _get_operator(self, op):
-        return getattr(self, "_compare_{0}".format(self._operators[op]))
-
-    def _coerce_version(self, version):
-        if not isinstance(version, (LegacyVersion, Version)):
-            version = parse(version)
-        return version
-
-    @property
-    def operator(self):
-        return self._spec[0]
-
-    @property
-    def version(self):
-        return self._spec[1]
-
-    @property
-    def prereleases(self):
-        return self._prereleases
-
-    @prereleases.setter
-    def prereleases(self, value):
-        self._prereleases = value
-
-    def __contains__(self, item):
-        return self.contains(item)
-
-    def contains(self, item, prereleases=None):
-        # Determine if prereleases are to be allowed or not.
-        if prereleases is None:
-            prereleases = self.prereleases
-
-        # Normalize item to a Version or LegacyVersion, this allows us to have
-        # a shortcut for ``"2.0" in Specifier(">=2")
-        item = self._coerce_version(item)
-
-        # Determine if we should be supporting prereleases in this specifier
-        # or not, if we do not support prereleases than we can short circuit
-        # logic if this version is a prereleases.
-        if item.is_prerelease and not prereleases:
-            return False
-
-        # Actually do the comparison to determine if this item is contained
-        # within this Specifier or not.
-        return self._get_operator(self.operator)(item, self.version)
-
-    def filter(self, iterable, prereleases=None):
-        yielded = False
-        found_prereleases = []
-
-        kw = {"prereleases": prereleases if prereleases is not None else True}
-
-        # Attempt to iterate over all the values in the iterable and if any of
-        # them match, yield them.
-        for version in iterable:
-            parsed_version = self._coerce_version(version)
-
-            if self.contains(parsed_version, **kw):
-                # If our version is a prerelease, and we were not set to allow
-                # prereleases, then we'll store it for later incase nothing
-                # else matches this specifier.
-                if (parsed_version.is_prerelease and not
-                        (prereleases or self.prereleases)):
-                    found_prereleases.append(version)
-                # Either this is not a prerelease, or we should have been
-                # accepting prereleases from the begining.
-                else:
-                    yielded = True
-                    yield version
-
-        # Now that we've iterated over everything, determine if we've yielded
-        # any values, and if we have not and we have any prereleases stored up
-        # then we will go ahead and yield the prereleases.
-        if not yielded and found_prereleases:
-            for version in found_prereleases:
-                yield version
-
-
-class LegacySpecifier(_IndividualSpecifier):
-
-    _regex_str = (
-        r"""
-        (?P(==|!=|<=|>=|<|>))
-        \s*
-        (?P
-            [^,;\s)]* # Since this is a "legacy" specifier, and the version
-                      # string can be just about anything, we match everything
-                      # except for whitespace, a semi-colon for marker support,
-                      # a closing paren since versions can be enclosed in
-                      # them, and a comma since it's a version separator.
-        )
-        """
-    )
-
-    _regex = re.compile(
-        r"^\s*" + _regex_str + r"\s*$", re.VERBOSE | re.IGNORECASE)
-
-    _operators = {
-        "==": "equal",
-        "!=": "not_equal",
-        "<=": "less_than_equal",
-        ">=": "greater_than_equal",
-        "<": "less_than",
-        ">": "greater_than",
-    }
-
-    def _coerce_version(self, version):
-        if not isinstance(version, LegacyVersion):
-            version = LegacyVersion(str(version))
-        return version
-
-    def _compare_equal(self, prospective, spec):
-        return prospective == self._coerce_version(spec)
-
-    def _compare_not_equal(self, prospective, spec):
-        return prospective != self._coerce_version(spec)
-
-    def _compare_less_than_equal(self, prospective, spec):
-        return prospective <= self._coerce_version(spec)
-
-    def _compare_greater_than_equal(self, prospective, spec):
-        return prospective >= self._coerce_version(spec)
-
-    def _compare_less_than(self, prospective, spec):
-        return prospective < self._coerce_version(spec)
-
-    def _compare_greater_than(self, prospective, spec):
-        return prospective > self._coerce_version(spec)
-
-
-def _require_version_compare(fn):
-    @functools.wraps(fn)
-    def wrapped(self, prospective, spec):
-        if not isinstance(prospective, Version):
-            return False
-        return fn(self, prospective, spec)
-    return wrapped
-
-
-class Specifier(_IndividualSpecifier):
-
-    _regex_str = (
-        r"""
-        (?P(~=|==|!=|<=|>=|<|>|===))
-        (?P
-            (?:
-                # The identity operators allow for an escape hatch that will
-                # do an exact string match of the version you wish to install.
-                # This will not be parsed by PEP 440 and we cannot determine
-                # any semantic meaning from it. This operator is discouraged
-                # but included entirely as an escape hatch.
-                (?<====)  # Only match for the identity operator
-                \s*
-                [^\s]*    # We just match everything, except for whitespace
-                          # since we are only testing for strict identity.
-            )
-            |
-            (?:
-                # The (non)equality operators allow for wild card and local
-                # versions to be specified so we have to define these two
-                # operators separately to enable that.
-                (?<===|!=)            # Only match for equals and not equals
-
-                \s*
-                v?
-                (?:[0-9]+!)?          # epoch
-                [0-9]+(?:\.[0-9]+)*   # release
-                (?:                   # pre release
-                    [-_\.]?
-                    (a|b|c|rc|alpha|beta|pre|preview)
-                    [-_\.]?
-                    [0-9]*
-                )?
-                (?:                   # post release
-                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
-                )?
-
-                # You cannot use a wild card and a dev or local version
-                # together so group them with a | and make them optional.
-                (?:
-                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
-                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
-                    |
-                    \.\*  # Wild card syntax of .*
-                )?
-            )
-            |
-            (?:
-                # The compatible operator requires at least two digits in the
-                # release segment.
-                (?<=~=)               # Only match for the compatible operator
-
-                \s*
-                v?
-                (?:[0-9]+!)?          # epoch
-                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
-                (?:                   # pre release
-                    [-_\.]?
-                    (a|b|c|rc|alpha|beta|pre|preview)
-                    [-_\.]?
-                    [0-9]*
-                )?
-                (?:                                   # post release
-                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
-                )?
-                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
-            )
-            |
-            (?:
-                # All other operators only allow a sub set of what the
-                # (non)equality operators do. Specifically they do not allow
-                # local versions to be specified nor do they allow the prefix
-                # matching wild cards.
-                (?=": "greater_than_equal",
-        "<": "less_than",
-        ">": "greater_than",
-        "===": "arbitrary",
-    }
-
-    @_require_version_compare
-    def _compare_compatible(self, prospective, spec):
-        # Compatible releases have an equivalent combination of >= and ==. That
-        # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
-        # implement this in terms of the other specifiers instead of
-        # implementing it ourselves. The only thing we need to do is construct
-        # the other specifiers.
-
-        # We want everything but the last item in the version, but we want to
-        # ignore post and dev releases and we want to treat the pre-release as
-        # it's own separate segment.
-        prefix = ".".join(
-            list(
-                itertools.takewhile(
-                    lambda x: (not x.startswith("post") and not
-                               x.startswith("dev")),
-                    _version_split(spec),
-                )
-            )[:-1]
-        )
-
-        # Add the prefix notation to the end of our string
-        prefix += ".*"
-
-        return (self._get_operator(">=")(prospective, spec) and
-                self._get_operator("==")(prospective, prefix))
-
-    @_require_version_compare
-    def _compare_equal(self, prospective, spec):
-        # We need special logic to handle prefix matching
-        if spec.endswith(".*"):
-            # In the case of prefix matching we want to ignore local segment.
-            prospective = Version(prospective.public)
-            # Split the spec out by dots, and pretend that there is an implicit
-            # dot in between a release segment and a pre-release segment.
-            spec = _version_split(spec[:-2])  # Remove the trailing .*
-
-            # Split the prospective version out by dots, and pretend that there
-            # is an implicit dot in between a release segment and a pre-release
-            # segment.
-            prospective = _version_split(str(prospective))
-
-            # Shorten the prospective version to be the same length as the spec
-            # so that we can determine if the specifier is a prefix of the
-            # prospective version or not.
-            prospective = prospective[:len(spec)]
-
-            # Pad out our two sides with zeros so that they both equal the same
-            # length.
-            spec, prospective = _pad_version(spec, prospective)
-        else:
-            # Convert our spec string into a Version
-            spec = Version(spec)
-
-            # If the specifier does not have a local segment, then we want to
-            # act as if the prospective version also does not have a local
-            # segment.
-            if not spec.local:
-                prospective = Version(prospective.public)
-
-        return prospective == spec
-
-    @_require_version_compare
-    def _compare_not_equal(self, prospective, spec):
-        return not self._compare_equal(prospective, spec)
-
-    @_require_version_compare
-    def _compare_less_than_equal(self, prospective, spec):
-        return prospective <= Version(spec)
-
-    @_require_version_compare
-    def _compare_greater_than_equal(self, prospective, spec):
-        return prospective >= Version(spec)
-
-    @_require_version_compare
-    def _compare_less_than(self, prospective, spec):
-        # Convert our spec to a Version instance, since we'll want to work with
-        # it as a version.
-        spec = Version(spec)
-
-        # Check to see if the prospective version is less than the spec
-        # version. If it's not we can short circuit and just return False now
-        # instead of doing extra unneeded work.
-        if not prospective < spec:
-            return False
-
-        # This special case is here so that, unless the specifier itself
-        # includes is a pre-release version, that we do not accept pre-release
-        # versions for the version mentioned in the specifier (e.g. <3.1 should
-        # not match 3.1.dev0, but should match 3.0.dev0).
-        if not spec.is_prerelease and prospective.is_prerelease:
-            if Version(prospective.base_version) == Version(spec.base_version):
-                return False
-
-        # If we've gotten to here, it means that prospective version is both
-        # less than the spec version *and* it's not a pre-release of the same
-        # version in the spec.
-        return True
-
-    @_require_version_compare
-    def _compare_greater_than(self, prospective, spec):
-        # Convert our spec to a Version instance, since we'll want to work with
-        # it as a version.
-        spec = Version(spec)
-
-        # Check to see if the prospective version is greater than the spec
-        # version. If it's not we can short circuit and just return False now
-        # instead of doing extra unneeded work.
-        if not prospective > spec:
-            return False
-
-        # This special case is here so that, unless the specifier itself
-        # includes is a post-release version, that we do not accept
-        # post-release versions for the version mentioned in the specifier
-        # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0).
-        if not spec.is_postrelease and prospective.is_postrelease:
-            if Version(prospective.base_version) == Version(spec.base_version):
-                return False
-
-        # Ensure that we do not allow a local version of the version mentioned
-        # in the specifier, which is techincally greater than, to match.
-        if prospective.local is not None:
-            if Version(prospective.base_version) == Version(spec.base_version):
-                return False
-
-        # If we've gotten to here, it means that prospective version is both
-        # greater than the spec version *and* it's not a pre-release of the
-        # same version in the spec.
-        return True
-
-    def _compare_arbitrary(self, prospective, spec):
-        return str(prospective).lower() == str(spec).lower()
-
-    @property
-    def prereleases(self):
-        # If there is an explicit prereleases set for this, then we'll just
-        # blindly use that.
-        if self._prereleases is not None:
-            return self._prereleases
-
-        # Look at all of our specifiers and determine if they are inclusive
-        # operators, and if they are if they are including an explicit
-        # prerelease.
-        operator, version = self._spec
-        if operator in ["==", ">=", "<=", "~=", "==="]:
-            # The == specifier can include a trailing .*, if it does we
-            # want to remove before parsing.
-            if operator == "==" and version.endswith(".*"):
-                version = version[:-2]
-
-            # Parse the version, and if it is a pre-release than this
-            # specifier allows pre-releases.
-            if parse(version).is_prerelease:
-                return True
-
-        return False
-
-    @prereleases.setter
-    def prereleases(self, value):
-        self._prereleases = value
-
-
-_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
-
-
-def _version_split(version):
-    result = []
-    for item in version.split("."):
-        match = _prefix_regex.search(item)
-        if match:
-            result.extend(match.groups())
-        else:
-            result.append(item)
-    return result
-
-
-def _pad_version(left, right):
-    left_split, right_split = [], []
-
-    # Get the release segment of our versions
-    left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))
-    right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))
-
-    # Get the rest of our versions
-    left_split.append(left[len(left_split[0]):])
-    right_split.append(right[len(right_split[0]):])
-
-    # Insert our padding
-    left_split.insert(
-        1,
-        ["0"] * max(0, len(right_split[0]) - len(left_split[0])),
-    )
-    right_split.insert(
-        1,
-        ["0"] * max(0, len(left_split[0]) - len(right_split[0])),
-    )
-
-    return (
-        list(itertools.chain(*left_split)),
-        list(itertools.chain(*right_split)),
-    )
-
-
-class SpecifierSet(BaseSpecifier):
-
-    def __init__(self, specifiers="", prereleases=None):
-        # Split on , to break each indidivual specifier into it's own item, and
-        # strip each item to remove leading/trailing whitespace.
-        specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
-
-        # Parsed each individual specifier, attempting first to make it a
-        # Specifier and falling back to a LegacySpecifier.
-        parsed = set()
-        for specifier in specifiers:
-            try:
-                parsed.add(Specifier(specifier))
-            except InvalidSpecifier:
-                parsed.add(LegacySpecifier(specifier))
-
-        # Turn our parsed specifiers into a frozen set and save them for later.
-        self._specs = frozenset(parsed)
-
-        # Store our prereleases value so we can use it later to determine if
-        # we accept prereleases or not.
-        self._prereleases = prereleases
-
-    def __repr__(self):
-        pre = (
-            ", prereleases={0!r}".format(self.prereleases)
-            if self._prereleases is not None
-            else ""
-        )
-
-        return "".format(str(self), pre)
-
-    def __str__(self):
-        return ",".join(sorted(str(s) for s in self._specs))
-
-    def __hash__(self):
-        return hash(self._specs)
-
-    def __and__(self, other):
-        if isinstance(other, string_types):
-            other = SpecifierSet(other)
-        elif not isinstance(other, SpecifierSet):
-            return NotImplemented
-
-        specifier = SpecifierSet()
-        specifier._specs = frozenset(self._specs | other._specs)
-
-        if self._prereleases is None and other._prereleases is not None:
-            specifier._prereleases = other._prereleases
-        elif self._prereleases is not None and other._prereleases is None:
-            specifier._prereleases = self._prereleases
-        elif self._prereleases == other._prereleases:
-            specifier._prereleases = self._prereleases
-        else:
-            raise ValueError(
-                "Cannot combine SpecifierSets with True and False prerelease "
-                "overrides."
-            )
-
-        return specifier
-
-    def __eq__(self, other):
-        if isinstance(other, string_types):
-            other = SpecifierSet(other)
-        elif isinstance(other, _IndividualSpecifier):
-            other = SpecifierSet(str(other))
-        elif not isinstance(other, SpecifierSet):
-            return NotImplemented
-
-        return self._specs == other._specs
-
-    def __ne__(self, other):
-        if isinstance(other, string_types):
-            other = SpecifierSet(other)
-        elif isinstance(other, _IndividualSpecifier):
-            other = SpecifierSet(str(other))
-        elif not isinstance(other, SpecifierSet):
-            return NotImplemented
-
-        return self._specs != other._specs
-
-    def __len__(self):
-        return len(self._specs)
-
-    def __iter__(self):
-        return iter(self._specs)
-
-    @property
-    def prereleases(self):
-        # If we have been given an explicit prerelease modifier, then we'll
-        # pass that through here.
-        if self._prereleases is not None:
-            return self._prereleases
-
-        # If we don't have any specifiers, and we don't have a forced value,
-        # then we'll just return None since we don't know if this should have
-        # pre-releases or not.
-        if not self._specs:
-            return None
-
-        # Otherwise we'll see if any of the given specifiers accept
-        # prereleases, if any of them do we'll return True, otherwise False.
-        return any(s.prereleases for s in self._specs)
-
-    @prereleases.setter
-    def prereleases(self, value):
-        self._prereleases = value
-
-    def __contains__(self, item):
-        return self.contains(item)
-
-    def contains(self, item, prereleases=None):
-        # Ensure that our item is a Version or LegacyVersion instance.
-        if not isinstance(item, (LegacyVersion, Version)):
-            item = parse(item)
-
-        # Determine if we're forcing a prerelease or not, if we're not forcing
-        # one for this particular filter call, then we'll use whatever the
-        # SpecifierSet thinks for whether or not we should support prereleases.
-        if prereleases is None:
-            prereleases = self.prereleases
-
-        # We can determine if we're going to allow pre-releases by looking to
-        # see if any of the underlying items supports them. If none of them do
-        # and this item is a pre-release then we do not allow it and we can
-        # short circuit that here.
-        # Note: This means that 1.0.dev1 would not be contained in something
-        #       like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0
-        if not prereleases and item.is_prerelease:
-            return False
-
-        # We simply dispatch to the underlying specs here to make sure that the
-        # given version is contained within all of them.
-        # Note: This use of all() here means that an empty set of specifiers
-        #       will always return True, this is an explicit design decision.
-        return all(
-            s.contains(item, prereleases=prereleases)
-            for s in self._specs
-        )
-
-    def filter(self, iterable, prereleases=None):
-        # Determine if we're forcing a prerelease or not, if we're not forcing
-        # one for this particular filter call, then we'll use whatever the
-        # SpecifierSet thinks for whether or not we should support prereleases.
-        if prereleases is None:
-            prereleases = self.prereleases
-
-        # If we have any specifiers, then we want to wrap our iterable in the
-        # filter method for each one, this will act as a logical AND amongst
-        # each specifier.
-        if self._specs:
-            for spec in self._specs:
-                iterable = spec.filter(iterable, prereleases=bool(prereleases))
-            return iterable
-        # If we do not have any specifiers, then we need to have a rough filter
-        # which will filter out any pre-releases, unless there are no final
-        # releases, and which will filter out LegacyVersion in general.
-        else:
-            filtered = []
-            found_prereleases = []
-
-            for item in iterable:
-                # Ensure that we some kind of Version class for this item.
-                if not isinstance(item, (LegacyVersion, Version)):
-                    parsed_version = parse(item)
-                else:
-                    parsed_version = item
-
-                # Filter out any item which is parsed as a LegacyVersion
-                if isinstance(parsed_version, LegacyVersion):
-                    continue
-
-                # Store any item which is a pre-release for later unless we've
-                # already found a final version or we are accepting prereleases
-                if parsed_version.is_prerelease and not prereleases:
-                    if not filtered:
-                        found_prereleases.append(item)
-                else:
-                    filtered.append(item)
-
-            # If we've found no items except for pre-releases, then we'll go
-            # ahead and use the pre-releases
-            if not filtered and found_prereleases and prereleases is None:
-                return found_prereleases
-
-            return filtered
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/utils.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/utils.py
deleted file mode 100644
index 942387cef5d75f299a769b1eb43b6c7679e7a3a0..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/utils.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-import re
-
-
-_canonicalize_regex = re.compile(r"[-_.]+")
-
-
-def canonicalize_name(name):
-    # This is taken from PEP 503.
-    return _canonicalize_regex.sub("-", name).lower()
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py
deleted file mode 100644
index 83b5ee8c5efadf22ce2f16ff08c8a8d75f1eb5df..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py
+++ /dev/null
@@ -1,393 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-from __future__ import absolute_import, division, print_function
-
-import collections
-import itertools
-import re
-
-from ._structures import Infinity
-
-
-__all__ = [
-    "parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"
-]
-
-
-_Version = collections.namedtuple(
-    "_Version",
-    ["epoch", "release", "dev", "pre", "post", "local"],
-)
-
-
-def parse(version):
-    """
-    Parse the given version string and return either a :class:`Version` object
-    or a :class:`LegacyVersion` object depending on if the given version is
-    a valid PEP 440 version or a legacy version.
-    """
-    try:
-        return Version(version)
-    except InvalidVersion:
-        return LegacyVersion(version)
-
-
-class InvalidVersion(ValueError):
-    """
-    An invalid version was found, users should refer to PEP 440.
-    """
-
-
-class _BaseVersion(object):
-
-    def __hash__(self):
-        return hash(self._key)
-
-    def __lt__(self, other):
-        return self._compare(other, lambda s, o: s < o)
-
-    def __le__(self, other):
-        return self._compare(other, lambda s, o: s <= o)
-
-    def __eq__(self, other):
-        return self._compare(other, lambda s, o: s == o)
-
-    def __ge__(self, other):
-        return self._compare(other, lambda s, o: s >= o)
-
-    def __gt__(self, other):
-        return self._compare(other, lambda s, o: s > o)
-
-    def __ne__(self, other):
-        return self._compare(other, lambda s, o: s != o)
-
-    def _compare(self, other, method):
-        if not isinstance(other, _BaseVersion):
-            return NotImplemented
-
-        return method(self._key, other._key)
-
-
-class LegacyVersion(_BaseVersion):
-
-    def __init__(self, version):
-        self._version = str(version)
-        self._key = _legacy_cmpkey(self._version)
-
-    def __str__(self):
-        return self._version
-
-    def __repr__(self):
-        return "".format(repr(str(self)))
-
-    @property
-    def public(self):
-        return self._version
-
-    @property
-    def base_version(self):
-        return self._version
-
-    @property
-    def local(self):
-        return None
-
-    @property
-    def is_prerelease(self):
-        return False
-
-    @property
-    def is_postrelease(self):
-        return False
-
-
-_legacy_version_component_re = re.compile(
-    r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE,
-)
-
-_legacy_version_replacement_map = {
-    "pre": "c", "preview": "c", "-": "final-", "rc": "c", "dev": "@",
-}
-
-
-def _parse_version_parts(s):
-    for part in _legacy_version_component_re.split(s):
-        part = _legacy_version_replacement_map.get(part, part)
-
-        if not part or part == ".":
-            continue
-
-        if part[:1] in "0123456789":
-            # pad for numeric comparison
-            yield part.zfill(8)
-        else:
-            yield "*" + part
-
-    # ensure that alpha/beta/candidate are before final
-    yield "*final"
-
-
-def _legacy_cmpkey(version):
-    # We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch
-    # greater than or equal to 0. This will effectively put the LegacyVersion,
-    # which uses the defacto standard originally implemented by setuptools,
-    # as before all PEP 440 versions.
-    epoch = -1
-
-    # This scheme is taken from pkg_resources.parse_version setuptools prior to
-    # it's adoption of the packaging library.
-    parts = []
-    for part in _parse_version_parts(version.lower()):
-        if part.startswith("*"):
-            # remove "-" before a prerelease tag
-            if part < "*final":
-                while parts and parts[-1] == "*final-":
-                    parts.pop()
-
-            # remove trailing zeros from each series of numeric parts
-            while parts and parts[-1] == "00000000":
-                parts.pop()
-
-        parts.append(part)
-    parts = tuple(parts)
-
-    return epoch, parts
-
-# Deliberately not anchored to the start and end of the string, to make it
-# easier for 3rd party code to reuse
-VERSION_PATTERN = r"""
-    v?
-    (?:
-        (?:(?P[0-9]+)!)?                           # epoch
-        (?P[0-9]+(?:\.[0-9]+)*)                  # release segment
-        (?P
                                          # pre-release
-            [-_\.]?
-            (?P(a|b|c|rc|alpha|beta|pre|preview))
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-        (?P                                         # post release
-            (?:-(?P[0-9]+))
-            |
-            (?:
-                [-_\.]?
-                (?Ppost|rev|r)
-                [-_\.]?
-                (?P[0-9]+)?
-            )
-        )?
-        (?P                                          # dev release
-            [-_\.]?
-            (?Pdev)
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-    )
-    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
-"""
-
-
-class Version(_BaseVersion):
-
-    _regex = re.compile(
-        r"^\s*" + VERSION_PATTERN + r"\s*$",
-        re.VERBOSE | re.IGNORECASE,
-    )
-
-    def __init__(self, version):
-        # Validate the version and parse it into pieces
-        match = self._regex.search(version)
-        if not match:
-            raise InvalidVersion("Invalid version: '{0}'".format(version))
-
-        # Store the parsed out pieces of the version
-        self._version = _Version(
-            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
-            release=tuple(int(i) for i in match.group("release").split(".")),
-            pre=_parse_letter_version(
-                match.group("pre_l"),
-                match.group("pre_n"),
-            ),
-            post=_parse_letter_version(
-                match.group("post_l"),
-                match.group("post_n1") or match.group("post_n2"),
-            ),
-            dev=_parse_letter_version(
-                match.group("dev_l"),
-                match.group("dev_n"),
-            ),
-            local=_parse_local_version(match.group("local")),
-        )
-
-        # Generate a key which will be used for sorting
-        self._key = _cmpkey(
-            self._version.epoch,
-            self._version.release,
-            self._version.pre,
-            self._version.post,
-            self._version.dev,
-            self._version.local,
-        )
-
-    def __repr__(self):
-        return "".format(repr(str(self)))
-
-    def __str__(self):
-        parts = []
-
-        # Epoch
-        if self._version.epoch != 0:
-            parts.append("{0}!".format(self._version.epoch))
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self._version.release))
-
-        # Pre-release
-        if self._version.pre is not None:
-            parts.append("".join(str(x) for x in self._version.pre))
-
-        # Post-release
-        if self._version.post is not None:
-            parts.append(".post{0}".format(self._version.post[1]))
-
-        # Development release
-        if self._version.dev is not None:
-            parts.append(".dev{0}".format(self._version.dev[1]))
-
-        # Local version segment
-        if self._version.local is not None:
-            parts.append(
-                "+{0}".format(".".join(str(x) for x in self._version.local))
-            )
-
-        return "".join(parts)
-
-    @property
-    def public(self):
-        return str(self).split("+", 1)[0]
-
-    @property
-    def base_version(self):
-        parts = []
-
-        # Epoch
-        if self._version.epoch != 0:
-            parts.append("{0}!".format(self._version.epoch))
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self._version.release))
-
-        return "".join(parts)
-
-    @property
-    def local(self):
-        version_string = str(self)
-        if "+" in version_string:
-            return version_string.split("+", 1)[1]
-
-    @property
-    def is_prerelease(self):
-        return bool(self._version.dev or self._version.pre)
-
-    @property
-    def is_postrelease(self):
-        return bool(self._version.post)
-
-
-def _parse_letter_version(letter, number):
-    if letter:
-        # We consider there to be an implicit 0 in a pre-release if there is
-        # not a numeral associated with it.
-        if number is None:
-            number = 0
-
-        # We normalize any letters to their lower case form
-        letter = letter.lower()
-
-        # We consider some words to be alternate spellings of other words and
-        # in those cases we want to normalize the spellings to our preferred
-        # spelling.
-        if letter == "alpha":
-            letter = "a"
-        elif letter == "beta":
-            letter = "b"
-        elif letter in ["c", "pre", "preview"]:
-            letter = "rc"
-        elif letter in ["rev", "r"]:
-            letter = "post"
-
-        return letter, int(number)
-    if not letter and number:
-        # We assume if we are given a number, but we are not given a letter
-        # then this is using the implicit post release syntax (e.g. 1.0-1)
-        letter = "post"
-
-        return letter, int(number)
-
-
-_local_version_seperators = re.compile(r"[\._-]")
-
-
-def _parse_local_version(local):
-    """
-    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
-    """
-    if local is not None:
-        return tuple(
-            part.lower() if not part.isdigit() else int(part)
-            for part in _local_version_seperators.split(local)
-        )
-
-
-def _cmpkey(epoch, release, pre, post, dev, local):
-    # When we compare a release version, we want to compare it with all of the
-    # trailing zeros removed. So we'll use a reverse the list, drop all the now
-    # leading zeros until we come to something non zero, then take the rest
-    # re-reverse it back into the correct order and make it a tuple and use
-    # that for our sorting key.
-    release = tuple(
-        reversed(list(
-            itertools.dropwhile(
-                lambda x: x == 0,
-                reversed(release),
-            )
-        ))
-    )
-
-    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
-    # We'll do this by abusing the pre segment, but we _only_ want to do this
-    # if there is not a pre or a post segment. If we have one of those then
-    # the normal sorting rules will handle this case correctly.
-    if pre is None and post is None and dev is not None:
-        pre = -Infinity
-    # Versions without a pre-release (except as noted above) should sort after
-    # those with one.
-    elif pre is None:
-        pre = Infinity
-
-    # Versions without a post segment should sort before those with one.
-    if post is None:
-        post = -Infinity
-
-    # Versions without a development segment should sort after those with one.
-    if dev is None:
-        dev = Infinity
-
-    if local is None:
-        # Versions without a local segment should sort before those with one.
-        local = -Infinity
-    else:
-        # Versions with a local segment need that segment parsed to implement
-        # the sorting rules in PEP440.
-        # - Alpha numeric segments sort before numeric segments
-        # - Alpha numeric segments sort lexicographically
-        # - Numeric segments sort numerically
-        # - Shorter versions sort before longer versions when the prefixes
-        #   match exactly
-        local = tuple(
-            (i, "") if isinstance(i, int) else (-Infinity, i)
-            for i in local
-        )
-
-    return epoch, release, pre, post, dev, local
diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py
deleted file mode 100644
index 4aa30ee6b250b3b72a9dcebb7f26a8e0432d7082..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/pyparsing.py
+++ /dev/null
@@ -1,5742 +0,0 @@
-# module pyparsing.py
-#
-# Copyright (c) 2003-2018  Paul T. McGuire
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__doc__ = \
-"""
-pyparsing module - Classes and methods to define and execute parsing grammars
-=============================================================================
-
-The pyparsing module is an alternative approach to creating and executing simple grammars,
-vs. the traditional lex/yacc approach, or the use of regular expressions.  With pyparsing, you
-don't need to learn a new syntax for defining grammars or matching expressions - the parsing module
-provides a library of classes that you use to construct the grammar directly in Python.
-
-Here is a program to parse "Hello, World!" (or any greeting of the form 
-C{", !"}), built up using L{Word}, L{Literal}, and L{And} elements 
-(L{'+'} operator gives L{And} expressions, strings are auto-converted to
-L{Literal} expressions)::
-
-    from pyparsing import Word, alphas
-
-    # define grammar of a greeting
-    greet = Word(alphas) + "," + Word(alphas) + "!"
-
-    hello = "Hello, World!"
-    print (hello, "->", greet.parseString(hello))
-
-The program outputs the following::
-
-    Hello, World! -> ['Hello', ',', 'World', '!']
-
-The Python representation of the grammar is quite readable, owing to the self-explanatory
-class names, and the use of '+', '|' and '^' operators.
-
-The L{ParseResults} object returned from L{ParserElement.parseString} can be accessed as a nested list, a dictionary, or an
-object with named attributes.
-
-The pyparsing module handles some of the problems that are typically vexing when writing text parsers:
- - extra or missing whitespace (the above program will also handle "Hello,World!", "Hello  ,  World  !", etc.)
- - quoted strings
- - embedded comments
-
-
-Getting Started -
------------------
-Visit the classes L{ParserElement} and L{ParseResults} to see the base classes that most other pyparsing
-classes inherit from. Use the docstrings for examples of how to:
- - construct literal match expressions from L{Literal} and L{CaselessLiteral} classes
- - construct character word-group expressions using the L{Word} class
- - see how to create repetitive expressions using L{ZeroOrMore} and L{OneOrMore} classes
- - use L{'+'}, L{'|'}, L{'^'}, and L{'&'} operators to combine simple expressions into more complex ones
- - associate names with your parsed results using L{ParserElement.setResultsName}
- - find some helpful expression short-cuts like L{delimitedList} and L{oneOf}
- - find more useful common expressions in the L{pyparsing_common} namespace class
-"""
-
-__version__ = "2.2.1"
-__versionTime__ = "18 Sep 2018 00:49 UTC"
-__author__ = "Paul McGuire "
-
-import string
-from weakref import ref as wkref
-import copy
-import sys
-import warnings
-import re
-import sre_constants
-import collections
-import pprint
-import traceback
-import types
-from datetime import datetime
-
-try:
-    from _thread import RLock
-except ImportError:
-    from threading import RLock
-
-try:
-    # Python 3
-    from collections.abc import Iterable
-    from collections.abc import MutableMapping
-except ImportError:
-    # Python 2.7
-    from collections import Iterable
-    from collections import MutableMapping
-
-try:
-    from collections import OrderedDict as _OrderedDict
-except ImportError:
-    try:
-        from ordereddict import OrderedDict as _OrderedDict
-    except ImportError:
-        _OrderedDict = None
-
-#~ sys.stderr.write( "testing pyparsing module, version %s, %s\n" % (__version__,__versionTime__ ) )
-
-__all__ = [
-'And', 'CaselessKeyword', 'CaselessLiteral', 'CharsNotIn', 'Combine', 'Dict', 'Each', 'Empty',
-'FollowedBy', 'Forward', 'GoToColumn', 'Group', 'Keyword', 'LineEnd', 'LineStart', 'Literal',
-'MatchFirst', 'NoMatch', 'NotAny', 'OneOrMore', 'OnlyOnce', 'Optional', 'Or',
-'ParseBaseException', 'ParseElementEnhance', 'ParseException', 'ParseExpression', 'ParseFatalException',
-'ParseResults', 'ParseSyntaxException', 'ParserElement', 'QuotedString', 'RecursiveGrammarException',
-'Regex', 'SkipTo', 'StringEnd', 'StringStart', 'Suppress', 'Token', 'TokenConverter', 
-'White', 'Word', 'WordEnd', 'WordStart', 'ZeroOrMore',
-'alphanums', 'alphas', 'alphas8bit', 'anyCloseTag', 'anyOpenTag', 'cStyleComment', 'col',
-'commaSeparatedList', 'commonHTMLEntity', 'countedArray', 'cppStyleComment', 'dblQuotedString',
-'dblSlashComment', 'delimitedList', 'dictOf', 'downcaseTokens', 'empty', 'hexnums',
-'htmlComment', 'javaStyleComment', 'line', 'lineEnd', 'lineStart', 'lineno',
-'makeHTMLTags', 'makeXMLTags', 'matchOnlyAtCol', 'matchPreviousExpr', 'matchPreviousLiteral',
-'nestedExpr', 'nullDebugAction', 'nums', 'oneOf', 'opAssoc', 'operatorPrecedence', 'printables',
-'punc8bit', 'pythonStyleComment', 'quotedString', 'removeQuotes', 'replaceHTMLEntity', 
-'replaceWith', 'restOfLine', 'sglQuotedString', 'srange', 'stringEnd',
-'stringStart', 'traceParseAction', 'unicodeString', 'upcaseTokens', 'withAttribute',
-'indentedBlock', 'originalTextFor', 'ungroup', 'infixNotation','locatedExpr', 'withClass',
-'CloseMatch', 'tokenMap', 'pyparsing_common',
-]
-
-system_version = tuple(sys.version_info)[:3]
-PY_3 = system_version[0] == 3
-if PY_3:
-    _MAX_INT = sys.maxsize
-    basestring = str
-    unichr = chr
-    _ustr = str
-
-    # build list of single arg builtins, that can be used as parse actions
-    singleArgBuiltins = [sum, len, sorted, reversed, list, tuple, set, any, all, min, max]
-
-else:
-    _MAX_INT = sys.maxint
-    range = xrange
-
-    def _ustr(obj):
-        """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries
-           str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It
-           then < returns the unicode object | encodes it with the default encoding | ... >.
-        """
-        if isinstance(obj,unicode):
-            return obj
-
-        try:
-            # If this works, then _ustr(obj) has the same behaviour as str(obj), so
-            # it won't break any existing code.
-            return str(obj)
-
-        except UnicodeEncodeError:
-            # Else encode it
-            ret = unicode(obj).encode(sys.getdefaultencoding(), 'xmlcharrefreplace')
-            xmlcharref = Regex(r'&#\d+;')
-            xmlcharref.setParseAction(lambda t: '\\u' + hex(int(t[0][2:-1]))[2:])
-            return xmlcharref.transformString(ret)
-
-    # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
-    singleArgBuiltins = []
-    import __builtin__
-    for fname in "sum len sorted reversed list tuple set any all min max".split():
-        try:
-            singleArgBuiltins.append(getattr(__builtin__,fname))
-        except AttributeError:
-            continue
-            
-_generatorType = type((y for y in range(1)))
- 
-def _xml_escape(data):
-    """Escape &, <, >, ", ', etc. in a string of data."""
-
-    # ampersand must be replaced first
-    from_symbols = '&><"\''
-    to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split())
-    for from_,to_ in zip(from_symbols, to_symbols):
-        data = data.replace(from_, to_)
-    return data
-
-class _Constants(object):
-    pass
-
-alphas     = string.ascii_uppercase + string.ascii_lowercase
-nums       = "0123456789"
-hexnums    = nums + "ABCDEFabcdef"
-alphanums  = alphas + nums
-_bslash    = chr(92)
-printables = "".join(c for c in string.printable if c not in string.whitespace)
-
-class ParseBaseException(Exception):
-    """base exception class for all parsing runtime exceptions"""
-    # Performance tuning: we construct a *lot* of these, so keep this
-    # constructor as small and fast as possible
-    def __init__( self, pstr, loc=0, msg=None, elem=None ):
-        self.loc = loc
-        if msg is None:
-            self.msg = pstr
-            self.pstr = ""
-        else:
-            self.msg = msg
-            self.pstr = pstr
-        self.parserElement = elem
-        self.args = (pstr, loc, msg)
-
-    @classmethod
-    def _from_exception(cls, pe):
-        """
-        internal factory method to simplify creating one type of ParseException 
-        from another - avoids having __init__ signature conflicts among subclasses
-        """
-        return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement)
-
-    def __getattr__( self, aname ):
-        """supported attributes by name are:
-            - lineno - returns the line number of the exception text
-            - col - returns the column number of the exception text
-            - line - returns the line containing the exception text
-        """
-        if( aname == "lineno" ):
-            return lineno( self.loc, self.pstr )
-        elif( aname in ("col", "column") ):
-            return col( self.loc, self.pstr )
-        elif( aname == "line" ):
-            return line( self.loc, self.pstr )
-        else:
-            raise AttributeError(aname)
-
-    def __str__( self ):
-        return "%s (at char %d), (line:%d, col:%d)" % \
-                ( self.msg, self.loc, self.lineno, self.column )
-    def __repr__( self ):
-        return _ustr(self)
-    def markInputline( self, markerString = ">!<" ):
-        """Extracts the exception line from the input string, and marks
-           the location of the exception with a special symbol.
-        """
-        line_str = self.line
-        line_column = self.column - 1
-        if markerString:
-            line_str = "".join((line_str[:line_column],
-                                markerString, line_str[line_column:]))
-        return line_str.strip()
-    def __dir__(self):
-        return "lineno col line".split() + dir(type(self))
-
-class ParseException(ParseBaseException):
-    """
-    Exception thrown when parse expressions don't match class;
-    supported attributes by name are:
-     - lineno - returns the line number of the exception text
-     - col - returns the column number of the exception text
-     - line - returns the line containing the exception text
-        
-    Example::
-        try:
-            Word(nums).setName("integer").parseString("ABC")
-        except ParseException as pe:
-            print(pe)
-            print("column: {}".format(pe.col))
-            
-    prints::
-       Expected integer (at char 0), (line:1, col:1)
-        column: 1
-    """
-    pass
-
-class ParseFatalException(ParseBaseException):
-    """user-throwable exception thrown when inconsistent parse content
-       is found; stops all parsing immediately"""
-    pass
-
-class ParseSyntaxException(ParseFatalException):
-    """just like L{ParseFatalException}, but thrown internally when an
-       L{ErrorStop} ('-' operator) indicates that parsing is to stop 
-       immediately because an unbacktrackable syntax error has been found"""
-    pass
-
-#~ class ReparseException(ParseBaseException):
-    #~ """Experimental class - parse actions can raise this exception to cause
-       #~ pyparsing to reparse the input string:
-        #~ - with a modified input string, and/or
-        #~ - with a modified start location
-       #~ Set the values of the ReparseException in the constructor, and raise the
-       #~ exception in a parse action to cause pyparsing to use the new string/location.
-       #~ Setting the values as None causes no change to be made.
-       #~ """
-    #~ def __init_( self, newstring, restartLoc ):
-        #~ self.newParseText = newstring
-        #~ self.reparseLoc = restartLoc
-
-class RecursiveGrammarException(Exception):
-    """exception thrown by L{ParserElement.validate} if the grammar could be improperly recursive"""
-    def __init__( self, parseElementList ):
-        self.parseElementTrace = parseElementList
-
-    def __str__( self ):
-        return "RecursiveGrammarException: %s" % self.parseElementTrace
-
-class _ParseResultsWithOffset(object):
-    def __init__(self,p1,p2):
-        self.tup = (p1,p2)
-    def __getitem__(self,i):
-        return self.tup[i]
-    def __repr__(self):
-        return repr(self.tup[0])
-    def setOffset(self,i):
-        self.tup = (self.tup[0],i)
-
-class ParseResults(object):
-    """
-    Structured parse results, to provide multiple means of access to the parsed data:
-       - as a list (C{len(results)})
-       - by list index (C{results[0], results[1]}, etc.)
-       - by attribute (C{results.} - see L{ParserElement.setResultsName})
-
-    Example::
-        integer = Word(nums)
-        date_str = (integer.setResultsName("year") + '/' 
-                        + integer.setResultsName("month") + '/' 
-                        + integer.setResultsName("day"))
-        # equivalent form:
-        # date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
-
-        # parseString returns a ParseResults object
-        result = date_str.parseString("1999/12/31")
-
-        def test(s, fn=repr):
-            print("%s -> %s" % (s, fn(eval(s))))
-        test("list(result)")
-        test("result[0]")
-        test("result['month']")
-        test("result.day")
-        test("'month' in result")
-        test("'minutes' in result")
-        test("result.dump()", str)
-    prints::
-        list(result) -> ['1999', '/', '12', '/', '31']
-        result[0] -> '1999'
-        result['month'] -> '12'
-        result.day -> '31'
-        'month' in result -> True
-        'minutes' in result -> False
-        result.dump() -> ['1999', '/', '12', '/', '31']
-        - day: 31
-        - month: 12
-        - year: 1999
-    """
-    def __new__(cls, toklist=None, name=None, asList=True, modal=True ):
-        if isinstance(toklist, cls):
-            return toklist
-        retobj = object.__new__(cls)
-        retobj.__doinit = True
-        return retobj
-
-    # Performance tuning: we construct a *lot* of these, so keep this
-    # constructor as small and fast as possible
-    def __init__( self, toklist=None, name=None, asList=True, modal=True, isinstance=isinstance ):
-        if self.__doinit:
-            self.__doinit = False
-            self.__name = None
-            self.__parent = None
-            self.__accumNames = {}
-            self.__asList = asList
-            self.__modal = modal
-            if toklist is None:
-                toklist = []
-            if isinstance(toklist, list):
-                self.__toklist = toklist[:]
-            elif isinstance(toklist, _generatorType):
-                self.__toklist = list(toklist)
-            else:
-                self.__toklist = [toklist]
-            self.__tokdict = dict()
-
-        if name is not None and name:
-            if not modal:
-                self.__accumNames[name] = 0
-            if isinstance(name,int):
-                name = _ustr(name) # will always return a str, but use _ustr for consistency
-            self.__name = name
-            if not (isinstance(toklist, (type(None), basestring, list)) and toklist in (None,'',[])):
-                if isinstance(toklist,basestring):
-                    toklist = [ toklist ]
-                if asList:
-                    if isinstance(toklist,ParseResults):
-                        self[name] = _ParseResultsWithOffset(toklist.copy(),0)
-                    else:
-                        self[name] = _ParseResultsWithOffset(ParseResults(toklist[0]),0)
-                    self[name].__name = name
-                else:
-                    try:
-                        self[name] = toklist[0]
-                    except (KeyError,TypeError,IndexError):
-                        self[name] = toklist
-
-    def __getitem__( self, i ):
-        if isinstance( i, (int,slice) ):
-            return self.__toklist[i]
-        else:
-            if i not in self.__accumNames:
-                return self.__tokdict[i][-1][0]
-            else:
-                return ParseResults([ v[0] for v in self.__tokdict[i] ])
-
-    def __setitem__( self, k, v, isinstance=isinstance ):
-        if isinstance(v,_ParseResultsWithOffset):
-            self.__tokdict[k] = self.__tokdict.get(k,list()) + [v]
-            sub = v[0]
-        elif isinstance(k,(int,slice)):
-            self.__toklist[k] = v
-            sub = v
-        else:
-            self.__tokdict[k] = self.__tokdict.get(k,list()) + [_ParseResultsWithOffset(v,0)]
-            sub = v
-        if isinstance(sub,ParseResults):
-            sub.__parent = wkref(self)
-
-    def __delitem__( self, i ):
-        if isinstance(i,(int,slice)):
-            mylen = len( self.__toklist )
-            del self.__toklist[i]
-
-            # convert int to slice
-            if isinstance(i, int):
-                if i < 0:
-                    i += mylen
-                i = slice(i, i+1)
-            # get removed indices
-            removed = list(range(*i.indices(mylen)))
-            removed.reverse()
-            # fixup indices in token dictionary
-            for name,occurrences in self.__tokdict.items():
-                for j in removed:
-                    for k, (value, position) in enumerate(occurrences):
-                        occurrences[k] = _ParseResultsWithOffset(value, position - (position > j))
-        else:
-            del self.__tokdict[i]
-
-    def __contains__( self, k ):
-        return k in self.__tokdict
-
-    def __len__( self ): return len( self.__toklist )
-    def __bool__(self): return ( not not self.__toklist )
-    __nonzero__ = __bool__
-    def __iter__( self ): return iter( self.__toklist )
-    def __reversed__( self ): return iter( self.__toklist[::-1] )
-    def _iterkeys( self ):
-        if hasattr(self.__tokdict, "iterkeys"):
-            return self.__tokdict.iterkeys()
-        else:
-            return iter(self.__tokdict)
-
-    def _itervalues( self ):
-        return (self[k] for k in self._iterkeys())
-            
-    def _iteritems( self ):
-        return ((k, self[k]) for k in self._iterkeys())
-
-    if PY_3:
-        keys = _iterkeys       
-        """Returns an iterator of all named result keys (Python 3.x only)."""
-
-        values = _itervalues
-        """Returns an iterator of all named result values (Python 3.x only)."""
-
-        items = _iteritems
-        """Returns an iterator of all named result key-value tuples (Python 3.x only)."""
-
-    else:
-        iterkeys = _iterkeys
-        """Returns an iterator of all named result keys (Python 2.x only)."""
-
-        itervalues = _itervalues
-        """Returns an iterator of all named result values (Python 2.x only)."""
-
-        iteritems = _iteritems
-        """Returns an iterator of all named result key-value tuples (Python 2.x only)."""
-
-        def keys( self ):
-            """Returns all named result keys (as a list in Python 2.x, as an iterator in Python 3.x)."""
-            return list(self.iterkeys())
-
-        def values( self ):
-            """Returns all named result values (as a list in Python 2.x, as an iterator in Python 3.x)."""
-            return list(self.itervalues())
-                
-        def items( self ):
-            """Returns all named result key-values (as a list of tuples in Python 2.x, as an iterator in Python 3.x)."""
-            return list(self.iteritems())
-
-    def haskeys( self ):
-        """Since keys() returns an iterator, this method is helpful in bypassing
-           code that looks for the existence of any defined results names."""
-        return bool(self.__tokdict)
-        
-    def pop( self, *args, **kwargs):
-        """
-        Removes and returns item at specified index (default=C{last}).
-        Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
-        argument or an integer argument, it will use C{list} semantics
-        and pop tokens from the list of parsed tokens. If passed a 
-        non-integer argument (most likely a string), it will use C{dict}
-        semantics and pop the corresponding value from any defined 
-        results names. A second default return value argument is 
-        supported, just as in C{dict.pop()}.
-
-        Example::
-            def remove_first(tokens):
-                tokens.pop(0)
-            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
-            print(OneOrMore(Word(nums)).addParseAction(remove_first).parseString("0 123 321")) # -> ['123', '321']
-
-            label = Word(alphas)
-            patt = label("LABEL") + OneOrMore(Word(nums))
-            print(patt.parseString("AAB 123 321").dump())
-
-            # Use pop() in a parse action to remove named result (note that corresponding value is not
-            # removed from list form of results)
-            def remove_LABEL(tokens):
-                tokens.pop("LABEL")
-                return tokens
-            patt.addParseAction(remove_LABEL)
-            print(patt.parseString("AAB 123 321").dump())
-        prints::
-            ['AAB', '123', '321']
-            - LABEL: AAB
-
-            ['AAB', '123', '321']
-        """
-        if not args:
-            args = [-1]
-        for k,v in kwargs.items():
-            if k == 'default':
-                args = (args[0], v)
-            else:
-                raise TypeError("pop() got an unexpected keyword argument '%s'" % k)
-        if (isinstance(args[0], int) or 
-                        len(args) == 1 or 
-                        args[0] in self):
-            index = args[0]
-            ret = self[index]
-            del self[index]
-            return ret
-        else:
-            defaultvalue = args[1]
-            return defaultvalue
-
-    def get(self, key, defaultValue=None):
-        """
-        Returns named result matching the given key, or if there is no
-        such name, then returns the given C{defaultValue} or C{None} if no
-        C{defaultValue} is specified.
-
-        Similar to C{dict.get()}.
-        
-        Example::
-            integer = Word(nums)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")           
-
-            result = date_str.parseString("1999/12/31")
-            print(result.get("year")) # -> '1999'
-            print(result.get("hour", "not specified")) # -> 'not specified'
-            print(result.get("hour")) # -> None
-        """
-        if key in self:
-            return self[key]
-        else:
-            return defaultValue
-
-    def insert( self, index, insStr ):
-        """
-        Inserts new element at location index in the list of parsed tokens.
-        
-        Similar to C{list.insert()}.
-
-        Example::
-            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
-
-            # use a parse action to insert the parse location in the front of the parsed results
-            def insert_locn(locn, tokens):
-                tokens.insert(0, locn)
-            print(OneOrMore(Word(nums)).addParseAction(insert_locn).parseString("0 123 321")) # -> [0, '0', '123', '321']
-        """
-        self.__toklist.insert(index, insStr)
-        # fixup indices in token dictionary
-        for name,occurrences in self.__tokdict.items():
-            for k, (value, position) in enumerate(occurrences):
-                occurrences[k] = _ParseResultsWithOffset(value, position + (position > index))
-
-    def append( self, item ):
-        """
-        Add single element to end of ParseResults list of elements.
-
-        Example::
-            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
-            
-            # use a parse action to compute the sum of the parsed integers, and add it to the end
-            def append_sum(tokens):
-                tokens.append(sum(map(int, tokens)))
-            print(OneOrMore(Word(nums)).addParseAction(append_sum).parseString("0 123 321")) # -> ['0', '123', '321', 444]
-        """
-        self.__toklist.append(item)
-
-    def extend( self, itemseq ):
-        """
-        Add sequence of elements to end of ParseResults list of elements.
-
-        Example::
-            patt = OneOrMore(Word(alphas))
-            
-            # use a parse action to append the reverse of the matched strings, to make a palindrome
-            def make_palindrome(tokens):
-                tokens.extend(reversed([t[::-1] for t in tokens]))
-                return ''.join(tokens)
-            print(patt.addParseAction(make_palindrome).parseString("lskdj sdlkjf lksd")) # -> 'lskdjsdlkjflksddsklfjkldsjdksl'
-        """
-        if isinstance(itemseq, ParseResults):
-            self += itemseq
-        else:
-            self.__toklist.extend(itemseq)
-
-    def clear( self ):
-        """
-        Clear all elements and results names.
-        """
-        del self.__toklist[:]
-        self.__tokdict.clear()
-
-    def __getattr__( self, name ):
-        try:
-            return self[name]
-        except KeyError:
-            return ""
-            
-        if name in self.__tokdict:
-            if name not in self.__accumNames:
-                return self.__tokdict[name][-1][0]
-            else:
-                return ParseResults([ v[0] for v in self.__tokdict[name] ])
-        else:
-            return ""
-
-    def __add__( self, other ):
-        ret = self.copy()
-        ret += other
-        return ret
-
-    def __iadd__( self, other ):
-        if other.__tokdict:
-            offset = len(self.__toklist)
-            addoffset = lambda a: offset if a<0 else a+offset
-            otheritems = other.__tokdict.items()
-            otherdictitems = [(k, _ParseResultsWithOffset(v[0],addoffset(v[1])) )
-                                for (k,vlist) in otheritems for v in vlist]
-            for k,v in otherdictitems:
-                self[k] = v
-                if isinstance(v[0],ParseResults):
-                    v[0].__parent = wkref(self)
-            
-        self.__toklist += other.__toklist
-        self.__accumNames.update( other.__accumNames )
-        return self
-
-    def __radd__(self, other):
-        if isinstance(other,int) and other == 0:
-            # useful for merging many ParseResults using sum() builtin
-            return self.copy()
-        else:
-            # this may raise a TypeError - so be it
-            return other + self
-        
-    def __repr__( self ):
-        return "(%s, %s)" % ( repr( self.__toklist ), repr( self.__tokdict ) )
-
-    def __str__( self ):
-        return '[' + ', '.join(_ustr(i) if isinstance(i, ParseResults) else repr(i) for i in self.__toklist) + ']'
-
-    def _asStringList( self, sep='' ):
-        out = []
-        for item in self.__toklist:
-            if out and sep:
-                out.append(sep)
-            if isinstance( item, ParseResults ):
-                out += item._asStringList()
-            else:
-                out.append( _ustr(item) )
-        return out
-
-    def asList( self ):
-        """
-        Returns the parse results as a nested list of matching tokens, all converted to strings.
-
-        Example::
-            patt = OneOrMore(Word(alphas))
-            result = patt.parseString("sldkj lsdkj sldkj")
-            # even though the result prints in string-like form, it is actually a pyparsing ParseResults
-            print(type(result), result) # ->  ['sldkj', 'lsdkj', 'sldkj']
-            
-            # Use asList() to create an actual list
-            result_list = result.asList()
-            print(type(result_list), result_list) # ->  ['sldkj', 'lsdkj', 'sldkj']
-        """
-        return [res.asList() if isinstance(res,ParseResults) else res for res in self.__toklist]
-
-    def asDict( self ):
-        """
-        Returns the named parse results as a nested dictionary.
-
-        Example::
-            integer = Word(nums)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
-            
-            result = date_str.parseString('12/31/1999')
-            print(type(result), repr(result)) # ->  (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]})
-            
-            result_dict = result.asDict()
-            print(type(result_dict), repr(result_dict)) # ->  {'day': '1999', 'year': '12', 'month': '31'}
-
-            # even though a ParseResults supports dict-like access, sometime you just need to have a dict
-            import json
-            print(json.dumps(result)) # -> Exception: TypeError: ... is not JSON serializable
-            print(json.dumps(result.asDict())) # -> {"month": "31", "day": "1999", "year": "12"}
-        """
-        if PY_3:
-            item_fn = self.items
-        else:
-            item_fn = self.iteritems
-            
-        def toItem(obj):
-            if isinstance(obj, ParseResults):
-                if obj.haskeys():
-                    return obj.asDict()
-                else:
-                    return [toItem(v) for v in obj]
-            else:
-                return obj
-                
-        return dict((k,toItem(v)) for k,v in item_fn())
-
-    def copy( self ):
-        """
-        Returns a new copy of a C{ParseResults} object.
-        """
-        ret = ParseResults( self.__toklist )
-        ret.__tokdict = self.__tokdict.copy()
-        ret.__parent = self.__parent
-        ret.__accumNames.update( self.__accumNames )
-        ret.__name = self.__name
-        return ret
-
-    def asXML( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ):
-        """
-        (Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
-        """
-        nl = "\n"
-        out = []
-        namedItems = dict((v[1],k) for (k,vlist) in self.__tokdict.items()
-                                                            for v in vlist)
-        nextLevelIndent = indent + "  "
-
-        # collapse out indents if formatting is not desired
-        if not formatted:
-            indent = ""
-            nextLevelIndent = ""
-            nl = ""
-
-        selfTag = None
-        if doctag is not None:
-            selfTag = doctag
-        else:
-            if self.__name:
-                selfTag = self.__name
-
-        if not selfTag:
-            if namedItemsOnly:
-                return ""
-            else:
-                selfTag = "ITEM"
-
-        out += [ nl, indent, "<", selfTag, ">" ]
-
-        for i,res in enumerate(self.__toklist):
-            if isinstance(res,ParseResults):
-                if i in namedItems:
-                    out += [ res.asXML(namedItems[i],
-                                        namedItemsOnly and doctag is None,
-                                        nextLevelIndent,
-                                        formatted)]
-                else:
-                    out += [ res.asXML(None,
-                                        namedItemsOnly and doctag is None,
-                                        nextLevelIndent,
-                                        formatted)]
-            else:
-                # individual token, see if there is a name for it
-                resTag = None
-                if i in namedItems:
-                    resTag = namedItems[i]
-                if not resTag:
-                    if namedItemsOnly:
-                        continue
-                    else:
-                        resTag = "ITEM"
-                xmlBodyText = _xml_escape(_ustr(res))
-                out += [ nl, nextLevelIndent, "<", resTag, ">",
-                                                xmlBodyText,
-                                                "" ]
-
-        out += [ nl, indent, "" ]
-        return "".join(out)
-
-    def __lookup(self,sub):
-        for k,vlist in self.__tokdict.items():
-            for v,loc in vlist:
-                if sub is v:
-                    return k
-        return None
-
-    def getName(self):
-        r"""
-        Returns the results name for this token expression. Useful when several 
-        different expressions might match at a particular location.
-
-        Example::
-            integer = Word(nums)
-            ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
-            house_number_expr = Suppress('#') + Word(nums, alphanums)
-            user_data = (Group(house_number_expr)("house_number") 
-                        | Group(ssn_expr)("ssn")
-                        | Group(integer)("age"))
-            user_info = OneOrMore(user_data)
-            
-            result = user_info.parseString("22 111-22-3333 #221B")
-            for item in result:
-                print(item.getName(), ':', item[0])
-        prints::
-            age : 22
-            ssn : 111-22-3333
-            house_number : 221B
-        """
-        if self.__name:
-            return self.__name
-        elif self.__parent:
-            par = self.__parent()
-            if par:
-                return par.__lookup(self)
-            else:
-                return None
-        elif (len(self) == 1 and
-               len(self.__tokdict) == 1 and
-               next(iter(self.__tokdict.values()))[0][1] in (0,-1)):
-            return next(iter(self.__tokdict.keys()))
-        else:
-            return None
-
-    def dump(self, indent='', depth=0, full=True):
-        """
-        Diagnostic method for listing out the contents of a C{ParseResults}.
-        Accepts an optional C{indent} argument so that this string can be embedded
-        in a nested display of other data.
-
-        Example::
-            integer = Word(nums)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
-            
-            result = date_str.parseString('12/31/1999')
-            print(result.dump())
-        prints::
-            ['12', '/', '31', '/', '1999']
-            - day: 1999
-            - month: 31
-            - year: 12
-        """
-        out = []
-        NL = '\n'
-        out.append( indent+_ustr(self.asList()) )
-        if full:
-            if self.haskeys():
-                items = sorted((str(k), v) for k,v in self.items())
-                for k,v in items:
-                    if out:
-                        out.append(NL)
-                    out.append( "%s%s- %s: " % (indent,('  '*depth), k) )
-                    if isinstance(v,ParseResults):
-                        if v:
-                            out.append( v.dump(indent,depth+1) )
-                        else:
-                            out.append(_ustr(v))
-                    else:
-                        out.append(repr(v))
-            elif any(isinstance(vv,ParseResults) for vv in self):
-                v = self
-                for i,vv in enumerate(v):
-                    if isinstance(vv,ParseResults):
-                        out.append("\n%s%s[%d]:\n%s%s%s" % (indent,('  '*(depth)),i,indent,('  '*(depth+1)),vv.dump(indent,depth+1) ))
-                    else:
-                        out.append("\n%s%s[%d]:\n%s%s%s" % (indent,('  '*(depth)),i,indent,('  '*(depth+1)),_ustr(vv)))
-            
-        return "".join(out)
-
-    def pprint(self, *args, **kwargs):
-        """
-        Pretty-printer for parsed results as a list, using the C{pprint} module.
-        Accepts additional positional or keyword args as defined for the 
-        C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})
-
-        Example::
-            ident = Word(alphas, alphanums)
-            num = Word(nums)
-            func = Forward()
-            term = ident | num | Group('(' + func + ')')
-            func <<= ident + Group(Optional(delimitedList(term)))
-            result = func.parseString("fna a,b,(fnb c,d,200),100")
-            result.pprint(width=40)
-        prints::
-            ['fna',
-             ['a',
-              'b',
-              ['(', 'fnb', ['c', 'd', '200'], ')'],
-              '100']]
-        """
-        pprint.pprint(self.asList(), *args, **kwargs)
-
-    # add support for pickle protocol
-    def __getstate__(self):
-        return ( self.__toklist,
-                 ( self.__tokdict.copy(),
-                   self.__parent is not None and self.__parent() or None,
-                   self.__accumNames,
-                   self.__name ) )
-
-    def __setstate__(self,state):
-        self.__toklist = state[0]
-        (self.__tokdict,
-         par,
-         inAccumNames,
-         self.__name) = state[1]
-        self.__accumNames = {}
-        self.__accumNames.update(inAccumNames)
-        if par is not None:
-            self.__parent = wkref(par)
-        else:
-            self.__parent = None
-
-    def __getnewargs__(self):
-        return self.__toklist, self.__name, self.__asList, self.__modal
-
-    def __dir__(self):
-        return (dir(type(self)) + list(self.keys()))
-
-MutableMapping.register(ParseResults)
-
-def col (loc,strg):
-    """Returns current column within a string, counting newlines as line separators.
-   The first column is number 1.
-
-   Note: the default parsing behavior is to expand tabs in the input string
-   before starting the parsing process.  See L{I{ParserElement.parseString}} for more information
-   on parsing strings containing C{}s, and suggested methods to maintain a
-   consistent view of the parsed string, the parse location, and line and column
-   positions within the parsed string.
-   """
-    s = strg
-    return 1 if 0} for more information
-   on parsing strings containing C{}s, and suggested methods to maintain a
-   consistent view of the parsed string, the parse location, and line and column
-   positions within the parsed string.
-   """
-    return strg.count("\n",0,loc) + 1
-
-def line( loc, strg ):
-    """Returns the line of text containing loc within a string, counting newlines as line separators.
-       """
-    lastCR = strg.rfind("\n", 0, loc)
-    nextCR = strg.find("\n", loc)
-    if nextCR >= 0:
-        return strg[lastCR+1:nextCR]
-    else:
-        return strg[lastCR+1:]
-
-def _defaultStartDebugAction( instring, loc, expr ):
-    print (("Match " + _ustr(expr) + " at loc " + _ustr(loc) + "(%d,%d)" % ( lineno(loc,instring), col(loc,instring) )))
-
-def _defaultSuccessDebugAction( instring, startloc, endloc, expr, toks ):
-    print ("Matched " + _ustr(expr) + " -> " + str(toks.asList()))
-
-def _defaultExceptionDebugAction( instring, loc, expr, exc ):
-    print ("Exception raised:" + _ustr(exc))
-
-def nullDebugAction(*args):
-    """'Do-nothing' debug action, to suppress debugging output during parsing."""
-    pass
-
-# Only works on Python 3.x - nonlocal is toxic to Python 2 installs
-#~ 'decorator to trim function calls to match the arity of the target'
-#~ def _trim_arity(func, maxargs=3):
-    #~ if func in singleArgBuiltins:
-        #~ return lambda s,l,t: func(t)
-    #~ limit = 0
-    #~ foundArity = False
-    #~ def wrapper(*args):
-        #~ nonlocal limit,foundArity
-        #~ while 1:
-            #~ try:
-                #~ ret = func(*args[limit:])
-                #~ foundArity = True
-                #~ return ret
-            #~ except TypeError:
-                #~ if limit == maxargs or foundArity:
-                    #~ raise
-                #~ limit += 1
-                #~ continue
-    #~ return wrapper
-
-# this version is Python 2.x-3.x cross-compatible
-'decorator to trim function calls to match the arity of the target'
-def _trim_arity(func, maxargs=2):
-    if func in singleArgBuiltins:
-        return lambda s,l,t: func(t)
-    limit = [0]
-    foundArity = [False]
-    
-    # traceback return data structure changed in Py3.5 - normalize back to plain tuples
-    if system_version[:2] >= (3,5):
-        def extract_stack(limit=0):
-            # special handling for Python 3.5.0 - extra deep call stack by 1
-            offset = -3 if system_version == (3,5,0) else -2
-            frame_summary = traceback.extract_stack(limit=-offset+limit-1)[offset]
-            return [frame_summary[:2]]
-        def extract_tb(tb, limit=0):
-            frames = traceback.extract_tb(tb, limit=limit)
-            frame_summary = frames[-1]
-            return [frame_summary[:2]]
-    else:
-        extract_stack = traceback.extract_stack
-        extract_tb = traceback.extract_tb
-    
-    # synthesize what would be returned by traceback.extract_stack at the call to 
-    # user's parse action 'func', so that we don't incur call penalty at parse time
-    
-    LINE_DIFF = 6
-    # IF ANY CODE CHANGES, EVEN JUST COMMENTS OR BLANK LINES, BETWEEN THE NEXT LINE AND 
-    # THE CALL TO FUNC INSIDE WRAPPER, LINE_DIFF MUST BE MODIFIED!!!!
-    this_line = extract_stack(limit=2)[-1]
-    pa_call_line_synth = (this_line[0], this_line[1]+LINE_DIFF)
-
-    def wrapper(*args):
-        while 1:
-            try:
-                ret = func(*args[limit[0]:])
-                foundArity[0] = True
-                return ret
-            except TypeError:
-                # re-raise TypeErrors if they did not come from our arity testing
-                if foundArity[0]:
-                    raise
-                else:
-                    try:
-                        tb = sys.exc_info()[-1]
-                        if not extract_tb(tb, limit=2)[-1][:2] == pa_call_line_synth:
-                            raise
-                    finally:
-                        del tb
-
-                if limit[0] <= maxargs:
-                    limit[0] += 1
-                    continue
-                raise
-
-    # copy func name to wrapper for sensible debug output
-    func_name = ""
-    try:
-        func_name = getattr(func, '__name__', 
-                            getattr(func, '__class__').__name__)
-    except Exception:
-        func_name = str(func)
-    wrapper.__name__ = func_name
-
-    return wrapper
-
-class ParserElement(object):
-    """Abstract base level parser element class."""
-    DEFAULT_WHITE_CHARS = " \n\t\r"
-    verbose_stacktrace = False
-
-    @staticmethod
-    def setDefaultWhitespaceChars( chars ):
-        r"""
-        Overrides the default whitespace chars
-
-        Example::
-            # default whitespace chars are space,  and newline
-            OneOrMore(Word(alphas)).parseString("abc def\nghi jkl")  # -> ['abc', 'def', 'ghi', 'jkl']
-            
-            # change to just treat newline as significant
-            ParserElement.setDefaultWhitespaceChars(" \t")
-            OneOrMore(Word(alphas)).parseString("abc def\nghi jkl")  # -> ['abc', 'def']
-        """
-        ParserElement.DEFAULT_WHITE_CHARS = chars
-
-    @staticmethod
-    def inlineLiteralsUsing(cls):
-        """
-        Set class to be used for inclusion of string literals into a parser.
-        
-        Example::
-            # default literal class used is Literal
-            integer = Word(nums)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")           
-
-            date_str.parseString("1999/12/31")  # -> ['1999', '/', '12', '/', '31']
-
-
-            # change to Suppress
-            ParserElement.inlineLiteralsUsing(Suppress)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")           
-
-            date_str.parseString("1999/12/31")  # -> ['1999', '12', '31']
-        """
-        ParserElement._literalStringClass = cls
-
-    def __init__( self, savelist=False ):
-        self.parseAction = list()
-        self.failAction = None
-        #~ self.name = ""  # don't define self.name, let subclasses try/except upcall
-        self.strRepr = None
-        self.resultsName = None
-        self.saveAsList = savelist
-        self.skipWhitespace = True
-        self.whiteChars = ParserElement.DEFAULT_WHITE_CHARS
-        self.copyDefaultWhiteChars = True
-        self.mayReturnEmpty = False # used when checking for left-recursion
-        self.keepTabs = False
-        self.ignoreExprs = list()
-        self.debug = False
-        self.streamlined = False
-        self.mayIndexError = True # used to optimize exception handling for subclasses that don't advance parse index
-        self.errmsg = ""
-        self.modalResults = True # used to mark results names as modal (report only last) or cumulative (list all)
-        self.debugActions = ( None, None, None ) #custom debug actions
-        self.re = None
-        self.callPreparse = True # used to avoid redundant calls to preParse
-        self.callDuringTry = False
-
-    def copy( self ):
-        """
-        Make a copy of this C{ParserElement}.  Useful for defining different parse actions
-        for the same parsing pattern, using copies of the original parse element.
-        
-        Example::
-            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
-            integerK = integer.copy().addParseAction(lambda toks: toks[0]*1024) + Suppress("K")
-            integerM = integer.copy().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M")
-            
-            print(OneOrMore(integerK | integerM | integer).parseString("5K 100 640K 256M"))
-        prints::
-            [5120, 100, 655360, 268435456]
-        Equivalent form of C{expr.copy()} is just C{expr()}::
-            integerM = integer().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M")
-        """
-        cpy = copy.copy( self )
-        cpy.parseAction = self.parseAction[:]
-        cpy.ignoreExprs = self.ignoreExprs[:]
-        if self.copyDefaultWhiteChars:
-            cpy.whiteChars = ParserElement.DEFAULT_WHITE_CHARS
-        return cpy
-
-    def setName( self, name ):
-        """
-        Define name for this expression, makes debugging and exception messages clearer.
-        
-        Example::
-            Word(nums).parseString("ABC")  # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
-            Word(nums).setName("integer").parseString("ABC")  # -> Exception: Expected integer (at char 0), (line:1, col:1)
-        """
-        self.name = name
-        self.errmsg = "Expected " + self.name
-        if hasattr(self,"exception"):
-            self.exception.msg = self.errmsg
-        return self
-
-    def setResultsName( self, name, listAllMatches=False ):
-        """
-        Define name for referencing matching tokens as a nested attribute
-        of the returned parse results.
-        NOTE: this returns a *copy* of the original C{ParserElement} object;
-        this is so that the client can define a basic element, such as an
-        integer, and reference it in multiple places with different names.
-
-        You can also set results names using the abbreviated syntax,
-        C{expr("name")} in place of C{expr.setResultsName("name")} - 
-        see L{I{__call__}<__call__>}.
-
-        Example::
-            date_str = (integer.setResultsName("year") + '/' 
-                        + integer.setResultsName("month") + '/' 
-                        + integer.setResultsName("day"))
-
-            # equivalent form:
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
-        """
-        newself = self.copy()
-        if name.endswith("*"):
-            name = name[:-1]
-            listAllMatches=True
-        newself.resultsName = name
-        newself.modalResults = not listAllMatches
-        return newself
-
-    def setBreak(self,breakFlag = True):
-        """Method to invoke the Python pdb debugger when this element is
-           about to be parsed. Set C{breakFlag} to True to enable, False to
-           disable.
-        """
-        if breakFlag:
-            _parseMethod = self._parse
-            def breaker(instring, loc, doActions=True, callPreParse=True):
-                import pdb
-                pdb.set_trace()
-                return _parseMethod( instring, loc, doActions, callPreParse )
-            breaker._originalParseMethod = _parseMethod
-            self._parse = breaker
-        else:
-            if hasattr(self._parse,"_originalParseMethod"):
-                self._parse = self._parse._originalParseMethod
-        return self
-
-    def setParseAction( self, *fns, **kwargs ):
-        """
-        Define one or more actions to perform when successfully matching parse element definition.
-        Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
-        C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
-         - s   = the original string being parsed (see note below)
-         - loc = the location of the matching substring
-         - toks = a list of the matched tokens, packaged as a C{L{ParseResults}} object
-        If the functions in fns modify the tokens, they can return them as the return
-        value from fn, and the modified list of tokens will replace the original.
-        Otherwise, fn does not need to return any value.
-
-        Optional keyword arguments:
-         - callDuringTry = (default=C{False}) indicate if parse action should be run during lookaheads and alternate testing
-
-        Note: the default parsing behavior is to expand tabs in the input string
-        before starting the parsing process.  See L{I{parseString}} for more information
-        on parsing strings containing C{}s, and suggested methods to maintain a
-        consistent view of the parsed string, the parse location, and line and column
-        positions within the parsed string.
-        
-        Example::
-            integer = Word(nums)
-            date_str = integer + '/' + integer + '/' + integer
-
-            date_str.parseString("1999/12/31")  # -> ['1999', '/', '12', '/', '31']
-
-            # use parse action to convert to ints at parse time
-            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
-            date_str = integer + '/' + integer + '/' + integer
-
-            # note that integer fields are now ints, not strings
-            date_str.parseString("1999/12/31")  # -> [1999, '/', 12, '/', 31]
-        """
-        self.parseAction = list(map(_trim_arity, list(fns)))
-        self.callDuringTry = kwargs.get("callDuringTry", False)
-        return self
-
-    def addParseAction( self, *fns, **kwargs ):
-        """
-        Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}}.
-        
-        See examples in L{I{copy}}.
-        """
-        self.parseAction += list(map(_trim_arity, list(fns)))
-        self.callDuringTry = self.callDuringTry or kwargs.get("callDuringTry", False)
-        return self
-
-    def addCondition(self, *fns, **kwargs):
-        """Add a boolean predicate function to expression's list of parse actions. See 
-        L{I{setParseAction}} for function call signatures. Unlike C{setParseAction}, 
-        functions passed to C{addCondition} need to return boolean success/fail of the condition.
-
-        Optional keyword arguments:
-         - message = define a custom message to be used in the raised exception
-         - fatal   = if True, will raise ParseFatalException to stop parsing immediately; otherwise will raise ParseException
-         
-        Example::
-            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
-            year_int = integer.copy()
-            year_int.addCondition(lambda toks: toks[0] >= 2000, message="Only support years 2000 and later")
-            date_str = year_int + '/' + integer + '/' + integer
-
-            result = date_str.parseString("1999/12/31")  # -> Exception: Only support years 2000 and later (at char 0), (line:1, col:1)
-        """
-        msg = kwargs.get("message", "failed user-defined condition")
-        exc_type = ParseFatalException if kwargs.get("fatal", False) else ParseException
-        for fn in fns:
-            def pa(s,l,t):
-                if not bool(_trim_arity(fn)(s,l,t)):
-                    raise exc_type(s,l,msg)
-            self.parseAction.append(pa)
-        self.callDuringTry = self.callDuringTry or kwargs.get("callDuringTry", False)
-        return self
-
-    def setFailAction( self, fn ):
-        """Define action to perform if parsing fails at this expression.
-           Fail acton fn is a callable function that takes the arguments
-           C{fn(s,loc,expr,err)} where:
-            - s = string being parsed
-            - loc = location where expression match was attempted and failed
-            - expr = the parse expression that failed
-            - err = the exception thrown
-           The function returns no value.  It may throw C{L{ParseFatalException}}
-           if it is desired to stop parsing immediately."""
-        self.failAction = fn
-        return self
-
-    def _skipIgnorables( self, instring, loc ):
-        exprsFound = True
-        while exprsFound:
-            exprsFound = False
-            for e in self.ignoreExprs:
-                try:
-                    while 1:
-                        loc,dummy = e._parse( instring, loc )
-                        exprsFound = True
-                except ParseException:
-                    pass
-        return loc
-
-    def preParse( self, instring, loc ):
-        if self.ignoreExprs:
-            loc = self._skipIgnorables( instring, loc )
-
-        if self.skipWhitespace:
-            wt = self.whiteChars
-            instrlen = len(instring)
-            while loc < instrlen and instring[loc] in wt:
-                loc += 1
-
-        return loc
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        return loc, []
-
-    def postParse( self, instring, loc, tokenlist ):
-        return tokenlist
-
-    #~ @profile
-    def _parseNoCache( self, instring, loc, doActions=True, callPreParse=True ):
-        debugging = ( self.debug ) #and doActions )
-
-        if debugging or self.failAction:
-            #~ print ("Match",self,"at loc",loc,"(%d,%d)" % ( lineno(loc,instring), col(loc,instring) ))
-            if (self.debugActions[0] ):
-                self.debugActions[0]( instring, loc, self )
-            if callPreParse and self.callPreparse:
-                preloc = self.preParse( instring, loc )
-            else:
-                preloc = loc
-            tokensStart = preloc
-            try:
-                try:
-                    loc,tokens = self.parseImpl( instring, preloc, doActions )
-                except IndexError:
-                    raise ParseException( instring, len(instring), self.errmsg, self )
-            except ParseBaseException as err:
-                #~ print ("Exception raised:", err)
-                if self.debugActions[2]:
-                    self.debugActions[2]( instring, tokensStart, self, err )
-                if self.failAction:
-                    self.failAction( instring, tokensStart, self, err )
-                raise
-        else:
-            if callPreParse and self.callPreparse:
-                preloc = self.preParse( instring, loc )
-            else:
-                preloc = loc
-            tokensStart = preloc
-            if self.mayIndexError or preloc >= len(instring):
-                try:
-                    loc,tokens = self.parseImpl( instring, preloc, doActions )
-                except IndexError:
-                    raise ParseException( instring, len(instring), self.errmsg, self )
-            else:
-                loc,tokens = self.parseImpl( instring, preloc, doActions )
-
-        tokens = self.postParse( instring, loc, tokens )
-
-        retTokens = ParseResults( tokens, self.resultsName, asList=self.saveAsList, modal=self.modalResults )
-        if self.parseAction and (doActions or self.callDuringTry):
-            if debugging:
-                try:
-                    for fn in self.parseAction:
-                        tokens = fn( instring, tokensStart, retTokens )
-                        if tokens is not None:
-                            retTokens = ParseResults( tokens,
-                                                      self.resultsName,
-                                                      asList=self.saveAsList and isinstance(tokens,(ParseResults,list)),
-                                                      modal=self.modalResults )
-                except ParseBaseException as err:
-                    #~ print "Exception raised in user parse action:", err
-                    if (self.debugActions[2] ):
-                        self.debugActions[2]( instring, tokensStart, self, err )
-                    raise
-            else:
-                for fn in self.parseAction:
-                    tokens = fn( instring, tokensStart, retTokens )
-                    if tokens is not None:
-                        retTokens = ParseResults( tokens,
-                                                  self.resultsName,
-                                                  asList=self.saveAsList and isinstance(tokens,(ParseResults,list)),
-                                                  modal=self.modalResults )
-        if debugging:
-            #~ print ("Matched",self,"->",retTokens.asList())
-            if (self.debugActions[1] ):
-                self.debugActions[1]( instring, tokensStart, loc, self, retTokens )
-
-        return loc, retTokens
-
-    def tryParse( self, instring, loc ):
-        try:
-            return self._parse( instring, loc, doActions=False )[0]
-        except ParseFatalException:
-            raise ParseException( instring, loc, self.errmsg, self)
-    
-    def canParseNext(self, instring, loc):
-        try:
-            self.tryParse(instring, loc)
-        except (ParseException, IndexError):
-            return False
-        else:
-            return True
-
-    class _UnboundedCache(object):
-        def __init__(self):
-            cache = {}
-            self.not_in_cache = not_in_cache = object()
-
-            def get(self, key):
-                return cache.get(key, not_in_cache)
-
-            def set(self, key, value):
-                cache[key] = value
-
-            def clear(self):
-                cache.clear()
-                
-            def cache_len(self):
-                return len(cache)
-
-            self.get = types.MethodType(get, self)
-            self.set = types.MethodType(set, self)
-            self.clear = types.MethodType(clear, self)
-            self.__len__ = types.MethodType(cache_len, self)
-
-    if _OrderedDict is not None:
-        class _FifoCache(object):
-            def __init__(self, size):
-                self.not_in_cache = not_in_cache = object()
-
-                cache = _OrderedDict()
-
-                def get(self, key):
-                    return cache.get(key, not_in_cache)
-
-                def set(self, key, value):
-                    cache[key] = value
-                    while len(cache) > size:
-                        try:
-                            cache.popitem(False)
-                        except KeyError:
-                            pass
-
-                def clear(self):
-                    cache.clear()
-
-                def cache_len(self):
-                    return len(cache)
-
-                self.get = types.MethodType(get, self)
-                self.set = types.MethodType(set, self)
-                self.clear = types.MethodType(clear, self)
-                self.__len__ = types.MethodType(cache_len, self)
-
-    else:
-        class _FifoCache(object):
-            def __init__(self, size):
-                self.not_in_cache = not_in_cache = object()
-
-                cache = {}
-                key_fifo = collections.deque([], size)
-
-                def get(self, key):
-                    return cache.get(key, not_in_cache)
-
-                def set(self, key, value):
-                    cache[key] = value
-                    while len(key_fifo) > size:
-                        cache.pop(key_fifo.popleft(), None)
-                    key_fifo.append(key)
-
-                def clear(self):
-                    cache.clear()
-                    key_fifo.clear()
-
-                def cache_len(self):
-                    return len(cache)
-
-                self.get = types.MethodType(get, self)
-                self.set = types.MethodType(set, self)
-                self.clear = types.MethodType(clear, self)
-                self.__len__ = types.MethodType(cache_len, self)
-
-    # argument cache for optimizing repeated calls when backtracking through recursive expressions
-    packrat_cache = {} # this is set later by enabledPackrat(); this is here so that resetCache() doesn't fail
-    packrat_cache_lock = RLock()
-    packrat_cache_stats = [0, 0]
-
-    # this method gets repeatedly called during backtracking with the same arguments -
-    # we can cache these arguments and save ourselves the trouble of re-parsing the contained expression
-    def _parseCache( self, instring, loc, doActions=True, callPreParse=True ):
-        HIT, MISS = 0, 1
-        lookup = (self, instring, loc, callPreParse, doActions)
-        with ParserElement.packrat_cache_lock:
-            cache = ParserElement.packrat_cache
-            value = cache.get(lookup)
-            if value is cache.not_in_cache:
-                ParserElement.packrat_cache_stats[MISS] += 1
-                try:
-                    value = self._parseNoCache(instring, loc, doActions, callPreParse)
-                except ParseBaseException as pe:
-                    # cache a copy of the exception, without the traceback
-                    cache.set(lookup, pe.__class__(*pe.args))
-                    raise
-                else:
-                    cache.set(lookup, (value[0], value[1].copy()))
-                    return value
-            else:
-                ParserElement.packrat_cache_stats[HIT] += 1
-                if isinstance(value, Exception):
-                    raise value
-                return (value[0], value[1].copy())
-
-    _parse = _parseNoCache
-
-    @staticmethod
-    def resetCache():
-        ParserElement.packrat_cache.clear()
-        ParserElement.packrat_cache_stats[:] = [0] * len(ParserElement.packrat_cache_stats)
-
-    _packratEnabled = False
-    @staticmethod
-    def enablePackrat(cache_size_limit=128):
-        """Enables "packrat" parsing, which adds memoizing to the parsing logic.
-           Repeated parse attempts at the same string location (which happens
-           often in many complex grammars) can immediately return a cached value,
-           instead of re-executing parsing/validating code.  Memoizing is done of
-           both valid results and parsing exceptions.
-           
-           Parameters:
-            - cache_size_limit - (default=C{128}) - if an integer value is provided
-              will limit the size of the packrat cache; if None is passed, then
-              the cache size will be unbounded; if 0 is passed, the cache will
-              be effectively disabled.
-            
-           This speedup may break existing programs that use parse actions that
-           have side-effects.  For this reason, packrat parsing is disabled when
-           you first import pyparsing.  To activate the packrat feature, your
-           program must call the class method C{ParserElement.enablePackrat()}.  If
-           your program uses C{psyco} to "compile as you go", you must call
-           C{enablePackrat} before calling C{psyco.full()}.  If you do not do this,
-           Python will crash.  For best results, call C{enablePackrat()} immediately
-           after importing pyparsing.
-           
-           Example::
-               import pyparsing
-               pyparsing.ParserElement.enablePackrat()
-        """
-        if not ParserElement._packratEnabled:
-            ParserElement._packratEnabled = True
-            if cache_size_limit is None:
-                ParserElement.packrat_cache = ParserElement._UnboundedCache()
-            else:
-                ParserElement.packrat_cache = ParserElement._FifoCache(cache_size_limit)
-            ParserElement._parse = ParserElement._parseCache
-
-    def parseString( self, instring, parseAll=False ):
-        """
-        Execute the parse expression with the given string.
-        This is the main interface to the client code, once the complete
-        expression has been built.
-
-        If you want the grammar to require that the entire input string be
-        successfully parsed, then set C{parseAll} to True (equivalent to ending
-        the grammar with C{L{StringEnd()}}).
-
-        Note: C{parseString} implicitly calls C{expandtabs()} on the input string,
-        in order to report proper column numbers in parse actions.
-        If the input string contains tabs and
-        the grammar uses parse actions that use the C{loc} argument to index into the
-        string being parsed, you can ensure you have a consistent view of the input
-        string by:
-         - calling C{parseWithTabs} on your grammar before calling C{parseString}
-           (see L{I{parseWithTabs}})
-         - define your parse action using the full C{(s,loc,toks)} signature, and
-           reference the input string using the parse action's C{s} argument
-         - explictly expand the tabs in your input string before calling
-           C{parseString}
-        
-        Example::
-            Word('a').parseString('aaaaabaaa')  # -> ['aaaaa']
-            Word('a').parseString('aaaaabaaa', parseAll=True)  # -> Exception: Expected end of text
-        """
-        ParserElement.resetCache()
-        if not self.streamlined:
-            self.streamline()
-            #~ self.saveAsList = True
-        for e in self.ignoreExprs:
-            e.streamline()
-        if not self.keepTabs:
-            instring = instring.expandtabs()
-        try:
-            loc, tokens = self._parse( instring, 0 )
-            if parseAll:
-                loc = self.preParse( instring, loc )
-                se = Empty() + StringEnd()
-                se._parse( instring, loc )
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-        else:
-            return tokens
-
-    def scanString( self, instring, maxMatches=_MAX_INT, overlap=False ):
-        """
-        Scan the input string for expression matches.  Each match will return the
-        matching tokens, start location, and end location.  May be called with optional
-        C{maxMatches} argument, to clip scanning after 'n' matches are found.  If
-        C{overlap} is specified, then overlapping matches will be reported.
-
-        Note that the start and end locations are reported relative to the string
-        being parsed.  See L{I{parseString}} for more information on parsing
-        strings with embedded tabs.
-
-        Example::
-            source = "sldjf123lsdjjkf345sldkjf879lkjsfd987"
-            print(source)
-            for tokens,start,end in Word(alphas).scanString(source):
-                print(' '*start + '^'*(end-start))
-                print(' '*start + tokens[0])
-        
-        prints::
-        
-            sldjf123lsdjjkf345sldkjf879lkjsfd987
-            ^^^^^
-            sldjf
-                    ^^^^^^^
-                    lsdjjkf
-                              ^^^^^^
-                              sldkjf
-                                       ^^^^^^
-                                       lkjsfd
-        """
-        if not self.streamlined:
-            self.streamline()
-        for e in self.ignoreExprs:
-            e.streamline()
-
-        if not self.keepTabs:
-            instring = _ustr(instring).expandtabs()
-        instrlen = len(instring)
-        loc = 0
-        preparseFn = self.preParse
-        parseFn = self._parse
-        ParserElement.resetCache()
-        matches = 0
-        try:
-            while loc <= instrlen and matches < maxMatches:
-                try:
-                    preloc = preparseFn( instring, loc )
-                    nextLoc,tokens = parseFn( instring, preloc, callPreParse=False )
-                except ParseException:
-                    loc = preloc+1
-                else:
-                    if nextLoc > loc:
-                        matches += 1
-                        yield tokens, preloc, nextLoc
-                        if overlap:
-                            nextloc = preparseFn( instring, loc )
-                            if nextloc > loc:
-                                loc = nextLoc
-                            else:
-                                loc += 1
-                        else:
-                            loc = nextLoc
-                    else:
-                        loc = preloc+1
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-
-    def transformString( self, instring ):
-        """
-        Extension to C{L{scanString}}, to modify matching text with modified tokens that may
-        be returned from a parse action.  To use C{transformString}, define a grammar and
-        attach a parse action to it that modifies the returned token list.
-        Invoking C{transformString()} on a target string will then scan for matches,
-        and replace the matched text patterns according to the logic in the parse
-        action.  C{transformString()} returns the resulting transformed string.
-        
-        Example::
-            wd = Word(alphas)
-            wd.setParseAction(lambda toks: toks[0].title())
-            
-            print(wd.transformString("now is the winter of our discontent made glorious summer by this sun of york."))
-        Prints::
-            Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York.
-        """
-        out = []
-        lastE = 0
-        # force preservation of s, to minimize unwanted transformation of string, and to
-        # keep string locs straight between transformString and scanString
-        self.keepTabs = True
-        try:
-            for t,s,e in self.scanString( instring ):
-                out.append( instring[lastE:s] )
-                if t:
-                    if isinstance(t,ParseResults):
-                        out += t.asList()
-                    elif isinstance(t,list):
-                        out += t
-                    else:
-                        out.append(t)
-                lastE = e
-            out.append(instring[lastE:])
-            out = [o for o in out if o]
-            return "".join(map(_ustr,_flatten(out)))
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-
-    def searchString( self, instring, maxMatches=_MAX_INT ):
-        """
-        Another extension to C{L{scanString}}, simplifying the access to the tokens found
-        to match the given parse expression.  May be called with optional
-        C{maxMatches} argument, to clip searching after 'n' matches are found.
-        
-        Example::
-            # a capitalized word starts with an uppercase letter, followed by zero or more lowercase letters
-            cap_word = Word(alphas.upper(), alphas.lower())
-            
-            print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity"))
-
-            # the sum() builtin can be used to merge results into a single ParseResults object
-            print(sum(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")))
-        prints::
-            [['More'], ['Iron'], ['Lead'], ['Gold'], ['I'], ['Electricity']]
-            ['More', 'Iron', 'Lead', 'Gold', 'I', 'Electricity']
-        """
-        try:
-            return ParseResults([ t for t,s,e in self.scanString( instring, maxMatches ) ])
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-
-    def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False):
-        """
-        Generator method to split a string using the given expression as a separator.
-        May be called with optional C{maxsplit} argument, to limit the number of splits;
-        and the optional C{includeSeparators} argument (default=C{False}), if the separating
-        matching text should be included in the split results.
-        
-        Example::        
-            punc = oneOf(list(".,;:/-!?"))
-            print(list(punc.split("This, this?, this sentence, is badly punctuated!")))
-        prints::
-            ['This', ' this', '', ' this sentence', ' is badly punctuated', '']
-        """
-        splits = 0
-        last = 0
-        for t,s,e in self.scanString(instring, maxMatches=maxsplit):
-            yield instring[last:s]
-            if includeSeparators:
-                yield t[0]
-            last = e
-        yield instring[last:]
-
-    def __add__(self, other ):
-        """
-        Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement
-        converts them to L{Literal}s by default.
-        
-        Example::
-            greet = Word(alphas) + "," + Word(alphas) + "!"
-            hello = "Hello, World!"
-            print (hello, "->", greet.parseString(hello))
-        Prints::
-            Hello, World! -> ['Hello', ',', 'World', '!']
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return And( [ self, other ] )
-
-    def __radd__(self, other ):
-        """
-        Implementation of + operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other + self
-
-    def __sub__(self, other):
-        """
-        Implementation of - operator, returns C{L{And}} with error stop
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return self + And._ErrorStop() + other
-
-    def __rsub__(self, other ):
-        """
-        Implementation of - operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other - self
-
-    def __mul__(self,other):
-        """
-        Implementation of * operator, allows use of C{expr * 3} in place of
-        C{expr + expr + expr}.  Expressions may also me multiplied by a 2-integer
-        tuple, similar to C{{min,max}} multipliers in regular expressions.  Tuples
-        may also include C{None} as in:
-         - C{expr*(n,None)} or C{expr*(n,)} is equivalent
-              to C{expr*n + L{ZeroOrMore}(expr)}
-              (read as "at least n instances of C{expr}")
-         - C{expr*(None,n)} is equivalent to C{expr*(0,n)}
-              (read as "0 to n instances of C{expr}")
-         - C{expr*(None,None)} is equivalent to C{L{ZeroOrMore}(expr)}
-         - C{expr*(1,None)} is equivalent to C{L{OneOrMore}(expr)}
-
-        Note that C{expr*(None,n)} does not raise an exception if
-        more than n exprs exist in the input stream; that is,
-        C{expr*(None,n)} does not enforce a maximum number of expr
-        occurrences.  If this behavior is desired, then write
-        C{expr*(None,n) + ~expr}
-        """
-        if isinstance(other,int):
-            minElements, optElements = other,0
-        elif isinstance(other,tuple):
-            other = (other + (None, None))[:2]
-            if other[0] is None:
-                other = (0, other[1])
-            if isinstance(other[0],int) and other[1] is None:
-                if other[0] == 0:
-                    return ZeroOrMore(self)
-                if other[0] == 1:
-                    return OneOrMore(self)
-                else:
-                    return self*other[0] + ZeroOrMore(self)
-            elif isinstance(other[0],int) and isinstance(other[1],int):
-                minElements, optElements = other
-                optElements -= minElements
-            else:
-                raise TypeError("cannot multiply 'ParserElement' and ('%s','%s') objects", type(other[0]),type(other[1]))
-        else:
-            raise TypeError("cannot multiply 'ParserElement' and '%s' objects", type(other))
-
-        if minElements < 0:
-            raise ValueError("cannot multiply ParserElement by negative value")
-        if optElements < 0:
-            raise ValueError("second tuple value must be greater or equal to first tuple value")
-        if minElements == optElements == 0:
-            raise ValueError("cannot multiply ParserElement by 0 or (0,0)")
-
-        if (optElements):
-            def makeOptionalList(n):
-                if n>1:
-                    return Optional(self + makeOptionalList(n-1))
-                else:
-                    return Optional(self)
-            if minElements:
-                if minElements == 1:
-                    ret = self + makeOptionalList(optElements)
-                else:
-                    ret = And([self]*minElements) + makeOptionalList(optElements)
-            else:
-                ret = makeOptionalList(optElements)
-        else:
-            if minElements == 1:
-                ret = self
-            else:
-                ret = And([self]*minElements)
-        return ret
-
-    def __rmul__(self, other):
-        return self.__mul__(other)
-
-    def __or__(self, other ):
-        """
-        Implementation of | operator - returns C{L{MatchFirst}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return MatchFirst( [ self, other ] )
-
-    def __ror__(self, other ):
-        """
-        Implementation of | operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other | self
-
-    def __xor__(self, other ):
-        """
-        Implementation of ^ operator - returns C{L{Or}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return Or( [ self, other ] )
-
-    def __rxor__(self, other ):
-        """
-        Implementation of ^ operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other ^ self
-
-    def __and__(self, other ):
-        """
-        Implementation of & operator - returns C{L{Each}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return Each( [ self, other ] )
-
-    def __rand__(self, other ):
-        """
-        Implementation of & operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other & self
-
-    def __invert__( self ):
-        """
-        Implementation of ~ operator - returns C{L{NotAny}}
-        """
-        return NotAny( self )
-
-    def __call__(self, name=None):
-        """
-        Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}.
-        
-        If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be
-        passed as C{True}.
-           
-        If C{name} is omitted, same as calling C{L{copy}}.
-
-        Example::
-            # these are equivalent
-            userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno")
-            userdata = Word(alphas)("name") + Word(nums+"-")("socsecno")             
-        """
-        if name is not None:
-            return self.setResultsName(name)
-        else:
-            return self.copy()
-
-    def suppress( self ):
-        """
-        Suppresses the output of this C{ParserElement}; useful to keep punctuation from
-        cluttering up returned output.
-        """
-        return Suppress( self )
-
-    def leaveWhitespace( self ):
-        """
-        Disables the skipping of whitespace before matching the characters in the
-        C{ParserElement}'s defined pattern.  This is normally only used internally by
-        the pyparsing module, but may be needed in some whitespace-sensitive grammars.
-        """
-        self.skipWhitespace = False
-        return self
-
-    def setWhitespaceChars( self, chars ):
-        """
-        Overrides the default whitespace chars
-        """
-        self.skipWhitespace = True
-        self.whiteChars = chars
-        self.copyDefaultWhiteChars = False
-        return self
-
-    def parseWithTabs( self ):
-        """
-        Overrides default behavior to expand C{}s to spaces before parsing the input string.
-        Must be called before C{parseString} when the input grammar contains elements that
-        match C{} characters.
-        """
-        self.keepTabs = True
-        return self
-
-    def ignore( self, other ):
-        """
-        Define expression to be ignored (e.g., comments) while doing pattern
-        matching; may be called repeatedly, to define multiple comment or other
-        ignorable patterns.
-        
-        Example::
-            patt = OneOrMore(Word(alphas))
-            patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj']
-            
-            patt.ignore(cStyleComment)
-            patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj', 'lskjd']
-        """
-        if isinstance(other, basestring):
-            other = Suppress(other)
-
-        if isinstance( other, Suppress ):
-            if other not in self.ignoreExprs:
-                self.ignoreExprs.append(other)
-        else:
-            self.ignoreExprs.append( Suppress( other.copy() ) )
-        return self
-
-    def setDebugActions( self, startAction, successAction, exceptionAction ):
-        """
-        Enable display of debugging messages while doing pattern matching.
-        """
-        self.debugActions = (startAction or _defaultStartDebugAction,
-                             successAction or _defaultSuccessDebugAction,
-                             exceptionAction or _defaultExceptionDebugAction)
-        self.debug = True
-        return self
-
-    def setDebug( self, flag=True ):
-        """
-        Enable display of debugging messages while doing pattern matching.
-        Set C{flag} to True to enable, False to disable.
-
-        Example::
-            wd = Word(alphas).setName("alphaword")
-            integer = Word(nums).setName("numword")
-            term = wd | integer
-            
-            # turn on debugging for wd
-            wd.setDebug()
-
-            OneOrMore(term).parseString("abc 123 xyz 890")
-        
-        prints::
-            Match alphaword at loc 0(1,1)
-            Matched alphaword -> ['abc']
-            Match alphaword at loc 3(1,4)
-            Exception raised:Expected alphaword (at char 4), (line:1, col:5)
-            Match alphaword at loc 7(1,8)
-            Matched alphaword -> ['xyz']
-            Match alphaword at loc 11(1,12)
-            Exception raised:Expected alphaword (at char 12), (line:1, col:13)
-            Match alphaword at loc 15(1,16)
-            Exception raised:Expected alphaword (at char 15), (line:1, col:16)
-
-        The output shown is that produced by the default debug actions - custom debug actions can be
-        specified using L{setDebugActions}. Prior to attempting
-        to match the C{wd} expression, the debugging message C{"Match  at loc (,)"}
-        is shown. Then if the parse succeeds, a C{"Matched"} message is shown, or an C{"Exception raised"}
-        message is shown. Also note the use of L{setName} to assign a human-readable name to the expression,
-        which makes debugging and exception messages easier to understand - for instance, the default
-        name created for the C{Word} expression without calling C{setName} is C{"W:(ABCD...)"}.
-        """
-        if flag:
-            self.setDebugActions( _defaultStartDebugAction, _defaultSuccessDebugAction, _defaultExceptionDebugAction )
-        else:
-            self.debug = False
-        return self
-
-    def __str__( self ):
-        return self.name
-
-    def __repr__( self ):
-        return _ustr(self)
-
-    def streamline( self ):
-        self.streamlined = True
-        self.strRepr = None
-        return self
-
-    def checkRecursion( self, parseElementList ):
-        pass
-
-    def validate( self, validateTrace=[] ):
-        """
-        Check defined expressions for valid structure, check for infinite recursive definitions.
-        """
-        self.checkRecursion( [] )
-
-    def parseFile( self, file_or_filename, parseAll=False ):
-        """
-        Execute the parse expression on the given file or filename.
-        If a filename is specified (instead of a file object),
-        the entire file is opened, read, and closed before parsing.
-        """
-        try:
-            file_contents = file_or_filename.read()
-        except AttributeError:
-            with open(file_or_filename, "r") as f:
-                file_contents = f.read()
-        try:
-            return self.parseString(file_contents, parseAll)
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-
-    def __eq__(self,other):
-        if isinstance(other, ParserElement):
-            return self is other or vars(self) == vars(other)
-        elif isinstance(other, basestring):
-            return self.matches(other)
-        else:
-            return super(ParserElement,self)==other
-
-    def __ne__(self,other):
-        return not (self == other)
-
-    def __hash__(self):
-        return hash(id(self))
-
-    def __req__(self,other):
-        return self == other
-
-    def __rne__(self,other):
-        return not (self == other)
-
-    def matches(self, testString, parseAll=True):
-        """
-        Method for quick testing of a parser against a test string. Good for simple 
-        inline microtests of sub expressions while building up larger parser.
-           
-        Parameters:
-         - testString - to test against this expression for a match
-         - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests
-            
-        Example::
-            expr = Word(nums)
-            assert expr.matches("100")
-        """
-        try:
-            self.parseString(_ustr(testString), parseAll=parseAll)
-            return True
-        except ParseBaseException:
-            return False
-                
-    def runTests(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False):
-        """
-        Execute the parse expression on a series of test strings, showing each
-        test, the parsed results or where the parse failed. Quick and easy way to
-        run a parse expression against a list of sample strings.
-           
-        Parameters:
-         - tests - a list of separate test strings, or a multiline string of test strings
-         - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests           
-         - comment - (default=C{'#'}) - expression for indicating embedded comments in the test 
-              string; pass None to disable comment filtering
-         - fullDump - (default=C{True}) - dump results as list followed by results names in nested outline;
-              if False, only dump nested list
-         - printResults - (default=C{True}) prints test output to stdout
-         - failureTests - (default=C{False}) indicates if these tests are expected to fail parsing
-
-        Returns: a (success, results) tuple, where success indicates that all tests succeeded
-        (or failed if C{failureTests} is True), and the results contain a list of lines of each 
-        test's output
-        
-        Example::
-            number_expr = pyparsing_common.number.copy()
-
-            result = number_expr.runTests('''
-                # unsigned integer
-                100
-                # negative integer
-                -100
-                # float with scientific notation
-                6.02e23
-                # integer with scientific notation
-                1e-12
-                ''')
-            print("Success" if result[0] else "Failed!")
-
-            result = number_expr.runTests('''
-                # stray character
-                100Z
-                # missing leading digit before '.'
-                -.100
-                # too many '.'
-                3.14.159
-                ''', failureTests=True)
-            print("Success" if result[0] else "Failed!")
-        prints::
-            # unsigned integer
-            100
-            [100]
-
-            # negative integer
-            -100
-            [-100]
-
-            # float with scientific notation
-            6.02e23
-            [6.02e+23]
-
-            # integer with scientific notation
-            1e-12
-            [1e-12]
-
-            Success
-            
-            # stray character
-            100Z
-               ^
-            FAIL: Expected end of text (at char 3), (line:1, col:4)
-
-            # missing leading digit before '.'
-            -.100
-            ^
-            FAIL: Expected {real number with scientific notation | real number | signed integer} (at char 0), (line:1, col:1)
-
-            # too many '.'
-            3.14.159
-                ^
-            FAIL: Expected end of text (at char 4), (line:1, col:5)
-
-            Success
-
-        Each test string must be on a single line. If you want to test a string that spans multiple
-        lines, create a test like this::
-
-            expr.runTest(r"this is a test\\n of strings that spans \\n 3 lines")
-        
-        (Note that this is a raw string literal, you must include the leading 'r'.)
-        """
-        if isinstance(tests, basestring):
-            tests = list(map(str.strip, tests.rstrip().splitlines()))
-        if isinstance(comment, basestring):
-            comment = Literal(comment)
-        allResults = []
-        comments = []
-        success = True
-        for t in tests:
-            if comment is not None and comment.matches(t, False) or comments and not t:
-                comments.append(t)
-                continue
-            if not t:
-                continue
-            out = ['\n'.join(comments), t]
-            comments = []
-            try:
-                t = t.replace(r'\n','\n')
-                result = self.parseString(t, parseAll=parseAll)
-                out.append(result.dump(full=fullDump))
-                success = success and not failureTests
-            except ParseBaseException as pe:
-                fatal = "(FATAL)" if isinstance(pe, ParseFatalException) else ""
-                if '\n' in t:
-                    out.append(line(pe.loc, t))
-                    out.append(' '*(col(pe.loc,t)-1) + '^' + fatal)
-                else:
-                    out.append(' '*pe.loc + '^' + fatal)
-                out.append("FAIL: " + str(pe))
-                success = success and failureTests
-                result = pe
-            except Exception as exc:
-                out.append("FAIL-EXCEPTION: " + str(exc))
-                success = success and failureTests
-                result = exc
-
-            if printResults:
-                if fullDump:
-                    out.append('')
-                print('\n'.join(out))
-
-            allResults.append((t, result))
-        
-        return success, allResults
-
-        
-class Token(ParserElement):
-    """
-    Abstract C{ParserElement} subclass, for defining atomic matching patterns.
-    """
-    def __init__( self ):
-        super(Token,self).__init__( savelist=False )
-
-
-class Empty(Token):
-    """
-    An empty token, will always match.
-    """
-    def __init__( self ):
-        super(Empty,self).__init__()
-        self.name = "Empty"
-        self.mayReturnEmpty = True
-        self.mayIndexError = False
-
-
-class NoMatch(Token):
-    """
-    A token that will never match.
-    """
-    def __init__( self ):
-        super(NoMatch,self).__init__()
-        self.name = "NoMatch"
-        self.mayReturnEmpty = True
-        self.mayIndexError = False
-        self.errmsg = "Unmatchable token"
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        raise ParseException(instring, loc, self.errmsg, self)
-
-
-class Literal(Token):
-    """
-    Token to exactly match a specified string.
-    
-    Example::
-        Literal('blah').parseString('blah')  # -> ['blah']
-        Literal('blah').parseString('blahfooblah')  # -> ['blah']
-        Literal('blah').parseString('bla')  # -> Exception: Expected "blah"
-    
-    For case-insensitive matching, use L{CaselessLiteral}.
-    
-    For keyword matching (force word break before and after the matched string),
-    use L{Keyword} or L{CaselessKeyword}.
-    """
-    def __init__( self, matchString ):
-        super(Literal,self).__init__()
-        self.match = matchString
-        self.matchLen = len(matchString)
-        try:
-            self.firstMatchChar = matchString[0]
-        except IndexError:
-            warnings.warn("null string passed to Literal; use Empty() instead",
-                            SyntaxWarning, stacklevel=2)
-            self.__class__ = Empty
-        self.name = '"%s"' % _ustr(self.match)
-        self.errmsg = "Expected " + self.name
-        self.mayReturnEmpty = False
-        self.mayIndexError = False
-
-    # Performance tuning: this routine gets called a *lot*
-    # if this is a single character match string  and the first character matches,
-    # short-circuit as quickly as possible, and avoid calling startswith
-    #~ @profile
-    def parseImpl( self, instring, loc, doActions=True ):
-        if (instring[loc] == self.firstMatchChar and
-            (self.matchLen==1 or instring.startswith(self.match,loc)) ):
-            return loc+self.matchLen, self.match
-        raise ParseException(instring, loc, self.errmsg, self)
-_L = Literal
-ParserElement._literalStringClass = Literal
-
-class Keyword(Token):
-    """
-    Token to exactly match a specified string as a keyword, that is, it must be
-    immediately followed by a non-keyword character.  Compare with C{L{Literal}}:
-     - C{Literal("if")} will match the leading C{'if'} in C{'ifAndOnlyIf'}.
-     - C{Keyword("if")} will not; it will only match the leading C{'if'} in C{'if x=1'}, or C{'if(y==2)'}
-    Accepts two optional constructor arguments in addition to the keyword string:
-     - C{identChars} is a string of characters that would be valid identifier characters,
-          defaulting to all alphanumerics + "_" and "$"
-     - C{caseless} allows case-insensitive matching, default is C{False}.
-       
-    Example::
-        Keyword("start").parseString("start")  # -> ['start']
-        Keyword("start").parseString("starting")  # -> Exception
-
-    For case-insensitive matching, use L{CaselessKeyword}.
-    """
-    DEFAULT_KEYWORD_CHARS = alphanums+"_$"
-
-    def __init__( self, matchString, identChars=None, caseless=False ):
-        super(Keyword,self).__init__()
-        if identChars is None:
-            identChars = Keyword.DEFAULT_KEYWORD_CHARS
-        self.match = matchString
-        self.matchLen = len(matchString)
-        try:
-            self.firstMatchChar = matchString[0]
-        except IndexError:
-            warnings.warn("null string passed to Keyword; use Empty() instead",
-                            SyntaxWarning, stacklevel=2)
-        self.name = '"%s"' % self.match
-        self.errmsg = "Expected " + self.name
-        self.mayReturnEmpty = False
-        self.mayIndexError = False
-        self.caseless = caseless
-        if caseless:
-            self.caselessmatch = matchString.upper()
-            identChars = identChars.upper()
-        self.identChars = set(identChars)
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.caseless:
-            if ( (instring[ loc:loc+self.matchLen ].upper() == self.caselessmatch) and
-                 (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen].upper() not in self.identChars) and
-                 (loc == 0 or instring[loc-1].upper() not in self.identChars) ):
-                return loc+self.matchLen, self.match
-        else:
-            if (instring[loc] == self.firstMatchChar and
-                (self.matchLen==1 or instring.startswith(self.match,loc)) and
-                (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen] not in self.identChars) and
-                (loc == 0 or instring[loc-1] not in self.identChars) ):
-                return loc+self.matchLen, self.match
-        raise ParseException(instring, loc, self.errmsg, self)
-
-    def copy(self):
-        c = super(Keyword,self).copy()
-        c.identChars = Keyword.DEFAULT_KEYWORD_CHARS
-        return c
-
-    @staticmethod
-    def setDefaultKeywordChars( chars ):
-        """Overrides the default Keyword chars
-        """
-        Keyword.DEFAULT_KEYWORD_CHARS = chars
-
-class CaselessLiteral(Literal):
-    """
-    Token to match a specified string, ignoring case of letters.
-    Note: the matched results will always be in the case of the given
-    match string, NOT the case of the input text.
-
-    Example::
-        OneOrMore(CaselessLiteral("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD', 'CMD']
-        
-    (Contrast with example for L{CaselessKeyword}.)
-    """
-    def __init__( self, matchString ):
-        super(CaselessLiteral,self).__init__( matchString.upper() )
-        # Preserve the defining literal.
-        self.returnString = matchString
-        self.name = "'%s'" % self.returnString
-        self.errmsg = "Expected " + self.name
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if instring[ loc:loc+self.matchLen ].upper() == self.match:
-            return loc+self.matchLen, self.returnString
-        raise ParseException(instring, loc, self.errmsg, self)
-
-class CaselessKeyword(Keyword):
-    """
-    Caseless version of L{Keyword}.
-
-    Example::
-        OneOrMore(CaselessKeyword("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD']
-        
-    (Contrast with example for L{CaselessLiteral}.)
-    """
-    def __init__( self, matchString, identChars=None ):
-        super(CaselessKeyword,self).__init__( matchString, identChars, caseless=True )
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if ( (instring[ loc:loc+self.matchLen ].upper() == self.caselessmatch) and
-             (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen].upper() not in self.identChars) ):
-            return loc+self.matchLen, self.match
-        raise ParseException(instring, loc, self.errmsg, self)
-
-class CloseMatch(Token):
-    """
-    A variation on L{Literal} which matches "close" matches, that is, 
-    strings with at most 'n' mismatching characters. C{CloseMatch} takes parameters:
-     - C{match_string} - string to be matched
-     - C{maxMismatches} - (C{default=1}) maximum number of mismatches allowed to count as a match
-    
-    The results from a successful parse will contain the matched text from the input string and the following named results:
-     - C{mismatches} - a list of the positions within the match_string where mismatches were found
-     - C{original} - the original match_string used to compare against the input string
-    
-    If C{mismatches} is an empty list, then the match was an exact match.
-    
-    Example::
-        patt = CloseMatch("ATCATCGAATGGA")
-        patt.parseString("ATCATCGAAXGGA") # -> (['ATCATCGAAXGGA'], {'mismatches': [[9]], 'original': ['ATCATCGAATGGA']})
-        patt.parseString("ATCAXCGAAXGGA") # -> Exception: Expected 'ATCATCGAATGGA' (with up to 1 mismatches) (at char 0), (line:1, col:1)
-
-        # exact match
-        patt.parseString("ATCATCGAATGGA") # -> (['ATCATCGAATGGA'], {'mismatches': [[]], 'original': ['ATCATCGAATGGA']})
-
-        # close match allowing up to 2 mismatches
-        patt = CloseMatch("ATCATCGAATGGA", maxMismatches=2)
-        patt.parseString("ATCAXCGAAXGGA") # -> (['ATCAXCGAAXGGA'], {'mismatches': [[4, 9]], 'original': ['ATCATCGAATGGA']})
-    """
-    def __init__(self, match_string, maxMismatches=1):
-        super(CloseMatch,self).__init__()
-        self.name = match_string
-        self.match_string = match_string
-        self.maxMismatches = maxMismatches
-        self.errmsg = "Expected %r (with up to %d mismatches)" % (self.match_string, self.maxMismatches)
-        self.mayIndexError = False
-        self.mayReturnEmpty = False
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        start = loc
-        instrlen = len(instring)
-        maxloc = start + len(self.match_string)
-
-        if maxloc <= instrlen:
-            match_string = self.match_string
-            match_stringloc = 0
-            mismatches = []
-            maxMismatches = self.maxMismatches
-
-            for match_stringloc,s_m in enumerate(zip(instring[loc:maxloc], self.match_string)):
-                src,mat = s_m
-                if src != mat:
-                    mismatches.append(match_stringloc)
-                    if len(mismatches) > maxMismatches:
-                        break
-            else:
-                loc = match_stringloc + 1
-                results = ParseResults([instring[start:loc]])
-                results['original'] = self.match_string
-                results['mismatches'] = mismatches
-                return loc, results
-
-        raise ParseException(instring, loc, self.errmsg, self)
-
-
-class Word(Token):
-    """
-    Token for matching words composed of allowed character sets.
-    Defined with string containing all allowed initial characters,
-    an optional string containing allowed body characters (if omitted,
-    defaults to the initial character set), and an optional minimum,
-    maximum, and/or exact length.  The default value for C{min} is 1 (a
-    minimum value < 1 is not valid); the default values for C{max} and C{exact}
-    are 0, meaning no maximum or exact length restriction. An optional
-    C{excludeChars} parameter can list characters that might be found in 
-    the input C{bodyChars} string; useful to define a word of all printables
-    except for one or two characters, for instance.
-    
-    L{srange} is useful for defining custom character set strings for defining 
-    C{Word} expressions, using range notation from regular expression character sets.
-    
-    A common mistake is to use C{Word} to match a specific literal string, as in 
-    C{Word("Address")}. Remember that C{Word} uses the string argument to define
-    I{sets} of matchable characters. This expression would match "Add", "AAA",
-    "dAred", or any other word made up of the characters 'A', 'd', 'r', 'e', and 's'.
-    To match an exact literal string, use L{Literal} or L{Keyword}.
-
-    pyparsing includes helper strings for building Words:
-     - L{alphas}
-     - L{nums}
-     - L{alphanums}
-     - L{hexnums}
-     - L{alphas8bit} (alphabetic characters in ASCII range 128-255 - accented, tilded, umlauted, etc.)
-     - L{punc8bit} (non-alphabetic characters in ASCII range 128-255 - currency, symbols, superscripts, diacriticals, etc.)
-     - L{printables} (any non-whitespace character)
-
-    Example::
-        # a word composed of digits
-        integer = Word(nums) # equivalent to Word("0123456789") or Word(srange("0-9"))
-        
-        # a word with a leading capital, and zero or more lowercase
-        capital_word = Word(alphas.upper(), alphas.lower())
-
-        # hostnames are alphanumeric, with leading alpha, and '-'
-        hostname = Word(alphas, alphanums+'-')
-        
-        # roman numeral (not a strict parser, accepts invalid mix of characters)
-        roman = Word("IVXLCDM")
-        
-        # any string of non-whitespace characters, except for ','
-        csv_value = Word(printables, excludeChars=",")
-    """
-    def __init__( self, initChars, bodyChars=None, min=1, max=0, exact=0, asKeyword=False, excludeChars=None ):
-        super(Word,self).__init__()
-        if excludeChars:
-            initChars = ''.join(c for c in initChars if c not in excludeChars)
-            if bodyChars:
-                bodyChars = ''.join(c for c in bodyChars if c not in excludeChars)
-        self.initCharsOrig = initChars
-        self.initChars = set(initChars)
-        if bodyChars :
-            self.bodyCharsOrig = bodyChars
-            self.bodyChars = set(bodyChars)
-        else:
-            self.bodyCharsOrig = initChars
-            self.bodyChars = set(initChars)
-
-        self.maxSpecified = max > 0
-
-        if min < 1:
-            raise ValueError("cannot specify a minimum length < 1; use Optional(Word()) if zero-length word is permitted")
-
-        self.minLen = min
-
-        if max > 0:
-            self.maxLen = max
-        else:
-            self.maxLen = _MAX_INT
-
-        if exact > 0:
-            self.maxLen = exact
-            self.minLen = exact
-
-        self.name = _ustr(self)
-        self.errmsg = "Expected " + self.name
-        self.mayIndexError = False
-        self.asKeyword = asKeyword
-
-        if ' ' not in self.initCharsOrig+self.bodyCharsOrig and (min==1 and max==0 and exact==0):
-            if self.bodyCharsOrig == self.initCharsOrig:
-                self.reString = "[%s]+" % _escapeRegexRangeChars(self.initCharsOrig)
-            elif len(self.initCharsOrig) == 1:
-                self.reString = "%s[%s]*" % \
-                                      (re.escape(self.initCharsOrig),
-                                      _escapeRegexRangeChars(self.bodyCharsOrig),)
-            else:
-                self.reString = "[%s][%s]*" % \
-                                      (_escapeRegexRangeChars(self.initCharsOrig),
-                                      _escapeRegexRangeChars(self.bodyCharsOrig),)
-            if self.asKeyword:
-                self.reString = r"\b"+self.reString+r"\b"
-            try:
-                self.re = re.compile( self.reString )
-            except Exception:
-                self.re = None
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.re:
-            result = self.re.match(instring,loc)
-            if not result:
-                raise ParseException(instring, loc, self.errmsg, self)
-
-            loc = result.end()
-            return loc, result.group()
-
-        if not(instring[ loc ] in self.initChars):
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        start = loc
-        loc += 1
-        instrlen = len(instring)
-        bodychars = self.bodyChars
-        maxloc = start + self.maxLen
-        maxloc = min( maxloc, instrlen )
-        while loc < maxloc and instring[loc] in bodychars:
-            loc += 1
-
-        throwException = False
-        if loc - start < self.minLen:
-            throwException = True
-        if self.maxSpecified and loc < instrlen and instring[loc] in bodychars:
-            throwException = True
-        if self.asKeyword:
-            if (start>0 and instring[start-1] in bodychars) or (loc4:
-                    return s[:4]+"..."
-                else:
-                    return s
-
-            if ( self.initCharsOrig != self.bodyCharsOrig ):
-                self.strRepr = "W:(%s,%s)" % ( charsAsStr(self.initCharsOrig), charsAsStr(self.bodyCharsOrig) )
-            else:
-                self.strRepr = "W:(%s)" % charsAsStr(self.initCharsOrig)
-
-        return self.strRepr
-
-
-class Regex(Token):
-    r"""
-    Token for matching strings that match a given regular expression.
-    Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module.
-    If the given regex contains named groups (defined using C{(?P...)}), these will be preserved as 
-    named parse results.
-
-    Example::
-        realnum = Regex(r"[+-]?\d+\.\d*")
-        date = Regex(r'(?P\d{4})-(?P\d\d?)-(?P\d\d?)')
-        # ref: http://stackoverflow.com/questions/267399/how-do-you-match-only-valid-roman-numerals-with-a-regular-expression
-        roman = Regex(r"M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})")
-    """
-    compiledREtype = type(re.compile("[A-Z]"))
-    def __init__( self, pattern, flags=0):
-        """The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags."""
-        super(Regex,self).__init__()
-
-        if isinstance(pattern, basestring):
-            if not pattern:
-                warnings.warn("null string passed to Regex; use Empty() instead",
-                        SyntaxWarning, stacklevel=2)
-
-            self.pattern = pattern
-            self.flags = flags
-
-            try:
-                self.re = re.compile(self.pattern, self.flags)
-                self.reString = self.pattern
-            except sre_constants.error:
-                warnings.warn("invalid pattern (%s) passed to Regex" % pattern,
-                    SyntaxWarning, stacklevel=2)
-                raise
-
-        elif isinstance(pattern, Regex.compiledREtype):
-            self.re = pattern
-            self.pattern = \
-            self.reString = str(pattern)
-            self.flags = flags
-            
-        else:
-            raise ValueError("Regex may only be constructed with a string or a compiled RE object")
-
-        self.name = _ustr(self)
-        self.errmsg = "Expected " + self.name
-        self.mayIndexError = False
-        self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        result = self.re.match(instring,loc)
-        if not result:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        loc = result.end()
-        d = result.groupdict()
-        ret = ParseResults(result.group())
-        if d:
-            for k in d:
-                ret[k] = d[k]
-        return loc,ret
-
-    def __str__( self ):
-        try:
-            return super(Regex,self).__str__()
-        except Exception:
-            pass
-
-        if self.strRepr is None:
-            self.strRepr = "Re:(%s)" % repr(self.pattern)
-
-        return self.strRepr
-
-
-class QuotedString(Token):
-    r"""
-    Token for matching strings that are delimited by quoting characters.
-    
-    Defined with the following parameters:
-        - quoteChar - string of one or more characters defining the quote delimiting string
-        - escChar - character to escape quotes, typically backslash (default=C{None})
-        - escQuote - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=C{None})
-        - multiline - boolean indicating whether quotes can span multiple lines (default=C{False})
-        - unquoteResults - boolean indicating whether the matched text should be unquoted (default=C{True})
-        - endQuoteChar - string of one or more characters defining the end of the quote delimited string (default=C{None} => same as quoteChar)
-        - convertWhitespaceEscapes - convert escaped whitespace (C{'\t'}, C{'\n'}, etc.) to actual whitespace (default=C{True})
-
-    Example::
-        qs = QuotedString('"')
-        print(qs.searchString('lsjdf "This is the quote" sldjf'))
-        complex_qs = QuotedString('{{', endQuoteChar='}}')
-        print(complex_qs.searchString('lsjdf {{This is the "quote"}} sldjf'))
-        sql_qs = QuotedString('"', escQuote='""')
-        print(sql_qs.searchString('lsjdf "This is the quote with ""embedded"" quotes" sldjf'))
-    prints::
-        [['This is the quote']]
-        [['This is the "quote"']]
-        [['This is the quote with "embedded" quotes']]
-    """
-    def __init__( self, quoteChar, escChar=None, escQuote=None, multiline=False, unquoteResults=True, endQuoteChar=None, convertWhitespaceEscapes=True):
-        super(QuotedString,self).__init__()
-
-        # remove white space from quote chars - wont work anyway
-        quoteChar = quoteChar.strip()
-        if not quoteChar:
-            warnings.warn("quoteChar cannot be the empty string",SyntaxWarning,stacklevel=2)
-            raise SyntaxError()
-
-        if endQuoteChar is None:
-            endQuoteChar = quoteChar
-        else:
-            endQuoteChar = endQuoteChar.strip()
-            if not endQuoteChar:
-                warnings.warn("endQuoteChar cannot be the empty string",SyntaxWarning,stacklevel=2)
-                raise SyntaxError()
-
-        self.quoteChar = quoteChar
-        self.quoteCharLen = len(quoteChar)
-        self.firstQuoteChar = quoteChar[0]
-        self.endQuoteChar = endQuoteChar
-        self.endQuoteCharLen = len(endQuoteChar)
-        self.escChar = escChar
-        self.escQuote = escQuote
-        self.unquoteResults = unquoteResults
-        self.convertWhitespaceEscapes = convertWhitespaceEscapes
-
-        if multiline:
-            self.flags = re.MULTILINE | re.DOTALL
-            self.pattern = r'%s(?:[^%s%s]' % \
-                ( re.escape(self.quoteChar),
-                  _escapeRegexRangeChars(self.endQuoteChar[0]),
-                  (escChar is not None and _escapeRegexRangeChars(escChar) or '') )
-        else:
-            self.flags = 0
-            self.pattern = r'%s(?:[^%s\n\r%s]' % \
-                ( re.escape(self.quoteChar),
-                  _escapeRegexRangeChars(self.endQuoteChar[0]),
-                  (escChar is not None and _escapeRegexRangeChars(escChar) or '') )
-        if len(self.endQuoteChar) > 1:
-            self.pattern += (
-                '|(?:' + ')|(?:'.join("%s[^%s]" % (re.escape(self.endQuoteChar[:i]),
-                                               _escapeRegexRangeChars(self.endQuoteChar[i]))
-                                    for i in range(len(self.endQuoteChar)-1,0,-1)) + ')'
-                )
-        if escQuote:
-            self.pattern += (r'|(?:%s)' % re.escape(escQuote))
-        if escChar:
-            self.pattern += (r'|(?:%s.)' % re.escape(escChar))
-            self.escCharReplacePattern = re.escape(self.escChar)+"(.)"
-        self.pattern += (r')*%s' % re.escape(self.endQuoteChar))
-
-        try:
-            self.re = re.compile(self.pattern, self.flags)
-            self.reString = self.pattern
-        except sre_constants.error:
-            warnings.warn("invalid pattern (%s) passed to Regex" % self.pattern,
-                SyntaxWarning, stacklevel=2)
-            raise
-
-        self.name = _ustr(self)
-        self.errmsg = "Expected " + self.name
-        self.mayIndexError = False
-        self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        result = instring[loc] == self.firstQuoteChar and self.re.match(instring,loc) or None
-        if not result:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        loc = result.end()
-        ret = result.group()
-
-        if self.unquoteResults:
-
-            # strip off quotes
-            ret = ret[self.quoteCharLen:-self.endQuoteCharLen]
-
-            if isinstance(ret,basestring):
-                # replace escaped whitespace
-                if '\\' in ret and self.convertWhitespaceEscapes:
-                    ws_map = {
-                        r'\t' : '\t',
-                        r'\n' : '\n',
-                        r'\f' : '\f',
-                        r'\r' : '\r',
-                    }
-                    for wslit,wschar in ws_map.items():
-                        ret = ret.replace(wslit, wschar)
-
-                # replace escaped characters
-                if self.escChar:
-                    ret = re.sub(self.escCharReplacePattern, r"\g<1>", ret)
-
-                # replace escaped quotes
-                if self.escQuote:
-                    ret = ret.replace(self.escQuote, self.endQuoteChar)
-
-        return loc, ret
-
-    def __str__( self ):
-        try:
-            return super(QuotedString,self).__str__()
-        except Exception:
-            pass
-
-        if self.strRepr is None:
-            self.strRepr = "quoted string, starting with %s ending with %s" % (self.quoteChar, self.endQuoteChar)
-
-        return self.strRepr
-
-
-class CharsNotIn(Token):
-    """
-    Token for matching words composed of characters I{not} in a given set (will
-    include whitespace in matched characters if not listed in the provided exclusion set - see example).
-    Defined with string containing all disallowed characters, and an optional
-    minimum, maximum, and/or exact length.  The default value for C{min} is 1 (a
-    minimum value < 1 is not valid); the default values for C{max} and C{exact}
-    are 0, meaning no maximum or exact length restriction.
-
-    Example::
-        # define a comma-separated-value as anything that is not a ','
-        csv_value = CharsNotIn(',')
-        print(delimitedList(csv_value).parseString("dkls,lsdkjf,s12 34,@!#,213"))
-    prints::
-        ['dkls', 'lsdkjf', 's12 34', '@!#', '213']
-    """
-    def __init__( self, notChars, min=1, max=0, exact=0 ):
-        super(CharsNotIn,self).__init__()
-        self.skipWhitespace = False
-        self.notChars = notChars
-
-        if min < 1:
-            raise ValueError("cannot specify a minimum length < 1; use Optional(CharsNotIn()) if zero-length char group is permitted")
-
-        self.minLen = min
-
-        if max > 0:
-            self.maxLen = max
-        else:
-            self.maxLen = _MAX_INT
-
-        if exact > 0:
-            self.maxLen = exact
-            self.minLen = exact
-
-        self.name = _ustr(self)
-        self.errmsg = "Expected " + self.name
-        self.mayReturnEmpty = ( self.minLen == 0 )
-        self.mayIndexError = False
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if instring[loc] in self.notChars:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        start = loc
-        loc += 1
-        notchars = self.notChars
-        maxlen = min( start+self.maxLen, len(instring) )
-        while loc < maxlen and \
-              (instring[loc] not in notchars):
-            loc += 1
-
-        if loc - start < self.minLen:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        return loc, instring[start:loc]
-
-    def __str__( self ):
-        try:
-            return super(CharsNotIn, self).__str__()
-        except Exception:
-            pass
-
-        if self.strRepr is None:
-            if len(self.notChars) > 4:
-                self.strRepr = "!W:(%s...)" % self.notChars[:4]
-            else:
-                self.strRepr = "!W:(%s)" % self.notChars
-
-        return self.strRepr
-
-class White(Token):
-    """
-    Special matching class for matching whitespace.  Normally, whitespace is ignored
-    by pyparsing grammars.  This class is included when some whitespace structures
-    are significant.  Define with a string containing the whitespace characters to be
-    matched; default is C{" \\t\\r\\n"}.  Also takes optional C{min}, C{max}, and C{exact} arguments,
-    as defined for the C{L{Word}} class.
-    """
-    whiteStrs = {
-        " " : "",
-        "\t": "",
-        "\n": "",
-        "\r": "",
-        "\f": "",
-        }
-    def __init__(self, ws=" \t\r\n", min=1, max=0, exact=0):
-        super(White,self).__init__()
-        self.matchWhite = ws
-        self.setWhitespaceChars( "".join(c for c in self.whiteChars if c not in self.matchWhite) )
-        #~ self.leaveWhitespace()
-        self.name = ("".join(White.whiteStrs[c] for c in self.matchWhite))
-        self.mayReturnEmpty = True
-        self.errmsg = "Expected " + self.name
-
-        self.minLen = min
-
-        if max > 0:
-            self.maxLen = max
-        else:
-            self.maxLen = _MAX_INT
-
-        if exact > 0:
-            self.maxLen = exact
-            self.minLen = exact
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if not(instring[ loc ] in self.matchWhite):
-            raise ParseException(instring, loc, self.errmsg, self)
-        start = loc
-        loc += 1
-        maxloc = start + self.maxLen
-        maxloc = min( maxloc, len(instring) )
-        while loc < maxloc and instring[loc] in self.matchWhite:
-            loc += 1
-
-        if loc - start < self.minLen:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        return loc, instring[start:loc]
-
-
-class _PositionToken(Token):
-    def __init__( self ):
-        super(_PositionToken,self).__init__()
-        self.name=self.__class__.__name__
-        self.mayReturnEmpty = True
-        self.mayIndexError = False
-
-class GoToColumn(_PositionToken):
-    """
-    Token to advance to a specific column of input text; useful for tabular report scraping.
-    """
-    def __init__( self, colno ):
-        super(GoToColumn,self).__init__()
-        self.col = colno
-
-    def preParse( self, instring, loc ):
-        if col(loc,instring) != self.col:
-            instrlen = len(instring)
-            if self.ignoreExprs:
-                loc = self._skipIgnorables( instring, loc )
-            while loc < instrlen and instring[loc].isspace() and col( loc, instring ) != self.col :
-                loc += 1
-        return loc
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        thiscol = col( loc, instring )
-        if thiscol > self.col:
-            raise ParseException( instring, loc, "Text not in expected column", self )
-        newloc = loc + self.col - thiscol
-        ret = instring[ loc: newloc ]
-        return newloc, ret
-
-
-class LineStart(_PositionToken):
-    """
-    Matches if current position is at the beginning of a line within the parse string
-    
-    Example::
-    
-        test = '''\
-        AAA this line
-        AAA and this line
-          AAA but not this one
-        B AAA and definitely not this one
-        '''
-
-        for t in (LineStart() + 'AAA' + restOfLine).searchString(test):
-            print(t)
-    
-    Prints::
-        ['AAA', ' this line']
-        ['AAA', ' and this line']    
-
-    """
-    def __init__( self ):
-        super(LineStart,self).__init__()
-        self.errmsg = "Expected start of line"
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if col(loc, instring) == 1:
-            return loc, []
-        raise ParseException(instring, loc, self.errmsg, self)
-
-class LineEnd(_PositionToken):
-    """
-    Matches if current position is at the end of a line within the parse string
-    """
-    def __init__( self ):
-        super(LineEnd,self).__init__()
-        self.setWhitespaceChars( ParserElement.DEFAULT_WHITE_CHARS.replace("\n","") )
-        self.errmsg = "Expected end of line"
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if loc len(instring):
-            return loc, []
-        else:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-class WordStart(_PositionToken):
-    """
-    Matches if the current position is at the beginning of a Word, and
-    is not preceded by any character in a given set of C{wordChars}
-    (default=C{printables}). To emulate the C{\b} behavior of regular expressions,
-    use C{WordStart(alphanums)}. C{WordStart} will also match at the beginning of
-    the string being parsed, or at the beginning of a line.
-    """
-    def __init__(self, wordChars = printables):
-        super(WordStart,self).__init__()
-        self.wordChars = set(wordChars)
-        self.errmsg = "Not at the start of a word"
-
-    def parseImpl(self, instring, loc, doActions=True ):
-        if loc != 0:
-            if (instring[loc-1] in self.wordChars or
-                instring[loc] not in self.wordChars):
-                raise ParseException(instring, loc, self.errmsg, self)
-        return loc, []
-
-class WordEnd(_PositionToken):
-    """
-    Matches if the current position is at the end of a Word, and
-    is not followed by any character in a given set of C{wordChars}
-    (default=C{printables}). To emulate the C{\b} behavior of regular expressions,
-    use C{WordEnd(alphanums)}. C{WordEnd} will also match at the end of
-    the string being parsed, or at the end of a line.
-    """
-    def __init__(self, wordChars = printables):
-        super(WordEnd,self).__init__()
-        self.wordChars = set(wordChars)
-        self.skipWhitespace = False
-        self.errmsg = "Not at the end of a word"
-
-    def parseImpl(self, instring, loc, doActions=True ):
-        instrlen = len(instring)
-        if instrlen>0 and loc maxExcLoc:
-                    maxException = err
-                    maxExcLoc = err.loc
-            except IndexError:
-                if len(instring) > maxExcLoc:
-                    maxException = ParseException(instring,len(instring),e.errmsg,self)
-                    maxExcLoc = len(instring)
-            else:
-                # save match among all matches, to retry longest to shortest
-                matches.append((loc2, e))
-
-        if matches:
-            matches.sort(key=lambda x: -x[0])
-            for _,e in matches:
-                try:
-                    return e._parse( instring, loc, doActions )
-                except ParseException as err:
-                    err.__traceback__ = None
-                    if err.loc > maxExcLoc:
-                        maxException = err
-                        maxExcLoc = err.loc
-
-        if maxException is not None:
-            maxException.msg = self.errmsg
-            raise maxException
-        else:
-            raise ParseException(instring, loc, "no defined alternatives to match", self)
-
-
-    def __ixor__(self, other ):
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        return self.append( other ) #Or( [ self, other ] )
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "{" + " ^ ".join(_ustr(e) for e in self.exprs) + "}"
-
-        return self.strRepr
-
-    def checkRecursion( self, parseElementList ):
-        subRecCheckList = parseElementList[:] + [ self ]
-        for e in self.exprs:
-            e.checkRecursion( subRecCheckList )
-
-
-class MatchFirst(ParseExpression):
-    """
-    Requires that at least one C{ParseExpression} is found.
-    If two expressions match, the first one listed is the one that will match.
-    May be constructed using the C{'|'} operator.
-
-    Example::
-        # construct MatchFirst using '|' operator
-        
-        # watch the order of expressions to match
-        number = Word(nums) | Combine(Word(nums) + '.' + Word(nums))
-        print(number.searchString("123 3.1416 789")) #  Fail! -> [['123'], ['3'], ['1416'], ['789']]
-
-        # put more selective expression first
-        number = Combine(Word(nums) + '.' + Word(nums)) | Word(nums)
-        print(number.searchString("123 3.1416 789")) #  Better -> [['123'], ['3.1416'], ['789']]
-    """
-    def __init__( self, exprs, savelist = False ):
-        super(MatchFirst,self).__init__(exprs, savelist)
-        if self.exprs:
-            self.mayReturnEmpty = any(e.mayReturnEmpty for e in self.exprs)
-        else:
-            self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        maxExcLoc = -1
-        maxException = None
-        for e in self.exprs:
-            try:
-                ret = e._parse( instring, loc, doActions )
-                return ret
-            except ParseException as err:
-                if err.loc > maxExcLoc:
-                    maxException = err
-                    maxExcLoc = err.loc
-            except IndexError:
-                if len(instring) > maxExcLoc:
-                    maxException = ParseException(instring,len(instring),e.errmsg,self)
-                    maxExcLoc = len(instring)
-
-        # only got here if no expression matched, raise exception for match that made it the furthest
-        else:
-            if maxException is not None:
-                maxException.msg = self.errmsg
-                raise maxException
-            else:
-                raise ParseException(instring, loc, "no defined alternatives to match", self)
-
-    def __ior__(self, other ):
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        return self.append( other ) #MatchFirst( [ self, other ] )
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "{" + " | ".join(_ustr(e) for e in self.exprs) + "}"
-
-        return self.strRepr
-
-    def checkRecursion( self, parseElementList ):
-        subRecCheckList = parseElementList[:] + [ self ]
-        for e in self.exprs:
-            e.checkRecursion( subRecCheckList )
-
-
-class Each(ParseExpression):
-    """
-    Requires all given C{ParseExpression}s to be found, but in any order.
-    Expressions may be separated by whitespace.
-    May be constructed using the C{'&'} operator.
-
-    Example::
-        color = oneOf("RED ORANGE YELLOW GREEN BLUE PURPLE BLACK WHITE BROWN")
-        shape_type = oneOf("SQUARE CIRCLE TRIANGLE STAR HEXAGON OCTAGON")
-        integer = Word(nums)
-        shape_attr = "shape:" + shape_type("shape")
-        posn_attr = "posn:" + Group(integer("x") + ',' + integer("y"))("posn")
-        color_attr = "color:" + color("color")
-        size_attr = "size:" + integer("size")
-
-        # use Each (using operator '&') to accept attributes in any order 
-        # (shape and posn are required, color and size are optional)
-        shape_spec = shape_attr & posn_attr & Optional(color_attr) & Optional(size_attr)
-
-        shape_spec.runTests('''
-            shape: SQUARE color: BLACK posn: 100, 120
-            shape: CIRCLE size: 50 color: BLUE posn: 50,80
-            color:GREEN size:20 shape:TRIANGLE posn:20,40
-            '''
-            )
-    prints::
-        shape: SQUARE color: BLACK posn: 100, 120
-        ['shape:', 'SQUARE', 'color:', 'BLACK', 'posn:', ['100', ',', '120']]
-        - color: BLACK
-        - posn: ['100', ',', '120']
-          - x: 100
-          - y: 120
-        - shape: SQUARE
-
-
-        shape: CIRCLE size: 50 color: BLUE posn: 50,80
-        ['shape:', 'CIRCLE', 'size:', '50', 'color:', 'BLUE', 'posn:', ['50', ',', '80']]
-        - color: BLUE
-        - posn: ['50', ',', '80']
-          - x: 50
-          - y: 80
-        - shape: CIRCLE
-        - size: 50
-
-
-        color: GREEN size: 20 shape: TRIANGLE posn: 20,40
-        ['color:', 'GREEN', 'size:', '20', 'shape:', 'TRIANGLE', 'posn:', ['20', ',', '40']]
-        - color: GREEN
-        - posn: ['20', ',', '40']
-          - x: 20
-          - y: 40
-        - shape: TRIANGLE
-        - size: 20
-    """
-    def __init__( self, exprs, savelist = True ):
-        super(Each,self).__init__(exprs, savelist)
-        self.mayReturnEmpty = all(e.mayReturnEmpty for e in self.exprs)
-        self.skipWhitespace = True
-        self.initExprGroups = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.initExprGroups:
-            self.opt1map = dict((id(e.expr),e) for e in self.exprs if isinstance(e,Optional))
-            opt1 = [ e.expr for e in self.exprs if isinstance(e,Optional) ]
-            opt2 = [ e for e in self.exprs if e.mayReturnEmpty and not isinstance(e,Optional)]
-            self.optionals = opt1 + opt2
-            self.multioptionals = [ e.expr for e in self.exprs if isinstance(e,ZeroOrMore) ]
-            self.multirequired = [ e.expr for e in self.exprs if isinstance(e,OneOrMore) ]
-            self.required = [ e for e in self.exprs if not isinstance(e,(Optional,ZeroOrMore,OneOrMore)) ]
-            self.required += self.multirequired
-            self.initExprGroups = False
-        tmpLoc = loc
-        tmpReqd = self.required[:]
-        tmpOpt  = self.optionals[:]
-        matchOrder = []
-
-        keepMatching = True
-        while keepMatching:
-            tmpExprs = tmpReqd + tmpOpt + self.multioptionals + self.multirequired
-            failed = []
-            for e in tmpExprs:
-                try:
-                    tmpLoc = e.tryParse( instring, tmpLoc )
-                except ParseException:
-                    failed.append(e)
-                else:
-                    matchOrder.append(self.opt1map.get(id(e),e))
-                    if e in tmpReqd:
-                        tmpReqd.remove(e)
-                    elif e in tmpOpt:
-                        tmpOpt.remove(e)
-            if len(failed) == len(tmpExprs):
-                keepMatching = False
-
-        if tmpReqd:
-            missing = ", ".join(_ustr(e) for e in tmpReqd)
-            raise ParseException(instring,loc,"Missing one or more required elements (%s)" % missing )
-
-        # add any unmatched Optionals, in case they have default values defined
-        matchOrder += [e for e in self.exprs if isinstance(e,Optional) and e.expr in tmpOpt]
-
-        resultlist = []
-        for e in matchOrder:
-            loc,results = e._parse(instring,loc,doActions)
-            resultlist.append(results)
-
-        finalResults = sum(resultlist, ParseResults([]))
-        return loc, finalResults
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "{" + " & ".join(_ustr(e) for e in self.exprs) + "}"
-
-        return self.strRepr
-
-    def checkRecursion( self, parseElementList ):
-        subRecCheckList = parseElementList[:] + [ self ]
-        for e in self.exprs:
-            e.checkRecursion( subRecCheckList )
-
-
-class ParseElementEnhance(ParserElement):
-    """
-    Abstract subclass of C{ParserElement}, for combining and post-processing parsed tokens.
-    """
-    def __init__( self, expr, savelist=False ):
-        super(ParseElementEnhance,self).__init__(savelist)
-        if isinstance( expr, basestring ):
-            if issubclass(ParserElement._literalStringClass, Token):
-                expr = ParserElement._literalStringClass(expr)
-            else:
-                expr = ParserElement._literalStringClass(Literal(expr))
-        self.expr = expr
-        self.strRepr = None
-        if expr is not None:
-            self.mayIndexError = expr.mayIndexError
-            self.mayReturnEmpty = expr.mayReturnEmpty
-            self.setWhitespaceChars( expr.whiteChars )
-            self.skipWhitespace = expr.skipWhitespace
-            self.saveAsList = expr.saveAsList
-            self.callPreparse = expr.callPreparse
-            self.ignoreExprs.extend(expr.ignoreExprs)
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.expr is not None:
-            return self.expr._parse( instring, loc, doActions, callPreParse=False )
-        else:
-            raise ParseException("",loc,self.errmsg,self)
-
-    def leaveWhitespace( self ):
-        self.skipWhitespace = False
-        self.expr = self.expr.copy()
-        if self.expr is not None:
-            self.expr.leaveWhitespace()
-        return self
-
-    def ignore( self, other ):
-        if isinstance( other, Suppress ):
-            if other not in self.ignoreExprs:
-                super( ParseElementEnhance, self).ignore( other )
-                if self.expr is not None:
-                    self.expr.ignore( self.ignoreExprs[-1] )
-        else:
-            super( ParseElementEnhance, self).ignore( other )
-            if self.expr is not None:
-                self.expr.ignore( self.ignoreExprs[-1] )
-        return self
-
-    def streamline( self ):
-        super(ParseElementEnhance,self).streamline()
-        if self.expr is not None:
-            self.expr.streamline()
-        return self
-
-    def checkRecursion( self, parseElementList ):
-        if self in parseElementList:
-            raise RecursiveGrammarException( parseElementList+[self] )
-        subRecCheckList = parseElementList[:] + [ self ]
-        if self.expr is not None:
-            self.expr.checkRecursion( subRecCheckList )
-
-    def validate( self, validateTrace=[] ):
-        tmp = validateTrace[:]+[self]
-        if self.expr is not None:
-            self.expr.validate(tmp)
-        self.checkRecursion( [] )
-
-    def __str__( self ):
-        try:
-            return super(ParseElementEnhance,self).__str__()
-        except Exception:
-            pass
-
-        if self.strRepr is None and self.expr is not None:
-            self.strRepr = "%s:(%s)" % ( self.__class__.__name__, _ustr(self.expr) )
-        return self.strRepr
-
-
-class FollowedBy(ParseElementEnhance):
-    """
-    Lookahead matching of the given parse expression.  C{FollowedBy}
-    does I{not} advance the parsing position within the input string, it only
-    verifies that the specified parse expression matches at the current
-    position.  C{FollowedBy} always returns a null token list.
-
-    Example::
-        # use FollowedBy to match a label only if it is followed by a ':'
-        data_word = Word(alphas)
-        label = data_word + FollowedBy(':')
-        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
-        
-        OneOrMore(attr_expr).parseString("shape: SQUARE color: BLACK posn: upper left").pprint()
-    prints::
-        [['shape', 'SQUARE'], ['color', 'BLACK'], ['posn', 'upper left']]
-    """
-    def __init__( self, expr ):
-        super(FollowedBy,self).__init__(expr)
-        self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        self.expr.tryParse( instring, loc )
-        return loc, []
-
-
-class NotAny(ParseElementEnhance):
-    """
-    Lookahead to disallow matching with the given parse expression.  C{NotAny}
-    does I{not} advance the parsing position within the input string, it only
-    verifies that the specified parse expression does I{not} match at the current
-    position.  Also, C{NotAny} does I{not} skip over leading whitespace. C{NotAny}
-    always returns a null token list.  May be constructed using the '~' operator.
-
-    Example::
-        
-    """
-    def __init__( self, expr ):
-        super(NotAny,self).__init__(expr)
-        #~ self.leaveWhitespace()
-        self.skipWhitespace = False  # do NOT use self.leaveWhitespace(), don't want to propagate to exprs
-        self.mayReturnEmpty = True
-        self.errmsg = "Found unwanted token, "+_ustr(self.expr)
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.expr.canParseNext(instring, loc):
-            raise ParseException(instring, loc, self.errmsg, self)
-        return loc, []
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "~{" + _ustr(self.expr) + "}"
-
-        return self.strRepr
-
-class _MultipleMatch(ParseElementEnhance):
-    def __init__( self, expr, stopOn=None):
-        super(_MultipleMatch, self).__init__(expr)
-        self.saveAsList = True
-        ender = stopOn
-        if isinstance(ender, basestring):
-            ender = ParserElement._literalStringClass(ender)
-        self.not_ender = ~ender if ender is not None else None
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        self_expr_parse = self.expr._parse
-        self_skip_ignorables = self._skipIgnorables
-        check_ender = self.not_ender is not None
-        if check_ender:
-            try_not_ender = self.not_ender.tryParse
-        
-        # must be at least one (but first see if we are the stopOn sentinel;
-        # if so, fail)
-        if check_ender:
-            try_not_ender(instring, loc)
-        loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
-        try:
-            hasIgnoreExprs = (not not self.ignoreExprs)
-            while 1:
-                if check_ender:
-                    try_not_ender(instring, loc)
-                if hasIgnoreExprs:
-                    preloc = self_skip_ignorables( instring, loc )
-                else:
-                    preloc = loc
-                loc, tmptokens = self_expr_parse( instring, preloc, doActions )
-                if tmptokens or tmptokens.haskeys():
-                    tokens += tmptokens
-        except (ParseException,IndexError):
-            pass
-
-        return loc, tokens
-        
-class OneOrMore(_MultipleMatch):
-    """
-    Repetition of one or more of the given expression.
-    
-    Parameters:
-     - expr - expression that must match one or more times
-     - stopOn - (default=C{None}) - expression for a terminating sentinel
-          (only required if the sentinel would ordinarily match the repetition 
-          expression)          
-
-    Example::
-        data_word = Word(alphas)
-        label = data_word + FollowedBy(':')
-        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join))
-
-        text = "shape: SQUARE posn: upper left color: BLACK"
-        OneOrMore(attr_expr).parseString(text).pprint()  # Fail! read 'color' as data instead of next label -> [['shape', 'SQUARE color']]
-
-        # use stopOn attribute for OneOrMore to avoid reading label string as part of the data
-        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
-        OneOrMore(attr_expr).parseString(text).pprint() # Better -> [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'BLACK']]
-        
-        # could also be written as
-        (attr_expr * (1,)).parseString(text).pprint()
-    """
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "{" + _ustr(self.expr) + "}..."
-
-        return self.strRepr
-
-class ZeroOrMore(_MultipleMatch):
-    """
-    Optional repetition of zero or more of the given expression.
-    
-    Parameters:
-     - expr - expression that must match zero or more times
-     - stopOn - (default=C{None}) - expression for a terminating sentinel
-          (only required if the sentinel would ordinarily match the repetition 
-          expression)          
-
-    Example: similar to L{OneOrMore}
-    """
-    def __init__( self, expr, stopOn=None):
-        super(ZeroOrMore,self).__init__(expr, stopOn=stopOn)
-        self.mayReturnEmpty = True
-        
-    def parseImpl( self, instring, loc, doActions=True ):
-        try:
-            return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
-        except (ParseException,IndexError):
-            return loc, []
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "[" + _ustr(self.expr) + "]..."
-
-        return self.strRepr
-
-class _NullToken(object):
-    def __bool__(self):
-        return False
-    __nonzero__ = __bool__
-    def __str__(self):
-        return ""
-
-_optionalNotMatched = _NullToken()
-class Optional(ParseElementEnhance):
-    """
-    Optional matching of the given expression.
-
-    Parameters:
-     - expr - expression that must match zero or more times
-     - default (optional) - value to be returned if the optional expression is not found.
-
-    Example::
-        # US postal code can be a 5-digit zip, plus optional 4-digit qualifier
-        zip = Combine(Word(nums, exact=5) + Optional('-' + Word(nums, exact=4)))
-        zip.runTests('''
-            # traditional ZIP code
-            12345
-            
-            # ZIP+4 form
-            12101-0001
-            
-            # invalid ZIP
-            98765-
-            ''')
-    prints::
-        # traditional ZIP code
-        12345
-        ['12345']
-
-        # ZIP+4 form
-        12101-0001
-        ['12101-0001']
-
-        # invalid ZIP
-        98765-
-             ^
-        FAIL: Expected end of text (at char 5), (line:1, col:6)
-    """
-    def __init__( self, expr, default=_optionalNotMatched ):
-        super(Optional,self).__init__( expr, savelist=False )
-        self.saveAsList = self.expr.saveAsList
-        self.defaultValue = default
-        self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        try:
-            loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False )
-        except (ParseException,IndexError):
-            if self.defaultValue is not _optionalNotMatched:
-                if self.expr.resultsName:
-                    tokens = ParseResults([ self.defaultValue ])
-                    tokens[self.expr.resultsName] = self.defaultValue
-                else:
-                    tokens = [ self.defaultValue ]
-            else:
-                tokens = []
-        return loc, tokens
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "[" + _ustr(self.expr) + "]"
-
-        return self.strRepr
-
-class SkipTo(ParseElementEnhance):
-    """
-    Token for skipping over all undefined text until the matched expression is found.
-
-    Parameters:
-     - expr - target expression marking the end of the data to be skipped
-     - include - (default=C{False}) if True, the target expression is also parsed 
-          (the skipped text and target expression are returned as a 2-element list).
-     - ignore - (default=C{None}) used to define grammars (typically quoted strings and 
-          comments) that might contain false matches to the target expression
-     - failOn - (default=C{None}) define expressions that are not allowed to be 
-          included in the skipped test; if found before the target expression is found, 
-          the SkipTo is not a match
-
-    Example::
-        report = '''
-            Outstanding Issues Report - 1 Jan 2000
-
-               # | Severity | Description                               |  Days Open
-            -----+----------+-------------------------------------------+-----------
-             101 | Critical | Intermittent system crash                 |          6
-              94 | Cosmetic | Spelling error on Login ('log|n')         |         14
-              79 | Minor    | System slow when running too many reports |         47
-            '''
-        integer = Word(nums)
-        SEP = Suppress('|')
-        # use SkipTo to simply match everything up until the next SEP
-        # - ignore quoted strings, so that a '|' character inside a quoted string does not match
-        # - parse action will call token.strip() for each matched token, i.e., the description body
-        string_data = SkipTo(SEP, ignore=quotedString)
-        string_data.setParseAction(tokenMap(str.strip))
-        ticket_expr = (integer("issue_num") + SEP 
-                      + string_data("sev") + SEP 
-                      + string_data("desc") + SEP 
-                      + integer("days_open"))
-        
-        for tkt in ticket_expr.searchString(report):
-            print tkt.dump()
-    prints::
-        ['101', 'Critical', 'Intermittent system crash', '6']
-        - days_open: 6
-        - desc: Intermittent system crash
-        - issue_num: 101
-        - sev: Critical
-        ['94', 'Cosmetic', "Spelling error on Login ('log|n')", '14']
-        - days_open: 14
-        - desc: Spelling error on Login ('log|n')
-        - issue_num: 94
-        - sev: Cosmetic
-        ['79', 'Minor', 'System slow when running too many reports', '47']
-        - days_open: 47
-        - desc: System slow when running too many reports
-        - issue_num: 79
-        - sev: Minor
-    """
-    def __init__( self, other, include=False, ignore=None, failOn=None ):
-        super( SkipTo, self ).__init__( other )
-        self.ignoreExpr = ignore
-        self.mayReturnEmpty = True
-        self.mayIndexError = False
-        self.includeMatch = include
-        self.asList = False
-        if isinstance(failOn, basestring):
-            self.failOn = ParserElement._literalStringClass(failOn)
-        else:
-            self.failOn = failOn
-        self.errmsg = "No match found for "+_ustr(self.expr)
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        startloc = loc
-        instrlen = len(instring)
-        expr = self.expr
-        expr_parse = self.expr._parse
-        self_failOn_canParseNext = self.failOn.canParseNext if self.failOn is not None else None
-        self_ignoreExpr_tryParse = self.ignoreExpr.tryParse if self.ignoreExpr is not None else None
-        
-        tmploc = loc
-        while tmploc <= instrlen:
-            if self_failOn_canParseNext is not None:
-                # break if failOn expression matches
-                if self_failOn_canParseNext(instring, tmploc):
-                    break
-                    
-            if self_ignoreExpr_tryParse is not None:
-                # advance past ignore expressions
-                while 1:
-                    try:
-                        tmploc = self_ignoreExpr_tryParse(instring, tmploc)
-                    except ParseBaseException:
-                        break
-            
-            try:
-                expr_parse(instring, tmploc, doActions=False, callPreParse=False)
-            except (ParseException, IndexError):
-                # no match, advance loc in string
-                tmploc += 1
-            else:
-                # matched skipto expr, done
-                break
-
-        else:
-            # ran off the end of the input string without matching skipto expr, fail
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        # build up return values
-        loc = tmploc
-        skiptext = instring[startloc:loc]
-        skipresult = ParseResults(skiptext)
-        
-        if self.includeMatch:
-            loc, mat = expr_parse(instring,loc,doActions,callPreParse=False)
-            skipresult += mat
-
-        return loc, skipresult
-
-class Forward(ParseElementEnhance):
-    """
-    Forward declaration of an expression to be defined later -
-    used for recursive grammars, such as algebraic infix notation.
-    When the expression is known, it is assigned to the C{Forward} variable using the '<<' operator.
-
-    Note: take care when assigning to C{Forward} not to overlook precedence of operators.
-    Specifically, '|' has a lower precedence than '<<', so that::
-        fwdExpr << a | b | c
-    will actually be evaluated as::
-        (fwdExpr << a) | b | c
-    thereby leaving b and c out as parseable alternatives.  It is recommended that you
-    explicitly group the values inserted into the C{Forward}::
-        fwdExpr << (a | b | c)
-    Converting to use the '<<=' operator instead will avoid this problem.
-
-    See L{ParseResults.pprint} for an example of a recursive parser created using
-    C{Forward}.
-    """
-    def __init__( self, other=None ):
-        super(Forward,self).__init__( other, savelist=False )
-
-    def __lshift__( self, other ):
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass(other)
-        self.expr = other
-        self.strRepr = None
-        self.mayIndexError = self.expr.mayIndexError
-        self.mayReturnEmpty = self.expr.mayReturnEmpty
-        self.setWhitespaceChars( self.expr.whiteChars )
-        self.skipWhitespace = self.expr.skipWhitespace
-        self.saveAsList = self.expr.saveAsList
-        self.ignoreExprs.extend(self.expr.ignoreExprs)
-        return self
-        
-    def __ilshift__(self, other):
-        return self << other
-    
-    def leaveWhitespace( self ):
-        self.skipWhitespace = False
-        return self
-
-    def streamline( self ):
-        if not self.streamlined:
-            self.streamlined = True
-            if self.expr is not None:
-                self.expr.streamline()
-        return self
-
-    def validate( self, validateTrace=[] ):
-        if self not in validateTrace:
-            tmp = validateTrace[:]+[self]
-            if self.expr is not None:
-                self.expr.validate(tmp)
-        self.checkRecursion([])
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-        return self.__class__.__name__ + ": ..."
-
-        # stubbed out for now - creates awful memory and perf issues
-        self._revertClass = self.__class__
-        self.__class__ = _ForwardNoRecurse
-        try:
-            if self.expr is not None:
-                retString = _ustr(self.expr)
-            else:
-                retString = "None"
-        finally:
-            self.__class__ = self._revertClass
-        return self.__class__.__name__ + ": " + retString
-
-    def copy(self):
-        if self.expr is not None:
-            return super(Forward,self).copy()
-        else:
-            ret = Forward()
-            ret <<= self
-            return ret
-
-class _ForwardNoRecurse(Forward):
-    def __str__( self ):
-        return "..."
-
-class TokenConverter(ParseElementEnhance):
-    """
-    Abstract subclass of C{ParseExpression}, for converting parsed results.
-    """
-    def __init__( self, expr, savelist=False ):
-        super(TokenConverter,self).__init__( expr )#, savelist )
-        self.saveAsList = False
-
-class Combine(TokenConverter):
-    """
-    Converter to concatenate all matching tokens to a single string.
-    By default, the matching patterns must also be contiguous in the input string;
-    this can be disabled by specifying C{'adjacent=False'} in the constructor.
-
-    Example::
-        real = Word(nums) + '.' + Word(nums)
-        print(real.parseString('3.1416')) # -> ['3', '.', '1416']
-        # will also erroneously match the following
-        print(real.parseString('3. 1416')) # -> ['3', '.', '1416']
-
-        real = Combine(Word(nums) + '.' + Word(nums))
-        print(real.parseString('3.1416')) # -> ['3.1416']
-        # no match when there are internal spaces
-        print(real.parseString('3. 1416')) # -> Exception: Expected W:(0123...)
-    """
-    def __init__( self, expr, joinString="", adjacent=True ):
-        super(Combine,self).__init__( expr )
-        # suppress whitespace-stripping in contained parse expressions, but re-enable it on the Combine itself
-        if adjacent:
-            self.leaveWhitespace()
-        self.adjacent = adjacent
-        self.skipWhitespace = True
-        self.joinString = joinString
-        self.callPreparse = True
-
-    def ignore( self, other ):
-        if self.adjacent:
-            ParserElement.ignore(self, other)
-        else:
-            super( Combine, self).ignore( other )
-        return self
-
-    def postParse( self, instring, loc, tokenlist ):
-        retToks = tokenlist.copy()
-        del retToks[:]
-        retToks += ParseResults([ "".join(tokenlist._asStringList(self.joinString)) ], modal=self.modalResults)
-
-        if self.resultsName and retToks.haskeys():
-            return [ retToks ]
-        else:
-            return retToks
-
-class Group(TokenConverter):
-    """
-    Converter to return the matched tokens as a list - useful for returning tokens of C{L{ZeroOrMore}} and C{L{OneOrMore}} expressions.
-
-    Example::
-        ident = Word(alphas)
-        num = Word(nums)
-        term = ident | num
-        func = ident + Optional(delimitedList(term))
-        print(func.parseString("fn a,b,100"))  # -> ['fn', 'a', 'b', '100']
-
-        func = ident + Group(Optional(delimitedList(term)))
-        print(func.parseString("fn a,b,100"))  # -> ['fn', ['a', 'b', '100']]
-    """
-    def __init__( self, expr ):
-        super(Group,self).__init__( expr )
-        self.saveAsList = True
-
-    def postParse( self, instring, loc, tokenlist ):
-        return [ tokenlist ]
-
-class Dict(TokenConverter):
-    """
-    Converter to return a repetitive expression as a list, but also as a dictionary.
-    Each element can also be referenced using the first token in the expression as its key.
-    Useful for tabular report scraping when the first column can be used as a item key.
-
-    Example::
-        data_word = Word(alphas)
-        label = data_word + FollowedBy(':')
-        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join))
-
-        text = "shape: SQUARE posn: upper left color: light blue texture: burlap"
-        attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
-        
-        # print attributes as plain groups
-        print(OneOrMore(attr_expr).parseString(text).dump())
-        
-        # instead of OneOrMore(expr), parse using Dict(OneOrMore(Group(expr))) - Dict will auto-assign names
-        result = Dict(OneOrMore(Group(attr_expr))).parseString(text)
-        print(result.dump())
-        
-        # access named fields as dict entries, or output as dict
-        print(result['shape'])        
-        print(result.asDict())
-    prints::
-        ['shape', 'SQUARE', 'posn', 'upper left', 'color', 'light blue', 'texture', 'burlap']
-
-        [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']]
-        - color: light blue
-        - posn: upper left
-        - shape: SQUARE
-        - texture: burlap
-        SQUARE
-        {'color': 'light blue', 'posn': 'upper left', 'texture': 'burlap', 'shape': 'SQUARE'}
-    See more examples at L{ParseResults} of accessing fields by results name.
-    """
-    def __init__( self, expr ):
-        super(Dict,self).__init__( expr )
-        self.saveAsList = True
-
-    def postParse( self, instring, loc, tokenlist ):
-        for i,tok in enumerate(tokenlist):
-            if len(tok) == 0:
-                continue
-            ikey = tok[0]
-            if isinstance(ikey,int):
-                ikey = _ustr(tok[0]).strip()
-            if len(tok)==1:
-                tokenlist[ikey] = _ParseResultsWithOffset("",i)
-            elif len(tok)==2 and not isinstance(tok[1],ParseResults):
-                tokenlist[ikey] = _ParseResultsWithOffset(tok[1],i)
-            else:
-                dictvalue = tok.copy() #ParseResults(i)
-                del dictvalue[0]
-                if len(dictvalue)!= 1 or (isinstance(dictvalue,ParseResults) and dictvalue.haskeys()):
-                    tokenlist[ikey] = _ParseResultsWithOffset(dictvalue,i)
-                else:
-                    tokenlist[ikey] = _ParseResultsWithOffset(dictvalue[0],i)
-
-        if self.resultsName:
-            return [ tokenlist ]
-        else:
-            return tokenlist
-
-
-class Suppress(TokenConverter):
-    """
-    Converter for ignoring the results of a parsed expression.
-
-    Example::
-        source = "a, b, c,d"
-        wd = Word(alphas)
-        wd_list1 = wd + ZeroOrMore(',' + wd)
-        print(wd_list1.parseString(source))
-
-        # often, delimiters that are useful during parsing are just in the
-        # way afterward - use Suppress to keep them out of the parsed output
-        wd_list2 = wd + ZeroOrMore(Suppress(',') + wd)
-        print(wd_list2.parseString(source))
-    prints::
-        ['a', ',', 'b', ',', 'c', ',', 'd']
-        ['a', 'b', 'c', 'd']
-    (See also L{delimitedList}.)
-    """
-    def postParse( self, instring, loc, tokenlist ):
-        return []
-
-    def suppress( self ):
-        return self
-
-
-class OnlyOnce(object):
-    """
-    Wrapper for parse actions, to ensure they are only called once.
-    """
-    def __init__(self, methodCall):
-        self.callable = _trim_arity(methodCall)
-        self.called = False
-    def __call__(self,s,l,t):
-        if not self.called:
-            results = self.callable(s,l,t)
-            self.called = True
-            return results
-        raise ParseException(s,l,"")
-    def reset(self):
-        self.called = False
-
-def traceParseAction(f):
-    """
-    Decorator for debugging parse actions. 
-    
-    When the parse action is called, this decorator will print C{">> entering I{method-name}(line:I{current_source_line}, I{parse_location}, I{matched_tokens})".}
-    When the parse action completes, the decorator will print C{"<<"} followed by the returned value, or any exception that the parse action raised.
-
-    Example::
-        wd = Word(alphas)
-
-        @traceParseAction
-        def remove_duplicate_chars(tokens):
-            return ''.join(sorted(set(''.join(tokens))))
-
-        wds = OneOrMore(wd).setParseAction(remove_duplicate_chars)
-        print(wds.parseString("slkdjs sld sldd sdlf sdljf"))
-    prints::
-        >>entering remove_duplicate_chars(line: 'slkdjs sld sldd sdlf sdljf', 0, (['slkdjs', 'sld', 'sldd', 'sdlf', 'sdljf'], {}))
-        <3:
-            thisFunc = paArgs[0].__class__.__name__ + '.' + thisFunc
-        sys.stderr.write( ">>entering %s(line: '%s', %d, %r)\n" % (thisFunc,line(l,s),l,t) )
-        try:
-            ret = f(*paArgs)
-        except Exception as exc:
-            sys.stderr.write( "< ['aa', 'bb', 'cc']
-        delimitedList(Word(hexnums), delim=':', combine=True).parseString("AA:BB:CC:DD:EE") # -> ['AA:BB:CC:DD:EE']
-    """
-    dlName = _ustr(expr)+" ["+_ustr(delim)+" "+_ustr(expr)+"]..."
-    if combine:
-        return Combine( expr + ZeroOrMore( delim + expr ) ).setName(dlName)
-    else:
-        return ( expr + ZeroOrMore( Suppress( delim ) + expr ) ).setName(dlName)
-
-def countedArray( expr, intExpr=None ):
-    """
-    Helper to define a counted list of expressions.
-    This helper defines a pattern of the form::
-        integer expr expr expr...
-    where the leading integer tells how many expr expressions follow.
-    The matched tokens returns the array of expr tokens as a list - the leading count token is suppressed.
-    
-    If C{intExpr} is specified, it should be a pyparsing expression that produces an integer value.
-
-    Example::
-        countedArray(Word(alphas)).parseString('2 ab cd ef')  # -> ['ab', 'cd']
-
-        # in this parser, the leading integer value is given in binary,
-        # '10' indicating that 2 values are in the array
-        binaryConstant = Word('01').setParseAction(lambda t: int(t[0], 2))
-        countedArray(Word(alphas), intExpr=binaryConstant).parseString('10 ab cd ef')  # -> ['ab', 'cd']
-    """
-    arrayExpr = Forward()
-    def countFieldParseAction(s,l,t):
-        n = t[0]
-        arrayExpr << (n and Group(And([expr]*n)) or Group(empty))
-        return []
-    if intExpr is None:
-        intExpr = Word(nums).setParseAction(lambda t:int(t[0]))
-    else:
-        intExpr = intExpr.copy()
-    intExpr.setName("arrayLen")
-    intExpr.addParseAction(countFieldParseAction, callDuringTry=True)
-    return ( intExpr + arrayExpr ).setName('(len) ' + _ustr(expr) + '...')
-
-def _flatten(L):
-    ret = []
-    for i in L:
-        if isinstance(i,list):
-            ret.extend(_flatten(i))
-        else:
-            ret.append(i)
-    return ret
-
-def matchPreviousLiteral(expr):
-    """
-    Helper to define an expression that is indirectly defined from
-    the tokens matched in a previous expression, that is, it looks
-    for a 'repeat' of a previous expression.  For example::
-        first = Word(nums)
-        second = matchPreviousLiteral(first)
-        matchExpr = first + ":" + second
-    will match C{"1:1"}, but not C{"1:2"}.  Because this matches a
-    previous literal, will also match the leading C{"1:1"} in C{"1:10"}.
-    If this is not desired, use C{matchPreviousExpr}.
-    Do I{not} use with packrat parsing enabled.
-    """
-    rep = Forward()
-    def copyTokenToRepeater(s,l,t):
-        if t:
-            if len(t) == 1:
-                rep << t[0]
-            else:
-                # flatten t tokens
-                tflat = _flatten(t.asList())
-                rep << And(Literal(tt) for tt in tflat)
-        else:
-            rep << Empty()
-    expr.addParseAction(copyTokenToRepeater, callDuringTry=True)
-    rep.setName('(prev) ' + _ustr(expr))
-    return rep
-
-def matchPreviousExpr(expr):
-    """
-    Helper to define an expression that is indirectly defined from
-    the tokens matched in a previous expression, that is, it looks
-    for a 'repeat' of a previous expression.  For example::
-        first = Word(nums)
-        second = matchPreviousExpr(first)
-        matchExpr = first + ":" + second
-    will match C{"1:1"}, but not C{"1:2"}.  Because this matches by
-    expressions, will I{not} match the leading C{"1:1"} in C{"1:10"};
-    the expressions are evaluated first, and then compared, so
-    C{"1"} is compared with C{"10"}.
-    Do I{not} use with packrat parsing enabled.
-    """
-    rep = Forward()
-    e2 = expr.copy()
-    rep <<= e2
-    def copyTokenToRepeater(s,l,t):
-        matchTokens = _flatten(t.asList())
-        def mustMatchTheseTokens(s,l,t):
-            theseTokens = _flatten(t.asList())
-            if  theseTokens != matchTokens:
-                raise ParseException("",0,"")
-        rep.setParseAction( mustMatchTheseTokens, callDuringTry=True )
-    expr.addParseAction(copyTokenToRepeater, callDuringTry=True)
-    rep.setName('(prev) ' + _ustr(expr))
-    return rep
-
-def _escapeRegexRangeChars(s):
-    #~  escape these chars: ^-]
-    for c in r"\^-]":
-        s = s.replace(c,_bslash+c)
-    s = s.replace("\n",r"\n")
-    s = s.replace("\t",r"\t")
-    return _ustr(s)
-
-def oneOf( strs, caseless=False, useRegex=True ):
-    """
-    Helper to quickly define a set of alternative Literals, and makes sure to do
-    longest-first testing when there is a conflict, regardless of the input order,
-    but returns a C{L{MatchFirst}} for best performance.
-
-    Parameters:
-     - strs - a string of space-delimited literals, or a collection of string literals
-     - caseless - (default=C{False}) - treat all literals as caseless
-     - useRegex - (default=C{True}) - as an optimization, will generate a Regex
-          object; otherwise, will generate a C{MatchFirst} object (if C{caseless=True}, or
-          if creating a C{Regex} raises an exception)
-
-    Example::
-        comp_oper = oneOf("< = > <= >= !=")
-        var = Word(alphas)
-        number = Word(nums)
-        term = var | number
-        comparison_expr = term + comp_oper + term
-        print(comparison_expr.searchString("B = 12  AA=23 B<=AA AA>12"))
-    prints::
-        [['B', '=', '12'], ['AA', '=', '23'], ['B', '<=', 'AA'], ['AA', '>', '12']]
-    """
-    if caseless:
-        isequal = ( lambda a,b: a.upper() == b.upper() )
-        masks = ( lambda a,b: b.upper().startswith(a.upper()) )
-        parseElementClass = CaselessLiteral
-    else:
-        isequal = ( lambda a,b: a == b )
-        masks = ( lambda a,b: b.startswith(a) )
-        parseElementClass = Literal
-
-    symbols = []
-    if isinstance(strs,basestring):
-        symbols = strs.split()
-    elif isinstance(strs, Iterable):
-        symbols = list(strs)
-    else:
-        warnings.warn("Invalid argument to oneOf, expected string or iterable",
-                SyntaxWarning, stacklevel=2)
-    if not symbols:
-        return NoMatch()
-
-    i = 0
-    while i < len(symbols)-1:
-        cur = symbols[i]
-        for j,other in enumerate(symbols[i+1:]):
-            if ( isequal(other, cur) ):
-                del symbols[i+j+1]
-                break
-            elif ( masks(cur, other) ):
-                del symbols[i+j+1]
-                symbols.insert(i,other)
-                cur = other
-                break
-        else:
-            i += 1
-
-    if not caseless and useRegex:
-        #~ print (strs,"->", "|".join( [ _escapeRegexChars(sym) for sym in symbols] ))
-        try:
-            if len(symbols)==len("".join(symbols)):
-                return Regex( "[%s]" % "".join(_escapeRegexRangeChars(sym) for sym in symbols) ).setName(' | '.join(symbols))
-            else:
-                return Regex( "|".join(re.escape(sym) for sym in symbols) ).setName(' | '.join(symbols))
-        except Exception:
-            warnings.warn("Exception creating Regex for oneOf, building MatchFirst",
-                    SyntaxWarning, stacklevel=2)
-
-
-    # last resort, just use MatchFirst
-    return MatchFirst(parseElementClass(sym) for sym in symbols).setName(' | '.join(symbols))
-
-def dictOf( key, value ):
-    """
-    Helper to easily and clearly define a dictionary by specifying the respective patterns
-    for the key and value.  Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens
-    in the proper order.  The key pattern can include delimiting markers or punctuation,
-    as long as they are suppressed, thereby leaving the significant key text.  The value
-    pattern can include named results, so that the C{Dict} results can include named token
-    fields.
-
-    Example::
-        text = "shape: SQUARE posn: upper left color: light blue texture: burlap"
-        attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
-        print(OneOrMore(attr_expr).parseString(text).dump())
-        
-        attr_label = label
-        attr_value = Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)
-
-        # similar to Dict, but simpler call format
-        result = dictOf(attr_label, attr_value).parseString(text)
-        print(result.dump())
-        print(result['shape'])
-        print(result.shape)  # object attribute access works too
-        print(result.asDict())
-    prints::
-        [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']]
-        - color: light blue
-        - posn: upper left
-        - shape: SQUARE
-        - texture: burlap
-        SQUARE
-        SQUARE
-        {'color': 'light blue', 'shape': 'SQUARE', 'posn': 'upper left', 'texture': 'burlap'}
-    """
-    return Dict( ZeroOrMore( Group ( key + value ) ) )
-
-def originalTextFor(expr, asString=True):
-    """
-    Helper to return the original, untokenized text for a given expression.  Useful to
-    restore the parsed fields of an HTML start tag into the raw tag text itself, or to
-    revert separate tokens with intervening whitespace back to the original matching
-    input text. By default, returns astring containing the original parsed text.  
-       
-    If the optional C{asString} argument is passed as C{False}, then the return value is a 
-    C{L{ParseResults}} containing any results names that were originally matched, and a 
-    single token containing the original matched text from the input string.  So if 
-    the expression passed to C{L{originalTextFor}} contains expressions with defined
-    results names, you must set C{asString} to C{False} if you want to preserve those
-    results name values.
-
-    Example::
-        src = "this is test  bold text  normal text "
-        for tag in ("b","i"):
-            opener,closer = makeHTMLTags(tag)
-            patt = originalTextFor(opener + SkipTo(closer) + closer)
-            print(patt.searchString(src)[0])
-    prints::
-        [' bold text ']
-        ['text']
-    """
-    locMarker = Empty().setParseAction(lambda s,loc,t: loc)
-    endlocMarker = locMarker.copy()
-    endlocMarker.callPreparse = False
-    matchExpr = locMarker("_original_start") + expr + endlocMarker("_original_end")
-    if asString:
-        extractText = lambda s,l,t: s[t._original_start:t._original_end]
-    else:
-        def extractText(s,l,t):
-            t[:] = [s[t.pop('_original_start'):t.pop('_original_end')]]
-    matchExpr.setParseAction(extractText)
-    matchExpr.ignoreExprs = expr.ignoreExprs
-    return matchExpr
-
-def ungroup(expr): 
-    """
-    Helper to undo pyparsing's default grouping of And expressions, even
-    if all but one are non-empty.
-    """
-    return TokenConverter(expr).setParseAction(lambda t:t[0])
-
-def locatedExpr(expr):
-    """
-    Helper to decorate a returned token with its starting and ending locations in the input string.
-    This helper adds the following results names:
-     - locn_start = location where matched expression begins
-     - locn_end = location where matched expression ends
-     - value = the actual parsed results
-
-    Be careful if the input text contains C{} characters, you may want to call
-    C{L{ParserElement.parseWithTabs}}
-
-    Example::
-        wd = Word(alphas)
-        for match in locatedExpr(wd).searchString("ljsdf123lksdjjf123lkkjj1222"):
-            print(match)
-    prints::
-        [[0, 'ljsdf', 5]]
-        [[8, 'lksdjjf', 15]]
-        [[18, 'lkkjj', 23]]
-    """
-    locator = Empty().setParseAction(lambda s,l,t: l)
-    return Group(locator("locn_start") + expr("value") + locator.copy().leaveWhitespace()("locn_end"))
-
-
-# convenience constants for positional expressions
-empty       = Empty().setName("empty")
-lineStart   = LineStart().setName("lineStart")
-lineEnd     = LineEnd().setName("lineEnd")
-stringStart = StringStart().setName("stringStart")
-stringEnd   = StringEnd().setName("stringEnd")
-
-_escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1])
-_escapedHexChar = Regex(r"\\0?[xX][0-9a-fA-F]+").setParseAction(lambda s,l,t:unichr(int(t[0].lstrip(r'\0x'),16)))
-_escapedOctChar = Regex(r"\\0[0-7]+").setParseAction(lambda s,l,t:unichr(int(t[0][1:],8)))
-_singleChar = _escapedPunc | _escapedHexChar | _escapedOctChar | CharsNotIn(r'\]', exact=1)
-_charRange = Group(_singleChar + Suppress("-") + _singleChar)
-_reBracketExpr = Literal("[") + Optional("^").setResultsName("negate") + Group( OneOrMore( _charRange | _singleChar ) ).setResultsName("body") + "]"
-
-def srange(s):
-    r"""
-    Helper to easily define string ranges for use in Word construction.  Borrows
-    syntax from regexp '[]' string range definitions::
-        srange("[0-9]")   -> "0123456789"
-        srange("[a-z]")   -> "abcdefghijklmnopqrstuvwxyz"
-        srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
-    The input string must be enclosed in []'s, and the returned string is the expanded
-    character set joined into a single string.
-    The values enclosed in the []'s may be:
-     - a single character
-     - an escaped character with a leading backslash (such as C{\-} or C{\]})
-     - an escaped hex character with a leading C{'\x'} (C{\x21}, which is a C{'!'} character) 
-         (C{\0x##} is also supported for backwards compatibility) 
-     - an escaped octal character with a leading C{'\0'} (C{\041}, which is a C{'!'} character)
-     - a range of any of the above, separated by a dash (C{'a-z'}, etc.)
-     - any combination of the above (C{'aeiouy'}, C{'a-zA-Z0-9_$'}, etc.)
-    """
-    _expanded = lambda p: p if not isinstance(p,ParseResults) else ''.join(unichr(c) for c in range(ord(p[0]),ord(p[1])+1))
-    try:
-        return "".join(_expanded(part) for part in _reBracketExpr.parseString(s).body)
-    except Exception:
-        return ""
-
-def matchOnlyAtCol(n):
-    """
-    Helper method for defining parse actions that require matching at a specific
-    column in the input text.
-    """
-    def verifyCol(strg,locn,toks):
-        if col(locn,strg) != n:
-            raise ParseException(strg,locn,"matched token not at column %d" % n)
-    return verifyCol
-
-def replaceWith(replStr):
-    """
-    Helper method for common parse actions that simply return a literal value.  Especially
-    useful when used with C{L{transformString}()}.
-
-    Example::
-        num = Word(nums).setParseAction(lambda toks: int(toks[0]))
-        na = oneOf("N/A NA").setParseAction(replaceWith(math.nan))
-        term = na | num
-        
-        OneOrMore(term).parseString("324 234 N/A 234") # -> [324, 234, nan, 234]
-    """
-    return lambda s,l,t: [replStr]
-
-def removeQuotes(s,l,t):
-    """
-    Helper parse action for removing quotation marks from parsed quoted strings.
-
-    Example::
-        # by default, quotation marks are included in parsed results
-        quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]
-
-        # use removeQuotes to strip quotation marks from parsed results
-        quotedString.setParseAction(removeQuotes)
-        quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["Now is the Winter of our Discontent"]
-    """
-    return t[0][1:-1]
-
-def tokenMap(func, *args):
-    """
-    Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional 
-    args are passed, they are forwarded to the given function as additional arguments after
-    the token, as in C{hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))}, which will convert the
-    parsed data to an integer using base 16.
-
-    Example (compare the last to example in L{ParserElement.transformString}::
-        hex_ints = OneOrMore(Word(hexnums)).setParseAction(tokenMap(int, 16))
-        hex_ints.runTests('''
-            00 11 22 aa FF 0a 0d 1a
-            ''')
-        
-        upperword = Word(alphas).setParseAction(tokenMap(str.upper))
-        OneOrMore(upperword).runTests('''
-            my kingdom for a horse
-            ''')
-
-        wd = Word(alphas).setParseAction(tokenMap(str.title))
-        OneOrMore(wd).setParseAction(' '.join).runTests('''
-            now is the winter of our discontent made glorious summer by this sun of york
-            ''')
-    prints::
-        00 11 22 aa FF 0a 0d 1a
-        [0, 17, 34, 170, 255, 10, 13, 26]
-
-        my kingdom for a horse
-        ['MY', 'KINGDOM', 'FOR', 'A', 'HORSE']
-
-        now is the winter of our discontent made glorious summer by this sun of york
-        ['Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York']
-    """
-    def pa(s,l,t):
-        return [func(tokn, *args) for tokn in t]
-
-    try:
-        func_name = getattr(func, '__name__', 
-                            getattr(func, '__class__').__name__)
-    except Exception:
-        func_name = str(func)
-    pa.__name__ = func_name
-
-    return pa
-
-upcaseTokens = tokenMap(lambda t: _ustr(t).upper())
-"""(Deprecated) Helper parse action to convert tokens to upper case. Deprecated in favor of L{pyparsing_common.upcaseTokens}"""
-
-downcaseTokens = tokenMap(lambda t: _ustr(t).lower())
-"""(Deprecated) Helper parse action to convert tokens to lower case. Deprecated in favor of L{pyparsing_common.downcaseTokens}"""
-    
-def _makeTags(tagStr, xml):
-    """Internal helper to construct opening and closing tag expressions, given a tag name"""
-    if isinstance(tagStr,basestring):
-        resname = tagStr
-        tagStr = Keyword(tagStr, caseless=not xml)
-    else:
-        resname = tagStr.name
-
-    tagAttrName = Word(alphas,alphanums+"_-:")
-    if (xml):
-        tagAttrValue = dblQuotedString.copy().setParseAction( removeQuotes )
-        openTag = Suppress("<") + tagStr("tag") + \
-                Dict(ZeroOrMore(Group( tagAttrName + Suppress("=") + tagAttrValue ))) + \
-                Optional("/",default=[False]).setResultsName("empty").setParseAction(lambda s,l,t:t[0]=='/') + Suppress(">")
-    else:
-        printablesLessRAbrack = "".join(c for c in printables if c not in ">")
-        tagAttrValue = quotedString.copy().setParseAction( removeQuotes ) | Word(printablesLessRAbrack)
-        openTag = Suppress("<") + tagStr("tag") + \
-                Dict(ZeroOrMore(Group( tagAttrName.setParseAction(downcaseTokens) + \
-                Optional( Suppress("=") + tagAttrValue ) ))) + \
-                Optional("/",default=[False]).setResultsName("empty").setParseAction(lambda s,l,t:t[0]=='/') + Suppress(">")
-    closeTag = Combine(_L("")
-
-    openTag = openTag.setResultsName("start"+"".join(resname.replace(":"," ").title().split())).setName("<%s>" % resname)
-    closeTag = closeTag.setResultsName("end"+"".join(resname.replace(":"," ").title().split())).setName("" % resname)
-    openTag.tag = resname
-    closeTag.tag = resname
-    return openTag, closeTag
-
-def makeHTMLTags(tagStr):
-    """
-    Helper to construct opening and closing tag expressions for HTML, given a tag name. Matches
-    tags in either upper or lower case, attributes with namespaces and with quoted or unquoted values.
-
-    Example::
-        text = 'More info at the pyparsing wiki page'
-        # makeHTMLTags returns pyparsing expressions for the opening and closing tags as a 2-tuple
-        a,a_end = makeHTMLTags("A")
-        link_expr = a + SkipTo(a_end)("link_text") + a_end
-        
-        for link in link_expr.searchString(text):
-            # attributes in the  tag (like "href" shown here) are also accessible as named results
-            print(link.link_text, '->', link.href)
-    prints::
-        pyparsing -> http://pyparsing.wikispaces.com
-    """
-    return _makeTags( tagStr, False )
-
-def makeXMLTags(tagStr):
-    """
-    Helper to construct opening and closing tag expressions for XML, given a tag name. Matches
-    tags only in the given upper/lower case.
-
-    Example: similar to L{makeHTMLTags}
-    """
-    return _makeTags( tagStr, True )
-
-def withAttribute(*args,**attrDict):
-    """
-    Helper to create a validating parse action to be used with start tags created
-    with C{L{makeXMLTags}} or C{L{makeHTMLTags}}. Use C{withAttribute} to qualify a starting tag
-    with a required attribute value, to avoid false matches on common tags such as
-    C{} or C{
}. - - Call C{withAttribute} with a series of attribute names and values. Specify the list - of filter attributes names and values as: - - keyword arguments, as in C{(align="right")}, or - - as an explicit dict with C{**} operator, when an attribute name is also a Python - reserved word, as in C{**{"class":"Customer", "align":"right"}} - - a list of name-value tuples, as in ( ("ns1:class", "Customer"), ("ns2:align","right") ) - For attribute names with a namespace prefix, you must use the second form. Attribute - names are matched insensitive to upper/lower case. - - If just testing for C{class} (with or without a namespace), use C{L{withClass}}. - - To verify that the attribute exists, but without specifying a value, pass - C{withAttribute.ANY_VALUE} as the value. - - Example:: - html = ''' -
- Some text -
1 4 0 1 0
-
1,3 2,3 1,1
-
this has no type
-
- - ''' - div,div_end = makeHTMLTags("div") - - # only match div tag having a type attribute with value "grid" - div_grid = div().setParseAction(withAttribute(type="grid")) - grid_expr = div_grid + SkipTo(div | div_end)("body") - for grid_header in grid_expr.searchString(html): - print(grid_header.body) - - # construct a match with any div tag having a type attribute, regardless of the value - div_any_type = div().setParseAction(withAttribute(type=withAttribute.ANY_VALUE)) - div_expr = div_any_type + SkipTo(div | div_end)("body") - for div_header in div_expr.searchString(html): - print(div_header.body) - prints:: - 1 4 0 1 0 - - 1 4 0 1 0 - 1,3 2,3 1,1 - """ - if args: - attrs = args[:] - else: - attrs = attrDict.items() - attrs = [(k,v) for k,v in attrs] - def pa(s,l,tokens): - for attrName,attrValue in attrs: - if attrName not in tokens: - raise ParseException(s,l,"no matching attribute " + attrName) - if attrValue != withAttribute.ANY_VALUE and tokens[attrName] != attrValue: - raise ParseException(s,l,"attribute '%s' has value '%s', must be '%s'" % - (attrName, tokens[attrName], attrValue)) - return pa -withAttribute.ANY_VALUE = object() - -def withClass(classname, namespace=''): - """ - Simplified version of C{L{withAttribute}} when matching on a div class - made - difficult because C{class} is a reserved word in Python. - - Example:: - html = ''' -
- Some text -
1 4 0 1 0
-
1,3 2,3 1,1
-
this <div> has no class
-
- - ''' - div,div_end = makeHTMLTags("div") - div_grid = div().setParseAction(withClass("grid")) - - grid_expr = div_grid + SkipTo(div | div_end)("body") - for grid_header in grid_expr.searchString(html): - print(grid_header.body) - - div_any_type = div().setParseAction(withClass(withAttribute.ANY_VALUE)) - div_expr = div_any_type + SkipTo(div | div_end)("body") - for div_header in div_expr.searchString(html): - print(div_header.body) - prints:: - 1 4 0 1 0 - - 1 4 0 1 0 - 1,3 2,3 1,1 - """ - classattr = "%s:class" % namespace if namespace else "class" - return withAttribute(**{classattr : classname}) - -opAssoc = _Constants() -opAssoc.LEFT = object() -opAssoc.RIGHT = object() - -def infixNotation( baseExpr, opList, lpar=Suppress('('), rpar=Suppress(')') ): - """ - Helper method for constructing grammars of expressions made up of - operators working in a precedence hierarchy. Operators may be unary or - binary, left- or right-associative. Parse actions can also be attached - to operator expressions. The generated parser will also recognize the use - of parentheses to override operator precedences (see example below). - - Note: if you define a deep operator list, you may see performance issues - when using infixNotation. See L{ParserElement.enablePackrat} for a - mechanism to potentially improve your parser performance. - - Parameters: - - baseExpr - expression representing the most basic element for the nested - - opList - list of tuples, one for each operator precedence level in the - expression grammar; each tuple is of the form - (opExpr, numTerms, rightLeftAssoc, parseAction), where: - - opExpr is the pyparsing expression for the operator; - may also be a string, which will be converted to a Literal; - if numTerms is 3, opExpr is a tuple of two expressions, for the - two operators separating the 3 terms - - numTerms is the number of terms for this operator (must - be 1, 2, or 3) - - rightLeftAssoc is the indicator whether the operator is - right or left associative, using the pyparsing-defined - constants C{opAssoc.RIGHT} and C{opAssoc.LEFT}. - - parseAction is the parse action to be associated with - expressions matching this operator expression (the - parse action tuple member may be omitted); if the parse action - is passed a tuple or list of functions, this is equivalent to - calling C{setParseAction(*fn)} (L{ParserElement.setParseAction}) - - lpar - expression for matching left-parentheses (default=C{Suppress('(')}) - - rpar - expression for matching right-parentheses (default=C{Suppress(')')}) - - Example:: - # simple example of four-function arithmetic with ints and variable names - integer = pyparsing_common.signed_integer - varname = pyparsing_common.identifier - - arith_expr = infixNotation(integer | varname, - [ - ('-', 1, opAssoc.RIGHT), - (oneOf('* /'), 2, opAssoc.LEFT), - (oneOf('+ -'), 2, opAssoc.LEFT), - ]) - - arith_expr.runTests(''' - 5+3*6 - (5+3)*6 - -2--11 - ''', fullDump=False) - prints:: - 5+3*6 - [[5, '+', [3, '*', 6]]] - - (5+3)*6 - [[[5, '+', 3], '*', 6]] - - -2--11 - [[['-', 2], '-', ['-', 11]]] - """ - ret = Forward() - lastExpr = baseExpr | ( lpar + ret + rpar ) - for i,operDef in enumerate(opList): - opExpr,arity,rightLeftAssoc,pa = (operDef + (None,))[:4] - termName = "%s term" % opExpr if arity < 3 else "%s%s term" % opExpr - if arity == 3: - if opExpr is None or len(opExpr) != 2: - raise ValueError("if numterms=3, opExpr must be a tuple or list of two expressions") - opExpr1, opExpr2 = opExpr - thisExpr = Forward().setName(termName) - if rightLeftAssoc == opAssoc.LEFT: - if arity == 1: - matchExpr = FollowedBy(lastExpr + opExpr) + Group( lastExpr + OneOrMore( opExpr ) ) - elif arity == 2: - if opExpr is not None: - matchExpr = FollowedBy(lastExpr + opExpr + lastExpr) + Group( lastExpr + OneOrMore( opExpr + lastExpr ) ) - else: - matchExpr = FollowedBy(lastExpr+lastExpr) + Group( lastExpr + OneOrMore(lastExpr) ) - elif arity == 3: - matchExpr = FollowedBy(lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr) + \ - Group( lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr ) - else: - raise ValueError("operator must be unary (1), binary (2), or ternary (3)") - elif rightLeftAssoc == opAssoc.RIGHT: - if arity == 1: - # try to avoid LR with this extra test - if not isinstance(opExpr, Optional): - opExpr = Optional(opExpr) - matchExpr = FollowedBy(opExpr.expr + thisExpr) + Group( opExpr + thisExpr ) - elif arity == 2: - if opExpr is not None: - matchExpr = FollowedBy(lastExpr + opExpr + thisExpr) + Group( lastExpr + OneOrMore( opExpr + thisExpr ) ) - else: - matchExpr = FollowedBy(lastExpr + thisExpr) + Group( lastExpr + OneOrMore( thisExpr ) ) - elif arity == 3: - matchExpr = FollowedBy(lastExpr + opExpr1 + thisExpr + opExpr2 + thisExpr) + \ - Group( lastExpr + opExpr1 + thisExpr + opExpr2 + thisExpr ) - else: - raise ValueError("operator must be unary (1), binary (2), or ternary (3)") - else: - raise ValueError("operator must indicate right or left associativity") - if pa: - if isinstance(pa, (tuple, list)): - matchExpr.setParseAction(*pa) - else: - matchExpr.setParseAction(pa) - thisExpr <<= ( matchExpr.setName(termName) | lastExpr ) - lastExpr = thisExpr - ret <<= lastExpr - return ret - -operatorPrecedence = infixNotation -"""(Deprecated) Former name of C{L{infixNotation}}, will be dropped in a future release.""" - -dblQuotedString = Combine(Regex(r'"(?:[^"\n\r\\]|(?:"")|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*')+'"').setName("string enclosed in double quotes") -sglQuotedString = Combine(Regex(r"'(?:[^'\n\r\\]|(?:'')|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*")+"'").setName("string enclosed in single quotes") -quotedString = Combine(Regex(r'"(?:[^"\n\r\\]|(?:"")|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*')+'"'| - Regex(r"'(?:[^'\n\r\\]|(?:'')|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*")+"'").setName("quotedString using single or double quotes") -unicodeString = Combine(_L('u') + quotedString.copy()).setName("unicode string literal") - -def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.copy()): - """ - Helper method for defining nested lists enclosed in opening and closing - delimiters ("(" and ")" are the default). - - Parameters: - - opener - opening character for a nested list (default=C{"("}); can also be a pyparsing expression - - closer - closing character for a nested list (default=C{")"}); can also be a pyparsing expression - - content - expression for items within the nested lists (default=C{None}) - - ignoreExpr - expression for ignoring opening and closing delimiters (default=C{quotedString}) - - If an expression is not provided for the content argument, the nested - expression will capture all whitespace-delimited content between delimiters - as a list of separate values. - - Use the C{ignoreExpr} argument to define expressions that may contain - opening or closing characters that should not be treated as opening - or closing characters for nesting, such as quotedString or a comment - expression. Specify multiple expressions using an C{L{Or}} or C{L{MatchFirst}}. - The default is L{quotedString}, but if no expressions are to be ignored, - then pass C{None} for this argument. - - Example:: - data_type = oneOf("void int short long char float double") - decl_data_type = Combine(data_type + Optional(Word('*'))) - ident = Word(alphas+'_', alphanums+'_') - number = pyparsing_common.number - arg = Group(decl_data_type + ident) - LPAR,RPAR = map(Suppress, "()") - - code_body = nestedExpr('{', '}', ignoreExpr=(quotedString | cStyleComment)) - - c_function = (decl_data_type("type") - + ident("name") - + LPAR + Optional(delimitedList(arg), [])("args") + RPAR - + code_body("body")) - c_function.ignore(cStyleComment) - - source_code = ''' - int is_odd(int x) { - return (x%2); - } - - int dec_to_hex(char hchar) { - if (hchar >= '0' && hchar <= '9') { - return (ord(hchar)-ord('0')); - } else { - return (10+ord(hchar)-ord('A')); - } - } - ''' - for func in c_function.searchString(source_code): - print("%(name)s (%(type)s) args: %(args)s" % func) - - prints:: - is_odd (int) args: [['int', 'x']] - dec_to_hex (int) args: [['char', 'hchar']] - """ - if opener == closer: - raise ValueError("opening and closing strings cannot be the same") - if content is None: - if isinstance(opener,basestring) and isinstance(closer,basestring): - if len(opener) == 1 and len(closer)==1: - if ignoreExpr is not None: - content = (Combine(OneOrMore(~ignoreExpr + - CharsNotIn(opener+closer+ParserElement.DEFAULT_WHITE_CHARS,exact=1)) - ).setParseAction(lambda t:t[0].strip())) - else: - content = (empty.copy()+CharsNotIn(opener+closer+ParserElement.DEFAULT_WHITE_CHARS - ).setParseAction(lambda t:t[0].strip())) - else: - if ignoreExpr is not None: - content = (Combine(OneOrMore(~ignoreExpr + - ~Literal(opener) + ~Literal(closer) + - CharsNotIn(ParserElement.DEFAULT_WHITE_CHARS,exact=1)) - ).setParseAction(lambda t:t[0].strip())) - else: - content = (Combine(OneOrMore(~Literal(opener) + ~Literal(closer) + - CharsNotIn(ParserElement.DEFAULT_WHITE_CHARS,exact=1)) - ).setParseAction(lambda t:t[0].strip())) - else: - raise ValueError("opening and closing arguments must be strings if no content expression is given") - ret = Forward() - if ignoreExpr is not None: - ret <<= Group( Suppress(opener) + ZeroOrMore( ignoreExpr | ret | content ) + Suppress(closer) ) - else: - ret <<= Group( Suppress(opener) + ZeroOrMore( ret | content ) + Suppress(closer) ) - ret.setName('nested %s%s expression' % (opener,closer)) - return ret - -def indentedBlock(blockStatementExpr, indentStack, indent=True): - """ - Helper method for defining space-delimited indentation blocks, such as - those used to define block statements in Python source code. - - Parameters: - - blockStatementExpr - expression defining syntax of statement that - is repeated within the indented block - - indentStack - list created by caller to manage indentation stack - (multiple statementWithIndentedBlock expressions within a single grammar - should share a common indentStack) - - indent - boolean indicating whether block must be indented beyond the - the current level; set to False for block of left-most statements - (default=C{True}) - - A valid block must contain at least one C{blockStatement}. - - Example:: - data = ''' - def A(z): - A1 - B = 100 - G = A2 - A2 - A3 - B - def BB(a,b,c): - BB1 - def BBA(): - bba1 - bba2 - bba3 - C - D - def spam(x,y): - def eggs(z): - pass - ''' - - - indentStack = [1] - stmt = Forward() - - identifier = Word(alphas, alphanums) - funcDecl = ("def" + identifier + Group( "(" + Optional( delimitedList(identifier) ) + ")" ) + ":") - func_body = indentedBlock(stmt, indentStack) - funcDef = Group( funcDecl + func_body ) - - rvalue = Forward() - funcCall = Group(identifier + "(" + Optional(delimitedList(rvalue)) + ")") - rvalue << (funcCall | identifier | Word(nums)) - assignment = Group(identifier + "=" + rvalue) - stmt << ( funcDef | assignment | identifier ) - - module_body = OneOrMore(stmt) - - parseTree = module_body.parseString(data) - parseTree.pprint() - prints:: - [['def', - 'A', - ['(', 'z', ')'], - ':', - [['A1'], [['B', '=', '100']], [['G', '=', 'A2']], ['A2'], ['A3']]], - 'B', - ['def', - 'BB', - ['(', 'a', 'b', 'c', ')'], - ':', - [['BB1'], [['def', 'BBA', ['(', ')'], ':', [['bba1'], ['bba2'], ['bba3']]]]]], - 'C', - 'D', - ['def', - 'spam', - ['(', 'x', 'y', ')'], - ':', - [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]] - """ - def checkPeerIndent(s,l,t): - if l >= len(s): return - curCol = col(l,s) - if curCol != indentStack[-1]: - if curCol > indentStack[-1]: - raise ParseFatalException(s,l,"illegal nesting") - raise ParseException(s,l,"not a peer entry") - - def checkSubIndent(s,l,t): - curCol = col(l,s) - if curCol > indentStack[-1]: - indentStack.append( curCol ) - else: - raise ParseException(s,l,"not a subentry") - - def checkUnindent(s,l,t): - if l >= len(s): return - curCol = col(l,s) - if not(indentStack and curCol < indentStack[-1] and curCol <= indentStack[-2]): - raise ParseException(s,l,"not an unindent") - indentStack.pop() - - NL = OneOrMore(LineEnd().setWhitespaceChars("\t ").suppress()) - INDENT = (Empty() + Empty().setParseAction(checkSubIndent)).setName('INDENT') - PEER = Empty().setParseAction(checkPeerIndent).setName('') - UNDENT = Empty().setParseAction(checkUnindent).setName('UNINDENT') - if indent: - smExpr = Group( Optional(NL) + - #~ FollowedBy(blockStatementExpr) + - INDENT + (OneOrMore( PEER + Group(blockStatementExpr) + Optional(NL) )) + UNDENT) - else: - smExpr = Group( Optional(NL) + - (OneOrMore( PEER + Group(blockStatementExpr) + Optional(NL) )) ) - blockStatementExpr.ignore(_bslash + LineEnd()) - return smExpr.setName('indented block') - -alphas8bit = srange(r"[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]") -punc8bit = srange(r"[\0xa1-\0xbf\0xd7\0xf7]") - -anyOpenTag,anyCloseTag = makeHTMLTags(Word(alphas,alphanums+"_:").setName('any tag')) -_htmlEntityMap = dict(zip("gt lt amp nbsp quot apos".split(),'><& "\'')) -commonHTMLEntity = Regex('&(?P' + '|'.join(_htmlEntityMap.keys()) +");").setName("common HTML entity") -def replaceHTMLEntity(t): - """Helper parser action to replace common HTML entities with their special characters""" - return _htmlEntityMap.get(t.entity) - -# it's easy to get these comment structures wrong - they're very common, so may as well make them available -cStyleComment = Combine(Regex(r"/\*(?:[^*]|\*(?!/))*") + '*/').setName("C style comment") -"Comment of the form C{/* ... */}" - -htmlComment = Regex(r"").setName("HTML comment") -"Comment of the form C{}" - -restOfLine = Regex(r".*").leaveWhitespace().setName("rest of line") -dblSlashComment = Regex(r"//(?:\\\n|[^\n])*").setName("// comment") -"Comment of the form C{// ... (to end of line)}" - -cppStyleComment = Combine(Regex(r"/\*(?:[^*]|\*(?!/))*") + '*/'| dblSlashComment).setName("C++ style comment") -"Comment of either form C{L{cStyleComment}} or C{L{dblSlashComment}}" - -javaStyleComment = cppStyleComment -"Same as C{L{cppStyleComment}}" - -pythonStyleComment = Regex(r"#.*").setName("Python style comment") -"Comment of the form C{# ... (to end of line)}" - -_commasepitem = Combine(OneOrMore(Word(printables, excludeChars=',') + - Optional( Word(" \t") + - ~Literal(",") + ~LineEnd() ) ) ).streamline().setName("commaItem") -commaSeparatedList = delimitedList( Optional( quotedString.copy() | _commasepitem, default="") ).setName("commaSeparatedList") -"""(Deprecated) Predefined expression of 1 or more printable words or quoted strings, separated by commas. - This expression is deprecated in favor of L{pyparsing_common.comma_separated_list}.""" - -# some other useful expressions - using lower-case class name since we are really using this as a namespace -class pyparsing_common: - """ - Here are some common low-level expressions that may be useful in jump-starting parser development: - - numeric forms (L{integers}, L{reals}, L{scientific notation}) - - common L{programming identifiers} - - network addresses (L{MAC}, L{IPv4}, L{IPv6}) - - ISO8601 L{dates} and L{datetime} - - L{UUID} - - L{comma-separated list} - Parse actions: - - C{L{convertToInteger}} - - C{L{convertToFloat}} - - C{L{convertToDate}} - - C{L{convertToDatetime}} - - C{L{stripHTMLTags}} - - C{L{upcaseTokens}} - - C{L{downcaseTokens}} - - Example:: - pyparsing_common.number.runTests(''' - # any int or real number, returned as the appropriate type - 100 - -100 - +100 - 3.14159 - 6.02e23 - 1e-12 - ''') - - pyparsing_common.fnumber.runTests(''' - # any int or real number, returned as float - 100 - -100 - +100 - 3.14159 - 6.02e23 - 1e-12 - ''') - - pyparsing_common.hex_integer.runTests(''' - # hex numbers - 100 - FF - ''') - - pyparsing_common.fraction.runTests(''' - # fractions - 1/2 - -3/4 - ''') - - pyparsing_common.mixed_integer.runTests(''' - # mixed fractions - 1 - 1/2 - -3/4 - 1-3/4 - ''') - - import uuid - pyparsing_common.uuid.setParseAction(tokenMap(uuid.UUID)) - pyparsing_common.uuid.runTests(''' - # uuid - 12345678-1234-5678-1234-567812345678 - ''') - prints:: - # any int or real number, returned as the appropriate type - 100 - [100] - - -100 - [-100] - - +100 - [100] - - 3.14159 - [3.14159] - - 6.02e23 - [6.02e+23] - - 1e-12 - [1e-12] - - # any int or real number, returned as float - 100 - [100.0] - - -100 - [-100.0] - - +100 - [100.0] - - 3.14159 - [3.14159] - - 6.02e23 - [6.02e+23] - - 1e-12 - [1e-12] - - # hex numbers - 100 - [256] - - FF - [255] - - # fractions - 1/2 - [0.5] - - -3/4 - [-0.75] - - # mixed fractions - 1 - [1] - - 1/2 - [0.5] - - -3/4 - [-0.75] - - 1-3/4 - [1.75] - - # uuid - 12345678-1234-5678-1234-567812345678 - [UUID('12345678-1234-5678-1234-567812345678')] - """ - - convertToInteger = tokenMap(int) - """ - Parse action for converting parsed integers to Python int - """ - - convertToFloat = tokenMap(float) - """ - Parse action for converting parsed numbers to Python float - """ - - integer = Word(nums).setName("integer").setParseAction(convertToInteger) - """expression that parses an unsigned integer, returns an int""" - - hex_integer = Word(hexnums).setName("hex integer").setParseAction(tokenMap(int,16)) - """expression that parses a hexadecimal integer, returns an int""" - - signed_integer = Regex(r'[+-]?\d+').setName("signed integer").setParseAction(convertToInteger) - """expression that parses an integer with optional leading sign, returns an int""" - - fraction = (signed_integer().setParseAction(convertToFloat) + '/' + signed_integer().setParseAction(convertToFloat)).setName("fraction") - """fractional expression of an integer divided by an integer, returns a float""" - fraction.addParseAction(lambda t: t[0]/t[-1]) - - mixed_integer = (fraction | signed_integer + Optional(Optional('-').suppress() + fraction)).setName("fraction or mixed integer-fraction") - """mixed integer of the form 'integer - fraction', with optional leading integer, returns float""" - mixed_integer.addParseAction(sum) - - real = Regex(r'[+-]?\d+\.\d*').setName("real number").setParseAction(convertToFloat) - """expression that parses a floating point number and returns a float""" - - sci_real = Regex(r'[+-]?\d+([eE][+-]?\d+|\.\d*([eE][+-]?\d+)?)').setName("real number with scientific notation").setParseAction(convertToFloat) - """expression that parses a floating point number with optional scientific notation and returns a float""" - - # streamlining this expression makes the docs nicer-looking - number = (sci_real | real | signed_integer).streamline() - """any numeric expression, returns the corresponding Python type""" - - fnumber = Regex(r'[+-]?\d+\.?\d*([eE][+-]?\d+)?').setName("fnumber").setParseAction(convertToFloat) - """any int or real number, returned as float""" - - identifier = Word(alphas+'_', alphanums+'_').setName("identifier") - """typical code identifier (leading alpha or '_', followed by 0 or more alphas, nums, or '_')""" - - ipv4_address = Regex(r'(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){3}').setName("IPv4 address") - "IPv4 address (C{0.0.0.0 - 255.255.255.255})" - - _ipv6_part = Regex(r'[0-9a-fA-F]{1,4}').setName("hex_integer") - _full_ipv6_address = (_ipv6_part + (':' + _ipv6_part)*7).setName("full IPv6 address") - _short_ipv6_address = (Optional(_ipv6_part + (':' + _ipv6_part)*(0,6)) + "::" + Optional(_ipv6_part + (':' + _ipv6_part)*(0,6))).setName("short IPv6 address") - _short_ipv6_address.addCondition(lambda t: sum(1 for tt in t if pyparsing_common._ipv6_part.matches(tt)) < 8) - _mixed_ipv6_address = ("::ffff:" + ipv4_address).setName("mixed IPv6 address") - ipv6_address = Combine((_full_ipv6_address | _mixed_ipv6_address | _short_ipv6_address).setName("IPv6 address")).setName("IPv6 address") - "IPv6 address (long, short, or mixed form)" - - mac_address = Regex(r'[0-9a-fA-F]{2}([:.-])[0-9a-fA-F]{2}(?:\1[0-9a-fA-F]{2}){4}').setName("MAC address") - "MAC address xx:xx:xx:xx:xx (may also have '-' or '.' delimiters)" - - @staticmethod - def convertToDate(fmt="%Y-%m-%d"): - """ - Helper to create a parse action for converting parsed date string to Python datetime.date - - Params - - - fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%d"}) - - Example:: - date_expr = pyparsing_common.iso8601_date.copy() - date_expr.setParseAction(pyparsing_common.convertToDate()) - print(date_expr.parseString("1999-12-31")) - prints:: - [datetime.date(1999, 12, 31)] - """ - def cvt_fn(s,l,t): - try: - return datetime.strptime(t[0], fmt).date() - except ValueError as ve: - raise ParseException(s, l, str(ve)) - return cvt_fn - - @staticmethod - def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"): - """ - Helper to create a parse action for converting parsed datetime string to Python datetime.datetime - - Params - - - fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%dT%H:%M:%S.%f"}) - - Example:: - dt_expr = pyparsing_common.iso8601_datetime.copy() - dt_expr.setParseAction(pyparsing_common.convertToDatetime()) - print(dt_expr.parseString("1999-12-31T23:59:59.999")) - prints:: - [datetime.datetime(1999, 12, 31, 23, 59, 59, 999000)] - """ - def cvt_fn(s,l,t): - try: - return datetime.strptime(t[0], fmt) - except ValueError as ve: - raise ParseException(s, l, str(ve)) - return cvt_fn - - iso8601_date = Regex(r'(?P\d{4})(?:-(?P\d\d)(?:-(?P\d\d))?)?').setName("ISO8601 date") - "ISO8601 date (C{yyyy-mm-dd})" - - iso8601_datetime = Regex(r'(?P\d{4})-(?P\d\d)-(?P\d\d)[T ](?P\d\d):(?P\d\d)(:(?P\d\d(\.\d*)?)?)?(?PZ|[+-]\d\d:?\d\d)?').setName("ISO8601 datetime") - "ISO8601 datetime (C{yyyy-mm-ddThh:mm:ss.s(Z|+-00:00)}) - trailing seconds, milliseconds, and timezone optional; accepts separating C{'T'} or C{' '}" - - uuid = Regex(r'[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}').setName("UUID") - "UUID (C{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx})" - - _html_stripper = anyOpenTag.suppress() | anyCloseTag.suppress() - @staticmethod - def stripHTMLTags(s, l, tokens): - """ - Parse action to remove HTML tags from web page HTML source - - Example:: - # strip HTML links from normal text - text = 'More info at the
pyparsing wiki page' - td,td_end = makeHTMLTags("TD") - table_text = td + SkipTo(td_end).setParseAction(pyparsing_common.stripHTMLTags)("body") + td_end - - print(table_text.parseString(text).body) # -> 'More info at the pyparsing wiki page' - """ - return pyparsing_common._html_stripper.transformString(tokens[0]) - - _commasepitem = Combine(OneOrMore(~Literal(",") + ~LineEnd() + Word(printables, excludeChars=',') - + Optional( White(" \t") ) ) ).streamline().setName("commaItem") - comma_separated_list = delimitedList( Optional( quotedString.copy() | _commasepitem, default="") ).setName("comma separated list") - """Predefined expression of 1 or more printable words or quoted strings, separated by commas.""" - - upcaseTokens = staticmethod(tokenMap(lambda t: _ustr(t).upper())) - """Parse action to convert tokens to upper case.""" - - downcaseTokens = staticmethod(tokenMap(lambda t: _ustr(t).lower())) - """Parse action to convert tokens to lower case.""" - - -if __name__ == "__main__": - - selectToken = CaselessLiteral("select") - fromToken = CaselessLiteral("from") - - ident = Word(alphas, alphanums + "_$") - - columnName = delimitedList(ident, ".", combine=True).setParseAction(upcaseTokens) - columnNameList = Group(delimitedList(columnName)).setName("columns") - columnSpec = ('*' | columnNameList) - - tableName = delimitedList(ident, ".", combine=True).setParseAction(upcaseTokens) - tableNameList = Group(delimitedList(tableName)).setName("tables") - - simpleSQL = selectToken("command") + columnSpec("columns") + fromToken + tableNameList("tables") - - # demo runTests method, including embedded comments in test string - simpleSQL.runTests(""" - # '*' as column list and dotted table name - select * from SYS.XYZZY - - # caseless match on "SELECT", and casts back to "select" - SELECT * from XYZZY, ABC - - # list of column names, and mixed case SELECT keyword - Select AA,BB,CC from Sys.dual - - # multiple tables - Select A, B, C from Sys.dual, Table2 - - # invalid SELECT keyword - should fail - Xelect A, B, C from Sys.dual - - # incomplete command - should fail - Select - - # invalid column name - should fail - Select ^^^ frox Sys.dual - - """) - - pyparsing_common.number.runTests(""" - 100 - -100 - +100 - 3.14159 - 6.02e23 - 1e-12 - """) - - # any int or real number, returned as float - pyparsing_common.fnumber.runTests(""" - 100 - -100 - +100 - 3.14159 - 6.02e23 - 1e-12 - """) - - pyparsing_common.hex_integer.runTests(""" - 100 - FF - """) - - import uuid - pyparsing_common.uuid.setParseAction(tokenMap(uuid.UUID)) - pyparsing_common.uuid.runTests(""" - 12345678-1234-5678-1234-567812345678 - """) diff --git a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/six.py b/venv/lib/python3.8/site-packages/pkg_resources/_vendor/six.py deleted file mode 100644 index 190c0239cd7d7af82a6e0cbc8d68053fa2e3dfaf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/pkg_resources/_vendor/six.py +++ /dev/null @@ -1,868 +0,0 @@ -"""Utilities for writing code that runs on Python 2 and 3""" - -# Copyright (c) 2010-2015 Benjamin Peterson -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from __future__ import absolute_import - -import functools -import itertools -import operator -import sys -import types - -__author__ = "Benjamin Peterson " -__version__ = "1.10.0" - - -# Useful for very coarse version differentiation. -PY2 = sys.version_info[0] == 2 -PY3 = sys.version_info[0] == 3 -PY34 = sys.version_info[0:2] >= (3, 4) - -if PY3: - string_types = str, - integer_types = int, - class_types = type, - text_type = str - binary_type = bytes - - MAXSIZE = sys.maxsize -else: - string_types = basestring, - integer_types = (int, long) - class_types = (type, types.ClassType) - text_type = unicode - binary_type = str - - if sys.platform.startswith("java"): - # Jython always uses 32 bits. - MAXSIZE = int((1 << 31) - 1) - else: - # It's possible to have sizeof(long) != sizeof(Py_ssize_t). - class X(object): - - def __len__(self): - return 1 << 31 - try: - len(X()) - except OverflowError: - # 32-bit - MAXSIZE = int((1 << 31) - 1) - else: - # 64-bit - MAXSIZE = int((1 << 63) - 1) - del X - - -def _add_doc(func, doc): - """Add documentation to a function.""" - func.__doc__ = doc - - -def _import_module(name): - """Import module, returning the module after the last dot.""" - __import__(name) - return sys.modules[name] - - -class _LazyDescr(object): - - def __init__(self, name): - self.name = name - - def __get__(self, obj, tp): - result = self._resolve() - setattr(obj, self.name, result) # Invokes __set__. - try: - # This is a bit ugly, but it avoids running this again by - # removing this descriptor. - delattr(obj.__class__, self.name) - except AttributeError: - pass - return result - - -class MovedModule(_LazyDescr): - - def __init__(self, name, old, new=None): - super(MovedModule, self).__init__(name) - if PY3: - if new is None: - new = name - self.mod = new - else: - self.mod = old - - def _resolve(self): - return _import_module(self.mod) - - def __getattr__(self, attr): - _module = self._resolve() - value = getattr(_module, attr) - setattr(self, attr, value) - return value - - -class _LazyModule(types.ModuleType): - - def __init__(self, name): - super(_LazyModule, self).__init__(name) - self.__doc__ = self.__class__.__doc__ - - def __dir__(self): - attrs = ["__doc__", "__name__"] - attrs += [attr.name for attr in self._moved_attributes] - return attrs - - # Subclasses should override this - _moved_attributes = [] - - -class MovedAttribute(_LazyDescr): - - def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): - super(MovedAttribute, self).__init__(name) - if PY3: - if new_mod is None: - new_mod = name - self.mod = new_mod - if new_attr is None: - if old_attr is None: - new_attr = name - else: - new_attr = old_attr - self.attr = new_attr - else: - self.mod = old_mod - if old_attr is None: - old_attr = name - self.attr = old_attr - - def _resolve(self): - module = _import_module(self.mod) - return getattr(module, self.attr) - - -class _SixMetaPathImporter(object): - - """ - A meta path importer to import six.moves and its submodules. - - This class implements a PEP302 finder and loader. It should be compatible - with Python 2.5 and all existing versions of Python3 - """ - - def __init__(self, six_module_name): - self.name = six_module_name - self.known_modules = {} - - def _add_module(self, mod, *fullnames): - for fullname in fullnames: - self.known_modules[self.name + "." + fullname] = mod - - def _get_module(self, fullname): - return self.known_modules[self.name + "." + fullname] - - def find_module(self, fullname, path=None): - if fullname in self.known_modules: - return self - return None - - def __get_module(self, fullname): - try: - return self.known_modules[fullname] - except KeyError: - raise ImportError("This loader does not know module " + fullname) - - def load_module(self, fullname): - try: - # in case of a reload - return sys.modules[fullname] - except KeyError: - pass - mod = self.__get_module(fullname) - if isinstance(mod, MovedModule): - mod = mod._resolve() - else: - mod.__loader__ = self - sys.modules[fullname] = mod - return mod - - def is_package(self, fullname): - """ - Return true, if the named module is a package. - - We need this method to get correct spec objects with - Python 3.4 (see PEP451) - """ - return hasattr(self.__get_module(fullname), "__path__") - - def get_code(self, fullname): - """Return None - - Required, if is_package is implemented""" - self.__get_module(fullname) # eventually raises ImportError - return None - get_source = get_code # same as get_code - -_importer = _SixMetaPathImporter(__name__) - - -class _MovedItems(_LazyModule): - - """Lazy loading of moved objects""" - __path__ = [] # mark as package - - -_moved_attributes = [ - MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), - MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), - MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"), - MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), - MovedAttribute("intern", "__builtin__", "sys"), - MovedAttribute("map", "itertools", "builtins", "imap", "map"), - MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"), - MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"), - MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"), - MovedAttribute("reduce", "__builtin__", "functools"), - MovedAttribute("shlex_quote", "pipes", "shlex", "quote"), - MovedAttribute("StringIO", "StringIO", "io"), - MovedAttribute("UserDict", "UserDict", "collections"), - MovedAttribute("UserList", "UserList", "collections"), - MovedAttribute("UserString", "UserString", "collections"), - MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), - MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"), - MovedModule("builtins", "__builtin__"), - MovedModule("configparser", "ConfigParser"), - MovedModule("copyreg", "copy_reg"), - MovedModule("dbm_gnu", "gdbm", "dbm.gnu"), - MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"), - MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), - MovedModule("http_cookies", "Cookie", "http.cookies"), - MovedModule("html_entities", "htmlentitydefs", "html.entities"), - MovedModule("html_parser", "HTMLParser", "html.parser"), - MovedModule("http_client", "httplib", "http.client"), - MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), - MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"), - MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), - MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), - MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), - MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), - MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), - MovedModule("cPickle", "cPickle", "pickle"), - MovedModule("queue", "Queue"), - MovedModule("reprlib", "repr"), - MovedModule("socketserver", "SocketServer"), - MovedModule("_thread", "thread", "_thread"), - MovedModule("tkinter", "Tkinter"), - MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), - MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), - MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), - MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), - MovedModule("tkinter_tix", "Tix", "tkinter.tix"), - MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"), - MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), - MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), - MovedModule("tkinter_colorchooser", "tkColorChooser", - "tkinter.colorchooser"), - MovedModule("tkinter_commondialog", "tkCommonDialog", - "tkinter.commondialog"), - MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), - MovedModule("tkinter_font", "tkFont", "tkinter.font"), - MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), - MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", - "tkinter.simpledialog"), - MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"), - MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"), - MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"), - MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), - MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"), - MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"), -] -# Add windows specific modules. -if sys.platform == "win32": - _moved_attributes += [ - MovedModule("winreg", "_winreg"), - ] - -for attr in _moved_attributes: - setattr(_MovedItems, attr.name, attr) - if isinstance(attr, MovedModule): - _importer._add_module(attr, "moves." + attr.name) -del attr - -_MovedItems._moved_attributes = _moved_attributes - -moves = _MovedItems(__name__ + ".moves") -_importer._add_module(moves, "moves") - - -class Module_six_moves_urllib_parse(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_parse""" - - -_urllib_parse_moved_attributes = [ - MovedAttribute("ParseResult", "urlparse", "urllib.parse"), - MovedAttribute("SplitResult", "urlparse", "urllib.parse"), - MovedAttribute("parse_qs", "urlparse", "urllib.parse"), - MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), - MovedAttribute("urldefrag", "urlparse", "urllib.parse"), - MovedAttribute("urljoin", "urlparse", "urllib.parse"), - MovedAttribute("urlparse", "urlparse", "urllib.parse"), - MovedAttribute("urlsplit", "urlparse", "urllib.parse"), - MovedAttribute("urlunparse", "urlparse", "urllib.parse"), - MovedAttribute("urlunsplit", "urlparse", "urllib.parse"), - MovedAttribute("quote", "urllib", "urllib.parse"), - MovedAttribute("quote_plus", "urllib", "urllib.parse"), - MovedAttribute("unquote", "urllib", "urllib.parse"), - MovedAttribute("unquote_plus", "urllib", "urllib.parse"), - MovedAttribute("urlencode", "urllib", "urllib.parse"), - MovedAttribute("splitquery", "urllib", "urllib.parse"), - MovedAttribute("splittag", "urllib", "urllib.parse"), - MovedAttribute("splituser", "urllib", "urllib.parse"), - MovedAttribute("uses_fragment", "urlparse", "urllib.parse"), - MovedAttribute("uses_netloc", "urlparse", "urllib.parse"), - MovedAttribute("uses_params", "urlparse", "urllib.parse"), - MovedAttribute("uses_query", "urlparse", "urllib.parse"), - MovedAttribute("uses_relative", "urlparse", "urllib.parse"), -] -for attr in _urllib_parse_moved_attributes: - setattr(Module_six_moves_urllib_parse, attr.name, attr) -del attr - -Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes - -_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"), - "moves.urllib_parse", "moves.urllib.parse") - - -class Module_six_moves_urllib_error(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_error""" - - -_urllib_error_moved_attributes = [ - MovedAttribute("URLError", "urllib2", "urllib.error"), - MovedAttribute("HTTPError", "urllib2", "urllib.error"), - MovedAttribute("ContentTooShortError", "urllib", "urllib.error"), -] -for attr in _urllib_error_moved_attributes: - setattr(Module_six_moves_urllib_error, attr.name, attr) -del attr - -Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes - -_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"), - "moves.urllib_error", "moves.urllib.error") - - -class Module_six_moves_urllib_request(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_request""" - - -_urllib_request_moved_attributes = [ - MovedAttribute("urlopen", "urllib2", "urllib.request"), - MovedAttribute("install_opener", "urllib2", "urllib.request"), - MovedAttribute("build_opener", "urllib2", "urllib.request"), - MovedAttribute("pathname2url", "urllib", "urllib.request"), - MovedAttribute("url2pathname", "urllib", "urllib.request"), - MovedAttribute("getproxies", "urllib", "urllib.request"), - MovedAttribute("Request", "urllib2", "urllib.request"), - MovedAttribute("OpenerDirector", "urllib2", "urllib.request"), - MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"), - MovedAttribute("ProxyHandler", "urllib2", "urllib.request"), - MovedAttribute("BaseHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"), - MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"), - MovedAttribute("FileHandler", "urllib2", "urllib.request"), - MovedAttribute("FTPHandler", "urllib2", "urllib.request"), - MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"), - MovedAttribute("UnknownHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"), - MovedAttribute("urlretrieve", "urllib", "urllib.request"), - MovedAttribute("urlcleanup", "urllib", "urllib.request"), - MovedAttribute("URLopener", "urllib", "urllib.request"), - MovedAttribute("FancyURLopener", "urllib", "urllib.request"), - MovedAttribute("proxy_bypass", "urllib", "urllib.request"), -] -for attr in _urllib_request_moved_attributes: - setattr(Module_six_moves_urllib_request, attr.name, attr) -del attr - -Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes - -_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"), - "moves.urllib_request", "moves.urllib.request") - - -class Module_six_moves_urllib_response(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_response""" - - -_urllib_response_moved_attributes = [ - MovedAttribute("addbase", "urllib", "urllib.response"), - MovedAttribute("addclosehook", "urllib", "urllib.response"), - MovedAttribute("addinfo", "urllib", "urllib.response"), - MovedAttribute("addinfourl", "urllib", "urllib.response"), -] -for attr in _urllib_response_moved_attributes: - setattr(Module_six_moves_urllib_response, attr.name, attr) -del attr - -Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes - -_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"), - "moves.urllib_response", "moves.urllib.response") - - -class Module_six_moves_urllib_robotparser(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_robotparser""" - - -_urllib_robotparser_moved_attributes = [ - MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"), -] -for attr in _urllib_robotparser_moved_attributes: - setattr(Module_six_moves_urllib_robotparser, attr.name, attr) -del attr - -Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes - -_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"), - "moves.urllib_robotparser", "moves.urllib.robotparser") - - -class Module_six_moves_urllib(types.ModuleType): - - """Create a six.moves.urllib namespace that resembles the Python 3 namespace""" - __path__ = [] # mark as package - parse = _importer._get_module("moves.urllib_parse") - error = _importer._get_module("moves.urllib_error") - request = _importer._get_module("moves.urllib_request") - response = _importer._get_module("moves.urllib_response") - robotparser = _importer._get_module("moves.urllib_robotparser") - - def __dir__(self): - return ['parse', 'error', 'request', 'response', 'robotparser'] - -_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"), - "moves.urllib") - - -def add_move(move): - """Add an item to six.moves.""" - setattr(_MovedItems, move.name, move) - - -def remove_move(name): - """Remove item from six.moves.""" - try: - delattr(_MovedItems, name) - except AttributeError: - try: - del moves.__dict__[name] - except KeyError: - raise AttributeError("no such move, %r" % (name,)) - - -if PY3: - _meth_func = "__func__" - _meth_self = "__self__" - - _func_closure = "__closure__" - _func_code = "__code__" - _func_defaults = "__defaults__" - _func_globals = "__globals__" -else: - _meth_func = "im_func" - _meth_self = "im_self" - - _func_closure = "func_closure" - _func_code = "func_code" - _func_defaults = "func_defaults" - _func_globals = "func_globals" - - -try: - advance_iterator = next -except NameError: - def advance_iterator(it): - return it.next() -next = advance_iterator - - -try: - callable = callable -except NameError: - def callable(obj): - return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) - - -if PY3: - def get_unbound_function(unbound): - return unbound - - create_bound_method = types.MethodType - - def create_unbound_method(func, cls): - return func - - Iterator = object -else: - def get_unbound_function(unbound): - return unbound.im_func - - def create_bound_method(func, obj): - return types.MethodType(func, obj, obj.__class__) - - def create_unbound_method(func, cls): - return types.MethodType(func, None, cls) - - class Iterator(object): - - def next(self): - return type(self).__next__(self) - - callable = callable -_add_doc(get_unbound_function, - """Get the function out of a possibly unbound function""") - - -get_method_function = operator.attrgetter(_meth_func) -get_method_self = operator.attrgetter(_meth_self) -get_function_closure = operator.attrgetter(_func_closure) -get_function_code = operator.attrgetter(_func_code) -get_function_defaults = operator.attrgetter(_func_defaults) -get_function_globals = operator.attrgetter(_func_globals) - - -if PY3: - def iterkeys(d, **kw): - return iter(d.keys(**kw)) - - def itervalues(d, **kw): - return iter(d.values(**kw)) - - def iteritems(d, **kw): - return iter(d.items(**kw)) - - def iterlists(d, **kw): - return iter(d.lists(**kw)) - - viewkeys = operator.methodcaller("keys") - - viewvalues = operator.methodcaller("values") - - viewitems = operator.methodcaller("items") -else: - def iterkeys(d, **kw): - return d.iterkeys(**kw) - - def itervalues(d, **kw): - return d.itervalues(**kw) - - def iteritems(d, **kw): - return d.iteritems(**kw) - - def iterlists(d, **kw): - return d.iterlists(**kw) - - viewkeys = operator.methodcaller("viewkeys") - - viewvalues = operator.methodcaller("viewvalues") - - viewitems = operator.methodcaller("viewitems") - -_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.") -_add_doc(itervalues, "Return an iterator over the values of a dictionary.") -_add_doc(iteritems, - "Return an iterator over the (key, value) pairs of a dictionary.") -_add_doc(iterlists, - "Return an iterator over the (key, [values]) pairs of a dictionary.") - - -if PY3: - def b(s): - return s.encode("latin-1") - - def u(s): - return s - unichr = chr - import struct - int2byte = struct.Struct(">B").pack - del struct - byte2int = operator.itemgetter(0) - indexbytes = operator.getitem - iterbytes = iter - import io - StringIO = io.StringIO - BytesIO = io.BytesIO - _assertCountEqual = "assertCountEqual" - if sys.version_info[1] <= 1: - _assertRaisesRegex = "assertRaisesRegexp" - _assertRegex = "assertRegexpMatches" - else: - _assertRaisesRegex = "assertRaisesRegex" - _assertRegex = "assertRegex" -else: - def b(s): - return s - # Workaround for standalone backslash - - def u(s): - return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") - unichr = unichr - int2byte = chr - - def byte2int(bs): - return ord(bs[0]) - - def indexbytes(buf, i): - return ord(buf[i]) - iterbytes = functools.partial(itertools.imap, ord) - import StringIO - StringIO = BytesIO = StringIO.StringIO - _assertCountEqual = "assertItemsEqual" - _assertRaisesRegex = "assertRaisesRegexp" - _assertRegex = "assertRegexpMatches" -_add_doc(b, """Byte literal""") -_add_doc(u, """Text literal""") - - -def assertCountEqual(self, *args, **kwargs): - return getattr(self, _assertCountEqual)(*args, **kwargs) - - -def assertRaisesRegex(self, *args, **kwargs): - return getattr(self, _assertRaisesRegex)(*args, **kwargs) - - -def assertRegex(self, *args, **kwargs): - return getattr(self, _assertRegex)(*args, **kwargs) - - -if PY3: - exec_ = getattr(moves.builtins, "exec") - - def reraise(tp, value, tb=None): - if value is None: - value = tp() - if value.__traceback__ is not tb: - raise value.with_traceback(tb) - raise value - -else: - def exec_(_code_, _globs_=None, _locs_=None): - """Execute code in a namespace.""" - if _globs_ is None: - frame = sys._getframe(1) - _globs_ = frame.f_globals - if _locs_ is None: - _locs_ = frame.f_locals - del frame - elif _locs_ is None: - _locs_ = _globs_ - exec("""exec _code_ in _globs_, _locs_""") - - exec_("""def reraise(tp, value, tb=None): - raise tp, value, tb -""") - - -if sys.version_info[:2] == (3, 2): - exec_("""def raise_from(value, from_value): - if from_value is None: - raise value - raise value from from_value -""") -elif sys.version_info[:2] > (3, 2): - exec_("""def raise_from(value, from_value): - raise value from from_value -""") -else: - def raise_from(value, from_value): - raise value - - -print_ = getattr(moves.builtins, "print", None) -if print_ is None: - def print_(*args, **kwargs): - """The new-style print function for Python 2.4 and 2.5.""" - fp = kwargs.pop("file", sys.stdout) - if fp is None: - return - - def write(data): - if not isinstance(data, basestring): - data = str(data) - # If the file has an encoding, encode unicode with it. - if (isinstance(fp, file) and - isinstance(data, unicode) and - fp.encoding is not None): - errors = getattr(fp, "errors", None) - if errors is None: - errors = "strict" - data = data.encode(fp.encoding, errors) - fp.write(data) - want_unicode = False - sep = kwargs.pop("sep", None) - if sep is not None: - if isinstance(sep, unicode): - want_unicode = True - elif not isinstance(sep, str): - raise TypeError("sep must be None or a string") - end = kwargs.pop("end", None) - if end is not None: - if isinstance(end, unicode): - want_unicode = True - elif not isinstance(end, str): - raise TypeError("end must be None or a string") - if kwargs: - raise TypeError("invalid keyword arguments to print()") - if not want_unicode: - for arg in args: - if isinstance(arg, unicode): - want_unicode = True - break - if want_unicode: - newline = unicode("\n") - space = unicode(" ") - else: - newline = "\n" - space = " " - if sep is None: - sep = space - if end is None: - end = newline - for i, arg in enumerate(args): - if i: - write(sep) - write(arg) - write(end) -if sys.version_info[:2] < (3, 3): - _print = print_ - - def print_(*args, **kwargs): - fp = kwargs.get("file", sys.stdout) - flush = kwargs.pop("flush", False) - _print(*args, **kwargs) - if flush and fp is not None: - fp.flush() - -_add_doc(reraise, """Reraise an exception.""") - -if sys.version_info[0:2] < (3, 4): - def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, - updated=functools.WRAPPER_UPDATES): - def wrapper(f): - f = functools.wraps(wrapped, assigned, updated)(f) - f.__wrapped__ = wrapped - return f - return wrapper -else: - wraps = functools.wraps - - -def with_metaclass(meta, *bases): - """Create a base class with a metaclass.""" - # This requires a bit of explanation: the basic idea is to make a dummy - # metaclass for one level of class instantiation that replaces itself with - # the actual metaclass. - class metaclass(meta): - - def __new__(cls, name, this_bases, d): - return meta(name, bases, d) - return type.__new__(metaclass, 'temporary_class', (), {}) - - -def add_metaclass(metaclass): - """Class decorator for creating a class with a metaclass.""" - def wrapper(cls): - orig_vars = cls.__dict__.copy() - slots = orig_vars.get('__slots__') - if slots is not None: - if isinstance(slots, str): - slots = [slots] - for slots_var in slots: - orig_vars.pop(slots_var) - orig_vars.pop('__dict__', None) - orig_vars.pop('__weakref__', None) - return metaclass(cls.__name__, cls.__bases__, orig_vars) - return wrapper - - -def python_2_unicode_compatible(klass): - """ - A decorator that defines __unicode__ and __str__ methods under Python 2. - Under Python 3 it does nothing. - - To support Python 2 and 3 with a single code base, define a __str__ method - returning text and apply this decorator to the class. - """ - if PY2: - if '__str__' not in klass.__dict__: - raise ValueError("@python_2_unicode_compatible cannot be applied " - "to %s because it doesn't define __str__()." % - klass.__name__) - klass.__unicode__ = klass.__str__ - klass.__str__ = lambda self: self.__unicode__().encode('utf-8') - return klass - - -# Complete the moves implementation. -# This code is at the end of this module to speed up module loading. -# Turn this module into a package. -__path__ = [] # required for PEP 302 and PEP 451 -__package__ = __name__ # see PEP 366 @ReservedAssignment -if globals().get("__spec__") is not None: - __spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable -# Remove other six meta path importers, since they cause problems. This can -# happen if six is removed from sys.modules and then reloaded. (Setuptools does -# this for some reason.) -if sys.meta_path: - for i, importer in enumerate(sys.meta_path): - # Here's some real nastiness: Another "instance" of the six module might - # be floating around. Therefore, we can't use isinstance() to check for - # the six meta path importer, since the other six instance will have - # inserted an importer with different class. - if (type(importer).__name__ == "_SixMetaPathImporter" and - importer.name == __name__): - del sys.meta_path[i] - break - del i, importer -# Finally, add the importer to the meta path import hook. -sys.meta_path.append(_importer) diff --git a/venv/lib/python3.8/site-packages/pkg_resources/extern/__init__.py b/venv/lib/python3.8/site-packages/pkg_resources/extern/__init__.py deleted file mode 100644 index c1eb9e998f8e117c82c176bc83ab1d350c729cd7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/pkg_resources/extern/__init__.py +++ /dev/null @@ -1,73 +0,0 @@ -import sys - - -class VendorImporter: - """ - A PEP 302 meta path importer for finding optionally-vendored - or otherwise naturally-installed packages from root_name. - """ - - def __init__(self, root_name, vendored_names=(), vendor_pkg=None): - self.root_name = root_name - self.vendored_names = set(vendored_names) - self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor') - - @property - def search_path(self): - """ - Search first the vendor package then as a natural package. - """ - yield self.vendor_pkg + '.' - yield '' - - def find_module(self, fullname, path=None): - """ - Return self when fullname starts with root_name and the - target module is one vendored through this importer. - """ - root, base, target = fullname.partition(self.root_name + '.') - if root: - return - if not any(map(target.startswith, self.vendored_names)): - return - return self - - def load_module(self, fullname): - """ - Iterate over the search path to locate and load fullname. - """ - root, base, target = fullname.partition(self.root_name + '.') - for prefix in self.search_path: - try: - extant = prefix + target - __import__(extant) - mod = sys.modules[extant] - sys.modules[fullname] = mod - # mysterious hack: - # Remove the reference to the extant package/module - # on later Python versions to cause relative imports - # in the vendor package to resolve the same modules - # as those going through this importer. - if prefix and sys.version_info > (3, 3): - del sys.modules[extant] - return mod - except ImportError: - pass - else: - raise ImportError( - "The '{target}' package is required; " - "normally this is bundled with this package so if you get " - "this warning, consult the packager of your " - "distribution.".format(**locals()) - ) - - def install(self): - """ - Install this importer into sys.meta_path if not already present. - """ - if self not in sys.meta_path: - sys.meta_path.append(self) - - -names = 'packaging', 'pyparsing', 'six', 'appdirs' -VendorImporter(__name__, names).install() diff --git a/venv/lib/python3.8/site-packages/pkg_resources/extern/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/pkg_resources/extern/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 54545dbd94eb06093f37a0c0f2df1bb7db4e7aa6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/pkg_resources/extern/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/pkg_resources/py31compat.py b/venv/lib/python3.8/site-packages/pkg_resources/py31compat.py deleted file mode 100644 index a381c424f9eaacb4126d4b8a474052551e34ccfb..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/pkg_resources/py31compat.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import errno -import sys - -from .extern import six - - -def _makedirs_31(path, exist_ok=False): - try: - os.makedirs(path) - except OSError as exc: - if not exist_ok or exc.errno != errno.EEXIST: - raise - - -# rely on compatibility behavior until mode considerations -# and exists_ok considerations are disentangled. -# See https://github.com/pypa/setuptools/pull/1083#issuecomment-315168663 -needs_makedirs = ( - six.PY2 or - (3, 4) <= sys.version_info < (3, 4, 1) -) -makedirs = _makedirs_31 if needs_makedirs else os.makedirs diff --git a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/LICENSE b/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/LICENSE deleted file mode 100644 index 67db8588217f266eb561f75fae738656325deac9..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/LICENSE +++ /dev/null @@ -1,175 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. diff --git a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/METADATA b/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/METADATA deleted file mode 100644 index 05779fa29c14fc279c2f4a8e13993f9add4e18a9..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/METADATA +++ /dev/null @@ -1,122 +0,0 @@ -Metadata-Version: 2.1 -Name: requests -Version: 2.31.0 -Summary: Python HTTP for Humans. -Home-page: https://requests.readthedocs.io -Author: Kenneth Reitz -Author-email: me@kennethreitz.org -License: Apache 2.0 -Project-URL: Documentation, https://requests.readthedocs.io -Project-URL: Source, https://github.com/psf/requests -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Web Environment -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Natural Language :: English -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Internet :: WWW/HTTP -Classifier: Topic :: Software Development :: Libraries -Requires-Python: >=3.7 -Description-Content-Type: text/markdown -License-File: LICENSE -Requires-Dist: charset-normalizer (<4,>=2) -Requires-Dist: idna (<4,>=2.5) -Requires-Dist: urllib3 (<3,>=1.21.1) -Requires-Dist: certifi (>=2017.4.17) -Provides-Extra: security -Provides-Extra: socks -Requires-Dist: PySocks (!=1.5.7,>=1.5.6) ; extra == 'socks' -Provides-Extra: use_chardet_on_py3 -Requires-Dist: chardet (<6,>=3.0.2) ; extra == 'use_chardet_on_py3' - -# Requests - -**Requests** is a simple, yet elegant, HTTP library. - -```python ->>> import requests ->>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass')) ->>> r.status_code -200 ->>> r.headers['content-type'] -'application/json; charset=utf8' ->>> r.encoding -'utf-8' ->>> r.text -'{"authenticated": true, ...' ->>> r.json() -{'authenticated': True, ...} -``` - -Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your `PUT` & `POST` data — but nowadays, just use the `json` method! - -Requests is one of the most downloaded Python packages today, pulling in around `30M downloads / week`— according to GitHub, Requests is currently [depended upon](https://github.com/psf/requests/network/dependents?package_id=UGFja2FnZS01NzA4OTExNg%3D%3D) by `1,000,000+` repositories. You may certainly put your trust in this code. - -[![Downloads](https://pepy.tech/badge/requests/month)](https://pepy.tech/project/requests) -[![Supported Versions](https://img.shields.io/pypi/pyversions/requests.svg)](https://pypi.org/project/requests) -[![Contributors](https://img.shields.io/github/contributors/psf/requests.svg)](https://github.com/psf/requests/graphs/contributors) - -## Installing Requests and Supported Versions - -Requests is available on PyPI: - -```console -$ python -m pip install requests -``` - -Requests officially supports Python 3.7+. - -## Supported Features & Best–Practices - -Requests is ready for the demands of building robust and reliable HTTP–speaking applications, for the needs of today. - -- Keep-Alive & Connection Pooling -- International Domains and URLs -- Sessions with Cookie Persistence -- Browser-style TLS/SSL Verification -- Basic & Digest Authentication -- Familiar `dict`–like Cookies -- Automatic Content Decompression and Decoding -- Multi-part File Uploads -- SOCKS Proxy Support -- Connection Timeouts -- Streaming Downloads -- Automatic honoring of `.netrc` -- Chunked HTTP Requests - -## API Reference and User Guide available on [Read the Docs](https://requests.readthedocs.io) - -[![Read the Docs](https://raw.githubusercontent.com/psf/requests/main/ext/ss.png)](https://requests.readthedocs.io) - -## Cloning the repository - -When cloning the Requests repository, you may need to add the `-c -fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad commit (see -[this issue](https://github.com/psf/requests/issues/2690) for more background): - -```shell -git clone -c fetch.fsck.badTimezone=ignore https://github.com/psf/requests.git -``` - -You can also apply this setting to your global Git config: - -```shell -git config --global fetch.fsck.badTimezone ignore -``` - ---- - -[![Kenneth Reitz](https://raw.githubusercontent.com/psf/requests/main/ext/kr.png)](https://kennethreitz.org) [![Python Software Foundation](https://raw.githubusercontent.com/psf/requests/main/ext/psf.png)](https://www.python.org/psf) - - diff --git a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/RECORD b/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/RECORD deleted file mode 100644 index a37d50f720e08709f9fac1e89b22549a6ecee1aa..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/RECORD +++ /dev/null @@ -1,42 +0,0 @@ -requests-2.31.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -requests-2.31.0.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142 -requests-2.31.0.dist-info/METADATA,sha256=eCPokOnbb0FROLrfl0R5EpDvdufsb9CaN4noJH__54I,4634 -requests-2.31.0.dist-info/RECORD,, -requests-2.31.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92 -requests-2.31.0.dist-info/top_level.txt,sha256=fMSVmHfb5rbGOo6xv-O_tUX6j-WyixssE-SnwcDRxNQ,9 -requests/__init__.py,sha256=LvmKhjIz8mHaKXthC2Mv5ykZ1d92voyf3oJpd-VuAig,4963 -requests/__pycache__/__init__.cpython-38.pyc,, -requests/__pycache__/__version__.cpython-38.pyc,, -requests/__pycache__/_internal_utils.cpython-38.pyc,, -requests/__pycache__/adapters.cpython-38.pyc,, -requests/__pycache__/api.cpython-38.pyc,, -requests/__pycache__/auth.cpython-38.pyc,, -requests/__pycache__/certs.cpython-38.pyc,, -requests/__pycache__/compat.cpython-38.pyc,, -requests/__pycache__/cookies.cpython-38.pyc,, -requests/__pycache__/exceptions.cpython-38.pyc,, -requests/__pycache__/help.cpython-38.pyc,, -requests/__pycache__/hooks.cpython-38.pyc,, -requests/__pycache__/models.cpython-38.pyc,, -requests/__pycache__/packages.cpython-38.pyc,, -requests/__pycache__/sessions.cpython-38.pyc,, -requests/__pycache__/status_codes.cpython-38.pyc,, -requests/__pycache__/structures.cpython-38.pyc,, -requests/__pycache__/utils.cpython-38.pyc,, -requests/__version__.py,sha256=ssI3Ezt7PaxgkOW45GhtwPUclo_SO_ygtIm4A74IOfw,435 -requests/_internal_utils.py,sha256=nMQymr4hs32TqVo5AbCrmcJEhvPUh7xXlluyqwslLiQ,1495 -requests/adapters.py,sha256=v_FmjU5KZ76k-YttShZYB5RprIzhhL8Y3zgW9p4eBQ8,19553 -requests/api.py,sha256=q61xcXq4tmiImrvcSVLTbFyCiD2F-L_-hWKGbz4y8vg,6449 -requests/auth.py,sha256=h-HLlVx9j8rKV5hfSAycP2ApOSglTz77R0tz7qCbbEE,10187 -requests/certs.py,sha256=Z9Sb410Anv6jUFTyss0jFFhU6xst8ctELqfy8Ev23gw,429 -requests/compat.py,sha256=yxntVOSEHGMrn7FNr_32EEam1ZNAdPRdSE13_yaHzTk,1451 -requests/cookies.py,sha256=kD3kNEcCj-mxbtf5fJsSaT86eGoEYpD3X0CSgpzl7BM,18560 -requests/exceptions.py,sha256=DhveFBclVjTRxhRduVpO-GbMYMID2gmjdLfNEqNpI_U,3811 -requests/help.py,sha256=gPX5d_H7Xd88aDABejhqGgl9B1VFRTt5BmiYvL3PzIQ,3875 -requests/hooks.py,sha256=CiuysiHA39V5UfcCBXFIx83IrDpuwfN9RcTUgv28ftQ,733 -requests/models.py,sha256=-DlKi0or8gFAM6VzutobXvvBW_2wrJuOF5NfndTIddA,35223 -requests/packages.py,sha256=DXgv-FJIczZITmv0vEBAhWj4W-5CGCIN_ksvgR17Dvs,957 -requests/sessions.py,sha256=-LvTzrPtetSTrR3buxu4XhdgMrJFLB1q5D7P--L2Xhw,30373 -requests/status_codes.py,sha256=FvHmT5uH-_uimtRz5hH9VCbt7VV-Nei2J9upbej6j8g,4235 -requests/structures.py,sha256=-IbmhVz06S-5aPSZuUthZ6-6D9XOjRuTXHOabY041XM,2912 -requests/utils.py,sha256=6sx2X3cIVA8BgWOg8odxFy-_lbWDFETU8HI4fU4Rmqw,33448 diff --git a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/WHEEL b/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/WHEEL deleted file mode 100644 index 1f37c02f2eb2e26b306202feaccb31e522b8b169..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.40.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/top_level.txt deleted file mode 100644 index f2293605cf1b01dca72aad0a15c45b72ed5429a2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests-2.31.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -requests diff --git a/venv/lib/python3.8/site-packages/requests/__init__.py b/venv/lib/python3.8/site-packages/requests/__init__.py deleted file mode 100644 index 300a16c5741d9ccb751185407694fe49e8da6bc5..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/__init__.py +++ /dev/null @@ -1,180 +0,0 @@ -# __ -# /__) _ _ _ _ _/ _ -# / ( (- (/ (/ (- _) / _) -# / - -""" -Requests HTTP Library -~~~~~~~~~~~~~~~~~~~~~ - -Requests is an HTTP library, written in Python, for human beings. -Basic GET usage: - - >>> import requests - >>> r = requests.get('https://www.python.org') - >>> r.status_code - 200 - >>> b'Python is a programming language' in r.content - True - -... or POST: - - >>> payload = dict(key1='value1', key2='value2') - >>> r = requests.post('https://httpbin.org/post', data=payload) - >>> print(r.text) - { - ... - "form": { - "key1": "value1", - "key2": "value2" - }, - ... - } - -The other HTTP methods are supported - see `requests.api`. Full documentation -is at . - -:copyright: (c) 2017 by Kenneth Reitz. -:license: Apache 2.0, see LICENSE for more details. -""" - -import warnings - -import urllib3 - -from .exceptions import RequestsDependencyWarning - -try: - from charset_normalizer import __version__ as charset_normalizer_version -except ImportError: - charset_normalizer_version = None - -try: - from chardet import __version__ as chardet_version -except ImportError: - chardet_version = None - - -def check_compatibility(urllib3_version, chardet_version, charset_normalizer_version): - urllib3_version = urllib3_version.split(".") - assert urllib3_version != ["dev"] # Verify urllib3 isn't installed from git. - - # Sometimes, urllib3 only reports its version as 16.1. - if len(urllib3_version) == 2: - urllib3_version.append("0") - - # Check urllib3 for compatibility. - major, minor, patch = urllib3_version # noqa: F811 - major, minor, patch = int(major), int(minor), int(patch) - # urllib3 >= 1.21.1 - assert major >= 1 - if major == 1: - assert minor >= 21 - - # Check charset_normalizer for compatibility. - if chardet_version: - major, minor, patch = chardet_version.split(".")[:3] - major, minor, patch = int(major), int(minor), int(patch) - # chardet_version >= 3.0.2, < 6.0.0 - assert (3, 0, 2) <= (major, minor, patch) < (6, 0, 0) - elif charset_normalizer_version: - major, minor, patch = charset_normalizer_version.split(".")[:3] - major, minor, patch = int(major), int(minor), int(patch) - # charset_normalizer >= 2.0.0 < 4.0.0 - assert (2, 0, 0) <= (major, minor, patch) < (4, 0, 0) - else: - raise Exception("You need either charset_normalizer or chardet installed") - - -def _check_cryptography(cryptography_version): - # cryptography < 1.3.4 - try: - cryptography_version = list(map(int, cryptography_version.split("."))) - except ValueError: - return - - if cryptography_version < [1, 3, 4]: - warning = "Old version of cryptography ({}) may cause slowdown.".format( - cryptography_version - ) - warnings.warn(warning, RequestsDependencyWarning) - - -# Check imported dependencies for compatibility. -try: - check_compatibility( - urllib3.__version__, chardet_version, charset_normalizer_version - ) -except (AssertionError, ValueError): - warnings.warn( - "urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " - "version!".format( - urllib3.__version__, chardet_version, charset_normalizer_version - ), - RequestsDependencyWarning, - ) - -# Attempt to enable urllib3's fallback for SNI support -# if the standard library doesn't support SNI or the -# 'ssl' library isn't available. -try: - try: - import ssl - except ImportError: - ssl = None - - if not getattr(ssl, "HAS_SNI", False): - from urllib3.contrib import pyopenssl - - pyopenssl.inject_into_urllib3() - - # Check cryptography version - from cryptography import __version__ as cryptography_version - - _check_cryptography(cryptography_version) -except ImportError: - pass - -# urllib3's DependencyWarnings should be silenced. -from urllib3.exceptions import DependencyWarning - -warnings.simplefilter("ignore", DependencyWarning) - -# Set default logging handler to avoid "No handler found" warnings. -import logging -from logging import NullHandler - -from . import packages, utils -from .__version__ import ( - __author__, - __author_email__, - __build__, - __cake__, - __copyright__, - __description__, - __license__, - __title__, - __url__, - __version__, -) -from .api import delete, get, head, options, patch, post, put, request -from .exceptions import ( - ConnectionError, - ConnectTimeout, - FileModeWarning, - HTTPError, - JSONDecodeError, - ReadTimeout, - RequestException, - Timeout, - TooManyRedirects, - URLRequired, -) -from .models import PreparedRequest, Request, Response -from .sessions import Session, session -from .status_codes import codes - -logging.getLogger(__name__).addHandler(NullHandler()) - -# FileModeWarnings go off per the default. -warnings.simplefilter("default", FileModeWarning, append=True) diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 3aca18fc9e470c95d5803acb35fafaf16ae3b208..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/__version__.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/__version__.cpython-38.pyc deleted file mode 100644 index 72d81de5f17eb6d668954b55633a1e7cd9a34bc4..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/__version__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/_internal_utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/_internal_utils.cpython-38.pyc deleted file mode 100644 index b340bc97528f784fb8cb763522790d03b6a1a27c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/_internal_utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/adapters.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/adapters.cpython-38.pyc deleted file mode 100644 index 60e051a5e224d3c775b91fd43748a4b25c607020..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/adapters.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/api.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/api.cpython-38.pyc deleted file mode 100644 index 5e24fe1c9e371ff0d9635b4dde298a862349e960..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/api.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/auth.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/auth.cpython-38.pyc deleted file mode 100644 index dc68e13e973d69dca4a3c786bdf9858f0f666734..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/auth.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/certs.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/certs.cpython-38.pyc deleted file mode 100644 index 717ad66e7edcbe4a5b05c6240d287a85e936e726..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/certs.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/compat.cpython-38.pyc deleted file mode 100644 index e33983372bc807465ea6c3a9c1e40bd6ba503581..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/compat.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/cookies.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/cookies.cpython-38.pyc deleted file mode 100644 index c7df70ff7c227563f27e73e5929cf7dcd145e6e7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/cookies.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/exceptions.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/exceptions.cpython-38.pyc deleted file mode 100644 index c016efc25e3c815216ca33712de0c5873a947df5..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/exceptions.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/help.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/help.cpython-38.pyc deleted file mode 100644 index f8421372be125bd4a03adec32aa0a21ceb3b1ac0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/help.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/hooks.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/hooks.cpython-38.pyc deleted file mode 100644 index 9736bad3340681ad71bcc4b6eec8648c302109b4..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/hooks.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/models.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/models.cpython-38.pyc deleted file mode 100644 index fa39c40cdbfd060dea517090a63243fa51802cc6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/models.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/packages.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/packages.cpython-38.pyc deleted file mode 100644 index cac466e2320b29998320dd073c4c02fbfb6fd2cd..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/packages.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/sessions.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/sessions.cpython-38.pyc deleted file mode 100644 index 499645e43cbc9069a00878310aa897680880b27e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/sessions.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/status_codes.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/status_codes.cpython-38.pyc deleted file mode 100644 index 9f1d4a06ea97cfc5052a209c051640721833c164..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/status_codes.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/structures.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/structures.cpython-38.pyc deleted file mode 100644 index 04feccf6c07dd5fe67c93a05be492e4a6cf8249e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/structures.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/requests/__pycache__/utils.cpython-38.pyc deleted file mode 100644 index 417f0665d49cf11ba42fe7a313334dd189a3fb9e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/requests/__pycache__/utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/requests/__version__.py b/venv/lib/python3.8/site-packages/requests/__version__.py deleted file mode 100644 index 5063c3f8ee7980493efcc30c24f7e7582714aa81..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/__version__.py +++ /dev/null @@ -1,14 +0,0 @@ -# .-. .-. .-. . . .-. .-. .-. .-. -# |( |- |.| | | |- `-. | `-. -# ' ' `-' `-`.`-' `-' `-' ' `-' - -__title__ = "requests" -__description__ = "Python HTTP for Humans." -__url__ = "https://requests.readthedocs.io" -__version__ = "2.31.0" -__build__ = 0x023100 -__author__ = "Kenneth Reitz" -__author_email__ = "me@kennethreitz.org" -__license__ = "Apache 2.0" -__copyright__ = "Copyright Kenneth Reitz" -__cake__ = "\u2728 \U0001f370 \u2728" diff --git a/venv/lib/python3.8/site-packages/requests/_internal_utils.py b/venv/lib/python3.8/site-packages/requests/_internal_utils.py deleted file mode 100644 index f2cf635e2937ee9b123a1498c5c5f723a6e20084..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/_internal_utils.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -requests._internal_utils -~~~~~~~~~~~~~~ - -Provides utility functions that are consumed internally by Requests -which depend on extremely few external helpers (such as compat) -""" -import re - -from .compat import builtin_str - -_VALID_HEADER_NAME_RE_BYTE = re.compile(rb"^[^:\s][^:\r\n]*$") -_VALID_HEADER_NAME_RE_STR = re.compile(r"^[^:\s][^:\r\n]*$") -_VALID_HEADER_VALUE_RE_BYTE = re.compile(rb"^\S[^\r\n]*$|^$") -_VALID_HEADER_VALUE_RE_STR = re.compile(r"^\S[^\r\n]*$|^$") - -_HEADER_VALIDATORS_STR = (_VALID_HEADER_NAME_RE_STR, _VALID_HEADER_VALUE_RE_STR) -_HEADER_VALIDATORS_BYTE = (_VALID_HEADER_NAME_RE_BYTE, _VALID_HEADER_VALUE_RE_BYTE) -HEADER_VALIDATORS = { - bytes: _HEADER_VALIDATORS_BYTE, - str: _HEADER_VALIDATORS_STR, -} - - -def to_native_string(string, encoding="ascii"): - """Given a string object, regardless of type, returns a representation of - that string in the native string type, encoding and decoding where - necessary. This assumes ASCII unless told otherwise. - """ - if isinstance(string, builtin_str): - out = string - else: - out = string.decode(encoding) - - return out - - -def unicode_is_ascii(u_string): - """Determine if unicode string only contains ASCII characters. - - :param str u_string: unicode string to check. Must be unicode - and not Python 2 `str`. - :rtype: bool - """ - assert isinstance(u_string, str) - try: - u_string.encode("ascii") - return True - except UnicodeEncodeError: - return False diff --git a/venv/lib/python3.8/site-packages/requests/adapters.py b/venv/lib/python3.8/site-packages/requests/adapters.py deleted file mode 100644 index 78e3bb6ecf920b429c4ecab62434b1e630c01707..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/adapters.py +++ /dev/null @@ -1,538 +0,0 @@ -""" -requests.adapters -~~~~~~~~~~~~~~~~~ - -This module contains the transport adapters that Requests uses to define -and maintain connections. -""" - -import os.path -import socket # noqa: F401 - -from urllib3.exceptions import ClosedPoolError, ConnectTimeoutError -from urllib3.exceptions import HTTPError as _HTTPError -from urllib3.exceptions import InvalidHeader as _InvalidHeader -from urllib3.exceptions import ( - LocationValueError, - MaxRetryError, - NewConnectionError, - ProtocolError, -) -from urllib3.exceptions import ProxyError as _ProxyError -from urllib3.exceptions import ReadTimeoutError, ResponseError -from urllib3.exceptions import SSLError as _SSLError -from urllib3.poolmanager import PoolManager, proxy_from_url -from urllib3.util import Timeout as TimeoutSauce -from urllib3.util import parse_url -from urllib3.util.retry import Retry - -from .auth import _basic_auth_str -from .compat import basestring, urlparse -from .cookies import extract_cookies_to_jar -from .exceptions import ( - ConnectionError, - ConnectTimeout, - InvalidHeader, - InvalidProxyURL, - InvalidSchema, - InvalidURL, - ProxyError, - ReadTimeout, - RetryError, - SSLError, -) -from .models import Response -from .structures import CaseInsensitiveDict -from .utils import ( - DEFAULT_CA_BUNDLE_PATH, - extract_zipped_paths, - get_auth_from_url, - get_encoding_from_headers, - prepend_scheme_if_needed, - select_proxy, - urldefragauth, -) - -try: - from urllib3.contrib.socks import SOCKSProxyManager -except ImportError: - - def SOCKSProxyManager(*args, **kwargs): - raise InvalidSchema("Missing dependencies for SOCKS support.") - - -DEFAULT_POOLBLOCK = False -DEFAULT_POOLSIZE = 10 -DEFAULT_RETRIES = 0 -DEFAULT_POOL_TIMEOUT = None - - -class BaseAdapter: - """The Base Transport Adapter""" - - def __init__(self): - super().__init__() - - def send( - self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None - ): - """Sends PreparedRequest object. Returns Response object. - - :param request: The :class:`PreparedRequest ` being sent. - :param stream: (optional) Whether to stream the request content. - :param timeout: (optional) How long to wait for the server to send - data before giving up, as a float, or a :ref:`(connect timeout, - read timeout) ` tuple. - :type timeout: float or tuple - :param verify: (optional) Either a boolean, in which case it controls whether we verify - the server's TLS certificate, or a string, in which case it must be a path - to a CA bundle to use - :param cert: (optional) Any user-provided SSL certificate to be trusted. - :param proxies: (optional) The proxies dictionary to apply to the request. - """ - raise NotImplementedError - - def close(self): - """Cleans up adapter specific items.""" - raise NotImplementedError - - -class HTTPAdapter(BaseAdapter): - """The built-in HTTP Adapter for urllib3. - - Provides a general-case interface for Requests sessions to contact HTTP and - HTTPS urls by implementing the Transport Adapter interface. This class will - usually be created by the :class:`Session ` class under the - covers. - - :param pool_connections: The number of urllib3 connection pools to cache. - :param pool_maxsize: The maximum number of connections to save in the pool. - :param max_retries: The maximum number of retries each connection - should attempt. Note, this applies only to failed DNS lookups, socket - connections and connection timeouts, never to requests where data has - made it to the server. By default, Requests does not retry failed - connections. If you need granular control over the conditions under - which we retry a request, import urllib3's ``Retry`` class and pass - that instead. - :param pool_block: Whether the connection pool should block for connections. - - Usage:: - - >>> import requests - >>> s = requests.Session() - >>> a = requests.adapters.HTTPAdapter(max_retries=3) - >>> s.mount('http://', a) - """ - - __attrs__ = [ - "max_retries", - "config", - "_pool_connections", - "_pool_maxsize", - "_pool_block", - ] - - def __init__( - self, - pool_connections=DEFAULT_POOLSIZE, - pool_maxsize=DEFAULT_POOLSIZE, - max_retries=DEFAULT_RETRIES, - pool_block=DEFAULT_POOLBLOCK, - ): - if max_retries == DEFAULT_RETRIES: - self.max_retries = Retry(0, read=False) - else: - self.max_retries = Retry.from_int(max_retries) - self.config = {} - self.proxy_manager = {} - - super().__init__() - - self._pool_connections = pool_connections - self._pool_maxsize = pool_maxsize - self._pool_block = pool_block - - self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block) - - def __getstate__(self): - return {attr: getattr(self, attr, None) for attr in self.__attrs__} - - def __setstate__(self, state): - # Can't handle by adding 'proxy_manager' to self.__attrs__ because - # self.poolmanager uses a lambda function, which isn't pickleable. - self.proxy_manager = {} - self.config = {} - - for attr, value in state.items(): - setattr(self, attr, value) - - self.init_poolmanager( - self._pool_connections, self._pool_maxsize, block=self._pool_block - ) - - def init_poolmanager( - self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs - ): - """Initializes a urllib3 PoolManager. - - This method should not be called from user code, and is only - exposed for use when subclassing the - :class:`HTTPAdapter `. - - :param connections: The number of urllib3 connection pools to cache. - :param maxsize: The maximum number of connections to save in the pool. - :param block: Block when no free connections are available. - :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. - """ - # save these values for pickling - self._pool_connections = connections - self._pool_maxsize = maxsize - self._pool_block = block - - self.poolmanager = PoolManager( - num_pools=connections, - maxsize=maxsize, - block=block, - **pool_kwargs, - ) - - def proxy_manager_for(self, proxy, **proxy_kwargs): - """Return urllib3 ProxyManager for the given proxy. - - This method should not be called from user code, and is only - exposed for use when subclassing the - :class:`HTTPAdapter `. - - :param proxy: The proxy to return a urllib3 ProxyManager for. - :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. - :returns: ProxyManager - :rtype: urllib3.ProxyManager - """ - if proxy in self.proxy_manager: - manager = self.proxy_manager[proxy] - elif proxy.lower().startswith("socks"): - username, password = get_auth_from_url(proxy) - manager = self.proxy_manager[proxy] = SOCKSProxyManager( - proxy, - username=username, - password=password, - num_pools=self._pool_connections, - maxsize=self._pool_maxsize, - block=self._pool_block, - **proxy_kwargs, - ) - else: - proxy_headers = self.proxy_headers(proxy) - manager = self.proxy_manager[proxy] = proxy_from_url( - proxy, - proxy_headers=proxy_headers, - num_pools=self._pool_connections, - maxsize=self._pool_maxsize, - block=self._pool_block, - **proxy_kwargs, - ) - - return manager - - def cert_verify(self, conn, url, verify, cert): - """Verify a SSL certificate. This method should not be called from user - code, and is only exposed for use when subclassing the - :class:`HTTPAdapter `. - - :param conn: The urllib3 connection object associated with the cert. - :param url: The requested URL. - :param verify: Either a boolean, in which case it controls whether we verify - the server's TLS certificate, or a string, in which case it must be a path - to a CA bundle to use - :param cert: The SSL certificate to verify. - """ - if url.lower().startswith("https") and verify: - - cert_loc = None - - # Allow self-specified cert location. - if verify is not True: - cert_loc = verify - - if not cert_loc: - cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH) - - if not cert_loc or not os.path.exists(cert_loc): - raise OSError( - f"Could not find a suitable TLS CA certificate bundle, " - f"invalid path: {cert_loc}" - ) - - conn.cert_reqs = "CERT_REQUIRED" - - if not os.path.isdir(cert_loc): - conn.ca_certs = cert_loc - else: - conn.ca_cert_dir = cert_loc - else: - conn.cert_reqs = "CERT_NONE" - conn.ca_certs = None - conn.ca_cert_dir = None - - if cert: - if not isinstance(cert, basestring): - conn.cert_file = cert[0] - conn.key_file = cert[1] - else: - conn.cert_file = cert - conn.key_file = None - if conn.cert_file and not os.path.exists(conn.cert_file): - raise OSError( - f"Could not find the TLS certificate file, " - f"invalid path: {conn.cert_file}" - ) - if conn.key_file and not os.path.exists(conn.key_file): - raise OSError( - f"Could not find the TLS key file, invalid path: {conn.key_file}" - ) - - def build_response(self, req, resp): - """Builds a :class:`Response ` object from a urllib3 - response. This should not be called from user code, and is only exposed - for use when subclassing the - :class:`HTTPAdapter ` - - :param req: The :class:`PreparedRequest ` used to generate the response. - :param resp: The urllib3 response object. - :rtype: requests.Response - """ - response = Response() - - # Fallback to None if there's no status_code, for whatever reason. - response.status_code = getattr(resp, "status", None) - - # Make headers case-insensitive. - response.headers = CaseInsensitiveDict(getattr(resp, "headers", {})) - - # Set encoding. - response.encoding = get_encoding_from_headers(response.headers) - response.raw = resp - response.reason = response.raw.reason - - if isinstance(req.url, bytes): - response.url = req.url.decode("utf-8") - else: - response.url = req.url - - # Add new cookies from the server. - extract_cookies_to_jar(response.cookies, req, resp) - - # Give the Response some context. - response.request = req - response.connection = self - - return response - - def get_connection(self, url, proxies=None): - """Returns a urllib3 connection for the given URL. This should not be - called from user code, and is only exposed for use when subclassing the - :class:`HTTPAdapter `. - - :param url: The URL to connect to. - :param proxies: (optional) A Requests-style dictionary of proxies used on this request. - :rtype: urllib3.ConnectionPool - """ - proxy = select_proxy(url, proxies) - - if proxy: - proxy = prepend_scheme_if_needed(proxy, "http") - proxy_url = parse_url(proxy) - if not proxy_url.host: - raise InvalidProxyURL( - "Please check proxy URL. It is malformed " - "and could be missing the host." - ) - proxy_manager = self.proxy_manager_for(proxy) - conn = proxy_manager.connection_from_url(url) - else: - # Only scheme should be lower case - parsed = urlparse(url) - url = parsed.geturl() - conn = self.poolmanager.connection_from_url(url) - - return conn - - def close(self): - """Disposes of any internal state. - - Currently, this closes the PoolManager and any active ProxyManager, - which closes any pooled connections. - """ - self.poolmanager.clear() - for proxy in self.proxy_manager.values(): - proxy.clear() - - def request_url(self, request, proxies): - """Obtain the url to use when making the final request. - - If the message is being sent through a HTTP proxy, the full URL has to - be used. Otherwise, we should only use the path portion of the URL. - - This should not be called from user code, and is only exposed for use - when subclassing the - :class:`HTTPAdapter `. - - :param request: The :class:`PreparedRequest ` being sent. - :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. - :rtype: str - """ - proxy = select_proxy(request.url, proxies) - scheme = urlparse(request.url).scheme - - is_proxied_http_request = proxy and scheme != "https" - using_socks_proxy = False - if proxy: - proxy_scheme = urlparse(proxy).scheme.lower() - using_socks_proxy = proxy_scheme.startswith("socks") - - url = request.path_url - if is_proxied_http_request and not using_socks_proxy: - url = urldefragauth(request.url) - - return url - - def add_headers(self, request, **kwargs): - """Add any headers needed by the connection. As of v2.0 this does - nothing by default, but is left for overriding by users that subclass - the :class:`HTTPAdapter `. - - This should not be called from user code, and is only exposed for use - when subclassing the - :class:`HTTPAdapter `. - - :param request: The :class:`PreparedRequest ` to add headers to. - :param kwargs: The keyword arguments from the call to send(). - """ - pass - - def proxy_headers(self, proxy): - """Returns a dictionary of the headers to add to any request sent - through a proxy. This works with urllib3 magic to ensure that they are - correctly sent to the proxy, rather than in a tunnelled request if - CONNECT is being used. - - This should not be called from user code, and is only exposed for use - when subclassing the - :class:`HTTPAdapter `. - - :param proxy: The url of the proxy being used for this request. - :rtype: dict - """ - headers = {} - username, password = get_auth_from_url(proxy) - - if username: - headers["Proxy-Authorization"] = _basic_auth_str(username, password) - - return headers - - def send( - self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None - ): - """Sends PreparedRequest object. Returns Response object. - - :param request: The :class:`PreparedRequest ` being sent. - :param stream: (optional) Whether to stream the request content. - :param timeout: (optional) How long to wait for the server to send - data before giving up, as a float, or a :ref:`(connect timeout, - read timeout) ` tuple. - :type timeout: float or tuple or urllib3 Timeout object - :param verify: (optional) Either a boolean, in which case it controls whether - we verify the server's TLS certificate, or a string, in which case it - must be a path to a CA bundle to use - :param cert: (optional) Any user-provided SSL certificate to be trusted. - :param proxies: (optional) The proxies dictionary to apply to the request. - :rtype: requests.Response - """ - - try: - conn = self.get_connection(request.url, proxies) - except LocationValueError as e: - raise InvalidURL(e, request=request) - - self.cert_verify(conn, request.url, verify, cert) - url = self.request_url(request, proxies) - self.add_headers( - request, - stream=stream, - timeout=timeout, - verify=verify, - cert=cert, - proxies=proxies, - ) - - chunked = not (request.body is None or "Content-Length" in request.headers) - - if isinstance(timeout, tuple): - try: - connect, read = timeout - timeout = TimeoutSauce(connect=connect, read=read) - except ValueError: - raise ValueError( - f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " - f"or a single float to set both timeouts to the same value." - ) - elif isinstance(timeout, TimeoutSauce): - pass - else: - timeout = TimeoutSauce(connect=timeout, read=timeout) - - try: - resp = conn.urlopen( - method=request.method, - url=url, - body=request.body, - headers=request.headers, - redirect=False, - assert_same_host=False, - preload_content=False, - decode_content=False, - retries=self.max_retries, - timeout=timeout, - chunked=chunked, - ) - - except (ProtocolError, OSError) as err: - raise ConnectionError(err, request=request) - - except MaxRetryError as e: - if isinstance(e.reason, ConnectTimeoutError): - # TODO: Remove this in 3.0.0: see #2811 - if not isinstance(e.reason, NewConnectionError): - raise ConnectTimeout(e, request=request) - - if isinstance(e.reason, ResponseError): - raise RetryError(e, request=request) - - if isinstance(e.reason, _ProxyError): - raise ProxyError(e, request=request) - - if isinstance(e.reason, _SSLError): - # This branch is for urllib3 v1.22 and later. - raise SSLError(e, request=request) - - raise ConnectionError(e, request=request) - - except ClosedPoolError as e: - raise ConnectionError(e, request=request) - - except _ProxyError as e: - raise ProxyError(e) - - except (_SSLError, _HTTPError) as e: - if isinstance(e, _SSLError): - # This branch is for urllib3 versions earlier than v1.22 - raise SSLError(e, request=request) - elif isinstance(e, ReadTimeoutError): - raise ReadTimeout(e, request=request) - elif isinstance(e, _InvalidHeader): - raise InvalidHeader(e, request=request) - else: - raise - - return self.build_response(request, resp) diff --git a/venv/lib/python3.8/site-packages/requests/api.py b/venv/lib/python3.8/site-packages/requests/api.py deleted file mode 100644 index cd0b3eeac3ebca7fe4a627ba5a96c1bbaf827d4f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/api.py +++ /dev/null @@ -1,157 +0,0 @@ -""" -requests.api -~~~~~~~~~~~~ - -This module implements the Requests API. - -:copyright: (c) 2012 by Kenneth Reitz. -:license: Apache2, see LICENSE for more details. -""" - -from . import sessions - - -def request(method, url, **kwargs): - """Constructs and sends a :class:`Request `. - - :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. - :param url: URL for the new :class:`Request` object. - :param params: (optional) Dictionary, list of tuples or bytes to send - in the query string for the :class:`Request`. - :param data: (optional) Dictionary, list of tuples, bytes, or file-like - object to send in the body of the :class:`Request`. - :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. - :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. - :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. - :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload. - ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')`` - or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string - defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers - to add for the file. - :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. - :param timeout: (optional) How many seconds to wait for the server to send data - before giving up, as a float, or a :ref:`(connect timeout, read - timeout) ` tuple. - :type timeout: float or tuple - :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``. - :type allow_redirects: bool - :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. - :param verify: (optional) Either a boolean, in which case it controls whether we verify - the server's TLS certificate, or a string, in which case it must be a path - to a CA bundle to use. Defaults to ``True``. - :param stream: (optional) if ``False``, the response content will be immediately downloaded. - :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. - :return: :class:`Response ` object - :rtype: requests.Response - - Usage:: - - >>> import requests - >>> req = requests.request('GET', 'https://httpbin.org/get') - >>> req - - """ - - # By using the 'with' statement we are sure the session is closed, thus we - # avoid leaving sockets open which can trigger a ResourceWarning in some - # cases, and look like a memory leak in others. - with sessions.Session() as session: - return session.request(method=method, url=url, **kwargs) - - -def get(url, params=None, **kwargs): - r"""Sends a GET request. - - :param url: URL for the new :class:`Request` object. - :param params: (optional) Dictionary, list of tuples or bytes to send - in the query string for the :class:`Request`. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :return: :class:`Response ` object - :rtype: requests.Response - """ - - return request("get", url, params=params, **kwargs) - - -def options(url, **kwargs): - r"""Sends an OPTIONS request. - - :param url: URL for the new :class:`Request` object. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :return: :class:`Response ` object - :rtype: requests.Response - """ - - return request("options", url, **kwargs) - - -def head(url, **kwargs): - r"""Sends a HEAD request. - - :param url: URL for the new :class:`Request` object. - :param \*\*kwargs: Optional arguments that ``request`` takes. If - `allow_redirects` is not provided, it will be set to `False` (as - opposed to the default :meth:`request` behavior). - :return: :class:`Response ` object - :rtype: requests.Response - """ - - kwargs.setdefault("allow_redirects", False) - return request("head", url, **kwargs) - - -def post(url, data=None, json=None, **kwargs): - r"""Sends a POST request. - - :param url: URL for the new :class:`Request` object. - :param data: (optional) Dictionary, list of tuples, bytes, or file-like - object to send in the body of the :class:`Request`. - :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :return: :class:`Response ` object - :rtype: requests.Response - """ - - return request("post", url, data=data, json=json, **kwargs) - - -def put(url, data=None, **kwargs): - r"""Sends a PUT request. - - :param url: URL for the new :class:`Request` object. - :param data: (optional) Dictionary, list of tuples, bytes, or file-like - object to send in the body of the :class:`Request`. - :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :return: :class:`Response ` object - :rtype: requests.Response - """ - - return request("put", url, data=data, **kwargs) - - -def patch(url, data=None, **kwargs): - r"""Sends a PATCH request. - - :param url: URL for the new :class:`Request` object. - :param data: (optional) Dictionary, list of tuples, bytes, or file-like - object to send in the body of the :class:`Request`. - :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :return: :class:`Response ` object - :rtype: requests.Response - """ - - return request("patch", url, data=data, **kwargs) - - -def delete(url, **kwargs): - r"""Sends a DELETE request. - - :param url: URL for the new :class:`Request` object. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :return: :class:`Response ` object - :rtype: requests.Response - """ - - return request("delete", url, **kwargs) diff --git a/venv/lib/python3.8/site-packages/requests/auth.py b/venv/lib/python3.8/site-packages/requests/auth.py deleted file mode 100644 index 9733686ddb36b826ead4f4666d42311397fa6fec..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/auth.py +++ /dev/null @@ -1,315 +0,0 @@ -""" -requests.auth -~~~~~~~~~~~~~ - -This module contains the authentication handlers for Requests. -""" - -import hashlib -import os -import re -import threading -import time -import warnings -from base64 import b64encode - -from ._internal_utils import to_native_string -from .compat import basestring, str, urlparse -from .cookies import extract_cookies_to_jar -from .utils import parse_dict_header - -CONTENT_TYPE_FORM_URLENCODED = "application/x-www-form-urlencoded" -CONTENT_TYPE_MULTI_PART = "multipart/form-data" - - -def _basic_auth_str(username, password): - """Returns a Basic Auth string.""" - - # "I want us to put a big-ol' comment on top of it that - # says that this behaviour is dumb but we need to preserve - # it because people are relying on it." - # - Lukasa - # - # These are here solely to maintain backwards compatibility - # for things like ints. This will be removed in 3.0.0. - if not isinstance(username, basestring): - warnings.warn( - "Non-string usernames will no longer be supported in Requests " - "3.0.0. Please convert the object you've passed in ({!r}) to " - "a string or bytes object in the near future to avoid " - "problems.".format(username), - category=DeprecationWarning, - ) - username = str(username) - - if not isinstance(password, basestring): - warnings.warn( - "Non-string passwords will no longer be supported in Requests " - "3.0.0. Please convert the object you've passed in ({!r}) to " - "a string or bytes object in the near future to avoid " - "problems.".format(type(password)), - category=DeprecationWarning, - ) - password = str(password) - # -- End Removal -- - - if isinstance(username, str): - username = username.encode("latin1") - - if isinstance(password, str): - password = password.encode("latin1") - - authstr = "Basic " + to_native_string( - b64encode(b":".join((username, password))).strip() - ) - - return authstr - - -class AuthBase: - """Base class that all auth implementations derive from""" - - def __call__(self, r): - raise NotImplementedError("Auth hooks must be callable.") - - -class HTTPBasicAuth(AuthBase): - """Attaches HTTP Basic Authentication to the given Request object.""" - - def __init__(self, username, password): - self.username = username - self.password = password - - def __eq__(self, other): - return all( - [ - self.username == getattr(other, "username", None), - self.password == getattr(other, "password", None), - ] - ) - - def __ne__(self, other): - return not self == other - - def __call__(self, r): - r.headers["Authorization"] = _basic_auth_str(self.username, self.password) - return r - - -class HTTPProxyAuth(HTTPBasicAuth): - """Attaches HTTP Proxy Authentication to a given Request object.""" - - def __call__(self, r): - r.headers["Proxy-Authorization"] = _basic_auth_str(self.username, self.password) - return r - - -class HTTPDigestAuth(AuthBase): - """Attaches HTTP Digest Authentication to the given Request object.""" - - def __init__(self, username, password): - self.username = username - self.password = password - # Keep state in per-thread local storage - self._thread_local = threading.local() - - def init_per_thread_state(self): - # Ensure state is initialized just once per-thread - if not hasattr(self._thread_local, "init"): - self._thread_local.init = True - self._thread_local.last_nonce = "" - self._thread_local.nonce_count = 0 - self._thread_local.chal = {} - self._thread_local.pos = None - self._thread_local.num_401_calls = None - - def build_digest_header(self, method, url): - """ - :rtype: str - """ - - realm = self._thread_local.chal["realm"] - nonce = self._thread_local.chal["nonce"] - qop = self._thread_local.chal.get("qop") - algorithm = self._thread_local.chal.get("algorithm") - opaque = self._thread_local.chal.get("opaque") - hash_utf8 = None - - if algorithm is None: - _algorithm = "MD5" - else: - _algorithm = algorithm.upper() - # lambdas assume digest modules are imported at the top level - if _algorithm == "MD5" or _algorithm == "MD5-SESS": - - def md5_utf8(x): - if isinstance(x, str): - x = x.encode("utf-8") - return hashlib.md5(x).hexdigest() - - hash_utf8 = md5_utf8 - elif _algorithm == "SHA": - - def sha_utf8(x): - if isinstance(x, str): - x = x.encode("utf-8") - return hashlib.sha1(x).hexdigest() - - hash_utf8 = sha_utf8 - elif _algorithm == "SHA-256": - - def sha256_utf8(x): - if isinstance(x, str): - x = x.encode("utf-8") - return hashlib.sha256(x).hexdigest() - - hash_utf8 = sha256_utf8 - elif _algorithm == "SHA-512": - - def sha512_utf8(x): - if isinstance(x, str): - x = x.encode("utf-8") - return hashlib.sha512(x).hexdigest() - - hash_utf8 = sha512_utf8 - - KD = lambda s, d: hash_utf8(f"{s}:{d}") # noqa:E731 - - if hash_utf8 is None: - return None - - # XXX not implemented yet - entdig = None - p_parsed = urlparse(url) - #: path is request-uri defined in RFC 2616 which should not be empty - path = p_parsed.path or "/" - if p_parsed.query: - path += f"?{p_parsed.query}" - - A1 = f"{self.username}:{realm}:{self.password}" - A2 = f"{method}:{path}" - - HA1 = hash_utf8(A1) - HA2 = hash_utf8(A2) - - if nonce == self._thread_local.last_nonce: - self._thread_local.nonce_count += 1 - else: - self._thread_local.nonce_count = 1 - ncvalue = f"{self._thread_local.nonce_count:08x}" - s = str(self._thread_local.nonce_count).encode("utf-8") - s += nonce.encode("utf-8") - s += time.ctime().encode("utf-8") - s += os.urandom(8) - - cnonce = hashlib.sha1(s).hexdigest()[:16] - if _algorithm == "MD5-SESS": - HA1 = hash_utf8(f"{HA1}:{nonce}:{cnonce}") - - if not qop: - respdig = KD(HA1, f"{nonce}:{HA2}") - elif qop == "auth" or "auth" in qop.split(","): - noncebit = f"{nonce}:{ncvalue}:{cnonce}:auth:{HA2}" - respdig = KD(HA1, noncebit) - else: - # XXX handle auth-int. - return None - - self._thread_local.last_nonce = nonce - - # XXX should the partial digests be encoded too? - base = ( - f'username="{self.username}", realm="{realm}", nonce="{nonce}", ' - f'uri="{path}", response="{respdig}"' - ) - if opaque: - base += f', opaque="{opaque}"' - if algorithm: - base += f', algorithm="{algorithm}"' - if entdig: - base += f', digest="{entdig}"' - if qop: - base += f', qop="auth", nc={ncvalue}, cnonce="{cnonce}"' - - return f"Digest {base}" - - def handle_redirect(self, r, **kwargs): - """Reset num_401_calls counter on redirects.""" - if r.is_redirect: - self._thread_local.num_401_calls = 1 - - def handle_401(self, r, **kwargs): - """ - Takes the given response and tries digest-auth, if needed. - - :rtype: requests.Response - """ - - # If response is not 4xx, do not auth - # See https://github.com/psf/requests/issues/3772 - if not 400 <= r.status_code < 500: - self._thread_local.num_401_calls = 1 - return r - - if self._thread_local.pos is not None: - # Rewind the file position indicator of the body to where - # it was to resend the request. - r.request.body.seek(self._thread_local.pos) - s_auth = r.headers.get("www-authenticate", "") - - if "digest" in s_auth.lower() and self._thread_local.num_401_calls < 2: - - self._thread_local.num_401_calls += 1 - pat = re.compile(r"digest ", flags=re.IGNORECASE) - self._thread_local.chal = parse_dict_header(pat.sub("", s_auth, count=1)) - - # Consume content and release the original connection - # to allow our new request to reuse the same one. - r.content - r.close() - prep = r.request.copy() - extract_cookies_to_jar(prep._cookies, r.request, r.raw) - prep.prepare_cookies(prep._cookies) - - prep.headers["Authorization"] = self.build_digest_header( - prep.method, prep.url - ) - _r = r.connection.send(prep, **kwargs) - _r.history.append(r) - _r.request = prep - - return _r - - self._thread_local.num_401_calls = 1 - return r - - def __call__(self, r): - # Initialize per-thread state, if needed - self.init_per_thread_state() - # If we have a saved nonce, skip the 401 - if self._thread_local.last_nonce: - r.headers["Authorization"] = self.build_digest_header(r.method, r.url) - try: - self._thread_local.pos = r.body.tell() - except AttributeError: - # In the case of HTTPDigestAuth being reused and the body of - # the previous request was a file-like object, pos has the - # file position of the previous body. Ensure it's set to - # None. - self._thread_local.pos = None - r.register_hook("response", self.handle_401) - r.register_hook("response", self.handle_redirect) - self._thread_local.num_401_calls = 1 - - return r - - def __eq__(self, other): - return all( - [ - self.username == getattr(other, "username", None), - self.password == getattr(other, "password", None), - ] - ) - - def __ne__(self, other): - return not self == other diff --git a/venv/lib/python3.8/site-packages/requests/certs.py b/venv/lib/python3.8/site-packages/requests/certs.py deleted file mode 100644 index be422c3e91e43bacf60ff3302688df0b28742333..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/certs.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python - -""" -requests.certs -~~~~~~~~~~~~~~ - -This module returns the preferred default CA certificate bundle. There is -only one — the one from the certifi package. - -If you are packaging Requests, e.g., for a Linux distribution or a managed -environment, you can change the definition of where() to return a separately -packaged CA bundle. -""" -from certifi import where - -if __name__ == "__main__": - print(where()) diff --git a/venv/lib/python3.8/site-packages/requests/compat.py b/venv/lib/python3.8/site-packages/requests/compat.py deleted file mode 100644 index 6776163c94f3d6f61b00d329d4061d6b02afeeb9..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/compat.py +++ /dev/null @@ -1,79 +0,0 @@ -""" -requests.compat -~~~~~~~~~~~~~~~ - -This module previously handled import compatibility issues -between Python 2 and Python 3. It remains for backwards -compatibility until the next major version. -""" - -try: - import chardet -except ImportError: - import charset_normalizer as chardet - -import sys - -# ------- -# Pythons -# ------- - -# Syntax sugar. -_ver = sys.version_info - -#: Python 2.x? -is_py2 = _ver[0] == 2 - -#: Python 3.x? -is_py3 = _ver[0] == 3 - -# json/simplejson module import resolution -has_simplejson = False -try: - import simplejson as json - - has_simplejson = True -except ImportError: - import json - -if has_simplejson: - from simplejson import JSONDecodeError -else: - from json import JSONDecodeError - -# Keep OrderedDict for backwards compatibility. -from collections import OrderedDict -from collections.abc import Callable, Mapping, MutableMapping -from http import cookiejar as cookielib -from http.cookies import Morsel -from io import StringIO - -# -------------- -# Legacy Imports -# -------------- -from urllib.parse import ( - quote, - quote_plus, - unquote, - unquote_plus, - urldefrag, - urlencode, - urljoin, - urlparse, - urlsplit, - urlunparse, -) -from urllib.request import ( - getproxies, - getproxies_environment, - parse_http_list, - proxy_bypass, - proxy_bypass_environment, -) - -builtin_str = str -str = str -bytes = bytes -basestring = (str, bytes) -numeric_types = (int, float) -integer_types = (int,) diff --git a/venv/lib/python3.8/site-packages/requests/cookies.py b/venv/lib/python3.8/site-packages/requests/cookies.py deleted file mode 100644 index bf54ab237e410603061b8cec8fd195912d3cfb08..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/cookies.py +++ /dev/null @@ -1,561 +0,0 @@ -""" -requests.cookies -~~~~~~~~~~~~~~~~ - -Compatibility code to be able to use `cookielib.CookieJar` with requests. - -requests.utils imports from here, so be careful with imports. -""" - -import calendar -import copy -import time - -from ._internal_utils import to_native_string -from .compat import Morsel, MutableMapping, cookielib, urlparse, urlunparse - -try: - import threading -except ImportError: - import dummy_threading as threading - - -class MockRequest: - """Wraps a `requests.Request` to mimic a `urllib2.Request`. - - The code in `cookielib.CookieJar` expects this interface in order to correctly - manage cookie policies, i.e., determine whether a cookie can be set, given the - domains of the request and the cookie. - - The original request object is read-only. The client is responsible for collecting - the new headers via `get_new_headers()` and interpreting them appropriately. You - probably want `get_cookie_header`, defined below. - """ - - def __init__(self, request): - self._r = request - self._new_headers = {} - self.type = urlparse(self._r.url).scheme - - def get_type(self): - return self.type - - def get_host(self): - return urlparse(self._r.url).netloc - - def get_origin_req_host(self): - return self.get_host() - - def get_full_url(self): - # Only return the response's URL if the user hadn't set the Host - # header - if not self._r.headers.get("Host"): - return self._r.url - # If they did set it, retrieve it and reconstruct the expected domain - host = to_native_string(self._r.headers["Host"], encoding="utf-8") - parsed = urlparse(self._r.url) - # Reconstruct the URL as we expect it - return urlunparse( - [ - parsed.scheme, - host, - parsed.path, - parsed.params, - parsed.query, - parsed.fragment, - ] - ) - - def is_unverifiable(self): - return True - - def has_header(self, name): - return name in self._r.headers or name in self._new_headers - - def get_header(self, name, default=None): - return self._r.headers.get(name, self._new_headers.get(name, default)) - - def add_header(self, key, val): - """cookielib has no legitimate use for this method; add it back if you find one.""" - raise NotImplementedError( - "Cookie headers should be added with add_unredirected_header()" - ) - - def add_unredirected_header(self, name, value): - self._new_headers[name] = value - - def get_new_headers(self): - return self._new_headers - - @property - def unverifiable(self): - return self.is_unverifiable() - - @property - def origin_req_host(self): - return self.get_origin_req_host() - - @property - def host(self): - return self.get_host() - - -class MockResponse: - """Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. - - ...what? Basically, expose the parsed HTTP headers from the server response - the way `cookielib` expects to see them. - """ - - def __init__(self, headers): - """Make a MockResponse for `cookielib` to read. - - :param headers: a httplib.HTTPMessage or analogous carrying the headers - """ - self._headers = headers - - def info(self): - return self._headers - - def getheaders(self, name): - self._headers.getheaders(name) - - -def extract_cookies_to_jar(jar, request, response): - """Extract the cookies from the response into a CookieJar. - - :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) - :param request: our own requests.Request object - :param response: urllib3.HTTPResponse object - """ - if not (hasattr(response, "_original_response") and response._original_response): - return - # the _original_response field is the wrapped httplib.HTTPResponse object, - req = MockRequest(request) - # pull out the HTTPMessage with the headers and put it in the mock: - res = MockResponse(response._original_response.msg) - jar.extract_cookies(res, req) - - -def get_cookie_header(jar, request): - """ - Produce an appropriate Cookie header string to be sent with `request`, or None. - - :rtype: str - """ - r = MockRequest(request) - jar.add_cookie_header(r) - return r.get_new_headers().get("Cookie") - - -def remove_cookie_by_name(cookiejar, name, domain=None, path=None): - """Unsets a cookie by name, by default over all domains and paths. - - Wraps CookieJar.clear(), is O(n). - """ - clearables = [] - for cookie in cookiejar: - if cookie.name != name: - continue - if domain is not None and domain != cookie.domain: - continue - if path is not None and path != cookie.path: - continue - clearables.append((cookie.domain, cookie.path, cookie.name)) - - for domain, path, name in clearables: - cookiejar.clear(domain, path, name) - - -class CookieConflictError(RuntimeError): - """There are two cookies that meet the criteria specified in the cookie jar. - Use .get and .set and include domain and path args in order to be more specific. - """ - - -class RequestsCookieJar(cookielib.CookieJar, MutableMapping): - """Compatibility class; is a cookielib.CookieJar, but exposes a dict - interface. - - This is the CookieJar we create by default for requests and sessions that - don't specify one, since some clients may expect response.cookies and - session.cookies to support dict operations. - - Requests does not use the dict interface internally; it's just for - compatibility with external client code. All requests code should work - out of the box with externally provided instances of ``CookieJar``, e.g. - ``LWPCookieJar`` and ``FileCookieJar``. - - Unlike a regular CookieJar, this class is pickleable. - - .. warning:: dictionary operations that are normally O(1) may be O(n). - """ - - def get(self, name, default=None, domain=None, path=None): - """Dict-like get() that also supports optional domain and path args in - order to resolve naming collisions from using one cookie jar over - multiple domains. - - .. warning:: operation is O(n), not O(1). - """ - try: - return self._find_no_duplicates(name, domain, path) - except KeyError: - return default - - def set(self, name, value, **kwargs): - """Dict-like set() that also supports optional domain and path args in - order to resolve naming collisions from using one cookie jar over - multiple domains. - """ - # support client code that unsets cookies by assignment of a None value: - if value is None: - remove_cookie_by_name( - self, name, domain=kwargs.get("domain"), path=kwargs.get("path") - ) - return - - if isinstance(value, Morsel): - c = morsel_to_cookie(value) - else: - c = create_cookie(name, value, **kwargs) - self.set_cookie(c) - return c - - def iterkeys(self): - """Dict-like iterkeys() that returns an iterator of names of cookies - from the jar. - - .. seealso:: itervalues() and iteritems(). - """ - for cookie in iter(self): - yield cookie.name - - def keys(self): - """Dict-like keys() that returns a list of names of cookies from the - jar. - - .. seealso:: values() and items(). - """ - return list(self.iterkeys()) - - def itervalues(self): - """Dict-like itervalues() that returns an iterator of values of cookies - from the jar. - - .. seealso:: iterkeys() and iteritems(). - """ - for cookie in iter(self): - yield cookie.value - - def values(self): - """Dict-like values() that returns a list of values of cookies from the - jar. - - .. seealso:: keys() and items(). - """ - return list(self.itervalues()) - - def iteritems(self): - """Dict-like iteritems() that returns an iterator of name-value tuples - from the jar. - - .. seealso:: iterkeys() and itervalues(). - """ - for cookie in iter(self): - yield cookie.name, cookie.value - - def items(self): - """Dict-like items() that returns a list of name-value tuples from the - jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a - vanilla python dict of key value pairs. - - .. seealso:: keys() and values(). - """ - return list(self.iteritems()) - - def list_domains(self): - """Utility method to list all the domains in the jar.""" - domains = [] - for cookie in iter(self): - if cookie.domain not in domains: - domains.append(cookie.domain) - return domains - - def list_paths(self): - """Utility method to list all the paths in the jar.""" - paths = [] - for cookie in iter(self): - if cookie.path not in paths: - paths.append(cookie.path) - return paths - - def multiple_domains(self): - """Returns True if there are multiple domains in the jar. - Returns False otherwise. - - :rtype: bool - """ - domains = [] - for cookie in iter(self): - if cookie.domain is not None and cookie.domain in domains: - return True - domains.append(cookie.domain) - return False # there is only one domain in jar - - def get_dict(self, domain=None, path=None): - """Takes as an argument an optional domain and path and returns a plain - old Python dict of name-value pairs of cookies that meet the - requirements. - - :rtype: dict - """ - dictionary = {} - for cookie in iter(self): - if (domain is None or cookie.domain == domain) and ( - path is None or cookie.path == path - ): - dictionary[cookie.name] = cookie.value - return dictionary - - def __contains__(self, name): - try: - return super().__contains__(name) - except CookieConflictError: - return True - - def __getitem__(self, name): - """Dict-like __getitem__() for compatibility with client code. Throws - exception if there are more than one cookie with name. In that case, - use the more explicit get() method instead. - - .. warning:: operation is O(n), not O(1). - """ - return self._find_no_duplicates(name) - - def __setitem__(self, name, value): - """Dict-like __setitem__ for compatibility with client code. Throws - exception if there is already a cookie of that name in the jar. In that - case, use the more explicit set() method instead. - """ - self.set(name, value) - - def __delitem__(self, name): - """Deletes a cookie given a name. Wraps ``cookielib.CookieJar``'s - ``remove_cookie_by_name()``. - """ - remove_cookie_by_name(self, name) - - def set_cookie(self, cookie, *args, **kwargs): - if ( - hasattr(cookie.value, "startswith") - and cookie.value.startswith('"') - and cookie.value.endswith('"') - ): - cookie.value = cookie.value.replace('\\"', "") - return super().set_cookie(cookie, *args, **kwargs) - - def update(self, other): - """Updates this jar with cookies from another CookieJar or dict-like""" - if isinstance(other, cookielib.CookieJar): - for cookie in other: - self.set_cookie(copy.copy(cookie)) - else: - super().update(other) - - def _find(self, name, domain=None, path=None): - """Requests uses this method internally to get cookie values. - - If there are conflicting cookies, _find arbitrarily chooses one. - See _find_no_duplicates if you want an exception thrown if there are - conflicting cookies. - - :param name: a string containing name of cookie - :param domain: (optional) string containing domain of cookie - :param path: (optional) string containing path of cookie - :return: cookie.value - """ - for cookie in iter(self): - if cookie.name == name: - if domain is None or cookie.domain == domain: - if path is None or cookie.path == path: - return cookie.value - - raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") - - def _find_no_duplicates(self, name, domain=None, path=None): - """Both ``__get_item__`` and ``get`` call this function: it's never - used elsewhere in Requests. - - :param name: a string containing name of cookie - :param domain: (optional) string containing domain of cookie - :param path: (optional) string containing path of cookie - :raises KeyError: if cookie is not found - :raises CookieConflictError: if there are multiple cookies - that match name and optionally domain and path - :return: cookie.value - """ - toReturn = None - for cookie in iter(self): - if cookie.name == name: - if domain is None or cookie.domain == domain: - if path is None or cookie.path == path: - if toReturn is not None: - # if there are multiple cookies that meet passed in criteria - raise CookieConflictError( - f"There are multiple cookies with name, {name!r}" - ) - # we will eventually return this as long as no cookie conflict - toReturn = cookie.value - - if toReturn: - return toReturn - raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") - - def __getstate__(self): - """Unlike a normal CookieJar, this class is pickleable.""" - state = self.__dict__.copy() - # remove the unpickleable RLock object - state.pop("_cookies_lock") - return state - - def __setstate__(self, state): - """Unlike a normal CookieJar, this class is pickleable.""" - self.__dict__.update(state) - if "_cookies_lock" not in self.__dict__: - self._cookies_lock = threading.RLock() - - def copy(self): - """Return a copy of this RequestsCookieJar.""" - new_cj = RequestsCookieJar() - new_cj.set_policy(self.get_policy()) - new_cj.update(self) - return new_cj - - def get_policy(self): - """Return the CookiePolicy instance used.""" - return self._policy - - -def _copy_cookie_jar(jar): - if jar is None: - return None - - if hasattr(jar, "copy"): - # We're dealing with an instance of RequestsCookieJar - return jar.copy() - # We're dealing with a generic CookieJar instance - new_jar = copy.copy(jar) - new_jar.clear() - for cookie in jar: - new_jar.set_cookie(copy.copy(cookie)) - return new_jar - - -def create_cookie(name, value, **kwargs): - """Make a cookie from underspecified parameters. - - By default, the pair of `name` and `value` will be set for the domain '' - and sent on every request (this is sometimes called a "supercookie"). - """ - result = { - "version": 0, - "name": name, - "value": value, - "port": None, - "domain": "", - "path": "/", - "secure": False, - "expires": None, - "discard": True, - "comment": None, - "comment_url": None, - "rest": {"HttpOnly": None}, - "rfc2109": False, - } - - badargs = set(kwargs) - set(result) - if badargs: - raise TypeError( - f"create_cookie() got unexpected keyword arguments: {list(badargs)}" - ) - - result.update(kwargs) - result["port_specified"] = bool(result["port"]) - result["domain_specified"] = bool(result["domain"]) - result["domain_initial_dot"] = result["domain"].startswith(".") - result["path_specified"] = bool(result["path"]) - - return cookielib.Cookie(**result) - - -def morsel_to_cookie(morsel): - """Convert a Morsel object into a Cookie containing the one k/v pair.""" - - expires = None - if morsel["max-age"]: - try: - expires = int(time.time() + int(morsel["max-age"])) - except ValueError: - raise TypeError(f"max-age: {morsel['max-age']} must be integer") - elif morsel["expires"]: - time_template = "%a, %d-%b-%Y %H:%M:%S GMT" - expires = calendar.timegm(time.strptime(morsel["expires"], time_template)) - return create_cookie( - comment=morsel["comment"], - comment_url=bool(morsel["comment"]), - discard=False, - domain=morsel["domain"], - expires=expires, - name=morsel.key, - path=morsel["path"], - port=None, - rest={"HttpOnly": morsel["httponly"]}, - rfc2109=False, - secure=bool(morsel["secure"]), - value=morsel.value, - version=morsel["version"] or 0, - ) - - -def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): - """Returns a CookieJar from a key/value dictionary. - - :param cookie_dict: Dict of key/values to insert into CookieJar. - :param cookiejar: (optional) A cookiejar to add the cookies to. - :param overwrite: (optional) If False, will not replace cookies - already in the jar with new ones. - :rtype: CookieJar - """ - if cookiejar is None: - cookiejar = RequestsCookieJar() - - if cookie_dict is not None: - names_from_jar = [cookie.name for cookie in cookiejar] - for name in cookie_dict: - if overwrite or (name not in names_from_jar): - cookiejar.set_cookie(create_cookie(name, cookie_dict[name])) - - return cookiejar - - -def merge_cookies(cookiejar, cookies): - """Add cookies to cookiejar and returns a merged CookieJar. - - :param cookiejar: CookieJar object to add the cookies to. - :param cookies: Dictionary or CookieJar object to be added. - :rtype: CookieJar - """ - if not isinstance(cookiejar, cookielib.CookieJar): - raise ValueError("You can only merge into CookieJar") - - if isinstance(cookies, dict): - cookiejar = cookiejar_from_dict(cookies, cookiejar=cookiejar, overwrite=False) - elif isinstance(cookies, cookielib.CookieJar): - try: - cookiejar.update(cookies) - except AttributeError: - for cookie_in_jar in cookies: - cookiejar.set_cookie(cookie_in_jar) - - return cookiejar diff --git a/venv/lib/python3.8/site-packages/requests/exceptions.py b/venv/lib/python3.8/site-packages/requests/exceptions.py deleted file mode 100644 index e1cedf883d3eadcbfda91967d36b7c59b8367e76..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/exceptions.py +++ /dev/null @@ -1,141 +0,0 @@ -""" -requests.exceptions -~~~~~~~~~~~~~~~~~~~ - -This module contains the set of Requests' exceptions. -""" -from urllib3.exceptions import HTTPError as BaseHTTPError - -from .compat import JSONDecodeError as CompatJSONDecodeError - - -class RequestException(IOError): - """There was an ambiguous exception that occurred while handling your - request. - """ - - def __init__(self, *args, **kwargs): - """Initialize RequestException with `request` and `response` objects.""" - response = kwargs.pop("response", None) - self.response = response - self.request = kwargs.pop("request", None) - if response is not None and not self.request and hasattr(response, "request"): - self.request = self.response.request - super().__init__(*args, **kwargs) - - -class InvalidJSONError(RequestException): - """A JSON error occurred.""" - - -class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError): - """Couldn't decode the text into json""" - - def __init__(self, *args, **kwargs): - """ - Construct the JSONDecodeError instance first with all - args. Then use it's args to construct the IOError so that - the json specific args aren't used as IOError specific args - and the error message from JSONDecodeError is preserved. - """ - CompatJSONDecodeError.__init__(self, *args) - InvalidJSONError.__init__(self, *self.args, **kwargs) - - -class HTTPError(RequestException): - """An HTTP error occurred.""" - - -class ConnectionError(RequestException): - """A Connection error occurred.""" - - -class ProxyError(ConnectionError): - """A proxy error occurred.""" - - -class SSLError(ConnectionError): - """An SSL error occurred.""" - - -class Timeout(RequestException): - """The request timed out. - - Catching this error will catch both - :exc:`~requests.exceptions.ConnectTimeout` and - :exc:`~requests.exceptions.ReadTimeout` errors. - """ - - -class ConnectTimeout(ConnectionError, Timeout): - """The request timed out while trying to connect to the remote server. - - Requests that produced this error are safe to retry. - """ - - -class ReadTimeout(Timeout): - """The server did not send any data in the allotted amount of time.""" - - -class URLRequired(RequestException): - """A valid URL is required to make a request.""" - - -class TooManyRedirects(RequestException): - """Too many redirects.""" - - -class MissingSchema(RequestException, ValueError): - """The URL scheme (e.g. http or https) is missing.""" - - -class InvalidSchema(RequestException, ValueError): - """The URL scheme provided is either invalid or unsupported.""" - - -class InvalidURL(RequestException, ValueError): - """The URL provided was somehow invalid.""" - - -class InvalidHeader(RequestException, ValueError): - """The header value provided was somehow invalid.""" - - -class InvalidProxyURL(InvalidURL): - """The proxy URL provided is invalid.""" - - -class ChunkedEncodingError(RequestException): - """The server declared chunked encoding but sent an invalid chunk.""" - - -class ContentDecodingError(RequestException, BaseHTTPError): - """Failed to decode response content.""" - - -class StreamConsumedError(RequestException, TypeError): - """The content for this response was already consumed.""" - - -class RetryError(RequestException): - """Custom retries logic failed""" - - -class UnrewindableBodyError(RequestException): - """Requests encountered an error when trying to rewind a body.""" - - -# Warnings - - -class RequestsWarning(Warning): - """Base warning for Requests.""" - - -class FileModeWarning(RequestsWarning, DeprecationWarning): - """A file was opened in text mode, but Requests determined its binary length.""" - - -class RequestsDependencyWarning(RequestsWarning): - """An imported dependency doesn't match the expected version range.""" diff --git a/venv/lib/python3.8/site-packages/requests/help.py b/venv/lib/python3.8/site-packages/requests/help.py deleted file mode 100644 index 8fbcd6560a8fe2c8a07e3bd1441a81e0db9cb689..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/help.py +++ /dev/null @@ -1,134 +0,0 @@ -"""Module containing bug report helper(s).""" - -import json -import platform -import ssl -import sys - -import idna -import urllib3 - -from . import __version__ as requests_version - -try: - import charset_normalizer -except ImportError: - charset_normalizer = None - -try: - import chardet -except ImportError: - chardet = None - -try: - from urllib3.contrib import pyopenssl -except ImportError: - pyopenssl = None - OpenSSL = None - cryptography = None -else: - import cryptography - import OpenSSL - - -def _implementation(): - """Return a dict with the Python implementation and version. - - Provide both the name and the version of the Python implementation - currently running. For example, on CPython 3.10.3 it will return - {'name': 'CPython', 'version': '3.10.3'}. - - This function works best on CPython and PyPy: in particular, it probably - doesn't work for Jython or IronPython. Future investigation should be done - to work out the correct shape of the code for those platforms. - """ - implementation = platform.python_implementation() - - if implementation == "CPython": - implementation_version = platform.python_version() - elif implementation == "PyPy": - implementation_version = "{}.{}.{}".format( - sys.pypy_version_info.major, - sys.pypy_version_info.minor, - sys.pypy_version_info.micro, - ) - if sys.pypy_version_info.releaselevel != "final": - implementation_version = "".join( - [implementation_version, sys.pypy_version_info.releaselevel] - ) - elif implementation == "Jython": - implementation_version = platform.python_version() # Complete Guess - elif implementation == "IronPython": - implementation_version = platform.python_version() # Complete Guess - else: - implementation_version = "Unknown" - - return {"name": implementation, "version": implementation_version} - - -def info(): - """Generate information for a bug report.""" - try: - platform_info = { - "system": platform.system(), - "release": platform.release(), - } - except OSError: - platform_info = { - "system": "Unknown", - "release": "Unknown", - } - - implementation_info = _implementation() - urllib3_info = {"version": urllib3.__version__} - charset_normalizer_info = {"version": None} - chardet_info = {"version": None} - if charset_normalizer: - charset_normalizer_info = {"version": charset_normalizer.__version__} - if chardet: - chardet_info = {"version": chardet.__version__} - - pyopenssl_info = { - "version": None, - "openssl_version": "", - } - if OpenSSL: - pyopenssl_info = { - "version": OpenSSL.__version__, - "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", - } - cryptography_info = { - "version": getattr(cryptography, "__version__", ""), - } - idna_info = { - "version": getattr(idna, "__version__", ""), - } - - system_ssl = ssl.OPENSSL_VERSION_NUMBER - system_ssl_info = {"version": f"{system_ssl:x}" if system_ssl is not None else ""} - - return { - "platform": platform_info, - "implementation": implementation_info, - "system_ssl": system_ssl_info, - "using_pyopenssl": pyopenssl is not None, - "using_charset_normalizer": chardet is None, - "pyOpenSSL": pyopenssl_info, - "urllib3": urllib3_info, - "chardet": chardet_info, - "charset_normalizer": charset_normalizer_info, - "cryptography": cryptography_info, - "idna": idna_info, - "requests": { - "version": requests_version, - }, - } - - -def main(): - """Pretty-print the bug information as JSON.""" - print(json.dumps(info(), sort_keys=True, indent=2)) - - -if __name__ == "__main__": - main() diff --git a/venv/lib/python3.8/site-packages/requests/hooks.py b/venv/lib/python3.8/site-packages/requests/hooks.py deleted file mode 100644 index d181ba2ec2e55d274897315887b78fbdca757da8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/hooks.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -requests.hooks -~~~~~~~~~~~~~~ - -This module provides the capabilities for the Requests hooks system. - -Available hooks: - -``response``: - The response generated from a Request. -""" -HOOKS = ["response"] - - -def default_hooks(): - return {event: [] for event in HOOKS} - - -# TODO: response is the only one - - -def dispatch_hook(key, hooks, hook_data, **kwargs): - """Dispatches a hook dictionary on a given piece of data.""" - hooks = hooks or {} - hooks = hooks.get(key) - if hooks: - if hasattr(hooks, "__call__"): - hooks = [hooks] - for hook in hooks: - _hook_data = hook(hook_data, **kwargs) - if _hook_data is not None: - hook_data = _hook_data - return hook_data diff --git a/venv/lib/python3.8/site-packages/requests/models.py b/venv/lib/python3.8/site-packages/requests/models.py deleted file mode 100644 index 617a4134e556774953a56d10a2f8f211b15a605f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/models.py +++ /dev/null @@ -1,1034 +0,0 @@ -""" -requests.models -~~~~~~~~~~~~~~~ - -This module contains the primary objects that power Requests. -""" - -import datetime - -# Import encoding now, to avoid implicit import later. -# Implicit import within threads may cause LookupError when standard library is in a ZIP, -# such as in Embedded Python. See https://github.com/psf/requests/issues/3578. -import encodings.idna # noqa: F401 -from io import UnsupportedOperation - -from urllib3.exceptions import ( - DecodeError, - LocationParseError, - ProtocolError, - ReadTimeoutError, - SSLError, -) -from urllib3.fields import RequestField -from urllib3.filepost import encode_multipart_formdata -from urllib3.util import parse_url - -from ._internal_utils import to_native_string, unicode_is_ascii -from .auth import HTTPBasicAuth -from .compat import ( - Callable, - JSONDecodeError, - Mapping, - basestring, - builtin_str, - chardet, - cookielib, -) -from .compat import json as complexjson -from .compat import urlencode, urlsplit, urlunparse -from .cookies import _copy_cookie_jar, cookiejar_from_dict, get_cookie_header -from .exceptions import ( - ChunkedEncodingError, - ConnectionError, - ContentDecodingError, - HTTPError, - InvalidJSONError, - InvalidURL, -) -from .exceptions import JSONDecodeError as RequestsJSONDecodeError -from .exceptions import MissingSchema -from .exceptions import SSLError as RequestsSSLError -from .exceptions import StreamConsumedError -from .hooks import default_hooks -from .status_codes import codes -from .structures import CaseInsensitiveDict -from .utils import ( - check_header_validity, - get_auth_from_url, - guess_filename, - guess_json_utf, - iter_slices, - parse_header_links, - requote_uri, - stream_decode_response_unicode, - super_len, - to_key_val_list, -) - -#: The set of HTTP status codes that indicate an automatically -#: processable redirect. -REDIRECT_STATI = ( - codes.moved, # 301 - codes.found, # 302 - codes.other, # 303 - codes.temporary_redirect, # 307 - codes.permanent_redirect, # 308 -) - -DEFAULT_REDIRECT_LIMIT = 30 -CONTENT_CHUNK_SIZE = 10 * 1024 -ITER_CHUNK_SIZE = 512 - - -class RequestEncodingMixin: - @property - def path_url(self): - """Build the path URL to use.""" - - url = [] - - p = urlsplit(self.url) - - path = p.path - if not path: - path = "/" - - url.append(path) - - query = p.query - if query: - url.append("?") - url.append(query) - - return "".join(url) - - @staticmethod - def _encode_params(data): - """Encode parameters in a piece of data. - - Will successfully encode parameters when passed as a dict or a list of - 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary - if parameters are supplied as a dict. - """ - - if isinstance(data, (str, bytes)): - return data - elif hasattr(data, "read"): - return data - elif hasattr(data, "__iter__"): - result = [] - for k, vs in to_key_val_list(data): - if isinstance(vs, basestring) or not hasattr(vs, "__iter__"): - vs = [vs] - for v in vs: - if v is not None: - result.append( - ( - k.encode("utf-8") if isinstance(k, str) else k, - v.encode("utf-8") if isinstance(v, str) else v, - ) - ) - return urlencode(result, doseq=True) - else: - return data - - @staticmethod - def _encode_files(files, data): - """Build the body for a multipart/form-data request. - - Will successfully encode files when passed as a dict or a list of - tuples. Order is retained if data is a list of tuples but arbitrary - if parameters are supplied as a dict. - The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) - or 4-tuples (filename, fileobj, contentype, custom_headers). - """ - if not files: - raise ValueError("Files must be provided.") - elif isinstance(data, basestring): - raise ValueError("Data must not be a string.") - - new_fields = [] - fields = to_key_val_list(data or {}) - files = to_key_val_list(files or {}) - - for field, val in fields: - if isinstance(val, basestring) or not hasattr(val, "__iter__"): - val = [val] - for v in val: - if v is not None: - # Don't call str() on bytestrings: in Py3 it all goes wrong. - if not isinstance(v, bytes): - v = str(v) - - new_fields.append( - ( - field.decode("utf-8") - if isinstance(field, bytes) - else field, - v.encode("utf-8") if isinstance(v, str) else v, - ) - ) - - for (k, v) in files: - # support for explicit filename - ft = None - fh = None - if isinstance(v, (tuple, list)): - if len(v) == 2: - fn, fp = v - elif len(v) == 3: - fn, fp, ft = v - else: - fn, fp, ft, fh = v - else: - fn = guess_filename(v) or k - fp = v - - if isinstance(fp, (str, bytes, bytearray)): - fdata = fp - elif hasattr(fp, "read"): - fdata = fp.read() - elif fp is None: - continue - else: - fdata = fp - - rf = RequestField(name=k, data=fdata, filename=fn, headers=fh) - rf.make_multipart(content_type=ft) - new_fields.append(rf) - - body, content_type = encode_multipart_formdata(new_fields) - - return body, content_type - - -class RequestHooksMixin: - def register_hook(self, event, hook): - """Properly register a hook.""" - - if event not in self.hooks: - raise ValueError(f'Unsupported event specified, with event name "{event}"') - - if isinstance(hook, Callable): - self.hooks[event].append(hook) - elif hasattr(hook, "__iter__"): - self.hooks[event].extend(h for h in hook if isinstance(h, Callable)) - - def deregister_hook(self, event, hook): - """Deregister a previously registered hook. - Returns True if the hook existed, False if not. - """ - - try: - self.hooks[event].remove(hook) - return True - except ValueError: - return False - - -class Request(RequestHooksMixin): - """A user-created :class:`Request ` object. - - Used to prepare a :class:`PreparedRequest `, which is sent to the server. - - :param method: HTTP method to use. - :param url: URL to send. - :param headers: dictionary of headers to send. - :param files: dictionary of {filename: fileobject} files to multipart upload. - :param data: the body to attach to the request. If a dictionary or - list of tuples ``[(key, value)]`` is provided, form-encoding will - take place. - :param json: json for the body to attach to the request (if files or data is not specified). - :param params: URL parameters to append to the URL. If a dictionary or - list of tuples ``[(key, value)]`` is provided, form-encoding will - take place. - :param auth: Auth handler or (user, pass) tuple. - :param cookies: dictionary or CookieJar of cookies to attach to this request. - :param hooks: dictionary of callback hooks, for internal usage. - - Usage:: - - >>> import requests - >>> req = requests.Request('GET', 'https://httpbin.org/get') - >>> req.prepare() - - """ - - def __init__( - self, - method=None, - url=None, - headers=None, - files=None, - data=None, - params=None, - auth=None, - cookies=None, - hooks=None, - json=None, - ): - - # Default empty dicts for dict params. - data = [] if data is None else data - files = [] if files is None else files - headers = {} if headers is None else headers - params = {} if params is None else params - hooks = {} if hooks is None else hooks - - self.hooks = default_hooks() - for (k, v) in list(hooks.items()): - self.register_hook(event=k, hook=v) - - self.method = method - self.url = url - self.headers = headers - self.files = files - self.data = data - self.json = json - self.params = params - self.auth = auth - self.cookies = cookies - - def __repr__(self): - return f"" - - def prepare(self): - """Constructs a :class:`PreparedRequest ` for transmission and returns it.""" - p = PreparedRequest() - p.prepare( - method=self.method, - url=self.url, - headers=self.headers, - files=self.files, - data=self.data, - json=self.json, - params=self.params, - auth=self.auth, - cookies=self.cookies, - hooks=self.hooks, - ) - return p - - -class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): - """The fully mutable :class:`PreparedRequest ` object, - containing the exact bytes that will be sent to the server. - - Instances are generated from a :class:`Request ` object, and - should not be instantiated manually; doing so may produce undesirable - effects. - - Usage:: - - >>> import requests - >>> req = requests.Request('GET', 'https://httpbin.org/get') - >>> r = req.prepare() - >>> r - - - >>> s = requests.Session() - >>> s.send(r) - - """ - - def __init__(self): - #: HTTP verb to send to the server. - self.method = None - #: HTTP URL to send the request to. - self.url = None - #: dictionary of HTTP headers. - self.headers = None - # The `CookieJar` used to create the Cookie header will be stored here - # after prepare_cookies is called - self._cookies = None - #: request body to send to the server. - self.body = None - #: dictionary of callback hooks, for internal usage. - self.hooks = default_hooks() - #: integer denoting starting position of a readable file-like body. - self._body_position = None - - def prepare( - self, - method=None, - url=None, - headers=None, - files=None, - data=None, - params=None, - auth=None, - cookies=None, - hooks=None, - json=None, - ): - """Prepares the entire request with the given parameters.""" - - self.prepare_method(method) - self.prepare_url(url, params) - self.prepare_headers(headers) - self.prepare_cookies(cookies) - self.prepare_body(data, files, json) - self.prepare_auth(auth, url) - - # Note that prepare_auth must be last to enable authentication schemes - # such as OAuth to work on a fully prepared request. - - # This MUST go after prepare_auth. Authenticators could add a hook - self.prepare_hooks(hooks) - - def __repr__(self): - return f"" - - def copy(self): - p = PreparedRequest() - p.method = self.method - p.url = self.url - p.headers = self.headers.copy() if self.headers is not None else None - p._cookies = _copy_cookie_jar(self._cookies) - p.body = self.body - p.hooks = self.hooks - p._body_position = self._body_position - return p - - def prepare_method(self, method): - """Prepares the given HTTP method.""" - self.method = method - if self.method is not None: - self.method = to_native_string(self.method.upper()) - - @staticmethod - def _get_idna_encoded_host(host): - import idna - - try: - host = idna.encode(host, uts46=True).decode("utf-8") - except idna.IDNAError: - raise UnicodeError - return host - - def prepare_url(self, url, params): - """Prepares the given HTTP URL.""" - #: Accept objects that have string representations. - #: We're unable to blindly call unicode/str functions - #: as this will include the bytestring indicator (b'') - #: on python 3.x. - #: https://github.com/psf/requests/pull/2238 - if isinstance(url, bytes): - url = url.decode("utf8") - else: - url = str(url) - - # Remove leading whitespaces from url - url = url.lstrip() - - # Don't do any URL preparation for non-HTTP schemes like `mailto`, - # `data` etc to work around exceptions from `url_parse`, which - # handles RFC 3986 only. - if ":" in url and not url.lower().startswith("http"): - self.url = url - return - - # Support for unicode domain names and paths. - try: - scheme, auth, host, port, path, query, fragment = parse_url(url) - except LocationParseError as e: - raise InvalidURL(*e.args) - - if not scheme: - raise MissingSchema( - f"Invalid URL {url!r}: No scheme supplied. " - f"Perhaps you meant https://{url}?" - ) - - if not host: - raise InvalidURL(f"Invalid URL {url!r}: No host supplied") - - # In general, we want to try IDNA encoding the hostname if the string contains - # non-ASCII characters. This allows users to automatically get the correct IDNA - # behaviour. For strings containing only ASCII characters, we need to also verify - # it doesn't start with a wildcard (*), before allowing the unencoded hostname. - if not unicode_is_ascii(host): - try: - host = self._get_idna_encoded_host(host) - except UnicodeError: - raise InvalidURL("URL has an invalid label.") - elif host.startswith(("*", ".")): - raise InvalidURL("URL has an invalid label.") - - # Carefully reconstruct the network location - netloc = auth or "" - if netloc: - netloc += "@" - netloc += host - if port: - netloc += f":{port}" - - # Bare domains aren't valid URLs. - if not path: - path = "/" - - if isinstance(params, (str, bytes)): - params = to_native_string(params) - - enc_params = self._encode_params(params) - if enc_params: - if query: - query = f"{query}&{enc_params}" - else: - query = enc_params - - url = requote_uri(urlunparse([scheme, netloc, path, None, query, fragment])) - self.url = url - - def prepare_headers(self, headers): - """Prepares the given HTTP headers.""" - - self.headers = CaseInsensitiveDict() - if headers: - for header in headers.items(): - # Raise exception on invalid header value. - check_header_validity(header) - name, value = header - self.headers[to_native_string(name)] = value - - def prepare_body(self, data, files, json=None): - """Prepares the given HTTP body data.""" - - # Check if file, fo, generator, iterator. - # If not, run through normal process. - - # Nottin' on you. - body = None - content_type = None - - if not data and json is not None: - # urllib3 requires a bytes-like body. Python 2's json.dumps - # provides this natively, but Python 3 gives a Unicode string. - content_type = "application/json" - - try: - body = complexjson.dumps(json, allow_nan=False) - except ValueError as ve: - raise InvalidJSONError(ve, request=self) - - if not isinstance(body, bytes): - body = body.encode("utf-8") - - is_stream = all( - [ - hasattr(data, "__iter__"), - not isinstance(data, (basestring, list, tuple, Mapping)), - ] - ) - - if is_stream: - try: - length = super_len(data) - except (TypeError, AttributeError, UnsupportedOperation): - length = None - - body = data - - if getattr(body, "tell", None) is not None: - # Record the current file position before reading. - # This will allow us to rewind a file in the event - # of a redirect. - try: - self._body_position = body.tell() - except OSError: - # This differentiates from None, allowing us to catch - # a failed `tell()` later when trying to rewind the body - self._body_position = object() - - if files: - raise NotImplementedError( - "Streamed bodies and files are mutually exclusive." - ) - - if length: - self.headers["Content-Length"] = builtin_str(length) - else: - self.headers["Transfer-Encoding"] = "chunked" - else: - # Multi-part file uploads. - if files: - (body, content_type) = self._encode_files(files, data) - else: - if data: - body = self._encode_params(data) - if isinstance(data, basestring) or hasattr(data, "read"): - content_type = None - else: - content_type = "application/x-www-form-urlencoded" - - self.prepare_content_length(body) - - # Add content-type if it wasn't explicitly provided. - if content_type and ("content-type" not in self.headers): - self.headers["Content-Type"] = content_type - - self.body = body - - def prepare_content_length(self, body): - """Prepare Content-Length header based on request method and body""" - if body is not None: - length = super_len(body) - if length: - # If length exists, set it. Otherwise, we fallback - # to Transfer-Encoding: chunked. - self.headers["Content-Length"] = builtin_str(length) - elif ( - self.method not in ("GET", "HEAD") - and self.headers.get("Content-Length") is None - ): - # Set Content-Length to 0 for methods that can have a body - # but don't provide one. (i.e. not GET or HEAD) - self.headers["Content-Length"] = "0" - - def prepare_auth(self, auth, url=""): - """Prepares the given HTTP auth data.""" - - # If no Auth is explicitly provided, extract it from the URL first. - if auth is None: - url_auth = get_auth_from_url(self.url) - auth = url_auth if any(url_auth) else None - - if auth: - if isinstance(auth, tuple) and len(auth) == 2: - # special-case basic HTTP auth - auth = HTTPBasicAuth(*auth) - - # Allow auth to make its changes. - r = auth(self) - - # Update self to reflect the auth changes. - self.__dict__.update(r.__dict__) - - # Recompute Content-Length - self.prepare_content_length(self.body) - - def prepare_cookies(self, cookies): - """Prepares the given HTTP cookie data. - - This function eventually generates a ``Cookie`` header from the - given cookies using cookielib. Due to cookielib's design, the header - will not be regenerated if it already exists, meaning this function - can only be called once for the life of the - :class:`PreparedRequest ` object. Any subsequent calls - to ``prepare_cookies`` will have no actual effect, unless the "Cookie" - header is removed beforehand. - """ - if isinstance(cookies, cookielib.CookieJar): - self._cookies = cookies - else: - self._cookies = cookiejar_from_dict(cookies) - - cookie_header = get_cookie_header(self._cookies, self) - if cookie_header is not None: - self.headers["Cookie"] = cookie_header - - def prepare_hooks(self, hooks): - """Prepares the given hooks.""" - # hooks can be passed as None to the prepare method and to this - # method. To prevent iterating over None, simply use an empty list - # if hooks is False-y - hooks = hooks or [] - for event in hooks: - self.register_hook(event, hooks[event]) - - -class Response: - """The :class:`Response ` object, which contains a - server's response to an HTTP request. - """ - - __attrs__ = [ - "_content", - "status_code", - "headers", - "url", - "history", - "encoding", - "reason", - "cookies", - "elapsed", - "request", - ] - - def __init__(self): - self._content = False - self._content_consumed = False - self._next = None - - #: Integer Code of responded HTTP Status, e.g. 404 or 200. - self.status_code = None - - #: Case-insensitive Dictionary of Response Headers. - #: For example, ``headers['content-encoding']`` will return the - #: value of a ``'Content-Encoding'`` response header. - self.headers = CaseInsensitiveDict() - - #: File-like object representation of response (for advanced usage). - #: Use of ``raw`` requires that ``stream=True`` be set on the request. - #: This requirement does not apply for use internally to Requests. - self.raw = None - - #: Final URL location of Response. - self.url = None - - #: Encoding to decode with when accessing r.text. - self.encoding = None - - #: A list of :class:`Response ` objects from - #: the history of the Request. Any redirect responses will end - #: up here. The list is sorted from the oldest to the most recent request. - self.history = [] - - #: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK". - self.reason = None - - #: A CookieJar of Cookies the server sent back. - self.cookies = cookiejar_from_dict({}) - - #: The amount of time elapsed between sending the request - #: and the arrival of the response (as a timedelta). - #: This property specifically measures the time taken between sending - #: the first byte of the request and finishing parsing the headers. It - #: is therefore unaffected by consuming the response content or the - #: value of the ``stream`` keyword argument. - self.elapsed = datetime.timedelta(0) - - #: The :class:`PreparedRequest ` object to which this - #: is a response. - self.request = None - - def __enter__(self): - return self - - def __exit__(self, *args): - self.close() - - def __getstate__(self): - # Consume everything; accessing the content attribute makes - # sure the content has been fully read. - if not self._content_consumed: - self.content - - return {attr: getattr(self, attr, None) for attr in self.__attrs__} - - def __setstate__(self, state): - for name, value in state.items(): - setattr(self, name, value) - - # pickled objects do not have .raw - setattr(self, "_content_consumed", True) - setattr(self, "raw", None) - - def __repr__(self): - return f"" - - def __bool__(self): - """Returns True if :attr:`status_code` is less than 400. - - This attribute checks if the status code of the response is between - 400 and 600 to see if there was a client error or a server error. If - the status code, is between 200 and 400, this will return True. This - is **not** a check to see if the response code is ``200 OK``. - """ - return self.ok - - def __nonzero__(self): - """Returns True if :attr:`status_code` is less than 400. - - This attribute checks if the status code of the response is between - 400 and 600 to see if there was a client error or a server error. If - the status code, is between 200 and 400, this will return True. This - is **not** a check to see if the response code is ``200 OK``. - """ - return self.ok - - def __iter__(self): - """Allows you to use a response as an iterator.""" - return self.iter_content(128) - - @property - def ok(self): - """Returns True if :attr:`status_code` is less than 400, False if not. - - This attribute checks if the status code of the response is between - 400 and 600 to see if there was a client error or a server error. If - the status code is between 200 and 400, this will return True. This - is **not** a check to see if the response code is ``200 OK``. - """ - try: - self.raise_for_status() - except HTTPError: - return False - return True - - @property - def is_redirect(self): - """True if this Response is a well-formed HTTP redirect that could have - been processed automatically (by :meth:`Session.resolve_redirects`). - """ - return "location" in self.headers and self.status_code in REDIRECT_STATI - - @property - def is_permanent_redirect(self): - """True if this Response one of the permanent versions of redirect.""" - return "location" in self.headers and self.status_code in ( - codes.moved_permanently, - codes.permanent_redirect, - ) - - @property - def next(self): - """Returns a PreparedRequest for the next request in a redirect chain, if there is one.""" - return self._next - - @property - def apparent_encoding(self): - """The apparent encoding, provided by the charset_normalizer or chardet libraries.""" - return chardet.detect(self.content)["encoding"] - - def iter_content(self, chunk_size=1, decode_unicode=False): - """Iterates over the response data. When stream=True is set on the - request, this avoids reading the content at once into memory for - large responses. The chunk size is the number of bytes it should - read into memory. This is not necessarily the length of each item - returned as decoding can take place. - - chunk_size must be of type int or None. A value of None will - function differently depending on the value of `stream`. - stream=True will read data as it arrives in whatever size the - chunks are received. If stream=False, data is returned as - a single chunk. - - If decode_unicode is True, content will be decoded using the best - available encoding based on the response. - """ - - def generate(): - # Special case for urllib3. - if hasattr(self.raw, "stream"): - try: - yield from self.raw.stream(chunk_size, decode_content=True) - except ProtocolError as e: - raise ChunkedEncodingError(e) - except DecodeError as e: - raise ContentDecodingError(e) - except ReadTimeoutError as e: - raise ConnectionError(e) - except SSLError as e: - raise RequestsSSLError(e) - else: - # Standard file-like object. - while True: - chunk = self.raw.read(chunk_size) - if not chunk: - break - yield chunk - - self._content_consumed = True - - if self._content_consumed and isinstance(self._content, bool): - raise StreamConsumedError() - elif chunk_size is not None and not isinstance(chunk_size, int): - raise TypeError( - f"chunk_size must be an int, it is instead a {type(chunk_size)}." - ) - # simulate reading small chunks of the content - reused_chunks = iter_slices(self._content, chunk_size) - - stream_chunks = generate() - - chunks = reused_chunks if self._content_consumed else stream_chunks - - if decode_unicode: - chunks = stream_decode_response_unicode(chunks, self) - - return chunks - - def iter_lines( - self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=False, delimiter=None - ): - """Iterates over the response data, one line at a time. When - stream=True is set on the request, this avoids reading the - content at once into memory for large responses. - - .. note:: This method is not reentrant safe. - """ - - pending = None - - for chunk in self.iter_content( - chunk_size=chunk_size, decode_unicode=decode_unicode - ): - - if pending is not None: - chunk = pending + chunk - - if delimiter: - lines = chunk.split(delimiter) - else: - lines = chunk.splitlines() - - if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]: - pending = lines.pop() - else: - pending = None - - yield from lines - - if pending is not None: - yield pending - - @property - def content(self): - """Content of the response, in bytes.""" - - if self._content is False: - # Read the contents. - if self._content_consumed: - raise RuntimeError("The content for this response was already consumed") - - if self.status_code == 0 or self.raw is None: - self._content = None - else: - self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b"" - - self._content_consumed = True - # don't need to release the connection; that's been handled by urllib3 - # since we exhausted the data. - return self._content - - @property - def text(self): - """Content of the response, in unicode. - - If Response.encoding is None, encoding will be guessed using - ``charset_normalizer`` or ``chardet``. - - The encoding of the response content is determined based solely on HTTP - headers, following RFC 2616 to the letter. If you can take advantage of - non-HTTP knowledge to make a better guess at the encoding, you should - set ``r.encoding`` appropriately before accessing this property. - """ - - # Try charset from content-type - content = None - encoding = self.encoding - - if not self.content: - return "" - - # Fallback to auto-detected encoding. - if self.encoding is None: - encoding = self.apparent_encoding - - # Decode unicode from given encoding. - try: - content = str(self.content, encoding, errors="replace") - except (LookupError, TypeError): - # A LookupError is raised if the encoding was not found which could - # indicate a misspelling or similar mistake. - # - # A TypeError can be raised if encoding is None - # - # So we try blindly encoding. - content = str(self.content, errors="replace") - - return content - - def json(self, **kwargs): - r"""Returns the json-encoded content of a response, if any. - - :param \*\*kwargs: Optional arguments that ``json.loads`` takes. - :raises requests.exceptions.JSONDecodeError: If the response body does not - contain valid json. - """ - - if not self.encoding and self.content and len(self.content) > 3: - # No encoding set. JSON RFC 4627 section 3 states we should expect - # UTF-8, -16 or -32. Detect which one to use; If the detection or - # decoding fails, fall back to `self.text` (using charset_normalizer to make - # a best guess). - encoding = guess_json_utf(self.content) - if encoding is not None: - try: - return complexjson.loads(self.content.decode(encoding), **kwargs) - except UnicodeDecodeError: - # Wrong UTF codec detected; usually because it's not UTF-8 - # but some other 8-bit codec. This is an RFC violation, - # and the server didn't bother to tell us what codec *was* - # used. - pass - except JSONDecodeError as e: - raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) - - try: - return complexjson.loads(self.text, **kwargs) - except JSONDecodeError as e: - # Catch JSON-related errors and raise as requests.JSONDecodeError - # This aliases json.JSONDecodeError and simplejson.JSONDecodeError - raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) - - @property - def links(self): - """Returns the parsed header links of the response, if any.""" - - header = self.headers.get("link") - - resolved_links = {} - - if header: - links = parse_header_links(header) - - for link in links: - key = link.get("rel") or link.get("url") - resolved_links[key] = link - - return resolved_links - - def raise_for_status(self): - """Raises :class:`HTTPError`, if one occurred.""" - - http_error_msg = "" - if isinstance(self.reason, bytes): - # We attempt to decode utf-8 first because some servers - # choose to localize their reason strings. If the string - # isn't utf-8, we fall back to iso-8859-1 for all other - # encodings. (See PR #3538) - try: - reason = self.reason.decode("utf-8") - except UnicodeDecodeError: - reason = self.reason.decode("iso-8859-1") - else: - reason = self.reason - - if 400 <= self.status_code < 500: - http_error_msg = ( - f"{self.status_code} Client Error: {reason} for url: {self.url}" - ) - - elif 500 <= self.status_code < 600: - http_error_msg = ( - f"{self.status_code} Server Error: {reason} for url: {self.url}" - ) - - if http_error_msg: - raise HTTPError(http_error_msg, response=self) - - def close(self): - """Releases the connection back to the pool. Once this method has been - called the underlying ``raw`` object must not be accessed again. - - *Note: Should not normally need to be called explicitly.* - """ - if not self._content_consumed: - self.raw.close() - - release_conn = getattr(self.raw, "release_conn", None) - if release_conn is not None: - release_conn() diff --git a/venv/lib/python3.8/site-packages/requests/packages.py b/venv/lib/python3.8/site-packages/requests/packages.py deleted file mode 100644 index 77c45c9e90cdf2bcd60eea3cac9c8cf56cca2c08..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/packages.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys - -try: - import chardet -except ImportError: - import warnings - - import charset_normalizer as chardet - - warnings.filterwarnings("ignore", "Trying to detect", module="charset_normalizer") - -# This code exists for backwards compatibility reasons. -# I don't like it either. Just look the other way. :) - -for package in ("urllib3", "idna"): - locals()[package] = __import__(package) - # This traversal is apparently necessary such that the identities are - # preserved (requests.packages.urllib3.* is urllib3.*) - for mod in list(sys.modules): - if mod == package or mod.startswith(f"{package}."): - sys.modules[f"requests.packages.{mod}"] = sys.modules[mod] - -target = chardet.__name__ -for mod in list(sys.modules): - if mod == target or mod.startswith(f"{target}."): - target = target.replace(target, "chardet") - sys.modules[f"requests.packages.{target}"] = sys.modules[mod] -# Kinda cool, though, right? diff --git a/venv/lib/python3.8/site-packages/requests/sessions.py b/venv/lib/python3.8/site-packages/requests/sessions.py deleted file mode 100644 index dbcf2a7b0ee2898b72714b756e4b27fbbad4beab..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/sessions.py +++ /dev/null @@ -1,833 +0,0 @@ -""" -requests.sessions -~~~~~~~~~~~~~~~~~ - -This module provides a Session object to manage and persist settings across -requests (cookies, auth, proxies). -""" -import os -import sys -import time -from collections import OrderedDict -from datetime import timedelta - -from ._internal_utils import to_native_string -from .adapters import HTTPAdapter -from .auth import _basic_auth_str -from .compat import Mapping, cookielib, urljoin, urlparse -from .cookies import ( - RequestsCookieJar, - cookiejar_from_dict, - extract_cookies_to_jar, - merge_cookies, -) -from .exceptions import ( - ChunkedEncodingError, - ContentDecodingError, - InvalidSchema, - TooManyRedirects, -) -from .hooks import default_hooks, dispatch_hook - -# formerly defined here, reexposed here for backward compatibility -from .models import ( # noqa: F401 - DEFAULT_REDIRECT_LIMIT, - REDIRECT_STATI, - PreparedRequest, - Request, -) -from .status_codes import codes -from .structures import CaseInsensitiveDict -from .utils import ( # noqa: F401 - DEFAULT_PORTS, - default_headers, - get_auth_from_url, - get_environ_proxies, - get_netrc_auth, - requote_uri, - resolve_proxies, - rewind_body, - should_bypass_proxies, - to_key_val_list, -) - -# Preferred clock, based on which one is more accurate on a given system. -if sys.platform == "win32": - preferred_clock = time.perf_counter -else: - preferred_clock = time.time - - -def merge_setting(request_setting, session_setting, dict_class=OrderedDict): - """Determines appropriate setting for a given request, taking into account - the explicit setting on that request, and the setting in the session. If a - setting is a dictionary, they will be merged together using `dict_class` - """ - - if session_setting is None: - return request_setting - - if request_setting is None: - return session_setting - - # Bypass if not a dictionary (e.g. verify) - if not ( - isinstance(session_setting, Mapping) and isinstance(request_setting, Mapping) - ): - return request_setting - - merged_setting = dict_class(to_key_val_list(session_setting)) - merged_setting.update(to_key_val_list(request_setting)) - - # Remove keys that are set to None. Extract keys first to avoid altering - # the dictionary during iteration. - none_keys = [k for (k, v) in merged_setting.items() if v is None] - for key in none_keys: - del merged_setting[key] - - return merged_setting - - -def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict): - """Properly merges both requests and session hooks. - - This is necessary because when request_hooks == {'response': []}, the - merge breaks Session hooks entirely. - """ - if session_hooks is None or session_hooks.get("response") == []: - return request_hooks - - if request_hooks is None or request_hooks.get("response") == []: - return session_hooks - - return merge_setting(request_hooks, session_hooks, dict_class) - - -class SessionRedirectMixin: - def get_redirect_target(self, resp): - """Receives a Response. Returns a redirect URI or ``None``""" - # Due to the nature of how requests processes redirects this method will - # be called at least once upon the original response and at least twice - # on each subsequent redirect response (if any). - # If a custom mixin is used to handle this logic, it may be advantageous - # to cache the redirect location onto the response object as a private - # attribute. - if resp.is_redirect: - location = resp.headers["location"] - # Currently the underlying http module on py3 decode headers - # in latin1, but empirical evidence suggests that latin1 is very - # rarely used with non-ASCII characters in HTTP headers. - # It is more likely to get UTF8 header rather than latin1. - # This causes incorrect handling of UTF8 encoded location headers. - # To solve this, we re-encode the location in latin1. - location = location.encode("latin1") - return to_native_string(location, "utf8") - return None - - def should_strip_auth(self, old_url, new_url): - """Decide whether Authorization header should be removed when redirecting""" - old_parsed = urlparse(old_url) - new_parsed = urlparse(new_url) - if old_parsed.hostname != new_parsed.hostname: - return True - # Special case: allow http -> https redirect when using the standard - # ports. This isn't specified by RFC 7235, but is kept to avoid - # breaking backwards compatibility with older versions of requests - # that allowed any redirects on the same host. - if ( - old_parsed.scheme == "http" - and old_parsed.port in (80, None) - and new_parsed.scheme == "https" - and new_parsed.port in (443, None) - ): - return False - - # Handle default port usage corresponding to scheme. - changed_port = old_parsed.port != new_parsed.port - changed_scheme = old_parsed.scheme != new_parsed.scheme - default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None) - if ( - not changed_scheme - and old_parsed.port in default_port - and new_parsed.port in default_port - ): - return False - - # Standard case: root URI must match - return changed_port or changed_scheme - - def resolve_redirects( - self, - resp, - req, - stream=False, - timeout=None, - verify=True, - cert=None, - proxies=None, - yield_requests=False, - **adapter_kwargs, - ): - """Receives a Response. Returns a generator of Responses or Requests.""" - - hist = [] # keep track of history - - url = self.get_redirect_target(resp) - previous_fragment = urlparse(req.url).fragment - while url: - prepared_request = req.copy() - - # Update history and keep track of redirects. - # resp.history must ignore the original request in this loop - hist.append(resp) - resp.history = hist[1:] - - try: - resp.content # Consume socket so it can be released - except (ChunkedEncodingError, ContentDecodingError, RuntimeError): - resp.raw.read(decode_content=False) - - if len(resp.history) >= self.max_redirects: - raise TooManyRedirects( - f"Exceeded {self.max_redirects} redirects.", response=resp - ) - - # Release the connection back into the pool. - resp.close() - - # Handle redirection without scheme (see: RFC 1808 Section 4) - if url.startswith("//"): - parsed_rurl = urlparse(resp.url) - url = ":".join([to_native_string(parsed_rurl.scheme), url]) - - # Normalize url case and attach previous fragment if needed (RFC 7231 7.1.2) - parsed = urlparse(url) - if parsed.fragment == "" and previous_fragment: - parsed = parsed._replace(fragment=previous_fragment) - elif parsed.fragment: - previous_fragment = parsed.fragment - url = parsed.geturl() - - # Facilitate relative 'location' headers, as allowed by RFC 7231. - # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') - # Compliant with RFC3986, we percent encode the url. - if not parsed.netloc: - url = urljoin(resp.url, requote_uri(url)) - else: - url = requote_uri(url) - - prepared_request.url = to_native_string(url) - - self.rebuild_method(prepared_request, resp) - - # https://github.com/psf/requests/issues/1084 - if resp.status_code not in ( - codes.temporary_redirect, - codes.permanent_redirect, - ): - # https://github.com/psf/requests/issues/3490 - purged_headers = ("Content-Length", "Content-Type", "Transfer-Encoding") - for header in purged_headers: - prepared_request.headers.pop(header, None) - prepared_request.body = None - - headers = prepared_request.headers - headers.pop("Cookie", None) - - # Extract any cookies sent on the response to the cookiejar - # in the new request. Because we've mutated our copied prepared - # request, use the old one that we haven't yet touched. - extract_cookies_to_jar(prepared_request._cookies, req, resp.raw) - merge_cookies(prepared_request._cookies, self.cookies) - prepared_request.prepare_cookies(prepared_request._cookies) - - # Rebuild auth and proxy information. - proxies = self.rebuild_proxies(prepared_request, proxies) - self.rebuild_auth(prepared_request, resp) - - # A failed tell() sets `_body_position` to `object()`. This non-None - # value ensures `rewindable` will be True, allowing us to raise an - # UnrewindableBodyError, instead of hanging the connection. - rewindable = prepared_request._body_position is not None and ( - "Content-Length" in headers or "Transfer-Encoding" in headers - ) - - # Attempt to rewind consumed file-like object. - if rewindable: - rewind_body(prepared_request) - - # Override the original request. - req = prepared_request - - if yield_requests: - yield req - else: - - resp = self.send( - req, - stream=stream, - timeout=timeout, - verify=verify, - cert=cert, - proxies=proxies, - allow_redirects=False, - **adapter_kwargs, - ) - - extract_cookies_to_jar(self.cookies, prepared_request, resp.raw) - - # extract redirect url, if any, for the next loop - url = self.get_redirect_target(resp) - yield resp - - def rebuild_auth(self, prepared_request, response): - """When being redirected we may want to strip authentication from the - request to avoid leaking credentials. This method intelligently removes - and reapplies authentication where possible to avoid credential loss. - """ - headers = prepared_request.headers - url = prepared_request.url - - if "Authorization" in headers and self.should_strip_auth( - response.request.url, url - ): - # If we get redirected to a new host, we should strip out any - # authentication headers. - del headers["Authorization"] - - # .netrc might have more auth for us on our new host. - new_auth = get_netrc_auth(url) if self.trust_env else None - if new_auth is not None: - prepared_request.prepare_auth(new_auth) - - def rebuild_proxies(self, prepared_request, proxies): - """This method re-evaluates the proxy configuration by considering the - environment variables. If we are redirected to a URL covered by - NO_PROXY, we strip the proxy configuration. Otherwise, we set missing - proxy keys for this URL (in case they were stripped by a previous - redirect). - - This method also replaces the Proxy-Authorization header where - necessary. - - :rtype: dict - """ - headers = prepared_request.headers - scheme = urlparse(prepared_request.url).scheme - new_proxies = resolve_proxies(prepared_request, proxies, self.trust_env) - - if "Proxy-Authorization" in headers: - del headers["Proxy-Authorization"] - - try: - username, password = get_auth_from_url(new_proxies[scheme]) - except KeyError: - username, password = None, None - - # urllib3 handles proxy authorization for us in the standard adapter. - # Avoid appending this to TLS tunneled requests where it may be leaked. - if not scheme.startswith('https') and username and password: - headers["Proxy-Authorization"] = _basic_auth_str(username, password) - - return new_proxies - - def rebuild_method(self, prepared_request, response): - """When being redirected we may want to change the method of the request - based on certain specs or browser behavior. - """ - method = prepared_request.method - - # https://tools.ietf.org/html/rfc7231#section-6.4.4 - if response.status_code == codes.see_other and method != "HEAD": - method = "GET" - - # Do what the browsers do, despite standards... - # First, turn 302s into GETs. - if response.status_code == codes.found and method != "HEAD": - method = "GET" - - # Second, if a POST is responded to with a 301, turn it into a GET. - # This bizarre behaviour is explained in Issue 1704. - if response.status_code == codes.moved and method == "POST": - method = "GET" - - prepared_request.method = method - - -class Session(SessionRedirectMixin): - """A Requests session. - - Provides cookie persistence, connection-pooling, and configuration. - - Basic Usage:: - - >>> import requests - >>> s = requests.Session() - >>> s.get('https://httpbin.org/get') - - - Or as a context manager:: - - >>> with requests.Session() as s: - ... s.get('https://httpbin.org/get') - - """ - - __attrs__ = [ - "headers", - "cookies", - "auth", - "proxies", - "hooks", - "params", - "verify", - "cert", - "adapters", - "stream", - "trust_env", - "max_redirects", - ] - - def __init__(self): - - #: A case-insensitive dictionary of headers to be sent on each - #: :class:`Request ` sent from this - #: :class:`Session `. - self.headers = default_headers() - - #: Default Authentication tuple or object to attach to - #: :class:`Request `. - self.auth = None - - #: Dictionary mapping protocol or protocol and host to the URL of the proxy - #: (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to - #: be used on each :class:`Request `. - self.proxies = {} - - #: Event-handling hooks. - self.hooks = default_hooks() - - #: Dictionary of querystring data to attach to each - #: :class:`Request `. The dictionary values may be lists for - #: representing multivalued query parameters. - self.params = {} - - #: Stream response content default. - self.stream = False - - #: SSL Verification default. - #: Defaults to `True`, requiring requests to verify the TLS certificate at the - #: remote end. - #: If verify is set to `False`, requests will accept any TLS certificate - #: presented by the server, and will ignore hostname mismatches and/or - #: expired certificates, which will make your application vulnerable to - #: man-in-the-middle (MitM) attacks. - #: Only set this to `False` for testing. - self.verify = True - - #: SSL client certificate default, if String, path to ssl client - #: cert file (.pem). If Tuple, ('cert', 'key') pair. - self.cert = None - - #: Maximum number of redirects allowed. If the request exceeds this - #: limit, a :class:`TooManyRedirects` exception is raised. - #: This defaults to requests.models.DEFAULT_REDIRECT_LIMIT, which is - #: 30. - self.max_redirects = DEFAULT_REDIRECT_LIMIT - - #: Trust environment settings for proxy configuration, default - #: authentication and similar. - self.trust_env = True - - #: A CookieJar containing all currently outstanding cookies set on this - #: session. By default it is a - #: :class:`RequestsCookieJar `, but - #: may be any other ``cookielib.CookieJar`` compatible object. - self.cookies = cookiejar_from_dict({}) - - # Default connection adapters. - self.adapters = OrderedDict() - self.mount("https://", HTTPAdapter()) - self.mount("http://", HTTPAdapter()) - - def __enter__(self): - return self - - def __exit__(self, *args): - self.close() - - def prepare_request(self, request): - """Constructs a :class:`PreparedRequest ` for - transmission and returns it. The :class:`PreparedRequest` has settings - merged from the :class:`Request ` instance and those of the - :class:`Session`. - - :param request: :class:`Request` instance to prepare with this - session's settings. - :rtype: requests.PreparedRequest - """ - cookies = request.cookies or {} - - # Bootstrap CookieJar. - if not isinstance(cookies, cookielib.CookieJar): - cookies = cookiejar_from_dict(cookies) - - # Merge with session cookies - merged_cookies = merge_cookies( - merge_cookies(RequestsCookieJar(), self.cookies), cookies - ) - - # Set environment's basic authentication if not explicitly set. - auth = request.auth - if self.trust_env and not auth and not self.auth: - auth = get_netrc_auth(request.url) - - p = PreparedRequest() - p.prepare( - method=request.method.upper(), - url=request.url, - files=request.files, - data=request.data, - json=request.json, - headers=merge_setting( - request.headers, self.headers, dict_class=CaseInsensitiveDict - ), - params=merge_setting(request.params, self.params), - auth=merge_setting(auth, self.auth), - cookies=merged_cookies, - hooks=merge_hooks(request.hooks, self.hooks), - ) - return p - - def request( - self, - method, - url, - params=None, - data=None, - headers=None, - cookies=None, - files=None, - auth=None, - timeout=None, - allow_redirects=True, - proxies=None, - hooks=None, - stream=None, - verify=None, - cert=None, - json=None, - ): - """Constructs a :class:`Request `, prepares it and sends it. - Returns :class:`Response ` object. - - :param method: method for the new :class:`Request` object. - :param url: URL for the new :class:`Request` object. - :param params: (optional) Dictionary or bytes to be sent in the query - string for the :class:`Request`. - :param data: (optional) Dictionary, list of tuples, bytes, or file-like - object to send in the body of the :class:`Request`. - :param json: (optional) json to send in the body of the - :class:`Request`. - :param headers: (optional) Dictionary of HTTP Headers to send with the - :class:`Request`. - :param cookies: (optional) Dict or CookieJar object to send with the - :class:`Request`. - :param files: (optional) Dictionary of ``'filename': file-like-objects`` - for multipart encoding upload. - :param auth: (optional) Auth tuple or callable to enable - Basic/Digest/Custom HTTP Auth. - :param timeout: (optional) How long to wait for the server to send - data before giving up, as a float, or a :ref:`(connect timeout, - read timeout) ` tuple. - :type timeout: float or tuple - :param allow_redirects: (optional) Set to True by default. - :type allow_redirects: bool - :param proxies: (optional) Dictionary mapping protocol or protocol and - hostname to the URL of the proxy. - :param stream: (optional) whether to immediately download the response - content. Defaults to ``False``. - :param verify: (optional) Either a boolean, in which case it controls whether we verify - the server's TLS certificate, or a string, in which case it must be a path - to a CA bundle to use. Defaults to ``True``. When set to - ``False``, requests will accept any TLS certificate presented by - the server, and will ignore hostname mismatches and/or expired - certificates, which will make your application vulnerable to - man-in-the-middle (MitM) attacks. Setting verify to ``False`` - may be useful during local development or testing. - :param cert: (optional) if String, path to ssl client cert file (.pem). - If Tuple, ('cert', 'key') pair. - :rtype: requests.Response - """ - # Create the Request. - req = Request( - method=method.upper(), - url=url, - headers=headers, - files=files, - data=data or {}, - json=json, - params=params or {}, - auth=auth, - cookies=cookies, - hooks=hooks, - ) - prep = self.prepare_request(req) - - proxies = proxies or {} - - settings = self.merge_environment_settings( - prep.url, proxies, stream, verify, cert - ) - - # Send the request. - send_kwargs = { - "timeout": timeout, - "allow_redirects": allow_redirects, - } - send_kwargs.update(settings) - resp = self.send(prep, **send_kwargs) - - return resp - - def get(self, url, **kwargs): - r"""Sends a GET request. Returns :class:`Response` object. - - :param url: URL for the new :class:`Request` object. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :rtype: requests.Response - """ - - kwargs.setdefault("allow_redirects", True) - return self.request("GET", url, **kwargs) - - def options(self, url, **kwargs): - r"""Sends a OPTIONS request. Returns :class:`Response` object. - - :param url: URL for the new :class:`Request` object. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :rtype: requests.Response - """ - - kwargs.setdefault("allow_redirects", True) - return self.request("OPTIONS", url, **kwargs) - - def head(self, url, **kwargs): - r"""Sends a HEAD request. Returns :class:`Response` object. - - :param url: URL for the new :class:`Request` object. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :rtype: requests.Response - """ - - kwargs.setdefault("allow_redirects", False) - return self.request("HEAD", url, **kwargs) - - def post(self, url, data=None, json=None, **kwargs): - r"""Sends a POST request. Returns :class:`Response` object. - - :param url: URL for the new :class:`Request` object. - :param data: (optional) Dictionary, list of tuples, bytes, or file-like - object to send in the body of the :class:`Request`. - :param json: (optional) json to send in the body of the :class:`Request`. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :rtype: requests.Response - """ - - return self.request("POST", url, data=data, json=json, **kwargs) - - def put(self, url, data=None, **kwargs): - r"""Sends a PUT request. Returns :class:`Response` object. - - :param url: URL for the new :class:`Request` object. - :param data: (optional) Dictionary, list of tuples, bytes, or file-like - object to send in the body of the :class:`Request`. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :rtype: requests.Response - """ - - return self.request("PUT", url, data=data, **kwargs) - - def patch(self, url, data=None, **kwargs): - r"""Sends a PATCH request. Returns :class:`Response` object. - - :param url: URL for the new :class:`Request` object. - :param data: (optional) Dictionary, list of tuples, bytes, or file-like - object to send in the body of the :class:`Request`. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :rtype: requests.Response - """ - - return self.request("PATCH", url, data=data, **kwargs) - - def delete(self, url, **kwargs): - r"""Sends a DELETE request. Returns :class:`Response` object. - - :param url: URL for the new :class:`Request` object. - :param \*\*kwargs: Optional arguments that ``request`` takes. - :rtype: requests.Response - """ - - return self.request("DELETE", url, **kwargs) - - def send(self, request, **kwargs): - """Send a given PreparedRequest. - - :rtype: requests.Response - """ - # Set defaults that the hooks can utilize to ensure they always have - # the correct parameters to reproduce the previous request. - kwargs.setdefault("stream", self.stream) - kwargs.setdefault("verify", self.verify) - kwargs.setdefault("cert", self.cert) - if "proxies" not in kwargs: - kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env) - - # It's possible that users might accidentally send a Request object. - # Guard against that specific failure case. - if isinstance(request, Request): - raise ValueError("You can only send PreparedRequests.") - - # Set up variables needed for resolve_redirects and dispatching of hooks - allow_redirects = kwargs.pop("allow_redirects", True) - stream = kwargs.get("stream") - hooks = request.hooks - - # Get the appropriate adapter to use - adapter = self.get_adapter(url=request.url) - - # Start time (approximately) of the request - start = preferred_clock() - - # Send the request - r = adapter.send(request, **kwargs) - - # Total elapsed time of the request (approximately) - elapsed = preferred_clock() - start - r.elapsed = timedelta(seconds=elapsed) - - # Response manipulation hooks - r = dispatch_hook("response", hooks, r, **kwargs) - - # Persist cookies - if r.history: - - # If the hooks create history then we want those cookies too - for resp in r.history: - extract_cookies_to_jar(self.cookies, resp.request, resp.raw) - - extract_cookies_to_jar(self.cookies, request, r.raw) - - # Resolve redirects if allowed. - if allow_redirects: - # Redirect resolving generator. - gen = self.resolve_redirects(r, request, **kwargs) - history = [resp for resp in gen] - else: - history = [] - - # Shuffle things around if there's history. - if history: - # Insert the first (original) request at the start - history.insert(0, r) - # Get the last request made - r = history.pop() - r.history = history - - # If redirects aren't being followed, store the response on the Request for Response.next(). - if not allow_redirects: - try: - r._next = next( - self.resolve_redirects(r, request, yield_requests=True, **kwargs) - ) - except StopIteration: - pass - - if not stream: - r.content - - return r - - def merge_environment_settings(self, url, proxies, stream, verify, cert): - """ - Check the environment and merge it with some settings. - - :rtype: dict - """ - # Gather clues from the surrounding environment. - if self.trust_env: - # Set environment's proxies. - no_proxy = proxies.get("no_proxy") if proxies is not None else None - env_proxies = get_environ_proxies(url, no_proxy=no_proxy) - for (k, v) in env_proxies.items(): - proxies.setdefault(k, v) - - # Look for requests environment configuration - # and be compatible with cURL. - if verify is True or verify is None: - verify = ( - os.environ.get("REQUESTS_CA_BUNDLE") - or os.environ.get("CURL_CA_BUNDLE") - or verify - ) - - # Merge all the kwargs. - proxies = merge_setting(proxies, self.proxies) - stream = merge_setting(stream, self.stream) - verify = merge_setting(verify, self.verify) - cert = merge_setting(cert, self.cert) - - return {"proxies": proxies, "stream": stream, "verify": verify, "cert": cert} - - def get_adapter(self, url): - """ - Returns the appropriate connection adapter for the given URL. - - :rtype: requests.adapters.BaseAdapter - """ - for (prefix, adapter) in self.adapters.items(): - - if url.lower().startswith(prefix.lower()): - return adapter - - # Nothing matches :-/ - raise InvalidSchema(f"No connection adapters were found for {url!r}") - - def close(self): - """Closes all adapters and as such the session""" - for v in self.adapters.values(): - v.close() - - def mount(self, prefix, adapter): - """Registers a connection adapter to a prefix. - - Adapters are sorted in descending order by prefix length. - """ - self.adapters[prefix] = adapter - keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] - - for key in keys_to_move: - self.adapters[key] = self.adapters.pop(key) - - def __getstate__(self): - state = {attr: getattr(self, attr, None) for attr in self.__attrs__} - return state - - def __setstate__(self, state): - for attr, value in state.items(): - setattr(self, attr, value) - - -def session(): - """ - Returns a :class:`Session` for context-management. - - .. deprecated:: 1.0.0 - - This method has been deprecated since version 1.0.0 and is only kept for - backwards compatibility. New code should use :class:`~requests.sessions.Session` - to create a session. This may be removed at a future date. - - :rtype: Session - """ - return Session() diff --git a/venv/lib/python3.8/site-packages/requests/status_codes.py b/venv/lib/python3.8/site-packages/requests/status_codes.py deleted file mode 100644 index 4bd072be9769748a852740d037d5c63021472c9d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/status_codes.py +++ /dev/null @@ -1,128 +0,0 @@ -r""" -The ``codes`` object defines a mapping from common names for HTTP statuses -to their numerical codes, accessible either as attributes or as dictionary -items. - -Example:: - - >>> import requests - >>> requests.codes['temporary_redirect'] - 307 - >>> requests.codes.teapot - 418 - >>> requests.codes['\o/'] - 200 - -Some codes have multiple names, and both upper- and lower-case versions of -the names are allowed. For example, ``codes.ok``, ``codes.OK``, and -``codes.okay`` all correspond to the HTTP status code 200. -""" - -from .structures import LookupDict - -_codes = { - # Informational. - 100: ("continue",), - 101: ("switching_protocols",), - 102: ("processing",), - 103: ("checkpoint",), - 122: ("uri_too_long", "request_uri_too_long"), - 200: ("ok", "okay", "all_ok", "all_okay", "all_good", "\\o/", "✓"), - 201: ("created",), - 202: ("accepted",), - 203: ("non_authoritative_info", "non_authoritative_information"), - 204: ("no_content",), - 205: ("reset_content", "reset"), - 206: ("partial_content", "partial"), - 207: ("multi_status", "multiple_status", "multi_stati", "multiple_stati"), - 208: ("already_reported",), - 226: ("im_used",), - # Redirection. - 300: ("multiple_choices",), - 301: ("moved_permanently", "moved", "\\o-"), - 302: ("found",), - 303: ("see_other", "other"), - 304: ("not_modified",), - 305: ("use_proxy",), - 306: ("switch_proxy",), - 307: ("temporary_redirect", "temporary_moved", "temporary"), - 308: ( - "permanent_redirect", - "resume_incomplete", - "resume", - ), # "resume" and "resume_incomplete" to be removed in 3.0 - # Client Error. - 400: ("bad_request", "bad"), - 401: ("unauthorized",), - 402: ("payment_required", "payment"), - 403: ("forbidden",), - 404: ("not_found", "-o-"), - 405: ("method_not_allowed", "not_allowed"), - 406: ("not_acceptable",), - 407: ("proxy_authentication_required", "proxy_auth", "proxy_authentication"), - 408: ("request_timeout", "timeout"), - 409: ("conflict",), - 410: ("gone",), - 411: ("length_required",), - 412: ("precondition_failed", "precondition"), - 413: ("request_entity_too_large",), - 414: ("request_uri_too_large",), - 415: ("unsupported_media_type", "unsupported_media", "media_type"), - 416: ( - "requested_range_not_satisfiable", - "requested_range", - "range_not_satisfiable", - ), - 417: ("expectation_failed",), - 418: ("im_a_teapot", "teapot", "i_am_a_teapot"), - 421: ("misdirected_request",), - 422: ("unprocessable_entity", "unprocessable"), - 423: ("locked",), - 424: ("failed_dependency", "dependency"), - 425: ("unordered_collection", "unordered"), - 426: ("upgrade_required", "upgrade"), - 428: ("precondition_required", "precondition"), - 429: ("too_many_requests", "too_many"), - 431: ("header_fields_too_large", "fields_too_large"), - 444: ("no_response", "none"), - 449: ("retry_with", "retry"), - 450: ("blocked_by_windows_parental_controls", "parental_controls"), - 451: ("unavailable_for_legal_reasons", "legal_reasons"), - 499: ("client_closed_request",), - # Server Error. - 500: ("internal_server_error", "server_error", "/o\\", "✗"), - 501: ("not_implemented",), - 502: ("bad_gateway",), - 503: ("service_unavailable", "unavailable"), - 504: ("gateway_timeout",), - 505: ("http_version_not_supported", "http_version"), - 506: ("variant_also_negotiates",), - 507: ("insufficient_storage",), - 509: ("bandwidth_limit_exceeded", "bandwidth"), - 510: ("not_extended",), - 511: ("network_authentication_required", "network_auth", "network_authentication"), -} - -codes = LookupDict(name="status_codes") - - -def _init(): - for code, titles in _codes.items(): - for title in titles: - setattr(codes, title, code) - if not title.startswith(("\\", "/")): - setattr(codes, title.upper(), code) - - def doc(code): - names = ", ".join(f"``{n}``" for n in _codes[code]) - return "* %d: %s" % (code, names) - - global __doc__ - __doc__ = ( - __doc__ + "\n" + "\n".join(doc(code) for code in sorted(_codes)) - if __doc__ is not None - else None - ) - - -_init() diff --git a/venv/lib/python3.8/site-packages/requests/structures.py b/venv/lib/python3.8/site-packages/requests/structures.py deleted file mode 100644 index 188e13e4829591facb23ae0e2eda84b9807cb818..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/structures.py +++ /dev/null @@ -1,99 +0,0 @@ -""" -requests.structures -~~~~~~~~~~~~~~~~~~~ - -Data structures that power Requests. -""" - -from collections import OrderedDict - -from .compat import Mapping, MutableMapping - - -class CaseInsensitiveDict(MutableMapping): - """A case-insensitive ``dict``-like object. - - Implements all methods and operations of - ``MutableMapping`` as well as dict's ``copy``. Also - provides ``lower_items``. - - All keys are expected to be strings. The structure remembers the - case of the last key to be set, and ``iter(instance)``, - ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` - will contain case-sensitive keys. However, querying and contains - testing is case insensitive:: - - cid = CaseInsensitiveDict() - cid['Accept'] = 'application/json' - cid['aCCEPT'] == 'application/json' # True - list(cid) == ['Accept'] # True - - For example, ``headers['content-encoding']`` will return the - value of a ``'Content-Encoding'`` response header, regardless - of how the header name was originally stored. - - If the constructor, ``.update``, or equality comparison - operations are given keys that have equal ``.lower()``s, the - behavior is undefined. - """ - - def __init__(self, data=None, **kwargs): - self._store = OrderedDict() - if data is None: - data = {} - self.update(data, **kwargs) - - def __setitem__(self, key, value): - # Use the lowercased key for lookups, but store the actual - # key alongside the value. - self._store[key.lower()] = (key, value) - - def __getitem__(self, key): - return self._store[key.lower()][1] - - def __delitem__(self, key): - del self._store[key.lower()] - - def __iter__(self): - return (casedkey for casedkey, mappedvalue in self._store.values()) - - def __len__(self): - return len(self._store) - - def lower_items(self): - """Like iteritems(), but with all lowercase keys.""" - return ((lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items()) - - def __eq__(self, other): - if isinstance(other, Mapping): - other = CaseInsensitiveDict(other) - else: - return NotImplemented - # Compare insensitively - return dict(self.lower_items()) == dict(other.lower_items()) - - # Copy is required - def copy(self): - return CaseInsensitiveDict(self._store.values()) - - def __repr__(self): - return str(dict(self.items())) - - -class LookupDict(dict): - """Dictionary lookup object.""" - - def __init__(self, name=None): - self.name = name - super().__init__() - - def __repr__(self): - return f"" - - def __getitem__(self, key): - # We allow fall-through here, so values default to None - - return self.__dict__.get(key, None) - - def get(self, key, default=None): - return self.__dict__.get(key, default) diff --git a/venv/lib/python3.8/site-packages/requests/utils.py b/venv/lib/python3.8/site-packages/requests/utils.py deleted file mode 100644 index a367417f8eb5926d0778eb50dc68ba68f977a31f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/requests/utils.py +++ /dev/null @@ -1,1094 +0,0 @@ -""" -requests.utils -~~~~~~~~~~~~~~ - -This module provides utility functions that are used within Requests -that are also useful for external consumption. -""" - -import codecs -import contextlib -import io -import os -import re -import socket -import struct -import sys -import tempfile -import warnings -import zipfile -from collections import OrderedDict - -from urllib3.util import make_headers, parse_url - -from . import certs -from .__version__ import __version__ - -# to_native_string is unused here, but imported here for backwards compatibility -from ._internal_utils import ( # noqa: F401 - _HEADER_VALIDATORS_BYTE, - _HEADER_VALIDATORS_STR, - HEADER_VALIDATORS, - to_native_string, -) -from .compat import ( - Mapping, - basestring, - bytes, - getproxies, - getproxies_environment, - integer_types, -) -from .compat import parse_http_list as _parse_list_header -from .compat import ( - proxy_bypass, - proxy_bypass_environment, - quote, - str, - unquote, - urlparse, - urlunparse, -) -from .cookies import cookiejar_from_dict -from .exceptions import ( - FileModeWarning, - InvalidHeader, - InvalidURL, - UnrewindableBodyError, -) -from .structures import CaseInsensitiveDict - -NETRC_FILES = (".netrc", "_netrc") - -DEFAULT_CA_BUNDLE_PATH = certs.where() - -DEFAULT_PORTS = {"http": 80, "https": 443} - -# Ensure that ', ' is used to preserve previous delimiter behavior. -DEFAULT_ACCEPT_ENCODING = ", ".join( - re.split(r",\s*", make_headers(accept_encoding=True)["accept-encoding"]) -) - - -if sys.platform == "win32": - # provide a proxy_bypass version on Windows without DNS lookups - - def proxy_bypass_registry(host): - try: - import winreg - except ImportError: - return False - - try: - internetSettings = winreg.OpenKey( - winreg.HKEY_CURRENT_USER, - r"Software\Microsoft\Windows\CurrentVersion\Internet Settings", - ) - # ProxyEnable could be REG_SZ or REG_DWORD, normalizing it - proxyEnable = int(winreg.QueryValueEx(internetSettings, "ProxyEnable")[0]) - # ProxyOverride is almost always a string - proxyOverride = winreg.QueryValueEx(internetSettings, "ProxyOverride")[0] - except (OSError, ValueError): - return False - if not proxyEnable or not proxyOverride: - return False - - # make a check value list from the registry entry: replace the - # '' string by the localhost entry and the corresponding - # canonical entry. - proxyOverride = proxyOverride.split(";") - # now check if we match one of the registry values. - for test in proxyOverride: - if test == "": - if "." not in host: - return True - test = test.replace(".", r"\.") # mask dots - test = test.replace("*", r".*") # change glob sequence - test = test.replace("?", r".") # change glob char - if re.match(test, host, re.I): - return True - return False - - def proxy_bypass(host): # noqa - """Return True, if the host should be bypassed. - - Checks proxy settings gathered from the environment, if specified, - or the registry. - """ - if getproxies_environment(): - return proxy_bypass_environment(host) - else: - return proxy_bypass_registry(host) - - -def dict_to_sequence(d): - """Returns an internal sequence dictionary update.""" - - if hasattr(d, "items"): - d = d.items() - - return d - - -def super_len(o): - total_length = None - current_position = 0 - - if hasattr(o, "__len__"): - total_length = len(o) - - elif hasattr(o, "len"): - total_length = o.len - - elif hasattr(o, "fileno"): - try: - fileno = o.fileno() - except (io.UnsupportedOperation, AttributeError): - # AttributeError is a surprising exception, seeing as how we've just checked - # that `hasattr(o, 'fileno')`. It happens for objects obtained via - # `Tarfile.extractfile()`, per issue 5229. - pass - else: - total_length = os.fstat(fileno).st_size - - # Having used fstat to determine the file length, we need to - # confirm that this file was opened up in binary mode. - if "b" not in o.mode: - warnings.warn( - ( - "Requests has determined the content-length for this " - "request using the binary size of the file: however, the " - "file has been opened in text mode (i.e. without the 'b' " - "flag in the mode). This may lead to an incorrect " - "content-length. In Requests 3.0, support will be removed " - "for files in text mode." - ), - FileModeWarning, - ) - - if hasattr(o, "tell"): - try: - current_position = o.tell() - except OSError: - # This can happen in some weird situations, such as when the file - # is actually a special file descriptor like stdin. In this - # instance, we don't know what the length is, so set it to zero and - # let requests chunk it instead. - if total_length is not None: - current_position = total_length - else: - if hasattr(o, "seek") and total_length is None: - # StringIO and BytesIO have seek but no usable fileno - try: - # seek to end of file - o.seek(0, 2) - total_length = o.tell() - - # seek back to current position to support - # partially read file-like objects - o.seek(current_position or 0) - except OSError: - total_length = 0 - - if total_length is None: - total_length = 0 - - return max(0, total_length - current_position) - - -def get_netrc_auth(url, raise_errors=False): - """Returns the Requests tuple auth for a given url from netrc.""" - - netrc_file = os.environ.get("NETRC") - if netrc_file is not None: - netrc_locations = (netrc_file,) - else: - netrc_locations = (f"~/{f}" for f in NETRC_FILES) - - try: - from netrc import NetrcParseError, netrc - - netrc_path = None - - for f in netrc_locations: - try: - loc = os.path.expanduser(f) - except KeyError: - # os.path.expanduser can fail when $HOME is undefined and - # getpwuid fails. See https://bugs.python.org/issue20164 & - # https://github.com/psf/requests/issues/1846 - return - - if os.path.exists(loc): - netrc_path = loc - break - - # Abort early if there isn't one. - if netrc_path is None: - return - - ri = urlparse(url) - - # Strip port numbers from netloc. This weird `if...encode`` dance is - # used for Python 3.2, which doesn't support unicode literals. - splitstr = b":" - if isinstance(url, str): - splitstr = splitstr.decode("ascii") - host = ri.netloc.split(splitstr)[0] - - try: - _netrc = netrc(netrc_path).authenticators(host) - if _netrc: - # Return with login / password - login_i = 0 if _netrc[0] else 1 - return (_netrc[login_i], _netrc[2]) - except (NetrcParseError, OSError): - # If there was a parsing error or a permissions issue reading the file, - # we'll just skip netrc auth unless explicitly asked to raise errors. - if raise_errors: - raise - - # App Engine hackiness. - except (ImportError, AttributeError): - pass - - -def guess_filename(obj): - """Tries to guess the filename of the given object.""" - name = getattr(obj, "name", None) - if name and isinstance(name, basestring) and name[0] != "<" and name[-1] != ">": - return os.path.basename(name) - - -def extract_zipped_paths(path): - """Replace nonexistent paths that look like they refer to a member of a zip - archive with the location of an extracted copy of the target, or else - just return the provided path unchanged. - """ - if os.path.exists(path): - # this is already a valid path, no need to do anything further - return path - - # find the first valid part of the provided path and treat that as a zip archive - # assume the rest of the path is the name of a member in the archive - archive, member = os.path.split(path) - while archive and not os.path.exists(archive): - archive, prefix = os.path.split(archive) - if not prefix: - # If we don't check for an empty prefix after the split (in other words, archive remains unchanged after the split), - # we _can_ end up in an infinite loop on a rare corner case affecting a small number of users - break - member = "/".join([prefix, member]) - - if not zipfile.is_zipfile(archive): - return path - - zip_file = zipfile.ZipFile(archive) - if member not in zip_file.namelist(): - return path - - # we have a valid zip archive and a valid member of that archive - tmp = tempfile.gettempdir() - extracted_path = os.path.join(tmp, member.split("/")[-1]) - if not os.path.exists(extracted_path): - # use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition - with atomic_open(extracted_path) as file_handler: - file_handler.write(zip_file.read(member)) - return extracted_path - - -@contextlib.contextmanager -def atomic_open(filename): - """Write a file to the disk in an atomic fashion""" - tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename)) - try: - with os.fdopen(tmp_descriptor, "wb") as tmp_handler: - yield tmp_handler - os.replace(tmp_name, filename) - except BaseException: - os.remove(tmp_name) - raise - - -def from_key_val_list(value): - """Take an object and test to see if it can be represented as a - dictionary. Unless it can not be represented as such, return an - OrderedDict, e.g., - - :: - - >>> from_key_val_list([('key', 'val')]) - OrderedDict([('key', 'val')]) - >>> from_key_val_list('string') - Traceback (most recent call last): - ... - ValueError: cannot encode objects that are not 2-tuples - >>> from_key_val_list({'key': 'val'}) - OrderedDict([('key', 'val')]) - - :rtype: OrderedDict - """ - if value is None: - return None - - if isinstance(value, (str, bytes, bool, int)): - raise ValueError("cannot encode objects that are not 2-tuples") - - return OrderedDict(value) - - -def to_key_val_list(value): - """Take an object and test to see if it can be represented as a - dictionary. If it can be, return a list of tuples, e.g., - - :: - - >>> to_key_val_list([('key', 'val')]) - [('key', 'val')] - >>> to_key_val_list({'key': 'val'}) - [('key', 'val')] - >>> to_key_val_list('string') - Traceback (most recent call last): - ... - ValueError: cannot encode objects that are not 2-tuples - - :rtype: list - """ - if value is None: - return None - - if isinstance(value, (str, bytes, bool, int)): - raise ValueError("cannot encode objects that are not 2-tuples") - - if isinstance(value, Mapping): - value = value.items() - - return list(value) - - -# From mitsuhiko/werkzeug (used with permission). -def parse_list_header(value): - """Parse lists as described by RFC 2068 Section 2. - - In particular, parse comma-separated lists where the elements of - the list may include quoted-strings. A quoted-string could - contain a comma. A non-quoted string could have quotes in the - middle. Quotes are removed automatically after parsing. - - It basically works like :func:`parse_set_header` just that items - may appear multiple times and case sensitivity is preserved. - - The return value is a standard :class:`list`: - - >>> parse_list_header('token, "quoted value"') - ['token', 'quoted value'] - - To create a header from the :class:`list` again, use the - :func:`dump_header` function. - - :param value: a string with a list header. - :return: :class:`list` - :rtype: list - """ - result = [] - for item in _parse_list_header(value): - if item[:1] == item[-1:] == '"': - item = unquote_header_value(item[1:-1]) - result.append(item) - return result - - -# From mitsuhiko/werkzeug (used with permission). -def parse_dict_header(value): - """Parse lists of key, value pairs as described by RFC 2068 Section 2 and - convert them into a python dict: - - >>> d = parse_dict_header('foo="is a fish", bar="as well"') - >>> type(d) is dict - True - >>> sorted(d.items()) - [('bar', 'as well'), ('foo', 'is a fish')] - - If there is no value for a key it will be `None`: - - >>> parse_dict_header('key_without_value') - {'key_without_value': None} - - To create a header from the :class:`dict` again, use the - :func:`dump_header` function. - - :param value: a string with a dict header. - :return: :class:`dict` - :rtype: dict - """ - result = {} - for item in _parse_list_header(value): - if "=" not in item: - result[item] = None - continue - name, value = item.split("=", 1) - if value[:1] == value[-1:] == '"': - value = unquote_header_value(value[1:-1]) - result[name] = value - return result - - -# From mitsuhiko/werkzeug (used with permission). -def unquote_header_value(value, is_filename=False): - r"""Unquotes a header value. (Reversal of :func:`quote_header_value`). - This does not use the real unquoting but what browsers are actually - using for quoting. - - :param value: the header value to unquote. - :rtype: str - """ - if value and value[0] == value[-1] == '"': - # this is not the real unquoting, but fixing this so that the - # RFC is met will result in bugs with internet explorer and - # probably some other browsers as well. IE for example is - # uploading files with "C:\foo\bar.txt" as filename - value = value[1:-1] - - # if this is a filename and the starting characters look like - # a UNC path, then just return the value without quotes. Using the - # replace sequence below on a UNC path has the effect of turning - # the leading double slash into a single slash and then - # _fix_ie_filename() doesn't work correctly. See #458. - if not is_filename or value[:2] != "\\\\": - return value.replace("\\\\", "\\").replace('\\"', '"') - return value - - -def dict_from_cookiejar(cj): - """Returns a key/value dictionary from a CookieJar. - - :param cj: CookieJar object to extract cookies from. - :rtype: dict - """ - - cookie_dict = {} - - for cookie in cj: - cookie_dict[cookie.name] = cookie.value - - return cookie_dict - - -def add_dict_to_cookiejar(cj, cookie_dict): - """Returns a CookieJar from a key/value dictionary. - - :param cj: CookieJar to insert cookies into. - :param cookie_dict: Dict of key/values to insert into CookieJar. - :rtype: CookieJar - """ - - return cookiejar_from_dict(cookie_dict, cj) - - -def get_encodings_from_content(content): - """Returns encodings from given content string. - - :param content: bytestring to extract encodings from. - """ - warnings.warn( - ( - "In requests 3.0, get_encodings_from_content will be removed. For " - "more information, please see the discussion on issue #2266. (This" - " warning should only appear once.)" - ), - DeprecationWarning, - ) - - charset_re = re.compile(r']', flags=re.I) - pragma_re = re.compile(r']', flags=re.I) - xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]') - - return ( - charset_re.findall(content) - + pragma_re.findall(content) - + xml_re.findall(content) - ) - - -def _parse_content_type_header(header): - """Returns content type and parameters from given header - - :param header: string - :return: tuple containing content type and dictionary of - parameters - """ - - tokens = header.split(";") - content_type, params = tokens[0].strip(), tokens[1:] - params_dict = {} - items_to_strip = "\"' " - - for param in params: - param = param.strip() - if param: - key, value = param, True - index_of_equals = param.find("=") - if index_of_equals != -1: - key = param[:index_of_equals].strip(items_to_strip) - value = param[index_of_equals + 1 :].strip(items_to_strip) - params_dict[key.lower()] = value - return content_type, params_dict - - -def get_encoding_from_headers(headers): - """Returns encodings from given HTTP Header Dict. - - :param headers: dictionary to extract encoding from. - :rtype: str - """ - - content_type = headers.get("content-type") - - if not content_type: - return None - - content_type, params = _parse_content_type_header(content_type) - - if "charset" in params: - return params["charset"].strip("'\"") - - if "text" in content_type: - return "ISO-8859-1" - - if "application/json" in content_type: - # Assume UTF-8 based on RFC 4627: https://www.ietf.org/rfc/rfc4627.txt since the charset was unset - return "utf-8" - - -def stream_decode_response_unicode(iterator, r): - """Stream decodes an iterator.""" - - if r.encoding is None: - yield from iterator - return - - decoder = codecs.getincrementaldecoder(r.encoding)(errors="replace") - for chunk in iterator: - rv = decoder.decode(chunk) - if rv: - yield rv - rv = decoder.decode(b"", final=True) - if rv: - yield rv - - -def iter_slices(string, slice_length): - """Iterate over slices of a string.""" - pos = 0 - if slice_length is None or slice_length <= 0: - slice_length = len(string) - while pos < len(string): - yield string[pos : pos + slice_length] - pos += slice_length - - -def get_unicode_from_response(r): - """Returns the requested content back in unicode. - - :param r: Response object to get unicode content from. - - Tried: - - 1. charset from content-type - 2. fall back and replace all unicode characters - - :rtype: str - """ - warnings.warn( - ( - "In requests 3.0, get_unicode_from_response will be removed. For " - "more information, please see the discussion on issue #2266. (This" - " warning should only appear once.)" - ), - DeprecationWarning, - ) - - tried_encodings = [] - - # Try charset from content-type - encoding = get_encoding_from_headers(r.headers) - - if encoding: - try: - return str(r.content, encoding) - except UnicodeError: - tried_encodings.append(encoding) - - # Fall back: - try: - return str(r.content, encoding, errors="replace") - except TypeError: - return r.content - - -# The unreserved URI characters (RFC 3986) -UNRESERVED_SET = frozenset( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~" -) - - -def unquote_unreserved(uri): - """Un-escape any percent-escape sequences in a URI that are unreserved - characters. This leaves all reserved, illegal and non-ASCII bytes encoded. - - :rtype: str - """ - parts = uri.split("%") - for i in range(1, len(parts)): - h = parts[i][0:2] - if len(h) == 2 and h.isalnum(): - try: - c = chr(int(h, 16)) - except ValueError: - raise InvalidURL(f"Invalid percent-escape sequence: '{h}'") - - if c in UNRESERVED_SET: - parts[i] = c + parts[i][2:] - else: - parts[i] = f"%{parts[i]}" - else: - parts[i] = f"%{parts[i]}" - return "".join(parts) - - -def requote_uri(uri): - """Re-quote the given URI. - - This function passes the given URI through an unquote/quote cycle to - ensure that it is fully and consistently quoted. - - :rtype: str - """ - safe_with_percent = "!#$%&'()*+,/:;=?@[]~" - safe_without_percent = "!#$&'()*+,/:;=?@[]~" - try: - # Unquote only the unreserved characters - # Then quote only illegal characters (do not quote reserved, - # unreserved, or '%') - return quote(unquote_unreserved(uri), safe=safe_with_percent) - except InvalidURL: - # We couldn't unquote the given URI, so let's try quoting it, but - # there may be unquoted '%'s in the URI. We need to make sure they're - # properly quoted so they do not cause issues elsewhere. - return quote(uri, safe=safe_without_percent) - - -def address_in_network(ip, net): - """This function allows you to check if an IP belongs to a network subnet - - Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24 - returns False if ip = 192.168.1.1 and net = 192.168.100.0/24 - - :rtype: bool - """ - ipaddr = struct.unpack("=L", socket.inet_aton(ip))[0] - netaddr, bits = net.split("/") - netmask = struct.unpack("=L", socket.inet_aton(dotted_netmask(int(bits))))[0] - network = struct.unpack("=L", socket.inet_aton(netaddr))[0] & netmask - return (ipaddr & netmask) == (network & netmask) - - -def dotted_netmask(mask): - """Converts mask from /xx format to xxx.xxx.xxx.xxx - - Example: if mask is 24 function returns 255.255.255.0 - - :rtype: str - """ - bits = 0xFFFFFFFF ^ (1 << 32 - mask) - 1 - return socket.inet_ntoa(struct.pack(">I", bits)) - - -def is_ipv4_address(string_ip): - """ - :rtype: bool - """ - try: - socket.inet_aton(string_ip) - except OSError: - return False - return True - - -def is_valid_cidr(string_network): - """ - Very simple check of the cidr format in no_proxy variable. - - :rtype: bool - """ - if string_network.count("/") == 1: - try: - mask = int(string_network.split("/")[1]) - except ValueError: - return False - - if mask < 1 or mask > 32: - return False - - try: - socket.inet_aton(string_network.split("/")[0]) - except OSError: - return False - else: - return False - return True - - -@contextlib.contextmanager -def set_environ(env_name, value): - """Set the environment variable 'env_name' to 'value' - - Save previous value, yield, and then restore the previous value stored in - the environment variable 'env_name'. - - If 'value' is None, do nothing""" - value_changed = value is not None - if value_changed: - old_value = os.environ.get(env_name) - os.environ[env_name] = value - try: - yield - finally: - if value_changed: - if old_value is None: - del os.environ[env_name] - else: - os.environ[env_name] = old_value - - -def should_bypass_proxies(url, no_proxy): - """ - Returns whether we should bypass proxies or not. - - :rtype: bool - """ - # Prioritize lowercase environment variables over uppercase - # to keep a consistent behaviour with other http projects (curl, wget). - def get_proxy(key): - return os.environ.get(key) or os.environ.get(key.upper()) - - # First check whether no_proxy is defined. If it is, check that the URL - # we're getting isn't in the no_proxy list. - no_proxy_arg = no_proxy - if no_proxy is None: - no_proxy = get_proxy("no_proxy") - parsed = urlparse(url) - - if parsed.hostname is None: - # URLs don't always have hostnames, e.g. file:/// urls. - return True - - if no_proxy: - # We need to check whether we match here. We need to see if we match - # the end of the hostname, both with and without the port. - no_proxy = (host for host in no_proxy.replace(" ", "").split(",") if host) - - if is_ipv4_address(parsed.hostname): - for proxy_ip in no_proxy: - if is_valid_cidr(proxy_ip): - if address_in_network(parsed.hostname, proxy_ip): - return True - elif parsed.hostname == proxy_ip: - # If no_proxy ip was defined in plain IP notation instead of cidr notation & - # matches the IP of the index - return True - else: - host_with_port = parsed.hostname - if parsed.port: - host_with_port += f":{parsed.port}" - - for host in no_proxy: - if parsed.hostname.endswith(host) or host_with_port.endswith(host): - # The URL does match something in no_proxy, so we don't want - # to apply the proxies on this URL. - return True - - with set_environ("no_proxy", no_proxy_arg): - # parsed.hostname can be `None` in cases such as a file URI. - try: - bypass = proxy_bypass(parsed.hostname) - except (TypeError, socket.gaierror): - bypass = False - - if bypass: - return True - - return False - - -def get_environ_proxies(url, no_proxy=None): - """ - Return a dict of environment proxies. - - :rtype: dict - """ - if should_bypass_proxies(url, no_proxy=no_proxy): - return {} - else: - return getproxies() - - -def select_proxy(url, proxies): - """Select a proxy for the url, if applicable. - - :param url: The url being for the request - :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs - """ - proxies = proxies or {} - urlparts = urlparse(url) - if urlparts.hostname is None: - return proxies.get(urlparts.scheme, proxies.get("all")) - - proxy_keys = [ - urlparts.scheme + "://" + urlparts.hostname, - urlparts.scheme, - "all://" + urlparts.hostname, - "all", - ] - proxy = None - for proxy_key in proxy_keys: - if proxy_key in proxies: - proxy = proxies[proxy_key] - break - - return proxy - - -def resolve_proxies(request, proxies, trust_env=True): - """This method takes proxy information from a request and configuration - input to resolve a mapping of target proxies. This will consider settings - such a NO_PROXY to strip proxy configurations. - - :param request: Request or PreparedRequest - :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs - :param trust_env: Boolean declaring whether to trust environment configs - - :rtype: dict - """ - proxies = proxies if proxies is not None else {} - url = request.url - scheme = urlparse(url).scheme - no_proxy = proxies.get("no_proxy") - new_proxies = proxies.copy() - - if trust_env and not should_bypass_proxies(url, no_proxy=no_proxy): - environ_proxies = get_environ_proxies(url, no_proxy=no_proxy) - - proxy = environ_proxies.get(scheme, environ_proxies.get("all")) - - if proxy: - new_proxies.setdefault(scheme, proxy) - return new_proxies - - -def default_user_agent(name="python-requests"): - """ - Return a string representing the default user agent. - - :rtype: str - """ - return f"{name}/{__version__}" - - -def default_headers(): - """ - :rtype: requests.structures.CaseInsensitiveDict - """ - return CaseInsensitiveDict( - { - "User-Agent": default_user_agent(), - "Accept-Encoding": DEFAULT_ACCEPT_ENCODING, - "Accept": "*/*", - "Connection": "keep-alive", - } - ) - - -def parse_header_links(value): - """Return a list of parsed link headers proxies. - - i.e. Link: ; rel=front; type="image/jpeg",; rel=back;type="image/jpeg" - - :rtype: list - """ - - links = [] - - replace_chars = " '\"" - - value = value.strip(replace_chars) - if not value: - return links - - for val in re.split(", *<", value): - try: - url, params = val.split(";", 1) - except ValueError: - url, params = val, "" - - link = {"url": url.strip("<> '\"")} - - for param in params.split(";"): - try: - key, value = param.split("=") - except ValueError: - break - - link[key.strip(replace_chars)] = value.strip(replace_chars) - - links.append(link) - - return links - - -# Null bytes; no need to recreate these on each call to guess_json_utf -_null = "\x00".encode("ascii") # encoding to ASCII for Python 3 -_null2 = _null * 2 -_null3 = _null * 3 - - -def guess_json_utf(data): - """ - :rtype: str - """ - # JSON always starts with two ASCII characters, so detection is as - # easy as counting the nulls and from their location and count - # determine the encoding. Also detect a BOM, if present. - sample = data[:4] - if sample in (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE): - return "utf-32" # BOM included - if sample[:3] == codecs.BOM_UTF8: - return "utf-8-sig" # BOM included, MS style (discouraged) - if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE): - return "utf-16" # BOM included - nullcount = sample.count(_null) - if nullcount == 0: - return "utf-8" - if nullcount == 2: - if sample[::2] == _null2: # 1st and 3rd are null - return "utf-16-be" - if sample[1::2] == _null2: # 2nd and 4th are null - return "utf-16-le" - # Did not detect 2 valid UTF-16 ascii-range characters - if nullcount == 3: - if sample[:3] == _null3: - return "utf-32-be" - if sample[1:] == _null3: - return "utf-32-le" - # Did not detect a valid UTF-32 ascii-range character - return None - - -def prepend_scheme_if_needed(url, new_scheme): - """Given a URL that may or may not have a scheme, prepend the given scheme. - Does not replace a present scheme with the one provided as an argument. - - :rtype: str - """ - parsed = parse_url(url) - scheme, auth, host, port, path, query, fragment = parsed - - # A defect in urlparse determines that there isn't a netloc present in some - # urls. We previously assumed parsing was overly cautious, and swapped the - # netloc and path. Due to a lack of tests on the original defect, this is - # maintained with parse_url for backwards compatibility. - netloc = parsed.netloc - if not netloc: - netloc, path = path, netloc - - if auth: - # parse_url doesn't provide the netloc with auth - # so we'll add it ourselves. - netloc = "@".join([auth, netloc]) - if scheme is None: - scheme = new_scheme - if path is None: - path = "" - - return urlunparse((scheme, netloc, path, "", query, fragment)) - - -def get_auth_from_url(url): - """Given a url with authentication components, extract them into a tuple of - username,password. - - :rtype: (str,str) - """ - parsed = urlparse(url) - - try: - auth = (unquote(parsed.username), unquote(parsed.password)) - except (AttributeError, TypeError): - auth = ("", "") - - return auth - - -def check_header_validity(header): - """Verifies that header parts don't contain leading whitespace - reserved characters, or return characters. - - :param header: tuple, in the format (name, value). - """ - name, value = header - _validate_header_part(header, name, 0) - _validate_header_part(header, value, 1) - - -def _validate_header_part(header, header_part, header_validator_index): - if isinstance(header_part, str): - validator = _HEADER_VALIDATORS_STR[header_validator_index] - elif isinstance(header_part, bytes): - validator = _HEADER_VALIDATORS_BYTE[header_validator_index] - else: - raise InvalidHeader( - f"Header part ({header_part!r}) from {header} " - f"must be of type str or bytes, not {type(header_part)}" - ) - - if not validator.match(header_part): - header_kind = "name" if header_validator_index == 0 else "value" - raise InvalidHeader( - f"Invalid leading whitespace, reserved character(s), or return" - f"character(s) in header {header_kind}: {header_part!r}" - ) - - -def urldefragauth(url): - """ - Given a url remove the fragment and the authentication part. - - :rtype: str - """ - scheme, netloc, path, params, query, fragment = urlparse(url) - - # see func:`prepend_scheme_if_needed` - if not netloc: - netloc, path = path, netloc - - netloc = netloc.rsplit("@", 1)[-1] - - return urlunparse((scheme, netloc, path, params, query, "")) - - -def rewind_body(prepared_request): - """Move file pointer back to its recorded starting position - so it can be read again on redirect. - """ - body_seek = getattr(prepared_request.body, "seek", None) - if body_seek is not None and isinstance( - prepared_request._body_position, integer_types - ): - try: - body_seek(prepared_request._body_position) - except OSError: - raise UnrewindableBodyError( - "An error occurred when rewinding request body for redirect." - ) - else: - raise UnrewindableBodyError("Unable to rewind request body for redirect.") diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/AUTHORS.txt b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/AUTHORS.txt deleted file mode 100644 index 72c87d7d38ae7bf859717c333a5ee8230f6ce624..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/AUTHORS.txt +++ /dev/null @@ -1,562 +0,0 @@ -A_Rog -Aakanksha Agrawal <11389424+rasponic@users.noreply.github.com> -Abhinav Sagar <40603139+abhinavsagar@users.noreply.github.com> -ABHYUDAY PRATAP SINGH -abs51295 -AceGentile -Adam Chainz -Adam Tse -Adam Tse -Adam Wentz -admin -Adrien Morison -ahayrapetyan -Ahilya -AinsworthK -Akash Srivastava -Alan Yee -Albert Tugushev -Albert-Guan -albertg -Aleks Bunin -Alethea Flowers -Alex Gaynor -Alex Grönholm -Alex Loosley -Alex Morega -Alex Stachowiak -Alexander Shtyrov -Alexandre Conrad -Alexey Popravka -Alexey Popravka -Alli -Ami Fischman -Ananya Maiti -Anatoly Techtonik -Anders Kaseorg -Andreas Lutro -Andrei Geacar -Andrew Gaul -Andrey Bulgakov -Andrés Delfino <34587441+andresdelfino@users.noreply.github.com> -Andrés Delfino -Andy Freeland -Andy Freeland -Andy Kluger -Ani Hayrapetyan -Aniruddha Basak -Anish Tambe -Anrs Hu -Anthony Sottile -Antoine Musso -Anton Ovchinnikov -Anton Patrushev -Antonio Alvarado Hernandez -Antony Lee -Antti Kaihola -Anubhav Patel -Anuj Godase -AQNOUCH Mohammed -AraHaan -Arindam Choudhury -Armin Ronacher -Artem -Ashley Manton -Ashwin Ramaswami -atse -Atsushi Odagiri -Avner Cohen -Baptiste Mispelon -Barney Gale -barneygale -Bartek Ogryczak -Bastian Venthur -Ben Darnell -Ben Hoyt -Ben Rosser -Bence Nagy -Benjamin Peterson -Benjamin VanEvery -Benoit Pierre -Berker Peksag -Bernardo B. Marques -Bernhard M. Wiedemann -Bertil Hatt -Bogdan Opanchuk -BorisZZZ -Brad Erickson -Bradley Ayers -Brandon L. Reiss -Brandt Bucher -Brett Randall -Brian Cristante <33549821+brcrista@users.noreply.github.com> -Brian Cristante -Brian Rosner -BrownTruck -Bruno Oliveira -Bruno Renié -Bstrdsmkr -Buck Golemon -burrows -Bussonnier Matthias -c22 -Caleb Martinez -Calvin Smith -Carl Meyer -Carlos Liam -Carol Willing -Carter Thayer -Cass -Chandrasekhar Atina -Chih-Hsuan Yen -Chih-Hsuan Yen -Chris Brinker -Chris Hunt -Chris Jerdonek -Chris McDonough -Chris Wolfe -Christian Heimes -Christian Oudard -Christopher Hunt -Christopher Snyder -Clark Boylan -Clay McClure -Cody -Cody Soyland -Colin Watson -Connor Osborn -Cooper Lees -Cooper Ry Lees -Cory Benfield -Cory Wright -Craig Kerstiens -Cristian Sorinel -Curtis Doty -cytolentino -Damian Quiroga -Dan Black -Dan Savilonis -Dan Sully -daniel -Daniel Collins -Daniel Hahler -Daniel Holth -Daniel Jost -Daniel Shaulov -Daniele Esposti -Daniele Procida -Danny Hermes -Dav Clark -Dave Abrahams -Dave Jones -David Aguilar -David Black -David Bordeynik -David Bordeynik -David Caro -David Evans -David Linke -David Pursehouse -David Tucker -David Wales -Davidovich -derwolfe -Desetude -Diego Caraballo -DiegoCaraballo -Dmitry Gladkov -Domen Kožar -Donald Stufft -Dongweiming -Douglas Thor -DrFeathers -Dustin Ingram -Dwayne Bailey -Ed Morley <501702+edmorley@users.noreply.github.com> -Ed Morley -Eitan Adler -ekristina -elainechan -Eli Schwartz -Eli Schwartz -Emil Burzo -Emil Styrke -Endoh Takanao -enoch -Erdinc Mutlu -Eric Gillingham -Eric Hanchrow -Eric Hopper -Erik M. Bray -Erik Rose -Ernest W Durbin III -Ernest W. Durbin III -Erwin Janssen -Eugene Vereshchagin -everdimension -Felix Yan -fiber-space -Filip Kokosiński -Florian Briand -Florian Rathgeber -Francesco -Francesco Montesano -Frost Ming -Gabriel Curio -Gabriel de Perthuis -Garry Polley -gdanielson -Geoffrey Lehée -Geoffrey Sneddon -George Song -Georgi Valkov -Giftlin Rajaiah -gizmoguy1 -gkdoc <40815324+gkdoc@users.noreply.github.com> -Gopinath M <31352222+mgopi1990@users.noreply.github.com> -GOTO Hayato <3532528+gh640@users.noreply.github.com> -gpiks -Guilherme Espada -Guy Rozendorn -gzpan123 -Hanjun Kim -Hari Charan -Harsh Vardhan -Herbert Pfennig -Hsiaoming Yang -Hugo -Hugo Lopes Tavares -Hugo van Kemenade -hugovk -Hynek Schlawack -Ian Bicking -Ian Cordasco -Ian Lee -Ian Stapleton Cordasco -Ian Wienand -Ian Wienand -Igor Kuzmitshov -Igor Sobreira -Ilya Baryshev -INADA Naoki -Ionel Cristian Mărieș -Ionel Maries Cristian -Ivan Pozdeev -Jacob Kim -jakirkham -Jakub Stasiak -Jakub Vysoky -Jakub Wilk -James Cleveland -James Cleveland -James Firth -James Polley -Jan Pokorný -Jannis Leidel -jarondl -Jason R. Coombs -Jay Graves -Jean-Christophe Fillion-Robin -Jeff Barber -Jeff Dairiki -Jelmer Vernooij -jenix21 -Jeremy Stanley -Jeremy Zafran -Jiashuo Li -Jim Garrison -Jivan Amara -John Paton -John-Scott Atlakson -johnthagen -johnthagen -Jon Banafato -Jon Dufresne -Jon Parise -Jonas Nockert -Jonathan Herbert -Joost Molenaar -Jorge Niedbalski -Joseph Long -Josh Bronson -Josh Hansen -Josh Schneier -Juanjo Bazán -Julian Berman -Julian Gethmann -Julien Demoor -jwg4 -Jyrki Pulliainen -Kai Chen -Kamal Bin Mustafa -kaustav haldar -keanemind -Keith Maxwell -Kelsey Hightower -Kenneth Belitzky -Kenneth Reitz -Kenneth Reitz -Kevin Burke -Kevin Carter -Kevin Frommelt -Kevin R Patterson -Kexuan Sun -Kit Randel -kpinc -Krishna Oza -Kumar McMillan -Kyle Persohn -lakshmanaram -Laszlo Kiss-Kollar -Laurent Bristiel -Laurie Opperman -Leon Sasson -Lev Givon -Lincoln de Sousa -Lipis -Loren Carvalho -Lucas Cimon -Ludovic Gasc -Luke Macken -Luo Jiebin -luojiebin -luz.paz -László Kiss Kollár -László Kiss Kollár -Marc Abramowitz -Marc Tamlyn -Marcus Smith -Mariatta -Mark Kohler -Mark Williams -Mark Williams -Markus Hametner -Masaki -Masklinn -Matej Stuchlik -Mathew Jennings -Mathieu Bridon -Matt Good -Matt Maker -Matt Robenolt -matthew -Matthew Einhorn -Matthew Gilliard -Matthew Iversen -Matthew Trumbell -Matthew Willson -Matthias Bussonnier -mattip -Maxim Kurnikov -Maxime Rouyrre -mayeut -mbaluna <44498973+mbaluna@users.noreply.github.com> -mdebi <17590103+mdebi@users.noreply.github.com> -memoselyk -Michael -Michael Aquilina -Michael E. Karpeles -Michael Klich -Michael Williamson -michaelpacer -Mickaël Schoentgen -Miguel Araujo Perez -Mihir Singh -Mike -Mike Hendricks -Min RK -MinRK -Miro Hrončok -Monica Baluna -montefra -Monty Taylor -Nate Coraor -Nathaniel J. Smith -Nehal J Wani -Neil Botelho -Nick Coghlan -Nick Stenning -Nick Timkovich -Nicolas Bock -Nikhil Benesch -Nitesh Sharma -Nowell Strite -NtaleGrey -nvdv -Ofekmeister -ofrinevo -Oliver Jeeves -Oliver Tonnhofer -Olivier Girardot -Olivier Grisel -Ollie Rutherfurd -OMOTO Kenji -Omry Yadan -Oren Held -Oscar Benjamin -Oz N Tiram -Pachwenko <32424503+Pachwenko@users.noreply.github.com> -Patrick Dubroy -Patrick Jenkins -Patrick Lawson -patricktokeeffe -Patrik Kopkan -Paul Kehrer -Paul Moore -Paul Nasrat -Paul Oswald -Paul van der Linden -Paulus Schoutsen -Pavithra Eswaramoorthy <33131404+QueenCoffee@users.noreply.github.com> -Pawel Jasinski -Pekka Klärck -Peter Lisák -Peter Waller -petr-tik -Phaneendra Chiruvella -Phil Freo -Phil Pennock -Phil Whelan -Philip Jägenstedt -Philip Molloy -Philippe Ombredanne -Pi Delport -Pierre-Yves Rofes -pip -Prabakaran Kumaresshan -Prabhjyotsing Surjit Singh Sodhi -Prabhu Marappan -Pradyun Gedam -Pratik Mallya -Preet Thakkar -Preston Holmes -Przemek Wrzos -Pulkit Goyal <7895pulkit@gmail.com> -Qiangning Hong -Quentin Pradet -R. David Murray -Rafael Caricio -Ralf Schmitt -Razzi Abuissa -rdb -Remi Rampin -Remi Rampin -Rene Dudfield -Riccardo Magliocchetti -Richard Jones -RobberPhex -Robert Collins -Robert McGibbon -Robert T. McGibbon -robin elisha robinson -Roey Berman -Rohan Jain -Rohan Jain -Rohan Jain -Roman Bogorodskiy -Romuald Brunet -Ronny Pfannschmidt -Rory McCann -Ross Brattain -Roy Wellington Ⅳ -Roy Wellington Ⅳ -Ryan Wooden -ryneeverett -Sachi King -Salvatore Rinchiera -Savio Jomton -schlamar -Scott Kitterman -Sean -seanj -Sebastian Jordan -Sebastian Schaetz -Segev Finer -SeongSoo Cho -Sergey Vasilyev -Seth Woodworth -Shlomi Fish -Shovan Maity -Simeon Visser -Simon Cross -Simon Pichugin -sinoroc -Sorin Sbarnea -Stavros Korokithakis -Stefan Scherfke -Stephan Erb -stepshal -Steve (Gadget) Barnes -Steve Barnes -Steve Dower -Steve Kowalik -Steven Myint -stonebig -Stéphane Bidoul (ACSONE) -Stéphane Bidoul -Stéphane Klein -Sumana Harihareswara -Sviatoslav Sydorenko -Sviatoslav Sydorenko -Swat009 -Takayuki SHIMIZUKAWA -tbeswick -Thijs Triemstra -Thomas Fenzl -Thomas Grainger -Thomas Guettler -Thomas Johansson -Thomas Kluyver -Thomas Smith -Tim D. Smith -Tim Gates -Tim Harder -Tim Heap -tim smith -tinruufu -Tom Forbes -Tom Freudenheim -Tom V -Tomas Orsava -Tomer Chachamu -Tony Beswick -Tony Zhaocheng Tan -TonyBeswick -toonarmycaptain -Toshio Kuratomi -Travis Swicegood -Tzu-ping Chung -Valentin Haenel -Victor Stinner -victorvpaulo -Viktor Szépe -Ville Skyttä -Vinay Sajip -Vincent Philippon -Vinicyus Macedo <7549205+vinicyusmacedo@users.noreply.github.com> -Vitaly Babiy -Vladimir Rutsky -W. Trevor King -Wil Tan -Wilfred Hughes -William ML Leslie -William T Olson -Wilson Mo -wim glenn -Wolfgang Maier -Xavier Fernandez -Xavier Fernandez -xoviat -xtreak -YAMAMOTO Takashi -Yen Chi Hsuan -Yeray Diaz Diaz -Yoval P -Yu Jian -Yuan Jing Vincent Yan -Zearin -Zearin -Zhiping Deng -Zvezdan Petkovic -Łukasz Langa -Семён Марьясин diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/LICENSE.txt b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/LICENSE.txt deleted file mode 100644 index 737fec5c5352af3d9a6a47a0670da4bdb52c5725..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2008-2019 The pip developers (see AUTHORS.txt file) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/METADATA b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/METADATA deleted file mode 100644 index 4adf953086ea4e28c5236788234f38f88602296f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/METADATA +++ /dev/null @@ -1,82 +0,0 @@ -Metadata-Version: 2.1 -Name: setuptools -Version: 44.0.0 -Summary: Easily download, build, install, upgrade, and uninstall Python packages -Home-page: https://github.com/pypa/setuptools -Author: Python Packaging Authority -Author-email: distutils-sig@python.org -License: UNKNOWN -Project-URL: Documentation, https://setuptools.readthedocs.io/ -Keywords: CPAN PyPI distutils eggs package management -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: System :: Archiving :: Packaging -Classifier: Topic :: System :: Systems Administration -Classifier: Topic :: Utilities -Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7 -Description-Content-Type: text/x-rst; charset=UTF-8 - -.. image:: https://img.shields.io/pypi/v/setuptools.svg - :target: https://pypi.org/project/setuptools - -.. image:: https://img.shields.io/readthedocs/setuptools/latest.svg - :target: https://setuptools.readthedocs.io - -.. image:: https://img.shields.io/travis/pypa/setuptools/master.svg?label=Linux%20CI&logo=travis&logoColor=white - :target: https://travis-ci.org/pypa/setuptools - -.. image:: https://img.shields.io/appveyor/ci/pypa/setuptools/master.svg?label=Windows%20CI&logo=appveyor&logoColor=white - :target: https://ci.appveyor.com/project/pypa/setuptools/branch/master - -.. image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white - :target: https://codecov.io/gh/pypa/setuptools - -.. image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat - :target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme - -.. image:: https://img.shields.io/pypi/pyversions/setuptools.svg - -See the `Installation Instructions -`_ in the Python Packaging -User's Guide for instructions on installing, upgrading, and uninstalling -Setuptools. - -Questions and comments should be directed to the `distutils-sig -mailing list `_. -Bug reports and especially tested patches may be -submitted directly to the `bug tracker -`_. - -To report a security vulnerability, please use the -`Tidelift security contact `_. -Tidelift will coordinate the fix and disclosure. - - -For Enterprise -============== - -Available as part of the Tidelift Subscription. - -Setuptools and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use. - -`Learn more `_. - -Code of Conduct -=============== - -Everyone interacting in the setuptools project's codebases, issue trackers, -chat rooms, and mailing lists is expected to follow the -`PyPA Code of Conduct `_. - - diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/RECORD b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/RECORD deleted file mode 100644 index 8fa25b29b726df7c0e185185d0b055081e1e9ce8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/RECORD +++ /dev/null @@ -1,163 +0,0 @@ -../../../bin/easy_install,sha256=53bTQ3CFeZZhpcuo8isdVJwCx_fsy5fGqkBMWkl2ek0,267 -../../../bin/easy_install-3.8,sha256=53bTQ3CFeZZhpcuo8isdVJwCx_fsy5fGqkBMWkl2ek0,267 -__pycache__/easy_install.cpython-38.pyc,, -easy_install.py,sha256=MDC9vt5AxDsXX5qcKlBz2TnW6Tpuv_AobnfhCJ9X3PM,126 -setuptools-44.0.0.dist-info/AUTHORS.txt,sha256=RtqU9KfonVGhI48DAA4-yTOBUhBtQTjFhaDzHoyh7uU,21518 -setuptools-44.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -setuptools-44.0.0.dist-info/LICENSE.txt,sha256=W6Ifuwlk-TatfRU2LR7W1JMcyMj5_y1NkRkOEJvnRDE,1090 -setuptools-44.0.0.dist-info/METADATA,sha256=L93fcafgVw4xoJUNG0lehyy0prVj-jU_JFxRh0ZUtos,3523 -setuptools-44.0.0.dist-info/RECORD,, -setuptools-44.0.0.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110 -setuptools-44.0.0.dist-info/dependency_links.txt,sha256=HlkCFkoK5TbZ5EMLbLKYhLcY_E31kBWD8TqW2EgmatQ,239 -setuptools-44.0.0.dist-info/entry_points.txt,sha256=ZmIqlp-SBdsBS2cuetmU2NdSOs4DG0kxctUR9UJ8Xk0,3150 -setuptools-44.0.0.dist-info/top_level.txt,sha256=2HUXVVwA4Pff1xgTFr3GsTXXKaPaO6vlG6oNJ_4u4Tg,38 -setuptools-44.0.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 -setuptools/__init__.py,sha256=WBpCcn2lvdckotabeae1TTYonPOcgCIF3raD2zRWzBc,7283 -setuptools/__pycache__/__init__.cpython-38.pyc,, -setuptools/__pycache__/_deprecation_warning.cpython-38.pyc,, -setuptools/__pycache__/_imp.cpython-38.pyc,, -setuptools/__pycache__/archive_util.cpython-38.pyc,, -setuptools/__pycache__/build_meta.cpython-38.pyc,, -setuptools/__pycache__/config.cpython-38.pyc,, -setuptools/__pycache__/dep_util.cpython-38.pyc,, -setuptools/__pycache__/depends.cpython-38.pyc,, -setuptools/__pycache__/dist.cpython-38.pyc,, -setuptools/__pycache__/errors.cpython-38.pyc,, -setuptools/__pycache__/extension.cpython-38.pyc,, -setuptools/__pycache__/glob.cpython-38.pyc,, -setuptools/__pycache__/installer.cpython-38.pyc,, -setuptools/__pycache__/launch.cpython-38.pyc,, -setuptools/__pycache__/lib2to3_ex.cpython-38.pyc,, -setuptools/__pycache__/monkey.cpython-38.pyc,, -setuptools/__pycache__/msvc.cpython-38.pyc,, -setuptools/__pycache__/namespaces.cpython-38.pyc,, -setuptools/__pycache__/package_index.cpython-38.pyc,, -setuptools/__pycache__/py27compat.cpython-38.pyc,, -setuptools/__pycache__/py31compat.cpython-38.pyc,, -setuptools/__pycache__/py33compat.cpython-38.pyc,, -setuptools/__pycache__/py34compat.cpython-38.pyc,, -setuptools/__pycache__/sandbox.cpython-38.pyc,, -setuptools/__pycache__/site-patch.cpython-38.pyc,, -setuptools/__pycache__/ssl_support.cpython-38.pyc,, -setuptools/__pycache__/unicode_utils.cpython-38.pyc,, -setuptools/__pycache__/version.cpython-38.pyc,, -setuptools/__pycache__/wheel.cpython-38.pyc,, -setuptools/__pycache__/windows_support.cpython-38.pyc,, -setuptools/_deprecation_warning.py,sha256=jU9-dtfv6cKmtQJOXN8nP1mm7gONw5kKEtiPtbwnZyI,218 -setuptools/_imp.py,sha256=jloslOkxrTKbobgemfP94YII0nhqiJzE1bRmCTZ1a5I,2223 -setuptools/_vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -setuptools/_vendor/__pycache__/__init__.cpython-38.pyc,, -setuptools/_vendor/__pycache__/ordered_set.cpython-38.pyc,, -setuptools/_vendor/__pycache__/pyparsing.cpython-38.pyc,, -setuptools/_vendor/__pycache__/six.cpython-38.pyc,, -setuptools/_vendor/ordered_set.py,sha256=dbaCcs27dyN9gnMWGF5nA_BrVn6Q-NrjKYJpV9_fgBs,15130 -setuptools/_vendor/packaging/__about__.py,sha256=CpuMSyh1V7adw8QMjWKkY3LtdqRUkRX4MgJ6nF4stM0,744 -setuptools/_vendor/packaging/__init__.py,sha256=6enbp5XgRfjBjsI9-bn00HjHf5TH21PDMOKkJW8xw-w,562 -setuptools/_vendor/packaging/__pycache__/__about__.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/__init__.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/_compat.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/_structures.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/markers.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/requirements.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/specifiers.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/tags.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/utils.cpython-38.pyc,, -setuptools/_vendor/packaging/__pycache__/version.cpython-38.pyc,, -setuptools/_vendor/packaging/_compat.py,sha256=Ugdm-qcneSchW25JrtMIKgUxfEEBcCAz6WrEeXeqz9o,865 -setuptools/_vendor/packaging/_structures.py,sha256=pVd90XcXRGwpZRB_qdFuVEibhCHpX_bL5zYr9-N0mc8,1416 -setuptools/_vendor/packaging/markers.py,sha256=-meFl9Fr9V8rF5Rduzgett5EHK9wBYRUqssAV2pj0lw,8268 -setuptools/_vendor/packaging/requirements.py,sha256=3dwIJekt8RRGCUbgxX8reeAbgmZYjb0wcCRtmH63kxI,4742 -setuptools/_vendor/packaging/specifiers.py,sha256=0ZzQpcUnvrQ6LjR-mQRLzMr8G6hdRv-mY0VSf_amFtI,27778 -setuptools/_vendor/packaging/tags.py,sha256=EPLXhO6GTD7_oiWEO1U0l0PkfR8R_xivpMDHXnsTlts,12933 -setuptools/_vendor/packaging/utils.py,sha256=VaTC0Ei7zO2xl9ARiWmz2YFLFt89PuuhLbAlXMyAGms,1520 -setuptools/_vendor/packaging/version.py,sha256=Npdwnb8OHedj_2L86yiUqscujb7w_i5gmSK1PhOAFzg,11978 -setuptools/_vendor/pyparsing.py,sha256=tmrp-lu-qO1i75ZzIN5A12nKRRD1Cm4Vpk-5LR9rims,232055 -setuptools/_vendor/six.py,sha256=A6hdJZVjI3t_geebZ9BzUvwRrIXo0lfwzQlM2LcKyas,30098 -setuptools/archive_util.py,sha256=kw8Ib_lKjCcnPKNbS7h8HztRVK0d5RacU3r_KRdVnmM,6592 -setuptools/build_meta.py,sha256=-9Nmj9YdbW4zX3TssPJZhsENrTa4fw3k86Jm1cdKMik,9597 -setuptools/cli-32.exe,sha256=dfEuovMNnA2HLa3jRfMPVi5tk4R7alCbpTvuxtCyw0Y,65536 -setuptools/cli-64.exe,sha256=KLABu5pyrnokJCv6skjXZ6GsXeyYHGcqOUT3oHI3Xpo,74752 -setuptools/cli.exe,sha256=dfEuovMNnA2HLa3jRfMPVi5tk4R7alCbpTvuxtCyw0Y,65536 -setuptools/command/__init__.py,sha256=QCAuA9whnq8Bnoc0bBaS6Lw_KAUO0DiHYZQXEMNn5hg,568 -setuptools/command/__pycache__/__init__.cpython-38.pyc,, -setuptools/command/__pycache__/alias.cpython-38.pyc,, -setuptools/command/__pycache__/bdist_egg.cpython-38.pyc,, -setuptools/command/__pycache__/bdist_rpm.cpython-38.pyc,, -setuptools/command/__pycache__/bdist_wininst.cpython-38.pyc,, -setuptools/command/__pycache__/build_clib.cpython-38.pyc,, -setuptools/command/__pycache__/build_ext.cpython-38.pyc,, -setuptools/command/__pycache__/build_py.cpython-38.pyc,, -setuptools/command/__pycache__/develop.cpython-38.pyc,, -setuptools/command/__pycache__/dist_info.cpython-38.pyc,, -setuptools/command/__pycache__/easy_install.cpython-38.pyc,, -setuptools/command/__pycache__/egg_info.cpython-38.pyc,, -setuptools/command/__pycache__/install.cpython-38.pyc,, -setuptools/command/__pycache__/install_egg_info.cpython-38.pyc,, -setuptools/command/__pycache__/install_lib.cpython-38.pyc,, -setuptools/command/__pycache__/install_scripts.cpython-38.pyc,, -setuptools/command/__pycache__/py36compat.cpython-38.pyc,, -setuptools/command/__pycache__/register.cpython-38.pyc,, -setuptools/command/__pycache__/rotate.cpython-38.pyc,, -setuptools/command/__pycache__/saveopts.cpython-38.pyc,, -setuptools/command/__pycache__/sdist.cpython-38.pyc,, -setuptools/command/__pycache__/setopt.cpython-38.pyc,, -setuptools/command/__pycache__/test.cpython-38.pyc,, -setuptools/command/__pycache__/upload.cpython-38.pyc,, -setuptools/command/__pycache__/upload_docs.cpython-38.pyc,, -setuptools/command/alias.py,sha256=KjpE0sz_SDIHv3fpZcIQK-sCkJz-SrC6Gmug6b9Nkc8,2426 -setuptools/command/bdist_egg.py,sha256=nnfV8Ah8IRC_Ifv5Loa9FdxL66MVbyDXwy-foP810zM,18185 -setuptools/command/bdist_rpm.py,sha256=B7l0TnzCGb-0nLlm6rS00jWLkojASwVmdhW2w5Qz_Ak,1508 -setuptools/command/bdist_wininst.py,sha256=_6dz3lpB1tY200LxKPLM7qgwTCceOMgaWFF-jW2-pm0,637 -setuptools/command/build_clib.py,sha256=bQ9aBr-5ZSO-9fGsGsDLz0mnnFteHUZnftVLkhvHDq0,4484 -setuptools/command/build_ext.py,sha256=Ib42YUGksBswm2mL5xmQPF6NeTA6HcqrvAtEgFCv32A,13019 -setuptools/command/build_py.py,sha256=yWyYaaS9F3o9JbIczn064A5g1C5_UiKRDxGaTqYbtLE,9596 -setuptools/command/develop.py,sha256=MQlnGS6uP19erK2JCNOyQYoYyquk3PADrqrrinqqLtA,8184 -setuptools/command/dist_info.py,sha256=5t6kOfrdgALT-P3ogss6PF9k-Leyesueycuk3dUyZnI,960 -setuptools/command/easy_install.py,sha256=0lY8Agxe-7IgMtxgxFuOY1NrDlBzOUlpCKsvayXlTYY,89903 -setuptools/command/egg_info.py,sha256=0e_TXrMfpa8nGTO7GmJcmpPCMWzliZi6zt9aMchlumc,25578 -setuptools/command/install.py,sha256=8doMxeQEDoK4Eco0mO2WlXXzzp9QnsGJQ7Z7yWkZPG8,4705 -setuptools/command/install_egg_info.py,sha256=4zq_Ad3jE-EffParuyDEnvxU6efB-Xhrzdr8aB6Ln_8,3195 -setuptools/command/install_lib.py,sha256=9zdc-H5h6RPxjySRhOwi30E_WfcVva7gpfhZ5ata60w,5023 -setuptools/command/install_scripts.py,sha256=UD0rEZ6861mTYhIdzcsqKnUl8PozocXWl9VBQ1VTWnc,2439 -setuptools/command/launcher manifest.xml,sha256=xlLbjWrB01tKC0-hlVkOKkiSPbzMml2eOPtJ_ucCnbE,628 -setuptools/command/py36compat.py,sha256=SzjZcOxF7zdFUT47Zv2n7AM3H8koDys_0OpS-n9gIfc,4986 -setuptools/command/register.py,sha256=kk3DxXCb5lXTvqnhfwx2g6q7iwbUmgTyXUCaBooBOUk,468 -setuptools/command/rotate.py,sha256=co5C1EkI7P0GGT6Tqz-T2SIj2LBJTZXYELpmao6d4KQ,2164 -setuptools/command/saveopts.py,sha256=za7QCBcQimKKriWcoCcbhxPjUz30gSB74zuTL47xpP4,658 -setuptools/command/sdist.py,sha256=IL1LepD2h8qGKOFJ3rrQVbjNH_Q6ViD40l0QADr4MEU,8088 -setuptools/command/setopt.py,sha256=NTWDyx-gjDF-txf4dO577s7LOzHVoKR0Mq33rFxaRr8,5085 -setuptools/command/test.py,sha256=u2kXngIIdSYqtvwFlHiN6Iye1IB4TU6uadB2uiV1szw,9602 -setuptools/command/upload.py,sha256=XT3YFVfYPAmA5qhGg0euluU98ftxRUW-PzKcODMLxUs,462 -setuptools/command/upload_docs.py,sha256=oXiGplM_cUKLwE4CWWw98RzCufAu8tBhMC97GegFcms,7311 -setuptools/config.py,sha256=6SB2OY3qcooOJmG_rsK_s0pKBsorBlDpfMJUyzjQIGk,20575 -setuptools/dep_util.py,sha256=fgixvC1R7sH3r13ktyf7N0FALoqEXL1cBarmNpSEoWg,935 -setuptools/depends.py,sha256=qt2RWllArRvhnm8lxsyRpcthEZYp4GHQgREl1q0LkFw,5517 -setuptools/dist.py,sha256=xtXaNsOsE32MwwQqErzgXJF7jsTQz9GYFRrwnPFQ0J0,49865 -setuptools/errors.py,sha256=MVOcv381HNSajDgEUWzOQ4J6B5BHCBMSjHfaWcEwA1o,524 -setuptools/extension.py,sha256=uc6nHI-MxwmNCNPbUiBnybSyqhpJqjbhvOQ-emdvt_E,1729 -setuptools/extern/__init__.py,sha256=4q9gtShB1XFP6CisltsyPqtcfTO6ZM9Lu1QBl3l-qmo,2514 -setuptools/extern/__pycache__/__init__.cpython-38.pyc,, -setuptools/glob.py,sha256=o75cHrOxYsvn854thSxE0x9k8JrKDuhP_rRXlVB00Q4,5084 -setuptools/gui-32.exe,sha256=XBr0bHMA6Hpz2s9s9Bzjl-PwXfa9nH4ie0rFn4V2kWA,65536 -setuptools/gui-64.exe,sha256=aYKMhX1IJLn4ULHgWX0sE0yREUt6B3TEHf_jOw6yNyE,75264 -setuptools/gui.exe,sha256=XBr0bHMA6Hpz2s9s9Bzjl-PwXfa9nH4ie0rFn4V2kWA,65536 -setuptools/installer.py,sha256=TCFRonRo01I79zo-ucf3Ymhj8TenPlmhMijN916aaJs,5337 -setuptools/launch.py,sha256=sd7ejwhBocCDx_wG9rIs0OaZ8HtmmFU8ZC6IR_S0Lvg,787 -setuptools/lib2to3_ex.py,sha256=t5e12hbR2pi9V4ezWDTB4JM-AISUnGOkmcnYHek3xjg,2013 -setuptools/monkey.py,sha256=FGc9fffh7gAxMLFmJs2DW_OYWpBjkdbNS2n14UAK4NA,5264 -setuptools/msvc.py,sha256=8baJ6aYgCA4TRdWQQi185qB9dnU8FaP4wgpbmd7VODs,46751 -setuptools/namespaces.py,sha256=F0Nrbv8KCT2OrO7rwa03om4N4GZKAlnce-rr-cgDQa8,3199 -setuptools/package_index.py,sha256=rqhmbFUEf4WxndnKbtWmj_x8WCuZSuoCgA0K1syyCY8,40616 -setuptools/py27compat.py,sha256=tvmer0Tn-wk_JummCkoM22UIjpjL-AQ8uUiOaqTs8sI,1496 -setuptools/py31compat.py,sha256=h2rtZghOfwoGYd8sQ0-auaKiF3TcL3qX0bX3VessqcE,838 -setuptools/py33compat.py,sha256=SMF9Z8wnGicTOkU1uRNwZ_kz5Z_bj29PUBbqdqeeNsc,1330 -setuptools/py34compat.py,sha256=KYOd6ybRxjBW8NJmYD8t_UyyVmysppFXqHpFLdslGXU,245 -setuptools/sandbox.py,sha256=9UbwfEL5QY436oMI1LtFWohhoZ-UzwHvGyZjUH_qhkw,14276 -setuptools/script (dev).tmpl,sha256=RUzQzCQUaXtwdLtYHWYbIQmOaES5Brqq1FvUA_tu-5I,218 -setuptools/script.tmpl,sha256=WGTt5piezO27c-Dbx6l5Q4T3Ff20A5z7872hv3aAhYY,138 -setuptools/site-patch.py,sha256=OumkIHMuoSenRSW1382kKWI1VAwxNE86E5W8iDd34FY,2302 -setuptools/ssl_support.py,sha256=nLjPUBBw7RTTx6O4RJZ5eAMGgjJG8beiDbkFXDZpLuM,8493 -setuptools/unicode_utils.py,sha256=NOiZ_5hD72A6w-4wVj8awHFM3n51Kmw1Ic_vx15XFqw,996 -setuptools/version.py,sha256=og_cuZQb0QI6ukKZFfZWPlr1HgJBPPn2vO2m_bI9ZTE,144 -setuptools/wheel.py,sha256=zct-SEj5_LoHg6XELt2cVRdulsUENenCdS1ekM7TlZA,8455 -setuptools/windows_support.py,sha256=5GrfqSP2-dLGJoZTq2g6dCKkyQxxa2n5IQiXlJCoYEE,714 diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/WHEEL b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/WHEEL deleted file mode 100644 index ef99c6cf3283b50a273ac4c6d009a0aa85597070..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.34.2) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/dependency_links.txt b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/dependency_links.txt deleted file mode 100644 index e87d02103ede91545d70783dd59653d183424b68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/dependency_links.txt +++ /dev/null @@ -1,2 +0,0 @@ -https://files.pythonhosted.org/packages/source/c/certifi/certifi-2016.9.26.tar.gz#md5=baa81e951a29958563689d868ef1064d -https://files.pythonhosted.org/packages/source/w/wincertstore/wincertstore-0.2.zip#md5=ae728f2f007185648d0c7a8679b361e2 diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/entry_points.txt b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/entry_points.txt deleted file mode 100644 index 0fed3f1d83f3eb690dddad3f050da3d3f021eb6a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/entry_points.txt +++ /dev/null @@ -1,68 +0,0 @@ -[console_scripts] -easy_install = setuptools.command.easy_install:main - -[distutils.commands] -alias = setuptools.command.alias:alias -bdist_egg = setuptools.command.bdist_egg:bdist_egg -bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm -bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst -build_clib = setuptools.command.build_clib:build_clib -build_ext = setuptools.command.build_ext:build_ext -build_py = setuptools.command.build_py:build_py -develop = setuptools.command.develop:develop -dist_info = setuptools.command.dist_info:dist_info -easy_install = setuptools.command.easy_install:easy_install -egg_info = setuptools.command.egg_info:egg_info -install = setuptools.command.install:install -install_egg_info = setuptools.command.install_egg_info:install_egg_info -install_lib = setuptools.command.install_lib:install_lib -install_scripts = setuptools.command.install_scripts:install_scripts -rotate = setuptools.command.rotate:rotate -saveopts = setuptools.command.saveopts:saveopts -sdist = setuptools.command.sdist:sdist -setopt = setuptools.command.setopt:setopt -test = setuptools.command.test:test -upload_docs = setuptools.command.upload_docs:upload_docs - -[distutils.setup_keywords] -convert_2to3_doctests = setuptools.dist:assert_string_list -dependency_links = setuptools.dist:assert_string_list -eager_resources = setuptools.dist:assert_string_list -entry_points = setuptools.dist:check_entry_points -exclude_package_data = setuptools.dist:check_package_data -extras_require = setuptools.dist:check_extras -include_package_data = setuptools.dist:assert_bool -install_requires = setuptools.dist:check_requirements -namespace_packages = setuptools.dist:check_nsp -package_data = setuptools.dist:check_package_data -packages = setuptools.dist:check_packages -python_requires = setuptools.dist:check_specifier -setup_requires = setuptools.dist:check_requirements -test_loader = setuptools.dist:check_importable -test_runner = setuptools.dist:check_importable -test_suite = setuptools.dist:check_test_suite -tests_require = setuptools.dist:check_requirements -use_2to3 = setuptools.dist:assert_bool -use_2to3_exclude_fixers = setuptools.dist:assert_string_list -use_2to3_fixers = setuptools.dist:assert_string_list -zip_safe = setuptools.dist:assert_bool - -[egg_info.writers] -PKG-INFO = setuptools.command.egg_info:write_pkg_info -dependency_links.txt = setuptools.command.egg_info:overwrite_arg -depends.txt = setuptools.command.egg_info:warn_depends_obsolete -eager_resources.txt = setuptools.command.egg_info:overwrite_arg -entry_points.txt = setuptools.command.egg_info:write_entries -namespace_packages.txt = setuptools.command.egg_info:overwrite_arg -requires.txt = setuptools.command.egg_info:write_requirements -top_level.txt = setuptools.command.egg_info:write_toplevel_names - -[setuptools.finalize_distribution_options] -2to3_doctests = setuptools.dist:Distribution._finalize_2to3_doctests -features = setuptools.dist:Distribution._finalize_feature_opts -keywords = setuptools.dist:Distribution._finalize_setup_keywords -parent_finalize = setuptools.dist:_Distribution.finalize_options - -[setuptools.installation] -eggsecutable = setuptools.command.easy_install:bootstrap - diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/top_level.txt deleted file mode 100644 index 4577c6a795e510bf7578236665f582c3770fb42e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/top_level.txt +++ /dev/null @@ -1,3 +0,0 @@ -easy_install -pkg_resources -setuptools diff --git a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/zip-safe b/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/zip-safe deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools-44.0.0.dist-info/zip-safe +++ /dev/null @@ -1 +0,0 @@ - diff --git a/venv/lib/python3.8/site-packages/setuptools/__init__.py b/venv/lib/python3.8/site-packages/setuptools/__init__.py deleted file mode 100644 index a71b2bbdc6170963a66959c48080c1dedc7bb703..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/__init__.py +++ /dev/null @@ -1,228 +0,0 @@ -"""Extensions to the 'distutils' for large or complex distributions""" - -import os -import sys -import functools -import distutils.core -import distutils.filelist -import re -from distutils.errors import DistutilsOptionError -from distutils.util import convert_path -from fnmatch import fnmatchcase - -from ._deprecation_warning import SetuptoolsDeprecationWarning - -from setuptools.extern.six import PY3, string_types -from setuptools.extern.six.moves import filter, map - -import setuptools.version -from setuptools.extension import Extension -from setuptools.dist import Distribution, Feature -from setuptools.depends import Require -from . import monkey - -__metaclass__ = type - - -__all__ = [ - 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', - 'SetuptoolsDeprecationWarning', - 'find_packages' -] - -if PY3: - __all__.append('find_namespace_packages') - -__version__ = setuptools.version.__version__ - -bootstrap_install_from = None - -# If we run 2to3 on .py files, should we also convert docstrings? -# Default: yes; assume that we can detect doctests reliably -run_2to3_on_doctests = True -# Standard package names for fixer packages -lib2to3_fixer_packages = ['lib2to3.fixes'] - - -class PackageFinder: - """ - Generate a list of all Python packages found within a directory - """ - - @classmethod - def find(cls, where='.', exclude=(), include=('*',)): - """Return a list all Python packages found within directory 'where' - - 'where' is the root directory which will be searched for packages. It - should be supplied as a "cross-platform" (i.e. URL-style) path; it will - be converted to the appropriate local path syntax. - - 'exclude' is a sequence of package names to exclude; '*' can be used - as a wildcard in the names, such that 'foo.*' will exclude all - subpackages of 'foo' (but not 'foo' itself). - - 'include' is a sequence of package names to include. If it's - specified, only the named packages will be included. If it's not - specified, all found packages will be included. 'include' can contain - shell style wildcard patterns just like 'exclude'. - """ - - return list(cls._find_packages_iter( - convert_path(where), - cls._build_filter('ez_setup', '*__pycache__', *exclude), - cls._build_filter(*include))) - - @classmethod - def _find_packages_iter(cls, where, exclude, include): - """ - All the packages found in 'where' that pass the 'include' filter, but - not the 'exclude' filter. - """ - for root, dirs, files in os.walk(where, followlinks=True): - # Copy dirs to iterate over it, then empty dirs. - all_dirs = dirs[:] - dirs[:] = [] - - for dir in all_dirs: - full_path = os.path.join(root, dir) - rel_path = os.path.relpath(full_path, where) - package = rel_path.replace(os.path.sep, '.') - - # Skip directory trees that are not valid packages - if ('.' in dir or not cls._looks_like_package(full_path)): - continue - - # Should this package be included? - if include(package) and not exclude(package): - yield package - - # Keep searching subdirectories, as there may be more packages - # down there, even if the parent was excluded. - dirs.append(dir) - - @staticmethod - def _looks_like_package(path): - """Does a directory look like a package?""" - return os.path.isfile(os.path.join(path, '__init__.py')) - - @staticmethod - def _build_filter(*patterns): - """ - Given a list of patterns, return a callable that will be true only if - the input matches at least one of the patterns. - """ - return lambda name: any(fnmatchcase(name, pat=pat) for pat in patterns) - - -class PEP420PackageFinder(PackageFinder): - @staticmethod - def _looks_like_package(path): - return True - - -find_packages = PackageFinder.find - -if PY3: - find_namespace_packages = PEP420PackageFinder.find - - -def _install_setup_requires(attrs): - # Note: do not use `setuptools.Distribution` directly, as - # our PEP 517 backend patch `distutils.core.Distribution`. - dist = distutils.core.Distribution(dict( - (k, v) for k, v in attrs.items() - if k in ('dependency_links', 'setup_requires') - )) - # Honor setup.cfg's options. - dist.parse_config_files(ignore_option_errors=True) - if dist.setup_requires: - dist.fetch_build_eggs(dist.setup_requires) - - -def setup(**attrs): - # Make sure we have any requirements needed to interpret 'attrs'. - _install_setup_requires(attrs) - return distutils.core.setup(**attrs) - -setup.__doc__ = distutils.core.setup.__doc__ - - -_Command = monkey.get_unpatched(distutils.core.Command) - - -class Command(_Command): - __doc__ = _Command.__doc__ - - command_consumes_arguments = False - - def __init__(self, dist, **kw): - """ - Construct the command for dist, updating - vars(self) with any keyword parameters. - """ - _Command.__init__(self, dist) - vars(self).update(kw) - - def _ensure_stringlike(self, option, what, default=None): - val = getattr(self, option) - if val is None: - setattr(self, option, default) - return default - elif not isinstance(val, string_types): - raise DistutilsOptionError("'%s' must be a %s (got `%s`)" - % (option, what, val)) - return val - - def ensure_string_list(self, option): - r"""Ensure that 'option' is a list of strings. If 'option' is - currently a string, we split it either on /,\s*/ or /\s+/, so - "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become - ["foo", "bar", "baz"]. - """ - val = getattr(self, option) - if val is None: - return - elif isinstance(val, string_types): - setattr(self, option, re.split(r',\s*|\s+', val)) - else: - if isinstance(val, list): - ok = all(isinstance(v, string_types) for v in val) - else: - ok = False - if not ok: - raise DistutilsOptionError( - "'%s' must be a list of strings (got %r)" - % (option, val)) - - def reinitialize_command(self, command, reinit_subcommands=0, **kw): - cmd = _Command.reinitialize_command(self, command, reinit_subcommands) - vars(cmd).update(kw) - return cmd - - -def _find_all_simple(path): - """ - Find all files under 'path' - """ - results = ( - os.path.join(base, file) - for base, dirs, files in os.walk(path, followlinks=True) - for file in files - ) - return filter(os.path.isfile, results) - - -def findall(dir=os.curdir): - """ - Find all files under 'dir' and return the list of full filenames. - Unless dir is '.', return full filenames with dir prepended. - """ - files = _find_all_simple(dir) - if dir == os.curdir: - make_rel = functools.partial(os.path.relpath, start=dir) - files = map(make_rel, files) - return list(files) - - -# Apply monkey patches -monkey.patch_all() diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 35c60a57045dd8c882df4e19fcee7221ced86bce..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/_deprecation_warning.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/_deprecation_warning.cpython-38.pyc deleted file mode 100644 index 69448a46a33e9ffad82973424c351a7a80ea1d16..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/_deprecation_warning.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/_imp.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/_imp.cpython-38.pyc deleted file mode 100644 index 95f2b0cdc7cfb0cf5de9a150f2387fac77bee661..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/_imp.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/archive_util.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/archive_util.cpython-38.pyc deleted file mode 100644 index cd756b73c6e2894bc22167b38c6ce5b84c7a2bd3..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/archive_util.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/build_meta.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/build_meta.cpython-38.pyc deleted file mode 100644 index 31c95ed947d18db5426f6d1994ae8086c25e1233..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/build_meta.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/config.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/config.cpython-38.pyc deleted file mode 100644 index 0433dc4fcde22b7cba2fee641c923a1e4b39b296..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/config.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/dep_util.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/dep_util.cpython-38.pyc deleted file mode 100644 index db71639c4e53a877b9df06463ae49334607ee2cb..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/dep_util.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/depends.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/depends.cpython-38.pyc deleted file mode 100644 index 92143f47a2236944e8ab9a5357db8f5fdb12f6ae..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/depends.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/dist.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/dist.cpython-38.pyc deleted file mode 100644 index 2baede9159fee6a8fa0a868ff23c0b20accfee17..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/dist.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/errors.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/errors.cpython-38.pyc deleted file mode 100644 index 5a5f8e57dc2aa9ec8181de0928d5dd350fc4d36d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/errors.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/extension.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/extension.cpython-38.pyc deleted file mode 100644 index 97fd4116e651235690ee2021df15fa4d716d6725..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/extension.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/glob.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/glob.cpython-38.pyc deleted file mode 100644 index 52d5550783e6be25db69312b84fa7356e0aee549..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/glob.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/installer.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/installer.cpython-38.pyc deleted file mode 100644 index e857f4ce929df8e5237b55f775b4db8eafca2ffa..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/installer.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/launch.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/launch.cpython-38.pyc deleted file mode 100644 index 0975a2a4049954e2598e570bcb267389b15f97bc..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/launch.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/lib2to3_ex.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/lib2to3_ex.cpython-38.pyc deleted file mode 100644 index 2e7fa00f69ea90c376d8e6298dec0af572b9fd93..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/lib2to3_ex.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/monkey.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/monkey.cpython-38.pyc deleted file mode 100644 index 1d77c7d7f3c6a933350ac1aea64f0bd99b980c7f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/monkey.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/msvc.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/msvc.cpython-38.pyc deleted file mode 100644 index 9a9f3ef4654bb17efe7ab2e70010fee8464dd982..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/msvc.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/namespaces.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/namespaces.cpython-38.pyc deleted file mode 100644 index cb8b79bd88f2536d5e3b4fb7a650f4fd49258722..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/namespaces.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.pyc deleted file mode 100644 index d1fafbf5718140046ef96ec3540303f28c9d4db8..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/py27compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/py27compat.cpython-38.pyc deleted file mode 100644 index a226d0d7f4a9059b70577c17201a490006c35b36..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/py27compat.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/py31compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/py31compat.cpython-38.pyc deleted file mode 100644 index 3d9bf4675d365e5fd64d5083af9e4d0482b2a5ac..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/py31compat.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/py33compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/py33compat.cpython-38.pyc deleted file mode 100644 index 51584f3d5b9688cdbcad80d5eab81342026e7fb0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/py33compat.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/py34compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/py34compat.cpython-38.pyc deleted file mode 100644 index c00ecb0e359b5f35e483787478b298c03dbd67de..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/py34compat.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/sandbox.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/sandbox.cpython-38.pyc deleted file mode 100644 index 34daa36c08f03db4884f8aee71a1c6c1f7b85298..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/sandbox.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/site-patch.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/site-patch.cpython-38.pyc deleted file mode 100644 index bdcf9112e42b212f7b0a563619fb661cc064a751..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/site-patch.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/ssl_support.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/ssl_support.cpython-38.pyc deleted file mode 100644 index 6107096064b4792717f25c648e52ba039babce13..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/ssl_support.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/unicode_utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/unicode_utils.cpython-38.pyc deleted file mode 100644 index bd2729e449f4dd921be868c438456fad9ce99648..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/unicode_utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/version.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/version.cpython-38.pyc deleted file mode 100644 index 3c12baa6e2c81725d1731bc77f7bd602e73f5ac4..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/version.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/wheel.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/wheel.cpython-38.pyc deleted file mode 100644 index 2c4b8d6bc34ac21187655a9e289f4201e52f7f3f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/wheel.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/__pycache__/windows_support.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/__pycache__/windows_support.cpython-38.pyc deleted file mode 100644 index cffe4a2f2995041252357d08ada1591960833557..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/__pycache__/windows_support.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_deprecation_warning.py b/venv/lib/python3.8/site-packages/setuptools/_deprecation_warning.py deleted file mode 100644 index 086b64dd3817c0c1a194ffc1959eeffdd2695bef..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_deprecation_warning.py +++ /dev/null @@ -1,7 +0,0 @@ -class SetuptoolsDeprecationWarning(Warning): - """ - Base class for warning deprecations in ``setuptools`` - - This class is not derived from ``DeprecationWarning``, and as such is - visible by default. - """ diff --git a/venv/lib/python3.8/site-packages/setuptools/_imp.py b/venv/lib/python3.8/site-packages/setuptools/_imp.py deleted file mode 100644 index a3cce9b284b1e580c1715c5e300a18077d63e8ce..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_imp.py +++ /dev/null @@ -1,73 +0,0 @@ -""" -Re-implementation of find_module and get_frozen_object -from the deprecated imp module. -""" - -import os -import importlib.util -import importlib.machinery - -from .py34compat import module_from_spec - - -PY_SOURCE = 1 -PY_COMPILED = 2 -C_EXTENSION = 3 -C_BUILTIN = 6 -PY_FROZEN = 7 - - -def find_module(module, paths=None): - """Just like 'imp.find_module()', but with package support""" - spec = importlib.util.find_spec(module, paths) - if spec is None: - raise ImportError("Can't find %s" % module) - if not spec.has_location and hasattr(spec, 'submodule_search_locations'): - spec = importlib.util.spec_from_loader('__init__.py', spec.loader) - - kind = -1 - file = None - static = isinstance(spec.loader, type) - if spec.origin == 'frozen' or static and issubclass( - spec.loader, importlib.machinery.FrozenImporter): - kind = PY_FROZEN - path = None # imp compabilty - suffix = mode = '' # imp compability - elif spec.origin == 'built-in' or static and issubclass( - spec.loader, importlib.machinery.BuiltinImporter): - kind = C_BUILTIN - path = None # imp compabilty - suffix = mode = '' # imp compability - elif spec.has_location: - path = spec.origin - suffix = os.path.splitext(path)[1] - mode = 'r' if suffix in importlib.machinery.SOURCE_SUFFIXES else 'rb' - - if suffix in importlib.machinery.SOURCE_SUFFIXES: - kind = PY_SOURCE - elif suffix in importlib.machinery.BYTECODE_SUFFIXES: - kind = PY_COMPILED - elif suffix in importlib.machinery.EXTENSION_SUFFIXES: - kind = C_EXTENSION - - if kind in {PY_SOURCE, PY_COMPILED}: - file = open(path, mode) - else: - path = None - suffix = mode = '' - - return file, path, (suffix, mode, kind) - - -def get_frozen_object(module, paths=None): - spec = importlib.util.find_spec(module, paths) - if not spec: - raise ImportError("Can't find %s" % module) - return spec.loader.get_code(module) - - -def get_module(module, paths, info): - spec = importlib.util.find_spec(module, paths) - if not spec: - raise ImportError("Can't find %s" % module) - return module_from_spec(spec) diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/__init__.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 16e34b9d6c3fad16149d78e3d564492636ae5c51..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/ordered_set.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/ordered_set.cpython-38.pyc deleted file mode 100644 index 46f414e2c7ea2c09ce0e531147b2192ca0759dda..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/ordered_set.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/pyparsing.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/pyparsing.cpython-38.pyc deleted file mode 100644 index bc37e5940c94aba0c9377422a13444335ea6147a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/pyparsing.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/six.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/six.cpython-38.pyc deleted file mode 100644 index 41f60d4c597a17ba8a5d61668c0cc391a4b0e60b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/__pycache__/six.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/ordered_set.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/ordered_set.py deleted file mode 100644 index 14876000de895a609d5b9f3de39c3c8fc44ef1fc..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/ordered_set.py +++ /dev/null @@ -1,488 +0,0 @@ -""" -An OrderedSet is a custom MutableSet that remembers its order, so that every -entry has an index that can be looked up. - -Based on a recipe originally posted to ActiveState Recipes by Raymond Hettiger, -and released under the MIT license. -""" -import itertools as it -from collections import deque - -try: - # Python 3 - from collections.abc import MutableSet, Sequence -except ImportError: - # Python 2.7 - from collections import MutableSet, Sequence - -SLICE_ALL = slice(None) -__version__ = "3.1" - - -def is_iterable(obj): - """ - Are we being asked to look up a list of things, instead of a single thing? - We check for the `__iter__` attribute so that this can cover types that - don't have to be known by this module, such as NumPy arrays. - - Strings, however, should be considered as atomic values to look up, not - iterables. The same goes for tuples, since they are immutable and therefore - valid entries. - - We don't need to check for the Python 2 `unicode` type, because it doesn't - have an `__iter__` attribute anyway. - """ - return ( - hasattr(obj, "__iter__") - and not isinstance(obj, str) - and not isinstance(obj, tuple) - ) - - -class OrderedSet(MutableSet, Sequence): - """ - An OrderedSet is a custom MutableSet that remembers its order, so that - every entry has an index that can be looked up. - - Example: - >>> OrderedSet([1, 1, 2, 3, 2]) - OrderedSet([1, 2, 3]) - """ - - def __init__(self, iterable=None): - self.items = [] - self.map = {} - if iterable is not None: - self |= iterable - - def __len__(self): - """ - Returns the number of unique elements in the ordered set - - Example: - >>> len(OrderedSet([])) - 0 - >>> len(OrderedSet([1, 2])) - 2 - """ - return len(self.items) - - def __getitem__(self, index): - """ - Get the item at a given index. - - If `index` is a slice, you will get back that slice of items, as a - new OrderedSet. - - If `index` is a list or a similar iterable, you'll get a list of - items corresponding to those indices. This is similar to NumPy's - "fancy indexing". The result is not an OrderedSet because you may ask - for duplicate indices, and the number of elements returned should be - the number of elements asked for. - - Example: - >>> oset = OrderedSet([1, 2, 3]) - >>> oset[1] - 2 - """ - if isinstance(index, slice) and index == SLICE_ALL: - return self.copy() - elif is_iterable(index): - return [self.items[i] for i in index] - elif hasattr(index, "__index__") or isinstance(index, slice): - result = self.items[index] - if isinstance(result, list): - return self.__class__(result) - else: - return result - else: - raise TypeError("Don't know how to index an OrderedSet by %r" % index) - - def copy(self): - """ - Return a shallow copy of this object. - - Example: - >>> this = OrderedSet([1, 2, 3]) - >>> other = this.copy() - >>> this == other - True - >>> this is other - False - """ - return self.__class__(self) - - def __getstate__(self): - if len(self) == 0: - # The state can't be an empty list. - # We need to return a truthy value, or else __setstate__ won't be run. - # - # This could have been done more gracefully by always putting the state - # in a tuple, but this way is backwards- and forwards- compatible with - # previous versions of OrderedSet. - return (None,) - else: - return list(self) - - def __setstate__(self, state): - if state == (None,): - self.__init__([]) - else: - self.__init__(state) - - def __contains__(self, key): - """ - Test if the item is in this ordered set - - Example: - >>> 1 in OrderedSet([1, 3, 2]) - True - >>> 5 in OrderedSet([1, 3, 2]) - False - """ - return key in self.map - - def add(self, key): - """ - Add `key` as an item to this OrderedSet, then return its index. - - If `key` is already in the OrderedSet, return the index it already - had. - - Example: - >>> oset = OrderedSet() - >>> oset.append(3) - 0 - >>> print(oset) - OrderedSet([3]) - """ - if key not in self.map: - self.map[key] = len(self.items) - self.items.append(key) - return self.map[key] - - append = add - - def update(self, sequence): - """ - Update the set with the given iterable sequence, then return the index - of the last element inserted. - - Example: - >>> oset = OrderedSet([1, 2, 3]) - >>> oset.update([3, 1, 5, 1, 4]) - 4 - >>> print(oset) - OrderedSet([1, 2, 3, 5, 4]) - """ - item_index = None - try: - for item in sequence: - item_index = self.add(item) - except TypeError: - raise ValueError( - "Argument needs to be an iterable, got %s" % type(sequence) - ) - return item_index - - def index(self, key): - """ - Get the index of a given entry, raising an IndexError if it's not - present. - - `key` can be an iterable of entries that is not a string, in which case - this returns a list of indices. - - Example: - >>> oset = OrderedSet([1, 2, 3]) - >>> oset.index(2) - 1 - """ - if is_iterable(key): - return [self.index(subkey) for subkey in key] - return self.map[key] - - # Provide some compatibility with pd.Index - get_loc = index - get_indexer = index - - def pop(self): - """ - Remove and return the last element from the set. - - Raises KeyError if the set is empty. - - Example: - >>> oset = OrderedSet([1, 2, 3]) - >>> oset.pop() - 3 - """ - if not self.items: - raise KeyError("Set is empty") - - elem = self.items[-1] - del self.items[-1] - del self.map[elem] - return elem - - def discard(self, key): - """ - Remove an element. Do not raise an exception if absent. - - The MutableSet mixin uses this to implement the .remove() method, which - *does* raise an error when asked to remove a non-existent item. - - Example: - >>> oset = OrderedSet([1, 2, 3]) - >>> oset.discard(2) - >>> print(oset) - OrderedSet([1, 3]) - >>> oset.discard(2) - >>> print(oset) - OrderedSet([1, 3]) - """ - if key in self: - i = self.map[key] - del self.items[i] - del self.map[key] - for k, v in self.map.items(): - if v >= i: - self.map[k] = v - 1 - - def clear(self): - """ - Remove all items from this OrderedSet. - """ - del self.items[:] - self.map.clear() - - def __iter__(self): - """ - Example: - >>> list(iter(OrderedSet([1, 2, 3]))) - [1, 2, 3] - """ - return iter(self.items) - - def __reversed__(self): - """ - Example: - >>> list(reversed(OrderedSet([1, 2, 3]))) - [3, 2, 1] - """ - return reversed(self.items) - - def __repr__(self): - if not self: - return "%s()" % (self.__class__.__name__,) - return "%s(%r)" % (self.__class__.__name__, list(self)) - - def __eq__(self, other): - """ - Returns true if the containers have the same items. If `other` is a - Sequence, then order is checked, otherwise it is ignored. - - Example: - >>> oset = OrderedSet([1, 3, 2]) - >>> oset == [1, 3, 2] - True - >>> oset == [1, 2, 3] - False - >>> oset == [2, 3] - False - >>> oset == OrderedSet([3, 2, 1]) - False - """ - # In Python 2 deque is not a Sequence, so treat it as one for - # consistent behavior with Python 3. - if isinstance(other, (Sequence, deque)): - # Check that this OrderedSet contains the same elements, in the - # same order, as the other object. - return list(self) == list(other) - try: - other_as_set = set(other) - except TypeError: - # If `other` can't be converted into a set, it's not equal. - return False - else: - return set(self) == other_as_set - - def union(self, *sets): - """ - Combines all unique items. - Each items order is defined by its first appearance. - - Example: - >>> oset = OrderedSet.union(OrderedSet([3, 1, 4, 1, 5]), [1, 3], [2, 0]) - >>> print(oset) - OrderedSet([3, 1, 4, 5, 2, 0]) - >>> oset.union([8, 9]) - OrderedSet([3, 1, 4, 5, 2, 0, 8, 9]) - >>> oset | {10} - OrderedSet([3, 1, 4, 5, 2, 0, 10]) - """ - cls = self.__class__ if isinstance(self, OrderedSet) else OrderedSet - containers = map(list, it.chain([self], sets)) - items = it.chain.from_iterable(containers) - return cls(items) - - def __and__(self, other): - # the parent implementation of this is backwards - return self.intersection(other) - - def intersection(self, *sets): - """ - Returns elements in common between all sets. Order is defined only - by the first set. - - Example: - >>> oset = OrderedSet.intersection(OrderedSet([0, 1, 2, 3]), [1, 2, 3]) - >>> print(oset) - OrderedSet([1, 2, 3]) - >>> oset.intersection([2, 4, 5], [1, 2, 3, 4]) - OrderedSet([2]) - >>> oset.intersection() - OrderedSet([1, 2, 3]) - """ - cls = self.__class__ if isinstance(self, OrderedSet) else OrderedSet - if sets: - common = set.intersection(*map(set, sets)) - items = (item for item in self if item in common) - else: - items = self - return cls(items) - - def difference(self, *sets): - """ - Returns all elements that are in this set but not the others. - - Example: - >>> OrderedSet([1, 2, 3]).difference(OrderedSet([2])) - OrderedSet([1, 3]) - >>> OrderedSet([1, 2, 3]).difference(OrderedSet([2]), OrderedSet([3])) - OrderedSet([1]) - >>> OrderedSet([1, 2, 3]) - OrderedSet([2]) - OrderedSet([1, 3]) - >>> OrderedSet([1, 2, 3]).difference() - OrderedSet([1, 2, 3]) - """ - cls = self.__class__ - if sets: - other = set.union(*map(set, sets)) - items = (item for item in self if item not in other) - else: - items = self - return cls(items) - - def issubset(self, other): - """ - Report whether another set contains this set. - - Example: - >>> OrderedSet([1, 2, 3]).issubset({1, 2}) - False - >>> OrderedSet([1, 2, 3]).issubset({1, 2, 3, 4}) - True - >>> OrderedSet([1, 2, 3]).issubset({1, 4, 3, 5}) - False - """ - if len(self) > len(other): # Fast check for obvious cases - return False - return all(item in other for item in self) - - def issuperset(self, other): - """ - Report whether this set contains another set. - - Example: - >>> OrderedSet([1, 2]).issuperset([1, 2, 3]) - False - >>> OrderedSet([1, 2, 3, 4]).issuperset({1, 2, 3}) - True - >>> OrderedSet([1, 4, 3, 5]).issuperset({1, 2, 3}) - False - """ - if len(self) < len(other): # Fast check for obvious cases - return False - return all(item in self for item in other) - - def symmetric_difference(self, other): - """ - Return the symmetric difference of two OrderedSets as a new set. - That is, the new set will contain all elements that are in exactly - one of the sets. - - Their order will be preserved, with elements from `self` preceding - elements from `other`. - - Example: - >>> this = OrderedSet([1, 4, 3, 5, 7]) - >>> other = OrderedSet([9, 7, 1, 3, 2]) - >>> this.symmetric_difference(other) - OrderedSet([4, 5, 9, 2]) - """ - cls = self.__class__ if isinstance(self, OrderedSet) else OrderedSet - diff1 = cls(self).difference(other) - diff2 = cls(other).difference(self) - return diff1.union(diff2) - - def _update_items(self, items): - """ - Replace the 'items' list of this OrderedSet with a new one, updating - self.map accordingly. - """ - self.items = items - self.map = {item: idx for (idx, item) in enumerate(items)} - - def difference_update(self, *sets): - """ - Update this OrderedSet to remove items from one or more other sets. - - Example: - >>> this = OrderedSet([1, 2, 3]) - >>> this.difference_update(OrderedSet([2, 4])) - >>> print(this) - OrderedSet([1, 3]) - - >>> this = OrderedSet([1, 2, 3, 4, 5]) - >>> this.difference_update(OrderedSet([2, 4]), OrderedSet([1, 4, 6])) - >>> print(this) - OrderedSet([3, 5]) - """ - items_to_remove = set() - for other in sets: - items_to_remove |= set(other) - self._update_items([item for item in self.items if item not in items_to_remove]) - - def intersection_update(self, other): - """ - Update this OrderedSet to keep only items in another set, preserving - their order in this set. - - Example: - >>> this = OrderedSet([1, 4, 3, 5, 7]) - >>> other = OrderedSet([9, 7, 1, 3, 2]) - >>> this.intersection_update(other) - >>> print(this) - OrderedSet([1, 3, 7]) - """ - other = set(other) - self._update_items([item for item in self.items if item in other]) - - def symmetric_difference_update(self, other): - """ - Update this OrderedSet to remove items from another set, then - add items from the other set that were not present in this set. - - Example: - >>> this = OrderedSet([1, 4, 3, 5, 7]) - >>> other = OrderedSet([9, 7, 1, 3, 2]) - >>> this.symmetric_difference_update(other) - >>> print(this) - OrderedSet([4, 5, 9, 2]) - """ - items_to_add = [item for item in other if item not in self] - items_to_remove = set(other) - self._update_items( - [item for item in self.items if item not in items_to_remove] + items_to_add - ) diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__about__.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__about__.py deleted file mode 100644 index dc95138d049ba3194964d528b552a6d1514fa382..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__about__.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - -__all__ = [ - "__title__", - "__summary__", - "__uri__", - "__version__", - "__author__", - "__email__", - "__license__", - "__copyright__", -] - -__title__ = "packaging" -__summary__ = "Core utilities for Python packages" -__uri__ = "https://github.com/pypa/packaging" - -__version__ = "19.2" - -__author__ = "Donald Stufft and individual contributors" -__email__ = "donald@stufft.io" - -__license__ = "BSD or Apache License, Version 2.0" -__copyright__ = "Copyright 2014-2019 %s" % __author__ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__init__.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__init__.py deleted file mode 100644 index a0cf67df5245be16a020ca048832e180f7ce8661..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - -from .__about__ import ( - __author__, - __copyright__, - __email__, - __license__, - __summary__, - __title__, - __uri__, - __version__, -) - -__all__ = [ - "__title__", - "__summary__", - "__uri__", - "__version__", - "__author__", - "__email__", - "__license__", - "__copyright__", -] diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/__about__.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/__about__.cpython-38.pyc deleted file mode 100644 index 5aed7df5ae6fddb698b513eba46c92023473e3f6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/__about__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index fe16a8aba0112cdb973eb7573d97529667d0b1a7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/_compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/_compat.cpython-38.pyc deleted file mode 100644 index bd5ce8cb0774a6f9cc88b569e1c36588d57ce20c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/_compat.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/_structures.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/_structures.cpython-38.pyc deleted file mode 100644 index 030900b4f65982605c990517a6296842a3f8714a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/_structures.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/markers.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/markers.cpython-38.pyc deleted file mode 100644 index 066873917feb8603bccfc66073b47c3772943859..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/markers.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/requirements.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/requirements.cpython-38.pyc deleted file mode 100644 index 217889b8ab95c876423f9e94f4c8ac32d08c5ef0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/requirements.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/specifiers.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/specifiers.cpython-38.pyc deleted file mode 100644 index df383de5c3089386667db5c8dd36f27e18b46b99..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/specifiers.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/tags.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/tags.cpython-38.pyc deleted file mode 100644 index 80d3bae779c6e723d4131b12c5b249b7ec0b7b04..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/tags.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/utils.cpython-38.pyc deleted file mode 100644 index 323b579da66ff2432d462faed90f99ae2e52b1aa..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/version.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/version.cpython-38.pyc deleted file mode 100644 index d2c9306b19734dce997ca709be3faa45ba9de635..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/__pycache__/version.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/_compat.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/_compat.py deleted file mode 100644 index 25da473c196855ad59a6d2d785ef1ddef49795be..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/_compat.py +++ /dev/null @@ -1,31 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - -import sys - - -PY2 = sys.version_info[0] == 2 -PY3 = sys.version_info[0] == 3 - -# flake8: noqa - -if PY3: - string_types = (str,) -else: - string_types = (basestring,) - - -def with_metaclass(meta, *bases): - """ - Create a base class with a metaclass. - """ - # This requires a bit of explanation: the basic idea is to make a dummy - # metaclass for one level of class instantiation that replaces itself with - # the actual metaclass. - class metaclass(meta): - def __new__(cls, name, this_bases, d): - return meta(name, bases, d) - - return type.__new__(metaclass, "temporary_class", (), {}) diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/_structures.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/_structures.py deleted file mode 100644 index 68dcca634d8e3f0081bad2f9ae5e653a2942db68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/_structures.py +++ /dev/null @@ -1,68 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - - -class Infinity(object): - def __repr__(self): - return "Infinity" - - def __hash__(self): - return hash(repr(self)) - - def __lt__(self, other): - return False - - def __le__(self, other): - return False - - def __eq__(self, other): - return isinstance(other, self.__class__) - - def __ne__(self, other): - return not isinstance(other, self.__class__) - - def __gt__(self, other): - return True - - def __ge__(self, other): - return True - - def __neg__(self): - return NegativeInfinity - - -Infinity = Infinity() - - -class NegativeInfinity(object): - def __repr__(self): - return "-Infinity" - - def __hash__(self): - return hash(repr(self)) - - def __lt__(self, other): - return True - - def __le__(self, other): - return True - - def __eq__(self, other): - return isinstance(other, self.__class__) - - def __ne__(self, other): - return not isinstance(other, self.__class__) - - def __gt__(self, other): - return False - - def __ge__(self, other): - return False - - def __neg__(self): - return Infinity - - -NegativeInfinity = NegativeInfinity() diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/markers.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/markers.py deleted file mode 100644 index 4bdfdb24f2096eac046bb9a576065bb96cfd476e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/markers.py +++ /dev/null @@ -1,296 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - -import operator -import os -import platform -import sys - -from setuptools.extern.pyparsing import ParseException, ParseResults, stringStart, stringEnd -from setuptools.extern.pyparsing import ZeroOrMore, Group, Forward, QuotedString -from setuptools.extern.pyparsing import Literal as L # noqa - -from ._compat import string_types -from .specifiers import Specifier, InvalidSpecifier - - -__all__ = [ - "InvalidMarker", - "UndefinedComparison", - "UndefinedEnvironmentName", - "Marker", - "default_environment", -] - - -class InvalidMarker(ValueError): - """ - An invalid marker was found, users should refer to PEP 508. - """ - - -class UndefinedComparison(ValueError): - """ - An invalid operation was attempted on a value that doesn't support it. - """ - - -class UndefinedEnvironmentName(ValueError): - """ - A name was attempted to be used that does not exist inside of the - environment. - """ - - -class Node(object): - def __init__(self, value): - self.value = value - - def __str__(self): - return str(self.value) - - def __repr__(self): - return "<{0}({1!r})>".format(self.__class__.__name__, str(self)) - - def serialize(self): - raise NotImplementedError - - -class Variable(Node): - def serialize(self): - return str(self) - - -class Value(Node): - def serialize(self): - return '"{0}"'.format(self) - - -class Op(Node): - def serialize(self): - return str(self) - - -VARIABLE = ( - L("implementation_version") - | L("platform_python_implementation") - | L("implementation_name") - | L("python_full_version") - | L("platform_release") - | L("platform_version") - | L("platform_machine") - | L("platform_system") - | L("python_version") - | L("sys_platform") - | L("os_name") - | L("os.name") - | L("sys.platform") # PEP-345 - | L("platform.version") # PEP-345 - | L("platform.machine") # PEP-345 - | L("platform.python_implementation") # PEP-345 - | L("python_implementation") # PEP-345 - | L("extra") # undocumented setuptools legacy -) -ALIASES = { - "os.name": "os_name", - "sys.platform": "sys_platform", - "platform.version": "platform_version", - "platform.machine": "platform_machine", - "platform.python_implementation": "platform_python_implementation", - "python_implementation": "platform_python_implementation", -} -VARIABLE.setParseAction(lambda s, l, t: Variable(ALIASES.get(t[0], t[0]))) - -VERSION_CMP = ( - L("===") | L("==") | L(">=") | L("<=") | L("!=") | L("~=") | L(">") | L("<") -) - -MARKER_OP = VERSION_CMP | L("not in") | L("in") -MARKER_OP.setParseAction(lambda s, l, t: Op(t[0])) - -MARKER_VALUE = QuotedString("'") | QuotedString('"') -MARKER_VALUE.setParseAction(lambda s, l, t: Value(t[0])) - -BOOLOP = L("and") | L("or") - -MARKER_VAR = VARIABLE | MARKER_VALUE - -MARKER_ITEM = Group(MARKER_VAR + MARKER_OP + MARKER_VAR) -MARKER_ITEM.setParseAction(lambda s, l, t: tuple(t[0])) - -LPAREN = L("(").suppress() -RPAREN = L(")").suppress() - -MARKER_EXPR = Forward() -MARKER_ATOM = MARKER_ITEM | Group(LPAREN + MARKER_EXPR + RPAREN) -MARKER_EXPR << MARKER_ATOM + ZeroOrMore(BOOLOP + MARKER_EXPR) - -MARKER = stringStart + MARKER_EXPR + stringEnd - - -def _coerce_parse_result(results): - if isinstance(results, ParseResults): - return [_coerce_parse_result(i) for i in results] - else: - return results - - -def _format_marker(marker, first=True): - assert isinstance(marker, (list, tuple, string_types)) - - # Sometimes we have a structure like [[...]] which is a single item list - # where the single item is itself it's own list. In that case we want skip - # the rest of this function so that we don't get extraneous () on the - # outside. - if ( - isinstance(marker, list) - and len(marker) == 1 - and isinstance(marker[0], (list, tuple)) - ): - return _format_marker(marker[0]) - - if isinstance(marker, list): - inner = (_format_marker(m, first=False) for m in marker) - if first: - return " ".join(inner) - else: - return "(" + " ".join(inner) + ")" - elif isinstance(marker, tuple): - return " ".join([m.serialize() for m in marker]) - else: - return marker - - -_operators = { - "in": lambda lhs, rhs: lhs in rhs, - "not in": lambda lhs, rhs: lhs not in rhs, - "<": operator.lt, - "<=": operator.le, - "==": operator.eq, - "!=": operator.ne, - ">=": operator.ge, - ">": operator.gt, -} - - -def _eval_op(lhs, op, rhs): - try: - spec = Specifier("".join([op.serialize(), rhs])) - except InvalidSpecifier: - pass - else: - return spec.contains(lhs) - - oper = _operators.get(op.serialize()) - if oper is None: - raise UndefinedComparison( - "Undefined {0!r} on {1!r} and {2!r}.".format(op, lhs, rhs) - ) - - return oper(lhs, rhs) - - -_undefined = object() - - -def _get_env(environment, name): - value = environment.get(name, _undefined) - - if value is _undefined: - raise UndefinedEnvironmentName( - "{0!r} does not exist in evaluation environment.".format(name) - ) - - return value - - -def _evaluate_markers(markers, environment): - groups = [[]] - - for marker in markers: - assert isinstance(marker, (list, tuple, string_types)) - - if isinstance(marker, list): - groups[-1].append(_evaluate_markers(marker, environment)) - elif isinstance(marker, tuple): - lhs, op, rhs = marker - - if isinstance(lhs, Variable): - lhs_value = _get_env(environment, lhs.value) - rhs_value = rhs.value - else: - lhs_value = lhs.value - rhs_value = _get_env(environment, rhs.value) - - groups[-1].append(_eval_op(lhs_value, op, rhs_value)) - else: - assert marker in ["and", "or"] - if marker == "or": - groups.append([]) - - return any(all(item) for item in groups) - - -def format_full_version(info): - version = "{0.major}.{0.minor}.{0.micro}".format(info) - kind = info.releaselevel - if kind != "final": - version += kind[0] + str(info.serial) - return version - - -def default_environment(): - if hasattr(sys, "implementation"): - iver = format_full_version(sys.implementation.version) - implementation_name = sys.implementation.name - else: - iver = "0" - implementation_name = "" - - return { - "implementation_name": implementation_name, - "implementation_version": iver, - "os_name": os.name, - "platform_machine": platform.machine(), - "platform_release": platform.release(), - "platform_system": platform.system(), - "platform_version": platform.version(), - "python_full_version": platform.python_version(), - "platform_python_implementation": platform.python_implementation(), - "python_version": ".".join(platform.python_version_tuple()[:2]), - "sys_platform": sys.platform, - } - - -class Marker(object): - def __init__(self, marker): - try: - self._markers = _coerce_parse_result(MARKER.parseString(marker)) - except ParseException as e: - err_str = "Invalid marker: {0!r}, parse error at {1!r}".format( - marker, marker[e.loc : e.loc + 8] - ) - raise InvalidMarker(err_str) - - def __str__(self): - return _format_marker(self._markers) - - def __repr__(self): - return "".format(str(self)) - - def evaluate(self, environment=None): - """Evaluate a marker. - - Return the boolean from evaluating the given marker against the - environment. environment is an optional argument to override all or - part of the determined environment. - - The environment is determined from the current Python process. - """ - current_environment = default_environment() - if environment is not None: - current_environment.update(environment) - - return _evaluate_markers(self._markers, current_environment) diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/requirements.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/requirements.py deleted file mode 100644 index 8a0c2cb9be06e633b26c7205d6efe42827835910..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/requirements.py +++ /dev/null @@ -1,138 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - -import string -import re - -from setuptools.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException -from setuptools.extern.pyparsing import ZeroOrMore, Word, Optional, Regex, Combine -from setuptools.extern.pyparsing import Literal as L # noqa -from setuptools.extern.six.moves.urllib import parse as urlparse - -from .markers import MARKER_EXPR, Marker -from .specifiers import LegacySpecifier, Specifier, SpecifierSet - - -class InvalidRequirement(ValueError): - """ - An invalid requirement was found, users should refer to PEP 508. - """ - - -ALPHANUM = Word(string.ascii_letters + string.digits) - -LBRACKET = L("[").suppress() -RBRACKET = L("]").suppress() -LPAREN = L("(").suppress() -RPAREN = L(")").suppress() -COMMA = L(",").suppress() -SEMICOLON = L(";").suppress() -AT = L("@").suppress() - -PUNCTUATION = Word("-_.") -IDENTIFIER_END = ALPHANUM | (ZeroOrMore(PUNCTUATION) + ALPHANUM) -IDENTIFIER = Combine(ALPHANUM + ZeroOrMore(IDENTIFIER_END)) - -NAME = IDENTIFIER("name") -EXTRA = IDENTIFIER - -URI = Regex(r"[^ ]+")("url") -URL = AT + URI - -EXTRAS_LIST = EXTRA + ZeroOrMore(COMMA + EXTRA) -EXTRAS = (LBRACKET + Optional(EXTRAS_LIST) + RBRACKET)("extras") - -VERSION_PEP440 = Regex(Specifier._regex_str, re.VERBOSE | re.IGNORECASE) -VERSION_LEGACY = Regex(LegacySpecifier._regex_str, re.VERBOSE | re.IGNORECASE) - -VERSION_ONE = VERSION_PEP440 ^ VERSION_LEGACY -VERSION_MANY = Combine( - VERSION_ONE + ZeroOrMore(COMMA + VERSION_ONE), joinString=",", adjacent=False -)("_raw_spec") -_VERSION_SPEC = Optional(((LPAREN + VERSION_MANY + RPAREN) | VERSION_MANY)) -_VERSION_SPEC.setParseAction(lambda s, l, t: t._raw_spec or "") - -VERSION_SPEC = originalTextFor(_VERSION_SPEC)("specifier") -VERSION_SPEC.setParseAction(lambda s, l, t: t[1]) - -MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker") -MARKER_EXPR.setParseAction( - lambda s, l, t: Marker(s[t._original_start : t._original_end]) -) -MARKER_SEPARATOR = SEMICOLON -MARKER = MARKER_SEPARATOR + MARKER_EXPR - -VERSION_AND_MARKER = VERSION_SPEC + Optional(MARKER) -URL_AND_MARKER = URL + Optional(MARKER) - -NAMED_REQUIREMENT = NAME + Optional(EXTRAS) + (URL_AND_MARKER | VERSION_AND_MARKER) - -REQUIREMENT = stringStart + NAMED_REQUIREMENT + stringEnd -# setuptools.extern.pyparsing isn't thread safe during initialization, so we do it eagerly, see -# issue #104 -REQUIREMENT.parseString("x[]") - - -class Requirement(object): - """Parse a requirement. - - Parse a given requirement string into its parts, such as name, specifier, - URL, and extras. Raises InvalidRequirement on a badly-formed requirement - string. - """ - - # TODO: Can we test whether something is contained within a requirement? - # If so how do we do that? Do we need to test against the _name_ of - # the thing as well as the version? What about the markers? - # TODO: Can we normalize the name and extra name? - - def __init__(self, requirement_string): - try: - req = REQUIREMENT.parseString(requirement_string) - except ParseException as e: - raise InvalidRequirement( - 'Parse error at "{0!r}": {1}'.format( - requirement_string[e.loc : e.loc + 8], e.msg - ) - ) - - self.name = req.name - if req.url: - parsed_url = urlparse.urlparse(req.url) - if parsed_url.scheme == "file": - if urlparse.urlunparse(parsed_url) != req.url: - raise InvalidRequirement("Invalid URL given") - elif not (parsed_url.scheme and parsed_url.netloc) or ( - not parsed_url.scheme and not parsed_url.netloc - ): - raise InvalidRequirement("Invalid URL: {0}".format(req.url)) - self.url = req.url - else: - self.url = None - self.extras = set(req.extras.asList() if req.extras else []) - self.specifier = SpecifierSet(req.specifier) - self.marker = req.marker if req.marker else None - - def __str__(self): - parts = [self.name] - - if self.extras: - parts.append("[{0}]".format(",".join(sorted(self.extras)))) - - if self.specifier: - parts.append(str(self.specifier)) - - if self.url: - parts.append("@ {0}".format(self.url)) - if self.marker: - parts.append(" ") - - if self.marker: - parts.append("; {0}".format(self.marker)) - - return "".join(parts) - - def __repr__(self): - return "".format(str(self)) diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/specifiers.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/specifiers.py deleted file mode 100644 index 743576a080a0af8d0995f307ea6afc645b13ca61..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/specifiers.py +++ /dev/null @@ -1,749 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - -import abc -import functools -import itertools -import re - -from ._compat import string_types, with_metaclass -from .version import Version, LegacyVersion, parse - - -class InvalidSpecifier(ValueError): - """ - An invalid specifier was found, users should refer to PEP 440. - """ - - -class BaseSpecifier(with_metaclass(abc.ABCMeta, object)): - @abc.abstractmethod - def __str__(self): - """ - Returns the str representation of this Specifier like object. This - should be representative of the Specifier itself. - """ - - @abc.abstractmethod - def __hash__(self): - """ - Returns a hash value for this Specifier like object. - """ - - @abc.abstractmethod - def __eq__(self, other): - """ - Returns a boolean representing whether or not the two Specifier like - objects are equal. - """ - - @abc.abstractmethod - def __ne__(self, other): - """ - Returns a boolean representing whether or not the two Specifier like - objects are not equal. - """ - - @abc.abstractproperty - def prereleases(self): - """ - Returns whether or not pre-releases as a whole are allowed by this - specifier. - """ - - @prereleases.setter - def prereleases(self, value): - """ - Sets whether or not pre-releases as a whole are allowed by this - specifier. - """ - - @abc.abstractmethod - def contains(self, item, prereleases=None): - """ - Determines if the given item is contained within this specifier. - """ - - @abc.abstractmethod - def filter(self, iterable, prereleases=None): - """ - Takes an iterable of items and filters them so that only items which - are contained within this specifier are allowed in it. - """ - - -class _IndividualSpecifier(BaseSpecifier): - - _operators = {} - - def __init__(self, spec="", prereleases=None): - match = self._regex.search(spec) - if not match: - raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec)) - - self._spec = (match.group("operator").strip(), match.group("version").strip()) - - # Store whether or not this Specifier should accept prereleases - self._prereleases = prereleases - - def __repr__(self): - pre = ( - ", prereleases={0!r}".format(self.prereleases) - if self._prereleases is not None - else "" - ) - - return "<{0}({1!r}{2})>".format(self.__class__.__name__, str(self), pre) - - def __str__(self): - return "{0}{1}".format(*self._spec) - - def __hash__(self): - return hash(self._spec) - - def __eq__(self, other): - if isinstance(other, string_types): - try: - other = self.__class__(other) - except InvalidSpecifier: - return NotImplemented - elif not isinstance(other, self.__class__): - return NotImplemented - - return self._spec == other._spec - - def __ne__(self, other): - if isinstance(other, string_types): - try: - other = self.__class__(other) - except InvalidSpecifier: - return NotImplemented - elif not isinstance(other, self.__class__): - return NotImplemented - - return self._spec != other._spec - - def _get_operator(self, op): - return getattr(self, "_compare_{0}".format(self._operators[op])) - - def _coerce_version(self, version): - if not isinstance(version, (LegacyVersion, Version)): - version = parse(version) - return version - - @property - def operator(self): - return self._spec[0] - - @property - def version(self): - return self._spec[1] - - @property - def prereleases(self): - return self._prereleases - - @prereleases.setter - def prereleases(self, value): - self._prereleases = value - - def __contains__(self, item): - return self.contains(item) - - def contains(self, item, prereleases=None): - # Determine if prereleases are to be allowed or not. - if prereleases is None: - prereleases = self.prereleases - - # Normalize item to a Version or LegacyVersion, this allows us to have - # a shortcut for ``"2.0" in Specifier(">=2") - item = self._coerce_version(item) - - # Determine if we should be supporting prereleases in this specifier - # or not, if we do not support prereleases than we can short circuit - # logic if this version is a prereleases. - if item.is_prerelease and not prereleases: - return False - - # Actually do the comparison to determine if this item is contained - # within this Specifier or not. - return self._get_operator(self.operator)(item, self.version) - - def filter(self, iterable, prereleases=None): - yielded = False - found_prereleases = [] - - kw = {"prereleases": prereleases if prereleases is not None else True} - - # Attempt to iterate over all the values in the iterable and if any of - # them match, yield them. - for version in iterable: - parsed_version = self._coerce_version(version) - - if self.contains(parsed_version, **kw): - # If our version is a prerelease, and we were not set to allow - # prereleases, then we'll store it for later incase nothing - # else matches this specifier. - if parsed_version.is_prerelease and not ( - prereleases or self.prereleases - ): - found_prereleases.append(version) - # Either this is not a prerelease, or we should have been - # accepting prereleases from the beginning. - else: - yielded = True - yield version - - # Now that we've iterated over everything, determine if we've yielded - # any values, and if we have not and we have any prereleases stored up - # then we will go ahead and yield the prereleases. - if not yielded and found_prereleases: - for version in found_prereleases: - yield version - - -class LegacySpecifier(_IndividualSpecifier): - - _regex_str = r""" - (?P(==|!=|<=|>=|<|>)) - \s* - (?P - [^,;\s)]* # Since this is a "legacy" specifier, and the version - # string can be just about anything, we match everything - # except for whitespace, a semi-colon for marker support, - # a closing paren since versions can be enclosed in - # them, and a comma since it's a version separator. - ) - """ - - _regex = re.compile(r"^\s*" + _regex_str + r"\s*$", re.VERBOSE | re.IGNORECASE) - - _operators = { - "==": "equal", - "!=": "not_equal", - "<=": "less_than_equal", - ">=": "greater_than_equal", - "<": "less_than", - ">": "greater_than", - } - - def _coerce_version(self, version): - if not isinstance(version, LegacyVersion): - version = LegacyVersion(str(version)) - return version - - def _compare_equal(self, prospective, spec): - return prospective == self._coerce_version(spec) - - def _compare_not_equal(self, prospective, spec): - return prospective != self._coerce_version(spec) - - def _compare_less_than_equal(self, prospective, spec): - return prospective <= self._coerce_version(spec) - - def _compare_greater_than_equal(self, prospective, spec): - return prospective >= self._coerce_version(spec) - - def _compare_less_than(self, prospective, spec): - return prospective < self._coerce_version(spec) - - def _compare_greater_than(self, prospective, spec): - return prospective > self._coerce_version(spec) - - -def _require_version_compare(fn): - @functools.wraps(fn) - def wrapped(self, prospective, spec): - if not isinstance(prospective, Version): - return False - return fn(self, prospective, spec) - - return wrapped - - -class Specifier(_IndividualSpecifier): - - _regex_str = r""" - (?P(~=|==|!=|<=|>=|<|>|===)) - (?P - (?: - # The identity operators allow for an escape hatch that will - # do an exact string match of the version you wish to install. - # This will not be parsed by PEP 440 and we cannot determine - # any semantic meaning from it. This operator is discouraged - # but included entirely as an escape hatch. - (?<====) # Only match for the identity operator - \s* - [^\s]* # We just match everything, except for whitespace - # since we are only testing for strict identity. - ) - | - (?: - # The (non)equality operators allow for wild card and local - # versions to be specified so we have to define these two - # operators separately to enable that. - (?<===|!=) # Only match for equals and not equals - - \s* - v? - (?:[0-9]+!)? # epoch - [0-9]+(?:\.[0-9]+)* # release - (?: # pre release - [-_\.]? - (a|b|c|rc|alpha|beta|pre|preview) - [-_\.]? - [0-9]* - )? - (?: # post release - (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) - )? - - # You cannot use a wild card and a dev or local version - # together so group them with a | and make them optional. - (?: - (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release - (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local - | - \.\* # Wild card syntax of .* - )? - ) - | - (?: - # The compatible operator requires at least two digits in the - # release segment. - (?<=~=) # Only match for the compatible operator - - \s* - v? - (?:[0-9]+!)? # epoch - [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) - (?: # pre release - [-_\.]? - (a|b|c|rc|alpha|beta|pre|preview) - [-_\.]? - [0-9]* - )? - (?: # post release - (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) - )? - (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release - ) - | - (?: - # All other operators only allow a sub set of what the - # (non)equality operators do. Specifically they do not allow - # local versions to be specified nor do they allow the prefix - # matching wild cards. - (?=": "greater_than_equal", - "<": "less_than", - ">": "greater_than", - "===": "arbitrary", - } - - @_require_version_compare - def _compare_compatible(self, prospective, spec): - # Compatible releases have an equivalent combination of >= and ==. That - # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to - # implement this in terms of the other specifiers instead of - # implementing it ourselves. The only thing we need to do is construct - # the other specifiers. - - # We want everything but the last item in the version, but we want to - # ignore post and dev releases and we want to treat the pre-release as - # it's own separate segment. - prefix = ".".join( - list( - itertools.takewhile( - lambda x: (not x.startswith("post") and not x.startswith("dev")), - _version_split(spec), - ) - )[:-1] - ) - - # Add the prefix notation to the end of our string - prefix += ".*" - - return self._get_operator(">=")(prospective, spec) and self._get_operator("==")( - prospective, prefix - ) - - @_require_version_compare - def _compare_equal(self, prospective, spec): - # We need special logic to handle prefix matching - if spec.endswith(".*"): - # In the case of prefix matching we want to ignore local segment. - prospective = Version(prospective.public) - # Split the spec out by dots, and pretend that there is an implicit - # dot in between a release segment and a pre-release segment. - spec = _version_split(spec[:-2]) # Remove the trailing .* - - # Split the prospective version out by dots, and pretend that there - # is an implicit dot in between a release segment and a pre-release - # segment. - prospective = _version_split(str(prospective)) - - # Shorten the prospective version to be the same length as the spec - # so that we can determine if the specifier is a prefix of the - # prospective version or not. - prospective = prospective[: len(spec)] - - # Pad out our two sides with zeros so that they both equal the same - # length. - spec, prospective = _pad_version(spec, prospective) - else: - # Convert our spec string into a Version - spec = Version(spec) - - # If the specifier does not have a local segment, then we want to - # act as if the prospective version also does not have a local - # segment. - if not spec.local: - prospective = Version(prospective.public) - - return prospective == spec - - @_require_version_compare - def _compare_not_equal(self, prospective, spec): - return not self._compare_equal(prospective, spec) - - @_require_version_compare - def _compare_less_than_equal(self, prospective, spec): - return prospective <= Version(spec) - - @_require_version_compare - def _compare_greater_than_equal(self, prospective, spec): - return prospective >= Version(spec) - - @_require_version_compare - def _compare_less_than(self, prospective, spec): - # Convert our spec to a Version instance, since we'll want to work with - # it as a version. - spec = Version(spec) - - # Check to see if the prospective version is less than the spec - # version. If it's not we can short circuit and just return False now - # instead of doing extra unneeded work. - if not prospective < spec: - return False - - # This special case is here so that, unless the specifier itself - # includes is a pre-release version, that we do not accept pre-release - # versions for the version mentioned in the specifier (e.g. <3.1 should - # not match 3.1.dev0, but should match 3.0.dev0). - if not spec.is_prerelease and prospective.is_prerelease: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # If we've gotten to here, it means that prospective version is both - # less than the spec version *and* it's not a pre-release of the same - # version in the spec. - return True - - @_require_version_compare - def _compare_greater_than(self, prospective, spec): - # Convert our spec to a Version instance, since we'll want to work with - # it as a version. - spec = Version(spec) - - # Check to see if the prospective version is greater than the spec - # version. If it's not we can short circuit and just return False now - # instead of doing extra unneeded work. - if not prospective > spec: - return False - - # This special case is here so that, unless the specifier itself - # includes is a post-release version, that we do not accept - # post-release versions for the version mentioned in the specifier - # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0). - if not spec.is_postrelease and prospective.is_postrelease: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # Ensure that we do not allow a local version of the version mentioned - # in the specifier, which is technically greater than, to match. - if prospective.local is not None: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # If we've gotten to here, it means that prospective version is both - # greater than the spec version *and* it's not a pre-release of the - # same version in the spec. - return True - - def _compare_arbitrary(self, prospective, spec): - return str(prospective).lower() == str(spec).lower() - - @property - def prereleases(self): - # If there is an explicit prereleases set for this, then we'll just - # blindly use that. - if self._prereleases is not None: - return self._prereleases - - # Look at all of our specifiers and determine if they are inclusive - # operators, and if they are if they are including an explicit - # prerelease. - operator, version = self._spec - if operator in ["==", ">=", "<=", "~=", "==="]: - # The == specifier can include a trailing .*, if it does we - # want to remove before parsing. - if operator == "==" and version.endswith(".*"): - version = version[:-2] - - # Parse the version, and if it is a pre-release than this - # specifier allows pre-releases. - if parse(version).is_prerelease: - return True - - return False - - @prereleases.setter - def prereleases(self, value): - self._prereleases = value - - -_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$") - - -def _version_split(version): - result = [] - for item in version.split("."): - match = _prefix_regex.search(item) - if match: - result.extend(match.groups()) - else: - result.append(item) - return result - - -def _pad_version(left, right): - left_split, right_split = [], [] - - # Get the release segment of our versions - left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left))) - right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right))) - - # Get the rest of our versions - left_split.append(left[len(left_split[0]) :]) - right_split.append(right[len(right_split[0]) :]) - - # Insert our padding - left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0]))) - right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0]))) - - return (list(itertools.chain(*left_split)), list(itertools.chain(*right_split))) - - -class SpecifierSet(BaseSpecifier): - def __init__(self, specifiers="", prereleases=None): - # Split on , to break each indidivual specifier into it's own item, and - # strip each item to remove leading/trailing whitespace. - specifiers = [s.strip() for s in specifiers.split(",") if s.strip()] - - # Parsed each individual specifier, attempting first to make it a - # Specifier and falling back to a LegacySpecifier. - parsed = set() - for specifier in specifiers: - try: - parsed.add(Specifier(specifier)) - except InvalidSpecifier: - parsed.add(LegacySpecifier(specifier)) - - # Turn our parsed specifiers into a frozen set and save them for later. - self._specs = frozenset(parsed) - - # Store our prereleases value so we can use it later to determine if - # we accept prereleases or not. - self._prereleases = prereleases - - def __repr__(self): - pre = ( - ", prereleases={0!r}".format(self.prereleases) - if self._prereleases is not None - else "" - ) - - return "".format(str(self), pre) - - def __str__(self): - return ",".join(sorted(str(s) for s in self._specs)) - - def __hash__(self): - return hash(self._specs) - - def __and__(self, other): - if isinstance(other, string_types): - other = SpecifierSet(other) - elif not isinstance(other, SpecifierSet): - return NotImplemented - - specifier = SpecifierSet() - specifier._specs = frozenset(self._specs | other._specs) - - if self._prereleases is None and other._prereleases is not None: - specifier._prereleases = other._prereleases - elif self._prereleases is not None and other._prereleases is None: - specifier._prereleases = self._prereleases - elif self._prereleases == other._prereleases: - specifier._prereleases = self._prereleases - else: - raise ValueError( - "Cannot combine SpecifierSets with True and False prerelease " - "overrides." - ) - - return specifier - - def __eq__(self, other): - if isinstance(other, string_types): - other = SpecifierSet(other) - elif isinstance(other, _IndividualSpecifier): - other = SpecifierSet(str(other)) - elif not isinstance(other, SpecifierSet): - return NotImplemented - - return self._specs == other._specs - - def __ne__(self, other): - if isinstance(other, string_types): - other = SpecifierSet(other) - elif isinstance(other, _IndividualSpecifier): - other = SpecifierSet(str(other)) - elif not isinstance(other, SpecifierSet): - return NotImplemented - - return self._specs != other._specs - - def __len__(self): - return len(self._specs) - - def __iter__(self): - return iter(self._specs) - - @property - def prereleases(self): - # If we have been given an explicit prerelease modifier, then we'll - # pass that through here. - if self._prereleases is not None: - return self._prereleases - - # If we don't have any specifiers, and we don't have a forced value, - # then we'll just return None since we don't know if this should have - # pre-releases or not. - if not self._specs: - return None - - # Otherwise we'll see if any of the given specifiers accept - # prereleases, if any of them do we'll return True, otherwise False. - return any(s.prereleases for s in self._specs) - - @prereleases.setter - def prereleases(self, value): - self._prereleases = value - - def __contains__(self, item): - return self.contains(item) - - def contains(self, item, prereleases=None): - # Ensure that our item is a Version or LegacyVersion instance. - if not isinstance(item, (LegacyVersion, Version)): - item = parse(item) - - # Determine if we're forcing a prerelease or not, if we're not forcing - # one for this particular filter call, then we'll use whatever the - # SpecifierSet thinks for whether or not we should support prereleases. - if prereleases is None: - prereleases = self.prereleases - - # We can determine if we're going to allow pre-releases by looking to - # see if any of the underlying items supports them. If none of them do - # and this item is a pre-release then we do not allow it and we can - # short circuit that here. - # Note: This means that 1.0.dev1 would not be contained in something - # like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0 - if not prereleases and item.is_prerelease: - return False - - # We simply dispatch to the underlying specs here to make sure that the - # given version is contained within all of them. - # Note: This use of all() here means that an empty set of specifiers - # will always return True, this is an explicit design decision. - return all(s.contains(item, prereleases=prereleases) for s in self._specs) - - def filter(self, iterable, prereleases=None): - # Determine if we're forcing a prerelease or not, if we're not forcing - # one for this particular filter call, then we'll use whatever the - # SpecifierSet thinks for whether or not we should support prereleases. - if prereleases is None: - prereleases = self.prereleases - - # If we have any specifiers, then we want to wrap our iterable in the - # filter method for each one, this will act as a logical AND amongst - # each specifier. - if self._specs: - for spec in self._specs: - iterable = spec.filter(iterable, prereleases=bool(prereleases)) - return iterable - # If we do not have any specifiers, then we need to have a rough filter - # which will filter out any pre-releases, unless there are no final - # releases, and which will filter out LegacyVersion in general. - else: - filtered = [] - found_prereleases = [] - - for item in iterable: - # Ensure that we some kind of Version class for this item. - if not isinstance(item, (LegacyVersion, Version)): - parsed_version = parse(item) - else: - parsed_version = item - - # Filter out any item which is parsed as a LegacyVersion - if isinstance(parsed_version, LegacyVersion): - continue - - # Store any item which is a pre-release for later unless we've - # already found a final version or we are accepting prereleases - if parsed_version.is_prerelease and not prereleases: - if not filtered: - found_prereleases.append(item) - else: - filtered.append(item) - - # If we've found no items except for pre-releases, then we'll go - # ahead and use the pre-releases - if not filtered and found_prereleases and prereleases is None: - return found_prereleases - - return filtered diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/tags.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/tags.py deleted file mode 100644 index ec9942f0f6627f34554082a8c0909bc70bd2a260..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/tags.py +++ /dev/null @@ -1,404 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -from __future__ import absolute_import - -import distutils.util - -try: - from importlib.machinery import EXTENSION_SUFFIXES -except ImportError: # pragma: no cover - import imp - - EXTENSION_SUFFIXES = [x[0] for x in imp.get_suffixes()] - del imp -import platform -import re -import sys -import sysconfig -import warnings - - -INTERPRETER_SHORT_NAMES = { - "python": "py", # Generic. - "cpython": "cp", - "pypy": "pp", - "ironpython": "ip", - "jython": "jy", -} - - -_32_BIT_INTERPRETER = sys.maxsize <= 2 ** 32 - - -class Tag(object): - - __slots__ = ["_interpreter", "_abi", "_platform"] - - def __init__(self, interpreter, abi, platform): - self._interpreter = interpreter.lower() - self._abi = abi.lower() - self._platform = platform.lower() - - @property - def interpreter(self): - return self._interpreter - - @property - def abi(self): - return self._abi - - @property - def platform(self): - return self._platform - - def __eq__(self, other): - return ( - (self.platform == other.platform) - and (self.abi == other.abi) - and (self.interpreter == other.interpreter) - ) - - def __hash__(self): - return hash((self._interpreter, self._abi, self._platform)) - - def __str__(self): - return "{}-{}-{}".format(self._interpreter, self._abi, self._platform) - - def __repr__(self): - return "<{self} @ {self_id}>".format(self=self, self_id=id(self)) - - -def parse_tag(tag): - tags = set() - interpreters, abis, platforms = tag.split("-") - for interpreter in interpreters.split("."): - for abi in abis.split("."): - for platform_ in platforms.split("."): - tags.add(Tag(interpreter, abi, platform_)) - return frozenset(tags) - - -def _normalize_string(string): - return string.replace(".", "_").replace("-", "_") - - -def _cpython_interpreter(py_version): - # TODO: Is using py_version_nodot for interpreter version critical? - return "cp{major}{minor}".format(major=py_version[0], minor=py_version[1]) - - -def _cpython_abis(py_version): - abis = [] - version = "{}{}".format(*py_version[:2]) - debug = pymalloc = ucs4 = "" - with_debug = sysconfig.get_config_var("Py_DEBUG") - has_refcount = hasattr(sys, "gettotalrefcount") - # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled - # extension modules is the best option. - # https://github.com/pypa/pip/issues/3383#issuecomment-173267692 - has_ext = "_d.pyd" in EXTENSION_SUFFIXES - if with_debug or (with_debug is None and (has_refcount or has_ext)): - debug = "d" - if py_version < (3, 8): - with_pymalloc = sysconfig.get_config_var("WITH_PYMALLOC") - if with_pymalloc or with_pymalloc is None: - pymalloc = "m" - if py_version < (3, 3): - unicode_size = sysconfig.get_config_var("Py_UNICODE_SIZE") - if unicode_size == 4 or ( - unicode_size is None and sys.maxunicode == 0x10FFFF - ): - ucs4 = "u" - elif debug: - # Debug builds can also load "normal" extension modules. - # We can also assume no UCS-4 or pymalloc requirement. - abis.append("cp{version}".format(version=version)) - abis.insert( - 0, - "cp{version}{debug}{pymalloc}{ucs4}".format( - version=version, debug=debug, pymalloc=pymalloc, ucs4=ucs4 - ), - ) - return abis - - -def _cpython_tags(py_version, interpreter, abis, platforms): - for abi in abis: - for platform_ in platforms: - yield Tag(interpreter, abi, platform_) - for tag in (Tag(interpreter, "abi3", platform_) for platform_ in platforms): - yield tag - for tag in (Tag(interpreter, "none", platform_) for platform_ in platforms): - yield tag - # PEP 384 was first implemented in Python 3.2. - for minor_version in range(py_version[1] - 1, 1, -1): - for platform_ in platforms: - interpreter = "cp{major}{minor}".format( - major=py_version[0], minor=minor_version - ) - yield Tag(interpreter, "abi3", platform_) - - -def _pypy_interpreter(): - return "pp{py_major}{pypy_major}{pypy_minor}".format( - py_major=sys.version_info[0], - pypy_major=sys.pypy_version_info.major, - pypy_minor=sys.pypy_version_info.minor, - ) - - -def _generic_abi(): - abi = sysconfig.get_config_var("SOABI") - if abi: - return _normalize_string(abi) - else: - return "none" - - -def _pypy_tags(py_version, interpreter, abi, platforms): - for tag in (Tag(interpreter, abi, platform) for platform in platforms): - yield tag - for tag in (Tag(interpreter, "none", platform) for platform in platforms): - yield tag - - -def _generic_tags(interpreter, py_version, abi, platforms): - for tag in (Tag(interpreter, abi, platform) for platform in platforms): - yield tag - if abi != "none": - tags = (Tag(interpreter, "none", platform_) for platform_ in platforms) - for tag in tags: - yield tag - - -def _py_interpreter_range(py_version): - """ - Yield Python versions in descending order. - - After the latest version, the major-only version will be yielded, and then - all following versions up to 'end'. - """ - yield "py{major}{minor}".format(major=py_version[0], minor=py_version[1]) - yield "py{major}".format(major=py_version[0]) - for minor in range(py_version[1] - 1, -1, -1): - yield "py{major}{minor}".format(major=py_version[0], minor=minor) - - -def _independent_tags(interpreter, py_version, platforms): - """ - Return the sequence of tags that are consistent across implementations. - - The tags consist of: - - py*-none- - - -none-any - - py*-none-any - """ - for version in _py_interpreter_range(py_version): - for platform_ in platforms: - yield Tag(version, "none", platform_) - yield Tag(interpreter, "none", "any") - for version in _py_interpreter_range(py_version): - yield Tag(version, "none", "any") - - -def _mac_arch(arch, is_32bit=_32_BIT_INTERPRETER): - if not is_32bit: - return arch - - if arch.startswith("ppc"): - return "ppc" - - return "i386" - - -def _mac_binary_formats(version, cpu_arch): - formats = [cpu_arch] - if cpu_arch == "x86_64": - if version < (10, 4): - return [] - formats.extend(["intel", "fat64", "fat32"]) - - elif cpu_arch == "i386": - if version < (10, 4): - return [] - formats.extend(["intel", "fat32", "fat"]) - - elif cpu_arch == "ppc64": - # TODO: Need to care about 32-bit PPC for ppc64 through 10.2? - if version > (10, 5) or version < (10, 4): - return [] - formats.append("fat64") - - elif cpu_arch == "ppc": - if version > (10, 6): - return [] - formats.extend(["fat32", "fat"]) - - formats.append("universal") - return formats - - -def _mac_platforms(version=None, arch=None): - version_str, _, cpu_arch = platform.mac_ver() - if version is None: - version = tuple(map(int, version_str.split(".")[:2])) - if arch is None: - arch = _mac_arch(cpu_arch) - platforms = [] - for minor_version in range(version[1], -1, -1): - compat_version = version[0], minor_version - binary_formats = _mac_binary_formats(compat_version, arch) - for binary_format in binary_formats: - platforms.append( - "macosx_{major}_{minor}_{binary_format}".format( - major=compat_version[0], - minor=compat_version[1], - binary_format=binary_format, - ) - ) - return platforms - - -# From PEP 513. -def _is_manylinux_compatible(name, glibc_version): - # Check for presence of _manylinux module. - try: - import _manylinux - - return bool(getattr(_manylinux, name + "_compatible")) - except (ImportError, AttributeError): - # Fall through to heuristic check below. - pass - - return _have_compatible_glibc(*glibc_version) - - -def _glibc_version_string(): - # Returns glibc version string, or None if not using glibc. - import ctypes - - # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen - # manpage says, "If filename is NULL, then the returned handle is for the - # main program". This way we can let the linker do the work to figure out - # which libc our process is actually using. - process_namespace = ctypes.CDLL(None) - try: - gnu_get_libc_version = process_namespace.gnu_get_libc_version - except AttributeError: - # Symbol doesn't exist -> therefore, we are not linked to - # glibc. - return None - - # Call gnu_get_libc_version, which returns a string like "2.5" - gnu_get_libc_version.restype = ctypes.c_char_p - version_str = gnu_get_libc_version() - # py2 / py3 compatibility: - if not isinstance(version_str, str): - version_str = version_str.decode("ascii") - - return version_str - - -# Separated out from have_compatible_glibc for easier unit testing. -def _check_glibc_version(version_str, required_major, minimum_minor): - # Parse string and check against requested version. - # - # We use a regexp instead of str.split because we want to discard any - # random junk that might come after the minor version -- this might happen - # in patched/forked versions of glibc (e.g. Linaro's version of glibc - # uses version strings like "2.20-2014.11"). See gh-3588. - m = re.match(r"(?P[0-9]+)\.(?P[0-9]+)", version_str) - if not m: - warnings.warn( - "Expected glibc version with 2 components major.minor," - " got: %s" % version_str, - RuntimeWarning, - ) - return False - return ( - int(m.group("major")) == required_major - and int(m.group("minor")) >= minimum_minor - ) - - -def _have_compatible_glibc(required_major, minimum_minor): - version_str = _glibc_version_string() - if version_str is None: - return False - return _check_glibc_version(version_str, required_major, minimum_minor) - - -def _linux_platforms(is_32bit=_32_BIT_INTERPRETER): - linux = _normalize_string(distutils.util.get_platform()) - if linux == "linux_x86_64" and is_32bit: - linux = "linux_i686" - manylinux_support = ( - ("manylinux2014", (2, 17)), # CentOS 7 w/ glibc 2.17 (PEP 599) - ("manylinux2010", (2, 12)), # CentOS 6 w/ glibc 2.12 (PEP 571) - ("manylinux1", (2, 5)), # CentOS 5 w/ glibc 2.5 (PEP 513) - ) - manylinux_support_iter = iter(manylinux_support) - for name, glibc_version in manylinux_support_iter: - if _is_manylinux_compatible(name, glibc_version): - platforms = [linux.replace("linux", name)] - break - else: - platforms = [] - # Support for a later manylinux implies support for an earlier version. - platforms += [linux.replace("linux", name) for name, _ in manylinux_support_iter] - platforms.append(linux) - return platforms - - -def _generic_platforms(): - platform = _normalize_string(distutils.util.get_platform()) - return [platform] - - -def _interpreter_name(): - name = platform.python_implementation().lower() - return INTERPRETER_SHORT_NAMES.get(name) or name - - -def _generic_interpreter(name, py_version): - version = sysconfig.get_config_var("py_version_nodot") - if not version: - version = "".join(map(str, py_version[:2])) - return "{name}{version}".format(name=name, version=version) - - -def sys_tags(): - """ - Returns the sequence of tag triples for the running interpreter. - - The order of the sequence corresponds to priority order for the - interpreter, from most to least important. - """ - py_version = sys.version_info[:2] - interpreter_name = _interpreter_name() - if platform.system() == "Darwin": - platforms = _mac_platforms() - elif platform.system() == "Linux": - platforms = _linux_platforms() - else: - platforms = _generic_platforms() - - if interpreter_name == "cp": - interpreter = _cpython_interpreter(py_version) - abis = _cpython_abis(py_version) - for tag in _cpython_tags(py_version, interpreter, abis, platforms): - yield tag - elif interpreter_name == "pp": - interpreter = _pypy_interpreter() - abi = _generic_abi() - for tag in _pypy_tags(py_version, interpreter, abi, platforms): - yield tag - else: - interpreter = _generic_interpreter(interpreter_name, py_version) - abi = _generic_abi() - for tag in _generic_tags(interpreter, py_version, abi, platforms): - yield tag - for tag in _independent_tags(interpreter, py_version, platforms): - yield tag diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/utils.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/utils.py deleted file mode 100644 index 88418786933b8bc5f6179b8e191f60f79efd7074..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/utils.py +++ /dev/null @@ -1,57 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - -import re - -from .version import InvalidVersion, Version - - -_canonicalize_regex = re.compile(r"[-_.]+") - - -def canonicalize_name(name): - # This is taken from PEP 503. - return _canonicalize_regex.sub("-", name).lower() - - -def canonicalize_version(version): - """ - This is very similar to Version.__str__, but has one subtle differences - with the way it handles the release segment. - """ - - try: - version = Version(version) - except InvalidVersion: - # Legacy versions cannot be normalized - return version - - parts = [] - - # Epoch - if version.epoch != 0: - parts.append("{0}!".format(version.epoch)) - - # Release segment - # NB: This strips trailing '.0's to normalize - parts.append(re.sub(r"(\.0)+$", "", ".".join(str(x) for x in version.release))) - - # Pre-release - if version.pre is not None: - parts.append("".join(str(x) for x in version.pre)) - - # Post-release - if version.post is not None: - parts.append(".post{0}".format(version.post)) - - # Development release - if version.dev is not None: - parts.append(".dev{0}".format(version.dev)) - - # Local version segment - if version.local is not None: - parts.append("+{0}".format(version.local)) - - return "".join(parts) diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/version.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/version.py deleted file mode 100644 index 95157a1f78c26829ffbe1bd2463f7735b636d16f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/version.py +++ /dev/null @@ -1,420 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import absolute_import, division, print_function - -import collections -import itertools -import re - -from ._structures import Infinity - - -__all__ = ["parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"] - - -_Version = collections.namedtuple( - "_Version", ["epoch", "release", "dev", "pre", "post", "local"] -) - - -def parse(version): - """ - Parse the given version string and return either a :class:`Version` object - or a :class:`LegacyVersion` object depending on if the given version is - a valid PEP 440 version or a legacy version. - """ - try: - return Version(version) - except InvalidVersion: - return LegacyVersion(version) - - -class InvalidVersion(ValueError): - """ - An invalid version was found, users should refer to PEP 440. - """ - - -class _BaseVersion(object): - def __hash__(self): - return hash(self._key) - - def __lt__(self, other): - return self._compare(other, lambda s, o: s < o) - - def __le__(self, other): - return self._compare(other, lambda s, o: s <= o) - - def __eq__(self, other): - return self._compare(other, lambda s, o: s == o) - - def __ge__(self, other): - return self._compare(other, lambda s, o: s >= o) - - def __gt__(self, other): - return self._compare(other, lambda s, o: s > o) - - def __ne__(self, other): - return self._compare(other, lambda s, o: s != o) - - def _compare(self, other, method): - if not isinstance(other, _BaseVersion): - return NotImplemented - - return method(self._key, other._key) - - -class LegacyVersion(_BaseVersion): - def __init__(self, version): - self._version = str(version) - self._key = _legacy_cmpkey(self._version) - - def __str__(self): - return self._version - - def __repr__(self): - return "".format(repr(str(self))) - - @property - def public(self): - return self._version - - @property - def base_version(self): - return self._version - - @property - def epoch(self): - return -1 - - @property - def release(self): - return None - - @property - def pre(self): - return None - - @property - def post(self): - return None - - @property - def dev(self): - return None - - @property - def local(self): - return None - - @property - def is_prerelease(self): - return False - - @property - def is_postrelease(self): - return False - - @property - def is_devrelease(self): - return False - - -_legacy_version_component_re = re.compile(r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE) - -_legacy_version_replacement_map = { - "pre": "c", - "preview": "c", - "-": "final-", - "rc": "c", - "dev": "@", -} - - -def _parse_version_parts(s): - for part in _legacy_version_component_re.split(s): - part = _legacy_version_replacement_map.get(part, part) - - if not part or part == ".": - continue - - if part[:1] in "0123456789": - # pad for numeric comparison - yield part.zfill(8) - else: - yield "*" + part - - # ensure that alpha/beta/candidate are before final - yield "*final" - - -def _legacy_cmpkey(version): - # We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch - # greater than or equal to 0. This will effectively put the LegacyVersion, - # which uses the defacto standard originally implemented by setuptools, - # as before all PEP 440 versions. - epoch = -1 - - # This scheme is taken from pkg_resources.parse_version setuptools prior to - # it's adoption of the packaging library. - parts = [] - for part in _parse_version_parts(version.lower()): - if part.startswith("*"): - # remove "-" before a prerelease tag - if part < "*final": - while parts and parts[-1] == "*final-": - parts.pop() - - # remove trailing zeros from each series of numeric parts - while parts and parts[-1] == "00000000": - parts.pop() - - parts.append(part) - parts = tuple(parts) - - return epoch, parts - - -# Deliberately not anchored to the start and end of the string, to make it -# easier for 3rd party code to reuse -VERSION_PATTERN = r""" - v? - (?: - (?:(?P[0-9]+)!)? # epoch - (?P[0-9]+(?:\.[0-9]+)*) # release segment - (?P
                                          # pre-release
-            [-_\.]?
-            (?P(a|b|c|rc|alpha|beta|pre|preview))
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-        (?P                                         # post release
-            (?:-(?P[0-9]+))
-            |
-            (?:
-                [-_\.]?
-                (?Ppost|rev|r)
-                [-_\.]?
-                (?P[0-9]+)?
-            )
-        )?
-        (?P                                          # dev release
-            [-_\.]?
-            (?Pdev)
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-    )
-    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
-"""
-
-
-class Version(_BaseVersion):
-
-    _regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
-
-    def __init__(self, version):
-        # Validate the version and parse it into pieces
-        match = self._regex.search(version)
-        if not match:
-            raise InvalidVersion("Invalid version: '{0}'".format(version))
-
-        # Store the parsed out pieces of the version
-        self._version = _Version(
-            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
-            release=tuple(int(i) for i in match.group("release").split(".")),
-            pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
-            post=_parse_letter_version(
-                match.group("post_l"), match.group("post_n1") or match.group("post_n2")
-            ),
-            dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
-            local=_parse_local_version(match.group("local")),
-        )
-
-        # Generate a key which will be used for sorting
-        self._key = _cmpkey(
-            self._version.epoch,
-            self._version.release,
-            self._version.pre,
-            self._version.post,
-            self._version.dev,
-            self._version.local,
-        )
-
-    def __repr__(self):
-        return "".format(repr(str(self)))
-
-    def __str__(self):
-        parts = []
-
-        # Epoch
-        if self.epoch != 0:
-            parts.append("{0}!".format(self.epoch))
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self.release))
-
-        # Pre-release
-        if self.pre is not None:
-            parts.append("".join(str(x) for x in self.pre))
-
-        # Post-release
-        if self.post is not None:
-            parts.append(".post{0}".format(self.post))
-
-        # Development release
-        if self.dev is not None:
-            parts.append(".dev{0}".format(self.dev))
-
-        # Local version segment
-        if self.local is not None:
-            parts.append("+{0}".format(self.local))
-
-        return "".join(parts)
-
-    @property
-    def epoch(self):
-        return self._version.epoch
-
-    @property
-    def release(self):
-        return self._version.release
-
-    @property
-    def pre(self):
-        return self._version.pre
-
-    @property
-    def post(self):
-        return self._version.post[1] if self._version.post else None
-
-    @property
-    def dev(self):
-        return self._version.dev[1] if self._version.dev else None
-
-    @property
-    def local(self):
-        if self._version.local:
-            return ".".join(str(x) for x in self._version.local)
-        else:
-            return None
-
-    @property
-    def public(self):
-        return str(self).split("+", 1)[0]
-
-    @property
-    def base_version(self):
-        parts = []
-
-        # Epoch
-        if self.epoch != 0:
-            parts.append("{0}!".format(self.epoch))
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self.release))
-
-        return "".join(parts)
-
-    @property
-    def is_prerelease(self):
-        return self.dev is not None or self.pre is not None
-
-    @property
-    def is_postrelease(self):
-        return self.post is not None
-
-    @property
-    def is_devrelease(self):
-        return self.dev is not None
-
-
-def _parse_letter_version(letter, number):
-    if letter:
-        # We consider there to be an implicit 0 in a pre-release if there is
-        # not a numeral associated with it.
-        if number is None:
-            number = 0
-
-        # We normalize any letters to their lower case form
-        letter = letter.lower()
-
-        # We consider some words to be alternate spellings of other words and
-        # in those cases we want to normalize the spellings to our preferred
-        # spelling.
-        if letter == "alpha":
-            letter = "a"
-        elif letter == "beta":
-            letter = "b"
-        elif letter in ["c", "pre", "preview"]:
-            letter = "rc"
-        elif letter in ["rev", "r"]:
-            letter = "post"
-
-        return letter, int(number)
-    if not letter and number:
-        # We assume if we are given a number, but we are not given a letter
-        # then this is using the implicit post release syntax (e.g. 1.0-1)
-        letter = "post"
-
-        return letter, int(number)
-
-
-_local_version_separators = re.compile(r"[\._-]")
-
-
-def _parse_local_version(local):
-    """
-    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
-    """
-    if local is not None:
-        return tuple(
-            part.lower() if not part.isdigit() else int(part)
-            for part in _local_version_separators.split(local)
-        )
-
-
-def _cmpkey(epoch, release, pre, post, dev, local):
-    # When we compare a release version, we want to compare it with all of the
-    # trailing zeros removed. So we'll use a reverse the list, drop all the now
-    # leading zeros until we come to something non zero, then take the rest
-    # re-reverse it back into the correct order and make it a tuple and use
-    # that for our sorting key.
-    release = tuple(
-        reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
-    )
-
-    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
-    # We'll do this by abusing the pre segment, but we _only_ want to do this
-    # if there is not a pre or a post segment. If we have one of those then
-    # the normal sorting rules will handle this case correctly.
-    if pre is None and post is None and dev is not None:
-        pre = -Infinity
-    # Versions without a pre-release (except as noted above) should sort after
-    # those with one.
-    elif pre is None:
-        pre = Infinity
-
-    # Versions without a post segment should sort before those with one.
-    if post is None:
-        post = -Infinity
-
-    # Versions without a development segment should sort after those with one.
-    if dev is None:
-        dev = Infinity
-
-    if local is None:
-        # Versions without a local segment should sort before those with one.
-        local = -Infinity
-    else:
-        # Versions with a local segment need that segment parsed to implement
-        # the sorting rules in PEP440.
-        # - Alpha numeric segments sort before numeric segments
-        # - Alpha numeric segments sort lexicographically
-        # - Numeric segments sort numerically
-        # - Shorter versions sort before longer versions when the prefixes
-        #   match exactly
-        local = tuple((i, "") if isinstance(i, int) else (-Infinity, i) for i in local)
-
-    return epoch, release, pre, post, dev, local
diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/pyparsing.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/pyparsing.py
deleted file mode 100644
index 4aa30ee6b250b3b72a9dcebb7f26a8e0432d7082..0000000000000000000000000000000000000000
--- a/venv/lib/python3.8/site-packages/setuptools/_vendor/pyparsing.py
+++ /dev/null
@@ -1,5742 +0,0 @@
-# module pyparsing.py
-#
-# Copyright (c) 2003-2018  Paul T. McGuire
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__doc__ = \
-"""
-pyparsing module - Classes and methods to define and execute parsing grammars
-=============================================================================
-
-The pyparsing module is an alternative approach to creating and executing simple grammars,
-vs. the traditional lex/yacc approach, or the use of regular expressions.  With pyparsing, you
-don't need to learn a new syntax for defining grammars or matching expressions - the parsing module
-provides a library of classes that you use to construct the grammar directly in Python.
-
-Here is a program to parse "Hello, World!" (or any greeting of the form 
-C{", !"}), built up using L{Word}, L{Literal}, and L{And} elements 
-(L{'+'} operator gives L{And} expressions, strings are auto-converted to
-L{Literal} expressions)::
-
-    from pyparsing import Word, alphas
-
-    # define grammar of a greeting
-    greet = Word(alphas) + "," + Word(alphas) + "!"
-
-    hello = "Hello, World!"
-    print (hello, "->", greet.parseString(hello))
-
-The program outputs the following::
-
-    Hello, World! -> ['Hello', ',', 'World', '!']
-
-The Python representation of the grammar is quite readable, owing to the self-explanatory
-class names, and the use of '+', '|' and '^' operators.
-
-The L{ParseResults} object returned from L{ParserElement.parseString} can be accessed as a nested list, a dictionary, or an
-object with named attributes.
-
-The pyparsing module handles some of the problems that are typically vexing when writing text parsers:
- - extra or missing whitespace (the above program will also handle "Hello,World!", "Hello  ,  World  !", etc.)
- - quoted strings
- - embedded comments
-
-
-Getting Started -
------------------
-Visit the classes L{ParserElement} and L{ParseResults} to see the base classes that most other pyparsing
-classes inherit from. Use the docstrings for examples of how to:
- - construct literal match expressions from L{Literal} and L{CaselessLiteral} classes
- - construct character word-group expressions using the L{Word} class
- - see how to create repetitive expressions using L{ZeroOrMore} and L{OneOrMore} classes
- - use L{'+'}, L{'|'}, L{'^'}, and L{'&'} operators to combine simple expressions into more complex ones
- - associate names with your parsed results using L{ParserElement.setResultsName}
- - find some helpful expression short-cuts like L{delimitedList} and L{oneOf}
- - find more useful common expressions in the L{pyparsing_common} namespace class
-"""
-
-__version__ = "2.2.1"
-__versionTime__ = "18 Sep 2018 00:49 UTC"
-__author__ = "Paul McGuire "
-
-import string
-from weakref import ref as wkref
-import copy
-import sys
-import warnings
-import re
-import sre_constants
-import collections
-import pprint
-import traceback
-import types
-from datetime import datetime
-
-try:
-    from _thread import RLock
-except ImportError:
-    from threading import RLock
-
-try:
-    # Python 3
-    from collections.abc import Iterable
-    from collections.abc import MutableMapping
-except ImportError:
-    # Python 2.7
-    from collections import Iterable
-    from collections import MutableMapping
-
-try:
-    from collections import OrderedDict as _OrderedDict
-except ImportError:
-    try:
-        from ordereddict import OrderedDict as _OrderedDict
-    except ImportError:
-        _OrderedDict = None
-
-#~ sys.stderr.write( "testing pyparsing module, version %s, %s\n" % (__version__,__versionTime__ ) )
-
-__all__ = [
-'And', 'CaselessKeyword', 'CaselessLiteral', 'CharsNotIn', 'Combine', 'Dict', 'Each', 'Empty',
-'FollowedBy', 'Forward', 'GoToColumn', 'Group', 'Keyword', 'LineEnd', 'LineStart', 'Literal',
-'MatchFirst', 'NoMatch', 'NotAny', 'OneOrMore', 'OnlyOnce', 'Optional', 'Or',
-'ParseBaseException', 'ParseElementEnhance', 'ParseException', 'ParseExpression', 'ParseFatalException',
-'ParseResults', 'ParseSyntaxException', 'ParserElement', 'QuotedString', 'RecursiveGrammarException',
-'Regex', 'SkipTo', 'StringEnd', 'StringStart', 'Suppress', 'Token', 'TokenConverter', 
-'White', 'Word', 'WordEnd', 'WordStart', 'ZeroOrMore',
-'alphanums', 'alphas', 'alphas8bit', 'anyCloseTag', 'anyOpenTag', 'cStyleComment', 'col',
-'commaSeparatedList', 'commonHTMLEntity', 'countedArray', 'cppStyleComment', 'dblQuotedString',
-'dblSlashComment', 'delimitedList', 'dictOf', 'downcaseTokens', 'empty', 'hexnums',
-'htmlComment', 'javaStyleComment', 'line', 'lineEnd', 'lineStart', 'lineno',
-'makeHTMLTags', 'makeXMLTags', 'matchOnlyAtCol', 'matchPreviousExpr', 'matchPreviousLiteral',
-'nestedExpr', 'nullDebugAction', 'nums', 'oneOf', 'opAssoc', 'operatorPrecedence', 'printables',
-'punc8bit', 'pythonStyleComment', 'quotedString', 'removeQuotes', 'replaceHTMLEntity', 
-'replaceWith', 'restOfLine', 'sglQuotedString', 'srange', 'stringEnd',
-'stringStart', 'traceParseAction', 'unicodeString', 'upcaseTokens', 'withAttribute',
-'indentedBlock', 'originalTextFor', 'ungroup', 'infixNotation','locatedExpr', 'withClass',
-'CloseMatch', 'tokenMap', 'pyparsing_common',
-]
-
-system_version = tuple(sys.version_info)[:3]
-PY_3 = system_version[0] == 3
-if PY_3:
-    _MAX_INT = sys.maxsize
-    basestring = str
-    unichr = chr
-    _ustr = str
-
-    # build list of single arg builtins, that can be used as parse actions
-    singleArgBuiltins = [sum, len, sorted, reversed, list, tuple, set, any, all, min, max]
-
-else:
-    _MAX_INT = sys.maxint
-    range = xrange
-
-    def _ustr(obj):
-        """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries
-           str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It
-           then < returns the unicode object | encodes it with the default encoding | ... >.
-        """
-        if isinstance(obj,unicode):
-            return obj
-
-        try:
-            # If this works, then _ustr(obj) has the same behaviour as str(obj), so
-            # it won't break any existing code.
-            return str(obj)
-
-        except UnicodeEncodeError:
-            # Else encode it
-            ret = unicode(obj).encode(sys.getdefaultencoding(), 'xmlcharrefreplace')
-            xmlcharref = Regex(r'&#\d+;')
-            xmlcharref.setParseAction(lambda t: '\\u' + hex(int(t[0][2:-1]))[2:])
-            return xmlcharref.transformString(ret)
-
-    # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
-    singleArgBuiltins = []
-    import __builtin__
-    for fname in "sum len sorted reversed list tuple set any all min max".split():
-        try:
-            singleArgBuiltins.append(getattr(__builtin__,fname))
-        except AttributeError:
-            continue
-            
-_generatorType = type((y for y in range(1)))
- 
-def _xml_escape(data):
-    """Escape &, <, >, ", ', etc. in a string of data."""
-
-    # ampersand must be replaced first
-    from_symbols = '&><"\''
-    to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split())
-    for from_,to_ in zip(from_symbols, to_symbols):
-        data = data.replace(from_, to_)
-    return data
-
-class _Constants(object):
-    pass
-
-alphas     = string.ascii_uppercase + string.ascii_lowercase
-nums       = "0123456789"
-hexnums    = nums + "ABCDEFabcdef"
-alphanums  = alphas + nums
-_bslash    = chr(92)
-printables = "".join(c for c in string.printable if c not in string.whitespace)
-
-class ParseBaseException(Exception):
-    """base exception class for all parsing runtime exceptions"""
-    # Performance tuning: we construct a *lot* of these, so keep this
-    # constructor as small and fast as possible
-    def __init__( self, pstr, loc=0, msg=None, elem=None ):
-        self.loc = loc
-        if msg is None:
-            self.msg = pstr
-            self.pstr = ""
-        else:
-            self.msg = msg
-            self.pstr = pstr
-        self.parserElement = elem
-        self.args = (pstr, loc, msg)
-
-    @classmethod
-    def _from_exception(cls, pe):
-        """
-        internal factory method to simplify creating one type of ParseException 
-        from another - avoids having __init__ signature conflicts among subclasses
-        """
-        return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement)
-
-    def __getattr__( self, aname ):
-        """supported attributes by name are:
-            - lineno - returns the line number of the exception text
-            - col - returns the column number of the exception text
-            - line - returns the line containing the exception text
-        """
-        if( aname == "lineno" ):
-            return lineno( self.loc, self.pstr )
-        elif( aname in ("col", "column") ):
-            return col( self.loc, self.pstr )
-        elif( aname == "line" ):
-            return line( self.loc, self.pstr )
-        else:
-            raise AttributeError(aname)
-
-    def __str__( self ):
-        return "%s (at char %d), (line:%d, col:%d)" % \
-                ( self.msg, self.loc, self.lineno, self.column )
-    def __repr__( self ):
-        return _ustr(self)
-    def markInputline( self, markerString = ">!<" ):
-        """Extracts the exception line from the input string, and marks
-           the location of the exception with a special symbol.
-        """
-        line_str = self.line
-        line_column = self.column - 1
-        if markerString:
-            line_str = "".join((line_str[:line_column],
-                                markerString, line_str[line_column:]))
-        return line_str.strip()
-    def __dir__(self):
-        return "lineno col line".split() + dir(type(self))
-
-class ParseException(ParseBaseException):
-    """
-    Exception thrown when parse expressions don't match class;
-    supported attributes by name are:
-     - lineno - returns the line number of the exception text
-     - col - returns the column number of the exception text
-     - line - returns the line containing the exception text
-        
-    Example::
-        try:
-            Word(nums).setName("integer").parseString("ABC")
-        except ParseException as pe:
-            print(pe)
-            print("column: {}".format(pe.col))
-            
-    prints::
-       Expected integer (at char 0), (line:1, col:1)
-        column: 1
-    """
-    pass
-
-class ParseFatalException(ParseBaseException):
-    """user-throwable exception thrown when inconsistent parse content
-       is found; stops all parsing immediately"""
-    pass
-
-class ParseSyntaxException(ParseFatalException):
-    """just like L{ParseFatalException}, but thrown internally when an
-       L{ErrorStop} ('-' operator) indicates that parsing is to stop 
-       immediately because an unbacktrackable syntax error has been found"""
-    pass
-
-#~ class ReparseException(ParseBaseException):
-    #~ """Experimental class - parse actions can raise this exception to cause
-       #~ pyparsing to reparse the input string:
-        #~ - with a modified input string, and/or
-        #~ - with a modified start location
-       #~ Set the values of the ReparseException in the constructor, and raise the
-       #~ exception in a parse action to cause pyparsing to use the new string/location.
-       #~ Setting the values as None causes no change to be made.
-       #~ """
-    #~ def __init_( self, newstring, restartLoc ):
-        #~ self.newParseText = newstring
-        #~ self.reparseLoc = restartLoc
-
-class RecursiveGrammarException(Exception):
-    """exception thrown by L{ParserElement.validate} if the grammar could be improperly recursive"""
-    def __init__( self, parseElementList ):
-        self.parseElementTrace = parseElementList
-
-    def __str__( self ):
-        return "RecursiveGrammarException: %s" % self.parseElementTrace
-
-class _ParseResultsWithOffset(object):
-    def __init__(self,p1,p2):
-        self.tup = (p1,p2)
-    def __getitem__(self,i):
-        return self.tup[i]
-    def __repr__(self):
-        return repr(self.tup[0])
-    def setOffset(self,i):
-        self.tup = (self.tup[0],i)
-
-class ParseResults(object):
-    """
-    Structured parse results, to provide multiple means of access to the parsed data:
-       - as a list (C{len(results)})
-       - by list index (C{results[0], results[1]}, etc.)
-       - by attribute (C{results.} - see L{ParserElement.setResultsName})
-
-    Example::
-        integer = Word(nums)
-        date_str = (integer.setResultsName("year") + '/' 
-                        + integer.setResultsName("month") + '/' 
-                        + integer.setResultsName("day"))
-        # equivalent form:
-        # date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
-
-        # parseString returns a ParseResults object
-        result = date_str.parseString("1999/12/31")
-
-        def test(s, fn=repr):
-            print("%s -> %s" % (s, fn(eval(s))))
-        test("list(result)")
-        test("result[0]")
-        test("result['month']")
-        test("result.day")
-        test("'month' in result")
-        test("'minutes' in result")
-        test("result.dump()", str)
-    prints::
-        list(result) -> ['1999', '/', '12', '/', '31']
-        result[0] -> '1999'
-        result['month'] -> '12'
-        result.day -> '31'
-        'month' in result -> True
-        'minutes' in result -> False
-        result.dump() -> ['1999', '/', '12', '/', '31']
-        - day: 31
-        - month: 12
-        - year: 1999
-    """
-    def __new__(cls, toklist=None, name=None, asList=True, modal=True ):
-        if isinstance(toklist, cls):
-            return toklist
-        retobj = object.__new__(cls)
-        retobj.__doinit = True
-        return retobj
-
-    # Performance tuning: we construct a *lot* of these, so keep this
-    # constructor as small and fast as possible
-    def __init__( self, toklist=None, name=None, asList=True, modal=True, isinstance=isinstance ):
-        if self.__doinit:
-            self.__doinit = False
-            self.__name = None
-            self.__parent = None
-            self.__accumNames = {}
-            self.__asList = asList
-            self.__modal = modal
-            if toklist is None:
-                toklist = []
-            if isinstance(toklist, list):
-                self.__toklist = toklist[:]
-            elif isinstance(toklist, _generatorType):
-                self.__toklist = list(toklist)
-            else:
-                self.__toklist = [toklist]
-            self.__tokdict = dict()
-
-        if name is not None and name:
-            if not modal:
-                self.__accumNames[name] = 0
-            if isinstance(name,int):
-                name = _ustr(name) # will always return a str, but use _ustr for consistency
-            self.__name = name
-            if not (isinstance(toklist, (type(None), basestring, list)) and toklist in (None,'',[])):
-                if isinstance(toklist,basestring):
-                    toklist = [ toklist ]
-                if asList:
-                    if isinstance(toklist,ParseResults):
-                        self[name] = _ParseResultsWithOffset(toklist.copy(),0)
-                    else:
-                        self[name] = _ParseResultsWithOffset(ParseResults(toklist[0]),0)
-                    self[name].__name = name
-                else:
-                    try:
-                        self[name] = toklist[0]
-                    except (KeyError,TypeError,IndexError):
-                        self[name] = toklist
-
-    def __getitem__( self, i ):
-        if isinstance( i, (int,slice) ):
-            return self.__toklist[i]
-        else:
-            if i not in self.__accumNames:
-                return self.__tokdict[i][-1][0]
-            else:
-                return ParseResults([ v[0] for v in self.__tokdict[i] ])
-
-    def __setitem__( self, k, v, isinstance=isinstance ):
-        if isinstance(v,_ParseResultsWithOffset):
-            self.__tokdict[k] = self.__tokdict.get(k,list()) + [v]
-            sub = v[0]
-        elif isinstance(k,(int,slice)):
-            self.__toklist[k] = v
-            sub = v
-        else:
-            self.__tokdict[k] = self.__tokdict.get(k,list()) + [_ParseResultsWithOffset(v,0)]
-            sub = v
-        if isinstance(sub,ParseResults):
-            sub.__parent = wkref(self)
-
-    def __delitem__( self, i ):
-        if isinstance(i,(int,slice)):
-            mylen = len( self.__toklist )
-            del self.__toklist[i]
-
-            # convert int to slice
-            if isinstance(i, int):
-                if i < 0:
-                    i += mylen
-                i = slice(i, i+1)
-            # get removed indices
-            removed = list(range(*i.indices(mylen)))
-            removed.reverse()
-            # fixup indices in token dictionary
-            for name,occurrences in self.__tokdict.items():
-                for j in removed:
-                    for k, (value, position) in enumerate(occurrences):
-                        occurrences[k] = _ParseResultsWithOffset(value, position - (position > j))
-        else:
-            del self.__tokdict[i]
-
-    def __contains__( self, k ):
-        return k in self.__tokdict
-
-    def __len__( self ): return len( self.__toklist )
-    def __bool__(self): return ( not not self.__toklist )
-    __nonzero__ = __bool__
-    def __iter__( self ): return iter( self.__toklist )
-    def __reversed__( self ): return iter( self.__toklist[::-1] )
-    def _iterkeys( self ):
-        if hasattr(self.__tokdict, "iterkeys"):
-            return self.__tokdict.iterkeys()
-        else:
-            return iter(self.__tokdict)
-
-    def _itervalues( self ):
-        return (self[k] for k in self._iterkeys())
-            
-    def _iteritems( self ):
-        return ((k, self[k]) for k in self._iterkeys())
-
-    if PY_3:
-        keys = _iterkeys       
-        """Returns an iterator of all named result keys (Python 3.x only)."""
-
-        values = _itervalues
-        """Returns an iterator of all named result values (Python 3.x only)."""
-
-        items = _iteritems
-        """Returns an iterator of all named result key-value tuples (Python 3.x only)."""
-
-    else:
-        iterkeys = _iterkeys
-        """Returns an iterator of all named result keys (Python 2.x only)."""
-
-        itervalues = _itervalues
-        """Returns an iterator of all named result values (Python 2.x only)."""
-
-        iteritems = _iteritems
-        """Returns an iterator of all named result key-value tuples (Python 2.x only)."""
-
-        def keys( self ):
-            """Returns all named result keys (as a list in Python 2.x, as an iterator in Python 3.x)."""
-            return list(self.iterkeys())
-
-        def values( self ):
-            """Returns all named result values (as a list in Python 2.x, as an iterator in Python 3.x)."""
-            return list(self.itervalues())
-                
-        def items( self ):
-            """Returns all named result key-values (as a list of tuples in Python 2.x, as an iterator in Python 3.x)."""
-            return list(self.iteritems())
-
-    def haskeys( self ):
-        """Since keys() returns an iterator, this method is helpful in bypassing
-           code that looks for the existence of any defined results names."""
-        return bool(self.__tokdict)
-        
-    def pop( self, *args, **kwargs):
-        """
-        Removes and returns item at specified index (default=C{last}).
-        Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
-        argument or an integer argument, it will use C{list} semantics
-        and pop tokens from the list of parsed tokens. If passed a 
-        non-integer argument (most likely a string), it will use C{dict}
-        semantics and pop the corresponding value from any defined 
-        results names. A second default return value argument is 
-        supported, just as in C{dict.pop()}.
-
-        Example::
-            def remove_first(tokens):
-                tokens.pop(0)
-            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
-            print(OneOrMore(Word(nums)).addParseAction(remove_first).parseString("0 123 321")) # -> ['123', '321']
-
-            label = Word(alphas)
-            patt = label("LABEL") + OneOrMore(Word(nums))
-            print(patt.parseString("AAB 123 321").dump())
-
-            # Use pop() in a parse action to remove named result (note that corresponding value is not
-            # removed from list form of results)
-            def remove_LABEL(tokens):
-                tokens.pop("LABEL")
-                return tokens
-            patt.addParseAction(remove_LABEL)
-            print(patt.parseString("AAB 123 321").dump())
-        prints::
-            ['AAB', '123', '321']
-            - LABEL: AAB
-
-            ['AAB', '123', '321']
-        """
-        if not args:
-            args = [-1]
-        for k,v in kwargs.items():
-            if k == 'default':
-                args = (args[0], v)
-            else:
-                raise TypeError("pop() got an unexpected keyword argument '%s'" % k)
-        if (isinstance(args[0], int) or 
-                        len(args) == 1 or 
-                        args[0] in self):
-            index = args[0]
-            ret = self[index]
-            del self[index]
-            return ret
-        else:
-            defaultvalue = args[1]
-            return defaultvalue
-
-    def get(self, key, defaultValue=None):
-        """
-        Returns named result matching the given key, or if there is no
-        such name, then returns the given C{defaultValue} or C{None} if no
-        C{defaultValue} is specified.
-
-        Similar to C{dict.get()}.
-        
-        Example::
-            integer = Word(nums)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")           
-
-            result = date_str.parseString("1999/12/31")
-            print(result.get("year")) # -> '1999'
-            print(result.get("hour", "not specified")) # -> 'not specified'
-            print(result.get("hour")) # -> None
-        """
-        if key in self:
-            return self[key]
-        else:
-            return defaultValue
-
-    def insert( self, index, insStr ):
-        """
-        Inserts new element at location index in the list of parsed tokens.
-        
-        Similar to C{list.insert()}.
-
-        Example::
-            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
-
-            # use a parse action to insert the parse location in the front of the parsed results
-            def insert_locn(locn, tokens):
-                tokens.insert(0, locn)
-            print(OneOrMore(Word(nums)).addParseAction(insert_locn).parseString("0 123 321")) # -> [0, '0', '123', '321']
-        """
-        self.__toklist.insert(index, insStr)
-        # fixup indices in token dictionary
-        for name,occurrences in self.__tokdict.items():
-            for k, (value, position) in enumerate(occurrences):
-                occurrences[k] = _ParseResultsWithOffset(value, position + (position > index))
-
-    def append( self, item ):
-        """
-        Add single element to end of ParseResults list of elements.
-
-        Example::
-            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
-            
-            # use a parse action to compute the sum of the parsed integers, and add it to the end
-            def append_sum(tokens):
-                tokens.append(sum(map(int, tokens)))
-            print(OneOrMore(Word(nums)).addParseAction(append_sum).parseString("0 123 321")) # -> ['0', '123', '321', 444]
-        """
-        self.__toklist.append(item)
-
-    def extend( self, itemseq ):
-        """
-        Add sequence of elements to end of ParseResults list of elements.
-
-        Example::
-            patt = OneOrMore(Word(alphas))
-            
-            # use a parse action to append the reverse of the matched strings, to make a palindrome
-            def make_palindrome(tokens):
-                tokens.extend(reversed([t[::-1] for t in tokens]))
-                return ''.join(tokens)
-            print(patt.addParseAction(make_palindrome).parseString("lskdj sdlkjf lksd")) # -> 'lskdjsdlkjflksddsklfjkldsjdksl'
-        """
-        if isinstance(itemseq, ParseResults):
-            self += itemseq
-        else:
-            self.__toklist.extend(itemseq)
-
-    def clear( self ):
-        """
-        Clear all elements and results names.
-        """
-        del self.__toklist[:]
-        self.__tokdict.clear()
-
-    def __getattr__( self, name ):
-        try:
-            return self[name]
-        except KeyError:
-            return ""
-            
-        if name in self.__tokdict:
-            if name not in self.__accumNames:
-                return self.__tokdict[name][-1][0]
-            else:
-                return ParseResults([ v[0] for v in self.__tokdict[name] ])
-        else:
-            return ""
-
-    def __add__( self, other ):
-        ret = self.copy()
-        ret += other
-        return ret
-
-    def __iadd__( self, other ):
-        if other.__tokdict:
-            offset = len(self.__toklist)
-            addoffset = lambda a: offset if a<0 else a+offset
-            otheritems = other.__tokdict.items()
-            otherdictitems = [(k, _ParseResultsWithOffset(v[0],addoffset(v[1])) )
-                                for (k,vlist) in otheritems for v in vlist]
-            for k,v in otherdictitems:
-                self[k] = v
-                if isinstance(v[0],ParseResults):
-                    v[0].__parent = wkref(self)
-            
-        self.__toklist += other.__toklist
-        self.__accumNames.update( other.__accumNames )
-        return self
-
-    def __radd__(self, other):
-        if isinstance(other,int) and other == 0:
-            # useful for merging many ParseResults using sum() builtin
-            return self.copy()
-        else:
-            # this may raise a TypeError - so be it
-            return other + self
-        
-    def __repr__( self ):
-        return "(%s, %s)" % ( repr( self.__toklist ), repr( self.__tokdict ) )
-
-    def __str__( self ):
-        return '[' + ', '.join(_ustr(i) if isinstance(i, ParseResults) else repr(i) for i in self.__toklist) + ']'
-
-    def _asStringList( self, sep='' ):
-        out = []
-        for item in self.__toklist:
-            if out and sep:
-                out.append(sep)
-            if isinstance( item, ParseResults ):
-                out += item._asStringList()
-            else:
-                out.append( _ustr(item) )
-        return out
-
-    def asList( self ):
-        """
-        Returns the parse results as a nested list of matching tokens, all converted to strings.
-
-        Example::
-            patt = OneOrMore(Word(alphas))
-            result = patt.parseString("sldkj lsdkj sldkj")
-            # even though the result prints in string-like form, it is actually a pyparsing ParseResults
-            print(type(result), result) # ->  ['sldkj', 'lsdkj', 'sldkj']
-            
-            # Use asList() to create an actual list
-            result_list = result.asList()
-            print(type(result_list), result_list) # ->  ['sldkj', 'lsdkj', 'sldkj']
-        """
-        return [res.asList() if isinstance(res,ParseResults) else res for res in self.__toklist]
-
-    def asDict( self ):
-        """
-        Returns the named parse results as a nested dictionary.
-
-        Example::
-            integer = Word(nums)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
-            
-            result = date_str.parseString('12/31/1999')
-            print(type(result), repr(result)) # ->  (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]})
-            
-            result_dict = result.asDict()
-            print(type(result_dict), repr(result_dict)) # ->  {'day': '1999', 'year': '12', 'month': '31'}
-
-            # even though a ParseResults supports dict-like access, sometime you just need to have a dict
-            import json
-            print(json.dumps(result)) # -> Exception: TypeError: ... is not JSON serializable
-            print(json.dumps(result.asDict())) # -> {"month": "31", "day": "1999", "year": "12"}
-        """
-        if PY_3:
-            item_fn = self.items
-        else:
-            item_fn = self.iteritems
-            
-        def toItem(obj):
-            if isinstance(obj, ParseResults):
-                if obj.haskeys():
-                    return obj.asDict()
-                else:
-                    return [toItem(v) for v in obj]
-            else:
-                return obj
-                
-        return dict((k,toItem(v)) for k,v in item_fn())
-
-    def copy( self ):
-        """
-        Returns a new copy of a C{ParseResults} object.
-        """
-        ret = ParseResults( self.__toklist )
-        ret.__tokdict = self.__tokdict.copy()
-        ret.__parent = self.__parent
-        ret.__accumNames.update( self.__accumNames )
-        ret.__name = self.__name
-        return ret
-
-    def asXML( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ):
-        """
-        (Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
-        """
-        nl = "\n"
-        out = []
-        namedItems = dict((v[1],k) for (k,vlist) in self.__tokdict.items()
-                                                            for v in vlist)
-        nextLevelIndent = indent + "  "
-
-        # collapse out indents if formatting is not desired
-        if not formatted:
-            indent = ""
-            nextLevelIndent = ""
-            nl = ""
-
-        selfTag = None
-        if doctag is not None:
-            selfTag = doctag
-        else:
-            if self.__name:
-                selfTag = self.__name
-
-        if not selfTag:
-            if namedItemsOnly:
-                return ""
-            else:
-                selfTag = "ITEM"
-
-        out += [ nl, indent, "<", selfTag, ">" ]
-
-        for i,res in enumerate(self.__toklist):
-            if isinstance(res,ParseResults):
-                if i in namedItems:
-                    out += [ res.asXML(namedItems[i],
-                                        namedItemsOnly and doctag is None,
-                                        nextLevelIndent,
-                                        formatted)]
-                else:
-                    out += [ res.asXML(None,
-                                        namedItemsOnly and doctag is None,
-                                        nextLevelIndent,
-                                        formatted)]
-            else:
-                # individual token, see if there is a name for it
-                resTag = None
-                if i in namedItems:
-                    resTag = namedItems[i]
-                if not resTag:
-                    if namedItemsOnly:
-                        continue
-                    else:
-                        resTag = "ITEM"
-                xmlBodyText = _xml_escape(_ustr(res))
-                out += [ nl, nextLevelIndent, "<", resTag, ">",
-                                                xmlBodyText,
-                                                "" ]
-
-        out += [ nl, indent, "" ]
-        return "".join(out)
-
-    def __lookup(self,sub):
-        for k,vlist in self.__tokdict.items():
-            for v,loc in vlist:
-                if sub is v:
-                    return k
-        return None
-
-    def getName(self):
-        r"""
-        Returns the results name for this token expression. Useful when several 
-        different expressions might match at a particular location.
-
-        Example::
-            integer = Word(nums)
-            ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
-            house_number_expr = Suppress('#') + Word(nums, alphanums)
-            user_data = (Group(house_number_expr)("house_number") 
-                        | Group(ssn_expr)("ssn")
-                        | Group(integer)("age"))
-            user_info = OneOrMore(user_data)
-            
-            result = user_info.parseString("22 111-22-3333 #221B")
-            for item in result:
-                print(item.getName(), ':', item[0])
-        prints::
-            age : 22
-            ssn : 111-22-3333
-            house_number : 221B
-        """
-        if self.__name:
-            return self.__name
-        elif self.__parent:
-            par = self.__parent()
-            if par:
-                return par.__lookup(self)
-            else:
-                return None
-        elif (len(self) == 1 and
-               len(self.__tokdict) == 1 and
-               next(iter(self.__tokdict.values()))[0][1] in (0,-1)):
-            return next(iter(self.__tokdict.keys()))
-        else:
-            return None
-
-    def dump(self, indent='', depth=0, full=True):
-        """
-        Diagnostic method for listing out the contents of a C{ParseResults}.
-        Accepts an optional C{indent} argument so that this string can be embedded
-        in a nested display of other data.
-
-        Example::
-            integer = Word(nums)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
-            
-            result = date_str.parseString('12/31/1999')
-            print(result.dump())
-        prints::
-            ['12', '/', '31', '/', '1999']
-            - day: 1999
-            - month: 31
-            - year: 12
-        """
-        out = []
-        NL = '\n'
-        out.append( indent+_ustr(self.asList()) )
-        if full:
-            if self.haskeys():
-                items = sorted((str(k), v) for k,v in self.items())
-                for k,v in items:
-                    if out:
-                        out.append(NL)
-                    out.append( "%s%s- %s: " % (indent,('  '*depth), k) )
-                    if isinstance(v,ParseResults):
-                        if v:
-                            out.append( v.dump(indent,depth+1) )
-                        else:
-                            out.append(_ustr(v))
-                    else:
-                        out.append(repr(v))
-            elif any(isinstance(vv,ParseResults) for vv in self):
-                v = self
-                for i,vv in enumerate(v):
-                    if isinstance(vv,ParseResults):
-                        out.append("\n%s%s[%d]:\n%s%s%s" % (indent,('  '*(depth)),i,indent,('  '*(depth+1)),vv.dump(indent,depth+1) ))
-                    else:
-                        out.append("\n%s%s[%d]:\n%s%s%s" % (indent,('  '*(depth)),i,indent,('  '*(depth+1)),_ustr(vv)))
-            
-        return "".join(out)
-
-    def pprint(self, *args, **kwargs):
-        """
-        Pretty-printer for parsed results as a list, using the C{pprint} module.
-        Accepts additional positional or keyword args as defined for the 
-        C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})
-
-        Example::
-            ident = Word(alphas, alphanums)
-            num = Word(nums)
-            func = Forward()
-            term = ident | num | Group('(' + func + ')')
-            func <<= ident + Group(Optional(delimitedList(term)))
-            result = func.parseString("fna a,b,(fnb c,d,200),100")
-            result.pprint(width=40)
-        prints::
-            ['fna',
-             ['a',
-              'b',
-              ['(', 'fnb', ['c', 'd', '200'], ')'],
-              '100']]
-        """
-        pprint.pprint(self.asList(), *args, **kwargs)
-
-    # add support for pickle protocol
-    def __getstate__(self):
-        return ( self.__toklist,
-                 ( self.__tokdict.copy(),
-                   self.__parent is not None and self.__parent() or None,
-                   self.__accumNames,
-                   self.__name ) )
-
-    def __setstate__(self,state):
-        self.__toklist = state[0]
-        (self.__tokdict,
-         par,
-         inAccumNames,
-         self.__name) = state[1]
-        self.__accumNames = {}
-        self.__accumNames.update(inAccumNames)
-        if par is not None:
-            self.__parent = wkref(par)
-        else:
-            self.__parent = None
-
-    def __getnewargs__(self):
-        return self.__toklist, self.__name, self.__asList, self.__modal
-
-    def __dir__(self):
-        return (dir(type(self)) + list(self.keys()))
-
-MutableMapping.register(ParseResults)
-
-def col (loc,strg):
-    """Returns current column within a string, counting newlines as line separators.
-   The first column is number 1.
-
-   Note: the default parsing behavior is to expand tabs in the input string
-   before starting the parsing process.  See L{I{ParserElement.parseString}} for more information
-   on parsing strings containing C{}s, and suggested methods to maintain a
-   consistent view of the parsed string, the parse location, and line and column
-   positions within the parsed string.
-   """
-    s = strg
-    return 1 if 0} for more information
-   on parsing strings containing C{}s, and suggested methods to maintain a
-   consistent view of the parsed string, the parse location, and line and column
-   positions within the parsed string.
-   """
-    return strg.count("\n",0,loc) + 1
-
-def line( loc, strg ):
-    """Returns the line of text containing loc within a string, counting newlines as line separators.
-       """
-    lastCR = strg.rfind("\n", 0, loc)
-    nextCR = strg.find("\n", loc)
-    if nextCR >= 0:
-        return strg[lastCR+1:nextCR]
-    else:
-        return strg[lastCR+1:]
-
-def _defaultStartDebugAction( instring, loc, expr ):
-    print (("Match " + _ustr(expr) + " at loc " + _ustr(loc) + "(%d,%d)" % ( lineno(loc,instring), col(loc,instring) )))
-
-def _defaultSuccessDebugAction( instring, startloc, endloc, expr, toks ):
-    print ("Matched " + _ustr(expr) + " -> " + str(toks.asList()))
-
-def _defaultExceptionDebugAction( instring, loc, expr, exc ):
-    print ("Exception raised:" + _ustr(exc))
-
-def nullDebugAction(*args):
-    """'Do-nothing' debug action, to suppress debugging output during parsing."""
-    pass
-
-# Only works on Python 3.x - nonlocal is toxic to Python 2 installs
-#~ 'decorator to trim function calls to match the arity of the target'
-#~ def _trim_arity(func, maxargs=3):
-    #~ if func in singleArgBuiltins:
-        #~ return lambda s,l,t: func(t)
-    #~ limit = 0
-    #~ foundArity = False
-    #~ def wrapper(*args):
-        #~ nonlocal limit,foundArity
-        #~ while 1:
-            #~ try:
-                #~ ret = func(*args[limit:])
-                #~ foundArity = True
-                #~ return ret
-            #~ except TypeError:
-                #~ if limit == maxargs or foundArity:
-                    #~ raise
-                #~ limit += 1
-                #~ continue
-    #~ return wrapper
-
-# this version is Python 2.x-3.x cross-compatible
-'decorator to trim function calls to match the arity of the target'
-def _trim_arity(func, maxargs=2):
-    if func in singleArgBuiltins:
-        return lambda s,l,t: func(t)
-    limit = [0]
-    foundArity = [False]
-    
-    # traceback return data structure changed in Py3.5 - normalize back to plain tuples
-    if system_version[:2] >= (3,5):
-        def extract_stack(limit=0):
-            # special handling for Python 3.5.0 - extra deep call stack by 1
-            offset = -3 if system_version == (3,5,0) else -2
-            frame_summary = traceback.extract_stack(limit=-offset+limit-1)[offset]
-            return [frame_summary[:2]]
-        def extract_tb(tb, limit=0):
-            frames = traceback.extract_tb(tb, limit=limit)
-            frame_summary = frames[-1]
-            return [frame_summary[:2]]
-    else:
-        extract_stack = traceback.extract_stack
-        extract_tb = traceback.extract_tb
-    
-    # synthesize what would be returned by traceback.extract_stack at the call to 
-    # user's parse action 'func', so that we don't incur call penalty at parse time
-    
-    LINE_DIFF = 6
-    # IF ANY CODE CHANGES, EVEN JUST COMMENTS OR BLANK LINES, BETWEEN THE NEXT LINE AND 
-    # THE CALL TO FUNC INSIDE WRAPPER, LINE_DIFF MUST BE MODIFIED!!!!
-    this_line = extract_stack(limit=2)[-1]
-    pa_call_line_synth = (this_line[0], this_line[1]+LINE_DIFF)
-
-    def wrapper(*args):
-        while 1:
-            try:
-                ret = func(*args[limit[0]:])
-                foundArity[0] = True
-                return ret
-            except TypeError:
-                # re-raise TypeErrors if they did not come from our arity testing
-                if foundArity[0]:
-                    raise
-                else:
-                    try:
-                        tb = sys.exc_info()[-1]
-                        if not extract_tb(tb, limit=2)[-1][:2] == pa_call_line_synth:
-                            raise
-                    finally:
-                        del tb
-
-                if limit[0] <= maxargs:
-                    limit[0] += 1
-                    continue
-                raise
-
-    # copy func name to wrapper for sensible debug output
-    func_name = ""
-    try:
-        func_name = getattr(func, '__name__', 
-                            getattr(func, '__class__').__name__)
-    except Exception:
-        func_name = str(func)
-    wrapper.__name__ = func_name
-
-    return wrapper
-
-class ParserElement(object):
-    """Abstract base level parser element class."""
-    DEFAULT_WHITE_CHARS = " \n\t\r"
-    verbose_stacktrace = False
-
-    @staticmethod
-    def setDefaultWhitespaceChars( chars ):
-        r"""
-        Overrides the default whitespace chars
-
-        Example::
-            # default whitespace chars are space,  and newline
-            OneOrMore(Word(alphas)).parseString("abc def\nghi jkl")  # -> ['abc', 'def', 'ghi', 'jkl']
-            
-            # change to just treat newline as significant
-            ParserElement.setDefaultWhitespaceChars(" \t")
-            OneOrMore(Word(alphas)).parseString("abc def\nghi jkl")  # -> ['abc', 'def']
-        """
-        ParserElement.DEFAULT_WHITE_CHARS = chars
-
-    @staticmethod
-    def inlineLiteralsUsing(cls):
-        """
-        Set class to be used for inclusion of string literals into a parser.
-        
-        Example::
-            # default literal class used is Literal
-            integer = Word(nums)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")           
-
-            date_str.parseString("1999/12/31")  # -> ['1999', '/', '12', '/', '31']
-
-
-            # change to Suppress
-            ParserElement.inlineLiteralsUsing(Suppress)
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")           
-
-            date_str.parseString("1999/12/31")  # -> ['1999', '12', '31']
-        """
-        ParserElement._literalStringClass = cls
-
-    def __init__( self, savelist=False ):
-        self.parseAction = list()
-        self.failAction = None
-        #~ self.name = ""  # don't define self.name, let subclasses try/except upcall
-        self.strRepr = None
-        self.resultsName = None
-        self.saveAsList = savelist
-        self.skipWhitespace = True
-        self.whiteChars = ParserElement.DEFAULT_WHITE_CHARS
-        self.copyDefaultWhiteChars = True
-        self.mayReturnEmpty = False # used when checking for left-recursion
-        self.keepTabs = False
-        self.ignoreExprs = list()
-        self.debug = False
-        self.streamlined = False
-        self.mayIndexError = True # used to optimize exception handling for subclasses that don't advance parse index
-        self.errmsg = ""
-        self.modalResults = True # used to mark results names as modal (report only last) or cumulative (list all)
-        self.debugActions = ( None, None, None ) #custom debug actions
-        self.re = None
-        self.callPreparse = True # used to avoid redundant calls to preParse
-        self.callDuringTry = False
-
-    def copy( self ):
-        """
-        Make a copy of this C{ParserElement}.  Useful for defining different parse actions
-        for the same parsing pattern, using copies of the original parse element.
-        
-        Example::
-            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
-            integerK = integer.copy().addParseAction(lambda toks: toks[0]*1024) + Suppress("K")
-            integerM = integer.copy().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M")
-            
-            print(OneOrMore(integerK | integerM | integer).parseString("5K 100 640K 256M"))
-        prints::
-            [5120, 100, 655360, 268435456]
-        Equivalent form of C{expr.copy()} is just C{expr()}::
-            integerM = integer().addParseAction(lambda toks: toks[0]*1024*1024) + Suppress("M")
-        """
-        cpy = copy.copy( self )
-        cpy.parseAction = self.parseAction[:]
-        cpy.ignoreExprs = self.ignoreExprs[:]
-        if self.copyDefaultWhiteChars:
-            cpy.whiteChars = ParserElement.DEFAULT_WHITE_CHARS
-        return cpy
-
-    def setName( self, name ):
-        """
-        Define name for this expression, makes debugging and exception messages clearer.
-        
-        Example::
-            Word(nums).parseString("ABC")  # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
-            Word(nums).setName("integer").parseString("ABC")  # -> Exception: Expected integer (at char 0), (line:1, col:1)
-        """
-        self.name = name
-        self.errmsg = "Expected " + self.name
-        if hasattr(self,"exception"):
-            self.exception.msg = self.errmsg
-        return self
-
-    def setResultsName( self, name, listAllMatches=False ):
-        """
-        Define name for referencing matching tokens as a nested attribute
-        of the returned parse results.
-        NOTE: this returns a *copy* of the original C{ParserElement} object;
-        this is so that the client can define a basic element, such as an
-        integer, and reference it in multiple places with different names.
-
-        You can also set results names using the abbreviated syntax,
-        C{expr("name")} in place of C{expr.setResultsName("name")} - 
-        see L{I{__call__}<__call__>}.
-
-        Example::
-            date_str = (integer.setResultsName("year") + '/' 
-                        + integer.setResultsName("month") + '/' 
-                        + integer.setResultsName("day"))
-
-            # equivalent form:
-            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
-        """
-        newself = self.copy()
-        if name.endswith("*"):
-            name = name[:-1]
-            listAllMatches=True
-        newself.resultsName = name
-        newself.modalResults = not listAllMatches
-        return newself
-
-    def setBreak(self,breakFlag = True):
-        """Method to invoke the Python pdb debugger when this element is
-           about to be parsed. Set C{breakFlag} to True to enable, False to
-           disable.
-        """
-        if breakFlag:
-            _parseMethod = self._parse
-            def breaker(instring, loc, doActions=True, callPreParse=True):
-                import pdb
-                pdb.set_trace()
-                return _parseMethod( instring, loc, doActions, callPreParse )
-            breaker._originalParseMethod = _parseMethod
-            self._parse = breaker
-        else:
-            if hasattr(self._parse,"_originalParseMethod"):
-                self._parse = self._parse._originalParseMethod
-        return self
-
-    def setParseAction( self, *fns, **kwargs ):
-        """
-        Define one or more actions to perform when successfully matching parse element definition.
-        Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
-        C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
-         - s   = the original string being parsed (see note below)
-         - loc = the location of the matching substring
-         - toks = a list of the matched tokens, packaged as a C{L{ParseResults}} object
-        If the functions in fns modify the tokens, they can return them as the return
-        value from fn, and the modified list of tokens will replace the original.
-        Otherwise, fn does not need to return any value.
-
-        Optional keyword arguments:
-         - callDuringTry = (default=C{False}) indicate if parse action should be run during lookaheads and alternate testing
-
-        Note: the default parsing behavior is to expand tabs in the input string
-        before starting the parsing process.  See L{I{parseString}} for more information
-        on parsing strings containing C{}s, and suggested methods to maintain a
-        consistent view of the parsed string, the parse location, and line and column
-        positions within the parsed string.
-        
-        Example::
-            integer = Word(nums)
-            date_str = integer + '/' + integer + '/' + integer
-
-            date_str.parseString("1999/12/31")  # -> ['1999', '/', '12', '/', '31']
-
-            # use parse action to convert to ints at parse time
-            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
-            date_str = integer + '/' + integer + '/' + integer
-
-            # note that integer fields are now ints, not strings
-            date_str.parseString("1999/12/31")  # -> [1999, '/', 12, '/', 31]
-        """
-        self.parseAction = list(map(_trim_arity, list(fns)))
-        self.callDuringTry = kwargs.get("callDuringTry", False)
-        return self
-
-    def addParseAction( self, *fns, **kwargs ):
-        """
-        Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}}.
-        
-        See examples in L{I{copy}}.
-        """
-        self.parseAction += list(map(_trim_arity, list(fns)))
-        self.callDuringTry = self.callDuringTry or kwargs.get("callDuringTry", False)
-        return self
-
-    def addCondition(self, *fns, **kwargs):
-        """Add a boolean predicate function to expression's list of parse actions. See 
-        L{I{setParseAction}} for function call signatures. Unlike C{setParseAction}, 
-        functions passed to C{addCondition} need to return boolean success/fail of the condition.
-
-        Optional keyword arguments:
-         - message = define a custom message to be used in the raised exception
-         - fatal   = if True, will raise ParseFatalException to stop parsing immediately; otherwise will raise ParseException
-         
-        Example::
-            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
-            year_int = integer.copy()
-            year_int.addCondition(lambda toks: toks[0] >= 2000, message="Only support years 2000 and later")
-            date_str = year_int + '/' + integer + '/' + integer
-
-            result = date_str.parseString("1999/12/31")  # -> Exception: Only support years 2000 and later (at char 0), (line:1, col:1)
-        """
-        msg = kwargs.get("message", "failed user-defined condition")
-        exc_type = ParseFatalException if kwargs.get("fatal", False) else ParseException
-        for fn in fns:
-            def pa(s,l,t):
-                if not bool(_trim_arity(fn)(s,l,t)):
-                    raise exc_type(s,l,msg)
-            self.parseAction.append(pa)
-        self.callDuringTry = self.callDuringTry or kwargs.get("callDuringTry", False)
-        return self
-
-    def setFailAction( self, fn ):
-        """Define action to perform if parsing fails at this expression.
-           Fail acton fn is a callable function that takes the arguments
-           C{fn(s,loc,expr,err)} where:
-            - s = string being parsed
-            - loc = location where expression match was attempted and failed
-            - expr = the parse expression that failed
-            - err = the exception thrown
-           The function returns no value.  It may throw C{L{ParseFatalException}}
-           if it is desired to stop parsing immediately."""
-        self.failAction = fn
-        return self
-
-    def _skipIgnorables( self, instring, loc ):
-        exprsFound = True
-        while exprsFound:
-            exprsFound = False
-            for e in self.ignoreExprs:
-                try:
-                    while 1:
-                        loc,dummy = e._parse( instring, loc )
-                        exprsFound = True
-                except ParseException:
-                    pass
-        return loc
-
-    def preParse( self, instring, loc ):
-        if self.ignoreExprs:
-            loc = self._skipIgnorables( instring, loc )
-
-        if self.skipWhitespace:
-            wt = self.whiteChars
-            instrlen = len(instring)
-            while loc < instrlen and instring[loc] in wt:
-                loc += 1
-
-        return loc
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        return loc, []
-
-    def postParse( self, instring, loc, tokenlist ):
-        return tokenlist
-
-    #~ @profile
-    def _parseNoCache( self, instring, loc, doActions=True, callPreParse=True ):
-        debugging = ( self.debug ) #and doActions )
-
-        if debugging or self.failAction:
-            #~ print ("Match",self,"at loc",loc,"(%d,%d)" % ( lineno(loc,instring), col(loc,instring) ))
-            if (self.debugActions[0] ):
-                self.debugActions[0]( instring, loc, self )
-            if callPreParse and self.callPreparse:
-                preloc = self.preParse( instring, loc )
-            else:
-                preloc = loc
-            tokensStart = preloc
-            try:
-                try:
-                    loc,tokens = self.parseImpl( instring, preloc, doActions )
-                except IndexError:
-                    raise ParseException( instring, len(instring), self.errmsg, self )
-            except ParseBaseException as err:
-                #~ print ("Exception raised:", err)
-                if self.debugActions[2]:
-                    self.debugActions[2]( instring, tokensStart, self, err )
-                if self.failAction:
-                    self.failAction( instring, tokensStart, self, err )
-                raise
-        else:
-            if callPreParse and self.callPreparse:
-                preloc = self.preParse( instring, loc )
-            else:
-                preloc = loc
-            tokensStart = preloc
-            if self.mayIndexError or preloc >= len(instring):
-                try:
-                    loc,tokens = self.parseImpl( instring, preloc, doActions )
-                except IndexError:
-                    raise ParseException( instring, len(instring), self.errmsg, self )
-            else:
-                loc,tokens = self.parseImpl( instring, preloc, doActions )
-
-        tokens = self.postParse( instring, loc, tokens )
-
-        retTokens = ParseResults( tokens, self.resultsName, asList=self.saveAsList, modal=self.modalResults )
-        if self.parseAction and (doActions or self.callDuringTry):
-            if debugging:
-                try:
-                    for fn in self.parseAction:
-                        tokens = fn( instring, tokensStart, retTokens )
-                        if tokens is not None:
-                            retTokens = ParseResults( tokens,
-                                                      self.resultsName,
-                                                      asList=self.saveAsList and isinstance(tokens,(ParseResults,list)),
-                                                      modal=self.modalResults )
-                except ParseBaseException as err:
-                    #~ print "Exception raised in user parse action:", err
-                    if (self.debugActions[2] ):
-                        self.debugActions[2]( instring, tokensStart, self, err )
-                    raise
-            else:
-                for fn in self.parseAction:
-                    tokens = fn( instring, tokensStart, retTokens )
-                    if tokens is not None:
-                        retTokens = ParseResults( tokens,
-                                                  self.resultsName,
-                                                  asList=self.saveAsList and isinstance(tokens,(ParseResults,list)),
-                                                  modal=self.modalResults )
-        if debugging:
-            #~ print ("Matched",self,"->",retTokens.asList())
-            if (self.debugActions[1] ):
-                self.debugActions[1]( instring, tokensStart, loc, self, retTokens )
-
-        return loc, retTokens
-
-    def tryParse( self, instring, loc ):
-        try:
-            return self._parse( instring, loc, doActions=False )[0]
-        except ParseFatalException:
-            raise ParseException( instring, loc, self.errmsg, self)
-    
-    def canParseNext(self, instring, loc):
-        try:
-            self.tryParse(instring, loc)
-        except (ParseException, IndexError):
-            return False
-        else:
-            return True
-
-    class _UnboundedCache(object):
-        def __init__(self):
-            cache = {}
-            self.not_in_cache = not_in_cache = object()
-
-            def get(self, key):
-                return cache.get(key, not_in_cache)
-
-            def set(self, key, value):
-                cache[key] = value
-
-            def clear(self):
-                cache.clear()
-                
-            def cache_len(self):
-                return len(cache)
-
-            self.get = types.MethodType(get, self)
-            self.set = types.MethodType(set, self)
-            self.clear = types.MethodType(clear, self)
-            self.__len__ = types.MethodType(cache_len, self)
-
-    if _OrderedDict is not None:
-        class _FifoCache(object):
-            def __init__(self, size):
-                self.not_in_cache = not_in_cache = object()
-
-                cache = _OrderedDict()
-
-                def get(self, key):
-                    return cache.get(key, not_in_cache)
-
-                def set(self, key, value):
-                    cache[key] = value
-                    while len(cache) > size:
-                        try:
-                            cache.popitem(False)
-                        except KeyError:
-                            pass
-
-                def clear(self):
-                    cache.clear()
-
-                def cache_len(self):
-                    return len(cache)
-
-                self.get = types.MethodType(get, self)
-                self.set = types.MethodType(set, self)
-                self.clear = types.MethodType(clear, self)
-                self.__len__ = types.MethodType(cache_len, self)
-
-    else:
-        class _FifoCache(object):
-            def __init__(self, size):
-                self.not_in_cache = not_in_cache = object()
-
-                cache = {}
-                key_fifo = collections.deque([], size)
-
-                def get(self, key):
-                    return cache.get(key, not_in_cache)
-
-                def set(self, key, value):
-                    cache[key] = value
-                    while len(key_fifo) > size:
-                        cache.pop(key_fifo.popleft(), None)
-                    key_fifo.append(key)
-
-                def clear(self):
-                    cache.clear()
-                    key_fifo.clear()
-
-                def cache_len(self):
-                    return len(cache)
-
-                self.get = types.MethodType(get, self)
-                self.set = types.MethodType(set, self)
-                self.clear = types.MethodType(clear, self)
-                self.__len__ = types.MethodType(cache_len, self)
-
-    # argument cache for optimizing repeated calls when backtracking through recursive expressions
-    packrat_cache = {} # this is set later by enabledPackrat(); this is here so that resetCache() doesn't fail
-    packrat_cache_lock = RLock()
-    packrat_cache_stats = [0, 0]
-
-    # this method gets repeatedly called during backtracking with the same arguments -
-    # we can cache these arguments and save ourselves the trouble of re-parsing the contained expression
-    def _parseCache( self, instring, loc, doActions=True, callPreParse=True ):
-        HIT, MISS = 0, 1
-        lookup = (self, instring, loc, callPreParse, doActions)
-        with ParserElement.packrat_cache_lock:
-            cache = ParserElement.packrat_cache
-            value = cache.get(lookup)
-            if value is cache.not_in_cache:
-                ParserElement.packrat_cache_stats[MISS] += 1
-                try:
-                    value = self._parseNoCache(instring, loc, doActions, callPreParse)
-                except ParseBaseException as pe:
-                    # cache a copy of the exception, without the traceback
-                    cache.set(lookup, pe.__class__(*pe.args))
-                    raise
-                else:
-                    cache.set(lookup, (value[0], value[1].copy()))
-                    return value
-            else:
-                ParserElement.packrat_cache_stats[HIT] += 1
-                if isinstance(value, Exception):
-                    raise value
-                return (value[0], value[1].copy())
-
-    _parse = _parseNoCache
-
-    @staticmethod
-    def resetCache():
-        ParserElement.packrat_cache.clear()
-        ParserElement.packrat_cache_stats[:] = [0] * len(ParserElement.packrat_cache_stats)
-
-    _packratEnabled = False
-    @staticmethod
-    def enablePackrat(cache_size_limit=128):
-        """Enables "packrat" parsing, which adds memoizing to the parsing logic.
-           Repeated parse attempts at the same string location (which happens
-           often in many complex grammars) can immediately return a cached value,
-           instead of re-executing parsing/validating code.  Memoizing is done of
-           both valid results and parsing exceptions.
-           
-           Parameters:
-            - cache_size_limit - (default=C{128}) - if an integer value is provided
-              will limit the size of the packrat cache; if None is passed, then
-              the cache size will be unbounded; if 0 is passed, the cache will
-              be effectively disabled.
-            
-           This speedup may break existing programs that use parse actions that
-           have side-effects.  For this reason, packrat parsing is disabled when
-           you first import pyparsing.  To activate the packrat feature, your
-           program must call the class method C{ParserElement.enablePackrat()}.  If
-           your program uses C{psyco} to "compile as you go", you must call
-           C{enablePackrat} before calling C{psyco.full()}.  If you do not do this,
-           Python will crash.  For best results, call C{enablePackrat()} immediately
-           after importing pyparsing.
-           
-           Example::
-               import pyparsing
-               pyparsing.ParserElement.enablePackrat()
-        """
-        if not ParserElement._packratEnabled:
-            ParserElement._packratEnabled = True
-            if cache_size_limit is None:
-                ParserElement.packrat_cache = ParserElement._UnboundedCache()
-            else:
-                ParserElement.packrat_cache = ParserElement._FifoCache(cache_size_limit)
-            ParserElement._parse = ParserElement._parseCache
-
-    def parseString( self, instring, parseAll=False ):
-        """
-        Execute the parse expression with the given string.
-        This is the main interface to the client code, once the complete
-        expression has been built.
-
-        If you want the grammar to require that the entire input string be
-        successfully parsed, then set C{parseAll} to True (equivalent to ending
-        the grammar with C{L{StringEnd()}}).
-
-        Note: C{parseString} implicitly calls C{expandtabs()} on the input string,
-        in order to report proper column numbers in parse actions.
-        If the input string contains tabs and
-        the grammar uses parse actions that use the C{loc} argument to index into the
-        string being parsed, you can ensure you have a consistent view of the input
-        string by:
-         - calling C{parseWithTabs} on your grammar before calling C{parseString}
-           (see L{I{parseWithTabs}})
-         - define your parse action using the full C{(s,loc,toks)} signature, and
-           reference the input string using the parse action's C{s} argument
-         - explictly expand the tabs in your input string before calling
-           C{parseString}
-        
-        Example::
-            Word('a').parseString('aaaaabaaa')  # -> ['aaaaa']
-            Word('a').parseString('aaaaabaaa', parseAll=True)  # -> Exception: Expected end of text
-        """
-        ParserElement.resetCache()
-        if not self.streamlined:
-            self.streamline()
-            #~ self.saveAsList = True
-        for e in self.ignoreExprs:
-            e.streamline()
-        if not self.keepTabs:
-            instring = instring.expandtabs()
-        try:
-            loc, tokens = self._parse( instring, 0 )
-            if parseAll:
-                loc = self.preParse( instring, loc )
-                se = Empty() + StringEnd()
-                se._parse( instring, loc )
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-        else:
-            return tokens
-
-    def scanString( self, instring, maxMatches=_MAX_INT, overlap=False ):
-        """
-        Scan the input string for expression matches.  Each match will return the
-        matching tokens, start location, and end location.  May be called with optional
-        C{maxMatches} argument, to clip scanning after 'n' matches are found.  If
-        C{overlap} is specified, then overlapping matches will be reported.
-
-        Note that the start and end locations are reported relative to the string
-        being parsed.  See L{I{parseString}} for more information on parsing
-        strings with embedded tabs.
-
-        Example::
-            source = "sldjf123lsdjjkf345sldkjf879lkjsfd987"
-            print(source)
-            for tokens,start,end in Word(alphas).scanString(source):
-                print(' '*start + '^'*(end-start))
-                print(' '*start + tokens[0])
-        
-        prints::
-        
-            sldjf123lsdjjkf345sldkjf879lkjsfd987
-            ^^^^^
-            sldjf
-                    ^^^^^^^
-                    lsdjjkf
-                              ^^^^^^
-                              sldkjf
-                                       ^^^^^^
-                                       lkjsfd
-        """
-        if not self.streamlined:
-            self.streamline()
-        for e in self.ignoreExprs:
-            e.streamline()
-
-        if not self.keepTabs:
-            instring = _ustr(instring).expandtabs()
-        instrlen = len(instring)
-        loc = 0
-        preparseFn = self.preParse
-        parseFn = self._parse
-        ParserElement.resetCache()
-        matches = 0
-        try:
-            while loc <= instrlen and matches < maxMatches:
-                try:
-                    preloc = preparseFn( instring, loc )
-                    nextLoc,tokens = parseFn( instring, preloc, callPreParse=False )
-                except ParseException:
-                    loc = preloc+1
-                else:
-                    if nextLoc > loc:
-                        matches += 1
-                        yield tokens, preloc, nextLoc
-                        if overlap:
-                            nextloc = preparseFn( instring, loc )
-                            if nextloc > loc:
-                                loc = nextLoc
-                            else:
-                                loc += 1
-                        else:
-                            loc = nextLoc
-                    else:
-                        loc = preloc+1
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-
-    def transformString( self, instring ):
-        """
-        Extension to C{L{scanString}}, to modify matching text with modified tokens that may
-        be returned from a parse action.  To use C{transformString}, define a grammar and
-        attach a parse action to it that modifies the returned token list.
-        Invoking C{transformString()} on a target string will then scan for matches,
-        and replace the matched text patterns according to the logic in the parse
-        action.  C{transformString()} returns the resulting transformed string.
-        
-        Example::
-            wd = Word(alphas)
-            wd.setParseAction(lambda toks: toks[0].title())
-            
-            print(wd.transformString("now is the winter of our discontent made glorious summer by this sun of york."))
-        Prints::
-            Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York.
-        """
-        out = []
-        lastE = 0
-        # force preservation of s, to minimize unwanted transformation of string, and to
-        # keep string locs straight between transformString and scanString
-        self.keepTabs = True
-        try:
-            for t,s,e in self.scanString( instring ):
-                out.append( instring[lastE:s] )
-                if t:
-                    if isinstance(t,ParseResults):
-                        out += t.asList()
-                    elif isinstance(t,list):
-                        out += t
-                    else:
-                        out.append(t)
-                lastE = e
-            out.append(instring[lastE:])
-            out = [o for o in out if o]
-            return "".join(map(_ustr,_flatten(out)))
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-
-    def searchString( self, instring, maxMatches=_MAX_INT ):
-        """
-        Another extension to C{L{scanString}}, simplifying the access to the tokens found
-        to match the given parse expression.  May be called with optional
-        C{maxMatches} argument, to clip searching after 'n' matches are found.
-        
-        Example::
-            # a capitalized word starts with an uppercase letter, followed by zero or more lowercase letters
-            cap_word = Word(alphas.upper(), alphas.lower())
-            
-            print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity"))
-
-            # the sum() builtin can be used to merge results into a single ParseResults object
-            print(sum(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")))
-        prints::
-            [['More'], ['Iron'], ['Lead'], ['Gold'], ['I'], ['Electricity']]
-            ['More', 'Iron', 'Lead', 'Gold', 'I', 'Electricity']
-        """
-        try:
-            return ParseResults([ t for t,s,e in self.scanString( instring, maxMatches ) ])
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-
-    def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False):
-        """
-        Generator method to split a string using the given expression as a separator.
-        May be called with optional C{maxsplit} argument, to limit the number of splits;
-        and the optional C{includeSeparators} argument (default=C{False}), if the separating
-        matching text should be included in the split results.
-        
-        Example::        
-            punc = oneOf(list(".,;:/-!?"))
-            print(list(punc.split("This, this?, this sentence, is badly punctuated!")))
-        prints::
-            ['This', ' this', '', ' this sentence', ' is badly punctuated', '']
-        """
-        splits = 0
-        last = 0
-        for t,s,e in self.scanString(instring, maxMatches=maxsplit):
-            yield instring[last:s]
-            if includeSeparators:
-                yield t[0]
-            last = e
-        yield instring[last:]
-
-    def __add__(self, other ):
-        """
-        Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement
-        converts them to L{Literal}s by default.
-        
-        Example::
-            greet = Word(alphas) + "," + Word(alphas) + "!"
-            hello = "Hello, World!"
-            print (hello, "->", greet.parseString(hello))
-        Prints::
-            Hello, World! -> ['Hello', ',', 'World', '!']
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return And( [ self, other ] )
-
-    def __radd__(self, other ):
-        """
-        Implementation of + operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other + self
-
-    def __sub__(self, other):
-        """
-        Implementation of - operator, returns C{L{And}} with error stop
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return self + And._ErrorStop() + other
-
-    def __rsub__(self, other ):
-        """
-        Implementation of - operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other - self
-
-    def __mul__(self,other):
-        """
-        Implementation of * operator, allows use of C{expr * 3} in place of
-        C{expr + expr + expr}.  Expressions may also me multiplied by a 2-integer
-        tuple, similar to C{{min,max}} multipliers in regular expressions.  Tuples
-        may also include C{None} as in:
-         - C{expr*(n,None)} or C{expr*(n,)} is equivalent
-              to C{expr*n + L{ZeroOrMore}(expr)}
-              (read as "at least n instances of C{expr}")
-         - C{expr*(None,n)} is equivalent to C{expr*(0,n)}
-              (read as "0 to n instances of C{expr}")
-         - C{expr*(None,None)} is equivalent to C{L{ZeroOrMore}(expr)}
-         - C{expr*(1,None)} is equivalent to C{L{OneOrMore}(expr)}
-
-        Note that C{expr*(None,n)} does not raise an exception if
-        more than n exprs exist in the input stream; that is,
-        C{expr*(None,n)} does not enforce a maximum number of expr
-        occurrences.  If this behavior is desired, then write
-        C{expr*(None,n) + ~expr}
-        """
-        if isinstance(other,int):
-            minElements, optElements = other,0
-        elif isinstance(other,tuple):
-            other = (other + (None, None))[:2]
-            if other[0] is None:
-                other = (0, other[1])
-            if isinstance(other[0],int) and other[1] is None:
-                if other[0] == 0:
-                    return ZeroOrMore(self)
-                if other[0] == 1:
-                    return OneOrMore(self)
-                else:
-                    return self*other[0] + ZeroOrMore(self)
-            elif isinstance(other[0],int) and isinstance(other[1],int):
-                minElements, optElements = other
-                optElements -= minElements
-            else:
-                raise TypeError("cannot multiply 'ParserElement' and ('%s','%s') objects", type(other[0]),type(other[1]))
-        else:
-            raise TypeError("cannot multiply 'ParserElement' and '%s' objects", type(other))
-
-        if minElements < 0:
-            raise ValueError("cannot multiply ParserElement by negative value")
-        if optElements < 0:
-            raise ValueError("second tuple value must be greater or equal to first tuple value")
-        if minElements == optElements == 0:
-            raise ValueError("cannot multiply ParserElement by 0 or (0,0)")
-
-        if (optElements):
-            def makeOptionalList(n):
-                if n>1:
-                    return Optional(self + makeOptionalList(n-1))
-                else:
-                    return Optional(self)
-            if minElements:
-                if minElements == 1:
-                    ret = self + makeOptionalList(optElements)
-                else:
-                    ret = And([self]*minElements) + makeOptionalList(optElements)
-            else:
-                ret = makeOptionalList(optElements)
-        else:
-            if minElements == 1:
-                ret = self
-            else:
-                ret = And([self]*minElements)
-        return ret
-
-    def __rmul__(self, other):
-        return self.__mul__(other)
-
-    def __or__(self, other ):
-        """
-        Implementation of | operator - returns C{L{MatchFirst}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return MatchFirst( [ self, other ] )
-
-    def __ror__(self, other ):
-        """
-        Implementation of | operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other | self
-
-    def __xor__(self, other ):
-        """
-        Implementation of ^ operator - returns C{L{Or}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return Or( [ self, other ] )
-
-    def __rxor__(self, other ):
-        """
-        Implementation of ^ operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other ^ self
-
-    def __and__(self, other ):
-        """
-        Implementation of & operator - returns C{L{Each}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return Each( [ self, other ] )
-
-    def __rand__(self, other ):
-        """
-        Implementation of & operator when left operand is not a C{L{ParserElement}}
-        """
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        if not isinstance( other, ParserElement ):
-            warnings.warn("Cannot combine element of type %s with ParserElement" % type(other),
-                    SyntaxWarning, stacklevel=2)
-            return None
-        return other & self
-
-    def __invert__( self ):
-        """
-        Implementation of ~ operator - returns C{L{NotAny}}
-        """
-        return NotAny( self )
-
-    def __call__(self, name=None):
-        """
-        Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}.
-        
-        If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be
-        passed as C{True}.
-           
-        If C{name} is omitted, same as calling C{L{copy}}.
-
-        Example::
-            # these are equivalent
-            userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno")
-            userdata = Word(alphas)("name") + Word(nums+"-")("socsecno")             
-        """
-        if name is not None:
-            return self.setResultsName(name)
-        else:
-            return self.copy()
-
-    def suppress( self ):
-        """
-        Suppresses the output of this C{ParserElement}; useful to keep punctuation from
-        cluttering up returned output.
-        """
-        return Suppress( self )
-
-    def leaveWhitespace( self ):
-        """
-        Disables the skipping of whitespace before matching the characters in the
-        C{ParserElement}'s defined pattern.  This is normally only used internally by
-        the pyparsing module, but may be needed in some whitespace-sensitive grammars.
-        """
-        self.skipWhitespace = False
-        return self
-
-    def setWhitespaceChars( self, chars ):
-        """
-        Overrides the default whitespace chars
-        """
-        self.skipWhitespace = True
-        self.whiteChars = chars
-        self.copyDefaultWhiteChars = False
-        return self
-
-    def parseWithTabs( self ):
-        """
-        Overrides default behavior to expand C{}s to spaces before parsing the input string.
-        Must be called before C{parseString} when the input grammar contains elements that
-        match C{} characters.
-        """
-        self.keepTabs = True
-        return self
-
-    def ignore( self, other ):
-        """
-        Define expression to be ignored (e.g., comments) while doing pattern
-        matching; may be called repeatedly, to define multiple comment or other
-        ignorable patterns.
-        
-        Example::
-            patt = OneOrMore(Word(alphas))
-            patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj']
-            
-            patt.ignore(cStyleComment)
-            patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj', 'lskjd']
-        """
-        if isinstance(other, basestring):
-            other = Suppress(other)
-
-        if isinstance( other, Suppress ):
-            if other not in self.ignoreExprs:
-                self.ignoreExprs.append(other)
-        else:
-            self.ignoreExprs.append( Suppress( other.copy() ) )
-        return self
-
-    def setDebugActions( self, startAction, successAction, exceptionAction ):
-        """
-        Enable display of debugging messages while doing pattern matching.
-        """
-        self.debugActions = (startAction or _defaultStartDebugAction,
-                             successAction or _defaultSuccessDebugAction,
-                             exceptionAction or _defaultExceptionDebugAction)
-        self.debug = True
-        return self
-
-    def setDebug( self, flag=True ):
-        """
-        Enable display of debugging messages while doing pattern matching.
-        Set C{flag} to True to enable, False to disable.
-
-        Example::
-            wd = Word(alphas).setName("alphaword")
-            integer = Word(nums).setName("numword")
-            term = wd | integer
-            
-            # turn on debugging for wd
-            wd.setDebug()
-
-            OneOrMore(term).parseString("abc 123 xyz 890")
-        
-        prints::
-            Match alphaword at loc 0(1,1)
-            Matched alphaword -> ['abc']
-            Match alphaword at loc 3(1,4)
-            Exception raised:Expected alphaword (at char 4), (line:1, col:5)
-            Match alphaword at loc 7(1,8)
-            Matched alphaword -> ['xyz']
-            Match alphaword at loc 11(1,12)
-            Exception raised:Expected alphaword (at char 12), (line:1, col:13)
-            Match alphaword at loc 15(1,16)
-            Exception raised:Expected alphaword (at char 15), (line:1, col:16)
-
-        The output shown is that produced by the default debug actions - custom debug actions can be
-        specified using L{setDebugActions}. Prior to attempting
-        to match the C{wd} expression, the debugging message C{"Match  at loc (,)"}
-        is shown. Then if the parse succeeds, a C{"Matched"} message is shown, or an C{"Exception raised"}
-        message is shown. Also note the use of L{setName} to assign a human-readable name to the expression,
-        which makes debugging and exception messages easier to understand - for instance, the default
-        name created for the C{Word} expression without calling C{setName} is C{"W:(ABCD...)"}.
-        """
-        if flag:
-            self.setDebugActions( _defaultStartDebugAction, _defaultSuccessDebugAction, _defaultExceptionDebugAction )
-        else:
-            self.debug = False
-        return self
-
-    def __str__( self ):
-        return self.name
-
-    def __repr__( self ):
-        return _ustr(self)
-
-    def streamline( self ):
-        self.streamlined = True
-        self.strRepr = None
-        return self
-
-    def checkRecursion( self, parseElementList ):
-        pass
-
-    def validate( self, validateTrace=[] ):
-        """
-        Check defined expressions for valid structure, check for infinite recursive definitions.
-        """
-        self.checkRecursion( [] )
-
-    def parseFile( self, file_or_filename, parseAll=False ):
-        """
-        Execute the parse expression on the given file or filename.
-        If a filename is specified (instead of a file object),
-        the entire file is opened, read, and closed before parsing.
-        """
-        try:
-            file_contents = file_or_filename.read()
-        except AttributeError:
-            with open(file_or_filename, "r") as f:
-                file_contents = f.read()
-        try:
-            return self.parseString(file_contents, parseAll)
-        except ParseBaseException as exc:
-            if ParserElement.verbose_stacktrace:
-                raise
-            else:
-                # catch and re-raise exception from here, clears out pyparsing internal stack trace
-                raise exc
-
-    def __eq__(self,other):
-        if isinstance(other, ParserElement):
-            return self is other or vars(self) == vars(other)
-        elif isinstance(other, basestring):
-            return self.matches(other)
-        else:
-            return super(ParserElement,self)==other
-
-    def __ne__(self,other):
-        return not (self == other)
-
-    def __hash__(self):
-        return hash(id(self))
-
-    def __req__(self,other):
-        return self == other
-
-    def __rne__(self,other):
-        return not (self == other)
-
-    def matches(self, testString, parseAll=True):
-        """
-        Method for quick testing of a parser against a test string. Good for simple 
-        inline microtests of sub expressions while building up larger parser.
-           
-        Parameters:
-         - testString - to test against this expression for a match
-         - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests
-            
-        Example::
-            expr = Word(nums)
-            assert expr.matches("100")
-        """
-        try:
-            self.parseString(_ustr(testString), parseAll=parseAll)
-            return True
-        except ParseBaseException:
-            return False
-                
-    def runTests(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False):
-        """
-        Execute the parse expression on a series of test strings, showing each
-        test, the parsed results or where the parse failed. Quick and easy way to
-        run a parse expression against a list of sample strings.
-           
-        Parameters:
-         - tests - a list of separate test strings, or a multiline string of test strings
-         - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests           
-         - comment - (default=C{'#'}) - expression for indicating embedded comments in the test 
-              string; pass None to disable comment filtering
-         - fullDump - (default=C{True}) - dump results as list followed by results names in nested outline;
-              if False, only dump nested list
-         - printResults - (default=C{True}) prints test output to stdout
-         - failureTests - (default=C{False}) indicates if these tests are expected to fail parsing
-
-        Returns: a (success, results) tuple, where success indicates that all tests succeeded
-        (or failed if C{failureTests} is True), and the results contain a list of lines of each 
-        test's output
-        
-        Example::
-            number_expr = pyparsing_common.number.copy()
-
-            result = number_expr.runTests('''
-                # unsigned integer
-                100
-                # negative integer
-                -100
-                # float with scientific notation
-                6.02e23
-                # integer with scientific notation
-                1e-12
-                ''')
-            print("Success" if result[0] else "Failed!")
-
-            result = number_expr.runTests('''
-                # stray character
-                100Z
-                # missing leading digit before '.'
-                -.100
-                # too many '.'
-                3.14.159
-                ''', failureTests=True)
-            print("Success" if result[0] else "Failed!")
-        prints::
-            # unsigned integer
-            100
-            [100]
-
-            # negative integer
-            -100
-            [-100]
-
-            # float with scientific notation
-            6.02e23
-            [6.02e+23]
-
-            # integer with scientific notation
-            1e-12
-            [1e-12]
-
-            Success
-            
-            # stray character
-            100Z
-               ^
-            FAIL: Expected end of text (at char 3), (line:1, col:4)
-
-            # missing leading digit before '.'
-            -.100
-            ^
-            FAIL: Expected {real number with scientific notation | real number | signed integer} (at char 0), (line:1, col:1)
-
-            # too many '.'
-            3.14.159
-                ^
-            FAIL: Expected end of text (at char 4), (line:1, col:5)
-
-            Success
-
-        Each test string must be on a single line. If you want to test a string that spans multiple
-        lines, create a test like this::
-
-            expr.runTest(r"this is a test\\n of strings that spans \\n 3 lines")
-        
-        (Note that this is a raw string literal, you must include the leading 'r'.)
-        """
-        if isinstance(tests, basestring):
-            tests = list(map(str.strip, tests.rstrip().splitlines()))
-        if isinstance(comment, basestring):
-            comment = Literal(comment)
-        allResults = []
-        comments = []
-        success = True
-        for t in tests:
-            if comment is not None and comment.matches(t, False) or comments and not t:
-                comments.append(t)
-                continue
-            if not t:
-                continue
-            out = ['\n'.join(comments), t]
-            comments = []
-            try:
-                t = t.replace(r'\n','\n')
-                result = self.parseString(t, parseAll=parseAll)
-                out.append(result.dump(full=fullDump))
-                success = success and not failureTests
-            except ParseBaseException as pe:
-                fatal = "(FATAL)" if isinstance(pe, ParseFatalException) else ""
-                if '\n' in t:
-                    out.append(line(pe.loc, t))
-                    out.append(' '*(col(pe.loc,t)-1) + '^' + fatal)
-                else:
-                    out.append(' '*pe.loc + '^' + fatal)
-                out.append("FAIL: " + str(pe))
-                success = success and failureTests
-                result = pe
-            except Exception as exc:
-                out.append("FAIL-EXCEPTION: " + str(exc))
-                success = success and failureTests
-                result = exc
-
-            if printResults:
-                if fullDump:
-                    out.append('')
-                print('\n'.join(out))
-
-            allResults.append((t, result))
-        
-        return success, allResults
-
-        
-class Token(ParserElement):
-    """
-    Abstract C{ParserElement} subclass, for defining atomic matching patterns.
-    """
-    def __init__( self ):
-        super(Token,self).__init__( savelist=False )
-
-
-class Empty(Token):
-    """
-    An empty token, will always match.
-    """
-    def __init__( self ):
-        super(Empty,self).__init__()
-        self.name = "Empty"
-        self.mayReturnEmpty = True
-        self.mayIndexError = False
-
-
-class NoMatch(Token):
-    """
-    A token that will never match.
-    """
-    def __init__( self ):
-        super(NoMatch,self).__init__()
-        self.name = "NoMatch"
-        self.mayReturnEmpty = True
-        self.mayIndexError = False
-        self.errmsg = "Unmatchable token"
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        raise ParseException(instring, loc, self.errmsg, self)
-
-
-class Literal(Token):
-    """
-    Token to exactly match a specified string.
-    
-    Example::
-        Literal('blah').parseString('blah')  # -> ['blah']
-        Literal('blah').parseString('blahfooblah')  # -> ['blah']
-        Literal('blah').parseString('bla')  # -> Exception: Expected "blah"
-    
-    For case-insensitive matching, use L{CaselessLiteral}.
-    
-    For keyword matching (force word break before and after the matched string),
-    use L{Keyword} or L{CaselessKeyword}.
-    """
-    def __init__( self, matchString ):
-        super(Literal,self).__init__()
-        self.match = matchString
-        self.matchLen = len(matchString)
-        try:
-            self.firstMatchChar = matchString[0]
-        except IndexError:
-            warnings.warn("null string passed to Literal; use Empty() instead",
-                            SyntaxWarning, stacklevel=2)
-            self.__class__ = Empty
-        self.name = '"%s"' % _ustr(self.match)
-        self.errmsg = "Expected " + self.name
-        self.mayReturnEmpty = False
-        self.mayIndexError = False
-
-    # Performance tuning: this routine gets called a *lot*
-    # if this is a single character match string  and the first character matches,
-    # short-circuit as quickly as possible, and avoid calling startswith
-    #~ @profile
-    def parseImpl( self, instring, loc, doActions=True ):
-        if (instring[loc] == self.firstMatchChar and
-            (self.matchLen==1 or instring.startswith(self.match,loc)) ):
-            return loc+self.matchLen, self.match
-        raise ParseException(instring, loc, self.errmsg, self)
-_L = Literal
-ParserElement._literalStringClass = Literal
-
-class Keyword(Token):
-    """
-    Token to exactly match a specified string as a keyword, that is, it must be
-    immediately followed by a non-keyword character.  Compare with C{L{Literal}}:
-     - C{Literal("if")} will match the leading C{'if'} in C{'ifAndOnlyIf'}.
-     - C{Keyword("if")} will not; it will only match the leading C{'if'} in C{'if x=1'}, or C{'if(y==2)'}
-    Accepts two optional constructor arguments in addition to the keyword string:
-     - C{identChars} is a string of characters that would be valid identifier characters,
-          defaulting to all alphanumerics + "_" and "$"
-     - C{caseless} allows case-insensitive matching, default is C{False}.
-       
-    Example::
-        Keyword("start").parseString("start")  # -> ['start']
-        Keyword("start").parseString("starting")  # -> Exception
-
-    For case-insensitive matching, use L{CaselessKeyword}.
-    """
-    DEFAULT_KEYWORD_CHARS = alphanums+"_$"
-
-    def __init__( self, matchString, identChars=None, caseless=False ):
-        super(Keyword,self).__init__()
-        if identChars is None:
-            identChars = Keyword.DEFAULT_KEYWORD_CHARS
-        self.match = matchString
-        self.matchLen = len(matchString)
-        try:
-            self.firstMatchChar = matchString[0]
-        except IndexError:
-            warnings.warn("null string passed to Keyword; use Empty() instead",
-                            SyntaxWarning, stacklevel=2)
-        self.name = '"%s"' % self.match
-        self.errmsg = "Expected " + self.name
-        self.mayReturnEmpty = False
-        self.mayIndexError = False
-        self.caseless = caseless
-        if caseless:
-            self.caselessmatch = matchString.upper()
-            identChars = identChars.upper()
-        self.identChars = set(identChars)
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.caseless:
-            if ( (instring[ loc:loc+self.matchLen ].upper() == self.caselessmatch) and
-                 (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen].upper() not in self.identChars) and
-                 (loc == 0 or instring[loc-1].upper() not in self.identChars) ):
-                return loc+self.matchLen, self.match
-        else:
-            if (instring[loc] == self.firstMatchChar and
-                (self.matchLen==1 or instring.startswith(self.match,loc)) and
-                (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen] not in self.identChars) and
-                (loc == 0 or instring[loc-1] not in self.identChars) ):
-                return loc+self.matchLen, self.match
-        raise ParseException(instring, loc, self.errmsg, self)
-
-    def copy(self):
-        c = super(Keyword,self).copy()
-        c.identChars = Keyword.DEFAULT_KEYWORD_CHARS
-        return c
-
-    @staticmethod
-    def setDefaultKeywordChars( chars ):
-        """Overrides the default Keyword chars
-        """
-        Keyword.DEFAULT_KEYWORD_CHARS = chars
-
-class CaselessLiteral(Literal):
-    """
-    Token to match a specified string, ignoring case of letters.
-    Note: the matched results will always be in the case of the given
-    match string, NOT the case of the input text.
-
-    Example::
-        OneOrMore(CaselessLiteral("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD', 'CMD']
-        
-    (Contrast with example for L{CaselessKeyword}.)
-    """
-    def __init__( self, matchString ):
-        super(CaselessLiteral,self).__init__( matchString.upper() )
-        # Preserve the defining literal.
-        self.returnString = matchString
-        self.name = "'%s'" % self.returnString
-        self.errmsg = "Expected " + self.name
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if instring[ loc:loc+self.matchLen ].upper() == self.match:
-            return loc+self.matchLen, self.returnString
-        raise ParseException(instring, loc, self.errmsg, self)
-
-class CaselessKeyword(Keyword):
-    """
-    Caseless version of L{Keyword}.
-
-    Example::
-        OneOrMore(CaselessKeyword("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD']
-        
-    (Contrast with example for L{CaselessLiteral}.)
-    """
-    def __init__( self, matchString, identChars=None ):
-        super(CaselessKeyword,self).__init__( matchString, identChars, caseless=True )
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if ( (instring[ loc:loc+self.matchLen ].upper() == self.caselessmatch) and
-             (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen].upper() not in self.identChars) ):
-            return loc+self.matchLen, self.match
-        raise ParseException(instring, loc, self.errmsg, self)
-
-class CloseMatch(Token):
-    """
-    A variation on L{Literal} which matches "close" matches, that is, 
-    strings with at most 'n' mismatching characters. C{CloseMatch} takes parameters:
-     - C{match_string} - string to be matched
-     - C{maxMismatches} - (C{default=1}) maximum number of mismatches allowed to count as a match
-    
-    The results from a successful parse will contain the matched text from the input string and the following named results:
-     - C{mismatches} - a list of the positions within the match_string where mismatches were found
-     - C{original} - the original match_string used to compare against the input string
-    
-    If C{mismatches} is an empty list, then the match was an exact match.
-    
-    Example::
-        patt = CloseMatch("ATCATCGAATGGA")
-        patt.parseString("ATCATCGAAXGGA") # -> (['ATCATCGAAXGGA'], {'mismatches': [[9]], 'original': ['ATCATCGAATGGA']})
-        patt.parseString("ATCAXCGAAXGGA") # -> Exception: Expected 'ATCATCGAATGGA' (with up to 1 mismatches) (at char 0), (line:1, col:1)
-
-        # exact match
-        patt.parseString("ATCATCGAATGGA") # -> (['ATCATCGAATGGA'], {'mismatches': [[]], 'original': ['ATCATCGAATGGA']})
-
-        # close match allowing up to 2 mismatches
-        patt = CloseMatch("ATCATCGAATGGA", maxMismatches=2)
-        patt.parseString("ATCAXCGAAXGGA") # -> (['ATCAXCGAAXGGA'], {'mismatches': [[4, 9]], 'original': ['ATCATCGAATGGA']})
-    """
-    def __init__(self, match_string, maxMismatches=1):
-        super(CloseMatch,self).__init__()
-        self.name = match_string
-        self.match_string = match_string
-        self.maxMismatches = maxMismatches
-        self.errmsg = "Expected %r (with up to %d mismatches)" % (self.match_string, self.maxMismatches)
-        self.mayIndexError = False
-        self.mayReturnEmpty = False
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        start = loc
-        instrlen = len(instring)
-        maxloc = start + len(self.match_string)
-
-        if maxloc <= instrlen:
-            match_string = self.match_string
-            match_stringloc = 0
-            mismatches = []
-            maxMismatches = self.maxMismatches
-
-            for match_stringloc,s_m in enumerate(zip(instring[loc:maxloc], self.match_string)):
-                src,mat = s_m
-                if src != mat:
-                    mismatches.append(match_stringloc)
-                    if len(mismatches) > maxMismatches:
-                        break
-            else:
-                loc = match_stringloc + 1
-                results = ParseResults([instring[start:loc]])
-                results['original'] = self.match_string
-                results['mismatches'] = mismatches
-                return loc, results
-
-        raise ParseException(instring, loc, self.errmsg, self)
-
-
-class Word(Token):
-    """
-    Token for matching words composed of allowed character sets.
-    Defined with string containing all allowed initial characters,
-    an optional string containing allowed body characters (if omitted,
-    defaults to the initial character set), and an optional minimum,
-    maximum, and/or exact length.  The default value for C{min} is 1 (a
-    minimum value < 1 is not valid); the default values for C{max} and C{exact}
-    are 0, meaning no maximum or exact length restriction. An optional
-    C{excludeChars} parameter can list characters that might be found in 
-    the input C{bodyChars} string; useful to define a word of all printables
-    except for one or two characters, for instance.
-    
-    L{srange} is useful for defining custom character set strings for defining 
-    C{Word} expressions, using range notation from regular expression character sets.
-    
-    A common mistake is to use C{Word} to match a specific literal string, as in 
-    C{Word("Address")}. Remember that C{Word} uses the string argument to define
-    I{sets} of matchable characters. This expression would match "Add", "AAA",
-    "dAred", or any other word made up of the characters 'A', 'd', 'r', 'e', and 's'.
-    To match an exact literal string, use L{Literal} or L{Keyword}.
-
-    pyparsing includes helper strings for building Words:
-     - L{alphas}
-     - L{nums}
-     - L{alphanums}
-     - L{hexnums}
-     - L{alphas8bit} (alphabetic characters in ASCII range 128-255 - accented, tilded, umlauted, etc.)
-     - L{punc8bit} (non-alphabetic characters in ASCII range 128-255 - currency, symbols, superscripts, diacriticals, etc.)
-     - L{printables} (any non-whitespace character)
-
-    Example::
-        # a word composed of digits
-        integer = Word(nums) # equivalent to Word("0123456789") or Word(srange("0-9"))
-        
-        # a word with a leading capital, and zero or more lowercase
-        capital_word = Word(alphas.upper(), alphas.lower())
-
-        # hostnames are alphanumeric, with leading alpha, and '-'
-        hostname = Word(alphas, alphanums+'-')
-        
-        # roman numeral (not a strict parser, accepts invalid mix of characters)
-        roman = Word("IVXLCDM")
-        
-        # any string of non-whitespace characters, except for ','
-        csv_value = Word(printables, excludeChars=",")
-    """
-    def __init__( self, initChars, bodyChars=None, min=1, max=0, exact=0, asKeyword=False, excludeChars=None ):
-        super(Word,self).__init__()
-        if excludeChars:
-            initChars = ''.join(c for c in initChars if c not in excludeChars)
-            if bodyChars:
-                bodyChars = ''.join(c for c in bodyChars if c not in excludeChars)
-        self.initCharsOrig = initChars
-        self.initChars = set(initChars)
-        if bodyChars :
-            self.bodyCharsOrig = bodyChars
-            self.bodyChars = set(bodyChars)
-        else:
-            self.bodyCharsOrig = initChars
-            self.bodyChars = set(initChars)
-
-        self.maxSpecified = max > 0
-
-        if min < 1:
-            raise ValueError("cannot specify a minimum length < 1; use Optional(Word()) if zero-length word is permitted")
-
-        self.minLen = min
-
-        if max > 0:
-            self.maxLen = max
-        else:
-            self.maxLen = _MAX_INT
-
-        if exact > 0:
-            self.maxLen = exact
-            self.minLen = exact
-
-        self.name = _ustr(self)
-        self.errmsg = "Expected " + self.name
-        self.mayIndexError = False
-        self.asKeyword = asKeyword
-
-        if ' ' not in self.initCharsOrig+self.bodyCharsOrig and (min==1 and max==0 and exact==0):
-            if self.bodyCharsOrig == self.initCharsOrig:
-                self.reString = "[%s]+" % _escapeRegexRangeChars(self.initCharsOrig)
-            elif len(self.initCharsOrig) == 1:
-                self.reString = "%s[%s]*" % \
-                                      (re.escape(self.initCharsOrig),
-                                      _escapeRegexRangeChars(self.bodyCharsOrig),)
-            else:
-                self.reString = "[%s][%s]*" % \
-                                      (_escapeRegexRangeChars(self.initCharsOrig),
-                                      _escapeRegexRangeChars(self.bodyCharsOrig),)
-            if self.asKeyword:
-                self.reString = r"\b"+self.reString+r"\b"
-            try:
-                self.re = re.compile( self.reString )
-            except Exception:
-                self.re = None
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.re:
-            result = self.re.match(instring,loc)
-            if not result:
-                raise ParseException(instring, loc, self.errmsg, self)
-
-            loc = result.end()
-            return loc, result.group()
-
-        if not(instring[ loc ] in self.initChars):
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        start = loc
-        loc += 1
-        instrlen = len(instring)
-        bodychars = self.bodyChars
-        maxloc = start + self.maxLen
-        maxloc = min( maxloc, instrlen )
-        while loc < maxloc and instring[loc] in bodychars:
-            loc += 1
-
-        throwException = False
-        if loc - start < self.minLen:
-            throwException = True
-        if self.maxSpecified and loc < instrlen and instring[loc] in bodychars:
-            throwException = True
-        if self.asKeyword:
-            if (start>0 and instring[start-1] in bodychars) or (loc4:
-                    return s[:4]+"..."
-                else:
-                    return s
-
-            if ( self.initCharsOrig != self.bodyCharsOrig ):
-                self.strRepr = "W:(%s,%s)" % ( charsAsStr(self.initCharsOrig), charsAsStr(self.bodyCharsOrig) )
-            else:
-                self.strRepr = "W:(%s)" % charsAsStr(self.initCharsOrig)
-
-        return self.strRepr
-
-
-class Regex(Token):
-    r"""
-    Token for matching strings that match a given regular expression.
-    Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module.
-    If the given regex contains named groups (defined using C{(?P...)}), these will be preserved as 
-    named parse results.
-
-    Example::
-        realnum = Regex(r"[+-]?\d+\.\d*")
-        date = Regex(r'(?P\d{4})-(?P\d\d?)-(?P\d\d?)')
-        # ref: http://stackoverflow.com/questions/267399/how-do-you-match-only-valid-roman-numerals-with-a-regular-expression
-        roman = Regex(r"M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})")
-    """
-    compiledREtype = type(re.compile("[A-Z]"))
-    def __init__( self, pattern, flags=0):
-        """The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags."""
-        super(Regex,self).__init__()
-
-        if isinstance(pattern, basestring):
-            if not pattern:
-                warnings.warn("null string passed to Regex; use Empty() instead",
-                        SyntaxWarning, stacklevel=2)
-
-            self.pattern = pattern
-            self.flags = flags
-
-            try:
-                self.re = re.compile(self.pattern, self.flags)
-                self.reString = self.pattern
-            except sre_constants.error:
-                warnings.warn("invalid pattern (%s) passed to Regex" % pattern,
-                    SyntaxWarning, stacklevel=2)
-                raise
-
-        elif isinstance(pattern, Regex.compiledREtype):
-            self.re = pattern
-            self.pattern = \
-            self.reString = str(pattern)
-            self.flags = flags
-            
-        else:
-            raise ValueError("Regex may only be constructed with a string or a compiled RE object")
-
-        self.name = _ustr(self)
-        self.errmsg = "Expected " + self.name
-        self.mayIndexError = False
-        self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        result = self.re.match(instring,loc)
-        if not result:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        loc = result.end()
-        d = result.groupdict()
-        ret = ParseResults(result.group())
-        if d:
-            for k in d:
-                ret[k] = d[k]
-        return loc,ret
-
-    def __str__( self ):
-        try:
-            return super(Regex,self).__str__()
-        except Exception:
-            pass
-
-        if self.strRepr is None:
-            self.strRepr = "Re:(%s)" % repr(self.pattern)
-
-        return self.strRepr
-
-
-class QuotedString(Token):
-    r"""
-    Token for matching strings that are delimited by quoting characters.
-    
-    Defined with the following parameters:
-        - quoteChar - string of one or more characters defining the quote delimiting string
-        - escChar - character to escape quotes, typically backslash (default=C{None})
-        - escQuote - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=C{None})
-        - multiline - boolean indicating whether quotes can span multiple lines (default=C{False})
-        - unquoteResults - boolean indicating whether the matched text should be unquoted (default=C{True})
-        - endQuoteChar - string of one or more characters defining the end of the quote delimited string (default=C{None} => same as quoteChar)
-        - convertWhitespaceEscapes - convert escaped whitespace (C{'\t'}, C{'\n'}, etc.) to actual whitespace (default=C{True})
-
-    Example::
-        qs = QuotedString('"')
-        print(qs.searchString('lsjdf "This is the quote" sldjf'))
-        complex_qs = QuotedString('{{', endQuoteChar='}}')
-        print(complex_qs.searchString('lsjdf {{This is the "quote"}} sldjf'))
-        sql_qs = QuotedString('"', escQuote='""')
-        print(sql_qs.searchString('lsjdf "This is the quote with ""embedded"" quotes" sldjf'))
-    prints::
-        [['This is the quote']]
-        [['This is the "quote"']]
-        [['This is the quote with "embedded" quotes']]
-    """
-    def __init__( self, quoteChar, escChar=None, escQuote=None, multiline=False, unquoteResults=True, endQuoteChar=None, convertWhitespaceEscapes=True):
-        super(QuotedString,self).__init__()
-
-        # remove white space from quote chars - wont work anyway
-        quoteChar = quoteChar.strip()
-        if not quoteChar:
-            warnings.warn("quoteChar cannot be the empty string",SyntaxWarning,stacklevel=2)
-            raise SyntaxError()
-
-        if endQuoteChar is None:
-            endQuoteChar = quoteChar
-        else:
-            endQuoteChar = endQuoteChar.strip()
-            if not endQuoteChar:
-                warnings.warn("endQuoteChar cannot be the empty string",SyntaxWarning,stacklevel=2)
-                raise SyntaxError()
-
-        self.quoteChar = quoteChar
-        self.quoteCharLen = len(quoteChar)
-        self.firstQuoteChar = quoteChar[0]
-        self.endQuoteChar = endQuoteChar
-        self.endQuoteCharLen = len(endQuoteChar)
-        self.escChar = escChar
-        self.escQuote = escQuote
-        self.unquoteResults = unquoteResults
-        self.convertWhitespaceEscapes = convertWhitespaceEscapes
-
-        if multiline:
-            self.flags = re.MULTILINE | re.DOTALL
-            self.pattern = r'%s(?:[^%s%s]' % \
-                ( re.escape(self.quoteChar),
-                  _escapeRegexRangeChars(self.endQuoteChar[0]),
-                  (escChar is not None and _escapeRegexRangeChars(escChar) or '') )
-        else:
-            self.flags = 0
-            self.pattern = r'%s(?:[^%s\n\r%s]' % \
-                ( re.escape(self.quoteChar),
-                  _escapeRegexRangeChars(self.endQuoteChar[0]),
-                  (escChar is not None and _escapeRegexRangeChars(escChar) or '') )
-        if len(self.endQuoteChar) > 1:
-            self.pattern += (
-                '|(?:' + ')|(?:'.join("%s[^%s]" % (re.escape(self.endQuoteChar[:i]),
-                                               _escapeRegexRangeChars(self.endQuoteChar[i]))
-                                    for i in range(len(self.endQuoteChar)-1,0,-1)) + ')'
-                )
-        if escQuote:
-            self.pattern += (r'|(?:%s)' % re.escape(escQuote))
-        if escChar:
-            self.pattern += (r'|(?:%s.)' % re.escape(escChar))
-            self.escCharReplacePattern = re.escape(self.escChar)+"(.)"
-        self.pattern += (r')*%s' % re.escape(self.endQuoteChar))
-
-        try:
-            self.re = re.compile(self.pattern, self.flags)
-            self.reString = self.pattern
-        except sre_constants.error:
-            warnings.warn("invalid pattern (%s) passed to Regex" % self.pattern,
-                SyntaxWarning, stacklevel=2)
-            raise
-
-        self.name = _ustr(self)
-        self.errmsg = "Expected " + self.name
-        self.mayIndexError = False
-        self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        result = instring[loc] == self.firstQuoteChar and self.re.match(instring,loc) or None
-        if not result:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        loc = result.end()
-        ret = result.group()
-
-        if self.unquoteResults:
-
-            # strip off quotes
-            ret = ret[self.quoteCharLen:-self.endQuoteCharLen]
-
-            if isinstance(ret,basestring):
-                # replace escaped whitespace
-                if '\\' in ret and self.convertWhitespaceEscapes:
-                    ws_map = {
-                        r'\t' : '\t',
-                        r'\n' : '\n',
-                        r'\f' : '\f',
-                        r'\r' : '\r',
-                    }
-                    for wslit,wschar in ws_map.items():
-                        ret = ret.replace(wslit, wschar)
-
-                # replace escaped characters
-                if self.escChar:
-                    ret = re.sub(self.escCharReplacePattern, r"\g<1>", ret)
-
-                # replace escaped quotes
-                if self.escQuote:
-                    ret = ret.replace(self.escQuote, self.endQuoteChar)
-
-        return loc, ret
-
-    def __str__( self ):
-        try:
-            return super(QuotedString,self).__str__()
-        except Exception:
-            pass
-
-        if self.strRepr is None:
-            self.strRepr = "quoted string, starting with %s ending with %s" % (self.quoteChar, self.endQuoteChar)
-
-        return self.strRepr
-
-
-class CharsNotIn(Token):
-    """
-    Token for matching words composed of characters I{not} in a given set (will
-    include whitespace in matched characters if not listed in the provided exclusion set - see example).
-    Defined with string containing all disallowed characters, and an optional
-    minimum, maximum, and/or exact length.  The default value for C{min} is 1 (a
-    minimum value < 1 is not valid); the default values for C{max} and C{exact}
-    are 0, meaning no maximum or exact length restriction.
-
-    Example::
-        # define a comma-separated-value as anything that is not a ','
-        csv_value = CharsNotIn(',')
-        print(delimitedList(csv_value).parseString("dkls,lsdkjf,s12 34,@!#,213"))
-    prints::
-        ['dkls', 'lsdkjf', 's12 34', '@!#', '213']
-    """
-    def __init__( self, notChars, min=1, max=0, exact=0 ):
-        super(CharsNotIn,self).__init__()
-        self.skipWhitespace = False
-        self.notChars = notChars
-
-        if min < 1:
-            raise ValueError("cannot specify a minimum length < 1; use Optional(CharsNotIn()) if zero-length char group is permitted")
-
-        self.minLen = min
-
-        if max > 0:
-            self.maxLen = max
-        else:
-            self.maxLen = _MAX_INT
-
-        if exact > 0:
-            self.maxLen = exact
-            self.minLen = exact
-
-        self.name = _ustr(self)
-        self.errmsg = "Expected " + self.name
-        self.mayReturnEmpty = ( self.minLen == 0 )
-        self.mayIndexError = False
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if instring[loc] in self.notChars:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        start = loc
-        loc += 1
-        notchars = self.notChars
-        maxlen = min( start+self.maxLen, len(instring) )
-        while loc < maxlen and \
-              (instring[loc] not in notchars):
-            loc += 1
-
-        if loc - start < self.minLen:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        return loc, instring[start:loc]
-
-    def __str__( self ):
-        try:
-            return super(CharsNotIn, self).__str__()
-        except Exception:
-            pass
-
-        if self.strRepr is None:
-            if len(self.notChars) > 4:
-                self.strRepr = "!W:(%s...)" % self.notChars[:4]
-            else:
-                self.strRepr = "!W:(%s)" % self.notChars
-
-        return self.strRepr
-
-class White(Token):
-    """
-    Special matching class for matching whitespace.  Normally, whitespace is ignored
-    by pyparsing grammars.  This class is included when some whitespace structures
-    are significant.  Define with a string containing the whitespace characters to be
-    matched; default is C{" \\t\\r\\n"}.  Also takes optional C{min}, C{max}, and C{exact} arguments,
-    as defined for the C{L{Word}} class.
-    """
-    whiteStrs = {
-        " " : "",
-        "\t": "",
-        "\n": "",
-        "\r": "",
-        "\f": "",
-        }
-    def __init__(self, ws=" \t\r\n", min=1, max=0, exact=0):
-        super(White,self).__init__()
-        self.matchWhite = ws
-        self.setWhitespaceChars( "".join(c for c in self.whiteChars if c not in self.matchWhite) )
-        #~ self.leaveWhitespace()
-        self.name = ("".join(White.whiteStrs[c] for c in self.matchWhite))
-        self.mayReturnEmpty = True
-        self.errmsg = "Expected " + self.name
-
-        self.minLen = min
-
-        if max > 0:
-            self.maxLen = max
-        else:
-            self.maxLen = _MAX_INT
-
-        if exact > 0:
-            self.maxLen = exact
-            self.minLen = exact
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if not(instring[ loc ] in self.matchWhite):
-            raise ParseException(instring, loc, self.errmsg, self)
-        start = loc
-        loc += 1
-        maxloc = start + self.maxLen
-        maxloc = min( maxloc, len(instring) )
-        while loc < maxloc and instring[loc] in self.matchWhite:
-            loc += 1
-
-        if loc - start < self.minLen:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        return loc, instring[start:loc]
-
-
-class _PositionToken(Token):
-    def __init__( self ):
-        super(_PositionToken,self).__init__()
-        self.name=self.__class__.__name__
-        self.mayReturnEmpty = True
-        self.mayIndexError = False
-
-class GoToColumn(_PositionToken):
-    """
-    Token to advance to a specific column of input text; useful for tabular report scraping.
-    """
-    def __init__( self, colno ):
-        super(GoToColumn,self).__init__()
-        self.col = colno
-
-    def preParse( self, instring, loc ):
-        if col(loc,instring) != self.col:
-            instrlen = len(instring)
-            if self.ignoreExprs:
-                loc = self._skipIgnorables( instring, loc )
-            while loc < instrlen and instring[loc].isspace() and col( loc, instring ) != self.col :
-                loc += 1
-        return loc
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        thiscol = col( loc, instring )
-        if thiscol > self.col:
-            raise ParseException( instring, loc, "Text not in expected column", self )
-        newloc = loc + self.col - thiscol
-        ret = instring[ loc: newloc ]
-        return newloc, ret
-
-
-class LineStart(_PositionToken):
-    """
-    Matches if current position is at the beginning of a line within the parse string
-    
-    Example::
-    
-        test = '''\
-        AAA this line
-        AAA and this line
-          AAA but not this one
-        B AAA and definitely not this one
-        '''
-
-        for t in (LineStart() + 'AAA' + restOfLine).searchString(test):
-            print(t)
-    
-    Prints::
-        ['AAA', ' this line']
-        ['AAA', ' and this line']    
-
-    """
-    def __init__( self ):
-        super(LineStart,self).__init__()
-        self.errmsg = "Expected start of line"
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if col(loc, instring) == 1:
-            return loc, []
-        raise ParseException(instring, loc, self.errmsg, self)
-
-class LineEnd(_PositionToken):
-    """
-    Matches if current position is at the end of a line within the parse string
-    """
-    def __init__( self ):
-        super(LineEnd,self).__init__()
-        self.setWhitespaceChars( ParserElement.DEFAULT_WHITE_CHARS.replace("\n","") )
-        self.errmsg = "Expected end of line"
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if loc len(instring):
-            return loc, []
-        else:
-            raise ParseException(instring, loc, self.errmsg, self)
-
-class WordStart(_PositionToken):
-    """
-    Matches if the current position is at the beginning of a Word, and
-    is not preceded by any character in a given set of C{wordChars}
-    (default=C{printables}). To emulate the C{\b} behavior of regular expressions,
-    use C{WordStart(alphanums)}. C{WordStart} will also match at the beginning of
-    the string being parsed, or at the beginning of a line.
-    """
-    def __init__(self, wordChars = printables):
-        super(WordStart,self).__init__()
-        self.wordChars = set(wordChars)
-        self.errmsg = "Not at the start of a word"
-
-    def parseImpl(self, instring, loc, doActions=True ):
-        if loc != 0:
-            if (instring[loc-1] in self.wordChars or
-                instring[loc] not in self.wordChars):
-                raise ParseException(instring, loc, self.errmsg, self)
-        return loc, []
-
-class WordEnd(_PositionToken):
-    """
-    Matches if the current position is at the end of a Word, and
-    is not followed by any character in a given set of C{wordChars}
-    (default=C{printables}). To emulate the C{\b} behavior of regular expressions,
-    use C{WordEnd(alphanums)}. C{WordEnd} will also match at the end of
-    the string being parsed, or at the end of a line.
-    """
-    def __init__(self, wordChars = printables):
-        super(WordEnd,self).__init__()
-        self.wordChars = set(wordChars)
-        self.skipWhitespace = False
-        self.errmsg = "Not at the end of a word"
-
-    def parseImpl(self, instring, loc, doActions=True ):
-        instrlen = len(instring)
-        if instrlen>0 and loc maxExcLoc:
-                    maxException = err
-                    maxExcLoc = err.loc
-            except IndexError:
-                if len(instring) > maxExcLoc:
-                    maxException = ParseException(instring,len(instring),e.errmsg,self)
-                    maxExcLoc = len(instring)
-            else:
-                # save match among all matches, to retry longest to shortest
-                matches.append((loc2, e))
-
-        if matches:
-            matches.sort(key=lambda x: -x[0])
-            for _,e in matches:
-                try:
-                    return e._parse( instring, loc, doActions )
-                except ParseException as err:
-                    err.__traceback__ = None
-                    if err.loc > maxExcLoc:
-                        maxException = err
-                        maxExcLoc = err.loc
-
-        if maxException is not None:
-            maxException.msg = self.errmsg
-            raise maxException
-        else:
-            raise ParseException(instring, loc, "no defined alternatives to match", self)
-
-
-    def __ixor__(self, other ):
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        return self.append( other ) #Or( [ self, other ] )
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "{" + " ^ ".join(_ustr(e) for e in self.exprs) + "}"
-
-        return self.strRepr
-
-    def checkRecursion( self, parseElementList ):
-        subRecCheckList = parseElementList[:] + [ self ]
-        for e in self.exprs:
-            e.checkRecursion( subRecCheckList )
-
-
-class MatchFirst(ParseExpression):
-    """
-    Requires that at least one C{ParseExpression} is found.
-    If two expressions match, the first one listed is the one that will match.
-    May be constructed using the C{'|'} operator.
-
-    Example::
-        # construct MatchFirst using '|' operator
-        
-        # watch the order of expressions to match
-        number = Word(nums) | Combine(Word(nums) + '.' + Word(nums))
-        print(number.searchString("123 3.1416 789")) #  Fail! -> [['123'], ['3'], ['1416'], ['789']]
-
-        # put more selective expression first
-        number = Combine(Word(nums) + '.' + Word(nums)) | Word(nums)
-        print(number.searchString("123 3.1416 789")) #  Better -> [['123'], ['3.1416'], ['789']]
-    """
-    def __init__( self, exprs, savelist = False ):
-        super(MatchFirst,self).__init__(exprs, savelist)
-        if self.exprs:
-            self.mayReturnEmpty = any(e.mayReturnEmpty for e in self.exprs)
-        else:
-            self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        maxExcLoc = -1
-        maxException = None
-        for e in self.exprs:
-            try:
-                ret = e._parse( instring, loc, doActions )
-                return ret
-            except ParseException as err:
-                if err.loc > maxExcLoc:
-                    maxException = err
-                    maxExcLoc = err.loc
-            except IndexError:
-                if len(instring) > maxExcLoc:
-                    maxException = ParseException(instring,len(instring),e.errmsg,self)
-                    maxExcLoc = len(instring)
-
-        # only got here if no expression matched, raise exception for match that made it the furthest
-        else:
-            if maxException is not None:
-                maxException.msg = self.errmsg
-                raise maxException
-            else:
-                raise ParseException(instring, loc, "no defined alternatives to match", self)
-
-    def __ior__(self, other ):
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass( other )
-        return self.append( other ) #MatchFirst( [ self, other ] )
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "{" + " | ".join(_ustr(e) for e in self.exprs) + "}"
-
-        return self.strRepr
-
-    def checkRecursion( self, parseElementList ):
-        subRecCheckList = parseElementList[:] + [ self ]
-        for e in self.exprs:
-            e.checkRecursion( subRecCheckList )
-
-
-class Each(ParseExpression):
-    """
-    Requires all given C{ParseExpression}s to be found, but in any order.
-    Expressions may be separated by whitespace.
-    May be constructed using the C{'&'} operator.
-
-    Example::
-        color = oneOf("RED ORANGE YELLOW GREEN BLUE PURPLE BLACK WHITE BROWN")
-        shape_type = oneOf("SQUARE CIRCLE TRIANGLE STAR HEXAGON OCTAGON")
-        integer = Word(nums)
-        shape_attr = "shape:" + shape_type("shape")
-        posn_attr = "posn:" + Group(integer("x") + ',' + integer("y"))("posn")
-        color_attr = "color:" + color("color")
-        size_attr = "size:" + integer("size")
-
-        # use Each (using operator '&') to accept attributes in any order 
-        # (shape and posn are required, color and size are optional)
-        shape_spec = shape_attr & posn_attr & Optional(color_attr) & Optional(size_attr)
-
-        shape_spec.runTests('''
-            shape: SQUARE color: BLACK posn: 100, 120
-            shape: CIRCLE size: 50 color: BLUE posn: 50,80
-            color:GREEN size:20 shape:TRIANGLE posn:20,40
-            '''
-            )
-    prints::
-        shape: SQUARE color: BLACK posn: 100, 120
-        ['shape:', 'SQUARE', 'color:', 'BLACK', 'posn:', ['100', ',', '120']]
-        - color: BLACK
-        - posn: ['100', ',', '120']
-          - x: 100
-          - y: 120
-        - shape: SQUARE
-
-
-        shape: CIRCLE size: 50 color: BLUE posn: 50,80
-        ['shape:', 'CIRCLE', 'size:', '50', 'color:', 'BLUE', 'posn:', ['50', ',', '80']]
-        - color: BLUE
-        - posn: ['50', ',', '80']
-          - x: 50
-          - y: 80
-        - shape: CIRCLE
-        - size: 50
-
-
-        color: GREEN size: 20 shape: TRIANGLE posn: 20,40
-        ['color:', 'GREEN', 'size:', '20', 'shape:', 'TRIANGLE', 'posn:', ['20', ',', '40']]
-        - color: GREEN
-        - posn: ['20', ',', '40']
-          - x: 20
-          - y: 40
-        - shape: TRIANGLE
-        - size: 20
-    """
-    def __init__( self, exprs, savelist = True ):
-        super(Each,self).__init__(exprs, savelist)
-        self.mayReturnEmpty = all(e.mayReturnEmpty for e in self.exprs)
-        self.skipWhitespace = True
-        self.initExprGroups = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.initExprGroups:
-            self.opt1map = dict((id(e.expr),e) for e in self.exprs if isinstance(e,Optional))
-            opt1 = [ e.expr for e in self.exprs if isinstance(e,Optional) ]
-            opt2 = [ e for e in self.exprs if e.mayReturnEmpty and not isinstance(e,Optional)]
-            self.optionals = opt1 + opt2
-            self.multioptionals = [ e.expr for e in self.exprs if isinstance(e,ZeroOrMore) ]
-            self.multirequired = [ e.expr for e in self.exprs if isinstance(e,OneOrMore) ]
-            self.required = [ e for e in self.exprs if not isinstance(e,(Optional,ZeroOrMore,OneOrMore)) ]
-            self.required += self.multirequired
-            self.initExprGroups = False
-        tmpLoc = loc
-        tmpReqd = self.required[:]
-        tmpOpt  = self.optionals[:]
-        matchOrder = []
-
-        keepMatching = True
-        while keepMatching:
-            tmpExprs = tmpReqd + tmpOpt + self.multioptionals + self.multirequired
-            failed = []
-            for e in tmpExprs:
-                try:
-                    tmpLoc = e.tryParse( instring, tmpLoc )
-                except ParseException:
-                    failed.append(e)
-                else:
-                    matchOrder.append(self.opt1map.get(id(e),e))
-                    if e in tmpReqd:
-                        tmpReqd.remove(e)
-                    elif e in tmpOpt:
-                        tmpOpt.remove(e)
-            if len(failed) == len(tmpExprs):
-                keepMatching = False
-
-        if tmpReqd:
-            missing = ", ".join(_ustr(e) for e in tmpReqd)
-            raise ParseException(instring,loc,"Missing one or more required elements (%s)" % missing )
-
-        # add any unmatched Optionals, in case they have default values defined
-        matchOrder += [e for e in self.exprs if isinstance(e,Optional) and e.expr in tmpOpt]
-
-        resultlist = []
-        for e in matchOrder:
-            loc,results = e._parse(instring,loc,doActions)
-            resultlist.append(results)
-
-        finalResults = sum(resultlist, ParseResults([]))
-        return loc, finalResults
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "{" + " & ".join(_ustr(e) for e in self.exprs) + "}"
-
-        return self.strRepr
-
-    def checkRecursion( self, parseElementList ):
-        subRecCheckList = parseElementList[:] + [ self ]
-        for e in self.exprs:
-            e.checkRecursion( subRecCheckList )
-
-
-class ParseElementEnhance(ParserElement):
-    """
-    Abstract subclass of C{ParserElement}, for combining and post-processing parsed tokens.
-    """
-    def __init__( self, expr, savelist=False ):
-        super(ParseElementEnhance,self).__init__(savelist)
-        if isinstance( expr, basestring ):
-            if issubclass(ParserElement._literalStringClass, Token):
-                expr = ParserElement._literalStringClass(expr)
-            else:
-                expr = ParserElement._literalStringClass(Literal(expr))
-        self.expr = expr
-        self.strRepr = None
-        if expr is not None:
-            self.mayIndexError = expr.mayIndexError
-            self.mayReturnEmpty = expr.mayReturnEmpty
-            self.setWhitespaceChars( expr.whiteChars )
-            self.skipWhitespace = expr.skipWhitespace
-            self.saveAsList = expr.saveAsList
-            self.callPreparse = expr.callPreparse
-            self.ignoreExprs.extend(expr.ignoreExprs)
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.expr is not None:
-            return self.expr._parse( instring, loc, doActions, callPreParse=False )
-        else:
-            raise ParseException("",loc,self.errmsg,self)
-
-    def leaveWhitespace( self ):
-        self.skipWhitespace = False
-        self.expr = self.expr.copy()
-        if self.expr is not None:
-            self.expr.leaveWhitespace()
-        return self
-
-    def ignore( self, other ):
-        if isinstance( other, Suppress ):
-            if other not in self.ignoreExprs:
-                super( ParseElementEnhance, self).ignore( other )
-                if self.expr is not None:
-                    self.expr.ignore( self.ignoreExprs[-1] )
-        else:
-            super( ParseElementEnhance, self).ignore( other )
-            if self.expr is not None:
-                self.expr.ignore( self.ignoreExprs[-1] )
-        return self
-
-    def streamline( self ):
-        super(ParseElementEnhance,self).streamline()
-        if self.expr is not None:
-            self.expr.streamline()
-        return self
-
-    def checkRecursion( self, parseElementList ):
-        if self in parseElementList:
-            raise RecursiveGrammarException( parseElementList+[self] )
-        subRecCheckList = parseElementList[:] + [ self ]
-        if self.expr is not None:
-            self.expr.checkRecursion( subRecCheckList )
-
-    def validate( self, validateTrace=[] ):
-        tmp = validateTrace[:]+[self]
-        if self.expr is not None:
-            self.expr.validate(tmp)
-        self.checkRecursion( [] )
-
-    def __str__( self ):
-        try:
-            return super(ParseElementEnhance,self).__str__()
-        except Exception:
-            pass
-
-        if self.strRepr is None and self.expr is not None:
-            self.strRepr = "%s:(%s)" % ( self.__class__.__name__, _ustr(self.expr) )
-        return self.strRepr
-
-
-class FollowedBy(ParseElementEnhance):
-    """
-    Lookahead matching of the given parse expression.  C{FollowedBy}
-    does I{not} advance the parsing position within the input string, it only
-    verifies that the specified parse expression matches at the current
-    position.  C{FollowedBy} always returns a null token list.
-
-    Example::
-        # use FollowedBy to match a label only if it is followed by a ':'
-        data_word = Word(alphas)
-        label = data_word + FollowedBy(':')
-        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
-        
-        OneOrMore(attr_expr).parseString("shape: SQUARE color: BLACK posn: upper left").pprint()
-    prints::
-        [['shape', 'SQUARE'], ['color', 'BLACK'], ['posn', 'upper left']]
-    """
-    def __init__( self, expr ):
-        super(FollowedBy,self).__init__(expr)
-        self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        self.expr.tryParse( instring, loc )
-        return loc, []
-
-
-class NotAny(ParseElementEnhance):
-    """
-    Lookahead to disallow matching with the given parse expression.  C{NotAny}
-    does I{not} advance the parsing position within the input string, it only
-    verifies that the specified parse expression does I{not} match at the current
-    position.  Also, C{NotAny} does I{not} skip over leading whitespace. C{NotAny}
-    always returns a null token list.  May be constructed using the '~' operator.
-
-    Example::
-        
-    """
-    def __init__( self, expr ):
-        super(NotAny,self).__init__(expr)
-        #~ self.leaveWhitespace()
-        self.skipWhitespace = False  # do NOT use self.leaveWhitespace(), don't want to propagate to exprs
-        self.mayReturnEmpty = True
-        self.errmsg = "Found unwanted token, "+_ustr(self.expr)
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        if self.expr.canParseNext(instring, loc):
-            raise ParseException(instring, loc, self.errmsg, self)
-        return loc, []
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "~{" + _ustr(self.expr) + "}"
-
-        return self.strRepr
-
-class _MultipleMatch(ParseElementEnhance):
-    def __init__( self, expr, stopOn=None):
-        super(_MultipleMatch, self).__init__(expr)
-        self.saveAsList = True
-        ender = stopOn
-        if isinstance(ender, basestring):
-            ender = ParserElement._literalStringClass(ender)
-        self.not_ender = ~ender if ender is not None else None
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        self_expr_parse = self.expr._parse
-        self_skip_ignorables = self._skipIgnorables
-        check_ender = self.not_ender is not None
-        if check_ender:
-            try_not_ender = self.not_ender.tryParse
-        
-        # must be at least one (but first see if we are the stopOn sentinel;
-        # if so, fail)
-        if check_ender:
-            try_not_ender(instring, loc)
-        loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )
-        try:
-            hasIgnoreExprs = (not not self.ignoreExprs)
-            while 1:
-                if check_ender:
-                    try_not_ender(instring, loc)
-                if hasIgnoreExprs:
-                    preloc = self_skip_ignorables( instring, loc )
-                else:
-                    preloc = loc
-                loc, tmptokens = self_expr_parse( instring, preloc, doActions )
-                if tmptokens or tmptokens.haskeys():
-                    tokens += tmptokens
-        except (ParseException,IndexError):
-            pass
-
-        return loc, tokens
-        
-class OneOrMore(_MultipleMatch):
-    """
-    Repetition of one or more of the given expression.
-    
-    Parameters:
-     - expr - expression that must match one or more times
-     - stopOn - (default=C{None}) - expression for a terminating sentinel
-          (only required if the sentinel would ordinarily match the repetition 
-          expression)          
-
-    Example::
-        data_word = Word(alphas)
-        label = data_word + FollowedBy(':')
-        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join))
-
-        text = "shape: SQUARE posn: upper left color: BLACK"
-        OneOrMore(attr_expr).parseString(text).pprint()  # Fail! read 'color' as data instead of next label -> [['shape', 'SQUARE color']]
-
-        # use stopOn attribute for OneOrMore to avoid reading label string as part of the data
-        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
-        OneOrMore(attr_expr).parseString(text).pprint() # Better -> [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'BLACK']]
-        
-        # could also be written as
-        (attr_expr * (1,)).parseString(text).pprint()
-    """
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "{" + _ustr(self.expr) + "}..."
-
-        return self.strRepr
-
-class ZeroOrMore(_MultipleMatch):
-    """
-    Optional repetition of zero or more of the given expression.
-    
-    Parameters:
-     - expr - expression that must match zero or more times
-     - stopOn - (default=C{None}) - expression for a terminating sentinel
-          (only required if the sentinel would ordinarily match the repetition 
-          expression)          
-
-    Example: similar to L{OneOrMore}
-    """
-    def __init__( self, expr, stopOn=None):
-        super(ZeroOrMore,self).__init__(expr, stopOn=stopOn)
-        self.mayReturnEmpty = True
-        
-    def parseImpl( self, instring, loc, doActions=True ):
-        try:
-            return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)
-        except (ParseException,IndexError):
-            return loc, []
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "[" + _ustr(self.expr) + "]..."
-
-        return self.strRepr
-
-class _NullToken(object):
-    def __bool__(self):
-        return False
-    __nonzero__ = __bool__
-    def __str__(self):
-        return ""
-
-_optionalNotMatched = _NullToken()
-class Optional(ParseElementEnhance):
-    """
-    Optional matching of the given expression.
-
-    Parameters:
-     - expr - expression that must match zero or more times
-     - default (optional) - value to be returned if the optional expression is not found.
-
-    Example::
-        # US postal code can be a 5-digit zip, plus optional 4-digit qualifier
-        zip = Combine(Word(nums, exact=5) + Optional('-' + Word(nums, exact=4)))
-        zip.runTests('''
-            # traditional ZIP code
-            12345
-            
-            # ZIP+4 form
-            12101-0001
-            
-            # invalid ZIP
-            98765-
-            ''')
-    prints::
-        # traditional ZIP code
-        12345
-        ['12345']
-
-        # ZIP+4 form
-        12101-0001
-        ['12101-0001']
-
-        # invalid ZIP
-        98765-
-             ^
-        FAIL: Expected end of text (at char 5), (line:1, col:6)
-    """
-    def __init__( self, expr, default=_optionalNotMatched ):
-        super(Optional,self).__init__( expr, savelist=False )
-        self.saveAsList = self.expr.saveAsList
-        self.defaultValue = default
-        self.mayReturnEmpty = True
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        try:
-            loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False )
-        except (ParseException,IndexError):
-            if self.defaultValue is not _optionalNotMatched:
-                if self.expr.resultsName:
-                    tokens = ParseResults([ self.defaultValue ])
-                    tokens[self.expr.resultsName] = self.defaultValue
-                else:
-                    tokens = [ self.defaultValue ]
-            else:
-                tokens = []
-        return loc, tokens
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-
-        if self.strRepr is None:
-            self.strRepr = "[" + _ustr(self.expr) + "]"
-
-        return self.strRepr
-
-class SkipTo(ParseElementEnhance):
-    """
-    Token for skipping over all undefined text until the matched expression is found.
-
-    Parameters:
-     - expr - target expression marking the end of the data to be skipped
-     - include - (default=C{False}) if True, the target expression is also parsed 
-          (the skipped text and target expression are returned as a 2-element list).
-     - ignore - (default=C{None}) used to define grammars (typically quoted strings and 
-          comments) that might contain false matches to the target expression
-     - failOn - (default=C{None}) define expressions that are not allowed to be 
-          included in the skipped test; if found before the target expression is found, 
-          the SkipTo is not a match
-
-    Example::
-        report = '''
-            Outstanding Issues Report - 1 Jan 2000
-
-               # | Severity | Description                               |  Days Open
-            -----+----------+-------------------------------------------+-----------
-             101 | Critical | Intermittent system crash                 |          6
-              94 | Cosmetic | Spelling error on Login ('log|n')         |         14
-              79 | Minor    | System slow when running too many reports |         47
-            '''
-        integer = Word(nums)
-        SEP = Suppress('|')
-        # use SkipTo to simply match everything up until the next SEP
-        # - ignore quoted strings, so that a '|' character inside a quoted string does not match
-        # - parse action will call token.strip() for each matched token, i.e., the description body
-        string_data = SkipTo(SEP, ignore=quotedString)
-        string_data.setParseAction(tokenMap(str.strip))
-        ticket_expr = (integer("issue_num") + SEP 
-                      + string_data("sev") + SEP 
-                      + string_data("desc") + SEP 
-                      + integer("days_open"))
-        
-        for tkt in ticket_expr.searchString(report):
-            print tkt.dump()
-    prints::
-        ['101', 'Critical', 'Intermittent system crash', '6']
-        - days_open: 6
-        - desc: Intermittent system crash
-        - issue_num: 101
-        - sev: Critical
-        ['94', 'Cosmetic', "Spelling error on Login ('log|n')", '14']
-        - days_open: 14
-        - desc: Spelling error on Login ('log|n')
-        - issue_num: 94
-        - sev: Cosmetic
-        ['79', 'Minor', 'System slow when running too many reports', '47']
-        - days_open: 47
-        - desc: System slow when running too many reports
-        - issue_num: 79
-        - sev: Minor
-    """
-    def __init__( self, other, include=False, ignore=None, failOn=None ):
-        super( SkipTo, self ).__init__( other )
-        self.ignoreExpr = ignore
-        self.mayReturnEmpty = True
-        self.mayIndexError = False
-        self.includeMatch = include
-        self.asList = False
-        if isinstance(failOn, basestring):
-            self.failOn = ParserElement._literalStringClass(failOn)
-        else:
-            self.failOn = failOn
-        self.errmsg = "No match found for "+_ustr(self.expr)
-
-    def parseImpl( self, instring, loc, doActions=True ):
-        startloc = loc
-        instrlen = len(instring)
-        expr = self.expr
-        expr_parse = self.expr._parse
-        self_failOn_canParseNext = self.failOn.canParseNext if self.failOn is not None else None
-        self_ignoreExpr_tryParse = self.ignoreExpr.tryParse if self.ignoreExpr is not None else None
-        
-        tmploc = loc
-        while tmploc <= instrlen:
-            if self_failOn_canParseNext is not None:
-                # break if failOn expression matches
-                if self_failOn_canParseNext(instring, tmploc):
-                    break
-                    
-            if self_ignoreExpr_tryParse is not None:
-                # advance past ignore expressions
-                while 1:
-                    try:
-                        tmploc = self_ignoreExpr_tryParse(instring, tmploc)
-                    except ParseBaseException:
-                        break
-            
-            try:
-                expr_parse(instring, tmploc, doActions=False, callPreParse=False)
-            except (ParseException, IndexError):
-                # no match, advance loc in string
-                tmploc += 1
-            else:
-                # matched skipto expr, done
-                break
-
-        else:
-            # ran off the end of the input string without matching skipto expr, fail
-            raise ParseException(instring, loc, self.errmsg, self)
-
-        # build up return values
-        loc = tmploc
-        skiptext = instring[startloc:loc]
-        skipresult = ParseResults(skiptext)
-        
-        if self.includeMatch:
-            loc, mat = expr_parse(instring,loc,doActions,callPreParse=False)
-            skipresult += mat
-
-        return loc, skipresult
-
-class Forward(ParseElementEnhance):
-    """
-    Forward declaration of an expression to be defined later -
-    used for recursive grammars, such as algebraic infix notation.
-    When the expression is known, it is assigned to the C{Forward} variable using the '<<' operator.
-
-    Note: take care when assigning to C{Forward} not to overlook precedence of operators.
-    Specifically, '|' has a lower precedence than '<<', so that::
-        fwdExpr << a | b | c
-    will actually be evaluated as::
-        (fwdExpr << a) | b | c
-    thereby leaving b and c out as parseable alternatives.  It is recommended that you
-    explicitly group the values inserted into the C{Forward}::
-        fwdExpr << (a | b | c)
-    Converting to use the '<<=' operator instead will avoid this problem.
-
-    See L{ParseResults.pprint} for an example of a recursive parser created using
-    C{Forward}.
-    """
-    def __init__( self, other=None ):
-        super(Forward,self).__init__( other, savelist=False )
-
-    def __lshift__( self, other ):
-        if isinstance( other, basestring ):
-            other = ParserElement._literalStringClass(other)
-        self.expr = other
-        self.strRepr = None
-        self.mayIndexError = self.expr.mayIndexError
-        self.mayReturnEmpty = self.expr.mayReturnEmpty
-        self.setWhitespaceChars( self.expr.whiteChars )
-        self.skipWhitespace = self.expr.skipWhitespace
-        self.saveAsList = self.expr.saveAsList
-        self.ignoreExprs.extend(self.expr.ignoreExprs)
-        return self
-        
-    def __ilshift__(self, other):
-        return self << other
-    
-    def leaveWhitespace( self ):
-        self.skipWhitespace = False
-        return self
-
-    def streamline( self ):
-        if not self.streamlined:
-            self.streamlined = True
-            if self.expr is not None:
-                self.expr.streamline()
-        return self
-
-    def validate( self, validateTrace=[] ):
-        if self not in validateTrace:
-            tmp = validateTrace[:]+[self]
-            if self.expr is not None:
-                self.expr.validate(tmp)
-        self.checkRecursion([])
-
-    def __str__( self ):
-        if hasattr(self,"name"):
-            return self.name
-        return self.__class__.__name__ + ": ..."
-
-        # stubbed out for now - creates awful memory and perf issues
-        self._revertClass = self.__class__
-        self.__class__ = _ForwardNoRecurse
-        try:
-            if self.expr is not None:
-                retString = _ustr(self.expr)
-            else:
-                retString = "None"
-        finally:
-            self.__class__ = self._revertClass
-        return self.__class__.__name__ + ": " + retString
-
-    def copy(self):
-        if self.expr is not None:
-            return super(Forward,self).copy()
-        else:
-            ret = Forward()
-            ret <<= self
-            return ret
-
-class _ForwardNoRecurse(Forward):
-    def __str__( self ):
-        return "..."
-
-class TokenConverter(ParseElementEnhance):
-    """
-    Abstract subclass of C{ParseExpression}, for converting parsed results.
-    """
-    def __init__( self, expr, savelist=False ):
-        super(TokenConverter,self).__init__( expr )#, savelist )
-        self.saveAsList = False
-
-class Combine(TokenConverter):
-    """
-    Converter to concatenate all matching tokens to a single string.
-    By default, the matching patterns must also be contiguous in the input string;
-    this can be disabled by specifying C{'adjacent=False'} in the constructor.
-
-    Example::
-        real = Word(nums) + '.' + Word(nums)
-        print(real.parseString('3.1416')) # -> ['3', '.', '1416']
-        # will also erroneously match the following
-        print(real.parseString('3. 1416')) # -> ['3', '.', '1416']
-
-        real = Combine(Word(nums) + '.' + Word(nums))
-        print(real.parseString('3.1416')) # -> ['3.1416']
-        # no match when there are internal spaces
-        print(real.parseString('3. 1416')) # -> Exception: Expected W:(0123...)
-    """
-    def __init__( self, expr, joinString="", adjacent=True ):
-        super(Combine,self).__init__( expr )
-        # suppress whitespace-stripping in contained parse expressions, but re-enable it on the Combine itself
-        if adjacent:
-            self.leaveWhitespace()
-        self.adjacent = adjacent
-        self.skipWhitespace = True
-        self.joinString = joinString
-        self.callPreparse = True
-
-    def ignore( self, other ):
-        if self.adjacent:
-            ParserElement.ignore(self, other)
-        else:
-            super( Combine, self).ignore( other )
-        return self
-
-    def postParse( self, instring, loc, tokenlist ):
-        retToks = tokenlist.copy()
-        del retToks[:]
-        retToks += ParseResults([ "".join(tokenlist._asStringList(self.joinString)) ], modal=self.modalResults)
-
-        if self.resultsName and retToks.haskeys():
-            return [ retToks ]
-        else:
-            return retToks
-
-class Group(TokenConverter):
-    """
-    Converter to return the matched tokens as a list - useful for returning tokens of C{L{ZeroOrMore}} and C{L{OneOrMore}} expressions.
-
-    Example::
-        ident = Word(alphas)
-        num = Word(nums)
-        term = ident | num
-        func = ident + Optional(delimitedList(term))
-        print(func.parseString("fn a,b,100"))  # -> ['fn', 'a', 'b', '100']
-
-        func = ident + Group(Optional(delimitedList(term)))
-        print(func.parseString("fn a,b,100"))  # -> ['fn', ['a', 'b', '100']]
-    """
-    def __init__( self, expr ):
-        super(Group,self).__init__( expr )
-        self.saveAsList = True
-
-    def postParse( self, instring, loc, tokenlist ):
-        return [ tokenlist ]
-
-class Dict(TokenConverter):
-    """
-    Converter to return a repetitive expression as a list, but also as a dictionary.
-    Each element can also be referenced using the first token in the expression as its key.
-    Useful for tabular report scraping when the first column can be used as a item key.
-
-    Example::
-        data_word = Word(alphas)
-        label = data_word + FollowedBy(':')
-        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join))
-
-        text = "shape: SQUARE posn: upper left color: light blue texture: burlap"
-        attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
-        
-        # print attributes as plain groups
-        print(OneOrMore(attr_expr).parseString(text).dump())
-        
-        # instead of OneOrMore(expr), parse using Dict(OneOrMore(Group(expr))) - Dict will auto-assign names
-        result = Dict(OneOrMore(Group(attr_expr))).parseString(text)
-        print(result.dump())
-        
-        # access named fields as dict entries, or output as dict
-        print(result['shape'])        
-        print(result.asDict())
-    prints::
-        ['shape', 'SQUARE', 'posn', 'upper left', 'color', 'light blue', 'texture', 'burlap']
-
-        [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']]
-        - color: light blue
-        - posn: upper left
-        - shape: SQUARE
-        - texture: burlap
-        SQUARE
-        {'color': 'light blue', 'posn': 'upper left', 'texture': 'burlap', 'shape': 'SQUARE'}
-    See more examples at L{ParseResults} of accessing fields by results name.
-    """
-    def __init__( self, expr ):
-        super(Dict,self).__init__( expr )
-        self.saveAsList = True
-
-    def postParse( self, instring, loc, tokenlist ):
-        for i,tok in enumerate(tokenlist):
-            if len(tok) == 0:
-                continue
-            ikey = tok[0]
-            if isinstance(ikey,int):
-                ikey = _ustr(tok[0]).strip()
-            if len(tok)==1:
-                tokenlist[ikey] = _ParseResultsWithOffset("",i)
-            elif len(tok)==2 and not isinstance(tok[1],ParseResults):
-                tokenlist[ikey] = _ParseResultsWithOffset(tok[1],i)
-            else:
-                dictvalue = tok.copy() #ParseResults(i)
-                del dictvalue[0]
-                if len(dictvalue)!= 1 or (isinstance(dictvalue,ParseResults) and dictvalue.haskeys()):
-                    tokenlist[ikey] = _ParseResultsWithOffset(dictvalue,i)
-                else:
-                    tokenlist[ikey] = _ParseResultsWithOffset(dictvalue[0],i)
-
-        if self.resultsName:
-            return [ tokenlist ]
-        else:
-            return tokenlist
-
-
-class Suppress(TokenConverter):
-    """
-    Converter for ignoring the results of a parsed expression.
-
-    Example::
-        source = "a, b, c,d"
-        wd = Word(alphas)
-        wd_list1 = wd + ZeroOrMore(',' + wd)
-        print(wd_list1.parseString(source))
-
-        # often, delimiters that are useful during parsing are just in the
-        # way afterward - use Suppress to keep them out of the parsed output
-        wd_list2 = wd + ZeroOrMore(Suppress(',') + wd)
-        print(wd_list2.parseString(source))
-    prints::
-        ['a', ',', 'b', ',', 'c', ',', 'd']
-        ['a', 'b', 'c', 'd']
-    (See also L{delimitedList}.)
-    """
-    def postParse( self, instring, loc, tokenlist ):
-        return []
-
-    def suppress( self ):
-        return self
-
-
-class OnlyOnce(object):
-    """
-    Wrapper for parse actions, to ensure they are only called once.
-    """
-    def __init__(self, methodCall):
-        self.callable = _trim_arity(methodCall)
-        self.called = False
-    def __call__(self,s,l,t):
-        if not self.called:
-            results = self.callable(s,l,t)
-            self.called = True
-            return results
-        raise ParseException(s,l,"")
-    def reset(self):
-        self.called = False
-
-def traceParseAction(f):
-    """
-    Decorator for debugging parse actions. 
-    
-    When the parse action is called, this decorator will print C{">> entering I{method-name}(line:I{current_source_line}, I{parse_location}, I{matched_tokens})".}
-    When the parse action completes, the decorator will print C{"<<"} followed by the returned value, or any exception that the parse action raised.
-
-    Example::
-        wd = Word(alphas)
-
-        @traceParseAction
-        def remove_duplicate_chars(tokens):
-            return ''.join(sorted(set(''.join(tokens))))
-
-        wds = OneOrMore(wd).setParseAction(remove_duplicate_chars)
-        print(wds.parseString("slkdjs sld sldd sdlf sdljf"))
-    prints::
-        >>entering remove_duplicate_chars(line: 'slkdjs sld sldd sdlf sdljf', 0, (['slkdjs', 'sld', 'sldd', 'sdlf', 'sdljf'], {}))
-        <3:
-            thisFunc = paArgs[0].__class__.__name__ + '.' + thisFunc
-        sys.stderr.write( ">>entering %s(line: '%s', %d, %r)\n" % (thisFunc,line(l,s),l,t) )
-        try:
-            ret = f(*paArgs)
-        except Exception as exc:
-            sys.stderr.write( "< ['aa', 'bb', 'cc']
-        delimitedList(Word(hexnums), delim=':', combine=True).parseString("AA:BB:CC:DD:EE") # -> ['AA:BB:CC:DD:EE']
-    """
-    dlName = _ustr(expr)+" ["+_ustr(delim)+" "+_ustr(expr)+"]..."
-    if combine:
-        return Combine( expr + ZeroOrMore( delim + expr ) ).setName(dlName)
-    else:
-        return ( expr + ZeroOrMore( Suppress( delim ) + expr ) ).setName(dlName)
-
-def countedArray( expr, intExpr=None ):
-    """
-    Helper to define a counted list of expressions.
-    This helper defines a pattern of the form::
-        integer expr expr expr...
-    where the leading integer tells how many expr expressions follow.
-    The matched tokens returns the array of expr tokens as a list - the leading count token is suppressed.
-    
-    If C{intExpr} is specified, it should be a pyparsing expression that produces an integer value.
-
-    Example::
-        countedArray(Word(alphas)).parseString('2 ab cd ef')  # -> ['ab', 'cd']
-
-        # in this parser, the leading integer value is given in binary,
-        # '10' indicating that 2 values are in the array
-        binaryConstant = Word('01').setParseAction(lambda t: int(t[0], 2))
-        countedArray(Word(alphas), intExpr=binaryConstant).parseString('10 ab cd ef')  # -> ['ab', 'cd']
-    """
-    arrayExpr = Forward()
-    def countFieldParseAction(s,l,t):
-        n = t[0]
-        arrayExpr << (n and Group(And([expr]*n)) or Group(empty))
-        return []
-    if intExpr is None:
-        intExpr = Word(nums).setParseAction(lambda t:int(t[0]))
-    else:
-        intExpr = intExpr.copy()
-    intExpr.setName("arrayLen")
-    intExpr.addParseAction(countFieldParseAction, callDuringTry=True)
-    return ( intExpr + arrayExpr ).setName('(len) ' + _ustr(expr) + '...')
-
-def _flatten(L):
-    ret = []
-    for i in L:
-        if isinstance(i,list):
-            ret.extend(_flatten(i))
-        else:
-            ret.append(i)
-    return ret
-
-def matchPreviousLiteral(expr):
-    """
-    Helper to define an expression that is indirectly defined from
-    the tokens matched in a previous expression, that is, it looks
-    for a 'repeat' of a previous expression.  For example::
-        first = Word(nums)
-        second = matchPreviousLiteral(first)
-        matchExpr = first + ":" + second
-    will match C{"1:1"}, but not C{"1:2"}.  Because this matches a
-    previous literal, will also match the leading C{"1:1"} in C{"1:10"}.
-    If this is not desired, use C{matchPreviousExpr}.
-    Do I{not} use with packrat parsing enabled.
-    """
-    rep = Forward()
-    def copyTokenToRepeater(s,l,t):
-        if t:
-            if len(t) == 1:
-                rep << t[0]
-            else:
-                # flatten t tokens
-                tflat = _flatten(t.asList())
-                rep << And(Literal(tt) for tt in tflat)
-        else:
-            rep << Empty()
-    expr.addParseAction(copyTokenToRepeater, callDuringTry=True)
-    rep.setName('(prev) ' + _ustr(expr))
-    return rep
-
-def matchPreviousExpr(expr):
-    """
-    Helper to define an expression that is indirectly defined from
-    the tokens matched in a previous expression, that is, it looks
-    for a 'repeat' of a previous expression.  For example::
-        first = Word(nums)
-        second = matchPreviousExpr(first)
-        matchExpr = first + ":" + second
-    will match C{"1:1"}, but not C{"1:2"}.  Because this matches by
-    expressions, will I{not} match the leading C{"1:1"} in C{"1:10"};
-    the expressions are evaluated first, and then compared, so
-    C{"1"} is compared with C{"10"}.
-    Do I{not} use with packrat parsing enabled.
-    """
-    rep = Forward()
-    e2 = expr.copy()
-    rep <<= e2
-    def copyTokenToRepeater(s,l,t):
-        matchTokens = _flatten(t.asList())
-        def mustMatchTheseTokens(s,l,t):
-            theseTokens = _flatten(t.asList())
-            if  theseTokens != matchTokens:
-                raise ParseException("",0,"")
-        rep.setParseAction( mustMatchTheseTokens, callDuringTry=True )
-    expr.addParseAction(copyTokenToRepeater, callDuringTry=True)
-    rep.setName('(prev) ' + _ustr(expr))
-    return rep
-
-def _escapeRegexRangeChars(s):
-    #~  escape these chars: ^-]
-    for c in r"\^-]":
-        s = s.replace(c,_bslash+c)
-    s = s.replace("\n",r"\n")
-    s = s.replace("\t",r"\t")
-    return _ustr(s)
-
-def oneOf( strs, caseless=False, useRegex=True ):
-    """
-    Helper to quickly define a set of alternative Literals, and makes sure to do
-    longest-first testing when there is a conflict, regardless of the input order,
-    but returns a C{L{MatchFirst}} for best performance.
-
-    Parameters:
-     - strs - a string of space-delimited literals, or a collection of string literals
-     - caseless - (default=C{False}) - treat all literals as caseless
-     - useRegex - (default=C{True}) - as an optimization, will generate a Regex
-          object; otherwise, will generate a C{MatchFirst} object (if C{caseless=True}, or
-          if creating a C{Regex} raises an exception)
-
-    Example::
-        comp_oper = oneOf("< = > <= >= !=")
-        var = Word(alphas)
-        number = Word(nums)
-        term = var | number
-        comparison_expr = term + comp_oper + term
-        print(comparison_expr.searchString("B = 12  AA=23 B<=AA AA>12"))
-    prints::
-        [['B', '=', '12'], ['AA', '=', '23'], ['B', '<=', 'AA'], ['AA', '>', '12']]
-    """
-    if caseless:
-        isequal = ( lambda a,b: a.upper() == b.upper() )
-        masks = ( lambda a,b: b.upper().startswith(a.upper()) )
-        parseElementClass = CaselessLiteral
-    else:
-        isequal = ( lambda a,b: a == b )
-        masks = ( lambda a,b: b.startswith(a) )
-        parseElementClass = Literal
-
-    symbols = []
-    if isinstance(strs,basestring):
-        symbols = strs.split()
-    elif isinstance(strs, Iterable):
-        symbols = list(strs)
-    else:
-        warnings.warn("Invalid argument to oneOf, expected string or iterable",
-                SyntaxWarning, stacklevel=2)
-    if not symbols:
-        return NoMatch()
-
-    i = 0
-    while i < len(symbols)-1:
-        cur = symbols[i]
-        for j,other in enumerate(symbols[i+1:]):
-            if ( isequal(other, cur) ):
-                del symbols[i+j+1]
-                break
-            elif ( masks(cur, other) ):
-                del symbols[i+j+1]
-                symbols.insert(i,other)
-                cur = other
-                break
-        else:
-            i += 1
-
-    if not caseless and useRegex:
-        #~ print (strs,"->", "|".join( [ _escapeRegexChars(sym) for sym in symbols] ))
-        try:
-            if len(symbols)==len("".join(symbols)):
-                return Regex( "[%s]" % "".join(_escapeRegexRangeChars(sym) for sym in symbols) ).setName(' | '.join(symbols))
-            else:
-                return Regex( "|".join(re.escape(sym) for sym in symbols) ).setName(' | '.join(symbols))
-        except Exception:
-            warnings.warn("Exception creating Regex for oneOf, building MatchFirst",
-                    SyntaxWarning, stacklevel=2)
-
-
-    # last resort, just use MatchFirst
-    return MatchFirst(parseElementClass(sym) for sym in symbols).setName(' | '.join(symbols))
-
-def dictOf( key, value ):
-    """
-    Helper to easily and clearly define a dictionary by specifying the respective patterns
-    for the key and value.  Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens
-    in the proper order.  The key pattern can include delimiting markers or punctuation,
-    as long as they are suppressed, thereby leaving the significant key text.  The value
-    pattern can include named results, so that the C{Dict} results can include named token
-    fields.
-
-    Example::
-        text = "shape: SQUARE posn: upper left color: light blue texture: burlap"
-        attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
-        print(OneOrMore(attr_expr).parseString(text).dump())
-        
-        attr_label = label
-        attr_value = Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)
-
-        # similar to Dict, but simpler call format
-        result = dictOf(attr_label, attr_value).parseString(text)
-        print(result.dump())
-        print(result['shape'])
-        print(result.shape)  # object attribute access works too
-        print(result.asDict())
-    prints::
-        [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']]
-        - color: light blue
-        - posn: upper left
-        - shape: SQUARE
-        - texture: burlap
-        SQUARE
-        SQUARE
-        {'color': 'light blue', 'shape': 'SQUARE', 'posn': 'upper left', 'texture': 'burlap'}
-    """
-    return Dict( ZeroOrMore( Group ( key + value ) ) )
-
-def originalTextFor(expr, asString=True):
-    """
-    Helper to return the original, untokenized text for a given expression.  Useful to
-    restore the parsed fields of an HTML start tag into the raw tag text itself, or to
-    revert separate tokens with intervening whitespace back to the original matching
-    input text. By default, returns astring containing the original parsed text.  
-       
-    If the optional C{asString} argument is passed as C{False}, then the return value is a 
-    C{L{ParseResults}} containing any results names that were originally matched, and a 
-    single token containing the original matched text from the input string.  So if 
-    the expression passed to C{L{originalTextFor}} contains expressions with defined
-    results names, you must set C{asString} to C{False} if you want to preserve those
-    results name values.
-
-    Example::
-        src = "this is test  bold text  normal text "
-        for tag in ("b","i"):
-            opener,closer = makeHTMLTags(tag)
-            patt = originalTextFor(opener + SkipTo(closer) + closer)
-            print(patt.searchString(src)[0])
-    prints::
-        [' bold text ']
-        ['text']
-    """
-    locMarker = Empty().setParseAction(lambda s,loc,t: loc)
-    endlocMarker = locMarker.copy()
-    endlocMarker.callPreparse = False
-    matchExpr = locMarker("_original_start") + expr + endlocMarker("_original_end")
-    if asString:
-        extractText = lambda s,l,t: s[t._original_start:t._original_end]
-    else:
-        def extractText(s,l,t):
-            t[:] = [s[t.pop('_original_start'):t.pop('_original_end')]]
-    matchExpr.setParseAction(extractText)
-    matchExpr.ignoreExprs = expr.ignoreExprs
-    return matchExpr
-
-def ungroup(expr): 
-    """
-    Helper to undo pyparsing's default grouping of And expressions, even
-    if all but one are non-empty.
-    """
-    return TokenConverter(expr).setParseAction(lambda t:t[0])
-
-def locatedExpr(expr):
-    """
-    Helper to decorate a returned token with its starting and ending locations in the input string.
-    This helper adds the following results names:
-     - locn_start = location where matched expression begins
-     - locn_end = location where matched expression ends
-     - value = the actual parsed results
-
-    Be careful if the input text contains C{} characters, you may want to call
-    C{L{ParserElement.parseWithTabs}}
-
-    Example::
-        wd = Word(alphas)
-        for match in locatedExpr(wd).searchString("ljsdf123lksdjjf123lkkjj1222"):
-            print(match)
-    prints::
-        [[0, 'ljsdf', 5]]
-        [[8, 'lksdjjf', 15]]
-        [[18, 'lkkjj', 23]]
-    """
-    locator = Empty().setParseAction(lambda s,l,t: l)
-    return Group(locator("locn_start") + expr("value") + locator.copy().leaveWhitespace()("locn_end"))
-
-
-# convenience constants for positional expressions
-empty       = Empty().setName("empty")
-lineStart   = LineStart().setName("lineStart")
-lineEnd     = LineEnd().setName("lineEnd")
-stringStart = StringStart().setName("stringStart")
-stringEnd   = StringEnd().setName("stringEnd")
-
-_escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1])
-_escapedHexChar = Regex(r"\\0?[xX][0-9a-fA-F]+").setParseAction(lambda s,l,t:unichr(int(t[0].lstrip(r'\0x'),16)))
-_escapedOctChar = Regex(r"\\0[0-7]+").setParseAction(lambda s,l,t:unichr(int(t[0][1:],8)))
-_singleChar = _escapedPunc | _escapedHexChar | _escapedOctChar | CharsNotIn(r'\]', exact=1)
-_charRange = Group(_singleChar + Suppress("-") + _singleChar)
-_reBracketExpr = Literal("[") + Optional("^").setResultsName("negate") + Group( OneOrMore( _charRange | _singleChar ) ).setResultsName("body") + "]"
-
-def srange(s):
-    r"""
-    Helper to easily define string ranges for use in Word construction.  Borrows
-    syntax from regexp '[]' string range definitions::
-        srange("[0-9]")   -> "0123456789"
-        srange("[a-z]")   -> "abcdefghijklmnopqrstuvwxyz"
-        srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
-    The input string must be enclosed in []'s, and the returned string is the expanded
-    character set joined into a single string.
-    The values enclosed in the []'s may be:
-     - a single character
-     - an escaped character with a leading backslash (such as C{\-} or C{\]})
-     - an escaped hex character with a leading C{'\x'} (C{\x21}, which is a C{'!'} character) 
-         (C{\0x##} is also supported for backwards compatibility) 
-     - an escaped octal character with a leading C{'\0'} (C{\041}, which is a C{'!'} character)
-     - a range of any of the above, separated by a dash (C{'a-z'}, etc.)
-     - any combination of the above (C{'aeiouy'}, C{'a-zA-Z0-9_$'}, etc.)
-    """
-    _expanded = lambda p: p if not isinstance(p,ParseResults) else ''.join(unichr(c) for c in range(ord(p[0]),ord(p[1])+1))
-    try:
-        return "".join(_expanded(part) for part in _reBracketExpr.parseString(s).body)
-    except Exception:
-        return ""
-
-def matchOnlyAtCol(n):
-    """
-    Helper method for defining parse actions that require matching at a specific
-    column in the input text.
-    """
-    def verifyCol(strg,locn,toks):
-        if col(locn,strg) != n:
-            raise ParseException(strg,locn,"matched token not at column %d" % n)
-    return verifyCol
-
-def replaceWith(replStr):
-    """
-    Helper method for common parse actions that simply return a literal value.  Especially
-    useful when used with C{L{transformString}()}.
-
-    Example::
-        num = Word(nums).setParseAction(lambda toks: int(toks[0]))
-        na = oneOf("N/A NA").setParseAction(replaceWith(math.nan))
-        term = na | num
-        
-        OneOrMore(term).parseString("324 234 N/A 234") # -> [324, 234, nan, 234]
-    """
-    return lambda s,l,t: [replStr]
-
-def removeQuotes(s,l,t):
-    """
-    Helper parse action for removing quotation marks from parsed quoted strings.
-
-    Example::
-        # by default, quotation marks are included in parsed results
-        quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]
-
-        # use removeQuotes to strip quotation marks from parsed results
-        quotedString.setParseAction(removeQuotes)
-        quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["Now is the Winter of our Discontent"]
-    """
-    return t[0][1:-1]
-
-def tokenMap(func, *args):
-    """
-    Helper to define a parse action by mapping a function to all elements of a ParseResults list.If any additional 
-    args are passed, they are forwarded to the given function as additional arguments after
-    the token, as in C{hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))}, which will convert the
-    parsed data to an integer using base 16.
-
-    Example (compare the last to example in L{ParserElement.transformString}::
-        hex_ints = OneOrMore(Word(hexnums)).setParseAction(tokenMap(int, 16))
-        hex_ints.runTests('''
-            00 11 22 aa FF 0a 0d 1a
-            ''')
-        
-        upperword = Word(alphas).setParseAction(tokenMap(str.upper))
-        OneOrMore(upperword).runTests('''
-            my kingdom for a horse
-            ''')
-
-        wd = Word(alphas).setParseAction(tokenMap(str.title))
-        OneOrMore(wd).setParseAction(' '.join).runTests('''
-            now is the winter of our discontent made glorious summer by this sun of york
-            ''')
-    prints::
-        00 11 22 aa FF 0a 0d 1a
-        [0, 17, 34, 170, 255, 10, 13, 26]
-
-        my kingdom for a horse
-        ['MY', 'KINGDOM', 'FOR', 'A', 'HORSE']
-
-        now is the winter of our discontent made glorious summer by this sun of york
-        ['Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York']
-    """
-    def pa(s,l,t):
-        return [func(tokn, *args) for tokn in t]
-
-    try:
-        func_name = getattr(func, '__name__', 
-                            getattr(func, '__class__').__name__)
-    except Exception:
-        func_name = str(func)
-    pa.__name__ = func_name
-
-    return pa
-
-upcaseTokens = tokenMap(lambda t: _ustr(t).upper())
-"""(Deprecated) Helper parse action to convert tokens to upper case. Deprecated in favor of L{pyparsing_common.upcaseTokens}"""
-
-downcaseTokens = tokenMap(lambda t: _ustr(t).lower())
-"""(Deprecated) Helper parse action to convert tokens to lower case. Deprecated in favor of L{pyparsing_common.downcaseTokens}"""
-    
-def _makeTags(tagStr, xml):
-    """Internal helper to construct opening and closing tag expressions, given a tag name"""
-    if isinstance(tagStr,basestring):
-        resname = tagStr
-        tagStr = Keyword(tagStr, caseless=not xml)
-    else:
-        resname = tagStr.name
-
-    tagAttrName = Word(alphas,alphanums+"_-:")
-    if (xml):
-        tagAttrValue = dblQuotedString.copy().setParseAction( removeQuotes )
-        openTag = Suppress("<") + tagStr("tag") + \
-                Dict(ZeroOrMore(Group( tagAttrName + Suppress("=") + tagAttrValue ))) + \
-                Optional("/",default=[False]).setResultsName("empty").setParseAction(lambda s,l,t:t[0]=='/') + Suppress(">")
-    else:
-        printablesLessRAbrack = "".join(c for c in printables if c not in ">")
-        tagAttrValue = quotedString.copy().setParseAction( removeQuotes ) | Word(printablesLessRAbrack)
-        openTag = Suppress("<") + tagStr("tag") + \
-                Dict(ZeroOrMore(Group( tagAttrName.setParseAction(downcaseTokens) + \
-                Optional( Suppress("=") + tagAttrValue ) ))) + \
-                Optional("/",default=[False]).setResultsName("empty").setParseAction(lambda s,l,t:t[0]=='/') + Suppress(">")
-    closeTag = Combine(_L("")
-
-    openTag = openTag.setResultsName("start"+"".join(resname.replace(":"," ").title().split())).setName("<%s>" % resname)
-    closeTag = closeTag.setResultsName("end"+"".join(resname.replace(":"," ").title().split())).setName("" % resname)
-    openTag.tag = resname
-    closeTag.tag = resname
-    return openTag, closeTag
-
-def makeHTMLTags(tagStr):
-    """
-    Helper to construct opening and closing tag expressions for HTML, given a tag name. Matches
-    tags in either upper or lower case, attributes with namespaces and with quoted or unquoted values.
-
-    Example::
-        text = 'More info at the pyparsing wiki page'
-        # makeHTMLTags returns pyparsing expressions for the opening and closing tags as a 2-tuple
-        a,a_end = makeHTMLTags("A")
-        link_expr = a + SkipTo(a_end)("link_text") + a_end
-        
-        for link in link_expr.searchString(text):
-            # attributes in the  tag (like "href" shown here) are also accessible as named results
-            print(link.link_text, '->', link.href)
-    prints::
-        pyparsing -> http://pyparsing.wikispaces.com
-    """
-    return _makeTags( tagStr, False )
-
-def makeXMLTags(tagStr):
-    """
-    Helper to construct opening and closing tag expressions for XML, given a tag name. Matches
-    tags only in the given upper/lower case.
-
-    Example: similar to L{makeHTMLTags}
-    """
-    return _makeTags( tagStr, True )
-
-def withAttribute(*args,**attrDict):
-    """
-    Helper to create a validating parse action to be used with start tags created
-    with C{L{makeXMLTags}} or C{L{makeHTMLTags}}. Use C{withAttribute} to qualify a starting tag
-    with a required attribute value, to avoid false matches on common tags such as
-    C{} or C{
}. - - Call C{withAttribute} with a series of attribute names and values. Specify the list - of filter attributes names and values as: - - keyword arguments, as in C{(align="right")}, or - - as an explicit dict with C{**} operator, when an attribute name is also a Python - reserved word, as in C{**{"class":"Customer", "align":"right"}} - - a list of name-value tuples, as in ( ("ns1:class", "Customer"), ("ns2:align","right") ) - For attribute names with a namespace prefix, you must use the second form. Attribute - names are matched insensitive to upper/lower case. - - If just testing for C{class} (with or without a namespace), use C{L{withClass}}. - - To verify that the attribute exists, but without specifying a value, pass - C{withAttribute.ANY_VALUE} as the value. - - Example:: - html = ''' -
- Some text -
1 4 0 1 0
-
1,3 2,3 1,1
-
this has no type
-
- - ''' - div,div_end = makeHTMLTags("div") - - # only match div tag having a type attribute with value "grid" - div_grid = div().setParseAction(withAttribute(type="grid")) - grid_expr = div_grid + SkipTo(div | div_end)("body") - for grid_header in grid_expr.searchString(html): - print(grid_header.body) - - # construct a match with any div tag having a type attribute, regardless of the value - div_any_type = div().setParseAction(withAttribute(type=withAttribute.ANY_VALUE)) - div_expr = div_any_type + SkipTo(div | div_end)("body") - for div_header in div_expr.searchString(html): - print(div_header.body) - prints:: - 1 4 0 1 0 - - 1 4 0 1 0 - 1,3 2,3 1,1 - """ - if args: - attrs = args[:] - else: - attrs = attrDict.items() - attrs = [(k,v) for k,v in attrs] - def pa(s,l,tokens): - for attrName,attrValue in attrs: - if attrName not in tokens: - raise ParseException(s,l,"no matching attribute " + attrName) - if attrValue != withAttribute.ANY_VALUE and tokens[attrName] != attrValue: - raise ParseException(s,l,"attribute '%s' has value '%s', must be '%s'" % - (attrName, tokens[attrName], attrValue)) - return pa -withAttribute.ANY_VALUE = object() - -def withClass(classname, namespace=''): - """ - Simplified version of C{L{withAttribute}} when matching on a div class - made - difficult because C{class} is a reserved word in Python. - - Example:: - html = ''' -
- Some text -
1 4 0 1 0
-
1,3 2,3 1,1
-
this <div> has no class
-
- - ''' - div,div_end = makeHTMLTags("div") - div_grid = div().setParseAction(withClass("grid")) - - grid_expr = div_grid + SkipTo(div | div_end)("body") - for grid_header in grid_expr.searchString(html): - print(grid_header.body) - - div_any_type = div().setParseAction(withClass(withAttribute.ANY_VALUE)) - div_expr = div_any_type + SkipTo(div | div_end)("body") - for div_header in div_expr.searchString(html): - print(div_header.body) - prints:: - 1 4 0 1 0 - - 1 4 0 1 0 - 1,3 2,3 1,1 - """ - classattr = "%s:class" % namespace if namespace else "class" - return withAttribute(**{classattr : classname}) - -opAssoc = _Constants() -opAssoc.LEFT = object() -opAssoc.RIGHT = object() - -def infixNotation( baseExpr, opList, lpar=Suppress('('), rpar=Suppress(')') ): - """ - Helper method for constructing grammars of expressions made up of - operators working in a precedence hierarchy. Operators may be unary or - binary, left- or right-associative. Parse actions can also be attached - to operator expressions. The generated parser will also recognize the use - of parentheses to override operator precedences (see example below). - - Note: if you define a deep operator list, you may see performance issues - when using infixNotation. See L{ParserElement.enablePackrat} for a - mechanism to potentially improve your parser performance. - - Parameters: - - baseExpr - expression representing the most basic element for the nested - - opList - list of tuples, one for each operator precedence level in the - expression grammar; each tuple is of the form - (opExpr, numTerms, rightLeftAssoc, parseAction), where: - - opExpr is the pyparsing expression for the operator; - may also be a string, which will be converted to a Literal; - if numTerms is 3, opExpr is a tuple of two expressions, for the - two operators separating the 3 terms - - numTerms is the number of terms for this operator (must - be 1, 2, or 3) - - rightLeftAssoc is the indicator whether the operator is - right or left associative, using the pyparsing-defined - constants C{opAssoc.RIGHT} and C{opAssoc.LEFT}. - - parseAction is the parse action to be associated with - expressions matching this operator expression (the - parse action tuple member may be omitted); if the parse action - is passed a tuple or list of functions, this is equivalent to - calling C{setParseAction(*fn)} (L{ParserElement.setParseAction}) - - lpar - expression for matching left-parentheses (default=C{Suppress('(')}) - - rpar - expression for matching right-parentheses (default=C{Suppress(')')}) - - Example:: - # simple example of four-function arithmetic with ints and variable names - integer = pyparsing_common.signed_integer - varname = pyparsing_common.identifier - - arith_expr = infixNotation(integer | varname, - [ - ('-', 1, opAssoc.RIGHT), - (oneOf('* /'), 2, opAssoc.LEFT), - (oneOf('+ -'), 2, opAssoc.LEFT), - ]) - - arith_expr.runTests(''' - 5+3*6 - (5+3)*6 - -2--11 - ''', fullDump=False) - prints:: - 5+3*6 - [[5, '+', [3, '*', 6]]] - - (5+3)*6 - [[[5, '+', 3], '*', 6]] - - -2--11 - [[['-', 2], '-', ['-', 11]]] - """ - ret = Forward() - lastExpr = baseExpr | ( lpar + ret + rpar ) - for i,operDef in enumerate(opList): - opExpr,arity,rightLeftAssoc,pa = (operDef + (None,))[:4] - termName = "%s term" % opExpr if arity < 3 else "%s%s term" % opExpr - if arity == 3: - if opExpr is None or len(opExpr) != 2: - raise ValueError("if numterms=3, opExpr must be a tuple or list of two expressions") - opExpr1, opExpr2 = opExpr - thisExpr = Forward().setName(termName) - if rightLeftAssoc == opAssoc.LEFT: - if arity == 1: - matchExpr = FollowedBy(lastExpr + opExpr) + Group( lastExpr + OneOrMore( opExpr ) ) - elif arity == 2: - if opExpr is not None: - matchExpr = FollowedBy(lastExpr + opExpr + lastExpr) + Group( lastExpr + OneOrMore( opExpr + lastExpr ) ) - else: - matchExpr = FollowedBy(lastExpr+lastExpr) + Group( lastExpr + OneOrMore(lastExpr) ) - elif arity == 3: - matchExpr = FollowedBy(lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr) + \ - Group( lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr ) - else: - raise ValueError("operator must be unary (1), binary (2), or ternary (3)") - elif rightLeftAssoc == opAssoc.RIGHT: - if arity == 1: - # try to avoid LR with this extra test - if not isinstance(opExpr, Optional): - opExpr = Optional(opExpr) - matchExpr = FollowedBy(opExpr.expr + thisExpr) + Group( opExpr + thisExpr ) - elif arity == 2: - if opExpr is not None: - matchExpr = FollowedBy(lastExpr + opExpr + thisExpr) + Group( lastExpr + OneOrMore( opExpr + thisExpr ) ) - else: - matchExpr = FollowedBy(lastExpr + thisExpr) + Group( lastExpr + OneOrMore( thisExpr ) ) - elif arity == 3: - matchExpr = FollowedBy(lastExpr + opExpr1 + thisExpr + opExpr2 + thisExpr) + \ - Group( lastExpr + opExpr1 + thisExpr + opExpr2 + thisExpr ) - else: - raise ValueError("operator must be unary (1), binary (2), or ternary (3)") - else: - raise ValueError("operator must indicate right or left associativity") - if pa: - if isinstance(pa, (tuple, list)): - matchExpr.setParseAction(*pa) - else: - matchExpr.setParseAction(pa) - thisExpr <<= ( matchExpr.setName(termName) | lastExpr ) - lastExpr = thisExpr - ret <<= lastExpr - return ret - -operatorPrecedence = infixNotation -"""(Deprecated) Former name of C{L{infixNotation}}, will be dropped in a future release.""" - -dblQuotedString = Combine(Regex(r'"(?:[^"\n\r\\]|(?:"")|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*')+'"').setName("string enclosed in double quotes") -sglQuotedString = Combine(Regex(r"'(?:[^'\n\r\\]|(?:'')|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*")+"'").setName("string enclosed in single quotes") -quotedString = Combine(Regex(r'"(?:[^"\n\r\\]|(?:"")|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*')+'"'| - Regex(r"'(?:[^'\n\r\\]|(?:'')|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*")+"'").setName("quotedString using single or double quotes") -unicodeString = Combine(_L('u') + quotedString.copy()).setName("unicode string literal") - -def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.copy()): - """ - Helper method for defining nested lists enclosed in opening and closing - delimiters ("(" and ")" are the default). - - Parameters: - - opener - opening character for a nested list (default=C{"("}); can also be a pyparsing expression - - closer - closing character for a nested list (default=C{")"}); can also be a pyparsing expression - - content - expression for items within the nested lists (default=C{None}) - - ignoreExpr - expression for ignoring opening and closing delimiters (default=C{quotedString}) - - If an expression is not provided for the content argument, the nested - expression will capture all whitespace-delimited content between delimiters - as a list of separate values. - - Use the C{ignoreExpr} argument to define expressions that may contain - opening or closing characters that should not be treated as opening - or closing characters for nesting, such as quotedString or a comment - expression. Specify multiple expressions using an C{L{Or}} or C{L{MatchFirst}}. - The default is L{quotedString}, but if no expressions are to be ignored, - then pass C{None} for this argument. - - Example:: - data_type = oneOf("void int short long char float double") - decl_data_type = Combine(data_type + Optional(Word('*'))) - ident = Word(alphas+'_', alphanums+'_') - number = pyparsing_common.number - arg = Group(decl_data_type + ident) - LPAR,RPAR = map(Suppress, "()") - - code_body = nestedExpr('{', '}', ignoreExpr=(quotedString | cStyleComment)) - - c_function = (decl_data_type("type") - + ident("name") - + LPAR + Optional(delimitedList(arg), [])("args") + RPAR - + code_body("body")) - c_function.ignore(cStyleComment) - - source_code = ''' - int is_odd(int x) { - return (x%2); - } - - int dec_to_hex(char hchar) { - if (hchar >= '0' && hchar <= '9') { - return (ord(hchar)-ord('0')); - } else { - return (10+ord(hchar)-ord('A')); - } - } - ''' - for func in c_function.searchString(source_code): - print("%(name)s (%(type)s) args: %(args)s" % func) - - prints:: - is_odd (int) args: [['int', 'x']] - dec_to_hex (int) args: [['char', 'hchar']] - """ - if opener == closer: - raise ValueError("opening and closing strings cannot be the same") - if content is None: - if isinstance(opener,basestring) and isinstance(closer,basestring): - if len(opener) == 1 and len(closer)==1: - if ignoreExpr is not None: - content = (Combine(OneOrMore(~ignoreExpr + - CharsNotIn(opener+closer+ParserElement.DEFAULT_WHITE_CHARS,exact=1)) - ).setParseAction(lambda t:t[0].strip())) - else: - content = (empty.copy()+CharsNotIn(opener+closer+ParserElement.DEFAULT_WHITE_CHARS - ).setParseAction(lambda t:t[0].strip())) - else: - if ignoreExpr is not None: - content = (Combine(OneOrMore(~ignoreExpr + - ~Literal(opener) + ~Literal(closer) + - CharsNotIn(ParserElement.DEFAULT_WHITE_CHARS,exact=1)) - ).setParseAction(lambda t:t[0].strip())) - else: - content = (Combine(OneOrMore(~Literal(opener) + ~Literal(closer) + - CharsNotIn(ParserElement.DEFAULT_WHITE_CHARS,exact=1)) - ).setParseAction(lambda t:t[0].strip())) - else: - raise ValueError("opening and closing arguments must be strings if no content expression is given") - ret = Forward() - if ignoreExpr is not None: - ret <<= Group( Suppress(opener) + ZeroOrMore( ignoreExpr | ret | content ) + Suppress(closer) ) - else: - ret <<= Group( Suppress(opener) + ZeroOrMore( ret | content ) + Suppress(closer) ) - ret.setName('nested %s%s expression' % (opener,closer)) - return ret - -def indentedBlock(blockStatementExpr, indentStack, indent=True): - """ - Helper method for defining space-delimited indentation blocks, such as - those used to define block statements in Python source code. - - Parameters: - - blockStatementExpr - expression defining syntax of statement that - is repeated within the indented block - - indentStack - list created by caller to manage indentation stack - (multiple statementWithIndentedBlock expressions within a single grammar - should share a common indentStack) - - indent - boolean indicating whether block must be indented beyond the - the current level; set to False for block of left-most statements - (default=C{True}) - - A valid block must contain at least one C{blockStatement}. - - Example:: - data = ''' - def A(z): - A1 - B = 100 - G = A2 - A2 - A3 - B - def BB(a,b,c): - BB1 - def BBA(): - bba1 - bba2 - bba3 - C - D - def spam(x,y): - def eggs(z): - pass - ''' - - - indentStack = [1] - stmt = Forward() - - identifier = Word(alphas, alphanums) - funcDecl = ("def" + identifier + Group( "(" + Optional( delimitedList(identifier) ) + ")" ) + ":") - func_body = indentedBlock(stmt, indentStack) - funcDef = Group( funcDecl + func_body ) - - rvalue = Forward() - funcCall = Group(identifier + "(" + Optional(delimitedList(rvalue)) + ")") - rvalue << (funcCall | identifier | Word(nums)) - assignment = Group(identifier + "=" + rvalue) - stmt << ( funcDef | assignment | identifier ) - - module_body = OneOrMore(stmt) - - parseTree = module_body.parseString(data) - parseTree.pprint() - prints:: - [['def', - 'A', - ['(', 'z', ')'], - ':', - [['A1'], [['B', '=', '100']], [['G', '=', 'A2']], ['A2'], ['A3']]], - 'B', - ['def', - 'BB', - ['(', 'a', 'b', 'c', ')'], - ':', - [['BB1'], [['def', 'BBA', ['(', ')'], ':', [['bba1'], ['bba2'], ['bba3']]]]]], - 'C', - 'D', - ['def', - 'spam', - ['(', 'x', 'y', ')'], - ':', - [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]] - """ - def checkPeerIndent(s,l,t): - if l >= len(s): return - curCol = col(l,s) - if curCol != indentStack[-1]: - if curCol > indentStack[-1]: - raise ParseFatalException(s,l,"illegal nesting") - raise ParseException(s,l,"not a peer entry") - - def checkSubIndent(s,l,t): - curCol = col(l,s) - if curCol > indentStack[-1]: - indentStack.append( curCol ) - else: - raise ParseException(s,l,"not a subentry") - - def checkUnindent(s,l,t): - if l >= len(s): return - curCol = col(l,s) - if not(indentStack and curCol < indentStack[-1] and curCol <= indentStack[-2]): - raise ParseException(s,l,"not an unindent") - indentStack.pop() - - NL = OneOrMore(LineEnd().setWhitespaceChars("\t ").suppress()) - INDENT = (Empty() + Empty().setParseAction(checkSubIndent)).setName('INDENT') - PEER = Empty().setParseAction(checkPeerIndent).setName('') - UNDENT = Empty().setParseAction(checkUnindent).setName('UNINDENT') - if indent: - smExpr = Group( Optional(NL) + - #~ FollowedBy(blockStatementExpr) + - INDENT + (OneOrMore( PEER + Group(blockStatementExpr) + Optional(NL) )) + UNDENT) - else: - smExpr = Group( Optional(NL) + - (OneOrMore( PEER + Group(blockStatementExpr) + Optional(NL) )) ) - blockStatementExpr.ignore(_bslash + LineEnd()) - return smExpr.setName('indented block') - -alphas8bit = srange(r"[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]") -punc8bit = srange(r"[\0xa1-\0xbf\0xd7\0xf7]") - -anyOpenTag,anyCloseTag = makeHTMLTags(Word(alphas,alphanums+"_:").setName('any tag')) -_htmlEntityMap = dict(zip("gt lt amp nbsp quot apos".split(),'><& "\'')) -commonHTMLEntity = Regex('&(?P' + '|'.join(_htmlEntityMap.keys()) +");").setName("common HTML entity") -def replaceHTMLEntity(t): - """Helper parser action to replace common HTML entities with their special characters""" - return _htmlEntityMap.get(t.entity) - -# it's easy to get these comment structures wrong - they're very common, so may as well make them available -cStyleComment = Combine(Regex(r"/\*(?:[^*]|\*(?!/))*") + '*/').setName("C style comment") -"Comment of the form C{/* ... */}" - -htmlComment = Regex(r"").setName("HTML comment") -"Comment of the form C{}" - -restOfLine = Regex(r".*").leaveWhitespace().setName("rest of line") -dblSlashComment = Regex(r"//(?:\\\n|[^\n])*").setName("// comment") -"Comment of the form C{// ... (to end of line)}" - -cppStyleComment = Combine(Regex(r"/\*(?:[^*]|\*(?!/))*") + '*/'| dblSlashComment).setName("C++ style comment") -"Comment of either form C{L{cStyleComment}} or C{L{dblSlashComment}}" - -javaStyleComment = cppStyleComment -"Same as C{L{cppStyleComment}}" - -pythonStyleComment = Regex(r"#.*").setName("Python style comment") -"Comment of the form C{# ... (to end of line)}" - -_commasepitem = Combine(OneOrMore(Word(printables, excludeChars=',') + - Optional( Word(" \t") + - ~Literal(",") + ~LineEnd() ) ) ).streamline().setName("commaItem") -commaSeparatedList = delimitedList( Optional( quotedString.copy() | _commasepitem, default="") ).setName("commaSeparatedList") -"""(Deprecated) Predefined expression of 1 or more printable words or quoted strings, separated by commas. - This expression is deprecated in favor of L{pyparsing_common.comma_separated_list}.""" - -# some other useful expressions - using lower-case class name since we are really using this as a namespace -class pyparsing_common: - """ - Here are some common low-level expressions that may be useful in jump-starting parser development: - - numeric forms (L{integers}, L{reals}, L{scientific notation}) - - common L{programming identifiers} - - network addresses (L{MAC}, L{IPv4}, L{IPv6}) - - ISO8601 L{dates} and L{datetime} - - L{UUID} - - L{comma-separated list} - Parse actions: - - C{L{convertToInteger}} - - C{L{convertToFloat}} - - C{L{convertToDate}} - - C{L{convertToDatetime}} - - C{L{stripHTMLTags}} - - C{L{upcaseTokens}} - - C{L{downcaseTokens}} - - Example:: - pyparsing_common.number.runTests(''' - # any int or real number, returned as the appropriate type - 100 - -100 - +100 - 3.14159 - 6.02e23 - 1e-12 - ''') - - pyparsing_common.fnumber.runTests(''' - # any int or real number, returned as float - 100 - -100 - +100 - 3.14159 - 6.02e23 - 1e-12 - ''') - - pyparsing_common.hex_integer.runTests(''' - # hex numbers - 100 - FF - ''') - - pyparsing_common.fraction.runTests(''' - # fractions - 1/2 - -3/4 - ''') - - pyparsing_common.mixed_integer.runTests(''' - # mixed fractions - 1 - 1/2 - -3/4 - 1-3/4 - ''') - - import uuid - pyparsing_common.uuid.setParseAction(tokenMap(uuid.UUID)) - pyparsing_common.uuid.runTests(''' - # uuid - 12345678-1234-5678-1234-567812345678 - ''') - prints:: - # any int or real number, returned as the appropriate type - 100 - [100] - - -100 - [-100] - - +100 - [100] - - 3.14159 - [3.14159] - - 6.02e23 - [6.02e+23] - - 1e-12 - [1e-12] - - # any int or real number, returned as float - 100 - [100.0] - - -100 - [-100.0] - - +100 - [100.0] - - 3.14159 - [3.14159] - - 6.02e23 - [6.02e+23] - - 1e-12 - [1e-12] - - # hex numbers - 100 - [256] - - FF - [255] - - # fractions - 1/2 - [0.5] - - -3/4 - [-0.75] - - # mixed fractions - 1 - [1] - - 1/2 - [0.5] - - -3/4 - [-0.75] - - 1-3/4 - [1.75] - - # uuid - 12345678-1234-5678-1234-567812345678 - [UUID('12345678-1234-5678-1234-567812345678')] - """ - - convertToInteger = tokenMap(int) - """ - Parse action for converting parsed integers to Python int - """ - - convertToFloat = tokenMap(float) - """ - Parse action for converting parsed numbers to Python float - """ - - integer = Word(nums).setName("integer").setParseAction(convertToInteger) - """expression that parses an unsigned integer, returns an int""" - - hex_integer = Word(hexnums).setName("hex integer").setParseAction(tokenMap(int,16)) - """expression that parses a hexadecimal integer, returns an int""" - - signed_integer = Regex(r'[+-]?\d+').setName("signed integer").setParseAction(convertToInteger) - """expression that parses an integer with optional leading sign, returns an int""" - - fraction = (signed_integer().setParseAction(convertToFloat) + '/' + signed_integer().setParseAction(convertToFloat)).setName("fraction") - """fractional expression of an integer divided by an integer, returns a float""" - fraction.addParseAction(lambda t: t[0]/t[-1]) - - mixed_integer = (fraction | signed_integer + Optional(Optional('-').suppress() + fraction)).setName("fraction or mixed integer-fraction") - """mixed integer of the form 'integer - fraction', with optional leading integer, returns float""" - mixed_integer.addParseAction(sum) - - real = Regex(r'[+-]?\d+\.\d*').setName("real number").setParseAction(convertToFloat) - """expression that parses a floating point number and returns a float""" - - sci_real = Regex(r'[+-]?\d+([eE][+-]?\d+|\.\d*([eE][+-]?\d+)?)').setName("real number with scientific notation").setParseAction(convertToFloat) - """expression that parses a floating point number with optional scientific notation and returns a float""" - - # streamlining this expression makes the docs nicer-looking - number = (sci_real | real | signed_integer).streamline() - """any numeric expression, returns the corresponding Python type""" - - fnumber = Regex(r'[+-]?\d+\.?\d*([eE][+-]?\d+)?').setName("fnumber").setParseAction(convertToFloat) - """any int or real number, returned as float""" - - identifier = Word(alphas+'_', alphanums+'_').setName("identifier") - """typical code identifier (leading alpha or '_', followed by 0 or more alphas, nums, or '_')""" - - ipv4_address = Regex(r'(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){3}').setName("IPv4 address") - "IPv4 address (C{0.0.0.0 - 255.255.255.255})" - - _ipv6_part = Regex(r'[0-9a-fA-F]{1,4}').setName("hex_integer") - _full_ipv6_address = (_ipv6_part + (':' + _ipv6_part)*7).setName("full IPv6 address") - _short_ipv6_address = (Optional(_ipv6_part + (':' + _ipv6_part)*(0,6)) + "::" + Optional(_ipv6_part + (':' + _ipv6_part)*(0,6))).setName("short IPv6 address") - _short_ipv6_address.addCondition(lambda t: sum(1 for tt in t if pyparsing_common._ipv6_part.matches(tt)) < 8) - _mixed_ipv6_address = ("::ffff:" + ipv4_address).setName("mixed IPv6 address") - ipv6_address = Combine((_full_ipv6_address | _mixed_ipv6_address | _short_ipv6_address).setName("IPv6 address")).setName("IPv6 address") - "IPv6 address (long, short, or mixed form)" - - mac_address = Regex(r'[0-9a-fA-F]{2}([:.-])[0-9a-fA-F]{2}(?:\1[0-9a-fA-F]{2}){4}').setName("MAC address") - "MAC address xx:xx:xx:xx:xx (may also have '-' or '.' delimiters)" - - @staticmethod - def convertToDate(fmt="%Y-%m-%d"): - """ - Helper to create a parse action for converting parsed date string to Python datetime.date - - Params - - - fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%d"}) - - Example:: - date_expr = pyparsing_common.iso8601_date.copy() - date_expr.setParseAction(pyparsing_common.convertToDate()) - print(date_expr.parseString("1999-12-31")) - prints:: - [datetime.date(1999, 12, 31)] - """ - def cvt_fn(s,l,t): - try: - return datetime.strptime(t[0], fmt).date() - except ValueError as ve: - raise ParseException(s, l, str(ve)) - return cvt_fn - - @staticmethod - def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"): - """ - Helper to create a parse action for converting parsed datetime string to Python datetime.datetime - - Params - - - fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%dT%H:%M:%S.%f"}) - - Example:: - dt_expr = pyparsing_common.iso8601_datetime.copy() - dt_expr.setParseAction(pyparsing_common.convertToDatetime()) - print(dt_expr.parseString("1999-12-31T23:59:59.999")) - prints:: - [datetime.datetime(1999, 12, 31, 23, 59, 59, 999000)] - """ - def cvt_fn(s,l,t): - try: - return datetime.strptime(t[0], fmt) - except ValueError as ve: - raise ParseException(s, l, str(ve)) - return cvt_fn - - iso8601_date = Regex(r'(?P\d{4})(?:-(?P\d\d)(?:-(?P\d\d))?)?').setName("ISO8601 date") - "ISO8601 date (C{yyyy-mm-dd})" - - iso8601_datetime = Regex(r'(?P\d{4})-(?P\d\d)-(?P\d\d)[T ](?P\d\d):(?P\d\d)(:(?P\d\d(\.\d*)?)?)?(?PZ|[+-]\d\d:?\d\d)?').setName("ISO8601 datetime") - "ISO8601 datetime (C{yyyy-mm-ddThh:mm:ss.s(Z|+-00:00)}) - trailing seconds, milliseconds, and timezone optional; accepts separating C{'T'} or C{' '}" - - uuid = Regex(r'[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}').setName("UUID") - "UUID (C{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx})" - - _html_stripper = anyOpenTag.suppress() | anyCloseTag.suppress() - @staticmethod - def stripHTMLTags(s, l, tokens): - """ - Parse action to remove HTML tags from web page HTML source - - Example:: - # strip HTML links from normal text - text = 'More info at the
pyparsing wiki page' - td,td_end = makeHTMLTags("TD") - table_text = td + SkipTo(td_end).setParseAction(pyparsing_common.stripHTMLTags)("body") + td_end - - print(table_text.parseString(text).body) # -> 'More info at the pyparsing wiki page' - """ - return pyparsing_common._html_stripper.transformString(tokens[0]) - - _commasepitem = Combine(OneOrMore(~Literal(",") + ~LineEnd() + Word(printables, excludeChars=',') - + Optional( White(" \t") ) ) ).streamline().setName("commaItem") - comma_separated_list = delimitedList( Optional( quotedString.copy() | _commasepitem, default="") ).setName("comma separated list") - """Predefined expression of 1 or more printable words or quoted strings, separated by commas.""" - - upcaseTokens = staticmethod(tokenMap(lambda t: _ustr(t).upper())) - """Parse action to convert tokens to upper case.""" - - downcaseTokens = staticmethod(tokenMap(lambda t: _ustr(t).lower())) - """Parse action to convert tokens to lower case.""" - - -if __name__ == "__main__": - - selectToken = CaselessLiteral("select") - fromToken = CaselessLiteral("from") - - ident = Word(alphas, alphanums + "_$") - - columnName = delimitedList(ident, ".", combine=True).setParseAction(upcaseTokens) - columnNameList = Group(delimitedList(columnName)).setName("columns") - columnSpec = ('*' | columnNameList) - - tableName = delimitedList(ident, ".", combine=True).setParseAction(upcaseTokens) - tableNameList = Group(delimitedList(tableName)).setName("tables") - - simpleSQL = selectToken("command") + columnSpec("columns") + fromToken + tableNameList("tables") - - # demo runTests method, including embedded comments in test string - simpleSQL.runTests(""" - # '*' as column list and dotted table name - select * from SYS.XYZZY - - # caseless match on "SELECT", and casts back to "select" - SELECT * from XYZZY, ABC - - # list of column names, and mixed case SELECT keyword - Select AA,BB,CC from Sys.dual - - # multiple tables - Select A, B, C from Sys.dual, Table2 - - # invalid SELECT keyword - should fail - Xelect A, B, C from Sys.dual - - # incomplete command - should fail - Select - - # invalid column name - should fail - Select ^^^ frox Sys.dual - - """) - - pyparsing_common.number.runTests(""" - 100 - -100 - +100 - 3.14159 - 6.02e23 - 1e-12 - """) - - # any int or real number, returned as float - pyparsing_common.fnumber.runTests(""" - 100 - -100 - +100 - 3.14159 - 6.02e23 - 1e-12 - """) - - pyparsing_common.hex_integer.runTests(""" - 100 - FF - """) - - import uuid - pyparsing_common.uuid.setParseAction(tokenMap(uuid.UUID)) - pyparsing_common.uuid.runTests(""" - 12345678-1234-5678-1234-567812345678 - """) diff --git a/venv/lib/python3.8/site-packages/setuptools/_vendor/six.py b/venv/lib/python3.8/site-packages/setuptools/_vendor/six.py deleted file mode 100644 index 190c0239cd7d7af82a6e0cbc8d68053fa2e3dfaf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/_vendor/six.py +++ /dev/null @@ -1,868 +0,0 @@ -"""Utilities for writing code that runs on Python 2 and 3""" - -# Copyright (c) 2010-2015 Benjamin Peterson -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from __future__ import absolute_import - -import functools -import itertools -import operator -import sys -import types - -__author__ = "Benjamin Peterson " -__version__ = "1.10.0" - - -# Useful for very coarse version differentiation. -PY2 = sys.version_info[0] == 2 -PY3 = sys.version_info[0] == 3 -PY34 = sys.version_info[0:2] >= (3, 4) - -if PY3: - string_types = str, - integer_types = int, - class_types = type, - text_type = str - binary_type = bytes - - MAXSIZE = sys.maxsize -else: - string_types = basestring, - integer_types = (int, long) - class_types = (type, types.ClassType) - text_type = unicode - binary_type = str - - if sys.platform.startswith("java"): - # Jython always uses 32 bits. - MAXSIZE = int((1 << 31) - 1) - else: - # It's possible to have sizeof(long) != sizeof(Py_ssize_t). - class X(object): - - def __len__(self): - return 1 << 31 - try: - len(X()) - except OverflowError: - # 32-bit - MAXSIZE = int((1 << 31) - 1) - else: - # 64-bit - MAXSIZE = int((1 << 63) - 1) - del X - - -def _add_doc(func, doc): - """Add documentation to a function.""" - func.__doc__ = doc - - -def _import_module(name): - """Import module, returning the module after the last dot.""" - __import__(name) - return sys.modules[name] - - -class _LazyDescr(object): - - def __init__(self, name): - self.name = name - - def __get__(self, obj, tp): - result = self._resolve() - setattr(obj, self.name, result) # Invokes __set__. - try: - # This is a bit ugly, but it avoids running this again by - # removing this descriptor. - delattr(obj.__class__, self.name) - except AttributeError: - pass - return result - - -class MovedModule(_LazyDescr): - - def __init__(self, name, old, new=None): - super(MovedModule, self).__init__(name) - if PY3: - if new is None: - new = name - self.mod = new - else: - self.mod = old - - def _resolve(self): - return _import_module(self.mod) - - def __getattr__(self, attr): - _module = self._resolve() - value = getattr(_module, attr) - setattr(self, attr, value) - return value - - -class _LazyModule(types.ModuleType): - - def __init__(self, name): - super(_LazyModule, self).__init__(name) - self.__doc__ = self.__class__.__doc__ - - def __dir__(self): - attrs = ["__doc__", "__name__"] - attrs += [attr.name for attr in self._moved_attributes] - return attrs - - # Subclasses should override this - _moved_attributes = [] - - -class MovedAttribute(_LazyDescr): - - def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): - super(MovedAttribute, self).__init__(name) - if PY3: - if new_mod is None: - new_mod = name - self.mod = new_mod - if new_attr is None: - if old_attr is None: - new_attr = name - else: - new_attr = old_attr - self.attr = new_attr - else: - self.mod = old_mod - if old_attr is None: - old_attr = name - self.attr = old_attr - - def _resolve(self): - module = _import_module(self.mod) - return getattr(module, self.attr) - - -class _SixMetaPathImporter(object): - - """ - A meta path importer to import six.moves and its submodules. - - This class implements a PEP302 finder and loader. It should be compatible - with Python 2.5 and all existing versions of Python3 - """ - - def __init__(self, six_module_name): - self.name = six_module_name - self.known_modules = {} - - def _add_module(self, mod, *fullnames): - for fullname in fullnames: - self.known_modules[self.name + "." + fullname] = mod - - def _get_module(self, fullname): - return self.known_modules[self.name + "." + fullname] - - def find_module(self, fullname, path=None): - if fullname in self.known_modules: - return self - return None - - def __get_module(self, fullname): - try: - return self.known_modules[fullname] - except KeyError: - raise ImportError("This loader does not know module " + fullname) - - def load_module(self, fullname): - try: - # in case of a reload - return sys.modules[fullname] - except KeyError: - pass - mod = self.__get_module(fullname) - if isinstance(mod, MovedModule): - mod = mod._resolve() - else: - mod.__loader__ = self - sys.modules[fullname] = mod - return mod - - def is_package(self, fullname): - """ - Return true, if the named module is a package. - - We need this method to get correct spec objects with - Python 3.4 (see PEP451) - """ - return hasattr(self.__get_module(fullname), "__path__") - - def get_code(self, fullname): - """Return None - - Required, if is_package is implemented""" - self.__get_module(fullname) # eventually raises ImportError - return None - get_source = get_code # same as get_code - -_importer = _SixMetaPathImporter(__name__) - - -class _MovedItems(_LazyModule): - - """Lazy loading of moved objects""" - __path__ = [] # mark as package - - -_moved_attributes = [ - MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), - MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), - MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"), - MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), - MovedAttribute("intern", "__builtin__", "sys"), - MovedAttribute("map", "itertools", "builtins", "imap", "map"), - MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"), - MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"), - MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"), - MovedAttribute("reduce", "__builtin__", "functools"), - MovedAttribute("shlex_quote", "pipes", "shlex", "quote"), - MovedAttribute("StringIO", "StringIO", "io"), - MovedAttribute("UserDict", "UserDict", "collections"), - MovedAttribute("UserList", "UserList", "collections"), - MovedAttribute("UserString", "UserString", "collections"), - MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), - MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"), - MovedModule("builtins", "__builtin__"), - MovedModule("configparser", "ConfigParser"), - MovedModule("copyreg", "copy_reg"), - MovedModule("dbm_gnu", "gdbm", "dbm.gnu"), - MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"), - MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), - MovedModule("http_cookies", "Cookie", "http.cookies"), - MovedModule("html_entities", "htmlentitydefs", "html.entities"), - MovedModule("html_parser", "HTMLParser", "html.parser"), - MovedModule("http_client", "httplib", "http.client"), - MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), - MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"), - MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), - MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), - MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), - MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), - MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), - MovedModule("cPickle", "cPickle", "pickle"), - MovedModule("queue", "Queue"), - MovedModule("reprlib", "repr"), - MovedModule("socketserver", "SocketServer"), - MovedModule("_thread", "thread", "_thread"), - MovedModule("tkinter", "Tkinter"), - MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), - MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), - MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), - MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), - MovedModule("tkinter_tix", "Tix", "tkinter.tix"), - MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"), - MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), - MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), - MovedModule("tkinter_colorchooser", "tkColorChooser", - "tkinter.colorchooser"), - MovedModule("tkinter_commondialog", "tkCommonDialog", - "tkinter.commondialog"), - MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), - MovedModule("tkinter_font", "tkFont", "tkinter.font"), - MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), - MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", - "tkinter.simpledialog"), - MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"), - MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"), - MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"), - MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), - MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"), - MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"), -] -# Add windows specific modules. -if sys.platform == "win32": - _moved_attributes += [ - MovedModule("winreg", "_winreg"), - ] - -for attr in _moved_attributes: - setattr(_MovedItems, attr.name, attr) - if isinstance(attr, MovedModule): - _importer._add_module(attr, "moves." + attr.name) -del attr - -_MovedItems._moved_attributes = _moved_attributes - -moves = _MovedItems(__name__ + ".moves") -_importer._add_module(moves, "moves") - - -class Module_six_moves_urllib_parse(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_parse""" - - -_urllib_parse_moved_attributes = [ - MovedAttribute("ParseResult", "urlparse", "urllib.parse"), - MovedAttribute("SplitResult", "urlparse", "urllib.parse"), - MovedAttribute("parse_qs", "urlparse", "urllib.parse"), - MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), - MovedAttribute("urldefrag", "urlparse", "urllib.parse"), - MovedAttribute("urljoin", "urlparse", "urllib.parse"), - MovedAttribute("urlparse", "urlparse", "urllib.parse"), - MovedAttribute("urlsplit", "urlparse", "urllib.parse"), - MovedAttribute("urlunparse", "urlparse", "urllib.parse"), - MovedAttribute("urlunsplit", "urlparse", "urllib.parse"), - MovedAttribute("quote", "urllib", "urllib.parse"), - MovedAttribute("quote_plus", "urllib", "urllib.parse"), - MovedAttribute("unquote", "urllib", "urllib.parse"), - MovedAttribute("unquote_plus", "urllib", "urllib.parse"), - MovedAttribute("urlencode", "urllib", "urllib.parse"), - MovedAttribute("splitquery", "urllib", "urllib.parse"), - MovedAttribute("splittag", "urllib", "urllib.parse"), - MovedAttribute("splituser", "urllib", "urllib.parse"), - MovedAttribute("uses_fragment", "urlparse", "urllib.parse"), - MovedAttribute("uses_netloc", "urlparse", "urllib.parse"), - MovedAttribute("uses_params", "urlparse", "urllib.parse"), - MovedAttribute("uses_query", "urlparse", "urllib.parse"), - MovedAttribute("uses_relative", "urlparse", "urllib.parse"), -] -for attr in _urllib_parse_moved_attributes: - setattr(Module_six_moves_urllib_parse, attr.name, attr) -del attr - -Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes - -_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"), - "moves.urllib_parse", "moves.urllib.parse") - - -class Module_six_moves_urllib_error(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_error""" - - -_urllib_error_moved_attributes = [ - MovedAttribute("URLError", "urllib2", "urllib.error"), - MovedAttribute("HTTPError", "urllib2", "urllib.error"), - MovedAttribute("ContentTooShortError", "urllib", "urllib.error"), -] -for attr in _urllib_error_moved_attributes: - setattr(Module_six_moves_urllib_error, attr.name, attr) -del attr - -Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes - -_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"), - "moves.urllib_error", "moves.urllib.error") - - -class Module_six_moves_urllib_request(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_request""" - - -_urllib_request_moved_attributes = [ - MovedAttribute("urlopen", "urllib2", "urllib.request"), - MovedAttribute("install_opener", "urllib2", "urllib.request"), - MovedAttribute("build_opener", "urllib2", "urllib.request"), - MovedAttribute("pathname2url", "urllib", "urllib.request"), - MovedAttribute("url2pathname", "urllib", "urllib.request"), - MovedAttribute("getproxies", "urllib", "urllib.request"), - MovedAttribute("Request", "urllib2", "urllib.request"), - MovedAttribute("OpenerDirector", "urllib2", "urllib.request"), - MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"), - MovedAttribute("ProxyHandler", "urllib2", "urllib.request"), - MovedAttribute("BaseHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"), - MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"), - MovedAttribute("FileHandler", "urllib2", "urllib.request"), - MovedAttribute("FTPHandler", "urllib2", "urllib.request"), - MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"), - MovedAttribute("UnknownHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"), - MovedAttribute("urlretrieve", "urllib", "urllib.request"), - MovedAttribute("urlcleanup", "urllib", "urllib.request"), - MovedAttribute("URLopener", "urllib", "urllib.request"), - MovedAttribute("FancyURLopener", "urllib", "urllib.request"), - MovedAttribute("proxy_bypass", "urllib", "urllib.request"), -] -for attr in _urllib_request_moved_attributes: - setattr(Module_six_moves_urllib_request, attr.name, attr) -del attr - -Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes - -_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"), - "moves.urllib_request", "moves.urllib.request") - - -class Module_six_moves_urllib_response(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_response""" - - -_urllib_response_moved_attributes = [ - MovedAttribute("addbase", "urllib", "urllib.response"), - MovedAttribute("addclosehook", "urllib", "urllib.response"), - MovedAttribute("addinfo", "urllib", "urllib.response"), - MovedAttribute("addinfourl", "urllib", "urllib.response"), -] -for attr in _urllib_response_moved_attributes: - setattr(Module_six_moves_urllib_response, attr.name, attr) -del attr - -Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes - -_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"), - "moves.urllib_response", "moves.urllib.response") - - -class Module_six_moves_urllib_robotparser(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_robotparser""" - - -_urllib_robotparser_moved_attributes = [ - MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"), -] -for attr in _urllib_robotparser_moved_attributes: - setattr(Module_six_moves_urllib_robotparser, attr.name, attr) -del attr - -Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes - -_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"), - "moves.urllib_robotparser", "moves.urllib.robotparser") - - -class Module_six_moves_urllib(types.ModuleType): - - """Create a six.moves.urllib namespace that resembles the Python 3 namespace""" - __path__ = [] # mark as package - parse = _importer._get_module("moves.urllib_parse") - error = _importer._get_module("moves.urllib_error") - request = _importer._get_module("moves.urllib_request") - response = _importer._get_module("moves.urllib_response") - robotparser = _importer._get_module("moves.urllib_robotparser") - - def __dir__(self): - return ['parse', 'error', 'request', 'response', 'robotparser'] - -_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"), - "moves.urllib") - - -def add_move(move): - """Add an item to six.moves.""" - setattr(_MovedItems, move.name, move) - - -def remove_move(name): - """Remove item from six.moves.""" - try: - delattr(_MovedItems, name) - except AttributeError: - try: - del moves.__dict__[name] - except KeyError: - raise AttributeError("no such move, %r" % (name,)) - - -if PY3: - _meth_func = "__func__" - _meth_self = "__self__" - - _func_closure = "__closure__" - _func_code = "__code__" - _func_defaults = "__defaults__" - _func_globals = "__globals__" -else: - _meth_func = "im_func" - _meth_self = "im_self" - - _func_closure = "func_closure" - _func_code = "func_code" - _func_defaults = "func_defaults" - _func_globals = "func_globals" - - -try: - advance_iterator = next -except NameError: - def advance_iterator(it): - return it.next() -next = advance_iterator - - -try: - callable = callable -except NameError: - def callable(obj): - return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) - - -if PY3: - def get_unbound_function(unbound): - return unbound - - create_bound_method = types.MethodType - - def create_unbound_method(func, cls): - return func - - Iterator = object -else: - def get_unbound_function(unbound): - return unbound.im_func - - def create_bound_method(func, obj): - return types.MethodType(func, obj, obj.__class__) - - def create_unbound_method(func, cls): - return types.MethodType(func, None, cls) - - class Iterator(object): - - def next(self): - return type(self).__next__(self) - - callable = callable -_add_doc(get_unbound_function, - """Get the function out of a possibly unbound function""") - - -get_method_function = operator.attrgetter(_meth_func) -get_method_self = operator.attrgetter(_meth_self) -get_function_closure = operator.attrgetter(_func_closure) -get_function_code = operator.attrgetter(_func_code) -get_function_defaults = operator.attrgetter(_func_defaults) -get_function_globals = operator.attrgetter(_func_globals) - - -if PY3: - def iterkeys(d, **kw): - return iter(d.keys(**kw)) - - def itervalues(d, **kw): - return iter(d.values(**kw)) - - def iteritems(d, **kw): - return iter(d.items(**kw)) - - def iterlists(d, **kw): - return iter(d.lists(**kw)) - - viewkeys = operator.methodcaller("keys") - - viewvalues = operator.methodcaller("values") - - viewitems = operator.methodcaller("items") -else: - def iterkeys(d, **kw): - return d.iterkeys(**kw) - - def itervalues(d, **kw): - return d.itervalues(**kw) - - def iteritems(d, **kw): - return d.iteritems(**kw) - - def iterlists(d, **kw): - return d.iterlists(**kw) - - viewkeys = operator.methodcaller("viewkeys") - - viewvalues = operator.methodcaller("viewvalues") - - viewitems = operator.methodcaller("viewitems") - -_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.") -_add_doc(itervalues, "Return an iterator over the values of a dictionary.") -_add_doc(iteritems, - "Return an iterator over the (key, value) pairs of a dictionary.") -_add_doc(iterlists, - "Return an iterator over the (key, [values]) pairs of a dictionary.") - - -if PY3: - def b(s): - return s.encode("latin-1") - - def u(s): - return s - unichr = chr - import struct - int2byte = struct.Struct(">B").pack - del struct - byte2int = operator.itemgetter(0) - indexbytes = operator.getitem - iterbytes = iter - import io - StringIO = io.StringIO - BytesIO = io.BytesIO - _assertCountEqual = "assertCountEqual" - if sys.version_info[1] <= 1: - _assertRaisesRegex = "assertRaisesRegexp" - _assertRegex = "assertRegexpMatches" - else: - _assertRaisesRegex = "assertRaisesRegex" - _assertRegex = "assertRegex" -else: - def b(s): - return s - # Workaround for standalone backslash - - def u(s): - return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") - unichr = unichr - int2byte = chr - - def byte2int(bs): - return ord(bs[0]) - - def indexbytes(buf, i): - return ord(buf[i]) - iterbytes = functools.partial(itertools.imap, ord) - import StringIO - StringIO = BytesIO = StringIO.StringIO - _assertCountEqual = "assertItemsEqual" - _assertRaisesRegex = "assertRaisesRegexp" - _assertRegex = "assertRegexpMatches" -_add_doc(b, """Byte literal""") -_add_doc(u, """Text literal""") - - -def assertCountEqual(self, *args, **kwargs): - return getattr(self, _assertCountEqual)(*args, **kwargs) - - -def assertRaisesRegex(self, *args, **kwargs): - return getattr(self, _assertRaisesRegex)(*args, **kwargs) - - -def assertRegex(self, *args, **kwargs): - return getattr(self, _assertRegex)(*args, **kwargs) - - -if PY3: - exec_ = getattr(moves.builtins, "exec") - - def reraise(tp, value, tb=None): - if value is None: - value = tp() - if value.__traceback__ is not tb: - raise value.with_traceback(tb) - raise value - -else: - def exec_(_code_, _globs_=None, _locs_=None): - """Execute code in a namespace.""" - if _globs_ is None: - frame = sys._getframe(1) - _globs_ = frame.f_globals - if _locs_ is None: - _locs_ = frame.f_locals - del frame - elif _locs_ is None: - _locs_ = _globs_ - exec("""exec _code_ in _globs_, _locs_""") - - exec_("""def reraise(tp, value, tb=None): - raise tp, value, tb -""") - - -if sys.version_info[:2] == (3, 2): - exec_("""def raise_from(value, from_value): - if from_value is None: - raise value - raise value from from_value -""") -elif sys.version_info[:2] > (3, 2): - exec_("""def raise_from(value, from_value): - raise value from from_value -""") -else: - def raise_from(value, from_value): - raise value - - -print_ = getattr(moves.builtins, "print", None) -if print_ is None: - def print_(*args, **kwargs): - """The new-style print function for Python 2.4 and 2.5.""" - fp = kwargs.pop("file", sys.stdout) - if fp is None: - return - - def write(data): - if not isinstance(data, basestring): - data = str(data) - # If the file has an encoding, encode unicode with it. - if (isinstance(fp, file) and - isinstance(data, unicode) and - fp.encoding is not None): - errors = getattr(fp, "errors", None) - if errors is None: - errors = "strict" - data = data.encode(fp.encoding, errors) - fp.write(data) - want_unicode = False - sep = kwargs.pop("sep", None) - if sep is not None: - if isinstance(sep, unicode): - want_unicode = True - elif not isinstance(sep, str): - raise TypeError("sep must be None or a string") - end = kwargs.pop("end", None) - if end is not None: - if isinstance(end, unicode): - want_unicode = True - elif not isinstance(end, str): - raise TypeError("end must be None or a string") - if kwargs: - raise TypeError("invalid keyword arguments to print()") - if not want_unicode: - for arg in args: - if isinstance(arg, unicode): - want_unicode = True - break - if want_unicode: - newline = unicode("\n") - space = unicode(" ") - else: - newline = "\n" - space = " " - if sep is None: - sep = space - if end is None: - end = newline - for i, arg in enumerate(args): - if i: - write(sep) - write(arg) - write(end) -if sys.version_info[:2] < (3, 3): - _print = print_ - - def print_(*args, **kwargs): - fp = kwargs.get("file", sys.stdout) - flush = kwargs.pop("flush", False) - _print(*args, **kwargs) - if flush and fp is not None: - fp.flush() - -_add_doc(reraise, """Reraise an exception.""") - -if sys.version_info[0:2] < (3, 4): - def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, - updated=functools.WRAPPER_UPDATES): - def wrapper(f): - f = functools.wraps(wrapped, assigned, updated)(f) - f.__wrapped__ = wrapped - return f - return wrapper -else: - wraps = functools.wraps - - -def with_metaclass(meta, *bases): - """Create a base class with a metaclass.""" - # This requires a bit of explanation: the basic idea is to make a dummy - # metaclass for one level of class instantiation that replaces itself with - # the actual metaclass. - class metaclass(meta): - - def __new__(cls, name, this_bases, d): - return meta(name, bases, d) - return type.__new__(metaclass, 'temporary_class', (), {}) - - -def add_metaclass(metaclass): - """Class decorator for creating a class with a metaclass.""" - def wrapper(cls): - orig_vars = cls.__dict__.copy() - slots = orig_vars.get('__slots__') - if slots is not None: - if isinstance(slots, str): - slots = [slots] - for slots_var in slots: - orig_vars.pop(slots_var) - orig_vars.pop('__dict__', None) - orig_vars.pop('__weakref__', None) - return metaclass(cls.__name__, cls.__bases__, orig_vars) - return wrapper - - -def python_2_unicode_compatible(klass): - """ - A decorator that defines __unicode__ and __str__ methods under Python 2. - Under Python 3 it does nothing. - - To support Python 2 and 3 with a single code base, define a __str__ method - returning text and apply this decorator to the class. - """ - if PY2: - if '__str__' not in klass.__dict__: - raise ValueError("@python_2_unicode_compatible cannot be applied " - "to %s because it doesn't define __str__()." % - klass.__name__) - klass.__unicode__ = klass.__str__ - klass.__str__ = lambda self: self.__unicode__().encode('utf-8') - return klass - - -# Complete the moves implementation. -# This code is at the end of this module to speed up module loading. -# Turn this module into a package. -__path__ = [] # required for PEP 302 and PEP 451 -__package__ = __name__ # see PEP 366 @ReservedAssignment -if globals().get("__spec__") is not None: - __spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable -# Remove other six meta path importers, since they cause problems. This can -# happen if six is removed from sys.modules and then reloaded. (Setuptools does -# this for some reason.) -if sys.meta_path: - for i, importer in enumerate(sys.meta_path): - # Here's some real nastiness: Another "instance" of the six module might - # be floating around. Therefore, we can't use isinstance() to check for - # the six meta path importer, since the other six instance will have - # inserted an importer with different class. - if (type(importer).__name__ == "_SixMetaPathImporter" and - importer.name == __name__): - del sys.meta_path[i] - break - del i, importer -# Finally, add the importer to the meta path import hook. -sys.meta_path.append(_importer) diff --git a/venv/lib/python3.8/site-packages/setuptools/archive_util.py b/venv/lib/python3.8/site-packages/setuptools/archive_util.py deleted file mode 100644 index 81436044d995ff430334a7ef324b08e616f4b7a7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/archive_util.py +++ /dev/null @@ -1,173 +0,0 @@ -"""Utilities for extracting common archive formats""" - -import zipfile -import tarfile -import os -import shutil -import posixpath -import contextlib -from distutils.errors import DistutilsError - -from pkg_resources import ensure_directory - -__all__ = [ - "unpack_archive", "unpack_zipfile", "unpack_tarfile", "default_filter", - "UnrecognizedFormat", "extraction_drivers", "unpack_directory", -] - - -class UnrecognizedFormat(DistutilsError): - """Couldn't recognize the archive type""" - - -def default_filter(src, dst): - """The default progress/filter callback; returns True for all files""" - return dst - - -def unpack_archive(filename, extract_dir, progress_filter=default_filter, - drivers=None): - """Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat`` - - `progress_filter` is a function taking two arguments: a source path - internal to the archive ('/'-separated), and a filesystem path where it - will be extracted. The callback must return the desired extract path - (which may be the same as the one passed in), or else ``None`` to skip - that file or directory. The callback can thus be used to report on the - progress of the extraction, as well as to filter the items extracted or - alter their extraction paths. - - `drivers`, if supplied, must be a non-empty sequence of functions with the - same signature as this function (minus the `drivers` argument), that raise - ``UnrecognizedFormat`` if they do not support extracting the designated - archive type. The `drivers` are tried in sequence until one is found that - does not raise an error, or until all are exhausted (in which case - ``UnrecognizedFormat`` is raised). If you do not supply a sequence of - drivers, the module's ``extraction_drivers`` constant will be used, which - means that ``unpack_zipfile`` and ``unpack_tarfile`` will be tried, in that - order. - """ - for driver in drivers or extraction_drivers: - try: - driver(filename, extract_dir, progress_filter) - except UnrecognizedFormat: - continue - else: - return - else: - raise UnrecognizedFormat( - "Not a recognized archive type: %s" % filename - ) - - -def unpack_directory(filename, extract_dir, progress_filter=default_filter): - """"Unpack" a directory, using the same interface as for archives - - Raises ``UnrecognizedFormat`` if `filename` is not a directory - """ - if not os.path.isdir(filename): - raise UnrecognizedFormat("%s is not a directory" % filename) - - paths = { - filename: ('', extract_dir), - } - for base, dirs, files in os.walk(filename): - src, dst = paths[base] - for d in dirs: - paths[os.path.join(base, d)] = src + d + '/', os.path.join(dst, d) - for f in files: - target = os.path.join(dst, f) - target = progress_filter(src + f, target) - if not target: - # skip non-files - continue - ensure_directory(target) - f = os.path.join(base, f) - shutil.copyfile(f, target) - shutil.copystat(f, target) - - -def unpack_zipfile(filename, extract_dir, progress_filter=default_filter): - """Unpack zip `filename` to `extract_dir` - - Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined - by ``zipfile.is_zipfile()``). See ``unpack_archive()`` for an explanation - of the `progress_filter` argument. - """ - - if not zipfile.is_zipfile(filename): - raise UnrecognizedFormat("%s is not a zip file" % (filename,)) - - with zipfile.ZipFile(filename) as z: - for info in z.infolist(): - name = info.filename - - # don't extract absolute paths or ones with .. in them - if name.startswith('/') or '..' in name.split('/'): - continue - - target = os.path.join(extract_dir, *name.split('/')) - target = progress_filter(name, target) - if not target: - continue - if name.endswith('/'): - # directory - ensure_directory(target) - else: - # file - ensure_directory(target) - data = z.read(info.filename) - with open(target, 'wb') as f: - f.write(data) - unix_attributes = info.external_attr >> 16 - if unix_attributes: - os.chmod(target, unix_attributes) - - -def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): - """Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` - - Raises ``UnrecognizedFormat`` if `filename` is not a tarfile (as determined - by ``tarfile.open()``). See ``unpack_archive()`` for an explanation - of the `progress_filter` argument. - """ - try: - tarobj = tarfile.open(filename) - except tarfile.TarError: - raise UnrecognizedFormat( - "%s is not a compressed or uncompressed tar file" % (filename,) - ) - with contextlib.closing(tarobj): - # don't do any chowning! - tarobj.chown = lambda *args: None - for member in tarobj: - name = member.name - # don't extract absolute paths or ones with .. in them - if not name.startswith('/') and '..' not in name.split('/'): - prelim_dst = os.path.join(extract_dir, *name.split('/')) - - # resolve any links and to extract the link targets as normal - # files - while member is not None and (member.islnk() or member.issym()): - linkpath = member.linkname - if member.issym(): - base = posixpath.dirname(member.name) - linkpath = posixpath.join(base, linkpath) - linkpath = posixpath.normpath(linkpath) - member = tarobj._getmember(linkpath) - - if member is not None and (member.isfile() or member.isdir()): - final_dst = progress_filter(name, prelim_dst) - if final_dst: - if final_dst.endswith(os.sep): - final_dst = final_dst[:-1] - try: - # XXX Ugh - tarobj._extract_member(member, final_dst) - except tarfile.ExtractError: - # chown/chmod/mkfifo/mknode/makedev failed - pass - return True - - -extraction_drivers = unpack_directory, unpack_zipfile, unpack_tarfile diff --git a/venv/lib/python3.8/site-packages/setuptools/build_meta.py b/venv/lib/python3.8/site-packages/setuptools/build_meta.py deleted file mode 100644 index 10c4b528d996d23a1319e3fed755aef0e6da2eb9..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/build_meta.py +++ /dev/null @@ -1,257 +0,0 @@ -"""A PEP 517 interface to setuptools - -Previously, when a user or a command line tool (let's call it a "frontend") -needed to make a request of setuptools to take a certain action, for -example, generating a list of installation requirements, the frontend would -would call "setup.py egg_info" or "setup.py bdist_wheel" on the command line. - -PEP 517 defines a different method of interfacing with setuptools. Rather -than calling "setup.py" directly, the frontend should: - - 1. Set the current directory to the directory with a setup.py file - 2. Import this module into a safe python interpreter (one in which - setuptools can potentially set global variables or crash hard). - 3. Call one of the functions defined in PEP 517. - -What each function does is defined in PEP 517. However, here is a "casual" -definition of the functions (this definition should not be relied on for -bug reports or API stability): - - - `build_wheel`: build a wheel in the folder and return the basename - - `get_requires_for_build_wheel`: get the `setup_requires` to build - - `prepare_metadata_for_build_wheel`: get the `install_requires` - - `build_sdist`: build an sdist in the folder and return the basename - - `get_requires_for_build_sdist`: get the `setup_requires` to build - -Again, this is not a formal definition! Just a "taste" of the module. -""" - -import io -import os -import sys -import tokenize -import shutil -import contextlib - -import setuptools -import distutils -from setuptools.py31compat import TemporaryDirectory - -from pkg_resources import parse_requirements -from pkg_resources.py31compat import makedirs - -__all__ = ['get_requires_for_build_sdist', - 'get_requires_for_build_wheel', - 'prepare_metadata_for_build_wheel', - 'build_wheel', - 'build_sdist', - '__legacy__', - 'SetupRequirementsError'] - -class SetupRequirementsError(BaseException): - def __init__(self, specifiers): - self.specifiers = specifiers - - -class Distribution(setuptools.dist.Distribution): - def fetch_build_eggs(self, specifiers): - specifier_list = list(map(str, parse_requirements(specifiers))) - - raise SetupRequirementsError(specifier_list) - - @classmethod - @contextlib.contextmanager - def patch(cls): - """ - Replace - distutils.dist.Distribution with this class - for the duration of this context. - """ - orig = distutils.core.Distribution - distutils.core.Distribution = cls - try: - yield - finally: - distutils.core.Distribution = orig - - -def _to_str(s): - """ - Convert a filename to a string (on Python 2, explicitly - a byte string, not Unicode) as distutils checks for the - exact type str. - """ - if sys.version_info[0] == 2 and not isinstance(s, str): - # Assume it's Unicode, as that's what the PEP says - # should be provided. - return s.encode(sys.getfilesystemencoding()) - return s - - -def _get_immediate_subdirectories(a_dir): - return [name for name in os.listdir(a_dir) - if os.path.isdir(os.path.join(a_dir, name))] - - -def _file_with_extension(directory, extension): - matching = ( - f for f in os.listdir(directory) - if f.endswith(extension) - ) - file, = matching - return file - - -def _open_setup_script(setup_script): - if not os.path.exists(setup_script): - # Supply a default setup.py - return io.StringIO(u"from setuptools import setup; setup()") - - return getattr(tokenize, 'open', open)(setup_script) - - -class _BuildMetaBackend(object): - - def _fix_config(self, config_settings): - config_settings = config_settings or {} - config_settings.setdefault('--global-option', []) - return config_settings - - def _get_build_requires(self, config_settings, requirements): - config_settings = self._fix_config(config_settings) - - sys.argv = sys.argv[:1] + ['egg_info'] + \ - config_settings["--global-option"] - try: - with Distribution.patch(): - self.run_setup() - except SetupRequirementsError as e: - requirements += e.specifiers - - return requirements - - def run_setup(self, setup_script='setup.py'): - # Note that we can reuse our build directory between calls - # Correctness comes first, then optimization later - __file__ = setup_script - __name__ = '__main__' - - with _open_setup_script(__file__) as f: - code = f.read().replace(r'\r\n', r'\n') - - exec(compile(code, __file__, 'exec'), locals()) - - def get_requires_for_build_wheel(self, config_settings=None): - config_settings = self._fix_config(config_settings) - return self._get_build_requires(config_settings, requirements=['wheel']) - - def get_requires_for_build_sdist(self, config_settings=None): - config_settings = self._fix_config(config_settings) - return self._get_build_requires(config_settings, requirements=[]) - - def prepare_metadata_for_build_wheel(self, metadata_directory, - config_settings=None): - sys.argv = sys.argv[:1] + ['dist_info', '--egg-base', - _to_str(metadata_directory)] - self.run_setup() - - dist_info_directory = metadata_directory - while True: - dist_infos = [f for f in os.listdir(dist_info_directory) - if f.endswith('.dist-info')] - - if (len(dist_infos) == 0 and - len(_get_immediate_subdirectories(dist_info_directory)) == 1): - - dist_info_directory = os.path.join( - dist_info_directory, os.listdir(dist_info_directory)[0]) - continue - - assert len(dist_infos) == 1 - break - - # PEP 517 requires that the .dist-info directory be placed in the - # metadata_directory. To comply, we MUST copy the directory to the root - if dist_info_directory != metadata_directory: - shutil.move( - os.path.join(dist_info_directory, dist_infos[0]), - metadata_directory) - shutil.rmtree(dist_info_directory, ignore_errors=True) - - return dist_infos[0] - - def _build_with_temp_dir(self, setup_command, result_extension, - result_directory, config_settings): - config_settings = self._fix_config(config_settings) - result_directory = os.path.abspath(result_directory) - - # Build in a temporary directory, then copy to the target. - makedirs(result_directory, exist_ok=True) - with TemporaryDirectory(dir=result_directory) as tmp_dist_dir: - sys.argv = (sys.argv[:1] + setup_command + - ['--dist-dir', tmp_dist_dir] + - config_settings["--global-option"]) - self.run_setup() - - result_basename = _file_with_extension(tmp_dist_dir, result_extension) - result_path = os.path.join(result_directory, result_basename) - if os.path.exists(result_path): - # os.rename will fail overwriting on non-Unix. - os.remove(result_path) - os.rename(os.path.join(tmp_dist_dir, result_basename), result_path) - - return result_basename - - - def build_wheel(self, wheel_directory, config_settings=None, - metadata_directory=None): - return self._build_with_temp_dir(['bdist_wheel'], '.whl', - wheel_directory, config_settings) - - def build_sdist(self, sdist_directory, config_settings=None): - return self._build_with_temp_dir(['sdist', '--formats', 'gztar'], - '.tar.gz', sdist_directory, - config_settings) - - -class _BuildMetaLegacyBackend(_BuildMetaBackend): - """Compatibility backend for setuptools - - This is a version of setuptools.build_meta that endeavors to maintain backwards - compatibility with pre-PEP 517 modes of invocation. It exists as a temporary - bridge between the old packaging mechanism and the new packaging mechanism, - and will eventually be removed. - """ - def run_setup(self, setup_script='setup.py'): - # In order to maintain compatibility with scripts assuming that - # the setup.py script is in a directory on the PYTHONPATH, inject - # '' into sys.path. (pypa/setuptools#1642) - sys_path = list(sys.path) # Save the original path - - script_dir = os.path.dirname(os.path.abspath(setup_script)) - if script_dir not in sys.path: - sys.path.insert(0, script_dir) - - try: - super(_BuildMetaLegacyBackend, - self).run_setup(setup_script=setup_script) - finally: - # While PEP 517 frontends should be calling each hook in a fresh - # subprocess according to the standard (and thus it should not be - # strictly necessary to restore the old sys.path), we'll restore - # the original path so that the path manipulation does not persist - # within the hook after run_setup is called. - sys.path[:] = sys_path - -# The primary backend -_BACKEND = _BuildMetaBackend() - -get_requires_for_build_wheel = _BACKEND.get_requires_for_build_wheel -get_requires_for_build_sdist = _BACKEND.get_requires_for_build_sdist -prepare_metadata_for_build_wheel = _BACKEND.prepare_metadata_for_build_wheel -build_wheel = _BACKEND.build_wheel -build_sdist = _BACKEND.build_sdist - - -# The legacy backend -__legacy__ = _BuildMetaLegacyBackend() diff --git a/venv/lib/python3.8/site-packages/setuptools/cli-32.exe b/venv/lib/python3.8/site-packages/setuptools/cli-32.exe deleted file mode 100644 index b1487b7819e7286577a043c7726fbe0ca1543083..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/cli-32.exe and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/cli-64.exe b/venv/lib/python3.8/site-packages/setuptools/cli-64.exe deleted file mode 100644 index 675e6bf3743f3d3011c238657e7128ee9960ef7f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/cli-64.exe and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/cli.exe b/venv/lib/python3.8/site-packages/setuptools/cli.exe deleted file mode 100644 index b1487b7819e7286577a043c7726fbe0ca1543083..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/cli.exe and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__init__.py b/venv/lib/python3.8/site-packages/setuptools/command/__init__.py deleted file mode 100644 index 743f5588faf3ad79850df7bd196749e7a6c03f93..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -__all__ = [ - 'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop', - 'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts', - 'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts', - 'bdist_wininst', 'upload_docs', 'build_clib', 'dist_info', -] - -from distutils.command.bdist import bdist -import sys - -from setuptools.command import install_scripts - -if 'egg' not in bdist.format_commands: - bdist.format_command['egg'] = ('bdist_egg', "Python .egg file") - bdist.format_commands.append('egg') - -del bdist, sys diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 7d3d8022b24ed1911d41bebd9203408a9a45c550..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/alias.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/alias.cpython-38.pyc deleted file mode 100644 index 15b06616a778d5f34db6910cfb32e8a9d842e6bc..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/alias.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-38.pyc deleted file mode 100644 index 1884202cc75469669fc3c9d88fababc3a281f892..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-38.pyc deleted file mode 100644 index 8799adb7601bf7f1845e1f08fb6614222fcb7114..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_wininst.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_wininst.cpython-38.pyc deleted file mode 100644 index eca1d3d1169a257ccac66b28c8135e82ff5f96ce..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/bdist_wininst.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_clib.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_clib.cpython-38.pyc deleted file mode 100644 index cbfbacb28ac2c2121822691e192fb080d0dc26ec..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_clib.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_ext.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_ext.cpython-38.pyc deleted file mode 100644 index bd9f03498c599875bde13e5c39b85f122a0ef015..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_ext.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_py.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_py.cpython-38.pyc deleted file mode 100644 index c961acf21caccc3e8ca7063530a87343437e8267..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/build_py.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/develop.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/develop.cpython-38.pyc deleted file mode 100644 index 78aa846ed022b31f48307406b205143aa7188c50..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/develop.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/dist_info.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/dist_info.cpython-38.pyc deleted file mode 100644 index bc19eb6adeb652e0da2fa844d0f44ee06aa0de01..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/dist_info.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/easy_install.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/easy_install.cpython-38.pyc deleted file mode 100644 index b8e9c68e6cb9f74e4cf6397c516ef8a2f6a18df5..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/easy_install.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/egg_info.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/egg_info.cpython-38.pyc deleted file mode 100644 index 98a24594e6b68c06285aa07b4585e2d35810dc63..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/egg_info.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install.cpython-38.pyc deleted file mode 100644 index b0a25ff7aeaf4603a013d6b95f7f70bdb32156b8..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-38.pyc deleted file mode 100644 index 87e89de8724c516ae107ef0dab369b3e425f7186..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_lib.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_lib.cpython-38.pyc deleted file mode 100644 index ec643c9281ea2689db79a371ec81216fe20e30eb..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_lib.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_scripts.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_scripts.cpython-38.pyc deleted file mode 100644 index cde95838236c1ca51cf8c5daedb5ca666897c48b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/install_scripts.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/py36compat.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/py36compat.cpython-38.pyc deleted file mode 100644 index 6e75a12f5aa75bbbd57d3d5d82997da70425c755..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/py36compat.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/register.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/register.cpython-38.pyc deleted file mode 100644 index 3eb131c000e2dea729e8198cb82270224d6de345..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/register.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/rotate.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/rotate.cpython-38.pyc deleted file mode 100644 index f48b13c0afd477eadbe0e7d3924c8716c8ddad74..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/rotate.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/saveopts.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/saveopts.cpython-38.pyc deleted file mode 100644 index 4a0e3311dac3b9caaace70cf2b76df09ebad8f85..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/saveopts.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/sdist.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/sdist.cpython-38.pyc deleted file mode 100644 index 26c4112673611d7ac8b5ba2b5153cd37205be450..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/sdist.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/setopt.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/setopt.cpython-38.pyc deleted file mode 100644 index cdc953f0ace3d3bfd04d2729d26c46f44c7bbbb8..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/setopt.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/test.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/test.cpython-38.pyc deleted file mode 100644 index f700bb0ecfefd69495e22673bd67559e60eb07dd..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/test.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/upload.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/upload.cpython-38.pyc deleted file mode 100644 index ff7dab31ab30b4ec4e2d12a63d9e4d1525ae5e8f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/upload.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/upload_docs.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/upload_docs.cpython-38.pyc deleted file mode 100644 index 39bc48d6ebdb491d789483e488711dcc9c34518e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/command/__pycache__/upload_docs.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/command/alias.py b/venv/lib/python3.8/site-packages/setuptools/command/alias.py deleted file mode 100644 index 4532b1cc0dca76227927e873f9c64f01008e565a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/alias.py +++ /dev/null @@ -1,80 +0,0 @@ -from distutils.errors import DistutilsOptionError - -from setuptools.extern.six.moves import map - -from setuptools.command.setopt import edit_config, option_base, config_file - - -def shquote(arg): - """Quote an argument for later parsing by shlex.split()""" - for c in '"', "'", "\\", "#": - if c in arg: - return repr(arg) - if arg.split() != [arg]: - return repr(arg) - return arg - - -class alias(option_base): - """Define a shortcut that invokes one or more commands""" - - description = "define a shortcut to invoke one or more commands" - command_consumes_arguments = True - - user_options = [ - ('remove', 'r', 'remove (unset) the alias'), - ] + option_base.user_options - - boolean_options = option_base.boolean_options + ['remove'] - - def initialize_options(self): - option_base.initialize_options(self) - self.args = None - self.remove = None - - def finalize_options(self): - option_base.finalize_options(self) - if self.remove and len(self.args) != 1: - raise DistutilsOptionError( - "Must specify exactly one argument (the alias name) when " - "using --remove" - ) - - def run(self): - aliases = self.distribution.get_option_dict('aliases') - - if not self.args: - print("Command Aliases") - print("---------------") - for alias in aliases: - print("setup.py alias", format_alias(alias, aliases)) - return - - elif len(self.args) == 1: - alias, = self.args - if self.remove: - command = None - elif alias in aliases: - print("setup.py alias", format_alias(alias, aliases)) - return - else: - print("No alias definition found for %r" % alias) - return - else: - alias = self.args[0] - command = ' '.join(map(shquote, self.args[1:])) - - edit_config(self.filename, {'aliases': {alias: command}}, self.dry_run) - - -def format_alias(name, aliases): - source, command = aliases[name] - if source == config_file('global'): - source = '--global-config ' - elif source == config_file('user'): - source = '--user-config ' - elif source == config_file('local'): - source = '' - else: - source = '--filename=%r' % source - return source + name + ' ' + command diff --git a/venv/lib/python3.8/site-packages/setuptools/command/bdist_egg.py b/venv/lib/python3.8/site-packages/setuptools/command/bdist_egg.py deleted file mode 100644 index 98470f1715b21befab94b3e84428622a1ba86463..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/bdist_egg.py +++ /dev/null @@ -1,502 +0,0 @@ -"""setuptools.command.bdist_egg - -Build .egg distributions""" - -from distutils.errors import DistutilsSetupError -from distutils.dir_util import remove_tree, mkpath -from distutils import log -from types import CodeType -import sys -import os -import re -import textwrap -import marshal - -from setuptools.extern import six - -from pkg_resources import get_build_platform, Distribution, ensure_directory -from pkg_resources import EntryPoint -from setuptools.extension import Library -from setuptools import Command - -try: - # Python 2.7 or >=3.2 - from sysconfig import get_path, get_python_version - - def _get_purelib(): - return get_path("purelib") -except ImportError: - from distutils.sysconfig import get_python_lib, get_python_version - - def _get_purelib(): - return get_python_lib(False) - - -def strip_module(filename): - if '.' in filename: - filename = os.path.splitext(filename)[0] - if filename.endswith('module'): - filename = filename[:-6] - return filename - - -def sorted_walk(dir): - """Do os.walk in a reproducible way, - independent of indeterministic filesystem readdir order - """ - for base, dirs, files in os.walk(dir): - dirs.sort() - files.sort() - yield base, dirs, files - - -def write_stub(resource, pyfile): - _stub_template = textwrap.dedent(""" - def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__, %r) - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) - __bootstrap__() - """).lstrip() - with open(pyfile, 'w') as f: - f.write(_stub_template % resource) - - -class bdist_egg(Command): - description = "create an \"egg\" distribution" - - user_options = [ - ('bdist-dir=', 'b', - "temporary directory for creating the distribution"), - ('plat-name=', 'p', "platform name to embed in generated filenames " - "(default: %s)" % get_build_platform()), - ('exclude-source-files', None, - "remove all .py files from the generated egg"), - ('keep-temp', 'k', - "keep the pseudo-installation tree around after " + - "creating the distribution archive"), - ('dist-dir=', 'd', - "directory to put final built distributions in"), - ('skip-build', None, - "skip rebuilding everything (for testing/debugging)"), - ] - - boolean_options = [ - 'keep-temp', 'skip-build', 'exclude-source-files' - ] - - def initialize_options(self): - self.bdist_dir = None - self.plat_name = None - self.keep_temp = 0 - self.dist_dir = None - self.skip_build = 0 - self.egg_output = None - self.exclude_source_files = None - - def finalize_options(self): - ei_cmd = self.ei_cmd = self.get_finalized_command("egg_info") - self.egg_info = ei_cmd.egg_info - - if self.bdist_dir is None: - bdist_base = self.get_finalized_command('bdist').bdist_base - self.bdist_dir = os.path.join(bdist_base, 'egg') - - if self.plat_name is None: - self.plat_name = get_build_platform() - - self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) - - if self.egg_output is None: - - # Compute filename of the output egg - basename = Distribution( - None, None, ei_cmd.egg_name, ei_cmd.egg_version, - get_python_version(), - self.distribution.has_ext_modules() and self.plat_name - ).egg_name() - - self.egg_output = os.path.join(self.dist_dir, basename + '.egg') - - def do_install_data(self): - # Hack for packages that install data to install's --install-lib - self.get_finalized_command('install').install_lib = self.bdist_dir - - site_packages = os.path.normcase(os.path.realpath(_get_purelib())) - old, self.distribution.data_files = self.distribution.data_files, [] - - for item in old: - if isinstance(item, tuple) and len(item) == 2: - if os.path.isabs(item[0]): - realpath = os.path.realpath(item[0]) - normalized = os.path.normcase(realpath) - if normalized == site_packages or normalized.startswith( - site_packages + os.sep - ): - item = realpath[len(site_packages) + 1:], item[1] - # XXX else: raise ??? - self.distribution.data_files.append(item) - - try: - log.info("installing package data to %s", self.bdist_dir) - self.call_command('install_data', force=0, root=None) - finally: - self.distribution.data_files = old - - def get_outputs(self): - return [self.egg_output] - - def call_command(self, cmdname, **kw): - """Invoke reinitialized command `cmdname` with keyword args""" - for dirname in INSTALL_DIRECTORY_ATTRS: - kw.setdefault(dirname, self.bdist_dir) - kw.setdefault('skip_build', self.skip_build) - kw.setdefault('dry_run', self.dry_run) - cmd = self.reinitialize_command(cmdname, **kw) - self.run_command(cmdname) - return cmd - - def run(self): - # Generate metadata first - self.run_command("egg_info") - # We run install_lib before install_data, because some data hacks - # pull their data path from the install_lib command. - log.info("installing library code to %s", self.bdist_dir) - instcmd = self.get_finalized_command('install') - old_root = instcmd.root - instcmd.root = None - if self.distribution.has_c_libraries() and not self.skip_build: - self.run_command('build_clib') - cmd = self.call_command('install_lib', warn_dir=0) - instcmd.root = old_root - - all_outputs, ext_outputs = self.get_ext_outputs() - self.stubs = [] - to_compile = [] - for (p, ext_name) in enumerate(ext_outputs): - filename, ext = os.path.splitext(ext_name) - pyfile = os.path.join(self.bdist_dir, strip_module(filename) + - '.py') - self.stubs.append(pyfile) - log.info("creating stub loader for %s", ext_name) - if not self.dry_run: - write_stub(os.path.basename(ext_name), pyfile) - to_compile.append(pyfile) - ext_outputs[p] = ext_name.replace(os.sep, '/') - - if to_compile: - cmd.byte_compile(to_compile) - if self.distribution.data_files: - self.do_install_data() - - # Make the EGG-INFO directory - archive_root = self.bdist_dir - egg_info = os.path.join(archive_root, 'EGG-INFO') - self.mkpath(egg_info) - if self.distribution.scripts: - script_dir = os.path.join(egg_info, 'scripts') - log.info("installing scripts to %s", script_dir) - self.call_command('install_scripts', install_dir=script_dir, - no_ep=1) - - self.copy_metadata_to(egg_info) - native_libs = os.path.join(egg_info, "native_libs.txt") - if all_outputs: - log.info("writing %s", native_libs) - if not self.dry_run: - ensure_directory(native_libs) - libs_file = open(native_libs, 'wt') - libs_file.write('\n'.join(all_outputs)) - libs_file.write('\n') - libs_file.close() - elif os.path.isfile(native_libs): - log.info("removing %s", native_libs) - if not self.dry_run: - os.unlink(native_libs) - - write_safety_flag( - os.path.join(archive_root, 'EGG-INFO'), self.zip_safe() - ) - - if os.path.exists(os.path.join(self.egg_info, 'depends.txt')): - log.warn( - "WARNING: 'depends.txt' will not be used by setuptools 0.6!\n" - "Use the install_requires/extras_require setup() args instead." - ) - - if self.exclude_source_files: - self.zap_pyfiles() - - # Make the archive - make_zipfile(self.egg_output, archive_root, verbose=self.verbose, - dry_run=self.dry_run, mode=self.gen_header()) - if not self.keep_temp: - remove_tree(self.bdist_dir, dry_run=self.dry_run) - - # Add to 'Distribution.dist_files' so that the "upload" command works - getattr(self.distribution, 'dist_files', []).append( - ('bdist_egg', get_python_version(), self.egg_output)) - - def zap_pyfiles(self): - log.info("Removing .py files from temporary directory") - for base, dirs, files in walk_egg(self.bdist_dir): - for name in files: - path = os.path.join(base, name) - - if name.endswith('.py'): - log.debug("Deleting %s", path) - os.unlink(path) - - if base.endswith('__pycache__'): - path_old = path - - pattern = r'(?P.+)\.(?P[^.]+)\.pyc' - m = re.match(pattern, name) - path_new = os.path.join( - base, os.pardir, m.group('name') + '.pyc') - log.info( - "Renaming file from [%s] to [%s]" - % (path_old, path_new)) - try: - os.remove(path_new) - except OSError: - pass - os.rename(path_old, path_new) - - def zip_safe(self): - safe = getattr(self.distribution, 'zip_safe', None) - if safe is not None: - return safe - log.warn("zip_safe flag not set; analyzing archive contents...") - return analyze_egg(self.bdist_dir, self.stubs) - - def gen_header(self): - epm = EntryPoint.parse_map(self.distribution.entry_points or '') - ep = epm.get('setuptools.installation', {}).get('eggsecutable') - if ep is None: - return 'w' # not an eggsecutable, do it the usual way. - - if not ep.attrs or ep.extras: - raise DistutilsSetupError( - "eggsecutable entry point (%r) cannot have 'extras' " - "or refer to a module" % (ep,) - ) - - pyver = '{}.{}'.format(*sys.version_info) - pkg = ep.module_name - full = '.'.join(ep.attrs) - base = ep.attrs[0] - basename = os.path.basename(self.egg_output) - - header = ( - "#!/bin/sh\n" - 'if [ `basename $0` = "%(basename)s" ]\n' - 'then exec python%(pyver)s -c "' - "import sys, os; sys.path.insert(0, os.path.abspath('$0')); " - "from %(pkg)s import %(base)s; sys.exit(%(full)s())" - '" "$@"\n' - 'else\n' - ' echo $0 is not the correct name for this egg file.\n' - ' echo Please rename it back to %(basename)s and try again.\n' - ' exec false\n' - 'fi\n' - ) % locals() - - if not self.dry_run: - mkpath(os.path.dirname(self.egg_output), dry_run=self.dry_run) - f = open(self.egg_output, 'w') - f.write(header) - f.close() - return 'a' - - def copy_metadata_to(self, target_dir): - "Copy metadata (egg info) to the target_dir" - # normalize the path (so that a forward-slash in egg_info will - # match using startswith below) - norm_egg_info = os.path.normpath(self.egg_info) - prefix = os.path.join(norm_egg_info, '') - for path in self.ei_cmd.filelist.files: - if path.startswith(prefix): - target = os.path.join(target_dir, path[len(prefix):]) - ensure_directory(target) - self.copy_file(path, target) - - def get_ext_outputs(self): - """Get a list of relative paths to C extensions in the output distro""" - - all_outputs = [] - ext_outputs = [] - - paths = {self.bdist_dir: ''} - for base, dirs, files in sorted_walk(self.bdist_dir): - for filename in files: - if os.path.splitext(filename)[1].lower() in NATIVE_EXTENSIONS: - all_outputs.append(paths[base] + filename) - for filename in dirs: - paths[os.path.join(base, filename)] = (paths[base] + - filename + '/') - - if self.distribution.has_ext_modules(): - build_cmd = self.get_finalized_command('build_ext') - for ext in build_cmd.extensions: - if isinstance(ext, Library): - continue - fullname = build_cmd.get_ext_fullname(ext.name) - filename = build_cmd.get_ext_filename(fullname) - if not os.path.basename(filename).startswith('dl-'): - if os.path.exists(os.path.join(self.bdist_dir, filename)): - ext_outputs.append(filename) - - return all_outputs, ext_outputs - - -NATIVE_EXTENSIONS = dict.fromkeys('.dll .so .dylib .pyd'.split()) - - -def walk_egg(egg_dir): - """Walk an unpacked egg's contents, skipping the metadata directory""" - walker = sorted_walk(egg_dir) - base, dirs, files = next(walker) - if 'EGG-INFO' in dirs: - dirs.remove('EGG-INFO') - yield base, dirs, files - for bdf in walker: - yield bdf - - -def analyze_egg(egg_dir, stubs): - # check for existing flag in EGG-INFO - for flag, fn in safety_flags.items(): - if os.path.exists(os.path.join(egg_dir, 'EGG-INFO', fn)): - return flag - if not can_scan(): - return False - safe = True - for base, dirs, files in walk_egg(egg_dir): - for name in files: - if name.endswith('.py') or name.endswith('.pyw'): - continue - elif name.endswith('.pyc') or name.endswith('.pyo'): - # always scan, even if we already know we're not safe - safe = scan_module(egg_dir, base, name, stubs) and safe - return safe - - -def write_safety_flag(egg_dir, safe): - # Write or remove zip safety flag file(s) - for flag, fn in safety_flags.items(): - fn = os.path.join(egg_dir, fn) - if os.path.exists(fn): - if safe is None or bool(safe) != flag: - os.unlink(fn) - elif safe is not None and bool(safe) == flag: - f = open(fn, 'wt') - f.write('\n') - f.close() - - -safety_flags = { - True: 'zip-safe', - False: 'not-zip-safe', -} - - -def scan_module(egg_dir, base, name, stubs): - """Check whether module possibly uses unsafe-for-zipfile stuff""" - - filename = os.path.join(base, name) - if filename[:-1] in stubs: - return True # Extension module - pkg = base[len(egg_dir) + 1:].replace(os.sep, '.') - module = pkg + (pkg and '.' or '') + os.path.splitext(name)[0] - if six.PY2: - skip = 8 # skip magic & date - elif sys.version_info < (3, 7): - skip = 12 # skip magic & date & file size - else: - skip = 16 # skip magic & reserved? & date & file size - f = open(filename, 'rb') - f.read(skip) - code = marshal.load(f) - f.close() - safe = True - symbols = dict.fromkeys(iter_symbols(code)) - for bad in ['__file__', '__path__']: - if bad in symbols: - log.warn("%s: module references %s", module, bad) - safe = False - if 'inspect' in symbols: - for bad in [ - 'getsource', 'getabsfile', 'getsourcefile', 'getfile' - 'getsourcelines', 'findsource', 'getcomments', 'getframeinfo', - 'getinnerframes', 'getouterframes', 'stack', 'trace' - ]: - if bad in symbols: - log.warn("%s: module MAY be using inspect.%s", module, bad) - safe = False - return safe - - -def iter_symbols(code): - """Yield names and strings used by `code` and its nested code objects""" - for name in code.co_names: - yield name - for const in code.co_consts: - if isinstance(const, six.string_types): - yield const - elif isinstance(const, CodeType): - for name in iter_symbols(const): - yield name - - -def can_scan(): - if not sys.platform.startswith('java') and sys.platform != 'cli': - # CPython, PyPy, etc. - return True - log.warn("Unable to analyze compiled code on this platform.") - log.warn("Please ask the author to include a 'zip_safe'" - " setting (either True or False) in the package's setup.py") - - -# Attribute names of options for commands that might need to be convinced to -# install to the egg build directory - -INSTALL_DIRECTORY_ATTRS = [ - 'install_lib', 'install_dir', 'install_data', 'install_base' -] - - -def make_zipfile(zip_filename, base_dir, verbose=0, dry_run=0, compress=True, - mode='w'): - """Create a zip file from all the files under 'base_dir'. The output - zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" - Python module (if available) or the InfoZIP "zip" utility (if installed - and found on the default search path). If neither tool is available, - raises DistutilsExecError. Returns the name of the output zip file. - """ - import zipfile - - mkpath(os.path.dirname(zip_filename), dry_run=dry_run) - log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) - - def visit(z, dirname, names): - for name in names: - path = os.path.normpath(os.path.join(dirname, name)) - if os.path.isfile(path): - p = path[len(base_dir) + 1:] - if not dry_run: - z.write(path, p) - log.debug("adding '%s'", p) - - compression = zipfile.ZIP_DEFLATED if compress else zipfile.ZIP_STORED - if not dry_run: - z = zipfile.ZipFile(zip_filename, mode, compression=compression) - for dirname, dirs, files in sorted_walk(base_dir): - visit(z, dirname, files) - z.close() - else: - for dirname, dirs, files in sorted_walk(base_dir): - visit(None, dirname, files) - return zip_filename diff --git a/venv/lib/python3.8/site-packages/setuptools/command/bdist_rpm.py b/venv/lib/python3.8/site-packages/setuptools/command/bdist_rpm.py deleted file mode 100644 index 70730927ecaed778ebbdee98eb37c24ec3f1a8e6..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/bdist_rpm.py +++ /dev/null @@ -1,43 +0,0 @@ -import distutils.command.bdist_rpm as orig - - -class bdist_rpm(orig.bdist_rpm): - """ - Override the default bdist_rpm behavior to do the following: - - 1. Run egg_info to ensure the name and version are properly calculated. - 2. Always run 'install' using --single-version-externally-managed to - disable eggs in RPM distributions. - 3. Replace dash with underscore in the version numbers for better RPM - compatibility. - """ - - def run(self): - # ensure distro name is up-to-date - self.run_command('egg_info') - - orig.bdist_rpm.run(self) - - def _make_spec_file(self): - version = self.distribution.get_version() - rpmversion = version.replace('-', '_') - spec = orig.bdist_rpm._make_spec_file(self) - line23 = '%define version ' + version - line24 = '%define version ' + rpmversion - spec = [ - line.replace( - "Source0: %{name}-%{version}.tar", - "Source0: %{name}-%{unmangled_version}.tar" - ).replace( - "setup.py install ", - "setup.py install --single-version-externally-managed " - ).replace( - "%setup", - "%setup -n %{name}-%{unmangled_version}" - ).replace(line23, line24) - for line in spec - ] - insert_loc = spec.index(line24) + 1 - unmangled_version = "%define unmangled_version " + version - spec.insert(insert_loc, unmangled_version) - return spec diff --git a/venv/lib/python3.8/site-packages/setuptools/command/bdist_wininst.py b/venv/lib/python3.8/site-packages/setuptools/command/bdist_wininst.py deleted file mode 100644 index 073de97b46c92e2e221cade8c1350ab2c5cff891..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/bdist_wininst.py +++ /dev/null @@ -1,21 +0,0 @@ -import distutils.command.bdist_wininst as orig - - -class bdist_wininst(orig.bdist_wininst): - def reinitialize_command(self, command, reinit_subcommands=0): - """ - Supplement reinitialize_command to work around - http://bugs.python.org/issue20819 - """ - cmd = self.distribution.reinitialize_command( - command, reinit_subcommands) - if command in ('install', 'install_lib'): - cmd.install_lib = None - return cmd - - def run(self): - self._is_running = True - try: - orig.bdist_wininst.run(self) - finally: - self._is_running = False diff --git a/venv/lib/python3.8/site-packages/setuptools/command/build_clib.py b/venv/lib/python3.8/site-packages/setuptools/command/build_clib.py deleted file mode 100644 index 09caff6ffde8fc3f368cb635dc3cbbbc8851530d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/build_clib.py +++ /dev/null @@ -1,98 +0,0 @@ -import distutils.command.build_clib as orig -from distutils.errors import DistutilsSetupError -from distutils import log -from setuptools.dep_util import newer_pairwise_group - - -class build_clib(orig.build_clib): - """ - Override the default build_clib behaviour to do the following: - - 1. Implement a rudimentary timestamp-based dependency system - so 'compile()' doesn't run every time. - 2. Add more keys to the 'build_info' dictionary: - * obj_deps - specify dependencies for each object compiled. - this should be a dictionary mapping a key - with the source filename to a list of - dependencies. Use an empty string for global - dependencies. - * cflags - specify a list of additional flags to pass to - the compiler. - """ - - def build_libraries(self, libraries): - for (lib_name, build_info) in libraries: - sources = build_info.get('sources') - if sources is None or not isinstance(sources, (list, tuple)): - raise DistutilsSetupError( - "in 'libraries' option (library '%s'), " - "'sources' must be present and must be " - "a list of source filenames" % lib_name) - sources = list(sources) - - log.info("building '%s' library", lib_name) - - # Make sure everything is the correct type. - # obj_deps should be a dictionary of keys as sources - # and a list/tuple of files that are its dependencies. - obj_deps = build_info.get('obj_deps', dict()) - if not isinstance(obj_deps, dict): - raise DistutilsSetupError( - "in 'libraries' option (library '%s'), " - "'obj_deps' must be a dictionary of " - "type 'source: list'" % lib_name) - dependencies = [] - - # Get the global dependencies that are specified by the '' key. - # These will go into every source's dependency list. - global_deps = obj_deps.get('', list()) - if not isinstance(global_deps, (list, tuple)): - raise DistutilsSetupError( - "in 'libraries' option (library '%s'), " - "'obj_deps' must be a dictionary of " - "type 'source: list'" % lib_name) - - # Build the list to be used by newer_pairwise_group - # each source will be auto-added to its dependencies. - for source in sources: - src_deps = [source] - src_deps.extend(global_deps) - extra_deps = obj_deps.get(source, list()) - if not isinstance(extra_deps, (list, tuple)): - raise DistutilsSetupError( - "in 'libraries' option (library '%s'), " - "'obj_deps' must be a dictionary of " - "type 'source: list'" % lib_name) - src_deps.extend(extra_deps) - dependencies.append(src_deps) - - expected_objects = self.compiler.object_filenames( - sources, - output_dir=self.build_temp - ) - - if newer_pairwise_group(dependencies, expected_objects) != ([], []): - # First, compile the source code to object files in the library - # directory. (This should probably change to putting object - # files in a temporary build directory.) - macros = build_info.get('macros') - include_dirs = build_info.get('include_dirs') - cflags = build_info.get('cflags') - objects = self.compiler.compile( - sources, - output_dir=self.build_temp, - macros=macros, - include_dirs=include_dirs, - extra_postargs=cflags, - debug=self.debug - ) - - # Now "link" the object files together into a static library. - # (On Unix at least, this isn't really linking -- it just - # builds an archive. Whatever.) - self.compiler.create_static_lib( - expected_objects, - lib_name, - output_dir=self.build_clib, - debug=self.debug - ) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/build_ext.py b/venv/lib/python3.8/site-packages/setuptools/command/build_ext.py deleted file mode 100644 index daa8e4fe81c18e8fc3e07718b4a66137b062127e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/build_ext.py +++ /dev/null @@ -1,327 +0,0 @@ -import os -import sys -import itertools -from distutils.command.build_ext import build_ext as _du_build_ext -from distutils.file_util import copy_file -from distutils.ccompiler import new_compiler -from distutils.sysconfig import customize_compiler, get_config_var -from distutils.errors import DistutilsError -from distutils import log - -from setuptools.extension import Library -from setuptools.extern import six - -if six.PY2: - import imp - - EXTENSION_SUFFIXES = [s for s, _, tp in imp.get_suffixes() if tp == imp.C_EXTENSION] -else: - from importlib.machinery import EXTENSION_SUFFIXES - -try: - # Attempt to use Cython for building extensions, if available - from Cython.Distutils.build_ext import build_ext as _build_ext - # Additionally, assert that the compiler module will load - # also. Ref #1229. - __import__('Cython.Compiler.Main') -except ImportError: - _build_ext = _du_build_ext - -# make sure _config_vars is initialized -get_config_var("LDSHARED") -from distutils.sysconfig import _config_vars as _CONFIG_VARS - - -def _customize_compiler_for_shlib(compiler): - if sys.platform == "darwin": - # building .dylib requires additional compiler flags on OSX; here we - # temporarily substitute the pyconfig.h variables so that distutils' - # 'customize_compiler' uses them before we build the shared libraries. - tmp = _CONFIG_VARS.copy() - try: - # XXX Help! I don't have any idea whether these are right... - _CONFIG_VARS['LDSHARED'] = ( - "gcc -Wl,-x -dynamiclib -undefined dynamic_lookup") - _CONFIG_VARS['CCSHARED'] = " -dynamiclib" - _CONFIG_VARS['SO'] = ".dylib" - customize_compiler(compiler) - finally: - _CONFIG_VARS.clear() - _CONFIG_VARS.update(tmp) - else: - customize_compiler(compiler) - - -have_rtld = False -use_stubs = False -libtype = 'shared' - -if sys.platform == "darwin": - use_stubs = True -elif os.name != 'nt': - try: - import dl - use_stubs = have_rtld = hasattr(dl, 'RTLD_NOW') - except ImportError: - pass - -if_dl = lambda s: s if have_rtld else '' - - -def get_abi3_suffix(): - """Return the file extension for an abi3-compliant Extension()""" - for suffix in EXTENSION_SUFFIXES: - if '.abi3' in suffix: # Unix - return suffix - elif suffix == '.pyd': # Windows - return suffix - - -class build_ext(_build_ext): - def run(self): - """Build extensions in build directory, then copy if --inplace""" - old_inplace, self.inplace = self.inplace, 0 - _build_ext.run(self) - self.inplace = old_inplace - if old_inplace: - self.copy_extensions_to_source() - - def copy_extensions_to_source(self): - build_py = self.get_finalized_command('build_py') - for ext in self.extensions: - fullname = self.get_ext_fullname(ext.name) - filename = self.get_ext_filename(fullname) - modpath = fullname.split('.') - package = '.'.join(modpath[:-1]) - package_dir = build_py.get_package_dir(package) - dest_filename = os.path.join(package_dir, - os.path.basename(filename)) - src_filename = os.path.join(self.build_lib, filename) - - # Always copy, even if source is older than destination, to ensure - # that the right extensions for the current Python/platform are - # used. - copy_file( - src_filename, dest_filename, verbose=self.verbose, - dry_run=self.dry_run - ) - if ext._needs_stub: - self.write_stub(package_dir or os.curdir, ext, True) - - def get_ext_filename(self, fullname): - filename = _build_ext.get_ext_filename(self, fullname) - if fullname in self.ext_map: - ext = self.ext_map[fullname] - use_abi3 = ( - six.PY3 - and getattr(ext, 'py_limited_api') - and get_abi3_suffix() - ) - if use_abi3: - so_ext = get_config_var('EXT_SUFFIX') - filename = filename[:-len(so_ext)] - filename = filename + get_abi3_suffix() - if isinstance(ext, Library): - fn, ext = os.path.splitext(filename) - return self.shlib_compiler.library_filename(fn, libtype) - elif use_stubs and ext._links_to_dynamic: - d, fn = os.path.split(filename) - return os.path.join(d, 'dl-' + fn) - return filename - - def initialize_options(self): - _build_ext.initialize_options(self) - self.shlib_compiler = None - self.shlibs = [] - self.ext_map = {} - - def finalize_options(self): - _build_ext.finalize_options(self) - self.extensions = self.extensions or [] - self.check_extensions_list(self.extensions) - self.shlibs = [ext for ext in self.extensions - if isinstance(ext, Library)] - if self.shlibs: - self.setup_shlib_compiler() - for ext in self.extensions: - ext._full_name = self.get_ext_fullname(ext.name) - for ext in self.extensions: - fullname = ext._full_name - self.ext_map[fullname] = ext - - # distutils 3.1 will also ask for module names - # XXX what to do with conflicts? - self.ext_map[fullname.split('.')[-1]] = ext - - ltd = self.shlibs and self.links_to_dynamic(ext) or False - ns = ltd and use_stubs and not isinstance(ext, Library) - ext._links_to_dynamic = ltd - ext._needs_stub = ns - filename = ext._file_name = self.get_ext_filename(fullname) - libdir = os.path.dirname(os.path.join(self.build_lib, filename)) - if ltd and libdir not in ext.library_dirs: - ext.library_dirs.append(libdir) - if ltd and use_stubs and os.curdir not in ext.runtime_library_dirs: - ext.runtime_library_dirs.append(os.curdir) - - def setup_shlib_compiler(self): - compiler = self.shlib_compiler = new_compiler( - compiler=self.compiler, dry_run=self.dry_run, force=self.force - ) - _customize_compiler_for_shlib(compiler) - - if self.include_dirs is not None: - compiler.set_include_dirs(self.include_dirs) - if self.define is not None: - # 'define' option is a list of (name,value) tuples - for (name, value) in self.define: - compiler.define_macro(name, value) - if self.undef is not None: - for macro in self.undef: - compiler.undefine_macro(macro) - if self.libraries is not None: - compiler.set_libraries(self.libraries) - if self.library_dirs is not None: - compiler.set_library_dirs(self.library_dirs) - if self.rpath is not None: - compiler.set_runtime_library_dirs(self.rpath) - if self.link_objects is not None: - compiler.set_link_objects(self.link_objects) - - # hack so distutils' build_extension() builds a library instead - compiler.link_shared_object = link_shared_object.__get__(compiler) - - def get_export_symbols(self, ext): - if isinstance(ext, Library): - return ext.export_symbols - return _build_ext.get_export_symbols(self, ext) - - def build_extension(self, ext): - ext._convert_pyx_sources_to_lang() - _compiler = self.compiler - try: - if isinstance(ext, Library): - self.compiler = self.shlib_compiler - _build_ext.build_extension(self, ext) - if ext._needs_stub: - cmd = self.get_finalized_command('build_py').build_lib - self.write_stub(cmd, ext) - finally: - self.compiler = _compiler - - def links_to_dynamic(self, ext): - """Return true if 'ext' links to a dynamic lib in the same package""" - # XXX this should check to ensure the lib is actually being built - # XXX as dynamic, and not just using a locally-found version or a - # XXX static-compiled version - libnames = dict.fromkeys([lib._full_name for lib in self.shlibs]) - pkg = '.'.join(ext._full_name.split('.')[:-1] + ['']) - return any(pkg + libname in libnames for libname in ext.libraries) - - def get_outputs(self): - return _build_ext.get_outputs(self) + self.__get_stubs_outputs() - - def __get_stubs_outputs(self): - # assemble the base name for each extension that needs a stub - ns_ext_bases = ( - os.path.join(self.build_lib, *ext._full_name.split('.')) - for ext in self.extensions - if ext._needs_stub - ) - # pair each base with the extension - pairs = itertools.product(ns_ext_bases, self.__get_output_extensions()) - return list(base + fnext for base, fnext in pairs) - - def __get_output_extensions(self): - yield '.py' - yield '.pyc' - if self.get_finalized_command('build_py').optimize: - yield '.pyo' - - def write_stub(self, output_dir, ext, compile=False): - log.info("writing stub loader for %s to %s", ext._full_name, - output_dir) - stub_file = (os.path.join(output_dir, *ext._full_name.split('.')) + - '.py') - if compile and os.path.exists(stub_file): - raise DistutilsError(stub_file + " already exists! Please delete.") - if not self.dry_run: - f = open(stub_file, 'w') - f.write( - '\n'.join([ - "def __bootstrap__():", - " global __bootstrap__, __file__, __loader__", - " import sys, os, pkg_resources, imp" + if_dl(", dl"), - " __file__ = pkg_resources.resource_filename" - "(__name__,%r)" - % os.path.basename(ext._file_name), - " del __bootstrap__", - " if '__loader__' in globals():", - " del __loader__", - if_dl(" old_flags = sys.getdlopenflags()"), - " old_dir = os.getcwd()", - " try:", - " os.chdir(os.path.dirname(__file__))", - if_dl(" sys.setdlopenflags(dl.RTLD_NOW)"), - " imp.load_dynamic(__name__,__file__)", - " finally:", - if_dl(" sys.setdlopenflags(old_flags)"), - " os.chdir(old_dir)", - "__bootstrap__()", - "" # terminal \n - ]) - ) - f.close() - if compile: - from distutils.util import byte_compile - - byte_compile([stub_file], optimize=0, - force=True, dry_run=self.dry_run) - optimize = self.get_finalized_command('install_lib').optimize - if optimize > 0: - byte_compile([stub_file], optimize=optimize, - force=True, dry_run=self.dry_run) - if os.path.exists(stub_file) and not self.dry_run: - os.unlink(stub_file) - - -if use_stubs or os.name == 'nt': - # Build shared libraries - # - def link_shared_object( - self, objects, output_libname, output_dir=None, libraries=None, - library_dirs=None, runtime_library_dirs=None, export_symbols=None, - debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, - target_lang=None): - self.link( - self.SHARED_LIBRARY, objects, output_libname, - output_dir, libraries, library_dirs, runtime_library_dirs, - export_symbols, debug, extra_preargs, extra_postargs, - build_temp, target_lang - ) -else: - # Build static libraries everywhere else - libtype = 'static' - - def link_shared_object( - self, objects, output_libname, output_dir=None, libraries=None, - library_dirs=None, runtime_library_dirs=None, export_symbols=None, - debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, - target_lang=None): - # XXX we need to either disallow these attrs on Library instances, - # or warn/abort here if set, or something... - # libraries=None, library_dirs=None, runtime_library_dirs=None, - # export_symbols=None, extra_preargs=None, extra_postargs=None, - # build_temp=None - - assert output_dir is None # distutils build_ext doesn't pass this - output_dir, filename = os.path.split(output_libname) - basename, ext = os.path.splitext(filename) - if self.library_filename("x").startswith('lib'): - # strip 'lib' prefix; this is kludgy if some platform uses - # a different prefix - basename = basename[3:] - - self.create_static_lib( - objects, basename, output_dir, debug, target_lang - ) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/build_py.py b/venv/lib/python3.8/site-packages/setuptools/command/build_py.py deleted file mode 100644 index b0314fd413ae7f8c1027ccde0b092fd493fb104b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/build_py.py +++ /dev/null @@ -1,270 +0,0 @@ -from glob import glob -from distutils.util import convert_path -import distutils.command.build_py as orig -import os -import fnmatch -import textwrap -import io -import distutils.errors -import itertools - -from setuptools.extern import six -from setuptools.extern.six.moves import map, filter, filterfalse - -try: - from setuptools.lib2to3_ex import Mixin2to3 -except ImportError: - - class Mixin2to3: - def run_2to3(self, files, doctests=True): - "do nothing" - - -class build_py(orig.build_py, Mixin2to3): - """Enhanced 'build_py' command that includes data files with packages - - The data files are specified via a 'package_data' argument to 'setup()'. - See 'setuptools.dist.Distribution' for more details. - - Also, this version of the 'build_py' command allows you to specify both - 'py_modules' and 'packages' in the same setup operation. - """ - - def finalize_options(self): - orig.build_py.finalize_options(self) - self.package_data = self.distribution.package_data - self.exclude_package_data = (self.distribution.exclude_package_data or - {}) - if 'data_files' in self.__dict__: - del self.__dict__['data_files'] - self.__updated_files = [] - self.__doctests_2to3 = [] - - def run(self): - """Build modules, packages, and copy data files to build directory""" - if not self.py_modules and not self.packages: - return - - if self.py_modules: - self.build_modules() - - if self.packages: - self.build_packages() - self.build_package_data() - - self.run_2to3(self.__updated_files, False) - self.run_2to3(self.__updated_files, True) - self.run_2to3(self.__doctests_2to3, True) - - # Only compile actual .py files, using our base class' idea of what our - # output files are. - self.byte_compile(orig.build_py.get_outputs(self, include_bytecode=0)) - - def __getattr__(self, attr): - "lazily compute data files" - if attr == 'data_files': - self.data_files = self._get_data_files() - return self.data_files - return orig.build_py.__getattr__(self, attr) - - def build_module(self, module, module_file, package): - if six.PY2 and isinstance(package, six.string_types): - # avoid errors on Python 2 when unicode is passed (#190) - package = package.split('.') - outfile, copied = orig.build_py.build_module(self, module, module_file, - package) - if copied: - self.__updated_files.append(outfile) - return outfile, copied - - def _get_data_files(self): - """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" - self.analyze_manifest() - return list(map(self._get_pkg_data_files, self.packages or ())) - - def _get_pkg_data_files(self, package): - # Locate package source directory - src_dir = self.get_package_dir(package) - - # Compute package build directory - build_dir = os.path.join(*([self.build_lib] + package.split('.'))) - - # Strip directory from globbed filenames - filenames = [ - os.path.relpath(file, src_dir) - for file in self.find_data_files(package, src_dir) - ] - return package, src_dir, build_dir, filenames - - def find_data_files(self, package, src_dir): - """Return filenames for package's data files in 'src_dir'""" - patterns = self._get_platform_patterns( - self.package_data, - package, - src_dir, - ) - globs_expanded = map(glob, patterns) - # flatten the expanded globs into an iterable of matches - globs_matches = itertools.chain.from_iterable(globs_expanded) - glob_files = filter(os.path.isfile, globs_matches) - files = itertools.chain( - self.manifest_files.get(package, []), - glob_files, - ) - return self.exclude_data_files(package, src_dir, files) - - def build_package_data(self): - """Copy data files into build directory""" - for package, src_dir, build_dir, filenames in self.data_files: - for filename in filenames: - target = os.path.join(build_dir, filename) - self.mkpath(os.path.dirname(target)) - srcfile = os.path.join(src_dir, filename) - outf, copied = self.copy_file(srcfile, target) - srcfile = os.path.abspath(srcfile) - if (copied and - srcfile in self.distribution.convert_2to3_doctests): - self.__doctests_2to3.append(outf) - - def analyze_manifest(self): - self.manifest_files = mf = {} - if not self.distribution.include_package_data: - return - src_dirs = {} - for package in self.packages or (): - # Locate package source directory - src_dirs[assert_relative(self.get_package_dir(package))] = package - - self.run_command('egg_info') - ei_cmd = self.get_finalized_command('egg_info') - for path in ei_cmd.filelist.files: - d, f = os.path.split(assert_relative(path)) - prev = None - oldf = f - while d and d != prev and d not in src_dirs: - prev = d - d, df = os.path.split(d) - f = os.path.join(df, f) - if d in src_dirs: - if path.endswith('.py') and f == oldf: - continue # it's a module, not data - mf.setdefault(src_dirs[d], []).append(path) - - def get_data_files(self): - pass # Lazily compute data files in _get_data_files() function. - - def check_package(self, package, package_dir): - """Check namespace packages' __init__ for declare_namespace""" - try: - return self.packages_checked[package] - except KeyError: - pass - - init_py = orig.build_py.check_package(self, package, package_dir) - self.packages_checked[package] = init_py - - if not init_py or not self.distribution.namespace_packages: - return init_py - - for pkg in self.distribution.namespace_packages: - if pkg == package or pkg.startswith(package + '.'): - break - else: - return init_py - - with io.open(init_py, 'rb') as f: - contents = f.read() - if b'declare_namespace' not in contents: - raise distutils.errors.DistutilsError( - "Namespace package problem: %s is a namespace package, but " - "its\n__init__.py does not call declare_namespace()! Please " - 'fix it.\n(See the setuptools manual under ' - '"Namespace Packages" for details.)\n"' % (package,) - ) - return init_py - - def initialize_options(self): - self.packages_checked = {} - orig.build_py.initialize_options(self) - - def get_package_dir(self, package): - res = orig.build_py.get_package_dir(self, package) - if self.distribution.src_root is not None: - return os.path.join(self.distribution.src_root, res) - return res - - def exclude_data_files(self, package, src_dir, files): - """Filter filenames for package's data files in 'src_dir'""" - files = list(files) - patterns = self._get_platform_patterns( - self.exclude_package_data, - package, - src_dir, - ) - match_groups = ( - fnmatch.filter(files, pattern) - for pattern in patterns - ) - # flatten the groups of matches into an iterable of matches - matches = itertools.chain.from_iterable(match_groups) - bad = set(matches) - keepers = ( - fn - for fn in files - if fn not in bad - ) - # ditch dupes - return list(_unique_everseen(keepers)) - - @staticmethod - def _get_platform_patterns(spec, package, src_dir): - """ - yield platform-specific path patterns (suitable for glob - or fn_match) from a glob-based spec (such as - self.package_data or self.exclude_package_data) - matching package in src_dir. - """ - raw_patterns = itertools.chain( - spec.get('', []), - spec.get(package, []), - ) - return ( - # Each pattern has to be converted to a platform-specific path - os.path.join(src_dir, convert_path(pattern)) - for pattern in raw_patterns - ) - - -# from Python docs -def _unique_everseen(iterable, key=None): - "List unique elements, preserving order. Remember all elements ever seen." - # unique_everseen('AAAABBBCCDAABBB') --> A B C D - # unique_everseen('ABBCcAD', str.lower) --> A B C D - seen = set() - seen_add = seen.add - if key is None: - for element in filterfalse(seen.__contains__, iterable): - seen_add(element) - yield element - else: - for element in iterable: - k = key(element) - if k not in seen: - seen_add(k) - yield element - - -def assert_relative(path): - if not os.path.isabs(path): - return path - from distutils.errors import DistutilsSetupError - - msg = textwrap.dedent(""" - Error: setup script specifies an absolute path: - - %s - - setup() arguments must *always* be /-separated paths relative to the - setup.py directory, *never* absolute paths. - """).lstrip() % path - raise DistutilsSetupError(msg) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/develop.py b/venv/lib/python3.8/site-packages/setuptools/command/develop.py deleted file mode 100644 index 009e4f9368f5b29fffd160f3b712fb0cd19807bd..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/develop.py +++ /dev/null @@ -1,221 +0,0 @@ -from distutils.util import convert_path -from distutils import log -from distutils.errors import DistutilsError, DistutilsOptionError -import os -import glob -import io - -from setuptools.extern import six - -import pkg_resources -from setuptools.command.easy_install import easy_install -from setuptools import namespaces -import setuptools - -__metaclass__ = type - - -class develop(namespaces.DevelopInstaller, easy_install): - """Set up package for development""" - - description = "install package in 'development mode'" - - user_options = easy_install.user_options + [ - ("uninstall", "u", "Uninstall this source package"), - ("egg-path=", None, "Set the path to be used in the .egg-link file"), - ] - - boolean_options = easy_install.boolean_options + ['uninstall'] - - command_consumes_arguments = False # override base - - def run(self): - if self.uninstall: - self.multi_version = True - self.uninstall_link() - self.uninstall_namespaces() - else: - self.install_for_development() - self.warn_deprecated_options() - - def initialize_options(self): - self.uninstall = None - self.egg_path = None - easy_install.initialize_options(self) - self.setup_path = None - self.always_copy_from = '.' # always copy eggs installed in curdir - - def finalize_options(self): - ei = self.get_finalized_command("egg_info") - if ei.broken_egg_info: - template = "Please rename %r to %r before using 'develop'" - args = ei.egg_info, ei.broken_egg_info - raise DistutilsError(template % args) - self.args = [ei.egg_name] - - easy_install.finalize_options(self) - self.expand_basedirs() - self.expand_dirs() - # pick up setup-dir .egg files only: no .egg-info - self.package_index.scan(glob.glob('*.egg')) - - egg_link_fn = ei.egg_name + '.egg-link' - self.egg_link = os.path.join(self.install_dir, egg_link_fn) - self.egg_base = ei.egg_base - if self.egg_path is None: - self.egg_path = os.path.abspath(ei.egg_base) - - target = pkg_resources.normalize_path(self.egg_base) - egg_path = pkg_resources.normalize_path( - os.path.join(self.install_dir, self.egg_path)) - if egg_path != target: - raise DistutilsOptionError( - "--egg-path must be a relative path from the install" - " directory to " + target - ) - - # Make a distribution for the package's source - self.dist = pkg_resources.Distribution( - target, - pkg_resources.PathMetadata(target, os.path.abspath(ei.egg_info)), - project_name=ei.egg_name - ) - - self.setup_path = self._resolve_setup_path( - self.egg_base, - self.install_dir, - self.egg_path, - ) - - @staticmethod - def _resolve_setup_path(egg_base, install_dir, egg_path): - """ - Generate a path from egg_base back to '.' where the - setup script resides and ensure that path points to the - setup path from $install_dir/$egg_path. - """ - path_to_setup = egg_base.replace(os.sep, '/').rstrip('/') - if path_to_setup != os.curdir: - path_to_setup = '../' * (path_to_setup.count('/') + 1) - resolved = pkg_resources.normalize_path( - os.path.join(install_dir, egg_path, path_to_setup) - ) - if resolved != pkg_resources.normalize_path(os.curdir): - raise DistutilsOptionError( - "Can't get a consistent path to setup script from" - " installation directory", resolved, - pkg_resources.normalize_path(os.curdir)) - return path_to_setup - - def install_for_development(self): - if six.PY3 and getattr(self.distribution, 'use_2to3', False): - # If we run 2to3 we can not do this inplace: - - # Ensure metadata is up-to-date - self.reinitialize_command('build_py', inplace=0) - self.run_command('build_py') - bpy_cmd = self.get_finalized_command("build_py") - build_path = pkg_resources.normalize_path(bpy_cmd.build_lib) - - # Build extensions - self.reinitialize_command('egg_info', egg_base=build_path) - self.run_command('egg_info') - - self.reinitialize_command('build_ext', inplace=0) - self.run_command('build_ext') - - # Fixup egg-link and easy-install.pth - ei_cmd = self.get_finalized_command("egg_info") - self.egg_path = build_path - self.dist.location = build_path - # XXX - self.dist._provider = pkg_resources.PathMetadata( - build_path, ei_cmd.egg_info) - else: - # Without 2to3 inplace works fine: - self.run_command('egg_info') - - # Build extensions in-place - self.reinitialize_command('build_ext', inplace=1) - self.run_command('build_ext') - - self.install_site_py() # ensure that target dir is site-safe - if setuptools.bootstrap_install_from: - self.easy_install(setuptools.bootstrap_install_from) - setuptools.bootstrap_install_from = None - - self.install_namespaces() - - # create an .egg-link in the installation dir, pointing to our egg - log.info("Creating %s (link to %s)", self.egg_link, self.egg_base) - if not self.dry_run: - with open(self.egg_link, "w") as f: - f.write(self.egg_path + "\n" + self.setup_path) - # postprocess the installed distro, fixing up .pth, installing scripts, - # and handling requirements - self.process_distribution(None, self.dist, not self.no_deps) - - def uninstall_link(self): - if os.path.exists(self.egg_link): - log.info("Removing %s (link to %s)", self.egg_link, self.egg_base) - egg_link_file = open(self.egg_link) - contents = [line.rstrip() for line in egg_link_file] - egg_link_file.close() - if contents not in ([self.egg_path], - [self.egg_path, self.setup_path]): - log.warn("Link points to %s: uninstall aborted", contents) - return - if not self.dry_run: - os.unlink(self.egg_link) - if not self.dry_run: - self.update_pth(self.dist) # remove any .pth link to us - if self.distribution.scripts: - # XXX should also check for entry point scripts! - log.warn("Note: you must uninstall or replace scripts manually!") - - def install_egg_scripts(self, dist): - if dist is not self.dist: - # Installing a dependency, so fall back to normal behavior - return easy_install.install_egg_scripts(self, dist) - - # create wrapper scripts in the script dir, pointing to dist.scripts - - # new-style... - self.install_wrapper_scripts(dist) - - # ...and old-style - for script_name in self.distribution.scripts or []: - script_path = os.path.abspath(convert_path(script_name)) - script_name = os.path.basename(script_path) - with io.open(script_path) as strm: - script_text = strm.read() - self.install_script(dist, script_name, script_text, script_path) - - def install_wrapper_scripts(self, dist): - dist = VersionlessRequirement(dist) - return easy_install.install_wrapper_scripts(self, dist) - - -class VersionlessRequirement: - """ - Adapt a pkg_resources.Distribution to simply return the project - name as the 'requirement' so that scripts will work across - multiple versions. - - >>> from pkg_resources import Distribution - >>> dist = Distribution(project_name='foo', version='1.0') - >>> str(dist.as_requirement()) - 'foo==1.0' - >>> adapted_dist = VersionlessRequirement(dist) - >>> str(adapted_dist.as_requirement()) - 'foo' - """ - - def __init__(self, dist): - self.__dist = dist - - def __getattr__(self, name): - return getattr(self.__dist, name) - - def as_requirement(self): - return self.project_name diff --git a/venv/lib/python3.8/site-packages/setuptools/command/dist_info.py b/venv/lib/python3.8/site-packages/setuptools/command/dist_info.py deleted file mode 100644 index c45258fa03a3ddd6a73db4514365f8741d16ca86..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/dist_info.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -Create a dist_info directory -As defined in the wheel specification -""" - -import os - -from distutils.core import Command -from distutils import log - - -class dist_info(Command): - - description = 'create a .dist-info directory' - - user_options = [ - ('egg-base=', 'e', "directory containing .egg-info directories" - " (default: top of the source tree)"), - ] - - def initialize_options(self): - self.egg_base = None - - def finalize_options(self): - pass - - def run(self): - egg_info = self.get_finalized_command('egg_info') - egg_info.egg_base = self.egg_base - egg_info.finalize_options() - egg_info.run() - dist_info_dir = egg_info.egg_info[:-len('.egg-info')] + '.dist-info' - log.info("creating '{}'".format(os.path.abspath(dist_info_dir))) - - bdist_wheel = self.get_finalized_command('bdist_wheel') - bdist_wheel.egg2dist(egg_info.egg_info, dist_info_dir) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/easy_install.py b/venv/lib/python3.8/site-packages/setuptools/command/easy_install.py deleted file mode 100644 index 1f6839cb3b78fe8d63f709b6ff9abb15bf276b6e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/easy_install.py +++ /dev/null @@ -1,2402 +0,0 @@ -#!/usr/bin/env python -""" -Easy Install ------------- - -A tool for doing automatic download/extract/build of distutils-based Python -packages. For detailed documentation, see the accompanying EasyInstall.txt -file, or visit the `EasyInstall home page`__. - -__ https://setuptools.readthedocs.io/en/latest/easy_install.html - -""" - -from glob import glob -from distutils.util import get_platform -from distutils.util import convert_path, subst_vars -from distutils.errors import ( - DistutilsArgError, DistutilsOptionError, - DistutilsError, DistutilsPlatformError, -) -from distutils.command.install import INSTALL_SCHEMES, SCHEME_KEYS -from distutils import log, dir_util -from distutils.command.build_scripts import first_line_re -from distutils.spawn import find_executable -import sys -import os -import zipimport -import shutil -import tempfile -import zipfile -import re -import stat -import random -import textwrap -import warnings -import site -import struct -import contextlib -import subprocess -import shlex -import io - - -from sysconfig import get_config_vars, get_path - -from setuptools import SetuptoolsDeprecationWarning - -from setuptools.extern import six -from setuptools.extern.six.moves import configparser, map - -from setuptools import Command -from setuptools.sandbox import run_setup -from setuptools.py27compat import rmtree_safe -from setuptools.command import setopt -from setuptools.archive_util import unpack_archive -from setuptools.package_index import ( - PackageIndex, parse_requirement_arg, URL_SCHEME, -) -from setuptools.command import bdist_egg, egg_info -from setuptools.wheel import Wheel -from pkg_resources import ( - yield_lines, normalize_path, resource_string, ensure_directory, - get_distribution, find_distributions, Environment, Requirement, - Distribution, PathMetadata, EggMetadata, WorkingSet, DistributionNotFound, - VersionConflict, DEVELOP_DIST, -) -import pkg_resources.py31compat - -__metaclass__ = type - -# Turn on PEP440Warnings -warnings.filterwarnings("default", category=pkg_resources.PEP440Warning) - -__all__ = [ - 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', - 'main', 'get_exe_prefixes', -] - - -def is_64bit(): - return struct.calcsize("P") == 8 - - -def samefile(p1, p2): - """ - Determine if two paths reference the same file. - - Augments os.path.samefile to work on Windows and - suppresses errors if the path doesn't exist. - """ - both_exist = os.path.exists(p1) and os.path.exists(p2) - use_samefile = hasattr(os.path, 'samefile') and both_exist - if use_samefile: - return os.path.samefile(p1, p2) - norm_p1 = os.path.normpath(os.path.normcase(p1)) - norm_p2 = os.path.normpath(os.path.normcase(p2)) - return norm_p1 == norm_p2 - - -if six.PY2: - - def _to_bytes(s): - return s - - def isascii(s): - try: - six.text_type(s, 'ascii') - return True - except UnicodeError: - return False -else: - - def _to_bytes(s): - return s.encode('utf8') - - def isascii(s): - try: - s.encode('ascii') - return True - except UnicodeError: - return False - - -_one_liner = lambda text: textwrap.dedent(text).strip().replace('\n', '; ') - - -class easy_install(Command): - """Manage a download/build/install process""" - description = "Find/get/install Python packages" - command_consumes_arguments = True - - user_options = [ - ('prefix=', None, "installation prefix"), - ("zip-ok", "z", "install package as a zipfile"), - ("multi-version", "m", "make apps have to require() a version"), - ("upgrade", "U", "force upgrade (searches PyPI for latest versions)"), - ("install-dir=", "d", "install package to DIR"), - ("script-dir=", "s", "install scripts to DIR"), - ("exclude-scripts", "x", "Don't install scripts"), - ("always-copy", "a", "Copy all needed packages to install dir"), - ("index-url=", "i", "base URL of Python Package Index"), - ("find-links=", "f", "additional URL(s) to search for packages"), - ("build-directory=", "b", - "download/extract/build in DIR; keep the results"), - ('optimize=', 'O', - "also compile with optimization: -O1 for \"python -O\", " - "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"), - ('record=', None, - "filename in which to record list of installed files"), - ('always-unzip', 'Z', "don't install as a zipfile, no matter what"), - ('site-dirs=', 'S', "list of directories where .pth files work"), - ('editable', 'e', "Install specified packages in editable form"), - ('no-deps', 'N', "don't install dependencies"), - ('allow-hosts=', 'H', "pattern(s) that hostnames must match"), - ('local-snapshots-ok', 'l', - "allow building eggs from local checkouts"), - ('version', None, "print version information and exit"), - ('install-layout=', None, "installation layout to choose (known values: deb)"), - ('force-installation-into-system-dir', '0', "force installation into /usr"), - ('no-find-links', None, - "Don't load find-links defined in packages being installed") - ] - boolean_options = [ - 'zip-ok', 'multi-version', 'exclude-scripts', 'upgrade', 'always-copy', - 'editable', - 'no-deps', 'local-snapshots-ok', 'version', 'force-installation-into-system-dir' - ] - - if site.ENABLE_USER_SITE: - help_msg = "install in user site-package '%s'" % site.USER_SITE - user_options.append(('user', None, help_msg)) - boolean_options.append('user') - - negative_opt = {'always-unzip': 'zip-ok'} - create_index = PackageIndex - - def initialize_options(self): - # the --user option seems to be an opt-in one, - # so the default should be False. - self.user = 0 - self.zip_ok = self.local_snapshots_ok = None - self.install_dir = self.script_dir = self.exclude_scripts = None - self.index_url = None - self.find_links = None - self.build_directory = None - self.args = None - self.optimize = self.record = None - self.upgrade = self.always_copy = self.multi_version = None - self.editable = self.no_deps = self.allow_hosts = None - self.root = self.prefix = self.no_report = None - self.version = None - self.install_purelib = None # for pure module distributions - self.install_platlib = None # non-pure (dists w/ extensions) - self.install_headers = None # for C/C++ headers - self.install_lib = None # set to either purelib or platlib - self.install_scripts = None - self.install_data = None - self.install_base = None - self.install_platbase = None - if site.ENABLE_USER_SITE: - self.install_userbase = site.USER_BASE - self.install_usersite = site.USER_SITE - else: - self.install_userbase = None - self.install_usersite = None - self.no_find_links = None - - # Options not specifiable via command line - self.package_index = None - self.pth_file = self.always_copy_from = None - self.site_dirs = None - self.installed_projects = {} - self.sitepy_installed = False - # enable custom installation, known values: deb - self.install_layout = None - self.force_installation_into_system_dir = None - self.multiarch = None - - # Always read easy_install options, even if we are subclassed, or have - # an independent instance created. This ensures that defaults will - # always come from the standard configuration file(s)' "easy_install" - # section, even if this is a "develop" or "install" command, or some - # other embedding. - self._dry_run = None - self.verbose = self.distribution.verbose - self.distribution._set_command_options( - self, self.distribution.get_option_dict('easy_install') - ) - - def delete_blockers(self, blockers): - extant_blockers = ( - filename for filename in blockers - if os.path.exists(filename) or os.path.islink(filename) - ) - list(map(self._delete_path, extant_blockers)) - - def _delete_path(self, path): - log.info("Deleting %s", path) - if self.dry_run: - return - - is_tree = os.path.isdir(path) and not os.path.islink(path) - remover = rmtree if is_tree else os.unlink - remover(path) - - @staticmethod - def _render_version(): - """ - Render the Setuptools version and installation details, then exit. - """ - ver = '{}.{}'.format(*sys.version_info) - dist = get_distribution('setuptools') - tmpl = 'setuptools {dist.version} from {dist.location} (Python {ver})' - print(tmpl.format(**locals())) - raise SystemExit() - - def finalize_options(self): - self.version and self._render_version() - - py_version = sys.version.split()[0] - prefix, exec_prefix = get_config_vars('prefix', 'exec_prefix') - - self.config_vars = { - 'dist_name': self.distribution.get_name(), - 'dist_version': self.distribution.get_version(), - 'dist_fullname': self.distribution.get_fullname(), - 'py_version': py_version, - 'py_version_short': py_version[0:3], - 'py_version_nodot': py_version[0] + py_version[2], - 'sys_prefix': prefix, - 'prefix': prefix, - 'sys_exec_prefix': exec_prefix, - 'exec_prefix': exec_prefix, - # Only python 3.2+ has abiflags - 'abiflags': getattr(sys, 'abiflags', ''), - } - - if site.ENABLE_USER_SITE: - self.config_vars['userbase'] = self.install_userbase - self.config_vars['usersite'] = self.install_usersite - - self._fix_install_dir_for_user_site() - - self.expand_basedirs() - self.expand_dirs() - - if self.install_layout: - if not self.install_layout.lower() in ['deb']: - raise DistutilsOptionError("unknown value for --install-layout") - self.install_layout = self.install_layout.lower() - - import sysconfig - if sys.version_info[:2] >= (3, 3): - self.multiarch = sysconfig.get_config_var('MULTIARCH') - - self._expand( - 'install_dir', 'script_dir', 'build_directory', - 'site_dirs', - ) - # If a non-default installation directory was specified, default the - # script directory to match it. - if self.script_dir is None: - self.script_dir = self.install_dir - - if self.no_find_links is None: - self.no_find_links = False - - # Let install_dir get set by install_lib command, which in turn - # gets its info from the install command, and takes into account - # --prefix and --home and all that other crud. - self.set_undefined_options( - 'install_lib', ('install_dir', 'install_dir') - ) - # Likewise, set default script_dir from 'install_scripts.install_dir' - self.set_undefined_options( - 'install_scripts', ('install_dir', 'script_dir') - ) - - if self.user and self.install_purelib: - self.install_dir = self.install_purelib - self.script_dir = self.install_scripts - - if self.prefix == '/usr' and not self.force_installation_into_system_dir: - raise DistutilsOptionError("""installation into /usr - -Trying to install into the system managed parts of the file system. Please -consider to install to another location, or use the option ---force-installation-into-system-dir to overwrite this warning. -""") - - # default --record from the install command - self.set_undefined_options('install', ('record', 'record')) - # Should this be moved to the if statement below? It's not used - # elsewhere - normpath = map(normalize_path, sys.path) - self.all_site_dirs = get_site_dirs() - if self.site_dirs is not None: - site_dirs = [ - os.path.expanduser(s.strip()) for s in - self.site_dirs.split(',') - ] - for d in site_dirs: - if not os.path.isdir(d): - log.warn("%s (in --site-dirs) does not exist", d) - elif normalize_path(d) not in normpath: - raise DistutilsOptionError( - d + " (in --site-dirs) is not on sys.path" - ) - else: - self.all_site_dirs.append(normalize_path(d)) - if not self.editable: - self.check_site_dir() - self.index_url = self.index_url or "https://pypi.org/simple/" - self.shadow_path = self.all_site_dirs[:] - for path_item in self.install_dir, normalize_path(self.script_dir): - if path_item not in self.shadow_path: - self.shadow_path.insert(0, path_item) - - if self.allow_hosts is not None: - hosts = [s.strip() for s in self.allow_hosts.split(',')] - else: - hosts = ['*'] - if self.package_index is None: - self.package_index = self.create_index( - self.index_url, search_path=self.shadow_path, hosts=hosts, - ) - self.local_index = Environment(self.shadow_path + sys.path) - - if self.find_links is not None: - if isinstance(self.find_links, six.string_types): - self.find_links = self.find_links.split() - else: - self.find_links = [] - if self.local_snapshots_ok: - self.package_index.scan_egg_links(self.shadow_path + sys.path) - if not self.no_find_links: - self.package_index.add_find_links(self.find_links) - self.set_undefined_options('install_lib', ('optimize', 'optimize')) - if not isinstance(self.optimize, int): - try: - self.optimize = int(self.optimize) - if not (0 <= self.optimize <= 2): - raise ValueError - except ValueError: - raise DistutilsOptionError("--optimize must be 0, 1, or 2") - - if self.editable and not self.build_directory: - raise DistutilsArgError( - "Must specify a build directory (-b) when using --editable" - ) - if not self.args: - raise DistutilsArgError( - "No urls, filenames, or requirements specified (see --help)") - - self.outputs = [] - - def _fix_install_dir_for_user_site(self): - """ - Fix the install_dir if "--user" was used. - """ - if not self.user or not site.ENABLE_USER_SITE: - return - - self.create_home_path() - if self.install_userbase is None: - msg = "User base directory is not specified" - raise DistutilsPlatformError(msg) - self.install_base = self.install_platbase = self.install_userbase - scheme_name = os.name.replace('posix', 'unix') + '_user' - self.select_scheme(scheme_name) - - def _expand_attrs(self, attrs): - for attr in attrs: - val = getattr(self, attr) - if val is not None: - if os.name == 'posix' or os.name == 'nt': - val = os.path.expanduser(val) - val = subst_vars(val, self.config_vars) - setattr(self, attr, val) - - def expand_basedirs(self): - """Calls `os.path.expanduser` on install_base, install_platbase and - root.""" - self._expand_attrs(['install_base', 'install_platbase', 'root']) - - def expand_dirs(self): - """Calls `os.path.expanduser` on install dirs.""" - dirs = [ - 'install_purelib', - 'install_platlib', - 'install_lib', - 'install_headers', - 'install_scripts', - 'install_data', - ] - self._expand_attrs(dirs) - - def run(self, show_deprecation=True): - if show_deprecation: - self.announce( - "WARNING: The easy_install command is deprecated " - "and will be removed in a future version." - , log.WARN, - ) - if self.verbose != self.distribution.verbose: - log.set_verbosity(self.verbose) - try: - for spec in self.args: - self.easy_install(spec, not self.no_deps) - if self.record: - outputs = list(sorted(self.outputs)) - if self.root: # strip any package prefix - root_len = len(self.root) - for counter in range(len(outputs)): - outputs[counter] = outputs[counter][root_len:] - from distutils import file_util - - self.execute( - file_util.write_file, (self.record, outputs), - "writing list of installed files to '%s'" % - self.record - ) - self.warn_deprecated_options() - finally: - log.set_verbosity(self.distribution.verbose) - - def pseudo_tempname(self): - """Return a pseudo-tempname base in the install directory. - This code is intentionally naive; if a malicious party can write to - the target directory you're already in deep doodoo. - """ - try: - pid = os.getpid() - except Exception: - pid = random.randint(0, sys.maxsize) - return os.path.join(self.install_dir, "test-easy-install-%s" % pid) - - def warn_deprecated_options(self): - pass - - def check_site_dir(self): - """Verify that self.install_dir is .pth-capable dir, if needed""" - - instdir = normalize_path(self.install_dir) - pth_file = os.path.join(instdir, 'easy-install.pth') - - # Is it a configured, PYTHONPATH, implicit, or explicit site dir? - is_site_dir = instdir in self.all_site_dirs - - if not is_site_dir and not self.multi_version: - # No? Then directly test whether it does .pth file processing - is_site_dir = self.check_pth_processing() - else: - # make sure we can write to target dir - testfile = self.pseudo_tempname() + '.write-test' - test_exists = os.path.exists(testfile) - try: - if test_exists: - os.unlink(testfile) - open(testfile, 'w').close() - os.unlink(testfile) - except (OSError, IOError): - self.cant_write_to_target() - - if not is_site_dir and not self.multi_version: - # Can't install non-multi to non-site dir - raise DistutilsError(self.no_default_version_msg()) - - if is_site_dir: - if self.pth_file is None: - self.pth_file = PthDistributions(pth_file, self.all_site_dirs) - else: - self.pth_file = None - - if instdir not in map(normalize_path, _pythonpath()): - # only PYTHONPATH dirs need a site.py, so pretend it's there - self.sitepy_installed = True - elif self.multi_version and not os.path.exists(pth_file): - self.sitepy_installed = True # don't need site.py in this case - self.pth_file = None # and don't create a .pth file - self.install_dir = instdir - - __cant_write_msg = textwrap.dedent(""" - can't create or remove files in install directory - - The following error occurred while trying to add or remove files in the - installation directory: - - %s - - The installation directory you specified (via --install-dir, --prefix, or - the distutils default setting) was: - - %s - """).lstrip() - - __not_exists_id = textwrap.dedent(""" - This directory does not currently exist. Please create it and try again, or - choose a different installation directory (using the -d or --install-dir - option). - """).lstrip() - - __access_msg = textwrap.dedent(""" - Perhaps your account does not have write access to this directory? If the - installation directory is a system-owned directory, you may need to sign in - as the administrator or "root" account. If you do not have administrative - access to this machine, you may wish to choose a different installation - directory, preferably one that is listed in your PYTHONPATH environment - variable. - - For information on other options, you may wish to consult the - documentation at: - - https://setuptools.readthedocs.io/en/latest/easy_install.html - - Please make the appropriate changes for your system and try again. - """).lstrip() - - def cant_write_to_target(self): - msg = self.__cant_write_msg % (sys.exc_info()[1], self.install_dir,) - - if not os.path.exists(self.install_dir): - msg += '\n' + self.__not_exists_id - else: - msg += '\n' + self.__access_msg - raise DistutilsError(msg) - - def check_pth_processing(self): - """Empirically verify whether .pth files are supported in inst. dir""" - instdir = self.install_dir - log.info("Checking .pth file support in %s", instdir) - pth_file = self.pseudo_tempname() + ".pth" - ok_file = pth_file + '.ok' - ok_exists = os.path.exists(ok_file) - tmpl = _one_liner(""" - import os - f = open({ok_file!r}, 'w') - f.write('OK') - f.close() - """) + '\n' - try: - if ok_exists: - os.unlink(ok_file) - dirname = os.path.dirname(ok_file) - pkg_resources.py31compat.makedirs(dirname, exist_ok=True) - f = open(pth_file, 'w') - except (OSError, IOError): - self.cant_write_to_target() - else: - try: - f.write(tmpl.format(**locals())) - f.close() - f = None - executable = sys.executable - if os.name == 'nt': - dirname, basename = os.path.split(executable) - alt = os.path.join(dirname, 'pythonw.exe') - use_alt = ( - basename.lower() == 'python.exe' and - os.path.exists(alt) - ) - if use_alt: - # use pythonw.exe to avoid opening a console window - executable = alt - - from distutils.spawn import spawn - - spawn([executable, '-E', '-c', 'pass'], 0) - - if os.path.exists(ok_file): - log.info( - "TEST PASSED: %s appears to support .pth files", - instdir - ) - return True - finally: - if f: - f.close() - if os.path.exists(ok_file): - os.unlink(ok_file) - if os.path.exists(pth_file): - os.unlink(pth_file) - if not self.multi_version: - log.warn("TEST FAILED: %s does NOT support .pth files", instdir) - return False - - def install_egg_scripts(self, dist): - """Write all the scripts for `dist`, unless scripts are excluded""" - if not self.exclude_scripts and dist.metadata_isdir('scripts'): - for script_name in dist.metadata_listdir('scripts'): - if dist.metadata_isdir('scripts/' + script_name): - # The "script" is a directory, likely a Python 3 - # __pycache__ directory, so skip it. - continue - self.install_script( - dist, script_name, - dist.get_metadata('scripts/' + script_name) - ) - self.install_wrapper_scripts(dist) - - def add_output(self, path): - if os.path.isdir(path): - for base, dirs, files in os.walk(path): - for filename in files: - self.outputs.append(os.path.join(base, filename)) - else: - self.outputs.append(path) - - def not_editable(self, spec): - if self.editable: - raise DistutilsArgError( - "Invalid argument %r: you can't use filenames or URLs " - "with --editable (except via the --find-links option)." - % (spec,) - ) - - def check_editable(self, spec): - if not self.editable: - return - - if os.path.exists(os.path.join(self.build_directory, spec.key)): - raise DistutilsArgError( - "%r already exists in %s; can't do a checkout there" % - (spec.key, self.build_directory) - ) - - @contextlib.contextmanager - def _tmpdir(self): - tmpdir = tempfile.mkdtemp(prefix=u"easy_install-") - try: - # cast to str as workaround for #709 and #710 and #712 - yield str(tmpdir) - finally: - os.path.exists(tmpdir) and rmtree(rmtree_safe(tmpdir)) - - def easy_install(self, spec, deps=False): - if not self.editable: - self.install_site_py() - - with self._tmpdir() as tmpdir: - if not isinstance(spec, Requirement): - if URL_SCHEME(spec): - # It's a url, download it to tmpdir and process - self.not_editable(spec) - dl = self.package_index.download(spec, tmpdir) - return self.install_item(None, dl, tmpdir, deps, True) - - elif os.path.exists(spec): - # Existing file or directory, just process it directly - self.not_editable(spec) - return self.install_item(None, spec, tmpdir, deps, True) - else: - spec = parse_requirement_arg(spec) - - self.check_editable(spec) - dist = self.package_index.fetch_distribution( - spec, tmpdir, self.upgrade, self.editable, - not self.always_copy, self.local_index - ) - if dist is None: - msg = "Could not find suitable distribution for %r" % spec - if self.always_copy: - msg += " (--always-copy skips system and development eggs)" - raise DistutilsError(msg) - elif dist.precedence == DEVELOP_DIST: - # .egg-info dists don't need installing, just process deps - self.process_distribution(spec, dist, deps, "Using") - return dist - else: - return self.install_item(spec, dist.location, tmpdir, deps) - - def install_item(self, spec, download, tmpdir, deps, install_needed=False): - - # Installation is also needed if file in tmpdir or is not an egg - install_needed = install_needed or self.always_copy - install_needed = install_needed or os.path.dirname(download) == tmpdir - install_needed = install_needed or not download.endswith('.egg') - install_needed = install_needed or ( - self.always_copy_from is not None and - os.path.dirname(normalize_path(download)) == - normalize_path(self.always_copy_from) - ) - - if spec and not install_needed: - # at this point, we know it's a local .egg, we just don't know if - # it's already installed. - for dist in self.local_index[spec.project_name]: - if dist.location == download: - break - else: - install_needed = True # it's not in the local index - - log.info("Processing %s", os.path.basename(download)) - - if install_needed: - dists = self.install_eggs(spec, download, tmpdir) - for dist in dists: - self.process_distribution(spec, dist, deps) - else: - dists = [self.egg_distribution(download)] - self.process_distribution(spec, dists[0], deps, "Using") - - if spec is not None: - for dist in dists: - if dist in spec: - return dist - - def select_scheme(self, name): - """Sets the install directories by applying the install schemes.""" - # it's the caller's problem if they supply a bad name! - scheme = INSTALL_SCHEMES[name] - for key in SCHEME_KEYS: - attrname = 'install_' + key - if getattr(self, attrname) is None: - setattr(self, attrname, scheme[key]) - - def process_distribution(self, requirement, dist, deps=True, *info): - self.update_pth(dist) - self.package_index.add(dist) - if dist in self.local_index[dist.key]: - self.local_index.remove(dist) - self.local_index.add(dist) - self.install_egg_scripts(dist) - self.installed_projects[dist.key] = dist - log.info(self.installation_report(requirement, dist, *info)) - if (dist.has_metadata('dependency_links.txt') and - not self.no_find_links): - self.package_index.add_find_links( - dist.get_metadata_lines('dependency_links.txt') - ) - if not deps and not self.always_copy: - return - elif requirement is not None and dist.key != requirement.key: - log.warn("Skipping dependencies for %s", dist) - return # XXX this is not the distribution we were looking for - elif requirement is None or dist not in requirement: - # if we wound up with a different version, resolve what we've got - distreq = dist.as_requirement() - requirement = Requirement(str(distreq)) - log.info("Processing dependencies for %s", requirement) - try: - distros = WorkingSet([]).resolve( - [requirement], self.local_index, self.easy_install - ) - except DistributionNotFound as e: - raise DistutilsError(str(e)) - except VersionConflict as e: - raise DistutilsError(e.report()) - if self.always_copy or self.always_copy_from: - # Force all the relevant distros to be copied or activated - for dist in distros: - if dist.key not in self.installed_projects: - self.easy_install(dist.as_requirement()) - log.info("Finished processing dependencies for %s", requirement) - - def should_unzip(self, dist): - if self.zip_ok is not None: - return not self.zip_ok - if dist.has_metadata('not-zip-safe'): - return True - if not dist.has_metadata('zip-safe'): - return True - return False - - def maybe_move(self, spec, dist_filename, setup_base): - dst = os.path.join(self.build_directory, spec.key) - if os.path.exists(dst): - msg = ( - "%r already exists in %s; build directory %s will not be kept" - ) - log.warn(msg, spec.key, self.build_directory, setup_base) - return setup_base - if os.path.isdir(dist_filename): - setup_base = dist_filename - else: - if os.path.dirname(dist_filename) == setup_base: - os.unlink(dist_filename) # get it out of the tmp dir - contents = os.listdir(setup_base) - if len(contents) == 1: - dist_filename = os.path.join(setup_base, contents[0]) - if os.path.isdir(dist_filename): - # if the only thing there is a directory, move it instead - setup_base = dist_filename - ensure_directory(dst) - shutil.move(setup_base, dst) - return dst - - def install_wrapper_scripts(self, dist): - if self.exclude_scripts: - return - for args in ScriptWriter.best().get_args(dist): - self.write_script(*args) - - def install_script(self, dist, script_name, script_text, dev_path=None): - """Generate a legacy script wrapper and install it""" - spec = str(dist.as_requirement()) - is_script = is_python_script(script_text, script_name) - - if is_script: - body = self._load_template(dev_path) % locals() - script_text = ScriptWriter.get_header(script_text) + body - self.write_script(script_name, _to_bytes(script_text), 'b') - - @staticmethod - def _load_template(dev_path): - """ - There are a couple of template scripts in the package. This - function loads one of them and prepares it for use. - """ - # See https://github.com/pypa/setuptools/issues/134 for info - # on script file naming and downstream issues with SVR4 - name = 'script.tmpl' - if dev_path: - name = name.replace('.tmpl', ' (dev).tmpl') - - raw_bytes = resource_string('setuptools', name) - return raw_bytes.decode('utf-8') - - def write_script(self, script_name, contents, mode="t", blockers=()): - """Write an executable file to the scripts directory""" - self.delete_blockers( # clean up old .py/.pyw w/o a script - [os.path.join(self.script_dir, x) for x in blockers] - ) - log.info("Installing %s script to %s", script_name, self.script_dir) - target = os.path.join(self.script_dir, script_name) - self.add_output(target) - - if self.dry_run: - return - - mask = current_umask() - ensure_directory(target) - if os.path.exists(target): - os.unlink(target) - with open(target, "w" + mode) as f: - f.write(contents) - chmod(target, 0o777 - mask) - - def install_eggs(self, spec, dist_filename, tmpdir): - # .egg dirs or files are already built, so just return them - if dist_filename.lower().endswith('.egg'): - return [self.install_egg(dist_filename, tmpdir)] - elif dist_filename.lower().endswith('.exe'): - return [self.install_exe(dist_filename, tmpdir)] - elif dist_filename.lower().endswith('.whl'): - return [self.install_wheel(dist_filename, tmpdir)] - - # Anything else, try to extract and build - setup_base = tmpdir - if os.path.isfile(dist_filename) and not dist_filename.endswith('.py'): - unpack_archive(dist_filename, tmpdir, self.unpack_progress) - elif os.path.isdir(dist_filename): - setup_base = os.path.abspath(dist_filename) - - if (setup_base.startswith(tmpdir) # something we downloaded - and self.build_directory and spec is not None): - setup_base = self.maybe_move(spec, dist_filename, setup_base) - - # Find the setup.py file - setup_script = os.path.join(setup_base, 'setup.py') - - if not os.path.exists(setup_script): - setups = glob(os.path.join(setup_base, '*', 'setup.py')) - if not setups: - raise DistutilsError( - "Couldn't find a setup script in %s" % - os.path.abspath(dist_filename) - ) - if len(setups) > 1: - raise DistutilsError( - "Multiple setup scripts in %s" % - os.path.abspath(dist_filename) - ) - setup_script = setups[0] - - # Now run it, and return the result - if self.editable: - log.info(self.report_editable(spec, setup_script)) - return [] - else: - return self.build_and_install(setup_script, setup_base) - - def egg_distribution(self, egg_path): - if os.path.isdir(egg_path): - metadata = PathMetadata(egg_path, os.path.join(egg_path, - 'EGG-INFO')) - else: - metadata = EggMetadata(zipimport.zipimporter(egg_path)) - return Distribution.from_filename(egg_path, metadata=metadata) - - def install_egg(self, egg_path, tmpdir): - destination = os.path.join( - self.install_dir, - os.path.basename(egg_path), - ) - destination = os.path.abspath(destination) - if not self.dry_run: - ensure_directory(destination) - - dist = self.egg_distribution(egg_path) - if not samefile(egg_path, destination): - if os.path.isdir(destination) and not os.path.islink(destination): - dir_util.remove_tree(destination, dry_run=self.dry_run) - elif os.path.exists(destination): - self.execute( - os.unlink, - (destination,), - "Removing " + destination, - ) - try: - new_dist_is_zipped = False - if os.path.isdir(egg_path): - if egg_path.startswith(tmpdir): - f, m = shutil.move, "Moving" - else: - f, m = shutil.copytree, "Copying" - elif self.should_unzip(dist): - self.mkpath(destination) - f, m = self.unpack_and_compile, "Extracting" - else: - new_dist_is_zipped = True - if egg_path.startswith(tmpdir): - f, m = shutil.move, "Moving" - else: - f, m = shutil.copy2, "Copying" - self.execute( - f, - (egg_path, destination), - (m + " %s to %s") % ( - os.path.basename(egg_path), - os.path.dirname(destination) - ), - ) - update_dist_caches( - destination, - fix_zipimporter_caches=new_dist_is_zipped, - ) - except Exception: - update_dist_caches(destination, fix_zipimporter_caches=False) - raise - - self.add_output(destination) - return self.egg_distribution(destination) - - def install_exe(self, dist_filename, tmpdir): - # See if it's valid, get data - cfg = extract_wininst_cfg(dist_filename) - if cfg is None: - raise DistutilsError( - "%s is not a valid distutils Windows .exe" % dist_filename - ) - # Create a dummy distribution object until we build the real distro - dist = Distribution( - None, - project_name=cfg.get('metadata', 'name'), - version=cfg.get('metadata', 'version'), platform=get_platform(), - ) - - # Convert the .exe to an unpacked egg - egg_path = os.path.join(tmpdir, dist.egg_name() + '.egg') - dist.location = egg_path - egg_tmp = egg_path + '.tmp' - _egg_info = os.path.join(egg_tmp, 'EGG-INFO') - pkg_inf = os.path.join(_egg_info, 'PKG-INFO') - ensure_directory(pkg_inf) # make sure EGG-INFO dir exists - dist._provider = PathMetadata(egg_tmp, _egg_info) # XXX - self.exe_to_egg(dist_filename, egg_tmp) - - # Write EGG-INFO/PKG-INFO - if not os.path.exists(pkg_inf): - f = open(pkg_inf, 'w') - f.write('Metadata-Version: 1.0\n') - for k, v in cfg.items('metadata'): - if k != 'target_version': - f.write('%s: %s\n' % (k.replace('_', '-').title(), v)) - f.close() - script_dir = os.path.join(_egg_info, 'scripts') - # delete entry-point scripts to avoid duping - self.delete_blockers([ - os.path.join(script_dir, args[0]) - for args in ScriptWriter.get_args(dist) - ]) - # Build .egg file from tmpdir - bdist_egg.make_zipfile( - egg_path, egg_tmp, verbose=self.verbose, dry_run=self.dry_run, - ) - # install the .egg - return self.install_egg(egg_path, tmpdir) - - def exe_to_egg(self, dist_filename, egg_tmp): - """Extract a bdist_wininst to the directories an egg would use""" - # Check for .pth file and set up prefix translations - prefixes = get_exe_prefixes(dist_filename) - to_compile = [] - native_libs = [] - top_level = {} - - def process(src, dst): - s = src.lower() - for old, new in prefixes: - if s.startswith(old): - src = new + src[len(old):] - parts = src.split('/') - dst = os.path.join(egg_tmp, *parts) - dl = dst.lower() - if dl.endswith('.pyd') or dl.endswith('.dll'): - parts[-1] = bdist_egg.strip_module(parts[-1]) - top_level[os.path.splitext(parts[0])[0]] = 1 - native_libs.append(src) - elif dl.endswith('.py') and old != 'SCRIPTS/': - top_level[os.path.splitext(parts[0])[0]] = 1 - to_compile.append(dst) - return dst - if not src.endswith('.pth'): - log.warn("WARNING: can't process %s", src) - return None - - # extract, tracking .pyd/.dll->native_libs and .py -> to_compile - unpack_archive(dist_filename, egg_tmp, process) - stubs = [] - for res in native_libs: - if res.lower().endswith('.pyd'): # create stubs for .pyd's - parts = res.split('/') - resource = parts[-1] - parts[-1] = bdist_egg.strip_module(parts[-1]) + '.py' - pyfile = os.path.join(egg_tmp, *parts) - to_compile.append(pyfile) - stubs.append(pyfile) - bdist_egg.write_stub(resource, pyfile) - self.byte_compile(to_compile) # compile .py's - bdist_egg.write_safety_flag( - os.path.join(egg_tmp, 'EGG-INFO'), - bdist_egg.analyze_egg(egg_tmp, stubs)) # write zip-safety flag - - for name in 'top_level', 'native_libs': - if locals()[name]: - txt = os.path.join(egg_tmp, 'EGG-INFO', name + '.txt') - if not os.path.exists(txt): - f = open(txt, 'w') - f.write('\n'.join(locals()[name]) + '\n') - f.close() - - def install_wheel(self, wheel_path, tmpdir): - wheel = Wheel(wheel_path) - assert wheel.is_compatible() - destination = os.path.join(self.install_dir, wheel.egg_name()) - destination = os.path.abspath(destination) - if not self.dry_run: - ensure_directory(destination) - if os.path.isdir(destination) and not os.path.islink(destination): - dir_util.remove_tree(destination, dry_run=self.dry_run) - elif os.path.exists(destination): - self.execute( - os.unlink, - (destination,), - "Removing " + destination, - ) - try: - self.execute( - wheel.install_as_egg, - (destination,), - ("Installing %s to %s") % ( - os.path.basename(wheel_path), - os.path.dirname(destination) - ), - ) - finally: - update_dist_caches(destination, fix_zipimporter_caches=False) - self.add_output(destination) - return self.egg_distribution(destination) - - __mv_warning = textwrap.dedent(""" - Because this distribution was installed --multi-version, before you can - import modules from this package in an application, you will need to - 'import pkg_resources' and then use a 'require()' call similar to one of - these examples, in order to select the desired version: - - pkg_resources.require("%(name)s") # latest installed version - pkg_resources.require("%(name)s==%(version)s") # this exact version - pkg_resources.require("%(name)s>=%(version)s") # this version or higher - """).lstrip() - - __id_warning = textwrap.dedent(""" - Note also that the installation directory must be on sys.path at runtime for - this to work. (e.g. by being the application's script directory, by being on - PYTHONPATH, or by being added to sys.path by your code.) - """) - - def installation_report(self, req, dist, what="Installed"): - """Helpful installation message for display to package users""" - msg = "\n%(what)s %(eggloc)s%(extras)s" - if self.multi_version and not self.no_report: - msg += '\n' + self.__mv_warning - if self.install_dir not in map(normalize_path, sys.path): - msg += '\n' + self.__id_warning - - eggloc = dist.location - name = dist.project_name - version = dist.version - extras = '' # TODO: self.report_extras(req, dist) - return msg % locals() - - __editable_msg = textwrap.dedent(""" - Extracted editable version of %(spec)s to %(dirname)s - - If it uses setuptools in its setup script, you can activate it in - "development" mode by going to that directory and running:: - - %(python)s setup.py develop - - See the setuptools documentation for the "develop" command for more info. - """).lstrip() - - def report_editable(self, spec, setup_script): - dirname = os.path.dirname(setup_script) - python = sys.executable - return '\n' + self.__editable_msg % locals() - - def run_setup(self, setup_script, setup_base, args): - sys.modules.setdefault('distutils.command.bdist_egg', bdist_egg) - sys.modules.setdefault('distutils.command.egg_info', egg_info) - - args = list(args) - if self.verbose > 2: - v = 'v' * (self.verbose - 1) - args.insert(0, '-' + v) - elif self.verbose < 2: - args.insert(0, '-q') - if self.dry_run: - args.insert(0, '-n') - log.info( - "Running %s %s", setup_script[len(setup_base) + 1:], ' '.join(args) - ) - try: - run_setup(setup_script, args) - except SystemExit as v: - raise DistutilsError("Setup script exited with %s" % (v.args[0],)) - - def build_and_install(self, setup_script, setup_base): - args = ['bdist_egg', '--dist-dir'] - - dist_dir = tempfile.mkdtemp( - prefix='egg-dist-tmp-', dir=os.path.dirname(setup_script) - ) - try: - self._set_fetcher_options(os.path.dirname(setup_script)) - args.append(dist_dir) - - self.run_setup(setup_script, setup_base, args) - all_eggs = Environment([dist_dir]) - eggs = [] - for key in all_eggs: - for dist in all_eggs[key]: - eggs.append(self.install_egg(dist.location, setup_base)) - if not eggs and not self.dry_run: - log.warn("No eggs found in %s (setup script problem?)", - dist_dir) - return eggs - finally: - rmtree(dist_dir) - log.set_verbosity(self.verbose) # restore our log verbosity - - def _set_fetcher_options(self, base): - """ - When easy_install is about to run bdist_egg on a source dist, that - source dist might have 'setup_requires' directives, requiring - additional fetching. Ensure the fetcher options given to easy_install - are available to that command as well. - """ - # find the fetch options from easy_install and write them out - # to the setup.cfg file. - ei_opts = self.distribution.get_option_dict('easy_install').copy() - fetch_directives = ( - 'find_links', 'site_dirs', 'index_url', 'optimize', 'allow_hosts', - ) - fetch_options = {} - for key, val in ei_opts.items(): - if key not in fetch_directives: - continue - fetch_options[key.replace('_', '-')] = val[1] - # create a settings dictionary suitable for `edit_config` - settings = dict(easy_install=fetch_options) - cfg_filename = os.path.join(base, 'setup.cfg') - setopt.edit_config(cfg_filename, settings) - - def update_pth(self, dist): - if self.pth_file is None: - return - - for d in self.pth_file[dist.key]: # drop old entries - if self.multi_version or d.location != dist.location: - log.info("Removing %s from easy-install.pth file", d) - self.pth_file.remove(d) - if d.location in self.shadow_path: - self.shadow_path.remove(d.location) - - if not self.multi_version: - if dist.location in self.pth_file.paths: - log.info( - "%s is already the active version in easy-install.pth", - dist, - ) - else: - log.info("Adding %s to easy-install.pth file", dist) - self.pth_file.add(dist) # add new entry - if dist.location not in self.shadow_path: - self.shadow_path.append(dist.location) - - if not self.dry_run: - - self.pth_file.save() - - if dist.key == 'setuptools': - # Ensure that setuptools itself never becomes unavailable! - # XXX should this check for latest version? - filename = os.path.join(self.install_dir, 'setuptools.pth') - if os.path.islink(filename): - os.unlink(filename) - f = open(filename, 'wt') - f.write(self.pth_file.make_relative(dist.location) + '\n') - f.close() - - def unpack_progress(self, src, dst): - # Progress filter for unpacking - log.debug("Unpacking %s to %s", src, dst) - return dst # only unpack-and-compile skips files for dry run - - def unpack_and_compile(self, egg_path, destination): - to_compile = [] - to_chmod = [] - - def pf(src, dst): - if dst.endswith('.py') and not src.startswith('EGG-INFO/'): - to_compile.append(dst) - elif dst.endswith('.dll') or dst.endswith('.so'): - to_chmod.append(dst) - self.unpack_progress(src, dst) - return not self.dry_run and dst or None - - unpack_archive(egg_path, destination, pf) - self.byte_compile(to_compile) - if not self.dry_run: - for f in to_chmod: - mode = ((os.stat(f)[stat.ST_MODE]) | 0o555) & 0o7755 - chmod(f, mode) - - def byte_compile(self, to_compile): - if sys.dont_write_bytecode: - return - - from distutils.util import byte_compile - - try: - # try to make the byte compile messages quieter - log.set_verbosity(self.verbose - 1) - - byte_compile(to_compile, optimize=0, force=1, dry_run=self.dry_run) - if self.optimize: - byte_compile( - to_compile, optimize=self.optimize, force=1, - dry_run=self.dry_run, - ) - finally: - log.set_verbosity(self.verbose) # restore original verbosity - - __no_default_msg = textwrap.dedent(""" - bad install directory or PYTHONPATH - - You are attempting to install a package to a directory that is not - on PYTHONPATH and which Python does not read ".pth" files from. The - installation directory you specified (via --install-dir, --prefix, or - the distutils default setting) was: - - %s - - and your PYTHONPATH environment variable currently contains: - - %r - - Here are some of your options for correcting the problem: - - * You can choose a different installation directory, i.e., one that is - on PYTHONPATH or supports .pth files - - * You can add the installation directory to the PYTHONPATH environment - variable. (It must then also be on PYTHONPATH whenever you run - Python and want to use the package(s) you are installing.) - - * You can set up the installation directory to support ".pth" files by - using one of the approaches described here: - - https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations - - - Please make the appropriate changes for your system and try again.""").lstrip() - - def no_default_version_msg(self): - template = self.__no_default_msg - return template % (self.install_dir, os.environ.get('PYTHONPATH', '')) - - def install_site_py(self): - """Make sure there's a site.py in the target dir, if needed""" - - if self.sitepy_installed: - return # already did it, or don't need to - - sitepy = os.path.join(self.install_dir, "site.py") - source = resource_string("setuptools", "site-patch.py") - source = source.decode('utf-8') - current = "" - - if os.path.exists(sitepy): - log.debug("Checking existing site.py in %s", self.install_dir) - with io.open(sitepy) as strm: - current = strm.read() - - if not current.startswith('def __boot():'): - raise DistutilsError( - "%s is not a setuptools-generated site.py; please" - " remove it." % sitepy - ) - - if current != source: - log.info("Creating %s", sitepy) - if not self.dry_run: - ensure_directory(sitepy) - with io.open(sitepy, 'w', encoding='utf-8') as strm: - strm.write(source) - self.byte_compile([sitepy]) - - self.sitepy_installed = True - - def create_home_path(self): - """Create directories under ~.""" - if not self.user: - return - home = convert_path(os.path.expanduser("~")) - for name, path in six.iteritems(self.config_vars): - if path.startswith(home) and not os.path.isdir(path): - self.debug_print("os.makedirs('%s', 0o700)" % path) - os.makedirs(path, 0o700) - - if sys.version[:3] in ('2.3', '2.4', '2.5') or 'real_prefix' in sys.__dict__: - sitedir_name = 'site-packages' - else: - sitedir_name = 'dist-packages' - - INSTALL_SCHEMES = dict( - posix=dict( - install_dir='$base/lib/python$py_version_short/site-packages', - script_dir='$base/bin', - ), - unix_local = dict( - install_dir = '$base/local/lib/python$py_version_short/%s' % sitedir_name, - script_dir = '$base/local/bin', - ), - posix_local = dict( - install_dir = '$base/local/lib/python$py_version_short/%s' % sitedir_name, - script_dir = '$base/local/bin', - ), - deb_system = dict( - install_dir = '$base/lib/python3/%s' % sitedir_name, - script_dir = '$base/bin', - ), - ) - - DEFAULT_SCHEME = dict( - install_dir='$base/Lib/site-packages', - script_dir='$base/Scripts', - ) - - def _expand(self, *attrs): - config_vars = self.get_finalized_command('install').config_vars - - if self.prefix or self.install_layout: - if self.install_layout and self.install_layout in ['deb']: - scheme_name = "deb_system" - self.prefix = '/usr' - elif self.prefix or 'real_prefix' in sys.__dict__: - scheme_name = os.name - else: - scheme_name = "posix_local" - # Set default install_dir/scripts from --prefix - config_vars = config_vars.copy() - config_vars['base'] = self.prefix - scheme = self.INSTALL_SCHEMES.get(scheme_name,self.DEFAULT_SCHEME) - for attr, val in scheme.items(): - if getattr(self, attr, None) is None: - setattr(self, attr, val) - - from distutils.util import subst_vars - - for attr in attrs: - val = getattr(self, attr) - if val is not None: - val = subst_vars(val, config_vars) - if os.name == 'posix': - val = os.path.expanduser(val) - setattr(self, attr, val) - - -def _pythonpath(): - items = os.environ.get('PYTHONPATH', '').split(os.pathsep) - return filter(None, items) - - -def get_site_dirs(): - """ - Return a list of 'site' dirs - """ - - sitedirs = [] - - # start with PYTHONPATH - sitedirs.extend(_pythonpath()) - - prefixes = [sys.prefix] - if sys.exec_prefix != sys.prefix: - prefixes.append(sys.exec_prefix) - for prefix in prefixes: - if prefix: - if sys.platform in ('os2emx', 'riscos'): - sitedirs.append(os.path.join(prefix, "Lib", "site-packages")) - elif os.sep == '/': - sitedirs.extend([ - os.path.join( - prefix, - "local/lib", - "python" + sys.version[:3], - "dist-packages", - ), - os.path.join( - prefix, - "lib", - "python{}.{}".format(*sys.version_info), - "dist-packages", - ), - os.path.join(prefix, "lib", "site-python"), - ]) - else: - sitedirs.extend([ - prefix, - os.path.join(prefix, "lib", "site-packages"), - ]) - if sys.platform == 'darwin': - # for framework builds *only* we add the standard Apple - # locations. Currently only per-user, but /Library and - # /Network/Library could be added too - if 'Python.framework' in prefix: - home = os.environ.get('HOME') - if home: - home_sp = os.path.join( - home, - 'Library', - 'Python', - '{}.{}'.format(*sys.version_info), - 'site-packages', - ) - sitedirs.append(home_sp) - lib_paths = get_path('purelib'), get_path('platlib') - for site_lib in lib_paths: - if site_lib not in sitedirs: - sitedirs.append(site_lib) - - if site.ENABLE_USER_SITE: - sitedirs.append(site.USER_SITE) - - try: - sitedirs.extend(site.getsitepackages()) - except AttributeError: - pass - - sitedirs = list(map(normalize_path, sitedirs)) - - return sitedirs - - -def expand_paths(inputs): - """Yield sys.path directories that might contain "old-style" packages""" - - seen = {} - - for dirname in inputs: - dirname = normalize_path(dirname) - if dirname in seen: - continue - - seen[dirname] = 1 - if not os.path.isdir(dirname): - continue - - files = os.listdir(dirname) - yield dirname, files - - for name in files: - if not name.endswith('.pth'): - # We only care about the .pth files - continue - if name in ('easy-install.pth', 'setuptools.pth'): - # Ignore .pth files that we control - continue - - # Read the .pth file - f = open(os.path.join(dirname, name)) - lines = list(yield_lines(f)) - f.close() - - # Yield existing non-dupe, non-import directory lines from it - for line in lines: - if not line.startswith("import"): - line = normalize_path(line.rstrip()) - if line not in seen: - seen[line] = 1 - if not os.path.isdir(line): - continue - yield line, os.listdir(line) - - -def extract_wininst_cfg(dist_filename): - """Extract configuration data from a bdist_wininst .exe - - Returns a configparser.RawConfigParser, or None - """ - f = open(dist_filename, 'rb') - try: - endrec = zipfile._EndRecData(f) - if endrec is None: - return None - - prepended = (endrec[9] - endrec[5]) - endrec[6] - if prepended < 12: # no wininst data here - return None - f.seek(prepended - 12) - - tag, cfglen, bmlen = struct.unpack("egg path translations for a given .exe file""" - - prefixes = [ - ('PURELIB/', ''), - ('PLATLIB/pywin32_system32', ''), - ('PLATLIB/', ''), - ('SCRIPTS/', 'EGG-INFO/scripts/'), - ('DATA/lib/site-packages', ''), - ] - z = zipfile.ZipFile(exe_filename) - try: - for info in z.infolist(): - name = info.filename - parts = name.split('/') - if len(parts) == 3 and parts[2] == 'PKG-INFO': - if parts[1].endswith('.egg-info'): - prefixes.insert(0, ('/'.join(parts[:2]), 'EGG-INFO/')) - break - if len(parts) != 2 or not name.endswith('.pth'): - continue - if name.endswith('-nspkg.pth'): - continue - if parts[0].upper() in ('PURELIB', 'PLATLIB'): - contents = z.read(name) - if six.PY3: - contents = contents.decode() - for pth in yield_lines(contents): - pth = pth.strip().replace('\\', '/') - if not pth.startswith('import'): - prefixes.append((('%s/%s/' % (parts[0], pth)), '')) - finally: - z.close() - prefixes = [(x.lower(), y) for x, y in prefixes] - prefixes.sort() - prefixes.reverse() - return prefixes - - -class PthDistributions(Environment): - """A .pth file with Distribution paths in it""" - - dirty = False - - def __init__(self, filename, sitedirs=()): - self.filename = filename - self.sitedirs = list(map(normalize_path, sitedirs)) - self.basedir = normalize_path(os.path.dirname(self.filename)) - self._load() - Environment.__init__(self, [], None, None) - for path in yield_lines(self.paths): - list(map(self.add, find_distributions(path, True))) - - def _load(self): - self.paths = [] - saw_import = False - seen = dict.fromkeys(self.sitedirs) - if os.path.isfile(self.filename): - f = open(self.filename, 'rt') - for line in f: - if line.startswith('import'): - saw_import = True - continue - path = line.rstrip() - self.paths.append(path) - if not path.strip() or path.strip().startswith('#'): - continue - # skip non-existent paths, in case somebody deleted a package - # manually, and duplicate paths as well - path = self.paths[-1] = normalize_path( - os.path.join(self.basedir, path) - ) - if not os.path.exists(path) or path in seen: - self.paths.pop() # skip it - self.dirty = True # we cleaned up, so we're dirty now :) - continue - seen[path] = 1 - f.close() - - if self.paths and not saw_import: - self.dirty = True # ensure anything we touch has import wrappers - while self.paths and not self.paths[-1].strip(): - self.paths.pop() - - def save(self): - """Write changed .pth file back to disk""" - if not self.dirty: - return - - rel_paths = list(map(self.make_relative, self.paths)) - if rel_paths: - log.debug("Saving %s", self.filename) - lines = self._wrap_lines(rel_paths) - data = '\n'.join(lines) + '\n' - - if os.path.islink(self.filename): - os.unlink(self.filename) - with open(self.filename, 'wt') as f: - f.write(data) - - elif os.path.exists(self.filename): - log.debug("Deleting empty %s", self.filename) - os.unlink(self.filename) - - self.dirty = False - - @staticmethod - def _wrap_lines(lines): - return lines - - def add(self, dist): - """Add `dist` to the distribution map""" - new_path = ( - dist.location not in self.paths and ( - dist.location not in self.sitedirs or - # account for '.' being in PYTHONPATH - dist.location == os.getcwd() - ) - ) - if new_path: - self.paths.append(dist.location) - self.dirty = True - Environment.add(self, dist) - - def remove(self, dist): - """Remove `dist` from the distribution map""" - while dist.location in self.paths: - self.paths.remove(dist.location) - self.dirty = True - Environment.remove(self, dist) - - def make_relative(self, path): - npath, last = os.path.split(normalize_path(path)) - baselen = len(self.basedir) - parts = [last] - sep = os.altsep == '/' and '/' or os.sep - while len(npath) >= baselen: - if npath == self.basedir: - parts.append(os.curdir) - parts.reverse() - return sep.join(parts) - npath, last = os.path.split(npath) - parts.append(last) - else: - return path - - -class RewritePthDistributions(PthDistributions): - @classmethod - def _wrap_lines(cls, lines): - yield cls.prelude - for line in lines: - yield line - yield cls.postlude - - prelude = _one_liner(""" - import sys - sys.__plen = len(sys.path) - """) - postlude = _one_liner(""" - import sys - new = sys.path[sys.__plen:] - del sys.path[sys.__plen:] - p = getattr(sys, '__egginsert', 0) - sys.path[p:p] = new - sys.__egginsert = p + len(new) - """) - - -if os.environ.get('SETUPTOOLS_SYS_PATH_TECHNIQUE', 'raw') == 'rewrite': - PthDistributions = RewritePthDistributions - - -def _first_line_re(): - """ - Return a regular expression based on first_line_re suitable for matching - strings. - """ - if isinstance(first_line_re.pattern, str): - return first_line_re - - # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern. - return re.compile(first_line_re.pattern.decode()) - - -def auto_chmod(func, arg, exc): - if func in [os.unlink, os.remove] and os.name == 'nt': - chmod(arg, stat.S_IWRITE) - return func(arg) - et, ev, _ = sys.exc_info() - six.reraise(et, (ev[0], ev[1] + (" %s %s" % (func, arg)))) - - -def update_dist_caches(dist_path, fix_zipimporter_caches): - """ - Fix any globally cached `dist_path` related data - - `dist_path` should be a path of a newly installed egg distribution (zipped - or unzipped). - - sys.path_importer_cache contains finder objects that have been cached when - importing data from the original distribution. Any such finders need to be - cleared since the replacement distribution might be packaged differently, - e.g. a zipped egg distribution might get replaced with an unzipped egg - folder or vice versa. Having the old finders cached may then cause Python - to attempt loading modules from the replacement distribution using an - incorrect loader. - - zipimport.zipimporter objects are Python loaders charged with importing - data packaged inside zip archives. If stale loaders referencing the - original distribution, are left behind, they can fail to load modules from - the replacement distribution. E.g. if an old zipimport.zipimporter instance - is used to load data from a new zipped egg archive, it may cause the - operation to attempt to locate the requested data in the wrong location - - one indicated by the original distribution's zip archive directory - information. Such an operation may then fail outright, e.g. report having - read a 'bad local file header', or even worse, it may fail silently & - return invalid data. - - zipimport._zip_directory_cache contains cached zip archive directory - information for all existing zipimport.zipimporter instances and all such - instances connected to the same archive share the same cached directory - information. - - If asked, and the underlying Python implementation allows it, we can fix - all existing zipimport.zipimporter instances instead of having to track - them down and remove them one by one, by updating their shared cached zip - archive directory information. This, of course, assumes that the - replacement distribution is packaged as a zipped egg. - - If not asked to fix existing zipimport.zipimporter instances, we still do - our best to clear any remaining zipimport.zipimporter related cached data - that might somehow later get used when attempting to load data from the new - distribution and thus cause such load operations to fail. Note that when - tracking down such remaining stale data, we can not catch every conceivable - usage from here, and we clear only those that we know of and have found to - cause problems if left alive. Any remaining caches should be updated by - whomever is in charge of maintaining them, i.e. they should be ready to - handle us replacing their zip archives with new distributions at runtime. - - """ - # There are several other known sources of stale zipimport.zipimporter - # instances that we do not clear here, but might if ever given a reason to - # do so: - # * Global setuptools pkg_resources.working_set (a.k.a. 'master working - # set') may contain distributions which may in turn contain their - # zipimport.zipimporter loaders. - # * Several zipimport.zipimporter loaders held by local variables further - # up the function call stack when running the setuptools installation. - # * Already loaded modules may have their __loader__ attribute set to the - # exact loader instance used when importing them. Python 3.4 docs state - # that this information is intended mostly for introspection and so is - # not expected to cause us problems. - normalized_path = normalize_path(dist_path) - _uncache(normalized_path, sys.path_importer_cache) - if fix_zipimporter_caches: - _replace_zip_directory_cache_data(normalized_path) - else: - # Here, even though we do not want to fix existing and now stale - # zipimporter cache information, we still want to remove it. Related to - # Python's zip archive directory information cache, we clear each of - # its stale entries in two phases: - # 1. Clear the entry so attempting to access zip archive information - # via any existing stale zipimport.zipimporter instances fails. - # 2. Remove the entry from the cache so any newly constructed - # zipimport.zipimporter instances do not end up using old stale - # zip archive directory information. - # This whole stale data removal step does not seem strictly necessary, - # but has been left in because it was done before we started replacing - # the zip archive directory information cache content if possible, and - # there are no relevant unit tests that we can depend on to tell us if - # this is really needed. - _remove_and_clear_zip_directory_cache_data(normalized_path) - - -def _collect_zipimporter_cache_entries(normalized_path, cache): - """ - Return zipimporter cache entry keys related to a given normalized path. - - Alternative path spellings (e.g. those using different character case or - those using alternative path separators) related to the same path are - included. Any sub-path entries are included as well, i.e. those - corresponding to zip archives embedded in other zip archives. - - """ - result = [] - prefix_len = len(normalized_path) - for p in cache: - np = normalize_path(p) - if (np.startswith(normalized_path) and - np[prefix_len:prefix_len + 1] in (os.sep, '')): - result.append(p) - return result - - -def _update_zipimporter_cache(normalized_path, cache, updater=None): - """ - Update zipimporter cache data for a given normalized path. - - Any sub-path entries are processed as well, i.e. those corresponding to zip - archives embedded in other zip archives. - - Given updater is a callable taking a cache entry key and the original entry - (after already removing the entry from the cache), and expected to update - the entry and possibly return a new one to be inserted in its place. - Returning None indicates that the entry should not be replaced with a new - one. If no updater is given, the cache entries are simply removed without - any additional processing, the same as if the updater simply returned None. - - """ - for p in _collect_zipimporter_cache_entries(normalized_path, cache): - # N.B. pypy's custom zipimport._zip_directory_cache implementation does - # not support the complete dict interface: - # * Does not support item assignment, thus not allowing this function - # to be used only for removing existing cache entries. - # * Does not support the dict.pop() method, forcing us to use the - # get/del patterns instead. For more detailed information see the - # following links: - # https://github.com/pypa/setuptools/issues/202#issuecomment-202913420 - # http://bit.ly/2h9itJX - old_entry = cache[p] - del cache[p] - new_entry = updater and updater(p, old_entry) - if new_entry is not None: - cache[p] = new_entry - - -def _uncache(normalized_path, cache): - _update_zipimporter_cache(normalized_path, cache) - - -def _remove_and_clear_zip_directory_cache_data(normalized_path): - def clear_and_remove_cached_zip_archive_directory_data(path, old_entry): - old_entry.clear() - - _update_zipimporter_cache( - normalized_path, zipimport._zip_directory_cache, - updater=clear_and_remove_cached_zip_archive_directory_data) - - -# PyPy Python implementation does not allow directly writing to the -# zipimport._zip_directory_cache and so prevents us from attempting to correct -# its content. The best we can do there is clear the problematic cache content -# and have PyPy repopulate it as needed. The downside is that if there are any -# stale zipimport.zipimporter instances laying around, attempting to use them -# will fail due to not having its zip archive directory information available -# instead of being automatically corrected to use the new correct zip archive -# directory information. -if '__pypy__' in sys.builtin_module_names: - _replace_zip_directory_cache_data = \ - _remove_and_clear_zip_directory_cache_data -else: - - def _replace_zip_directory_cache_data(normalized_path): - def replace_cached_zip_archive_directory_data(path, old_entry): - # N.B. In theory, we could load the zip directory information just - # once for all updated path spellings, and then copy it locally and - # update its contained path strings to contain the correct - # spelling, but that seems like a way too invasive move (this cache - # structure is not officially documented anywhere and could in - # theory change with new Python releases) for no significant - # benefit. - old_entry.clear() - zipimport.zipimporter(path) - old_entry.update(zipimport._zip_directory_cache[path]) - return old_entry - - _update_zipimporter_cache( - normalized_path, zipimport._zip_directory_cache, - updater=replace_cached_zip_archive_directory_data) - - -def is_python(text, filename=''): - "Is this string a valid Python script?" - try: - compile(text, filename, 'exec') - except (SyntaxError, TypeError): - return False - else: - return True - - -def is_sh(executable): - """Determine if the specified executable is a .sh (contains a #! line)""" - try: - with io.open(executable, encoding='latin-1') as fp: - magic = fp.read(2) - except (OSError, IOError): - return executable - return magic == '#!' - - -def nt_quote_arg(arg): - """Quote a command line argument according to Windows parsing rules""" - return subprocess.list2cmdline([arg]) - - -def is_python_script(script_text, filename): - """Is this text, as a whole, a Python script? (as opposed to shell/bat/etc. - """ - if filename.endswith('.py') or filename.endswith('.pyw'): - return True # extension says it's Python - if is_python(script_text, filename): - return True # it's syntactically valid Python - if script_text.startswith('#!'): - # It begins with a '#!' line, so check if 'python' is in it somewhere - return 'python' in script_text.splitlines()[0].lower() - - return False # Not any Python I can recognize - - -try: - from os import chmod as _chmod -except ImportError: - # Jython compatibility - def _chmod(*args): - pass - - -def chmod(path, mode): - log.debug("changing mode of %s to %o", path, mode) - try: - _chmod(path, mode) - except os.error as e: - log.debug("chmod failed: %s", e) - - -class CommandSpec(list): - """ - A command spec for a #! header, specified as a list of arguments akin to - those passed to Popen. - """ - - options = [] - split_args = dict() - - @classmethod - def best(cls): - """ - Choose the best CommandSpec class based on environmental conditions. - """ - return cls - - @classmethod - def _sys_executable(cls): - _default = os.path.normpath(sys.executable) - return os.environ.get('__PYVENV_LAUNCHER__', _default) - - @classmethod - def from_param(cls, param): - """ - Construct a CommandSpec from a parameter to build_scripts, which may - be None. - """ - if isinstance(param, cls): - return param - if isinstance(param, list): - return cls(param) - if param is None: - return cls.from_environment() - # otherwise, assume it's a string. - return cls.from_string(param) - - @classmethod - def from_environment(cls): - return cls([cls._sys_executable()]) - - @classmethod - def from_string(cls, string): - """ - Construct a command spec from a simple string representing a command - line parseable by shlex.split. - """ - items = shlex.split(string, **cls.split_args) - return cls(items) - - def install_options(self, script_text): - self.options = shlex.split(self._extract_options(script_text)) - cmdline = subprocess.list2cmdline(self) - if not isascii(cmdline): - self.options[:0] = ['-x'] - - @staticmethod - def _extract_options(orig_script): - """ - Extract any options from the first line of the script. - """ - first = (orig_script + '\n').splitlines()[0] - match = _first_line_re().match(first) - options = match.group(1) or '' if match else '' - return options.strip() - - def as_header(self): - return self._render(self + list(self.options)) - - @staticmethod - def _strip_quotes(item): - _QUOTES = '"\'' - for q in _QUOTES: - if item.startswith(q) and item.endswith(q): - return item[1:-1] - return item - - @staticmethod - def _render(items): - cmdline = subprocess.list2cmdline( - CommandSpec._strip_quotes(item.strip()) for item in items) - return '#!' + cmdline + '\n' - - -# For pbr compat; will be removed in a future version. -sys_executable = CommandSpec._sys_executable() - - -class WindowsCommandSpec(CommandSpec): - split_args = dict(posix=False) - - -class ScriptWriter: - """ - Encapsulates behavior around writing entry point scripts for console and - gui apps. - """ - - template = textwrap.dedent(r""" - # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r - __requires__ = %(spec)r - import re - import sys - from pkg_resources import load_entry_point - - if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit( - load_entry_point(%(spec)r, %(group)r, %(name)r)() - ) - """).lstrip() - - command_spec_class = CommandSpec - - @classmethod - def get_script_args(cls, dist, executable=None, wininst=False): - # for backward compatibility - warnings.warn("Use get_args", EasyInstallDeprecationWarning) - writer = (WindowsScriptWriter if wininst else ScriptWriter).best() - header = cls.get_script_header("", executable, wininst) - return writer.get_args(dist, header) - - @classmethod - def get_script_header(cls, script_text, executable=None, wininst=False): - # for backward compatibility - warnings.warn("Use get_header", EasyInstallDeprecationWarning, stacklevel=2) - if wininst: - executable = "python.exe" - return cls.get_header(script_text, executable) - - @classmethod - def get_args(cls, dist, header=None): - """ - Yield write_script() argument tuples for a distribution's - console_scripts and gui_scripts entry points. - """ - if header is None: - header = cls.get_header() - spec = str(dist.as_requirement()) - for type_ in 'console', 'gui': - group = type_ + '_scripts' - for name, ep in dist.get_entry_map(group).items(): - cls._ensure_safe_name(name) - script_text = cls.template % locals() - args = cls._get_script_args(type_, name, header, script_text) - for res in args: - yield res - - @staticmethod - def _ensure_safe_name(name): - """ - Prevent paths in *_scripts entry point names. - """ - has_path_sep = re.search(r'[\\/]', name) - if has_path_sep: - raise ValueError("Path separators not allowed in script names") - - @classmethod - def get_writer(cls, force_windows): - # for backward compatibility - warnings.warn("Use best", EasyInstallDeprecationWarning) - return WindowsScriptWriter.best() if force_windows else cls.best() - - @classmethod - def best(cls): - """ - Select the best ScriptWriter for this environment. - """ - if sys.platform == 'win32' or (os.name == 'java' and os._name == 'nt'): - return WindowsScriptWriter.best() - else: - return cls - - @classmethod - def _get_script_args(cls, type_, name, header, script_text): - # Simply write the stub with no extension. - yield (name, header + script_text) - - @classmethod - def get_header(cls, script_text="", executable=None): - """Create a #! line, getting options (if any) from script_text""" - cmd = cls.command_spec_class.best().from_param(executable) - cmd.install_options(script_text) - return cmd.as_header() - - -class WindowsScriptWriter(ScriptWriter): - command_spec_class = WindowsCommandSpec - - @classmethod - def get_writer(cls): - # for backward compatibility - warnings.warn("Use best", EasyInstallDeprecationWarning) - return cls.best() - - @classmethod - def best(cls): - """ - Select the best ScriptWriter suitable for Windows - """ - writer_lookup = dict( - executable=WindowsExecutableLauncherWriter, - natural=cls, - ) - # for compatibility, use the executable launcher by default - launcher = os.environ.get('SETUPTOOLS_LAUNCHER', 'executable') - return writer_lookup[launcher] - - @classmethod - def _get_script_args(cls, type_, name, header, script_text): - "For Windows, add a .py extension" - ext = dict(console='.pya', gui='.pyw')[type_] - if ext not in os.environ['PATHEXT'].lower().split(';'): - msg = ( - "{ext} not listed in PATHEXT; scripts will not be " - "recognized as executables." - ).format(**locals()) - warnings.warn(msg, UserWarning) - old = ['.pya', '.py', '-script.py', '.pyc', '.pyo', '.pyw', '.exe'] - old.remove(ext) - header = cls._adjust_header(type_, header) - blockers = [name + x for x in old] - yield name + ext, header + script_text, 't', blockers - - @classmethod - def _adjust_header(cls, type_, orig_header): - """ - Make sure 'pythonw' is used for gui and and 'python' is used for - console (regardless of what sys.executable is). - """ - pattern = 'pythonw.exe' - repl = 'python.exe' - if type_ == 'gui': - pattern, repl = repl, pattern - pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE) - new_header = pattern_ob.sub(string=orig_header, repl=repl) - return new_header if cls._use_header(new_header) else orig_header - - @staticmethod - def _use_header(new_header): - """ - Should _adjust_header use the replaced header? - - On non-windows systems, always use. On - Windows systems, only use the replaced header if it resolves - to an executable on the system. - """ - clean_header = new_header[2:-1].strip('"') - return sys.platform != 'win32' or find_executable(clean_header) - - -class WindowsExecutableLauncherWriter(WindowsScriptWriter): - @classmethod - def _get_script_args(cls, type_, name, header, script_text): - """ - For Windows, add a .py extension and an .exe launcher - """ - if type_ == 'gui': - launcher_type = 'gui' - ext = '-script.pyw' - old = ['.pyw'] - else: - launcher_type = 'cli' - ext = '-script.py' - old = ['.py', '.pyc', '.pyo'] - hdr = cls._adjust_header(type_, header) - blockers = [name + x for x in old] - yield (name + ext, hdr + script_text, 't', blockers) - yield ( - name + '.exe', get_win_launcher(launcher_type), - 'b' # write in binary mode - ) - if not is_64bit(): - # install a manifest for the launcher to prevent Windows - # from detecting it as an installer (which it will for - # launchers like easy_install.exe). Consider only - # adding a manifest for launchers detected as installers. - # See Distribute #143 for details. - m_name = name + '.exe.manifest' - yield (m_name, load_launcher_manifest(name), 't') - - -# for backward-compatibility -get_script_args = ScriptWriter.get_script_args -get_script_header = ScriptWriter.get_script_header - - -def get_win_launcher(type): - """ - Load the Windows launcher (executable) suitable for launching a script. - - `type` should be either 'cli' or 'gui' - - Returns the executable as a byte string. - """ - launcher_fn = '%s.exe' % type - if is_64bit(): - launcher_fn = launcher_fn.replace(".", "-64.") - else: - launcher_fn = launcher_fn.replace(".", "-32.") - return resource_string('setuptools', launcher_fn) - - -def load_launcher_manifest(name): - manifest = pkg_resources.resource_string(__name__, 'launcher manifest.xml') - if six.PY2: - return manifest % vars() - else: - return manifest.decode('utf-8') % vars() - - -def rmtree(path, ignore_errors=False, onerror=auto_chmod): - return shutil.rmtree(path, ignore_errors, onerror) - - -def current_umask(): - tmp = os.umask(0o022) - os.umask(tmp) - return tmp - - -def bootstrap(): - # This function is called when setuptools*.egg is run using /bin/sh - import setuptools - - argv0 = os.path.dirname(setuptools.__path__[0]) - sys.argv[0] = argv0 - sys.argv.append(argv0) - main() - - -def main(argv=None, **kw): - from setuptools import setup - from setuptools.dist import Distribution - - class DistributionWithoutHelpCommands(Distribution): - common_usage = "" - - def _show_help(self, *args, **kw): - with _patch_usage(): - Distribution._show_help(self, *args, **kw) - - if argv is None: - argv = sys.argv[1:] - - with _patch_usage(): - setup( - script_args=['-q', 'easy_install', '-v'] + argv, - script_name=sys.argv[0] or 'easy_install', - distclass=DistributionWithoutHelpCommands, - **kw - ) - - -@contextlib.contextmanager -def _patch_usage(): - import distutils.core - USAGE = textwrap.dedent(""" - usage: %(script)s [options] requirement_or_url ... - or: %(script)s --help - """).lstrip() - - def gen_usage(script_name): - return USAGE % dict( - script=os.path.basename(script_name), - ) - - saved = distutils.core.gen_usage - distutils.core.gen_usage = gen_usage - try: - yield - finally: - distutils.core.gen_usage = saved - -class EasyInstallDeprecationWarning(SetuptoolsDeprecationWarning): - """Class for warning about deprecations in EasyInstall in SetupTools. Not ignored by default, unlike DeprecationWarning.""" - diff --git a/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py b/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py deleted file mode 100644 index b767ef31d3155dd0292f748f8749c405fd1d3258..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py +++ /dev/null @@ -1,717 +0,0 @@ -"""setuptools.command.egg_info - -Create a distribution's .egg-info directory and contents""" - -from distutils.filelist import FileList as _FileList -from distutils.errors import DistutilsInternalError -from distutils.util import convert_path -from distutils import log -import distutils.errors -import distutils.filelist -import os -import re -import sys -import io -import warnings -import time -import collections - -from setuptools.extern import six -from setuptools.extern.six.moves import map - -from setuptools import Command -from setuptools.command.sdist import sdist -from setuptools.command.sdist import walk_revctrl -from setuptools.command.setopt import edit_config -from setuptools.command import bdist_egg -from pkg_resources import ( - parse_requirements, safe_name, parse_version, - safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename) -import setuptools.unicode_utils as unicode_utils -from setuptools.glob import glob - -from setuptools.extern import packaging -from setuptools import SetuptoolsDeprecationWarning - -def translate_pattern(glob): - """ - Translate a file path glob like '*.txt' in to a regular expression. - This differs from fnmatch.translate which allows wildcards to match - directory separators. It also knows about '**/' which matches any number of - directories. - """ - pat = '' - - # This will split on '/' within [character classes]. This is deliberate. - chunks = glob.split(os.path.sep) - - sep = re.escape(os.sep) - valid_char = '[^%s]' % (sep,) - - for c, chunk in enumerate(chunks): - last_chunk = c == len(chunks) - 1 - - # Chunks that are a literal ** are globstars. They match anything. - if chunk == '**': - if last_chunk: - # Match anything if this is the last component - pat += '.*' - else: - # Match '(name/)*' - pat += '(?:%s+%s)*' % (valid_char, sep) - continue # Break here as the whole path component has been handled - - # Find any special characters in the remainder - i = 0 - chunk_len = len(chunk) - while i < chunk_len: - char = chunk[i] - if char == '*': - # Match any number of name characters - pat += valid_char + '*' - elif char == '?': - # Match a name character - pat += valid_char - elif char == '[': - # Character class - inner_i = i + 1 - # Skip initial !/] chars - if inner_i < chunk_len and chunk[inner_i] == '!': - inner_i = inner_i + 1 - if inner_i < chunk_len and chunk[inner_i] == ']': - inner_i = inner_i + 1 - - # Loop till the closing ] is found - while inner_i < chunk_len and chunk[inner_i] != ']': - inner_i = inner_i + 1 - - if inner_i >= chunk_len: - # Got to the end of the string without finding a closing ] - # Do not treat this as a matching group, but as a literal [ - pat += re.escape(char) - else: - # Grab the insides of the [brackets] - inner = chunk[i + 1:inner_i] - char_class = '' - - # Class negation - if inner[0] == '!': - char_class = '^' - inner = inner[1:] - - char_class += re.escape(inner) - pat += '[%s]' % (char_class,) - - # Skip to the end ] - i = inner_i - else: - pat += re.escape(char) - i += 1 - - # Join each chunk with the dir separator - if not last_chunk: - pat += sep - - pat += r'\Z' - return re.compile(pat, flags=re.MULTILINE|re.DOTALL) - - -class InfoCommon: - tag_build = None - tag_date = None - - @property - def name(self): - return safe_name(self.distribution.get_name()) - - def tagged_version(self): - version = self.distribution.get_version() - # egg_info may be called more than once for a distribution, - # in which case the version string already contains all tags. - if self.vtags and version.endswith(self.vtags): - return safe_version(version) - return safe_version(version + self.vtags) - - def tags(self): - version = '' - if self.tag_build: - version += self.tag_build - if self.tag_date: - version += time.strftime("-%Y%m%d") - return version - vtags = property(tags) - - -class egg_info(InfoCommon, Command): - description = "create a distribution's .egg-info directory" - - user_options = [ - ('egg-base=', 'e', "directory containing .egg-info directories" - " (default: top of the source tree)"), - ('tag-date', 'd', "Add date stamp (e.g. 20050528) to version number"), - ('tag-build=', 'b', "Specify explicit tag to add to version number"), - ('no-date', 'D', "Don't include date stamp [default]"), - ] - - boolean_options = ['tag-date'] - negative_opt = { - 'no-date': 'tag-date', - } - - def initialize_options(self): - self.egg_base = None - self.egg_name = None - self.egg_info = None - self.egg_version = None - self.broken_egg_info = False - - #################################### - # allow the 'tag_svn_revision' to be detected and - # set, supporting sdists built on older Setuptools. - @property - def tag_svn_revision(self): - pass - - @tag_svn_revision.setter - def tag_svn_revision(self, value): - pass - #################################### - - def save_version_info(self, filename): - """ - Materialize the value of date into the - build tag. Install build keys in a deterministic order - to avoid arbitrary reordering on subsequent builds. - """ - egg_info = collections.OrderedDict() - # follow the order these keys would have been added - # when PYTHONHASHSEED=0 - egg_info['tag_build'] = self.tags() - egg_info['tag_date'] = 0 - edit_config(filename, dict(egg_info=egg_info)) - - def finalize_options(self): - # Note: we need to capture the current value returned - # by `self.tagged_version()`, so we can later update - # `self.distribution.metadata.version` without - # repercussions. - self.egg_name = self.name - self.egg_version = self.tagged_version() - parsed_version = parse_version(self.egg_version) - - try: - is_version = isinstance(parsed_version, packaging.version.Version) - spec = ( - "%s==%s" if is_version else "%s===%s" - ) - list( - parse_requirements(spec % (self.egg_name, self.egg_version)) - ) - except ValueError: - raise distutils.errors.DistutilsOptionError( - "Invalid distribution name or version syntax: %s-%s" % - (self.egg_name, self.egg_version) - ) - - if self.egg_base is None: - dirs = self.distribution.package_dir - self.egg_base = (dirs or {}).get('', os.curdir) - - self.ensure_dirname('egg_base') - self.egg_info = to_filename(self.egg_name) + '.egg-info' - if self.egg_base != os.curdir: - self.egg_info = os.path.join(self.egg_base, self.egg_info) - if '-' in self.egg_name: - self.check_broken_egg_info() - - # Set package version for the benefit of dumber commands - # (e.g. sdist, bdist_wininst, etc.) - # - self.distribution.metadata.version = self.egg_version - - # If we bootstrapped around the lack of a PKG-INFO, as might be the - # case in a fresh checkout, make sure that any special tags get added - # to the version info - # - pd = self.distribution._patched_dist - if pd is not None and pd.key == self.egg_name.lower(): - pd._version = self.egg_version - pd._parsed_version = parse_version(self.egg_version) - self.distribution._patched_dist = None - - def write_or_delete_file(self, what, filename, data, force=False): - """Write `data` to `filename` or delete if empty - - If `data` is non-empty, this routine is the same as ``write_file()``. - If `data` is empty but not ``None``, this is the same as calling - ``delete_file(filename)`. If `data` is ``None``, then this is a no-op - unless `filename` exists, in which case a warning is issued about the - orphaned file (if `force` is false), or deleted (if `force` is true). - """ - if data: - self.write_file(what, filename, data) - elif os.path.exists(filename): - if data is None and not force: - log.warn( - "%s not set in setup(), but %s exists", what, filename - ) - return - else: - self.delete_file(filename) - - def write_file(self, what, filename, data): - """Write `data` to `filename` (if not a dry run) after announcing it - - `what` is used in a log message to identify what is being written - to the file. - """ - log.info("writing %s to %s", what, filename) - if six.PY3: - data = data.encode("utf-8") - if not self.dry_run: - f = open(filename, 'wb') - f.write(data) - f.close() - - def delete_file(self, filename): - """Delete `filename` (if not a dry run) after announcing it""" - log.info("deleting %s", filename) - if not self.dry_run: - os.unlink(filename) - - def run(self): - self.mkpath(self.egg_info) - os.utime(self.egg_info, None) - installer = self.distribution.fetch_build_egg - for ep in iter_entry_points('egg_info.writers'): - ep.require(installer=installer) - writer = ep.resolve() - writer(self, ep.name, os.path.join(self.egg_info, ep.name)) - - # Get rid of native_libs.txt if it was put there by older bdist_egg - nl = os.path.join(self.egg_info, "native_libs.txt") - if os.path.exists(nl): - self.delete_file(nl) - - self.find_sources() - - def find_sources(self): - """Generate SOURCES.txt manifest file""" - manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") - mm = manifest_maker(self.distribution) - mm.manifest = manifest_filename - mm.run() - self.filelist = mm.filelist - - def check_broken_egg_info(self): - bei = self.egg_name + '.egg-info' - if self.egg_base != os.curdir: - bei = os.path.join(self.egg_base, bei) - if os.path.exists(bei): - log.warn( - "-" * 78 + '\n' - "Note: Your current .egg-info directory has a '-' in its name;" - '\nthis will not work correctly with "setup.py develop".\n\n' - 'Please rename %s to %s to correct this problem.\n' + '-' * 78, - bei, self.egg_info - ) - self.broken_egg_info = self.egg_info - self.egg_info = bei # make it work for now - - -class FileList(_FileList): - # Implementations of the various MANIFEST.in commands - - def process_template_line(self, line): - # Parse the line: split it up, make sure the right number of words - # is there, and return the relevant words. 'action' is always - # defined: it's the first word of the line. Which of the other - # three are defined depends on the action; it'll be either - # patterns, (dir and patterns), or (dir_pattern). - (action, patterns, dir, dir_pattern) = self._parse_template_line(line) - - # OK, now we know that the action is valid and we have the - # right number of words on the line for that action -- so we - # can proceed with minimal error-checking. - if action == 'include': - self.debug_print("include " + ' '.join(patterns)) - for pattern in patterns: - if not self.include(pattern): - log.warn("warning: no files found matching '%s'", pattern) - - elif action == 'exclude': - self.debug_print("exclude " + ' '.join(patterns)) - for pattern in patterns: - if not self.exclude(pattern): - log.warn(("warning: no previously-included files " - "found matching '%s'"), pattern) - - elif action == 'global-include': - self.debug_print("global-include " + ' '.join(patterns)) - for pattern in patterns: - if not self.global_include(pattern): - log.warn(("warning: no files found matching '%s' " - "anywhere in distribution"), pattern) - - elif action == 'global-exclude': - self.debug_print("global-exclude " + ' '.join(patterns)) - for pattern in patterns: - if not self.global_exclude(pattern): - log.warn(("warning: no previously-included files matching " - "'%s' found anywhere in distribution"), - pattern) - - elif action == 'recursive-include': - self.debug_print("recursive-include %s %s" % - (dir, ' '.join(patterns))) - for pattern in patterns: - if not self.recursive_include(dir, pattern): - log.warn(("warning: no files found matching '%s' " - "under directory '%s'"), - pattern, dir) - - elif action == 'recursive-exclude': - self.debug_print("recursive-exclude %s %s" % - (dir, ' '.join(patterns))) - for pattern in patterns: - if not self.recursive_exclude(dir, pattern): - log.warn(("warning: no previously-included files matching " - "'%s' found under directory '%s'"), - pattern, dir) - - elif action == 'graft': - self.debug_print("graft " + dir_pattern) - if not self.graft(dir_pattern): - log.warn("warning: no directories found matching '%s'", - dir_pattern) - - elif action == 'prune': - self.debug_print("prune " + dir_pattern) - if not self.prune(dir_pattern): - log.warn(("no previously-included directories found " - "matching '%s'"), dir_pattern) - - else: - raise DistutilsInternalError( - "this cannot happen: invalid action '%s'" % action) - - def _remove_files(self, predicate): - """ - Remove all files from the file list that match the predicate. - Return True if any matching files were removed - """ - found = False - for i in range(len(self.files) - 1, -1, -1): - if predicate(self.files[i]): - self.debug_print(" removing " + self.files[i]) - del self.files[i] - found = True - return found - - def include(self, pattern): - """Include files that match 'pattern'.""" - found = [f for f in glob(pattern) if not os.path.isdir(f)] - self.extend(found) - return bool(found) - - def exclude(self, pattern): - """Exclude files that match 'pattern'.""" - match = translate_pattern(pattern) - return self._remove_files(match.match) - - def recursive_include(self, dir, pattern): - """ - Include all files anywhere in 'dir/' that match the pattern. - """ - full_pattern = os.path.join(dir, '**', pattern) - found = [f for f in glob(full_pattern, recursive=True) - if not os.path.isdir(f)] - self.extend(found) - return bool(found) - - def recursive_exclude(self, dir, pattern): - """ - Exclude any file anywhere in 'dir/' that match the pattern. - """ - match = translate_pattern(os.path.join(dir, '**', pattern)) - return self._remove_files(match.match) - - def graft(self, dir): - """Include all files from 'dir/'.""" - found = [ - item - for match_dir in glob(dir) - for item in distutils.filelist.findall(match_dir) - ] - self.extend(found) - return bool(found) - - def prune(self, dir): - """Filter out files from 'dir/'.""" - match = translate_pattern(os.path.join(dir, '**')) - return self._remove_files(match.match) - - def global_include(self, pattern): - """ - Include all files anywhere in the current directory that match the - pattern. This is very inefficient on large file trees. - """ - if self.allfiles is None: - self.findall() - match = translate_pattern(os.path.join('**', pattern)) - found = [f for f in self.allfiles if match.match(f)] - self.extend(found) - return bool(found) - - def global_exclude(self, pattern): - """ - Exclude all files anywhere that match the pattern. - """ - match = translate_pattern(os.path.join('**', pattern)) - return self._remove_files(match.match) - - def append(self, item): - if item.endswith('\r'): # Fix older sdists built on Windows - item = item[:-1] - path = convert_path(item) - - if self._safe_path(path): - self.files.append(path) - - def extend(self, paths): - self.files.extend(filter(self._safe_path, paths)) - - def _repair(self): - """ - Replace self.files with only safe paths - - Because some owners of FileList manipulate the underlying - ``files`` attribute directly, this method must be called to - repair those paths. - """ - self.files = list(filter(self._safe_path, self.files)) - - def _safe_path(self, path): - enc_warn = "'%s' not %s encodable -- skipping" - - # To avoid accidental trans-codings errors, first to unicode - u_path = unicode_utils.filesys_decode(path) - if u_path is None: - log.warn("'%s' in unexpected encoding -- skipping" % path) - return False - - # Must ensure utf-8 encodability - utf8_path = unicode_utils.try_encode(u_path, "utf-8") - if utf8_path is None: - log.warn(enc_warn, path, 'utf-8') - return False - - try: - # accept is either way checks out - if os.path.exists(u_path) or os.path.exists(utf8_path): - return True - # this will catch any encode errors decoding u_path - except UnicodeEncodeError: - log.warn(enc_warn, path, sys.getfilesystemencoding()) - - -class manifest_maker(sdist): - template = "MANIFEST.in" - - def initialize_options(self): - self.use_defaults = 1 - self.prune = 1 - self.manifest_only = 1 - self.force_manifest = 1 - - def finalize_options(self): - pass - - def run(self): - self.filelist = FileList() - if not os.path.exists(self.manifest): - self.write_manifest() # it must exist so it'll get in the list - self.add_defaults() - if os.path.exists(self.template): - self.read_template() - self.prune_file_list() - self.filelist.sort() - self.filelist.remove_duplicates() - self.write_manifest() - - def _manifest_normalize(self, path): - path = unicode_utils.filesys_decode(path) - return path.replace(os.sep, '/') - - def write_manifest(self): - """ - Write the file list in 'self.filelist' to the manifest file - named by 'self.manifest'. - """ - self.filelist._repair() - - # Now _repairs should encodability, but not unicode - files = [self._manifest_normalize(f) for f in self.filelist.files] - msg = "writing manifest file '%s'" % self.manifest - self.execute(write_file, (self.manifest, files), msg) - - def warn(self, msg): - if not self._should_suppress_warning(msg): - sdist.warn(self, msg) - - @staticmethod - def _should_suppress_warning(msg): - """ - suppress missing-file warnings from sdist - """ - return re.match(r"standard file .*not found", msg) - - def add_defaults(self): - sdist.add_defaults(self) - self.check_license() - self.filelist.append(self.template) - self.filelist.append(self.manifest) - rcfiles = list(walk_revctrl()) - if rcfiles: - self.filelist.extend(rcfiles) - elif os.path.exists(self.manifest): - self.read_manifest() - - if os.path.exists("setup.py"): - # setup.py should be included by default, even if it's not - # the script called to create the sdist - self.filelist.append("setup.py") - - ei_cmd = self.get_finalized_command('egg_info') - self.filelist.graft(ei_cmd.egg_info) - - def prune_file_list(self): - build = self.get_finalized_command('build') - base_dir = self.distribution.get_fullname() - self.filelist.prune(build.build_base) - self.filelist.prune(base_dir) - sep = re.escape(os.sep) - self.filelist.exclude_pattern(r'(^|' + sep + r')(RCS|CVS|\.svn)' + sep, - is_regex=1) - - -def write_file(filename, contents): - """Create a file with the specified name and write 'contents' (a - sequence of strings without line terminators) to it. - """ - contents = "\n".join(contents) - - # assuming the contents has been vetted for utf-8 encoding - contents = contents.encode("utf-8") - - with open(filename, "wb") as f: # always write POSIX-style manifest - f.write(contents) - - -def write_pkg_info(cmd, basename, filename): - log.info("writing %s", filename) - if not cmd.dry_run: - metadata = cmd.distribution.metadata - metadata.version, oldver = cmd.egg_version, metadata.version - metadata.name, oldname = cmd.egg_name, metadata.name - - try: - # write unescaped data to PKG-INFO, so older pkg_resources - # can still parse it - metadata.write_pkg_info(cmd.egg_info) - finally: - metadata.name, metadata.version = oldname, oldver - - safe = getattr(cmd.distribution, 'zip_safe', None) - - bdist_egg.write_safety_flag(cmd.egg_info, safe) - - -def warn_depends_obsolete(cmd, basename, filename): - if os.path.exists(filename): - log.warn( - "WARNING: 'depends.txt' is not used by setuptools 0.6!\n" - "Use the install_requires/extras_require setup() args instead." - ) - - -def _write_requirements(stream, reqs): - lines = yield_lines(reqs or ()) - append_cr = lambda line: line + '\n' - lines = map(append_cr, sorted(lines)) - stream.writelines(lines) - - -def write_requirements(cmd, basename, filename): - dist = cmd.distribution - data = six.StringIO() - _write_requirements(data, dist.install_requires) - extras_require = dist.extras_require or {} - for extra in sorted(extras_require): - data.write('\n[{extra}]\n'.format(**vars())) - _write_requirements(data, extras_require[extra]) - cmd.write_or_delete_file("requirements", filename, data.getvalue()) - - -def write_setup_requirements(cmd, basename, filename): - data = io.StringIO() - _write_requirements(data, cmd.distribution.setup_requires) - cmd.write_or_delete_file("setup-requirements", filename, data.getvalue()) - - -def write_toplevel_names(cmd, basename, filename): - pkgs = dict.fromkeys( - [ - k.split('.', 1)[0] - for k in cmd.distribution.iter_distribution_names() - ] - ) - cmd.write_file("top-level names", filename, '\n'.join(sorted(pkgs)) + '\n') - - -def overwrite_arg(cmd, basename, filename): - write_arg(cmd, basename, filename, True) - - -def write_arg(cmd, basename, filename, force=False): - argname = os.path.splitext(basename)[0] - value = getattr(cmd.distribution, argname, None) - if value is not None: - value = '\n'.join(value) + '\n' - cmd.write_or_delete_file(argname, filename, value, force) - - -def write_entries(cmd, basename, filename): - ep = cmd.distribution.entry_points - - if isinstance(ep, six.string_types) or ep is None: - data = ep - elif ep is not None: - data = [] - for section, contents in sorted(ep.items()): - if not isinstance(contents, six.string_types): - contents = EntryPoint.parse_group(section, contents) - contents = '\n'.join(sorted(map(str, contents.values()))) - data.append('[%s]\n%s\n\n' % (section, contents)) - data = ''.join(data) - - cmd.write_or_delete_file('entry points', filename, data, True) - - -def get_pkg_info_revision(): - """ - Get a -r### off of PKG-INFO Version in case this is an sdist of - a subversion revision. - """ - warnings.warn("get_pkg_info_revision is deprecated.", EggInfoDeprecationWarning) - if os.path.exists('PKG-INFO'): - with io.open('PKG-INFO') as f: - for line in f: - match = re.match(r"Version:.*-r(\d+)\s*$", line) - if match: - return int(match.group(1)) - return 0 - - -class EggInfoDeprecationWarning(SetuptoolsDeprecationWarning): - """Class for warning about deprecations in eggInfo in setupTools. Not ignored by default, unlike DeprecationWarning.""" diff --git a/venv/lib/python3.8/site-packages/setuptools/command/install.py b/venv/lib/python3.8/site-packages/setuptools/command/install.py deleted file mode 100644 index 72b9a3e424707633c7e31a347170f358cfa3f87a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/install.py +++ /dev/null @@ -1,125 +0,0 @@ -from distutils.errors import DistutilsArgError -import inspect -import glob -import warnings -import platform -import distutils.command.install as orig - -import setuptools - -# Prior to numpy 1.9, NumPy relies on the '_install' name, so provide it for -# now. See https://github.com/pypa/setuptools/issues/199/ -_install = orig.install - - -class install(orig.install): - """Use easy_install to install the package, w/dependencies""" - - user_options = orig.install.user_options + [ - ('old-and-unmanageable', None, "Try not to use this!"), - ('single-version-externally-managed', None, - "used by system package builders to create 'flat' eggs"), - ] - boolean_options = orig.install.boolean_options + [ - 'old-and-unmanageable', 'single-version-externally-managed', - ] - new_commands = [ - ('install_egg_info', lambda self: True), - ('install_scripts', lambda self: True), - ] - _nc = dict(new_commands) - - def initialize_options(self): - orig.install.initialize_options(self) - self.old_and_unmanageable = None - self.single_version_externally_managed = None - - def finalize_options(self): - orig.install.finalize_options(self) - if self.root: - self.single_version_externally_managed = True - elif self.single_version_externally_managed: - if not self.root and not self.record: - raise DistutilsArgError( - "You must specify --record or --root when building system" - " packages" - ) - - def handle_extra_path(self): - if self.root or self.single_version_externally_managed: - # explicit backward-compatibility mode, allow extra_path to work - return orig.install.handle_extra_path(self) - - # Ignore extra_path when installing an egg (or being run by another - # command without --root or --single-version-externally-managed - self.path_file = None - self.extra_dirs = '' - - def run(self): - # Explicit request for old-style install? Just do it - if self.old_and_unmanageable or self.single_version_externally_managed: - return orig.install.run(self) - - if not self._called_from_setup(inspect.currentframe()): - # Run in backward-compatibility mode to support bdist_* commands. - orig.install.run(self) - else: - self.do_egg_install() - - @staticmethod - def _called_from_setup(run_frame): - """ - Attempt to detect whether run() was called from setup() or by another - command. If called by setup(), the parent caller will be the - 'run_command' method in 'distutils.dist', and *its* caller will be - the 'run_commands' method. If called any other way, the - immediate caller *might* be 'run_command', but it won't have been - called by 'run_commands'. Return True in that case or if a call stack - is unavailable. Return False otherwise. - """ - if run_frame is None: - msg = "Call stack not available. bdist_* commands may fail." - warnings.warn(msg) - if platform.python_implementation() == 'IronPython': - msg = "For best results, pass -X:Frames to enable call stack." - warnings.warn(msg) - return True - res = inspect.getouterframes(run_frame)[2] - caller, = res[:1] - info = inspect.getframeinfo(caller) - caller_module = caller.f_globals.get('__name__', '') - return ( - caller_module == 'distutils.dist' - and info.function == 'run_commands' - ) - - def do_egg_install(self): - - easy_install = self.distribution.get_command_class('easy_install') - - cmd = easy_install( - self.distribution, args="x", root=self.root, record=self.record, - ) - cmd.ensure_finalized() # finalize before bdist_egg munges install cmd - cmd.always_copy_from = '.' # make sure local-dir eggs get installed - - # pick up setup-dir .egg files only: no .egg-info - cmd.package_index.scan(glob.glob('*.egg')) - - self.run_command('bdist_egg') - args = [self.distribution.get_command_obj('bdist_egg').egg_output] - - if setuptools.bootstrap_install_from: - # Bootstrap self-installation of setuptools - args.insert(0, setuptools.bootstrap_install_from) - - cmd.args = args - cmd.run(show_deprecation=False) - setuptools.bootstrap_install_from = None - - -# XXX Python 3.1 doesn't see _nc if this is inside the class -install.sub_commands = ( - [cmd for cmd in orig.install.sub_commands if cmd[0] not in install._nc] + - install.new_commands -) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/install_egg_info.py b/venv/lib/python3.8/site-packages/setuptools/command/install_egg_info.py deleted file mode 100644 index 5f405bcad743bac704e90c5489713a5cd4404497..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/install_egg_info.py +++ /dev/null @@ -1,82 +0,0 @@ -from distutils import log, dir_util -import os, sys - -from setuptools import Command -from setuptools import namespaces -from setuptools.archive_util import unpack_archive -import pkg_resources - - -class install_egg_info(namespaces.Installer, Command): - """Install an .egg-info directory for the package""" - - description = "Install an .egg-info directory for the package" - - user_options = [ - ('install-dir=', 'd', "directory to install to"), - ] - - def initialize_options(self): - self.install_dir = None - self.install_layout = None - self.prefix_option = None - - def finalize_options(self): - self.set_undefined_options('install_lib', - ('install_dir', 'install_dir')) - self.set_undefined_options('install',('install_layout','install_layout')) - if sys.hexversion > 0x2060000: - self.set_undefined_options('install',('prefix_option','prefix_option')) - ei_cmd = self.get_finalized_command("egg_info") - basename = pkg_resources.Distribution( - None, None, ei_cmd.egg_name, ei_cmd.egg_version - ).egg_name() + '.egg-info' - - if self.install_layout: - if not self.install_layout.lower() in ['deb']: - raise DistutilsOptionError("unknown value for --install-layout") - self.install_layout = self.install_layout.lower() - basename = basename.replace('-py%s' % pkg_resources.PY_MAJOR, '') - elif self.prefix_option or 'real_prefix' in sys.__dict__: - # don't modify for virtualenv - pass - else: - basename = basename.replace('-py%s' % pkg_resources.PY_MAJOR, '') - - self.source = ei_cmd.egg_info - self.target = os.path.join(self.install_dir, basename) - self.outputs = [] - - def run(self): - self.run_command('egg_info') - if os.path.isdir(self.target) and not os.path.islink(self.target): - dir_util.remove_tree(self.target, dry_run=self.dry_run) - elif os.path.exists(self.target): - self.execute(os.unlink, (self.target,), "Removing " + self.target) - if not self.dry_run: - pkg_resources.ensure_directory(self.target) - self.execute( - self.copytree, (), "Copying %s to %s" % (self.source, self.target) - ) - self.install_namespaces() - - def get_outputs(self): - return self.outputs - - def copytree(self): - # Copy the .egg-info tree to site-packages - def skimmer(src, dst): - # filter out source-control directories; note that 'src' is always - # a '/'-separated path, regardless of platform. 'dst' is a - # platform-specific path. - for skip in '.svn/', 'CVS/': - if src.startswith(skip) or '/' + skip in src: - return None - if self.install_layout and self.install_layout in ['deb'] and src.startswith('SOURCES.txt'): - log.info("Skipping SOURCES.txt") - return None - self.outputs.append(dst) - log.debug("Copying %s to %s", src, dst) - return dst - - unpack_archive(self.source, self.target, skimmer) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/install_lib.py b/venv/lib/python3.8/site-packages/setuptools/command/install_lib.py deleted file mode 100644 index bf81519d98e8221707f45c1a3901b8d836095d30..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/install_lib.py +++ /dev/null @@ -1,147 +0,0 @@ -import os -import sys -from itertools import product, starmap -import distutils.command.install_lib as orig - - -class install_lib(orig.install_lib): - """Don't add compiled flags to filenames of non-Python files""" - - def initialize_options(self): - orig.install_lib.initialize_options(self) - self.multiarch = None - self.install_layout = None - - def finalize_options(self): - orig.install_lib.finalize_options(self) - self.set_undefined_options('install',('install_layout','install_layout')) - if self.install_layout == 'deb' and sys.version_info[:2] >= (3, 3): - import sysconfig - self.multiarch = sysconfig.get_config_var('MULTIARCH') - - def run(self): - self.build() - outfiles = self.install() - if outfiles is not None: - # always compile, in case we have any extension stubs to deal with - self.byte_compile(outfiles) - - def get_exclusions(self): - """ - Return a collections.Sized collections.Container of paths to be - excluded for single_version_externally_managed installations. - """ - all_packages = ( - pkg - for ns_pkg in self._get_SVEM_NSPs() - for pkg in self._all_packages(ns_pkg) - ) - - excl_specs = product(all_packages, self._gen_exclusion_paths()) - return set(starmap(self._exclude_pkg_path, excl_specs)) - - def _exclude_pkg_path(self, pkg, exclusion_path): - """ - Given a package name and exclusion path within that package, - compute the full exclusion path. - """ - parts = pkg.split('.') + [exclusion_path] - return os.path.join(self.install_dir, *parts) - - @staticmethod - def _all_packages(pkg_name): - """ - >>> list(install_lib._all_packages('foo.bar.baz')) - ['foo.bar.baz', 'foo.bar', 'foo'] - """ - while pkg_name: - yield pkg_name - pkg_name, sep, child = pkg_name.rpartition('.') - - def _get_SVEM_NSPs(self): - """ - Get namespace packages (list) but only for - single_version_externally_managed installations and empty otherwise. - """ - # TODO: is it necessary to short-circuit here? i.e. what's the cost - # if get_finalized_command is called even when namespace_packages is - # False? - if not self.distribution.namespace_packages: - return [] - - install_cmd = self.get_finalized_command('install') - svem = install_cmd.single_version_externally_managed - - return self.distribution.namespace_packages if svem else [] - - @staticmethod - def _gen_exclusion_paths(): - """ - Generate file paths to be excluded for namespace packages (bytecode - cache files). - """ - # always exclude the package module itself - yield '__init__.py' - - yield '__init__.pyc' - yield '__init__.pyo' - - if not hasattr(sys, 'implementation'): - return - - base = os.path.join('__pycache__', '__init__.' + sys.implementation.cache_tag) - yield base + '.pyc' - yield base + '.pyo' - yield base + '.opt-1.pyc' - yield base + '.opt-2.pyc' - - def copy_tree( - self, infile, outfile, - preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1 - ): - assert preserve_mode and preserve_times and not preserve_symlinks - exclude = self.get_exclusions() - - if not exclude: - import distutils.dir_util - distutils.dir_util._multiarch = self.multiarch - return orig.install_lib.copy_tree(self, infile, outfile) - - # Exclude namespace package __init__.py* files from the output - - from setuptools.archive_util import unpack_directory - from distutils import log - - outfiles = [] - - if self.multiarch: - import sysconfig - ext_suffix = sysconfig.get_config_var ('EXT_SUFFIX') - if ext_suffix.endswith(self.multiarch + ext_suffix[-3:]): - new_suffix = None - else: - new_suffix = "%s-%s%s" % (ext_suffix[:-3], self.multiarch, ext_suffix[-3:]) - - def pf(src, dst): - if dst in exclude: - log.warn("Skipping installation of %s (namespace package)", - dst) - return False - - if self.multiarch and new_suffix and dst.endswith(ext_suffix) and not dst.endswith(new_suffix): - dst = dst.replace(ext_suffix, new_suffix) - log.info("renaming extension to %s", os.path.basename(dst)) - - log.info("copying %s -> %s", src, os.path.dirname(dst)) - outfiles.append(dst) - return dst - - unpack_directory(infile, outfile, pf) - return outfiles - - def get_outputs(self): - outputs = orig.install_lib.get_outputs(self) - exclude = self.get_exclusions() - if exclude: - return [f for f in outputs if f not in exclude] - return outputs diff --git a/venv/lib/python3.8/site-packages/setuptools/command/install_scripts.py b/venv/lib/python3.8/site-packages/setuptools/command/install_scripts.py deleted file mode 100644 index 16234273a2d36b0b3d821a7a97bf8f03cf3f2948..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/install_scripts.py +++ /dev/null @@ -1,65 +0,0 @@ -from distutils import log -import distutils.command.install_scripts as orig -import os -import sys - -from pkg_resources import Distribution, PathMetadata, ensure_directory - - -class install_scripts(orig.install_scripts): - """Do normal script install, plus any egg_info wrapper scripts""" - - def initialize_options(self): - orig.install_scripts.initialize_options(self) - self.no_ep = False - - def run(self): - import setuptools.command.easy_install as ei - - self.run_command("egg_info") - if self.distribution.scripts: - orig.install_scripts.run(self) # run first to set up self.outfiles - else: - self.outfiles = [] - if self.no_ep: - # don't install entry point scripts into .egg file! - return - - ei_cmd = self.get_finalized_command("egg_info") - dist = Distribution( - ei_cmd.egg_base, PathMetadata(ei_cmd.egg_base, ei_cmd.egg_info), - ei_cmd.egg_name, ei_cmd.egg_version, - ) - bs_cmd = self.get_finalized_command('build_scripts') - exec_param = getattr(bs_cmd, 'executable', None) - bw_cmd = self.get_finalized_command("bdist_wininst") - is_wininst = getattr(bw_cmd, '_is_running', False) - writer = ei.ScriptWriter - if is_wininst: - exec_param = "python.exe" - writer = ei.WindowsScriptWriter - if exec_param == sys.executable: - # In case the path to the Python executable contains a space, wrap - # it so it's not split up. - exec_param = [exec_param] - # resolve the writer to the environment - writer = writer.best() - cmd = writer.command_spec_class.best().from_param(exec_param) - for args in writer.get_args(dist, cmd.as_header()): - self.write_script(*args) - - def write_script(self, script_name, contents, mode="t", *ignored): - """Write an executable file to the scripts directory""" - from setuptools.command.easy_install import chmod, current_umask - - log.info("Installing %s script to %s", script_name, self.install_dir) - target = os.path.join(self.install_dir, script_name) - self.outfiles.append(target) - - mask = current_umask() - if not self.dry_run: - ensure_directory(target) - f = open(target, "w" + mode) - f.write(contents) - f.close() - chmod(target, 0o777 - mask) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/launcher manifest.xml b/venv/lib/python3.8/site-packages/setuptools/command/launcher manifest.xml deleted file mode 100644 index 5972a96d8ded85cc14147ffc1400ec67c3b5a578..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/launcher manifest.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/venv/lib/python3.8/site-packages/setuptools/command/py36compat.py b/venv/lib/python3.8/site-packages/setuptools/command/py36compat.py deleted file mode 100644 index 61063e7542586c05c3af21d31cd917ebd1118272..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/py36compat.py +++ /dev/null @@ -1,136 +0,0 @@ -import os -from glob import glob -from distutils.util import convert_path -from distutils.command import sdist - -from setuptools.extern.six.moves import filter - - -class sdist_add_defaults: - """ - Mix-in providing forward-compatibility for functionality as found in - distutils on Python 3.7. - - Do not edit the code in this class except to update functionality - as implemented in distutils. Instead, override in the subclass. - """ - - def add_defaults(self): - """Add all the default files to self.filelist: - - README or README.txt - - setup.py - - test/test*.py - - all pure Python modules mentioned in setup script - - all files pointed by package_data (build_py) - - all files defined in data_files. - - all files defined as scripts. - - all C sources listed as part of extensions or C libraries - in the setup script (doesn't catch C headers!) - Warns if (README or README.txt) or setup.py are missing; everything - else is optional. - """ - self._add_defaults_standards() - self._add_defaults_optional() - self._add_defaults_python() - self._add_defaults_data_files() - self._add_defaults_ext() - self._add_defaults_c_libs() - self._add_defaults_scripts() - - @staticmethod - def _cs_path_exists(fspath): - """ - Case-sensitive path existence check - - >>> sdist_add_defaults._cs_path_exists(__file__) - True - >>> sdist_add_defaults._cs_path_exists(__file__.upper()) - False - """ - if not os.path.exists(fspath): - return False - # make absolute so we always have a directory - abspath = os.path.abspath(fspath) - directory, filename = os.path.split(abspath) - return filename in os.listdir(directory) - - def _add_defaults_standards(self): - standards = [self.READMES, self.distribution.script_name] - for fn in standards: - if isinstance(fn, tuple): - alts = fn - got_it = False - for fn in alts: - if self._cs_path_exists(fn): - got_it = True - self.filelist.append(fn) - break - - if not got_it: - self.warn("standard file not found: should have one of " + - ', '.join(alts)) - else: - if self._cs_path_exists(fn): - self.filelist.append(fn) - else: - self.warn("standard file '%s' not found" % fn) - - def _add_defaults_optional(self): - optional = ['test/test*.py', 'setup.cfg'] - for pattern in optional: - files = filter(os.path.isfile, glob(pattern)) - self.filelist.extend(files) - - def _add_defaults_python(self): - # build_py is used to get: - # - python modules - # - files defined in package_data - build_py = self.get_finalized_command('build_py') - - # getting python files - if self.distribution.has_pure_modules(): - self.filelist.extend(build_py.get_source_files()) - - # getting package_data files - # (computed in build_py.data_files by build_py.finalize_options) - for pkg, src_dir, build_dir, filenames in build_py.data_files: - for filename in filenames: - self.filelist.append(os.path.join(src_dir, filename)) - - def _add_defaults_data_files(self): - # getting distribution.data_files - if self.distribution.has_data_files(): - for item in self.distribution.data_files: - if isinstance(item, str): - # plain file - item = convert_path(item) - if os.path.isfile(item): - self.filelist.append(item) - else: - # a (dirname, filenames) tuple - dirname, filenames = item - for f in filenames: - f = convert_path(f) - if os.path.isfile(f): - self.filelist.append(f) - - def _add_defaults_ext(self): - if self.distribution.has_ext_modules(): - build_ext = self.get_finalized_command('build_ext') - self.filelist.extend(build_ext.get_source_files()) - - def _add_defaults_c_libs(self): - if self.distribution.has_c_libraries(): - build_clib = self.get_finalized_command('build_clib') - self.filelist.extend(build_clib.get_source_files()) - - def _add_defaults_scripts(self): - if self.distribution.has_scripts(): - build_scripts = self.get_finalized_command('build_scripts') - self.filelist.extend(build_scripts.get_source_files()) - - -if hasattr(sdist.sdist, '_add_defaults_standards'): - # disable the functionality already available upstream - class sdist_add_defaults: - pass diff --git a/venv/lib/python3.8/site-packages/setuptools/command/register.py b/venv/lib/python3.8/site-packages/setuptools/command/register.py deleted file mode 100644 index b8266b9a60f8c363ba35f7b73befd7c9c7cb4abc..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/register.py +++ /dev/null @@ -1,18 +0,0 @@ -from distutils import log -import distutils.command.register as orig - -from setuptools.errors import RemovedCommandError - - -class register(orig.register): - """Formerly used to register packages on PyPI.""" - - def run(self): - msg = ( - "The register command has been removed, use twine to upload " - + "instead (https://pypi.org/p/twine)" - ) - - self.announce("ERROR: " + msg, log.ERROR) - - raise RemovedCommandError(msg) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/rotate.py b/venv/lib/python3.8/site-packages/setuptools/command/rotate.py deleted file mode 100644 index b89353f529b3d08e768dea69a9dc8b5e7403003d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/rotate.py +++ /dev/null @@ -1,66 +0,0 @@ -from distutils.util import convert_path -from distutils import log -from distutils.errors import DistutilsOptionError -import os -import shutil - -from setuptools.extern import six - -from setuptools import Command - - -class rotate(Command): - """Delete older distributions""" - - description = "delete older distributions, keeping N newest files" - user_options = [ - ('match=', 'm', "patterns to match (required)"), - ('dist-dir=', 'd', "directory where the distributions are"), - ('keep=', 'k', "number of matching distributions to keep"), - ] - - boolean_options = [] - - def initialize_options(self): - self.match = None - self.dist_dir = None - self.keep = None - - def finalize_options(self): - if self.match is None: - raise DistutilsOptionError( - "Must specify one or more (comma-separated) match patterns " - "(e.g. '.zip' or '.egg')" - ) - if self.keep is None: - raise DistutilsOptionError("Must specify number of files to keep") - try: - self.keep = int(self.keep) - except ValueError: - raise DistutilsOptionError("--keep must be an integer") - if isinstance(self.match, six.string_types): - self.match = [ - convert_path(p.strip()) for p in self.match.split(',') - ] - self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) - - def run(self): - self.run_command("egg_info") - from glob import glob - - for pattern in self.match: - pattern = self.distribution.get_name() + '*' + pattern - files = glob(os.path.join(self.dist_dir, pattern)) - files = [(os.path.getmtime(f), f) for f in files] - files.sort() - files.reverse() - - log.info("%d file(s) matching %s", len(files), pattern) - files = files[self.keep:] - for (t, f) in files: - log.info("Deleting %s", f) - if not self.dry_run: - if os.path.isdir(f): - shutil.rmtree(f) - else: - os.unlink(f) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/saveopts.py b/venv/lib/python3.8/site-packages/setuptools/command/saveopts.py deleted file mode 100644 index 611cec552867a6d50b7edd700c86c7396d906ea2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/saveopts.py +++ /dev/null @@ -1,22 +0,0 @@ -from setuptools.command.setopt import edit_config, option_base - - -class saveopts(option_base): - """Save command-line options to a file""" - - description = "save supplied options to setup.cfg or other config file" - - def run(self): - dist = self.distribution - settings = {} - - for cmd in dist.command_options: - - if cmd == 'saveopts': - continue # don't save our own options! - - for opt, (src, val) in dist.get_option_dict(cmd).items(): - if src == "command line": - settings.setdefault(cmd, {})[opt] = val - - edit_config(self.filename, settings, self.dry_run) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/sdist.py b/venv/lib/python3.8/site-packages/setuptools/command/sdist.py deleted file mode 100644 index a851453f9aa9506d307e1aa7e802fdee9e943eae..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/sdist.py +++ /dev/null @@ -1,252 +0,0 @@ -from distutils import log -import distutils.command.sdist as orig -import os -import sys -import io -import contextlib - -from setuptools.extern import six, ordered_set - -from .py36compat import sdist_add_defaults - -import pkg_resources - -_default_revctrl = list - - -def walk_revctrl(dirname=''): - """Find all files under revision control""" - for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): - for item in ep.load()(dirname): - yield item - - -class sdist(sdist_add_defaults, orig.sdist): - """Smart sdist that finds anything supported by revision control""" - - user_options = [ - ('formats=', None, - "formats for source distribution (comma-separated list)"), - ('keep-temp', 'k', - "keep the distribution tree around after creating " + - "archive file(s)"), - ('dist-dir=', 'd', - "directory to put the source distribution archive(s) in " - "[default: dist]"), - ] - - negative_opt = {} - - README_EXTENSIONS = ['', '.rst', '.txt', '.md'] - READMES = tuple('README{0}'.format(ext) for ext in README_EXTENSIONS) - - def run(self): - self.run_command('egg_info') - ei_cmd = self.get_finalized_command('egg_info') - self.filelist = ei_cmd.filelist - self.filelist.append(os.path.join(ei_cmd.egg_info, 'SOURCES.txt')) - self.check_readme() - - # Run sub commands - for cmd_name in self.get_sub_commands(): - self.run_command(cmd_name) - - self.make_distribution() - - dist_files = getattr(self.distribution, 'dist_files', []) - for file in self.archive_files: - data = ('sdist', '', file) - if data not in dist_files: - dist_files.append(data) - - def initialize_options(self): - orig.sdist.initialize_options(self) - - self._default_to_gztar() - - def _default_to_gztar(self): - # only needed on Python prior to 3.6. - if sys.version_info >= (3, 6, 0, 'beta', 1): - return - self.formats = ['gztar'] - - def make_distribution(self): - """ - Workaround for #516 - """ - with self._remove_os_link(): - orig.sdist.make_distribution(self) - - @staticmethod - @contextlib.contextmanager - def _remove_os_link(): - """ - In a context, remove and restore os.link if it exists - """ - - class NoValue: - pass - - orig_val = getattr(os, 'link', NoValue) - try: - del os.link - except Exception: - pass - try: - yield - finally: - if orig_val is not NoValue: - setattr(os, 'link', orig_val) - - def __read_template_hack(self): - # This grody hack closes the template file (MANIFEST.in) if an - # exception occurs during read_template. - # Doing so prevents an error when easy_install attempts to delete the - # file. - try: - orig.sdist.read_template(self) - except Exception: - _, _, tb = sys.exc_info() - tb.tb_next.tb_frame.f_locals['template'].close() - raise - - # Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle - # has been fixed, so only override the method if we're using an earlier - # Python. - has_leaky_handle = ( - sys.version_info < (2, 7, 2) - or (3, 0) <= sys.version_info < (3, 1, 4) - or (3, 2) <= sys.version_info < (3, 2, 1) - ) - if has_leaky_handle: - read_template = __read_template_hack - - def _add_defaults_optional(self): - if six.PY2: - sdist_add_defaults._add_defaults_optional(self) - else: - super()._add_defaults_optional() - if os.path.isfile('pyproject.toml'): - self.filelist.append('pyproject.toml') - - def _add_defaults_python(self): - """getting python files""" - if self.distribution.has_pure_modules(): - build_py = self.get_finalized_command('build_py') - self.filelist.extend(build_py.get_source_files()) - self._add_data_files(self._safe_data_files(build_py)) - - def _safe_data_files(self, build_py): - """ - Extracting data_files from build_py is known to cause - infinite recursion errors when `include_package_data` - is enabled, so suppress it in that case. - """ - if self.distribution.include_package_data: - return () - return build_py.data_files - - def _add_data_files(self, data_files): - """ - Add data files as found in build_py.data_files. - """ - self.filelist.extend( - os.path.join(src_dir, name) - for _, src_dir, _, filenames in data_files - for name in filenames - ) - - def _add_defaults_data_files(self): - try: - if six.PY2: - sdist_add_defaults._add_defaults_data_files(self) - else: - super()._add_defaults_data_files() - except TypeError: - log.warn("data_files contains unexpected objects") - - def check_readme(self): - for f in self.READMES: - if os.path.exists(f): - return - else: - self.warn( - "standard file not found: should have one of " + - ', '.join(self.READMES) - ) - - def make_release_tree(self, base_dir, files): - orig.sdist.make_release_tree(self, base_dir, files) - - # Save any egg_info command line options used to create this sdist - dest = os.path.join(base_dir, 'setup.cfg') - if hasattr(os, 'link') and os.path.exists(dest): - # unlink and re-copy, since it might be hard-linked, and - # we don't want to change the source version - os.unlink(dest) - self.copy_file('setup.cfg', dest) - - self.get_finalized_command('egg_info').save_version_info(dest) - - def _manifest_is_not_generated(self): - # check for special comment used in 2.7.1 and higher - if not os.path.isfile(self.manifest): - return False - - with io.open(self.manifest, 'rb') as fp: - first_line = fp.readline() - return (first_line != - '# file GENERATED by distutils, do NOT edit\n'.encode()) - - def read_manifest(self): - """Read the manifest file (named by 'self.manifest') and use it to - fill in 'self.filelist', the list of files to include in the source - distribution. - """ - log.info("reading manifest file '%s'", self.manifest) - manifest = open(self.manifest, 'rb') - for line in manifest: - # The manifest must contain UTF-8. See #303. - if six.PY3: - try: - line = line.decode('UTF-8') - except UnicodeDecodeError: - log.warn("%r not UTF-8 decodable -- skipping" % line) - continue - # ignore comments and blank lines - line = line.strip() - if line.startswith('#') or not line: - continue - self.filelist.append(line) - manifest.close() - - def check_license(self): - """Checks if license_file' or 'license_files' is configured and adds any - valid paths to 'self.filelist'. - """ - - files = ordered_set.OrderedSet() - - opts = self.distribution.get_option_dict('metadata') - - # ignore the source of the value - _, license_file = opts.get('license_file', (None, None)) - - if license_file is None: - log.debug("'license_file' option was not specified") - else: - files.add(license_file) - - try: - files.update(self.distribution.metadata.license_files) - except TypeError: - log.warn("warning: 'license_files' option is malformed") - - for f in files: - if not os.path.exists(f): - log.warn( - "warning: Failed to find the configured license file '%s'", - f) - files.remove(f) - - self.filelist.extend(files) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/setopt.py b/venv/lib/python3.8/site-packages/setuptools/command/setopt.py deleted file mode 100644 index 7e57cc02627fc3c3bb49613731a51c72452f96ba..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/setopt.py +++ /dev/null @@ -1,149 +0,0 @@ -from distutils.util import convert_path -from distutils import log -from distutils.errors import DistutilsOptionError -import distutils -import os - -from setuptools.extern.six.moves import configparser - -from setuptools import Command - -__all__ = ['config_file', 'edit_config', 'option_base', 'setopt'] - - -def config_file(kind="local"): - """Get the filename of the distutils, local, global, or per-user config - - `kind` must be one of "local", "global", or "user" - """ - if kind == 'local': - return 'setup.cfg' - if kind == 'global': - return os.path.join( - os.path.dirname(distutils.__file__), 'distutils.cfg' - ) - if kind == 'user': - dot = os.name == 'posix' and '.' or '' - return os.path.expanduser(convert_path("~/%spydistutils.cfg" % dot)) - raise ValueError( - "config_file() type must be 'local', 'global', or 'user'", kind - ) - - -def edit_config(filename, settings, dry_run=False): - """Edit a configuration file to include `settings` - - `settings` is a dictionary of dictionaries or ``None`` values, keyed by - command/section name. A ``None`` value means to delete the entire section, - while a dictionary lists settings to be changed or deleted in that section. - A setting of ``None`` means to delete that setting. - """ - log.debug("Reading configuration from %s", filename) - opts = configparser.RawConfigParser() - opts.read([filename]) - for section, options in settings.items(): - if options is None: - log.info("Deleting section [%s] from %s", section, filename) - opts.remove_section(section) - else: - if not opts.has_section(section): - log.debug("Adding new section [%s] to %s", section, filename) - opts.add_section(section) - for option, value in options.items(): - if value is None: - log.debug( - "Deleting %s.%s from %s", - section, option, filename - ) - opts.remove_option(section, option) - if not opts.options(section): - log.info("Deleting empty [%s] section from %s", - section, filename) - opts.remove_section(section) - else: - log.debug( - "Setting %s.%s to %r in %s", - section, option, value, filename - ) - opts.set(section, option, value) - - log.info("Writing %s", filename) - if not dry_run: - with open(filename, 'w') as f: - opts.write(f) - - -class option_base(Command): - """Abstract base class for commands that mess with config files""" - - user_options = [ - ('global-config', 'g', - "save options to the site-wide distutils.cfg file"), - ('user-config', 'u', - "save options to the current user's pydistutils.cfg file"), - ('filename=', 'f', - "configuration file to use (default=setup.cfg)"), - ] - - boolean_options = [ - 'global-config', 'user-config', - ] - - def initialize_options(self): - self.global_config = None - self.user_config = None - self.filename = None - - def finalize_options(self): - filenames = [] - if self.global_config: - filenames.append(config_file('global')) - if self.user_config: - filenames.append(config_file('user')) - if self.filename is not None: - filenames.append(self.filename) - if not filenames: - filenames.append(config_file('local')) - if len(filenames) > 1: - raise DistutilsOptionError( - "Must specify only one configuration file option", - filenames - ) - self.filename, = filenames - - -class setopt(option_base): - """Save command-line options to a file""" - - description = "set an option in setup.cfg or another config file" - - user_options = [ - ('command=', 'c', 'command to set an option for'), - ('option=', 'o', 'option to set'), - ('set-value=', 's', 'value of the option'), - ('remove', 'r', 'remove (unset) the value'), - ] + option_base.user_options - - boolean_options = option_base.boolean_options + ['remove'] - - def initialize_options(self): - option_base.initialize_options(self) - self.command = None - self.option = None - self.set_value = None - self.remove = None - - def finalize_options(self): - option_base.finalize_options(self) - if self.command is None or self.option is None: - raise DistutilsOptionError("Must specify --command *and* --option") - if self.set_value is None and not self.remove: - raise DistutilsOptionError("Must specify --set-value or --remove") - - def run(self): - edit_config( - self.filename, { - self.command: {self.option.replace('-', '_'): self.set_value} - }, - self.dry_run - ) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/test.py b/venv/lib/python3.8/site-packages/setuptools/command/test.py deleted file mode 100644 index c148b38d10c7691c2045520e5aedb60293dd714d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/test.py +++ /dev/null @@ -1,279 +0,0 @@ -import os -import operator -import sys -import contextlib -import itertools -import unittest -from distutils.errors import DistutilsError, DistutilsOptionError -from distutils import log -from unittest import TestLoader - -from setuptools.extern import six -from setuptools.extern.six.moves import map, filter - -from pkg_resources import (resource_listdir, resource_exists, normalize_path, - working_set, _namespace_packages, evaluate_marker, - add_activation_listener, require, EntryPoint) -from setuptools import Command -from .build_py import _unique_everseen - -__metaclass__ = type - - -class ScanningLoader(TestLoader): - - def __init__(self): - TestLoader.__init__(self) - self._visited = set() - - def loadTestsFromModule(self, module, pattern=None): - """Return a suite of all tests cases contained in the given module - - If the module is a package, load tests from all the modules in it. - If the module has an ``additional_tests`` function, call it and add - the return value to the tests. - """ - if module in self._visited: - return None - self._visited.add(module) - - tests = [] - tests.append(TestLoader.loadTestsFromModule(self, module)) - - if hasattr(module, "additional_tests"): - tests.append(module.additional_tests()) - - if hasattr(module, '__path__'): - for file in resource_listdir(module.__name__, ''): - if file.endswith('.py') and file != '__init__.py': - submodule = module.__name__ + '.' + file[:-3] - else: - if resource_exists(module.__name__, file + '/__init__.py'): - submodule = module.__name__ + '.' + file - else: - continue - tests.append(self.loadTestsFromName(submodule)) - - if len(tests) != 1: - return self.suiteClass(tests) - else: - return tests[0] # don't create a nested suite for only one return - - -# adapted from jaraco.classes.properties:NonDataProperty -class NonDataProperty: - def __init__(self, fget): - self.fget = fget - - def __get__(self, obj, objtype=None): - if obj is None: - return self - return self.fget(obj) - - -class test(Command): - """Command to run unit tests after in-place build""" - - description = "run unit tests after in-place build (deprecated)" - - user_options = [ - ('test-module=', 'm', "Run 'test_suite' in specified module"), - ('test-suite=', 's', - "Run single test, case or suite (e.g. 'module.test_suite')"), - ('test-runner=', 'r', "Test runner to use"), - ] - - def initialize_options(self): - self.test_suite = None - self.test_module = None - self.test_loader = None - self.test_runner = None - - def finalize_options(self): - - if self.test_suite and self.test_module: - msg = "You may specify a module or a suite, but not both" - raise DistutilsOptionError(msg) - - if self.test_suite is None: - if self.test_module is None: - self.test_suite = self.distribution.test_suite - else: - self.test_suite = self.test_module + ".test_suite" - - if self.test_loader is None: - self.test_loader = getattr(self.distribution, 'test_loader', None) - if self.test_loader is None: - self.test_loader = "setuptools.command.test:ScanningLoader" - if self.test_runner is None: - self.test_runner = getattr(self.distribution, 'test_runner', None) - - @NonDataProperty - def test_args(self): - return list(self._test_args()) - - def _test_args(self): - if not self.test_suite and sys.version_info >= (2, 7): - yield 'discover' - if self.verbose: - yield '--verbose' - if self.test_suite: - yield self.test_suite - - def with_project_on_sys_path(self, func): - """ - Backward compatibility for project_on_sys_path context. - """ - with self.project_on_sys_path(): - func() - - @contextlib.contextmanager - def project_on_sys_path(self, include_dists=[]): - with_2to3 = six.PY3 and getattr(self.distribution, 'use_2to3', False) - - if with_2to3: - # If we run 2to3 we can not do this inplace: - - # Ensure metadata is up-to-date - self.reinitialize_command('build_py', inplace=0) - self.run_command('build_py') - bpy_cmd = self.get_finalized_command("build_py") - build_path = normalize_path(bpy_cmd.build_lib) - - # Build extensions - self.reinitialize_command('egg_info', egg_base=build_path) - self.run_command('egg_info') - - self.reinitialize_command('build_ext', inplace=0) - self.run_command('build_ext') - else: - # Without 2to3 inplace works fine: - self.run_command('egg_info') - - # Build extensions in-place - self.reinitialize_command('build_ext', inplace=1) - self.run_command('build_ext') - - ei_cmd = self.get_finalized_command("egg_info") - - old_path = sys.path[:] - old_modules = sys.modules.copy() - - try: - project_path = normalize_path(ei_cmd.egg_base) - sys.path.insert(0, project_path) - working_set.__init__() - add_activation_listener(lambda dist: dist.activate()) - require('%s==%s' % (ei_cmd.egg_name, ei_cmd.egg_version)) - with self.paths_on_pythonpath([project_path]): - yield - finally: - sys.path[:] = old_path - sys.modules.clear() - sys.modules.update(old_modules) - working_set.__init__() - - @staticmethod - @contextlib.contextmanager - def paths_on_pythonpath(paths): - """ - Add the indicated paths to the head of the PYTHONPATH environment - variable so that subprocesses will also see the packages at - these paths. - - Do this in a context that restores the value on exit. - """ - nothing = object() - orig_pythonpath = os.environ.get('PYTHONPATH', nothing) - current_pythonpath = os.environ.get('PYTHONPATH', '') - try: - prefix = os.pathsep.join(_unique_everseen(paths)) - to_join = filter(None, [prefix, current_pythonpath]) - new_path = os.pathsep.join(to_join) - if new_path: - os.environ['PYTHONPATH'] = new_path - yield - finally: - if orig_pythonpath is nothing: - os.environ.pop('PYTHONPATH', None) - else: - os.environ['PYTHONPATH'] = orig_pythonpath - - @staticmethod - def install_dists(dist): - """ - Install the requirements indicated by self.distribution and - return an iterable of the dists that were built. - """ - ir_d = dist.fetch_build_eggs(dist.install_requires) - tr_d = dist.fetch_build_eggs(dist.tests_require or []) - er_d = dist.fetch_build_eggs( - v for k, v in dist.extras_require.items() - if k.startswith(':') and evaluate_marker(k[1:]) - ) - return itertools.chain(ir_d, tr_d, er_d) - - def run(self): - self.announce( - "WARNING: Testing via this command is deprecated and will be " - "removed in a future version. Users looking for a generic test " - "entry point independent of test runner are encouraged to use " - "tox.", - log.WARN, - ) - - installed_dists = self.install_dists(self.distribution) - - cmd = ' '.join(self._argv) - if self.dry_run: - self.announce('skipping "%s" (dry run)' % cmd) - return - - self.announce('running "%s"' % cmd) - - paths = map(operator.attrgetter('location'), installed_dists) - with self.paths_on_pythonpath(paths): - with self.project_on_sys_path(): - self.run_tests() - - def run_tests(self): - # Purge modules under test from sys.modules. The test loader will - # re-import them from the build location. Required when 2to3 is used - # with namespace packages. - if six.PY3 and getattr(self.distribution, 'use_2to3', False): - module = self.test_suite.split('.')[0] - if module in _namespace_packages: - del_modules = [] - if module in sys.modules: - del_modules.append(module) - module += '.' - for name in sys.modules: - if name.startswith(module): - del_modules.append(name) - list(map(sys.modules.__delitem__, del_modules)) - - test = unittest.main( - None, None, self._argv, - testLoader=self._resolve_as_ep(self.test_loader), - testRunner=self._resolve_as_ep(self.test_runner), - exit=False, - ) - if not test.result.wasSuccessful(): - msg = 'Test failed: %s' % test.result - self.announce(msg, log.ERROR) - raise DistutilsError(msg) - - @property - def _argv(self): - return ['unittest'] + self.test_args - - @staticmethod - def _resolve_as_ep(val): - """ - Load the indicated attribute value, called, as a as if it were - specified as an entry point. - """ - if val is None: - return - parsed = EntryPoint.parse("x=" + val) - return parsed.resolve()() diff --git a/venv/lib/python3.8/site-packages/setuptools/command/upload.py b/venv/lib/python3.8/site-packages/setuptools/command/upload.py deleted file mode 100644 index ec7f81e22772511d668e5ab92f625db33259e803..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/upload.py +++ /dev/null @@ -1,17 +0,0 @@ -from distutils import log -from distutils.command import upload as orig - -from setuptools.errors import RemovedCommandError - - -class upload(orig.upload): - """Formerly used to upload packages to PyPI.""" - - def run(self): - msg = ( - "The upload command has been removed, use twine to upload " - + "instead (https://pypi.org/p/twine)" - ) - - self.announce("ERROR: " + msg, log.ERROR) - raise RemovedCommandError(msg) diff --git a/venv/lib/python3.8/site-packages/setuptools/command/upload_docs.py b/venv/lib/python3.8/site-packages/setuptools/command/upload_docs.py deleted file mode 100644 index 07aa564af451ce41d818d72f8ee93cb46887cecf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/command/upload_docs.py +++ /dev/null @@ -1,206 +0,0 @@ -# -*- coding: utf-8 -*- -"""upload_docs - -Implements a Distutils 'upload_docs' subcommand (upload documentation to -PyPI's pythonhosted.org). -""" - -from base64 import standard_b64encode -from distutils import log -from distutils.errors import DistutilsOptionError -import os -import socket -import zipfile -import tempfile -import shutil -import itertools -import functools - -from setuptools.extern import six -from setuptools.extern.six.moves import http_client, urllib - -from pkg_resources import iter_entry_points -from .upload import upload - - -def _encode(s): - errors = 'surrogateescape' if six.PY3 else 'strict' - return s.encode('utf-8', errors) - - -class upload_docs(upload): - # override the default repository as upload_docs isn't - # supported by Warehouse (and won't be). - DEFAULT_REPOSITORY = 'https://pypi.python.org/pypi/' - - description = 'Upload documentation to PyPI' - - user_options = [ - ('repository=', 'r', - "url of repository [default: %s]" % upload.DEFAULT_REPOSITORY), - ('show-response', None, - 'display full response text from server'), - ('upload-dir=', None, 'directory to upload'), - ] - boolean_options = upload.boolean_options - - def has_sphinx(self): - if self.upload_dir is None: - for ep in iter_entry_points('distutils.commands', 'build_sphinx'): - return True - - sub_commands = [('build_sphinx', has_sphinx)] - - def initialize_options(self): - upload.initialize_options(self) - self.upload_dir = None - self.target_dir = None - - def finalize_options(self): - upload.finalize_options(self) - if self.upload_dir is None: - if self.has_sphinx(): - build_sphinx = self.get_finalized_command('build_sphinx') - self.target_dir = build_sphinx.builder_target_dir - else: - build = self.get_finalized_command('build') - self.target_dir = os.path.join(build.build_base, 'docs') - else: - self.ensure_dirname('upload_dir') - self.target_dir = self.upload_dir - if 'pypi.python.org' in self.repository: - log.warn("Upload_docs command is deprecated. Use RTD instead.") - self.announce('Using upload directory %s' % self.target_dir) - - def create_zipfile(self, filename): - zip_file = zipfile.ZipFile(filename, "w") - try: - self.mkpath(self.target_dir) # just in case - for root, dirs, files in os.walk(self.target_dir): - if root == self.target_dir and not files: - tmpl = "no files found in upload directory '%s'" - raise DistutilsOptionError(tmpl % self.target_dir) - for name in files: - full = os.path.join(root, name) - relative = root[len(self.target_dir):].lstrip(os.path.sep) - dest = os.path.join(relative, name) - zip_file.write(full, dest) - finally: - zip_file.close() - - def run(self): - # Run sub commands - for cmd_name in self.get_sub_commands(): - self.run_command(cmd_name) - - tmp_dir = tempfile.mkdtemp() - name = self.distribution.metadata.get_name() - zip_file = os.path.join(tmp_dir, "%s.zip" % name) - try: - self.create_zipfile(zip_file) - self.upload_file(zip_file) - finally: - shutil.rmtree(tmp_dir) - - @staticmethod - def _build_part(item, sep_boundary): - key, values = item - title = '\nContent-Disposition: form-data; name="%s"' % key - # handle multiple entries for the same name - if not isinstance(values, list): - values = [values] - for value in values: - if isinstance(value, tuple): - title += '; filename="%s"' % value[0] - value = value[1] - else: - value = _encode(value) - yield sep_boundary - yield _encode(title) - yield b"\n\n" - yield value - if value and value[-1:] == b'\r': - yield b'\n' # write an extra newline (lurve Macs) - - @classmethod - def _build_multipart(cls, data): - """ - Build up the MIME payload for the POST data - """ - boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - sep_boundary = b'\n--' + boundary - end_boundary = sep_boundary + b'--' - end_items = end_boundary, b"\n", - builder = functools.partial( - cls._build_part, - sep_boundary=sep_boundary, - ) - part_groups = map(builder, data.items()) - parts = itertools.chain.from_iterable(part_groups) - body_items = itertools.chain(parts, end_items) - content_type = 'multipart/form-data; boundary=%s' % boundary.decode('ascii') - return b''.join(body_items), content_type - - def upload_file(self, filename): - with open(filename, 'rb') as f: - content = f.read() - meta = self.distribution.metadata - data = { - ':action': 'doc_upload', - 'name': meta.get_name(), - 'content': (os.path.basename(filename), content), - } - # set up the authentication - credentials = _encode(self.username + ':' + self.password) - credentials = standard_b64encode(credentials) - if six.PY3: - credentials = credentials.decode('ascii') - auth = "Basic " + credentials - - body, ct = self._build_multipart(data) - - msg = "Submitting documentation to %s" % (self.repository) - self.announce(msg, log.INFO) - - # build the Request - # We can't use urllib2 since we need to send the Basic - # auth right with the first request - schema, netloc, url, params, query, fragments = \ - urllib.parse.urlparse(self.repository) - assert not params and not query and not fragments - if schema == 'http': - conn = http_client.HTTPConnection(netloc) - elif schema == 'https': - conn = http_client.HTTPSConnection(netloc) - else: - raise AssertionError("unsupported schema " + schema) - - data = '' - try: - conn.connect() - conn.putrequest("POST", url) - content_type = ct - conn.putheader('Content-type', content_type) - conn.putheader('Content-length', str(len(body))) - conn.putheader('Authorization', auth) - conn.endheaders() - conn.send(body) - except socket.error as e: - self.announce(str(e), log.ERROR) - return - - r = conn.getresponse() - if r.status == 200: - msg = 'Server response (%s): %s' % (r.status, r.reason) - self.announce(msg, log.INFO) - elif r.status == 301: - location = r.getheader('Location') - if location is None: - location = 'https://pythonhosted.org/%s/' % meta.get_name() - msg = 'Upload successful. Visit %s' % location - self.announce(msg, log.INFO) - else: - msg = 'Upload failed (%s): %s' % (r.status, r.reason) - self.announce(msg, log.ERROR) - if self.show_response: - print('-' * 75, r.read(), '-' * 75) diff --git a/venv/lib/python3.8/site-packages/setuptools/config.py b/venv/lib/python3.8/site-packages/setuptools/config.py deleted file mode 100644 index 9b9a0c45e756b44ddea7660228934d0a37fcd97c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/config.py +++ /dev/null @@ -1,659 +0,0 @@ -from __future__ import absolute_import, unicode_literals -import io -import os -import sys - -import warnings -import functools -from collections import defaultdict -from functools import partial -from functools import wraps -from importlib import import_module - -from distutils.errors import DistutilsOptionError, DistutilsFileError -from setuptools.extern.packaging.version import LegacyVersion, parse -from setuptools.extern.packaging.specifiers import SpecifierSet -from setuptools.extern.six import string_types, PY3 - - -__metaclass__ = type - - -def read_configuration( - filepath, find_others=False, ignore_option_errors=False): - """Read given configuration file and returns options from it as a dict. - - :param str|unicode filepath: Path to configuration file - to get options from. - - :param bool find_others: Whether to search for other configuration files - which could be on in various places. - - :param bool ignore_option_errors: Whether to silently ignore - options, values of which could not be resolved (e.g. due to exceptions - in directives such as file:, attr:, etc.). - If False exceptions are propagated as expected. - - :rtype: dict - """ - from setuptools.dist import Distribution, _Distribution - - filepath = os.path.abspath(filepath) - - if not os.path.isfile(filepath): - raise DistutilsFileError( - 'Configuration file %s does not exist.' % filepath) - - current_directory = os.getcwd() - os.chdir(os.path.dirname(filepath)) - - try: - dist = Distribution() - - filenames = dist.find_config_files() if find_others else [] - if filepath not in filenames: - filenames.append(filepath) - - _Distribution.parse_config_files(dist, filenames=filenames) - - handlers = parse_configuration( - dist, dist.command_options, - ignore_option_errors=ignore_option_errors) - - finally: - os.chdir(current_directory) - - return configuration_to_dict(handlers) - - -def _get_option(target_obj, key): - """ - Given a target object and option key, get that option from - the target object, either through a get_{key} method or - from an attribute directly. - """ - getter_name = 'get_{key}'.format(**locals()) - by_attribute = functools.partial(getattr, target_obj, key) - getter = getattr(target_obj, getter_name, by_attribute) - return getter() - - -def configuration_to_dict(handlers): - """Returns configuration data gathered by given handlers as a dict. - - :param list[ConfigHandler] handlers: Handlers list, - usually from parse_configuration() - - :rtype: dict - """ - config_dict = defaultdict(dict) - - for handler in handlers: - for option in handler.set_options: - value = _get_option(handler.target_obj, option) - config_dict[handler.section_prefix][option] = value - - return config_dict - - -def parse_configuration( - distribution, command_options, ignore_option_errors=False): - """Performs additional parsing of configuration options - for a distribution. - - Returns a list of used option handlers. - - :param Distribution distribution: - :param dict command_options: - :param bool ignore_option_errors: Whether to silently ignore - options, values of which could not be resolved (e.g. due to exceptions - in directives such as file:, attr:, etc.). - If False exceptions are propagated as expected. - :rtype: list - """ - options = ConfigOptionsHandler( - distribution, command_options, ignore_option_errors) - options.parse() - - meta = ConfigMetadataHandler( - distribution.metadata, command_options, ignore_option_errors, - distribution.package_dir) - meta.parse() - - return meta, options - - -class ConfigHandler: - """Handles metadata supplied in configuration files.""" - - section_prefix = None - """Prefix for config sections handled by this handler. - Must be provided by class heirs. - - """ - - aliases = {} - """Options aliases. - For compatibility with various packages. E.g.: d2to1 and pbr. - Note: `-` in keys is replaced with `_` by config parser. - - """ - - def __init__(self, target_obj, options, ignore_option_errors=False): - sections = {} - - section_prefix = self.section_prefix - for section_name, section_options in options.items(): - if not section_name.startswith(section_prefix): - continue - - section_name = section_name.replace(section_prefix, '').strip('.') - sections[section_name] = section_options - - self.ignore_option_errors = ignore_option_errors - self.target_obj = target_obj - self.sections = sections - self.set_options = [] - - @property - def parsers(self): - """Metadata item name to parser function mapping.""" - raise NotImplementedError( - '%s must provide .parsers property' % self.__class__.__name__) - - def __setitem__(self, option_name, value): - unknown = tuple() - target_obj = self.target_obj - - # Translate alias into real name. - option_name = self.aliases.get(option_name, option_name) - - current_value = getattr(target_obj, option_name, unknown) - - if current_value is unknown: - raise KeyError(option_name) - - if current_value: - # Already inhabited. Skipping. - return - - skip_option = False - parser = self.parsers.get(option_name) - if parser: - try: - value = parser(value) - - except Exception: - skip_option = True - if not self.ignore_option_errors: - raise - - if skip_option: - return - - setter = getattr(target_obj, 'set_%s' % option_name, None) - if setter is None: - setattr(target_obj, option_name, value) - else: - setter(value) - - self.set_options.append(option_name) - - @classmethod - def _parse_list(cls, value, separator=','): - """Represents value as a list. - - Value is split either by separator (defaults to comma) or by lines. - - :param value: - :param separator: List items separator character. - :rtype: list - """ - if isinstance(value, list): # _get_parser_compound case - return value - - if '\n' in value: - value = value.splitlines() - else: - value = value.split(separator) - - return [chunk.strip() for chunk in value if chunk.strip()] - - @classmethod - def _parse_dict(cls, value): - """Represents value as a dict. - - :param value: - :rtype: dict - """ - separator = '=' - result = {} - for line in cls._parse_list(value): - key, sep, val = line.partition(separator) - if sep != separator: - raise DistutilsOptionError( - 'Unable to parse option value to dict: %s' % value) - result[key.strip()] = val.strip() - - return result - - @classmethod - def _parse_bool(cls, value): - """Represents value as boolean. - - :param value: - :rtype: bool - """ - value = value.lower() - return value in ('1', 'true', 'yes') - - @classmethod - def _exclude_files_parser(cls, key): - """Returns a parser function to make sure field inputs - are not files. - - Parses a value after getting the key so error messages are - more informative. - - :param key: - :rtype: callable - """ - def parser(value): - exclude_directive = 'file:' - if value.startswith(exclude_directive): - raise ValueError( - 'Only strings are accepted for the {0} field, ' - 'files are not accepted'.format(key)) - return value - return parser - - @classmethod - def _parse_file(cls, value): - """Represents value as a string, allowing including text - from nearest files using `file:` directive. - - Directive is sandboxed and won't reach anything outside - directory with setup.py. - - Examples: - file: README.rst, CHANGELOG.md, src/file.txt - - :param str value: - :rtype: str - """ - include_directive = 'file:' - - if not isinstance(value, string_types): - return value - - if not value.startswith(include_directive): - return value - - spec = value[len(include_directive):] - filepaths = (os.path.abspath(path.strip()) for path in spec.split(',')) - return '\n'.join( - cls._read_file(path) - for path in filepaths - if (cls._assert_local(path) or True) - and os.path.isfile(path) - ) - - @staticmethod - def _assert_local(filepath): - if not filepath.startswith(os.getcwd()): - raise DistutilsOptionError( - '`file:` directive can not access %s' % filepath) - - @staticmethod - def _read_file(filepath): - with io.open(filepath, encoding='utf-8') as f: - return f.read() - - @classmethod - def _parse_attr(cls, value, package_dir=None): - """Represents value as a module attribute. - - Examples: - attr: package.attr - attr: package.module.attr - - :param str value: - :rtype: str - """ - attr_directive = 'attr:' - if not value.startswith(attr_directive): - return value - - attrs_path = value.replace(attr_directive, '').strip().split('.') - attr_name = attrs_path.pop() - - module_name = '.'.join(attrs_path) - module_name = module_name or '__init__' - - parent_path = os.getcwd() - if package_dir: - if attrs_path[0] in package_dir: - # A custom path was specified for the module we want to import - custom_path = package_dir[attrs_path[0]] - parts = custom_path.rsplit('/', 1) - if len(parts) > 1: - parent_path = os.path.join(os.getcwd(), parts[0]) - module_name = parts[1] - else: - module_name = custom_path - elif '' in package_dir: - # A custom parent directory was specified for all root modules - parent_path = os.path.join(os.getcwd(), package_dir['']) - sys.path.insert(0, parent_path) - try: - module = import_module(module_name) - value = getattr(module, attr_name) - - finally: - sys.path = sys.path[1:] - - return value - - @classmethod - def _get_parser_compound(cls, *parse_methods): - """Returns parser function to represents value as a list. - - Parses a value applying given methods one after another. - - :param parse_methods: - :rtype: callable - """ - def parse(value): - parsed = value - - for method in parse_methods: - parsed = method(parsed) - - return parsed - - return parse - - @classmethod - def _parse_section_to_dict(cls, section_options, values_parser=None): - """Parses section options into a dictionary. - - Optionally applies a given parser to values. - - :param dict section_options: - :param callable values_parser: - :rtype: dict - """ - value = {} - values_parser = values_parser or (lambda val: val) - for key, (_, val) in section_options.items(): - value[key] = values_parser(val) - return value - - def parse_section(self, section_options): - """Parses configuration file section. - - :param dict section_options: - """ - for (name, (_, value)) in section_options.items(): - try: - self[name] = value - - except KeyError: - pass # Keep silent for a new option may appear anytime. - - def parse(self): - """Parses configuration file items from one - or more related sections. - - """ - for section_name, section_options in self.sections.items(): - - method_postfix = '' - if section_name: # [section.option] variant - method_postfix = '_%s' % section_name - - section_parser_method = getattr( - self, - # Dots in section names are translated into dunderscores. - ('parse_section%s' % method_postfix).replace('.', '__'), - None) - - if section_parser_method is None: - raise DistutilsOptionError( - 'Unsupported distribution option section: [%s.%s]' % ( - self.section_prefix, section_name)) - - section_parser_method(section_options) - - def _deprecated_config_handler(self, func, msg, warning_class): - """ this function will wrap around parameters that are deprecated - - :param msg: deprecation message - :param warning_class: class of warning exception to be raised - :param func: function to be wrapped around - """ - @wraps(func) - def config_handler(*args, **kwargs): - warnings.warn(msg, warning_class) - return func(*args, **kwargs) - - return config_handler - - -class ConfigMetadataHandler(ConfigHandler): - - section_prefix = 'metadata' - - aliases = { - 'home_page': 'url', - 'summary': 'description', - 'classifier': 'classifiers', - 'platform': 'platforms', - } - - strict_mode = False - """We need to keep it loose, to be partially compatible with - `pbr` and `d2to1` packages which also uses `metadata` section. - - """ - - def __init__(self, target_obj, options, ignore_option_errors=False, - package_dir=None): - super(ConfigMetadataHandler, self).__init__(target_obj, options, - ignore_option_errors) - self.package_dir = package_dir - - @property - def parsers(self): - """Metadata item name to parser function mapping.""" - parse_list = self._parse_list - parse_file = self._parse_file - parse_dict = self._parse_dict - exclude_files_parser = self._exclude_files_parser - - return { - 'platforms': parse_list, - 'keywords': parse_list, - 'provides': parse_list, - 'requires': self._deprecated_config_handler( - parse_list, - "The requires parameter is deprecated, please use " - "install_requires for runtime dependencies.", - DeprecationWarning), - 'obsoletes': parse_list, - 'classifiers': self._get_parser_compound(parse_file, parse_list), - 'license': exclude_files_parser('license'), - 'license_files': parse_list, - 'description': parse_file, - 'long_description': parse_file, - 'version': self._parse_version, - 'project_urls': parse_dict, - } - - def _parse_version(self, value): - """Parses `version` option value. - - :param value: - :rtype: str - - """ - version = self._parse_file(value) - - if version != value: - version = version.strip() - # Be strict about versions loaded from file because it's easy to - # accidentally include newlines and other unintended content - if isinstance(parse(version), LegacyVersion): - tmpl = ( - 'Version loaded from {value} does not ' - 'comply with PEP 440: {version}' - ) - raise DistutilsOptionError(tmpl.format(**locals())) - - return version - - version = self._parse_attr(value, self.package_dir) - - if callable(version): - version = version() - - if not isinstance(version, string_types): - if hasattr(version, '__iter__'): - version = '.'.join(map(str, version)) - else: - version = '%s' % version - - return version - - -class ConfigOptionsHandler(ConfigHandler): - - section_prefix = 'options' - - @property - def parsers(self): - """Metadata item name to parser function mapping.""" - parse_list = self._parse_list - parse_list_semicolon = partial(self._parse_list, separator=';') - parse_bool = self._parse_bool - parse_dict = self._parse_dict - - return { - 'zip_safe': parse_bool, - 'use_2to3': parse_bool, - 'include_package_data': parse_bool, - 'package_dir': parse_dict, - 'use_2to3_fixers': parse_list, - 'use_2to3_exclude_fixers': parse_list, - 'convert_2to3_doctests': parse_list, - 'scripts': parse_list, - 'eager_resources': parse_list, - 'dependency_links': parse_list, - 'namespace_packages': parse_list, - 'install_requires': parse_list_semicolon, - 'setup_requires': parse_list_semicolon, - 'tests_require': parse_list_semicolon, - 'packages': self._parse_packages, - 'entry_points': self._parse_file, - 'py_modules': parse_list, - 'python_requires': SpecifierSet, - } - - def _parse_packages(self, value): - """Parses `packages` option value. - - :param value: - :rtype: list - """ - find_directives = ['find:', 'find_namespace:'] - trimmed_value = value.strip() - - if trimmed_value not in find_directives: - return self._parse_list(value) - - findns = trimmed_value == find_directives[1] - if findns and not PY3: - raise DistutilsOptionError( - 'find_namespace: directive is unsupported on Python < 3.3') - - # Read function arguments from a dedicated section. - find_kwargs = self.parse_section_packages__find( - self.sections.get('packages.find', {})) - - if findns: - from setuptools import find_namespace_packages as find_packages - else: - from setuptools import find_packages - - return find_packages(**find_kwargs) - - def parse_section_packages__find(self, section_options): - """Parses `packages.find` configuration file section. - - To be used in conjunction with _parse_packages(). - - :param dict section_options: - """ - section_data = self._parse_section_to_dict( - section_options, self._parse_list) - - valid_keys = ['where', 'include', 'exclude'] - - find_kwargs = dict( - [(k, v) for k, v in section_data.items() if k in valid_keys and v]) - - where = find_kwargs.get('where') - if where is not None: - find_kwargs['where'] = where[0] # cast list to single val - - return find_kwargs - - def parse_section_entry_points(self, section_options): - """Parses `entry_points` configuration file section. - - :param dict section_options: - """ - parsed = self._parse_section_to_dict(section_options, self._parse_list) - self['entry_points'] = parsed - - def _parse_package_data(self, section_options): - parsed = self._parse_section_to_dict(section_options, self._parse_list) - - root = parsed.get('*') - if root: - parsed[''] = root - del parsed['*'] - - return parsed - - def parse_section_package_data(self, section_options): - """Parses `package_data` configuration file section. - - :param dict section_options: - """ - self['package_data'] = self._parse_package_data(section_options) - - def parse_section_exclude_package_data(self, section_options): - """Parses `exclude_package_data` configuration file section. - - :param dict section_options: - """ - self['exclude_package_data'] = self._parse_package_data( - section_options) - - def parse_section_extras_require(self, section_options): - """Parses `extras_require` configuration file section. - - :param dict section_options: - """ - parse_list = partial(self._parse_list, separator=';') - self['extras_require'] = self._parse_section_to_dict( - section_options, parse_list) - - def parse_section_data_files(self, section_options): - """Parses `data_files` configuration file section. - - :param dict section_options: - """ - parsed = self._parse_section_to_dict(section_options, self._parse_list) - self['data_files'] = [(k, v) for k, v in parsed.items()] diff --git a/venv/lib/python3.8/site-packages/setuptools/dep_util.py b/venv/lib/python3.8/site-packages/setuptools/dep_util.py deleted file mode 100644 index 2931c13ec35aa60b742ac4c46ceabd4ed32a5511..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/dep_util.py +++ /dev/null @@ -1,23 +0,0 @@ -from distutils.dep_util import newer_group - -# yes, this is was almost entirely copy-pasted from -# 'newer_pairwise()', this is just another convenience -# function. -def newer_pairwise_group(sources_groups, targets): - """Walk both arguments in parallel, testing if each source group is newer - than its corresponding target. Returns a pair of lists (sources_groups, - targets) where sources is newer than target, according to the semantics - of 'newer_group()'. - """ - if len(sources_groups) != len(targets): - raise ValueError("'sources_group' and 'targets' must be the same length") - - # build a pair of lists (sources_groups, targets) where source is newer - n_sources = [] - n_targets = [] - for i in range(len(sources_groups)): - if newer_group(sources_groups[i], targets[i]): - n_sources.append(sources_groups[i]) - n_targets.append(targets[i]) - - return n_sources, n_targets diff --git a/venv/lib/python3.8/site-packages/setuptools/depends.py b/venv/lib/python3.8/site-packages/setuptools/depends.py deleted file mode 100644 index a37675cbd9bc9583fd01cc158198e2f4deda321b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/depends.py +++ /dev/null @@ -1,176 +0,0 @@ -import sys -import marshal -import contextlib -from distutils.version import StrictVersion - -from .py33compat import Bytecode - -from .py27compat import find_module, PY_COMPILED, PY_FROZEN, PY_SOURCE -from . import py27compat - - -__all__ = [ - 'Require', 'find_module', 'get_module_constant', 'extract_constant' -] - - -class Require: - """A prerequisite to building or installing a distribution""" - - def __init__( - self, name, requested_version, module, homepage='', - attribute=None, format=None): - - if format is None and requested_version is not None: - format = StrictVersion - - if format is not None: - requested_version = format(requested_version) - if attribute is None: - attribute = '__version__' - - self.__dict__.update(locals()) - del self.self - - def full_name(self): - """Return full package/distribution name, w/version""" - if self.requested_version is not None: - return '%s-%s' % (self.name, self.requested_version) - return self.name - - def version_ok(self, version): - """Is 'version' sufficiently up-to-date?""" - return self.attribute is None or self.format is None or \ - str(version) != "unknown" and version >= self.requested_version - - def get_version(self, paths=None, default="unknown"): - """Get version number of installed module, 'None', or 'default' - - Search 'paths' for module. If not found, return 'None'. If found, - return the extracted version attribute, or 'default' if no version - attribute was specified, or the value cannot be determined without - importing the module. The version is formatted according to the - requirement's version format (if any), unless it is 'None' or the - supplied 'default'. - """ - - if self.attribute is None: - try: - f, p, i = find_module(self.module, paths) - if f: - f.close() - return default - except ImportError: - return None - - v = get_module_constant(self.module, self.attribute, default, paths) - - if v is not None and v is not default and self.format is not None: - return self.format(v) - - return v - - def is_present(self, paths=None): - """Return true if dependency is present on 'paths'""" - return self.get_version(paths) is not None - - def is_current(self, paths=None): - """Return true if dependency is present and up-to-date on 'paths'""" - version = self.get_version(paths) - if version is None: - return False - return self.version_ok(version) - - -def maybe_close(f): - @contextlib.contextmanager - def empty(): - yield - return - if not f: - return empty() - - return contextlib.closing(f) - - -def get_module_constant(module, symbol, default=-1, paths=None): - """Find 'module' by searching 'paths', and extract 'symbol' - - Return 'None' if 'module' does not exist on 'paths', or it does not define - 'symbol'. If the module defines 'symbol' as a constant, return the - constant. Otherwise, return 'default'.""" - - try: - f, path, (suffix, mode, kind) = info = find_module(module, paths) - except ImportError: - # Module doesn't exist - return None - - with maybe_close(f): - if kind == PY_COMPILED: - f.read(8) # skip magic & date - code = marshal.load(f) - elif kind == PY_FROZEN: - code = py27compat.get_frozen_object(module, paths) - elif kind == PY_SOURCE: - code = compile(f.read(), path, 'exec') - else: - # Not something we can parse; we'll have to import it. :( - imported = py27compat.get_module(module, paths, info) - return getattr(imported, symbol, None) - - return extract_constant(code, symbol, default) - - -def extract_constant(code, symbol, default=-1): - """Extract the constant value of 'symbol' from 'code' - - If the name 'symbol' is bound to a constant value by the Python code - object 'code', return that value. If 'symbol' is bound to an expression, - return 'default'. Otherwise, return 'None'. - - Return value is based on the first assignment to 'symbol'. 'symbol' must - be a global, or at least a non-"fast" local in the code block. That is, - only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' - must be present in 'code.co_names'. - """ - if symbol not in code.co_names: - # name's not there, can't possibly be an assignment - return None - - name_idx = list(code.co_names).index(symbol) - - STORE_NAME = 90 - STORE_GLOBAL = 97 - LOAD_CONST = 100 - - const = default - - for byte_code in Bytecode(code): - op = byte_code.opcode - arg = byte_code.arg - - if op == LOAD_CONST: - const = code.co_consts[arg] - elif arg == name_idx and (op == STORE_NAME or op == STORE_GLOBAL): - return const - else: - const = default - - -def _update_globals(): - """ - Patch the globals to remove the objects not available on some platforms. - - XXX it'd be better to test assertions about bytecode instead. - """ - - if not sys.platform.startswith('java') and sys.platform != 'cli': - return - incompatible = 'extract_constant', 'get_module_constant' - for name in incompatible: - del globals()[name] - __all__.remove(name) - - -_update_globals() diff --git a/venv/lib/python3.8/site-packages/setuptools/dist.py b/venv/lib/python3.8/site-packages/setuptools/dist.py deleted file mode 100644 index f22429e8e191683da2cc83c7cc5eba205a541988..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/dist.py +++ /dev/null @@ -1,1274 +0,0 @@ -# -*- coding: utf-8 -*- -__all__ = ['Distribution'] - -import io -import sys -import re -import os -import warnings -import numbers -import distutils.log -import distutils.core -import distutils.cmd -import distutils.dist -from distutils.util import strtobool -from distutils.debug import DEBUG -from distutils.fancy_getopt import translate_longopt -import itertools - -from collections import defaultdict -from email import message_from_file - -from distutils.errors import ( - DistutilsOptionError, DistutilsPlatformError, DistutilsSetupError, -) -from distutils.util import rfc822_escape -from distutils.version import StrictVersion - -from setuptools.extern import six -from setuptools.extern import packaging -from setuptools.extern import ordered_set -from setuptools.extern.six.moves import map, filter, filterfalse - -from . import SetuptoolsDeprecationWarning - -from setuptools.depends import Require -from setuptools import windows_support -from setuptools.monkey import get_unpatched -from setuptools.config import parse_configuration -import pkg_resources - -__import__('setuptools.extern.packaging.specifiers') -__import__('setuptools.extern.packaging.version') - - -def _get_unpatched(cls): - warnings.warn("Do not call this function", DistDeprecationWarning) - return get_unpatched(cls) - - -def get_metadata_version(self): - mv = getattr(self, 'metadata_version', None) - - if mv is None: - if self.long_description_content_type or self.provides_extras: - mv = StrictVersion('2.1') - elif (self.maintainer is not None or - self.maintainer_email is not None or - getattr(self, 'python_requires', None) is not None or - self.project_urls): - mv = StrictVersion('1.2') - elif (self.provides or self.requires or self.obsoletes or - self.classifiers or self.download_url): - mv = StrictVersion('1.1') - else: - mv = StrictVersion('1.0') - - self.metadata_version = mv - - return mv - - -def read_pkg_file(self, file): - """Reads the metadata values from a file object.""" - msg = message_from_file(file) - - def _read_field(name): - value = msg[name] - if value == 'UNKNOWN': - return None - return value - - def _read_list(name): - values = msg.get_all(name, None) - if values == []: - return None - return values - - self.metadata_version = StrictVersion(msg['metadata-version']) - self.name = _read_field('name') - self.version = _read_field('version') - self.description = _read_field('summary') - # we are filling author only. - self.author = _read_field('author') - self.maintainer = None - self.author_email = _read_field('author-email') - self.maintainer_email = None - self.url = _read_field('home-page') - self.license = _read_field('license') - - if 'download-url' in msg: - self.download_url = _read_field('download-url') - else: - self.download_url = None - - self.long_description = _read_field('description') - self.description = _read_field('summary') - - if 'keywords' in msg: - self.keywords = _read_field('keywords').split(',') - - self.platforms = _read_list('platform') - self.classifiers = _read_list('classifier') - - # PEP 314 - these fields only exist in 1.1 - if self.metadata_version == StrictVersion('1.1'): - self.requires = _read_list('requires') - self.provides = _read_list('provides') - self.obsoletes = _read_list('obsoletes') - else: - self.requires = None - self.provides = None - self.obsoletes = None - - -# Based on Python 3.5 version -def write_pkg_file(self, file): - """Write the PKG-INFO format data to a file object. - """ - version = self.get_metadata_version() - - if six.PY2: - def write_field(key, value): - file.write("%s: %s\n" % (key, self._encode_field(value))) - else: - def write_field(key, value): - file.write("%s: %s\n" % (key, value)) - - write_field('Metadata-Version', str(version)) - write_field('Name', self.get_name()) - write_field('Version', self.get_version()) - write_field('Summary', self.get_description()) - write_field('Home-page', self.get_url()) - - if version < StrictVersion('1.2'): - write_field('Author', self.get_contact()) - write_field('Author-email', self.get_contact_email()) - else: - optional_fields = ( - ('Author', 'author'), - ('Author-email', 'author_email'), - ('Maintainer', 'maintainer'), - ('Maintainer-email', 'maintainer_email'), - ) - - for field, attr in optional_fields: - attr_val = getattr(self, attr) - - if attr_val is not None: - write_field(field, attr_val) - - write_field('License', self.get_license()) - if self.download_url: - write_field('Download-URL', self.download_url) - for project_url in self.project_urls.items(): - write_field('Project-URL', '%s, %s' % project_url) - - long_desc = rfc822_escape(self.get_long_description()) - write_field('Description', long_desc) - - keywords = ','.join(self.get_keywords()) - if keywords: - write_field('Keywords', keywords) - - if version >= StrictVersion('1.2'): - for platform in self.get_platforms(): - write_field('Platform', platform) - else: - self._write_list(file, 'Platform', self.get_platforms()) - - self._write_list(file, 'Classifier', self.get_classifiers()) - - # PEP 314 - self._write_list(file, 'Requires', self.get_requires()) - self._write_list(file, 'Provides', self.get_provides()) - self._write_list(file, 'Obsoletes', self.get_obsoletes()) - - # Setuptools specific for PEP 345 - if hasattr(self, 'python_requires'): - write_field('Requires-Python', self.python_requires) - - # PEP 566 - if self.long_description_content_type: - write_field( - 'Description-Content-Type', - self.long_description_content_type - ) - if self.provides_extras: - for extra in sorted(self.provides_extras): - write_field('Provides-Extra', extra) - - -sequence = tuple, list - - -def check_importable(dist, attr, value): - try: - ep = pkg_resources.EntryPoint.parse('x=' + value) - assert not ep.extras - except (TypeError, ValueError, AttributeError, AssertionError): - raise DistutilsSetupError( - "%r must be importable 'module:attrs' string (got %r)" - % (attr, value) - ) - - -def assert_string_list(dist, attr, value): - """Verify that value is a string list""" - try: - # verify that value is a list or tuple to exclude unordered - # or single-use iterables - assert isinstance(value, (list, tuple)) - # verify that elements of value are strings - assert ''.join(value) != value - except (TypeError, ValueError, AttributeError, AssertionError): - raise DistutilsSetupError( - "%r must be a list of strings (got %r)" % (attr, value) - ) - - -def check_nsp(dist, attr, value): - """Verify that namespace packages are valid""" - ns_packages = value - assert_string_list(dist, attr, ns_packages) - for nsp in ns_packages: - if not dist.has_contents_for(nsp): - raise DistutilsSetupError( - "Distribution contains no modules or packages for " + - "namespace package %r" % nsp - ) - parent, sep, child = nsp.rpartition('.') - if parent and parent not in ns_packages: - distutils.log.warn( - "WARNING: %r is declared as a package namespace, but %r" - " is not: please correct this in setup.py", nsp, parent - ) - - -def check_extras(dist, attr, value): - """Verify that extras_require mapping is valid""" - try: - list(itertools.starmap(_check_extra, value.items())) - except (TypeError, ValueError, AttributeError): - raise DistutilsSetupError( - "'extras_require' must be a dictionary whose values are " - "strings or lists of strings containing valid project/version " - "requirement specifiers." - ) - - -def _check_extra(extra, reqs): - name, sep, marker = extra.partition(':') - if marker and pkg_resources.invalid_marker(marker): - raise DistutilsSetupError("Invalid environment marker: " + marker) - list(pkg_resources.parse_requirements(reqs)) - - -def assert_bool(dist, attr, value): - """Verify that value is True, False, 0, or 1""" - if bool(value) != value: - tmpl = "{attr!r} must be a boolean value (got {value!r})" - raise DistutilsSetupError(tmpl.format(attr=attr, value=value)) - - -def check_requirements(dist, attr, value): - """Verify that install_requires is a valid requirements list""" - try: - list(pkg_resources.parse_requirements(value)) - if isinstance(value, (dict, set)): - raise TypeError("Unordered types are not allowed") - except (TypeError, ValueError) as error: - tmpl = ( - "{attr!r} must be a string or list of strings " - "containing valid project/version requirement specifiers; {error}" - ) - raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) - - -def check_specifier(dist, attr, value): - """Verify that value is a valid version specifier""" - try: - packaging.specifiers.SpecifierSet(value) - except packaging.specifiers.InvalidSpecifier as error: - tmpl = ( - "{attr!r} must be a string " - "containing valid version specifiers; {error}" - ) - raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) - - -def check_entry_points(dist, attr, value): - """Verify that entry_points map is parseable""" - try: - pkg_resources.EntryPoint.parse_map(value) - except ValueError as e: - raise DistutilsSetupError(e) - - -def check_test_suite(dist, attr, value): - if not isinstance(value, six.string_types): - raise DistutilsSetupError("test_suite must be a string") - - -def check_package_data(dist, attr, value): - """Verify that value is a dictionary of package names to glob lists""" - if not isinstance(value, dict): - raise DistutilsSetupError( - "{!r} must be a dictionary mapping package names to lists of " - "string wildcard patterns".format(attr)) - for k, v in value.items(): - if not isinstance(k, six.string_types): - raise DistutilsSetupError( - "keys of {!r} dict must be strings (got {!r})" - .format(attr, k) - ) - assert_string_list(dist, 'values of {!r} dict'.format(attr), v) - - -def check_packages(dist, attr, value): - for pkgname in value: - if not re.match(r'\w+(\.\w+)*', pkgname): - distutils.log.warn( - "WARNING: %r not a valid package name; please use only " - ".-separated package names in setup.py", pkgname - ) - - -_Distribution = get_unpatched(distutils.core.Distribution) - - -class Distribution(_Distribution): - """Distribution with support for features, tests, and package data - - This is an enhanced version of 'distutils.dist.Distribution' that - effectively adds the following new optional keyword arguments to 'setup()': - - 'install_requires' -- a string or sequence of strings specifying project - versions that the distribution requires when installed, in the format - used by 'pkg_resources.require()'. They will be installed - automatically when the package is installed. If you wish to use - packages that are not available in PyPI, or want to give your users an - alternate download location, you can add a 'find_links' option to the - '[easy_install]' section of your project's 'setup.cfg' file, and then - setuptools will scan the listed web pages for links that satisfy the - requirements. - - 'extras_require' -- a dictionary mapping names of optional "extras" to the - additional requirement(s) that using those extras incurs. For example, - this:: - - extras_require = dict(reST = ["docutils>=0.3", "reSTedit"]) - - indicates that the distribution can optionally provide an extra - capability called "reST", but it can only be used if docutils and - reSTedit are installed. If the user installs your package using - EasyInstall and requests one of your extras, the corresponding - additional requirements will be installed if needed. - - 'features' **deprecated** -- a dictionary mapping option names to - 'setuptools.Feature' - objects. Features are a portion of the distribution that can be - included or excluded based on user options, inter-feature dependencies, - and availability on the current system. Excluded features are omitted - from all setup commands, including source and binary distributions, so - you can create multiple distributions from the same source tree. - Feature names should be valid Python identifiers, except that they may - contain the '-' (minus) sign. Features can be included or excluded - via the command line options '--with-X' and '--without-X', where 'X' is - the name of the feature. Whether a feature is included by default, and - whether you are allowed to control this from the command line, is - determined by the Feature object. See the 'Feature' class for more - information. - - 'test_suite' -- the name of a test suite to run for the 'test' command. - If the user runs 'python setup.py test', the package will be installed, - and the named test suite will be run. The format is the same as - would be used on a 'unittest.py' command line. That is, it is the - dotted name of an object to import and call to generate a test suite. - - 'package_data' -- a dictionary mapping package names to lists of filenames - or globs to use to find data files contained in the named packages. - If the dictionary has filenames or globs listed under '""' (the empty - string), those names will be searched for in every package, in addition - to any names for the specific package. Data files found using these - names/globs will be installed along with the package, in the same - location as the package. Note that globs are allowed to reference - the contents of non-package subdirectories, as long as you use '/' as - a path separator. (Globs are automatically converted to - platform-specific paths at runtime.) - - In addition to these new keywords, this class also has several new methods - for manipulating the distribution's contents. For example, the 'include()' - and 'exclude()' methods can be thought of as in-place add and subtract - commands that add or remove packages, modules, extensions, and so on from - the distribution. They are used by the feature subsystem to configure the - distribution for the included and excluded features. - """ - - _DISTUTILS_UNSUPPORTED_METADATA = { - 'long_description_content_type': None, - 'project_urls': dict, - 'provides_extras': ordered_set.OrderedSet, - 'license_files': ordered_set.OrderedSet, - } - - _patched_dist = None - - def patch_missing_pkg_info(self, attrs): - # Fake up a replacement for the data that would normally come from - # PKG-INFO, but which might not yet be built if this is a fresh - # checkout. - # - if not attrs or 'name' not in attrs or 'version' not in attrs: - return - key = pkg_resources.safe_name(str(attrs['name'])).lower() - dist = pkg_resources.working_set.by_key.get(key) - if dist is not None and not dist.has_metadata('PKG-INFO'): - dist._version = pkg_resources.safe_version(str(attrs['version'])) - self._patched_dist = dist - - def __init__(self, attrs=None): - have_package_data = hasattr(self, "package_data") - if not have_package_data: - self.package_data = {} - attrs = attrs or {} - if 'features' in attrs or 'require_features' in attrs: - Feature.warn_deprecated() - self.require_features = [] - self.features = {} - self.dist_files = [] - # Filter-out setuptools' specific options. - self.src_root = attrs.pop("src_root", None) - self.patch_missing_pkg_info(attrs) - self.dependency_links = attrs.pop('dependency_links', []) - self.setup_requires = attrs.pop('setup_requires', []) - for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): - vars(self).setdefault(ep.name, None) - _Distribution.__init__(self, { - k: v for k, v in attrs.items() - if k not in self._DISTUTILS_UNSUPPORTED_METADATA - }) - - # Fill-in missing metadata fields not supported by distutils. - # Note some fields may have been set by other tools (e.g. pbr) - # above; they are taken preferrentially to setup() arguments - for option, default in self._DISTUTILS_UNSUPPORTED_METADATA.items(): - for source in self.metadata.__dict__, attrs: - if option in source: - value = source[option] - break - else: - value = default() if default else None - setattr(self.metadata, option, value) - - if isinstance(self.metadata.version, numbers.Number): - # Some people apparently take "version number" too literally :) - self.metadata.version = str(self.metadata.version) - - if self.metadata.version is not None: - try: - ver = packaging.version.Version(self.metadata.version) - normalized_version = str(ver) - if self.metadata.version != normalized_version: - warnings.warn( - "Normalizing '%s' to '%s'" % ( - self.metadata.version, - normalized_version, - ) - ) - self.metadata.version = normalized_version - except (packaging.version.InvalidVersion, TypeError): - warnings.warn( - "The version specified (%r) is an invalid version, this " - "may not work as expected with newer versions of " - "setuptools, pip, and PyPI. Please see PEP 440 for more " - "details." % self.metadata.version - ) - self._finalize_requires() - - def _finalize_requires(self): - """ - Set `metadata.python_requires` and fix environment markers - in `install_requires` and `extras_require`. - """ - if getattr(self, 'python_requires', None): - self.metadata.python_requires = self.python_requires - - if getattr(self, 'extras_require', None): - for extra in self.extras_require.keys(): - # Since this gets called multiple times at points where the - # keys have become 'converted' extras, ensure that we are only - # truly adding extras we haven't seen before here. - extra = extra.split(':')[0] - if extra: - self.metadata.provides_extras.add(extra) - - self._convert_extras_requirements() - self._move_install_requirements_markers() - - def _convert_extras_requirements(self): - """ - Convert requirements in `extras_require` of the form - `"extra": ["barbazquux; {marker}"]` to - `"extra:{marker}": ["barbazquux"]`. - """ - spec_ext_reqs = getattr(self, 'extras_require', None) or {} - self._tmp_extras_require = defaultdict(list) - for section, v in spec_ext_reqs.items(): - # Do not strip empty sections. - self._tmp_extras_require[section] - for r in pkg_resources.parse_requirements(v): - suffix = self._suffix_for(r) - self._tmp_extras_require[section + suffix].append(r) - - @staticmethod - def _suffix_for(req): - """ - For a requirement, return the 'extras_require' suffix for - that requirement. - """ - return ':' + str(req.marker) if req.marker else '' - - def _move_install_requirements_markers(self): - """ - Move requirements in `install_requires` that are using environment - markers `extras_require`. - """ - - # divide the install_requires into two sets, simple ones still - # handled by install_requires and more complex ones handled - # by extras_require. - - def is_simple_req(req): - return not req.marker - - spec_inst_reqs = getattr(self, 'install_requires', None) or () - inst_reqs = list(pkg_resources.parse_requirements(spec_inst_reqs)) - simple_reqs = filter(is_simple_req, inst_reqs) - complex_reqs = filterfalse(is_simple_req, inst_reqs) - self.install_requires = list(map(str, simple_reqs)) - - for r in complex_reqs: - self._tmp_extras_require[':' + str(r.marker)].append(r) - self.extras_require = dict( - (k, [str(r) for r in map(self._clean_req, v)]) - for k, v in self._tmp_extras_require.items() - ) - - def _clean_req(self, req): - """ - Given a Requirement, remove environment markers and return it. - """ - req.marker = None - return req - - def _parse_config_files(self, filenames=None): - """ - Adapted from distutils.dist.Distribution.parse_config_files, - this method provides the same functionality in subtly-improved - ways. - """ - from setuptools.extern.six.moves.configparser import ConfigParser - - # Ignore install directory options if we have a venv - if six.PY3 and sys.prefix != sys.base_prefix: - ignore_options = [ - 'install-base', 'install-platbase', 'install-lib', - 'install-platlib', 'install-purelib', 'install-headers', - 'install-scripts', 'install-data', 'prefix', 'exec-prefix', - 'home', 'user', 'root'] - else: - ignore_options = [] - - ignore_options = frozenset(ignore_options) - - if filenames is None: - filenames = self.find_config_files() - - if DEBUG: - self.announce("Distribution.parse_config_files():") - - parser = ConfigParser() - for filename in filenames: - with io.open(filename, encoding='utf-8') as reader: - if DEBUG: - self.announce(" reading {filename}".format(**locals())) - (parser.read_file if six.PY3 else parser.readfp)(reader) - for section in parser.sections(): - options = parser.options(section) - opt_dict = self.get_option_dict(section) - - for opt in options: - if opt != '__name__' and opt not in ignore_options: - val = self._try_str(parser.get(section, opt)) - opt = opt.replace('-', '_') - opt_dict[opt] = (filename, val) - - # Make the ConfigParser forget everything (so we retain - # the original filenames that options come from) - parser.__init__() - - # If there was a "global" section in the config file, use it - # to set Distribution options. - - if 'global' in self.command_options: - for (opt, (src, val)) in self.command_options['global'].items(): - alias = self.negative_opt.get(opt) - try: - if alias: - setattr(self, alias, not strtobool(val)) - elif opt in ('verbose', 'dry_run'): # ugh! - setattr(self, opt, strtobool(val)) - else: - setattr(self, opt, val) - except ValueError as msg: - raise DistutilsOptionError(msg) - - @staticmethod - def _try_str(val): - """ - On Python 2, much of distutils relies on string values being of - type 'str' (bytes) and not unicode text. If the value can be safely - encoded to bytes using the default encoding, prefer that. - - Why the default encoding? Because that value can be implicitly - decoded back to text if needed. - - Ref #1653 - """ - if six.PY3: - return val - try: - return val.encode() - except UnicodeEncodeError: - pass - return val - - def _set_command_options(self, command_obj, option_dict=None): - """ - Set the options for 'command_obj' from 'option_dict'. Basically - this means copying elements of a dictionary ('option_dict') to - attributes of an instance ('command'). - - 'command_obj' must be a Command instance. If 'option_dict' is not - supplied, uses the standard option dictionary for this command - (from 'self.command_options'). - - (Adopted from distutils.dist.Distribution._set_command_options) - """ - command_name = command_obj.get_command_name() - if option_dict is None: - option_dict = self.get_option_dict(command_name) - - if DEBUG: - self.announce(" setting options for '%s' command:" % command_name) - for (option, (source, value)) in option_dict.items(): - if DEBUG: - self.announce(" %s = %s (from %s)" % (option, value, - source)) - try: - bool_opts = [translate_longopt(o) - for o in command_obj.boolean_options] - except AttributeError: - bool_opts = [] - try: - neg_opt = command_obj.negative_opt - except AttributeError: - neg_opt = {} - - try: - is_string = isinstance(value, six.string_types) - if option in neg_opt and is_string: - setattr(command_obj, neg_opt[option], not strtobool(value)) - elif option in bool_opts and is_string: - setattr(command_obj, option, strtobool(value)) - elif hasattr(command_obj, option): - setattr(command_obj, option, value) - else: - raise DistutilsOptionError( - "error in %s: command '%s' has no such option '%s'" - % (source, command_name, option)) - except ValueError as msg: - raise DistutilsOptionError(msg) - - def parse_config_files(self, filenames=None, ignore_option_errors=False): - """Parses configuration files from various levels - and loads configuration. - - """ - self._parse_config_files(filenames=filenames) - - parse_configuration(self, self.command_options, - ignore_option_errors=ignore_option_errors) - self._finalize_requires() - - def parse_command_line(self): - """Process features after parsing command line options""" - result = _Distribution.parse_command_line(self) - if self.features: - self._finalize_features() - return result - - def _feature_attrname(self, name): - """Convert feature name to corresponding option attribute name""" - return 'with_' + name.replace('-', '_') - - def fetch_build_eggs(self, requires): - """Resolve pre-setup requirements""" - resolved_dists = pkg_resources.working_set.resolve( - pkg_resources.parse_requirements(requires), - installer=self.fetch_build_egg, - replace_conflicting=True, - ) - for dist in resolved_dists: - pkg_resources.working_set.add(dist, replace=True) - return resolved_dists - - def finalize_options(self): - """ - Allow plugins to apply arbitrary operations to the - distribution. Each hook may optionally define a 'order' - to influence the order of execution. Smaller numbers - go first and the default is 0. - """ - hook_key = 'setuptools.finalize_distribution_options' - - def by_order(hook): - return getattr(hook, 'order', 0) - eps = pkg_resources.iter_entry_points(hook_key) - for ep in sorted(eps, key=by_order): - ep.load()(self) - - def _finalize_setup_keywords(self): - for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): - value = getattr(self, ep.name, None) - if value is not None: - ep.require(installer=self.fetch_build_egg) - ep.load()(self, ep.name, value) - - def _finalize_2to3_doctests(self): - if getattr(self, 'convert_2to3_doctests', None): - # XXX may convert to set here when we can rely on set being builtin - self.convert_2to3_doctests = [ - os.path.abspath(p) - for p in self.convert_2to3_doctests - ] - else: - self.convert_2to3_doctests = [] - - def get_egg_cache_dir(self): - egg_cache_dir = os.path.join(os.curdir, '.eggs') - if not os.path.exists(egg_cache_dir): - os.mkdir(egg_cache_dir) - windows_support.hide_file(egg_cache_dir) - readme_txt_filename = os.path.join(egg_cache_dir, 'README.txt') - with open(readme_txt_filename, 'w') as f: - f.write('This directory contains eggs that were downloaded ' - 'by setuptools to build, test, and run plug-ins.\n\n') - f.write('This directory caches those eggs to prevent ' - 'repeated downloads.\n\n') - f.write('However, it is safe to delete this directory.\n\n') - - return egg_cache_dir - - def fetch_build_egg(self, req): - """Fetch an egg needed for building""" - from setuptools.installer import fetch_build_egg - return fetch_build_egg(self, req) - - def _finalize_feature_opts(self): - """Add --with-X/--without-X options based on optional features""" - - if not self.features: - return - - go = [] - no = self.negative_opt.copy() - - for name, feature in self.features.items(): - self._set_feature(name, None) - feature.validate(self) - - if feature.optional: - descr = feature.description - incdef = ' (default)' - excdef = '' - if not feature.include_by_default(): - excdef, incdef = incdef, excdef - - new = ( - ('with-' + name, None, 'include ' + descr + incdef), - ('without-' + name, None, 'exclude ' + descr + excdef), - ) - go.extend(new) - no['without-' + name] = 'with-' + name - - self.global_options = self.feature_options = go + self.global_options - self.negative_opt = self.feature_negopt = no - - def _finalize_features(self): - """Add/remove features and resolve dependencies between them""" - - # First, flag all the enabled items (and thus their dependencies) - for name, feature in self.features.items(): - enabled = self.feature_is_included(name) - if enabled or (enabled is None and feature.include_by_default()): - feature.include_in(self) - self._set_feature(name, 1) - - # Then disable the rest, so that off-by-default features don't - # get flagged as errors when they're required by an enabled feature - for name, feature in self.features.items(): - if not self.feature_is_included(name): - feature.exclude_from(self) - self._set_feature(name, 0) - - def get_command_class(self, command): - """Pluggable version of get_command_class()""" - if command in self.cmdclass: - return self.cmdclass[command] - - eps = pkg_resources.iter_entry_points('distutils.commands', command) - for ep in eps: - ep.require(installer=self.fetch_build_egg) - self.cmdclass[command] = cmdclass = ep.load() - return cmdclass - else: - return _Distribution.get_command_class(self, command) - - def print_commands(self): - for ep in pkg_resources.iter_entry_points('distutils.commands'): - if ep.name not in self.cmdclass: - # don't require extras as the commands won't be invoked - cmdclass = ep.resolve() - self.cmdclass[ep.name] = cmdclass - return _Distribution.print_commands(self) - - def get_command_list(self): - for ep in pkg_resources.iter_entry_points('distutils.commands'): - if ep.name not in self.cmdclass: - # don't require extras as the commands won't be invoked - cmdclass = ep.resolve() - self.cmdclass[ep.name] = cmdclass - return _Distribution.get_command_list(self) - - def _set_feature(self, name, status): - """Set feature's inclusion status""" - setattr(self, self._feature_attrname(name), status) - - def feature_is_included(self, name): - """Return 1 if feature is included, 0 if excluded, 'None' if unknown""" - return getattr(self, self._feature_attrname(name)) - - def include_feature(self, name): - """Request inclusion of feature named 'name'""" - - if self.feature_is_included(name) == 0: - descr = self.features[name].description - raise DistutilsOptionError( - descr + " is required, but was excluded or is not available" - ) - self.features[name].include_in(self) - self._set_feature(name, 1) - - def include(self, **attrs): - """Add items to distribution that are named in keyword arguments - - For example, 'dist.include(py_modules=["x"])' would add 'x' to - the distribution's 'py_modules' attribute, if it was not already - there. - - Currently, this method only supports inclusion for attributes that are - lists or tuples. If you need to add support for adding to other - attributes in this or a subclass, you can add an '_include_X' method, - where 'X' is the name of the attribute. The method will be called with - the value passed to 'include()'. So, 'dist.include(foo={"bar":"baz"})' - will try to call 'dist._include_foo({"bar":"baz"})', which can then - handle whatever special inclusion logic is needed. - """ - for k, v in attrs.items(): - include = getattr(self, '_include_' + k, None) - if include: - include(v) - else: - self._include_misc(k, v) - - def exclude_package(self, package): - """Remove packages, modules, and extensions in named package""" - - pfx = package + '.' - if self.packages: - self.packages = [ - p for p in self.packages - if p != package and not p.startswith(pfx) - ] - - if self.py_modules: - self.py_modules = [ - p for p in self.py_modules - if p != package and not p.startswith(pfx) - ] - - if self.ext_modules: - self.ext_modules = [ - p for p in self.ext_modules - if p.name != package and not p.name.startswith(pfx) - ] - - def has_contents_for(self, package): - """Return true if 'exclude_package(package)' would do something""" - - pfx = package + '.' - - for p in self.iter_distribution_names(): - if p == package or p.startswith(pfx): - return True - - def _exclude_misc(self, name, value): - """Handle 'exclude()' for list/tuple attrs without a special handler""" - if not isinstance(value, sequence): - raise DistutilsSetupError( - "%s: setting must be a list or tuple (%r)" % (name, value) - ) - try: - old = getattr(self, name) - except AttributeError: - raise DistutilsSetupError( - "%s: No such distribution setting" % name - ) - if old is not None and not isinstance(old, sequence): - raise DistutilsSetupError( - name + ": this setting cannot be changed via include/exclude" - ) - elif old: - setattr(self, name, [item for item in old if item not in value]) - - def _include_misc(self, name, value): - """Handle 'include()' for list/tuple attrs without a special handler""" - - if not isinstance(value, sequence): - raise DistutilsSetupError( - "%s: setting must be a list (%r)" % (name, value) - ) - try: - old = getattr(self, name) - except AttributeError: - raise DistutilsSetupError( - "%s: No such distribution setting" % name - ) - if old is None: - setattr(self, name, value) - elif not isinstance(old, sequence): - raise DistutilsSetupError( - name + ": this setting cannot be changed via include/exclude" - ) - else: - new = [item for item in value if item not in old] - setattr(self, name, old + new) - - def exclude(self, **attrs): - """Remove items from distribution that are named in keyword arguments - - For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from - the distribution's 'py_modules' attribute. Excluding packages uses - the 'exclude_package()' method, so all of the package's contained - packages, modules, and extensions are also excluded. - - Currently, this method only supports exclusion from attributes that are - lists or tuples. If you need to add support for excluding from other - attributes in this or a subclass, you can add an '_exclude_X' method, - where 'X' is the name of the attribute. The method will be called with - the value passed to 'exclude()'. So, 'dist.exclude(foo={"bar":"baz"})' - will try to call 'dist._exclude_foo({"bar":"baz"})', which can then - handle whatever special exclusion logic is needed. - """ - for k, v in attrs.items(): - exclude = getattr(self, '_exclude_' + k, None) - if exclude: - exclude(v) - else: - self._exclude_misc(k, v) - - def _exclude_packages(self, packages): - if not isinstance(packages, sequence): - raise DistutilsSetupError( - "packages: setting must be a list or tuple (%r)" % (packages,) - ) - list(map(self.exclude_package, packages)) - - def _parse_command_opts(self, parser, args): - # Remove --with-X/--without-X options when processing command args - self.global_options = self.__class__.global_options - self.negative_opt = self.__class__.negative_opt - - # First, expand any aliases - command = args[0] - aliases = self.get_option_dict('aliases') - while command in aliases: - src, alias = aliases[command] - del aliases[command] # ensure each alias can expand only once! - import shlex - args[:1] = shlex.split(alias, True) - command = args[0] - - nargs = _Distribution._parse_command_opts(self, parser, args) - - # Handle commands that want to consume all remaining arguments - cmd_class = self.get_command_class(command) - if getattr(cmd_class, 'command_consumes_arguments', None): - self.get_option_dict(command)['args'] = ("command line", nargs) - if nargs is not None: - return [] - - return nargs - - def get_cmdline_options(self): - """Return a '{cmd: {opt:val}}' map of all command-line options - - Option names are all long, but do not include the leading '--', and - contain dashes rather than underscores. If the option doesn't take - an argument (e.g. '--quiet'), the 'val' is 'None'. - - Note that options provided by config files are intentionally excluded. - """ - - d = {} - - for cmd, opts in self.command_options.items(): - - for opt, (src, val) in opts.items(): - - if src != "command line": - continue - - opt = opt.replace('_', '-') - - if val == 0: - cmdobj = self.get_command_obj(cmd) - neg_opt = self.negative_opt.copy() - neg_opt.update(getattr(cmdobj, 'negative_opt', {})) - for neg, pos in neg_opt.items(): - if pos == opt: - opt = neg - val = None - break - else: - raise AssertionError("Shouldn't be able to get here") - - elif val == 1: - val = None - - d.setdefault(cmd, {})[opt] = val - - return d - - def iter_distribution_names(self): - """Yield all packages, modules, and extension names in distribution""" - - for pkg in self.packages or (): - yield pkg - - for module in self.py_modules or (): - yield module - - for ext in self.ext_modules or (): - if isinstance(ext, tuple): - name, buildinfo = ext - else: - name = ext.name - if name.endswith('module'): - name = name[:-6] - yield name - - def handle_display_options(self, option_order): - """If there were any non-global "display-only" options - (--help-commands or the metadata display options) on the command - line, display the requested info and return true; else return - false. - """ - import sys - - if six.PY2 or self.help_commands: - return _Distribution.handle_display_options(self, option_order) - - # Stdout may be StringIO (e.g. in tests) - if not isinstance(sys.stdout, io.TextIOWrapper): - return _Distribution.handle_display_options(self, option_order) - - # Don't wrap stdout if utf-8 is already the encoding. Provides - # workaround for #334. - if sys.stdout.encoding.lower() in ('utf-8', 'utf8'): - return _Distribution.handle_display_options(self, option_order) - - # Print metadata in UTF-8 no matter the platform - encoding = sys.stdout.encoding - errors = sys.stdout.errors - newline = sys.platform != 'win32' and '\n' or None - line_buffering = sys.stdout.line_buffering - - sys.stdout = io.TextIOWrapper( - sys.stdout.detach(), 'utf-8', errors, newline, line_buffering) - try: - return _Distribution.handle_display_options(self, option_order) - finally: - sys.stdout = io.TextIOWrapper( - sys.stdout.detach(), encoding, errors, newline, line_buffering) - - -class Feature: - """ - **deprecated** -- The `Feature` facility was never completely implemented - or supported, `has reported issues - `_ and will be removed in - a future version. - - A subset of the distribution that can be excluded if unneeded/wanted - - Features are created using these keyword arguments: - - 'description' -- a short, human readable description of the feature, to - be used in error messages, and option help messages. - - 'standard' -- if true, the feature is included by default if it is - available on the current system. Otherwise, the feature is only - included if requested via a command line '--with-X' option, or if - another included feature requires it. The default setting is 'False'. - - 'available' -- if true, the feature is available for installation on the - current system. The default setting is 'True'. - - 'optional' -- if true, the feature's inclusion can be controlled from the - command line, using the '--with-X' or '--without-X' options. If - false, the feature's inclusion status is determined automatically, - based on 'availabile', 'standard', and whether any other feature - requires it. The default setting is 'True'. - - 'require_features' -- a string or sequence of strings naming features - that should also be included if this feature is included. Defaults to - empty list. May also contain 'Require' objects that should be - added/removed from the distribution. - - 'remove' -- a string or list of strings naming packages to be removed - from the distribution if this feature is *not* included. If the - feature *is* included, this argument is ignored. This argument exists - to support removing features that "crosscut" a distribution, such as - defining a 'tests' feature that removes all the 'tests' subpackages - provided by other features. The default for this argument is an empty - list. (Note: the named package(s) or modules must exist in the base - distribution when the 'setup()' function is initially called.) - - other keywords -- any other keyword arguments are saved, and passed to - the distribution's 'include()' and 'exclude()' methods when the - feature is included or excluded, respectively. So, for example, you - could pass 'packages=["a","b"]' to cause packages 'a' and 'b' to be - added or removed from the distribution as appropriate. - - A feature must include at least one 'requires', 'remove', or other - keyword argument. Otherwise, it can't affect the distribution in any way. - Note also that you can subclass 'Feature' to create your own specialized - feature types that modify the distribution in other ways when included or - excluded. See the docstrings for the various methods here for more detail. - Aside from the methods, the only feature attributes that distributions look - at are 'description' and 'optional'. - """ - - @staticmethod - def warn_deprecated(): - msg = ( - "Features are deprecated and will be removed in a future " - "version. See https://github.com/pypa/setuptools/issues/65." - ) - warnings.warn(msg, DistDeprecationWarning, stacklevel=3) - - def __init__( - self, description, standard=False, available=True, - optional=True, require_features=(), remove=(), **extras): - self.warn_deprecated() - - self.description = description - self.standard = standard - self.available = available - self.optional = optional - if isinstance(require_features, (str, Require)): - require_features = require_features, - - self.require_features = [ - r for r in require_features if isinstance(r, str) - ] - er = [r for r in require_features if not isinstance(r, str)] - if er: - extras['require_features'] = er - - if isinstance(remove, str): - remove = remove, - self.remove = remove - self.extras = extras - - if not remove and not require_features and not extras: - raise DistutilsSetupError( - "Feature %s: must define 'require_features', 'remove', or " - "at least one of 'packages', 'py_modules', etc." - ) - - def include_by_default(self): - """Should this feature be included by default?""" - return self.available and self.standard - - def include_in(self, dist): - """Ensure feature and its requirements are included in distribution - - You may override this in a subclass to perform additional operations on - the distribution. Note that this method may be called more than once - per feature, and so should be idempotent. - - """ - - if not self.available: - raise DistutilsPlatformError( - self.description + " is required, " - "but is not available on this platform" - ) - - dist.include(**self.extras) - - for f in self.require_features: - dist.include_feature(f) - - def exclude_from(self, dist): - """Ensure feature is excluded from distribution - - You may override this in a subclass to perform additional operations on - the distribution. This method will be called at most once per - feature, and only after all included features have been asked to - include themselves. - """ - - dist.exclude(**self.extras) - - if self.remove: - for item in self.remove: - dist.exclude_package(item) - - def validate(self, dist): - """Verify that feature makes sense in context of distribution - - This method is called by the distribution just before it parses its - command line. It checks to ensure that the 'remove' attribute, if any, - contains only valid package/module names that are present in the base - distribution when 'setup()' is called. You may override it in a - subclass to perform any other required validation of the feature - against a target distribution. - """ - - for item in self.remove: - if not dist.has_contents_for(item): - raise DistutilsSetupError( - "%s wants to be able to remove %s, but the distribution" - " doesn't contain any packages or modules under %s" - % (self.description, item, item) - ) - - -class DistDeprecationWarning(SetuptoolsDeprecationWarning): - """Class for warning about deprecations in dist in - setuptools. Not ignored by default, unlike DeprecationWarning.""" diff --git a/venv/lib/python3.8/site-packages/setuptools/errors.py b/venv/lib/python3.8/site-packages/setuptools/errors.py deleted file mode 100644 index 2701747f56cc77845159f2c5fee2d0ce114259af..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/errors.py +++ /dev/null @@ -1,16 +0,0 @@ -"""setuptools.errors - -Provides exceptions used by setuptools modules. -""" - -from distutils.errors import DistutilsError - - -class RemovedCommandError(DistutilsError, RuntimeError): - """Error used for commands that have been removed in setuptools. - - Since ``setuptools`` is built on ``distutils``, simply removing a command - from ``setuptools`` will make the behavior fall back to ``distutils``; this - error is raised if a command exists in ``distutils`` but has been actively - removed in ``setuptools``. - """ diff --git a/venv/lib/python3.8/site-packages/setuptools/extension.py b/venv/lib/python3.8/site-packages/setuptools/extension.py deleted file mode 100644 index 29468894f828128f4c36660167dd1f9e68e584be..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/extension.py +++ /dev/null @@ -1,57 +0,0 @@ -import re -import functools -import distutils.core -import distutils.errors -import distutils.extension - -from setuptools.extern.six.moves import map - -from .monkey import get_unpatched - - -def _have_cython(): - """ - Return True if Cython can be imported. - """ - cython_impl = 'Cython.Distutils.build_ext' - try: - # from (cython_impl) import build_ext - __import__(cython_impl, fromlist=['build_ext']).build_ext - return True - except Exception: - pass - return False - - -# for compatibility -have_pyrex = _have_cython - -_Extension = get_unpatched(distutils.core.Extension) - - -class Extension(_Extension): - """Extension that uses '.c' files in place of '.pyx' files""" - - def __init__(self, name, sources, *args, **kw): - # The *args is needed for compatibility as calls may use positional - # arguments. py_limited_api may be set only via keyword. - self.py_limited_api = kw.pop("py_limited_api", False) - _Extension.__init__(self, name, sources, *args, **kw) - - def _convert_pyx_sources_to_lang(self): - """ - Replace sources with .pyx extensions to sources with the target - language extension. This mechanism allows language authors to supply - pre-converted sources but to prefer the .pyx sources. - """ - if _have_cython(): - # the build has Cython, so allow it to compile the .pyx files - return - lang = self.language or '' - target_ext = '.cpp' if lang.lower() == 'c++' else '.c' - sub = functools.partial(re.sub, '.pyx$', target_ext) - self.sources = list(map(sub, self.sources)) - - -class Library(Extension): - """Just like a regular Extension, but built as a library instead""" diff --git a/venv/lib/python3.8/site-packages/setuptools/extern/__init__.py b/venv/lib/python3.8/site-packages/setuptools/extern/__init__.py deleted file mode 100644 index e8c616f910bb9bb874c3d44f1efe5239ecb8f621..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/extern/__init__.py +++ /dev/null @@ -1,73 +0,0 @@ -import sys - - -class VendorImporter: - """ - A PEP 302 meta path importer for finding optionally-vendored - or otherwise naturally-installed packages from root_name. - """ - - def __init__(self, root_name, vendored_names=(), vendor_pkg=None): - self.root_name = root_name - self.vendored_names = set(vendored_names) - self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor') - - @property - def search_path(self): - """ - Search first the vendor package then as a natural package. - """ - yield self.vendor_pkg + '.' - yield '' - - def find_module(self, fullname, path=None): - """ - Return self when fullname starts with root_name and the - target module is one vendored through this importer. - """ - root, base, target = fullname.partition(self.root_name + '.') - if root: - return - if not any(map(target.startswith, self.vendored_names)): - return - return self - - def load_module(self, fullname): - """ - Iterate over the search path to locate and load fullname. - """ - root, base, target = fullname.partition(self.root_name + '.') - for prefix in self.search_path: - try: - extant = prefix + target - __import__(extant) - mod = sys.modules[extant] - sys.modules[fullname] = mod - # mysterious hack: - # Remove the reference to the extant package/module - # on later Python versions to cause relative imports - # in the vendor package to resolve the same modules - # as those going through this importer. - if sys.version_info >= (3, ): - del sys.modules[extant] - return mod - except ImportError: - pass - else: - raise ImportError( - "The '{target}' package is required; " - "normally this is bundled with this package so if you get " - "this warning, consult the packager of your " - "distribution.".format(**locals()) - ) - - def install(self): - """ - Install this importer into sys.meta_path if not already present. - """ - if self not in sys.meta_path: - sys.meta_path.append(self) - - -names = 'six', 'packaging', 'pyparsing', 'ordered_set', -VendorImporter(__name__, names, 'setuptools._vendor').install() diff --git a/venv/lib/python3.8/site-packages/setuptools/extern/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/setuptools/extern/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 670cb2ea12147ef4a34d047a65e9fbb39ea4b79e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/extern/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/glob.py b/venv/lib/python3.8/site-packages/setuptools/glob.py deleted file mode 100644 index 9d7cbc5da68da8605d271b9314befb206b87bca6..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/glob.py +++ /dev/null @@ -1,174 +0,0 @@ -""" -Filename globbing utility. Mostly a copy of `glob` from Python 3.5. - -Changes include: - * `yield from` and PEP3102 `*` removed. - * Hidden files are not ignored. -""" - -import os -import re -import fnmatch - -__all__ = ["glob", "iglob", "escape"] - - -def glob(pathname, recursive=False): - """Return a list of paths matching a pathname pattern. - - The pattern may contain simple shell-style wildcards a la - fnmatch. However, unlike fnmatch, filenames starting with a - dot are special cases that are not matched by '*' and '?' - patterns. - - If recursive is true, the pattern '**' will match any files and - zero or more directories and subdirectories. - """ - return list(iglob(pathname, recursive=recursive)) - - -def iglob(pathname, recursive=False): - """Return an iterator which yields the paths matching a pathname pattern. - - The pattern may contain simple shell-style wildcards a la - fnmatch. However, unlike fnmatch, filenames starting with a - dot are special cases that are not matched by '*' and '?' - patterns. - - If recursive is true, the pattern '**' will match any files and - zero or more directories and subdirectories. - """ - it = _iglob(pathname, recursive) - if recursive and _isrecursive(pathname): - s = next(it) # skip empty string - assert not s - return it - - -def _iglob(pathname, recursive): - dirname, basename = os.path.split(pathname) - if not has_magic(pathname): - if basename: - if os.path.lexists(pathname): - yield pathname - else: - # Patterns ending with a slash should match only directories - if os.path.isdir(dirname): - yield pathname - return - if not dirname: - if recursive and _isrecursive(basename): - for x in glob2(dirname, basename): - yield x - else: - for x in glob1(dirname, basename): - yield x - return - # `os.path.split()` returns the argument itself as a dirname if it is a - # drive or UNC path. Prevent an infinite recursion if a drive or UNC path - # contains magic characters (i.e. r'\\?\C:'). - if dirname != pathname and has_magic(dirname): - dirs = _iglob(dirname, recursive) - else: - dirs = [dirname] - if has_magic(basename): - if recursive and _isrecursive(basename): - glob_in_dir = glob2 - else: - glob_in_dir = glob1 - else: - glob_in_dir = glob0 - for dirname in dirs: - for name in glob_in_dir(dirname, basename): - yield os.path.join(dirname, name) - - -# These 2 helper functions non-recursively glob inside a literal directory. -# They return a list of basenames. `glob1` accepts a pattern while `glob0` -# takes a literal basename (so it only has to check for its existence). - - -def glob1(dirname, pattern): - if not dirname: - if isinstance(pattern, bytes): - dirname = os.curdir.encode('ASCII') - else: - dirname = os.curdir - try: - names = os.listdir(dirname) - except OSError: - return [] - return fnmatch.filter(names, pattern) - - -def glob0(dirname, basename): - if not basename: - # `os.path.split()` returns an empty basename for paths ending with a - # directory separator. 'q*x/' should match only directories. - if os.path.isdir(dirname): - return [basename] - else: - if os.path.lexists(os.path.join(dirname, basename)): - return [basename] - return [] - - -# This helper function recursively yields relative pathnames inside a literal -# directory. - - -def glob2(dirname, pattern): - assert _isrecursive(pattern) - yield pattern[:0] - for x in _rlistdir(dirname): - yield x - - -# Recursively yields relative pathnames inside a literal directory. -def _rlistdir(dirname): - if not dirname: - if isinstance(dirname, bytes): - dirname = os.curdir.encode('ASCII') - else: - dirname = os.curdir - try: - names = os.listdir(dirname) - except os.error: - return - for x in names: - yield x - path = os.path.join(dirname, x) if dirname else x - for y in _rlistdir(path): - yield os.path.join(x, y) - - -magic_check = re.compile('([*?[])') -magic_check_bytes = re.compile(b'([*?[])') - - -def has_magic(s): - if isinstance(s, bytes): - match = magic_check_bytes.search(s) - else: - match = magic_check.search(s) - return match is not None - - -def _isrecursive(pattern): - if isinstance(pattern, bytes): - return pattern == b'**' - else: - return pattern == '**' - - -def escape(pathname): - """Escape all special characters. - """ - # Escaping is done by wrapping any of "*?[" between square brackets. - # Metacharacters do not work in the drive part and shouldn't be escaped. - drive, pathname = os.path.splitdrive(pathname) - if isinstance(pathname, bytes): - pathname = magic_check_bytes.sub(br'[\1]', pathname) - else: - pathname = magic_check.sub(r'[\1]', pathname) - return drive + pathname diff --git a/venv/lib/python3.8/site-packages/setuptools/gui-32.exe b/venv/lib/python3.8/site-packages/setuptools/gui-32.exe deleted file mode 100644 index f8d3509653ba8f80ca7f3aa7f95616142ba83a94..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/gui-32.exe and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/gui-64.exe b/venv/lib/python3.8/site-packages/setuptools/gui-64.exe deleted file mode 100644 index 330c51a5dde15a0bb610a48cd0ca11770c914dae..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/gui-64.exe and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/gui.exe b/venv/lib/python3.8/site-packages/setuptools/gui.exe deleted file mode 100644 index f8d3509653ba8f80ca7f3aa7f95616142ba83a94..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/setuptools/gui.exe and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/setuptools/installer.py b/venv/lib/python3.8/site-packages/setuptools/installer.py deleted file mode 100644 index 9f8be2ef8427651e3b0fbef497535e152dde66b1..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/installer.py +++ /dev/null @@ -1,150 +0,0 @@ -import glob -import os -import subprocess -import sys -from distutils import log -from distutils.errors import DistutilsError - -import pkg_resources -from setuptools.command.easy_install import easy_install -from setuptools.extern import six -from setuptools.wheel import Wheel - -from .py31compat import TemporaryDirectory - - -def _fixup_find_links(find_links): - """Ensure find-links option end-up being a list of strings.""" - if isinstance(find_links, six.string_types): - return find_links.split() - assert isinstance(find_links, (tuple, list)) - return find_links - - -def _legacy_fetch_build_egg(dist, req): - """Fetch an egg needed for building. - - Legacy path using EasyInstall. - """ - tmp_dist = dist.__class__({'script_args': ['easy_install']}) - opts = tmp_dist.get_option_dict('easy_install') - opts.clear() - opts.update( - (k, v) - for k, v in dist.get_option_dict('easy_install').items() - if k in ( - # don't use any other settings - 'find_links', 'site_dirs', 'index_url', - 'optimize', 'site_dirs', 'allow_hosts', - )) - if dist.dependency_links: - links = dist.dependency_links[:] - if 'find_links' in opts: - links = _fixup_find_links(opts['find_links'][1]) + links - opts['find_links'] = ('setup', links) - install_dir = dist.get_egg_cache_dir() - cmd = easy_install( - tmp_dist, args=["x"], install_dir=install_dir, - exclude_scripts=True, - always_copy=False, build_directory=None, editable=False, - upgrade=False, multi_version=True, no_report=True, user=False - ) - cmd.ensure_finalized() - return cmd.easy_install(req) - - -def fetch_build_egg(dist, req): - """Fetch an egg needed for building. - - Use pip/wheel to fetch/build a wheel.""" - # Check pip is available. - try: - pkg_resources.get_distribution('pip') - except pkg_resources.DistributionNotFound: - dist.announce( - 'WARNING: The pip package is not available, falling back ' - 'to EasyInstall for handling setup_requires/test_requires; ' - 'this is deprecated and will be removed in a future version.' - , log.WARN - ) - return _legacy_fetch_build_egg(dist, req) - # Warn if wheel is not. - try: - pkg_resources.get_distribution('wheel') - except pkg_resources.DistributionNotFound: - dist.announce('WARNING: The wheel package is not available.', log.WARN) - # Ignore environment markers; if supplied, it is required. - req = strip_marker(req) - # Take easy_install options into account, but do not override relevant - # pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll - # take precedence. - opts = dist.get_option_dict('easy_install') - if 'allow_hosts' in opts: - raise DistutilsError('the `allow-hosts` option is not supported ' - 'when using pip to install requirements.') - if 'PIP_QUIET' in os.environ or 'PIP_VERBOSE' in os.environ: - quiet = False - else: - quiet = True - if 'PIP_INDEX_URL' in os.environ: - index_url = None - elif 'index_url' in opts: - index_url = opts['index_url'][1] - else: - index_url = None - if 'find_links' in opts: - find_links = _fixup_find_links(opts['find_links'][1])[:] - else: - find_links = [] - if dist.dependency_links: - find_links.extend(dist.dependency_links) - eggs_dir = os.path.realpath(dist.get_egg_cache_dir()) - environment = pkg_resources.Environment() - for egg_dist in pkg_resources.find_distributions(eggs_dir): - if egg_dist in req and environment.can_add(egg_dist): - return egg_dist - with TemporaryDirectory() as tmpdir: - cmd = [ - sys.executable, '-m', 'pip', - '--disable-pip-version-check', - 'wheel', '--no-deps', - '-w', tmpdir, - ] - if quiet: - cmd.append('--quiet') - if index_url is not None: - cmd.extend(('--index-url', index_url)) - if find_links is not None: - for link in find_links: - cmd.extend(('--find-links', link)) - # If requirement is a PEP 508 direct URL, directly pass - # the URL to pip, as `req @ url` does not work on the - # command line. - if req.url: - cmd.append(req.url) - else: - cmd.append(str(req)) - try: - subprocess.check_call(cmd) - except subprocess.CalledProcessError as e: - raise DistutilsError(str(e)) - wheel = Wheel(glob.glob(os.path.join(tmpdir, '*.whl'))[0]) - dist_location = os.path.join(eggs_dir, wheel.egg_name()) - wheel.install_as_egg(dist_location) - dist_metadata = pkg_resources.PathMetadata( - dist_location, os.path.join(dist_location, 'EGG-INFO')) - dist = pkg_resources.Distribution.from_filename( - dist_location, metadata=dist_metadata) - return dist - - -def strip_marker(req): - """ - Return a new requirement without the environment marker to avoid - calling pip with something like `babel; extra == "i18n"`, which - would always be ignored. - """ - # create a copy to avoid mutating the input - req = pkg_resources.Requirement.parse(str(req)) - req.marker = None - return req diff --git a/venv/lib/python3.8/site-packages/setuptools/launch.py b/venv/lib/python3.8/site-packages/setuptools/launch.py deleted file mode 100644 index 308283ea939ed9bced7b099eb8a1879aa9c203d4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/launch.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Launch the Python script on the command line after -setuptools is bootstrapped via import. -""" - -# Note that setuptools gets imported implicitly by the -# invocation of this script using python -m setuptools.launch - -import tokenize -import sys - - -def run(): - """ - Run the script in sys.argv[1] as if it had - been invoked naturally. - """ - __builtins__ - script_name = sys.argv[1] - namespace = dict( - __file__=script_name, - __name__='__main__', - __doc__=None, - ) - sys.argv[:] = sys.argv[1:] - - open_ = getattr(tokenize, 'open', open) - script = open_(script_name).read() - norm_script = script.replace('\\r\\n', '\\n') - code = compile(norm_script, script_name, 'exec') - exec(code, namespace) - - -if __name__ == '__main__': - run() diff --git a/venv/lib/python3.8/site-packages/setuptools/lib2to3_ex.py b/venv/lib/python3.8/site-packages/setuptools/lib2to3_ex.py deleted file mode 100644 index 4b1a73feb26fdad65bafdeb21f5ce6abfb905fc0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/lib2to3_ex.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -Customized Mixin2to3 support: - - - adds support for converting doctests - - -This module raises an ImportError on Python 2. -""" - -from distutils.util import Mixin2to3 as _Mixin2to3 -from distutils import log -from lib2to3.refactor import RefactoringTool, get_fixers_from_package - -import setuptools - - -class DistutilsRefactoringTool(RefactoringTool): - def log_error(self, msg, *args, **kw): - log.error(msg, *args) - - def log_message(self, msg, *args): - log.info(msg, *args) - - def log_debug(self, msg, *args): - log.debug(msg, *args) - - -class Mixin2to3(_Mixin2to3): - def run_2to3(self, files, doctests=False): - # See of the distribution option has been set, otherwise check the - # setuptools default. - if self.distribution.use_2to3 is not True: - return - if not files: - return - log.info("Fixing " + " ".join(files)) - self.__build_fixer_names() - self.__exclude_fixers() - if doctests: - if setuptools.run_2to3_on_doctests: - r = DistutilsRefactoringTool(self.fixer_names) - r.refactor(files, write=True, doctests_only=True) - else: - _Mixin2to3.run_2to3(self, files) - - def __build_fixer_names(self): - if self.fixer_names: - return - self.fixer_names = [] - for p in setuptools.lib2to3_fixer_packages: - self.fixer_names.extend(get_fixers_from_package(p)) - if self.distribution.use_2to3_fixers is not None: - for p in self.distribution.use_2to3_fixers: - self.fixer_names.extend(get_fixers_from_package(p)) - - def __exclude_fixers(self): - excluded_fixers = getattr(self, 'exclude_fixers', []) - if self.distribution.use_2to3_exclude_fixers is not None: - excluded_fixers.extend(self.distribution.use_2to3_exclude_fixers) - for fixer_name in excluded_fixers: - if fixer_name in self.fixer_names: - self.fixer_names.remove(fixer_name) diff --git a/venv/lib/python3.8/site-packages/setuptools/monkey.py b/venv/lib/python3.8/site-packages/setuptools/monkey.py deleted file mode 100644 index 3c77f8cf27f0ab1e71d64cfc114ef9d1bf72295c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/monkey.py +++ /dev/null @@ -1,179 +0,0 @@ -""" -Monkey patching of distutils. -""" - -import sys -import distutils.filelist -import platform -import types -import functools -from importlib import import_module -import inspect - -from setuptools.extern import six - -import setuptools - -__all__ = [] -""" -Everything is private. Contact the project team -if you think you need this functionality. -""" - - -def _get_mro(cls): - """ - Returns the bases classes for cls sorted by the MRO. - - Works around an issue on Jython where inspect.getmro will not return all - base classes if multiple classes share the same name. Instead, this - function will return a tuple containing the class itself, and the contents - of cls.__bases__. See https://github.com/pypa/setuptools/issues/1024. - """ - if platform.python_implementation() == "Jython": - return (cls,) + cls.__bases__ - return inspect.getmro(cls) - - -def get_unpatched(item): - lookup = ( - get_unpatched_class if isinstance(item, six.class_types) else - get_unpatched_function if isinstance(item, types.FunctionType) else - lambda item: None - ) - return lookup(item) - - -def get_unpatched_class(cls): - """Protect against re-patching the distutils if reloaded - - Also ensures that no other distutils extension monkeypatched the distutils - first. - """ - external_bases = ( - cls - for cls in _get_mro(cls) - if not cls.__module__.startswith('setuptools') - ) - base = next(external_bases) - if not base.__module__.startswith('distutils'): - msg = "distutils has already been patched by %r" % cls - raise AssertionError(msg) - return base - - -def patch_all(): - # we can't patch distutils.cmd, alas - distutils.core.Command = setuptools.Command - - has_issue_12885 = sys.version_info <= (3, 5, 3) - - if has_issue_12885: - # fix findall bug in distutils (http://bugs.python.org/issue12885) - distutils.filelist.findall = setuptools.findall - - needs_warehouse = ( - sys.version_info < (2, 7, 13) - or - (3, 4) < sys.version_info < (3, 4, 6) - or - (3, 5) < sys.version_info <= (3, 5, 3) - ) - - if needs_warehouse: - warehouse = 'https://upload.pypi.org/legacy/' - distutils.config.PyPIRCCommand.DEFAULT_REPOSITORY = warehouse - - _patch_distribution_metadata() - - # Install Distribution throughout the distutils - for module in distutils.dist, distutils.core, distutils.cmd: - module.Distribution = setuptools.dist.Distribution - - # Install the patched Extension - distutils.core.Extension = setuptools.extension.Extension - distutils.extension.Extension = setuptools.extension.Extension - if 'distutils.command.build_ext' in sys.modules: - sys.modules['distutils.command.build_ext'].Extension = ( - setuptools.extension.Extension - ) - - patch_for_msvc_specialized_compiler() - - -def _patch_distribution_metadata(): - """Patch write_pkg_file and read_pkg_file for higher metadata standards""" - for attr in ('write_pkg_file', 'read_pkg_file', 'get_metadata_version'): - new_val = getattr(setuptools.dist, attr) - setattr(distutils.dist.DistributionMetadata, attr, new_val) - - -def patch_func(replacement, target_mod, func_name): - """ - Patch func_name in target_mod with replacement - - Important - original must be resolved by name to avoid - patching an already patched function. - """ - original = getattr(target_mod, func_name) - - # set the 'unpatched' attribute on the replacement to - # point to the original. - vars(replacement).setdefault('unpatched', original) - - # replace the function in the original module - setattr(target_mod, func_name, replacement) - - -def get_unpatched_function(candidate): - return getattr(candidate, 'unpatched') - - -def patch_for_msvc_specialized_compiler(): - """ - Patch functions in distutils to use standalone Microsoft Visual C++ - compilers. - """ - # import late to avoid circular imports on Python < 3.5 - msvc = import_module('setuptools.msvc') - - if platform.system() != 'Windows': - # Compilers only availables on Microsoft Windows - return - - def patch_params(mod_name, func_name): - """ - Prepare the parameters for patch_func to patch indicated function. - """ - repl_prefix = 'msvc9_' if 'msvc9' in mod_name else 'msvc14_' - repl_name = repl_prefix + func_name.lstrip('_') - repl = getattr(msvc, repl_name) - mod = import_module(mod_name) - if not hasattr(mod, func_name): - raise ImportError(func_name) - return repl, mod, func_name - - # Python 2.7 to 3.4 - msvc9 = functools.partial(patch_params, 'distutils.msvc9compiler') - - # Python 3.5+ - msvc14 = functools.partial(patch_params, 'distutils._msvccompiler') - - try: - # Patch distutils.msvc9compiler - patch_func(*msvc9('find_vcvarsall')) - patch_func(*msvc9('query_vcvarsall')) - except ImportError: - pass - - try: - # Patch distutils._msvccompiler._get_vc_env - patch_func(*msvc14('_get_vc_env')) - except ImportError: - pass - - try: - # Patch distutils._msvccompiler.gen_lib_options for Numpy - patch_func(*msvc14('gen_lib_options')) - except ImportError: - pass diff --git a/venv/lib/python3.8/site-packages/setuptools/msvc.py b/venv/lib/python3.8/site-packages/setuptools/msvc.py deleted file mode 100644 index 2ffe1c81ee629c98246e9e72bf630431fa7905b6..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/msvc.py +++ /dev/null @@ -1,1679 +0,0 @@ -""" -Improved support for Microsoft Visual C++ compilers. - -Known supported compilers: --------------------------- -Microsoft Visual C++ 9.0: - Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64) - Microsoft Windows SDK 6.1 (x86, x64, ia64) - Microsoft Windows SDK 7.0 (x86, x64, ia64) - -Microsoft Visual C++ 10.0: - Microsoft Windows SDK 7.1 (x86, x64, ia64) - -Microsoft Visual C++ 14.X: - Microsoft Visual C++ Build Tools 2015 (x86, x64, arm) - Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64) - Microsoft Visual Studio Build Tools 2019 (x86, x64, arm, arm64) - -This may also support compilers shipped with compatible Visual Studio versions. -""" - -import json -from io import open -from os import listdir, pathsep -from os.path import join, isfile, isdir, dirname -import sys -import platform -import itertools -import distutils.errors -from setuptools.extern.packaging.version import LegacyVersion - -from setuptools.extern.six.moves import filterfalse - -from .monkey import get_unpatched - -if platform.system() == 'Windows': - from setuptools.extern.six.moves import winreg - from os import environ -else: - # Mock winreg and environ so the module can be imported on this platform. - - class winreg: - HKEY_USERS = None - HKEY_CURRENT_USER = None - HKEY_LOCAL_MACHINE = None - HKEY_CLASSES_ROOT = None - - environ = dict() - -_msvc9_suppress_errors = ( - # msvc9compiler isn't available on some platforms - ImportError, - - # msvc9compiler raises DistutilsPlatformError in some - # environments. See #1118. - distutils.errors.DistutilsPlatformError, -) - -try: - from distutils.msvc9compiler import Reg -except _msvc9_suppress_errors: - pass - - -def msvc9_find_vcvarsall(version): - """ - Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone - compiler build for Python - (VCForPython / Microsoft Visual C++ Compiler for Python 2.7). - - Fall back to original behavior when the standalone compiler is not - available. - - Redirect the path of "vcvarsall.bat". - - Parameters - ---------- - version: float - Required Microsoft Visual C++ version. - - Return - ------ - str - vcvarsall.bat path - """ - vc_base = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' - key = vc_base % ('', version) - try: - # Per-user installs register the compiler path here - productdir = Reg.get_value(key, "installdir") - except KeyError: - try: - # All-user installs on a 64-bit system register here - key = vc_base % ('Wow6432Node\\', version) - productdir = Reg.get_value(key, "installdir") - except KeyError: - productdir = None - - if productdir: - vcvarsall = join(productdir, "vcvarsall.bat") - if isfile(vcvarsall): - return vcvarsall - - return get_unpatched(msvc9_find_vcvarsall)(version) - - -def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): - """ - Patched "distutils.msvc9compiler.query_vcvarsall" for support extra - Microsoft Visual C++ 9.0 and 10.0 compilers. - - Set environment without use of "vcvarsall.bat". - - Parameters - ---------- - ver: float - Required Microsoft Visual C++ version. - arch: str - Target architecture. - - Return - ------ - dict - environment - """ - # Try to get environment from vcvarsall.bat (Classical way) - try: - orig = get_unpatched(msvc9_query_vcvarsall) - return orig(ver, arch, *args, **kwargs) - except distutils.errors.DistutilsPlatformError: - # Pass error if Vcvarsall.bat is missing - pass - except ValueError: - # Pass error if environment not set after executing vcvarsall.bat - pass - - # If error, try to set environment directly - try: - return EnvironmentInfo(arch, ver).return_env() - except distutils.errors.DistutilsPlatformError as exc: - _augment_exception(exc, ver, arch) - raise - - -def msvc14_get_vc_env(plat_spec): - """ - Patched "distutils._msvccompiler._get_vc_env" for support extra - Microsoft Visual C++ 14.X compilers. - - Set environment without use of "vcvarsall.bat". - - Parameters - ---------- - plat_spec: str - Target architecture. - - Return - ------ - dict - environment - """ - # Try to get environment from vcvarsall.bat (Classical way) - try: - return get_unpatched(msvc14_get_vc_env)(plat_spec) - except distutils.errors.DistutilsPlatformError: - # Pass error Vcvarsall.bat is missing - pass - - # If error, try to set environment directly - try: - return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env() - except distutils.errors.DistutilsPlatformError as exc: - _augment_exception(exc, 14.0) - raise - - -def msvc14_gen_lib_options(*args, **kwargs): - """ - Patched "distutils._msvccompiler.gen_lib_options" for fix - compatibility between "numpy.distutils" and "distutils._msvccompiler" - (for Numpy < 1.11.2) - """ - if "numpy.distutils" in sys.modules: - import numpy as np - if LegacyVersion(np.__version__) < LegacyVersion('1.11.2'): - return np.distutils.ccompiler.gen_lib_options(*args, **kwargs) - return get_unpatched(msvc14_gen_lib_options)(*args, **kwargs) - - -def _augment_exception(exc, version, arch=''): - """ - Add details to the exception message to help guide the user - as to what action will resolve it. - """ - # Error if MSVC++ directory not found or environment not set - message = exc.args[0] - - if "vcvarsall" in message.lower() or "visual c" in message.lower(): - # Special error message if MSVC++ not installed - tmpl = 'Microsoft Visual C++ {version:0.1f} is required.' - message = tmpl.format(**locals()) - msdownload = 'www.microsoft.com/download/details.aspx?id=%d' - if version == 9.0: - if arch.lower().find('ia64') > -1: - # For VC++ 9.0, if IA64 support is needed, redirect user - # to Windows SDK 7.0. - # Note: No download link available from Microsoft. - message += ' Get it with "Microsoft Windows SDK 7.0"' - else: - # For VC++ 9.0 redirect user to Vc++ for Python 2.7 : - # This redirection link is maintained by Microsoft. - # Contact vspython@microsoft.com if it needs updating. - message += ' Get it from http://aka.ms/vcpython27' - elif version == 10.0: - # For VC++ 10.0 Redirect user to Windows SDK 7.1 - message += ' Get it with "Microsoft Windows SDK 7.1": ' - message += msdownload % 8279 - elif version >= 14.0: - # For VC++ 14.X Redirect user to latest Visual C++ Build Tools - message += (' Get it with "Build Tools for Visual Studio": ' - r'https://visualstudio.microsoft.com/downloads/') - - exc.args = (message, ) - - -class PlatformInfo: - """ - Current and Target Architectures information. - - Parameters - ---------- - arch: str - Target architecture. - """ - current_cpu = environ.get('processor_architecture', '').lower() - - def __init__(self, arch): - self.arch = arch.lower().replace('x64', 'amd64') - - @property - def target_cpu(self): - """ - Return Target CPU architecture. - - Return - ------ - str - Target CPU - """ - return self.arch[self.arch.find('_') + 1:] - - def target_is_x86(self): - """ - Return True if target CPU is x86 32 bits.. - - Return - ------ - bool - CPU is x86 32 bits - """ - return self.target_cpu == 'x86' - - def current_is_x86(self): - """ - Return True if current CPU is x86 32 bits.. - - Return - ------ - bool - CPU is x86 32 bits - """ - return self.current_cpu == 'x86' - - def current_dir(self, hidex86=False, x64=False): - """ - Current platform specific subfolder. - - Parameters - ---------- - hidex86: bool - return '' and not '\x86' if architecture is x86. - x64: bool - return '\x64' and not '\amd64' if architecture is amd64. - - Return - ------ - str - subfolder: '\target', or '' (see hidex86 parameter) - """ - return ( - '' if (self.current_cpu == 'x86' and hidex86) else - r'\x64' if (self.current_cpu == 'amd64' and x64) else - r'\%s' % self.current_cpu - ) - - def target_dir(self, hidex86=False, x64=False): - r""" - Target platform specific subfolder. - - Parameters - ---------- - hidex86: bool - return '' and not '\x86' if architecture is x86. - x64: bool - return '\x64' and not '\amd64' if architecture is amd64. - - Return - ------ - str - subfolder: '\current', or '' (see hidex86 parameter) - """ - return ( - '' if (self.target_cpu == 'x86' and hidex86) else - r'\x64' if (self.target_cpu == 'amd64' and x64) else - r'\%s' % self.target_cpu - ) - - def cross_dir(self, forcex86=False): - r""" - Cross platform specific subfolder. - - Parameters - ---------- - forcex86: bool - Use 'x86' as current architecture even if current architecture is - not x86. - - Return - ------ - str - subfolder: '' if target architecture is current architecture, - '\current_target' if not. - """ - current = 'x86' if forcex86 else self.current_cpu - return ( - '' if self.target_cpu == current else - self.target_dir().replace('\\', '\\%s_' % current) - ) - - -class RegistryInfo: - """ - Microsoft Visual Studio related registry information. - - Parameters - ---------- - platform_info: PlatformInfo - "PlatformInfo" instance. - """ - HKEYS = (winreg.HKEY_USERS, - winreg.HKEY_CURRENT_USER, - winreg.HKEY_LOCAL_MACHINE, - winreg.HKEY_CLASSES_ROOT) - - def __init__(self, platform_info): - self.pi = platform_info - - @property - def visualstudio(self): - """ - Microsoft Visual Studio root registry key. - - Return - ------ - str - Registry key - """ - return 'VisualStudio' - - @property - def sxs(self): - """ - Microsoft Visual Studio SxS registry key. - - Return - ------ - str - Registry key - """ - return join(self.visualstudio, 'SxS') - - @property - def vc(self): - """ - Microsoft Visual C++ VC7 registry key. - - Return - ------ - str - Registry key - """ - return join(self.sxs, 'VC7') - - @property - def vs(self): - """ - Microsoft Visual Studio VS7 registry key. - - Return - ------ - str - Registry key - """ - return join(self.sxs, 'VS7') - - @property - def vc_for_python(self): - """ - Microsoft Visual C++ for Python registry key. - - Return - ------ - str - Registry key - """ - return r'DevDiv\VCForPython' - - @property - def microsoft_sdk(self): - """ - Microsoft SDK registry key. - - Return - ------ - str - Registry key - """ - return 'Microsoft SDKs' - - @property - def windows_sdk(self): - """ - Microsoft Windows/Platform SDK registry key. - - Return - ------ - str - Registry key - """ - return join(self.microsoft_sdk, 'Windows') - - @property - def netfx_sdk(self): - """ - Microsoft .NET Framework SDK registry key. - - Return - ------ - str - Registry key - """ - return join(self.microsoft_sdk, 'NETFXSDK') - - @property - def windows_kits_roots(self): - """ - Microsoft Windows Kits Roots registry key. - - Return - ------ - str - Registry key - """ - return r'Windows Kits\Installed Roots' - - def microsoft(self, key, x86=False): - """ - Return key in Microsoft software registry. - - Parameters - ---------- - key: str - Registry key path where look. - x86: str - Force x86 software registry. - - Return - ------ - str - Registry key - """ - node64 = '' if self.pi.current_is_x86() or x86 else 'Wow6432Node' - return join('Software', node64, 'Microsoft', key) - - def lookup(self, key, name): - """ - Look for values in registry in Microsoft software registry. - - Parameters - ---------- - key: str - Registry key path where look. - name: str - Value name to find. - - Return - ------ - str - value - """ - key_read = winreg.KEY_READ - openkey = winreg.OpenKey - ms = self.microsoft - for hkey in self.HKEYS: - try: - bkey = openkey(hkey, ms(key), 0, key_read) - except (OSError, IOError): - if not self.pi.current_is_x86(): - try: - bkey = openkey(hkey, ms(key, True), 0, key_read) - except (OSError, IOError): - continue - else: - continue - try: - return winreg.QueryValueEx(bkey, name)[0] - except (OSError, IOError): - pass - - -class SystemInfo: - """ - Microsoft Windows and Visual Studio related system information. - - Parameters - ---------- - registry_info: RegistryInfo - "RegistryInfo" instance. - vc_ver: float - Required Microsoft Visual C++ version. - """ - - # Variables and properties in this class use originals CamelCase variables - # names from Microsoft source files for more easy comparison. - WinDir = environ.get('WinDir', '') - ProgramFiles = environ.get('ProgramFiles', '') - ProgramFilesx86 = environ.get('ProgramFiles(x86)', ProgramFiles) - - def __init__(self, registry_info, vc_ver=None): - self.ri = registry_info - self.pi = self.ri.pi - - self.known_vs_paths = self.find_programdata_vs_vers() - - # Except for VS15+, VC version is aligned with VS version - self.vs_ver = self.vc_ver = ( - vc_ver or self._find_latest_available_vs_ver()) - - def _find_latest_available_vs_ver(self): - """ - Find the latest VC version - - Return - ------ - float - version - """ - reg_vc_vers = self.find_reg_vs_vers() - - if not (reg_vc_vers or self.known_vs_paths): - raise distutils.errors.DistutilsPlatformError( - 'No Microsoft Visual C++ version found') - - vc_vers = set(reg_vc_vers) - vc_vers.update(self.known_vs_paths) - return sorted(vc_vers)[-1] - - def find_reg_vs_vers(self): - """ - Find Microsoft Visual Studio versions available in registry. - - Return - ------ - list of float - Versions - """ - ms = self.ri.microsoft - vckeys = (self.ri.vc, self.ri.vc_for_python, self.ri.vs) - vs_vers = [] - for hkey in self.ri.HKEYS: - for key in vckeys: - try: - bkey = winreg.OpenKey(hkey, ms(key), 0, winreg.KEY_READ) - except (OSError, IOError): - continue - subkeys, values, _ = winreg.QueryInfoKey(bkey) - for i in range(values): - try: - ver = float(winreg.EnumValue(bkey, i)[0]) - if ver not in vs_vers: - vs_vers.append(ver) - except ValueError: - pass - for i in range(subkeys): - try: - ver = float(winreg.EnumKey(bkey, i)) - if ver not in vs_vers: - vs_vers.append(ver) - except ValueError: - pass - return sorted(vs_vers) - - def find_programdata_vs_vers(self): - r""" - Find Visual studio 2017+ versions from information in - "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances". - - Return - ------ - dict - float version as key, path as value. - """ - vs_versions = {} - instances_dir = \ - r'C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances' - - try: - hashed_names = listdir(instances_dir) - - except (OSError, IOError): - # Directory not exists with all Visual Studio versions - return vs_versions - - for name in hashed_names: - try: - # Get VS installation path from "state.json" file - state_path = join(instances_dir, name, 'state.json') - with open(state_path, 'rt', encoding='utf-8') as state_file: - state = json.load(state_file) - vs_path = state['installationPath'] - - # Raises OSError if this VS installation does not contain VC - listdir(join(vs_path, r'VC\Tools\MSVC')) - - # Store version and path - vs_versions[self._as_float_version( - state['installationVersion'])] = vs_path - - except (OSError, IOError, KeyError): - # Skip if "state.json" file is missing or bad format - continue - - return vs_versions - - @staticmethod - def _as_float_version(version): - """ - Return a string version as a simplified float version (major.minor) - - Parameters - ---------- - version: str - Version. - - Return - ------ - float - version - """ - return float('.'.join(version.split('.')[:2])) - - @property - def VSInstallDir(self): - """ - Microsoft Visual Studio directory. - - Return - ------ - str - path - """ - # Default path - default = join(self.ProgramFilesx86, - 'Microsoft Visual Studio %0.1f' % self.vs_ver) - - # Try to get path from registry, if fail use default path - return self.ri.lookup(self.ri.vs, '%0.1f' % self.vs_ver) or default - - @property - def VCInstallDir(self): - """ - Microsoft Visual C++ directory. - - Return - ------ - str - path - """ - path = self._guess_vc() or self._guess_vc_legacy() - - if not isdir(path): - msg = 'Microsoft Visual C++ directory not found' - raise distutils.errors.DistutilsPlatformError(msg) - - return path - - def _guess_vc(self): - """ - Locate Visual C++ for VS2017+. - - Return - ------ - str - path - """ - if self.vs_ver <= 14.0: - return '' - - try: - # First search in known VS paths - vs_dir = self.known_vs_paths[self.vs_ver] - except KeyError: - # Else, search with path from registry - vs_dir = self.VSInstallDir - - guess_vc = join(vs_dir, r'VC\Tools\MSVC') - - # Subdir with VC exact version as name - try: - # Update the VC version with real one instead of VS version - vc_ver = listdir(guess_vc)[-1] - self.vc_ver = self._as_float_version(vc_ver) - return join(guess_vc, vc_ver) - except (OSError, IOError, IndexError): - return '' - - def _guess_vc_legacy(self): - """ - Locate Visual C++ for versions prior to 2017. - - Return - ------ - str - path - """ - default = join(self.ProgramFilesx86, - r'Microsoft Visual Studio %0.1f\VC' % self.vs_ver) - - # Try to get "VC++ for Python" path from registry as default path - reg_path = join(self.ri.vc_for_python, '%0.1f' % self.vs_ver) - python_vc = self.ri.lookup(reg_path, 'installdir') - default_vc = join(python_vc, 'VC') if python_vc else default - - # Try to get path from registry, if fail use default path - return self.ri.lookup(self.ri.vc, '%0.1f' % self.vs_ver) or default_vc - - @property - def WindowsSdkVersion(self): - """ - Microsoft Windows SDK versions for specified MSVC++ version. - - Return - ------ - tuple of str - versions - """ - if self.vs_ver <= 9.0: - return '7.0', '6.1', '6.0a' - elif self.vs_ver == 10.0: - return '7.1', '7.0a' - elif self.vs_ver == 11.0: - return '8.0', '8.0a' - elif self.vs_ver == 12.0: - return '8.1', '8.1a' - elif self.vs_ver >= 14.0: - return '10.0', '8.1' - - @property - def WindowsSdkLastVersion(self): - """ - Microsoft Windows SDK last version. - - Return - ------ - str - version - """ - return self._use_last_dir_name(join(self.WindowsSdkDir, 'lib')) - - @property - def WindowsSdkDir(self): - """ - Microsoft Windows SDK directory. - - Return - ------ - str - path - """ - sdkdir = '' - for ver in self.WindowsSdkVersion: - # Try to get it from registry - loc = join(self.ri.windows_sdk, 'v%s' % ver) - sdkdir = self.ri.lookup(loc, 'installationfolder') - if sdkdir: - break - if not sdkdir or not isdir(sdkdir): - # Try to get "VC++ for Python" version from registry - path = join(self.ri.vc_for_python, '%0.1f' % self.vc_ver) - install_base = self.ri.lookup(path, 'installdir') - if install_base: - sdkdir = join(install_base, 'WinSDK') - if not sdkdir or not isdir(sdkdir): - # If fail, use default new path - for ver in self.WindowsSdkVersion: - intver = ver[:ver.rfind('.')] - path = r'Microsoft SDKs\Windows Kits\%s' % intver - d = join(self.ProgramFiles, path) - if isdir(d): - sdkdir = d - if not sdkdir or not isdir(sdkdir): - # If fail, use default old path - for ver in self.WindowsSdkVersion: - path = r'Microsoft SDKs\Windows\v%s' % ver - d = join(self.ProgramFiles, path) - if isdir(d): - sdkdir = d - if not sdkdir: - # If fail, use Platform SDK - sdkdir = join(self.VCInstallDir, 'PlatformSDK') - return sdkdir - - @property - def WindowsSDKExecutablePath(self): - """ - Microsoft Windows SDK executable directory. - - Return - ------ - str - path - """ - # Find WinSDK NetFx Tools registry dir name - if self.vs_ver <= 11.0: - netfxver = 35 - arch = '' - else: - netfxver = 40 - hidex86 = True if self.vs_ver <= 12.0 else False - arch = self.pi.current_dir(x64=True, hidex86=hidex86) - fx = 'WinSDK-NetFx%dTools%s' % (netfxver, arch.replace('\\', '-')) - - # list all possibles registry paths - regpaths = [] - if self.vs_ver >= 14.0: - for ver in self.NetFxSdkVersion: - regpaths += [join(self.ri.netfx_sdk, ver, fx)] - - for ver in self.WindowsSdkVersion: - regpaths += [join(self.ri.windows_sdk, 'v%sA' % ver, fx)] - - # Return installation folder from the more recent path - for path in regpaths: - execpath = self.ri.lookup(path, 'installationfolder') - if execpath: - return execpath - - @property - def FSharpInstallDir(self): - """ - Microsoft Visual F# directory. - - Return - ------ - str - path - """ - path = join(self.ri.visualstudio, r'%0.1f\Setup\F#' % self.vs_ver) - return self.ri.lookup(path, 'productdir') or '' - - @property - def UniversalCRTSdkDir(self): - """ - Microsoft Universal CRT SDK directory. - - Return - ------ - str - path - """ - # Set Kit Roots versions for specified MSVC++ version - vers = ('10', '81') if self.vs_ver >= 14.0 else () - - # Find path of the more recent Kit - for ver in vers: - sdkdir = self.ri.lookup(self.ri.windows_kits_roots, - 'kitsroot%s' % ver) - if sdkdir: - return sdkdir or '' - - @property - def UniversalCRTSdkLastVersion(self): - """ - Microsoft Universal C Runtime SDK last version. - - Return - ------ - str - version - """ - return self._use_last_dir_name(join(self.UniversalCRTSdkDir, 'lib')) - - @property - def NetFxSdkVersion(self): - """ - Microsoft .NET Framework SDK versions. - - Return - ------ - tuple of str - versions - """ - # Set FxSdk versions for specified VS version - return (('4.7.2', '4.7.1', '4.7', - '4.6.2', '4.6.1', '4.6', - '4.5.2', '4.5.1', '4.5') - if self.vs_ver >= 14.0 else ()) - - @property - def NetFxSdkDir(self): - """ - Microsoft .NET Framework SDK directory. - - Return - ------ - str - path - """ - sdkdir = '' - for ver in self.NetFxSdkVersion: - loc = join(self.ri.netfx_sdk, ver) - sdkdir = self.ri.lookup(loc, 'kitsinstallationfolder') - if sdkdir: - break - return sdkdir - - @property - def FrameworkDir32(self): - """ - Microsoft .NET Framework 32bit directory. - - Return - ------ - str - path - """ - # Default path - guess_fw = join(self.WinDir, r'Microsoft.NET\Framework') - - # Try to get path from registry, if fail use default path - return self.ri.lookup(self.ri.vc, 'frameworkdir32') or guess_fw - - @property - def FrameworkDir64(self): - """ - Microsoft .NET Framework 64bit directory. - - Return - ------ - str - path - """ - # Default path - guess_fw = join(self.WinDir, r'Microsoft.NET\Framework64') - - # Try to get path from registry, if fail use default path - return self.ri.lookup(self.ri.vc, 'frameworkdir64') or guess_fw - - @property - def FrameworkVersion32(self): - """ - Microsoft .NET Framework 32bit versions. - - Return - ------ - tuple of str - versions - """ - return self._find_dot_net_versions(32) - - @property - def FrameworkVersion64(self): - """ - Microsoft .NET Framework 64bit versions. - - Return - ------ - tuple of str - versions - """ - return self._find_dot_net_versions(64) - - def _find_dot_net_versions(self, bits): - """ - Find Microsoft .NET Framework versions. - - Parameters - ---------- - bits: int - Platform number of bits: 32 or 64. - - Return - ------ - tuple of str - versions - """ - # Find actual .NET version in registry - reg_ver = self.ri.lookup(self.ri.vc, 'frameworkver%d' % bits) - dot_net_dir = getattr(self, 'FrameworkDir%d' % bits) - ver = reg_ver or self._use_last_dir_name(dot_net_dir, 'v') or '' - - # Set .NET versions for specified MSVC++ version - if self.vs_ver >= 12.0: - return ver, 'v4.0' - elif self.vs_ver >= 10.0: - return 'v4.0.30319' if ver.lower()[:2] != 'v4' else ver, 'v3.5' - elif self.vs_ver == 9.0: - return 'v3.5', 'v2.0.50727' - elif self.vs_ver == 8.0: - return 'v3.0', 'v2.0.50727' - - @staticmethod - def _use_last_dir_name(path, prefix=''): - """ - Return name of the last dir in path or '' if no dir found. - - Parameters - ---------- - path: str - Use dirs in this path - prefix: str - Use only dirs starting by this prefix - - Return - ------ - str - name - """ - matching_dirs = ( - dir_name - for dir_name in reversed(listdir(path)) - if isdir(join(path, dir_name)) and - dir_name.startswith(prefix) - ) - return next(matching_dirs, None) or '' - - -class EnvironmentInfo: - """ - Return environment variables for specified Microsoft Visual C++ version - and platform : Lib, Include, Path and libpath. - - This function is compatible with Microsoft Visual C++ 9.0 to 14.X. - - Script created by analysing Microsoft environment configuration files like - "vcvars[...].bat", "SetEnv.Cmd", "vcbuildtools.bat", ... - - Parameters - ---------- - arch: str - Target architecture. - vc_ver: float - Required Microsoft Visual C++ version. If not set, autodetect the last - version. - vc_min_ver: float - Minimum Microsoft Visual C++ version. - """ - - # Variables and properties in this class use originals CamelCase variables - # names from Microsoft source files for more easy comparison. - - def __init__(self, arch, vc_ver=None, vc_min_ver=0): - self.pi = PlatformInfo(arch) - self.ri = RegistryInfo(self.pi) - self.si = SystemInfo(self.ri, vc_ver) - - if self.vc_ver < vc_min_ver: - err = 'No suitable Microsoft Visual C++ version found' - raise distutils.errors.DistutilsPlatformError(err) - - @property - def vs_ver(self): - """ - Microsoft Visual Studio. - - Return - ------ - float - version - """ - return self.si.vs_ver - - @property - def vc_ver(self): - """ - Microsoft Visual C++ version. - - Return - ------ - float - version - """ - return self.si.vc_ver - - @property - def VSTools(self): - """ - Microsoft Visual Studio Tools. - - Return - ------ - list of str - paths - """ - paths = [r'Common7\IDE', r'Common7\Tools'] - - if self.vs_ver >= 14.0: - arch_subdir = self.pi.current_dir(hidex86=True, x64=True) - paths += [r'Common7\IDE\CommonExtensions\Microsoft\TestWindow'] - paths += [r'Team Tools\Performance Tools'] - paths += [r'Team Tools\Performance Tools%s' % arch_subdir] - - return [join(self.si.VSInstallDir, path) for path in paths] - - @property - def VCIncludes(self): - """ - Microsoft Visual C++ & Microsoft Foundation Class Includes. - - Return - ------ - list of str - paths - """ - return [join(self.si.VCInstallDir, 'Include'), - join(self.si.VCInstallDir, r'ATLMFC\Include')] - - @property - def VCLibraries(self): - """ - Microsoft Visual C++ & Microsoft Foundation Class Libraries. - - Return - ------ - list of str - paths - """ - if self.vs_ver >= 15.0: - arch_subdir = self.pi.target_dir(x64=True) - else: - arch_subdir = self.pi.target_dir(hidex86=True) - paths = ['Lib%s' % arch_subdir, r'ATLMFC\Lib%s' % arch_subdir] - - if self.vs_ver >= 14.0: - paths += [r'Lib\store%s' % arch_subdir] - - return [join(self.si.VCInstallDir, path) for path in paths] - - @property - def VCStoreRefs(self): - """ - Microsoft Visual C++ store references Libraries. - - Return - ------ - list of str - paths - """ - if self.vs_ver < 14.0: - return [] - return [join(self.si.VCInstallDir, r'Lib\store\references')] - - @property - def VCTools(self): - """ - Microsoft Visual C++ Tools. - - Return - ------ - list of str - paths - """ - si = self.si - tools = [join(si.VCInstallDir, 'VCPackages')] - - forcex86 = True if self.vs_ver <= 10.0 else False - arch_subdir = self.pi.cross_dir(forcex86) - if arch_subdir: - tools += [join(si.VCInstallDir, 'Bin%s' % arch_subdir)] - - if self.vs_ver == 14.0: - path = 'Bin%s' % self.pi.current_dir(hidex86=True) - tools += [join(si.VCInstallDir, path)] - - elif self.vs_ver >= 15.0: - host_dir = (r'bin\HostX86%s' if self.pi.current_is_x86() else - r'bin\HostX64%s') - tools += [join( - si.VCInstallDir, host_dir % self.pi.target_dir(x64=True))] - - if self.pi.current_cpu != self.pi.target_cpu: - tools += [join( - si.VCInstallDir, host_dir % self.pi.current_dir(x64=True))] - - else: - tools += [join(si.VCInstallDir, 'Bin')] - - return tools - - @property - def OSLibraries(self): - """ - Microsoft Windows SDK Libraries. - - Return - ------ - list of str - paths - """ - if self.vs_ver <= 10.0: - arch_subdir = self.pi.target_dir(hidex86=True, x64=True) - return [join(self.si.WindowsSdkDir, 'Lib%s' % arch_subdir)] - - else: - arch_subdir = self.pi.target_dir(x64=True) - lib = join(self.si.WindowsSdkDir, 'lib') - libver = self._sdk_subdir - return [join(lib, '%sum%s' % (libver , arch_subdir))] - - @property - def OSIncludes(self): - """ - Microsoft Windows SDK Include. - - Return - ------ - list of str - paths - """ - include = join(self.si.WindowsSdkDir, 'include') - - if self.vs_ver <= 10.0: - return [include, join(include, 'gl')] - - else: - if self.vs_ver >= 14.0: - sdkver = self._sdk_subdir - else: - sdkver = '' - return [join(include, '%sshared' % sdkver), - join(include, '%sum' % sdkver), - join(include, '%swinrt' % sdkver)] - - @property - def OSLibpath(self): - """ - Microsoft Windows SDK Libraries Paths. - - Return - ------ - list of str - paths - """ - ref = join(self.si.WindowsSdkDir, 'References') - libpath = [] - - if self.vs_ver <= 9.0: - libpath += self.OSLibraries - - if self.vs_ver >= 11.0: - libpath += [join(ref, r'CommonConfiguration\Neutral')] - - if self.vs_ver >= 14.0: - libpath += [ - ref, - join(self.si.WindowsSdkDir, 'UnionMetadata'), - join(ref, 'Windows.Foundation.UniversalApiContract', '1.0.0.0'), - join(ref, 'Windows.Foundation.FoundationContract', '1.0.0.0'), - join(ref,'Windows.Networking.Connectivity.WwanContract', - '1.0.0.0'), - join(self.si.WindowsSdkDir, 'ExtensionSDKs', 'Microsoft.VCLibs', - '%0.1f' % self.vs_ver, 'References', 'CommonConfiguration', - 'neutral'), - ] - return libpath - - @property - def SdkTools(self): - """ - Microsoft Windows SDK Tools. - - Return - ------ - list of str - paths - """ - return list(self._sdk_tools()) - - def _sdk_tools(self): - """ - Microsoft Windows SDK Tools paths generator. - - Return - ------ - generator of str - paths - """ - if self.vs_ver < 15.0: - bin_dir = 'Bin' if self.vs_ver <= 11.0 else r'Bin\x86' - yield join(self.si.WindowsSdkDir, bin_dir) - - if not self.pi.current_is_x86(): - arch_subdir = self.pi.current_dir(x64=True) - path = 'Bin%s' % arch_subdir - yield join(self.si.WindowsSdkDir, path) - - if self.vs_ver in (10.0, 11.0): - if self.pi.target_is_x86(): - arch_subdir = '' - else: - arch_subdir = self.pi.current_dir(hidex86=True, x64=True) - path = r'Bin\NETFX 4.0 Tools%s' % arch_subdir - yield join(self.si.WindowsSdkDir, path) - - elif self.vs_ver >= 15.0: - path = join(self.si.WindowsSdkDir, 'Bin') - arch_subdir = self.pi.current_dir(x64=True) - sdkver = self.si.WindowsSdkLastVersion - yield join(path, '%s%s' % (sdkver, arch_subdir)) - - if self.si.WindowsSDKExecutablePath: - yield self.si.WindowsSDKExecutablePath - - @property - def _sdk_subdir(self): - """ - Microsoft Windows SDK version subdir. - - Return - ------ - str - subdir - """ - ucrtver = self.si.WindowsSdkLastVersion - return ('%s\\' % ucrtver) if ucrtver else '' - - @property - def SdkSetup(self): - """ - Microsoft Windows SDK Setup. - - Return - ------ - list of str - paths - """ - if self.vs_ver > 9.0: - return [] - - return [join(self.si.WindowsSdkDir, 'Setup')] - - @property - def FxTools(self): - """ - Microsoft .NET Framework Tools. - - Return - ------ - list of str - paths - """ - pi = self.pi - si = self.si - - if self.vs_ver <= 10.0: - include32 = True - include64 = not pi.target_is_x86() and not pi.current_is_x86() - else: - include32 = pi.target_is_x86() or pi.current_is_x86() - include64 = pi.current_cpu == 'amd64' or pi.target_cpu == 'amd64' - - tools = [] - if include32: - tools += [join(si.FrameworkDir32, ver) - for ver in si.FrameworkVersion32] - if include64: - tools += [join(si.FrameworkDir64, ver) - for ver in si.FrameworkVersion64] - return tools - - @property - def NetFxSDKLibraries(self): - """ - Microsoft .Net Framework SDK Libraries. - - Return - ------ - list of str - paths - """ - if self.vs_ver < 14.0 or not self.si.NetFxSdkDir: - return [] - - arch_subdir = self.pi.target_dir(x64=True) - return [join(self.si.NetFxSdkDir, r'lib\um%s' % arch_subdir)] - - @property - def NetFxSDKIncludes(self): - """ - Microsoft .Net Framework SDK Includes. - - Return - ------ - list of str - paths - """ - if self.vs_ver < 14.0 or not self.si.NetFxSdkDir: - return [] - - return [join(self.si.NetFxSdkDir, r'include\um')] - - @property - def VsTDb(self): - """ - Microsoft Visual Studio Team System Database. - - Return - ------ - list of str - paths - """ - return [join(self.si.VSInstallDir, r'VSTSDB\Deploy')] - - @property - def MSBuild(self): - """ - Microsoft Build Engine. - - Return - ------ - list of str - paths - """ - if self.vs_ver < 12.0: - return [] - elif self.vs_ver < 15.0: - base_path = self.si.ProgramFilesx86 - arch_subdir = self.pi.current_dir(hidex86=True) - else: - base_path = self.si.VSInstallDir - arch_subdir = '' - - path = r'MSBuild\%0.1f\bin%s' % (self.vs_ver, arch_subdir) - build = [join(base_path, path)] - - if self.vs_ver >= 15.0: - # Add Roslyn C# & Visual Basic Compiler - build += [join(base_path, path, 'Roslyn')] - - return build - - @property - def HTMLHelpWorkshop(self): - """ - Microsoft HTML Help Workshop. - - Return - ------ - list of str - paths - """ - if self.vs_ver < 11.0: - return [] - - return [join(self.si.ProgramFilesx86, 'HTML Help Workshop')] - - @property - def UCRTLibraries(self): - """ - Microsoft Universal C Runtime SDK Libraries. - - Return - ------ - list of str - paths - """ - if self.vs_ver < 14.0: - return [] - - arch_subdir = self.pi.target_dir(x64=True) - lib = join(self.si.UniversalCRTSdkDir, 'lib') - ucrtver = self._ucrt_subdir - return [join(lib, '%sucrt%s' % (ucrtver, arch_subdir))] - - @property - def UCRTIncludes(self): - """ - Microsoft Universal C Runtime SDK Include. - - Return - ------ - list of str - paths - """ - if self.vs_ver < 14.0: - return [] - - include = join(self.si.UniversalCRTSdkDir, 'include') - return [join(include, '%sucrt' % self._ucrt_subdir)] - - @property - def _ucrt_subdir(self): - """ - Microsoft Universal C Runtime SDK version subdir. - - Return - ------ - str - subdir - """ - ucrtver = self.si.UniversalCRTSdkLastVersion - return ('%s\\' % ucrtver) if ucrtver else '' - - @property - def FSharp(self): - """ - Microsoft Visual F#. - - Return - ------ - list of str - paths - """ - if 11.0 > self.vs_ver > 12.0: - return [] - - return [self.si.FSharpInstallDir] - - @property - def VCRuntimeRedist(self): - """ - Microsoft Visual C++ runtime redistributable dll. - - Return - ------ - str - path - """ - vcruntime = 'vcruntime%d0.dll' % self.vc_ver - arch_subdir = self.pi.target_dir(x64=True).strip('\\') - - # Installation prefixes candidates - prefixes = [] - tools_path = self.si.VCInstallDir - redist_path = dirname(tools_path.replace(r'\Tools', r'\Redist')) - if isdir(redist_path): - # Redist version may not be exactly the same as tools - redist_path = join(redist_path, listdir(redist_path)[-1]) - prefixes += [redist_path, join(redist_path, 'onecore')] - - prefixes += [join(tools_path, 'redist')] # VS14 legacy path - - # CRT directory - crt_dirs = ('Microsoft.VC%d.CRT' % (self.vc_ver * 10), - # Sometime store in directory with VS version instead of VC - 'Microsoft.VC%d.CRT' % (int(self.vs_ver) * 10)) - - # vcruntime path - for prefix, crt_dir in itertools.product(prefixes, crt_dirs): - path = join(prefix, arch_subdir, crt_dir, vcruntime) - if isfile(path): - return path - - def return_env(self, exists=True): - """ - Return environment dict. - - Parameters - ---------- - exists: bool - It True, only return existing paths. - - Return - ------ - dict - environment - """ - env = dict( - include=self._build_paths('include', - [self.VCIncludes, - self.OSIncludes, - self.UCRTIncludes, - self.NetFxSDKIncludes], - exists), - lib=self._build_paths('lib', - [self.VCLibraries, - self.OSLibraries, - self.FxTools, - self.UCRTLibraries, - self.NetFxSDKLibraries], - exists), - libpath=self._build_paths('libpath', - [self.VCLibraries, - self.FxTools, - self.VCStoreRefs, - self.OSLibpath], - exists), - path=self._build_paths('path', - [self.VCTools, - self.VSTools, - self.VsTDb, - self.SdkTools, - self.SdkSetup, - self.FxTools, - self.MSBuild, - self.HTMLHelpWorkshop, - self.FSharp], - exists), - ) - if self.vs_ver >= 14 and isfile(self.VCRuntimeRedist): - env['py_vcruntime_redist'] = self.VCRuntimeRedist - return env - - def _build_paths(self, name, spec_path_lists, exists): - """ - Given an environment variable name and specified paths, - return a pathsep-separated string of paths containing - unique, extant, directories from those paths and from - the environment variable. Raise an error if no paths - are resolved. - - Parameters - ---------- - name: str - Environment variable name - spec_path_lists: list of str - Paths - exists: bool - It True, only return existing paths. - - Return - ------ - str - Pathsep-separated paths - """ - # flatten spec_path_lists - spec_paths = itertools.chain.from_iterable(spec_path_lists) - env_paths = environ.get(name, '').split(pathsep) - paths = itertools.chain(spec_paths, env_paths) - extant_paths = list(filter(isdir, paths)) if exists else paths - if not extant_paths: - msg = "%s environment variable is empty" % name.upper() - raise distutils.errors.DistutilsPlatformError(msg) - unique_paths = self._unique_everseen(extant_paths) - return pathsep.join(unique_paths) - - # from Python docs - @staticmethod - def _unique_everseen(iterable, key=None): - """ - List unique elements, preserving order. - Remember all elements ever seen. - - _unique_everseen('AAAABBBCCDAABBB') --> A B C D - - _unique_everseen('ABBCcAD', str.lower) --> A B C D - """ - seen = set() - seen_add = seen.add - if key is None: - for element in filterfalse(seen.__contains__, iterable): - seen_add(element) - yield element - else: - for element in iterable: - k = key(element) - if k not in seen: - seen_add(k) - yield element diff --git a/venv/lib/python3.8/site-packages/setuptools/namespaces.py b/venv/lib/python3.8/site-packages/setuptools/namespaces.py deleted file mode 100644 index dc16106d3dc7048a160129745756bbc9b1fb51d9..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/namespaces.py +++ /dev/null @@ -1,107 +0,0 @@ -import os -from distutils import log -import itertools - -from setuptools.extern.six.moves import map - - -flatten = itertools.chain.from_iterable - - -class Installer: - - nspkg_ext = '-nspkg.pth' - - def install_namespaces(self): - nsp = self._get_all_ns_packages() - if not nsp: - return - filename, ext = os.path.splitext(self._get_target()) - filename += self.nspkg_ext - self.outputs.append(filename) - log.info("Installing %s", filename) - lines = map(self._gen_nspkg_line, nsp) - - if self.dry_run: - # always generate the lines, even in dry run - list(lines) - return - - with open(filename, 'wt') as f: - f.writelines(lines) - - def uninstall_namespaces(self): - filename, ext = os.path.splitext(self._get_target()) - filename += self.nspkg_ext - if not os.path.exists(filename): - return - log.info("Removing %s", filename) - os.remove(filename) - - def _get_target(self): - return self.target - - _nspkg_tmpl = ( - "import sys, types, os", - "has_mfs = sys.version_info > (3, 5)", - "p = os.path.join(%(root)s, *%(pth)r)", - "importlib = has_mfs and __import__('importlib.util')", - "has_mfs and __import__('importlib.machinery')", - "m = has_mfs and " - "sys.modules.setdefault(%(pkg)r, " - "importlib.util.module_from_spec(" - "importlib.machinery.PathFinder.find_spec(%(pkg)r, " - "[os.path.dirname(p)])))", - "m = m or " - "sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))", - "mp = (m or []) and m.__dict__.setdefault('__path__',[])", - "(p not in mp) and mp.append(p)", - ) - "lines for the namespace installer" - - _nspkg_tmpl_multi = ( - 'm and setattr(sys.modules[%(parent)r], %(child)r, m)', - ) - "additional line(s) when a parent package is indicated" - - def _get_root(self): - return "sys._getframe(1).f_locals['sitedir']" - - def _gen_nspkg_line(self, pkg): - # ensure pkg is not a unicode string under Python 2.7 - pkg = str(pkg) - pth = tuple(pkg.split('.')) - root = self._get_root() - tmpl_lines = self._nspkg_tmpl - parent, sep, child = pkg.rpartition('.') - if parent: - tmpl_lines += self._nspkg_tmpl_multi - return ';'.join(tmpl_lines) % locals() + '\n' - - def _get_all_ns_packages(self): - """Return sorted list of all package namespaces""" - pkgs = self.distribution.namespace_packages or [] - return sorted(flatten(map(self._pkg_names, pkgs))) - - @staticmethod - def _pkg_names(pkg): - """ - Given a namespace package, yield the components of that - package. - - >>> names = Installer._pkg_names('a.b.c') - >>> set(names) == set(['a', 'a.b', 'a.b.c']) - True - """ - parts = pkg.split('.') - while parts: - yield '.'.join(parts) - parts.pop() - - -class DevelopInstaller(Installer): - def _get_root(self): - return repr(str(self.egg_path)) - - def _get_target(self): - return self.egg_link diff --git a/venv/lib/python3.8/site-packages/setuptools/package_index.py b/venv/lib/python3.8/site-packages/setuptools/package_index.py deleted file mode 100644 index 9a2da9d5aca817555b919e7b09e9a2535cb9c1fd..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/package_index.py +++ /dev/null @@ -1,1136 +0,0 @@ -"""PyPI and direct package downloading""" -import sys -import os -import re -import shutil -import socket -import base64 -import hashlib -import itertools -import warnings -from functools import wraps - -from setuptools.extern import six -from setuptools.extern.six.moves import urllib, http_client, configparser, map - -import setuptools -from pkg_resources import ( - CHECKOUT_DIST, Distribution, BINARY_DIST, normalize_path, SOURCE_DIST, - Environment, find_distributions, safe_name, safe_version, - to_filename, Requirement, DEVELOP_DIST, EGG_DIST, -) -from setuptools import ssl_support -from distutils import log -from distutils.errors import DistutilsError -from fnmatch import translate -from setuptools.py27compat import get_all_headers -from setuptools.py33compat import unescape -from setuptools.wheel import Wheel - -__metaclass__ = type - -EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$') -HREF = re.compile(r"""href\s*=\s*['"]?([^'"> ]+)""", re.I) -PYPI_MD5 = re.compile( - r'([^<]+)\n\s+\(md5\)' -) -URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):', re.I).match -EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split() - -__all__ = [ - 'PackageIndex', 'distros_for_url', 'parse_bdist_wininst', - 'interpret_distro_name', -] - -_SOCKET_TIMEOUT = 15 - -_tmpl = "setuptools/{setuptools.__version__} Python-urllib/{py_major}" -user_agent = _tmpl.format(py_major='{}.{}'.format(*sys.version_info), setuptools=setuptools) - - -def parse_requirement_arg(spec): - try: - return Requirement.parse(spec) - except ValueError: - raise DistutilsError( - "Not a URL, existing file, or requirement spec: %r" % (spec,) - ) - - -def parse_bdist_wininst(name): - """Return (base,pyversion) or (None,None) for possible .exe name""" - - lower = name.lower() - base, py_ver, plat = None, None, None - - if lower.endswith('.exe'): - if lower.endswith('.win32.exe'): - base = name[:-10] - plat = 'win32' - elif lower.startswith('.win32-py', -16): - py_ver = name[-7:-4] - base = name[:-16] - plat = 'win32' - elif lower.endswith('.win-amd64.exe'): - base = name[:-14] - plat = 'win-amd64' - elif lower.startswith('.win-amd64-py', -20): - py_ver = name[-7:-4] - base = name[:-20] - plat = 'win-amd64' - return base, py_ver, plat - - -def egg_info_for_url(url): - parts = urllib.parse.urlparse(url) - scheme, server, path, parameters, query, fragment = parts - base = urllib.parse.unquote(path.split('/')[-1]) - if server == 'sourceforge.net' and base == 'download': # XXX Yuck - base = urllib.parse.unquote(path.split('/')[-2]) - if '#' in base: - base, fragment = base.split('#', 1) - return base, fragment - - -def distros_for_url(url, metadata=None): - """Yield egg or source distribution objects that might be found at a URL""" - base, fragment = egg_info_for_url(url) - for dist in distros_for_location(url, base, metadata): - yield dist - if fragment: - match = EGG_FRAGMENT.match(fragment) - if match: - for dist in interpret_distro_name( - url, match.group(1), metadata, precedence=CHECKOUT_DIST - ): - yield dist - - -def distros_for_location(location, basename, metadata=None): - """Yield egg or source distribution objects based on basename""" - if basename.endswith('.egg.zip'): - basename = basename[:-4] # strip the .zip - if basename.endswith('.egg') and '-' in basename: - # only one, unambiguous interpretation - return [Distribution.from_location(location, basename, metadata)] - if basename.endswith('.whl') and '-' in basename: - wheel = Wheel(basename) - if not wheel.is_compatible(): - return [] - return [Distribution( - location=location, - project_name=wheel.project_name, - version=wheel.version, - # Increase priority over eggs. - precedence=EGG_DIST + 1, - )] - if basename.endswith('.exe'): - win_base, py_ver, platform = parse_bdist_wininst(basename) - if win_base is not None: - return interpret_distro_name( - location, win_base, metadata, py_ver, BINARY_DIST, platform - ) - # Try source distro extensions (.zip, .tgz, etc.) - # - for ext in EXTENSIONS: - if basename.endswith(ext): - basename = basename[:-len(ext)] - return interpret_distro_name(location, basename, metadata) - return [] # no extension matched - - -def distros_for_filename(filename, metadata=None): - """Yield possible egg or source distribution objects based on a filename""" - return distros_for_location( - normalize_path(filename), os.path.basename(filename), metadata - ) - - -def interpret_distro_name( - location, basename, metadata, py_version=None, precedence=SOURCE_DIST, - platform=None -): - """Generate alternative interpretations of a source distro name - - Note: if `location` is a filesystem filename, you should call - ``pkg_resources.normalize_path()`` on it before passing it to this - routine! - """ - # Generate alternative interpretations of a source distro name - # Because some packages are ambiguous as to name/versions split - # e.g. "adns-python-1.1.0", "egenix-mx-commercial", etc. - # So, we generate each possible interepretation (e.g. "adns, python-1.1.0" - # "adns-python, 1.1.0", and "adns-python-1.1.0, no version"). In practice, - # the spurious interpretations should be ignored, because in the event - # there's also an "adns" package, the spurious "python-1.1.0" version will - # compare lower than any numeric version number, and is therefore unlikely - # to match a request for it. It's still a potential problem, though, and - # in the long run PyPI and the distutils should go for "safe" names and - # versions in distribution archive names (sdist and bdist). - - parts = basename.split('-') - if not py_version and any(re.match(r'py\d\.\d$', p) for p in parts[2:]): - # it is a bdist_dumb, not an sdist -- bail out - return - - for p in range(1, len(parts) + 1): - yield Distribution( - location, metadata, '-'.join(parts[:p]), '-'.join(parts[p:]), - py_version=py_version, precedence=precedence, - platform=platform - ) - - -# From Python 2.7 docs -def unique_everseen(iterable, key=None): - "List unique elements, preserving order. Remember all elements ever seen." - # unique_everseen('AAAABBBCCDAABBB') --> A B C D - # unique_everseen('ABBCcAD', str.lower) --> A B C D - seen = set() - seen_add = seen.add - if key is None: - for element in six.moves.filterfalse(seen.__contains__, iterable): - seen_add(element) - yield element - else: - for element in iterable: - k = key(element) - if k not in seen: - seen_add(k) - yield element - - -def unique_values(func): - """ - Wrap a function returning an iterable such that the resulting iterable - only ever yields unique items. - """ - - @wraps(func) - def wrapper(*args, **kwargs): - return unique_everseen(func(*args, **kwargs)) - - return wrapper - - -REL = re.compile(r"""<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>""", re.I) -# this line is here to fix emacs' cruddy broken syntax highlighting - - -@unique_values -def find_external_links(url, page): - """Find rel="homepage" and rel="download" links in `page`, yielding URLs""" - - for match in REL.finditer(page): - tag, rel = match.groups() - rels = set(map(str.strip, rel.lower().split(','))) - if 'homepage' in rels or 'download' in rels: - for match in HREF.finditer(tag): - yield urllib.parse.urljoin(url, htmldecode(match.group(1))) - - for tag in ("Home Page", "Download URL"): - pos = page.find(tag) - if pos != -1: - match = HREF.search(page, pos) - if match: - yield urllib.parse.urljoin(url, htmldecode(match.group(1))) - - -class ContentChecker: - """ - A null content checker that defines the interface for checking content - """ - - def feed(self, block): - """ - Feed a block of data to the hash. - """ - return - - def is_valid(self): - """ - Check the hash. Return False if validation fails. - """ - return True - - def report(self, reporter, template): - """ - Call reporter with information about the checker (hash name) - substituted into the template. - """ - return - - -class HashChecker(ContentChecker): - pattern = re.compile( - r'(?Psha1|sha224|sha384|sha256|sha512|md5)=' - r'(?P[a-f0-9]+)' - ) - - def __init__(self, hash_name, expected): - self.hash_name = hash_name - self.hash = hashlib.new(hash_name) - self.expected = expected - - @classmethod - def from_url(cls, url): - "Construct a (possibly null) ContentChecker from a URL" - fragment = urllib.parse.urlparse(url)[-1] - if not fragment: - return ContentChecker() - match = cls.pattern.search(fragment) - if not match: - return ContentChecker() - return cls(**match.groupdict()) - - def feed(self, block): - self.hash.update(block) - - def is_valid(self): - return self.hash.hexdigest() == self.expected - - def report(self, reporter, template): - msg = template % self.hash_name - return reporter(msg) - - -class PackageIndex(Environment): - """A distribution index that scans web pages for download URLs""" - - def __init__( - self, index_url="https://pypi.org/simple/", hosts=('*',), - ca_bundle=None, verify_ssl=True, *args, **kw - ): - Environment.__init__(self, *args, **kw) - self.index_url = index_url + "/" [:not index_url.endswith('/')] - self.scanned_urls = {} - self.fetched_urls = {} - self.package_pages = {} - self.allows = re.compile('|'.join(map(translate, hosts))).match - self.to_scan = [] - use_ssl = ( - verify_ssl - and ssl_support.is_available - and (ca_bundle or ssl_support.find_ca_bundle()) - ) - if use_ssl: - self.opener = ssl_support.opener_for(ca_bundle) - else: - self.opener = urllib.request.urlopen - - def process_url(self, url, retrieve=False): - """Evaluate a URL as a possible download, and maybe retrieve it""" - if url in self.scanned_urls and not retrieve: - return - self.scanned_urls[url] = True - if not URL_SCHEME(url): - self.process_filename(url) - return - else: - dists = list(distros_for_url(url)) - if dists: - if not self.url_ok(url): - return - self.debug("Found link: %s", url) - - if dists or not retrieve or url in self.fetched_urls: - list(map(self.add, dists)) - return # don't need the actual page - - if not self.url_ok(url): - self.fetched_urls[url] = True - return - - self.info("Reading %s", url) - self.fetched_urls[url] = True # prevent multiple fetch attempts - tmpl = "Download error on %s: %%s -- Some packages may not be found!" - f = self.open_url(url, tmpl % url) - if f is None: - return - self.fetched_urls[f.url] = True - if 'html' not in f.headers.get('content-type', '').lower(): - f.close() # not html, we can't process it - return - - base = f.url # handle redirects - page = f.read() - if not isinstance(page, str): - # In Python 3 and got bytes but want str. - if isinstance(f, urllib.error.HTTPError): - # Errors have no charset, assume latin1: - charset = 'latin-1' - else: - charset = f.headers.get_param('charset') or 'latin-1' - page = page.decode(charset, "ignore") - f.close() - for match in HREF.finditer(page): - link = urllib.parse.urljoin(base, htmldecode(match.group(1))) - self.process_url(link) - if url.startswith(self.index_url) and getattr(f, 'code', None) != 404: - page = self.process_index(url, page) - - def process_filename(self, fn, nested=False): - # process filenames or directories - if not os.path.exists(fn): - self.warn("Not found: %s", fn) - return - - if os.path.isdir(fn) and not nested: - path = os.path.realpath(fn) - for item in os.listdir(path): - self.process_filename(os.path.join(path, item), True) - - dists = distros_for_filename(fn) - if dists: - self.debug("Found: %s", fn) - list(map(self.add, dists)) - - def url_ok(self, url, fatal=False): - s = URL_SCHEME(url) - is_file = s and s.group(1).lower() == 'file' - if is_file or self.allows(urllib.parse.urlparse(url)[1]): - return True - msg = ( - "\nNote: Bypassing %s (disallowed host; see " - "http://bit.ly/2hrImnY for details).\n") - if fatal: - raise DistutilsError(msg % url) - else: - self.warn(msg, url) - - def scan_egg_links(self, search_path): - dirs = filter(os.path.isdir, search_path) - egg_links = ( - (path, entry) - for path in dirs - for entry in os.listdir(path) - if entry.endswith('.egg-link') - ) - list(itertools.starmap(self.scan_egg_link, egg_links)) - - def scan_egg_link(self, path, entry): - with open(os.path.join(path, entry)) as raw_lines: - # filter non-empty lines - lines = list(filter(None, map(str.strip, raw_lines))) - - if len(lines) != 2: - # format is not recognized; punt - return - - egg_path, setup_path = lines - - for dist in find_distributions(os.path.join(path, egg_path)): - dist.location = os.path.join(path, *lines) - dist.precedence = SOURCE_DIST - self.add(dist) - - def process_index(self, url, page): - """Process the contents of a PyPI page""" - - def scan(link): - # Process a URL to see if it's for a package page - if link.startswith(self.index_url): - parts = list(map( - urllib.parse.unquote, link[len(self.index_url):].split('/') - )) - if len(parts) == 2 and '#' not in parts[1]: - # it's a package page, sanitize and index it - pkg = safe_name(parts[0]) - ver = safe_version(parts[1]) - self.package_pages.setdefault(pkg.lower(), {})[link] = True - return to_filename(pkg), to_filename(ver) - return None, None - - # process an index page into the package-page index - for match in HREF.finditer(page): - try: - scan(urllib.parse.urljoin(url, htmldecode(match.group(1)))) - except ValueError: - pass - - pkg, ver = scan(url) # ensure this page is in the page index - if pkg: - # process individual package page - for new_url in find_external_links(url, page): - # Process the found URL - base, frag = egg_info_for_url(new_url) - if base.endswith('.py') and not frag: - if ver: - new_url += '#egg=%s-%s' % (pkg, ver) - else: - self.need_version_info(url) - self.scan_url(new_url) - - return PYPI_MD5.sub( - lambda m: '%s' % m.group(1, 3, 2), page - ) - else: - return "" # no sense double-scanning non-package pages - - def need_version_info(self, url): - self.scan_all( - "Page at %s links to .py file(s) without version info; an index " - "scan is required.", url - ) - - def scan_all(self, msg=None, *args): - if self.index_url not in self.fetched_urls: - if msg: - self.warn(msg, *args) - self.info( - "Scanning index of all packages (this may take a while)" - ) - self.scan_url(self.index_url) - - def find_packages(self, requirement): - self.scan_url(self.index_url + requirement.unsafe_name + '/') - - if not self.package_pages.get(requirement.key): - # Fall back to safe version of the name - self.scan_url(self.index_url + requirement.project_name + '/') - - if not self.package_pages.get(requirement.key): - # We couldn't find the target package, so search the index page too - self.not_found_in_index(requirement) - - for url in list(self.package_pages.get(requirement.key, ())): - # scan each page that might be related to the desired package - self.scan_url(url) - - def obtain(self, requirement, installer=None): - self.prescan() - self.find_packages(requirement) - for dist in self[requirement.key]: - if dist in requirement: - return dist - self.debug("%s does not match %s", requirement, dist) - return super(PackageIndex, self).obtain(requirement, installer) - - def check_hash(self, checker, filename, tfp): - """ - checker is a ContentChecker - """ - checker.report( - self.debug, - "Validating %%s checksum for %s" % filename) - if not checker.is_valid(): - tfp.close() - os.unlink(filename) - raise DistutilsError( - "%s validation failed for %s; " - "possible download problem?" - % (checker.hash.name, os.path.basename(filename)) - ) - - def add_find_links(self, urls): - """Add `urls` to the list that will be prescanned for searches""" - for url in urls: - if ( - self.to_scan is None # if we have already "gone online" - or not URL_SCHEME(url) # or it's a local file/directory - or url.startswith('file:') - or list(distros_for_url(url)) # or a direct package link - ): - # then go ahead and process it now - self.scan_url(url) - else: - # otherwise, defer retrieval till later - self.to_scan.append(url) - - def prescan(self): - """Scan urls scheduled for prescanning (e.g. --find-links)""" - if self.to_scan: - list(map(self.scan_url, self.to_scan)) - self.to_scan = None # from now on, go ahead and process immediately - - def not_found_in_index(self, requirement): - if self[requirement.key]: # we've seen at least one distro - meth, msg = self.info, "Couldn't retrieve index page for %r" - else: # no distros seen for this name, might be misspelled - meth, msg = ( - self.warn, - "Couldn't find index page for %r (maybe misspelled?)") - meth(msg, requirement.unsafe_name) - self.scan_all() - - def download(self, spec, tmpdir): - """Locate and/or download `spec` to `tmpdir`, returning a local path - - `spec` may be a ``Requirement`` object, or a string containing a URL, - an existing local filename, or a project/version requirement spec - (i.e. the string form of a ``Requirement`` object). If it is the URL - of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one - that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is - automatically created alongside the downloaded file. - - If `spec` is a ``Requirement`` object or a string containing a - project/version requirement spec, this method returns the location of - a matching distribution (possibly after downloading it to `tmpdir`). - If `spec` is a locally existing file or directory name, it is simply - returned unchanged. If `spec` is a URL, it is downloaded to a subpath - of `tmpdir`, and the local filename is returned. Various errors may be - raised if a problem occurs during downloading. - """ - if not isinstance(spec, Requirement): - scheme = URL_SCHEME(spec) - if scheme: - # It's a url, download it to tmpdir - found = self._download_url(scheme.group(1), spec, tmpdir) - base, fragment = egg_info_for_url(spec) - if base.endswith('.py'): - found = self.gen_setup(found, fragment, tmpdir) - return found - elif os.path.exists(spec): - # Existing file or directory, just return it - return spec - else: - spec = parse_requirement_arg(spec) - return getattr(self.fetch_distribution(spec, tmpdir), 'location', None) - - def fetch_distribution( - self, requirement, tmpdir, force_scan=False, source=False, - develop_ok=False, local_index=None): - """Obtain a distribution suitable for fulfilling `requirement` - - `requirement` must be a ``pkg_resources.Requirement`` instance. - If necessary, or if the `force_scan` flag is set, the requirement is - searched for in the (online) package index as well as the locally - installed packages. If a distribution matching `requirement` is found, - the returned distribution's ``location`` is the value you would have - gotten from calling the ``download()`` method with the matching - distribution's URL or filename. If no matching distribution is found, - ``None`` is returned. - - If the `source` flag is set, only source distributions and source - checkout links will be considered. Unless the `develop_ok` flag is - set, development and system eggs (i.e., those using the ``.egg-info`` - format) will be ignored. - """ - # process a Requirement - self.info("Searching for %s", requirement) - skipped = {} - dist = None - - def find(req, env=None): - if env is None: - env = self - # Find a matching distribution; may be called more than once - - for dist in env[req.key]: - - if dist.precedence == DEVELOP_DIST and not develop_ok: - if dist not in skipped: - self.warn( - "Skipping development or system egg: %s", dist, - ) - skipped[dist] = 1 - continue - - test = ( - dist in req - and (dist.precedence <= SOURCE_DIST or not source) - ) - if test: - loc = self.download(dist.location, tmpdir) - dist.download_location = loc - if os.path.exists(dist.download_location): - return dist - - if force_scan: - self.prescan() - self.find_packages(requirement) - dist = find(requirement) - - if not dist and local_index is not None: - dist = find(requirement, local_index) - - if dist is None: - if self.to_scan is not None: - self.prescan() - dist = find(requirement) - - if dist is None and not force_scan: - self.find_packages(requirement) - dist = find(requirement) - - if dist is None: - self.warn( - "No local packages or working download links found for %s%s", - (source and "a source distribution of " or ""), - requirement, - ) - else: - self.info("Best match: %s", dist) - return dist.clone(location=dist.download_location) - - def fetch(self, requirement, tmpdir, force_scan=False, source=False): - """Obtain a file suitable for fulfilling `requirement` - - DEPRECATED; use the ``fetch_distribution()`` method now instead. For - backward compatibility, this routine is identical but returns the - ``location`` of the downloaded distribution instead of a distribution - object. - """ - dist = self.fetch_distribution(requirement, tmpdir, force_scan, source) - if dist is not None: - return dist.location - return None - - def gen_setup(self, filename, fragment, tmpdir): - match = EGG_FRAGMENT.match(fragment) - dists = match and [ - d for d in - interpret_distro_name(filename, match.group(1), None) if d.version - ] or [] - - if len(dists) == 1: # unambiguous ``#egg`` fragment - basename = os.path.basename(filename) - - # Make sure the file has been downloaded to the temp dir. - if os.path.dirname(filename) != tmpdir: - dst = os.path.join(tmpdir, basename) - from setuptools.command.easy_install import samefile - if not samefile(filename, dst): - shutil.copy2(filename, dst) - filename = dst - - with open(os.path.join(tmpdir, 'setup.py'), 'w') as file: - file.write( - "from setuptools import setup\n" - "setup(name=%r, version=%r, py_modules=[%r])\n" - % ( - dists[0].project_name, dists[0].version, - os.path.splitext(basename)[0] - ) - ) - return filename - - elif match: - raise DistutilsError( - "Can't unambiguously interpret project/version identifier %r; " - "any dashes in the name or version should be escaped using " - "underscores. %r" % (fragment, dists) - ) - else: - raise DistutilsError( - "Can't process plain .py files without an '#egg=name-version'" - " suffix to enable automatic setup script generation." - ) - - dl_blocksize = 8192 - - def _download_to(self, url, filename): - self.info("Downloading %s", url) - # Download the file - fp = None - try: - checker = HashChecker.from_url(url) - fp = self.open_url(url) - if isinstance(fp, urllib.error.HTTPError): - raise DistutilsError( - "Can't download %s: %s %s" % (url, fp.code, fp.msg) - ) - headers = fp.info() - blocknum = 0 - bs = self.dl_blocksize - size = -1 - if "content-length" in headers: - # Some servers return multiple Content-Length headers :( - sizes = get_all_headers(headers, 'Content-Length') - size = max(map(int, sizes)) - self.reporthook(url, filename, blocknum, bs, size) - with open(filename, 'wb') as tfp: - while True: - block = fp.read(bs) - if block: - checker.feed(block) - tfp.write(block) - blocknum += 1 - self.reporthook(url, filename, blocknum, bs, size) - else: - break - self.check_hash(checker, filename, tfp) - return headers - finally: - if fp: - fp.close() - - def reporthook(self, url, filename, blocknum, blksize, size): - pass # no-op - - def open_url(self, url, warning=None): - if url.startswith('file:'): - return local_open(url) - try: - return open_with_auth(url, self.opener) - except (ValueError, http_client.InvalidURL) as v: - msg = ' '.join([str(arg) for arg in v.args]) - if warning: - self.warn(warning, msg) - else: - raise DistutilsError('%s %s' % (url, msg)) - except urllib.error.HTTPError as v: - return v - except urllib.error.URLError as v: - if warning: - self.warn(warning, v.reason) - else: - raise DistutilsError("Download error for %s: %s" - % (url, v.reason)) - except http_client.BadStatusLine as v: - if warning: - self.warn(warning, v.line) - else: - raise DistutilsError( - '%s returned a bad status line. The server might be ' - 'down, %s' % - (url, v.line) - ) - except (http_client.HTTPException, socket.error) as v: - if warning: - self.warn(warning, v) - else: - raise DistutilsError("Download error for %s: %s" - % (url, v)) - - def _download_url(self, scheme, url, tmpdir): - # Determine download filename - # - name, fragment = egg_info_for_url(url) - if name: - while '..' in name: - name = name.replace('..', '.').replace('\\', '_') - else: - name = "__downloaded__" # default if URL has no path contents - - if name.endswith('.egg.zip'): - name = name[:-4] # strip the extra .zip before download - - filename = os.path.join(tmpdir, name) - - # Download the file - # - if scheme == 'svn' or scheme.startswith('svn+'): - return self._download_svn(url, filename) - elif scheme == 'git' or scheme.startswith('git+'): - return self._download_git(url, filename) - elif scheme.startswith('hg+'): - return self._download_hg(url, filename) - elif scheme == 'file': - return urllib.request.url2pathname(urllib.parse.urlparse(url)[2]) - else: - self.url_ok(url, True) # raises error if not allowed - return self._attempt_download(url, filename) - - def scan_url(self, url): - self.process_url(url, True) - - def _attempt_download(self, url, filename): - headers = self._download_to(url, filename) - if 'html' in headers.get('content-type', '').lower(): - return self._download_html(url, headers, filename) - else: - return filename - - def _download_html(self, url, headers, filename): - file = open(filename) - for line in file: - if line.strip(): - # Check for a subversion index page - if re.search(r'([^- ]+ - )?Revision \d+:', line): - # it's a subversion index page: - file.close() - os.unlink(filename) - return self._download_svn(url, filename) - break # not an index page - file.close() - os.unlink(filename) - raise DistutilsError("Unexpected HTML page found at " + url) - - def _download_svn(self, url, filename): - warnings.warn("SVN download support is deprecated", UserWarning) - url = url.split('#', 1)[0] # remove any fragment for svn's sake - creds = '' - if url.lower().startswith('svn:') and '@' in url: - scheme, netloc, path, p, q, f = urllib.parse.urlparse(url) - if not netloc and path.startswith('//') and '/' in path[2:]: - netloc, path = path[2:].split('/', 1) - auth, host = _splituser(netloc) - if auth: - if ':' in auth: - user, pw = auth.split(':', 1) - creds = " --username=%s --password=%s" % (user, pw) - else: - creds = " --username=" + auth - netloc = host - parts = scheme, netloc, url, p, q, f - url = urllib.parse.urlunparse(parts) - self.info("Doing subversion checkout from %s to %s", url, filename) - os.system("svn checkout%s -q %s %s" % (creds, url, filename)) - return filename - - @staticmethod - def _vcs_split_rev_from_url(url, pop_prefix=False): - scheme, netloc, path, query, frag = urllib.parse.urlsplit(url) - - scheme = scheme.split('+', 1)[-1] - - # Some fragment identification fails - path = path.split('#', 1)[0] - - rev = None - if '@' in path: - path, rev = path.rsplit('@', 1) - - # Also, discard fragment - url = urllib.parse.urlunsplit((scheme, netloc, path, query, '')) - - return url, rev - - def _download_git(self, url, filename): - filename = filename.split('#', 1)[0] - url, rev = self._vcs_split_rev_from_url(url, pop_prefix=True) - - self.info("Doing git clone from %s to %s", url, filename) - os.system("git clone --quiet %s %s" % (url, filename)) - - if rev is not None: - self.info("Checking out %s", rev) - os.system("git -C %s checkout --quiet %s" % ( - filename, - rev, - )) - - return filename - - def _download_hg(self, url, filename): - filename = filename.split('#', 1)[0] - url, rev = self._vcs_split_rev_from_url(url, pop_prefix=True) - - self.info("Doing hg clone from %s to %s", url, filename) - os.system("hg clone --quiet %s %s" % (url, filename)) - - if rev is not None: - self.info("Updating to %s", rev) - os.system("hg --cwd %s up -C -r %s -q" % ( - filename, - rev, - )) - - return filename - - def debug(self, msg, *args): - log.debug(msg, *args) - - def info(self, msg, *args): - log.info(msg, *args) - - def warn(self, msg, *args): - log.warn(msg, *args) - - -# This pattern matches a character entity reference (a decimal numeric -# references, a hexadecimal numeric reference, or a named reference). -entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub - - -def decode_entity(match): - what = match.group(0) - return unescape(what) - - -def htmldecode(text): - """ - Decode HTML entities in the given text. - - >>> htmldecode( - ... 'https://../package_name-0.1.2.tar.gz' - ... '?tokena=A&tokenb=B">package_name-0.1.2.tar.gz') - 'https://../package_name-0.1.2.tar.gz?tokena=A&tokenb=B">package_name-0.1.2.tar.gz' - """ - return entity_sub(decode_entity, text) - - -def socket_timeout(timeout=15): - def _socket_timeout(func): - def _socket_timeout(*args, **kwargs): - old_timeout = socket.getdefaulttimeout() - socket.setdefaulttimeout(timeout) - try: - return func(*args, **kwargs) - finally: - socket.setdefaulttimeout(old_timeout) - - return _socket_timeout - - return _socket_timeout - - -def _encode_auth(auth): - """ - A function compatible with Python 2.3-3.3 that will encode - auth from a URL suitable for an HTTP header. - >>> str(_encode_auth('username%3Apassword')) - 'dXNlcm5hbWU6cGFzc3dvcmQ=' - - Long auth strings should not cause a newline to be inserted. - >>> long_auth = 'username:' + 'password'*10 - >>> chr(10) in str(_encode_auth(long_auth)) - False - """ - auth_s = urllib.parse.unquote(auth) - # convert to bytes - auth_bytes = auth_s.encode() - encoded_bytes = base64.b64encode(auth_bytes) - # convert back to a string - encoded = encoded_bytes.decode() - # strip the trailing carriage return - return encoded.replace('\n', '') - - -class Credential: - """ - A username/password pair. Use like a namedtuple. - """ - - def __init__(self, username, password): - self.username = username - self.password = password - - def __iter__(self): - yield self.username - yield self.password - - def __str__(self): - return '%(username)s:%(password)s' % vars(self) - - -class PyPIConfig(configparser.RawConfigParser): - def __init__(self): - """ - Load from ~/.pypirc - """ - defaults = dict.fromkeys(['username', 'password', 'repository'], '') - configparser.RawConfigParser.__init__(self, defaults) - - rc = os.path.join(os.path.expanduser('~'), '.pypirc') - if os.path.exists(rc): - self.read(rc) - - @property - def creds_by_repository(self): - sections_with_repositories = [ - section for section in self.sections() - if self.get(section, 'repository').strip() - ] - - return dict(map(self._get_repo_cred, sections_with_repositories)) - - def _get_repo_cred(self, section): - repo = self.get(section, 'repository').strip() - return repo, Credential( - self.get(section, 'username').strip(), - self.get(section, 'password').strip(), - ) - - def find_credential(self, url): - """ - If the URL indicated appears to be a repository defined in this - config, return the credential for that repository. - """ - for repository, cred in self.creds_by_repository.items(): - if url.startswith(repository): - return cred - - -def open_with_auth(url, opener=urllib.request.urlopen): - """Open a urllib2 request, handling HTTP authentication""" - - parsed = urllib.parse.urlparse(url) - scheme, netloc, path, params, query, frag = parsed - - # Double scheme does not raise on Mac OS X as revealed by a - # failing test. We would expect "nonnumeric port". Refs #20. - if netloc.endswith(':'): - raise http_client.InvalidURL("nonnumeric port: ''") - - if scheme in ('http', 'https'): - auth, address = _splituser(netloc) - else: - auth = None - - if not auth: - cred = PyPIConfig().find_credential(url) - if cred: - auth = str(cred) - info = cred.username, url - log.info('Authenticating as %s for %s (from .pypirc)', *info) - - if auth: - auth = "Basic " + _encode_auth(auth) - parts = scheme, address, path, params, query, frag - new_url = urllib.parse.urlunparse(parts) - request = urllib.request.Request(new_url) - request.add_header("Authorization", auth) - else: - request = urllib.request.Request(url) - - request.add_header('User-Agent', user_agent) - fp = opener(request) - - if auth: - # Put authentication info back into request URL if same host, - # so that links found on the page will work - s2, h2, path2, param2, query2, frag2 = urllib.parse.urlparse(fp.url) - if s2 == scheme and h2 == address: - parts = s2, netloc, path2, param2, query2, frag2 - fp.url = urllib.parse.urlunparse(parts) - - return fp - - -# copy of urllib.parse._splituser from Python 3.8 -def _splituser(host): - """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" - user, delim, host = host.rpartition('@') - return (user if delim else None), host - - -# adding a timeout to avoid freezing package_index -open_with_auth = socket_timeout(_SOCKET_TIMEOUT)(open_with_auth) - - -def fix_sf_url(url): - return url # backward compatibility - - -def local_open(url): - """Read a local path, with special support for directories""" - scheme, server, path, param, query, frag = urllib.parse.urlparse(url) - filename = urllib.request.url2pathname(path) - if os.path.isfile(filename): - return urllib.request.urlopen(url) - elif path.endswith('/') and os.path.isdir(filename): - files = [] - for f in os.listdir(filename): - filepath = os.path.join(filename, f) - if f == 'index.html': - with open(filepath, 'r') as fp: - body = fp.read() - break - elif os.path.isdir(filepath): - f += '/' - files.append('<a href="{name}">{name}</a>'.format(name=f)) - else: - tmpl = ( - "<html><head><title>{url}" - "{files}") - body = tmpl.format(url=url, files='\n'.join(files)) - status, message = 200, "OK" - else: - status, message, body = 404, "Path not found", "Not found" - - headers = {'content-type': 'text/html'} - body_stream = six.StringIO(body) - return urllib.error.HTTPError(url, status, message, headers, body_stream) diff --git a/venv/lib/python3.8/site-packages/setuptools/py27compat.py b/venv/lib/python3.8/site-packages/setuptools/py27compat.py deleted file mode 100644 index 1d57360f4eff13cd94a25fec989036a0b0b80523..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/py27compat.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -Compatibility Support for Python 2.7 and earlier -""" - -import sys -import platform - -from setuptools.extern import six - - -def get_all_headers(message, key): - """ - Given an HTTPMessage, return all headers matching a given key. - """ - return message.get_all(key) - - -if six.PY2: - def get_all_headers(message, key): - return message.getheaders(key) - - -linux_py2_ascii = ( - platform.system() == 'Linux' and - six.PY2 -) - -rmtree_safe = str if linux_py2_ascii else lambda x: x -"""Workaround for http://bugs.python.org/issue24672""" - - -try: - from ._imp import find_module, PY_COMPILED, PY_FROZEN, PY_SOURCE - from ._imp import get_frozen_object, get_module -except ImportError: - import imp - from imp import PY_COMPILED, PY_FROZEN, PY_SOURCE # noqa - - def find_module(module, paths=None): - """Just like 'imp.find_module()', but with package support""" - parts = module.split('.') - while parts: - part = parts.pop(0) - f, path, (suffix, mode, kind) = info = imp.find_module(part, paths) - - if kind == imp.PKG_DIRECTORY: - parts = parts or ['__init__'] - paths = [path] - - elif parts: - raise ImportError("Can't find %r in %s" % (parts, module)) - - return info - - def get_frozen_object(module, paths): - return imp.get_frozen_object(module) - - def get_module(module, paths, info): - imp.load_module(module, *info) - return sys.modules[module] diff --git a/venv/lib/python3.8/site-packages/setuptools/py31compat.py b/venv/lib/python3.8/site-packages/setuptools/py31compat.py deleted file mode 100644 index e1da7ee2a2c56e46e09665d98ba1bc5bfedd2c3e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/py31compat.py +++ /dev/null @@ -1,32 +0,0 @@ -__all__ = [] - -__metaclass__ = type - - -try: - # Python >=3.2 - from tempfile import TemporaryDirectory -except ImportError: - import shutil - import tempfile - - class TemporaryDirectory: - """ - Very simple temporary directory context manager. - Will try to delete afterward, but will also ignore OS and similar - errors on deletion. - """ - - def __init__(self, **kwargs): - self.name = None # Handle mkdtemp raising an exception - self.name = tempfile.mkdtemp(**kwargs) - - def __enter__(self): - return self.name - - def __exit__(self, exctype, excvalue, exctrace): - try: - shutil.rmtree(self.name, True) - except OSError: # removal errors are not the only possible - pass - self.name = None diff --git a/venv/lib/python3.8/site-packages/setuptools/py33compat.py b/venv/lib/python3.8/site-packages/setuptools/py33compat.py deleted file mode 100644 index cb69443638354b46b43da5bbf187b4f7cba301f1..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/py33compat.py +++ /dev/null @@ -1,59 +0,0 @@ -import dis -import array -import collections - -try: - import html -except ImportError: - html = None - -from setuptools.extern import six -from setuptools.extern.six.moves import html_parser - -__metaclass__ = type - -OpArg = collections.namedtuple('OpArg', 'opcode arg') - - -class Bytecode_compat: - def __init__(self, code): - self.code = code - - def __iter__(self): - """Yield '(op,arg)' pair for each operation in code object 'code'""" - - bytes = array.array('b', self.code.co_code) - eof = len(self.code.co_code) - - ptr = 0 - extended_arg = 0 - - while ptr < eof: - - op = bytes[ptr] - - if op >= dis.HAVE_ARGUMENT: - - arg = bytes[ptr + 1] + bytes[ptr + 2] * 256 + extended_arg - ptr += 3 - - if op == dis.EXTENDED_ARG: - long_type = six.integer_types[-1] - extended_arg = arg * long_type(65536) - continue - - else: - arg = None - ptr += 1 - - yield OpArg(op, arg) - - -Bytecode = getattr(dis, 'Bytecode', Bytecode_compat) - - -unescape = getattr(html, 'unescape', None) -if unescape is None: - # HTMLParser.unescape is deprecated since Python 3.4, and will be removed - # from 3.9. - unescape = html_parser.HTMLParser().unescape diff --git a/venv/lib/python3.8/site-packages/setuptools/py34compat.py b/venv/lib/python3.8/site-packages/setuptools/py34compat.py deleted file mode 100644 index 3ad917222a4e5bb93fe1c9e8fe1713bcab3630b6..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/py34compat.py +++ /dev/null @@ -1,13 +0,0 @@ -import importlib - -try: - import importlib.util -except ImportError: - pass - - -try: - module_from_spec = importlib.util.module_from_spec -except AttributeError: - def module_from_spec(spec): - return spec.loader.load_module(spec.name) diff --git a/venv/lib/python3.8/site-packages/setuptools/sandbox.py b/venv/lib/python3.8/site-packages/setuptools/sandbox.py deleted file mode 100644 index 685f3f72e3611a5fa99c999e233ffd179c431a6d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/sandbox.py +++ /dev/null @@ -1,491 +0,0 @@ -import os -import sys -import tempfile -import operator -import functools -import itertools -import re -import contextlib -import pickle -import textwrap - -from setuptools.extern import six -from setuptools.extern.six.moves import builtins, map - -import pkg_resources.py31compat - -if sys.platform.startswith('java'): - import org.python.modules.posix.PosixModule as _os -else: - _os = sys.modules[os.name] -try: - _file = file -except NameError: - _file = None -_open = open -from distutils.errors import DistutilsError -from pkg_resources import working_set - - -__all__ = [ - "AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup", -] - - -def _execfile(filename, globals, locals=None): - """ - Python 3 implementation of execfile. - """ - mode = 'rb' - with open(filename, mode) as stream: - script = stream.read() - if locals is None: - locals = globals - code = compile(script, filename, 'exec') - exec(code, globals, locals) - - -@contextlib.contextmanager -def save_argv(repl=None): - saved = sys.argv[:] - if repl is not None: - sys.argv[:] = repl - try: - yield saved - finally: - sys.argv[:] = saved - - -@contextlib.contextmanager -def save_path(): - saved = sys.path[:] - try: - yield saved - finally: - sys.path[:] = saved - - -@contextlib.contextmanager -def override_temp(replacement): - """ - Monkey-patch tempfile.tempdir with replacement, ensuring it exists - """ - pkg_resources.py31compat.makedirs(replacement, exist_ok=True) - - saved = tempfile.tempdir - - tempfile.tempdir = replacement - - try: - yield - finally: - tempfile.tempdir = saved - - -@contextlib.contextmanager -def pushd(target): - saved = os.getcwd() - os.chdir(target) - try: - yield saved - finally: - os.chdir(saved) - - -class UnpickleableException(Exception): - """ - An exception representing another Exception that could not be pickled. - """ - - @staticmethod - def dump(type, exc): - """ - Always return a dumped (pickled) type and exc. If exc can't be pickled, - wrap it in UnpickleableException first. - """ - try: - return pickle.dumps(type), pickle.dumps(exc) - except Exception: - # get UnpickleableException inside the sandbox - from setuptools.sandbox import UnpickleableException as cls - return cls.dump(cls, cls(repr(exc))) - - -class ExceptionSaver: - """ - A Context Manager that will save an exception, serialized, and restore it - later. - """ - - def __enter__(self): - return self - - def __exit__(self, type, exc, tb): - if not exc: - return - - # dump the exception - self._saved = UnpickleableException.dump(type, exc) - self._tb = tb - - # suppress the exception - return True - - def resume(self): - "restore and re-raise any exception" - - if '_saved' not in vars(self): - return - - type, exc = map(pickle.loads, self._saved) - six.reraise(type, exc, self._tb) - - -@contextlib.contextmanager -def save_modules(): - """ - Context in which imported modules are saved. - - Translates exceptions internal to the context into the equivalent exception - outside the context. - """ - saved = sys.modules.copy() - with ExceptionSaver() as saved_exc: - yield saved - - sys.modules.update(saved) - # remove any modules imported since - del_modules = ( - mod_name for mod_name in sys.modules - if mod_name not in saved - # exclude any encodings modules. See #285 - and not mod_name.startswith('encodings.') - ) - _clear_modules(del_modules) - - saved_exc.resume() - - -def _clear_modules(module_names): - for mod_name in list(module_names): - del sys.modules[mod_name] - - -@contextlib.contextmanager -def save_pkg_resources_state(): - saved = pkg_resources.__getstate__() - try: - yield saved - finally: - pkg_resources.__setstate__(saved) - - -@contextlib.contextmanager -def setup_context(setup_dir): - temp_dir = os.path.join(setup_dir, 'temp') - with save_pkg_resources_state(): - with save_modules(): - hide_setuptools() - with save_path(): - with save_argv(): - with override_temp(temp_dir): - with pushd(setup_dir): - # ensure setuptools commands are available - __import__('setuptools') - yield - - -def _needs_hiding(mod_name): - """ - >>> _needs_hiding('setuptools') - True - >>> _needs_hiding('pkg_resources') - True - >>> _needs_hiding('setuptools_plugin') - False - >>> _needs_hiding('setuptools.__init__') - True - >>> _needs_hiding('distutils') - True - >>> _needs_hiding('os') - False - >>> _needs_hiding('Cython') - True - """ - pattern = re.compile(r'(setuptools|pkg_resources|distutils|Cython)(\.|$)') - return bool(pattern.match(mod_name)) - - -def hide_setuptools(): - """ - Remove references to setuptools' modules from sys.modules to allow the - invocation to import the most appropriate setuptools. This technique is - necessary to avoid issues such as #315 where setuptools upgrading itself - would fail to find a function declared in the metadata. - """ - modules = filter(_needs_hiding, sys.modules) - _clear_modules(modules) - - -def run_setup(setup_script, args): - """Run a distutils setup script, sandboxed in its directory""" - setup_dir = os.path.abspath(os.path.dirname(setup_script)) - with setup_context(setup_dir): - try: - sys.argv[:] = [setup_script] + list(args) - sys.path.insert(0, setup_dir) - # reset to include setup dir, w/clean callback list - working_set.__init__() - working_set.callbacks.append(lambda dist: dist.activate()) - - # __file__ should be a byte string on Python 2 (#712) - dunder_file = ( - setup_script - if isinstance(setup_script, str) else - setup_script.encode(sys.getfilesystemencoding()) - ) - - with DirectorySandbox(setup_dir): - ns = dict(__file__=dunder_file, __name__='__main__') - _execfile(setup_script, ns) - except SystemExit as v: - if v.args and v.args[0]: - raise - # Normal exit, just return - - -class AbstractSandbox: - """Wrap 'os' module and 'open()' builtin for virtualizing setup scripts""" - - _active = False - - def __init__(self): - self._attrs = [ - name for name in dir(_os) - if not name.startswith('_') and hasattr(self, name) - ] - - def _copy(self, source): - for name in self._attrs: - setattr(os, name, getattr(source, name)) - - def __enter__(self): - self._copy(self) - if _file: - builtins.file = self._file - builtins.open = self._open - self._active = True - - def __exit__(self, exc_type, exc_value, traceback): - self._active = False - if _file: - builtins.file = _file - builtins.open = _open - self._copy(_os) - - def run(self, func): - """Run 'func' under os sandboxing""" - with self: - return func() - - def _mk_dual_path_wrapper(name): - original = getattr(_os, name) - - def wrap(self, src, dst, *args, **kw): - if self._active: - src, dst = self._remap_pair(name, src, dst, *args, **kw) - return original(src, dst, *args, **kw) - - return wrap - - for name in ["rename", "link", "symlink"]: - if hasattr(_os, name): - locals()[name] = _mk_dual_path_wrapper(name) - - def _mk_single_path_wrapper(name, original=None): - original = original or getattr(_os, name) - - def wrap(self, path, *args, **kw): - if self._active: - path = self._remap_input(name, path, *args, **kw) - return original(path, *args, **kw) - - return wrap - - if _file: - _file = _mk_single_path_wrapper('file', _file) - _open = _mk_single_path_wrapper('open', _open) - for name in [ - "stat", "listdir", "chdir", "open", "chmod", "chown", "mkdir", - "remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat", - "startfile", "mkfifo", "mknod", "pathconf", "access" - ]: - if hasattr(_os, name): - locals()[name] = _mk_single_path_wrapper(name) - - def _mk_single_with_return(name): - original = getattr(_os, name) - - def wrap(self, path, *args, **kw): - if self._active: - path = self._remap_input(name, path, *args, **kw) - return self._remap_output(name, original(path, *args, **kw)) - return original(path, *args, **kw) - - return wrap - - for name in ['readlink', 'tempnam']: - if hasattr(_os, name): - locals()[name] = _mk_single_with_return(name) - - def _mk_query(name): - original = getattr(_os, name) - - def wrap(self, *args, **kw): - retval = original(*args, **kw) - if self._active: - return self._remap_output(name, retval) - return retval - - return wrap - - for name in ['getcwd', 'tmpnam']: - if hasattr(_os, name): - locals()[name] = _mk_query(name) - - def _validate_path(self, path): - """Called to remap or validate any path, whether input or output""" - return path - - def _remap_input(self, operation, path, *args, **kw): - """Called for path inputs""" - return self._validate_path(path) - - def _remap_output(self, operation, path): - """Called for path outputs""" - return self._validate_path(path) - - def _remap_pair(self, operation, src, dst, *args, **kw): - """Called for path pairs like rename, link, and symlink operations""" - return ( - self._remap_input(operation + '-from', src, *args, **kw), - self._remap_input(operation + '-to', dst, *args, **kw) - ) - - -if hasattr(os, 'devnull'): - _EXCEPTIONS = [os.devnull,] -else: - _EXCEPTIONS = [] - - -class DirectorySandbox(AbstractSandbox): - """Restrict operations to a single subdirectory - pseudo-chroot""" - - write_ops = dict.fromkeys([ - "open", "chmod", "chown", "mkdir", "remove", "unlink", "rmdir", - "utime", "lchown", "chroot", "mkfifo", "mknod", "tempnam", - ]) - - _exception_patterns = [ - # Allow lib2to3 to attempt to save a pickled grammar object (#121) - r'.*lib2to3.*\.pickle$', - ] - "exempt writing to paths that match the pattern" - - def __init__(self, sandbox, exceptions=_EXCEPTIONS): - self._sandbox = os.path.normcase(os.path.realpath(sandbox)) - self._prefix = os.path.join(self._sandbox, '') - self._exceptions = [ - os.path.normcase(os.path.realpath(path)) - for path in exceptions - ] - AbstractSandbox.__init__(self) - - def _violation(self, operation, *args, **kw): - from setuptools.sandbox import SandboxViolation - raise SandboxViolation(operation, args, kw) - - if _file: - - def _file(self, path, mode='r', *args, **kw): - if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path): - self._violation("file", path, mode, *args, **kw) - return _file(path, mode, *args, **kw) - - def _open(self, path, mode='r', *args, **kw): - if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path): - self._violation("open", path, mode, *args, **kw) - return _open(path, mode, *args, **kw) - - def tmpnam(self): - self._violation("tmpnam") - - def _ok(self, path): - active = self._active - try: - self._active = False - realpath = os.path.normcase(os.path.realpath(path)) - return ( - self._exempted(realpath) - or realpath == self._sandbox - or realpath.startswith(self._prefix) - ) - finally: - self._active = active - - def _exempted(self, filepath): - start_matches = ( - filepath.startswith(exception) - for exception in self._exceptions - ) - pattern_matches = ( - re.match(pattern, filepath) - for pattern in self._exception_patterns - ) - candidates = itertools.chain(start_matches, pattern_matches) - return any(candidates) - - def _remap_input(self, operation, path, *args, **kw): - """Called for path inputs""" - if operation in self.write_ops and not self._ok(path): - self._violation(operation, os.path.realpath(path), *args, **kw) - return path - - def _remap_pair(self, operation, src, dst, *args, **kw): - """Called for path pairs like rename, link, and symlink operations""" - if not self._ok(src) or not self._ok(dst): - self._violation(operation, src, dst, *args, **kw) - return (src, dst) - - def open(self, file, flags, mode=0o777, *args, **kw): - """Called for low-level os.open()""" - if flags & WRITE_FLAGS and not self._ok(file): - self._violation("os.open", file, flags, mode, *args, **kw) - return _os.open(file, flags, mode, *args, **kw) - - -WRITE_FLAGS = functools.reduce( - operator.or_, [getattr(_os, a, 0) for a in - "O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()] -) - - -class SandboxViolation(DistutilsError): - """A setup script attempted to modify the filesystem outside the sandbox""" - - tmpl = textwrap.dedent(""" - SandboxViolation: {cmd}{args!r} {kwargs} - - The package setup script has attempted to modify files on your system - that are not within the EasyInstall build area, and has been aborted. - - This package cannot be safely installed by EasyInstall, and may not - support alternate installation locations even if you run its setup - script by hand. Please inform the package's author and the EasyInstall - maintainers to find out if a fix or workaround is available. - """).lstrip() - - def __str__(self): - cmd, args, kwargs = self.args - return self.tmpl.format(**locals()) diff --git a/venv/lib/python3.8/site-packages/setuptools/script (dev).tmpl b/venv/lib/python3.8/site-packages/setuptools/script (dev).tmpl deleted file mode 100644 index 39a24b04888e79df51e2237577b303a2f901be63..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/script (dev).tmpl +++ /dev/null @@ -1,6 +0,0 @@ -# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r -__requires__ = %(spec)r -__import__('pkg_resources').require(%(spec)r) -__file__ = %(dev_path)r -with open(__file__) as f: - exec(compile(f.read(), __file__, 'exec')) diff --git a/venv/lib/python3.8/site-packages/setuptools/script.tmpl b/venv/lib/python3.8/site-packages/setuptools/script.tmpl deleted file mode 100644 index ff5efbcab3b58063dd84787181c26a95fb663d94..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/script.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r -__requires__ = %(spec)r -__import__('pkg_resources').run_script(%(spec)r, %(script_name)r) diff --git a/venv/lib/python3.8/site-packages/setuptools/site-patch.py b/venv/lib/python3.8/site-packages/setuptools/site-patch.py deleted file mode 100644 index 40b00de0a799686485b266fd92abb9fb100ed718..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/site-patch.py +++ /dev/null @@ -1,74 +0,0 @@ -def __boot(): - import sys - import os - PYTHONPATH = os.environ.get('PYTHONPATH') - if PYTHONPATH is None or (sys.platform == 'win32' and not PYTHONPATH): - PYTHONPATH = [] - else: - PYTHONPATH = PYTHONPATH.split(os.pathsep) - - pic = getattr(sys, 'path_importer_cache', {}) - stdpath = sys.path[len(PYTHONPATH):] - mydir = os.path.dirname(__file__) - - for item in stdpath: - if item == mydir or not item: - continue # skip if current dir. on Windows, or my own directory - importer = pic.get(item) - if importer is not None: - loader = importer.find_module('site') - if loader is not None: - # This should actually reload the current module - loader.load_module('site') - break - else: - try: - import imp # Avoid import loop in Python 3 - stream, path, descr = imp.find_module('site', [item]) - except ImportError: - continue - if stream is None: - continue - try: - # This should actually reload the current module - imp.load_module('site', stream, path, descr) - finally: - stream.close() - break - else: - raise ImportError("Couldn't find the real 'site' module") - - known_paths = dict([(makepath(item)[1], 1) for item in sys.path]) # 2.2 comp - - oldpos = getattr(sys, '__egginsert', 0) # save old insertion position - sys.__egginsert = 0 # and reset the current one - - for item in PYTHONPATH: - addsitedir(item) - - sys.__egginsert += oldpos # restore effective old position - - d, nd = makepath(stdpath[0]) - insert_at = None - new_path = [] - - for item in sys.path: - p, np = makepath(item) - - if np == nd and insert_at is None: - # We've hit the first 'system' path entry, so added entries go here - insert_at = len(new_path) - - if np in known_paths or insert_at is None: - new_path.append(item) - else: - # new path after the insert point, back-insert it - new_path.insert(insert_at, item) - insert_at += 1 - - sys.path[:] = new_path - - -if __name__ == 'site': - __boot() - del __boot diff --git a/venv/lib/python3.8/site-packages/setuptools/ssl_support.py b/venv/lib/python3.8/site-packages/setuptools/ssl_support.py deleted file mode 100644 index 226db694bb38791147c6bf2881c4b86025dd2f8f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/ssl_support.py +++ /dev/null @@ -1,260 +0,0 @@ -import os -import socket -import atexit -import re -import functools - -from setuptools.extern.six.moves import urllib, http_client, map, filter - -from pkg_resources import ResolutionError, ExtractionError - -try: - import ssl -except ImportError: - ssl = None - -__all__ = [ - 'VerifyingHTTPSHandler', 'find_ca_bundle', 'is_available', 'cert_paths', - 'opener_for' -] - -cert_paths = """ -/etc/pki/tls/certs/ca-bundle.crt -/etc/ssl/certs/ca-certificates.crt -/usr/share/ssl/certs/ca-bundle.crt -/usr/local/share/certs/ca-root.crt -/etc/ssl/cert.pem -/System/Library/OpenSSL/certs/cert.pem -/usr/local/share/certs/ca-root-nss.crt -/etc/ssl/ca-bundle.pem -""".strip().split() - -try: - HTTPSHandler = urllib.request.HTTPSHandler - HTTPSConnection = http_client.HTTPSConnection -except AttributeError: - HTTPSHandler = HTTPSConnection = object - -is_available = ssl is not None and object not in (HTTPSHandler, HTTPSConnection) - - -try: - from ssl import CertificateError, match_hostname -except ImportError: - try: - from backports.ssl_match_hostname import CertificateError - from backports.ssl_match_hostname import match_hostname - except ImportError: - CertificateError = None - match_hostname = None - -if not CertificateError: - - class CertificateError(ValueError): - pass - - -if not match_hostname: - - def _dnsname_match(dn, hostname, max_wildcards=1): - """Matching according to RFC 6125, section 6.4.3 - - https://tools.ietf.org/html/rfc6125#section-6.4.3 - """ - pats = [] - if not dn: - return False - - # Ported from python3-syntax: - # leftmost, *remainder = dn.split(r'.') - parts = dn.split(r'.') - leftmost = parts[0] - remainder = parts[1:] - - wildcards = leftmost.count('*') - if wildcards > max_wildcards: - # Issue #17980: avoid denials of service by refusing more - # than one wildcard per fragment. A survey of established - # policy among SSL implementations showed it to be a - # reasonable choice. - raise CertificateError( - "too many wildcards in certificate DNS name: " + repr(dn)) - - # speed up common case w/o wildcards - if not wildcards: - return dn.lower() == hostname.lower() - - # RFC 6125, section 6.4.3, subitem 1. - # The client SHOULD NOT attempt to match a presented identifier in which - # the wildcard character comprises a label other than the left-most label. - if leftmost == '*': - # When '*' is a fragment by itself, it matches a non-empty dotless - # fragment. - pats.append('[^.]+') - elif leftmost.startswith('xn--') or hostname.startswith('xn--'): - # RFC 6125, section 6.4.3, subitem 3. - # The client SHOULD NOT attempt to match a presented identifier - # where the wildcard character is embedded within an A-label or - # U-label of an internationalized domain name. - pats.append(re.escape(leftmost)) - else: - # Otherwise, '*' matches any dotless string, e.g. www* - pats.append(re.escape(leftmost).replace(r'\*', '[^.]*')) - - # add the remaining fragments, ignore any wildcards - for frag in remainder: - pats.append(re.escape(frag)) - - pat = re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE) - return pat.match(hostname) - - def match_hostname(cert, hostname): - """Verify that *cert* (in decoded format as returned by - SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 - rules are followed, but IP addresses are not accepted for *hostname*. - - CertificateError is raised on failure. On success, the function - returns nothing. - """ - if not cert: - raise ValueError("empty or no certificate") - dnsnames = [] - san = cert.get('subjectAltName', ()) - for key, value in san: - if key == 'DNS': - if _dnsname_match(value, hostname): - return - dnsnames.append(value) - if not dnsnames: - # The subject is only checked when there is no dNSName entry - # in subjectAltName - for sub in cert.get('subject', ()): - for key, value in sub: - # XXX according to RFC 2818, the most specific Common Name - # must be used. - if key == 'commonName': - if _dnsname_match(value, hostname): - return - dnsnames.append(value) - if len(dnsnames) > 1: - raise CertificateError("hostname %r " - "doesn't match either of %s" - % (hostname, ', '.join(map(repr, dnsnames)))) - elif len(dnsnames) == 1: - raise CertificateError("hostname %r " - "doesn't match %r" - % (hostname, dnsnames[0])) - else: - raise CertificateError("no appropriate commonName or " - "subjectAltName fields were found") - - -class VerifyingHTTPSHandler(HTTPSHandler): - """Simple verifying handler: no auth, subclasses, timeouts, etc.""" - - def __init__(self, ca_bundle): - self.ca_bundle = ca_bundle - HTTPSHandler.__init__(self) - - def https_open(self, req): - return self.do_open( - lambda host, **kw: VerifyingHTTPSConn(host, self.ca_bundle, **kw), req - ) - - -class VerifyingHTTPSConn(HTTPSConnection): - """Simple verifying connection: no auth, subclasses, timeouts, etc.""" - - def __init__(self, host, ca_bundle, **kw): - HTTPSConnection.__init__(self, host, **kw) - self.ca_bundle = ca_bundle - - def connect(self): - sock = socket.create_connection( - (self.host, self.port), getattr(self, 'source_address', None) - ) - - # Handle the socket if a (proxy) tunnel is present - if hasattr(self, '_tunnel') and getattr(self, '_tunnel_host', None): - self.sock = sock - self._tunnel() - # http://bugs.python.org/issue7776: Python>=3.4.1 and >=2.7.7 - # change self.host to mean the proxy server host when tunneling is - # being used. Adapt, since we are interested in the destination - # host for the match_hostname() comparison. - actual_host = self._tunnel_host - else: - actual_host = self.host - - if hasattr(ssl, 'create_default_context'): - ctx = ssl.create_default_context(cafile=self.ca_bundle) - self.sock = ctx.wrap_socket(sock, server_hostname=actual_host) - else: - # This is for python < 2.7.9 and < 3.4? - self.sock = ssl.wrap_socket( - sock, cert_reqs=ssl.CERT_REQUIRED, ca_certs=self.ca_bundle - ) - try: - match_hostname(self.sock.getpeercert(), actual_host) - except CertificateError: - self.sock.shutdown(socket.SHUT_RDWR) - self.sock.close() - raise - - -def opener_for(ca_bundle=None): - """Get a urlopen() replacement that uses ca_bundle for verification""" - return urllib.request.build_opener( - VerifyingHTTPSHandler(ca_bundle or find_ca_bundle()) - ).open - - -# from jaraco.functools -def once(func): - @functools.wraps(func) - def wrapper(*args, **kwargs): - if not hasattr(func, 'always_returns'): - func.always_returns = func(*args, **kwargs) - return func.always_returns - return wrapper - - -@once -def get_win_certfile(): - try: - import wincertstore - except ImportError: - return None - - class CertFile(wincertstore.CertFile): - def __init__(self): - super(CertFile, self).__init__() - atexit.register(self.close) - - def close(self): - try: - super(CertFile, self).close() - except OSError: - pass - - _wincerts = CertFile() - _wincerts.addstore('CA') - _wincerts.addstore('ROOT') - return _wincerts.name - - -def find_ca_bundle(): - """Return an existing CA bundle path, or None""" - extant_cert_paths = filter(os.path.isfile, cert_paths) - return ( - get_win_certfile() - or next(extant_cert_paths, None) - or _certifi_where() - ) - - -def _certifi_where(): - try: - return __import__('certifi').where() - except (ImportError, ResolutionError, ExtractionError): - pass diff --git a/venv/lib/python3.8/site-packages/setuptools/unicode_utils.py b/venv/lib/python3.8/site-packages/setuptools/unicode_utils.py deleted file mode 100644 index 7c63efd20b350358ab25c079166dbb00ef49f8d2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/unicode_utils.py +++ /dev/null @@ -1,44 +0,0 @@ -import unicodedata -import sys - -from setuptools.extern import six - - -# HFS Plus uses decomposed UTF-8 -def decompose(path): - if isinstance(path, six.text_type): - return unicodedata.normalize('NFD', path) - try: - path = path.decode('utf-8') - path = unicodedata.normalize('NFD', path) - path = path.encode('utf-8') - except UnicodeError: - pass # Not UTF-8 - return path - - -def filesys_decode(path): - """ - Ensure that the given path is decoded, - NONE when no expected encoding works - """ - - if isinstance(path, six.text_type): - return path - - fs_enc = sys.getfilesystemencoding() or 'utf-8' - candidates = fs_enc, 'utf-8' - - for enc in candidates: - try: - return path.decode(enc) - except UnicodeDecodeError: - continue - - -def try_encode(string, enc): - "turn unicode encoding into a functional routine" - try: - return string.encode(enc) - except UnicodeEncodeError: - return None diff --git a/venv/lib/python3.8/site-packages/setuptools/version.py b/venv/lib/python3.8/site-packages/setuptools/version.py deleted file mode 100644 index 95e1869658566aac3060562d8cd5a6b647887d1e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/version.py +++ /dev/null @@ -1,6 +0,0 @@ -import pkg_resources - -try: - __version__ = pkg_resources.get_distribution('setuptools').version -except Exception: - __version__ = 'unknown' diff --git a/venv/lib/python3.8/site-packages/setuptools/wheel.py b/venv/lib/python3.8/site-packages/setuptools/wheel.py deleted file mode 100644 index 025aaa828a24cb7746e5fac9b66984d5b9794bc3..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/wheel.py +++ /dev/null @@ -1,220 +0,0 @@ -"""Wheels support.""" - -from distutils.util import get_platform -from distutils import log -import email -import itertools -import os -import posixpath -import re -import zipfile - -import pkg_resources -import setuptools -from pkg_resources import parse_version -from setuptools.extern.packaging.tags import sys_tags -from setuptools.extern.packaging.utils import canonicalize_name -from setuptools.extern.six import PY3 -from setuptools.command.egg_info import write_requirements - - -__metaclass__ = type - - -WHEEL_NAME = re.compile( - r"""^(?P.+?)-(?P\d.*?) - ((-(?P\d.*?))?-(?P.+?)-(?P.+?)-(?P.+?) - )\.whl$""", - re.VERBOSE).match - -NAMESPACE_PACKAGE_INIT = '''\ -try: - __import__('pkg_resources').declare_namespace(__name__) -except ImportError: - __path__ = __import__('pkgutil').extend_path(__path__, __name__) -''' - - -def unpack(src_dir, dst_dir): - '''Move everything under `src_dir` to `dst_dir`, and delete the former.''' - for dirpath, dirnames, filenames in os.walk(src_dir): - subdir = os.path.relpath(dirpath, src_dir) - for f in filenames: - src = os.path.join(dirpath, f) - dst = os.path.join(dst_dir, subdir, f) - os.renames(src, dst) - for n, d in reversed(list(enumerate(dirnames))): - src = os.path.join(dirpath, d) - dst = os.path.join(dst_dir, subdir, d) - if not os.path.exists(dst): - # Directory does not exist in destination, - # rename it and prune it from os.walk list. - os.renames(src, dst) - del dirnames[n] - # Cleanup. - for dirpath, dirnames, filenames in os.walk(src_dir, topdown=True): - assert not filenames - os.rmdir(dirpath) - - -class Wheel: - - def __init__(self, filename): - match = WHEEL_NAME(os.path.basename(filename)) - if match is None: - raise ValueError('invalid wheel name: %r' % filename) - self.filename = filename - for k, v in match.groupdict().items(): - setattr(self, k, v) - - def tags(self): - '''List tags (py_version, abi, platform) supported by this wheel.''' - return itertools.product( - self.py_version.split('.'), - self.abi.split('.'), - self.platform.split('.'), - ) - - def is_compatible(self): - '''Is the wheel is compatible with the current platform?''' - supported_tags = set((t.interpreter, t.abi, t.platform) for t in sys_tags()) - return next((True for t in self.tags() if t in supported_tags), False) - - def egg_name(self): - return pkg_resources.Distribution( - project_name=self.project_name, version=self.version, - platform=(None if self.platform == 'any' else get_platform()), - ).egg_name() + '.egg' - - def get_dist_info(self, zf): - # find the correct name of the .dist-info dir in the wheel file - for member in zf.namelist(): - dirname = posixpath.dirname(member) - if (dirname.endswith('.dist-info') and - canonicalize_name(dirname).startswith( - canonicalize_name(self.project_name))): - return dirname - raise ValueError("unsupported wheel format. .dist-info not found") - - def install_as_egg(self, destination_eggdir): - '''Install wheel as an egg directory.''' - with zipfile.ZipFile(self.filename) as zf: - self._install_as_egg(destination_eggdir, zf) - - def _install_as_egg(self, destination_eggdir, zf): - dist_basename = '%s-%s' % (self.project_name, self.version) - dist_info = self.get_dist_info(zf) - dist_data = '%s.data' % dist_basename - egg_info = os.path.join(destination_eggdir, 'EGG-INFO') - - self._convert_metadata(zf, destination_eggdir, dist_info, egg_info) - self._move_data_entries(destination_eggdir, dist_data) - self._fix_namespace_packages(egg_info, destination_eggdir) - - @staticmethod - def _convert_metadata(zf, destination_eggdir, dist_info, egg_info): - def get_metadata(name): - with zf.open(posixpath.join(dist_info, name)) as fp: - value = fp.read().decode('utf-8') if PY3 else fp.read() - return email.parser.Parser().parsestr(value) - - wheel_metadata = get_metadata('WHEEL') - # Check wheel format version is supported. - wheel_version = parse_version(wheel_metadata.get('Wheel-Version')) - wheel_v1 = ( - parse_version('1.0') <= wheel_version < parse_version('2.0dev0') - ) - if not wheel_v1: - raise ValueError( - 'unsupported wheel format version: %s' % wheel_version) - # Extract to target directory. - os.mkdir(destination_eggdir) - zf.extractall(destination_eggdir) - # Convert metadata. - dist_info = os.path.join(destination_eggdir, dist_info) - dist = pkg_resources.Distribution.from_location( - destination_eggdir, dist_info, - metadata=pkg_resources.PathMetadata(destination_eggdir, dist_info), - ) - - # Note: Evaluate and strip markers now, - # as it's difficult to convert back from the syntax: - # foobar; "linux" in sys_platform and extra == 'test' - def raw_req(req): - req.marker = None - return str(req) - install_requires = list(sorted(map(raw_req, dist.requires()))) - extras_require = { - extra: sorted( - req - for req in map(raw_req, dist.requires((extra,))) - if req not in install_requires - ) - for extra in dist.extras - } - os.rename(dist_info, egg_info) - os.rename( - os.path.join(egg_info, 'METADATA'), - os.path.join(egg_info, 'PKG-INFO'), - ) - setup_dist = setuptools.Distribution( - attrs=dict( - install_requires=install_requires, - extras_require=extras_require, - ), - ) - # Temporarily disable info traces. - log_threshold = log._global_log.threshold - log.set_threshold(log.WARN) - try: - write_requirements( - setup_dist.get_command_obj('egg_info'), - None, - os.path.join(egg_info, 'requires.txt'), - ) - finally: - log.set_threshold(log_threshold) - - @staticmethod - def _move_data_entries(destination_eggdir, dist_data): - """Move data entries to their correct location.""" - dist_data = os.path.join(destination_eggdir, dist_data) - dist_data_scripts = os.path.join(dist_data, 'scripts') - if os.path.exists(dist_data_scripts): - egg_info_scripts = os.path.join( - destination_eggdir, 'EGG-INFO', 'scripts') - os.mkdir(egg_info_scripts) - for entry in os.listdir(dist_data_scripts): - # Remove bytecode, as it's not properly handled - # during easy_install scripts install phase. - if entry.endswith('.pyc'): - os.unlink(os.path.join(dist_data_scripts, entry)) - else: - os.rename( - os.path.join(dist_data_scripts, entry), - os.path.join(egg_info_scripts, entry), - ) - os.rmdir(dist_data_scripts) - for subdir in filter(os.path.exists, ( - os.path.join(dist_data, d) - for d in ('data', 'headers', 'purelib', 'platlib') - )): - unpack(subdir, destination_eggdir) - if os.path.exists(dist_data): - os.rmdir(dist_data) - - @staticmethod - def _fix_namespace_packages(egg_info, destination_eggdir): - namespace_packages = os.path.join( - egg_info, 'namespace_packages.txt') - if os.path.exists(namespace_packages): - with open(namespace_packages) as fp: - namespace_packages = fp.read().split() - for mod in namespace_packages: - mod_dir = os.path.join(destination_eggdir, *mod.split('.')) - mod_init = os.path.join(mod_dir, '__init__.py') - if not os.path.exists(mod_dir): - os.mkdir(mod_dir) - if not os.path.exists(mod_init): - with open(mod_init, 'w') as fp: - fp.write(NAMESPACE_PACKAGE_INIT) diff --git a/venv/lib/python3.8/site-packages/setuptools/windows_support.py b/venv/lib/python3.8/site-packages/setuptools/windows_support.py deleted file mode 100644 index cb977cff9545ef5d48ad7cf13f2cbe1ebc3e7cd0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/setuptools/windows_support.py +++ /dev/null @@ -1,29 +0,0 @@ -import platform -import ctypes - - -def windows_only(func): - if platform.system() != 'Windows': - return lambda *args, **kwargs: None - return func - - -@windows_only -def hide_file(path): - """ - Set the hidden attribute on a file or directory. - - From http://stackoverflow.com/questions/19622133/ - - `path` must be text. - """ - __import__('ctypes.wintypes') - SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW - SetFileAttributes.argtypes = ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD - SetFileAttributes.restype = ctypes.wintypes.BOOL - - FILE_ATTRIBUTE_HIDDEN = 0x02 - - ret = SetFileAttributes(path, FILE_ATTRIBUTE_HIDDEN) - if not ret: - raise ctypes.WinError() diff --git a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/LICENCE b/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/LICENCE deleted file mode 100644 index 32840e7cf8b95175e3723a2d1bc9346f3aa3162f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/LICENCE +++ /dev/null @@ -1,49 +0,0 @@ -`tqdm` is a product of collaborative work. -Unless otherwise stated, all authors (see commit logs) retain copyright -for their respective work, and release the work under the MIT licence -(text below). - -Exceptions or notable authors are listed below -in reverse chronological order: - -* files: * - MPL-2.0 2015-2023 (c) Casper da Costa-Luis - [casperdcl](https://github.com/casperdcl). -* files: tqdm/_tqdm.py - MIT 2016 (c) [PR #96] on behalf of Google Inc. -* files: tqdm/_tqdm.py README.rst .gitignore - MIT 2013 (c) Noam Yorav-Raphael, original author. - -[PR #96]: https://github.com/tqdm/tqdm/pull/96 - - -Mozilla Public Licence (MPL) v. 2.0 - Exhibit A ------------------------------------------------ - -This Source Code Form is subject to the terms of the -Mozilla Public License, v. 2.0. -If a copy of the MPL was not distributed with this project, -You can obtain one at https://mozilla.org/MPL/2.0/. - - -MIT License (MIT) ------------------ - -Copyright (c) 2013 noamraph - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/METADATA b/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/METADATA deleted file mode 100644 index 33ac83ab5772025b2397ca175646eb3cb9ceb7e0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/METADATA +++ /dev/null @@ -1,1590 +0,0 @@ -Metadata-Version: 2.1 -Name: tqdm -Version: 4.66.1 -Summary: Fast, Extensible Progress Meter -Maintainer-email: tqdm developers -License: MPL-2.0 AND MIT -Project-URL: homepage, https://tqdm.github.io -Project-URL: repository, https://github.com/tqdm/tqdm -Project-URL: changelog, https://tqdm.github.io/releases -Project-URL: wiki, https://github.com/tqdm/tqdm/wiki -Keywords: progressbar,progressmeter,progress,bar,meter,rate,eta,console,terminal,time -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Console -Classifier: Environment :: MacOS X -Classifier: Environment :: Other Environment -Classifier: Environment :: Win32 (MS Windows) -Classifier: Environment :: X11 Applications -Classifier: Framework :: IPython -Classifier: Framework :: Jupyter -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: Education -Classifier: Intended Audience :: End Users/Desktop -Classifier: Intended Audience :: Other Audience -Classifier: Intended Audience :: System Administrators -Classifier: License :: OSI Approved :: MIT License -Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) -Classifier: Operating System :: MacOS -Classifier: Operating System :: MacOS :: MacOS X -Classifier: Operating System :: Microsoft -Classifier: Operating System :: Microsoft :: MS-DOS -Classifier: Operating System :: Microsoft :: Windows -Classifier: Operating System :: POSIX -Classifier: Operating System :: POSIX :: BSD -Classifier: Operating System :: POSIX :: BSD :: FreeBSD -Classifier: Operating System :: POSIX :: Linux -Classifier: Operating System :: POSIX :: SunOS/Solaris -Classifier: Operating System :: Unix -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: Implementation -Classifier: Programming Language :: Python :: Implementation :: IronPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Programming Language :: Unix Shell -Classifier: Topic :: Desktop Environment -Classifier: Topic :: Education :: Computer Aided Instruction (CAI) -Classifier: Topic :: Education :: Testing -Classifier: Topic :: Office/Business -Classifier: Topic :: Other/Nonlisted Topic -Classifier: Topic :: Software Development :: Build Tools -Classifier: Topic :: Software Development :: Libraries -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Software Development :: Pre-processors -Classifier: Topic :: Software Development :: User Interfaces -Classifier: Topic :: System :: Installation/Setup -Classifier: Topic :: System :: Logging -Classifier: Topic :: System :: Monitoring -Classifier: Topic :: System :: Shells -Classifier: Topic :: Terminals -Classifier: Topic :: Utilities -Requires-Python: >=3.7 -Description-Content-Type: text/x-rst -License-File: LICENCE -Requires-Dist: colorama ; platform_system == "Windows" -Provides-Extra: dev -Requires-Dist: pytest >=6 ; extra == 'dev' -Requires-Dist: pytest-cov ; extra == 'dev' -Requires-Dist: pytest-timeout ; extra == 'dev' -Requires-Dist: pytest-xdist ; extra == 'dev' -Provides-Extra: notebook -Requires-Dist: ipywidgets >=6 ; extra == 'notebook' -Provides-Extra: slack -Requires-Dist: slack-sdk ; extra == 'slack' -Provides-Extra: telegram -Requires-Dist: requests ; extra == 'telegram' - -|Logo| - -tqdm -==== - -|Py-Versions| |Versions| |Conda-Forge-Status| |Docker| |Snapcraft| - -|Build-Status| |Coverage-Status| |Branch-Coverage-Status| |Codacy-Grade| |Libraries-Rank| |PyPI-Downloads| - -|LICENCE| |OpenHub-Status| |binder-demo| |awesome-python| - -``tqdm`` derives from the Arabic word *taqaddum* (تقدّم) which can mean "progress," -and is an abbreviation for "I love you so much" in Spanish (*te quiero demasiado*). - -Instantly make your loops show a smart progress meter - just wrap any -iterable with ``tqdm(iterable)``, and you're done! - -.. code:: python - - from tqdm import tqdm - for i in tqdm(range(10000)): - ... - -``76%|████████████████████████        | 7568/10000 [00:33<00:10, 229.00it/s]`` - -``trange(N)`` can be also used as a convenient shortcut for -``tqdm(range(N))``. - -|Screenshot| - |Video| |Slides| |Merch| - -It can also be executed as a module with pipes: - -.. code:: sh - - $ seq 9999999 | tqdm --bytes | wc -l - 75.2MB [00:00, 217MB/s] - 9999999 - - $ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \ - > backup.tgz - 32%|██████████▍ | 8.89G/27.9G [00:42<01:31, 223MB/s] - -Overhead is low -- about 60ns per iteration (80ns with ``tqdm.gui``), and is -unit tested against performance regression. -By comparison, the well-established -`ProgressBar `__ has -an 800ns/iter overhead. - -In addition to its low overhead, ``tqdm`` uses smart algorithms to predict -the remaining time and to skip unnecessary iteration displays, which allows -for a negligible overhead in most cases. - -``tqdm`` works on any platform -(Linux, Windows, Mac, FreeBSD, NetBSD, Solaris/SunOS), -in any console or in a GUI, and is also friendly with IPython/Jupyter notebooks. - -``tqdm`` does not require any dependencies (not even ``curses``!), just -Python and an environment supporting ``carriage return \r`` and -``line feed \n`` control characters. - ------------------------------------------- - -.. contents:: Table of contents - :backlinks: top - :local: - - -Installation ------------- - -Latest PyPI stable release -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -|Versions| |PyPI-Downloads| |Libraries-Dependents| - -.. code:: sh - - pip install tqdm - -Latest development release on GitHub -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -|GitHub-Status| |GitHub-Stars| |GitHub-Commits| |GitHub-Forks| |GitHub-Updated| - -Pull and install pre-release ``devel`` branch: - -.. code:: sh - - pip install "git+https://github.com/tqdm/tqdm.git@devel#egg=tqdm" - -Latest Conda release -~~~~~~~~~~~~~~~~~~~~ - -|Conda-Forge-Status| - -.. code:: sh - - conda install -c conda-forge tqdm - -Latest Snapcraft release -~~~~~~~~~~~~~~~~~~~~~~~~ - -|Snapcraft| - -There are 3 channels to choose from: - -.. code:: sh - - snap install tqdm # implies --stable, i.e. latest tagged release - snap install tqdm --candidate # master branch - snap install tqdm --edge # devel branch - -Note that ``snap`` binaries are purely for CLI use (not ``import``-able), and -automatically set up ``bash`` tab-completion. - -Latest Docker release -~~~~~~~~~~~~~~~~~~~~~ - -|Docker| - -.. code:: sh - - docker pull tqdm/tqdm - docker run -i --rm tqdm/tqdm --help - -Other -~~~~~ - -There are other (unofficial) places where ``tqdm`` may be downloaded, particularly for CLI use: - -|Repology| - -.. |Repology| image:: https://repology.org/badge/tiny-repos/python:tqdm.svg - :target: https://repology.org/project/python:tqdm/versions - -Changelog ---------- - -The list of all changes is available either on GitHub's Releases: -|GitHub-Status|, on the -`wiki `__, or on the -`website `__. - - -Usage ------ - -``tqdm`` is very versatile and can be used in a number of ways. -The three main ones are given below. - -Iterable-based -~~~~~~~~~~~~~~ - -Wrap ``tqdm()`` around any iterable: - -.. code:: python - - from tqdm import tqdm - from time import sleep - - text = "" - for char in tqdm(["a", "b", "c", "d"]): - sleep(0.25) - text = text + char - -``trange(i)`` is a special optimised instance of ``tqdm(range(i))``: - -.. code:: python - - from tqdm import trange - - for i in trange(100): - sleep(0.01) - -Instantiation outside of the loop allows for manual control over ``tqdm()``: - -.. code:: python - - pbar = tqdm(["a", "b", "c", "d"]) - for char in pbar: - sleep(0.25) - pbar.set_description("Processing %s" % char) - -Manual -~~~~~~ - -Manual control of ``tqdm()`` updates using a ``with`` statement: - -.. code:: python - - with tqdm(total=100) as pbar: - for i in range(10): - sleep(0.1) - pbar.update(10) - -If the optional variable ``total`` (or an iterable with ``len()``) is -provided, predictive stats are displayed. - -``with`` is also optional (you can just assign ``tqdm()`` to a variable, -but in this case don't forget to ``del`` or ``close()`` at the end: - -.. code:: python - - pbar = tqdm(total=100) - for i in range(10): - sleep(0.1) - pbar.update(10) - pbar.close() - -Module -~~~~~~ - -Perhaps the most wonderful use of ``tqdm`` is in a script or on the command -line. Simply inserting ``tqdm`` (or ``python -m tqdm``) between pipes will pass -through all ``stdin`` to ``stdout`` while printing progress to ``stderr``. - -The example below demonstrate counting the number of lines in all Python files -in the current directory, with timing information included. - -.. code:: sh - - $ time find . -name '*.py' -type f -exec cat \{} \; | wc -l - 857365 - - real 0m3.458s - user 0m0.274s - sys 0m3.325s - - $ time find . -name '*.py' -type f -exec cat \{} \; | tqdm | wc -l - 857366it [00:03, 246471.31it/s] - 857365 - - real 0m3.585s - user 0m0.862s - sys 0m3.358s - -Note that the usual arguments for ``tqdm`` can also be specified. - -.. code:: sh - - $ find . -name '*.py' -type f -exec cat \{} \; | - tqdm --unit loc --unit_scale --total 857366 >> /dev/null - 100%|█████████████████████████████████| 857K/857K [00:04<00:00, 246Kloc/s] - -Backing up a large directory? - -.. code:: sh - - $ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \ - > backup.tgz - 44%|██████████████▊ | 153M/352M [00:14<00:18, 11.0MB/s] - -This can be beautified further: - -.. code:: sh - - $ BYTES=$(du -sb docs/ | cut -f1) - $ tar -cf - docs/ \ - | tqdm --bytes --total "$BYTES" --desc Processing | gzip \ - | tqdm --bytes --total "$BYTES" --desc Compressed --position 1 \ - > ~/backup.tgz - Processing: 100%|██████████████████████| 352M/352M [00:14<00:00, 30.2MB/s] - Compressed: 42%|█████████▎ | 148M/352M [00:14<00:19, 10.9MB/s] - -Or done on a file level using 7-zip: - -.. code:: sh - - $ 7z a -bd -r backup.7z docs/ | grep Compressing \ - | tqdm --total $(find docs/ -type f | wc -l) --unit files \ - | grep -v Compressing - 100%|██████████████████████████▉| 15327/15327 [01:00<00:00, 712.96files/s] - -Pre-existing CLI programs already outputting basic progress information will -benefit from ``tqdm``'s ``--update`` and ``--update_to`` flags: - -.. code:: sh - - $ seq 3 0.1 5 | tqdm --total 5 --update_to --null - 100%|████████████████████████████████████| 5.0/5 [00:00<00:00, 9673.21it/s] - $ seq 10 | tqdm --update --null # 1 + 2 + ... + 10 = 55 iterations - 55it [00:00, 90006.52it/s] - -FAQ and Known Issues --------------------- - -|GitHub-Issues| - -The most common issues relate to excessive output on multiple lines, instead -of a neat one-line progress bar. - -- Consoles in general: require support for carriage return (``CR``, ``\r``). - - * Some cloud logging consoles which don't support ``\r`` properly - (`cloudwatch `__, - `K8s `__) may benefit from - ``export TQDM_POSITION=-1``. - -- Nested progress bars: - - * Consoles in general: require support for moving cursors up to the - previous line. For example, - `IDLE `__, - `ConEmu `__ and - `PyCharm `__ (also - `here `__, - `here `__, and - `here `__) - lack full support. - * Windows: additionally may require the Python module ``colorama`` - to ensure nested bars stay within their respective lines. - -- Unicode: - - * Environments which report that they support unicode will have solid smooth - progressbars. The fallback is an ``ascii``-only bar. - * Windows consoles often only partially support unicode and thus - `often require explicit ascii=True `__ - (also `here `__). This is due to - either normal-width unicode characters being incorrectly displayed as - "wide", or some unicode characters not rendering. - -- Wrapping generators: - - * Generator wrapper functions tend to hide the length of iterables. - ``tqdm`` does not. - * Replace ``tqdm(enumerate(...))`` with ``enumerate(tqdm(...))`` or - ``tqdm(enumerate(x), total=len(x), ...)``. - The same applies to ``numpy.ndenumerate``. - * Replace ``tqdm(zip(a, b))`` with ``zip(tqdm(a), b)`` or even - ``zip(tqdm(a), tqdm(b))``. - * The same applies to ``itertools``. - * Some useful convenience functions can be found under ``tqdm.contrib``. - -- `No intermediate output in docker-compose `__: - use ``docker-compose run`` instead of ``docker-compose up`` and ``tty: true``. - -- Overriding defaults via environment variables: - e.g. in CI/cloud jobs, ``export TQDM_MININTERVAL=5`` to avoid log spam. - This override logic is handled by the ``tqdm.utils.envwrap`` decorator - (useful independent of ``tqdm``). - -If you come across any other difficulties, browse and file |GitHub-Issues|. - -Documentation -------------- - -|Py-Versions| |README-Hits| (Since 19 May 2016) - -.. code:: python - - class tqdm(): - """ - Decorate an iterable object, returning an iterator which acts exactly - like the original iterable, but prints a dynamically updating - progressbar every time a value is requested. - """ - - @envwrap("TQDM_") # override defaults via env vars - def __init__(self, iterable=None, desc=None, total=None, leave=True, - file=None, ncols=None, mininterval=0.1, - maxinterval=10.0, miniters=None, ascii=None, disable=False, - unit='it', unit_scale=False, dynamic_ncols=False, - smoothing=0.3, bar_format=None, initial=0, position=None, - postfix=None, unit_divisor=1000, write_bytes=False, - lock_args=None, nrows=None, colour=None, delay=0): - -Parameters -~~~~~~~~~~ - -* iterable : iterable, optional - Iterable to decorate with a progressbar. - Leave blank to manually manage the updates. -* desc : str, optional - Prefix for the progressbar. -* total : int or float, optional - The number of expected iterations. If unspecified, - len(iterable) is used if possible. If float("inf") or as a last - resort, only basic progress statistics are displayed - (no ETA, no progressbar). - If ``gui`` is True and this parameter needs subsequent updating, - specify an initial arbitrary large positive number, - e.g. 9e9. -* leave : bool, optional - If [default: True], keeps all traces of the progressbar - upon termination of iteration. - If ``None``, will leave only if ``position`` is ``0``. -* file : ``io.TextIOWrapper`` or ``io.StringIO``, optional - Specifies where to output the progress messages - (default: sys.stderr). Uses ``file.write(str)`` and ``file.flush()`` - methods. For encoding, see ``write_bytes``. -* ncols : int, optional - The width of the entire output message. If specified, - dynamically resizes the progressbar to stay within this bound. - If unspecified, attempts to use environment width. The - fallback is a meter width of 10 and no limit for the counter and - statistics. If 0, will not print any meter (only stats). -* mininterval : float, optional - Minimum progress display update interval [default: 0.1] seconds. -* maxinterval : float, optional - Maximum progress display update interval [default: 10] seconds. - Automatically adjusts ``miniters`` to correspond to ``mininterval`` - after long display update lag. Only works if ``dynamic_miniters`` - or monitor thread is enabled. -* miniters : int or float, optional - Minimum progress display update interval, in iterations. - If 0 and ``dynamic_miniters``, will automatically adjust to equal - ``mininterval`` (more CPU efficient, good for tight loops). - If > 0, will skip display of specified number of iterations. - Tweak this and ``mininterval`` to get very efficient loops. - If your progress is erratic with both fast and slow iterations - (network, skipping items, etc) you should set miniters=1. -* ascii : bool or str, optional - If unspecified or False, use unicode (smooth blocks) to fill - the meter. The fallback is to use ASCII characters " 123456789#". -* disable : bool, optional - Whether to disable the entire progressbar wrapper - [default: False]. If set to None, disable on non-TTY. -* unit : str, optional - String that will be used to define the unit of each iteration - [default: it]. -* unit_scale : bool or int or float, optional - If 1 or True, the number of iterations will be reduced/scaled - automatically and a metric prefix following the - International System of Units standard will be added - (kilo, mega, etc.) [default: False]. If any other non-zero - number, will scale ``total`` and ``n``. -* dynamic_ncols : bool, optional - If set, constantly alters ``ncols`` and ``nrows`` to the - environment (allowing for window resizes) [default: False]. -* smoothing : float, optional - Exponential moving average smoothing factor for speed estimates - (ignored in GUI mode). Ranges from 0 (average speed) to 1 - (current/instantaneous speed) [default: 0.3]. -* bar_format : str, optional - Specify a custom bar string formatting. May impact performance. - [default: '{l_bar}{bar}{r_bar}'], where - l_bar='{desc}: {percentage:3.0f}%|' and - r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' - '{rate_fmt}{postfix}]' - Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, - percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, - rate, rate_fmt, rate_noinv, rate_noinv_fmt, - rate_inv, rate_inv_fmt, postfix, unit_divisor, - remaining, remaining_s, eta. - Note that a trailing ": " is automatically removed after {desc} - if the latter is empty. -* initial : int or float, optional - The initial counter value. Useful when restarting a progress - bar [default: 0]. If using float, consider specifying ``{n:.3f}`` - or similar in ``bar_format``, or specifying ``unit_scale``. -* position : int, optional - Specify the line offset to print this bar (starting from 0) - Automatic if unspecified. - Useful to manage multiple bars at once (eg, from threads). -* postfix : dict or ``*``, optional - Specify additional stats to display at the end of the bar. - Calls ``set_postfix(**postfix)`` if possible (dict). -* unit_divisor : float, optional - [default: 1000], ignored unless ``unit_scale`` is True. -* write_bytes : bool, optional - Whether to write bytes. If (default: False) will write unicode. -* lock_args : tuple, optional - Passed to ``refresh`` for intermediate output - (initialisation, iterating, and updating). -* nrows : int, optional - The screen height. If specified, hides nested bars outside this - bound. If unspecified, attempts to use environment height. - The fallback is 20. -* colour : str, optional - Bar colour (e.g. 'green', '#00ff00'). -* delay : float, optional - Don't display until [default: 0] seconds have elapsed. - -Extra CLI Options -~~~~~~~~~~~~~~~~~ - -* delim : chr, optional - Delimiting character [default: '\n']. Use '\0' for null. - N.B.: on Windows systems, Python converts '\n' to '\r\n'. -* buf_size : int, optional - String buffer size in bytes [default: 256] - used when ``delim`` is specified. -* bytes : bool, optional - If true, will count bytes, ignore ``delim``, and default - ``unit_scale`` to True, ``unit_divisor`` to 1024, and ``unit`` to 'B'. -* tee : bool, optional - If true, passes ``stdin`` to both ``stderr`` and ``stdout``. -* update : bool, optional - If true, will treat input as newly elapsed iterations, - i.e. numbers to pass to ``update()``. Note that this is slow - (~2e5 it/s) since every input must be decoded as a number. -* update_to : bool, optional - If true, will treat input as total elapsed iterations, - i.e. numbers to assign to ``self.n``. Note that this is slow - (~2e5 it/s) since every input must be decoded as a number. -* null : bool, optional - If true, will discard input (no stdout). -* manpath : str, optional - Directory in which to install tqdm man pages. -* comppath : str, optional - Directory in which to place tqdm completion. -* log : str, optional - CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET. - -Returns -~~~~~~~ - -* out : decorated iterator. - -.. code:: python - - class tqdm(): - def update(self, n=1): - """ - Manually update the progress bar, useful for streams - such as reading files. - E.g.: - >>> t = tqdm(total=filesize) # Initialise - >>> for current_buffer in stream: - ... ... - ... t.update(len(current_buffer)) - >>> t.close() - The last line is highly recommended, but possibly not necessary if - ``t.update()`` will be called in such a way that ``filesize`` will be - exactly reached and printed. - - Parameters - ---------- - n : int or float, optional - Increment to add to the internal counter of iterations - [default: 1]. If using float, consider specifying ``{n:.3f}`` - or similar in ``bar_format``, or specifying ``unit_scale``. - - Returns - ------- - out : bool or None - True if a ``display()`` was triggered. - """ - - def close(self): - """Cleanup and (if leave=False) close the progressbar.""" - - def clear(self, nomove=False): - """Clear current bar display.""" - - def refresh(self): - """ - Force refresh the display of this bar. - - Parameters - ---------- - nolock : bool, optional - If ``True``, does not lock. - If [default: ``False``]: calls ``acquire()`` on internal lock. - lock_args : tuple, optional - Passed to internal lock's ``acquire()``. - If specified, will only ``display()`` if ``acquire()`` returns ``True``. - """ - - def unpause(self): - """Restart tqdm timer from last print time.""" - - def reset(self, total=None): - """ - Resets to 0 iterations for repeated use. - - Consider combining with ``leave=True``. - - Parameters - ---------- - total : int or float, optional. Total to use for the new bar. - """ - - def set_description(self, desc=None, refresh=True): - """ - Set/modify description of the progress bar. - - Parameters - ---------- - desc : str, optional - refresh : bool, optional - Forces refresh [default: True]. - """ - - def set_postfix(self, ordered_dict=None, refresh=True, **tqdm_kwargs): - """ - Set/modify postfix (additional stats) - with automatic formatting based on datatype. - - Parameters - ---------- - ordered_dict : dict or OrderedDict, optional - refresh : bool, optional - Forces refresh [default: True]. - kwargs : dict, optional - """ - - @classmethod - def write(cls, s, file=sys.stdout, end="\n"): - """Print a message via tqdm (without overlap with bars).""" - - @property - def format_dict(self): - """Public API for read-only member access.""" - - def display(self, msg=None, pos=None): - """ - Use ``self.sp`` to display ``msg`` in the specified ``pos``. - - Consider overloading this function when inheriting to use e.g.: - ``self.some_frontend(**self.format_dict)`` instead of ``self.sp``. - - Parameters - ---------- - msg : str, optional. What to display (default: ``repr(self)``). - pos : int, optional. Position to ``moveto`` - (default: ``abs(self.pos)``). - """ - - @classmethod - @contextmanager - def wrapattr(cls, stream, method, total=None, bytes=True, **tqdm_kwargs): - """ - stream : file-like object. - method : str, "read" or "write". The result of ``read()`` and - the first argument of ``write()`` should have a ``len()``. - - >>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj: - ... while True: - ... chunk = fobj.read(chunk_size) - ... if not chunk: - ... break - """ - - @classmethod - def pandas(cls, *targs, **tqdm_kwargs): - """Registers the current `tqdm` class with `pandas`.""" - - def trange(*args, **tqdm_kwargs): - """Shortcut for `tqdm(range(*args), **tqdm_kwargs)`.""" - -Convenience Functions -~~~~~~~~~~~~~~~~~~~~~ - -.. code:: python - - def tqdm.contrib.tenumerate(iterable, start=0, total=None, - tqdm_class=tqdm.auto.tqdm, **tqdm_kwargs): - """Equivalent of `numpy.ndenumerate` or builtin `enumerate`.""" - - def tqdm.contrib.tzip(iter1, *iter2plus, **tqdm_kwargs): - """Equivalent of builtin `zip`.""" - - def tqdm.contrib.tmap(function, *sequences, **tqdm_kwargs): - """Equivalent of builtin `map`.""" - -Submodules -~~~~~~~~~~ - -.. code:: python - - class tqdm.notebook.tqdm(tqdm.tqdm): - """IPython/Jupyter Notebook widget.""" - - class tqdm.auto.tqdm(tqdm.tqdm): - """Automatically chooses beween `tqdm.notebook` and `tqdm.tqdm`.""" - - class tqdm.asyncio.tqdm(tqdm.tqdm): - """Asynchronous version.""" - @classmethod - def as_completed(cls, fs, *, loop=None, timeout=None, total=None, - **tqdm_kwargs): - """Wrapper for `asyncio.as_completed`.""" - - class tqdm.gui.tqdm(tqdm.tqdm): - """Matplotlib GUI version.""" - - class tqdm.tk.tqdm(tqdm.tqdm): - """Tkinter GUI version.""" - - class tqdm.rich.tqdm(tqdm.tqdm): - """`rich.progress` version.""" - - class tqdm.keras.TqdmCallback(keras.callbacks.Callback): - """Keras callback for epoch and batch progress.""" - - class tqdm.dask.TqdmCallback(dask.callbacks.Callback): - """Dask callback for task progress.""" - - -``contrib`` -+++++++++++ - -The ``tqdm.contrib`` package also contains experimental modules: - -- ``tqdm.contrib.itertools``: Thin wrappers around ``itertools`` -- ``tqdm.contrib.concurrent``: Thin wrappers around ``concurrent.futures`` -- ``tqdm.contrib.slack``: Posts to `Slack `__ bots -- ``tqdm.contrib.discord``: Posts to `Discord `__ bots -- ``tqdm.contrib.telegram``: Posts to `Telegram `__ bots -- ``tqdm.contrib.bells``: Automagically enables all optional features - - * ``auto``, ``pandas``, ``slack``, ``discord``, ``telegram`` - -Examples and Advanced Usage ---------------------------- - -- See the `examples `__ - folder; -- import the module and run ``help()``; -- consult the `wiki `__; - - * this has an - `excellent article `__ - on how to make a **great** progressbar; - -- check out the `slides from PyData London `__, or -- run the |binder-demo|. - -Description and additional stats -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Custom information can be displayed and updated dynamically on ``tqdm`` bars -with the ``desc`` and ``postfix`` arguments: - -.. code:: python - - from tqdm import tqdm, trange - from random import random, randint - from time import sleep - - with trange(10) as t: - for i in t: - # Description will be displayed on the left - t.set_description('GEN %i' % i) - # Postfix will be displayed on the right, - # formatted automatically based on argument's datatype - t.set_postfix(loss=random(), gen=randint(1,999), str='h', - lst=[1, 2]) - sleep(0.1) - - with tqdm(total=10, bar_format="{postfix[0]} {postfix[1][value]:>8.2g}", - postfix=["Batch", {"value": 0}]) as t: - for i in range(10): - sleep(0.1) - t.postfix[1]["value"] = i / 2 - t.update() - -Points to remember when using ``{postfix[...]}`` in the ``bar_format`` string: - -- ``postfix`` also needs to be passed as an initial argument in a compatible - format, and -- ``postfix`` will be auto-converted to a string if it is a ``dict``-like - object. To prevent this behaviour, insert an extra item into the dictionary - where the key is not a string. - -Additional ``bar_format`` parameters may also be defined by overriding -``format_dict``, and the bar itself may be modified using ``ascii``: - -.. code:: python - - from tqdm import tqdm - class TqdmExtraFormat(tqdm): - """Provides a `total_time` format parameter""" - @property - def format_dict(self): - d = super(TqdmExtraFormat, self).format_dict - total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1) - d.update(total_time=self.format_interval(total_time) + " in total") - return d - - for i in TqdmExtraFormat( - range(9), ascii=" .oO0", - bar_format="{total_time}: {percentage:.0f}%|{bar}{r_bar}"): - if i == 4: - break - -.. code:: - - 00:00 in total: 44%|0000. | 4/9 [00:00<00:00, 962.93it/s] - -Note that ``{bar}`` also supports a format specifier ``[width][type]``. - -- ``width`` - - * unspecified (default): automatic to fill ``ncols`` - * ``int >= 0``: fixed width overriding ``ncols`` logic - * ``int < 0``: subtract from the automatic default - -- ``type`` - - * ``a``: ascii (``ascii=True`` override) - * ``u``: unicode (``ascii=False`` override) - * ``b``: blank (``ascii=" "`` override) - -This means a fixed bar with right-justified text may be created by using: -``bar_format="{l_bar}{bar:10}|{bar:-10b}right-justified"`` - -Nested progress bars -~~~~~~~~~~~~~~~~~~~~ - -``tqdm`` supports nested progress bars. Here's an example: - -.. code:: python - - from tqdm.auto import trange - from time import sleep - - for i in trange(4, desc='1st loop'): - for j in trange(5, desc='2nd loop'): - for k in trange(50, desc='3rd loop', leave=False): - sleep(0.01) - -For manual control over positioning (e.g. for multi-processing use), -you may specify ``position=n`` where ``n=0`` for the outermost bar, -``n=1`` for the next, and so on. -However, it's best to check if ``tqdm`` can work without manual ``position`` -first. - -.. code:: python - - from time import sleep - from tqdm import trange, tqdm - from multiprocessing import Pool, RLock, freeze_support - - L = list(range(9)) - - def progresser(n): - interval = 0.001 / (n + 2) - total = 5000 - text = "#{}, est. {:<04.2}s".format(n, interval * total) - for _ in trange(total, desc=text, position=n): - sleep(interval) - - if __name__ == '__main__': - freeze_support() # for Windows support - tqdm.set_lock(RLock()) # for managing output contention - p = Pool(initializer=tqdm.set_lock, initargs=(tqdm.get_lock(),)) - p.map(progresser, L) - -Note that in Python 3, ``tqdm.write`` is thread-safe: - -.. code:: python - - from time import sleep - from tqdm import tqdm, trange - from concurrent.futures import ThreadPoolExecutor - - L = list(range(9)) - - def progresser(n): - interval = 0.001 / (n + 2) - total = 5000 - text = "#{}, est. {:<04.2}s".format(n, interval * total) - for _ in trange(total, desc=text): - sleep(interval) - if n == 6: - tqdm.write("n == 6 completed.") - tqdm.write("`tqdm.write()` is thread-safe in py3!") - - if __name__ == '__main__': - with ThreadPoolExecutor() as p: - p.map(progresser, L) - -Hooks and callbacks -~~~~~~~~~~~~~~~~~~~ - -``tqdm`` can easily support callbacks/hooks and manual updates. -Here's an example with ``urllib``: - -**``urllib.urlretrieve`` documentation** - - | [...] - | If present, the hook function will be called once - | on establishment of the network connection and once after each block read - | thereafter. The hook will be passed three arguments; a count of blocks - | transferred so far, a block size in bytes, and the total size of the file. - | [...] - -.. code:: python - - import urllib, os - from tqdm import tqdm - urllib = getattr(urllib, 'request', urllib) - - class TqdmUpTo(tqdm): - """Provides `update_to(n)` which uses `tqdm.update(delta_n)`.""" - def update_to(self, b=1, bsize=1, tsize=None): - """ - b : int, optional - Number of blocks transferred so far [default: 1]. - bsize : int, optional - Size of each block (in tqdm units) [default: 1]. - tsize : int, optional - Total size (in tqdm units). If [default: None] remains unchanged. - """ - if tsize is not None: - self.total = tsize - return self.update(b * bsize - self.n) # also sets self.n = b * bsize - - eg_link = "https://caspersci.uk.to/matryoshka.zip" - with TqdmUpTo(unit='B', unit_scale=True, unit_divisor=1024, miniters=1, - desc=eg_link.split('/')[-1]) as t: # all optional kwargs - urllib.urlretrieve(eg_link, filename=os.devnull, - reporthook=t.update_to, data=None) - t.total = t.n - -Inspired by `twine#242 `__. -Functional alternative in -`examples/tqdm_wget.py `__. - -It is recommend to use ``miniters=1`` whenever there is potentially -large differences in iteration speed (e.g. downloading a file over -a patchy connection). - -**Wrapping read/write methods** - -To measure throughput through a file-like object's ``read`` or ``write`` -methods, use ``CallbackIOWrapper``: - -.. code:: python - - from tqdm.auto import tqdm - from tqdm.utils import CallbackIOWrapper - - with tqdm(total=file_obj.size, - unit='B', unit_scale=True, unit_divisor=1024) as t: - fobj = CallbackIOWrapper(t.update, file_obj, "read") - while True: - chunk = fobj.read(chunk_size) - if not chunk: - break - t.reset() - # ... continue to use `t` for something else - -Alternatively, use the even simpler ``wrapattr`` convenience function, -which would condense both the ``urllib`` and ``CallbackIOWrapper`` examples -down to: - -.. code:: python - - import urllib, os - from tqdm import tqdm - - eg_link = "https://caspersci.uk.to/matryoshka.zip" - response = getattr(urllib, 'request', urllib).urlopen(eg_link) - with tqdm.wrapattr(open(os.devnull, "wb"), "write", - miniters=1, desc=eg_link.split('/')[-1], - total=getattr(response, 'length', None)) as fout: - for chunk in response: - fout.write(chunk) - -The ``requests`` equivalent is nearly identical: - -.. code:: python - - import requests, os - from tqdm import tqdm - - eg_link = "https://caspersci.uk.to/matryoshka.zip" - response = requests.get(eg_link, stream=True) - with tqdm.wrapattr(open(os.devnull, "wb"), "write", - miniters=1, desc=eg_link.split('/')[-1], - total=int(response.headers.get('content-length', 0))) as fout: - for chunk in response.iter_content(chunk_size=4096): - fout.write(chunk) - -**Custom callback** - -``tqdm`` is known for intelligently skipping unnecessary displays. To make a -custom callback take advantage of this, simply use the return value of -``update()``. This is set to ``True`` if a ``display()`` was triggered. - -.. code:: python - - from tqdm.auto import tqdm as std_tqdm - - def external_callback(*args, **kwargs): - ... - - class TqdmExt(std_tqdm): - def update(self, n=1): - displayed = super(TqdmExt, self).update(n) - if displayed: - external_callback(**self.format_dict) - return displayed - -``asyncio`` -~~~~~~~~~~~ - -Note that ``break`` isn't currently caught by asynchronous iterators. -This means that ``tqdm`` cannot clean up after itself in this case: - -.. code:: python - - from tqdm.asyncio import tqdm - - async for i in tqdm(range(9)): - if i == 2: - break - -Instead, either call ``pbar.close()`` manually or use the context manager syntax: - -.. code:: python - - from tqdm.asyncio import tqdm - - with tqdm(range(9)) as pbar: - async for i in pbar: - if i == 2: - break - -Pandas Integration -~~~~~~~~~~~~~~~~~~ - -Due to popular demand we've added support for ``pandas`` -- here's an example -for ``DataFrame.progress_apply`` and ``DataFrameGroupBy.progress_apply``: - -.. code:: python - - import pandas as pd - import numpy as np - from tqdm import tqdm - - df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) - - # Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm` - # (can use `tqdm.gui.tqdm`, `tqdm.notebook.tqdm`, optional kwargs, etc.) - tqdm.pandas(desc="my bar!") - - # Now you can use `progress_apply` instead of `apply` - # and `progress_map` instead of `map` - df.progress_apply(lambda x: x**2) - # can also groupby: - # df.groupby(0).progress_apply(lambda x: x**2) - -In case you're interested in how this works (and how to modify it for your -own callbacks), see the -`examples `__ -folder or import the module and run ``help()``. - -Keras Integration -~~~~~~~~~~~~~~~~~ - -A ``keras`` callback is also available: - -.. code:: python - - from tqdm.keras import TqdmCallback - - ... - - model.fit(..., verbose=0, callbacks=[TqdmCallback()]) - -Dask Integration -~~~~~~~~~~~~~~~~ - -A ``dask`` callback is also available: - -.. code:: python - - from tqdm.dask import TqdmCallback - - with TqdmCallback(desc="compute"): - ... - arr.compute() - - # or use callback globally - cb = TqdmCallback(desc="global") - cb.register() - arr.compute() - -IPython/Jupyter Integration -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IPython/Jupyter is supported via the ``tqdm.notebook`` submodule: - -.. code:: python - - from tqdm.notebook import trange, tqdm - from time import sleep - - for i in trange(3, desc='1st loop'): - for j in tqdm(range(100), desc='2nd loop'): - sleep(0.01) - -In addition to ``tqdm`` features, the submodule provides a native Jupyter -widget (compatible with IPython v1-v4 and Jupyter), fully working nested bars -and colour hints (blue: normal, green: completed, red: error/interrupt, -light blue: no ETA); as demonstrated below. - -|Screenshot-Jupyter1| -|Screenshot-Jupyter2| -|Screenshot-Jupyter3| - -The ``notebook`` version supports percentage or pixels for overall width -(e.g.: ``ncols='100%'`` or ``ncols='480px'``). - -It is also possible to let ``tqdm`` automatically choose between -console or notebook versions by using the ``autonotebook`` submodule: - -.. code:: python - - from tqdm.autonotebook import tqdm - tqdm.pandas() - -Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook -since it is not meant to be possible to distinguish between ``jupyter notebook`` -and ``jupyter console``. Use ``auto`` instead of ``autonotebook`` to suppress -this warning. - -Note that notebooks will display the bar in the cell where it was created. -This may be a different cell from the one where it is used. -If this is not desired, either - -- delay the creation of the bar to the cell where it must be displayed, or -- create the bar with ``display=False``, and in a later cell call - ``display(bar.container)``: - -.. code:: python - - from tqdm.notebook import tqdm - pbar = tqdm(..., display=False) - -.. code:: python - - # different cell - display(pbar.container) - -The ``keras`` callback has a ``display()`` method which can be used likewise: - -.. code:: python - - from tqdm.keras import TqdmCallback - cbk = TqdmCallback(display=False) - -.. code:: python - - # different cell - cbk.display() - model.fit(..., verbose=0, callbacks=[cbk]) - -Another possibility is to have a single bar (near the top of the notebook) -which is constantly re-used (using ``reset()`` rather than ``close()``). -For this reason, the notebook version (unlike the CLI version) does not -automatically call ``close()`` upon ``Exception``. - -.. code:: python - - from tqdm.notebook import tqdm - pbar = tqdm() - -.. code:: python - - # different cell - iterable = range(100) - pbar.reset(total=len(iterable)) # initialise with new `total` - for i in iterable: - pbar.update() - pbar.refresh() # force print final status but don't `close()` - -Custom Integration -~~~~~~~~~~~~~~~~~~ - -To change the default arguments (such as making ``dynamic_ncols=True``), -simply use built-in Python magic: - -.. code:: python - - from functools import partial - from tqdm import tqdm as std_tqdm - tqdm = partial(std_tqdm, dynamic_ncols=True) - -For further customisation, -``tqdm`` may be inherited from to create custom callbacks (as with the -``TqdmUpTo`` example `above <#hooks-and-callbacks>`__) or for custom frontends -(e.g. GUIs such as notebook or plotting packages). In the latter case: - -1. ``def __init__()`` to call ``super().__init__(..., gui=True)`` to disable - terminal ``status_printer`` creation. -2. Redefine: ``close()``, ``clear()``, ``display()``. - -Consider overloading ``display()`` to use e.g. -``self.frontend(**self.format_dict)`` instead of ``self.sp(repr(self))``. - -Some submodule examples of inheritance: - -- `tqdm/notebook.py `__ -- `tqdm/gui.py `__ -- `tqdm/tk.py `__ -- `tqdm/contrib/slack.py `__ -- `tqdm/contrib/discord.py `__ -- `tqdm/contrib/telegram.py `__ - -Dynamic Monitor/Meter -~~~~~~~~~~~~~~~~~~~~~ - -You can use a ``tqdm`` as a meter which is not monotonically increasing. -This could be because ``n`` decreases (e.g. a CPU usage monitor) or ``total`` -changes. - -One example would be recursively searching for files. The ``total`` is the -number of objects found so far, while ``n`` is the number of those objects which -are files (rather than folders): - -.. code:: python - - from tqdm import tqdm - import os.path - - def find_files_recursively(path, show_progress=True): - files = [] - # total=1 assumes `path` is a file - t = tqdm(total=1, unit="file", disable=not show_progress) - if not os.path.exists(path): - raise IOError("Cannot find:" + path) - - def append_found_file(f): - files.append(f) - t.update() - - def list_found_dir(path): - """returns os.listdir(path) assuming os.path.isdir(path)""" - listing = os.listdir(path) - # subtract 1 since a "file" we found was actually this directory - t.total += len(listing) - 1 - # fancy way to give info without forcing a refresh - t.set_postfix(dir=path[-10:], refresh=False) - t.update(0) # may trigger a refresh - return listing - - def recursively_search(path): - if os.path.isdir(path): - for f in list_found_dir(path): - recursively_search(os.path.join(path, f)) - else: - append_found_file(path) - - recursively_search(path) - t.set_postfix(dir=path) - t.close() - return files - -Using ``update(0)`` is a handy way to let ``tqdm`` decide when to trigger a -display refresh to avoid console spamming. - -Writing messages -~~~~~~~~~~~~~~~~ - -This is a work in progress (see -`#737 `__). - -Since ``tqdm`` uses a simple printing mechanism to display progress bars, -you should not write any message in the terminal using ``print()`` while -a progressbar is open. - -To write messages in the terminal without any collision with ``tqdm`` bar -display, a ``.write()`` method is provided: - -.. code:: python - - from tqdm.auto import tqdm, trange - from time import sleep - - bar = trange(10) - for i in bar: - # Print using tqdm class method .write() - sleep(0.1) - if not (i % 3): - tqdm.write("Done task %i" % i) - # Can also use bar.write() - -By default, this will print to standard output ``sys.stdout``. but you can -specify any file-like object using the ``file`` argument. For example, this -can be used to redirect the messages writing to a log file or class. - -Redirecting writing -~~~~~~~~~~~~~~~~~~~ - -If using a library that can print messages to the console, editing the library -by replacing ``print()`` with ``tqdm.write()`` may not be desirable. -In that case, redirecting ``sys.stdout`` to ``tqdm.write()`` is an option. - -To redirect ``sys.stdout``, create a file-like class that will write -any input string to ``tqdm.write()``, and supply the arguments -``file=sys.stdout, dynamic_ncols=True``. - -A reusable canonical example is given below: - -.. code:: python - - from time import sleep - import contextlib - import sys - from tqdm import tqdm - from tqdm.contrib import DummyTqdmFile - - - @contextlib.contextmanager - def std_out_err_redirect_tqdm(): - orig_out_err = sys.stdout, sys.stderr - try: - sys.stdout, sys.stderr = map(DummyTqdmFile, orig_out_err) - yield orig_out_err[0] - # Relay exceptions - except Exception as exc: - raise exc - # Always restore sys.stdout/err if necessary - finally: - sys.stdout, sys.stderr = orig_out_err - - def some_fun(i): - print("Fee, fi, fo,".split()[i]) - - # Redirect stdout to tqdm.write() (don't forget the `as save_stdout`) - with std_out_err_redirect_tqdm() as orig_stdout: - # tqdm needs the original stdout - # and dynamic_ncols=True to autodetect console width - for i in tqdm(range(3), file=orig_stdout, dynamic_ncols=True): - sleep(.5) - some_fun(i) - - # After the `with`, printing is restored - print("Done!") - -Redirecting ``logging`` -~~~~~~~~~~~~~~~~~~~~~~~ - -Similar to ``sys.stdout``/``sys.stderr`` as detailed above, console ``logging`` -may also be redirected to ``tqdm.write()``. - -Warning: if also redirecting ``sys.stdout``/``sys.stderr``, make sure to -redirect ``logging`` first if needed. - -Helper methods are available in ``tqdm.contrib.logging``. For example: - -.. code:: python - - import logging - from tqdm import trange - from tqdm.contrib.logging import logging_redirect_tqdm - - LOG = logging.getLogger(__name__) - - if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) - with logging_redirect_tqdm(): - for i in trange(9): - if i == 4: - LOG.info("console logging redirected to `tqdm.write()`") - # logging restored - -Monitoring thread, intervals and miniters -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``tqdm`` implements a few tricks to increase efficiency and reduce overhead. - -- Avoid unnecessary frequent bar refreshing: ``mininterval`` defines how long - to wait between each refresh. ``tqdm`` always gets updated in the background, - but it will display only every ``mininterval``. -- Reduce number of calls to check system clock/time. -- ``mininterval`` is more intuitive to configure than ``miniters``. - A clever adjustment system ``dynamic_miniters`` will automatically adjust - ``miniters`` to the amount of iterations that fit into time ``mininterval``. - Essentially, ``tqdm`` will check if it's time to print without actually - checking time. This behaviour can be still be bypassed by manually setting - ``miniters``. - -However, consider a case with a combination of fast and slow iterations. -After a few fast iterations, ``dynamic_miniters`` will set ``miniters`` to a -large number. When iteration rate subsequently slows, ``miniters`` will -remain large and thus reduce display update frequency. To address this: - -- ``maxinterval`` defines the maximum time between display refreshes. - A concurrent monitoring thread checks for overdue updates and forces one - where necessary. - -The monitoring thread should not have a noticeable overhead, and guarantees -updates at least every 10 seconds by default. -This value can be directly changed by setting the ``monitor_interval`` of -any ``tqdm`` instance (i.e. ``t = tqdm.tqdm(...); t.monitor_interval = 2``). -The monitor thread may be disabled application-wide by setting -``tqdm.tqdm.monitor_interval = 0`` before instantiation of any ``tqdm`` bar. - - -Merch ------ - -You can buy `tqdm branded merch `__ now! - -Contributions -------------- - -|GitHub-Commits| |GitHub-Issues| |GitHub-PRs| |OpenHub-Status| |GitHub-Contributions| |CII Best Practices| - -All source code is hosted on `GitHub `__. -Contributions are welcome. - -See the -`CONTRIBUTING `__ -file for more information. - -Developers who have made significant contributions, ranked by *SLoC* -(surviving lines of code, -`git fame `__ ``-wMC --excl '\.(png|gif|jpg)$'``), -are: - -==================== ======================================================== ==== ================================ -Name ID SLoC Notes -==================== ======================================================== ==== ================================ -Casper da Costa-Luis `casperdcl `__ ~80% primary maintainer |Gift-Casper| -Stephen Larroque `lrq3000 `__ ~9% team member -Martin Zugnoni `martinzugnoni `__ ~3% -Daniel Ecer `de-code `__ ~2% -Richard Sheridan `richardsheridan `__ ~1% -Guangshuo Chen `chengs `__ ~1% -Helio Machado `0x2b3bfa0 `__ ~1% -Kyle Altendorf `altendky `__ <1% -Noam Yorav-Raphael `noamraph `__ <1% original author -Matthew Stevens `mjstevens777 `__ <1% -Hadrien Mary `hadim `__ <1% team member -Mikhail Korobov `kmike `__ <1% team member -==================== ======================================================== ==== ================================ - -Ports to Other Languages -~~~~~~~~~~~~~~~~~~~~~~~~ - -A list is available on -`this wiki page `__. - - -LICENCE -------- - -Open Source (OSI approved): |LICENCE| - -Citation information: |DOI| - -|README-Hits| (Since 19 May 2016) - -.. |Logo| image:: https://tqdm.github.io/img/logo.gif -.. |Screenshot| image:: https://tqdm.github.io/img/tqdm.gif -.. |Video| image:: https://tqdm.github.io/img/video.jpg - :target: https://tqdm.github.io/video -.. |Slides| image:: https://tqdm.github.io/img/slides.jpg - :target: https://tqdm.github.io/PyData2019/slides.html -.. |Merch| image:: https://tqdm.github.io/img/merch.jpg - :target: https://tqdm.github.io/merch -.. |Build-Status| image:: https://img.shields.io/github/actions/workflow/status/tqdm/tqdm/test.yml?branch=master&label=tqdm&logo=GitHub - :target: https://github.com/tqdm/tqdm/actions/workflows/test.yml -.. |Coverage-Status| image:: https://img.shields.io/coveralls/github/tqdm/tqdm/master?logo=coveralls - :target: https://coveralls.io/github/tqdm/tqdm -.. |Branch-Coverage-Status| image:: https://codecov.io/gh/tqdm/tqdm/branch/master/graph/badge.svg - :target: https://codecov.io/gh/tqdm/tqdm -.. |Codacy-Grade| image:: https://app.codacy.com/project/badge/Grade/3f965571598f44549c7818f29cdcf177 - :target: https://www.codacy.com/gh/tqdm/tqdm/dashboard -.. |CII Best Practices| image:: https://bestpractices.coreinfrastructure.org/projects/3264/badge - :target: https://bestpractices.coreinfrastructure.org/projects/3264 -.. |GitHub-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=86400&logo=github&logoColor=white - :target: https://github.com/tqdm/tqdm/releases -.. |GitHub-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg?logo=github&logoColor=white - :target: https://github.com/tqdm/tqdm/network -.. |GitHub-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg?logo=github&logoColor=white - :target: https://github.com/tqdm/tqdm/stargazers -.. |GitHub-Commits| image:: https://img.shields.io/github/commit-activity/y/tqdm/tqdm.svg?logo=git&logoColor=white - :target: https://github.com/tqdm/tqdm/graphs/commit-activity -.. |GitHub-Issues| image:: https://img.shields.io/github/issues-closed/tqdm/tqdm.svg?logo=github&logoColor=white - :target: https://github.com/tqdm/tqdm/issues?q= -.. |GitHub-PRs| image:: https://img.shields.io/github/issues-pr-closed/tqdm/tqdm.svg?logo=github&logoColor=white - :target: https://github.com/tqdm/tqdm/pulls -.. |GitHub-Contributions| image:: https://img.shields.io/github/contributors/tqdm/tqdm.svg?logo=github&logoColor=white - :target: https://github.com/tqdm/tqdm/graphs/contributors -.. |GitHub-Updated| image:: https://img.shields.io/github/last-commit/tqdm/tqdm/master.svg?logo=github&logoColor=white&label=pushed - :target: https://github.com/tqdm/tqdm/pulse -.. |Gift-Casper| image:: https://img.shields.io/badge/dynamic/json.svg?color=ff69b4&label=gifts%20received&prefix=%C2%A3&query=%24..sum&url=https%3A%2F%2Fcaspersci.uk.to%2Fgifts.json - :target: https://cdcl.ml/sponsor -.. |Versions| image:: https://img.shields.io/pypi/v/tqdm.svg - :target: https://tqdm.github.io/releases -.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg?label=pypi%20downloads&logo=PyPI&logoColor=white - :target: https://pepy.tech/project/tqdm -.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg?logo=python&logoColor=white - :target: https://pypi.org/project/tqdm -.. |Conda-Forge-Status| image:: https://img.shields.io/conda/v/conda-forge/tqdm.svg?label=conda-forge&logo=conda-forge - :target: https://anaconda.org/conda-forge/tqdm -.. |Snapcraft| image:: https://img.shields.io/badge/snap-install-82BEA0.svg?logo=snapcraft - :target: https://snapcraft.io/tqdm -.. |Docker| image:: https://img.shields.io/badge/docker-pull-blue.svg?logo=docker&logoColor=white - :target: https://hub.docker.com/r/tqdm/tqdm -.. |Libraries-Rank| image:: https://img.shields.io/librariesio/sourcerank/pypi/tqdm.svg?logo=koding&logoColor=white - :target: https://libraries.io/pypi/tqdm -.. |Libraries-Dependents| image:: https://img.shields.io/librariesio/dependent-repos/pypi/tqdm.svg?logo=koding&logoColor=white - :target: https://github.com/tqdm/tqdm/network/dependents -.. |OpenHub-Status| image:: https://www.openhub.net/p/tqdm/widgets/project_thin_badge?format=gif - :target: https://www.openhub.net/p/tqdm?ref=Thin+badge -.. |awesome-python| image:: https://awesome.re/mentioned-badge.svg - :target: https://github.com/vinta/awesome-python -.. |LICENCE| image:: https://img.shields.io/pypi/l/tqdm.svg - :target: https://raw.githubusercontent.com/tqdm/tqdm/master/LICENCE -.. |DOI| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.595120-blue.svg - :target: https://doi.org/10.5281/zenodo.595120 -.. |binder-demo| image:: https://mybinder.org/badge_logo.svg - :target: https://mybinder.org/v2/gh/tqdm/tqdm/master?filepath=DEMO.ipynb -.. |Screenshot-Jupyter1| image:: https://tqdm.github.io/img/jupyter-1.gif -.. |Screenshot-Jupyter2| image:: https://tqdm.github.io/img/jupyter-2.gif -.. |Screenshot-Jupyter3| image:: https://tqdm.github.io/img/jupyter-3.gif -.. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif - :target: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social diff --git a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/RECORD b/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/RECORD deleted file mode 100644 index 27d026912d1070d5d28d67efa47975eacce07501..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/RECORD +++ /dev/null @@ -1,74 +0,0 @@ -../../../bin/tqdm,sha256=LXe-EomVfv7JW37VCwXGzkkCQJ-V2vnmzs_zJpowdDs,244 -tqdm-4.66.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -tqdm-4.66.1.dist-info/LICENCE,sha256=thXS10gIiloJMkKWQg2f4Ja01RWnHkNAVC73t7MRDx4,1985 -tqdm-4.66.1.dist-info/METADATA,sha256=4dDZaeXLmSGfiKGYcdob2BwQVpxAoU9xQKYp_Umv8ys,57607 -tqdm-4.66.1.dist-info/RECORD,, -tqdm-4.66.1.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92 -tqdm-4.66.1.dist-info/entry_points.txt,sha256=ReJCH7Ui3Zyh6M16E4OhsZ1oU7WtMXCfbtoyBhGO29Y,39 -tqdm-4.66.1.dist-info/top_level.txt,sha256=NLiUJNfmc9At15s7JURiwvqMEjUi9G5PMGRrmMYzNSM,5 -tqdm/__init__.py,sha256=9mQNYSSqP99JasubEC1POJLMmhkkBH6cJZxPIR5G2pQ,1572 -tqdm/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30 -tqdm/__pycache__/__init__.cpython-38.pyc,, -tqdm/__pycache__/__main__.cpython-38.pyc,, -tqdm/__pycache__/_dist_ver.cpython-38.pyc,, -tqdm/__pycache__/_main.cpython-38.pyc,, -tqdm/__pycache__/_monitor.cpython-38.pyc,, -tqdm/__pycache__/_tqdm.cpython-38.pyc,, -tqdm/__pycache__/_tqdm_gui.cpython-38.pyc,, -tqdm/__pycache__/_tqdm_notebook.cpython-38.pyc,, -tqdm/__pycache__/_tqdm_pandas.cpython-38.pyc,, -tqdm/__pycache__/_utils.cpython-38.pyc,, -tqdm/__pycache__/asyncio.cpython-38.pyc,, -tqdm/__pycache__/auto.cpython-38.pyc,, -tqdm/__pycache__/autonotebook.cpython-38.pyc,, -tqdm/__pycache__/cli.cpython-38.pyc,, -tqdm/__pycache__/dask.cpython-38.pyc,, -tqdm/__pycache__/gui.cpython-38.pyc,, -tqdm/__pycache__/keras.cpython-38.pyc,, -tqdm/__pycache__/notebook.cpython-38.pyc,, -tqdm/__pycache__/rich.cpython-38.pyc,, -tqdm/__pycache__/std.cpython-38.pyc,, -tqdm/__pycache__/tk.cpython-38.pyc,, -tqdm/__pycache__/utils.cpython-38.pyc,, -tqdm/__pycache__/version.cpython-38.pyc,, -tqdm/_dist_ver.py,sha256=gmg9Ezwhpto7l9mix4BN8_EyDWGhIEFJ1yPBeak4UcA,23 -tqdm/_main.py,sha256=9ySvgmi_2Sw4CAo5UDW0Q2dxfTryboEWGHohfCJz0sA,283 -tqdm/_monitor.py,sha256=Uku-DPWgzJ7dO5CK08xKJK-E_F6qQ-JB3ksuXczSYR0,3699 -tqdm/_tqdm.py,sha256=LfLCuJ6bpsVo9xilmtBXyEm1vGnUCFrliW85j3J-nD4,283 -tqdm/_tqdm_gui.py,sha256=03Hc8KayxJveieI5-0-2NGiDpLvw9jZekofJUV7CCwk,287 -tqdm/_tqdm_notebook.py,sha256=BuHiLuxu6uEfZFaPJW3RPpPaxaVctEQA3kdSJSDL1hw,307 -tqdm/_tqdm_pandas.py,sha256=c9jptUgigN6axRDhRd4Rif98Tmxeopc1nFNFhIpbFUE,888 -tqdm/_utils.py,sha256=_4E73bfDj4f1s3sM42NLHNrZDOkijZoWq-n6xWLkdZ8,553 -tqdm/asyncio.py,sha256=WcWbVEjc1-GxqnN0BVntDuwYR31JN9SV7ERZhEz8kKo,2775 -tqdm/auto.py,sha256=nDZflj6p2zKkjBCNBourrhS81zYfZy1_dQvbckrdW8o,871 -tqdm/autonotebook.py,sha256=Yb9F5uaiBPhfbDDFpbtoG8I2YUw3uQJ89rUDLbfR6ws,956 -tqdm/cli.py,sha256=RZh5sKVclaNp_7tZ3iCXWJB3-V6KfeQNNw7mZ818gMc,10594 -tqdm/completion.sh,sha256=j79KbSmpIj_E11jfTfBXrGnUTzKXVpQ1vGVQvsyDRl4,946 -tqdm/contrib/__init__.py,sha256=cNNaRURdcPjbQpkxPGe4iaShyQr_Dx8h6NQJubPhq7g,2513 -tqdm/contrib/__pycache__/__init__.cpython-38.pyc,, -tqdm/contrib/__pycache__/bells.cpython-38.pyc,, -tqdm/contrib/__pycache__/concurrent.cpython-38.pyc,, -tqdm/contrib/__pycache__/discord.cpython-38.pyc,, -tqdm/contrib/__pycache__/itertools.cpython-38.pyc,, -tqdm/contrib/__pycache__/logging.cpython-38.pyc,, -tqdm/contrib/__pycache__/slack.cpython-38.pyc,, -tqdm/contrib/__pycache__/telegram.cpython-38.pyc,, -tqdm/contrib/__pycache__/utils_worker.cpython-38.pyc,, -tqdm/contrib/bells.py,sha256=Yx1HqGCmHrESCAO700j5wE__JCleNODJxedh1ijPLD0,837 -tqdm/contrib/concurrent.py,sha256=K1yjloKS5WRNFyjLRth0DmU5PAnDbF0A-GD27N-J4a8,3986 -tqdm/contrib/discord.py,sha256=hhbOL1VGTWXQ4z1RUsIybhga7oUMYH5CoAkNWTt7t70,3962 -tqdm/contrib/itertools.py,sha256=WdKKQU5eSzsqHu29SN_oH12huYZo0Jihqoi9-nVhwz4,774 -tqdm/contrib/logging.py,sha256=aUvbBPGm0jetH22p1H5bobkdzewwYpXkdO8C_6nmAJk,3785 -tqdm/contrib/slack.py,sha256=CYIzKBgbk0azM19F4kSA8Ccod9I8hNfuscbcc9kjGYU,4068 -tqdm/contrib/telegram.py,sha256=ICWNBIb-l-quSgjKw4PhRdrH2_bKk7umy6BfEsp9EuU,5100 -tqdm/contrib/utils_worker.py,sha256=HJP5Mz1S1xyzEke2JaqJ2sYLHXADYoo2epT5AzQ38eA,1207 -tqdm/dask.py,sha256=RWR3rz9s36zNceeESTm-F3H1F7dxuBuqS1bhifOuvEY,1337 -tqdm/gui.py,sha256=LhGizt5G1w4f17OjFRBWza8MEmQZjrFgTx9Y9Lc7-gA,5809 -tqdm/keras.py,sha256=crCBtNnOr8ZzdQVPzPNWXDH5dMnsmpfkFM289FzO5Ds,4359 -tqdm/notebook.py,sha256=Life3uD3PvUnpEK3Zfhs_anX2UPN5p84ZtxkDKlswx0,10951 -tqdm/rich.py,sha256=8SamiW-LlUKEMQwzubomHCXkX6awaz-7Tq-gnMkJJ5A,5018 -tqdm/std.py,sha256=zIybtwP4e7zWUPfLEgARoN1pZXtefy4EVc4aLTJwA6E,57482 -tqdm/tk.py,sha256=Hp9QwXTsihURoxt5aXbIe8Cu1qjLBZzkhfl_nAgD418,6727 -tqdm/tqdm.1,sha256=aILyUPk2S4OPe_uWy2P4AMjUf0oQ6PUW0nLYXB-BWwI,7889 -tqdm/utils.py,sha256=hKNXysKfWDhjeSQ93dXrEdZ2sjxCGJKlyfggWHB2MDU,11890 -tqdm/version.py,sha256=-1yWjfu3P0eghVsysHH07fbzdiADNRdzRtYPqOaqR2A,333 diff --git a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/WHEEL b/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/WHEEL deleted file mode 100644 index 2c08da084599354e5b2dbccb3ab716165e63d1a0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.41.1) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/entry_points.txt b/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/entry_points.txt deleted file mode 100644 index 540e60f4e073bc53a5f0a521a3639e0d80780af4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[console_scripts] -tqdm = tqdm.cli:main diff --git a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/top_level.txt b/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/top_level.txt deleted file mode 100644 index 78620c472c9d799a14ccb02a0233f4669b3bcdcb..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm-4.66.1.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -tqdm diff --git a/venv/lib/python3.8/site-packages/tqdm/__init__.py b/venv/lib/python3.8/site-packages/tqdm/__init__.py deleted file mode 100644 index 8081f77b8812f3b42d7949daa4195d2c35dc70ac..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -from ._monitor import TMonitor, TqdmSynchronisationWarning -from ._tqdm_pandas import tqdm_pandas -from .cli import main # TODO: remove in v5.0.0 -from .gui import tqdm as tqdm_gui # TODO: remove in v5.0.0 -from .gui import trange as tgrange # TODO: remove in v5.0.0 -from .std import ( - TqdmDeprecationWarning, TqdmExperimentalWarning, TqdmKeyError, TqdmMonitorWarning, - TqdmTypeError, TqdmWarning, tqdm, trange) -from .version import __version__ - -__all__ = ['tqdm', 'tqdm_gui', 'trange', 'tgrange', 'tqdm_pandas', - 'tqdm_notebook', 'tnrange', 'main', 'TMonitor', - 'TqdmTypeError', 'TqdmKeyError', - 'TqdmWarning', 'TqdmDeprecationWarning', - 'TqdmExperimentalWarning', - 'TqdmMonitorWarning', 'TqdmSynchronisationWarning', - '__version__'] - - -def tqdm_notebook(*args, **kwargs): # pragma: no cover - """See tqdm.notebook.tqdm for full documentation""" - from warnings import warn - - from .notebook import tqdm as _tqdm_notebook - warn("This function will be removed in tqdm==5.0.0\n" - "Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`", - TqdmDeprecationWarning, stacklevel=2) - return _tqdm_notebook(*args, **kwargs) - - -def tnrange(*args, **kwargs): # pragma: no cover - """Shortcut for `tqdm.notebook.tqdm(range(*args), **kwargs)`.""" - from warnings import warn - - from .notebook import trange as _tnrange - warn("Please use `tqdm.notebook.trange` instead of `tqdm.tnrange`", - TqdmDeprecationWarning, stacklevel=2) - return _tnrange(*args, **kwargs) diff --git a/venv/lib/python3.8/site-packages/tqdm/__main__.py b/venv/lib/python3.8/site-packages/tqdm/__main__.py deleted file mode 100644 index 4e28416e104515e90fca4b69cc60d0c61fd15d61..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/__main__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .cli import main - -main() diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 99cb9074d48e45dd5ad5b390accedc972fc59746..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/__main__.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/__main__.cpython-38.pyc deleted file mode 100644 index 6f180e068000291865d4bd6490e2cc778516a311..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/__main__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_dist_ver.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/_dist_ver.cpython-38.pyc deleted file mode 100644 index d3f7ac61112a59d863e6fea2f6de10fe5d16031a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_dist_ver.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_main.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/_main.cpython-38.pyc deleted file mode 100644 index f59a61e5ca294cef497c6718a4e40de2660636b2..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_main.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_monitor.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/_monitor.cpython-38.pyc deleted file mode 100644 index 6e17ed24bee7ec59ee1ca5e2a5bfc2ea1d9cac33..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_monitor.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm.cpython-38.pyc deleted file mode 100644 index b987e0f429680a01c76e48c1bfe2956865c0a5ff..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_gui.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_gui.cpython-38.pyc deleted file mode 100644 index 7591062888072c806275fb2a5348feb2a089c21f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_gui.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_notebook.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_notebook.cpython-38.pyc deleted file mode 100644 index d7737c0188bf1e291bf270c0c301bca0714e149f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_notebook.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_pandas.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_pandas.cpython-38.pyc deleted file mode 100644 index 3148749b74557218173e9c623e91da2f04ef5526..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_tqdm_pandas.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/_utils.cpython-38.pyc deleted file mode 100644 index 016580ba6d4b0c82b2359fc810ecc32286467c10..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/_utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/asyncio.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/asyncio.cpython-38.pyc deleted file mode 100644 index e336bc37ad53535e8fd6bc382422453f952f7bf7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/asyncio.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/auto.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/auto.cpython-38.pyc deleted file mode 100644 index ae4bd32e4aa67b378455b56dcadaf6ed10ec1465..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/auto.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/autonotebook.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/autonotebook.cpython-38.pyc deleted file mode 100644 index 71cbecc7660b94fe78d2d7be68e5e5675858a091..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/autonotebook.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/cli.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/cli.cpython-38.pyc deleted file mode 100644 index c6cfa7f09b9dc11dce15268ac1fc9ba0b1cc1313..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/cli.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/dask.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/dask.cpython-38.pyc deleted file mode 100644 index 82f10f69ac94502f314c10961c68ad03c1b64e9c..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/dask.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/gui.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/gui.cpython-38.pyc deleted file mode 100644 index c371e98d73d973236f01b91d135b9f2355a8b329..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/gui.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/keras.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/keras.cpython-38.pyc deleted file mode 100644 index b7068793c7327e27a93a9a13c6aa0fd9e12be650..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/keras.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/notebook.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/notebook.cpython-38.pyc deleted file mode 100644 index 338e93bd2ede91cb330ae62623791e35cfe96dac..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/notebook.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/rich.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/rich.cpython-38.pyc deleted file mode 100644 index b19a7118ca2f83f6042752746f28c84f72b6c19d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/rich.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/std.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/std.cpython-38.pyc deleted file mode 100644 index 4a62c60a2d5e9db040f3d8763bd99acfdfc77463..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/std.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/tk.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/tk.cpython-38.pyc deleted file mode 100644 index bcbb3e72dd0bc5e6c264d3fa3c19a637dcfada22..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/tk.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/utils.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/utils.cpython-38.pyc deleted file mode 100644 index 39f0c886d9ab41738e03b9c665fd048b3a15eff5..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/utils.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/__pycache__/version.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/__pycache__/version.cpython-38.pyc deleted file mode 100644 index 86fa1ce38386276178a18654c39befc5c69e13c7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/__pycache__/version.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/_dist_ver.py b/venv/lib/python3.8/site-packages/tqdm/_dist_ver.py deleted file mode 100644 index 75bd7e081d8ab38759dc6ed9c6577f9ef85d6ce4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/_dist_ver.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = '4.66.1' diff --git a/venv/lib/python3.8/site-packages/tqdm/_main.py b/venv/lib/python3.8/site-packages/tqdm/_main.py deleted file mode 100644 index 04fdeeff17b5cc84b210f445b54b87d5b99e3748..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/_main.py +++ /dev/null @@ -1,9 +0,0 @@ -from warnings import warn - -from .cli import * # NOQA -from .cli import __all__ # NOQA -from .std import TqdmDeprecationWarning - -warn("This function will be removed in tqdm==5.0.0\n" - "Please use `tqdm.cli.*` instead of `tqdm._main.*`", - TqdmDeprecationWarning, stacklevel=2) diff --git a/venv/lib/python3.8/site-packages/tqdm/_monitor.py b/venv/lib/python3.8/site-packages/tqdm/_monitor.py deleted file mode 100644 index f71aa56817ca77eba5df4a2dd11cb0c4a9a7ea1c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/_monitor.py +++ /dev/null @@ -1,95 +0,0 @@ -import atexit -from threading import Event, Thread, current_thread -from time import time -from warnings import warn - -__all__ = ["TMonitor", "TqdmSynchronisationWarning"] - - -class TqdmSynchronisationWarning(RuntimeWarning): - """tqdm multi-thread/-process errors which may cause incorrect nesting - but otherwise no adverse effects""" - pass - - -class TMonitor(Thread): - """ - Monitoring thread for tqdm bars. - Monitors if tqdm bars are taking too much time to display - and readjusts miniters automatically if necessary. - - Parameters - ---------- - tqdm_cls : class - tqdm class to use (can be core tqdm or a submodule). - sleep_interval : float - Time to sleep between monitoring checks. - """ - _test = {} # internal vars for unit testing - - def __init__(self, tqdm_cls, sleep_interval): - Thread.__init__(self) - self.daemon = True # kill thread when main killed (KeyboardInterrupt) - self.woken = 0 # last time woken up, to sync with monitor - self.tqdm_cls = tqdm_cls - self.sleep_interval = sleep_interval - self._time = self._test.get("time", time) - self.was_killed = self._test.get("Event", Event)() - atexit.register(self.exit) - self.start() - - def exit(self): - self.was_killed.set() - if self is not current_thread(): - self.join() - return self.report() - - def get_instances(self): - # returns a copy of started `tqdm_cls` instances - return [i for i in self.tqdm_cls._instances.copy() - # Avoid race by checking that the instance started - if hasattr(i, 'start_t')] - - def run(self): - cur_t = self._time() - while True: - # After processing and before sleeping, notify that we woke - # Need to be done just before sleeping - self.woken = cur_t - # Sleep some time... - self.was_killed.wait(self.sleep_interval) - # Quit if killed - if self.was_killed.is_set(): - return - # Then monitor! - # Acquire lock (to access _instances) - with self.tqdm_cls.get_lock(): - cur_t = self._time() - # Check tqdm instances are waiting too long to print - instances = self.get_instances() - for instance in instances: - # Check event in loop to reduce blocking time on exit - if self.was_killed.is_set(): - return - # Only if mininterval > 1 (else iterations are just slow) - # and last refresh exceeded maxinterval - if ( - instance.miniters > 1 - and (cur_t - instance.last_print_t) >= instance.maxinterval - ): - # force bypassing miniters on next iteration - # (dynamic_miniters adjusts mininterval automatically) - instance.miniters = 1 - # Refresh now! (works only for manual tqdm) - instance.refresh(nolock=True) - # Remove accidental long-lived strong reference - del instance - if instances != self.get_instances(): # pragma: nocover - warn("Set changed size during iteration" + - " (see https://github.com/tqdm/tqdm/issues/481)", - TqdmSynchronisationWarning, stacklevel=2) - # Remove accidental long-lived strong references - del instances - - def report(self): - return not self.was_killed.is_set() diff --git a/venv/lib/python3.8/site-packages/tqdm/_tqdm.py b/venv/lib/python3.8/site-packages/tqdm/_tqdm.py deleted file mode 100644 index 7fc4962774a4651db7a739a3f143633b6215a9bd..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/_tqdm.py +++ /dev/null @@ -1,9 +0,0 @@ -from warnings import warn - -from .std import * # NOQA -from .std import __all__ # NOQA -from .std import TqdmDeprecationWarning - -warn("This function will be removed in tqdm==5.0.0\n" - "Please use `tqdm.std.*` instead of `tqdm._tqdm.*`", - TqdmDeprecationWarning, stacklevel=2) diff --git a/venv/lib/python3.8/site-packages/tqdm/_tqdm_gui.py b/venv/lib/python3.8/site-packages/tqdm/_tqdm_gui.py deleted file mode 100644 index f32aa894f54b3a5b47a0fbf4263c2fd20df56c9d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/_tqdm_gui.py +++ /dev/null @@ -1,9 +0,0 @@ -from warnings import warn - -from .gui import * # NOQA -from .gui import __all__ # NOQA -from .std import TqdmDeprecationWarning - -warn("This function will be removed in tqdm==5.0.0\n" - "Please use `tqdm.gui.*` instead of `tqdm._tqdm_gui.*`", - TqdmDeprecationWarning, stacklevel=2) diff --git a/venv/lib/python3.8/site-packages/tqdm/_tqdm_notebook.py b/venv/lib/python3.8/site-packages/tqdm/_tqdm_notebook.py deleted file mode 100644 index f225fbf5b52d04987ccf68f4d5ee4b735e3158b0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/_tqdm_notebook.py +++ /dev/null @@ -1,9 +0,0 @@ -from warnings import warn - -from .notebook import * # NOQA -from .notebook import __all__ # NOQA -from .std import TqdmDeprecationWarning - -warn("This function will be removed in tqdm==5.0.0\n" - "Please use `tqdm.notebook.*` instead of `tqdm._tqdm_notebook.*`", - TqdmDeprecationWarning, stacklevel=2) diff --git a/venv/lib/python3.8/site-packages/tqdm/_tqdm_pandas.py b/venv/lib/python3.8/site-packages/tqdm/_tqdm_pandas.py deleted file mode 100644 index c4fe6efdc603579e7f8acfa27ac10dccdf3e94ce..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/_tqdm_pandas.py +++ /dev/null @@ -1,24 +0,0 @@ -import sys - -__author__ = "github.com/casperdcl" -__all__ = ['tqdm_pandas'] - - -def tqdm_pandas(tclass, **tqdm_kwargs): - """ - Registers the given `tqdm` instance with - `pandas.core.groupby.DataFrameGroupBy.progress_apply`. - """ - from tqdm import TqdmDeprecationWarning - - if isinstance(tclass, type) or (getattr(tclass, '__name__', '').startswith( - 'tqdm_')): # delayed adapter case - TqdmDeprecationWarning( - "Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm, ...)`.", - fp_write=getattr(tqdm_kwargs.get('file', None), 'write', sys.stderr.write)) - tclass.pandas(**tqdm_kwargs) - else: - TqdmDeprecationWarning( - "Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm(...))`.", - fp_write=getattr(tclass.fp, 'write', sys.stderr.write)) - type(tclass).pandas(deprecated_t=tclass) diff --git a/venv/lib/python3.8/site-packages/tqdm/_utils.py b/venv/lib/python3.8/site-packages/tqdm/_utils.py deleted file mode 100644 index 385e849e106d1319fe21045f14eb0aa6552fb153..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/_utils.py +++ /dev/null @@ -1,11 +0,0 @@ -from warnings import warn - -from .std import TqdmDeprecationWarning -from .utils import ( # NOQA, pylint: disable=unused-import - CUR_OS, IS_NIX, IS_WIN, RE_ANSI, Comparable, FormatReplace, SimpleTextIOWrapper, - _environ_cols_wrapper, _is_ascii, _is_utf, _screen_shape_linux, _screen_shape_tput, - _screen_shape_windows, _screen_shape_wrapper, _supports_unicode, _term_move_up, colorama) - -warn("This function will be removed in tqdm==5.0.0\n" - "Please use `tqdm.utils.*` instead of `tqdm._utils.*`", - TqdmDeprecationWarning, stacklevel=2) diff --git a/venv/lib/python3.8/site-packages/tqdm/asyncio.py b/venv/lib/python3.8/site-packages/tqdm/asyncio.py deleted file mode 100644 index ddc89b8539a4628bc527976dc3f07f813950d44f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/asyncio.py +++ /dev/null @@ -1,93 +0,0 @@ -""" -Asynchronous progressbar decorator for iterators. -Includes a default `range` iterator printing to `stderr`. - -Usage: ->>> from tqdm.asyncio import trange, tqdm ->>> async for i in trange(10): -... ... -""" -import asyncio -from sys import version_info - -from .std import tqdm as std_tqdm - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['tqdm_asyncio', 'tarange', 'tqdm', 'trange'] - - -class tqdm_asyncio(std_tqdm): - """ - Asynchronous-friendly version of tqdm. - """ - def __init__(self, iterable=None, *args, **kwargs): - super(tqdm_asyncio, self).__init__(iterable, *args, **kwargs) - self.iterable_awaitable = False - if iterable is not None: - if hasattr(iterable, "__anext__"): - self.iterable_next = iterable.__anext__ - self.iterable_awaitable = True - elif hasattr(iterable, "__next__"): - self.iterable_next = iterable.__next__ - else: - self.iterable_iterator = iter(iterable) - self.iterable_next = self.iterable_iterator.__next__ - - def __aiter__(self): - return self - - async def __anext__(self): - try: - if self.iterable_awaitable: - res = await self.iterable_next() - else: - res = self.iterable_next() - self.update() - return res - except StopIteration: - self.close() - raise StopAsyncIteration - except BaseException: - self.close() - raise - - def send(self, *args, **kwargs): - return self.iterable.send(*args, **kwargs) - - @classmethod - def as_completed(cls, fs, *, loop=None, timeout=None, total=None, **tqdm_kwargs): - """ - Wrapper for `asyncio.as_completed`. - """ - if total is None: - total = len(fs) - kwargs = {} - if version_info[:2] < (3, 10): - kwargs['loop'] = loop - yield from cls(asyncio.as_completed(fs, timeout=timeout, **kwargs), - total=total, **tqdm_kwargs) - - @classmethod - async def gather(cls, *fs, loop=None, timeout=None, total=None, **tqdm_kwargs): - """ - Wrapper for `asyncio.gather`. - """ - async def wrap_awaitable(i, f): - return i, await f - - ifs = [wrap_awaitable(i, f) for i, f in enumerate(fs)] - res = [await f for f in cls.as_completed(ifs, loop=loop, timeout=timeout, - total=total, **tqdm_kwargs)] - return [i for _, i in sorted(res)] - - -def tarange(*args, **kwargs): - """ - A shortcut for `tqdm.asyncio.tqdm(range(*args), **kwargs)`. - """ - return tqdm_asyncio(range(*args), **kwargs) - - -# Aliases -tqdm = tqdm_asyncio -trange = tarange diff --git a/venv/lib/python3.8/site-packages/tqdm/auto.py b/venv/lib/python3.8/site-packages/tqdm/auto.py deleted file mode 100644 index 206c4409d5269594bdbab3a092ef6e09e7c01947..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/auto.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -Enables multiple commonly used features. - -Method resolution order: - -- `tqdm.autonotebook` without import warnings -- `tqdm.asyncio` -- `tqdm.std` base class - -Usage: ->>> from tqdm.auto import trange, tqdm ->>> for i in trange(10): -... ... -""" -import warnings - -from .std import TqdmExperimentalWarning - -with warnings.catch_warnings(): - warnings.simplefilter("ignore", category=TqdmExperimentalWarning) - from .autonotebook import tqdm as notebook_tqdm - -from .asyncio import tqdm as asyncio_tqdm -from .std import tqdm as std_tqdm - -if notebook_tqdm != std_tqdm: - class tqdm(notebook_tqdm, asyncio_tqdm): # pylint: disable=inconsistent-mro - pass -else: - tqdm = asyncio_tqdm - - -def trange(*args, **kwargs): - """ - A shortcut for `tqdm.auto.tqdm(range(*args), **kwargs)`. - """ - return tqdm(range(*args), **kwargs) - - -__all__ = ["tqdm", "trange"] diff --git a/venv/lib/python3.8/site-packages/tqdm/autonotebook.py b/venv/lib/python3.8/site-packages/tqdm/autonotebook.py deleted file mode 100644 index a09f2ec4b8c95f12b8c7b7774f84d5ec55826334..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/autonotebook.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Automatically choose between `tqdm.notebook` and `tqdm.std`. - -Usage: ->>> from tqdm.autonotebook import trange, tqdm ->>> for i in trange(10): -... ... -""" -import sys -from warnings import warn - -try: - get_ipython = sys.modules['IPython'].get_ipython - if 'IPKernelApp' not in get_ipython().config: # pragma: no cover - raise ImportError("console") - from .notebook import WARN_NOIPYW, IProgress - if IProgress is None: - from .std import TqdmWarning - warn(WARN_NOIPYW, TqdmWarning, stacklevel=2) - raise ImportError('ipywidgets') -except Exception: - from .std import tqdm, trange -else: # pragma: no cover - from .notebook import tqdm, trange - from .std import TqdmExperimentalWarning - warn("Using `tqdm.autonotebook.tqdm` in notebook mode." - " Use `tqdm.tqdm` instead to force console mode" - " (e.g. in jupyter console)", TqdmExperimentalWarning, stacklevel=2) -__all__ = ["tqdm", "trange"] diff --git a/venv/lib/python3.8/site-packages/tqdm/cli.py b/venv/lib/python3.8/site-packages/tqdm/cli.py deleted file mode 100644 index 1223d4977a737a249203bba6579f87558fb3e7b7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/cli.py +++ /dev/null @@ -1,311 +0,0 @@ -""" -Module version for monitoring CLI pipes (`... | python -m tqdm | ...`). -""" -import logging -import re -import sys -from ast import literal_eval as numeric - -from .std import TqdmKeyError, TqdmTypeError, tqdm -from .version import __version__ - -__all__ = ["main"] -log = logging.getLogger(__name__) - - -def cast(val, typ): - log.debug((val, typ)) - if " or " in typ: - for t in typ.split(" or "): - try: - return cast(val, t) - except TqdmTypeError: - pass - raise TqdmTypeError(val + ' : ' + typ) - - # sys.stderr.write('\ndebug | `val:type`: `' + val + ':' + typ + '`.\n') - if typ == 'bool': - if (val == 'True') or (val == ''): - return True - elif val == 'False': - return False - else: - raise TqdmTypeError(val + ' : ' + typ) - try: - return eval(typ + '("' + val + '")') - except Exception: - if typ == 'chr': - return chr(ord(eval('"' + val + '"'))).encode() - else: - raise TqdmTypeError(val + ' : ' + typ) - - -def posix_pipe(fin, fout, delim=b'\\n', buf_size=256, - callback=lambda float: None, callback_len=True): - """ - Params - ------ - fin : binary file with `read(buf_size : int)` method - fout : binary file with `write` (and optionally `flush`) methods. - callback : function(float), e.g.: `tqdm.update` - callback_len : If (default: True) do `callback(len(buffer))`. - Otherwise, do `callback(data) for data in buffer.split(delim)`. - """ - fp_write = fout.write - - if not delim: - while True: - tmp = fin.read(buf_size) - - # flush at EOF - if not tmp: - getattr(fout, 'flush', lambda: None)() - return - - fp_write(tmp) - callback(len(tmp)) - # return - - buf = b'' - len_delim = len(delim) - # n = 0 - while True: - tmp = fin.read(buf_size) - - # flush at EOF - if not tmp: - if buf: - fp_write(buf) - if callback_len: - # n += 1 + buf.count(delim) - callback(1 + buf.count(delim)) - else: - for i in buf.split(delim): - callback(i) - getattr(fout, 'flush', lambda: None)() - return # n - - while True: - i = tmp.find(delim) - if i < 0: - buf += tmp - break - fp_write(buf + tmp[:i + len(delim)]) - # n += 1 - callback(1 if callback_len else (buf + tmp[:i])) - buf = b'' - tmp = tmp[i + len_delim:] - - -# ((opt, type), ... ) -RE_OPTS = re.compile(r'\n {4}(\S+)\s{2,}:\s*([^,]+)') -# better split method assuming no positional args -RE_SHLEX = re.compile(r'\s*(? : \2', d) - split = RE_OPTS.split(d) - opt_types_desc = zip(split[1::3], split[2::3], split[3::3]) - d = ''.join(('\n --{0} : {2}{3}' if otd[1] == 'bool' else - '\n --{0}=<{1}> : {2}{3}').format( - otd[0].replace('_', '-'), otd[0], *otd[1:]) - for otd in opt_types_desc if otd[0] not in UNSUPPORTED_OPTS) - - help_short = "Usage:\n tqdm [--help | options]\n" - d = help_short + """ -Options: - -h, --help Print this help and exit. - -v, --version Print version and exit. -""" + d.strip('\n') + '\n' - - # opts = docopt(d, version=__version__) - if any(v in argv for v in ('-v', '--version')): - sys.stdout.write(__version__ + '\n') - sys.exit(0) - elif any(v in argv for v in ('-h', '--help')): - sys.stdout.write(d + '\n') - sys.exit(0) - elif argv and argv[0][:2] != '--': - sys.stderr.write(f"Error:Unknown argument:{argv[0]}\n{help_short}") - - argv = RE_SHLEX.split(' '.join(["tqdm"] + argv)) - opts = dict(zip(argv[1::3], argv[3::3])) - - log.debug(opts) - opts.pop('log', True) - - tqdm_args = {'file': fp} - try: - for (o, v) in opts.items(): - o = o.replace('-', '_') - try: - tqdm_args[o] = cast(v, opt_types[o]) - except KeyError as e: - raise TqdmKeyError(str(e)) - log.debug('args:' + str(tqdm_args)) - - delim_per_char = tqdm_args.pop('bytes', False) - update = tqdm_args.pop('update', False) - update_to = tqdm_args.pop('update_to', False) - if sum((delim_per_char, update, update_to)) > 1: - raise TqdmKeyError("Can only have one of --bytes --update --update_to") - except Exception: - fp.write("\nError:\n" + help_short) - stdin, stdout_write = sys.stdin, sys.stdout.write - for i in stdin: - stdout_write(i) - raise - else: - buf_size = tqdm_args.pop('buf_size', 256) - delim = tqdm_args.pop('delim', b'\\n') - tee = tqdm_args.pop('tee', False) - manpath = tqdm_args.pop('manpath', None) - comppath = tqdm_args.pop('comppath', None) - if tqdm_args.pop('null', False): - class stdout(object): - @staticmethod - def write(_): - pass - else: - stdout = sys.stdout - stdout = getattr(stdout, 'buffer', stdout) - stdin = getattr(sys.stdin, 'buffer', sys.stdin) - if manpath or comppath: - from importlib import resources - from os import path - from shutil import copyfile - - def cp(name, dst): - """copy resource `name` to `dst`""" - if hasattr(resources, 'files'): - copyfile(str(resources.files('tqdm') / name), dst) - else: # py<3.9 - with resources.path('tqdm', name) as src: - copyfile(str(src), dst) - log.info("written:%s", dst) - if manpath is not None: - cp('tqdm.1', path.join(manpath, 'tqdm.1')) - if comppath is not None: - cp('completion.sh', path.join(comppath, 'tqdm_completion.sh')) - sys.exit(0) - if tee: - stdout_write = stdout.write - fp_write = getattr(fp, 'buffer', fp).write - - class stdout(object): # pylint: disable=function-redefined - @staticmethod - def write(x): - with tqdm.external_write_mode(file=fp): - fp_write(x) - stdout_write(x) - if delim_per_char: - tqdm_args.setdefault('unit', 'B') - tqdm_args.setdefault('unit_scale', True) - tqdm_args.setdefault('unit_divisor', 1024) - log.debug(tqdm_args) - with tqdm(**tqdm_args) as t: - posix_pipe(stdin, stdout, '', buf_size, t.update) - elif delim == b'\\n': - log.debug(tqdm_args) - write = stdout.write - if update or update_to: - with tqdm(**tqdm_args) as t: - if update: - def callback(i): - t.update(numeric(i.decode())) - else: # update_to - def callback(i): - t.update(numeric(i.decode()) - t.n) - for i in stdin: - write(i) - callback(i) - else: - for i in tqdm(stdin, **tqdm_args): - write(i) - else: - log.debug(tqdm_args) - with tqdm(**tqdm_args) as t: - callback_len = False - if update: - def callback(i): - t.update(numeric(i.decode())) - elif update_to: - def callback(i): - t.update(numeric(i.decode()) - t.n) - else: - callback = t.update - callback_len = True - posix_pipe(stdin, stdout, delim, buf_size, callback, callback_len) diff --git a/venv/lib/python3.8/site-packages/tqdm/completion.sh b/venv/lib/python3.8/site-packages/tqdm/completion.sh deleted file mode 100644 index 9f61c7f14bb8c1f6099b9eb75dce28ece6a7ae96..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/completion.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -_tqdm(){ - local cur prv - cur="${COMP_WORDS[COMP_CWORD]}" - prv="${COMP_WORDS[COMP_CWORD - 1]}" - - case ${prv} in - --bar_format|--buf_size|--colour|--comppath|--delay|--delim|--desc|--initial|--lock_args|--manpath|--maxinterval|--mininterval|--miniters|--ncols|--nrows|--position|--postfix|--smoothing|--total|--unit|--unit_divisor) - # await user input - ;; - "--log") - COMPREPLY=($(compgen -W 'CRITICAL FATAL ERROR WARN WARNING INFO DEBUG NOTSET' -- ${cur})) - ;; - *) - COMPREPLY=($(compgen -W '--ascii --bar_format --buf_size --bytes --colour --comppath --delay --delim --desc --disable --dynamic_ncols --help --initial --leave --lock_args --log --manpath --maxinterval --mininterval --miniters --ncols --nrows --null --position --postfix --smoothing --tee --total --unit --unit_divisor --unit_scale --update --update_to --version --write_bytes -h -v' -- ${cur})) - ;; - esac -} -complete -F _tqdm tqdm diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__init__.py b/venv/lib/python3.8/site-packages/tqdm/contrib/__init__.py deleted file mode 100644 index 7338c960a44c4d0c3a56c370ce3b398b255cd0cb..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/__init__.py +++ /dev/null @@ -1,92 +0,0 @@ -""" -Thin wrappers around common functions. - -Subpackages contain potentially unstable extensions. -""" -from warnings import warn - -from ..auto import tqdm as tqdm_auto -from ..std import TqdmDeprecationWarning, tqdm -from ..utils import ObjectWrapper - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['tenumerate', 'tzip', 'tmap'] - - -class DummyTqdmFile(ObjectWrapper): - """Dummy file-like that will write to tqdm""" - - def __init__(self, wrapped): - super(DummyTqdmFile, self).__init__(wrapped) - self._buf = [] - - def write(self, x, nolock=False): - nl = b"\n" if isinstance(x, bytes) else "\n" - pre, sep, post = x.rpartition(nl) - if sep: - blank = type(nl)() - tqdm.write(blank.join(self._buf + [pre, sep]), - end=blank, file=self._wrapped, nolock=nolock) - self._buf = [post] - else: - self._buf.append(x) - - def __del__(self): - if self._buf: - blank = type(self._buf[0])() - try: - tqdm.write(blank.join(self._buf), end=blank, file=self._wrapped) - except (OSError, ValueError): - pass - - -def builtin_iterable(func): - """Returns `func`""" - warn("This function has no effect, and will be removed in tqdm==5.0.0", - TqdmDeprecationWarning, stacklevel=2) - return func - - -def tenumerate(iterable, start=0, total=None, tqdm_class=tqdm_auto, **tqdm_kwargs): - """ - Equivalent of `numpy.ndenumerate` or builtin `enumerate`. - - Parameters - ---------- - tqdm_class : [default: tqdm.auto.tqdm]. - """ - try: - import numpy as np - except ImportError: - pass - else: - if isinstance(iterable, np.ndarray): - return tqdm_class(np.ndenumerate(iterable), total=total or iterable.size, - **tqdm_kwargs) - return enumerate(tqdm_class(iterable, total=total, **tqdm_kwargs), start) - - -def tzip(iter1, *iter2plus, **tqdm_kwargs): - """ - Equivalent of builtin `zip`. - - Parameters - ---------- - tqdm_class : [default: tqdm.auto.tqdm]. - """ - kwargs = tqdm_kwargs.copy() - tqdm_class = kwargs.pop("tqdm_class", tqdm_auto) - for i in zip(tqdm_class(iter1, **kwargs), *iter2plus): - yield i - - -def tmap(function, *sequences, **tqdm_kwargs): - """ - Equivalent of builtin `map`. - - Parameters - ---------- - tqdm_class : [default: tqdm.auto.tqdm]. - """ - for i in tzip(*sequences, **tqdm_kwargs): - yield function(*i) diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index e93a7c6f42a684ce3ac1503aa0a63c189ee7d654..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/bells.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/bells.cpython-38.pyc deleted file mode 100644 index 717420c624214b94616605e3bd027aa1f90c506e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/bells.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/concurrent.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/concurrent.cpython-38.pyc deleted file mode 100644 index d997ef665781e5340229ed391c92cf2996fa4bce..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/concurrent.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/discord.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/discord.cpython-38.pyc deleted file mode 100644 index a659d0c6bdeec9f1c44a62ad3253775648817730..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/discord.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/itertools.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/itertools.cpython-38.pyc deleted file mode 100644 index db4b0b2f20a351891aa0504acaba8cb3d214b0dc..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/itertools.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/logging.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/logging.cpython-38.pyc deleted file mode 100644 index b964d3be00ba8129493ba1ef25b2c6c15836cc00..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/logging.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/slack.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/slack.cpython-38.pyc deleted file mode 100644 index 848f85e341a7cbe4725461bb6493d1598bebcbac..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/slack.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/telegram.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/telegram.cpython-38.pyc deleted file mode 100644 index d5cb8f61d59cfc3e82dcf98ae872f0efb64f5bb0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/telegram.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/utils_worker.cpython-38.pyc b/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/utils_worker.cpython-38.pyc deleted file mode 100644 index e2ee93ad1dfb4579bfc113802077c8b072a0e44b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/tqdm/contrib/__pycache__/utils_worker.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/bells.py b/venv/lib/python3.8/site-packages/tqdm/contrib/bells.py deleted file mode 100644 index 5b8f4b9ecd894f1edfaa08d9fe730b8d7c8b93e0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/bells.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Even more features than `tqdm.auto` (all the bells & whistles): - -- `tqdm.auto` -- `tqdm.tqdm.pandas` -- `tqdm.contrib.telegram` - + uses `${TQDM_TELEGRAM_TOKEN}` and `${TQDM_TELEGRAM_CHAT_ID}` -- `tqdm.contrib.discord` - + uses `${TQDM_DISCORD_TOKEN}` and `${TQDM_DISCORD_CHANNEL_ID}` -""" -__all__ = ['tqdm', 'trange'] -import warnings -from os import getenv - -if getenv("TQDM_SLACK_TOKEN") and getenv("TQDM_SLACK_CHANNEL"): - from .slack import tqdm, trange -elif getenv("TQDM_TELEGRAM_TOKEN") and getenv("TQDM_TELEGRAM_CHAT_ID"): - from .telegram import tqdm, trange -elif getenv("TQDM_DISCORD_TOKEN") and getenv("TQDM_DISCORD_CHANNEL_ID"): - from .discord import tqdm, trange -else: - from ..auto import tqdm, trange - -with warnings.catch_warnings(): - warnings.simplefilter("ignore", category=FutureWarning) - tqdm.pandas() diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/concurrent.py b/venv/lib/python3.8/site-packages/tqdm/contrib/concurrent.py deleted file mode 100644 index cd81d622a1309df179042159a56cef4f8c309224..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/concurrent.py +++ /dev/null @@ -1,105 +0,0 @@ -""" -Thin wrappers around `concurrent.futures`. -""" -from contextlib import contextmanager -from operator import length_hint -from os import cpu_count - -from ..auto import tqdm as tqdm_auto -from ..std import TqdmWarning - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['thread_map', 'process_map'] - - -@contextmanager -def ensure_lock(tqdm_class, lock_name=""): - """get (create if necessary) and then restore `tqdm_class`'s lock""" - old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock - lock = old_lock or tqdm_class.get_lock() # maybe create a new lock - lock = getattr(lock, lock_name, lock) # maybe subtype - tqdm_class.set_lock(lock) - yield lock - if old_lock is None: - del tqdm_class._lock - else: - tqdm_class.set_lock(old_lock) - - -def _executor_map(PoolExecutor, fn, *iterables, **tqdm_kwargs): - """ - Implementation of `thread_map` and `process_map`. - - Parameters - ---------- - tqdm_class : [default: tqdm.auto.tqdm]. - max_workers : [default: min(32, cpu_count() + 4)]. - chunksize : [default: 1]. - lock_name : [default: "":str]. - """ - kwargs = tqdm_kwargs.copy() - if "total" not in kwargs: - kwargs["total"] = length_hint(iterables[0]) - tqdm_class = kwargs.pop("tqdm_class", tqdm_auto) - max_workers = kwargs.pop("max_workers", min(32, cpu_count() + 4)) - chunksize = kwargs.pop("chunksize", 1) - lock_name = kwargs.pop("lock_name", "") - with ensure_lock(tqdm_class, lock_name=lock_name) as lk: - # share lock in case workers are already using `tqdm` - with PoolExecutor(max_workers=max_workers, initializer=tqdm_class.set_lock, - initargs=(lk,)) as ex: - return list(tqdm_class(ex.map(fn, *iterables, chunksize=chunksize), **kwargs)) - - -def thread_map(fn, *iterables, **tqdm_kwargs): - """ - Equivalent of `list(map(fn, *iterables))` - driven by `concurrent.futures.ThreadPoolExecutor`. - - Parameters - ---------- - tqdm_class : optional - `tqdm` class to use for bars [default: tqdm.auto.tqdm]. - max_workers : int, optional - Maximum number of workers to spawn; passed to - `concurrent.futures.ThreadPoolExecutor.__init__`. - [default: max(32, cpu_count() + 4)]. - """ - from concurrent.futures import ThreadPoolExecutor - return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs) - - -def process_map(fn, *iterables, **tqdm_kwargs): - """ - Equivalent of `list(map(fn, *iterables))` - driven by `concurrent.futures.ProcessPoolExecutor`. - - Parameters - ---------- - tqdm_class : optional - `tqdm` class to use for bars [default: tqdm.auto.tqdm]. - max_workers : int, optional - Maximum number of workers to spawn; passed to - `concurrent.futures.ProcessPoolExecutor.__init__`. - [default: min(32, cpu_count() + 4)]. - chunksize : int, optional - Size of chunks sent to worker processes; passed to - `concurrent.futures.ProcessPoolExecutor.map`. [default: 1]. - lock_name : str, optional - Member of `tqdm_class.get_lock()` to use [default: mp_lock]. - """ - from concurrent.futures import ProcessPoolExecutor - if iterables and "chunksize" not in tqdm_kwargs: - # default `chunksize=1` has poor performance for large iterables - # (most time spent dispatching items to workers). - longest_iterable_len = max(map(length_hint, iterables)) - if longest_iterable_len > 1000: - from warnings import warn - warn("Iterable length %d > 1000 but `chunksize` is not set." - " This may seriously degrade multiprocess performance." - " Set `chunksize=1` or more." % longest_iterable_len, - TqdmWarning, stacklevel=2) - if "lock_name" not in tqdm_kwargs: - tqdm_kwargs = tqdm_kwargs.copy() - tqdm_kwargs["lock_name"] = "mp_lock" - return _executor_map(ProcessPoolExecutor, fn, *iterables, **tqdm_kwargs) diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/discord.py b/venv/lib/python3.8/site-packages/tqdm/contrib/discord.py deleted file mode 100644 index 1e413082895f1de0b5a9dc510d4f0746455c1fc5..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/discord.py +++ /dev/null @@ -1,119 +0,0 @@ -""" -Sends updates to a Discord bot. - -Usage: ->>> from tqdm.contrib.discord import tqdm, trange ->>> for i in trange(10, token='{token}', channel_id='{channel_id}'): -... ... - -![screenshot](https://tqdm.github.io/img/screenshot-discord.png) -""" -import logging -from os import getenv - -try: - from disco.client import Client, ClientConfig -except ImportError: - raise ImportError("Please `pip install disco-py`") - -from ..auto import tqdm as tqdm_auto -from .utils_worker import MonoWorker - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['DiscordIO', 'tqdm_discord', 'tdrange', 'tqdm', 'trange'] - - -class DiscordIO(MonoWorker): - """Non-blocking file-like IO using a Discord Bot.""" - def __init__(self, token, channel_id): - """Creates a new message in the given `channel_id`.""" - super(DiscordIO, self).__init__() - config = ClientConfig() - config.token = token - client = Client(config) - self.text = self.__class__.__name__ - try: - self.message = client.api.channels_messages_create(channel_id, self.text) - except Exception as e: - tqdm_auto.write(str(e)) - self.message = None - - def write(self, s): - """Replaces internal `message`'s text with `s`.""" - if not s: - s = "..." - s = s.replace('\r', '').strip() - if s == self.text: - return # skip duplicate message - message = self.message - if message is None: - return - self.text = s - try: - future = self.submit(message.edit, '`' + s + '`') - except Exception as e: - tqdm_auto.write(str(e)) - else: - return future - - -class tqdm_discord(tqdm_auto): - """ - Standard `tqdm.auto.tqdm` but also sends updates to a Discord Bot. - May take a few seconds to create (`__init__`). - - - create a discord bot (not public, no requirement of OAuth2 code - grant, only send message permissions) & invite it to a channel: - - - copy the bot `{token}` & `{channel_id}` and paste below - - >>> from tqdm.contrib.discord import tqdm, trange - >>> for i in tqdm(iterable, token='{token}', channel_id='{channel_id}'): - ... ... - """ - def __init__(self, *args, **kwargs): - """ - Parameters - ---------- - token : str, required. Discord token - [default: ${TQDM_DISCORD_TOKEN}]. - channel_id : int, required. Discord channel ID - [default: ${TQDM_DISCORD_CHANNEL_ID}]. - mininterval : float, optional. - Minimum of [default: 1.5] to avoid rate limit. - - See `tqdm.auto.tqdm.__init__` for other parameters. - """ - if not kwargs.get('disable'): - kwargs = kwargs.copy() - logging.getLogger("HTTPClient").setLevel(logging.WARNING) - self.dio = DiscordIO( - kwargs.pop('token', getenv("TQDM_DISCORD_TOKEN")), - kwargs.pop('channel_id', getenv("TQDM_DISCORD_CHANNEL_ID"))) - kwargs['mininterval'] = max(1.5, kwargs.get('mininterval', 1.5)) - super(tqdm_discord, self).__init__(*args, **kwargs) - - def display(self, **kwargs): - super(tqdm_discord, self).display(**kwargs) - fmt = self.format_dict - if fmt.get('bar_format', None): - fmt['bar_format'] = fmt['bar_format'].replace( - '', '{bar:10u}').replace('{bar}', '{bar:10u}') - else: - fmt['bar_format'] = '{l_bar}{bar:10u}{r_bar}' - self.dio.write(self.format_meter(**fmt)) - - def clear(self, *args, **kwargs): - super(tqdm_discord, self).clear(*args, **kwargs) - if not self.disable: - self.dio.write("") - - -def tdrange(*args, **kwargs): - """Shortcut for `tqdm.contrib.discord.tqdm(range(*args), **kwargs)`.""" - return tqdm_discord(range(*args), **kwargs) - - -# Aliases -tqdm = tqdm_discord -trange = tdrange diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/itertools.py b/venv/lib/python3.8/site-packages/tqdm/contrib/itertools.py deleted file mode 100644 index e67651a41a6b8760d9b928ea48239e4611d70315..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/itertools.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Thin wrappers around `itertools`. -""" -import itertools - -from ..auto import tqdm as tqdm_auto - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['product'] - - -def product(*iterables, **tqdm_kwargs): - """ - Equivalent of `itertools.product`. - - Parameters - ---------- - tqdm_class : [default: tqdm.auto.tqdm]. - """ - kwargs = tqdm_kwargs.copy() - tqdm_class = kwargs.pop("tqdm_class", tqdm_auto) - try: - lens = list(map(len, iterables)) - except TypeError: - total = None - else: - total = 1 - for i in lens: - total *= i - kwargs.setdefault("total", total) - with tqdm_class(**kwargs) as t: - it = itertools.product(*iterables) - for i in it: - yield i - t.update() diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/logging.py b/venv/lib/python3.8/site-packages/tqdm/contrib/logging.py deleted file mode 100644 index b8eaec53f16c0e63f174aef4d2a4da49ebdf0b30..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/logging.py +++ /dev/null @@ -1,126 +0,0 @@ -""" -Helper functionality for interoperability with stdlib `logging`. -""" -import logging -import sys -from contextlib import contextmanager - -try: - from typing import Iterator, List, Optional, Type # noqa: F401 -except ImportError: - pass - -from ..std import tqdm as std_tqdm - - -class _TqdmLoggingHandler(logging.StreamHandler): - def __init__( - self, - tqdm_class=std_tqdm # type: Type[std_tqdm] - ): - super(_TqdmLoggingHandler, self).__init__() - self.tqdm_class = tqdm_class - - def emit(self, record): - try: - msg = self.format(record) - self.tqdm_class.write(msg, file=self.stream) - self.flush() - except (KeyboardInterrupt, SystemExit): - raise - except: # noqa pylint: disable=bare-except - self.handleError(record) - - -def _is_console_logging_handler(handler): - return (isinstance(handler, logging.StreamHandler) - and handler.stream in {sys.stdout, sys.stderr}) - - -def _get_first_found_console_logging_handler(handlers): - for handler in handlers: - if _is_console_logging_handler(handler): - return handler - - -@contextmanager -def logging_redirect_tqdm( - loggers=None, # type: Optional[List[logging.Logger]], - tqdm_class=std_tqdm # type: Type[std_tqdm] -): - # type: (...) -> Iterator[None] - """ - Context manager redirecting console logging to `tqdm.write()`, leaving - other logging handlers (e.g. log files) unaffected. - - Parameters - ---------- - loggers : list, optional - Which handlers to redirect (default: [logging.root]). - tqdm_class : optional - - Example - ------- - ```python - import logging - from tqdm import trange - from tqdm.contrib.logging import logging_redirect_tqdm - - LOG = logging.getLogger(__name__) - - if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) - with logging_redirect_tqdm(): - for i in trange(9): - if i == 4: - LOG.info("console logging redirected to `tqdm.write()`") - # logging restored - ``` - """ - if loggers is None: - loggers = [logging.root] - original_handlers_list = [logger.handlers for logger in loggers] - try: - for logger in loggers: - tqdm_handler = _TqdmLoggingHandler(tqdm_class) - orig_handler = _get_first_found_console_logging_handler(logger.handlers) - if orig_handler is not None: - tqdm_handler.setFormatter(orig_handler.formatter) - tqdm_handler.stream = orig_handler.stream - logger.handlers = [ - handler for handler in logger.handlers - if not _is_console_logging_handler(handler)] + [tqdm_handler] - yield - finally: - for logger, original_handlers in zip(loggers, original_handlers_list): - logger.handlers = original_handlers - - -@contextmanager -def tqdm_logging_redirect( - *args, - # loggers=None, # type: Optional[List[logging.Logger]] - # tqdm=None, # type: Optional[Type[tqdm.tqdm]] - **kwargs -): - # type: (...) -> Iterator[None] - """ - Convenience shortcut for: - ```python - with tqdm_class(*args, **tqdm_kwargs) as pbar: - with logging_redirect_tqdm(loggers=loggers, tqdm_class=tqdm_class): - yield pbar - ``` - - Parameters - ---------- - tqdm_class : optional, (default: tqdm.std.tqdm). - loggers : optional, list. - **tqdm_kwargs : passed to `tqdm_class`. - """ - tqdm_kwargs = kwargs.copy() - loggers = tqdm_kwargs.pop('loggers', None) - tqdm_class = tqdm_kwargs.pop('tqdm_class', std_tqdm) - with tqdm_class(*args, **tqdm_kwargs) as pbar: - with logging_redirect_tqdm(loggers=loggers, tqdm_class=tqdm_class): - yield pbar diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/slack.py b/venv/lib/python3.8/site-packages/tqdm/contrib/slack.py deleted file mode 100644 index d4c850ca403c2337d50bdc0acaad6ba7d9c39666..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/slack.py +++ /dev/null @@ -1,120 +0,0 @@ -""" -Sends updates to a Slack app. - -Usage: ->>> from tqdm.contrib.slack import tqdm, trange ->>> for i in trange(10, token='{token}', channel='{channel}'): -... ... - -![screenshot](https://tqdm.github.io/img/screenshot-slack.png) -""" -import logging -from os import getenv - -try: - from slack_sdk import WebClient -except ImportError: - raise ImportError("Please `pip install slack-sdk`") - -from ..auto import tqdm as tqdm_auto -from .utils_worker import MonoWorker - -__author__ = {"github.com/": ["0x2b3bfa0", "casperdcl"]} -__all__ = ['SlackIO', 'tqdm_slack', 'tsrange', 'tqdm', 'trange'] - - -class SlackIO(MonoWorker): - """Non-blocking file-like IO using a Slack app.""" - def __init__(self, token, channel): - """Creates a new message in the given `channel`.""" - super(SlackIO, self).__init__() - self.client = WebClient(token=token) - self.text = self.__class__.__name__ - try: - self.message = self.client.chat_postMessage(channel=channel, text=self.text) - except Exception as e: - tqdm_auto.write(str(e)) - self.message = None - - def write(self, s): - """Replaces internal `message`'s text with `s`.""" - if not s: - s = "..." - s = s.replace('\r', '').strip() - if s == self.text: - return # skip duplicate message - message = self.message - if message is None: - return - self.text = s - try: - future = self.submit(self.client.chat_update, channel=message['channel'], - ts=message['ts'], text='`' + s + '`') - except Exception as e: - tqdm_auto.write(str(e)) - else: - return future - - -class tqdm_slack(tqdm_auto): - """ - Standard `tqdm.auto.tqdm` but also sends updates to a Slack app. - May take a few seconds to create (`__init__`). - - - create a Slack app with the `chat:write` scope & invite it to a - channel: - - copy the bot `{token}` & `{channel}` and paste below - >>> from tqdm.contrib.slack import tqdm, trange - >>> for i in tqdm(iterable, token='{token}', channel='{channel}'): - ... ... - """ - def __init__(self, *args, **kwargs): - """ - Parameters - ---------- - token : str, required. Slack token - [default: ${TQDM_SLACK_TOKEN}]. - channel : int, required. Slack channel - [default: ${TQDM_SLACK_CHANNEL}]. - mininterval : float, optional. - Minimum of [default: 1.5] to avoid rate limit. - - See `tqdm.auto.tqdm.__init__` for other parameters. - """ - if not kwargs.get('disable'): - kwargs = kwargs.copy() - logging.getLogger("HTTPClient").setLevel(logging.WARNING) - self.sio = SlackIO( - kwargs.pop('token', getenv("TQDM_SLACK_TOKEN")), - kwargs.pop('channel', getenv("TQDM_SLACK_CHANNEL"))) - kwargs['mininterval'] = max(1.5, kwargs.get('mininterval', 1.5)) - super(tqdm_slack, self).__init__(*args, **kwargs) - - def display(self, **kwargs): - super(tqdm_slack, self).display(**kwargs) - fmt = self.format_dict - if fmt.get('bar_format', None): - fmt['bar_format'] = fmt['bar_format'].replace( - '', '`{bar:10}`').replace('{bar}', '`{bar:10u}`') - else: - fmt['bar_format'] = '{l_bar}`{bar:10}`{r_bar}' - if fmt['ascii'] is False: - fmt['ascii'] = [":black_square:", ":small_blue_diamond:", ":large_blue_diamond:", - ":large_blue_square:"] - fmt['ncols'] = 336 - self.sio.write(self.format_meter(**fmt)) - - def clear(self, *args, **kwargs): - super(tqdm_slack, self).clear(*args, **kwargs) - if not self.disable: - self.sio.write("") - - -def tsrange(*args, **kwargs): - """Shortcut for `tqdm.contrib.slack.tqdm(range(*args), **kwargs)`.""" - return tqdm_slack(range(*args), **kwargs) - - -# Aliases -tqdm = tqdm_slack -trange = tsrange diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/telegram.py b/venv/lib/python3.8/site-packages/tqdm/contrib/telegram.py deleted file mode 100644 index cbeadf20f1e83e8fde9d79cd4fa2d36a77ecdb5a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/telegram.py +++ /dev/null @@ -1,153 +0,0 @@ -""" -Sends updates to a Telegram bot. - -Usage: ->>> from tqdm.contrib.telegram import tqdm, trange ->>> for i in trange(10, token='{token}', chat_id='{chat_id}'): -... ... - -![screenshot](https://tqdm.github.io/img/screenshot-telegram.gif) -""" -from os import getenv -from warnings import warn - -from requests import Session - -from ..auto import tqdm as tqdm_auto -from ..std import TqdmWarning -from .utils_worker import MonoWorker - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['TelegramIO', 'tqdm_telegram', 'ttgrange', 'tqdm', 'trange'] - - -class TelegramIO(MonoWorker): - """Non-blocking file-like IO using a Telegram Bot.""" - API = 'https://api.telegram.org/bot' - - def __init__(self, token, chat_id): - """Creates a new message in the given `chat_id`.""" - super(TelegramIO, self).__init__() - self.token = token - self.chat_id = chat_id - self.session = Session() - self.text = self.__class__.__name__ - self.message_id - - @property - def message_id(self): - if hasattr(self, '_message_id'): - return self._message_id - try: - res = self.session.post( - self.API + '%s/sendMessage' % self.token, - data={'text': '`' + self.text + '`', 'chat_id': self.chat_id, - 'parse_mode': 'MarkdownV2'}).json() - except Exception as e: - tqdm_auto.write(str(e)) - else: - if res.get('error_code') == 429: - warn("Creation rate limit: try increasing `mininterval`.", - TqdmWarning, stacklevel=2) - else: - self._message_id = res['result']['message_id'] - return self._message_id - - def write(self, s): - """Replaces internal `message_id`'s text with `s`.""" - if not s: - s = "..." - s = s.replace('\r', '').strip() - if s == self.text: - return # avoid duplicate message Bot error - message_id = self.message_id - if message_id is None: - return - self.text = s - try: - future = self.submit( - self.session.post, self.API + '%s/editMessageText' % self.token, - data={'text': '`' + s + '`', 'chat_id': self.chat_id, - 'message_id': message_id, 'parse_mode': 'MarkdownV2'}) - except Exception as e: - tqdm_auto.write(str(e)) - else: - return future - - def delete(self): - """Deletes internal `message_id`.""" - try: - future = self.submit( - self.session.post, self.API + '%s/deleteMessage' % self.token, - data={'chat_id': self.chat_id, 'message_id': self.message_id}) - except Exception as e: - tqdm_auto.write(str(e)) - else: - return future - - -class tqdm_telegram(tqdm_auto): - """ - Standard `tqdm.auto.tqdm` but also sends updates to a Telegram Bot. - May take a few seconds to create (`__init__`). - - - create a bot - - copy its `{token}` - - add the bot to a chat and send it a message such as `/start` - - go to to find out - the `{chat_id}` - - paste the `{token}` & `{chat_id}` below - - >>> from tqdm.contrib.telegram import tqdm, trange - >>> for i in tqdm(iterable, token='{token}', chat_id='{chat_id}'): - ... ... - """ - def __init__(self, *args, **kwargs): - """ - Parameters - ---------- - token : str, required. Telegram token - [default: ${TQDM_TELEGRAM_TOKEN}]. - chat_id : str, required. Telegram chat ID - [default: ${TQDM_TELEGRAM_CHAT_ID}]. - - See `tqdm.auto.tqdm.__init__` for other parameters. - """ - if not kwargs.get('disable'): - kwargs = kwargs.copy() - self.tgio = TelegramIO( - kwargs.pop('token', getenv('TQDM_TELEGRAM_TOKEN')), - kwargs.pop('chat_id', getenv('TQDM_TELEGRAM_CHAT_ID'))) - super(tqdm_telegram, self).__init__(*args, **kwargs) - - def display(self, **kwargs): - super(tqdm_telegram, self).display(**kwargs) - fmt = self.format_dict - if fmt.get('bar_format', None): - fmt['bar_format'] = fmt['bar_format'].replace( - '', '{bar:10u}').replace('{bar}', '{bar:10u}') - else: - fmt['bar_format'] = '{l_bar}{bar:10u}{r_bar}' - self.tgio.write(self.format_meter(**fmt)) - - def clear(self, *args, **kwargs): - super(tqdm_telegram, self).clear(*args, **kwargs) - if not self.disable: - self.tgio.write("") - - def close(self): - if self.disable: - return - super(tqdm_telegram, self).close() - if not (self.leave or (self.leave is None and self.pos == 0)): - self.tgio.delete() - - -def ttgrange(*args, **kwargs): - """Shortcut for `tqdm.contrib.telegram.tqdm(range(*args), **kwargs)`.""" - return tqdm_telegram(range(*args), **kwargs) - - -# Aliases -tqdm = tqdm_telegram -trange = ttgrange diff --git a/venv/lib/python3.8/site-packages/tqdm/contrib/utils_worker.py b/venv/lib/python3.8/site-packages/tqdm/contrib/utils_worker.py deleted file mode 100644 index 2a03a2a8930001e37938836196e0d15b649b07a8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/contrib/utils_worker.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -IO/concurrency helpers for `tqdm.contrib`. -""" -from collections import deque -from concurrent.futures import ThreadPoolExecutor - -from ..auto import tqdm as tqdm_auto - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['MonoWorker'] - - -class MonoWorker(object): - """ - Supports one running task and one waiting task. - The waiting task is the most recent submitted (others are discarded). - """ - def __init__(self): - self.pool = ThreadPoolExecutor(max_workers=1) - self.futures = deque([], 2) - - def submit(self, func, *args, **kwargs): - """`func(*args, **kwargs)` may replace currently waiting task.""" - futures = self.futures - if len(futures) == futures.maxlen: - running = futures.popleft() - if not running.done(): - if len(futures): # clear waiting - waiting = futures.pop() - waiting.cancel() - futures.appendleft(running) # re-insert running - try: - waiting = self.pool.submit(func, *args, **kwargs) - except Exception as e: - tqdm_auto.write(str(e)) - else: - futures.append(waiting) - return waiting diff --git a/venv/lib/python3.8/site-packages/tqdm/dask.py b/venv/lib/python3.8/site-packages/tqdm/dask.py deleted file mode 100644 index af9926a2797b9a49220fc5b2228e1ae18c447f37..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/dask.py +++ /dev/null @@ -1,44 +0,0 @@ -from functools import partial - -from dask.callbacks import Callback - -from .auto import tqdm as tqdm_auto - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['TqdmCallback'] - - -class TqdmCallback(Callback): - """Dask callback for task progress.""" - def __init__(self, start=None, pretask=None, tqdm_class=tqdm_auto, - **tqdm_kwargs): - """ - Parameters - ---------- - tqdm_class : optional - `tqdm` class to use for bars [default: `tqdm.auto.tqdm`]. - tqdm_kwargs : optional - Any other arguments used for all bars. - """ - super(TqdmCallback, self).__init__(start=start, pretask=pretask) - if tqdm_kwargs: - tqdm_class = partial(tqdm_class, **tqdm_kwargs) - self.tqdm_class = tqdm_class - - def _start_state(self, _, state): - self.pbar = self.tqdm_class(total=sum( - len(state[k]) for k in ['ready', 'waiting', 'running', 'finished'])) - - def _posttask(self, *_, **__): - self.pbar.update() - - def _finish(self, *_, **__): - self.pbar.close() - - def display(self): - """Displays in the current cell in Notebooks.""" - container = getattr(self.bar, 'container', None) - if container is None: - return - from .notebook import display - display(container) diff --git a/venv/lib/python3.8/site-packages/tqdm/gui.py b/venv/lib/python3.8/site-packages/tqdm/gui.py deleted file mode 100644 index 8bab6ac7807e2fafc9db326c50f0e5ec99af6a05..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/gui.py +++ /dev/null @@ -1,186 +0,0 @@ -""" -Matplotlib GUI progressbar decorator for iterators. - -Usage: ->>> from tqdm.gui import trange, tqdm ->>> for i in trange(10): -... ... -""" -# future division is important to divide integers and get as -# a result precise floating numbers (instead of truncated int) -import re -from warnings import warn - -# to inherit from the tqdm class -from .std import TqdmExperimentalWarning -from .std import tqdm as std_tqdm - -# import compatibility functions and utilities - -__author__ = {"github.com/": ["casperdcl", "lrq3000"]} -__all__ = ['tqdm_gui', 'tgrange', 'tqdm', 'trange'] - - -class tqdm_gui(std_tqdm): # pragma: no cover - """Experimental Matplotlib GUI version of tqdm!""" - # TODO: @classmethod: write() on GUI? - def __init__(self, *args, **kwargs): - from collections import deque - - import matplotlib as mpl - import matplotlib.pyplot as plt - kwargs = kwargs.copy() - kwargs['gui'] = True - colour = kwargs.pop('colour', 'g') - super(tqdm_gui, self).__init__(*args, **kwargs) - - if self.disable: - return - - warn("GUI is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) - self.mpl = mpl - self.plt = plt - - # Remember if external environment uses toolbars - self.toolbar = self.mpl.rcParams['toolbar'] - self.mpl.rcParams['toolbar'] = 'None' - - self.mininterval = max(self.mininterval, 0.5) - self.fig, ax = plt.subplots(figsize=(9, 2.2)) - # self.fig.subplots_adjust(bottom=0.2) - total = self.__len__() # avoids TypeError on None #971 - if total is not None: - self.xdata = [] - self.ydata = [] - self.zdata = [] - else: - self.xdata = deque([]) - self.ydata = deque([]) - self.zdata = deque([]) - self.line1, = ax.plot(self.xdata, self.ydata, color='b') - self.line2, = ax.plot(self.xdata, self.zdata, color='k') - ax.set_ylim(0, 0.001) - if total is not None: - ax.set_xlim(0, 100) - ax.set_xlabel("percent") - self.fig.legend((self.line1, self.line2), ("cur", "est"), - loc='center right') - # progressbar - self.hspan = plt.axhspan(0, 0.001, xmin=0, xmax=0, color=colour) - else: - # ax.set_xlim(-60, 0) - ax.set_xlim(0, 60) - ax.invert_xaxis() - ax.set_xlabel("seconds") - ax.legend(("cur", "est"), loc='lower left') - ax.grid() - # ax.set_xlabel('seconds') - ax.set_ylabel((self.unit if self.unit else "it") + "/s") - if self.unit_scale: - plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) - ax.yaxis.get_offset_text().set_x(-0.15) - - # Remember if external environment is interactive - self.wasion = plt.isinteractive() - plt.ion() - self.ax = ax - - def close(self): - if self.disable: - return - - self.disable = True - - with self.get_lock(): - self._instances.remove(self) - - # Restore toolbars - self.mpl.rcParams['toolbar'] = self.toolbar - # Return to non-interactive mode - if not self.wasion: - self.plt.ioff() - if self.leave: - self.display() - else: - self.plt.close(self.fig) - - def clear(self, *_, **__): - pass - - def display(self, *_, **__): - n = self.n - cur_t = self._time() - elapsed = cur_t - self.start_t - delta_it = n - self.last_print_n - delta_t = cur_t - self.last_print_t - - # Inline due to multiple calls - total = self.total - xdata = self.xdata - ydata = self.ydata - zdata = self.zdata - ax = self.ax - line1 = self.line1 - line2 = self.line2 - # instantaneous rate - y = delta_it / delta_t - # overall rate - z = n / elapsed - # update line data - xdata.append(n * 100.0 / total if total else cur_t) - ydata.append(y) - zdata.append(z) - - # Discard old values - # xmin, xmax = ax.get_xlim() - # if (not total) and elapsed > xmin * 1.1: - if (not total) and elapsed > 66: - xdata.popleft() - ydata.popleft() - zdata.popleft() - - ymin, ymax = ax.get_ylim() - if y > ymax or z > ymax: - ymax = 1.1 * y - ax.set_ylim(ymin, ymax) - ax.figure.canvas.draw() - - if total: - line1.set_data(xdata, ydata) - line2.set_data(xdata, zdata) - try: - poly_lims = self.hspan.get_xy() - except AttributeError: - self.hspan = self.plt.axhspan(0, 0.001, xmin=0, xmax=0, color='g') - poly_lims = self.hspan.get_xy() - poly_lims[0, 1] = ymin - poly_lims[1, 1] = ymax - poly_lims[2] = [n / total, ymax] - poly_lims[3] = [poly_lims[2, 0], ymin] - if len(poly_lims) > 4: - poly_lims[4, 1] = ymin - self.hspan.set_xy(poly_lims) - else: - t_ago = [cur_t - i for i in xdata] - line1.set_data(t_ago, ydata) - line2.set_data(t_ago, zdata) - - d = self.format_dict - # remove {bar} - d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( - "{bar}", "") - msg = self.format_meter(**d) - if '' in msg: - msg = "".join(re.split(r'\|?\|?', msg, maxsplit=1)) - ax.set_title(msg, fontname="DejaVu Sans Mono", fontsize=11) - self.plt.pause(1e-9) - - -def tgrange(*args, **kwargs): - """Shortcut for `tqdm.gui.tqdm(range(*args), **kwargs)`.""" - return tqdm_gui(range(*args), **kwargs) - - -# Aliases -tqdm = tqdm_gui -trange = tgrange diff --git a/venv/lib/python3.8/site-packages/tqdm/keras.py b/venv/lib/python3.8/site-packages/tqdm/keras.py deleted file mode 100644 index 96782d7e8bf6cc624dfd4204fab0e452993ebf68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/keras.py +++ /dev/null @@ -1,122 +0,0 @@ -from copy import copy -from functools import partial - -from .auto import tqdm as tqdm_auto - -try: - import keras -except (ImportError, AttributeError) as e: - try: - from tensorflow import keras - except ImportError: - raise e -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['TqdmCallback'] - - -class TqdmCallback(keras.callbacks.Callback): - """Keras callback for epoch and batch progress.""" - @staticmethod - def bar2callback(bar, pop=None, delta=(lambda logs: 1)): - def callback(_, logs=None): - n = delta(logs) - if logs: - if pop: - logs = copy(logs) - [logs.pop(i, 0) for i in pop] - bar.set_postfix(logs, refresh=False) - bar.update(n) - - return callback - - def __init__(self, epochs=None, data_size=None, batch_size=None, verbose=1, - tqdm_class=tqdm_auto, **tqdm_kwargs): - """ - Parameters - ---------- - epochs : int, optional - data_size : int, optional - Number of training pairs. - batch_size : int, optional - Number of training pairs per batch. - verbose : int - 0: epoch, 1: batch (transient), 2: batch. [default: 1]. - Will be set to `0` unless both `data_size` and `batch_size` - are given. - tqdm_class : optional - `tqdm` class to use for bars [default: `tqdm.auto.tqdm`]. - tqdm_kwargs : optional - Any other arguments used for all bars. - """ - if tqdm_kwargs: - tqdm_class = partial(tqdm_class, **tqdm_kwargs) - self.tqdm_class = tqdm_class - self.epoch_bar = tqdm_class(total=epochs, unit='epoch') - self.on_epoch_end = self.bar2callback(self.epoch_bar) - if data_size and batch_size: - self.batches = batches = (data_size + batch_size - 1) // batch_size - else: - self.batches = batches = None - self.verbose = verbose - if verbose == 1: - self.batch_bar = tqdm_class(total=batches, unit='batch', leave=False) - self.on_batch_end = self.bar2callback( - self.batch_bar, pop=['batch', 'size'], - delta=lambda logs: logs.get('size', 1)) - - def on_train_begin(self, *_, **__): - params = self.params.get - auto_total = params('epochs', params('nb_epoch', None)) - if auto_total is not None and auto_total != self.epoch_bar.total: - self.epoch_bar.reset(total=auto_total) - - def on_epoch_begin(self, epoch, *_, **__): - if self.epoch_bar.n < epoch: - ebar = self.epoch_bar - ebar.n = ebar.last_print_n = ebar.initial = epoch - if self.verbose: - params = self.params.get - total = params('samples', params( - 'nb_sample', params('steps', None))) or self.batches - if self.verbose == 2: - if hasattr(self, 'batch_bar'): - self.batch_bar.close() - self.batch_bar = self.tqdm_class( - total=total, unit='batch', leave=True, - unit_scale=1 / (params('batch_size', 1) or 1)) - self.on_batch_end = self.bar2callback( - self.batch_bar, pop=['batch', 'size'], - delta=lambda logs: logs.get('size', 1)) - elif self.verbose == 1: - self.batch_bar.unit_scale = 1 / (params('batch_size', 1) or 1) - self.batch_bar.reset(total=total) - else: - raise KeyError('Unknown verbosity') - - def on_train_end(self, *_, **__): - if self.verbose: - self.batch_bar.close() - self.epoch_bar.close() - - def display(self): - """Displays in the current cell in Notebooks.""" - container = getattr(self.epoch_bar, 'container', None) - if container is None: - return - from .notebook import display - display(container) - batch_bar = getattr(self, 'batch_bar', None) - if batch_bar is not None: - display(batch_bar.container) - - @staticmethod - def _implements_train_batch_hooks(): - return True - - @staticmethod - def _implements_test_batch_hooks(): - return True - - @staticmethod - def _implements_predict_batch_hooks(): - return True diff --git a/venv/lib/python3.8/site-packages/tqdm/notebook.py b/venv/lib/python3.8/site-packages/tqdm/notebook.py deleted file mode 100644 index 0f531ab9400d6e43b08423bf4169c0374a1bf1db..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/notebook.py +++ /dev/null @@ -1,316 +0,0 @@ -""" -IPython/Jupyter Notebook progressbar decorator for iterators. -Includes a default `range` iterator printing to `stderr`. - -Usage: ->>> from tqdm.notebook import trange, tqdm ->>> for i in trange(10): -... ... -""" -# import compatibility functions and utilities -import re -import sys -from html import escape -from weakref import proxy - -# to inherit from the tqdm class -from .std import tqdm as std_tqdm - -if True: # pragma: no cover - # import IPython/Jupyter base widget and display utilities - IPY = 0 - try: # IPython 4.x - import ipywidgets - IPY = 4 - except ImportError: # IPython 3.x / 2.x - IPY = 32 - import warnings - with warnings.catch_warnings(): - warnings.filterwarnings( - 'ignore', message=".*The `IPython.html` package has been deprecated.*") - try: - import IPython.html.widgets as ipywidgets # NOQA: F401 - except ImportError: - pass - - try: # IPython 4.x / 3.x - if IPY == 32: - from IPython.html.widgets import HTML - from IPython.html.widgets import FloatProgress as IProgress - from IPython.html.widgets import HBox - IPY = 3 - else: - from ipywidgets import HTML - from ipywidgets import FloatProgress as IProgress - from ipywidgets import HBox - except ImportError: - try: # IPython 2.x - from IPython.html.widgets import HTML - from IPython.html.widgets import ContainerWidget as HBox - from IPython.html.widgets import FloatProgressWidget as IProgress - IPY = 2 - except ImportError: - IPY = 0 - IProgress = None - HBox = object - - try: - from IPython.display import display # , clear_output - except ImportError: - pass - -__author__ = {"github.com/": ["lrq3000", "casperdcl", "alexanderkuk"]} -__all__ = ['tqdm_notebook', 'tnrange', 'tqdm', 'trange'] -WARN_NOIPYW = ("IProgress not found. Please update jupyter and ipywidgets." - " See https://ipywidgets.readthedocs.io/en/stable" - "/user_install.html") - - -class TqdmHBox(HBox): - """`ipywidgets.HBox` with a pretty representation""" - def _json_(self, pretty=None): - pbar = getattr(self, 'pbar', None) - if pbar is None: - return {} - d = pbar.format_dict - if pretty is not None: - d["ascii"] = not pretty - return d - - def __repr__(self, pretty=False): - pbar = getattr(self, 'pbar', None) - if pbar is None: - return super(TqdmHBox, self).__repr__() - return pbar.format_meter(**self._json_(pretty)) - - def _repr_pretty_(self, pp, *_, **__): - pp.text(self.__repr__(True)) - - -class tqdm_notebook(std_tqdm): - """ - Experimental IPython/Jupyter Notebook widget using tqdm! - """ - @staticmethod - def status_printer(_, total=None, desc=None, ncols=None): - """ - Manage the printing of an IPython/Jupyter Notebook progress bar widget. - """ - # Fallback to text bar if there's no total - # DEPRECATED: replaced with an 'info' style bar - # if not total: - # return super(tqdm_notebook, tqdm_notebook).status_printer(file) - - # fp = file - - # Prepare IPython progress bar - if IProgress is None: # #187 #451 #558 #872 - raise ImportError(WARN_NOIPYW) - if total: - pbar = IProgress(min=0, max=total) - else: # No total? Show info style bar with no progress tqdm status - pbar = IProgress(min=0, max=1) - pbar.value = 1 - pbar.bar_style = 'info' - if ncols is None: - pbar.layout.width = "20px" - - ltext = HTML() - rtext = HTML() - if desc: - ltext.value = desc - container = TqdmHBox(children=[ltext, pbar, rtext]) - # Prepare layout - if ncols is not None: # use default style of ipywidgets - # ncols could be 100, "100px", "100%" - ncols = str(ncols) # ipywidgets only accepts string - try: - if int(ncols) > 0: # isnumeric and positive - ncols += 'px' - except ValueError: - pass - pbar.layout.flex = '2' - container.layout.width = ncols - container.layout.display = 'inline-flex' - container.layout.flex_flow = 'row wrap' - - return container - - def display(self, msg=None, pos=None, - # additional signals - close=False, bar_style=None, check_delay=True): - # Note: contrary to native tqdm, msg='' does NOT clear bar - # goal is to keep all infos if error happens so user knows - # at which iteration the loop failed. - - # Clear previous output (really necessary?) - # clear_output(wait=1) - - if not msg and not close: - d = self.format_dict - # remove {bar} - d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( - "{bar}", "") - msg = self.format_meter(**d) - - ltext, pbar, rtext = self.container.children - pbar.value = self.n - - if msg: - # html escape special characters (like '&') - if '' in msg: - left, right = map(escape, re.split(r'\|?\|?', msg, maxsplit=1)) - else: - left, right = '', escape(msg) - - # Update description - ltext.value = left - # never clear the bar (signal: msg='') - if right: - rtext.value = right - - # Change bar style - if bar_style: - # Hack-ish way to avoid the danger bar_style being overridden by - # success because the bar gets closed after the error... - if pbar.bar_style != 'danger' or bar_style != 'success': - pbar.bar_style = bar_style - - # Special signal to close the bar - if close and pbar.bar_style != 'danger': # hide only if no error - try: - self.container.close() - except AttributeError: - self.container.visible = False - self.container.layout.visibility = 'hidden' # IPYW>=8 - - if check_delay and self.delay > 0 and not self.displayed: - display(self.container) - self.displayed = True - - @property - def colour(self): - if hasattr(self, 'container'): - return self.container.children[-2].style.bar_color - - @colour.setter - def colour(self, bar_color): - if hasattr(self, 'container'): - self.container.children[-2].style.bar_color = bar_color - - def __init__(self, *args, **kwargs): - """ - Supports the usual `tqdm.tqdm` parameters as well as those listed below. - - Parameters - ---------- - display : Whether to call `display(self.container)` immediately - [default: True]. - """ - kwargs = kwargs.copy() - # Setup default output - file_kwarg = kwargs.get('file', sys.stderr) - if file_kwarg is sys.stderr or file_kwarg is None: - kwargs['file'] = sys.stdout # avoid the red block in IPython - - # Initialize parent class + avoid printing by using gui=True - kwargs['gui'] = True - # convert disable = None to False - kwargs['disable'] = bool(kwargs.get('disable', False)) - colour = kwargs.pop('colour', None) - display_here = kwargs.pop('display', True) - super(tqdm_notebook, self).__init__(*args, **kwargs) - if self.disable or not kwargs['gui']: - self.disp = lambda *_, **__: None - return - - # Get bar width - self.ncols = '100%' if self.dynamic_ncols else kwargs.get("ncols", None) - - # Replace with IPython progress bar display (with correct total) - unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1 - total = self.total * unit_scale if self.total else self.total - self.container = self.status_printer(self.fp, total, self.desc, self.ncols) - self.container.pbar = proxy(self) - self.displayed = False - if display_here and self.delay <= 0: - display(self.container) - self.displayed = True - self.disp = self.display - self.colour = colour - - # Print initial bar state - if not self.disable: - self.display(check_delay=False) - - def __iter__(self): - try: - it = super(tqdm_notebook, self).__iter__() - for obj in it: - # return super(tqdm...) will not catch exception - yield obj - # NB: except ... [ as ...] breaks IPython async KeyboardInterrupt - except: # NOQA - self.disp(bar_style='danger') - raise - # NB: don't `finally: close()` - # since this could be a shared bar which the user will `reset()` - - def update(self, n=1): - try: - return super(tqdm_notebook, self).update(n=n) - # NB: except ... [ as ...] breaks IPython async KeyboardInterrupt - except: # NOQA - # cannot catch KeyboardInterrupt when using manual tqdm - # as the interrupt will most likely happen on another statement - self.disp(bar_style='danger') - raise - # NB: don't `finally: close()` - # since this could be a shared bar which the user will `reset()` - - def close(self): - if self.disable: - return - super(tqdm_notebook, self).close() - # Try to detect if there was an error or KeyboardInterrupt - # in manual mode: if n < total, things probably got wrong - if self.total and self.n < self.total: - self.disp(bar_style='danger', check_delay=False) - else: - if self.leave: - self.disp(bar_style='success', check_delay=False) - else: - self.disp(close=True, check_delay=False) - - def clear(self, *_, **__): - pass - - def reset(self, total=None): - """ - Resets to 0 iterations for repeated use. - - Consider combining with `leave=True`. - - Parameters - ---------- - total : int or float, optional. Total to use for the new bar. - """ - if self.disable: - return super(tqdm_notebook, self).reset(total=total) - _, pbar, _ = self.container.children - pbar.bar_style = '' - if total is not None: - pbar.max = total - if not self.total and self.ncols is None: # no longer unknown total - pbar.layout.width = None # reset width - return super(tqdm_notebook, self).reset(total=total) - - -def tnrange(*args, **kwargs): - """Shortcut for `tqdm.notebook.tqdm(range(*args), **kwargs)`.""" - return tqdm_notebook(range(*args), **kwargs) - - -# Aliases -tqdm = tqdm_notebook -trange = tnrange diff --git a/venv/lib/python3.8/site-packages/tqdm/rich.py b/venv/lib/python3.8/site-packages/tqdm/rich.py deleted file mode 100644 index 00e1ddf2611e132f503472281b659691d3784ef7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/rich.py +++ /dev/null @@ -1,150 +0,0 @@ -""" -`rich.progress` decorator for iterators. - -Usage: ->>> from tqdm.rich import trange, tqdm ->>> for i in trange(10): -... ... -""" -from warnings import warn - -from rich.progress import ( - BarColumn, Progress, ProgressColumn, Text, TimeElapsedColumn, TimeRemainingColumn, filesize) - -from .std import TqdmExperimentalWarning -from .std import tqdm as std_tqdm - -__author__ = {"github.com/": ["casperdcl"]} -__all__ = ['tqdm_rich', 'trrange', 'tqdm', 'trange'] - - -class FractionColumn(ProgressColumn): - """Renders completed/total, e.g. '0.5/2.3 G'.""" - def __init__(self, unit_scale=False, unit_divisor=1000): - self.unit_scale = unit_scale - self.unit_divisor = unit_divisor - super().__init__() - - def render(self, task): - """Calculate common unit for completed and total.""" - completed = int(task.completed) - total = int(task.total) - if self.unit_scale: - unit, suffix = filesize.pick_unit_and_suffix( - total, - ["", "K", "M", "G", "T", "P", "E", "Z", "Y"], - self.unit_divisor, - ) - else: - unit, suffix = filesize.pick_unit_and_suffix(total, [""], 1) - precision = 0 if unit == 1 else 1 - return Text( - f"{completed/unit:,.{precision}f}/{total/unit:,.{precision}f} {suffix}", - style="progress.download") - - -class RateColumn(ProgressColumn): - """Renders human readable transfer speed.""" - def __init__(self, unit="", unit_scale=False, unit_divisor=1000): - self.unit = unit - self.unit_scale = unit_scale - self.unit_divisor = unit_divisor - super().__init__() - - def render(self, task): - """Show data transfer speed.""" - speed = task.speed - if speed is None: - return Text(f"? {self.unit}/s", style="progress.data.speed") - if self.unit_scale: - unit, suffix = filesize.pick_unit_and_suffix( - speed, - ["", "K", "M", "G", "T", "P", "E", "Z", "Y"], - self.unit_divisor, - ) - else: - unit, suffix = filesize.pick_unit_and_suffix(speed, [""], 1) - precision = 0 if unit == 1 else 1 - return Text(f"{speed/unit:,.{precision}f} {suffix}{self.unit}/s", - style="progress.data.speed") - - -class tqdm_rich(std_tqdm): # pragma: no cover - """Experimental rich.progress GUI version of tqdm!""" - # TODO: @classmethod: write()? - def __init__(self, *args, **kwargs): - """ - This class accepts the following parameters *in addition* to - the parameters accepted by `tqdm`. - - Parameters - ---------- - progress : tuple, optional - arguments for `rich.progress.Progress()`. - options : dict, optional - keyword arguments for `rich.progress.Progress()`. - """ - kwargs = kwargs.copy() - kwargs['gui'] = True - # convert disable = None to False - kwargs['disable'] = bool(kwargs.get('disable', False)) - progress = kwargs.pop('progress', None) - options = kwargs.pop('options', {}).copy() - super(tqdm_rich, self).__init__(*args, **kwargs) - - if self.disable: - return - - warn("rich is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) - d = self.format_dict - if progress is None: - progress = ( - "[progress.description]{task.description}" - "[progress.percentage]{task.percentage:>4.0f}%", - BarColumn(bar_width=None), - FractionColumn( - unit_scale=d['unit_scale'], unit_divisor=d['unit_divisor']), - "[", TimeElapsedColumn(), "<", TimeRemainingColumn(), - ",", RateColumn(unit=d['unit'], unit_scale=d['unit_scale'], - unit_divisor=d['unit_divisor']), "]" - ) - options.setdefault('transient', not self.leave) - self._prog = Progress(*progress, **options) - self._prog.__enter__() - self._task_id = self._prog.add_task(self.desc or "", **d) - - def close(self): - if self.disable: - return - super(tqdm_rich, self).close() - self._prog.__exit__(None, None, None) - - def clear(self, *_, **__): - pass - - def display(self, *_, **__): - if not hasattr(self, '_prog'): - return - self._prog.update(self._task_id, completed=self.n, description=self.desc) - - def reset(self, total=None): - """ - Resets to 0 iterations for repeated use. - - Parameters - ---------- - total : int or float, optional. Total to use for the new bar. - """ - if hasattr(self, '_prog'): - self._prog.reset(total=total) - super(tqdm_rich, self).reset(total=total) - - -def trrange(*args, **kwargs): - """Shortcut for `tqdm.rich.tqdm(range(*args), **kwargs)`.""" - return tqdm_rich(range(*args), **kwargs) - - -# Aliases -tqdm = tqdm_rich -trange = trrange diff --git a/venv/lib/python3.8/site-packages/tqdm/std.py b/venv/lib/python3.8/site-packages/tqdm/std.py deleted file mode 100644 index 9ba8e850692baa51ca7c8d6cb71617bf09fc458c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/std.py +++ /dev/null @@ -1,1525 +0,0 @@ -""" -Customisable progressbar decorator for iterators. -Includes a default `range` iterator printing to `stderr`. - -Usage: ->>> from tqdm import trange, tqdm ->>> for i in trange(10): -... ... -""" -import sys -from collections import OrderedDict, defaultdict -from contextlib import contextmanager -from datetime import datetime, timedelta -from numbers import Number -from time import time -from warnings import warn -from weakref import WeakSet - -from ._monitor import TMonitor -from .utils import ( - CallbackIOWrapper, Comparable, DisableOnWriteError, FormatReplace, SimpleTextIOWrapper, - _is_ascii, _screen_shape_wrapper, _supports_unicode, _term_move_up, disp_len, disp_trim, - envwrap) - -__author__ = "https://github.com/tqdm/tqdm#contributions" -__all__ = ['tqdm', 'trange', - 'TqdmTypeError', 'TqdmKeyError', 'TqdmWarning', - 'TqdmExperimentalWarning', 'TqdmDeprecationWarning', - 'TqdmMonitorWarning'] - - -class TqdmTypeError(TypeError): - pass - - -class TqdmKeyError(KeyError): - pass - - -class TqdmWarning(Warning): - """base class for all tqdm warnings. - - Used for non-external-code-breaking errors, such as garbled printing. - """ - def __init__(self, msg, fp_write=None, *a, **k): - if fp_write is not None: - fp_write("\n" + self.__class__.__name__ + ": " + str(msg).rstrip() + '\n') - else: - super(TqdmWarning, self).__init__(msg, *a, **k) - - -class TqdmExperimentalWarning(TqdmWarning, FutureWarning): - """beta feature, unstable API and behaviour""" - pass - - -class TqdmDeprecationWarning(TqdmWarning, DeprecationWarning): - # not suppressed if raised - pass - - -class TqdmMonitorWarning(TqdmWarning, RuntimeWarning): - """tqdm monitor errors which do not affect external functionality""" - pass - - -def TRLock(*args, **kwargs): - """threading RLock""" - try: - from threading import RLock - return RLock(*args, **kwargs) - except (ImportError, OSError): # pragma: no cover - pass - - -class TqdmDefaultWriteLock(object): - """ - Provide a default write lock for thread and multiprocessing safety. - Works only on platforms supporting `fork` (so Windows is excluded). - You must initialise a `tqdm` or `TqdmDefaultWriteLock` instance - before forking in order for the write lock to work. - On Windows, you need to supply the lock from the parent to the children as - an argument to joblib or the parallelism lib you use. - """ - # global thread lock so no setup required for multithreading. - # NB: Do not create multiprocessing lock as it sets the multiprocessing - # context, disallowing `spawn()`/`forkserver()` - th_lock = TRLock() - - def __init__(self): - # Create global parallelism locks to avoid racing issues with parallel - # bars works only if fork available (Linux/MacOSX, but not Windows) - cls = type(self) - root_lock = cls.th_lock - if root_lock is not None: - root_lock.acquire() - cls.create_mp_lock() - self.locks = [lk for lk in [cls.mp_lock, cls.th_lock] if lk is not None] - if root_lock is not None: - root_lock.release() - - def acquire(self, *a, **k): - for lock in self.locks: - lock.acquire(*a, **k) - - def release(self): - for lock in self.locks[::-1]: # Release in inverse order of acquisition - lock.release() - - def __enter__(self): - self.acquire() - - def __exit__(self, *exc): - self.release() - - @classmethod - def create_mp_lock(cls): - if not hasattr(cls, 'mp_lock'): - try: - from multiprocessing import RLock - cls.mp_lock = RLock() - except (ImportError, OSError): # pragma: no cover - cls.mp_lock = None - - @classmethod - def create_th_lock(cls): - assert hasattr(cls, 'th_lock') - warn("create_th_lock not needed anymore", TqdmDeprecationWarning, stacklevel=2) - - -class Bar(object): - """ - `str.format`-able bar with format specifiers: `[width][type]` - - - `width` - + unspecified (default): use `self.default_len` - + `int >= 0`: overrides `self.default_len` - + `int < 0`: subtract from `self.default_len` - - `type` - + `a`: ascii (`charset=self.ASCII` override) - + `u`: unicode (`charset=self.UTF` override) - + `b`: blank (`charset=" "` override) - """ - ASCII = " 123456789#" - UTF = u" " + u''.join(map(chr, range(0x258F, 0x2587, -1))) - BLANK = " " - COLOUR_RESET = '\x1b[0m' - COLOUR_RGB = '\x1b[38;2;%d;%d;%dm' - COLOURS = {'BLACK': '\x1b[30m', 'RED': '\x1b[31m', 'GREEN': '\x1b[32m', - 'YELLOW': '\x1b[33m', 'BLUE': '\x1b[34m', 'MAGENTA': '\x1b[35m', - 'CYAN': '\x1b[36m', 'WHITE': '\x1b[37m'} - - def __init__(self, frac, default_len=10, charset=UTF, colour=None): - if not 0 <= frac <= 1: - warn("clamping frac to range [0, 1]", TqdmWarning, stacklevel=2) - frac = max(0, min(1, frac)) - assert default_len > 0 - self.frac = frac - self.default_len = default_len - self.charset = charset - self.colour = colour - - @property - def colour(self): - return self._colour - - @colour.setter - def colour(self, value): - if not value: - self._colour = None - return - try: - if value.upper() in self.COLOURS: - self._colour = self.COLOURS[value.upper()] - elif value[0] == '#' and len(value) == 7: - self._colour = self.COLOUR_RGB % tuple( - int(i, 16) for i in (value[1:3], value[3:5], value[5:7])) - else: - raise KeyError - except (KeyError, AttributeError): - warn("Unknown colour (%s); valid choices: [hex (#00ff00), %s]" % ( - value, ", ".join(self.COLOURS)), - TqdmWarning, stacklevel=2) - self._colour = None - - def __format__(self, format_spec): - if format_spec: - _type = format_spec[-1].lower() - try: - charset = {'a': self.ASCII, 'u': self.UTF, 'b': self.BLANK}[_type] - except KeyError: - charset = self.charset - else: - format_spec = format_spec[:-1] - if format_spec: - N_BARS = int(format_spec) - if N_BARS < 0: - N_BARS += self.default_len - else: - N_BARS = self.default_len - else: - charset = self.charset - N_BARS = self.default_len - - nsyms = len(charset) - 1 - bar_length, frac_bar_length = divmod(int(self.frac * N_BARS * nsyms), nsyms) - - res = charset[-1] * bar_length - if bar_length < N_BARS: # whitespace padding - res = res + charset[frac_bar_length] + charset[0] * (N_BARS - bar_length - 1) - return self.colour + res + self.COLOUR_RESET if self.colour else res - - -class EMA(object): - """ - Exponential moving average: smoothing to give progressively lower - weights to older values. - - Parameters - ---------- - smoothing : float, optional - Smoothing factor in range [0, 1], [default: 0.3]. - Increase to give more weight to recent values. - Ranges from 0 (yields old value) to 1 (yields new value). - """ - def __init__(self, smoothing=0.3): - self.alpha = smoothing - self.last = 0 - self.calls = 0 - - def __call__(self, x=None): - """ - Parameters - ---------- - x : float - New value to include in EMA. - """ - beta = 1 - self.alpha - if x is not None: - self.last = self.alpha * x + beta * self.last - self.calls += 1 - return self.last / (1 - beta ** self.calls) if self.calls else self.last - - -class tqdm(Comparable): - """ - Decorate an iterable object, returning an iterator which acts exactly - like the original iterable, but prints a dynamically updating - progressbar every time a value is requested. - - Parameters - ---------- - iterable : iterable, optional - Iterable to decorate with a progressbar. - Leave blank to manually manage the updates. - desc : str, optional - Prefix for the progressbar. - total : int or float, optional - The number of expected iterations. If unspecified, - len(iterable) is used if possible. If float("inf") or as a last - resort, only basic progress statistics are displayed - (no ETA, no progressbar). - If `gui` is True and this parameter needs subsequent updating, - specify an initial arbitrary large positive number, - e.g. 9e9. - leave : bool, optional - If [default: True], keeps all traces of the progressbar - upon termination of iteration. - If `None`, will leave only if `position` is `0`. - file : `io.TextIOWrapper` or `io.StringIO`, optional - Specifies where to output the progress messages - (default: sys.stderr). Uses `file.write(str)` and `file.flush()` - methods. For encoding, see `write_bytes`. - ncols : int, optional - The width of the entire output message. If specified, - dynamically resizes the progressbar to stay within this bound. - If unspecified, attempts to use environment width. The - fallback is a meter width of 10 and no limit for the counter and - statistics. If 0, will not print any meter (only stats). - mininterval : float, optional - Minimum progress display update interval [default: 0.1] seconds. - maxinterval : float, optional - Maximum progress display update interval [default: 10] seconds. - Automatically adjusts `miniters` to correspond to `mininterval` - after long display update lag. Only works if `dynamic_miniters` - or monitor thread is enabled. - miniters : int or float, optional - Minimum progress display update interval, in iterations. - If 0 and `dynamic_miniters`, will automatically adjust to equal - `mininterval` (more CPU efficient, good for tight loops). - If > 0, will skip display of specified number of iterations. - Tweak this and `mininterval` to get very efficient loops. - If your progress is erratic with both fast and slow iterations - (network, skipping items, etc) you should set miniters=1. - ascii : bool or str, optional - If unspecified or False, use unicode (smooth blocks) to fill - the meter. The fallback is to use ASCII characters " 123456789#". - disable : bool, optional - Whether to disable the entire progressbar wrapper - [default: False]. If set to None, disable on non-TTY. - unit : str, optional - String that will be used to define the unit of each iteration - [default: it]. - unit_scale : bool or int or float, optional - If 1 or True, the number of iterations will be reduced/scaled - automatically and a metric prefix following the - International System of Units standard will be added - (kilo, mega, etc.) [default: False]. If any other non-zero - number, will scale `total` and `n`. - dynamic_ncols : bool, optional - If set, constantly alters `ncols` and `nrows` to the - environment (allowing for window resizes) [default: False]. - smoothing : float, optional - Exponential moving average smoothing factor for speed estimates - (ignored in GUI mode). Ranges from 0 (average speed) to 1 - (current/instantaneous speed) [default: 0.3]. - bar_format : str, optional - Specify a custom bar string formatting. May impact performance. - [default: '{l_bar}{bar}{r_bar}'], where - l_bar='{desc}: {percentage:3.0f}%|' and - r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' - '{rate_fmt}{postfix}]' - Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, - percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, - rate, rate_fmt, rate_noinv, rate_noinv_fmt, - rate_inv, rate_inv_fmt, postfix, unit_divisor, - remaining, remaining_s, eta. - Note that a trailing ": " is automatically removed after {desc} - if the latter is empty. - initial : int or float, optional - The initial counter value. Useful when restarting a progress - bar [default: 0]. If using float, consider specifying `{n:.3f}` - or similar in `bar_format`, or specifying `unit_scale`. - position : int, optional - Specify the line offset to print this bar (starting from 0) - Automatic if unspecified. - Useful to manage multiple bars at once (eg, from threads). - postfix : dict or *, optional - Specify additional stats to display at the end of the bar. - Calls `set_postfix(**postfix)` if possible (dict). - unit_divisor : float, optional - [default: 1000], ignored unless `unit_scale` is True. - write_bytes : bool, optional - Whether to write bytes. If (default: False) will write unicode. - lock_args : tuple, optional - Passed to `refresh` for intermediate output - (initialisation, iterating, and updating). - nrows : int, optional - The screen height. If specified, hides nested bars outside this - bound. If unspecified, attempts to use environment height. - The fallback is 20. - colour : str, optional - Bar colour (e.g. 'green', '#00ff00'). - delay : float, optional - Don't display until [default: 0] seconds have elapsed. - gui : bool, optional - WARNING: internal parameter - do not use. - Use tqdm.gui.tqdm(...) instead. If set, will attempt to use - matplotlib animations for a graphical output [default: False]. - - Returns - ------- - out : decorated iterator. - """ - - monitor_interval = 10 # set to 0 to disable the thread - monitor = None - _instances = WeakSet() - - @staticmethod - def format_sizeof(num, suffix='', divisor=1000): - """ - Formats a number (greater than unity) with SI Order of Magnitude - prefixes. - - Parameters - ---------- - num : float - Number ( >= 1) to format. - suffix : str, optional - Post-postfix [default: '']. - divisor : float, optional - Divisor between prefixes [default: 1000]. - - Returns - ------- - out : str - Number with Order of Magnitude SI unit postfix. - """ - for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']: - if abs(num) < 999.5: - if abs(num) < 99.95: - if abs(num) < 9.995: - return '{0:1.2f}'.format(num) + unit + suffix - return '{0:2.1f}'.format(num) + unit + suffix - return '{0:3.0f}'.format(num) + unit + suffix - num /= divisor - return '{0:3.1f}Y'.format(num) + suffix - - @staticmethod - def format_interval(t): - """ - Formats a number of seconds as a clock time, [H:]MM:SS - - Parameters - ---------- - t : int - Number of seconds. - - Returns - ------- - out : str - [H:]MM:SS - """ - mins, s = divmod(int(t), 60) - h, m = divmod(mins, 60) - if h: - return '{0:d}:{1:02d}:{2:02d}'.format(h, m, s) - else: - return '{0:02d}:{1:02d}'.format(m, s) - - @staticmethod - def format_num(n): - """ - Intelligent scientific notation (.3g). - - Parameters - ---------- - n : int or float or Numeric - A Number. - - Returns - ------- - out : str - Formatted number. - """ - f = '{0:.3g}'.format(n).replace('+0', '+').replace('-0', '-') - n = str(n) - return f if len(f) < len(n) else n - - @staticmethod - def status_printer(file): - """ - Manage the printing and in-place updating of a line of characters. - Note that if the string is longer than a line, then in-place - updating may not work (it will print a new line at each refresh). - """ - fp = file - fp_flush = getattr(fp, 'flush', lambda: None) # pragma: no cover - if fp in (sys.stderr, sys.stdout): - getattr(sys.stderr, 'flush', lambda: None)() - getattr(sys.stdout, 'flush', lambda: None)() - - def fp_write(s): - fp.write(str(s)) - fp_flush() - - last_len = [0] - - def print_status(s): - len_s = disp_len(s) - fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) - last_len[0] = len_s - - return print_status - - @staticmethod - def format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False, unit='it', - unit_scale=False, rate=None, bar_format=None, postfix=None, - unit_divisor=1000, initial=0, colour=None, **extra_kwargs): - """ - Return a string-based progress bar given some parameters - - Parameters - ---------- - n : int or float - Number of finished iterations. - total : int or float - The expected total number of iterations. If meaningless (None), - only basic progress statistics are displayed (no ETA). - elapsed : float - Number of seconds passed since start. - ncols : int, optional - The width of the entire output message. If specified, - dynamically resizes `{bar}` to stay within this bound - [default: None]. If `0`, will not print any bar (only stats). - The fallback is `{bar:10}`. - prefix : str, optional - Prefix message (included in total width) [default: '']. - Use as {desc} in bar_format string. - ascii : bool, optional or str, optional - If not set, use unicode (smooth blocks) to fill the meter - [default: False]. The fallback is to use ASCII characters - " 123456789#". - unit : str, optional - The iteration unit [default: 'it']. - unit_scale : bool or int or float, optional - If 1 or True, the number of iterations will be printed with an - appropriate SI metric prefix (k = 10^3, M = 10^6, etc.) - [default: False]. If any other non-zero number, will scale - `total` and `n`. - rate : float, optional - Manual override for iteration rate. - If [default: None], uses n/elapsed. - bar_format : str, optional - Specify a custom bar string formatting. May impact performance. - [default: '{l_bar}{bar}{r_bar}'], where - l_bar='{desc}: {percentage:3.0f}%|' and - r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' - '{rate_fmt}{postfix}]' - Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, - percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, - rate, rate_fmt, rate_noinv, rate_noinv_fmt, - rate_inv, rate_inv_fmt, postfix, unit_divisor, - remaining, remaining_s, eta. - Note that a trailing ": " is automatically removed after {desc} - if the latter is empty. - postfix : *, optional - Similar to `prefix`, but placed at the end - (e.g. for additional stats). - Note: postfix is usually a string (not a dict) for this method, - and will if possible be set to postfix = ', ' + postfix. - However other types are supported (#382). - unit_divisor : float, optional - [default: 1000], ignored unless `unit_scale` is True. - initial : int or float, optional - The initial counter value [default: 0]. - colour : str, optional - Bar colour (e.g. 'green', '#00ff00'). - - Returns - ------- - out : Formatted meter and stats, ready to display. - """ - - # sanity check: total - if total and n >= (total + 0.5): # allow float imprecision (#849) - total = None - - # apply custom scale if necessary - if unit_scale and unit_scale not in (True, 1): - if total: - total *= unit_scale - n *= unit_scale - if rate: - rate *= unit_scale # by default rate = self.avg_dn / self.avg_dt - unit_scale = False - - elapsed_str = tqdm.format_interval(elapsed) - - # if unspecified, attempt to use rate = average speed - # (we allow manual override since predicting time is an arcane art) - if rate is None and elapsed: - rate = (n - initial) / elapsed - inv_rate = 1 / rate if rate else None - format_sizeof = tqdm.format_sizeof - rate_noinv_fmt = ((format_sizeof(rate) if unit_scale else - '{0:5.2f}'.format(rate)) if rate else '?') + unit + '/s' - rate_inv_fmt = ( - (format_sizeof(inv_rate) if unit_scale else '{0:5.2f}'.format(inv_rate)) - if inv_rate else '?') + 's/' + unit - rate_fmt = rate_inv_fmt if inv_rate and inv_rate > 1 else rate_noinv_fmt - - if unit_scale: - n_fmt = format_sizeof(n, divisor=unit_divisor) - total_fmt = format_sizeof(total, divisor=unit_divisor) if total is not None else '?' - else: - n_fmt = str(n) - total_fmt = str(total) if total is not None else '?' - - try: - postfix = ', ' + postfix if postfix else '' - except TypeError: - pass - - remaining = (total - n) / rate if rate and total else 0 - remaining_str = tqdm.format_interval(remaining) if rate else '?' - try: - eta_dt = (datetime.now() + timedelta(seconds=remaining) - if rate and total else datetime.utcfromtimestamp(0)) - except OverflowError: - eta_dt = datetime.max - - # format the stats displayed to the left and right sides of the bar - if prefix: - # old prefix setup work around - bool_prefix_colon_already = (prefix[-2:] == ": ") - l_bar = prefix if bool_prefix_colon_already else prefix + ": " - else: - l_bar = '' - - r_bar = f'| {n_fmt}/{total_fmt} [{elapsed_str}<{remaining_str}, {rate_fmt}{postfix}]' - - # Custom bar formatting - # Populate a dict with all available progress indicators - format_dict = { - # slight extension of self.format_dict - 'n': n, 'n_fmt': n_fmt, 'total': total, 'total_fmt': total_fmt, - 'elapsed': elapsed_str, 'elapsed_s': elapsed, - 'ncols': ncols, 'desc': prefix or '', 'unit': unit, - 'rate': inv_rate if inv_rate and inv_rate > 1 else rate, - 'rate_fmt': rate_fmt, 'rate_noinv': rate, - 'rate_noinv_fmt': rate_noinv_fmt, 'rate_inv': inv_rate, - 'rate_inv_fmt': rate_inv_fmt, - 'postfix': postfix, 'unit_divisor': unit_divisor, - 'colour': colour, - # plus more useful definitions - 'remaining': remaining_str, 'remaining_s': remaining, - 'l_bar': l_bar, 'r_bar': r_bar, 'eta': eta_dt, - **extra_kwargs} - - # total is known: we can predict some stats - if total: - # fractional and percentage progress - frac = n / total - percentage = frac * 100 - - l_bar += '{0:3.0f}%|'.format(percentage) - - if ncols == 0: - return l_bar[:-1] + r_bar[1:] - - format_dict.update(l_bar=l_bar) - if bar_format: - format_dict.update(percentage=percentage) - - # auto-remove colon for empty `{desc}` - if not prefix: - bar_format = bar_format.replace("{desc}: ", '') - else: - bar_format = "{l_bar}{bar}{r_bar}" - - full_bar = FormatReplace() - nobar = bar_format.format(bar=full_bar, **format_dict) - if not full_bar.format_called: - return nobar # no `{bar}`; nothing else to do - - # Formatting progress bar space available for bar's display - full_bar = Bar(frac, - max(1, ncols - disp_len(nobar)) if ncols else 10, - charset=Bar.ASCII if ascii is True else ascii or Bar.UTF, - colour=colour) - if not _is_ascii(full_bar.charset) and _is_ascii(bar_format): - bar_format = str(bar_format) - res = bar_format.format(bar=full_bar, **format_dict) - return disp_trim(res, ncols) if ncols else res - - elif bar_format: - # user-specified bar_format but no total - l_bar += '|' - format_dict.update(l_bar=l_bar, percentage=0) - full_bar = FormatReplace() - nobar = bar_format.format(bar=full_bar, **format_dict) - if not full_bar.format_called: - return nobar - full_bar = Bar(0, - max(1, ncols - disp_len(nobar)) if ncols else 10, - charset=Bar.BLANK, colour=colour) - res = bar_format.format(bar=full_bar, **format_dict) - return disp_trim(res, ncols) if ncols else res - else: - # no total: no progressbar, ETA, just progress stats - return (f'{(prefix + ": ") if prefix else ""}' - f'{n_fmt}{unit} [{elapsed_str}, {rate_fmt}{postfix}]') - - def __new__(cls, *_, **__): - instance = object.__new__(cls) - with cls.get_lock(): # also constructs lock if non-existent - cls._instances.add(instance) - # create monitoring thread - if cls.monitor_interval and (cls.monitor is None - or not cls.monitor.report()): - try: - cls.monitor = TMonitor(cls, cls.monitor_interval) - except Exception as e: # pragma: nocover - warn("tqdm:disabling monitor support" - " (monitor_interval = 0) due to:\n" + str(e), - TqdmMonitorWarning, stacklevel=2) - cls.monitor_interval = 0 - return instance - - @classmethod - def _get_free_pos(cls, instance=None): - """Skips specified instance.""" - positions = {abs(inst.pos) for inst in cls._instances - if inst is not instance and hasattr(inst, "pos")} - return min(set(range(len(positions) + 1)).difference(positions)) - - @classmethod - def _decr_instances(cls, instance): - """ - Remove from list and reposition another unfixed bar - to fill the new gap. - - This means that by default (where all nested bars are unfixed), - order is not maintained but screen flicker/blank space is minimised. - (tqdm<=4.44.1 moved ALL subsequent unfixed bars up.) - """ - with cls._lock: - try: - cls._instances.remove(instance) - except KeyError: - # if not instance.gui: # pragma: no cover - # raise - pass # py2: maybe magically removed already - # else: - if not instance.gui: - last = (instance.nrows or 20) - 1 - # find unfixed (`pos >= 0`) overflow (`pos >= nrows - 1`) - instances = list(filter( - lambda i: hasattr(i, "pos") and last <= i.pos, - cls._instances)) - # set first found to current `pos` - if instances: - inst = min(instances, key=lambda i: i.pos) - inst.clear(nolock=True) - inst.pos = abs(instance.pos) - - @classmethod - def write(cls, s, file=None, end="\n", nolock=False): - """Print a message via tqdm (without overlap with bars).""" - fp = file if file is not None else sys.stdout - with cls.external_write_mode(file=file, nolock=nolock): - # Write the message - fp.write(s) - fp.write(end) - - @classmethod - @contextmanager - def external_write_mode(cls, file=None, nolock=False): - """ - Disable tqdm within context and refresh tqdm when exits. - Useful when writing to standard output stream - """ - fp = file if file is not None else sys.stdout - - try: - if not nolock: - cls.get_lock().acquire() - # Clear all bars - inst_cleared = [] - for inst in getattr(cls, '_instances', []): - # Clear instance if in the target output file - # or if write output + tqdm output are both either - # sys.stdout or sys.stderr (because both are mixed in terminal) - if hasattr(inst, "start_t") and (inst.fp == fp or all( - f in (sys.stdout, sys.stderr) for f in (fp, inst.fp))): - inst.clear(nolock=True) - inst_cleared.append(inst) - yield - # Force refresh display of bars we cleared - for inst in inst_cleared: - inst.refresh(nolock=True) - finally: - if not nolock: - cls._lock.release() - - @classmethod - def set_lock(cls, lock): - """Set the global lock.""" - cls._lock = lock - - @classmethod - def get_lock(cls): - """Get the global lock. Construct it if it does not exist.""" - if not hasattr(cls, '_lock'): - cls._lock = TqdmDefaultWriteLock() - return cls._lock - - @classmethod - def pandas(cls, **tqdm_kwargs): - """ - Registers the current `tqdm` class with - pandas.core. - ( frame.DataFrame - | series.Series - | groupby.(generic.)DataFrameGroupBy - | groupby.(generic.)SeriesGroupBy - ).progress_apply - - A new instance will be created every time `progress_apply` is called, - and each instance will automatically `close()` upon completion. - - Parameters - ---------- - tqdm_kwargs : arguments for the tqdm instance - - Examples - -------- - >>> import pandas as pd - >>> import numpy as np - >>> from tqdm import tqdm - >>> from tqdm.gui import tqdm as tqdm_gui - >>> - >>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) - >>> tqdm.pandas(ncols=50) # can use tqdm_gui, optional kwargs, etc - >>> # Now you can use `progress_apply` instead of `apply` - >>> df.groupby(0).progress_apply(lambda x: x**2) - - References - ---------- - - """ - from warnings import catch_warnings, simplefilter - - from pandas.core.frame import DataFrame - from pandas.core.series import Series - try: - with catch_warnings(): - simplefilter("ignore", category=FutureWarning) - from pandas import Panel - except ImportError: # pandas>=1.2.0 - Panel = None - Rolling, Expanding = None, None - try: # pandas>=1.0.0 - from pandas.core.window.rolling import _Rolling_and_Expanding - except ImportError: - try: # pandas>=0.18.0 - from pandas.core.window import _Rolling_and_Expanding - except ImportError: # pandas>=1.2.0 - try: # pandas>=1.2.0 - from pandas.core.window.expanding import Expanding - from pandas.core.window.rolling import Rolling - _Rolling_and_Expanding = Rolling, Expanding - except ImportError: # pragma: no cover - _Rolling_and_Expanding = None - try: # pandas>=0.25.0 - from pandas.core.groupby.generic import SeriesGroupBy # , NDFrameGroupBy - from pandas.core.groupby.generic import DataFrameGroupBy - except ImportError: # pragma: no cover - try: # pandas>=0.23.0 - from pandas.core.groupby.groupby import DataFrameGroupBy, SeriesGroupBy - except ImportError: - from pandas.core.groupby import DataFrameGroupBy, SeriesGroupBy - try: # pandas>=0.23.0 - from pandas.core.groupby.groupby import GroupBy - except ImportError: # pragma: no cover - from pandas.core.groupby import GroupBy - - try: # pandas>=0.23.0 - from pandas.core.groupby.groupby import PanelGroupBy - except ImportError: - try: - from pandas.core.groupby import PanelGroupBy - except ImportError: # pandas>=0.25.0 - PanelGroupBy = None - - tqdm_kwargs = tqdm_kwargs.copy() - deprecated_t = [tqdm_kwargs.pop('deprecated_t', None)] - - def inner_generator(df_function='apply'): - def inner(df, func, *args, **kwargs): - """ - Parameters - ---------- - df : (DataFrame|Series)[GroupBy] - Data (may be grouped). - func : function - To be applied on the (grouped) data. - **kwargs : optional - Transmitted to `df.apply()`. - """ - - # Precompute total iterations - total = tqdm_kwargs.pop("total", getattr(df, 'ngroups', None)) - if total is None: # not grouped - if df_function == 'applymap': - total = df.size - elif isinstance(df, Series): - total = len(df) - elif (_Rolling_and_Expanding is None or - not isinstance(df, _Rolling_and_Expanding)): - # DataFrame or Panel - axis = kwargs.get('axis', 0) - if axis == 'index': - axis = 0 - elif axis == 'columns': - axis = 1 - # when axis=0, total is shape[axis1] - total = df.size // df.shape[axis] - - # Init bar - if deprecated_t[0] is not None: - t = deprecated_t[0] - deprecated_t[0] = None - else: - t = cls(total=total, **tqdm_kwargs) - - if len(args) > 0: - # *args intentionally not supported (see #244, #299) - TqdmDeprecationWarning( - "Except func, normal arguments are intentionally" + - " not supported by" + - " `(DataFrame|Series|GroupBy).progress_apply`." + - " Use keyword arguments instead.", - fp_write=getattr(t.fp, 'write', sys.stderr.write)) - - try: # pandas>=1.3.0 - from pandas.core.common import is_builtin_func - except ImportError: - is_builtin_func = df._is_builtin_func - try: - func = is_builtin_func(func) - except TypeError: - pass - - # Define bar updating wrapper - def wrapper(*args, **kwargs): - # update tbar correctly - # it seems `pandas apply` calls `func` twice - # on the first column/row to decide whether it can - # take a fast or slow code path; so stop when t.total==t.n - t.update(n=1 if not t.total or t.n < t.total else 0) - return func(*args, **kwargs) - - # Apply the provided function (in **kwargs) - # on the df using our wrapper (which provides bar updating) - try: - return getattr(df, df_function)(wrapper, **kwargs) - finally: - t.close() - - return inner - - # Monkeypatch pandas to provide easy methods - # Enable custom tqdm progress in pandas! - Series.progress_apply = inner_generator() - SeriesGroupBy.progress_apply = inner_generator() - Series.progress_map = inner_generator('map') - SeriesGroupBy.progress_map = inner_generator('map') - - DataFrame.progress_apply = inner_generator() - DataFrameGroupBy.progress_apply = inner_generator() - DataFrame.progress_applymap = inner_generator('applymap') - - if Panel is not None: - Panel.progress_apply = inner_generator() - if PanelGroupBy is not None: - PanelGroupBy.progress_apply = inner_generator() - - GroupBy.progress_apply = inner_generator() - GroupBy.progress_aggregate = inner_generator('aggregate') - GroupBy.progress_transform = inner_generator('transform') - - if Rolling is not None and Expanding is not None: - Rolling.progress_apply = inner_generator() - Expanding.progress_apply = inner_generator() - elif _Rolling_and_Expanding is not None: - _Rolling_and_Expanding.progress_apply = inner_generator() - - # override defaults via env vars - @envwrap("TQDM_", is_method=True, types={'total': float, 'ncols': int, 'miniters': float, - 'position': int, 'nrows': int}) - def __init__(self, iterable=None, desc=None, total=None, leave=True, file=None, - ncols=None, mininterval=0.1, maxinterval=10.0, miniters=None, - ascii=None, disable=False, unit='it', unit_scale=False, - dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, - position=None, postfix=None, unit_divisor=1000, write_bytes=False, - lock_args=None, nrows=None, colour=None, delay=0.0, gui=False, - **kwargs): - """see tqdm.tqdm for arguments""" - if file is None: - file = sys.stderr - - if write_bytes: - # Despite coercing unicode into bytes, py2 sys.std* streams - # should have bytes written to them. - file = SimpleTextIOWrapper( - file, encoding=getattr(file, 'encoding', None) or 'utf-8') - - file = DisableOnWriteError(file, tqdm_instance=self) - - if disable is None and hasattr(file, "isatty") and not file.isatty(): - disable = True - - if total is None and iterable is not None: - try: - total = len(iterable) - except (TypeError, AttributeError): - total = None - if total == float("inf"): - # Infinite iterations, behave same as unknown - total = None - - if disable: - self.iterable = iterable - self.disable = disable - with self._lock: - self.pos = self._get_free_pos(self) - self._instances.remove(self) - self.n = initial - self.total = total - self.leave = leave - return - - if kwargs: - self.disable = True - with self._lock: - self.pos = self._get_free_pos(self) - self._instances.remove(self) - raise ( - TqdmDeprecationWarning( - "`nested` is deprecated and automated.\n" - "Use `position` instead for manual control.\n", - fp_write=getattr(file, 'write', sys.stderr.write)) - if "nested" in kwargs else - TqdmKeyError("Unknown argument(s): " + str(kwargs))) - - # Preprocess the arguments - if ( - (ncols is None or nrows is None) and (file in (sys.stderr, sys.stdout)) - ) or dynamic_ncols: # pragma: no cover - if dynamic_ncols: - dynamic_ncols = _screen_shape_wrapper() - if dynamic_ncols: - ncols, nrows = dynamic_ncols(file) - else: - _dynamic_ncols = _screen_shape_wrapper() - if _dynamic_ncols: - _ncols, _nrows = _dynamic_ncols(file) - if ncols is None: - ncols = _ncols - if nrows is None: - nrows = _nrows - - if miniters is None: - miniters = 0 - dynamic_miniters = True - else: - dynamic_miniters = False - - if mininterval is None: - mininterval = 0 - - if maxinterval is None: - maxinterval = 0 - - if ascii is None: - ascii = not _supports_unicode(file) - - if bar_format and ascii is not True and not _is_ascii(ascii): - # Convert bar format into unicode since terminal uses unicode - bar_format = str(bar_format) - - if smoothing is None: - smoothing = 0 - - # Store the arguments - self.iterable = iterable - self.desc = desc or '' - self.total = total - self.leave = leave - self.fp = file - self.ncols = ncols - self.nrows = nrows - self.mininterval = mininterval - self.maxinterval = maxinterval - self.miniters = miniters - self.dynamic_miniters = dynamic_miniters - self.ascii = ascii - self.disable = disable - self.unit = unit - self.unit_scale = unit_scale - self.unit_divisor = unit_divisor - self.initial = initial - self.lock_args = lock_args - self.delay = delay - self.gui = gui - self.dynamic_ncols = dynamic_ncols - self.smoothing = smoothing - self._ema_dn = EMA(smoothing) - self._ema_dt = EMA(smoothing) - self._ema_miniters = EMA(smoothing) - self.bar_format = bar_format - self.postfix = None - self.colour = colour - self._time = time - if postfix: - try: - self.set_postfix(refresh=False, **postfix) - except TypeError: - self.postfix = postfix - - # Init the iterations counters - self.last_print_n = initial - self.n = initial - - # if nested, at initial sp() call we replace '\r' by '\n' to - # not overwrite the outer progress bar - with self._lock: - # mark fixed positions as negative - self.pos = self._get_free_pos(self) if position is None else -position - - if not gui: - # Initialize the screen printer - self.sp = self.status_printer(self.fp) - if delay <= 0: - self.refresh(lock_args=self.lock_args) - - # Init the time counter - self.last_print_t = self._time() - # NB: Avoid race conditions by setting start_t at the very end of init - self.start_t = self.last_print_t - - def __bool__(self): - if self.total is not None: - return self.total > 0 - if self.iterable is None: - raise TypeError('bool() undefined when iterable == total == None') - return bool(self.iterable) - - def __len__(self): - return ( - self.total if self.iterable is None - else self.iterable.shape[0] if hasattr(self.iterable, "shape") - else len(self.iterable) if hasattr(self.iterable, "__len__") - else self.iterable.__length_hint__() if hasattr(self.iterable, "__length_hint__") - else getattr(self, "total", None)) - - def __reversed__(self): - try: - orig = self.iterable - except AttributeError: - raise TypeError("'tqdm' object is not reversible") - else: - self.iterable = reversed(self.iterable) - return self.__iter__() - finally: - self.iterable = orig - - def __contains__(self, item): - contains = getattr(self.iterable, '__contains__', None) - return contains(item) if contains is not None else item in self.__iter__() - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - try: - self.close() - except AttributeError: - # maybe eager thread cleanup upon external error - if (exc_type, exc_value, traceback) == (None, None, None): - raise - warn("AttributeError ignored", TqdmWarning, stacklevel=2) - - def __del__(self): - self.close() - - def __str__(self): - return self.format_meter(**self.format_dict) - - @property - def _comparable(self): - return abs(getattr(self, "pos", 1 << 31)) - - def __hash__(self): - return id(self) - - def __iter__(self): - """Backward-compatibility to use: for x in tqdm(iterable)""" - - # Inlining instance variables as locals (speed optimisation) - iterable = self.iterable - - # If the bar is disabled, then just walk the iterable - # (note: keep this check outside the loop for performance) - if self.disable: - for obj in iterable: - yield obj - return - - mininterval = self.mininterval - last_print_t = self.last_print_t - last_print_n = self.last_print_n - min_start_t = self.start_t + self.delay - n = self.n - time = self._time - - try: - for obj in iterable: - yield obj - # Update and possibly print the progressbar. - # Note: does not call self.update(1) for speed optimisation. - n += 1 - - if n - last_print_n >= self.miniters: - cur_t = time() - dt = cur_t - last_print_t - if dt >= mininterval and cur_t >= min_start_t: - self.update(n - last_print_n) - last_print_n = self.last_print_n - last_print_t = self.last_print_t - finally: - self.n = n - self.close() - - def update(self, n=1): - """ - Manually update the progress bar, useful for streams - such as reading files. - E.g.: - >>> t = tqdm(total=filesize) # Initialise - >>> for current_buffer in stream: - ... ... - ... t.update(len(current_buffer)) - >>> t.close() - The last line is highly recommended, but possibly not necessary if - `t.update()` will be called in such a way that `filesize` will be - exactly reached and printed. - - Parameters - ---------- - n : int or float, optional - Increment to add to the internal counter of iterations - [default: 1]. If using float, consider specifying `{n:.3f}` - or similar in `bar_format`, or specifying `unit_scale`. - - Returns - ------- - out : bool or None - True if a `display()` was triggered. - """ - if self.disable: - return - - if n < 0: - self.last_print_n += n # for auto-refresh logic to work - self.n += n - - # check counter first to reduce calls to time() - if self.n - self.last_print_n >= self.miniters: - cur_t = self._time() - dt = cur_t - self.last_print_t - if dt >= self.mininterval and cur_t >= self.start_t + self.delay: - cur_t = self._time() - dn = self.n - self.last_print_n # >= n - if self.smoothing and dt and dn: - # EMA (not just overall average) - self._ema_dn(dn) - self._ema_dt(dt) - self.refresh(lock_args=self.lock_args) - if self.dynamic_miniters: - # If no `miniters` was specified, adjust automatically to the - # maximum iteration rate seen so far between two prints. - # e.g.: After running `tqdm.update(5)`, subsequent - # calls to `tqdm.update()` will only cause an update after - # at least 5 more iterations. - if self.maxinterval and dt >= self.maxinterval: - self.miniters = dn * (self.mininterval or self.maxinterval) / dt - elif self.smoothing: - # EMA miniters update - self.miniters = self._ema_miniters( - dn * (self.mininterval / dt if self.mininterval and dt - else 1)) - else: - # max iters between two prints - self.miniters = max(self.miniters, dn) - - # Store old values for next call - self.last_print_n = self.n - self.last_print_t = cur_t - return True - - def close(self): - """Cleanup and (if leave=False) close the progressbar.""" - if self.disable: - return - - # Prevent multiple closures - self.disable = True - - # decrement instance pos and remove from internal set - pos = abs(self.pos) - self._decr_instances(self) - - if self.last_print_t < self.start_t + self.delay: - # haven't ever displayed; nothing to clear - return - - # GUI mode - if getattr(self, 'sp', None) is None: - return - - # annoyingly, _supports_unicode isn't good enough - def fp_write(s): - self.fp.write(str(s)) - - try: - fp_write('') - except ValueError as e: - if 'closed' in str(e): - return - raise # pragma: no cover - - leave = pos == 0 if self.leave is None else self.leave - - with self._lock: - if leave: - # stats for overall rate (no weighted average) - self._ema_dt = lambda: None - self.display(pos=0) - fp_write('\n') - else: - # clear previous display - if self.display(msg='', pos=pos) and not pos: - fp_write('\r') - - def clear(self, nolock=False): - """Clear current bar display.""" - if self.disable: - return - - if not nolock: - self._lock.acquire() - pos = abs(self.pos) - if pos < (self.nrows or 20): - self.moveto(pos) - self.sp('') - self.fp.write('\r') # place cursor back at the beginning of line - self.moveto(-pos) - if not nolock: - self._lock.release() - - def refresh(self, nolock=False, lock_args=None): - """ - Force refresh the display of this bar. - - Parameters - ---------- - nolock : bool, optional - If `True`, does not lock. - If [default: `False`]: calls `acquire()` on internal lock. - lock_args : tuple, optional - Passed to internal lock's `acquire()`. - If specified, will only `display()` if `acquire()` returns `True`. - """ - if self.disable: - return - - if not nolock: - if lock_args: - if not self._lock.acquire(*lock_args): - return False - else: - self._lock.acquire() - self.display() - if not nolock: - self._lock.release() - return True - - def unpause(self): - """Restart tqdm timer from last print time.""" - if self.disable: - return - cur_t = self._time() - self.start_t += cur_t - self.last_print_t - self.last_print_t = cur_t - - def reset(self, total=None): - """ - Resets to 0 iterations for repeated use. - - Consider combining with `leave=True`. - - Parameters - ---------- - total : int or float, optional. Total to use for the new bar. - """ - self.n = 0 - if total is not None: - self.total = total - if self.disable: - return - self.last_print_n = 0 - self.last_print_t = self.start_t = self._time() - self._ema_dn = EMA(self.smoothing) - self._ema_dt = EMA(self.smoothing) - self._ema_miniters = EMA(self.smoothing) - self.refresh() - - def set_description(self, desc=None, refresh=True): - """ - Set/modify description of the progress bar. - - Parameters - ---------- - desc : str, optional - refresh : bool, optional - Forces refresh [default: True]. - """ - self.desc = desc + ': ' if desc else '' - if refresh: - self.refresh() - - def set_description_str(self, desc=None, refresh=True): - """Set/modify description without ': ' appended.""" - self.desc = desc or '' - if refresh: - self.refresh() - - def set_postfix(self, ordered_dict=None, refresh=True, **kwargs): - """ - Set/modify postfix (additional stats) - with automatic formatting based on datatype. - - Parameters - ---------- - ordered_dict : dict or OrderedDict, optional - refresh : bool, optional - Forces refresh [default: True]. - kwargs : dict, optional - """ - # Sort in alphabetical order to be more deterministic - postfix = OrderedDict([] if ordered_dict is None else ordered_dict) - for key in sorted(kwargs.keys()): - postfix[key] = kwargs[key] - # Preprocess stats according to datatype - for key in postfix.keys(): - # Number: limit the length of the string - if isinstance(postfix[key], Number): - postfix[key] = self.format_num(postfix[key]) - # Else for any other type, try to get the string conversion - elif not isinstance(postfix[key], str): - postfix[key] = str(postfix[key]) - # Else if it's a string, don't need to preprocess anything - # Stitch together to get the final postfix - self.postfix = ', '.join(key + '=' + postfix[key].strip() - for key in postfix.keys()) - if refresh: - self.refresh() - - def set_postfix_str(self, s='', refresh=True): - """ - Postfix without dictionary expansion, similar to prefix handling. - """ - self.postfix = str(s) - if refresh: - self.refresh() - - def moveto(self, n): - # TODO: private method - self.fp.write('\n' * n + _term_move_up() * -n) - getattr(self.fp, 'flush', lambda: None)() - - @property - def format_dict(self): - """Public API for read-only member access.""" - if self.disable and not hasattr(self, 'unit'): - return defaultdict(lambda: None, { - 'n': self.n, 'total': self.total, 'elapsed': 0, 'unit': 'it'}) - if self.dynamic_ncols: - self.ncols, self.nrows = self.dynamic_ncols(self.fp) - return { - 'n': self.n, 'total': self.total, - 'elapsed': self._time() - self.start_t if hasattr(self, 'start_t') else 0, - 'ncols': self.ncols, 'nrows': self.nrows, 'prefix': self.desc, - 'ascii': self.ascii, 'unit': self.unit, 'unit_scale': self.unit_scale, - 'rate': self._ema_dn() / self._ema_dt() if self._ema_dt() else None, - 'bar_format': self.bar_format, 'postfix': self.postfix, - 'unit_divisor': self.unit_divisor, 'initial': self.initial, - 'colour': self.colour} - - def display(self, msg=None, pos=None): - """ - Use `self.sp` to display `msg` in the specified `pos`. - - Consider overloading this function when inheriting to use e.g.: - `self.some_frontend(**self.format_dict)` instead of `self.sp`. - - Parameters - ---------- - msg : str, optional. What to display (default: `repr(self)`). - pos : int, optional. Position to `moveto` - (default: `abs(self.pos)`). - """ - if pos is None: - pos = abs(self.pos) - - nrows = self.nrows or 20 - if pos >= nrows - 1: - if pos >= nrows: - return False - if msg or msg is None: # override at `nrows - 1` - msg = " ... (more hidden) ..." - - if not hasattr(self, "sp"): - raise TqdmDeprecationWarning( - "Please use `tqdm.gui.tqdm(...)`" - " instead of `tqdm(..., gui=True)`\n", - fp_write=getattr(self.fp, 'write', sys.stderr.write)) - - if pos: - self.moveto(pos) - self.sp(self.__str__() if msg is None else msg) - if pos: - self.moveto(-pos) - return True - - @classmethod - @contextmanager - def wrapattr(cls, stream, method, total=None, bytes=True, **tqdm_kwargs): - """ - stream : file-like object. - method : str, "read" or "write". The result of `read()` and - the first argument of `write()` should have a `len()`. - - >>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj: - ... while True: - ... chunk = fobj.read(chunk_size) - ... if not chunk: - ... break - """ - with cls(total=total, **tqdm_kwargs) as t: - if bytes: - t.unit = "B" - t.unit_scale = True - t.unit_divisor = 1024 - yield CallbackIOWrapper(t.update, stream, method) - - -def trange(*args, **kwargs): - """Shortcut for tqdm(range(*args), **kwargs).""" - return tqdm(range(*args), **kwargs) diff --git a/venv/lib/python3.8/site-packages/tqdm/tk.py b/venv/lib/python3.8/site-packages/tqdm/tk.py deleted file mode 100644 index dfebf5c741c936d992c4ac37300562966480c7dc..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/tk.py +++ /dev/null @@ -1,196 +0,0 @@ -""" -Tkinter GUI progressbar decorator for iterators. - -Usage: ->>> from tqdm.tk import trange, tqdm ->>> for i in trange(10): -... ... -""" -import re -import sys -import tkinter -import tkinter.ttk as ttk -from warnings import warn - -from .std import TqdmExperimentalWarning, TqdmWarning -from .std import tqdm as std_tqdm - -__author__ = {"github.com/": ["richardsheridan", "casperdcl"]} -__all__ = ['tqdm_tk', 'ttkrange', 'tqdm', 'trange'] - - -class tqdm_tk(std_tqdm): # pragma: no cover - """ - Experimental Tkinter GUI version of tqdm! - - Note: Window interactivity suffers if `tqdm_tk` is not running within - a Tkinter mainloop and values are generated infrequently. In this case, - consider calling `tqdm_tk.refresh()` frequently in the Tk thread. - """ - - # TODO: @classmethod: write()? - - def __init__(self, *args, **kwargs): - """ - This class accepts the following parameters *in addition* to - the parameters accepted by `tqdm`. - - Parameters - ---------- - grab : bool, optional - Grab the input across all windows of the process. - tk_parent : `tkinter.Wm`, optional - Parent Tk window. - cancel_callback : Callable, optional - Create a cancel button and set `cancel_callback` to be called - when the cancel or window close button is clicked. - """ - kwargs = kwargs.copy() - kwargs['gui'] = True - # convert disable = None to False - kwargs['disable'] = bool(kwargs.get('disable', False)) - self._warn_leave = 'leave' in kwargs - grab = kwargs.pop('grab', False) - tk_parent = kwargs.pop('tk_parent', None) - self._cancel_callback = kwargs.pop('cancel_callback', None) - super(tqdm_tk, self).__init__(*args, **kwargs) - - if self.disable: - return - - if tk_parent is None: # Discover parent widget - try: - tk_parent = tkinter._default_root - except AttributeError: - raise AttributeError( - "`tk_parent` required when using `tkinter.NoDefaultRoot()`") - if tk_parent is None: # use new default root window as display - self._tk_window = tkinter.Tk() - else: # some other windows already exist - self._tk_window = tkinter.Toplevel() - else: - self._tk_window = tkinter.Toplevel(tk_parent) - - warn("GUI is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) - self._tk_dispatching = self._tk_dispatching_helper() - - self._tk_window.protocol("WM_DELETE_WINDOW", self.cancel) - self._tk_window.wm_title(self.desc) - self._tk_window.wm_attributes("-topmost", 1) - self._tk_window.after(0, lambda: self._tk_window.wm_attributes("-topmost", 0)) - self._tk_n_var = tkinter.DoubleVar(self._tk_window, value=0) - self._tk_text_var = tkinter.StringVar(self._tk_window) - pbar_frame = ttk.Frame(self._tk_window, padding=5) - pbar_frame.pack() - _tk_label = ttk.Label(pbar_frame, textvariable=self._tk_text_var, - wraplength=600, anchor="center", justify="center") - _tk_label.pack() - self._tk_pbar = ttk.Progressbar( - pbar_frame, variable=self._tk_n_var, length=450) - if self.total is not None: - self._tk_pbar.configure(maximum=self.total) - else: - self._tk_pbar.configure(mode="indeterminate") - self._tk_pbar.pack() - if self._cancel_callback is not None: - _tk_button = ttk.Button(pbar_frame, text="Cancel", command=self.cancel) - _tk_button.pack() - if grab: - self._tk_window.grab_set() - - def close(self): - if self.disable: - return - - self.disable = True - - with self.get_lock(): - self._instances.remove(self) - - def _close(): - self._tk_window.after('idle', self._tk_window.destroy) - if not self._tk_dispatching: - self._tk_window.update() - - self._tk_window.protocol("WM_DELETE_WINDOW", _close) - - # if leave is set but we are self-dispatching, the left window is - # totally unresponsive unless the user manually dispatches - if not self.leave: - _close() - elif not self._tk_dispatching: - if self._warn_leave: - warn("leave flag ignored if not in tkinter mainloop", - TqdmWarning, stacklevel=2) - _close() - - def clear(self, *_, **__): - pass - - def display(self, *_, **__): - self._tk_n_var.set(self.n) - d = self.format_dict - # remove {bar} - d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( - "{bar}", "") - msg = self.format_meter(**d) - if '' in msg: - msg = "".join(re.split(r'\|?\|?', msg, maxsplit=1)) - self._tk_text_var.set(msg) - if not self._tk_dispatching: - self._tk_window.update() - - def set_description(self, desc=None, refresh=True): - self.set_description_str(desc, refresh) - - def set_description_str(self, desc=None, refresh=True): - self.desc = desc - if not self.disable: - self._tk_window.wm_title(desc) - if refresh and not self._tk_dispatching: - self._tk_window.update() - - def cancel(self): - """ - `cancel_callback()` followed by `close()` - when close/cancel buttons clicked. - """ - if self._cancel_callback is not None: - self._cancel_callback() - self.close() - - def reset(self, total=None): - """ - Resets to 0 iterations for repeated use. - - Parameters - ---------- - total : int or float, optional. Total to use for the new bar. - """ - if hasattr(self, '_tk_pbar'): - if total is None: - self._tk_pbar.configure(maximum=100, mode="indeterminate") - else: - self._tk_pbar.configure(maximum=total, mode="determinate") - super(tqdm_tk, self).reset(total=total) - - @staticmethod - def _tk_dispatching_helper(): - """determine if Tkinter mainloop is dispatching events""" - codes = {tkinter.mainloop.__code__, tkinter.Misc.mainloop.__code__} - for frame in sys._current_frames().values(): - while frame: - if frame.f_code in codes: - return True - frame = frame.f_back - return False - - -def ttkrange(*args, **kwargs): - """Shortcut for `tqdm.tk.tqdm(range(*args), **kwargs)`.""" - return tqdm_tk(range(*args), **kwargs) - - -# Aliases -tqdm = tqdm_tk -trange = ttkrange diff --git a/venv/lib/python3.8/site-packages/tqdm/tqdm.1 b/venv/lib/python3.8/site-packages/tqdm/tqdm.1 deleted file mode 100644 index b90ab4b9ebdd183c98ee8ae0c7f0a65ac676e3b7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/tqdm.1 +++ /dev/null @@ -1,314 +0,0 @@ -.\" Automatically generated by Pandoc 1.19.2 -.\" -.TH "TQDM" "1" "2015\-2021" "tqdm User Manuals" "" -.hy -.SH NAME -.PP -tqdm \- fast, extensible progress bar for Python and CLI -.SH SYNOPSIS -.PP -tqdm [\f[I]options\f[]] -.SH DESCRIPTION -.PP -See . -Can be used as a pipe: -.IP -.nf -\f[C] -$\ #\ count\ lines\ of\ code -$\ cat\ *.py\ |\ tqdm\ |\ wc\ \-l -327it\ [00:00,\ 981773.38it/s] -327 - -$\ #\ find\ all\ files -$\ find\ .\ \-name\ "*.py"\ |\ tqdm\ |\ wc\ \-l -432it\ [00:00,\ 833842.30it/s] -432 - -#\ ...\ and\ more\ info -$\ find\ .\ \-name\ \[aq]*.py\[aq]\ \-exec\ wc\ \-l\ \\{}\ \\;\ \\ -\ \ |\ tqdm\ \-\-total\ 432\ \-\-unit\ files\ \-\-desc\ counting\ \\ -\ \ |\ awk\ \[aq]{\ sum\ +=\ $1\ };\ END\ {\ print\ sum\ }\[aq] -counting:\ 100%|█████████|\ 432/432\ [00:00<00:00,\ 794361.83files/s] -131998 -\f[] -.fi -.SH OPTIONS -.TP -.B \-h, \-\-help -Print this help and exit. -.RS -.RE -.TP -.B \-v, \-\-version -Print version and exit. -.RS -.RE -.TP -.B \-\-desc=\f[I]desc\f[] -str, optional. -Prefix for the progressbar. -.RS -.RE -.TP -.B \-\-total=\f[I]total\f[] -int or float, optional. -The number of expected iterations. -If unspecified, len(iterable) is used if possible. -If float("inf") or as a last resort, only basic progress statistics are -displayed (no ETA, no progressbar). -If \f[C]gui\f[] is True and this parameter needs subsequent updating, -specify an initial arbitrary large positive number, e.g. -9e9. -.RS -.RE -.TP -.B \-\-leave -bool, optional. -If [default: True], keeps all traces of the progressbar upon termination -of iteration. -If \f[C]None\f[], will leave only if \f[C]position\f[] is \f[C]0\f[]. -.RS -.RE -.TP -.B \-\-ncols=\f[I]ncols\f[] -int, optional. -The width of the entire output message. -If specified, dynamically resizes the progressbar to stay within this -bound. -If unspecified, attempts to use environment width. -The fallback is a meter width of 10 and no limit for the counter and -statistics. -If 0, will not print any meter (only stats). -.RS -.RE -.TP -.B \-\-mininterval=\f[I]mininterval\f[] -float, optional. -Minimum progress display update interval [default: 0.1] seconds. -.RS -.RE -.TP -.B \-\-maxinterval=\f[I]maxinterval\f[] -float, optional. -Maximum progress display update interval [default: 10] seconds. -Automatically adjusts \f[C]miniters\f[] to correspond to -\f[C]mininterval\f[] after long display update lag. -Only works if \f[C]dynamic_miniters\f[] or monitor thread is enabled. -.RS -.RE -.TP -.B \-\-miniters=\f[I]miniters\f[] -int or float, optional. -Minimum progress display update interval, in iterations. -If 0 and \f[C]dynamic_miniters\f[], will automatically adjust to equal -\f[C]mininterval\f[] (more CPU efficient, good for tight loops). -If > 0, will skip display of specified number of iterations. -Tweak this and \f[C]mininterval\f[] to get very efficient loops. -If your progress is erratic with both fast and slow iterations (network, -skipping items, etc) you should set miniters=1. -.RS -.RE -.TP -.B \-\-ascii=\f[I]ascii\f[] -bool or str, optional. -If unspecified or False, use unicode (smooth blocks) to fill the meter. -The fallback is to use ASCII characters " 123456789#". -.RS -.RE -.TP -.B \-\-disable -bool, optional. -Whether to disable the entire progressbar wrapper [default: False]. -If set to None, disable on non\-TTY. -.RS -.RE -.TP -.B \-\-unit=\f[I]unit\f[] -str, optional. -String that will be used to define the unit of each iteration [default: -it]. -.RS -.RE -.TP -.B \-\-unit\-scale=\f[I]unit_scale\f[] -bool or int or float, optional. -If 1 or True, the number of iterations will be reduced/scaled -automatically and a metric prefix following the International System of -Units standard will be added (kilo, mega, etc.) [default: False]. -If any other non\-zero number, will scale \f[C]total\f[] and \f[C]n\f[]. -.RS -.RE -.TP -.B \-\-dynamic\-ncols -bool, optional. -If set, constantly alters \f[C]ncols\f[] and \f[C]nrows\f[] to the -environment (allowing for window resizes) [default: False]. -.RS -.RE -.TP -.B \-\-smoothing=\f[I]smoothing\f[] -float, optional. -Exponential moving average smoothing factor for speed estimates (ignored -in GUI mode). -Ranges from 0 (average speed) to 1 (current/instantaneous speed) -[default: 0.3]. -.RS -.RE -.TP -.B \-\-bar\-format=\f[I]bar_format\f[] -str, optional. -Specify a custom bar string formatting. -May impact performance. -[default: \[aq]{l_bar}{bar}{r_bar}\[aq]], where l_bar=\[aq]{desc}: -{percentage:3.0f}%|\[aq] and r_bar=\[aq]| {n_fmt}/{total_fmt} -[{elapsed}<{remaining}, \[aq] \[aq]{rate_fmt}{postfix}]\[aq] Possible -vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, percentage, -elapsed, elapsed_s, ncols, nrows, desc, unit, rate, rate_fmt, -rate_noinv, rate_noinv_fmt, rate_inv, rate_inv_fmt, postfix, -unit_divisor, remaining, remaining_s, eta. -Note that a trailing ": " is automatically removed after {desc} if the -latter is empty. -.RS -.RE -.TP -.B \-\-initial=\f[I]initial\f[] -int or float, optional. -The initial counter value. -Useful when restarting a progress bar [default: 0]. -If using float, consider specifying \f[C]{n:.3f}\f[] or similar in -\f[C]bar_format\f[], or specifying \f[C]unit_scale\f[]. -.RS -.RE -.TP -.B \-\-position=\f[I]position\f[] -int, optional. -Specify the line offset to print this bar (starting from 0) Automatic if -unspecified. -Useful to manage multiple bars at once (eg, from threads). -.RS -.RE -.TP -.B \-\-postfix=\f[I]postfix\f[] -dict or *, optional. -Specify additional stats to display at the end of the bar. -Calls \f[C]set_postfix(**postfix)\f[] if possible (dict). -.RS -.RE -.TP -.B \-\-unit\-divisor=\f[I]unit_divisor\f[] -float, optional. -[default: 1000], ignored unless \f[C]unit_scale\f[] is True. -.RS -.RE -.TP -.B \-\-write\-bytes -bool, optional. -Whether to write bytes. -If (default: False) will write unicode. -.RS -.RE -.TP -.B \-\-lock\-args=\f[I]lock_args\f[] -tuple, optional. -Passed to \f[C]refresh\f[] for intermediate output (initialisation, -iterating, and updating). -.RS -.RE -.TP -.B \-\-nrows=\f[I]nrows\f[] -int, optional. -The screen height. -If specified, hides nested bars outside this bound. -If unspecified, attempts to use environment height. -The fallback is 20. -.RS -.RE -.TP -.B \-\-colour=\f[I]colour\f[] -str, optional. -Bar colour (e.g. -\[aq]green\[aq], \[aq]#00ff00\[aq]). -.RS -.RE -.TP -.B \-\-delay=\f[I]delay\f[] -float, optional. -Don\[aq]t display until [default: 0] seconds have elapsed. -.RS -.RE -.TP -.B \-\-delim=\f[I]delim\f[] -chr, optional. -Delimiting character [default: \[aq]\\n\[aq]]. -Use \[aq]\\0\[aq] for null. -N.B.: on Windows systems, Python converts \[aq]\\n\[aq] to -\[aq]\\r\\n\[aq]. -.RS -.RE -.TP -.B \-\-buf\-size=\f[I]buf_size\f[] -int, optional. -String buffer size in bytes [default: 256] used when \f[C]delim\f[] is -specified. -.RS -.RE -.TP -.B \-\-bytes -bool, optional. -If true, will count bytes, ignore \f[C]delim\f[], and default -\f[C]unit_scale\f[] to True, \f[C]unit_divisor\f[] to 1024, and -\f[C]unit\f[] to \[aq]B\[aq]. -.RS -.RE -.TP -.B \-\-tee -bool, optional. -If true, passes \f[C]stdin\f[] to both \f[C]stderr\f[] and -\f[C]stdout\f[]. -.RS -.RE -.TP -.B \-\-update -bool, optional. -If true, will treat input as newly elapsed iterations, i.e. -numbers to pass to \f[C]update()\f[]. -Note that this is slow (~2e5 it/s) since every input must be decoded as -a number. -.RS -.RE -.TP -.B \-\-update\-to -bool, optional. -If true, will treat input as total elapsed iterations, i.e. -numbers to assign to \f[C]self.n\f[]. -Note that this is slow (~2e5 it/s) since every input must be decoded as -a number. -.RS -.RE -.TP -.B \-\-null -bool, optional. -If true, will discard input (no stdout). -.RS -.RE -.TP -.B \-\-manpath=\f[I]manpath\f[] -str, optional. -Directory in which to install tqdm man pages. -.RS -.RE -.TP -.B \-\-comppath=\f[I]comppath\f[] -str, optional. -Directory in which to place tqdm completion. -.RS -.RE -.TP -.B \-\-log=\f[I]log\f[] -str, optional. -CRITICAL|FATAL|ERROR|WARN(ING)|[default: \[aq]INFO\[aq]]|DEBUG|NOTSET. -.RS -.RE -.SH AUTHORS -tqdm developers . diff --git a/venv/lib/python3.8/site-packages/tqdm/utils.py b/venv/lib/python3.8/site-packages/tqdm/utils.py deleted file mode 100644 index 5a70819c308d33845b1a40846dcb34cdc540c3f8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/utils.py +++ /dev/null @@ -1,398 +0,0 @@ -""" -General helpers required for `tqdm.std`. -""" -import os -import re -import sys -from functools import partial, partialmethod, wraps -from inspect import signature -# TODO consider using wcswidth third-party package for 0-width characters -from unicodedata import east_asian_width -from warnings import warn -from weakref import proxy - -_range, _unich, _unicode, _basestring = range, chr, str, str -CUR_OS = sys.platform -IS_WIN = any(CUR_OS.startswith(i) for i in ['win32', 'cygwin']) -IS_NIX = any(CUR_OS.startswith(i) for i in ['aix', 'linux', 'darwin']) -RE_ANSI = re.compile(r"\x1b\[[;\d]*[A-Za-z]") - -try: - if IS_WIN: - import colorama - else: - raise ImportError -except ImportError: - colorama = None -else: - try: - colorama.init(strip=False) - except TypeError: - colorama.init() - - -def envwrap(prefix, types=None, is_method=False): - """ - Override parameter defaults via `os.environ[prefix + param_name]`. - Maps UPPER_CASE env vars map to lower_case param names. - camelCase isn't supported (because Windows ignores case). - - Precedence (highest first): - - call (`foo(a=3)`) - - environ (`FOO_A=2`) - - signature (`def foo(a=1)`) - - Parameters - ---------- - prefix : str - Env var prefix, e.g. "FOO_" - types : dict, optional - Fallback mappings `{'param_name': type, ...}` if types cannot be - inferred from function signature. - Consider using `types=collections.defaultdict(lambda: ast.literal_eval)`. - is_method : bool, optional - Whether to use `functools.partialmethod`. If (default: False) use `functools.partial`. - - Examples - -------- - ``` - $ cat foo.py - from tqdm.utils import envwrap - @envwrap("FOO_") - def test(a=1, b=2, c=3): - print(f"received: a={a}, b={b}, c={c}") - - $ FOO_A=42 FOO_C=1337 python -c 'import foo; foo.test(c=99)' - received: a=42, b=2, c=99 - ``` - """ - if types is None: - types = {} - i = len(prefix) - env_overrides = {k[i:].lower(): v for k, v in os.environ.items() if k.startswith(prefix)} - part = partialmethod if is_method else partial - - def wrap(func): - params = signature(func).parameters - # ignore unknown env vars - overrides = {k: v for k, v in env_overrides.items() if k in params} - # infer overrides' `type`s - for k in overrides: - param = params[k] - if param.annotation is not param.empty: # typehints - for typ in getattr(param.annotation, '__args__', (param.annotation,)): - try: - overrides[k] = typ(overrides[k]) - except Exception: - pass - else: - break - elif param.default is not None: # type of default value - overrides[k] = type(param.default)(overrides[k]) - else: - try: # `types` fallback - overrides[k] = types[k](overrides[k]) - except KeyError: # keep unconverted (`str`) - pass - return part(func, **overrides) - return wrap - - -class FormatReplace(object): - """ - >>> a = FormatReplace('something') - >>> "{:5d}".format(a) - 'something' - """ # NOQA: P102 - def __init__(self, replace=''): - self.replace = replace - self.format_called = 0 - - def __format__(self, _): - self.format_called += 1 - return self.replace - - -class Comparable(object): - """Assumes child has self._comparable attr/@property""" - def __lt__(self, other): - return self._comparable < other._comparable - - def __le__(self, other): - return (self < other) or (self == other) - - def __eq__(self, other): - return self._comparable == other._comparable - - def __ne__(self, other): - return not self == other - - def __gt__(self, other): - return not self <= other - - def __ge__(self, other): - return not self < other - - -class ObjectWrapper(object): - def __getattr__(self, name): - return getattr(self._wrapped, name) - - def __setattr__(self, name, value): - return setattr(self._wrapped, name, value) - - def wrapper_getattr(self, name): - """Actual `self.getattr` rather than self._wrapped.getattr""" - try: - return object.__getattr__(self, name) - except AttributeError: # py2 - return getattr(self, name) - - def wrapper_setattr(self, name, value): - """Actual `self.setattr` rather than self._wrapped.setattr""" - return object.__setattr__(self, name, value) - - def __init__(self, wrapped): - """ - Thin wrapper around a given object - """ - self.wrapper_setattr('_wrapped', wrapped) - - -class SimpleTextIOWrapper(ObjectWrapper): - """ - Change only `.write()` of the wrapped object by encoding the passed - value and passing the result to the wrapped object's `.write()` method. - """ - # pylint: disable=too-few-public-methods - def __init__(self, wrapped, encoding): - super(SimpleTextIOWrapper, self).__init__(wrapped) - self.wrapper_setattr('encoding', encoding) - - def write(self, s): - """ - Encode `s` and pass to the wrapped object's `.write()` method. - """ - return self._wrapped.write(s.encode(self.wrapper_getattr('encoding'))) - - def __eq__(self, other): - return self._wrapped == getattr(other, '_wrapped', other) - - -class DisableOnWriteError(ObjectWrapper): - """ - Disable the given `tqdm_instance` upon `write()` or `flush()` errors. - """ - @staticmethod - def disable_on_exception(tqdm_instance, func): - """ - Quietly set `tqdm_instance.miniters=inf` if `func` raises `errno=5`. - """ - tqdm_instance = proxy(tqdm_instance) - - def inner(*args, **kwargs): - try: - return func(*args, **kwargs) - except OSError as e: - if e.errno != 5: - raise - try: - tqdm_instance.miniters = float('inf') - except ReferenceError: - pass - except ValueError as e: - if 'closed' not in str(e): - raise - try: - tqdm_instance.miniters = float('inf') - except ReferenceError: - pass - return inner - - def __init__(self, wrapped, tqdm_instance): - super(DisableOnWriteError, self).__init__(wrapped) - if hasattr(wrapped, 'write'): - self.wrapper_setattr( - 'write', self.disable_on_exception(tqdm_instance, wrapped.write)) - if hasattr(wrapped, 'flush'): - self.wrapper_setattr( - 'flush', self.disable_on_exception(tqdm_instance, wrapped.flush)) - - def __eq__(self, other): - return self._wrapped == getattr(other, '_wrapped', other) - - -class CallbackIOWrapper(ObjectWrapper): - def __init__(self, callback, stream, method="read"): - """ - Wrap a given `file`-like object's `read()` or `write()` to report - lengths to the given `callback` - """ - super(CallbackIOWrapper, self).__init__(stream) - func = getattr(stream, method) - if method == "write": - @wraps(func) - def write(data, *args, **kwargs): - res = func(data, *args, **kwargs) - callback(len(data)) - return res - self.wrapper_setattr('write', write) - elif method == "read": - @wraps(func) - def read(*args, **kwargs): - data = func(*args, **kwargs) - callback(len(data)) - return data - self.wrapper_setattr('read', read) - else: - raise KeyError("Can only wrap read/write methods") - - -def _is_utf(encoding): - try: - u'\u2588\u2589'.encode(encoding) - except UnicodeEncodeError: - return False - except Exception: - try: - return encoding.lower().startswith('utf-') or ('U8' == encoding) - except Exception: - return False - else: - return True - - -def _supports_unicode(fp): - try: - return _is_utf(fp.encoding) - except AttributeError: - return False - - -def _is_ascii(s): - if isinstance(s, str): - for c in s: - if ord(c) > 255: - return False - return True - return _supports_unicode(s) - - -def _screen_shape_wrapper(): # pragma: no cover - """ - Return a function which returns console dimensions (width, height). - Supported: linux, osx, windows, cygwin. - """ - _screen_shape = None - if IS_WIN: - _screen_shape = _screen_shape_windows - if _screen_shape is None: - _screen_shape = _screen_shape_tput - if IS_NIX: - _screen_shape = _screen_shape_linux - return _screen_shape - - -def _screen_shape_windows(fp): # pragma: no cover - try: - import struct - from ctypes import create_string_buffer, windll - from sys import stdin, stdout - - io_handle = -12 # assume stderr - if fp == stdin: - io_handle = -10 - elif fp == stdout: - io_handle = -11 - - h = windll.kernel32.GetStdHandle(io_handle) - csbi = create_string_buffer(22) - res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi) - if res: - (_bufx, _bufy, _curx, _cury, _wattr, left, top, right, bottom, - _maxx, _maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) - return right - left, bottom - top # +1 - except Exception: # nosec - pass - return None, None - - -def _screen_shape_tput(*_): # pragma: no cover - """cygwin xterm (windows)""" - try: - import shlex - from subprocess import check_call # nosec - return [int(check_call(shlex.split('tput ' + i))) - 1 - for i in ('cols', 'lines')] - except Exception: # nosec - pass - return None, None - - -def _screen_shape_linux(fp): # pragma: no cover - - try: - from array import array - from fcntl import ioctl - from termios import TIOCGWINSZ - except ImportError: - return None, None - else: - try: - rows, cols = array('h', ioctl(fp, TIOCGWINSZ, '\0' * 8))[:2] - return cols, rows - except Exception: - try: - return [int(os.environ[i]) - 1 for i in ("COLUMNS", "LINES")] - except (KeyError, ValueError): - return None, None - - -def _environ_cols_wrapper(): # pragma: no cover - """ - Return a function which returns console width. - Supported: linux, osx, windows, cygwin. - """ - warn("Use `_screen_shape_wrapper()(file)[0]` instead of" - " `_environ_cols_wrapper()(file)`", DeprecationWarning, stacklevel=2) - shape = _screen_shape_wrapper() - if not shape: - return None - - @wraps(shape) - def inner(fp): - return shape(fp)[0] - - return inner - - -def _term_move_up(): # pragma: no cover - return '' if (os.name == 'nt') and (colorama is None) else '\x1b[A' - - -def _text_width(s): - return sum(2 if east_asian_width(ch) in 'FW' else 1 for ch in str(s)) - - -def disp_len(data): - """ - Returns the real on-screen length of a string which may contain - ANSI control codes and wide chars. - """ - return _text_width(RE_ANSI.sub('', data)) - - -def disp_trim(data, length): - """ - Trim a string which may contain ANSI control characters. - """ - if len(data) == disp_len(data): - return data[:length] - - ansi_present = bool(RE_ANSI.search(data)) - while disp_len(data) > length: # carefully delete one char at a time - data = data[:-1] - if ansi_present and bool(RE_ANSI.search(data)): - # assume ANSI reset is required - return data if data.endswith("\033[0m") else data + "\033[0m" - return data diff --git a/venv/lib/python3.8/site-packages/tqdm/version.py b/venv/lib/python3.8/site-packages/tqdm/version.py deleted file mode 100644 index 11cbaea79d1f4f46f9ae4bea542d7c66ded96e34..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/tqdm/version.py +++ /dev/null @@ -1,9 +0,0 @@ -"""`tqdm` version detector. Precedence: installed dist, git, 'UNKNOWN'.""" -try: - from ._dist_ver import __version__ -except ImportError: - try: - from setuptools_scm import get_version - __version__ = get_version(root='..', relative_to=__file__) - except (ImportError, LookupError): - __version__ = "UNKNOWN" diff --git a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/LICENSE b/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/LICENSE deleted file mode 100644 index f26bcf4d2de6eb136e31006ca3ab447d5e488adf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/LICENSE +++ /dev/null @@ -1,279 +0,0 @@ -A. HISTORY OF THE SOFTWARE -========================== - -Python was created in the early 1990s by Guido van Rossum at Stichting -Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands -as a successor of a language called ABC. Guido remains Python's -principal author, although it includes many contributions from others. - -In 1995, Guido continued his work on Python at the Corporation for -National Research Initiatives (CNRI, see https://www.cnri.reston.va.us) -in Reston, Virginia where he released several versions of the -software. - -In May 2000, Guido and the Python core development team moved to -BeOpen.com to form the BeOpen PythonLabs team. In October of the same -year, the PythonLabs team moved to Digital Creations, which became -Zope Corporation. In 2001, the Python Software Foundation (PSF, see -https://www.python.org/psf/) was formed, a non-profit organization -created specifically to own Python-related Intellectual Property. -Zope Corporation was a sponsoring member of the PSF. - -All Python releases are Open Source (see https://opensource.org for -the Open Source Definition). Historically, most, but not all, Python -releases have also been GPL-compatible; the table below summarizes -the various releases. - - Release Derived Year Owner GPL- - from compatible? (1) - - 0.9.0 thru 1.2 1991-1995 CWI yes - 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes - 1.6 1.5.2 2000 CNRI no - 2.0 1.6 2000 BeOpen.com no - 1.6.1 1.6 2001 CNRI yes (2) - 2.1 2.0+1.6.1 2001 PSF no - 2.0.1 2.0+1.6.1 2001 PSF yes - 2.1.1 2.1+2.0.1 2001 PSF yes - 2.1.2 2.1.1 2002 PSF yes - 2.1.3 2.1.2 2002 PSF yes - 2.2 and above 2.1.1 2001-now PSF yes - -Footnotes: - -(1) GPL-compatible doesn't mean that we're distributing Python under - the GPL. All Python licenses, unlike the GPL, let you distribute - a modified version without making your changes open source. The - GPL-compatible licenses make it possible to combine Python with - other software that is released under the GPL; the others don't. - -(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, - because its license has a choice of law clause. According to - CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 - is "not incompatible" with the GPL. - -Thanks to the many outside volunteers who have worked under Guido's -direction to make these releases possible. - - -B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON -=============================================================== - -Python software and documentation are licensed under the -Python Software Foundation License Version 2. - -Starting with Python 3.8.6, examples, recipes, and other code in -the documentation are dual licensed under the PSF License Version 2 -and the Zero-Clause BSD license. - -Some software incorporated into Python is under different licenses. -The licenses are listed with code falling under that license. - - -PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 --------------------------------------------- - -1. This LICENSE AGREEMENT is between the Python Software Foundation -("PSF"), and the Individual or Organization ("Licensee") accessing and -otherwise using this software ("Python") in source or binary form and -its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, PSF hereby -grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, -analyze, test, perform and/or display publicly, prepare derivative works, -distribute, and otherwise use Python alone or in any derivative version, -provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation; -All Rights Reserved" are retained in Python alone or in any derivative version -prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python. - -4. PSF is making Python available to Licensee on an "AS IS" -basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between PSF and -Licensee. This License Agreement does not grant permission to use PSF -trademarks or trade name in a trademark sense to endorse or promote -products or services of Licensee, or any third party. - -8. By copying, installing or otherwise using Python, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 -------------------------------------------- - -BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 - -1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an -office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the -Individual or Organization ("Licensee") accessing and otherwise using -this software in source or binary form and its associated -documentation ("the Software"). - -2. Subject to the terms and conditions of this BeOpen Python License -Agreement, BeOpen hereby grants Licensee a non-exclusive, -royalty-free, world-wide license to reproduce, analyze, test, perform -and/or display publicly, prepare derivative works, distribute, and -otherwise use the Software alone or in any derivative version, -provided, however, that the BeOpen Python License is retained in the -Software, alone or in any derivative version prepared by Licensee. - -3. BeOpen is making the Software available to Licensee on an "AS IS" -basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE -SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS -AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -5. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -6. This License Agreement shall be governed by and interpreted in all -respects by the law of the State of California, excluding conflict of -law provisions. Nothing in this License Agreement shall be deemed to -create any relationship of agency, partnership, or joint venture -between BeOpen and Licensee. This License Agreement does not grant -permission to use BeOpen trademarks or trade names in a trademark -sense to endorse or promote products or services of Licensee, or any -third party. As an exception, the "BeOpen Python" logos available at -http://www.pythonlabs.com/logos.html may be used according to the -permissions granted on that web page. - -7. By copying, installing or otherwise using the software, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 ---------------------------------------- - -1. This LICENSE AGREEMENT is between the Corporation for National -Research Initiatives, having an office at 1895 Preston White Drive, -Reston, VA 20191 ("CNRI"), and the Individual or Organization -("Licensee") accessing and otherwise using Python 1.6.1 software in -source or binary form and its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, CNRI -hereby grants Licensee a nonexclusive, royalty-free, world-wide -license to reproduce, analyze, test, perform and/or display publicly, -prepare derivative works, distribute, and otherwise use Python 1.6.1 -alone or in any derivative version, provided, however, that CNRI's -License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) -1995-2001 Corporation for National Research Initiatives; All Rights -Reserved" are retained in Python 1.6.1 alone or in any derivative -version prepared by Licensee. Alternately, in lieu of CNRI's License -Agreement, Licensee may substitute the following text (omitting the -quotes): "Python 1.6.1 is made available subject to the terms and -conditions in CNRI's License Agreement. This Agreement together with -Python 1.6.1 may be located on the internet using the following -unique, persistent identifier (known as a handle): 1895.22/1013. This -Agreement may also be obtained from a proxy server on the internet -using the following URL: http://hdl.handle.net/1895.22/1013". - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python 1.6.1 or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python 1.6.1. - -4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" -basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. This License Agreement shall be governed by the federal -intellectual property law of the United States, including without -limitation the federal copyright law, and, to the extent such -U.S. federal law does not apply, by the law of the Commonwealth of -Virginia, excluding Virginia's conflict of law provisions. -Notwithstanding the foregoing, with regard to derivative works based -on Python 1.6.1 that incorporate non-separable material that was -previously distributed under the GNU General Public License (GPL), the -law of the Commonwealth of Virginia shall govern this License -Agreement only as to issues arising under or with respect to -Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this -License Agreement shall be deemed to create any relationship of -agency, partnership, or joint venture between CNRI and Licensee. This -License Agreement does not grant permission to use CNRI trademarks or -trade name in a trademark sense to endorse or promote products or -services of Licensee, or any third party. - -8. By clicking on the "ACCEPT" button where indicated, or by copying, -installing or otherwise using Python 1.6.1, Licensee agrees to be -bound by the terms and conditions of this License Agreement. - - ACCEPT - - -CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 --------------------------------------------------- - -Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, -The Netherlands. All rights reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Stichting Mathematisch -Centrum or CWI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE -FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION ----------------------------------------------------------------------- - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. diff --git a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/METADATA b/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/METADATA deleted file mode 100644 index dc7c951a0f374682c46888f075b4f1dba572ee00..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/METADATA +++ /dev/null @@ -1,66 +0,0 @@ -Metadata-Version: 2.1 -Name: typing_extensions -Version: 4.8.0 -Summary: Backported and Experimental Type Hints for Python 3.8+ -Keywords: annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing -Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" -Requires-Python: >=3.8 -Description-Content-Type: text/markdown -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Console -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Python Software Foundation License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Topic :: Software Development -Project-URL: Bug Tracker, https://github.com/python/typing_extensions/issues -Project-URL: Changes, https://github.com/python/typing_extensions/blob/main/CHANGELOG.md -Project-URL: Documentation, https://typing-extensions.readthedocs.io/ -Project-URL: Home, https://github.com/python/typing_extensions -Project-URL: Q & A, https://github.com/python/typing/discussions -Project-URL: Repository, https://github.com/python/typing_extensions - -# Typing Extensions - -[![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing) - -[Documentation](https://typing-extensions.readthedocs.io/en/latest/#) – -[PyPI](https://pypi.org/project/typing-extensions/) - -## Overview - -The `typing_extensions` module serves two related purposes: - -- Enable use of new type system features on older Python versions. For example, - `typing.TypeGuard` is new in Python 3.10, but `typing_extensions` allows - users on previous Python versions to use it too. -- Enable experimentation with new type system PEPs before they are accepted and - added to the `typing` module. - -`typing_extensions` is treated specially by static type checkers such as -mypy and pyright. Objects defined in `typing_extensions` are treated the same -way as equivalent forms in `typing`. - -`typing_extensions` uses -[Semantic Versioning](https://semver.org/). The -major version will be incremented only for backwards-incompatible changes. -Therefore, it's safe to depend -on `typing_extensions` like this: `typing_extensions >=x.y, <(x+1)`, -where `x.y` is the first version that includes all features you need. - -## Included items - -See [the documentation](https://typing-extensions.readthedocs.io/en/latest/#) for a -complete listing of module contents. - -## Contributing - -See [CONTRIBUTING.md](https://github.com/python/typing_extensions/blob/main/CONTRIBUTING.md) -for how to contribute to `typing_extensions`. - diff --git a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/RECORD b/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/RECORD deleted file mode 100644 index 711620d23617a7bbb104fc773c8e628c9ac1076f..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/RECORD +++ /dev/null @@ -1,7 +0,0 @@ -__pycache__/typing_extensions.cpython-38.pyc,, -typing_extensions-4.8.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -typing_extensions-4.8.0.dist-info/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936 -typing_extensions-4.8.0.dist-info/METADATA,sha256=FwHgtsuPpRLjEsgt7mXT_fzt0jErWt5vEa2ia2kRMaY,2966 -typing_extensions-4.8.0.dist-info/RECORD,, -typing_extensions-4.8.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81 -typing_extensions.py,sha256=ktWhnF_DOJuyvxy6jW0ndns3KA4byTEB9DzTtEMl26M,103397 diff --git a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/WHEEL b/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/WHEEL deleted file mode 100644 index 3b5e64b5e6c4a210201d1676a891fd57b15cda99..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/typing_extensions-4.8.0.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.9.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/venv/lib/python3.8/site-packages/typing_extensions.py b/venv/lib/python3.8/site-packages/typing_extensions.py deleted file mode 100644 index c96bf90feca76bd5278be03a2392ab050e8b8634..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/typing_extensions.py +++ /dev/null @@ -1,2892 +0,0 @@ -import abc -import collections -import collections.abc -import functools -import inspect -import operator -import sys -import types as _types -import typing -import warnings - -__all__ = [ - # Super-special typing primitives. - 'Any', - 'ClassVar', - 'Concatenate', - 'Final', - 'LiteralString', - 'ParamSpec', - 'ParamSpecArgs', - 'ParamSpecKwargs', - 'Self', - 'Type', - 'TypeVar', - 'TypeVarTuple', - 'Unpack', - - # ABCs (from collections.abc). - 'Awaitable', - 'AsyncIterator', - 'AsyncIterable', - 'Coroutine', - 'AsyncGenerator', - 'AsyncContextManager', - 'Buffer', - 'ChainMap', - - # Concrete collection types. - 'ContextManager', - 'Counter', - 'Deque', - 'DefaultDict', - 'NamedTuple', - 'OrderedDict', - 'TypedDict', - - # Structural checks, a.k.a. protocols. - 'SupportsAbs', - 'SupportsBytes', - 'SupportsComplex', - 'SupportsFloat', - 'SupportsIndex', - 'SupportsInt', - 'SupportsRound', - - # One-off things. - 'Annotated', - 'assert_never', - 'assert_type', - 'clear_overloads', - 'dataclass_transform', - 'deprecated', - 'Doc', - 'get_overloads', - 'final', - 'get_args', - 'get_origin', - 'get_original_bases', - 'get_protocol_members', - 'get_type_hints', - 'IntVar', - 'is_protocol', - 'is_typeddict', - 'Literal', - 'NewType', - 'overload', - 'override', - 'Protocol', - 'reveal_type', - 'runtime', - 'runtime_checkable', - 'Text', - 'TypeAlias', - 'TypeAliasType', - 'TypeGuard', - 'TYPE_CHECKING', - 'Never', - 'NoReturn', - 'Required', - 'NotRequired', - - # Pure aliases, have always been in typing - 'AbstractSet', - 'AnyStr', - 'BinaryIO', - 'Callable', - 'Collection', - 'Container', - 'Dict', - 'ForwardRef', - 'FrozenSet', - 'Generator', - 'Generic', - 'Hashable', - 'IO', - 'ItemsView', - 'Iterable', - 'Iterator', - 'KeysView', - 'List', - 'Mapping', - 'MappingView', - 'Match', - 'MutableMapping', - 'MutableSequence', - 'MutableSet', - 'Optional', - 'Pattern', - 'Reversible', - 'Sequence', - 'Set', - 'Sized', - 'TextIO', - 'Tuple', - 'Union', - 'ValuesView', - 'cast', - 'no_type_check', - 'no_type_check_decorator', -] - -# for backward compatibility -PEP_560 = True -GenericMeta = type - -# The functions below are modified copies of typing internal helpers. -# They are needed by _ProtocolMeta and they provide support for PEP 646. - - -class _Sentinel: - def __repr__(self): - return "" - - -_marker = _Sentinel() - - -def _check_generic(cls, parameters, elen=_marker): - """Check correct count for parameters of a generic cls (internal helper). - This gives a nice error message in case of count mismatch. - """ - if not elen: - raise TypeError(f"{cls} is not a generic class") - if elen is _marker: - if not hasattr(cls, "__parameters__") or not cls.__parameters__: - raise TypeError(f"{cls} is not a generic class") - elen = len(cls.__parameters__) - alen = len(parameters) - if alen != elen: - if hasattr(cls, "__parameters__"): - parameters = [p for p in cls.__parameters__ if not _is_unpack(p)] - num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in parameters) - if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples): - return - raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters for {cls};" - f" actual {alen}, expected {elen}") - - -if sys.version_info >= (3, 10): - def _should_collect_from_parameters(t): - return isinstance( - t, (typing._GenericAlias, _types.GenericAlias, _types.UnionType) - ) -elif sys.version_info >= (3, 9): - def _should_collect_from_parameters(t): - return isinstance(t, (typing._GenericAlias, _types.GenericAlias)) -else: - def _should_collect_from_parameters(t): - return isinstance(t, typing._GenericAlias) and not t._special - - -def _collect_type_vars(types, typevar_types=None): - """Collect all type variable contained in types in order of - first appearance (lexicographic order). For example:: - - _collect_type_vars((T, List[S, T])) == (T, S) - """ - if typevar_types is None: - typevar_types = typing.TypeVar - tvars = [] - for t in types: - if ( - isinstance(t, typevar_types) and - t not in tvars and - not _is_unpack(t) - ): - tvars.append(t) - if _should_collect_from_parameters(t): - tvars.extend([t for t in t.__parameters__ if t not in tvars]) - return tuple(tvars) - - -NoReturn = typing.NoReturn - -# Some unconstrained type variables. These are used by the container types. -# (These are not for export.) -T = typing.TypeVar('T') # Any type. -KT = typing.TypeVar('KT') # Key type. -VT = typing.TypeVar('VT') # Value type. -T_co = typing.TypeVar('T_co', covariant=True) # Any type covariant containers. -T_contra = typing.TypeVar('T_contra', contravariant=True) # Ditto contravariant. - - -if sys.version_info >= (3, 11): - from typing import Any -else: - - class _AnyMeta(type): - def __instancecheck__(self, obj): - if self is Any: - raise TypeError("typing_extensions.Any cannot be used with isinstance()") - return super().__instancecheck__(obj) - - def __repr__(self): - if self is Any: - return "typing_extensions.Any" - return super().__repr__() - - class Any(metaclass=_AnyMeta): - """Special type indicating an unconstrained type. - - Any is compatible with every type. - - Any assumed to have all methods. - - All values assumed to be instances of Any. - Note that all the above statements are true from the point of view of - static type checkers. At runtime, Any should not be used with instance - checks. - """ - def __new__(cls, *args, **kwargs): - if cls is Any: - raise TypeError("Any cannot be instantiated") - return super().__new__(cls, *args, **kwargs) - - -ClassVar = typing.ClassVar - - -class _ExtensionsSpecialForm(typing._SpecialForm, _root=True): - def __repr__(self): - return 'typing_extensions.' + self._name - - -Final = typing.Final - -if sys.version_info >= (3, 11): - final = typing.final -else: - # @final exists in 3.8+, but we backport it for all versions - # before 3.11 to keep support for the __final__ attribute. - # See https://bugs.python.org/issue46342 - def final(f): - """This decorator can be used to indicate to type checkers that - the decorated method cannot be overridden, and decorated class - cannot be subclassed. For example: - - class Base: - @final - def done(self) -> None: - ... - class Sub(Base): - def done(self) -> None: # Error reported by type checker - ... - @final - class Leaf: - ... - class Other(Leaf): # Error reported by type checker - ... - - There is no runtime checking of these properties. The decorator - sets the ``__final__`` attribute to ``True`` on the decorated object - to allow runtime introspection. - """ - try: - f.__final__ = True - except (AttributeError, TypeError): - # Skip the attribute silently if it is not writable. - # AttributeError happens if the object has __slots__ or a - # read-only property, TypeError if it's a builtin class. - pass - return f - - -def IntVar(name): - return typing.TypeVar(name) - - -# A Literal bug was fixed in 3.11.0, 3.10.1 and 3.9.8 -if sys.version_info >= (3, 10, 1): - Literal = typing.Literal -else: - def _flatten_literal_params(parameters): - """An internal helper for Literal creation: flatten Literals among parameters""" - params = [] - for p in parameters: - if isinstance(p, _LiteralGenericAlias): - params.extend(p.__args__) - else: - params.append(p) - return tuple(params) - - def _value_and_type_iter(params): - for p in params: - yield p, type(p) - - class _LiteralGenericAlias(typing._GenericAlias, _root=True): - def __eq__(self, other): - if not isinstance(other, _LiteralGenericAlias): - return NotImplemented - these_args_deduped = set(_value_and_type_iter(self.__args__)) - other_args_deduped = set(_value_and_type_iter(other.__args__)) - return these_args_deduped == other_args_deduped - - def __hash__(self): - return hash(frozenset(_value_and_type_iter(self.__args__))) - - class _LiteralForm(_ExtensionsSpecialForm, _root=True): - def __init__(self, doc: str): - self._name = 'Literal' - self._doc = self.__doc__ = doc - - def __getitem__(self, parameters): - if not isinstance(parameters, tuple): - parameters = (parameters,) - - parameters = _flatten_literal_params(parameters) - - val_type_pairs = list(_value_and_type_iter(parameters)) - try: - deduped_pairs = set(val_type_pairs) - except TypeError: - # unhashable parameters - pass - else: - # similar logic to typing._deduplicate on Python 3.9+ - if len(deduped_pairs) < len(val_type_pairs): - new_parameters = [] - for pair in val_type_pairs: - if pair in deduped_pairs: - new_parameters.append(pair[0]) - deduped_pairs.remove(pair) - assert not deduped_pairs, deduped_pairs - parameters = tuple(new_parameters) - - return _LiteralGenericAlias(self, parameters) - - Literal = _LiteralForm(doc="""\ - A type that can be used to indicate to type checkers - that the corresponding value has a value literally equivalent - to the provided parameter. For example: - - var: Literal[4] = 4 - - The type checker understands that 'var' is literally equal to - the value 4 and no other value. - - Literal[...] cannot be subclassed. There is no runtime - checking verifying that the parameter is actually a value - instead of a type.""") - - -_overload_dummy = typing._overload_dummy - - -if hasattr(typing, "get_overloads"): # 3.11+ - overload = typing.overload - get_overloads = typing.get_overloads - clear_overloads = typing.clear_overloads -else: - # {module: {qualname: {firstlineno: func}}} - _overload_registry = collections.defaultdict( - functools.partial(collections.defaultdict, dict) - ) - - def overload(func): - """Decorator for overloaded functions/methods. - - In a stub file, place two or more stub definitions for the same - function in a row, each decorated with @overload. For example: - - @overload - def utf8(value: None) -> None: ... - @overload - def utf8(value: bytes) -> bytes: ... - @overload - def utf8(value: str) -> bytes: ... - - In a non-stub file (i.e. a regular .py file), do the same but - follow it with an implementation. The implementation should *not* - be decorated with @overload. For example: - - @overload - def utf8(value: None) -> None: ... - @overload - def utf8(value: bytes) -> bytes: ... - @overload - def utf8(value: str) -> bytes: ... - def utf8(value): - # implementation goes here - - The overloads for a function can be retrieved at runtime using the - get_overloads() function. - """ - # classmethod and staticmethod - f = getattr(func, "__func__", func) - try: - _overload_registry[f.__module__][f.__qualname__][ - f.__code__.co_firstlineno - ] = func - except AttributeError: - # Not a normal function; ignore. - pass - return _overload_dummy - - def get_overloads(func): - """Return all defined overloads for *func* as a sequence.""" - # classmethod and staticmethod - f = getattr(func, "__func__", func) - if f.__module__ not in _overload_registry: - return [] - mod_dict = _overload_registry[f.__module__] - if f.__qualname__ not in mod_dict: - return [] - return list(mod_dict[f.__qualname__].values()) - - def clear_overloads(): - """Clear all overloads in the registry.""" - _overload_registry.clear() - - -# This is not a real generic class. Don't use outside annotations. -Type = typing.Type - -# Various ABCs mimicking those in collections.abc. -# A few are simply re-exported for completeness. -Awaitable = typing.Awaitable -Coroutine = typing.Coroutine -AsyncIterable = typing.AsyncIterable -AsyncIterator = typing.AsyncIterator -Deque = typing.Deque -ContextManager = typing.ContextManager -AsyncContextManager = typing.AsyncContextManager -DefaultDict = typing.DefaultDict -OrderedDict = typing.OrderedDict -Counter = typing.Counter -ChainMap = typing.ChainMap -AsyncGenerator = typing.AsyncGenerator -Text = typing.Text -TYPE_CHECKING = typing.TYPE_CHECKING - - -_PROTO_ALLOWLIST = { - 'collections.abc': [ - 'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable', - 'Hashable', 'Sized', 'Container', 'Collection', 'Reversible', 'Buffer', - ], - 'contextlib': ['AbstractContextManager', 'AbstractAsyncContextManager'], - 'typing_extensions': ['Buffer'], -} - - -_EXCLUDED_ATTRS = { - "__abstractmethods__", "__annotations__", "__weakref__", "_is_protocol", - "_is_runtime_protocol", "__dict__", "__slots__", "__parameters__", - "__orig_bases__", "__module__", "_MutableMapping__marker", "__doc__", - "__subclasshook__", "__orig_class__", "__init__", "__new__", - "__protocol_attrs__", "__callable_proto_members_only__", -} - -if sys.version_info >= (3, 9): - _EXCLUDED_ATTRS.add("__class_getitem__") - -if sys.version_info >= (3, 12): - _EXCLUDED_ATTRS.add("__type_params__") - -_EXCLUDED_ATTRS = frozenset(_EXCLUDED_ATTRS) - - -def _get_protocol_attrs(cls): - attrs = set() - for base in cls.__mro__[:-1]: # without object - if base.__name__ in {'Protocol', 'Generic'}: - continue - annotations = getattr(base, '__annotations__', {}) - for attr in (*base.__dict__, *annotations): - if (not attr.startswith('_abc_') and attr not in _EXCLUDED_ATTRS): - attrs.add(attr) - return attrs - - -def _caller(depth=2): - try: - return sys._getframe(depth).f_globals.get('__name__', '__main__') - except (AttributeError, ValueError): # For platforms without _getframe() - return None - - -# The performance of runtime-checkable protocols is significantly improved on Python 3.12, -# so we backport the 3.12 version of Protocol to Python <=3.11 -if sys.version_info >= (3, 12): - Protocol = typing.Protocol -else: - def _allow_reckless_class_checks(depth=3): - """Allow instance and class checks for special stdlib modules. - The abc and functools modules indiscriminately call isinstance() and - issubclass() on the whole MRO of a user class, which may contain protocols. - """ - return _caller(depth) in {'abc', 'functools', None} - - def _no_init(self, *args, **kwargs): - if type(self)._is_protocol: - raise TypeError('Protocols cannot be instantiated') - - # Inheriting from typing._ProtocolMeta isn't actually desirable, - # but is necessary to allow typing.Protocol and typing_extensions.Protocol - # to mix without getting TypeErrors about "metaclass conflict" - class _ProtocolMeta(type(typing.Protocol)): - # This metaclass is somewhat unfortunate, - # but is necessary for several reasons... - # - # NOTE: DO NOT call super() in any methods in this class - # That would call the methods on typing._ProtocolMeta on Python 3.8-3.11 - # and those are slow - def __new__(mcls, name, bases, namespace, **kwargs): - if name == "Protocol" and len(bases) < 2: - pass - elif {Protocol, typing.Protocol} & set(bases): - for base in bases: - if not ( - base in {object, typing.Generic, Protocol, typing.Protocol} - or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__, []) - or is_protocol(base) - ): - raise TypeError( - f"Protocols can only inherit from other protocols, " - f"got {base!r}" - ) - return abc.ABCMeta.__new__(mcls, name, bases, namespace, **kwargs) - - def __init__(cls, *args, **kwargs): - abc.ABCMeta.__init__(cls, *args, **kwargs) - if getattr(cls, "_is_protocol", False): - cls.__protocol_attrs__ = _get_protocol_attrs(cls) - # PEP 544 prohibits using issubclass() - # with protocols that have non-method members. - cls.__callable_proto_members_only__ = all( - callable(getattr(cls, attr, None)) for attr in cls.__protocol_attrs__ - ) - - def __subclasscheck__(cls, other): - if cls is Protocol: - return type.__subclasscheck__(cls, other) - if ( - getattr(cls, '_is_protocol', False) - and not _allow_reckless_class_checks() - ): - if not isinstance(other, type): - # Same error message as for issubclass(1, int). - raise TypeError('issubclass() arg 1 must be a class') - if ( - not cls.__callable_proto_members_only__ - and cls.__dict__.get("__subclasshook__") is _proto_hook - ): - raise TypeError( - "Protocols with non-method members don't support issubclass()" - ) - if not getattr(cls, '_is_runtime_protocol', False): - raise TypeError( - "Instance and class checks can only be used with " - "@runtime_checkable protocols" - ) - return abc.ABCMeta.__subclasscheck__(cls, other) - - def __instancecheck__(cls, instance): - # We need this method for situations where attributes are - # assigned in __init__. - if cls is Protocol: - return type.__instancecheck__(cls, instance) - if not getattr(cls, "_is_protocol", False): - # i.e., it's a concrete subclass of a protocol - return abc.ABCMeta.__instancecheck__(cls, instance) - - if ( - not getattr(cls, '_is_runtime_protocol', False) and - not _allow_reckless_class_checks() - ): - raise TypeError("Instance and class checks can only be used with" - " @runtime_checkable protocols") - - if abc.ABCMeta.__instancecheck__(cls, instance): - return True - - for attr in cls.__protocol_attrs__: - try: - val = inspect.getattr_static(instance, attr) - except AttributeError: - break - if val is None and callable(getattr(cls, attr, None)): - break - else: - return True - - return False - - def __eq__(cls, other): - # Hack so that typing.Generic.__class_getitem__ - # treats typing_extensions.Protocol - # as equivalent to typing.Protocol - if abc.ABCMeta.__eq__(cls, other) is True: - return True - return cls is Protocol and other is typing.Protocol - - # This has to be defined, or the abc-module cache - # complains about classes with this metaclass being unhashable, - # if we define only __eq__! - def __hash__(cls) -> int: - return type.__hash__(cls) - - @classmethod - def _proto_hook(cls, other): - if not cls.__dict__.get('_is_protocol', False): - return NotImplemented - - for attr in cls.__protocol_attrs__: - for base in other.__mro__: - # Check if the members appears in the class dictionary... - if attr in base.__dict__: - if base.__dict__[attr] is None: - return NotImplemented - break - - # ...or in annotations, if it is a sub-protocol. - annotations = getattr(base, '__annotations__', {}) - if ( - isinstance(annotations, collections.abc.Mapping) - and attr in annotations - and is_protocol(other) - ): - break - else: - return NotImplemented - return True - - class Protocol(typing.Generic, metaclass=_ProtocolMeta): - __doc__ = typing.Protocol.__doc__ - __slots__ = () - _is_protocol = True - _is_runtime_protocol = False - - def __init_subclass__(cls, *args, **kwargs): - super().__init_subclass__(*args, **kwargs) - - # Determine if this is a protocol or a concrete subclass. - if not cls.__dict__.get('_is_protocol', False): - cls._is_protocol = any(b is Protocol for b in cls.__bases__) - - # Set (or override) the protocol subclass hook. - if '__subclasshook__' not in cls.__dict__: - cls.__subclasshook__ = _proto_hook - - # Prohibit instantiation for protocol classes - if cls._is_protocol and cls.__init__ is Protocol.__init__: - cls.__init__ = _no_init - - -# The "runtime" alias exists for backwards compatibility. -runtime = runtime_checkable = typing.runtime_checkable - - -# Our version of runtime-checkable protocols is faster on Python 3.8-3.11 -if sys.version_info >= (3, 12): - SupportsInt = typing.SupportsInt - SupportsFloat = typing.SupportsFloat - SupportsComplex = typing.SupportsComplex - SupportsBytes = typing.SupportsBytes - SupportsIndex = typing.SupportsIndex - SupportsAbs = typing.SupportsAbs - SupportsRound = typing.SupportsRound -else: - @runtime_checkable - class SupportsInt(Protocol): - """An ABC with one abstract method __int__.""" - __slots__ = () - - @abc.abstractmethod - def __int__(self) -> int: - pass - - @runtime_checkable - class SupportsFloat(Protocol): - """An ABC with one abstract method __float__.""" - __slots__ = () - - @abc.abstractmethod - def __float__(self) -> float: - pass - - @runtime_checkable - class SupportsComplex(Protocol): - """An ABC with one abstract method __complex__.""" - __slots__ = () - - @abc.abstractmethod - def __complex__(self) -> complex: - pass - - @runtime_checkable - class SupportsBytes(Protocol): - """An ABC with one abstract method __bytes__.""" - __slots__ = () - - @abc.abstractmethod - def __bytes__(self) -> bytes: - pass - - @runtime_checkable - class SupportsIndex(Protocol): - __slots__ = () - - @abc.abstractmethod - def __index__(self) -> int: - pass - - @runtime_checkable - class SupportsAbs(Protocol[T_co]): - """ - An ABC with one abstract method __abs__ that is covariant in its return type. - """ - __slots__ = () - - @abc.abstractmethod - def __abs__(self) -> T_co: - pass - - @runtime_checkable - class SupportsRound(Protocol[T_co]): - """ - An ABC with one abstract method __round__ that is covariant in its return type. - """ - __slots__ = () - - @abc.abstractmethod - def __round__(self, ndigits: int = 0) -> T_co: - pass - - -def _ensure_subclassable(mro_entries): - def inner(func): - if sys.implementation.name == "pypy" and sys.version_info < (3, 9): - cls_dict = { - "__call__": staticmethod(func), - "__mro_entries__": staticmethod(mro_entries) - } - t = type(func.__name__, (), cls_dict) - return functools.update_wrapper(t(), func) - else: - func.__mro_entries__ = mro_entries - return func - return inner - - -if sys.version_info >= (3, 13): - # The standard library TypedDict in Python 3.8 does not store runtime information - # about which (if any) keys are optional. See https://bugs.python.org/issue38834 - # The standard library TypedDict in Python 3.9.0/1 does not honour the "total" - # keyword with old-style TypedDict(). See https://bugs.python.org/issue42059 - # The standard library TypedDict below Python 3.11 does not store runtime - # information about optional and required keys when using Required or NotRequired. - # Generic TypedDicts are also impossible using typing.TypedDict on Python <3.11. - # Aaaand on 3.12 we add __orig_bases__ to TypedDict - # to enable better runtime introspection. - # On 3.13 we deprecate some odd ways of creating TypedDicts. - TypedDict = typing.TypedDict - _TypedDictMeta = typing._TypedDictMeta - is_typeddict = typing.is_typeddict -else: - # 3.10.0 and later - _TAKES_MODULE = "module" in inspect.signature(typing._type_check).parameters - - class _TypedDictMeta(type): - def __new__(cls, name, bases, ns, total=True): - """Create new typed dict class object. - - This method is called when TypedDict is subclassed, - or when TypedDict is instantiated. This way - TypedDict supports all three syntax forms described in its docstring. - Subclasses and instances of TypedDict return actual dictionaries. - """ - for base in bases: - if type(base) is not _TypedDictMeta and base is not typing.Generic: - raise TypeError('cannot inherit from both a TypedDict type ' - 'and a non-TypedDict base class') - - if any(issubclass(b, typing.Generic) for b in bases): - generic_base = (typing.Generic,) - else: - generic_base = () - - # typing.py generally doesn't let you inherit from plain Generic, unless - # the name of the class happens to be "Protocol" - tp_dict = type.__new__(_TypedDictMeta, "Protocol", (*generic_base, dict), ns) - tp_dict.__name__ = name - if tp_dict.__qualname__ == "Protocol": - tp_dict.__qualname__ = name - - if not hasattr(tp_dict, '__orig_bases__'): - tp_dict.__orig_bases__ = bases - - annotations = {} - own_annotations = ns.get('__annotations__', {}) - msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type" - if _TAKES_MODULE: - own_annotations = { - n: typing._type_check(tp, msg, module=tp_dict.__module__) - for n, tp in own_annotations.items() - } - else: - own_annotations = { - n: typing._type_check(tp, msg) - for n, tp in own_annotations.items() - } - required_keys = set() - optional_keys = set() - - for base in bases: - annotations.update(base.__dict__.get('__annotations__', {})) - required_keys.update(base.__dict__.get('__required_keys__', ())) - optional_keys.update(base.__dict__.get('__optional_keys__', ())) - - annotations.update(own_annotations) - for annotation_key, annotation_type in own_annotations.items(): - annotation_origin = get_origin(annotation_type) - if annotation_origin is Annotated: - annotation_args = get_args(annotation_type) - if annotation_args: - annotation_type = annotation_args[0] - annotation_origin = get_origin(annotation_type) - - if annotation_origin is Required: - required_keys.add(annotation_key) - elif annotation_origin is NotRequired: - optional_keys.add(annotation_key) - elif total: - required_keys.add(annotation_key) - else: - optional_keys.add(annotation_key) - - tp_dict.__annotations__ = annotations - tp_dict.__required_keys__ = frozenset(required_keys) - tp_dict.__optional_keys__ = frozenset(optional_keys) - if not hasattr(tp_dict, '__total__'): - tp_dict.__total__ = total - return tp_dict - - __call__ = dict # static method - - def __subclasscheck__(cls, other): - # Typed dicts are only for static structural subtyping. - raise TypeError('TypedDict does not support instance and class checks') - - __instancecheck__ = __subclasscheck__ - - _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {}) - - @_ensure_subclassable(lambda bases: (_TypedDict,)) - def TypedDict(typename, fields=_marker, /, *, total=True, **kwargs): - """A simple typed namespace. At runtime it is equivalent to a plain dict. - - TypedDict creates a dictionary type such that a type checker will expect all - instances to have a certain set of keys, where each key is - associated with a value of a consistent type. This expectation - is not checked at runtime. - - Usage:: - - class Point2D(TypedDict): - x: int - y: int - label: str - - a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK - b: Point2D = {'z': 3, 'label': 'bad'} # Fails type check - - assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first') - - The type info can be accessed via the Point2D.__annotations__ dict, and - the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets. - TypedDict supports an additional equivalent form:: - - Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str}) - - By default, all keys must be present in a TypedDict. It is possible - to override this by specifying totality:: - - class Point2D(TypedDict, total=False): - x: int - y: int - - This means that a Point2D TypedDict can have any of the keys omitted. A type - checker is only expected to support a literal False or True as the value of - the total argument. True is the default, and makes all items defined in the - class body be required. - - The Required and NotRequired special forms can also be used to mark - individual keys as being required or not required:: - - class Point2D(TypedDict): - x: int # the "x" key must always be present (Required is the default) - y: NotRequired[int] # the "y" key can be omitted - - See PEP 655 for more details on Required and NotRequired. - """ - if fields is _marker or fields is None: - if fields is _marker: - deprecated_thing = "Failing to pass a value for the 'fields' parameter" - else: - deprecated_thing = "Passing `None` as the 'fields' parameter" - - example = f"`{typename} = TypedDict({typename!r}, {{}})`" - deprecation_msg = ( - f"{deprecated_thing} is deprecated and will be disallowed in " - "Python 3.15. To create a TypedDict class with 0 fields " - "using the functional syntax, pass an empty dictionary, e.g. " - ) + example + "." - warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=2) - fields = kwargs - elif kwargs: - raise TypeError("TypedDict takes either a dict or keyword arguments," - " but not both") - if kwargs: - warnings.warn( - "The kwargs-based syntax for TypedDict definitions is deprecated " - "in Python 3.11, will be removed in Python 3.13, and may not be " - "understood by third-party type checkers.", - DeprecationWarning, - stacklevel=2, - ) - - ns = {'__annotations__': dict(fields)} - module = _caller() - if module is not None: - # Setting correct module is necessary to make typed dict classes pickleable. - ns['__module__'] = module - - td = _TypedDictMeta(typename, (), ns, total=total) - td.__orig_bases__ = (TypedDict,) - return td - - if hasattr(typing, "_TypedDictMeta"): - _TYPEDDICT_TYPES = (typing._TypedDictMeta, _TypedDictMeta) - else: - _TYPEDDICT_TYPES = (_TypedDictMeta,) - - def is_typeddict(tp): - """Check if an annotation is a TypedDict class - - For example:: - class Film(TypedDict): - title: str - year: int - - is_typeddict(Film) # => True - is_typeddict(Union[list, str]) # => False - """ - # On 3.8, this would otherwise return True - if hasattr(typing, "TypedDict") and tp is typing.TypedDict: - return False - return isinstance(tp, _TYPEDDICT_TYPES) - - -if hasattr(typing, "assert_type"): - assert_type = typing.assert_type - -else: - def assert_type(val, typ, /): - """Assert (to the type checker) that the value is of the given type. - - When the type checker encounters a call to assert_type(), it - emits an error if the value is not of the specified type:: - - def greet(name: str) -> None: - assert_type(name, str) # ok - assert_type(name, int) # type checker error - - At runtime this returns the first argument unchanged and otherwise - does nothing. - """ - return val - - -if hasattr(typing, "Required"): # 3.11+ - get_type_hints = typing.get_type_hints -else: # <=3.10 - # replaces _strip_annotations() - def _strip_extras(t): - """Strips Annotated, Required and NotRequired from a given type.""" - if isinstance(t, _AnnotatedAlias): - return _strip_extras(t.__origin__) - if hasattr(t, "__origin__") and t.__origin__ in (Required, NotRequired): - return _strip_extras(t.__args__[0]) - if isinstance(t, typing._GenericAlias): - stripped_args = tuple(_strip_extras(a) for a in t.__args__) - if stripped_args == t.__args__: - return t - return t.copy_with(stripped_args) - if hasattr(_types, "GenericAlias") and isinstance(t, _types.GenericAlias): - stripped_args = tuple(_strip_extras(a) for a in t.__args__) - if stripped_args == t.__args__: - return t - return _types.GenericAlias(t.__origin__, stripped_args) - if hasattr(_types, "UnionType") and isinstance(t, _types.UnionType): - stripped_args = tuple(_strip_extras(a) for a in t.__args__) - if stripped_args == t.__args__: - return t - return functools.reduce(operator.or_, stripped_args) - - return t - - def get_type_hints(obj, globalns=None, localns=None, include_extras=False): - """Return type hints for an object. - - This is often the same as obj.__annotations__, but it handles - forward references encoded as string literals, adds Optional[t] if a - default value equal to None is set and recursively replaces all - 'Annotated[T, ...]', 'Required[T]' or 'NotRequired[T]' with 'T' - (unless 'include_extras=True'). - - The argument may be a module, class, method, or function. The annotations - are returned as a dictionary. For classes, annotations include also - inherited members. - - TypeError is raised if the argument is not of a type that can contain - annotations, and an empty dictionary is returned if no annotations are - present. - - BEWARE -- the behavior of globalns and localns is counterintuitive - (unless you are familiar with how eval() and exec() work). The - search order is locals first, then globals. - - - If no dict arguments are passed, an attempt is made to use the - globals from obj (or the respective module's globals for classes), - and these are also used as the locals. If the object does not appear - to have globals, an empty dictionary is used. - - - If one dict argument is passed, it is used for both globals and - locals. - - - If two dict arguments are passed, they specify globals and - locals, respectively. - """ - if hasattr(typing, "Annotated"): # 3.9+ - hint = typing.get_type_hints( - obj, globalns=globalns, localns=localns, include_extras=True - ) - else: # 3.8 - hint = typing.get_type_hints(obj, globalns=globalns, localns=localns) - if include_extras: - return hint - return {k: _strip_extras(t) for k, t in hint.items()} - - -# Python 3.9+ has PEP 593 (Annotated) -if hasattr(typing, 'Annotated'): - Annotated = typing.Annotated - # Not exported and not a public API, but needed for get_origin() and get_args() - # to work. - _AnnotatedAlias = typing._AnnotatedAlias -# 3.8 -else: - class _AnnotatedAlias(typing._GenericAlias, _root=True): - """Runtime representation of an annotated type. - - At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't' - with extra annotations. The alias behaves like a normal typing alias, - instantiating is the same as instantiating the underlying type, binding - it to types is also the same. - """ - def __init__(self, origin, metadata): - if isinstance(origin, _AnnotatedAlias): - metadata = origin.__metadata__ + metadata - origin = origin.__origin__ - super().__init__(origin, origin) - self.__metadata__ = metadata - - def copy_with(self, params): - assert len(params) == 1 - new_type = params[0] - return _AnnotatedAlias(new_type, self.__metadata__) - - def __repr__(self): - return (f"typing_extensions.Annotated[{typing._type_repr(self.__origin__)}, " - f"{', '.join(repr(a) for a in self.__metadata__)}]") - - def __reduce__(self): - return operator.getitem, ( - Annotated, (self.__origin__,) + self.__metadata__ - ) - - def __eq__(self, other): - if not isinstance(other, _AnnotatedAlias): - return NotImplemented - if self.__origin__ != other.__origin__: - return False - return self.__metadata__ == other.__metadata__ - - def __hash__(self): - return hash((self.__origin__, self.__metadata__)) - - class Annotated: - """Add context specific metadata to a type. - - Example: Annotated[int, runtime_check.Unsigned] indicates to the - hypothetical runtime_check module that this type is an unsigned int. - Every other consumer of this type can ignore this metadata and treat - this type as int. - - The first argument to Annotated must be a valid type (and will be in - the __origin__ field), the remaining arguments are kept as a tuple in - the __extra__ field. - - Details: - - - It's an error to call `Annotated` with less than two arguments. - - Nested Annotated are flattened:: - - Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3] - - - Instantiating an annotated type is equivalent to instantiating the - underlying type:: - - Annotated[C, Ann1](5) == C(5) - - - Annotated can be used as a generic type alias:: - - Optimized = Annotated[T, runtime.Optimize()] - Optimized[int] == Annotated[int, runtime.Optimize()] - - OptimizedList = Annotated[List[T], runtime.Optimize()] - OptimizedList[int] == Annotated[List[int], runtime.Optimize()] - """ - - __slots__ = () - - def __new__(cls, *args, **kwargs): - raise TypeError("Type Annotated cannot be instantiated.") - - @typing._tp_cache - def __class_getitem__(cls, params): - if not isinstance(params, tuple) or len(params) < 2: - raise TypeError("Annotated[...] should be used " - "with at least two arguments (a type and an " - "annotation).") - allowed_special_forms = (ClassVar, Final) - if get_origin(params[0]) in allowed_special_forms: - origin = params[0] - else: - msg = "Annotated[t, ...]: t must be a type." - origin = typing._type_check(params[0], msg) - metadata = tuple(params[1:]) - return _AnnotatedAlias(origin, metadata) - - def __init_subclass__(cls, *args, **kwargs): - raise TypeError( - f"Cannot subclass {cls.__module__}.Annotated" - ) - -# Python 3.8 has get_origin() and get_args() but those implementations aren't -# Annotated-aware, so we can't use those. Python 3.9's versions don't support -# ParamSpecArgs and ParamSpecKwargs, so only Python 3.10's versions will do. -if sys.version_info[:2] >= (3, 10): - get_origin = typing.get_origin - get_args = typing.get_args -# 3.8-3.9 -else: - try: - # 3.9+ - from typing import _BaseGenericAlias - except ImportError: - _BaseGenericAlias = typing._GenericAlias - try: - # 3.9+ - from typing import GenericAlias as _typing_GenericAlias - except ImportError: - _typing_GenericAlias = typing._GenericAlias - - def get_origin(tp): - """Get the unsubscripted version of a type. - - This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar - and Annotated. Return None for unsupported types. Examples:: - - get_origin(Literal[42]) is Literal - get_origin(int) is None - get_origin(ClassVar[int]) is ClassVar - get_origin(Generic) is Generic - get_origin(Generic[T]) is Generic - get_origin(Union[T, int]) is Union - get_origin(List[Tuple[T, T]][int]) == list - get_origin(P.args) is P - """ - if isinstance(tp, _AnnotatedAlias): - return Annotated - if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias, _BaseGenericAlias, - ParamSpecArgs, ParamSpecKwargs)): - return tp.__origin__ - if tp is typing.Generic: - return typing.Generic - return None - - def get_args(tp): - """Get type arguments with all substitutions performed. - - For unions, basic simplifications used by Union constructor are performed. - Examples:: - get_args(Dict[str, int]) == (str, int) - get_args(int) == () - get_args(Union[int, Union[T, int], str][int]) == (int, str) - get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int]) - get_args(Callable[[], T][int]) == ([], int) - """ - if isinstance(tp, _AnnotatedAlias): - return (tp.__origin__,) + tp.__metadata__ - if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias)): - if getattr(tp, "_special", False): - return () - res = tp.__args__ - if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis: - res = (list(res[:-1]), res[-1]) - return res - return () - - -# 3.10+ -if hasattr(typing, 'TypeAlias'): - TypeAlias = typing.TypeAlias -# 3.9 -elif sys.version_info[:2] >= (3, 9): - @_ExtensionsSpecialForm - def TypeAlias(self, parameters): - """Special marker indicating that an assignment should - be recognized as a proper type alias definition by type - checkers. - - For example:: - - Predicate: TypeAlias = Callable[..., bool] - - It's invalid when used anywhere except as in the example above. - """ - raise TypeError(f"{self} is not subscriptable") -# 3.8 -else: - TypeAlias = _ExtensionsSpecialForm( - 'TypeAlias', - doc="""Special marker indicating that an assignment should - be recognized as a proper type alias definition by type - checkers. - - For example:: - - Predicate: TypeAlias = Callable[..., bool] - - It's invalid when used anywhere except as in the example - above.""" - ) - - -def _set_default(type_param, default): - if isinstance(default, (tuple, list)): - type_param.__default__ = tuple((typing._type_check(d, "Default must be a type") - for d in default)) - elif default != _marker: - if isinstance(type_param, ParamSpec) and default is ...: # ... not valid <3.11 - type_param.__default__ = default - else: - type_param.__default__ = typing._type_check(default, "Default must be a type") - else: - type_param.__default__ = None - - -def _set_module(typevarlike): - # for pickling: - def_mod = _caller(depth=3) - if def_mod != 'typing_extensions': - typevarlike.__module__ = def_mod - - -class _DefaultMixin: - """Mixin for TypeVarLike defaults.""" - - __slots__ = () - __init__ = _set_default - - -# Classes using this metaclass must provide a _backported_typevarlike ClassVar -class _TypeVarLikeMeta(type): - def __instancecheck__(cls, __instance: Any) -> bool: - return isinstance(__instance, cls._backported_typevarlike) - - -# Add default and infer_variance parameters from PEP 696 and 695 -class TypeVar(metaclass=_TypeVarLikeMeta): - """Type variable.""" - - _backported_typevarlike = typing.TypeVar - - def __new__(cls, name, *constraints, bound=None, - covariant=False, contravariant=False, - default=_marker, infer_variance=False): - if hasattr(typing, "TypeAliasType"): - # PEP 695 implemented (3.12+), can pass infer_variance to typing.TypeVar - typevar = typing.TypeVar(name, *constraints, bound=bound, - covariant=covariant, contravariant=contravariant, - infer_variance=infer_variance) - else: - typevar = typing.TypeVar(name, *constraints, bound=bound, - covariant=covariant, contravariant=contravariant) - if infer_variance and (covariant or contravariant): - raise ValueError("Variance cannot be specified with infer_variance.") - typevar.__infer_variance__ = infer_variance - _set_default(typevar, default) - _set_module(typevar) - return typevar - - def __init_subclass__(cls) -> None: - raise TypeError(f"type '{__name__}.TypeVar' is not an acceptable base type") - - -# Python 3.10+ has PEP 612 -if hasattr(typing, 'ParamSpecArgs'): - ParamSpecArgs = typing.ParamSpecArgs - ParamSpecKwargs = typing.ParamSpecKwargs -# 3.8-3.9 -else: - class _Immutable: - """Mixin to indicate that object should not be copied.""" - __slots__ = () - - def __copy__(self): - return self - - def __deepcopy__(self, memo): - return self - - class ParamSpecArgs(_Immutable): - """The args for a ParamSpec object. - - Given a ParamSpec object P, P.args is an instance of ParamSpecArgs. - - ParamSpecArgs objects have a reference back to their ParamSpec: - - P.args.__origin__ is P - - This type is meant for runtime introspection and has no special meaning to - static type checkers. - """ - def __init__(self, origin): - self.__origin__ = origin - - def __repr__(self): - return f"{self.__origin__.__name__}.args" - - def __eq__(self, other): - if not isinstance(other, ParamSpecArgs): - return NotImplemented - return self.__origin__ == other.__origin__ - - class ParamSpecKwargs(_Immutable): - """The kwargs for a ParamSpec object. - - Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs. - - ParamSpecKwargs objects have a reference back to their ParamSpec: - - P.kwargs.__origin__ is P - - This type is meant for runtime introspection and has no special meaning to - static type checkers. - """ - def __init__(self, origin): - self.__origin__ = origin - - def __repr__(self): - return f"{self.__origin__.__name__}.kwargs" - - def __eq__(self, other): - if not isinstance(other, ParamSpecKwargs): - return NotImplemented - return self.__origin__ == other.__origin__ - -# 3.10+ -if hasattr(typing, 'ParamSpec'): - - # Add default parameter - PEP 696 - class ParamSpec(metaclass=_TypeVarLikeMeta): - """Parameter specification.""" - - _backported_typevarlike = typing.ParamSpec - - def __new__(cls, name, *, bound=None, - covariant=False, contravariant=False, - infer_variance=False, default=_marker): - if hasattr(typing, "TypeAliasType"): - # PEP 695 implemented, can pass infer_variance to typing.TypeVar - paramspec = typing.ParamSpec(name, bound=bound, - covariant=covariant, - contravariant=contravariant, - infer_variance=infer_variance) - else: - paramspec = typing.ParamSpec(name, bound=bound, - covariant=covariant, - contravariant=contravariant) - paramspec.__infer_variance__ = infer_variance - - _set_default(paramspec, default) - _set_module(paramspec) - return paramspec - - def __init_subclass__(cls) -> None: - raise TypeError(f"type '{__name__}.ParamSpec' is not an acceptable base type") - -# 3.8-3.9 -else: - - # Inherits from list as a workaround for Callable checks in Python < 3.9.2. - class ParamSpec(list, _DefaultMixin): - """Parameter specification variable. - - Usage:: - - P = ParamSpec('P') - - Parameter specification variables exist primarily for the benefit of static - type checkers. They are used to forward the parameter types of one - callable to another callable, a pattern commonly found in higher order - functions and decorators. They are only valid when used in ``Concatenate``, - or s the first argument to ``Callable``. In Python 3.10 and higher, - they are also supported in user-defined Generics at runtime. - See class Generic for more information on generic types. An - example for annotating a decorator:: - - T = TypeVar('T') - P = ParamSpec('P') - - def add_logging(f: Callable[P, T]) -> Callable[P, T]: - '''A type-safe decorator to add logging to a function.''' - def inner(*args: P.args, **kwargs: P.kwargs) -> T: - logging.info(f'{f.__name__} was called') - return f(*args, **kwargs) - return inner - - @add_logging - def add_two(x: float, y: float) -> float: - '''Add two numbers together.''' - return x + y - - Parameter specification variables defined with covariant=True or - contravariant=True can be used to declare covariant or contravariant - generic types. These keyword arguments are valid, but their actual semantics - are yet to be decided. See PEP 612 for details. - - Parameter specification variables can be introspected. e.g.: - - P.__name__ == 'T' - P.__bound__ == None - P.__covariant__ == False - P.__contravariant__ == False - - Note that only parameter specification variables defined in global scope can - be pickled. - """ - - # Trick Generic __parameters__. - __class__ = typing.TypeVar - - @property - def args(self): - return ParamSpecArgs(self) - - @property - def kwargs(self): - return ParamSpecKwargs(self) - - def __init__(self, name, *, bound=None, covariant=False, contravariant=False, - infer_variance=False, default=_marker): - super().__init__([self]) - self.__name__ = name - self.__covariant__ = bool(covariant) - self.__contravariant__ = bool(contravariant) - self.__infer_variance__ = bool(infer_variance) - if bound: - self.__bound__ = typing._type_check(bound, 'Bound must be a type.') - else: - self.__bound__ = None - _DefaultMixin.__init__(self, default) - - # for pickling: - def_mod = _caller() - if def_mod != 'typing_extensions': - self.__module__ = def_mod - - def __repr__(self): - if self.__infer_variance__: - prefix = '' - elif self.__covariant__: - prefix = '+' - elif self.__contravariant__: - prefix = '-' - else: - prefix = '~' - return prefix + self.__name__ - - def __hash__(self): - return object.__hash__(self) - - def __eq__(self, other): - return self is other - - def __reduce__(self): - return self.__name__ - - # Hack to get typing._type_check to pass. - def __call__(self, *args, **kwargs): - pass - - -# 3.8-3.9 -if not hasattr(typing, 'Concatenate'): - # Inherits from list as a workaround for Callable checks in Python < 3.9.2. - class _ConcatenateGenericAlias(list): - - # Trick Generic into looking into this for __parameters__. - __class__ = typing._GenericAlias - - # Flag in 3.8. - _special = False - - def __init__(self, origin, args): - super().__init__(args) - self.__origin__ = origin - self.__args__ = args - - def __repr__(self): - _type_repr = typing._type_repr - return (f'{_type_repr(self.__origin__)}' - f'[{", ".join(_type_repr(arg) for arg in self.__args__)}]') - - def __hash__(self): - return hash((self.__origin__, self.__args__)) - - # Hack to get typing._type_check to pass in Generic. - def __call__(self, *args, **kwargs): - pass - - @property - def __parameters__(self): - return tuple( - tp for tp in self.__args__ if isinstance(tp, (typing.TypeVar, ParamSpec)) - ) - - -# 3.8-3.9 -@typing._tp_cache -def _concatenate_getitem(self, parameters): - if parameters == (): - raise TypeError("Cannot take a Concatenate of no types.") - if not isinstance(parameters, tuple): - parameters = (parameters,) - if not isinstance(parameters[-1], ParamSpec): - raise TypeError("The last parameter to Concatenate should be a " - "ParamSpec variable.") - msg = "Concatenate[arg, ...]: each arg must be a type." - parameters = tuple(typing._type_check(p, msg) for p in parameters) - return _ConcatenateGenericAlias(self, parameters) - - -# 3.10+ -if hasattr(typing, 'Concatenate'): - Concatenate = typing.Concatenate - _ConcatenateGenericAlias = typing._ConcatenateGenericAlias # noqa: F811 -# 3.9 -elif sys.version_info[:2] >= (3, 9): - @_ExtensionsSpecialForm - def Concatenate(self, parameters): - """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a - higher order function which adds, removes or transforms parameters of a - callable. - - For example:: - - Callable[Concatenate[int, P], int] - - See PEP 612 for detailed information. - """ - return _concatenate_getitem(self, parameters) -# 3.8 -else: - class _ConcatenateForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - return _concatenate_getitem(self, parameters) - - Concatenate = _ConcatenateForm( - 'Concatenate', - doc="""Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a - higher order function which adds, removes or transforms parameters of a - callable. - - For example:: - - Callable[Concatenate[int, P], int] - - See PEP 612 for detailed information. - """) - -# 3.10+ -if hasattr(typing, 'TypeGuard'): - TypeGuard = typing.TypeGuard -# 3.9 -elif sys.version_info[:2] >= (3, 9): - @_ExtensionsSpecialForm - def TypeGuard(self, parameters): - """Special typing form used to annotate the return type of a user-defined - type guard function. ``TypeGuard`` only accepts a single type argument. - At runtime, functions marked this way should return a boolean. - - ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static - type checkers to determine a more precise type of an expression within a - program's code flow. Usually type narrowing is done by analyzing - conditional code flow and applying the narrowing to a block of code. The - conditional expression here is sometimes referred to as a "type guard". - - Sometimes it would be convenient to use a user-defined boolean function - as a type guard. Such a function should use ``TypeGuard[...]`` as its - return type to alert static type checkers to this intention. - - Using ``-> TypeGuard`` tells the static type checker that for a given - function: - - 1. The return value is a boolean. - 2. If the return value is ``True``, the type of its argument - is the type inside ``TypeGuard``. - - For example:: - - def is_str(val: Union[str, float]): - # "isinstance" type guard - if isinstance(val, str): - # Type of ``val`` is narrowed to ``str`` - ... - else: - # Else, type of ``val`` is narrowed to ``float``. - ... - - Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower - form of ``TypeA`` (it can even be a wider form) and this may lead to - type-unsafe results. The main reason is to allow for things like - narrowing ``List[object]`` to ``List[str]`` even though the latter is not - a subtype of the former, since ``List`` is invariant. The responsibility of - writing type-safe type guards is left to the user. - - ``TypeGuard`` also works with type variables. For more information, see - PEP 647 (User-Defined Type Guards). - """ - item = typing._type_check(parameters, f'{self} accepts only a single type.') - return typing._GenericAlias(self, (item,)) -# 3.8 -else: - class _TypeGuardForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - item = typing._type_check(parameters, - f'{self._name} accepts only a single type') - return typing._GenericAlias(self, (item,)) - - TypeGuard = _TypeGuardForm( - 'TypeGuard', - doc="""Special typing form used to annotate the return type of a user-defined - type guard function. ``TypeGuard`` only accepts a single type argument. - At runtime, functions marked this way should return a boolean. - - ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static - type checkers to determine a more precise type of an expression within a - program's code flow. Usually type narrowing is done by analyzing - conditional code flow and applying the narrowing to a block of code. The - conditional expression here is sometimes referred to as a "type guard". - - Sometimes it would be convenient to use a user-defined boolean function - as a type guard. Such a function should use ``TypeGuard[...]`` as its - return type to alert static type checkers to this intention. - - Using ``-> TypeGuard`` tells the static type checker that for a given - function: - - 1. The return value is a boolean. - 2. If the return value is ``True``, the type of its argument - is the type inside ``TypeGuard``. - - For example:: - - def is_str(val: Union[str, float]): - # "isinstance" type guard - if isinstance(val, str): - # Type of ``val`` is narrowed to ``str`` - ... - else: - # Else, type of ``val`` is narrowed to ``float``. - ... - - Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower - form of ``TypeA`` (it can even be a wider form) and this may lead to - type-unsafe results. The main reason is to allow for things like - narrowing ``List[object]`` to ``List[str]`` even though the latter is not - a subtype of the former, since ``List`` is invariant. The responsibility of - writing type-safe type guards is left to the user. - - ``TypeGuard`` also works with type variables. For more information, see - PEP 647 (User-Defined Type Guards). - """) - - -# Vendored from cpython typing._SpecialFrom -class _SpecialForm(typing._Final, _root=True): - __slots__ = ('_name', '__doc__', '_getitem') - - def __init__(self, getitem): - self._getitem = getitem - self._name = getitem.__name__ - self.__doc__ = getitem.__doc__ - - def __getattr__(self, item): - if item in {'__name__', '__qualname__'}: - return self._name - - raise AttributeError(item) - - def __mro_entries__(self, bases): - raise TypeError(f"Cannot subclass {self!r}") - - def __repr__(self): - return f'typing_extensions.{self._name}' - - def __reduce__(self): - return self._name - - def __call__(self, *args, **kwds): - raise TypeError(f"Cannot instantiate {self!r}") - - def __or__(self, other): - return typing.Union[self, other] - - def __ror__(self, other): - return typing.Union[other, self] - - def __instancecheck__(self, obj): - raise TypeError(f"{self} cannot be used with isinstance()") - - def __subclasscheck__(self, cls): - raise TypeError(f"{self} cannot be used with issubclass()") - - @typing._tp_cache - def __getitem__(self, parameters): - return self._getitem(self, parameters) - - -if hasattr(typing, "LiteralString"): # 3.11+ - LiteralString = typing.LiteralString -else: - @_SpecialForm - def LiteralString(self, params): - """Represents an arbitrary literal string. - - Example:: - - from typing_extensions import LiteralString - - def query(sql: LiteralString) -> ...: - ... - - query("SELECT * FROM table") # ok - query(f"SELECT * FROM {input()}") # not ok - - See PEP 675 for details. - - """ - raise TypeError(f"{self} is not subscriptable") - - -if hasattr(typing, "Self"): # 3.11+ - Self = typing.Self -else: - @_SpecialForm - def Self(self, params): - """Used to spell the type of "self" in classes. - - Example:: - - from typing import Self - - class ReturnsSelf: - def parse(self, data: bytes) -> Self: - ... - return self - - """ - - raise TypeError(f"{self} is not subscriptable") - - -if hasattr(typing, "Never"): # 3.11+ - Never = typing.Never -else: - @_SpecialForm - def Never(self, params): - """The bottom type, a type that has no members. - - This can be used to define a function that should never be - called, or a function that never returns:: - - from typing_extensions import Never - - def never_call_me(arg: Never) -> None: - pass - - def int_or_str(arg: int | str) -> None: - never_call_me(arg) # type checker error - match arg: - case int(): - print("It's an int") - case str(): - print("It's a str") - case _: - never_call_me(arg) # ok, arg is of type Never - - """ - - raise TypeError(f"{self} is not subscriptable") - - -if hasattr(typing, 'Required'): # 3.11+ - Required = typing.Required - NotRequired = typing.NotRequired -elif sys.version_info[:2] >= (3, 9): # 3.9-3.10 - @_ExtensionsSpecialForm - def Required(self, parameters): - """A special typing construct to mark a key of a total=False TypedDict - as required. For example: - - class Movie(TypedDict, total=False): - title: Required[str] - year: int - - m = Movie( - title='The Matrix', # typechecker error if key is omitted - year=1999, - ) - - There is no runtime checking that a required key is actually provided - when instantiating a related TypedDict. - """ - item = typing._type_check(parameters, f'{self._name} accepts only a single type.') - return typing._GenericAlias(self, (item,)) - - @_ExtensionsSpecialForm - def NotRequired(self, parameters): - """A special typing construct to mark a key of a TypedDict as - potentially missing. For example: - - class Movie(TypedDict): - title: str - year: NotRequired[int] - - m = Movie( - title='The Matrix', # typechecker error if key is omitted - year=1999, - ) - """ - item = typing._type_check(parameters, f'{self._name} accepts only a single type.') - return typing._GenericAlias(self, (item,)) - -else: # 3.8 - class _RequiredForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - item = typing._type_check(parameters, - f'{self._name} accepts only a single type.') - return typing._GenericAlias(self, (item,)) - - Required = _RequiredForm( - 'Required', - doc="""A special typing construct to mark a key of a total=False TypedDict - as required. For example: - - class Movie(TypedDict, total=False): - title: Required[str] - year: int - - m = Movie( - title='The Matrix', # typechecker error if key is omitted - year=1999, - ) - - There is no runtime checking that a required key is actually provided - when instantiating a related TypedDict. - """) - NotRequired = _RequiredForm( - 'NotRequired', - doc="""A special typing construct to mark a key of a TypedDict as - potentially missing. For example: - - class Movie(TypedDict): - title: str - year: NotRequired[int] - - m = Movie( - title='The Matrix', # typechecker error if key is omitted - year=1999, - ) - """) - - -_UNPACK_DOC = """\ -Type unpack operator. - -The type unpack operator takes the child types from some container type, -such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For -example: - - # For some generic class `Foo`: - Foo[Unpack[tuple[int, str]]] # Equivalent to Foo[int, str] - - Ts = TypeVarTuple('Ts') - # Specifies that `Bar` is generic in an arbitrary number of types. - # (Think of `Ts` as a tuple of an arbitrary number of individual - # `TypeVar`s, which the `Unpack` is 'pulling out' directly into the - # `Generic[]`.) - class Bar(Generic[Unpack[Ts]]): ... - Bar[int] # Valid - Bar[int, str] # Also valid - -From Python 3.11, this can also be done using the `*` operator: - - Foo[*tuple[int, str]] - class Bar(Generic[*Ts]): ... - -The operator can also be used along with a `TypedDict` to annotate -`**kwargs` in a function signature. For instance: - - class Movie(TypedDict): - name: str - year: int - - # This function expects two keyword arguments - *name* of type `str` and - # *year* of type `int`. - def foo(**kwargs: Unpack[Movie]): ... - -Note that there is only some runtime checking of this operator. Not -everything the runtime allows may be accepted by static type checkers. - -For more information, see PEP 646 and PEP 692. -""" - - -if sys.version_info >= (3, 12): # PEP 692 changed the repr of Unpack[] - Unpack = typing.Unpack - - def _is_unpack(obj): - return get_origin(obj) is Unpack - -elif sys.version_info[:2] >= (3, 9): # 3.9+ - class _UnpackSpecialForm(_ExtensionsSpecialForm, _root=True): - def __init__(self, getitem): - super().__init__(getitem) - self.__doc__ = _UNPACK_DOC - - class _UnpackAlias(typing._GenericAlias, _root=True): - __class__ = typing.TypeVar - - @_UnpackSpecialForm - def Unpack(self, parameters): - item = typing._type_check(parameters, f'{self._name} accepts only a single type.') - return _UnpackAlias(self, (item,)) - - def _is_unpack(obj): - return isinstance(obj, _UnpackAlias) - -else: # 3.8 - class _UnpackAlias(typing._GenericAlias, _root=True): - __class__ = typing.TypeVar - - class _UnpackForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - item = typing._type_check(parameters, - f'{self._name} accepts only a single type.') - return _UnpackAlias(self, (item,)) - - Unpack = _UnpackForm('Unpack', doc=_UNPACK_DOC) - - def _is_unpack(obj): - return isinstance(obj, _UnpackAlias) - - -if hasattr(typing, "TypeVarTuple"): # 3.11+ - - # Add default parameter - PEP 696 - class TypeVarTuple(metaclass=_TypeVarLikeMeta): - """Type variable tuple.""" - - _backported_typevarlike = typing.TypeVarTuple - - def __new__(cls, name, *, default=_marker): - tvt = typing.TypeVarTuple(name) - _set_default(tvt, default) - _set_module(tvt) - return tvt - - def __init_subclass__(self, *args, **kwds): - raise TypeError("Cannot subclass special typing classes") - -else: # <=3.10 - class TypeVarTuple(_DefaultMixin): - """Type variable tuple. - - Usage:: - - Ts = TypeVarTuple('Ts') - - In the same way that a normal type variable is a stand-in for a single - type such as ``int``, a type variable *tuple* is a stand-in for a *tuple* - type such as ``Tuple[int, str]``. - - Type variable tuples can be used in ``Generic`` declarations. - Consider the following example:: - - class Array(Generic[*Ts]): ... - - The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``, - where ``T1`` and ``T2`` are type variables. To use these type variables - as type parameters of ``Array``, we must *unpack* the type variable tuple using - the star operator: ``*Ts``. The signature of ``Array`` then behaves - as if we had simply written ``class Array(Generic[T1, T2]): ...``. - In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows - us to parameterise the class with an *arbitrary* number of type parameters. - - Type variable tuples can be used anywhere a normal ``TypeVar`` can. - This includes class definitions, as shown above, as well as function - signatures and variable annotations:: - - class Array(Generic[*Ts]): - - def __init__(self, shape: Tuple[*Ts]): - self._shape: Tuple[*Ts] = shape - - def get_shape(self) -> Tuple[*Ts]: - return self._shape - - shape = (Height(480), Width(640)) - x: Array[Height, Width] = Array(shape) - y = abs(x) # Inferred type is Array[Height, Width] - z = x + x # ... is Array[Height, Width] - x.get_shape() # ... is tuple[Height, Width] - - """ - - # Trick Generic __parameters__. - __class__ = typing.TypeVar - - def __iter__(self): - yield self.__unpacked__ - - def __init__(self, name, *, default=_marker): - self.__name__ = name - _DefaultMixin.__init__(self, default) - - # for pickling: - def_mod = _caller() - if def_mod != 'typing_extensions': - self.__module__ = def_mod - - self.__unpacked__ = Unpack[self] - - def __repr__(self): - return self.__name__ - - def __hash__(self): - return object.__hash__(self) - - def __eq__(self, other): - return self is other - - def __reduce__(self): - return self.__name__ - - def __init_subclass__(self, *args, **kwds): - if '_root' not in kwds: - raise TypeError("Cannot subclass special typing classes") - - -if hasattr(typing, "reveal_type"): # 3.11+ - reveal_type = typing.reveal_type -else: # <=3.10 - def reveal_type(obj: T, /) -> T: - """Reveal the inferred type of a variable. - - When a static type checker encounters a call to ``reveal_type()``, - it will emit the inferred type of the argument:: - - x: int = 1 - reveal_type(x) - - Running a static type checker (e.g., ``mypy``) on this example - will produce output similar to 'Revealed type is "builtins.int"'. - - At runtime, the function prints the runtime type of the - argument and returns it unchanged. - - """ - print(f"Runtime type is {type(obj).__name__!r}", file=sys.stderr) - return obj - - -if hasattr(typing, "assert_never"): # 3.11+ - assert_never = typing.assert_never -else: # <=3.10 - def assert_never(arg: Never, /) -> Never: - """Assert to the type checker that a line of code is unreachable. - - Example:: - - def int_or_str(arg: int | str) -> None: - match arg: - case int(): - print("It's an int") - case str(): - print("It's a str") - case _: - assert_never(arg) - - If a type checker finds that a call to assert_never() is - reachable, it will emit an error. - - At runtime, this throws an exception when called. - - """ - raise AssertionError("Expected code to be unreachable") - - -if sys.version_info >= (3, 12): # 3.12+ - # dataclass_transform exists in 3.11 but lacks the frozen_default parameter - dataclass_transform = typing.dataclass_transform -else: # <=3.11 - def dataclass_transform( - *, - eq_default: bool = True, - order_default: bool = False, - kw_only_default: bool = False, - frozen_default: bool = False, - field_specifiers: typing.Tuple[ - typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]], - ... - ] = (), - **kwargs: typing.Any, - ) -> typing.Callable[[T], T]: - """Decorator that marks a function, class, or metaclass as providing - dataclass-like behavior. - - Example: - - from typing_extensions import dataclass_transform - - _T = TypeVar("_T") - - # Used on a decorator function - @dataclass_transform() - def create_model(cls: type[_T]) -> type[_T]: - ... - return cls - - @create_model - class CustomerModel: - id: int - name: str - - # Used on a base class - @dataclass_transform() - class ModelBase: ... - - class CustomerModel(ModelBase): - id: int - name: str - - # Used on a metaclass - @dataclass_transform() - class ModelMeta(type): ... - - class ModelBase(metaclass=ModelMeta): ... - - class CustomerModel(ModelBase): - id: int - name: str - - Each of the ``CustomerModel`` classes defined in this example will now - behave similarly to a dataclass created with the ``@dataclasses.dataclass`` - decorator. For example, the type checker will synthesize an ``__init__`` - method. - - The arguments to this decorator can be used to customize this behavior: - - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be - True or False if it is omitted by the caller. - - ``order_default`` indicates whether the ``order`` parameter is - assumed to be True or False if it is omitted by the caller. - - ``kw_only_default`` indicates whether the ``kw_only`` parameter is - assumed to be True or False if it is omitted by the caller. - - ``frozen_default`` indicates whether the ``frozen`` parameter is - assumed to be True or False if it is omitted by the caller. - - ``field_specifiers`` specifies a static list of supported classes - or functions that describe fields, similar to ``dataclasses.field()``. - - At runtime, this decorator records its arguments in the - ``__dataclass_transform__`` attribute on the decorated object. - - See PEP 681 for details. - - """ - def decorator(cls_or_fn): - cls_or_fn.__dataclass_transform__ = { - "eq_default": eq_default, - "order_default": order_default, - "kw_only_default": kw_only_default, - "frozen_default": frozen_default, - "field_specifiers": field_specifiers, - "kwargs": kwargs, - } - return cls_or_fn - return decorator - - -if hasattr(typing, "override"): # 3.12+ - override = typing.override -else: # <=3.11 - _F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any]) - - def override(arg: _F, /) -> _F: - """Indicate that a method is intended to override a method in a base class. - - Usage: - - class Base: - def method(self) -> None: ... - pass - - class Child(Base): - @override - def method(self) -> None: - super().method() - - When this decorator is applied to a method, the type checker will - validate that it overrides a method with the same name on a base class. - This helps prevent bugs that may occur when a base class is changed - without an equivalent change to a child class. - - There is no runtime checking of these properties. The decorator - sets the ``__override__`` attribute to ``True`` on the decorated object - to allow runtime introspection. - - See PEP 698 for details. - - """ - try: - arg.__override__ = True - except (AttributeError, TypeError): - # Skip the attribute silently if it is not writable. - # AttributeError happens if the object has __slots__ or a - # read-only property, TypeError if it's a builtin class. - pass - return arg - - -if hasattr(typing, "deprecated"): - deprecated = typing.deprecated -else: - _T = typing.TypeVar("_T") - - def deprecated( - msg: str, - /, - *, - category: typing.Optional[typing.Type[Warning]] = DeprecationWarning, - stacklevel: int = 1, - ) -> typing.Callable[[_T], _T]: - """Indicate that a class, function or overload is deprecated. - - Usage: - - @deprecated("Use B instead") - class A: - pass - - @deprecated("Use g instead") - def f(): - pass - - @overload - @deprecated("int support is deprecated") - def g(x: int) -> int: ... - @overload - def g(x: str) -> int: ... - - When this decorator is applied to an object, the type checker - will generate a diagnostic on usage of the deprecated object. - - The warning specified by ``category`` will be emitted on use - of deprecated objects. For functions, that happens on calls; - for classes, on instantiation. If the ``category`` is ``None``, - no warning is emitted. The ``stacklevel`` determines where the - warning is emitted. If it is ``1`` (the default), the warning - is emitted at the direct caller of the deprecated object; if it - is higher, it is emitted further up the stack. - - The decorator sets the ``__deprecated__`` - attribute on the decorated object to the deprecation message - passed to the decorator. If applied to an overload, the decorator - must be after the ``@overload`` decorator for the attribute to - exist on the overload as returned by ``get_overloads()``. - - See PEP 702 for details. - - """ - def decorator(arg: _T, /) -> _T: - if category is None: - arg.__deprecated__ = msg - return arg - elif isinstance(arg, type): - original_new = arg.__new__ - has_init = arg.__init__ is not object.__init__ - - @functools.wraps(original_new) - def __new__(cls, *args, **kwargs): - warnings.warn(msg, category=category, stacklevel=stacklevel + 1) - if original_new is not object.__new__: - return original_new(cls, *args, **kwargs) - # Mirrors a similar check in object.__new__. - elif not has_init and (args or kwargs): - raise TypeError(f"{cls.__name__}() takes no arguments") - else: - return original_new(cls) - - arg.__new__ = staticmethod(__new__) - arg.__deprecated__ = __new__.__deprecated__ = msg - return arg - elif callable(arg): - @functools.wraps(arg) - def wrapper(*args, **kwargs): - warnings.warn(msg, category=category, stacklevel=stacklevel + 1) - return arg(*args, **kwargs) - - arg.__deprecated__ = wrapper.__deprecated__ = msg - return wrapper - else: - raise TypeError( - "@deprecated decorator with non-None category must be applied to " - f"a class or callable, not {arg!r}" - ) - - return decorator - - -# We have to do some monkey patching to deal with the dual nature of -# Unpack/TypeVarTuple: -# - We want Unpack to be a kind of TypeVar so it gets accepted in -# Generic[Unpack[Ts]] -# - We want it to *not* be treated as a TypeVar for the purposes of -# counting generic parameters, so that when we subscript a generic, -# the runtime doesn't try to substitute the Unpack with the subscripted type. -if not hasattr(typing, "TypeVarTuple"): - typing._collect_type_vars = _collect_type_vars - typing._check_generic = _check_generic - - -# Backport typing.NamedTuple as it exists in Python 3.13. -# In 3.11, the ability to define generic `NamedTuple`s was supported. -# This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8. -# On 3.12, we added __orig_bases__ to call-based NamedTuples -# On 3.13, we deprecated kwargs-based NamedTuples -if sys.version_info >= (3, 13): - NamedTuple = typing.NamedTuple -else: - def _make_nmtuple(name, types, module, defaults=()): - fields = [n for n, t in types] - annotations = {n: typing._type_check(t, f"field {n} annotation must be a type") - for n, t in types} - nm_tpl = collections.namedtuple(name, fields, - defaults=defaults, module=module) - nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = annotations - # The `_field_types` attribute was removed in 3.9; - # in earlier versions, it is the same as the `__annotations__` attribute - if sys.version_info < (3, 9): - nm_tpl._field_types = annotations - return nm_tpl - - _prohibited_namedtuple_fields = typing._prohibited - _special_namedtuple_fields = frozenset({'__module__', '__name__', '__annotations__'}) - - class _NamedTupleMeta(type): - def __new__(cls, typename, bases, ns): - assert _NamedTuple in bases - for base in bases: - if base is not _NamedTuple and base is not typing.Generic: - raise TypeError( - 'can only inherit from a NamedTuple type and Generic') - bases = tuple(tuple if base is _NamedTuple else base for base in bases) - types = ns.get('__annotations__', {}) - default_names = [] - for field_name in types: - if field_name in ns: - default_names.append(field_name) - elif default_names: - raise TypeError(f"Non-default namedtuple field {field_name} " - f"cannot follow default field" - f"{'s' if len(default_names) > 1 else ''} " - f"{', '.join(default_names)}") - nm_tpl = _make_nmtuple( - typename, types.items(), - defaults=[ns[n] for n in default_names], - module=ns['__module__'] - ) - nm_tpl.__bases__ = bases - if typing.Generic in bases: - if hasattr(typing, '_generic_class_getitem'): # 3.12+ - nm_tpl.__class_getitem__ = classmethod(typing._generic_class_getitem) - else: - class_getitem = typing.Generic.__class_getitem__.__func__ - nm_tpl.__class_getitem__ = classmethod(class_getitem) - # update from user namespace without overriding special namedtuple attributes - for key in ns: - if key in _prohibited_namedtuple_fields: - raise AttributeError("Cannot overwrite NamedTuple attribute " + key) - elif key not in _special_namedtuple_fields and key not in nm_tpl._fields: - setattr(nm_tpl, key, ns[key]) - if typing.Generic in bases: - nm_tpl.__init_subclass__() - return nm_tpl - - _NamedTuple = type.__new__(_NamedTupleMeta, 'NamedTuple', (), {}) - - def _namedtuple_mro_entries(bases): - assert NamedTuple in bases - return (_NamedTuple,) - - @_ensure_subclassable(_namedtuple_mro_entries) - def NamedTuple(typename, fields=_marker, /, **kwargs): - """Typed version of namedtuple. - - Usage:: - - class Employee(NamedTuple): - name: str - id: int - - This is equivalent to:: - - Employee = collections.namedtuple('Employee', ['name', 'id']) - - The resulting class has an extra __annotations__ attribute, giving a - dict that maps field names to types. (The field names are also in - the _fields attribute, which is part of the namedtuple API.) - An alternative equivalent functional syntax is also accepted:: - - Employee = NamedTuple('Employee', [('name', str), ('id', int)]) - """ - if fields is _marker: - if kwargs: - deprecated_thing = "Creating NamedTuple classes using keyword arguments" - deprecation_msg = ( - "{name} is deprecated and will be disallowed in Python {remove}. " - "Use the class-based or functional syntax instead." - ) - else: - deprecated_thing = "Failing to pass a value for the 'fields' parameter" - example = f"`{typename} = NamedTuple({typename!r}, [])`" - deprecation_msg = ( - "{name} is deprecated and will be disallowed in Python {remove}. " - "To create a NamedTuple class with 0 fields " - "using the functional syntax, " - "pass an empty list, e.g. " - ) + example + "." - elif fields is None: - if kwargs: - raise TypeError( - "Cannot pass `None` as the 'fields' parameter " - "and also specify fields using keyword arguments" - ) - else: - deprecated_thing = "Passing `None` as the 'fields' parameter" - example = f"`{typename} = NamedTuple({typename!r}, [])`" - deprecation_msg = ( - "{name} is deprecated and will be disallowed in Python {remove}. " - "To create a NamedTuple class with 0 fields " - "using the functional syntax, " - "pass an empty list, e.g. " - ) + example + "." - elif kwargs: - raise TypeError("Either list of fields or keywords" - " can be provided to NamedTuple, not both") - if fields is _marker or fields is None: - warnings.warn( - deprecation_msg.format(name=deprecated_thing, remove="3.15"), - DeprecationWarning, - stacklevel=2, - ) - fields = kwargs.items() - nt = _make_nmtuple(typename, fields, module=_caller()) - nt.__orig_bases__ = (NamedTuple,) - return nt - - -if hasattr(collections.abc, "Buffer"): - Buffer = collections.abc.Buffer -else: - class Buffer(abc.ABC): - """Base class for classes that implement the buffer protocol. - - The buffer protocol allows Python objects to expose a low-level - memory buffer interface. Before Python 3.12, it is not possible - to implement the buffer protocol in pure Python code, or even - to check whether a class implements the buffer protocol. In - Python 3.12 and higher, the ``__buffer__`` method allows access - to the buffer protocol from Python code, and the - ``collections.abc.Buffer`` ABC allows checking whether a class - implements the buffer protocol. - - To indicate support for the buffer protocol in earlier versions, - inherit from this ABC, either in a stub file or at runtime, - or use ABC registration. This ABC provides no methods, because - there is no Python-accessible methods shared by pre-3.12 buffer - classes. It is useful primarily for static checks. - - """ - - # As a courtesy, register the most common stdlib buffer classes. - Buffer.register(memoryview) - Buffer.register(bytearray) - Buffer.register(bytes) - - -# Backport of types.get_original_bases, available on 3.12+ in CPython -if hasattr(_types, "get_original_bases"): - get_original_bases = _types.get_original_bases -else: - def get_original_bases(cls, /): - """Return the class's "original" bases prior to modification by `__mro_entries__`. - - Examples:: - - from typing import TypeVar, Generic - from typing_extensions import NamedTuple, TypedDict - - T = TypeVar("T") - class Foo(Generic[T]): ... - class Bar(Foo[int], float): ... - class Baz(list[str]): ... - Eggs = NamedTuple("Eggs", [("a", int), ("b", str)]) - Spam = TypedDict("Spam", {"a": int, "b": str}) - - assert get_original_bases(Bar) == (Foo[int], float) - assert get_original_bases(Baz) == (list[str],) - assert get_original_bases(Eggs) == (NamedTuple,) - assert get_original_bases(Spam) == (TypedDict,) - assert get_original_bases(int) == (object,) - """ - try: - return cls.__dict__.get("__orig_bases__", cls.__bases__) - except AttributeError: - raise TypeError( - f'Expected an instance of type, not {type(cls).__name__!r}' - ) from None - - -# NewType is a class on Python 3.10+, making it pickleable -# The error message for subclassing instances of NewType was improved on 3.11+ -if sys.version_info >= (3, 11): - NewType = typing.NewType -else: - class NewType: - """NewType creates simple unique types with almost zero - runtime overhead. NewType(name, tp) is considered a subtype of tp - by static type checkers. At runtime, NewType(name, tp) returns - a dummy callable that simply returns its argument. Usage:: - UserId = NewType('UserId', int) - def name_by_id(user_id: UserId) -> str: - ... - UserId('user') # Fails type check - name_by_id(42) # Fails type check - name_by_id(UserId(42)) # OK - num = UserId(5) + 1 # type: int - """ - - def __call__(self, obj): - return obj - - def __init__(self, name, tp): - self.__qualname__ = name - if '.' in name: - name = name.rpartition('.')[-1] - self.__name__ = name - self.__supertype__ = tp - def_mod = _caller() - if def_mod != 'typing_extensions': - self.__module__ = def_mod - - def __mro_entries__(self, bases): - # We defined __mro_entries__ to get a better error message - # if a user attempts to subclass a NewType instance. bpo-46170 - supercls_name = self.__name__ - - class Dummy: - def __init_subclass__(cls): - subcls_name = cls.__name__ - raise TypeError( - f"Cannot subclass an instance of NewType. " - f"Perhaps you were looking for: " - f"`{subcls_name} = NewType({subcls_name!r}, {supercls_name})`" - ) - - return (Dummy,) - - def __repr__(self): - return f'{self.__module__}.{self.__qualname__}' - - def __reduce__(self): - return self.__qualname__ - - if sys.version_info >= (3, 10): - # PEP 604 methods - # It doesn't make sense to have these methods on Python <3.10 - - def __or__(self, other): - return typing.Union[self, other] - - def __ror__(self, other): - return typing.Union[other, self] - - -if hasattr(typing, "TypeAliasType"): - TypeAliasType = typing.TypeAliasType -else: - def _is_unionable(obj): - """Corresponds to is_unionable() in unionobject.c in CPython.""" - return obj is None or isinstance(obj, ( - type, - _types.GenericAlias, - _types.UnionType, - TypeAliasType, - )) - - class TypeAliasType: - """Create named, parameterized type aliases. - - This provides a backport of the new `type` statement in Python 3.12: - - type ListOrSet[T] = list[T] | set[T] - - is equivalent to: - - T = TypeVar("T") - ListOrSet = TypeAliasType("ListOrSet", list[T] | set[T], type_params=(T,)) - - The name ListOrSet can then be used as an alias for the type it refers to. - - The type_params argument should contain all the type parameters used - in the value of the type alias. If the alias is not generic, this - argument is omitted. - - Static type checkers should only support type aliases declared using - TypeAliasType that follow these rules: - - - The first argument (the name) must be a string literal. - - The TypeAliasType instance must be immediately assigned to a variable - of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid, - as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)'). - - """ - - def __init__(self, name: str, value, *, type_params=()): - if not isinstance(name, str): - raise TypeError("TypeAliasType name must be a string") - self.__value__ = value - self.__type_params__ = type_params - - parameters = [] - for type_param in type_params: - if isinstance(type_param, TypeVarTuple): - parameters.extend(type_param) - else: - parameters.append(type_param) - self.__parameters__ = tuple(parameters) - def_mod = _caller() - if def_mod != 'typing_extensions': - self.__module__ = def_mod - # Setting this attribute closes the TypeAliasType from further modification - self.__name__ = name - - def __setattr__(self, name: str, value: object, /) -> None: - if hasattr(self, "__name__"): - self._raise_attribute_error(name) - super().__setattr__(name, value) - - def __delattr__(self, name: str, /) -> Never: - self._raise_attribute_error(name) - - def _raise_attribute_error(self, name: str) -> Never: - # Match the Python 3.12 error messages exactly - if name == "__name__": - raise AttributeError("readonly attribute") - elif name in {"__value__", "__type_params__", "__parameters__", "__module__"}: - raise AttributeError( - f"attribute '{name}' of 'typing.TypeAliasType' objects " - "is not writable" - ) - else: - raise AttributeError( - f"'typing.TypeAliasType' object has no attribute '{name}'" - ) - - def __repr__(self) -> str: - return self.__name__ - - def __getitem__(self, parameters): - if not isinstance(parameters, tuple): - parameters = (parameters,) - parameters = [ - typing._type_check( - item, f'Subscripting {self.__name__} requires a type.' - ) - for item in parameters - ] - return typing._GenericAlias(self, tuple(parameters)) - - def __reduce__(self): - return self.__name__ - - def __init_subclass__(cls, *args, **kwargs): - raise TypeError( - "type 'typing_extensions.TypeAliasType' is not an acceptable base type" - ) - - # The presence of this method convinces typing._type_check - # that TypeAliasTypes are types. - def __call__(self): - raise TypeError("Type alias is not callable") - - if sys.version_info >= (3, 10): - def __or__(self, right): - # For forward compatibility with 3.12, reject Unions - # that are not accepted by the built-in Union. - if not _is_unionable(right): - return NotImplemented - return typing.Union[self, right] - - def __ror__(self, left): - if not _is_unionable(left): - return NotImplemented - return typing.Union[left, self] - - -if hasattr(typing, "is_protocol"): - is_protocol = typing.is_protocol - get_protocol_members = typing.get_protocol_members -else: - def is_protocol(tp: type, /) -> bool: - """Return True if the given type is a Protocol. - - Example:: - - >>> from typing_extensions import Protocol, is_protocol - >>> class P(Protocol): - ... def a(self) -> str: ... - ... b: int - >>> is_protocol(P) - True - >>> is_protocol(int) - False - """ - return ( - isinstance(tp, type) - and getattr(tp, '_is_protocol', False) - and tp is not Protocol - and tp is not typing.Protocol - ) - - def get_protocol_members(tp: type, /) -> typing.FrozenSet[str]: - """Return the set of members defined in a Protocol. - - Example:: - - >>> from typing_extensions import Protocol, get_protocol_members - >>> class P(Protocol): - ... def a(self) -> str: ... - ... b: int - >>> get_protocol_members(P) - frozenset({'a', 'b'}) - - Raise a TypeError for arguments that are not Protocols. - """ - if not is_protocol(tp): - raise TypeError(f'{tp!r} is not a Protocol') - if hasattr(tp, '__protocol_attrs__'): - return frozenset(tp.__protocol_attrs__) - return frozenset(_get_protocol_attrs(tp)) - - -if hasattr(typing, "Doc"): - Doc = typing.Doc -else: - class Doc: - """Define the documentation of a type annotation using ``Annotated``, to be - used in class attributes, function and method parameters, return values, - and variables. - - The value should be a positional-only string literal to allow static tools - like editors and documentation generators to use it. - - This complements docstrings. - - The string value passed is available in the attribute ``documentation``. - - Example:: - - >>> from typing_extensions import Annotated, Doc - >>> def hi(to: Annotated[str, Doc("Who to say hi to")]) -> None: ... - """ - def __init__(self, documentation: str, /) -> None: - self.documentation = documentation - - def __repr__(self) -> str: - return f"Doc({self.documentation!r})" - - def __hash__(self) -> int: - return hash(self.documentation) - - def __eq__(self, other: object) -> bool: - if not isinstance(other, Doc): - return NotImplemented - return self.documentation == other.documentation - - -# Aliases for items that have always been in typing. -# Explicitly assign these (rather than using `from typing import *` at the top), -# so that we get a CI error if one of these is deleted from typing.py -# in a future version of Python -AbstractSet = typing.AbstractSet -AnyStr = typing.AnyStr -BinaryIO = typing.BinaryIO -Callable = typing.Callable -Collection = typing.Collection -Container = typing.Container -Dict = typing.Dict -ForwardRef = typing.ForwardRef -FrozenSet = typing.FrozenSet -Generator = typing.Generator -Generic = typing.Generic -Hashable = typing.Hashable -IO = typing.IO -ItemsView = typing.ItemsView -Iterable = typing.Iterable -Iterator = typing.Iterator -KeysView = typing.KeysView -List = typing.List -Mapping = typing.Mapping -MappingView = typing.MappingView -Match = typing.Match -MutableMapping = typing.MutableMapping -MutableSequence = typing.MutableSequence -MutableSet = typing.MutableSet -Optional = typing.Optional -Pattern = typing.Pattern -Reversible = typing.Reversible -Sequence = typing.Sequence -Set = typing.Set -Sized = typing.Sized -TextIO = typing.TextIO -Tuple = typing.Tuple -Union = typing.Union -ValuesView = typing.ValuesView -cast = typing.cast -no_type_check = typing.no_type_check -no_type_check_decorator = typing.no_type_check_decorator diff --git a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/INSTALLER b/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a32041e49332e5e81c2d363dc418d68..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/METADATA b/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/METADATA deleted file mode 100644 index a711cb51d8d5e86d95d3b91f47508c5c39744ef7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/METADATA +++ /dev/null @@ -1,158 +0,0 @@ -Metadata-Version: 2.1 -Name: urllib3 -Version: 2.0.6 -Summary: HTTP library with thread-safe connection pooling, file post, and more. -Project-URL: Changelog, https://github.com/urllib3/urllib3/blob/main/CHANGES.rst -Project-URL: Documentation, https://urllib3.readthedocs.io -Project-URL: Code, https://github.com/urllib3/urllib3 -Project-URL: Issue tracker, https://github.com/urllib3/urllib3/issues -Author-email: Andrey Petrov -Maintainer-email: Seth Michael Larson , Quentin Pradet -License-File: LICENSE.txt -Keywords: filepost,http,httplib,https,pooling,ssl,threadsafe,urllib -Classifier: Environment :: Web Environment -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Internet :: WWW/HTTP -Classifier: Topic :: Software Development :: Libraries -Requires-Python: >=3.7 -Provides-Extra: brotli -Requires-Dist: brotli>=1.0.9; platform_python_implementation == 'CPython' and extra == 'brotli' -Requires-Dist: brotlicffi>=0.8.0; platform_python_implementation != 'CPython' and extra == 'brotli' -Provides-Extra: secure -Requires-Dist: certifi; extra == 'secure' -Requires-Dist: cryptography>=1.9; extra == 'secure' -Requires-Dist: idna>=2.0.0; extra == 'secure' -Requires-Dist: pyopenssl>=17.1.0; extra == 'secure' -Requires-Dist: urllib3-secure-extra; extra == 'secure' -Provides-Extra: socks -Requires-Dist: pysocks!=1.5.7,<2.0,>=1.5.6; extra == 'socks' -Provides-Extra: zstd -Requires-Dist: zstandard>=0.18.0; extra == 'zstd' -Description-Content-Type: text/markdown - -

- -![urllib3](https://github.com/urllib3/urllib3/raw/main/docs/_static/banner_github.svg) - -

- -

- PyPI Version - Python Versions - Join our Discord - Coverage Status - Build Status on GitHub - Documentation Status
- OpenSSF Scorecard - SLSA 3 - CII Best Practices -

- -urllib3 is a powerful, *user-friendly* HTTP client for Python. Much of the -Python ecosystem already uses urllib3 and you should too. -urllib3 brings many critical features that are missing from the Python -standard libraries: - -- Thread safety. -- Connection pooling. -- Client-side SSL/TLS verification. -- File uploads with multipart encoding. -- Helpers for retrying requests and dealing with HTTP redirects. -- Support for gzip, deflate, brotli, and zstd encoding. -- Proxy support for HTTP and SOCKS. -- 100% test coverage. - -urllib3 is powerful and easy to use: - -```python3 ->>> import urllib3 ->>> resp = urllib3.request("GET", "http://httpbin.org/robots.txt") ->>> resp.status -200 ->>> resp.data -b"User-agent: *\nDisallow: /deny\n" -``` - -## Installing - -urllib3 can be installed with [pip](https://pip.pypa.io): - -```bash -$ python -m pip install urllib3 -``` - -Alternatively, you can grab the latest source code from [GitHub](https://github.com/urllib3/urllib3): - -```bash -$ git clone https://github.com/urllib3/urllib3.git -$ cd urllib3 -$ pip install . -``` - - -## Documentation - -urllib3 has usage and reference documentation at [urllib3.readthedocs.io](https://urllib3.readthedocs.io). - - -## Community - -urllib3 has a [community Discord channel](https://discord.gg/urllib3) for asking questions and -collaborating with other contributors. Drop by and say hello 👋 - - -## Contributing - -urllib3 happily accepts contributions. Please see our -[contributing documentation](https://urllib3.readthedocs.io/en/latest/contributing.html) -for some tips on getting started. - - -## Security Disclosures - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure with maintainers. - - -## Maintainers - -- [@sethmlarson](https://github.com/sethmlarson) (Seth M. Larson) -- [@pquentin](https://github.com/pquentin) (Quentin Pradet) -- [@theacodes](https://github.com/theacodes) (Thea Flowers) -- [@haikuginger](https://github.com/haikuginger) (Jess Shapiro) -- [@lukasa](https://github.com/lukasa) (Cory Benfield) -- [@sigmavirus24](https://github.com/sigmavirus24) (Ian Stapleton Cordasco) -- [@shazow](https://github.com/shazow) (Andrey Petrov) - -👋 - - -## Sponsorship - -If your company benefits from this library, please consider [sponsoring its -development](https://urllib3.readthedocs.io/en/latest/sponsors.html). - - -## For Enterprise - -Professional support for urllib3 is available as part of the [Tidelift -Subscription][1]. Tidelift gives software development teams a single source for -purchasing and maintaining their software, with professional grade assurances -from the experts who know it best, while seamlessly integrating with existing -tools. - -[1]: https://tidelift.com/subscription/pkg/pypi-urllib3?utm_source=pypi-urllib3&utm_medium=referral&utm_campaign=readme diff --git a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/RECORD b/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/RECORD deleted file mode 100644 index 0a320584bc7f4f9de9078cc1423f6f7ce181980d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/RECORD +++ /dev/null @@ -1,70 +0,0 @@ -urllib3-2.0.6.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -urllib3-2.0.6.dist-info/METADATA,sha256=ww2exZtUcCiooAZZSJ5N6w0Y-Az2zZv3lD-ncq7t2t8,6591 -urllib3-2.0.6.dist-info/RECORD,, -urllib3-2.0.6.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87 -urllib3-2.0.6.dist-info/licenses/LICENSE.txt,sha256=Ew46ZNX91dCWp1JpRjSn2d8oRGnehuVzIQAmgEHj1oY,1093 -urllib3/__init__.py,sha256=OV22EiB-j4tci8776nQPuyOorDZSvsbzlS1_3SP9fmo,5307 -urllib3/__pycache__/__init__.cpython-38.pyc,, -urllib3/__pycache__/_base_connection.cpython-38.pyc,, -urllib3/__pycache__/_collections.cpython-38.pyc,, -urllib3/__pycache__/_request_methods.cpython-38.pyc,, -urllib3/__pycache__/_version.cpython-38.pyc,, -urllib3/__pycache__/connection.cpython-38.pyc,, -urllib3/__pycache__/connectionpool.cpython-38.pyc,, -urllib3/__pycache__/exceptions.cpython-38.pyc,, -urllib3/__pycache__/fields.cpython-38.pyc,, -urllib3/__pycache__/filepost.cpython-38.pyc,, -urllib3/__pycache__/poolmanager.cpython-38.pyc,, -urllib3/__pycache__/response.cpython-38.pyc,, -urllib3/_base_connection.py,sha256=4GpGs3Qa8WU_y6e7UkTteQWLzu8Q8e7O3xEb_Hj2JjI,5652 -urllib3/_collections.py,sha256=GYCDeODxROILJVRL9E9hprePDegUqh5LdggY_9UPBAw,16817 -urllib3/_request_methods.py,sha256=rTM3FfErdUIVfuqGYJvrnI-HLvBePTLDWKdzosJoyx4,7756 -urllib3/_version.py,sha256=qTdpl7WXha7jSdzlsgX5URxgAWJn7J6orP6MEKLG-gw,98 -urllib3/connection.py,sha256=RwaDviX3S_l4GmqITQQAGYLtRtyOee3E1OYkO6Jrx3E,33832 -urllib3/connectionpool.py,sha256=Sj7x6xkQHYe9I4xHBOBgkpeFQXog3nmmsLdtQJU3A4k,42961 -urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -urllib3/contrib/__pycache__/__init__.cpython-38.pyc,, -urllib3/contrib/__pycache__/pyopenssl.cpython-38.pyc,, -urllib3/contrib/__pycache__/securetransport.cpython-38.pyc,, -urllib3/contrib/__pycache__/socks.cpython-38.pyc,, -urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -urllib3/contrib/_securetransport/__pycache__/__init__.cpython-38.pyc,, -urllib3/contrib/_securetransport/__pycache__/bindings.cpython-38.pyc,, -urllib3/contrib/_securetransport/__pycache__/low_level.cpython-38.pyc,, -urllib3/contrib/_securetransport/bindings.py,sha256=N8r6aifbJ-dNS5v-YTPsBl7d0R1GhTi6FiUOdZMGdoo,14452 -urllib3/contrib/_securetransport/low_level.py,sha256=14Dhp_jima5J824obfFX5oBORYiAnULtUJ_TB8CEscY,16220 -urllib3/contrib/pyopenssl.py,sha256=l6Wzpc701s8gDnYg-UriakWuSfJU0vfNMj03V9ycCUc,19171 -urllib3/contrib/securetransport.py,sha256=tDglxxJvySdRih4JsawEKHitPytWUBJ6glrDrje4yM8,34121 -urllib3/contrib/socks.py,sha256=xbqs-P-UHH5L5a_dKvxKetFyV9lKuxkcV9K9Oiyd-gI,7715 -urllib3/exceptions.py,sha256=rOVHX1HOAb_TZwJZTqprLRTNAJQUWnrXDYaR8XBk1tY,9385 -urllib3/fields.py,sha256=XvSMfnSMqeOn9o-6Eb3Fl9MN2MNjiHsmEff_HR5jhEI,11026 -urllib3/filepost.py,sha256=-9qJT11cNGjO9dqnI20-oErZuTvNaM18xZZPCjZSbOE,2395 -urllib3/poolmanager.py,sha256=0StMnGCE-r0vuQygEsTpeaQjEQVBIyBb640rD1Bovfw,22648 -urllib3/py.typed,sha256=UaCuPFa3H8UAakbt-5G8SPacldTOGvJv18pPjUJ5gDY,93 -urllib3/response.py,sha256=kLnppZw7Syn-70drmHhy1jvEvd-xvHNmrNiVaCZKL54,39999 -urllib3/util/__init__.py,sha256=WsFx_PdwI25do8AcdW-Xj3rvUrI3NsgeQULp6S0sPeU,1051 -urllib3/util/__pycache__/__init__.cpython-38.pyc,, -urllib3/util/__pycache__/connection.cpython-38.pyc,, -urllib3/util/__pycache__/proxy.cpython-38.pyc,, -urllib3/util/__pycache__/request.cpython-38.pyc,, -urllib3/util/__pycache__/response.cpython-38.pyc,, -urllib3/util/__pycache__/retry.cpython-38.pyc,, -urllib3/util/__pycache__/ssl_.cpython-38.pyc,, -urllib3/util/__pycache__/ssl_match_hostname.cpython-38.pyc,, -urllib3/util/__pycache__/ssltransport.cpython-38.pyc,, -urllib3/util/__pycache__/timeout.cpython-38.pyc,, -urllib3/util/__pycache__/url.cpython-38.pyc,, -urllib3/util/__pycache__/util.cpython-38.pyc,, -urllib3/util/__pycache__/wait.cpython-38.pyc,, -urllib3/util/connection.py,sha256=QeUUEuNmhznpuKNPL-B0IVOkMdMCu8oJX62OC0Vpzug,4462 -urllib3/util/proxy.py,sha256=seP8-Q5B6bB0dMtwPj-YcZZQ30vHuLqRu-tI0JZ2fzs,1148 -urllib3/util/request.py,sha256=5w7bjcFNwXffvFyqogq8KmJhKagKdiiD5EusYH-rxgU,8083 -urllib3/util/response.py,sha256=vQE639uoEhj1vpjEdxu5lNIhJCSUZkd7pqllUI0BZOA,3374 -urllib3/util/retry.py,sha256=WB-7x1m7fQH_-Qqtrk2OGvz93GvBTxc-pRn8Vf3p4mg,18384 -urllib3/util/ssl_.py,sha256=uCuWbQhktyOwdHI91g4Ri3CD4SloVInYA58G6vKpqcw,19244 -urllib3/util/ssl_match_hostname.py,sha256=gaWqixoYtQ_GKO8fcRGFj3VXeMoqyxQQuUTPgWeiL_M,5812 -urllib3/util/ssltransport.py,sha256=jGmDxXI-nPBfMib-kjksI5TxUQyooYpekd0sjo1ibdg,9045 -urllib3/util/timeout.py,sha256=iXlm7hqG7ij7y27z23giTzsjyg3KIiVyjhsQsiWLDHA,10529 -urllib3/util/url.py,sha256=wHORhp80RAXyTlAIkTqLFzSrkU7J34ZDxX-tN65MBZk,15213 -urllib3/util/util.py,sha256=j3lbZK1jPyiwD34T8IgJzdWEZVT-4E-0vYIJi9UjeNA,1146 -urllib3/util/wait.py,sha256=_ph8IrUR3sqPqi0OopQgJUlH4wzkGeM5CiyA7XGGtmI,4423 diff --git a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/WHEEL b/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/WHEEL deleted file mode 100644 index ba1a8af28bcccdacebb8c22dfda1537447a1a58a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: hatchling 1.18.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/licenses/LICENSE.txt b/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/licenses/LICENSE.txt deleted file mode 100644 index e6183d0276b26c5b87aecccf8d0d5bcd7b1148d4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3-2.0.6.dist-info/licenses/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2008-2020 Andrey Petrov and contributors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/venv/lib/python3.8/site-packages/urllib3/__init__.py b/venv/lib/python3.8/site-packages/urllib3/__init__.py deleted file mode 100644 index 32c1f0025f0205192e3962e0d4633ef38fd8d2de..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/__init__.py +++ /dev/null @@ -1,166 +0,0 @@ -""" -Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more -""" - -from __future__ import annotations - -# Set default logging handler to avoid "No handler found" warnings. -import logging -import typing -import warnings -from logging import NullHandler - -from . import exceptions -from ._base_connection import _TYPE_BODY -from ._collections import HTTPHeaderDict -from ._version import __version__ -from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url -from .filepost import _TYPE_FIELDS, encode_multipart_formdata -from .poolmanager import PoolManager, ProxyManager, proxy_from_url -from .response import BaseHTTPResponse, HTTPResponse -from .util.request import make_headers -from .util.retry import Retry -from .util.timeout import Timeout - -# Ensure that Python is compiled with OpenSSL 1.1.1+ -# If the 'ssl' module isn't available at all that's -# fine, we only care if the module is available. -try: - import ssl -except ImportError: - pass -else: - if not ssl.OPENSSL_VERSION.startswith("OpenSSL "): # Defensive: - warnings.warn( - "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently " - f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION!r}. " - "See: https://github.com/urllib3/urllib3/issues/3020", - exceptions.NotOpenSSLWarning, - ) - elif ssl.OPENSSL_VERSION_INFO < (1, 1, 1): # Defensive: - raise ImportError( - "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently " - f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION!r}. " - "See: https://github.com/urllib3/urllib3/issues/2168" - ) - -# === NOTE TO REPACKAGERS AND VENDORS === -# Please delete this block, this logic is only -# for urllib3 being distributed via PyPI. -# See: https://github.com/urllib3/urllib3/issues/2680 -try: - import urllib3_secure_extra # type: ignore # noqa: F401 -except ModuleNotFoundError: - pass -else: - warnings.warn( - "'urllib3[secure]' extra is deprecated and will be removed " - "in urllib3 v2.1.0. Read more in this issue: " - "https://github.com/urllib3/urllib3/issues/2680", - category=DeprecationWarning, - stacklevel=2, - ) - -__author__ = "Andrey Petrov (andrey.petrov@shazow.net)" -__license__ = "MIT" -__version__ = __version__ - -__all__ = ( - "HTTPConnectionPool", - "HTTPHeaderDict", - "HTTPSConnectionPool", - "PoolManager", - "ProxyManager", - "HTTPResponse", - "Retry", - "Timeout", - "add_stderr_logger", - "connection_from_url", - "disable_warnings", - "encode_multipart_formdata", - "make_headers", - "proxy_from_url", - "request", - "BaseHTTPResponse", -) - -logging.getLogger(__name__).addHandler(NullHandler()) - - -def add_stderr_logger( - level: int = logging.DEBUG, -) -> logging.StreamHandler[typing.TextIO]: - """ - Helper for quickly adding a StreamHandler to the logger. Useful for - debugging. - - Returns the handler after adding it. - """ - # This method needs to be in this __init__.py to get the __name__ correct - # even if urllib3 is vendored within another package. - logger = logging.getLogger(__name__) - handler = logging.StreamHandler() - handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(message)s")) - logger.addHandler(handler) - logger.setLevel(level) - logger.debug("Added a stderr logging handler to logger: %s", __name__) - return handler - - -# ... Clean up. -del NullHandler - - -# All warning filters *must* be appended unless you're really certain that they -# shouldn't be: otherwise, it's very hard for users to use most Python -# mechanisms to silence them. -# SecurityWarning's always go off by default. -warnings.simplefilter("always", exceptions.SecurityWarning, append=True) -# InsecurePlatformWarning's don't vary between requests, so we keep it default. -warnings.simplefilter("default", exceptions.InsecurePlatformWarning, append=True) - - -def disable_warnings(category: type[Warning] = exceptions.HTTPWarning) -> None: - """ - Helper for quickly disabling all urllib3 warnings. - """ - warnings.simplefilter("ignore", category) - - -_DEFAULT_POOL = PoolManager() - - -def request( - method: str, - url: str, - *, - body: _TYPE_BODY | None = None, - fields: _TYPE_FIELDS | None = None, - headers: typing.Mapping[str, str] | None = None, - preload_content: bool | None = True, - decode_content: bool | None = True, - redirect: bool | None = True, - retries: Retry | bool | int | None = None, - timeout: Timeout | float | int | None = 3, - json: typing.Any | None = None, -) -> BaseHTTPResponse: - """ - A convenience, top-level request method. It uses a module-global ``PoolManager`` instance. - Therefore, its side effects could be shared across dependencies relying on it. - To avoid side effects create a new ``PoolManager`` instance and use it instead. - The method does not accept low-level ``**urlopen_kw`` keyword arguments. - """ - - return _DEFAULT_POOL.request( - method, - url, - body=body, - fields=fields, - headers=headers, - preload_content=preload_content, - decode_content=decode_content, - redirect=redirect, - retries=retries, - timeout=timeout, - json=json, - ) diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 914524793733e2b616c66bd110108eaf284fb57b..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/_base_connection.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/_base_connection.cpython-38.pyc deleted file mode 100644 index a445baec1b4e8dee1c9aa2f1c991713451d2c800..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/_base_connection.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/_collections.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/_collections.cpython-38.pyc deleted file mode 100644 index 918ab3eb5e98b7905f0b0c21672a63ba8a7a45f1..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/_collections.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/_request_methods.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/_request_methods.cpython-38.pyc deleted file mode 100644 index 6bb9e37996ef5ea1f3c4cdc177e207f1227419cc..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/_request_methods.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/_version.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/_version.cpython-38.pyc deleted file mode 100644 index 4d89dc0eab4a8a7e5cececbceb0453d8e8cdb01e..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/_version.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/connection.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/connection.cpython-38.pyc deleted file mode 100644 index 90b2b6e6c83748a89b8e366077f3c2ac454629ac..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/connection.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/connectionpool.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/connectionpool.cpython-38.pyc deleted file mode 100644 index 6e650b2413aba185f309c0b2ca2aed9c193a36e7..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/connectionpool.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/exceptions.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/exceptions.cpython-38.pyc deleted file mode 100644 index c30a0e3b621c7feb3584f5fe994f1e2aed642eab..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/exceptions.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/fields.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/fields.cpython-38.pyc deleted file mode 100644 index 652d2d5702b200a5cb325dc435320ace0da7380d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/fields.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/filepost.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/filepost.cpython-38.pyc deleted file mode 100644 index ab571a34f580cf45abdf7c8daf98f5155455a0fc..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/filepost.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/poolmanager.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/poolmanager.cpython-38.pyc deleted file mode 100644 index 423f9825a59f9376e15d9f30d42276e8ef8920ae..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/poolmanager.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/__pycache__/response.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/__pycache__/response.cpython-38.pyc deleted file mode 100644 index 54c4e37f3311f0f4d6a55863c533294afa46dd2f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/__pycache__/response.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/_base_connection.py b/venv/lib/python3.8/site-packages/urllib3/_base_connection.py deleted file mode 100644 index 25b633af257f20c87424ec8a341cbd6f5797b804..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/_base_connection.py +++ /dev/null @@ -1,173 +0,0 @@ -from __future__ import annotations - -import typing - -from .util.connection import _TYPE_SOCKET_OPTIONS -from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT -from .util.url import Url - -_TYPE_BODY = typing.Union[bytes, typing.IO[typing.Any], typing.Iterable[bytes], str] - - -class ProxyConfig(typing.NamedTuple): - ssl_context: ssl.SSLContext | None - use_forwarding_for_https: bool - assert_hostname: None | str | Literal[False] - assert_fingerprint: str | None - - -class _ResponseOptions(typing.NamedTuple): - # TODO: Remove this in favor of a better - # HTTP request/response lifecycle tracking. - request_method: str - request_url: str - preload_content: bool - decode_content: bool - enforce_content_length: bool - - -if typing.TYPE_CHECKING: - import ssl - - from typing_extensions import Literal, Protocol - - from .response import BaseHTTPResponse - - class BaseHTTPConnection(Protocol): - default_port: typing.ClassVar[int] - default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] - - host: str - port: int - timeout: None | ( - float - ) # Instance doesn't store _DEFAULT_TIMEOUT, must be resolved. - blocksize: int - source_address: tuple[str, int] | None - socket_options: _TYPE_SOCKET_OPTIONS | None - - proxy: Url | None - proxy_config: ProxyConfig | None - - is_verified: bool - proxy_is_verified: bool | None - - def __init__( - self, - host: str, - port: int | None = None, - *, - timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - source_address: tuple[str, int] | None = None, - blocksize: int = 8192, - socket_options: _TYPE_SOCKET_OPTIONS | None = ..., - proxy: Url | None = None, - proxy_config: ProxyConfig | None = None, - ) -> None: - ... - - def set_tunnel( - self, - host: str, - port: int | None = None, - headers: typing.Mapping[str, str] | None = None, - scheme: str = "http", - ) -> None: - ... - - def connect(self) -> None: - ... - - def request( - self, - method: str, - url: str, - body: _TYPE_BODY | None = None, - headers: typing.Mapping[str, str] | None = None, - # We know *at least* botocore is depending on the order of the - # first 3 parameters so to be safe we only mark the later ones - # as keyword-only to ensure we have space to extend. - *, - chunked: bool = False, - preload_content: bool = True, - decode_content: bool = True, - enforce_content_length: bool = True, - ) -> None: - ... - - def getresponse(self) -> BaseHTTPResponse: - ... - - def close(self) -> None: - ... - - @property - def is_closed(self) -> bool: - """Whether the connection either is brand new or has been previously closed. - If this property is True then both ``is_connected`` and ``has_connected_to_proxy`` - properties must be False. - """ - - @property - def is_connected(self) -> bool: - """Whether the connection is actively connected to any origin (proxy or target)""" - - @property - def has_connected_to_proxy(self) -> bool: - """Whether the connection has successfully connected to its proxy. - This returns False if no proxy is in use. Used to determine whether - errors are coming from the proxy layer or from tunnelling to the target origin. - """ - - class BaseHTTPSConnection(BaseHTTPConnection, Protocol): - default_port: typing.ClassVar[int] - default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] - - # Certificate verification methods - cert_reqs: int | str | None - assert_hostname: None | str | Literal[False] - assert_fingerprint: str | None - ssl_context: ssl.SSLContext | None - - # Trusted CAs - ca_certs: str | None - ca_cert_dir: str | None - ca_cert_data: None | str | bytes - - # TLS version - ssl_minimum_version: int | None - ssl_maximum_version: int | None - ssl_version: int | str | None # Deprecated - - # Client certificates - cert_file: str | None - key_file: str | None - key_password: str | None - - def __init__( - self, - host: str, - port: int | None = None, - *, - timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - source_address: tuple[str, int] | None = None, - blocksize: int = 16384, - socket_options: _TYPE_SOCKET_OPTIONS | None = ..., - proxy: Url | None = None, - proxy_config: ProxyConfig | None = None, - cert_reqs: int | str | None = None, - assert_hostname: None | str | Literal[False] = None, - assert_fingerprint: str | None = None, - server_hostname: str | None = None, - ssl_context: ssl.SSLContext | None = None, - ca_certs: str | None = None, - ca_cert_dir: str | None = None, - ca_cert_data: None | str | bytes = None, - ssl_minimum_version: int | None = None, - ssl_maximum_version: int | None = None, - ssl_version: int | str | None = None, # Deprecated - cert_file: str | None = None, - key_file: str | None = None, - key_password: str | None = None, - ) -> None: - ... diff --git a/venv/lib/python3.8/site-packages/urllib3/_collections.py b/venv/lib/python3.8/site-packages/urllib3/_collections.py deleted file mode 100644 index 7f9dca7fa81595e967c48b6c5b3c9ec6e33a93a2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/_collections.py +++ /dev/null @@ -1,463 +0,0 @@ -from __future__ import annotations - -import typing -from collections import OrderedDict -from enum import Enum, auto -from threading import RLock - -if typing.TYPE_CHECKING: - # We can only import Protocol if TYPE_CHECKING because it's a development - # dependency, and is not available at runtime. - from typing_extensions import Protocol - - class HasGettableStringKeys(Protocol): - def keys(self) -> typing.Iterator[str]: - ... - - def __getitem__(self, key: str) -> str: - ... - - -__all__ = ["RecentlyUsedContainer", "HTTPHeaderDict"] - - -# Key type -_KT = typing.TypeVar("_KT") -# Value type -_VT = typing.TypeVar("_VT") -# Default type -_DT = typing.TypeVar("_DT") - -ValidHTTPHeaderSource = typing.Union[ - "HTTPHeaderDict", - typing.Mapping[str, str], - typing.Iterable[typing.Tuple[str, str]], - "HasGettableStringKeys", -] - - -class _Sentinel(Enum): - not_passed = auto() - - -def ensure_can_construct_http_header_dict( - potential: object, -) -> ValidHTTPHeaderSource | None: - if isinstance(potential, HTTPHeaderDict): - return potential - elif isinstance(potential, typing.Mapping): - # Full runtime checking of the contents of a Mapping is expensive, so for the - # purposes of typechecking, we assume that any Mapping is the right shape. - return typing.cast(typing.Mapping[str, str], potential) - elif isinstance(potential, typing.Iterable): - # Similarly to Mapping, full runtime checking of the contents of an Iterable is - # expensive, so for the purposes of typechecking, we assume that any Iterable - # is the right shape. - return typing.cast(typing.Iterable[typing.Tuple[str, str]], potential) - elif hasattr(potential, "keys") and hasattr(potential, "__getitem__"): - return typing.cast("HasGettableStringKeys", potential) - else: - return None - - -class RecentlyUsedContainer(typing.Generic[_KT, _VT], typing.MutableMapping[_KT, _VT]): - """ - Provides a thread-safe dict-like container which maintains up to - ``maxsize`` keys while throwing away the least-recently-used keys beyond - ``maxsize``. - - :param maxsize: - Maximum number of recent elements to retain. - - :param dispose_func: - Every time an item is evicted from the container, - ``dispose_func(value)`` is called. Callback which will get called - """ - - _container: typing.OrderedDict[_KT, _VT] - _maxsize: int - dispose_func: typing.Callable[[_VT], None] | None - lock: RLock - - def __init__( - self, - maxsize: int = 10, - dispose_func: typing.Callable[[_VT], None] | None = None, - ) -> None: - super().__init__() - self._maxsize = maxsize - self.dispose_func = dispose_func - self._container = OrderedDict() - self.lock = RLock() - - def __getitem__(self, key: _KT) -> _VT: - # Re-insert the item, moving it to the end of the eviction line. - with self.lock: - item = self._container.pop(key) - self._container[key] = item - return item - - def __setitem__(self, key: _KT, value: _VT) -> None: - evicted_item = None - with self.lock: - # Possibly evict the existing value of 'key' - try: - # If the key exists, we'll overwrite it, which won't change the - # size of the pool. Because accessing a key should move it to - # the end of the eviction line, we pop it out first. - evicted_item = key, self._container.pop(key) - self._container[key] = value - except KeyError: - # When the key does not exist, we insert the value first so that - # evicting works in all cases, including when self._maxsize is 0 - self._container[key] = value - if len(self._container) > self._maxsize: - # If we didn't evict an existing value, and we've hit our maximum - # size, then we have to evict the least recently used item from - # the beginning of the container. - evicted_item = self._container.popitem(last=False) - - # After releasing the lock on the pool, dispose of any evicted value. - if evicted_item is not None and self.dispose_func: - _, evicted_value = evicted_item - self.dispose_func(evicted_value) - - def __delitem__(self, key: _KT) -> None: - with self.lock: - value = self._container.pop(key) - - if self.dispose_func: - self.dispose_func(value) - - def __len__(self) -> int: - with self.lock: - return len(self._container) - - def __iter__(self) -> typing.NoReturn: - raise NotImplementedError( - "Iteration over this class is unlikely to be threadsafe." - ) - - def clear(self) -> None: - with self.lock: - # Copy pointers to all values, then wipe the mapping - values = list(self._container.values()) - self._container.clear() - - if self.dispose_func: - for value in values: - self.dispose_func(value) - - def keys(self) -> set[_KT]: # type: ignore[override] - with self.lock: - return set(self._container.keys()) - - -class HTTPHeaderDictItemView(typing.Set[typing.Tuple[str, str]]): - """ - HTTPHeaderDict is unusual for a Mapping[str, str] in that it has two modes of - address. - - If we directly try to get an item with a particular name, we will get a string - back that is the concatenated version of all the values: - - >>> d['X-Header-Name'] - 'Value1, Value2, Value3' - - However, if we iterate over an HTTPHeaderDict's items, we will optionally combine - these values based on whether combine=True was called when building up the dictionary - - >>> d = HTTPHeaderDict({"A": "1", "B": "foo"}) - >>> d.add("A", "2", combine=True) - >>> d.add("B", "bar") - >>> list(d.items()) - [ - ('A', '1, 2'), - ('B', 'foo'), - ('B', 'bar'), - ] - - This class conforms to the interface required by the MutableMapping ABC while - also giving us the nonstandard iteration behavior we want; items with duplicate - keys, ordered by time of first insertion. - """ - - _headers: HTTPHeaderDict - - def __init__(self, headers: HTTPHeaderDict) -> None: - self._headers = headers - - def __len__(self) -> int: - return len(list(self._headers.iteritems())) - - def __iter__(self) -> typing.Iterator[tuple[str, str]]: - return self._headers.iteritems() - - def __contains__(self, item: object) -> bool: - if isinstance(item, tuple) and len(item) == 2: - passed_key, passed_val = item - if isinstance(passed_key, str) and isinstance(passed_val, str): - return self._headers._has_value_for_header(passed_key, passed_val) - return False - - -class HTTPHeaderDict(typing.MutableMapping[str, str]): - """ - :param headers: - An iterable of field-value pairs. Must not contain multiple field names - when compared case-insensitively. - - :param kwargs: - Additional field-value pairs to pass in to ``dict.update``. - - A ``dict`` like container for storing HTTP Headers. - - Field names are stored and compared case-insensitively in compliance with - RFC 7230. Iteration provides the first case-sensitive key seen for each - case-insensitive pair. - - Using ``__setitem__`` syntax overwrites fields that compare equal - case-insensitively in order to maintain ``dict``'s api. For fields that - compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add`` - in a loop. - - If multiple fields that are equal case-insensitively are passed to the - constructor or ``.update``, the behavior is undefined and some will be - lost. - - >>> headers = HTTPHeaderDict() - >>> headers.add('Set-Cookie', 'foo=bar') - >>> headers.add('set-cookie', 'baz=quxx') - >>> headers['content-length'] = '7' - >>> headers['SET-cookie'] - 'foo=bar, baz=quxx' - >>> headers['Content-Length'] - '7' - """ - - _container: typing.MutableMapping[str, list[str]] - - def __init__(self, headers: ValidHTTPHeaderSource | None = None, **kwargs: str): - super().__init__() - self._container = {} # 'dict' is insert-ordered in Python 3.7+ - if headers is not None: - if isinstance(headers, HTTPHeaderDict): - self._copy_from(headers) - else: - self.extend(headers) - if kwargs: - self.extend(kwargs) - - def __setitem__(self, key: str, val: str) -> None: - # avoid a bytes/str comparison by decoding before httplib - if isinstance(key, bytes): - key = key.decode("latin-1") - self._container[key.lower()] = [key, val] - - def __getitem__(self, key: str) -> str: - val = self._container[key.lower()] - return ", ".join(val[1:]) - - def __delitem__(self, key: str) -> None: - del self._container[key.lower()] - - def __contains__(self, key: object) -> bool: - if isinstance(key, str): - return key.lower() in self._container - return False - - def setdefault(self, key: str, default: str = "") -> str: - return super().setdefault(key, default) - - def __eq__(self, other: object) -> bool: - maybe_constructable = ensure_can_construct_http_header_dict(other) - if maybe_constructable is None: - return False - else: - other_as_http_header_dict = type(self)(maybe_constructable) - - return {k.lower(): v for k, v in self.itermerged()} == { - k.lower(): v for k, v in other_as_http_header_dict.itermerged() - } - - def __ne__(self, other: object) -> bool: - return not self.__eq__(other) - - def __len__(self) -> int: - return len(self._container) - - def __iter__(self) -> typing.Iterator[str]: - # Only provide the originally cased names - for vals in self._container.values(): - yield vals[0] - - def discard(self, key: str) -> None: - try: - del self[key] - except KeyError: - pass - - def add(self, key: str, val: str, *, combine: bool = False) -> None: - """Adds a (name, value) pair, doesn't overwrite the value if it already - exists. - - If this is called with combine=True, instead of adding a new header value - as a distinct item during iteration, this will instead append the value to - any existing header value with a comma. If no existing header value exists - for the key, then the value will simply be added, ignoring the combine parameter. - - >>> headers = HTTPHeaderDict(foo='bar') - >>> headers.add('Foo', 'baz') - >>> headers['foo'] - 'bar, baz' - >>> list(headers.items()) - [('foo', 'bar'), ('foo', 'baz')] - >>> headers.add('foo', 'quz', combine=True) - >>> list(headers.items()) - [('foo', 'bar, baz, quz')] - """ - # avoid a bytes/str comparison by decoding before httplib - if isinstance(key, bytes): - key = key.decode("latin-1") - key_lower = key.lower() - new_vals = [key, val] - # Keep the common case aka no item present as fast as possible - vals = self._container.setdefault(key_lower, new_vals) - if new_vals is not vals: - # if there are values here, then there is at least the initial - # key/value pair - assert len(vals) >= 2 - if combine: - vals[-1] = vals[-1] + ", " + val - else: - vals.append(val) - - def extend(self, *args: ValidHTTPHeaderSource, **kwargs: str) -> None: - """Generic import function for any type of header-like object. - Adapted version of MutableMapping.update in order to insert items - with self.add instead of self.__setitem__ - """ - if len(args) > 1: - raise TypeError( - f"extend() takes at most 1 positional arguments ({len(args)} given)" - ) - other = args[0] if len(args) >= 1 else () - - if isinstance(other, HTTPHeaderDict): - for key, val in other.iteritems(): - self.add(key, val) - elif isinstance(other, typing.Mapping): - for key, val in other.items(): - self.add(key, val) - elif isinstance(other, typing.Iterable): - other = typing.cast(typing.Iterable[typing.Tuple[str, str]], other) - for key, value in other: - self.add(key, value) - elif hasattr(other, "keys") and hasattr(other, "__getitem__"): - # THIS IS NOT A TYPESAFE BRANCH - # In this branch, the object has a `keys` attr but is not a Mapping or any of - # the other types indicated in the method signature. We do some stuff with - # it as though it partially implements the Mapping interface, but we're not - # doing that stuff safely AT ALL. - for key in other.keys(): - self.add(key, other[key]) - - for key, value in kwargs.items(): - self.add(key, value) - - @typing.overload - def getlist(self, key: str) -> list[str]: - ... - - @typing.overload - def getlist(self, key: str, default: _DT) -> list[str] | _DT: - ... - - def getlist( - self, key: str, default: _Sentinel | _DT = _Sentinel.not_passed - ) -> list[str] | _DT: - """Returns a list of all the values for the named field. Returns an - empty list if the key doesn't exist.""" - try: - vals = self._container[key.lower()] - except KeyError: - if default is _Sentinel.not_passed: - # _DT is unbound; empty list is instance of List[str] - return [] - # _DT is bound; default is instance of _DT - return default - else: - # _DT may or may not be bound; vals[1:] is instance of List[str], which - # meets our external interface requirement of `Union[List[str], _DT]`. - return vals[1:] - - # Backwards compatibility for httplib - getheaders = getlist - getallmatchingheaders = getlist - iget = getlist - - # Backwards compatibility for http.cookiejar - get_all = getlist - - def __repr__(self) -> str: - return f"{type(self).__name__}({dict(self.itermerged())})" - - def _copy_from(self, other: HTTPHeaderDict) -> None: - for key in other: - val = other.getlist(key) - self._container[key.lower()] = [key, *val] - - def copy(self) -> HTTPHeaderDict: - clone = type(self)() - clone._copy_from(self) - return clone - - def iteritems(self) -> typing.Iterator[tuple[str, str]]: - """Iterate over all header lines, including duplicate ones.""" - for key in self: - vals = self._container[key.lower()] - for val in vals[1:]: - yield vals[0], val - - def itermerged(self) -> typing.Iterator[tuple[str, str]]: - """Iterate over all headers, merging duplicate ones together.""" - for key in self: - val = self._container[key.lower()] - yield val[0], ", ".join(val[1:]) - - def items(self) -> HTTPHeaderDictItemView: # type: ignore[override] - return HTTPHeaderDictItemView(self) - - def _has_value_for_header(self, header_name: str, potential_value: str) -> bool: - if header_name in self: - return potential_value in self._container[header_name.lower()][1:] - return False - - def __ior__(self, other: object) -> HTTPHeaderDict: - # Supports extending a header dict in-place using operator |= - # combining items with add instead of __setitem__ - maybe_constructable = ensure_can_construct_http_header_dict(other) - if maybe_constructable is None: - return NotImplemented - self.extend(maybe_constructable) - return self - - def __or__(self, other: object) -> HTTPHeaderDict: - # Supports merging header dicts using operator | - # combining items with add instead of __setitem__ - maybe_constructable = ensure_can_construct_http_header_dict(other) - if maybe_constructable is None: - return NotImplemented - result = self.copy() - result.extend(maybe_constructable) - return result - - def __ror__(self, other: object) -> HTTPHeaderDict: - # Supports merging header dicts using operator | when other is on left side - # combining items with add instead of __setitem__ - maybe_constructable = ensure_can_construct_http_header_dict(other) - if maybe_constructable is None: - return NotImplemented - result = type(self)(maybe_constructable) - result.extend(self) - return result diff --git a/venv/lib/python3.8/site-packages/urllib3/_request_methods.py b/venv/lib/python3.8/site-packages/urllib3/_request_methods.py deleted file mode 100644 index 1d0f3465adf51558bd3b5111aad11fd4fc189433..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/_request_methods.py +++ /dev/null @@ -1,217 +0,0 @@ -from __future__ import annotations - -import json as _json -import typing -from urllib.parse import urlencode - -from ._base_connection import _TYPE_BODY -from ._collections import HTTPHeaderDict -from .filepost import _TYPE_FIELDS, encode_multipart_formdata -from .response import BaseHTTPResponse - -__all__ = ["RequestMethods"] - -_TYPE_ENCODE_URL_FIELDS = typing.Union[ - typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]], - typing.Mapping[str, typing.Union[str, bytes]], -] - - -class RequestMethods: - """ - Convenience mixin for classes who implement a :meth:`urlopen` method, such - as :class:`urllib3.HTTPConnectionPool` and - :class:`urllib3.PoolManager`. - - Provides behavior for making common types of HTTP request methods and - decides which type of request field encoding to use. - - Specifically, - - :meth:`.request_encode_url` is for sending requests whose fields are - encoded in the URL (such as GET, HEAD, DELETE). - - :meth:`.request_encode_body` is for sending requests whose fields are - encoded in the *body* of the request using multipart or www-form-urlencoded - (such as for POST, PUT, PATCH). - - :meth:`.request` is for making any kind of request, it will look up the - appropriate encoding format and use one of the above two methods to make - the request. - - Initializer parameters: - - :param headers: - Headers to include with all requests, unless other headers are given - explicitly. - """ - - _encode_url_methods = {"DELETE", "GET", "HEAD", "OPTIONS"} - - def __init__(self, headers: typing.Mapping[str, str] | None = None) -> None: - self.headers = headers or {} - - def urlopen( - self, - method: str, - url: str, - body: _TYPE_BODY | None = None, - headers: typing.Mapping[str, str] | None = None, - encode_multipart: bool = True, - multipart_boundary: str | None = None, - **kw: typing.Any, - ) -> BaseHTTPResponse: # Abstract - raise NotImplementedError( - "Classes extending RequestMethods must implement " - "their own ``urlopen`` method." - ) - - def request( - self, - method: str, - url: str, - body: _TYPE_BODY | None = None, - fields: _TYPE_FIELDS | None = None, - headers: typing.Mapping[str, str] | None = None, - json: typing.Any | None = None, - **urlopen_kw: typing.Any, - ) -> BaseHTTPResponse: - """ - Make a request using :meth:`urlopen` with the appropriate encoding of - ``fields`` based on the ``method`` used. - - This is a convenience method that requires the least amount of manual - effort. It can be used in most situations, while still having the - option to drop down to more specific methods when necessary, such as - :meth:`request_encode_url`, :meth:`request_encode_body`, - or even the lowest level :meth:`urlopen`. - """ - method = method.upper() - - if json is not None and body is not None: - raise TypeError( - "request got values for both 'body' and 'json' parameters which are mutually exclusive" - ) - - if json is not None: - if headers is None: - headers = self.headers.copy() # type: ignore - if not ("content-type" in map(str.lower, headers.keys())): - headers["Content-Type"] = "application/json" # type: ignore - - body = _json.dumps(json, separators=(",", ":"), ensure_ascii=False).encode( - "utf-8" - ) - - if body is not None: - urlopen_kw["body"] = body - - if method in self._encode_url_methods: - return self.request_encode_url( - method, - url, - fields=fields, # type: ignore[arg-type] - headers=headers, - **urlopen_kw, - ) - else: - return self.request_encode_body( - method, url, fields=fields, headers=headers, **urlopen_kw - ) - - def request_encode_url( - self, - method: str, - url: str, - fields: _TYPE_ENCODE_URL_FIELDS | None = None, - headers: typing.Mapping[str, str] | None = None, - **urlopen_kw: str, - ) -> BaseHTTPResponse: - """ - Make a request using :meth:`urlopen` with the ``fields`` encoded in - the url. This is useful for request methods like GET, HEAD, DELETE, etc. - """ - if headers is None: - headers = self.headers - - extra_kw: dict[str, typing.Any] = {"headers": headers} - extra_kw.update(urlopen_kw) - - if fields: - url += "?" + urlencode(fields) - - return self.urlopen(method, url, **extra_kw) - - def request_encode_body( - self, - method: str, - url: str, - fields: _TYPE_FIELDS | None = None, - headers: typing.Mapping[str, str] | None = None, - encode_multipart: bool = True, - multipart_boundary: str | None = None, - **urlopen_kw: str, - ) -> BaseHTTPResponse: - """ - Make a request using :meth:`urlopen` with the ``fields`` encoded in - the body. This is useful for request methods like POST, PUT, PATCH, etc. - - When ``encode_multipart=True`` (default), then - :func:`urllib3.encode_multipart_formdata` is used to encode - the payload with the appropriate content type. Otherwise - :func:`urllib.parse.urlencode` is used with the - 'application/x-www-form-urlencoded' content type. - - Multipart encoding must be used when posting files, and it's reasonably - safe to use it in other times too. However, it may break request - signing, such as with OAuth. - - Supports an optional ``fields`` parameter of key/value strings AND - key/filetuple. A filetuple is a (filename, data, MIME type) tuple where - the MIME type is optional. For example:: - - fields = { - 'foo': 'bar', - 'fakefile': ('foofile.txt', 'contents of foofile'), - 'realfile': ('barfile.txt', open('realfile').read()), - 'typedfile': ('bazfile.bin', open('bazfile').read(), - 'image/jpeg'), - 'nonamefile': 'contents of nonamefile field', - } - - When uploading a file, providing a filename (the first parameter of the - tuple) is optional but recommended to best mimic behavior of browsers. - - Note that if ``headers`` are supplied, the 'Content-Type' header will - be overwritten because it depends on the dynamic random boundary string - which is used to compose the body of the request. The random boundary - string can be explicitly set with the ``multipart_boundary`` parameter. - """ - if headers is None: - headers = self.headers - - extra_kw: dict[str, typing.Any] = {"headers": HTTPHeaderDict(headers)} - body: bytes | str - - if fields: - if "body" in urlopen_kw: - raise TypeError( - "request got values for both 'fields' and 'body', can only specify one." - ) - - if encode_multipart: - body, content_type = encode_multipart_formdata( - fields, boundary=multipart_boundary - ) - else: - body, content_type = ( - urlencode(fields), # type: ignore[arg-type] - "application/x-www-form-urlencoded", - ) - - extra_kw["body"] = body - extra_kw["headers"].setdefault("Content-Type", content_type) - - extra_kw.update(urlopen_kw) - - return self.urlopen(method, url, **extra_kw) diff --git a/venv/lib/python3.8/site-packages/urllib3/_version.py b/venv/lib/python3.8/site-packages/urllib3/_version.py deleted file mode 100644 index 2d0d43089692080c2268333381c138936ff2aeb7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/_version.py +++ /dev/null @@ -1,4 +0,0 @@ -# This file is protected via CODEOWNERS -from __future__ import annotations - -__version__ = "2.0.6" diff --git a/venv/lib/python3.8/site-packages/urllib3/connection.py b/venv/lib/python3.8/site-packages/urllib3/connection.py deleted file mode 100644 index 4a71225ce6e5bc81ffa6c79160411016f3a65240..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/connection.py +++ /dev/null @@ -1,906 +0,0 @@ -from __future__ import annotations - -import datetime -import logging -import os -import re -import socket -import sys -import typing -import warnings -from http.client import HTTPConnection as _HTTPConnection -from http.client import HTTPException as HTTPException # noqa: F401 -from http.client import ResponseNotReady -from socket import timeout as SocketTimeout - -if typing.TYPE_CHECKING: - from typing_extensions import Literal - - from .response import HTTPResponse - from .util.ssl_ import _TYPE_PEER_CERT_RET_DICT - from .util.ssltransport import SSLTransport - -from ._collections import HTTPHeaderDict -from .util.response import assert_header_parsing -from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT, Timeout -from .util.util import to_str -from .util.wait import wait_for_read - -try: # Compiled with SSL? - import ssl - - BaseSSLError = ssl.SSLError -except (ImportError, AttributeError): - ssl = None # type: ignore[assignment] - - class BaseSSLError(BaseException): # type: ignore[no-redef] - pass - - -from ._base_connection import _TYPE_BODY -from ._base_connection import ProxyConfig as ProxyConfig -from ._base_connection import _ResponseOptions as _ResponseOptions -from ._version import __version__ -from .exceptions import ( - ConnectTimeoutError, - HeaderParsingError, - NameResolutionError, - NewConnectionError, - ProxyError, - SystemTimeWarning, -) -from .util import SKIP_HEADER, SKIPPABLE_HEADERS, connection, ssl_ -from .util.request import body_to_chunks -from .util.ssl_ import assert_fingerprint as _assert_fingerprint -from .util.ssl_ import ( - create_urllib3_context, - is_ipaddress, - resolve_cert_reqs, - resolve_ssl_version, - ssl_wrap_socket, -) -from .util.ssl_match_hostname import CertificateError, match_hostname -from .util.url import Url - -# Not a no-op, we're adding this to the namespace so it can be imported. -ConnectionError = ConnectionError -BrokenPipeError = BrokenPipeError - - -log = logging.getLogger(__name__) - -port_by_scheme = {"http": 80, "https": 443} - -# When it comes time to update this value as a part of regular maintenance -# (ie test_recent_date is failing) update it to ~6 months before the current date. -RECENT_DATE = datetime.date(2022, 1, 1) - -_CONTAINS_CONTROL_CHAR_RE = re.compile(r"[^-!#$%&'*+.^_`|~0-9a-zA-Z]") - -_HAS_SYS_AUDIT = hasattr(sys, "audit") - - -class HTTPConnection(_HTTPConnection): - """ - Based on :class:`http.client.HTTPConnection` but provides an extra constructor - backwards-compatibility layer between older and newer Pythons. - - Additional keyword parameters are used to configure attributes of the connection. - Accepted parameters include: - - - ``source_address``: Set the source address for the current connection. - - ``socket_options``: Set specific options on the underlying socket. If not specified, then - defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling - Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy. - - For example, if you wish to enable TCP Keep Alive in addition to the defaults, - you might pass: - - .. code-block:: python - - HTTPConnection.default_socket_options + [ - (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), - ] - - Or you may want to disable the defaults by passing an empty list (e.g., ``[]``). - """ - - default_port: typing.ClassVar[int] = port_by_scheme["http"] # type: ignore[misc] - - #: Disable Nagle's algorithm by default. - #: ``[(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)]`` - default_socket_options: typing.ClassVar[connection._TYPE_SOCKET_OPTIONS] = [ - (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) - ] - - #: Whether this connection verifies the host's certificate. - is_verified: bool = False - - #: Whether this proxy connection verified the proxy host's certificate. - # If no proxy is currently connected to the value will be ``None``. - proxy_is_verified: bool | None = None - - blocksize: int - source_address: tuple[str, int] | None - socket_options: connection._TYPE_SOCKET_OPTIONS | None - - _has_connected_to_proxy: bool - _response_options: _ResponseOptions | None - _tunnel_host: str | None - _tunnel_port: int | None - _tunnel_scheme: str | None - - def __init__( - self, - host: str, - port: int | None = None, - *, - timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - source_address: tuple[str, int] | None = None, - blocksize: int = 16384, - socket_options: None - | (connection._TYPE_SOCKET_OPTIONS) = default_socket_options, - proxy: Url | None = None, - proxy_config: ProxyConfig | None = None, - ) -> None: - super().__init__( - host=host, - port=port, - timeout=Timeout.resolve_default_timeout(timeout), - source_address=source_address, - blocksize=blocksize, - ) - self.socket_options = socket_options - self.proxy = proxy - self.proxy_config = proxy_config - - self._has_connected_to_proxy = False - self._response_options = None - self._tunnel_host: str | None = None - self._tunnel_port: int | None = None - self._tunnel_scheme: str | None = None - - # https://github.com/python/mypy/issues/4125 - # Mypy treats this as LSP violation, which is considered a bug. - # If `host` is made a property it violates LSP, because a writeable attribute is overridden with a read-only one. - # However, there is also a `host` setter so LSP is not violated. - # Potentially, a `@host.deleter` might be needed depending on how this issue will be fixed. - @property - def host(self) -> str: - """ - Getter method to remove any trailing dots that indicate the hostname is an FQDN. - - In general, SSL certificates don't include the trailing dot indicating a - fully-qualified domain name, and thus, they don't validate properly when - checked against a domain name that includes the dot. In addition, some - servers may not expect to receive the trailing dot when provided. - - However, the hostname with trailing dot is critical to DNS resolution; doing a - lookup with the trailing dot will properly only resolve the appropriate FQDN, - whereas a lookup without a trailing dot will search the system's search domain - list. Thus, it's important to keep the original host around for use only in - those cases where it's appropriate (i.e., when doing DNS lookup to establish the - actual TCP connection across which we're going to send HTTP requests). - """ - return self._dns_host.rstrip(".") - - @host.setter - def host(self, value: str) -> None: - """ - Setter for the `host` property. - - We assume that only urllib3 uses the _dns_host attribute; httplib itself - only uses `host`, and it seems reasonable that other libraries follow suit. - """ - self._dns_host = value - - def _new_conn(self) -> socket.socket: - """Establish a socket connection and set nodelay settings on it. - - :return: New socket connection. - """ - try: - sock = connection.create_connection( - (self._dns_host, self.port), - self.timeout, - source_address=self.source_address, - socket_options=self.socket_options, - ) - except socket.gaierror as e: - raise NameResolutionError(self.host, self, e) from e - except SocketTimeout as e: - raise ConnectTimeoutError( - self, - f"Connection to {self.host} timed out. (connect timeout={self.timeout})", - ) from e - - except OSError as e: - raise NewConnectionError( - self, f"Failed to establish a new connection: {e}" - ) from e - - # Audit hooks are only available in Python 3.8+ - if _HAS_SYS_AUDIT: - sys.audit("http.client.connect", self, self.host, self.port) - - return sock - - def set_tunnel( - self, - host: str, - port: int | None = None, - headers: typing.Mapping[str, str] | None = None, - scheme: str = "http", - ) -> None: - if scheme not in ("http", "https"): - raise ValueError( - f"Invalid proxy scheme for tunneling: {scheme!r}, must be either 'http' or 'https'" - ) - super().set_tunnel(host, port=port, headers=headers) - self._tunnel_scheme = scheme - - def connect(self) -> None: - self.sock = self._new_conn() - if self._tunnel_host: - # If we're tunneling it means we're connected to our proxy. - self._has_connected_to_proxy = True - - # TODO: Fix tunnel so it doesn't depend on self.sock state. - self._tunnel() # type: ignore[attr-defined] - - # If there's a proxy to be connected to we are fully connected. - # This is set twice (once above and here) due to forwarding proxies - # not using tunnelling. - self._has_connected_to_proxy = bool(self.proxy) - - @property - def is_closed(self) -> bool: - return self.sock is None - - @property - def is_connected(self) -> bool: - if self.sock is None: - return False - return not wait_for_read(self.sock, timeout=0.0) - - @property - def has_connected_to_proxy(self) -> bool: - return self._has_connected_to_proxy - - def close(self) -> None: - try: - super().close() - finally: - # Reset all stateful properties so connection - # can be re-used without leaking prior configs. - self.sock = None - self.is_verified = False - self.proxy_is_verified = None - self._has_connected_to_proxy = False - self._response_options = None - self._tunnel_host = None - self._tunnel_port = None - self._tunnel_scheme = None - - def putrequest( - self, - method: str, - url: str, - skip_host: bool = False, - skip_accept_encoding: bool = False, - ) -> None: - """""" - # Empty docstring because the indentation of CPython's implementation - # is broken but we don't want this method in our documentation. - match = _CONTAINS_CONTROL_CHAR_RE.search(method) - if match: - raise ValueError( - f"Method cannot contain non-token characters {method!r} (found at least {match.group()!r})" - ) - - return super().putrequest( - method, url, skip_host=skip_host, skip_accept_encoding=skip_accept_encoding - ) - - def putheader(self, header: str, *values: str) -> None: - """""" - if not any(isinstance(v, str) and v == SKIP_HEADER for v in values): - super().putheader(header, *values) - elif to_str(header.lower()) not in SKIPPABLE_HEADERS: - skippable_headers = "', '".join( - [str.title(header) for header in sorted(SKIPPABLE_HEADERS)] - ) - raise ValueError( - f"urllib3.util.SKIP_HEADER only supports '{skippable_headers}'" - ) - - # `request` method's signature intentionally violates LSP. - # urllib3's API is different from `http.client.HTTPConnection` and the subclassing is only incidental. - def request( # type: ignore[override] - self, - method: str, - url: str, - body: _TYPE_BODY | None = None, - headers: typing.Mapping[str, str] | None = None, - *, - chunked: bool = False, - preload_content: bool = True, - decode_content: bool = True, - enforce_content_length: bool = True, - ) -> None: - # Update the inner socket's timeout value to send the request. - # This only triggers if the connection is re-used. - if self.sock is not None: - self.sock.settimeout(self.timeout) - - # Store these values to be fed into the HTTPResponse - # object later. TODO: Remove this in favor of a real - # HTTP lifecycle mechanism. - - # We have to store these before we call .request() - # because sometimes we can still salvage a response - # off the wire even if we aren't able to completely - # send the request body. - self._response_options = _ResponseOptions( - request_method=method, - request_url=url, - preload_content=preload_content, - decode_content=decode_content, - enforce_content_length=enforce_content_length, - ) - - if headers is None: - headers = {} - header_keys = frozenset(to_str(k.lower()) for k in headers) - skip_accept_encoding = "accept-encoding" in header_keys - skip_host = "host" in header_keys - self.putrequest( - method, url, skip_accept_encoding=skip_accept_encoding, skip_host=skip_host - ) - - # Transform the body into an iterable of sendall()-able chunks - # and detect if an explicit Content-Length is doable. - chunks_and_cl = body_to_chunks(body, method=method, blocksize=self.blocksize) - chunks = chunks_and_cl.chunks - content_length = chunks_and_cl.content_length - - # When chunked is explicit set to 'True' we respect that. - if chunked: - if "transfer-encoding" not in header_keys: - self.putheader("Transfer-Encoding", "chunked") - else: - # Detect whether a framing mechanism is already in use. If so - # we respect that value, otherwise we pick chunked vs content-length - # depending on the type of 'body'. - if "content-length" in header_keys: - chunked = False - elif "transfer-encoding" in header_keys: - chunked = True - - # Otherwise we go off the recommendation of 'body_to_chunks()'. - else: - chunked = False - if content_length is None: - if chunks is not None: - chunked = True - self.putheader("Transfer-Encoding", "chunked") - else: - self.putheader("Content-Length", str(content_length)) - - # Now that framing headers are out of the way we send all the other headers. - if "user-agent" not in header_keys: - self.putheader("User-Agent", _get_default_user_agent()) - for header, value in headers.items(): - self.putheader(header, value) - self.endheaders() - - # If we're given a body we start sending that in chunks. - if chunks is not None: - for chunk in chunks: - # Sending empty chunks isn't allowed for TE: chunked - # as it indicates the end of the body. - if not chunk: - continue - if isinstance(chunk, str): - chunk = chunk.encode("utf-8") - if chunked: - self.send(b"%x\r\n%b\r\n" % (len(chunk), chunk)) - else: - self.send(chunk) - - # Regardless of whether we have a body or not, if we're in - # chunked mode we want to send an explicit empty chunk. - if chunked: - self.send(b"0\r\n\r\n") - - def request_chunked( - self, - method: str, - url: str, - body: _TYPE_BODY | None = None, - headers: typing.Mapping[str, str] | None = None, - ) -> None: - """ - Alternative to the common request method, which sends the - body with chunked encoding and not as one block - """ - warnings.warn( - "HTTPConnection.request_chunked() is deprecated and will be removed " - "in urllib3 v2.1.0. Instead use HTTPConnection.request(..., chunked=True).", - category=DeprecationWarning, - stacklevel=2, - ) - self.request(method, url, body=body, headers=headers, chunked=True) - - def getresponse( # type: ignore[override] - self, - ) -> HTTPResponse: - """ - Get the response from the server. - - If the HTTPConnection is in the correct state, returns an instance of HTTPResponse or of whatever object is returned by the response_class variable. - - If a request has not been sent or if a previous response has not be handled, ResponseNotReady is raised. If the HTTP response indicates that the connection should be closed, then it will be closed before the response is returned. When the connection is closed, the underlying socket is closed. - """ - # Raise the same error as http.client.HTTPConnection - if self._response_options is None: - raise ResponseNotReady() - - # Reset this attribute for being used again. - resp_options = self._response_options - self._response_options = None - - # Since the connection's timeout value may have been updated - # we need to set the timeout on the socket. - self.sock.settimeout(self.timeout) - - # This is needed here to avoid circular import errors - from .response import HTTPResponse - - # Get the response from http.client.HTTPConnection - httplib_response = super().getresponse() - - try: - assert_header_parsing(httplib_response.msg) - except (HeaderParsingError, TypeError) as hpe: - log.warning( - "Failed to parse headers (url=%s): %s", - _url_from_connection(self, resp_options.request_url), - hpe, - exc_info=True, - ) - - headers = HTTPHeaderDict(httplib_response.msg.items()) - - response = HTTPResponse( - body=httplib_response, - headers=headers, - status=httplib_response.status, - version=httplib_response.version, - reason=httplib_response.reason, - preload_content=resp_options.preload_content, - decode_content=resp_options.decode_content, - original_response=httplib_response, - enforce_content_length=resp_options.enforce_content_length, - request_method=resp_options.request_method, - request_url=resp_options.request_url, - ) - return response - - -class HTTPSConnection(HTTPConnection): - """ - Many of the parameters to this constructor are passed to the underlying SSL - socket by means of :py:func:`urllib3.util.ssl_wrap_socket`. - """ - - default_port = port_by_scheme["https"] # type: ignore[misc] - - cert_reqs: int | str | None = None - ca_certs: str | None = None - ca_cert_dir: str | None = None - ca_cert_data: None | str | bytes = None - ssl_version: int | str | None = None - ssl_minimum_version: int | None = None - ssl_maximum_version: int | None = None - assert_fingerprint: str | None = None - - def __init__( - self, - host: str, - port: int | None = None, - *, - timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - source_address: tuple[str, int] | None = None, - blocksize: int = 16384, - socket_options: None - | (connection._TYPE_SOCKET_OPTIONS) = HTTPConnection.default_socket_options, - proxy: Url | None = None, - proxy_config: ProxyConfig | None = None, - cert_reqs: int | str | None = None, - assert_hostname: None | str | Literal[False] = None, - assert_fingerprint: str | None = None, - server_hostname: str | None = None, - ssl_context: ssl.SSLContext | None = None, - ca_certs: str | None = None, - ca_cert_dir: str | None = None, - ca_cert_data: None | str | bytes = None, - ssl_minimum_version: int | None = None, - ssl_maximum_version: int | None = None, - ssl_version: int | str | None = None, # Deprecated - cert_file: str | None = None, - key_file: str | None = None, - key_password: str | None = None, - ) -> None: - super().__init__( - host, - port=port, - timeout=timeout, - source_address=source_address, - blocksize=blocksize, - socket_options=socket_options, - proxy=proxy, - proxy_config=proxy_config, - ) - - self.key_file = key_file - self.cert_file = cert_file - self.key_password = key_password - self.ssl_context = ssl_context - self.server_hostname = server_hostname - self.assert_hostname = assert_hostname - self.assert_fingerprint = assert_fingerprint - self.ssl_version = ssl_version - self.ssl_minimum_version = ssl_minimum_version - self.ssl_maximum_version = ssl_maximum_version - self.ca_certs = ca_certs and os.path.expanduser(ca_certs) - self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) - self.ca_cert_data = ca_cert_data - - # cert_reqs depends on ssl_context so calculate last. - if cert_reqs is None: - if self.ssl_context is not None: - cert_reqs = self.ssl_context.verify_mode - else: - cert_reqs = resolve_cert_reqs(None) - self.cert_reqs = cert_reqs - - def set_cert( - self, - key_file: str | None = None, - cert_file: str | None = None, - cert_reqs: int | str | None = None, - key_password: str | None = None, - ca_certs: str | None = None, - assert_hostname: None | str | Literal[False] = None, - assert_fingerprint: str | None = None, - ca_cert_dir: str | None = None, - ca_cert_data: None | str | bytes = None, - ) -> None: - """ - This method should only be called once, before the connection is used. - """ - warnings.warn( - "HTTPSConnection.set_cert() is deprecated and will be removed " - "in urllib3 v2.1.0. Instead provide the parameters to the " - "HTTPSConnection constructor.", - category=DeprecationWarning, - stacklevel=2, - ) - - # If cert_reqs is not provided we'll assume CERT_REQUIRED unless we also - # have an SSLContext object in which case we'll use its verify_mode. - if cert_reqs is None: - if self.ssl_context is not None: - cert_reqs = self.ssl_context.verify_mode - else: - cert_reqs = resolve_cert_reqs(None) - - self.key_file = key_file - self.cert_file = cert_file - self.cert_reqs = cert_reqs - self.key_password = key_password - self.assert_hostname = assert_hostname - self.assert_fingerprint = assert_fingerprint - self.ca_certs = ca_certs and os.path.expanduser(ca_certs) - self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) - self.ca_cert_data = ca_cert_data - - def connect(self) -> None: - sock: socket.socket | ssl.SSLSocket - self.sock = sock = self._new_conn() - server_hostname: str = self.host - tls_in_tls = False - - # Do we need to establish a tunnel? - if self._tunnel_host is not None: - # We're tunneling to an HTTPS origin so need to do TLS-in-TLS. - if self._tunnel_scheme == "https": - self.sock = sock = self._connect_tls_proxy(self.host, sock) - tls_in_tls = True - - # If we're tunneling it means we're connected to our proxy. - self._has_connected_to_proxy = True - - self._tunnel() # type: ignore[attr-defined] - # Override the host with the one we're requesting data from. - server_hostname = self._tunnel_host - - if self.server_hostname is not None: - server_hostname = self.server_hostname - - is_time_off = datetime.date.today() < RECENT_DATE - if is_time_off: - warnings.warn( - ( - f"System time is way off (before {RECENT_DATE}). This will probably " - "lead to SSL verification errors" - ), - SystemTimeWarning, - ) - - sock_and_verified = _ssl_wrap_socket_and_match_hostname( - sock=sock, - cert_reqs=self.cert_reqs, - ssl_version=self.ssl_version, - ssl_minimum_version=self.ssl_minimum_version, - ssl_maximum_version=self.ssl_maximum_version, - ca_certs=self.ca_certs, - ca_cert_dir=self.ca_cert_dir, - ca_cert_data=self.ca_cert_data, - cert_file=self.cert_file, - key_file=self.key_file, - key_password=self.key_password, - server_hostname=server_hostname, - ssl_context=self.ssl_context, - tls_in_tls=tls_in_tls, - assert_hostname=self.assert_hostname, - assert_fingerprint=self.assert_fingerprint, - ) - self.sock = sock_and_verified.socket - self.is_verified = sock_and_verified.is_verified - - # If there's a proxy to be connected to we are fully connected. - # This is set twice (once above and here) due to forwarding proxies - # not using tunnelling. - self._has_connected_to_proxy = bool(self.proxy) - - def _connect_tls_proxy(self, hostname: str, sock: socket.socket) -> ssl.SSLSocket: - """ - Establish a TLS connection to the proxy using the provided SSL context. - """ - # `_connect_tls_proxy` is called when self._tunnel_host is truthy. - proxy_config = typing.cast(ProxyConfig, self.proxy_config) - ssl_context = proxy_config.ssl_context - sock_and_verified = _ssl_wrap_socket_and_match_hostname( - sock, - cert_reqs=self.cert_reqs, - ssl_version=self.ssl_version, - ssl_minimum_version=self.ssl_minimum_version, - ssl_maximum_version=self.ssl_maximum_version, - ca_certs=self.ca_certs, - ca_cert_dir=self.ca_cert_dir, - ca_cert_data=self.ca_cert_data, - server_hostname=hostname, - ssl_context=ssl_context, - assert_hostname=proxy_config.assert_hostname, - assert_fingerprint=proxy_config.assert_fingerprint, - # Features that aren't implemented for proxies yet: - cert_file=None, - key_file=None, - key_password=None, - tls_in_tls=False, - ) - self.proxy_is_verified = sock_and_verified.is_verified - return sock_and_verified.socket # type: ignore[return-value] - - -class _WrappedAndVerifiedSocket(typing.NamedTuple): - """ - Wrapped socket and whether the connection is - verified after the TLS handshake - """ - - socket: ssl.SSLSocket | SSLTransport - is_verified: bool - - -def _ssl_wrap_socket_and_match_hostname( - sock: socket.socket, - *, - cert_reqs: None | str | int, - ssl_version: None | str | int, - ssl_minimum_version: int | None, - ssl_maximum_version: int | None, - cert_file: str | None, - key_file: str | None, - key_password: str | None, - ca_certs: str | None, - ca_cert_dir: str | None, - ca_cert_data: None | str | bytes, - assert_hostname: None | str | Literal[False], - assert_fingerprint: str | None, - server_hostname: str | None, - ssl_context: ssl.SSLContext | None, - tls_in_tls: bool = False, -) -> _WrappedAndVerifiedSocket: - """Logic for constructing an SSLContext from all TLS parameters, passing - that down into ssl_wrap_socket, and then doing certificate verification - either via hostname or fingerprint. This function exists to guarantee - that both proxies and targets have the same behavior when connecting via TLS. - """ - default_ssl_context = False - if ssl_context is None: - default_ssl_context = True - context = create_urllib3_context( - ssl_version=resolve_ssl_version(ssl_version), - ssl_minimum_version=ssl_minimum_version, - ssl_maximum_version=ssl_maximum_version, - cert_reqs=resolve_cert_reqs(cert_reqs), - ) - else: - context = ssl_context - - context.verify_mode = resolve_cert_reqs(cert_reqs) - - # In some cases, we want to verify hostnames ourselves - if ( - # `ssl` can't verify fingerprints or alternate hostnames - assert_fingerprint - or assert_hostname - # assert_hostname can be set to False to disable hostname checking - or assert_hostname is False - # We still support OpenSSL 1.0.2, which prevents us from verifying - # hostnames easily: https://github.com/pyca/pyopenssl/pull/933 - or ssl_.IS_PYOPENSSL - or not ssl_.HAS_NEVER_CHECK_COMMON_NAME - ): - context.check_hostname = False - - # Try to load OS default certs if none are given. - # We need to do the hasattr() check for our custom - # pyOpenSSL and SecureTransport SSLContext objects - # because neither support load_default_certs(). - if ( - not ca_certs - and not ca_cert_dir - and not ca_cert_data - and default_ssl_context - and hasattr(context, "load_default_certs") - ): - context.load_default_certs() - - # Ensure that IPv6 addresses are in the proper format and don't have a - # scope ID. Python's SSL module fails to recognize scoped IPv6 addresses - # and interprets them as DNS hostnames. - if server_hostname is not None: - normalized = server_hostname.strip("[]") - if "%" in normalized: - normalized = normalized[: normalized.rfind("%")] - if is_ipaddress(normalized): - server_hostname = normalized - - ssl_sock = ssl_wrap_socket( - sock=sock, - keyfile=key_file, - certfile=cert_file, - key_password=key_password, - ca_certs=ca_certs, - ca_cert_dir=ca_cert_dir, - ca_cert_data=ca_cert_data, - server_hostname=server_hostname, - ssl_context=context, - tls_in_tls=tls_in_tls, - ) - - try: - if assert_fingerprint: - _assert_fingerprint( - ssl_sock.getpeercert(binary_form=True), assert_fingerprint - ) - elif ( - context.verify_mode != ssl.CERT_NONE - and not context.check_hostname - and assert_hostname is not False - ): - cert: _TYPE_PEER_CERT_RET_DICT = ssl_sock.getpeercert() # type: ignore[assignment] - - # Need to signal to our match_hostname whether to use 'commonName' or not. - # If we're using our own constructed SSLContext we explicitly set 'False' - # because PyPy hard-codes 'True' from SSLContext.hostname_checks_common_name. - if default_ssl_context: - hostname_checks_common_name = False - else: - hostname_checks_common_name = ( - getattr(context, "hostname_checks_common_name", False) or False - ) - - _match_hostname( - cert, - assert_hostname or server_hostname, # type: ignore[arg-type] - hostname_checks_common_name, - ) - - return _WrappedAndVerifiedSocket( - socket=ssl_sock, - is_verified=context.verify_mode == ssl.CERT_REQUIRED - or bool(assert_fingerprint), - ) - except BaseException: - ssl_sock.close() - raise - - -def _match_hostname( - cert: _TYPE_PEER_CERT_RET_DICT | None, - asserted_hostname: str, - hostname_checks_common_name: bool = False, -) -> None: - # Our upstream implementation of ssl.match_hostname() - # only applies this normalization to IP addresses so it doesn't - # match DNS SANs so we do the same thing! - stripped_hostname = asserted_hostname.strip("[]") - if is_ipaddress(stripped_hostname): - asserted_hostname = stripped_hostname - - try: - match_hostname(cert, asserted_hostname, hostname_checks_common_name) - except CertificateError as e: - log.warning( - "Certificate did not match expected hostname: %s. Certificate: %s", - asserted_hostname, - cert, - ) - # Add cert to exception and reraise so client code can inspect - # the cert when catching the exception, if they want to - e._peer_cert = cert # type: ignore[attr-defined] - raise - - -def _wrap_proxy_error(err: Exception, proxy_scheme: str | None) -> ProxyError: - # Look for the phrase 'wrong version number', if found - # then we should warn the user that we're very sure that - # this proxy is HTTP-only and they have a configuration issue. - error_normalized = " ".join(re.split("[^a-z]", str(err).lower())) - is_likely_http_proxy = ( - "wrong version number" in error_normalized - or "unknown protocol" in error_normalized - ) - http_proxy_warning = ( - ". Your proxy appears to only use HTTP and not HTTPS, " - "try changing your proxy URL to be HTTP. See: " - "https://urllib3.readthedocs.io/en/latest/advanced-usage.html" - "#https-proxy-error-http-proxy" - ) - new_err = ProxyError( - f"Unable to connect to proxy" - f"{http_proxy_warning if is_likely_http_proxy and proxy_scheme == 'https' else ''}", - err, - ) - new_err.__cause__ = err - return new_err - - -def _get_default_user_agent() -> str: - return f"python-urllib3/{__version__}" - - -class DummyConnection: - """Used to detect a failed ConnectionCls import.""" - - -if not ssl: - HTTPSConnection = DummyConnection # type: ignore[misc, assignment] # noqa: F811 - - -VerifiedHTTPSConnection = HTTPSConnection - - -def _url_from_connection( - conn: HTTPConnection | HTTPSConnection, path: str | None = None -) -> str: - """Returns the URL from a given connection. This is mainly used for testing and logging.""" - - scheme = "https" if isinstance(conn, HTTPSConnection) else "http" - - return Url(scheme=scheme, host=conn.host, port=conn.port, path=path).url diff --git a/venv/lib/python3.8/site-packages/urllib3/connectionpool.py b/venv/lib/python3.8/site-packages/urllib3/connectionpool.py deleted file mode 100644 index 2479405bd59dc291562b7cdf731d90fb2767c3c8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/connectionpool.py +++ /dev/null @@ -1,1178 +0,0 @@ -from __future__ import annotations - -import errno -import logging -import queue -import sys -import typing -import warnings -import weakref -from socket import timeout as SocketTimeout -from types import TracebackType - -from ._base_connection import _TYPE_BODY -from ._request_methods import RequestMethods -from .connection import ( - BaseSSLError, - BrokenPipeError, - DummyConnection, - HTTPConnection, - HTTPException, - HTTPSConnection, - ProxyConfig, - _wrap_proxy_error, -) -from .connection import port_by_scheme as port_by_scheme -from .exceptions import ( - ClosedPoolError, - EmptyPoolError, - FullPoolError, - HostChangedError, - InsecureRequestWarning, - LocationValueError, - MaxRetryError, - NewConnectionError, - ProtocolError, - ProxyError, - ReadTimeoutError, - SSLError, - TimeoutError, -) -from .response import BaseHTTPResponse -from .util.connection import is_connection_dropped -from .util.proxy import connection_requires_http_tunnel -from .util.request import _TYPE_BODY_POSITION, set_file_position -from .util.retry import Retry -from .util.ssl_match_hostname import CertificateError -from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_DEFAULT, Timeout -from .util.url import Url, _encode_target -from .util.url import _normalize_host as normalize_host -from .util.url import parse_url -from .util.util import to_str - -if typing.TYPE_CHECKING: - import ssl - - from typing_extensions import Literal - - from ._base_connection import BaseHTTPConnection, BaseHTTPSConnection - -log = logging.getLogger(__name__) - -_TYPE_TIMEOUT = typing.Union[Timeout, float, _TYPE_DEFAULT, None] - -_SelfT = typing.TypeVar("_SelfT") - - -# Pool objects -class ConnectionPool: - """ - Base class for all connection pools, such as - :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. - - .. note:: - ConnectionPool.urlopen() does not normalize or percent-encode target URIs - which is useful if your target server doesn't support percent-encoded - target URIs. - """ - - scheme: str | None = None - QueueCls = queue.LifoQueue - - def __init__(self, host: str, port: int | None = None) -> None: - if not host: - raise LocationValueError("No host specified.") - - self.host = _normalize_host(host, scheme=self.scheme) - self.port = port - - # This property uses 'normalize_host()' (not '_normalize_host()') - # to avoid removing square braces around IPv6 addresses. - # This value is sent to `HTTPConnection.set_tunnel()` if called - # because square braces are required for HTTP CONNECT tunneling. - self._tunnel_host = normalize_host(host, scheme=self.scheme).lower() - - def __str__(self) -> str: - return f"{type(self).__name__}(host={self.host!r}, port={self.port!r})" - - def __enter__(self: _SelfT) -> _SelfT: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> Literal[False]: - self.close() - # Return False to re-raise any potential exceptions - return False - - def close(self) -> None: - """ - Close all pooled connections and disable the pool. - """ - - -# This is taken from http://hg.python.org/cpython/file/7aaba721ebc0/Lib/socket.py#l252 -_blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK} - - -class HTTPConnectionPool(ConnectionPool, RequestMethods): - """ - Thread-safe connection pool for one host. - - :param host: - Host used for this HTTP Connection (e.g. "localhost"), passed into - :class:`http.client.HTTPConnection`. - - :param port: - Port used for this HTTP Connection (None is equivalent to 80), passed - into :class:`http.client.HTTPConnection`. - - :param timeout: - Socket timeout in seconds for each individual connection. This can - be a float or integer, which sets the timeout for the HTTP request, - or an instance of :class:`urllib3.util.Timeout` which gives you more - fine-grained control over request timeouts. After the constructor has - been parsed, this is always a `urllib3.util.Timeout` object. - - :param maxsize: - Number of connections to save that can be reused. More than 1 is useful - in multithreaded situations. If ``block`` is set to False, more - connections will be created but they will not be saved once they've - been used. - - :param block: - If set to True, no more than ``maxsize`` connections will be used at - a time. When no free connections are available, the call will block - until a connection has been released. This is a useful side effect for - particular multithreaded situations where one does not want to use more - than maxsize connections per host to prevent flooding. - - :param headers: - Headers to include with all requests, unless other headers are given - explicitly. - - :param retries: - Retry configuration to use by default with requests in this pool. - - :param _proxy: - Parsed proxy URL, should not be used directly, instead, see - :class:`urllib3.ProxyManager` - - :param _proxy_headers: - A dictionary with proxy headers, should not be used directly, - instead, see :class:`urllib3.ProxyManager` - - :param \\**conn_kw: - Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`, - :class:`urllib3.connection.HTTPSConnection` instances. - """ - - scheme = "http" - ConnectionCls: ( - type[BaseHTTPConnection] | type[BaseHTTPSConnection] - ) = HTTPConnection - - def __init__( - self, - host: str, - port: int | None = None, - timeout: _TYPE_TIMEOUT | None = _DEFAULT_TIMEOUT, - maxsize: int = 1, - block: bool = False, - headers: typing.Mapping[str, str] | None = None, - retries: Retry | bool | int | None = None, - _proxy: Url | None = None, - _proxy_headers: typing.Mapping[str, str] | None = None, - _proxy_config: ProxyConfig | None = None, - **conn_kw: typing.Any, - ): - ConnectionPool.__init__(self, host, port) - RequestMethods.__init__(self, headers) - - if not isinstance(timeout, Timeout): - timeout = Timeout.from_float(timeout) - - if retries is None: - retries = Retry.DEFAULT - - self.timeout = timeout - self.retries = retries - - self.pool: queue.LifoQueue[typing.Any] | None = self.QueueCls(maxsize) - self.block = block - - self.proxy = _proxy - self.proxy_headers = _proxy_headers or {} - self.proxy_config = _proxy_config - - # Fill the queue up so that doing get() on it will block properly - for _ in range(maxsize): - self.pool.put(None) - - # These are mostly for testing and debugging purposes. - self.num_connections = 0 - self.num_requests = 0 - self.conn_kw = conn_kw - - if self.proxy: - # Enable Nagle's algorithm for proxies, to avoid packet fragmentation. - # We cannot know if the user has added default socket options, so we cannot replace the - # list. - self.conn_kw.setdefault("socket_options", []) - - self.conn_kw["proxy"] = self.proxy - self.conn_kw["proxy_config"] = self.proxy_config - - # Do not pass 'self' as callback to 'finalize'. - # Then the 'finalize' would keep an endless living (leak) to self. - # By just passing a reference to the pool allows the garbage collector - # to free self if nobody else has a reference to it. - pool = self.pool - - # Close all the HTTPConnections in the pool before the - # HTTPConnectionPool object is garbage collected. - weakref.finalize(self, _close_pool_connections, pool) - - def _new_conn(self) -> BaseHTTPConnection: - """ - Return a fresh :class:`HTTPConnection`. - """ - self.num_connections += 1 - log.debug( - "Starting new HTTP connection (%d): %s:%s", - self.num_connections, - self.host, - self.port or "80", - ) - - conn = self.ConnectionCls( - host=self.host, - port=self.port, - timeout=self.timeout.connect_timeout, - **self.conn_kw, - ) - return conn - - def _get_conn(self, timeout: float | None = None) -> BaseHTTPConnection: - """ - Get a connection. Will return a pooled connection if one is available. - - If no connections are available and :prop:`.block` is ``False``, then a - fresh connection is returned. - - :param timeout: - Seconds to wait before giving up and raising - :class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and - :prop:`.block` is ``True``. - """ - conn = None - - if self.pool is None: - raise ClosedPoolError(self, "Pool is closed.") - - try: - conn = self.pool.get(block=self.block, timeout=timeout) - - except AttributeError: # self.pool is None - raise ClosedPoolError(self, "Pool is closed.") from None # Defensive: - - except queue.Empty: - if self.block: - raise EmptyPoolError( - self, - "Pool is empty and a new connection can't be opened due to blocking mode.", - ) from None - pass # Oh well, we'll create a new connection then - - # If this is a persistent connection, check if it got disconnected - if conn and is_connection_dropped(conn): - log.debug("Resetting dropped connection: %s", self.host) - conn.close() - - return conn or self._new_conn() - - def _put_conn(self, conn: BaseHTTPConnection | None) -> None: - """ - Put a connection back into the pool. - - :param conn: - Connection object for the current host and port as returned by - :meth:`._new_conn` or :meth:`._get_conn`. - - If the pool is already full, the connection is closed and discarded - because we exceeded maxsize. If connections are discarded frequently, - then maxsize should be increased. - - If the pool is closed, then the connection will be closed and discarded. - """ - if self.pool is not None: - try: - self.pool.put(conn, block=False) - return # Everything is dandy, done. - except AttributeError: - # self.pool is None. - pass - except queue.Full: - # Connection never got put back into the pool, close it. - if conn: - conn.close() - - if self.block: - # This should never happen if you got the conn from self._get_conn - raise FullPoolError( - self, - "Pool reached maximum size and no more connections are allowed.", - ) from None - - log.warning( - "Connection pool is full, discarding connection: %s. Connection pool size: %s", - self.host, - self.pool.qsize(), - ) - - # Connection never got put back into the pool, close it. - if conn: - conn.close() - - def _validate_conn(self, conn: BaseHTTPConnection) -> None: - """ - Called right before a request is made, after the socket is created. - """ - - def _prepare_proxy(self, conn: BaseHTTPConnection) -> None: - # Nothing to do for HTTP connections. - pass - - def _get_timeout(self, timeout: _TYPE_TIMEOUT) -> Timeout: - """Helper that always returns a :class:`urllib3.util.Timeout`""" - if timeout is _DEFAULT_TIMEOUT: - return self.timeout.clone() - - if isinstance(timeout, Timeout): - return timeout.clone() - else: - # User passed us an int/float. This is for backwards compatibility, - # can be removed later - return Timeout.from_float(timeout) - - def _raise_timeout( - self, - err: BaseSSLError | OSError | SocketTimeout, - url: str, - timeout_value: _TYPE_TIMEOUT | None, - ) -> None: - """Is the error actually a timeout? Will raise a ReadTimeout or pass""" - - if isinstance(err, SocketTimeout): - raise ReadTimeoutError( - self, url, f"Read timed out. (read timeout={timeout_value})" - ) from err - - # See the above comment about EAGAIN in Python 3. - if hasattr(err, "errno") and err.errno in _blocking_errnos: - raise ReadTimeoutError( - self, url, f"Read timed out. (read timeout={timeout_value})" - ) from err - - def _make_request( - self, - conn: BaseHTTPConnection, - method: str, - url: str, - body: _TYPE_BODY | None = None, - headers: typing.Mapping[str, str] | None = None, - retries: Retry | None = None, - timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - chunked: bool = False, - response_conn: BaseHTTPConnection | None = None, - preload_content: bool = True, - decode_content: bool = True, - enforce_content_length: bool = True, - ) -> BaseHTTPResponse: - """ - Perform a request on a given urllib connection object taken from our - pool. - - :param conn: - a connection from one of our connection pools - - :param method: - HTTP request method (such as GET, POST, PUT, etc.) - - :param url: - The URL to perform the request on. - - :param body: - Data to send in the request body, either :class:`str`, :class:`bytes`, - an iterable of :class:`str`/:class:`bytes`, or a file-like object. - - :param headers: - Dictionary of custom headers to send, such as User-Agent, - If-None-Match, etc. If None, pool headers are used. If provided, - these headers completely replace any pool-specific headers. - - :param retries: - Configure the number of retries to allow before raising a - :class:`~urllib3.exceptions.MaxRetryError` exception. - - Pass ``None`` to retry until you receive a response. Pass a - :class:`~urllib3.util.retry.Retry` object for fine-grained control - over different types of retries. - Pass an integer number to retry connection errors that many times, - but no other types of errors. Pass zero to never retry. - - If ``False``, then retries are disabled and any exception is raised - immediately. Also, instead of raising a MaxRetryError on redirects, - the redirect response will be returned. - - :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. - - :param timeout: - If specified, overrides the default timeout for this one - request. It may be a float (in seconds) or an instance of - :class:`urllib3.util.Timeout`. - - :param chunked: - If True, urllib3 will send the body using chunked transfer - encoding. Otherwise, urllib3 will send the body using the standard - content-length form. Defaults to False. - - :param response_conn: - Set this to ``None`` if you will handle releasing the connection or - set the connection to have the response release it. - - :param preload_content: - If True, the response's body will be preloaded during construction. - - :param decode_content: - If True, will attempt to decode the body based on the - 'content-encoding' header. - - :param enforce_content_length: - Enforce content length checking. Body returned by server must match - value of Content-Length header, if present. Otherwise, raise error. - """ - self.num_requests += 1 - - timeout_obj = self._get_timeout(timeout) - timeout_obj.start_connect() - conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout) - - try: - # Trigger any extra validation we need to do. - try: - self._validate_conn(conn) - except (SocketTimeout, BaseSSLError) as e: - self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) - raise - - # _validate_conn() starts the connection to an HTTPS proxy - # so we need to wrap errors with 'ProxyError' here too. - except ( - OSError, - NewConnectionError, - TimeoutError, - BaseSSLError, - CertificateError, - SSLError, - ) as e: - new_e: Exception = e - if isinstance(e, (BaseSSLError, CertificateError)): - new_e = SSLError(e) - # If the connection didn't successfully connect to it's proxy - # then there - if isinstance( - new_e, (OSError, NewConnectionError, TimeoutError, SSLError) - ) and (conn and conn.proxy and not conn.has_connected_to_proxy): - new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) - raise new_e - - # conn.request() calls http.client.*.request, not the method in - # urllib3.request. It also calls makefile (recv) on the socket. - try: - conn.request( - method, - url, - body=body, - headers=headers, - chunked=chunked, - preload_content=preload_content, - decode_content=decode_content, - enforce_content_length=enforce_content_length, - ) - - # We are swallowing BrokenPipeError (errno.EPIPE) since the server is - # legitimately able to close the connection after sending a valid response. - # With this behaviour, the received response is still readable. - except BrokenPipeError: - pass - except OSError as e: - # MacOS/Linux - # EPROTOTYPE is needed on macOS - # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/ - if e.errno != errno.EPROTOTYPE: - raise - - # Reset the timeout for the recv() on the socket - read_timeout = timeout_obj.read_timeout - - if not conn.is_closed: - # In Python 3 socket.py will catch EAGAIN and return None when you - # try and read into the file pointer created by http.client, which - # instead raises a BadStatusLine exception. Instead of catching - # the exception and assuming all BadStatusLine exceptions are read - # timeouts, check for a zero timeout before making the request. - if read_timeout == 0: - raise ReadTimeoutError( - self, url, f"Read timed out. (read timeout={read_timeout})" - ) - conn.timeout = read_timeout - - # Receive the response from the server - try: - response = conn.getresponse() - except (BaseSSLError, OSError) as e: - self._raise_timeout(err=e, url=url, timeout_value=read_timeout) - raise - - # Set properties that are used by the pooling layer. - response.retries = retries - response._connection = response_conn # type: ignore[attr-defined] - response._pool = self # type: ignore[attr-defined] - - log.debug( - '%s://%s:%s "%s %s %s" %s %s', - self.scheme, - self.host, - self.port, - method, - url, - # HTTP version - conn._http_vsn_str, # type: ignore[attr-defined] - response.status, - response.length_remaining, # type: ignore[attr-defined] - ) - - return response - - def close(self) -> None: - """ - Close all pooled connections and disable the pool. - """ - if self.pool is None: - return - # Disable access to the pool - old_pool, self.pool = self.pool, None - - # Close all the HTTPConnections in the pool. - _close_pool_connections(old_pool) - - def is_same_host(self, url: str) -> bool: - """ - Check if the given ``url`` is a member of the same host as this - connection pool. - """ - if url.startswith("/"): - return True - - # TODO: Add optional support for socket.gethostbyname checking. - scheme, _, host, port, *_ = parse_url(url) - scheme = scheme or "http" - if host is not None: - host = _normalize_host(host, scheme=scheme) - - # Use explicit default port for comparison when none is given - if self.port and not port: - port = port_by_scheme.get(scheme) - elif not self.port and port == port_by_scheme.get(scheme): - port = None - - return (scheme, host, port) == (self.scheme, self.host, self.port) - - def urlopen( # type: ignore[override] - self, - method: str, - url: str, - body: _TYPE_BODY | None = None, - headers: typing.Mapping[str, str] | None = None, - retries: Retry | bool | int | None = None, - redirect: bool = True, - assert_same_host: bool = True, - timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - pool_timeout: int | None = None, - release_conn: bool | None = None, - chunked: bool = False, - body_pos: _TYPE_BODY_POSITION | None = None, - preload_content: bool = True, - decode_content: bool = True, - **response_kw: typing.Any, - ) -> BaseHTTPResponse: - """ - Get a connection from the pool and perform an HTTP request. This is the - lowest level call for making a request, so you'll need to specify all - the raw details. - - .. note:: - - More commonly, it's appropriate to use a convenience method - such as :meth:`request`. - - .. note:: - - `release_conn` will only behave as expected if - `preload_content=False` because we want to make - `preload_content=False` the default behaviour someday soon without - breaking backwards compatibility. - - :param method: - HTTP request method (such as GET, POST, PUT, etc.) - - :param url: - The URL to perform the request on. - - :param body: - Data to send in the request body, either :class:`str`, :class:`bytes`, - an iterable of :class:`str`/:class:`bytes`, or a file-like object. - - :param headers: - Dictionary of custom headers to send, such as User-Agent, - If-None-Match, etc. If None, pool headers are used. If provided, - these headers completely replace any pool-specific headers. - - :param retries: - Configure the number of retries to allow before raising a - :class:`~urllib3.exceptions.MaxRetryError` exception. - - Pass ``None`` to retry until you receive a response. Pass a - :class:`~urllib3.util.retry.Retry` object for fine-grained control - over different types of retries. - Pass an integer number to retry connection errors that many times, - but no other types of errors. Pass zero to never retry. - - If ``False``, then retries are disabled and any exception is raised - immediately. Also, instead of raising a MaxRetryError on redirects, - the redirect response will be returned. - - :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. - - :param redirect: - If True, automatically handle redirects (status codes 301, 302, - 303, 307, 308). Each redirect counts as a retry. Disabling retries - will disable redirect, too. - - :param assert_same_host: - If ``True``, will make sure that the host of the pool requests is - consistent else will raise HostChangedError. When ``False``, you can - use the pool on an HTTP proxy and request foreign hosts. - - :param timeout: - If specified, overrides the default timeout for this one - request. It may be a float (in seconds) or an instance of - :class:`urllib3.util.Timeout`. - - :param pool_timeout: - If set and the pool is set to block=True, then this method will - block for ``pool_timeout`` seconds and raise EmptyPoolError if no - connection is available within the time period. - - :param bool preload_content: - If True, the response's body will be preloaded into memory. - - :param bool decode_content: - If True, will attempt to decode the body based on the - 'content-encoding' header. - - :param release_conn: - If False, then the urlopen call will not release the connection - back into the pool once a response is received (but will release if - you read the entire contents of the response such as when - `preload_content=True`). This is useful if you're not preloading - the response's content immediately. You will need to call - ``r.release_conn()`` on the response ``r`` to return the connection - back into the pool. If None, it takes the value of ``preload_content`` - which defaults to ``True``. - - :param bool chunked: - If True, urllib3 will send the body using chunked transfer - encoding. Otherwise, urllib3 will send the body using the standard - content-length form. Defaults to False. - - :param int body_pos: - Position to seek to in file-like body in the event of a retry or - redirect. Typically this won't need to be set because urllib3 will - auto-populate the value when needed. - """ - parsed_url = parse_url(url) - destination_scheme = parsed_url.scheme - - if headers is None: - headers = self.headers - - if not isinstance(retries, Retry): - retries = Retry.from_int(retries, redirect=redirect, default=self.retries) - - if release_conn is None: - release_conn = preload_content - - # Check host - if assert_same_host and not self.is_same_host(url): - raise HostChangedError(self, url, retries) - - # Ensure that the URL we're connecting to is properly encoded - if url.startswith("/"): - url = to_str(_encode_target(url)) - else: - url = to_str(parsed_url.url) - - conn = None - - # Track whether `conn` needs to be released before - # returning/raising/recursing. Update this variable if necessary, and - # leave `release_conn` constant throughout the function. That way, if - # the function recurses, the original value of `release_conn` will be - # passed down into the recursive call, and its value will be respected. - # - # See issue #651 [1] for details. - # - # [1] - release_this_conn = release_conn - - http_tunnel_required = connection_requires_http_tunnel( - self.proxy, self.proxy_config, destination_scheme - ) - - # Merge the proxy headers. Only done when not using HTTP CONNECT. We - # have to copy the headers dict so we can safely change it without those - # changes being reflected in anyone else's copy. - if not http_tunnel_required: - headers = headers.copy() # type: ignore[attr-defined] - headers.update(self.proxy_headers) # type: ignore[union-attr] - - # Must keep the exception bound to a separate variable or else Python 3 - # complains about UnboundLocalError. - err = None - - # Keep track of whether we cleanly exited the except block. This - # ensures we do proper cleanup in finally. - clean_exit = False - - # Rewind body position, if needed. Record current position - # for future rewinds in the event of a redirect/retry. - body_pos = set_file_position(body, body_pos) - - try: - # Request a connection from the queue. - timeout_obj = self._get_timeout(timeout) - conn = self._get_conn(timeout=pool_timeout) - - conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] - - # Is this a closed/new connection that requires CONNECT tunnelling? - if self.proxy is not None and http_tunnel_required and conn.is_closed: - try: - self._prepare_proxy(conn) - except (BaseSSLError, OSError, SocketTimeout) as e: - self._raise_timeout( - err=e, url=self.proxy.url, timeout_value=conn.timeout - ) - raise - - # If we're going to release the connection in ``finally:``, then - # the response doesn't need to know about the connection. Otherwise - # it will also try to release it and we'll have a double-release - # mess. - response_conn = conn if not release_conn else None - - # Make the request on the HTTPConnection object - response = self._make_request( - conn, - method, - url, - timeout=timeout_obj, - body=body, - headers=headers, - chunked=chunked, - retries=retries, - response_conn=response_conn, - preload_content=preload_content, - decode_content=decode_content, - **response_kw, - ) - - # Everything went great! - clean_exit = True - - except EmptyPoolError: - # Didn't get a connection from the pool, no need to clean up - clean_exit = True - release_this_conn = False - raise - - except ( - TimeoutError, - HTTPException, - OSError, - ProtocolError, - BaseSSLError, - SSLError, - CertificateError, - ProxyError, - ) as e: - # Discard the connection for these exceptions. It will be - # replaced during the next _get_conn() call. - clean_exit = False - new_e: Exception = e - if isinstance(e, (BaseSSLError, CertificateError)): - new_e = SSLError(e) - if isinstance( - new_e, - ( - OSError, - NewConnectionError, - TimeoutError, - SSLError, - HTTPException, - ), - ) and (conn and conn.proxy and not conn.has_connected_to_proxy): - new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) - elif isinstance(new_e, (OSError, HTTPException)): - new_e = ProtocolError("Connection aborted.", new_e) - - retries = retries.increment( - method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2] - ) - retries.sleep() - - # Keep track of the error for the retry warning. - err = e - - finally: - if not clean_exit: - # We hit some kind of exception, handled or otherwise. We need - # to throw the connection away unless explicitly told not to. - # Close the connection, set the variable to None, and make sure - # we put the None back in the pool to avoid leaking it. - if conn: - conn.close() - conn = None - release_this_conn = True - - if release_this_conn: - # Put the connection back to be reused. If the connection is - # expired then it will be None, which will get replaced with a - # fresh connection during _get_conn. - self._put_conn(conn) - - if not conn: - # Try again - log.warning( - "Retrying (%r) after connection broken by '%r': %s", retries, err, url - ) - return self.urlopen( - method, - url, - body, - headers, - retries, - redirect, - assert_same_host, - timeout=timeout, - pool_timeout=pool_timeout, - release_conn=release_conn, - chunked=chunked, - body_pos=body_pos, - preload_content=preload_content, - decode_content=decode_content, - **response_kw, - ) - - # Handle redirect? - redirect_location = redirect and response.get_redirect_location() - if redirect_location: - if response.status == 303: - method = "GET" - - try: - retries = retries.increment(method, url, response=response, _pool=self) - except MaxRetryError: - if retries.raise_on_redirect: - response.drain_conn() - raise - return response - - response.drain_conn() - retries.sleep_for_retry(response) - log.debug("Redirecting %s -> %s", url, redirect_location) - return self.urlopen( - method, - redirect_location, - body, - headers, - retries=retries, - redirect=redirect, - assert_same_host=assert_same_host, - timeout=timeout, - pool_timeout=pool_timeout, - release_conn=release_conn, - chunked=chunked, - body_pos=body_pos, - preload_content=preload_content, - decode_content=decode_content, - **response_kw, - ) - - # Check if we should retry the HTTP response. - has_retry_after = bool(response.headers.get("Retry-After")) - if retries.is_retry(method, response.status, has_retry_after): - try: - retries = retries.increment(method, url, response=response, _pool=self) - except MaxRetryError: - if retries.raise_on_status: - response.drain_conn() - raise - return response - - response.drain_conn() - retries.sleep(response) - log.debug("Retry: %s", url) - return self.urlopen( - method, - url, - body, - headers, - retries=retries, - redirect=redirect, - assert_same_host=assert_same_host, - timeout=timeout, - pool_timeout=pool_timeout, - release_conn=release_conn, - chunked=chunked, - body_pos=body_pos, - preload_content=preload_content, - decode_content=decode_content, - **response_kw, - ) - - return response - - -class HTTPSConnectionPool(HTTPConnectionPool): - """ - Same as :class:`.HTTPConnectionPool`, but HTTPS. - - :class:`.HTTPSConnection` uses one of ``assert_fingerprint``, - ``assert_hostname`` and ``host`` in this order to verify connections. - If ``assert_hostname`` is False, no verification is done. - - The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs``, - ``ca_cert_dir``, ``ssl_version``, ``key_password`` are only used if :mod:`ssl` - is available and are fed into :meth:`urllib3.util.ssl_wrap_socket` to upgrade - the connection socket into an SSL socket. - """ - - scheme = "https" - ConnectionCls: type[BaseHTTPSConnection] = HTTPSConnection - - def __init__( - self, - host: str, - port: int | None = None, - timeout: _TYPE_TIMEOUT | None = _DEFAULT_TIMEOUT, - maxsize: int = 1, - block: bool = False, - headers: typing.Mapping[str, str] | None = None, - retries: Retry | bool | int | None = None, - _proxy: Url | None = None, - _proxy_headers: typing.Mapping[str, str] | None = None, - key_file: str | None = None, - cert_file: str | None = None, - cert_reqs: int | str | None = None, - key_password: str | None = None, - ca_certs: str | None = None, - ssl_version: int | str | None = None, - ssl_minimum_version: ssl.TLSVersion | None = None, - ssl_maximum_version: ssl.TLSVersion | None = None, - assert_hostname: str | Literal[False] | None = None, - assert_fingerprint: str | None = None, - ca_cert_dir: str | None = None, - **conn_kw: typing.Any, - ) -> None: - super().__init__( - host, - port, - timeout, - maxsize, - block, - headers, - retries, - _proxy, - _proxy_headers, - **conn_kw, - ) - - self.key_file = key_file - self.cert_file = cert_file - self.cert_reqs = cert_reqs - self.key_password = key_password - self.ca_certs = ca_certs - self.ca_cert_dir = ca_cert_dir - self.ssl_version = ssl_version - self.ssl_minimum_version = ssl_minimum_version - self.ssl_maximum_version = ssl_maximum_version - self.assert_hostname = assert_hostname - self.assert_fingerprint = assert_fingerprint - - def _prepare_proxy(self, conn: HTTPSConnection) -> None: # type: ignore[override] - """Establishes a tunnel connection through HTTP CONNECT.""" - if self.proxy and self.proxy.scheme == "https": - tunnel_scheme = "https" - else: - tunnel_scheme = "http" - - conn.set_tunnel( - scheme=tunnel_scheme, - host=self._tunnel_host, - port=self.port, - headers=self.proxy_headers, - ) - conn.connect() - - def _new_conn(self) -> BaseHTTPSConnection: - """ - Return a fresh :class:`urllib3.connection.HTTPConnection`. - """ - self.num_connections += 1 - log.debug( - "Starting new HTTPS connection (%d): %s:%s", - self.num_connections, - self.host, - self.port or "443", - ) - - if not self.ConnectionCls or self.ConnectionCls is DummyConnection: # type: ignore[comparison-overlap] - raise ImportError( - "Can't connect to HTTPS URL because the SSL module is not available." - ) - - actual_host: str = self.host - actual_port = self.port - if self.proxy is not None and self.proxy.host is not None: - actual_host = self.proxy.host - actual_port = self.proxy.port - - return self.ConnectionCls( - host=actual_host, - port=actual_port, - timeout=self.timeout.connect_timeout, - cert_file=self.cert_file, - key_file=self.key_file, - key_password=self.key_password, - cert_reqs=self.cert_reqs, - ca_certs=self.ca_certs, - ca_cert_dir=self.ca_cert_dir, - assert_hostname=self.assert_hostname, - assert_fingerprint=self.assert_fingerprint, - ssl_version=self.ssl_version, - ssl_minimum_version=self.ssl_minimum_version, - ssl_maximum_version=self.ssl_maximum_version, - **self.conn_kw, - ) - - def _validate_conn(self, conn: BaseHTTPConnection) -> None: - """ - Called right before a request is made, after the socket is created. - """ - super()._validate_conn(conn) - - # Force connect early to allow us to validate the connection. - if conn.is_closed: - conn.connect() - - if not conn.is_verified: - warnings.warn( - ( - f"Unverified HTTPS request is being made to host '{conn.host}'. " - "Adding certificate verification is strongly advised. See: " - "https://urllib3.readthedocs.io/en/latest/advanced-usage.html" - "#tls-warnings" - ), - InsecureRequestWarning, - ) - - -def connection_from_url(url: str, **kw: typing.Any) -> HTTPConnectionPool: - """ - Given a url, return an :class:`.ConnectionPool` instance of its host. - - This is a shortcut for not having to parse out the scheme, host, and port - of the url before creating an :class:`.ConnectionPool` instance. - - :param url: - Absolute URL string that must include the scheme. Port is optional. - - :param \\**kw: - Passes additional parameters to the constructor of the appropriate - :class:`.ConnectionPool`. Useful for specifying things like - timeout, maxsize, headers, etc. - - Example:: - - >>> conn = connection_from_url('http://google.com/') - >>> r = conn.request('GET', '/') - """ - scheme, _, host, port, *_ = parse_url(url) - scheme = scheme or "http" - port = port or port_by_scheme.get(scheme, 80) - if scheme == "https": - return HTTPSConnectionPool(host, port=port, **kw) # type: ignore[arg-type] - else: - return HTTPConnectionPool(host, port=port, **kw) # type: ignore[arg-type] - - -@typing.overload -def _normalize_host(host: None, scheme: str | None) -> None: - ... - - -@typing.overload -def _normalize_host(host: str, scheme: str | None) -> str: - ... - - -def _normalize_host(host: str | None, scheme: str | None) -> str | None: - """ - Normalize hosts for comparisons and use with sockets. - """ - - host = normalize_host(host, scheme) - - # httplib doesn't like it when we include brackets in IPv6 addresses - # Specifically, if we include brackets but also pass the port then - # httplib crazily doubles up the square brackets on the Host header. - # Instead, we need to make sure we never pass ``None`` as the port. - # However, for backward compatibility reasons we can't actually - # *assert* that. See http://bugs.python.org/issue28539 - if host and host.startswith("[") and host.endswith("]"): - host = host[1:-1] - return host - - -def _url_from_pool( - pool: HTTPConnectionPool | HTTPSConnectionPool, path: str | None = None -) -> str: - """Returns the URL from a given connection pool. This is mainly used for testing and logging.""" - return Url(scheme=pool.scheme, host=pool.host, port=pool.port, path=path).url - - -def _close_pool_connections(pool: queue.LifoQueue[typing.Any]) -> None: - """Drains a queue of connections and closes each one.""" - try: - while True: - conn = pool.get(block=False) - if conn: - conn.close() - except queue.Empty: - pass # Done. diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/__init__.py b/venv/lib/python3.8/site-packages/urllib3/contrib/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 73afcf39d3f86cd45b8aff9ce311d8b68d7a6d31..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/pyopenssl.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/pyopenssl.cpython-38.pyc deleted file mode 100644 index 0d2b597cd913de5454afb73f0ebc500a3fa1fa57..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/pyopenssl.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/securetransport.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/securetransport.cpython-38.pyc deleted file mode 100644 index cccb54c468540231f7583f76755af66f20740e34..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/securetransport.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/socks.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/socks.cpython-38.pyc deleted file mode 100644 index 8ff88d50f80a219c0b9d09f69a73d7a52ac69d9f..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/contrib/__pycache__/socks.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__init__.py b/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 5df2c55f6ede527e5dd64ad999b723e54043c284..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-38.pyc deleted file mode 100644 index 81d8134c737f866844fb37f214bd2eac77e41268..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-38.pyc deleted file mode 100644 index 1c97297d5678e5b34d51a8ddf3e19e76ec641a4a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/bindings.py b/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/bindings.py deleted file mode 100644 index 3e4cd466eab6e551b3947819ddf271738b30e064..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/bindings.py +++ /dev/null @@ -1,430 +0,0 @@ -# type: ignore - -""" -This module uses ctypes to bind a whole bunch of functions and constants from -SecureTransport. The goal here is to provide the low-level API to -SecureTransport. These are essentially the C-level functions and constants, and -they're pretty gross to work with. - -This code is a bastardised version of the code found in Will Bond's oscrypto -library. An enormous debt is owed to him for blazing this trail for us. For -that reason, this code should be considered to be covered both by urllib3's -license and by oscrypto's: - - Copyright (c) 2015-2016 Will Bond - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -""" - -from __future__ import annotations - -import platform -from ctypes import ( - CDLL, - CFUNCTYPE, - POINTER, - c_bool, - c_byte, - c_char_p, - c_int32, - c_long, - c_size_t, - c_uint32, - c_ulong, - c_void_p, -) -from ctypes.util import find_library - -if platform.system() != "Darwin": - raise ImportError("Only macOS is supported") - -version = platform.mac_ver()[0] -version_info = tuple(map(int, version.split("."))) -if version_info < (10, 8): - raise OSError( - f"Only OS X 10.8 and newer are supported, not {version_info[0]}.{version_info[1]}" - ) - - -def load_cdll(name: str, macos10_16_path: str) -> CDLL: - """Loads a CDLL by name, falling back to known path on 10.16+""" - try: - # Big Sur is technically 11 but we use 10.16 due to the Big Sur - # beta being labeled as 10.16. - path: str | None - if version_info >= (10, 16): - path = macos10_16_path - else: - path = find_library(name) - if not path: - raise OSError # Caught and reraised as 'ImportError' - return CDLL(path, use_errno=True) - except OSError: - raise ImportError(f"The library {name} failed to load") from None - - -Security = load_cdll( - "Security", "/System/Library/Frameworks/Security.framework/Security" -) -CoreFoundation = load_cdll( - "CoreFoundation", - "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", -) - - -Boolean = c_bool -CFIndex = c_long -CFStringEncoding = c_uint32 -CFData = c_void_p -CFString = c_void_p -CFArray = c_void_p -CFMutableArray = c_void_p -CFDictionary = c_void_p -CFError = c_void_p -CFType = c_void_p -CFTypeID = c_ulong - -CFTypeRef = POINTER(CFType) -CFAllocatorRef = c_void_p - -OSStatus = c_int32 - -CFDataRef = POINTER(CFData) -CFStringRef = POINTER(CFString) -CFArrayRef = POINTER(CFArray) -CFMutableArrayRef = POINTER(CFMutableArray) -CFDictionaryRef = POINTER(CFDictionary) -CFArrayCallBacks = c_void_p -CFDictionaryKeyCallBacks = c_void_p -CFDictionaryValueCallBacks = c_void_p - -SecCertificateRef = POINTER(c_void_p) -SecExternalFormat = c_uint32 -SecExternalItemType = c_uint32 -SecIdentityRef = POINTER(c_void_p) -SecItemImportExportFlags = c_uint32 -SecItemImportExportKeyParameters = c_void_p -SecKeychainRef = POINTER(c_void_p) -SSLProtocol = c_uint32 -SSLCipherSuite = c_uint32 -SSLContextRef = POINTER(c_void_p) -SecTrustRef = POINTER(c_void_p) -SSLConnectionRef = c_uint32 -SecTrustResultType = c_uint32 -SecTrustOptionFlags = c_uint32 -SSLProtocolSide = c_uint32 -SSLConnectionType = c_uint32 -SSLSessionOption = c_uint32 - - -try: - Security.SecItemImport.argtypes = [ - CFDataRef, - CFStringRef, - POINTER(SecExternalFormat), - POINTER(SecExternalItemType), - SecItemImportExportFlags, - POINTER(SecItemImportExportKeyParameters), - SecKeychainRef, - POINTER(CFArrayRef), - ] - Security.SecItemImport.restype = OSStatus - - Security.SecCertificateGetTypeID.argtypes = [] - Security.SecCertificateGetTypeID.restype = CFTypeID - - Security.SecIdentityGetTypeID.argtypes = [] - Security.SecIdentityGetTypeID.restype = CFTypeID - - Security.SecKeyGetTypeID.argtypes = [] - Security.SecKeyGetTypeID.restype = CFTypeID - - Security.SecCertificateCreateWithData.argtypes = [CFAllocatorRef, CFDataRef] - Security.SecCertificateCreateWithData.restype = SecCertificateRef - - Security.SecCertificateCopyData.argtypes = [SecCertificateRef] - Security.SecCertificateCopyData.restype = CFDataRef - - Security.SecCopyErrorMessageString.argtypes = [OSStatus, c_void_p] - Security.SecCopyErrorMessageString.restype = CFStringRef - - Security.SecIdentityCreateWithCertificate.argtypes = [ - CFTypeRef, - SecCertificateRef, - POINTER(SecIdentityRef), - ] - Security.SecIdentityCreateWithCertificate.restype = OSStatus - - Security.SecKeychainCreate.argtypes = [ - c_char_p, - c_uint32, - c_void_p, - Boolean, - c_void_p, - POINTER(SecKeychainRef), - ] - Security.SecKeychainCreate.restype = OSStatus - - Security.SecKeychainDelete.argtypes = [SecKeychainRef] - Security.SecKeychainDelete.restype = OSStatus - - Security.SecPKCS12Import.argtypes = [ - CFDataRef, - CFDictionaryRef, - POINTER(CFArrayRef), - ] - Security.SecPKCS12Import.restype = OSStatus - - SSLReadFunc = CFUNCTYPE(OSStatus, SSLConnectionRef, c_void_p, POINTER(c_size_t)) - SSLWriteFunc = CFUNCTYPE( - OSStatus, SSLConnectionRef, POINTER(c_byte), POINTER(c_size_t) - ) - - Security.SSLSetIOFuncs.argtypes = [SSLContextRef, SSLReadFunc, SSLWriteFunc] - Security.SSLSetIOFuncs.restype = OSStatus - - Security.SSLSetPeerID.argtypes = [SSLContextRef, c_char_p, c_size_t] - Security.SSLSetPeerID.restype = OSStatus - - Security.SSLSetCertificate.argtypes = [SSLContextRef, CFArrayRef] - Security.SSLSetCertificate.restype = OSStatus - - Security.SSLSetCertificateAuthorities.argtypes = [SSLContextRef, CFTypeRef, Boolean] - Security.SSLSetCertificateAuthorities.restype = OSStatus - - Security.SSLSetConnection.argtypes = [SSLContextRef, SSLConnectionRef] - Security.SSLSetConnection.restype = OSStatus - - Security.SSLSetPeerDomainName.argtypes = [SSLContextRef, c_char_p, c_size_t] - Security.SSLSetPeerDomainName.restype = OSStatus - - Security.SSLHandshake.argtypes = [SSLContextRef] - Security.SSLHandshake.restype = OSStatus - - Security.SSLRead.argtypes = [SSLContextRef, c_char_p, c_size_t, POINTER(c_size_t)] - Security.SSLRead.restype = OSStatus - - Security.SSLWrite.argtypes = [SSLContextRef, c_char_p, c_size_t, POINTER(c_size_t)] - Security.SSLWrite.restype = OSStatus - - Security.SSLClose.argtypes = [SSLContextRef] - Security.SSLClose.restype = OSStatus - - Security.SSLGetNumberSupportedCiphers.argtypes = [SSLContextRef, POINTER(c_size_t)] - Security.SSLGetNumberSupportedCiphers.restype = OSStatus - - Security.SSLGetSupportedCiphers.argtypes = [ - SSLContextRef, - POINTER(SSLCipherSuite), - POINTER(c_size_t), - ] - Security.SSLGetSupportedCiphers.restype = OSStatus - - Security.SSLSetEnabledCiphers.argtypes = [ - SSLContextRef, - POINTER(SSLCipherSuite), - c_size_t, - ] - Security.SSLSetEnabledCiphers.restype = OSStatus - - Security.SSLGetNumberEnabledCiphers.argtype = [SSLContextRef, POINTER(c_size_t)] - Security.SSLGetNumberEnabledCiphers.restype = OSStatus - - Security.SSLGetEnabledCiphers.argtypes = [ - SSLContextRef, - POINTER(SSLCipherSuite), - POINTER(c_size_t), - ] - Security.SSLGetEnabledCiphers.restype = OSStatus - - Security.SSLGetNegotiatedCipher.argtypes = [SSLContextRef, POINTER(SSLCipherSuite)] - Security.SSLGetNegotiatedCipher.restype = OSStatus - - Security.SSLGetNegotiatedProtocolVersion.argtypes = [ - SSLContextRef, - POINTER(SSLProtocol), - ] - Security.SSLGetNegotiatedProtocolVersion.restype = OSStatus - - Security.SSLCopyPeerTrust.argtypes = [SSLContextRef, POINTER(SecTrustRef)] - Security.SSLCopyPeerTrust.restype = OSStatus - - Security.SecTrustSetAnchorCertificates.argtypes = [SecTrustRef, CFArrayRef] - Security.SecTrustSetAnchorCertificates.restype = OSStatus - - Security.SecTrustSetAnchorCertificatesOnly.argstypes = [SecTrustRef, Boolean] - Security.SecTrustSetAnchorCertificatesOnly.restype = OSStatus - - Security.SecTrustEvaluate.argtypes = [SecTrustRef, POINTER(SecTrustResultType)] - Security.SecTrustEvaluate.restype = OSStatus - - Security.SecTrustGetCertificateCount.argtypes = [SecTrustRef] - Security.SecTrustGetCertificateCount.restype = CFIndex - - Security.SecTrustGetCertificateAtIndex.argtypes = [SecTrustRef, CFIndex] - Security.SecTrustGetCertificateAtIndex.restype = SecCertificateRef - - Security.SSLCreateContext.argtypes = [ - CFAllocatorRef, - SSLProtocolSide, - SSLConnectionType, - ] - Security.SSLCreateContext.restype = SSLContextRef - - Security.SSLSetSessionOption.argtypes = [SSLContextRef, SSLSessionOption, Boolean] - Security.SSLSetSessionOption.restype = OSStatus - - Security.SSLSetProtocolVersionMin.argtypes = [SSLContextRef, SSLProtocol] - Security.SSLSetProtocolVersionMin.restype = OSStatus - - Security.SSLSetProtocolVersionMax.argtypes = [SSLContextRef, SSLProtocol] - Security.SSLSetProtocolVersionMax.restype = OSStatus - - try: - Security.SSLSetALPNProtocols.argtypes = [SSLContextRef, CFArrayRef] - Security.SSLSetALPNProtocols.restype = OSStatus - except AttributeError: - # Supported only in 10.12+ - pass - - Security.SecCopyErrorMessageString.argtypes = [OSStatus, c_void_p] - Security.SecCopyErrorMessageString.restype = CFStringRef - - Security.SSLReadFunc = SSLReadFunc - Security.SSLWriteFunc = SSLWriteFunc - Security.SSLContextRef = SSLContextRef - Security.SSLProtocol = SSLProtocol - Security.SSLCipherSuite = SSLCipherSuite - Security.SecIdentityRef = SecIdentityRef - Security.SecKeychainRef = SecKeychainRef - Security.SecTrustRef = SecTrustRef - Security.SecTrustResultType = SecTrustResultType - Security.SecExternalFormat = SecExternalFormat - Security.OSStatus = OSStatus - - Security.kSecImportExportPassphrase = CFStringRef.in_dll( - Security, "kSecImportExportPassphrase" - ) - Security.kSecImportItemIdentity = CFStringRef.in_dll( - Security, "kSecImportItemIdentity" - ) - - # CoreFoundation time! - CoreFoundation.CFRetain.argtypes = [CFTypeRef] - CoreFoundation.CFRetain.restype = CFTypeRef - - CoreFoundation.CFRelease.argtypes = [CFTypeRef] - CoreFoundation.CFRelease.restype = None - - CoreFoundation.CFGetTypeID.argtypes = [CFTypeRef] - CoreFoundation.CFGetTypeID.restype = CFTypeID - - CoreFoundation.CFStringCreateWithCString.argtypes = [ - CFAllocatorRef, - c_char_p, - CFStringEncoding, - ] - CoreFoundation.CFStringCreateWithCString.restype = CFStringRef - - CoreFoundation.CFStringGetCStringPtr.argtypes = [CFStringRef, CFStringEncoding] - CoreFoundation.CFStringGetCStringPtr.restype = c_char_p - - CoreFoundation.CFStringGetCString.argtypes = [ - CFStringRef, - c_char_p, - CFIndex, - CFStringEncoding, - ] - CoreFoundation.CFStringGetCString.restype = c_bool - - CoreFoundation.CFDataCreate.argtypes = [CFAllocatorRef, c_char_p, CFIndex] - CoreFoundation.CFDataCreate.restype = CFDataRef - - CoreFoundation.CFDataGetLength.argtypes = [CFDataRef] - CoreFoundation.CFDataGetLength.restype = CFIndex - - CoreFoundation.CFDataGetBytePtr.argtypes = [CFDataRef] - CoreFoundation.CFDataGetBytePtr.restype = c_void_p - - CoreFoundation.CFDictionaryCreate.argtypes = [ - CFAllocatorRef, - POINTER(CFTypeRef), - POINTER(CFTypeRef), - CFIndex, - CFDictionaryKeyCallBacks, - CFDictionaryValueCallBacks, - ] - CoreFoundation.CFDictionaryCreate.restype = CFDictionaryRef - - CoreFoundation.CFDictionaryGetValue.argtypes = [CFDictionaryRef, CFTypeRef] - CoreFoundation.CFDictionaryGetValue.restype = CFTypeRef - - CoreFoundation.CFArrayCreate.argtypes = [ - CFAllocatorRef, - POINTER(CFTypeRef), - CFIndex, - CFArrayCallBacks, - ] - CoreFoundation.CFArrayCreate.restype = CFArrayRef - - CoreFoundation.CFArrayCreateMutable.argtypes = [ - CFAllocatorRef, - CFIndex, - CFArrayCallBacks, - ] - CoreFoundation.CFArrayCreateMutable.restype = CFMutableArrayRef - - CoreFoundation.CFArrayAppendValue.argtypes = [CFMutableArrayRef, c_void_p] - CoreFoundation.CFArrayAppendValue.restype = None - - CoreFoundation.CFArrayGetCount.argtypes = [CFArrayRef] - CoreFoundation.CFArrayGetCount.restype = CFIndex - - CoreFoundation.CFArrayGetValueAtIndex.argtypes = [CFArrayRef, CFIndex] - CoreFoundation.CFArrayGetValueAtIndex.restype = c_void_p - - CoreFoundation.kCFAllocatorDefault = CFAllocatorRef.in_dll( - CoreFoundation, "kCFAllocatorDefault" - ) - CoreFoundation.kCFTypeArrayCallBacks = c_void_p.in_dll( - CoreFoundation, "kCFTypeArrayCallBacks" - ) - CoreFoundation.kCFTypeDictionaryKeyCallBacks = c_void_p.in_dll( - CoreFoundation, "kCFTypeDictionaryKeyCallBacks" - ) - CoreFoundation.kCFTypeDictionaryValueCallBacks = c_void_p.in_dll( - CoreFoundation, "kCFTypeDictionaryValueCallBacks" - ) - - CoreFoundation.CFTypeRef = CFTypeRef - CoreFoundation.CFArrayRef = CFArrayRef - CoreFoundation.CFStringRef = CFStringRef - CoreFoundation.CFDictionaryRef = CFDictionaryRef - -except AttributeError: - raise ImportError("Error initializing ctypes") from None - - -class CFConst: - """ - A class object that acts as essentially a namespace for CoreFoundation - constants. - """ - - kCFStringEncodingUTF8 = CFStringEncoding(0x08000100) diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/low_level.py b/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/low_level.py deleted file mode 100644 index e23569972c7a541774366a01eea05e066b19c406..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/contrib/_securetransport/low_level.py +++ /dev/null @@ -1,474 +0,0 @@ -""" -Low-level helpers for the SecureTransport bindings. - -These are Python functions that are not directly related to the high-level APIs -but are necessary to get them to work. They include a whole bunch of low-level -CoreFoundation messing about and memory management. The concerns in this module -are almost entirely about trying to avoid memory leaks and providing -appropriate and useful assistance to the higher-level code. -""" -from __future__ import annotations - -import base64 -import ctypes -import itertools -import os -import re -import ssl -import struct -import tempfile -import typing - -from .bindings import ( # type: ignore[attr-defined] - CFArray, - CFConst, - CFData, - CFDictionary, - CFMutableArray, - CFString, - CFTypeRef, - CoreFoundation, - SecKeychainRef, - Security, -) - -# This regular expression is used to grab PEM data out of a PEM bundle. -_PEM_CERTS_RE = re.compile( - b"-----BEGIN CERTIFICATE-----\n(.*?)\n-----END CERTIFICATE-----", re.DOTALL -) - - -def _cf_data_from_bytes(bytestring: bytes) -> CFData: - """ - Given a bytestring, create a CFData object from it. This CFData object must - be CFReleased by the caller. - """ - return CoreFoundation.CFDataCreate( - CoreFoundation.kCFAllocatorDefault, bytestring, len(bytestring) - ) - - -def _cf_dictionary_from_tuples( - tuples: list[tuple[typing.Any, typing.Any]] -) -> CFDictionary: - """ - Given a list of Python tuples, create an associated CFDictionary. - """ - dictionary_size = len(tuples) - - # We need to get the dictionary keys and values out in the same order. - keys = (t[0] for t in tuples) - values = (t[1] for t in tuples) - cf_keys = (CoreFoundation.CFTypeRef * dictionary_size)(*keys) - cf_values = (CoreFoundation.CFTypeRef * dictionary_size)(*values) - - return CoreFoundation.CFDictionaryCreate( - CoreFoundation.kCFAllocatorDefault, - cf_keys, - cf_values, - dictionary_size, - CoreFoundation.kCFTypeDictionaryKeyCallBacks, - CoreFoundation.kCFTypeDictionaryValueCallBacks, - ) - - -def _cfstr(py_bstr: bytes) -> CFString: - """ - Given a Python binary data, create a CFString. - The string must be CFReleased by the caller. - """ - c_str = ctypes.c_char_p(py_bstr) - cf_str = CoreFoundation.CFStringCreateWithCString( - CoreFoundation.kCFAllocatorDefault, - c_str, - CFConst.kCFStringEncodingUTF8, - ) - return cf_str - - -def _create_cfstring_array(lst: list[bytes]) -> CFMutableArray: - """ - Given a list of Python binary data, create an associated CFMutableArray. - The array must be CFReleased by the caller. - - Raises an ssl.SSLError on failure. - """ - cf_arr = None - try: - cf_arr = CoreFoundation.CFArrayCreateMutable( - CoreFoundation.kCFAllocatorDefault, - 0, - ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), - ) - if not cf_arr: - raise MemoryError("Unable to allocate memory!") - for item in lst: - cf_str = _cfstr(item) - if not cf_str: - raise MemoryError("Unable to allocate memory!") - try: - CoreFoundation.CFArrayAppendValue(cf_arr, cf_str) - finally: - CoreFoundation.CFRelease(cf_str) - except BaseException as e: - if cf_arr: - CoreFoundation.CFRelease(cf_arr) - raise ssl.SSLError(f"Unable to allocate array: {e}") from None - return cf_arr - - -def _cf_string_to_unicode(value: CFString) -> str | None: - """ - Creates a Unicode string from a CFString object. Used entirely for error - reporting. - - Yes, it annoys me quite a lot that this function is this complex. - """ - value_as_void_p = ctypes.cast(value, ctypes.POINTER(ctypes.c_void_p)) - - string = CoreFoundation.CFStringGetCStringPtr( - value_as_void_p, CFConst.kCFStringEncodingUTF8 - ) - if string is None: - buffer = ctypes.create_string_buffer(1024) - result = CoreFoundation.CFStringGetCString( - value_as_void_p, buffer, 1024, CFConst.kCFStringEncodingUTF8 - ) - if not result: - raise OSError("Error copying C string from CFStringRef") - string = buffer.value - if string is not None: - string = string.decode("utf-8") - return string # type: ignore[no-any-return] - - -def _assert_no_error( - error: int, exception_class: type[BaseException] | None = None -) -> None: - """ - Checks the return code and throws an exception if there is an error to - report - """ - if error == 0: - return - - cf_error_string = Security.SecCopyErrorMessageString(error, None) - output = _cf_string_to_unicode(cf_error_string) - CoreFoundation.CFRelease(cf_error_string) - - if output is None or output == "": - output = f"OSStatus {error}" - - if exception_class is None: - exception_class = ssl.SSLError - - raise exception_class(output) - - -def _cert_array_from_pem(pem_bundle: bytes) -> CFArray: - """ - Given a bundle of certs in PEM format, turns them into a CFArray of certs - that can be used to validate a cert chain. - """ - # Normalize the PEM bundle's line endings. - pem_bundle = pem_bundle.replace(b"\r\n", b"\n") - - der_certs = [ - base64.b64decode(match.group(1)) for match in _PEM_CERTS_RE.finditer(pem_bundle) - ] - if not der_certs: - raise ssl.SSLError("No root certificates specified") - - cert_array = CoreFoundation.CFArrayCreateMutable( - CoreFoundation.kCFAllocatorDefault, - 0, - ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), - ) - if not cert_array: - raise ssl.SSLError("Unable to allocate memory!") - - try: - for der_bytes in der_certs: - certdata = _cf_data_from_bytes(der_bytes) - if not certdata: - raise ssl.SSLError("Unable to allocate memory!") - cert = Security.SecCertificateCreateWithData( - CoreFoundation.kCFAllocatorDefault, certdata - ) - CoreFoundation.CFRelease(certdata) - if not cert: - raise ssl.SSLError("Unable to build cert object!") - - CoreFoundation.CFArrayAppendValue(cert_array, cert) - CoreFoundation.CFRelease(cert) - except Exception: - # We need to free the array before the exception bubbles further. - # We only want to do that if an error occurs: otherwise, the caller - # should free. - CoreFoundation.CFRelease(cert_array) - raise - - return cert_array - - -def _is_cert(item: CFTypeRef) -> bool: - """ - Returns True if a given CFTypeRef is a certificate. - """ - expected = Security.SecCertificateGetTypeID() - return CoreFoundation.CFGetTypeID(item) == expected # type: ignore[no-any-return] - - -def _is_identity(item: CFTypeRef) -> bool: - """ - Returns True if a given CFTypeRef is an identity. - """ - expected = Security.SecIdentityGetTypeID() - return CoreFoundation.CFGetTypeID(item) == expected # type: ignore[no-any-return] - - -def _temporary_keychain() -> tuple[SecKeychainRef, str]: - """ - This function creates a temporary Mac keychain that we can use to work with - credentials. This keychain uses a one-time password and a temporary file to - store the data. We expect to have one keychain per socket. The returned - SecKeychainRef must be freed by the caller, including calling - SecKeychainDelete. - - Returns a tuple of the SecKeychainRef and the path to the temporary - directory that contains it. - """ - # Unfortunately, SecKeychainCreate requires a path to a keychain. This - # means we cannot use mkstemp to use a generic temporary file. Instead, - # we're going to create a temporary directory and a filename to use there. - # This filename will be 8 random bytes expanded into base64. We also need - # some random bytes to password-protect the keychain we're creating, so we - # ask for 40 random bytes. - random_bytes = os.urandom(40) - filename = base64.b16encode(random_bytes[:8]).decode("utf-8") - password = base64.b16encode(random_bytes[8:]) # Must be valid UTF-8 - tempdirectory = tempfile.mkdtemp() - - keychain_path = os.path.join(tempdirectory, filename).encode("utf-8") - - # We now want to create the keychain itself. - keychain = Security.SecKeychainRef() - status = Security.SecKeychainCreate( - keychain_path, len(password), password, False, None, ctypes.byref(keychain) - ) - _assert_no_error(status) - - # Having created the keychain, we want to pass it off to the caller. - return keychain, tempdirectory - - -def _load_items_from_file( - keychain: SecKeychainRef, path: str -) -> tuple[list[CFTypeRef], list[CFTypeRef]]: - """ - Given a single file, loads all the trust objects from it into arrays and - the keychain. - Returns a tuple of lists: the first list is a list of identities, the - second a list of certs. - """ - certificates = [] - identities = [] - result_array = None - - with open(path, "rb") as f: - raw_filedata = f.read() - - try: - filedata = CoreFoundation.CFDataCreate( - CoreFoundation.kCFAllocatorDefault, raw_filedata, len(raw_filedata) - ) - result_array = CoreFoundation.CFArrayRef() - result = Security.SecItemImport( - filedata, # cert data - None, # Filename, leaving it out for now - None, # What the type of the file is, we don't care - None, # what's in the file, we don't care - 0, # import flags - None, # key params, can include passphrase in the future - keychain, # The keychain to insert into - ctypes.byref(result_array), # Results - ) - _assert_no_error(result) - - # A CFArray is not very useful to us as an intermediary - # representation, so we are going to extract the objects we want - # and then free the array. We don't need to keep hold of keys: the - # keychain already has them! - result_count = CoreFoundation.CFArrayGetCount(result_array) - for index in range(result_count): - item = CoreFoundation.CFArrayGetValueAtIndex(result_array, index) - item = ctypes.cast(item, CoreFoundation.CFTypeRef) - - if _is_cert(item): - CoreFoundation.CFRetain(item) - certificates.append(item) - elif _is_identity(item): - CoreFoundation.CFRetain(item) - identities.append(item) - finally: - if result_array: - CoreFoundation.CFRelease(result_array) - - CoreFoundation.CFRelease(filedata) - - return (identities, certificates) - - -def _load_client_cert_chain(keychain: SecKeychainRef, *paths: str | None) -> CFArray: - """ - Load certificates and maybe keys from a number of files. Has the end goal - of returning a CFArray containing one SecIdentityRef, and then zero or more - SecCertificateRef objects, suitable for use as a client certificate trust - chain. - """ - # Ok, the strategy. - # - # This relies on knowing that macOS will not give you a SecIdentityRef - # unless you have imported a key into a keychain. This is a somewhat - # artificial limitation of macOS (for example, it doesn't necessarily - # affect iOS), but there is nothing inside Security.framework that lets you - # get a SecIdentityRef without having a key in a keychain. - # - # So the policy here is we take all the files and iterate them in order. - # Each one will use SecItemImport to have one or more objects loaded from - # it. We will also point at a keychain that macOS can use to work with the - # private key. - # - # Once we have all the objects, we'll check what we actually have. If we - # already have a SecIdentityRef in hand, fab: we'll use that. Otherwise, - # we'll take the first certificate (which we assume to be our leaf) and - # ask the keychain to give us a SecIdentityRef with that cert's associated - # key. - # - # We'll then return a CFArray containing the trust chain: one - # SecIdentityRef and then zero-or-more SecCertificateRef objects. The - # responsibility for freeing this CFArray will be with the caller. This - # CFArray must remain alive for the entire connection, so in practice it - # will be stored with a single SSLSocket, along with the reference to the - # keychain. - certificates = [] - identities = [] - - # Filter out bad paths. - filtered_paths = (path for path in paths if path) - - try: - for file_path in filtered_paths: - new_identities, new_certs = _load_items_from_file(keychain, file_path) - identities.extend(new_identities) - certificates.extend(new_certs) - - # Ok, we have everything. The question is: do we have an identity? If - # not, we want to grab one from the first cert we have. - if not identities: - new_identity = Security.SecIdentityRef() - status = Security.SecIdentityCreateWithCertificate( - keychain, certificates[0], ctypes.byref(new_identity) - ) - _assert_no_error(status) - identities.append(new_identity) - - # We now want to release the original certificate, as we no longer - # need it. - CoreFoundation.CFRelease(certificates.pop(0)) - - # We now need to build a new CFArray that holds the trust chain. - trust_chain = CoreFoundation.CFArrayCreateMutable( - CoreFoundation.kCFAllocatorDefault, - 0, - ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), - ) - for item in itertools.chain(identities, certificates): - # ArrayAppendValue does a CFRetain on the item. That's fine, - # because the finally block will release our other refs to them. - CoreFoundation.CFArrayAppendValue(trust_chain, item) - - return trust_chain - finally: - for obj in itertools.chain(identities, certificates): - CoreFoundation.CFRelease(obj) - - -TLS_PROTOCOL_VERSIONS = { - "SSLv2": (0, 2), - "SSLv3": (3, 0), - "TLSv1": (3, 1), - "TLSv1.1": (3, 2), - "TLSv1.2": (3, 3), -} - - -def _build_tls_unknown_ca_alert(version: str) -> bytes: - """ - Builds a TLS alert record for an unknown CA. - """ - ver_maj, ver_min = TLS_PROTOCOL_VERSIONS[version] - severity_fatal = 0x02 - description_unknown_ca = 0x30 - msg = struct.pack(">BB", severity_fatal, description_unknown_ca) - msg_len = len(msg) - record_type_alert = 0x15 - record = struct.pack(">BBBH", record_type_alert, ver_maj, ver_min, msg_len) + msg - return record - - -class SecurityConst: - """ - A class object that acts as essentially a namespace for Security constants. - """ - - kSSLSessionOptionBreakOnServerAuth = 0 - - kSSLProtocol2 = 1 - kSSLProtocol3 = 2 - kTLSProtocol1 = 4 - kTLSProtocol11 = 7 - kTLSProtocol12 = 8 - # SecureTransport does not support TLS 1.3 even if there's a constant for it - kTLSProtocol13 = 10 - kTLSProtocolMaxSupported = 999 - - kSSLClientSide = 1 - kSSLStreamType = 0 - - kSecFormatPEMSequence = 10 - - kSecTrustResultInvalid = 0 - kSecTrustResultProceed = 1 - # This gap is present on purpose: this was kSecTrustResultConfirm, which - # is deprecated. - kSecTrustResultDeny = 3 - kSecTrustResultUnspecified = 4 - kSecTrustResultRecoverableTrustFailure = 5 - kSecTrustResultFatalTrustFailure = 6 - kSecTrustResultOtherError = 7 - - errSSLProtocol = -9800 - errSSLWouldBlock = -9803 - errSSLClosedGraceful = -9805 - errSSLClosedNoNotify = -9816 - errSSLClosedAbort = -9806 - - errSSLXCertChainInvalid = -9807 - errSSLCrypto = -9809 - errSSLInternal = -9810 - errSSLCertExpired = -9814 - errSSLCertNotYetValid = -9815 - errSSLUnknownRootCert = -9812 - errSSLNoRootCert = -9813 - errSSLHostNameMismatch = -9843 - errSSLPeerHandshakeFail = -9824 - errSSLPeerUserCancelled = -9839 - errSSLWeakPeerEphemeralDHKey = -9850 - errSSLServerAuthCompleted = -9841 - errSSLRecordOverflow = -9847 - - errSecVerifyFailed = -67808 - errSecNoTrustSettings = -25263 - errSecItemNotFound = -25300 - errSecInvalidTrustSettings = -25262 diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py b/venv/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py deleted file mode 100644 index 74b35883bfdd214cb784215a0b83ff2c0f5f23c3..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py +++ /dev/null @@ -1,548 +0,0 @@ -""" -Module for using pyOpenSSL as a TLS backend. This module was relevant before -the standard library ``ssl`` module supported SNI, but now that we've dropped -support for Python 2.7 all relevant Python versions support SNI so -**this module is no longer recommended**. - -This needs the following packages installed: - -* `pyOpenSSL`_ (tested with 16.0.0) -* `cryptography`_ (minimum 1.3.4, from pyopenssl) -* `idna`_ (minimum 2.0, from cryptography) - -However, pyOpenSSL depends on cryptography, which depends on idna, so while we -use all three directly here we end up having relatively few packages required. - -You can install them with the following command: - -.. code-block:: bash - - $ python -m pip install pyopenssl cryptography idna - -To activate certificate checking, call -:func:`~urllib3.contrib.pyopenssl.inject_into_urllib3` from your Python code -before you begin making HTTP requests. This can be done in a ``sitecustomize`` -module, or at any other time before your application begins using ``urllib3``, -like this: - -.. code-block:: python - - try: - import urllib3.contrib.pyopenssl - urllib3.contrib.pyopenssl.inject_into_urllib3() - except ImportError: - pass - -.. _pyopenssl: https://www.pyopenssl.org -.. _cryptography: https://cryptography.io -.. _idna: https://github.com/kjd/idna -""" - -from __future__ import annotations - -import OpenSSL.SSL # type: ignore[import] -from cryptography import x509 - -try: - from cryptography.x509 import UnsupportedExtension # type: ignore[attr-defined] -except ImportError: - # UnsupportedExtension is gone in cryptography >= 2.1.0 - class UnsupportedExtension(Exception): # type: ignore[no-redef] - pass - - -import logging -import ssl -import typing -from io import BytesIO -from socket import socket as socket_cls -from socket import timeout - -from .. import util - -if typing.TYPE_CHECKING: - from OpenSSL.crypto import X509 # type: ignore[import] - - -__all__ = ["inject_into_urllib3", "extract_from_urllib3"] - -# Map from urllib3 to PyOpenSSL compatible parameter-values. -_openssl_versions = { - util.ssl_.PROTOCOL_TLS: OpenSSL.SSL.SSLv23_METHOD, # type: ignore[attr-defined] - util.ssl_.PROTOCOL_TLS_CLIENT: OpenSSL.SSL.SSLv23_METHOD, # type: ignore[attr-defined] - ssl.PROTOCOL_TLSv1: OpenSSL.SSL.TLSv1_METHOD, -} - -if hasattr(ssl, "PROTOCOL_TLSv1_1") and hasattr(OpenSSL.SSL, "TLSv1_1_METHOD"): - _openssl_versions[ssl.PROTOCOL_TLSv1_1] = OpenSSL.SSL.TLSv1_1_METHOD - -if hasattr(ssl, "PROTOCOL_TLSv1_2") and hasattr(OpenSSL.SSL, "TLSv1_2_METHOD"): - _openssl_versions[ssl.PROTOCOL_TLSv1_2] = OpenSSL.SSL.TLSv1_2_METHOD - - -_stdlib_to_openssl_verify = { - ssl.CERT_NONE: OpenSSL.SSL.VERIFY_NONE, - ssl.CERT_OPTIONAL: OpenSSL.SSL.VERIFY_PEER, - ssl.CERT_REQUIRED: OpenSSL.SSL.VERIFY_PEER - + OpenSSL.SSL.VERIFY_FAIL_IF_NO_PEER_CERT, -} -_openssl_to_stdlib_verify = {v: k for k, v in _stdlib_to_openssl_verify.items()} - -# The SSLvX values are the most likely to be missing in the future -# but we check them all just to be sure. -_OP_NO_SSLv2_OR_SSLv3: int = getattr(OpenSSL.SSL, "OP_NO_SSLv2", 0) | getattr( - OpenSSL.SSL, "OP_NO_SSLv3", 0 -) -_OP_NO_TLSv1: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1", 0) -_OP_NO_TLSv1_1: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_1", 0) -_OP_NO_TLSv1_2: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_2", 0) -_OP_NO_TLSv1_3: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_3", 0) - -_openssl_to_ssl_minimum_version: dict[int, int] = { - ssl.TLSVersion.MINIMUM_SUPPORTED: _OP_NO_SSLv2_OR_SSLv3, - ssl.TLSVersion.TLSv1: _OP_NO_SSLv2_OR_SSLv3, - ssl.TLSVersion.TLSv1_1: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1, - ssl.TLSVersion.TLSv1_2: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1, - ssl.TLSVersion.TLSv1_3: ( - _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 - ), - ssl.TLSVersion.MAXIMUM_SUPPORTED: ( - _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 - ), -} -_openssl_to_ssl_maximum_version: dict[int, int] = { - ssl.TLSVersion.MINIMUM_SUPPORTED: ( - _OP_NO_SSLv2_OR_SSLv3 - | _OP_NO_TLSv1 - | _OP_NO_TLSv1_1 - | _OP_NO_TLSv1_2 - | _OP_NO_TLSv1_3 - ), - ssl.TLSVersion.TLSv1: ( - _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 | _OP_NO_TLSv1_3 - ), - ssl.TLSVersion.TLSv1_1: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_2 | _OP_NO_TLSv1_3, - ssl.TLSVersion.TLSv1_2: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_3, - ssl.TLSVersion.TLSv1_3: _OP_NO_SSLv2_OR_SSLv3, - ssl.TLSVersion.MAXIMUM_SUPPORTED: _OP_NO_SSLv2_OR_SSLv3, -} - -# OpenSSL will only write 16K at a time -SSL_WRITE_BLOCKSIZE = 16384 - -orig_util_SSLContext = util.ssl_.SSLContext - - -log = logging.getLogger(__name__) - - -def inject_into_urllib3() -> None: - "Monkey-patch urllib3 with PyOpenSSL-backed SSL-support." - - _validate_dependencies_met() - - util.SSLContext = PyOpenSSLContext # type: ignore[assignment] - util.ssl_.SSLContext = PyOpenSSLContext # type: ignore[assignment] - util.IS_PYOPENSSL = True - util.ssl_.IS_PYOPENSSL = True - - -def extract_from_urllib3() -> None: - "Undo monkey-patching by :func:`inject_into_urllib3`." - - util.SSLContext = orig_util_SSLContext - util.ssl_.SSLContext = orig_util_SSLContext - util.IS_PYOPENSSL = False - util.ssl_.IS_PYOPENSSL = False - - -def _validate_dependencies_met() -> None: - """ - Verifies that PyOpenSSL's package-level dependencies have been met. - Throws `ImportError` if they are not met. - """ - # Method added in `cryptography==1.1`; not available in older versions - from cryptography.x509.extensions import Extensions - - if getattr(Extensions, "get_extension_for_class", None) is None: - raise ImportError( - "'cryptography' module missing required functionality. " - "Try upgrading to v1.3.4 or newer." - ) - - # pyOpenSSL 0.14 and above use cryptography for OpenSSL bindings. The _x509 - # attribute is only present on those versions. - from OpenSSL.crypto import X509 - - x509 = X509() - if getattr(x509, "_x509", None) is None: - raise ImportError( - "'pyOpenSSL' module missing required functionality. " - "Try upgrading to v0.14 or newer." - ) - - -def _dnsname_to_stdlib(name: str) -> str | None: - """ - Converts a dNSName SubjectAlternativeName field to the form used by the - standard library on the given Python version. - - Cryptography produces a dNSName as a unicode string that was idna-decoded - from ASCII bytes. We need to idna-encode that string to get it back, and - then on Python 3 we also need to convert to unicode via UTF-8 (the stdlib - uses PyUnicode_FromStringAndSize on it, which decodes via UTF-8). - - If the name cannot be idna-encoded then we return None signalling that - the name given should be skipped. - """ - - def idna_encode(name: str) -> bytes | None: - """ - Borrowed wholesale from the Python Cryptography Project. It turns out - that we can't just safely call `idna.encode`: it can explode for - wildcard names. This avoids that problem. - """ - import idna - - try: - for prefix in ["*.", "."]: - if name.startswith(prefix): - name = name[len(prefix) :] - return prefix.encode("ascii") + idna.encode(name) - return idna.encode(name) - except idna.core.IDNAError: - return None - - # Don't send IPv6 addresses through the IDNA encoder. - if ":" in name: - return name - - encoded_name = idna_encode(name) - if encoded_name is None: - return None - return encoded_name.decode("utf-8") - - -def get_subj_alt_name(peer_cert: X509) -> list[tuple[str, str]]: - """ - Given an PyOpenSSL certificate, provides all the subject alternative names. - """ - cert = peer_cert.to_cryptography() - - # We want to find the SAN extension. Ask Cryptography to locate it (it's - # faster than looping in Python) - try: - ext = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value - except x509.ExtensionNotFound: - # No such extension, return the empty list. - return [] - except ( - x509.DuplicateExtension, - UnsupportedExtension, - x509.UnsupportedGeneralNameType, - UnicodeError, - ) as e: - # A problem has been found with the quality of the certificate. Assume - # no SAN field is present. - log.warning( - "A problem was encountered with the certificate that prevented " - "urllib3 from finding the SubjectAlternativeName field. This can " - "affect certificate validation. The error was %s", - e, - ) - return [] - - # We want to return dNSName and iPAddress fields. We need to cast the IPs - # back to strings because the match_hostname function wants them as - # strings. - # Sadly the DNS names need to be idna encoded and then, on Python 3, UTF-8 - # decoded. This is pretty frustrating, but that's what the standard library - # does with certificates, and so we need to attempt to do the same. - # We also want to skip over names which cannot be idna encoded. - names = [ - ("DNS", name) - for name in map(_dnsname_to_stdlib, ext.get_values_for_type(x509.DNSName)) - if name is not None - ] - names.extend( - ("IP Address", str(name)) for name in ext.get_values_for_type(x509.IPAddress) - ) - - return names - - -class WrappedSocket: - """API-compatibility wrapper for Python OpenSSL's Connection-class.""" - - def __init__( - self, - connection: OpenSSL.SSL.Connection, - socket: socket_cls, - suppress_ragged_eofs: bool = True, - ) -> None: - self.connection = connection - self.socket = socket - self.suppress_ragged_eofs = suppress_ragged_eofs - self._io_refs = 0 - self._closed = False - - def fileno(self) -> int: - return self.socket.fileno() - - # Copy-pasted from Python 3.5 source code - def _decref_socketios(self) -> None: - if self._io_refs > 0: - self._io_refs -= 1 - if self._closed: - self.close() - - def recv(self, *args: typing.Any, **kwargs: typing.Any) -> bytes: - try: - data = self.connection.recv(*args, **kwargs) - except OpenSSL.SSL.SysCallError as e: - if self.suppress_ragged_eofs and e.args == (-1, "Unexpected EOF"): - return b"" - else: - raise OSError(e.args[0], str(e)) from e - except OpenSSL.SSL.ZeroReturnError: - if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN: - return b"" - else: - raise - except OpenSSL.SSL.WantReadError as e: - if not util.wait_for_read(self.socket, self.socket.gettimeout()): - raise timeout("The read operation timed out") from e - else: - return self.recv(*args, **kwargs) - - # TLS 1.3 post-handshake authentication - except OpenSSL.SSL.Error as e: - raise ssl.SSLError(f"read error: {e!r}") from e - else: - return data # type: ignore[no-any-return] - - def recv_into(self, *args: typing.Any, **kwargs: typing.Any) -> int: - try: - return self.connection.recv_into(*args, **kwargs) # type: ignore[no-any-return] - except OpenSSL.SSL.SysCallError as e: - if self.suppress_ragged_eofs and e.args == (-1, "Unexpected EOF"): - return 0 - else: - raise OSError(e.args[0], str(e)) from e - except OpenSSL.SSL.ZeroReturnError: - if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN: - return 0 - else: - raise - except OpenSSL.SSL.WantReadError as e: - if not util.wait_for_read(self.socket, self.socket.gettimeout()): - raise timeout("The read operation timed out") from e - else: - return self.recv_into(*args, **kwargs) - - # TLS 1.3 post-handshake authentication - except OpenSSL.SSL.Error as e: - raise ssl.SSLError(f"read error: {e!r}") from e - - def settimeout(self, timeout: float) -> None: - return self.socket.settimeout(timeout) - - def _send_until_done(self, data: bytes) -> int: - while True: - try: - return self.connection.send(data) # type: ignore[no-any-return] - except OpenSSL.SSL.WantWriteError as e: - if not util.wait_for_write(self.socket, self.socket.gettimeout()): - raise timeout() from e - continue - except OpenSSL.SSL.SysCallError as e: - raise OSError(e.args[0], str(e)) from e - - def sendall(self, data: bytes) -> None: - total_sent = 0 - while total_sent < len(data): - sent = self._send_until_done( - data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE] - ) - total_sent += sent - - def shutdown(self) -> None: - # FIXME rethrow compatible exceptions should we ever use this - self.connection.shutdown() - - def close(self) -> None: - self._closed = True - if self._io_refs <= 0: - self._real_close() - - def _real_close(self) -> None: - try: - return self.connection.close() # type: ignore[no-any-return] - except OpenSSL.SSL.Error: - return - - def getpeercert( - self, binary_form: bool = False - ) -> dict[str, list[typing.Any]] | None: - x509 = self.connection.get_peer_certificate() - - if not x509: - return x509 # type: ignore[no-any-return] - - if binary_form: - return OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_ASN1, x509) # type: ignore[no-any-return] - - return { - "subject": ((("commonName", x509.get_subject().CN),),), # type: ignore[dict-item] - "subjectAltName": get_subj_alt_name(x509), - } - - def version(self) -> str: - return self.connection.get_protocol_version_name() # type: ignore[no-any-return] - - -WrappedSocket.makefile = socket_cls.makefile # type: ignore[attr-defined] - - -class PyOpenSSLContext: - """ - I am a wrapper class for the PyOpenSSL ``Context`` object. I am responsible - for translating the interface of the standard library ``SSLContext`` object - to calls into PyOpenSSL. - """ - - def __init__(self, protocol: int) -> None: - self.protocol = _openssl_versions[protocol] - self._ctx = OpenSSL.SSL.Context(self.protocol) - self._options = 0 - self.check_hostname = False - self._minimum_version: int = ssl.TLSVersion.MINIMUM_SUPPORTED - self._maximum_version: int = ssl.TLSVersion.MAXIMUM_SUPPORTED - - @property - def options(self) -> int: - return self._options - - @options.setter - def options(self, value: int) -> None: - self._options = value - self._set_ctx_options() - - @property - def verify_mode(self) -> int: - return _openssl_to_stdlib_verify[self._ctx.get_verify_mode()] - - @verify_mode.setter - def verify_mode(self, value: ssl.VerifyMode) -> None: - self._ctx.set_verify(_stdlib_to_openssl_verify[value], _verify_callback) - - def set_default_verify_paths(self) -> None: - self._ctx.set_default_verify_paths() - - def set_ciphers(self, ciphers: bytes | str) -> None: - if isinstance(ciphers, str): - ciphers = ciphers.encode("utf-8") - self._ctx.set_cipher_list(ciphers) - - def load_verify_locations( - self, - cafile: str | None = None, - capath: str | None = None, - cadata: bytes | None = None, - ) -> None: - if cafile is not None: - cafile = cafile.encode("utf-8") # type: ignore[assignment] - if capath is not None: - capath = capath.encode("utf-8") # type: ignore[assignment] - try: - self._ctx.load_verify_locations(cafile, capath) - if cadata is not None: - self._ctx.load_verify_locations(BytesIO(cadata)) - except OpenSSL.SSL.Error as e: - raise ssl.SSLError(f"unable to load trusted certificates: {e!r}") from e - - def load_cert_chain( - self, - certfile: str, - keyfile: str | None = None, - password: str | None = None, - ) -> None: - try: - self._ctx.use_certificate_chain_file(certfile) - if password is not None: - if not isinstance(password, bytes): - password = password.encode("utf-8") # type: ignore[assignment] - self._ctx.set_passwd_cb(lambda *_: password) - self._ctx.use_privatekey_file(keyfile or certfile) - except OpenSSL.SSL.Error as e: - raise ssl.SSLError(f"Unable to load certificate chain: {e!r}") from e - - def set_alpn_protocols(self, protocols: list[bytes | str]) -> None: - protocols = [util.util.to_bytes(p, "ascii") for p in protocols] - return self._ctx.set_alpn_protos(protocols) # type: ignore[no-any-return] - - def wrap_socket( - self, - sock: socket_cls, - server_side: bool = False, - do_handshake_on_connect: bool = True, - suppress_ragged_eofs: bool = True, - server_hostname: bytes | str | None = None, - ) -> WrappedSocket: - cnx = OpenSSL.SSL.Connection(self._ctx, sock) - - # If server_hostname is an IP, don't use it for SNI, per RFC6066 Section 3 - if server_hostname and not util.ssl_.is_ipaddress(server_hostname): - if isinstance(server_hostname, str): - server_hostname = server_hostname.encode("utf-8") - cnx.set_tlsext_host_name(server_hostname) - - cnx.set_connect_state() - - while True: - try: - cnx.do_handshake() - except OpenSSL.SSL.WantReadError as e: - if not util.wait_for_read(sock, sock.gettimeout()): - raise timeout("select timed out") from e - continue - except OpenSSL.SSL.Error as e: - raise ssl.SSLError(f"bad handshake: {e!r}") from e - break - - return WrappedSocket(cnx, sock) - - def _set_ctx_options(self) -> None: - self._ctx.set_options( - self._options - | _openssl_to_ssl_minimum_version[self._minimum_version] - | _openssl_to_ssl_maximum_version[self._maximum_version] - ) - - @property - def minimum_version(self) -> int: - return self._minimum_version - - @minimum_version.setter - def minimum_version(self, minimum_version: int) -> None: - self._minimum_version = minimum_version - self._set_ctx_options() - - @property - def maximum_version(self) -> int: - return self._maximum_version - - @maximum_version.setter - def maximum_version(self, maximum_version: int) -> None: - self._maximum_version = maximum_version - self._set_ctx_options() - - -def _verify_callback( - cnx: OpenSSL.SSL.Connection, - x509: X509, - err_no: int, - err_depth: int, - return_code: int, -) -> bool: - return err_no == 0 diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/securetransport.py b/venv/lib/python3.8/site-packages/urllib3/contrib/securetransport.py deleted file mode 100644 index 11beb3dfefb7e92c2e37440bd2a29809657d5f47..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/contrib/securetransport.py +++ /dev/null @@ -1,913 +0,0 @@ -""" -SecureTranport support for urllib3 via ctypes. - -This makes platform-native TLS available to urllib3 users on macOS without the -use of a compiler. This is an important feature because the Python Package -Index is moving to become a TLSv1.2-or-higher server, and the default OpenSSL -that ships with macOS is not capable of doing TLSv1.2. The only way to resolve -this is to give macOS users an alternative solution to the problem, and that -solution is to use SecureTransport. - -We use ctypes here because this solution must not require a compiler. That's -because pip is not allowed to require a compiler either. - -This is not intended to be a seriously long-term solution to this problem. -The hope is that PEP 543 will eventually solve this issue for us, at which -point we can retire this contrib module. But in the short term, we need to -solve the impending tire fire that is Python on Mac without this kind of -contrib module. So...here we are. - -To use this module, simply import and inject it:: - - import urllib3.contrib.securetransport - urllib3.contrib.securetransport.inject_into_urllib3() - -Happy TLSing! - -This code is a bastardised version of the code found in Will Bond's oscrypto -library. An enormous debt is owed to him for blazing this trail for us. For -that reason, this code should be considered to be covered both by urllib3's -license and by oscrypto's: - -.. code-block:: - - Copyright (c) 2015-2016 Will Bond - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -""" - -from __future__ import annotations - -import contextlib -import ctypes -import errno -import os.path -import shutil -import socket -import ssl -import struct -import threading -import typing -import warnings -import weakref -from socket import socket as socket_cls - -from .. import util -from ._securetransport.bindings import ( # type: ignore[attr-defined] - CoreFoundation, - Security, -) -from ._securetransport.low_level import ( - SecurityConst, - _assert_no_error, - _build_tls_unknown_ca_alert, - _cert_array_from_pem, - _create_cfstring_array, - _load_client_cert_chain, - _temporary_keychain, -) - -warnings.warn( - "'urllib3.contrib.securetransport' module is deprecated and will be removed " - "in urllib3 v2.1.0. Read more in this issue: " - "https://github.com/urllib3/urllib3/issues/2681", - category=DeprecationWarning, - stacklevel=2, -) - -if typing.TYPE_CHECKING: - from typing_extensions import Literal - -__all__ = ["inject_into_urllib3", "extract_from_urllib3"] - -orig_util_SSLContext = util.ssl_.SSLContext - -# This dictionary is used by the read callback to obtain a handle to the -# calling wrapped socket. This is a pretty silly approach, but for now it'll -# do. I feel like I should be able to smuggle a handle to the wrapped socket -# directly in the SSLConnectionRef, but for now this approach will work I -# guess. -# -# We need to lock around this structure for inserts, but we don't do it for -# reads/writes in the callbacks. The reasoning here goes as follows: -# -# 1. It is not possible to call into the callbacks before the dictionary is -# populated, so once in the callback the id must be in the dictionary. -# 2. The callbacks don't mutate the dictionary, they only read from it, and -# so cannot conflict with any of the insertions. -# -# This is good: if we had to lock in the callbacks we'd drastically slow down -# the performance of this code. -_connection_refs: weakref.WeakValueDictionary[ - int, WrappedSocket -] = weakref.WeakValueDictionary() -_connection_ref_lock = threading.Lock() - -# Limit writes to 16kB. This is OpenSSL's limit, but we'll cargo-cult it over -# for no better reason than we need *a* limit, and this one is right there. -SSL_WRITE_BLOCKSIZE = 16384 - -# Basically this is simple: for PROTOCOL_SSLv23 we turn it into a low of -# TLSv1 and a high of TLSv1.2. For everything else, we pin to that version. -# TLSv1 to 1.2 are supported on macOS 10.8+ -_protocol_to_min_max = { - util.ssl_.PROTOCOL_TLS: (SecurityConst.kTLSProtocol1, SecurityConst.kTLSProtocol12), # type: ignore[attr-defined] - util.ssl_.PROTOCOL_TLS_CLIENT: ( # type: ignore[attr-defined] - SecurityConst.kTLSProtocol1, - SecurityConst.kTLSProtocol12, - ), -} - -if hasattr(ssl, "PROTOCOL_SSLv2"): - _protocol_to_min_max[ssl.PROTOCOL_SSLv2] = ( - SecurityConst.kSSLProtocol2, - SecurityConst.kSSLProtocol2, - ) -if hasattr(ssl, "PROTOCOL_SSLv3"): - _protocol_to_min_max[ssl.PROTOCOL_SSLv3] = ( - SecurityConst.kSSLProtocol3, - SecurityConst.kSSLProtocol3, - ) -if hasattr(ssl, "PROTOCOL_TLSv1"): - _protocol_to_min_max[ssl.PROTOCOL_TLSv1] = ( - SecurityConst.kTLSProtocol1, - SecurityConst.kTLSProtocol1, - ) -if hasattr(ssl, "PROTOCOL_TLSv1_1"): - _protocol_to_min_max[ssl.PROTOCOL_TLSv1_1] = ( - SecurityConst.kTLSProtocol11, - SecurityConst.kTLSProtocol11, - ) -if hasattr(ssl, "PROTOCOL_TLSv1_2"): - _protocol_to_min_max[ssl.PROTOCOL_TLSv1_2] = ( - SecurityConst.kTLSProtocol12, - SecurityConst.kTLSProtocol12, - ) - - -_tls_version_to_st: dict[int, int] = { - ssl.TLSVersion.MINIMUM_SUPPORTED: SecurityConst.kTLSProtocol1, - ssl.TLSVersion.TLSv1: SecurityConst.kTLSProtocol1, - ssl.TLSVersion.TLSv1_1: SecurityConst.kTLSProtocol11, - ssl.TLSVersion.TLSv1_2: SecurityConst.kTLSProtocol12, - ssl.TLSVersion.MAXIMUM_SUPPORTED: SecurityConst.kTLSProtocol12, -} - - -def inject_into_urllib3() -> None: - """ - Monkey-patch urllib3 with SecureTransport-backed SSL-support. - """ - util.SSLContext = SecureTransportContext # type: ignore[assignment] - util.ssl_.SSLContext = SecureTransportContext # type: ignore[assignment] - util.IS_SECURETRANSPORT = True - util.ssl_.IS_SECURETRANSPORT = True - - -def extract_from_urllib3() -> None: - """ - Undo monkey-patching by :func:`inject_into_urllib3`. - """ - util.SSLContext = orig_util_SSLContext - util.ssl_.SSLContext = orig_util_SSLContext - util.IS_SECURETRANSPORT = False - util.ssl_.IS_SECURETRANSPORT = False - - -def _read_callback( - connection_id: int, data_buffer: int, data_length_pointer: bytearray -) -> int: - """ - SecureTransport read callback. This is called by ST to request that data - be returned from the socket. - """ - wrapped_socket = None - try: - wrapped_socket = _connection_refs.get(connection_id) - if wrapped_socket is None: - return SecurityConst.errSSLInternal - base_socket = wrapped_socket.socket - - requested_length = data_length_pointer[0] - - timeout = wrapped_socket.gettimeout() - error = None - read_count = 0 - - try: - while read_count < requested_length: - if timeout is None or timeout >= 0: - if not util.wait_for_read(base_socket, timeout): - raise OSError(errno.EAGAIN, "timed out") - - remaining = requested_length - read_count - buffer = (ctypes.c_char * remaining).from_address( - data_buffer + read_count - ) - chunk_size = base_socket.recv_into(buffer, remaining) - read_count += chunk_size - if not chunk_size: - if not read_count: - return SecurityConst.errSSLClosedGraceful - break - except OSError as e: - error = e.errno - - if error is not None and error != errno.EAGAIN: - data_length_pointer[0] = read_count - if error == errno.ECONNRESET or error == errno.EPIPE: - return SecurityConst.errSSLClosedAbort - raise - - data_length_pointer[0] = read_count - - if read_count != requested_length: - return SecurityConst.errSSLWouldBlock - - return 0 - except Exception as e: - if wrapped_socket is not None: - wrapped_socket._exception = e - return SecurityConst.errSSLInternal - - -def _write_callback( - connection_id: int, data_buffer: int, data_length_pointer: bytearray -) -> int: - """ - SecureTransport write callback. This is called by ST to request that data - actually be sent on the network. - """ - wrapped_socket = None - try: - wrapped_socket = _connection_refs.get(connection_id) - if wrapped_socket is None: - return SecurityConst.errSSLInternal - base_socket = wrapped_socket.socket - - bytes_to_write = data_length_pointer[0] - data = ctypes.string_at(data_buffer, bytes_to_write) - - timeout = wrapped_socket.gettimeout() - error = None - sent = 0 - - try: - while sent < bytes_to_write: - if timeout is None or timeout >= 0: - if not util.wait_for_write(base_socket, timeout): - raise OSError(errno.EAGAIN, "timed out") - chunk_sent = base_socket.send(data) - sent += chunk_sent - - # This has some needless copying here, but I'm not sure there's - # much value in optimising this data path. - data = data[chunk_sent:] - except OSError as e: - error = e.errno - - if error is not None and error != errno.EAGAIN: - data_length_pointer[0] = sent - if error == errno.ECONNRESET or error == errno.EPIPE: - return SecurityConst.errSSLClosedAbort - raise - - data_length_pointer[0] = sent - - if sent != bytes_to_write: - return SecurityConst.errSSLWouldBlock - - return 0 - except Exception as e: - if wrapped_socket is not None: - wrapped_socket._exception = e - return SecurityConst.errSSLInternal - - -# We need to keep these two objects references alive: if they get GC'd while -# in use then SecureTransport could attempt to call a function that is in freed -# memory. That would be...uh...bad. Yeah, that's the word. Bad. -_read_callback_pointer = Security.SSLReadFunc(_read_callback) -_write_callback_pointer = Security.SSLWriteFunc(_write_callback) - - -class WrappedSocket: - """ - API-compatibility wrapper for Python's OpenSSL wrapped socket object. - """ - - def __init__(self, socket: socket_cls) -> None: - self.socket = socket - self.context = None - self._io_refs = 0 - self._closed = False - self._real_closed = False - self._exception: Exception | None = None - self._keychain = None - self._keychain_dir: str | None = None - self._client_cert_chain = None - - # We save off the previously-configured timeout and then set it to - # zero. This is done because we use select and friends to handle the - # timeouts, but if we leave the timeout set on the lower socket then - # Python will "kindly" call select on that socket again for us. Avoid - # that by forcing the timeout to zero. - self._timeout = self.socket.gettimeout() - self.socket.settimeout(0) - - @contextlib.contextmanager - def _raise_on_error(self) -> typing.Generator[None, None, None]: - """ - A context manager that can be used to wrap calls that do I/O from - SecureTransport. If any of the I/O callbacks hit an exception, this - context manager will correctly propagate the exception after the fact. - This avoids silently swallowing those exceptions. - - It also correctly forces the socket closed. - """ - self._exception = None - - # We explicitly don't catch around this yield because in the unlikely - # event that an exception was hit in the block we don't want to swallow - # it. - yield - if self._exception is not None: - exception, self._exception = self._exception, None - self._real_close() - raise exception - - def _set_alpn_protocols(self, protocols: list[bytes] | None) -> None: - """ - Sets up the ALPN protocols on the context. - """ - if not protocols: - return - protocols_arr = _create_cfstring_array(protocols) - try: - result = Security.SSLSetALPNProtocols(self.context, protocols_arr) - _assert_no_error(result) - finally: - CoreFoundation.CFRelease(protocols_arr) - - def _custom_validate(self, verify: bool, trust_bundle: bytes | None) -> None: - """ - Called when we have set custom validation. We do this in two cases: - first, when cert validation is entirely disabled; and second, when - using a custom trust DB. - Raises an SSLError if the connection is not trusted. - """ - # If we disabled cert validation, just say: cool. - if not verify or trust_bundle is None: - return - - successes = ( - SecurityConst.kSecTrustResultUnspecified, - SecurityConst.kSecTrustResultProceed, - ) - try: - trust_result = self._evaluate_trust(trust_bundle) - if trust_result in successes: - return - reason = f"error code: {int(trust_result)}" - exc = None - except Exception as e: - # Do not trust on error - reason = f"exception: {e!r}" - exc = e - - # SecureTransport does not send an alert nor shuts down the connection. - rec = _build_tls_unknown_ca_alert(self.version()) - self.socket.sendall(rec) - # close the connection immediately - # l_onoff = 1, activate linger - # l_linger = 0, linger for 0 seoncds - opts = struct.pack("ii", 1, 0) - self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, opts) - self._real_close() - raise ssl.SSLError(f"certificate verify failed, {reason}") from exc - - def _evaluate_trust(self, trust_bundle: bytes) -> int: - # We want data in memory, so load it up. - if os.path.isfile(trust_bundle): - with open(trust_bundle, "rb") as f: - trust_bundle = f.read() - - cert_array = None - trust = Security.SecTrustRef() - - try: - # Get a CFArray that contains the certs we want. - cert_array = _cert_array_from_pem(trust_bundle) - - # Ok, now the hard part. We want to get the SecTrustRef that ST has - # created for this connection, shove our CAs into it, tell ST to - # ignore everything else it knows, and then ask if it can build a - # chain. This is a buuuunch of code. - result = Security.SSLCopyPeerTrust(self.context, ctypes.byref(trust)) - _assert_no_error(result) - if not trust: - raise ssl.SSLError("Failed to copy trust reference") - - result = Security.SecTrustSetAnchorCertificates(trust, cert_array) - _assert_no_error(result) - - result = Security.SecTrustSetAnchorCertificatesOnly(trust, True) - _assert_no_error(result) - - trust_result = Security.SecTrustResultType() - result = Security.SecTrustEvaluate(trust, ctypes.byref(trust_result)) - _assert_no_error(result) - finally: - if trust: - CoreFoundation.CFRelease(trust) - - if cert_array is not None: - CoreFoundation.CFRelease(cert_array) - - return trust_result.value # type: ignore[no-any-return] - - def handshake( - self, - server_hostname: bytes | str | None, - verify: bool, - trust_bundle: bytes | None, - min_version: int, - max_version: int, - client_cert: str | None, - client_key: str | None, - client_key_passphrase: typing.Any, - alpn_protocols: list[bytes] | None, - ) -> None: - """ - Actually performs the TLS handshake. This is run automatically by - wrapped socket, and shouldn't be needed in user code. - """ - # First, we do the initial bits of connection setup. We need to create - # a context, set its I/O funcs, and set the connection reference. - self.context = Security.SSLCreateContext( - None, SecurityConst.kSSLClientSide, SecurityConst.kSSLStreamType - ) - result = Security.SSLSetIOFuncs( - self.context, _read_callback_pointer, _write_callback_pointer - ) - _assert_no_error(result) - - # Here we need to compute the handle to use. We do this by taking the - # id of self modulo 2**31 - 1. If this is already in the dictionary, we - # just keep incrementing by one until we find a free space. - with _connection_ref_lock: - handle = id(self) % 2147483647 - while handle in _connection_refs: - handle = (handle + 1) % 2147483647 - _connection_refs[handle] = self - - result = Security.SSLSetConnection(self.context, handle) - _assert_no_error(result) - - # If we have a server hostname, we should set that too. - # RFC6066 Section 3 tells us not to use SNI when the host is an IP, but we have - # to do it anyway to match server_hostname against the server certificate - if server_hostname: - if not isinstance(server_hostname, bytes): - server_hostname = server_hostname.encode("utf-8") - - result = Security.SSLSetPeerDomainName( - self.context, server_hostname, len(server_hostname) - ) - _assert_no_error(result) - - # Setup the ALPN protocols. - self._set_alpn_protocols(alpn_protocols) - - # Set the minimum and maximum TLS versions. - result = Security.SSLSetProtocolVersionMin(self.context, min_version) - _assert_no_error(result) - - result = Security.SSLSetProtocolVersionMax(self.context, max_version) - _assert_no_error(result) - - # If there's a trust DB, we need to use it. We do that by telling - # SecureTransport to break on server auth. We also do that if we don't - # want to validate the certs at all: we just won't actually do any - # authing in that case. - if not verify or trust_bundle is not None: - result = Security.SSLSetSessionOption( - self.context, SecurityConst.kSSLSessionOptionBreakOnServerAuth, True - ) - _assert_no_error(result) - - # If there's a client cert, we need to use it. - if client_cert: - self._keychain, self._keychain_dir = _temporary_keychain() - self._client_cert_chain = _load_client_cert_chain( - self._keychain, client_cert, client_key - ) - result = Security.SSLSetCertificate(self.context, self._client_cert_chain) - _assert_no_error(result) - - while True: - with self._raise_on_error(): - result = Security.SSLHandshake(self.context) - - if result == SecurityConst.errSSLWouldBlock: - raise socket.timeout("handshake timed out") - elif result == SecurityConst.errSSLServerAuthCompleted: - self._custom_validate(verify, trust_bundle) - continue - else: - _assert_no_error(result) - break - - def fileno(self) -> int: - return self.socket.fileno() - - # Copy-pasted from Python 3.5 source code - def _decref_socketios(self) -> None: - if self._io_refs > 0: - self._io_refs -= 1 - if self._closed: - self.close() - - def recv(self, bufsiz: int) -> bytes: - buffer = ctypes.create_string_buffer(bufsiz) - bytes_read = self.recv_into(buffer, bufsiz) - data = buffer[:bytes_read] - return typing.cast(bytes, data) - - def recv_into( - self, buffer: ctypes.Array[ctypes.c_char], nbytes: int | None = None - ) -> int: - # Read short on EOF. - if self._real_closed: - return 0 - - if nbytes is None: - nbytes = len(buffer) - - buffer = (ctypes.c_char * nbytes).from_buffer(buffer) - processed_bytes = ctypes.c_size_t(0) - - with self._raise_on_error(): - result = Security.SSLRead( - self.context, buffer, nbytes, ctypes.byref(processed_bytes) - ) - - # There are some result codes that we want to treat as "not always - # errors". Specifically, those are errSSLWouldBlock, - # errSSLClosedGraceful, and errSSLClosedNoNotify. - if result == SecurityConst.errSSLWouldBlock: - # If we didn't process any bytes, then this was just a time out. - # However, we can get errSSLWouldBlock in situations when we *did* - # read some data, and in those cases we should just read "short" - # and return. - if processed_bytes.value == 0: - # Timed out, no data read. - raise socket.timeout("recv timed out") - elif result in ( - SecurityConst.errSSLClosedGraceful, - SecurityConst.errSSLClosedNoNotify, - ): - # The remote peer has closed this connection. We should do so as - # well. Note that we don't actually return here because in - # principle this could actually be fired along with return data. - # It's unlikely though. - self._real_close() - else: - _assert_no_error(result) - - # Ok, we read and probably succeeded. We should return whatever data - # was actually read. - return processed_bytes.value - - def settimeout(self, timeout: float) -> None: - self._timeout = timeout - - def gettimeout(self) -> float | None: - return self._timeout - - def send(self, data: bytes) -> int: - processed_bytes = ctypes.c_size_t(0) - - with self._raise_on_error(): - result = Security.SSLWrite( - self.context, data, len(data), ctypes.byref(processed_bytes) - ) - - if result == SecurityConst.errSSLWouldBlock and processed_bytes.value == 0: - # Timed out - raise socket.timeout("send timed out") - else: - _assert_no_error(result) - - # We sent, and probably succeeded. Tell them how much we sent. - return processed_bytes.value - - def sendall(self, data: bytes) -> None: - total_sent = 0 - while total_sent < len(data): - sent = self.send(data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE]) - total_sent += sent - - def shutdown(self) -> None: - with self._raise_on_error(): - Security.SSLClose(self.context) - - def close(self) -> None: - self._closed = True - # TODO: should I do clean shutdown here? Do I have to? - if self._io_refs <= 0: - self._real_close() - - def _real_close(self) -> None: - self._real_closed = True - if self.context: - CoreFoundation.CFRelease(self.context) - self.context = None - if self._client_cert_chain: - CoreFoundation.CFRelease(self._client_cert_chain) - self._client_cert_chain = None - if self._keychain: - Security.SecKeychainDelete(self._keychain) - CoreFoundation.CFRelease(self._keychain) - shutil.rmtree(self._keychain_dir) - self._keychain = self._keychain_dir = None - return self.socket.close() - - def getpeercert(self, binary_form: bool = False) -> bytes | None: - # Urgh, annoying. - # - # Here's how we do this: - # - # 1. Call SSLCopyPeerTrust to get hold of the trust object for this - # connection. - # 2. Call SecTrustGetCertificateAtIndex for index 0 to get the leaf. - # 3. To get the CN, call SecCertificateCopyCommonName and process that - # string so that it's of the appropriate type. - # 4. To get the SAN, we need to do something a bit more complex: - # a. Call SecCertificateCopyValues to get the data, requesting - # kSecOIDSubjectAltName. - # b. Mess about with this dictionary to try to get the SANs out. - # - # This is gross. Really gross. It's going to be a few hundred LoC extra - # just to repeat something that SecureTransport can *already do*. So my - # operating assumption at this time is that what we want to do is - # instead to just flag to urllib3 that it shouldn't do its own hostname - # validation when using SecureTransport. - if not binary_form: - raise ValueError("SecureTransport only supports dumping binary certs") - trust = Security.SecTrustRef() - certdata = None - der_bytes = None - - try: - # Grab the trust store. - result = Security.SSLCopyPeerTrust(self.context, ctypes.byref(trust)) - _assert_no_error(result) - if not trust: - # Probably we haven't done the handshake yet. No biggie. - return None - - cert_count = Security.SecTrustGetCertificateCount(trust) - if not cert_count: - # Also a case that might happen if we haven't handshaked. - # Handshook? Handshaken? - return None - - leaf = Security.SecTrustGetCertificateAtIndex(trust, 0) - assert leaf - - # Ok, now we want the DER bytes. - certdata = Security.SecCertificateCopyData(leaf) - assert certdata - - data_length = CoreFoundation.CFDataGetLength(certdata) - data_buffer = CoreFoundation.CFDataGetBytePtr(certdata) - der_bytes = ctypes.string_at(data_buffer, data_length) - finally: - if certdata: - CoreFoundation.CFRelease(certdata) - if trust: - CoreFoundation.CFRelease(trust) - - return der_bytes - - def version(self) -> str: - protocol = Security.SSLProtocol() - result = Security.SSLGetNegotiatedProtocolVersion( - self.context, ctypes.byref(protocol) - ) - _assert_no_error(result) - if protocol.value == SecurityConst.kTLSProtocol13: - raise ssl.SSLError("SecureTransport does not support TLS 1.3") - elif protocol.value == SecurityConst.kTLSProtocol12: - return "TLSv1.2" - elif protocol.value == SecurityConst.kTLSProtocol11: - return "TLSv1.1" - elif protocol.value == SecurityConst.kTLSProtocol1: - return "TLSv1" - elif protocol.value == SecurityConst.kSSLProtocol3: - return "SSLv3" - elif protocol.value == SecurityConst.kSSLProtocol2: - return "SSLv2" - else: - raise ssl.SSLError(f"Unknown TLS version: {protocol!r}") - - -def makefile( - self: socket_cls, - mode: ( - Literal["r"] | Literal["w"] | Literal["rw"] | Literal["wr"] | Literal[""] - ) = "r", - buffering: int | None = None, - *args: typing.Any, - **kwargs: typing.Any, -) -> typing.BinaryIO | typing.TextIO: - # We disable buffering with SecureTransport because it conflicts with - # the buffering that ST does internally (see issue #1153 for more). - buffering = 0 - return socket_cls.makefile(self, mode, buffering, *args, **kwargs) - - -WrappedSocket.makefile = makefile # type: ignore[attr-defined] - - -class SecureTransportContext: - """ - I am a wrapper class for the SecureTransport library, to translate the - interface of the standard library ``SSLContext`` object to calls into - SecureTransport. - """ - - def __init__(self, protocol: int) -> None: - self._minimum_version: int = ssl.TLSVersion.MINIMUM_SUPPORTED - self._maximum_version: int = ssl.TLSVersion.MAXIMUM_SUPPORTED - if protocol not in (None, ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS_CLIENT): - self._min_version, self._max_version = _protocol_to_min_max[protocol] - - self._options = 0 - self._verify = False - self._trust_bundle: bytes | None = None - self._client_cert: str | None = None - self._client_key: str | None = None - self._client_key_passphrase = None - self._alpn_protocols: list[bytes] | None = None - - @property - def check_hostname(self) -> Literal[True]: - """ - SecureTransport cannot have its hostname checking disabled. For more, - see the comment on getpeercert() in this file. - """ - return True - - @check_hostname.setter - def check_hostname(self, value: typing.Any) -> None: - """ - SecureTransport cannot have its hostname checking disabled. For more, - see the comment on getpeercert() in this file. - """ - - @property - def options(self) -> int: - # TODO: Well, crap. - # - # So this is the bit of the code that is the most likely to cause us - # trouble. Essentially we need to enumerate all of the SSL options that - # users might want to use and try to see if we can sensibly translate - # them, or whether we should just ignore them. - return self._options - - @options.setter - def options(self, value: int) -> None: - # TODO: Update in line with above. - self._options = value - - @property - def verify_mode(self) -> int: - return ssl.CERT_REQUIRED if self._verify else ssl.CERT_NONE - - @verify_mode.setter - def verify_mode(self, value: int) -> None: - self._verify = value == ssl.CERT_REQUIRED - - def set_default_verify_paths(self) -> None: - # So, this has to do something a bit weird. Specifically, what it does - # is nothing. - # - # This means that, if we had previously had load_verify_locations - # called, this does not undo that. We need to do that because it turns - # out that the rest of the urllib3 code will attempt to load the - # default verify paths if it hasn't been told about any paths, even if - # the context itself was sometime earlier. We resolve that by just - # ignoring it. - pass - - def load_default_certs(self) -> None: - return self.set_default_verify_paths() - - def set_ciphers(self, ciphers: typing.Any) -> None: - raise ValueError("SecureTransport doesn't support custom cipher strings") - - def load_verify_locations( - self, - cafile: str | None = None, - capath: str | None = None, - cadata: bytes | None = None, - ) -> None: - # OK, we only really support cadata and cafile. - if capath is not None: - raise ValueError("SecureTransport does not support cert directories") - - # Raise if cafile does not exist. - if cafile is not None: - with open(cafile): - pass - - self._trust_bundle = cafile or cadata # type: ignore[assignment] - - def load_cert_chain( - self, - certfile: str, - keyfile: str | None = None, - password: str | None = None, - ) -> None: - self._client_cert = certfile - self._client_key = keyfile - self._client_cert_passphrase = password - - def set_alpn_protocols(self, protocols: list[str | bytes]) -> None: - """ - Sets the ALPN protocols that will later be set on the context. - - Raises a NotImplementedError if ALPN is not supported. - """ - if not hasattr(Security, "SSLSetALPNProtocols"): - raise NotImplementedError( - "SecureTransport supports ALPN only in macOS 10.12+" - ) - self._alpn_protocols = [util.util.to_bytes(p, "ascii") for p in protocols] - - def wrap_socket( - self, - sock: socket_cls, - server_side: bool = False, - do_handshake_on_connect: bool = True, - suppress_ragged_eofs: bool = True, - server_hostname: bytes | str | None = None, - ) -> WrappedSocket: - # So, what do we do here? Firstly, we assert some properties. This is a - # stripped down shim, so there is some functionality we don't support. - # See PEP 543 for the real deal. - assert not server_side - assert do_handshake_on_connect - assert suppress_ragged_eofs - - # Ok, we're good to go. Now we want to create the wrapped socket object - # and store it in the appropriate place. - wrapped_socket = WrappedSocket(sock) - - # Now we can handshake - wrapped_socket.handshake( - server_hostname, - self._verify, - self._trust_bundle, - _tls_version_to_st[self._minimum_version], - _tls_version_to_st[self._maximum_version], - self._client_cert, - self._client_key, - self._client_key_passphrase, - self._alpn_protocols, - ) - return wrapped_socket - - @property - def minimum_version(self) -> int: - return self._minimum_version - - @minimum_version.setter - def minimum_version(self, minimum_version: int) -> None: - self._minimum_version = minimum_version - - @property - def maximum_version(self) -> int: - return self._maximum_version - - @maximum_version.setter - def maximum_version(self, maximum_version: int) -> None: - self._maximum_version = maximum_version diff --git a/venv/lib/python3.8/site-packages/urllib3/contrib/socks.py b/venv/lib/python3.8/site-packages/urllib3/contrib/socks.py deleted file mode 100644 index 5e552ddaed36d698bee9c086a590af3807ba1972..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/contrib/socks.py +++ /dev/null @@ -1,233 +0,0 @@ -""" -This module contains provisional support for SOCKS proxies from within -urllib3. This module supports SOCKS4, SOCKS4A (an extension of SOCKS4), and -SOCKS5. To enable its functionality, either install PySocks or install this -module with the ``socks`` extra. - -The SOCKS implementation supports the full range of urllib3 features. It also -supports the following SOCKS features: - -- SOCKS4A (``proxy_url='socks4a://...``) -- SOCKS4 (``proxy_url='socks4://...``) -- SOCKS5 with remote DNS (``proxy_url='socks5h://...``) -- SOCKS5 with local DNS (``proxy_url='socks5://...``) -- Usernames and passwords for the SOCKS proxy - -.. note:: - It is recommended to use ``socks5h://`` or ``socks4a://`` schemes in - your ``proxy_url`` to ensure that DNS resolution is done from the remote - server instead of client-side when connecting to a domain name. - -SOCKS4 supports IPv4 and domain names with the SOCKS4A extension. SOCKS5 -supports IPv4, IPv6, and domain names. - -When connecting to a SOCKS4 proxy the ``username`` portion of the ``proxy_url`` -will be sent as the ``userid`` section of the SOCKS request: - -.. code-block:: python - - proxy_url="socks4a://@proxy-host" - -When connecting to a SOCKS5 proxy the ``username`` and ``password`` portion -of the ``proxy_url`` will be sent as the username/password to authenticate -with the proxy: - -.. code-block:: python - - proxy_url="socks5h://:@proxy-host" - -""" - -from __future__ import annotations - -try: - import socks # type: ignore[import] -except ImportError: - import warnings - - from ..exceptions import DependencyWarning - - warnings.warn( - ( - "SOCKS support in urllib3 requires the installation of optional " - "dependencies: specifically, PySocks. For more information, see " - "https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies" - ), - DependencyWarning, - ) - raise - -import typing -from socket import timeout as SocketTimeout - -from ..connection import HTTPConnection, HTTPSConnection -from ..connectionpool import HTTPConnectionPool, HTTPSConnectionPool -from ..exceptions import ConnectTimeoutError, NewConnectionError -from ..poolmanager import PoolManager -from ..util.url import parse_url - -try: - import ssl -except ImportError: - ssl = None # type: ignore[assignment] - -try: - from typing import TypedDict - - class _TYPE_SOCKS_OPTIONS(TypedDict): - socks_version: int - proxy_host: str | None - proxy_port: str | None - username: str | None - password: str | None - rdns: bool - -except ImportError: # Python 3.7 - _TYPE_SOCKS_OPTIONS = typing.Dict[str, typing.Any] # type: ignore[misc, assignment] - - -class SOCKSConnection(HTTPConnection): - """ - A plain-text HTTP connection that connects via a SOCKS proxy. - """ - - def __init__( - self, - _socks_options: _TYPE_SOCKS_OPTIONS, - *args: typing.Any, - **kwargs: typing.Any, - ) -> None: - self._socks_options = _socks_options - super().__init__(*args, **kwargs) - - def _new_conn(self) -> socks.socksocket: - """ - Establish a new connection via the SOCKS proxy. - """ - extra_kw: dict[str, typing.Any] = {} - if self.source_address: - extra_kw["source_address"] = self.source_address - - if self.socket_options: - extra_kw["socket_options"] = self.socket_options - - try: - conn = socks.create_connection( - (self.host, self.port), - proxy_type=self._socks_options["socks_version"], - proxy_addr=self._socks_options["proxy_host"], - proxy_port=self._socks_options["proxy_port"], - proxy_username=self._socks_options["username"], - proxy_password=self._socks_options["password"], - proxy_rdns=self._socks_options["rdns"], - timeout=self.timeout, - **extra_kw, - ) - - except SocketTimeout as e: - raise ConnectTimeoutError( - self, - f"Connection to {self.host} timed out. (connect timeout={self.timeout})", - ) from e - - except socks.ProxyError as e: - # This is fragile as hell, but it seems to be the only way to raise - # useful errors here. - if e.socket_err: - error = e.socket_err - if isinstance(error, SocketTimeout): - raise ConnectTimeoutError( - self, - f"Connection to {self.host} timed out. (connect timeout={self.timeout})", - ) from e - else: - # Adding `from e` messes with coverage somehow, so it's omitted. - # See #2386. - raise NewConnectionError( - self, f"Failed to establish a new connection: {error}" - ) - else: - raise NewConnectionError( - self, f"Failed to establish a new connection: {e}" - ) from e - - except OSError as e: # Defensive: PySocks should catch all these. - raise NewConnectionError( - self, f"Failed to establish a new connection: {e}" - ) from e - - return conn - - -# We don't need to duplicate the Verified/Unverified distinction from -# urllib3/connection.py here because the HTTPSConnection will already have been -# correctly set to either the Verified or Unverified form by that module. This -# means the SOCKSHTTPSConnection will automatically be the correct type. -class SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection): - pass - - -class SOCKSHTTPConnectionPool(HTTPConnectionPool): - ConnectionCls = SOCKSConnection - - -class SOCKSHTTPSConnectionPool(HTTPSConnectionPool): - ConnectionCls = SOCKSHTTPSConnection - - -class SOCKSProxyManager(PoolManager): - """ - A version of the urllib3 ProxyManager that routes connections via the - defined SOCKS proxy. - """ - - pool_classes_by_scheme = { - "http": SOCKSHTTPConnectionPool, - "https": SOCKSHTTPSConnectionPool, - } - - def __init__( - self, - proxy_url: str, - username: str | None = None, - password: str | None = None, - num_pools: int = 10, - headers: typing.Mapping[str, str] | None = None, - **connection_pool_kw: typing.Any, - ): - parsed = parse_url(proxy_url) - - if username is None and password is None and parsed.auth is not None: - split = parsed.auth.split(":") - if len(split) == 2: - username, password = split - if parsed.scheme == "socks5": - socks_version = socks.PROXY_TYPE_SOCKS5 - rdns = False - elif parsed.scheme == "socks5h": - socks_version = socks.PROXY_TYPE_SOCKS5 - rdns = True - elif parsed.scheme == "socks4": - socks_version = socks.PROXY_TYPE_SOCKS4 - rdns = False - elif parsed.scheme == "socks4a": - socks_version = socks.PROXY_TYPE_SOCKS4 - rdns = True - else: - raise ValueError(f"Unable to determine SOCKS version from {proxy_url}") - - self.proxy_url = proxy_url - - socks_options = { - "socks_version": socks_version, - "proxy_host": parsed.host, - "proxy_port": parsed.port, - "username": username, - "password": password, - "rdns": rdns, - } - connection_pool_kw["_socks_options"] = socks_options - - super().__init__(num_pools, headers, **connection_pool_kw) - - self.pool_classes_by_scheme = SOCKSProxyManager.pool_classes_by_scheme diff --git a/venv/lib/python3.8/site-packages/urllib3/exceptions.py b/venv/lib/python3.8/site-packages/urllib3/exceptions.py deleted file mode 100644 index 5bb92369613fc65a8e1f219552898fb178a0cf39..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/exceptions.py +++ /dev/null @@ -1,318 +0,0 @@ -from __future__ import annotations - -import socket -import typing -import warnings -from email.errors import MessageDefect -from http.client import IncompleteRead as httplib_IncompleteRead - -if typing.TYPE_CHECKING: - from .connection import HTTPConnection - from .connectionpool import ConnectionPool - from .response import HTTPResponse - from .util.retry import Retry - -# Base Exceptions - - -class HTTPError(Exception): - """Base exception used by this module.""" - - -class HTTPWarning(Warning): - """Base warning used by this module.""" - - -_TYPE_REDUCE_RESULT = typing.Tuple[ - typing.Callable[..., object], typing.Tuple[object, ...] -] - - -class PoolError(HTTPError): - """Base exception for errors caused within a pool.""" - - def __init__(self, pool: ConnectionPool, message: str) -> None: - self.pool = pool - super().__init__(f"{pool}: {message}") - - def __reduce__(self) -> _TYPE_REDUCE_RESULT: - # For pickling purposes. - return self.__class__, (None, None) - - -class RequestError(PoolError): - """Base exception for PoolErrors that have associated URLs.""" - - def __init__(self, pool: ConnectionPool, url: str, message: str) -> None: - self.url = url - super().__init__(pool, message) - - def __reduce__(self) -> _TYPE_REDUCE_RESULT: - # For pickling purposes. - return self.__class__, (None, self.url, None) - - -class SSLError(HTTPError): - """Raised when SSL certificate fails in an HTTPS connection.""" - - -class ProxyError(HTTPError): - """Raised when the connection to a proxy fails.""" - - # The original error is also available as __cause__. - original_error: Exception - - def __init__(self, message: str, error: Exception) -> None: - super().__init__(message, error) - self.original_error = error - - -class DecodeError(HTTPError): - """Raised when automatic decoding based on Content-Type fails.""" - - -class ProtocolError(HTTPError): - """Raised when something unexpected happens mid-request/response.""" - - -#: Renamed to ProtocolError but aliased for backwards compatibility. -ConnectionError = ProtocolError - - -# Leaf Exceptions - - -class MaxRetryError(RequestError): - """Raised when the maximum number of retries is exceeded. - - :param pool: The connection pool - :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool` - :param str url: The requested Url - :param reason: The underlying error - :type reason: :class:`Exception` - - """ - - def __init__( - self, pool: ConnectionPool, url: str, reason: Exception | None = None - ) -> None: - self.reason = reason - - message = f"Max retries exceeded with url: {url} (Caused by {reason!r})" - - super().__init__(pool, url, message) - - -class HostChangedError(RequestError): - """Raised when an existing pool gets a request for a foreign host.""" - - def __init__( - self, pool: ConnectionPool, url: str, retries: Retry | int = 3 - ) -> None: - message = f"Tried to open a foreign host with url: {url}" - super().__init__(pool, url, message) - self.retries = retries - - -class TimeoutStateError(HTTPError): - """Raised when passing an invalid state to a timeout""" - - -class TimeoutError(HTTPError): - """Raised when a socket timeout error occurs. - - Catching this error will catch both :exc:`ReadTimeoutErrors - ` and :exc:`ConnectTimeoutErrors `. - """ - - -class ReadTimeoutError(TimeoutError, RequestError): - """Raised when a socket timeout occurs while receiving data from a server""" - - -# This timeout error does not have a URL attached and needs to inherit from the -# base HTTPError -class ConnectTimeoutError(TimeoutError): - """Raised when a socket timeout occurs while connecting to a server""" - - -class NewConnectionError(ConnectTimeoutError, HTTPError): - """Raised when we fail to establish a new connection. Usually ECONNREFUSED.""" - - def __init__(self, conn: HTTPConnection, message: str) -> None: - self.conn = conn - super().__init__(f"{conn}: {message}") - - @property - def pool(self) -> HTTPConnection: - warnings.warn( - "The 'pool' property is deprecated and will be removed " - "in urllib3 v2.1.0. Use 'conn' instead.", - DeprecationWarning, - stacklevel=2, - ) - - return self.conn - - -class NameResolutionError(NewConnectionError): - """Raised when host name resolution fails.""" - - def __init__(self, host: str, conn: HTTPConnection, reason: socket.gaierror): - message = f"Failed to resolve '{host}' ({reason})" - super().__init__(conn, message) - - -class EmptyPoolError(PoolError): - """Raised when a pool runs out of connections and no more are allowed.""" - - -class FullPoolError(PoolError): - """Raised when we try to add a connection to a full pool in blocking mode.""" - - -class ClosedPoolError(PoolError): - """Raised when a request enters a pool after the pool has been closed.""" - - -class LocationValueError(ValueError, HTTPError): - """Raised when there is something wrong with a given URL input.""" - - -class LocationParseError(LocationValueError): - """Raised when get_host or similar fails to parse the URL input.""" - - def __init__(self, location: str) -> None: - message = f"Failed to parse: {location}" - super().__init__(message) - - self.location = location - - -class URLSchemeUnknown(LocationValueError): - """Raised when a URL input has an unsupported scheme.""" - - def __init__(self, scheme: str): - message = f"Not supported URL scheme {scheme}" - super().__init__(message) - - self.scheme = scheme - - -class ResponseError(HTTPError): - """Used as a container for an error reason supplied in a MaxRetryError.""" - - GENERIC_ERROR = "too many error responses" - SPECIFIC_ERROR = "too many {status_code} error responses" - - -class SecurityWarning(HTTPWarning): - """Warned when performing security reducing actions""" - - -class InsecureRequestWarning(SecurityWarning): - """Warned when making an unverified HTTPS request.""" - - -class NotOpenSSLWarning(SecurityWarning): - """Warned when using unsupported SSL library""" - - -class SystemTimeWarning(SecurityWarning): - """Warned when system time is suspected to be wrong""" - - -class InsecurePlatformWarning(SecurityWarning): - """Warned when certain TLS/SSL configuration is not available on a platform.""" - - -class DependencyWarning(HTTPWarning): - """ - Warned when an attempt is made to import a module with missing optional - dependencies. - """ - - -class ResponseNotChunked(ProtocolError, ValueError): - """Response needs to be chunked in order to read it as chunks.""" - - -class BodyNotHttplibCompatible(HTTPError): - """ - Body should be :class:`http.client.HTTPResponse` like - (have an fp attribute which returns raw chunks) for read_chunked(). - """ - - -class IncompleteRead(HTTPError, httplib_IncompleteRead): - """ - Response length doesn't match expected Content-Length - - Subclass of :class:`http.client.IncompleteRead` to allow int value - for ``partial`` to avoid creating large objects on streamed reads. - """ - - def __init__(self, partial: int, expected: int) -> None: - self.partial = partial # type: ignore[assignment] - self.expected = expected - - def __repr__(self) -> str: - return "IncompleteRead(%i bytes read, %i more expected)" % ( - self.partial, # type: ignore[str-format] - self.expected, - ) - - -class InvalidChunkLength(HTTPError, httplib_IncompleteRead): - """Invalid chunk length in a chunked response.""" - - def __init__(self, response: HTTPResponse, length: bytes) -> None: - self.partial: int = response.tell() # type: ignore[assignment] - self.expected: int | None = response.length_remaining - self.response = response - self.length = length - - def __repr__(self) -> str: - return "InvalidChunkLength(got length %r, %i bytes read)" % ( - self.length, - self.partial, - ) - - -class InvalidHeader(HTTPError): - """The header provided was somehow invalid.""" - - -class ProxySchemeUnknown(AssertionError, URLSchemeUnknown): - """ProxyManager does not support the supplied scheme""" - - # TODO(t-8ch): Stop inheriting from AssertionError in v2.0. - - def __init__(self, scheme: str | None) -> None: - # 'localhost' is here because our URL parser parses - # localhost:8080 -> scheme=localhost, remove if we fix this. - if scheme == "localhost": - scheme = None - if scheme is None: - message = "Proxy URL had no scheme, should start with http:// or https://" - else: - message = f"Proxy URL had unsupported scheme {scheme}, should use http:// or https://" - super().__init__(message) - - -class ProxySchemeUnsupported(ValueError): - """Fetching HTTPS resources through HTTPS proxies is unsupported""" - - -class HeaderParsingError(HTTPError): - """Raised by assert_header_parsing, but we convert it to a log.warning statement.""" - - def __init__( - self, defects: list[MessageDefect], unparsed_data: bytes | str | None - ) -> None: - message = f"{defects or 'Unknown'}, unparsed data: {unparsed_data!r}" - super().__init__(message) - - -class UnrewindableBodyError(HTTPError): - """urllib3 encountered an error when trying to rewind a body""" diff --git a/venv/lib/python3.8/site-packages/urllib3/fields.py b/venv/lib/python3.8/site-packages/urllib3/fields.py deleted file mode 100644 index 51d898e24f34ca0ae88235fc83c8465a47c326ed..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/fields.py +++ /dev/null @@ -1,345 +0,0 @@ -from __future__ import annotations - -import email.utils -import mimetypes -import typing - -_TYPE_FIELD_VALUE = typing.Union[str, bytes] -_TYPE_FIELD_VALUE_TUPLE = typing.Union[ - _TYPE_FIELD_VALUE, - typing.Tuple[str, _TYPE_FIELD_VALUE], - typing.Tuple[str, _TYPE_FIELD_VALUE, str], -] - - -def guess_content_type( - filename: str | None, default: str = "application/octet-stream" -) -> str: - """ - Guess the "Content-Type" of a file. - - :param filename: - The filename to guess the "Content-Type" of using :mod:`mimetypes`. - :param default: - If no "Content-Type" can be guessed, default to `default`. - """ - if filename: - return mimetypes.guess_type(filename)[0] or default - return default - - -def format_header_param_rfc2231(name: str, value: _TYPE_FIELD_VALUE) -> str: - """ - Helper function to format and quote a single header parameter using the - strategy defined in RFC 2231. - - Particularly useful for header parameters which might contain - non-ASCII values, like file names. This follows - `RFC 2388 Section 4.4 `_. - - :param name: - The name of the parameter, a string expected to be ASCII only. - :param value: - The value of the parameter, provided as ``bytes`` or `str``. - :returns: - An RFC-2231-formatted unicode string. - - .. deprecated:: 2.0.0 - Will be removed in urllib3 v2.1.0. This is not valid for - ``multipart/form-data`` header parameters. - """ - import warnings - - warnings.warn( - "'format_header_param_rfc2231' is deprecated and will be " - "removed in urllib3 v2.1.0. This is not valid for " - "multipart/form-data header parameters.", - DeprecationWarning, - stacklevel=2, - ) - - if isinstance(value, bytes): - value = value.decode("utf-8") - - if not any(ch in value for ch in '"\\\r\n'): - result = f'{name}="{value}"' - try: - result.encode("ascii") - except (UnicodeEncodeError, UnicodeDecodeError): - pass - else: - return result - - value = email.utils.encode_rfc2231(value, "utf-8") - value = f"{name}*={value}" - - return value - - -def format_multipart_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str: - """ - Format and quote a single multipart header parameter. - - This follows the `WHATWG HTML Standard`_ as of 2021/06/10, matching - the behavior of current browser and curl versions. Values are - assumed to be UTF-8. The ``\\n``, ``\\r``, and ``"`` characters are - percent encoded. - - .. _WHATWG HTML Standard: - https://html.spec.whatwg.org/multipage/ - form-control-infrastructure.html#multipart-form-data - - :param name: - The name of the parameter, an ASCII-only ``str``. - :param value: - The value of the parameter, a ``str`` or UTF-8 encoded - ``bytes``. - :returns: - A string ``name="value"`` with the escaped value. - - .. versionchanged:: 2.0.0 - Matches the WHATWG HTML Standard as of 2021/06/10. Control - characters are no longer percent encoded. - - .. versionchanged:: 2.0.0 - Renamed from ``format_header_param_html5`` and - ``format_header_param``. The old names will be removed in - urllib3 v2.1.0. - """ - if isinstance(value, bytes): - value = value.decode("utf-8") - - # percent encode \n \r " - value = value.translate({10: "%0A", 13: "%0D", 34: "%22"}) - return f'{name}="{value}"' - - -def format_header_param_html5(name: str, value: _TYPE_FIELD_VALUE) -> str: - """ - .. deprecated:: 2.0.0 - Renamed to :func:`format_multipart_header_param`. Will be - removed in urllib3 v2.1.0. - """ - import warnings - - warnings.warn( - "'format_header_param_html5' has been renamed to " - "'format_multipart_header_param'. The old name will be " - "removed in urllib3 v2.1.0.", - DeprecationWarning, - stacklevel=2, - ) - return format_multipart_header_param(name, value) - - -def format_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str: - """ - .. deprecated:: 2.0.0 - Renamed to :func:`format_multipart_header_param`. Will be - removed in urllib3 v2.1.0. - """ - import warnings - - warnings.warn( - "'format_header_param' has been renamed to " - "'format_multipart_header_param'. The old name will be " - "removed in urllib3 v2.1.0.", - DeprecationWarning, - stacklevel=2, - ) - return format_multipart_header_param(name, value) - - -class RequestField: - """ - A data container for request body parameters. - - :param name: - The name of this request field. Must be unicode. - :param data: - The data/value body. - :param filename: - An optional filename of the request field. Must be unicode. - :param headers: - An optional dict-like object of headers to initially use for the field. - - .. versionchanged:: 2.0.0 - The ``header_formatter`` parameter is deprecated and will - be removed in urllib3 v2.1.0. - """ - - def __init__( - self, - name: str, - data: _TYPE_FIELD_VALUE, - filename: str | None = None, - headers: typing.Mapping[str, str] | None = None, - header_formatter: typing.Callable[[str, _TYPE_FIELD_VALUE], str] | None = None, - ): - self._name = name - self._filename = filename - self.data = data - self.headers: dict[str, str | None] = {} - if headers: - self.headers = dict(headers) - - if header_formatter is not None: - import warnings - - warnings.warn( - "The 'header_formatter' parameter is deprecated and " - "will be removed in urllib3 v2.1.0.", - DeprecationWarning, - stacklevel=2, - ) - self.header_formatter = header_formatter - else: - self.header_formatter = format_multipart_header_param - - @classmethod - def from_tuples( - cls, - fieldname: str, - value: _TYPE_FIELD_VALUE_TUPLE, - header_formatter: typing.Callable[[str, _TYPE_FIELD_VALUE], str] | None = None, - ) -> RequestField: - """ - A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. - - Supports constructing :class:`~urllib3.fields.RequestField` from - parameter of key/value strings AND key/filetuple. A filetuple is a - (filename, data, MIME type) tuple where the MIME type is optional. - For example:: - - 'foo': 'bar', - 'fakefile': ('foofile.txt', 'contents of foofile'), - 'realfile': ('barfile.txt', open('realfile').read()), - 'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'), - 'nonamefile': 'contents of nonamefile field', - - Field names and filenames must be unicode. - """ - filename: str | None - content_type: str | None - data: _TYPE_FIELD_VALUE - - if isinstance(value, tuple): - if len(value) == 3: - filename, data, content_type = typing.cast( - typing.Tuple[str, _TYPE_FIELD_VALUE, str], value - ) - else: - filename, data = typing.cast( - typing.Tuple[str, _TYPE_FIELD_VALUE], value - ) - content_type = guess_content_type(filename) - else: - filename = None - content_type = None - data = value - - request_param = cls( - fieldname, data, filename=filename, header_formatter=header_formatter - ) - request_param.make_multipart(content_type=content_type) - - return request_param - - def _render_part(self, name: str, value: _TYPE_FIELD_VALUE) -> str: - """ - Override this method to change how each multipart header - parameter is formatted. By default, this calls - :func:`format_multipart_header_param`. - - :param name: - The name of the parameter, an ASCII-only ``str``. - :param value: - The value of the parameter, a ``str`` or UTF-8 encoded - ``bytes``. - - :meta public: - """ - return self.header_formatter(name, value) - - def _render_parts( - self, - header_parts: ( - dict[str, _TYPE_FIELD_VALUE | None] - | typing.Sequence[tuple[str, _TYPE_FIELD_VALUE | None]] - ), - ) -> str: - """ - Helper function to format and quote a single header. - - Useful for single headers that are composed of multiple items. E.g., - 'Content-Disposition' fields. - - :param header_parts: - A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format - as `k1="v1"; k2="v2"; ...`. - """ - iterable: typing.Iterable[tuple[str, _TYPE_FIELD_VALUE | None]] - - parts = [] - if isinstance(header_parts, dict): - iterable = header_parts.items() - else: - iterable = header_parts - - for name, value in iterable: - if value is not None: - parts.append(self._render_part(name, value)) - - return "; ".join(parts) - - def render_headers(self) -> str: - """ - Renders the headers for this request field. - """ - lines = [] - - sort_keys = ["Content-Disposition", "Content-Type", "Content-Location"] - for sort_key in sort_keys: - if self.headers.get(sort_key, False): - lines.append(f"{sort_key}: {self.headers[sort_key]}") - - for header_name, header_value in self.headers.items(): - if header_name not in sort_keys: - if header_value: - lines.append(f"{header_name}: {header_value}") - - lines.append("\r\n") - return "\r\n".join(lines) - - def make_multipart( - self, - content_disposition: str | None = None, - content_type: str | None = None, - content_location: str | None = None, - ) -> None: - """ - Makes this request field into a multipart request field. - - This method overrides "Content-Disposition", "Content-Type" and - "Content-Location" headers to the request parameter. - - :param content_disposition: - The 'Content-Disposition' of the request body. Defaults to 'form-data' - :param content_type: - The 'Content-Type' of the request body. - :param content_location: - The 'Content-Location' of the request body. - - """ - content_disposition = (content_disposition or "form-data") + "; ".join( - [ - "", - self._render_parts( - (("name", self._name), ("filename", self._filename)) - ), - ] - ) - - self.headers["Content-Disposition"] = content_disposition - self.headers["Content-Type"] = content_type - self.headers["Content-Location"] = content_location diff --git a/venv/lib/python3.8/site-packages/urllib3/filepost.py b/venv/lib/python3.8/site-packages/urllib3/filepost.py deleted file mode 100644 index 1c90a211fbc4337b08734db0d2fd3de0f4eb0e21..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/filepost.py +++ /dev/null @@ -1,89 +0,0 @@ -from __future__ import annotations - -import binascii -import codecs -import os -import typing -from io import BytesIO - -from .fields import _TYPE_FIELD_VALUE_TUPLE, RequestField - -writer = codecs.lookup("utf-8")[3] - -_TYPE_FIELDS_SEQUENCE = typing.Sequence[ - typing.Union[typing.Tuple[str, _TYPE_FIELD_VALUE_TUPLE], RequestField] -] -_TYPE_FIELDS = typing.Union[ - _TYPE_FIELDS_SEQUENCE, - typing.Mapping[str, _TYPE_FIELD_VALUE_TUPLE], -] - - -def choose_boundary() -> str: - """ - Our embarrassingly-simple replacement for mimetools.choose_boundary. - """ - return binascii.hexlify(os.urandom(16)).decode() - - -def iter_field_objects(fields: _TYPE_FIELDS) -> typing.Iterable[RequestField]: - """ - Iterate over fields. - - Supports list of (k, v) tuples and dicts, and lists of - :class:`~urllib3.fields.RequestField`. - - """ - iterable: typing.Iterable[RequestField | tuple[str, _TYPE_FIELD_VALUE_TUPLE]] - - if isinstance(fields, typing.Mapping): - iterable = fields.items() - else: - iterable = fields - - for field in iterable: - if isinstance(field, RequestField): - yield field - else: - yield RequestField.from_tuples(*field) - - -def encode_multipart_formdata( - fields: _TYPE_FIELDS, boundary: str | None = None -) -> tuple[bytes, str]: - """ - Encode a dictionary of ``fields`` using the multipart/form-data MIME format. - - :param fields: - Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). - Values are processed by :func:`urllib3.fields.RequestField.from_tuples`. - - :param boundary: - If not specified, then a random boundary will be generated using - :func:`urllib3.filepost.choose_boundary`. - """ - body = BytesIO() - if boundary is None: - boundary = choose_boundary() - - for field in iter_field_objects(fields): - body.write(f"--{boundary}\r\n".encode("latin-1")) - - writer(body).write(field.render_headers()) - data = field.data - - if isinstance(data, int): - data = str(data) # Backwards compatibility - - if isinstance(data, str): - writer(body).write(data) - else: - body.write(data) - - body.write(b"\r\n") - - body.write(f"--{boundary}--\r\n".encode("latin-1")) - - content_type = f"multipart/form-data; boundary={boundary}" - - return body.getvalue(), content_type diff --git a/venv/lib/python3.8/site-packages/urllib3/poolmanager.py b/venv/lib/python3.8/site-packages/urllib3/poolmanager.py deleted file mode 100644 index 02b2f622a1b1cfca660f602ba13913530e21992e..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/poolmanager.py +++ /dev/null @@ -1,634 +0,0 @@ -from __future__ import annotations - -import functools -import logging -import typing -import warnings -from types import TracebackType -from urllib.parse import urljoin - -from ._collections import RecentlyUsedContainer -from ._request_methods import RequestMethods -from .connection import ProxyConfig -from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, port_by_scheme -from .exceptions import ( - LocationValueError, - MaxRetryError, - ProxySchemeUnknown, - URLSchemeUnknown, -) -from .response import BaseHTTPResponse -from .util.connection import _TYPE_SOCKET_OPTIONS -from .util.proxy import connection_requires_http_tunnel -from .util.retry import Retry -from .util.timeout import Timeout -from .util.url import Url, parse_url - -if typing.TYPE_CHECKING: - import ssl - - from typing_extensions import Literal - -__all__ = ["PoolManager", "ProxyManager", "proxy_from_url"] - - -log = logging.getLogger(__name__) - -SSL_KEYWORDS = ( - "key_file", - "cert_file", - "cert_reqs", - "ca_certs", - "ssl_version", - "ssl_minimum_version", - "ssl_maximum_version", - "ca_cert_dir", - "ssl_context", - "key_password", - "server_hostname", -) -# Default value for `blocksize` - a new parameter introduced to -# http.client.HTTPConnection & http.client.HTTPSConnection in Python 3.7 -_DEFAULT_BLOCKSIZE = 16384 - -_SelfT = typing.TypeVar("_SelfT") - - -class PoolKey(typing.NamedTuple): - """ - All known keyword arguments that could be provided to the pool manager, its - pools, or the underlying connections. - - All custom key schemes should include the fields in this key at a minimum. - """ - - key_scheme: str - key_host: str - key_port: int | None - key_timeout: Timeout | float | int | None - key_retries: Retry | bool | int | None - key_block: bool | None - key_source_address: tuple[str, int] | None - key_key_file: str | None - key_key_password: str | None - key_cert_file: str | None - key_cert_reqs: str | None - key_ca_certs: str | None - key_ssl_version: int | str | None - key_ssl_minimum_version: ssl.TLSVersion | None - key_ssl_maximum_version: ssl.TLSVersion | None - key_ca_cert_dir: str | None - key_ssl_context: ssl.SSLContext | None - key_maxsize: int | None - key_headers: frozenset[tuple[str, str]] | None - key__proxy: Url | None - key__proxy_headers: frozenset[tuple[str, str]] | None - key__proxy_config: ProxyConfig | None - key_socket_options: _TYPE_SOCKET_OPTIONS | None - key__socks_options: frozenset[tuple[str, str]] | None - key_assert_hostname: bool | str | None - key_assert_fingerprint: str | None - key_server_hostname: str | None - key_blocksize: int | None - - -def _default_key_normalizer( - key_class: type[PoolKey], request_context: dict[str, typing.Any] -) -> PoolKey: - """ - Create a pool key out of a request context dictionary. - - According to RFC 3986, both the scheme and host are case-insensitive. - Therefore, this function normalizes both before constructing the pool - key for an HTTPS request. If you wish to change this behaviour, provide - alternate callables to ``key_fn_by_scheme``. - - :param key_class: - The class to use when constructing the key. This should be a namedtuple - with the ``scheme`` and ``host`` keys at a minimum. - :type key_class: namedtuple - :param request_context: - A dictionary-like object that contain the context for a request. - :type request_context: dict - - :return: A namedtuple that can be used as a connection pool key. - :rtype: PoolKey - """ - # Since we mutate the dictionary, make a copy first - context = request_context.copy() - context["scheme"] = context["scheme"].lower() - context["host"] = context["host"].lower() - - # These are both dictionaries and need to be transformed into frozensets - for key in ("headers", "_proxy_headers", "_socks_options"): - if key in context and context[key] is not None: - context[key] = frozenset(context[key].items()) - - # The socket_options key may be a list and needs to be transformed into a - # tuple. - socket_opts = context.get("socket_options") - if socket_opts is not None: - context["socket_options"] = tuple(socket_opts) - - # Map the kwargs to the names in the namedtuple - this is necessary since - # namedtuples can't have fields starting with '_'. - for key in list(context.keys()): - context["key_" + key] = context.pop(key) - - # Default to ``None`` for keys missing from the context - for field in key_class._fields: - if field not in context: - context[field] = None - - # Default key_blocksize to _DEFAULT_BLOCKSIZE if missing from the context - if context.get("key_blocksize") is None: - context["key_blocksize"] = _DEFAULT_BLOCKSIZE - - return key_class(**context) - - -#: A dictionary that maps a scheme to a callable that creates a pool key. -#: This can be used to alter the way pool keys are constructed, if desired. -#: Each PoolManager makes a copy of this dictionary so they can be configured -#: globally here, or individually on the instance. -key_fn_by_scheme = { - "http": functools.partial(_default_key_normalizer, PoolKey), - "https": functools.partial(_default_key_normalizer, PoolKey), -} - -pool_classes_by_scheme = {"http": HTTPConnectionPool, "https": HTTPSConnectionPool} - - -class PoolManager(RequestMethods): - """ - Allows for arbitrary requests while transparently keeping track of - necessary connection pools for you. - - :param num_pools: - Number of connection pools to cache before discarding the least - recently used pool. - - :param headers: - Headers to include with all requests, unless other headers are given - explicitly. - - :param \\**connection_pool_kw: - Additional parameters are used to create fresh - :class:`urllib3.connectionpool.ConnectionPool` instances. - - Example: - - .. code-block:: python - - import urllib3 - - http = urllib3.PoolManager(num_pools=2) - - resp1 = http.request("GET", "https://google.com/") - resp2 = http.request("GET", "https://google.com/mail") - resp3 = http.request("GET", "https://yahoo.com/") - - print(len(http.pools)) - # 2 - - """ - - proxy: Url | None = None - proxy_config: ProxyConfig | None = None - - def __init__( - self, - num_pools: int = 10, - headers: typing.Mapping[str, str] | None = None, - **connection_pool_kw: typing.Any, - ) -> None: - super().__init__(headers) - self.connection_pool_kw = connection_pool_kw - - self.pools: RecentlyUsedContainer[PoolKey, HTTPConnectionPool] - self.pools = RecentlyUsedContainer(num_pools) - - # Locally set the pool classes and keys so other PoolManagers can - # override them. - self.pool_classes_by_scheme = pool_classes_by_scheme - self.key_fn_by_scheme = key_fn_by_scheme.copy() - - def __enter__(self: _SelfT) -> _SelfT: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> Literal[False]: - self.clear() - # Return False to re-raise any potential exceptions - return False - - def _new_pool( - self, - scheme: str, - host: str, - port: int, - request_context: dict[str, typing.Any] | None = None, - ) -> HTTPConnectionPool: - """ - Create a new :class:`urllib3.connectionpool.ConnectionPool` based on host, port, scheme, and - any additional pool keyword arguments. - - If ``request_context`` is provided, it is provided as keyword arguments - to the pool class used. This method is used to actually create the - connection pools handed out by :meth:`connection_from_url` and - companion methods. It is intended to be overridden for customization. - """ - pool_cls: type[HTTPConnectionPool] = self.pool_classes_by_scheme[scheme] - if request_context is None: - request_context = self.connection_pool_kw.copy() - - # Default blocksize to _DEFAULT_BLOCKSIZE if missing or explicitly - # set to 'None' in the request_context. - if request_context.get("blocksize") is None: - request_context["blocksize"] = _DEFAULT_BLOCKSIZE - - # Although the context has everything necessary to create the pool, - # this function has historically only used the scheme, host, and port - # in the positional args. When an API change is acceptable these can - # be removed. - for key in ("scheme", "host", "port"): - request_context.pop(key, None) - - if scheme == "http": - for kw in SSL_KEYWORDS: - request_context.pop(kw, None) - - return pool_cls(host, port, **request_context) - - def clear(self) -> None: - """ - Empty our store of pools and direct them all to close. - - This will not affect in-flight connections, but they will not be - re-used after completion. - """ - self.pools.clear() - - def connection_from_host( - self, - host: str | None, - port: int | None = None, - scheme: str | None = "http", - pool_kwargs: dict[str, typing.Any] | None = None, - ) -> HTTPConnectionPool: - """ - Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme. - - If ``port`` isn't given, it will be derived from the ``scheme`` using - ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is - provided, it is merged with the instance's ``connection_pool_kw`` - variable and used to create the new connection pool, if one is - needed. - """ - - if not host: - raise LocationValueError("No host specified.") - - request_context = self._merge_pool_kwargs(pool_kwargs) - request_context["scheme"] = scheme or "http" - if not port: - port = port_by_scheme.get(request_context["scheme"].lower(), 80) - request_context["port"] = port - request_context["host"] = host - - return self.connection_from_context(request_context) - - def connection_from_context( - self, request_context: dict[str, typing.Any] - ) -> HTTPConnectionPool: - """ - Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. - - ``request_context`` must at least contain the ``scheme`` key and its - value must be a key in ``key_fn_by_scheme`` instance variable. - """ - if "strict" in request_context: - warnings.warn( - "The 'strict' parameter is no longer needed on Python 3+. " - "This will raise an error in urllib3 v2.1.0.", - DeprecationWarning, - ) - request_context.pop("strict") - - scheme = request_context["scheme"].lower() - pool_key_constructor = self.key_fn_by_scheme.get(scheme) - if not pool_key_constructor: - raise URLSchemeUnknown(scheme) - pool_key = pool_key_constructor(request_context) - - return self.connection_from_pool_key(pool_key, request_context=request_context) - - def connection_from_pool_key( - self, pool_key: PoolKey, request_context: dict[str, typing.Any] - ) -> HTTPConnectionPool: - """ - Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key. - - ``pool_key`` should be a namedtuple that only contains immutable - objects. At a minimum it must have the ``scheme``, ``host``, and - ``port`` fields. - """ - with self.pools.lock: - # If the scheme, host, or port doesn't match existing open - # connections, open a new ConnectionPool. - pool = self.pools.get(pool_key) - if pool: - return pool - - # Make a fresh ConnectionPool of the desired type - scheme = request_context["scheme"] - host = request_context["host"] - port = request_context["port"] - pool = self._new_pool(scheme, host, port, request_context=request_context) - self.pools[pool_key] = pool - - return pool - - def connection_from_url( - self, url: str, pool_kwargs: dict[str, typing.Any] | None = None - ) -> HTTPConnectionPool: - """ - Similar to :func:`urllib3.connectionpool.connection_from_url`. - - If ``pool_kwargs`` is not provided and a new pool needs to be - constructed, ``self.connection_pool_kw`` is used to initialize - the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs`` - is provided, it is used instead. Note that if a new pool does not - need to be created for the request, the provided ``pool_kwargs`` are - not used. - """ - u = parse_url(url) - return self.connection_from_host( - u.host, port=u.port, scheme=u.scheme, pool_kwargs=pool_kwargs - ) - - def _merge_pool_kwargs( - self, override: dict[str, typing.Any] | None - ) -> dict[str, typing.Any]: - """ - Merge a dictionary of override values for self.connection_pool_kw. - - This does not modify self.connection_pool_kw and returns a new dict. - Any keys in the override dictionary with a value of ``None`` are - removed from the merged dictionary. - """ - base_pool_kwargs = self.connection_pool_kw.copy() - if override: - for key, value in override.items(): - if value is None: - try: - del base_pool_kwargs[key] - except KeyError: - pass - else: - base_pool_kwargs[key] = value - return base_pool_kwargs - - def _proxy_requires_url_absolute_form(self, parsed_url: Url) -> bool: - """ - Indicates if the proxy requires the complete destination URL in the - request. Normally this is only needed when not using an HTTP CONNECT - tunnel. - """ - if self.proxy is None: - return False - - return not connection_requires_http_tunnel( - self.proxy, self.proxy_config, parsed_url.scheme - ) - - def urlopen( # type: ignore[override] - self, method: str, url: str, redirect: bool = True, **kw: typing.Any - ) -> BaseHTTPResponse: - """ - Same as :meth:`urllib3.HTTPConnectionPool.urlopen` - with custom cross-host redirect logic and only sends the request-uri - portion of the ``url``. - - The given ``url`` parameter must be absolute, such that an appropriate - :class:`urllib3.connectionpool.ConnectionPool` can be chosen for it. - """ - u = parse_url(url) - - if u.scheme is None: - warnings.warn( - "URLs without a scheme (ie 'https://') are deprecated and will raise an error " - "in a future version of urllib3. To avoid this DeprecationWarning ensure all URLs " - "start with 'https://' or 'http://'. Read more in this issue: " - "https://github.com/urllib3/urllib3/issues/2920", - category=DeprecationWarning, - stacklevel=2, - ) - - conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme) - - kw["assert_same_host"] = False - kw["redirect"] = False - - if "headers" not in kw: - kw["headers"] = self.headers - - if self._proxy_requires_url_absolute_form(u): - response = conn.urlopen(method, url, **kw) - else: - response = conn.urlopen(method, u.request_uri, **kw) - - redirect_location = redirect and response.get_redirect_location() - if not redirect_location: - return response - - # Support relative URLs for redirecting. - redirect_location = urljoin(url, redirect_location) - - # RFC 7231, Section 6.4.4 - if response.status == 303: - method = "GET" - - retries = kw.get("retries") - if not isinstance(retries, Retry): - retries = Retry.from_int(retries, redirect=redirect) - - # Strip headers marked as unsafe to forward to the redirected location. - # Check remove_headers_on_redirect to avoid a potential network call within - # conn.is_same_host() which may use socket.gethostbyname() in the future. - if retries.remove_headers_on_redirect and not conn.is_same_host( - redirect_location - ): - new_headers = kw["headers"].copy() - for header in kw["headers"]: - if header.lower() in retries.remove_headers_on_redirect: - new_headers.pop(header, None) - kw["headers"] = new_headers - - try: - retries = retries.increment(method, url, response=response, _pool=conn) - except MaxRetryError: - if retries.raise_on_redirect: - response.drain_conn() - raise - return response - - kw["retries"] = retries - kw["redirect"] = redirect - - log.info("Redirecting %s -> %s", url, redirect_location) - - response.drain_conn() - return self.urlopen(method, redirect_location, **kw) - - -class ProxyManager(PoolManager): - """ - Behaves just like :class:`PoolManager`, but sends all requests through - the defined proxy, using the CONNECT method for HTTPS URLs. - - :param proxy_url: - The URL of the proxy to be used. - - :param proxy_headers: - A dictionary containing headers that will be sent to the proxy. In case - of HTTP they are being sent with each request, while in the - HTTPS/CONNECT case they are sent only once. Could be used for proxy - authentication. - - :param proxy_ssl_context: - The proxy SSL context is used to establish the TLS connection to the - proxy when using HTTPS proxies. - - :param use_forwarding_for_https: - (Defaults to False) If set to True will forward requests to the HTTPS - proxy to be made on behalf of the client instead of creating a TLS - tunnel via the CONNECT method. **Enabling this flag means that request - and response headers and content will be visible from the HTTPS proxy** - whereas tunneling keeps request and response headers and content - private. IP address, target hostname, SNI, and port are always visible - to an HTTPS proxy even when this flag is disabled. - - :param proxy_assert_hostname: - The hostname of the certificate to verify against. - - :param proxy_assert_fingerprint: - The fingerprint of the certificate to verify against. - - Example: - - .. code-block:: python - - import urllib3 - - proxy = urllib3.ProxyManager("https://localhost:3128/") - - resp1 = proxy.request("GET", "https://google.com/") - resp2 = proxy.request("GET", "https://httpbin.org/") - - print(len(proxy.pools)) - # 1 - - resp3 = proxy.request("GET", "https://httpbin.org/") - resp4 = proxy.request("GET", "https://twitter.com/") - - print(len(proxy.pools)) - # 3 - - """ - - def __init__( - self, - proxy_url: str, - num_pools: int = 10, - headers: typing.Mapping[str, str] | None = None, - proxy_headers: typing.Mapping[str, str] | None = None, - proxy_ssl_context: ssl.SSLContext | None = None, - use_forwarding_for_https: bool = False, - proxy_assert_hostname: None | str | Literal[False] = None, - proxy_assert_fingerprint: str | None = None, - **connection_pool_kw: typing.Any, - ) -> None: - if isinstance(proxy_url, HTTPConnectionPool): - str_proxy_url = f"{proxy_url.scheme}://{proxy_url.host}:{proxy_url.port}" - else: - str_proxy_url = proxy_url - proxy = parse_url(str_proxy_url) - - if proxy.scheme not in ("http", "https"): - raise ProxySchemeUnknown(proxy.scheme) - - if not proxy.port: - port = port_by_scheme.get(proxy.scheme, 80) - proxy = proxy._replace(port=port) - - self.proxy = proxy - self.proxy_headers = proxy_headers or {} - self.proxy_ssl_context = proxy_ssl_context - self.proxy_config = ProxyConfig( - proxy_ssl_context, - use_forwarding_for_https, - proxy_assert_hostname, - proxy_assert_fingerprint, - ) - - connection_pool_kw["_proxy"] = self.proxy - connection_pool_kw["_proxy_headers"] = self.proxy_headers - connection_pool_kw["_proxy_config"] = self.proxy_config - - super().__init__(num_pools, headers, **connection_pool_kw) - - def connection_from_host( - self, - host: str | None, - port: int | None = None, - scheme: str | None = "http", - pool_kwargs: dict[str, typing.Any] | None = None, - ) -> HTTPConnectionPool: - if scheme == "https": - return super().connection_from_host( - host, port, scheme, pool_kwargs=pool_kwargs - ) - - return super().connection_from_host( - self.proxy.host, self.proxy.port, self.proxy.scheme, pool_kwargs=pool_kwargs # type: ignore[union-attr] - ) - - def _set_proxy_headers( - self, url: str, headers: typing.Mapping[str, str] | None = None - ) -> typing.Mapping[str, str]: - """ - Sets headers needed by proxies: specifically, the Accept and Host - headers. Only sets headers not provided by the user. - """ - headers_ = {"Accept": "*/*"} - - netloc = parse_url(url).netloc - if netloc: - headers_["Host"] = netloc - - if headers: - headers_.update(headers) - return headers_ - - def urlopen( # type: ignore[override] - self, method: str, url: str, redirect: bool = True, **kw: typing.Any - ) -> BaseHTTPResponse: - "Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute." - u = parse_url(url) - if not connection_requires_http_tunnel(self.proxy, self.proxy_config, u.scheme): - # For connections using HTTP CONNECT, httplib sets the necessary - # headers on the CONNECT to the proxy. If we're not using CONNECT, - # we'll definitely need to set 'Host' at the very least. - headers = kw.get("headers", self.headers) - kw["headers"] = self._set_proxy_headers(url, headers) - - return super().urlopen(method, url, redirect=redirect, **kw) - - -def proxy_from_url(url: str, **kw: typing.Any) -> ProxyManager: - return ProxyManager(proxy_url=url, **kw) diff --git a/venv/lib/python3.8/site-packages/urllib3/py.typed b/venv/lib/python3.8/site-packages/urllib3/py.typed deleted file mode 100644 index 5f3ea3d919363f08ab03edbc85b6099bc4df5647..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Instruct type checkers to look for inline type annotations in this package. -# See PEP 561. diff --git a/venv/lib/python3.8/site-packages/urllib3/response.py b/venv/lib/python3.8/site-packages/urllib3/response.py deleted file mode 100644 index 12097ea9c20698dff1b56d8d100f8a3267a33655..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/response.py +++ /dev/null @@ -1,1132 +0,0 @@ -from __future__ import annotations - -import collections -import io -import json as _json -import logging -import re -import sys -import typing -import warnings -import zlib -from contextlib import contextmanager -from http.client import HTTPMessage as _HttplibHTTPMessage -from http.client import HTTPResponse as _HttplibHTTPResponse -from socket import timeout as SocketTimeout - -try: - try: - import brotlicffi as brotli # type: ignore[import] - except ImportError: - import brotli # type: ignore[import] -except ImportError: - brotli = None - -try: - import zstandard as zstd # type: ignore[import] - - # The package 'zstandard' added the 'eof' property starting - # in v0.18.0 which we require to ensure a complete and - # valid zstd stream was fed into the ZstdDecoder. - # See: https://github.com/urllib3/urllib3/pull/2624 - _zstd_version = _zstd_version = tuple( - map(int, re.search(r"^([0-9]+)\.([0-9]+)", zstd.__version__).groups()) # type: ignore[union-attr] - ) - if _zstd_version < (0, 18): # Defensive: - zstd = None - -except (AttributeError, ImportError, ValueError): # Defensive: - zstd = None - -from . import util -from ._base_connection import _TYPE_BODY -from ._collections import HTTPHeaderDict -from .connection import BaseSSLError, HTTPConnection, HTTPException -from .exceptions import ( - BodyNotHttplibCompatible, - DecodeError, - HTTPError, - IncompleteRead, - InvalidChunkLength, - InvalidHeader, - ProtocolError, - ReadTimeoutError, - ResponseNotChunked, - SSLError, -) -from .util.response import is_fp_closed, is_response_to_head -from .util.retry import Retry - -if typing.TYPE_CHECKING: - from typing_extensions import Literal - - from .connectionpool import HTTPConnectionPool - -log = logging.getLogger(__name__) - - -class ContentDecoder: - def decompress(self, data: bytes) -> bytes: - raise NotImplementedError() - - def flush(self) -> bytes: - raise NotImplementedError() - - -class DeflateDecoder(ContentDecoder): - def __init__(self) -> None: - self._first_try = True - self._data = b"" - self._obj = zlib.decompressobj() - - def decompress(self, data: bytes) -> bytes: - if not data: - return data - - if not self._first_try: - return self._obj.decompress(data) - - self._data += data - try: - decompressed = self._obj.decompress(data) - if decompressed: - self._first_try = False - self._data = None # type: ignore[assignment] - return decompressed - except zlib.error: - self._first_try = False - self._obj = zlib.decompressobj(-zlib.MAX_WBITS) - try: - return self.decompress(self._data) - finally: - self._data = None # type: ignore[assignment] - - def flush(self) -> bytes: - return self._obj.flush() - - -class GzipDecoderState: - FIRST_MEMBER = 0 - OTHER_MEMBERS = 1 - SWALLOW_DATA = 2 - - -class GzipDecoder(ContentDecoder): - def __init__(self) -> None: - self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) - self._state = GzipDecoderState.FIRST_MEMBER - - def decompress(self, data: bytes) -> bytes: - ret = bytearray() - if self._state == GzipDecoderState.SWALLOW_DATA or not data: - return bytes(ret) - while True: - try: - ret += self._obj.decompress(data) - except zlib.error: - previous_state = self._state - # Ignore data after the first error - self._state = GzipDecoderState.SWALLOW_DATA - if previous_state == GzipDecoderState.OTHER_MEMBERS: - # Allow trailing garbage acceptable in other gzip clients - return bytes(ret) - raise - data = self._obj.unused_data - if not data: - return bytes(ret) - self._state = GzipDecoderState.OTHER_MEMBERS - self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) - - def flush(self) -> bytes: - return self._obj.flush() - - -if brotli is not None: - - class BrotliDecoder(ContentDecoder): - # Supports both 'brotlipy' and 'Brotli' packages - # since they share an import name. The top branches - # are for 'brotlipy' and bottom branches for 'Brotli' - def __init__(self) -> None: - self._obj = brotli.Decompressor() - if hasattr(self._obj, "decompress"): - setattr(self, "decompress", self._obj.decompress) - else: - setattr(self, "decompress", self._obj.process) - - def flush(self) -> bytes: - if hasattr(self._obj, "flush"): - return self._obj.flush() # type: ignore[no-any-return] - return b"" - - -if zstd is not None: - - class ZstdDecoder(ContentDecoder): - def __init__(self) -> None: - self._obj = zstd.ZstdDecompressor().decompressobj() - - def decompress(self, data: bytes) -> bytes: - if not data: - return b"" - data_parts = [self._obj.decompress(data)] - while self._obj.eof and self._obj.unused_data: - unused_data = self._obj.unused_data - self._obj = zstd.ZstdDecompressor().decompressobj() - data_parts.append(self._obj.decompress(unused_data)) - return b"".join(data_parts) - - def flush(self) -> bytes: - ret = self._obj.flush() # note: this is a no-op - if not self._obj.eof: - raise DecodeError("Zstandard data is incomplete") - return ret # type: ignore[no-any-return] - - -class MultiDecoder(ContentDecoder): - """ - From RFC7231: - If one or more encodings have been applied to a representation, the - sender that applied the encodings MUST generate a Content-Encoding - header field that lists the content codings in the order in which - they were applied. - """ - - def __init__(self, modes: str) -> None: - self._decoders = [_get_decoder(m.strip()) for m in modes.split(",")] - - def flush(self) -> bytes: - return self._decoders[0].flush() - - def decompress(self, data: bytes) -> bytes: - for d in reversed(self._decoders): - data = d.decompress(data) - return data - - -def _get_decoder(mode: str) -> ContentDecoder: - if "," in mode: - return MultiDecoder(mode) - - if mode == "gzip": - return GzipDecoder() - - if brotli is not None and mode == "br": - return BrotliDecoder() - - if zstd is not None and mode == "zstd": - return ZstdDecoder() - - return DeflateDecoder() - - -class BytesQueueBuffer: - """Memory-efficient bytes buffer - - To return decoded data in read() and still follow the BufferedIOBase API, we need a - buffer to always return the correct amount of bytes. - - This buffer should be filled using calls to put() - - Our maximum memory usage is determined by the sum of the size of: - - * self.buffer, which contains the full data - * the largest chunk that we will copy in get() - - The worst case scenario is a single chunk, in which case we'll make a full copy of - the data inside get(). - """ - - def __init__(self) -> None: - self.buffer: typing.Deque[bytes] = collections.deque() - self._size: int = 0 - - def __len__(self) -> int: - return self._size - - def put(self, data: bytes) -> None: - self.buffer.append(data) - self._size += len(data) - - def get(self, n: int) -> bytes: - if n == 0: - return b"" - elif not self.buffer: - raise RuntimeError("buffer is empty") - elif n < 0: - raise ValueError("n should be > 0") - - fetched = 0 - ret = io.BytesIO() - while fetched < n: - remaining = n - fetched - chunk = self.buffer.popleft() - chunk_length = len(chunk) - if remaining < chunk_length: - left_chunk, right_chunk = chunk[:remaining], chunk[remaining:] - ret.write(left_chunk) - self.buffer.appendleft(right_chunk) - self._size -= remaining - break - else: - ret.write(chunk) - self._size -= chunk_length - fetched += chunk_length - - if not self.buffer: - break - - return ret.getvalue() - - -class BaseHTTPResponse(io.IOBase): - CONTENT_DECODERS = ["gzip", "deflate"] - if brotli is not None: - CONTENT_DECODERS += ["br"] - if zstd is not None: - CONTENT_DECODERS += ["zstd"] - REDIRECT_STATUSES = [301, 302, 303, 307, 308] - - DECODER_ERROR_CLASSES: tuple[type[Exception], ...] = (IOError, zlib.error) - if brotli is not None: - DECODER_ERROR_CLASSES += (brotli.error,) - - if zstd is not None: - DECODER_ERROR_CLASSES += (zstd.ZstdError,) - - def __init__( - self, - *, - headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, - status: int, - version: int, - reason: str | None, - decode_content: bool, - request_url: str | None, - retries: Retry | None = None, - ) -> None: - if isinstance(headers, HTTPHeaderDict): - self.headers = headers - else: - self.headers = HTTPHeaderDict(headers) # type: ignore[arg-type] - self.status = status - self.version = version - self.reason = reason - self.decode_content = decode_content - self._has_decoded_content = False - self._request_url: str | None = request_url - self.retries = retries - - self.chunked = False - tr_enc = self.headers.get("transfer-encoding", "").lower() - # Don't incur the penalty of creating a list and then discarding it - encodings = (enc.strip() for enc in tr_enc.split(",")) - if "chunked" in encodings: - self.chunked = True - - self._decoder: ContentDecoder | None = None - - def get_redirect_location(self) -> str | None | Literal[False]: - """ - Should we redirect and where to? - - :returns: Truthy redirect location string if we got a redirect status - code and valid location. ``None`` if redirect status and no - location. ``False`` if not a redirect status code. - """ - if self.status in self.REDIRECT_STATUSES: - return self.headers.get("location") - return False - - @property - def data(self) -> bytes: - raise NotImplementedError() - - def json(self) -> typing.Any: - """ - Parses the body of the HTTP response as JSON. - - To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to the decoder. - - This method can raise either `UnicodeDecodeError` or `json.JSONDecodeError`. - - Read more :ref:`here `. - """ - data = self.data.decode("utf-8") - return _json.loads(data) - - @property - def url(self) -> str | None: - raise NotImplementedError() - - @url.setter - def url(self, url: str | None) -> None: - raise NotImplementedError() - - @property - def connection(self) -> HTTPConnection | None: - raise NotImplementedError() - - @property - def retries(self) -> Retry | None: - return self._retries - - @retries.setter - def retries(self, retries: Retry | None) -> None: - # Override the request_url if retries has a redirect location. - if retries is not None and retries.history: - self.url = retries.history[-1].redirect_location - self._retries = retries - - def stream( - self, amt: int | None = 2**16, decode_content: bool | None = None - ) -> typing.Iterator[bytes]: - raise NotImplementedError() - - def read( - self, - amt: int | None = None, - decode_content: bool | None = None, - cache_content: bool = False, - ) -> bytes: - raise NotImplementedError() - - def read_chunked( - self, - amt: int | None = None, - decode_content: bool | None = None, - ) -> typing.Iterator[bytes]: - raise NotImplementedError() - - def release_conn(self) -> None: - raise NotImplementedError() - - def drain_conn(self) -> None: - raise NotImplementedError() - - def close(self) -> None: - raise NotImplementedError() - - def _init_decoder(self) -> None: - """ - Set-up the _decoder attribute if necessary. - """ - # Note: content-encoding value should be case-insensitive, per RFC 7230 - # Section 3.2 - content_encoding = self.headers.get("content-encoding", "").lower() - if self._decoder is None: - if content_encoding in self.CONTENT_DECODERS: - self._decoder = _get_decoder(content_encoding) - elif "," in content_encoding: - encodings = [ - e.strip() - for e in content_encoding.split(",") - if e.strip() in self.CONTENT_DECODERS - ] - if encodings: - self._decoder = _get_decoder(content_encoding) - - def _decode( - self, data: bytes, decode_content: bool | None, flush_decoder: bool - ) -> bytes: - """ - Decode the data passed in and potentially flush the decoder. - """ - if not decode_content: - if self._has_decoded_content: - raise RuntimeError( - "Calling read(decode_content=False) is not supported after " - "read(decode_content=True) was called." - ) - return data - - try: - if self._decoder: - data = self._decoder.decompress(data) - self._has_decoded_content = True - except self.DECODER_ERROR_CLASSES as e: - content_encoding = self.headers.get("content-encoding", "").lower() - raise DecodeError( - "Received response with content-encoding: %s, but " - "failed to decode it." % content_encoding, - e, - ) from e - if flush_decoder: - data += self._flush_decoder() - - return data - - def _flush_decoder(self) -> bytes: - """ - Flushes the decoder. Should only be called if the decoder is actually - being used. - """ - if self._decoder: - return self._decoder.decompress(b"") + self._decoder.flush() - return b"" - - # Compatibility methods for `io` module - def readinto(self, b: bytearray) -> int: - temp = self.read(len(b)) - if len(temp) == 0: - return 0 - else: - b[: len(temp)] = temp - return len(temp) - - # Compatibility methods for http.client.HTTPResponse - def getheaders(self) -> HTTPHeaderDict: - warnings.warn( - "HTTPResponse.getheaders() is deprecated and will be removed " - "in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.", - category=DeprecationWarning, - stacklevel=2, - ) - return self.headers - - def getheader(self, name: str, default: str | None = None) -> str | None: - warnings.warn( - "HTTPResponse.getheader() is deprecated and will be removed " - "in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).", - category=DeprecationWarning, - stacklevel=2, - ) - return self.headers.get(name, default) - - # Compatibility method for http.cookiejar - def info(self) -> HTTPHeaderDict: - return self.headers - - def geturl(self) -> str | None: - return self.url - - -class HTTPResponse(BaseHTTPResponse): - """ - HTTP Response container. - - Backwards-compatible with :class:`http.client.HTTPResponse` but the response ``body`` is - loaded and decoded on-demand when the ``data`` property is accessed. This - class is also compatible with the Python standard library's :mod:`io` - module, and can hence be treated as a readable object in the context of that - framework. - - Extra parameters for behaviour not present in :class:`http.client.HTTPResponse`: - - :param preload_content: - If True, the response's body will be preloaded during construction. - - :param decode_content: - If True, will attempt to decode the body based on the - 'content-encoding' header. - - :param original_response: - When this HTTPResponse wrapper is generated from an :class:`http.client.HTTPResponse` - object, it's convenient to include the original for debug purposes. It's - otherwise unused. - - :param retries: - The retries contains the last :class:`~urllib3.util.retry.Retry` that - was used during the request. - - :param enforce_content_length: - Enforce content length checking. Body returned by server must match - value of Content-Length header, if present. Otherwise, raise error. - """ - - def __init__( - self, - body: _TYPE_BODY = "", - headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, - status: int = 0, - version: int = 0, - reason: str | None = None, - preload_content: bool = True, - decode_content: bool = True, - original_response: _HttplibHTTPResponse | None = None, - pool: HTTPConnectionPool | None = None, - connection: HTTPConnection | None = None, - msg: _HttplibHTTPMessage | None = None, - retries: Retry | None = None, - enforce_content_length: bool = True, - request_method: str | None = None, - request_url: str | None = None, - auto_close: bool = True, - ) -> None: - super().__init__( - headers=headers, - status=status, - version=version, - reason=reason, - decode_content=decode_content, - request_url=request_url, - retries=retries, - ) - - self.enforce_content_length = enforce_content_length - self.auto_close = auto_close - - self._body = None - self._fp: _HttplibHTTPResponse | None = None - self._original_response = original_response - self._fp_bytes_read = 0 - self.msg = msg - - if body and isinstance(body, (str, bytes)): - self._body = body - - self._pool = pool - self._connection = connection - - if hasattr(body, "read"): - self._fp = body # type: ignore[assignment] - - # Are we using the chunked-style of transfer encoding? - self.chunk_left: int | None = None - - # Determine length of response - self.length_remaining = self._init_length(request_method) - - # Used to return the correct amount of bytes for partial read()s - self._decoded_buffer = BytesQueueBuffer() - - # If requested, preload the body. - if preload_content and not self._body: - self._body = self.read(decode_content=decode_content) - - def release_conn(self) -> None: - if not self._pool or not self._connection: - return None - - self._pool._put_conn(self._connection) - self._connection = None - - def drain_conn(self) -> None: - """ - Read and discard any remaining HTTP response data in the response connection. - - Unread data in the HTTPResponse connection blocks the connection from being released back to the pool. - """ - try: - self.read() - except (HTTPError, OSError, BaseSSLError, HTTPException): - pass - - @property - def data(self) -> bytes: - # For backwards-compat with earlier urllib3 0.4 and earlier. - if self._body: - return self._body # type: ignore[return-value] - - if self._fp: - return self.read(cache_content=True) - - return None # type: ignore[return-value] - - @property - def connection(self) -> HTTPConnection | None: - return self._connection - - def isclosed(self) -> bool: - return is_fp_closed(self._fp) - - def tell(self) -> int: - """ - Obtain the number of bytes pulled over the wire so far. May differ from - the amount of content returned by :meth:``urllib3.response.HTTPResponse.read`` - if bytes are encoded on the wire (e.g, compressed). - """ - return self._fp_bytes_read - - def _init_length(self, request_method: str | None) -> int | None: - """ - Set initial length value for Response content if available. - """ - length: int | None - content_length: str | None = self.headers.get("content-length") - - if content_length is not None: - if self.chunked: - # This Response will fail with an IncompleteRead if it can't be - # received as chunked. This method falls back to attempt reading - # the response before raising an exception. - log.warning( - "Received response with both Content-Length and " - "Transfer-Encoding set. This is expressly forbidden " - "by RFC 7230 sec 3.3.2. Ignoring Content-Length and " - "attempting to process response as Transfer-Encoding: " - "chunked." - ) - return None - - try: - # RFC 7230 section 3.3.2 specifies multiple content lengths can - # be sent in a single Content-Length header - # (e.g. Content-Length: 42, 42). This line ensures the values - # are all valid ints and that as long as the `set` length is 1, - # all values are the same. Otherwise, the header is invalid. - lengths = {int(val) for val in content_length.split(",")} - if len(lengths) > 1: - raise InvalidHeader( - "Content-Length contained multiple " - "unmatching values (%s)" % content_length - ) - length = lengths.pop() - except ValueError: - length = None - else: - if length < 0: - length = None - - else: # if content_length is None - length = None - - # Convert status to int for comparison - # In some cases, httplib returns a status of "_UNKNOWN" - try: - status = int(self.status) - except ValueError: - status = 0 - - # Check for responses that shouldn't include a body - if status in (204, 304) or 100 <= status < 200 or request_method == "HEAD": - length = 0 - - return length - - @contextmanager - def _error_catcher(self) -> typing.Generator[None, None, None]: - """ - Catch low-level python exceptions, instead re-raising urllib3 - variants, so that low-level exceptions are not leaked in the - high-level api. - - On exit, release the connection back to the pool. - """ - clean_exit = False - - try: - try: - yield - - except SocketTimeout as e: - # FIXME: Ideally we'd like to include the url in the ReadTimeoutError but - # there is yet no clean way to get at it from this context. - raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type] - - except BaseSSLError as e: - # FIXME: Is there a better way to differentiate between SSLErrors? - if "read operation timed out" not in str(e): - # SSL errors related to framing/MAC get wrapped and reraised here - raise SSLError(e) from e - - raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type] - - except (HTTPException, OSError) as e: - # This includes IncompleteRead. - raise ProtocolError(f"Connection broken: {e!r}", e) from e - - # If no exception is thrown, we should avoid cleaning up - # unnecessarily. - clean_exit = True - finally: - # If we didn't terminate cleanly, we need to throw away our - # connection. - if not clean_exit: - # The response may not be closed but we're not going to use it - # anymore so close it now to ensure that the connection is - # released back to the pool. - if self._original_response: - self._original_response.close() - - # Closing the response may not actually be sufficient to close - # everything, so if we have a hold of the connection close that - # too. - if self._connection: - self._connection.close() - - # If we hold the original response but it's closed now, we should - # return the connection back to the pool. - if self._original_response and self._original_response.isclosed(): - self.release_conn() - - def _fp_read(self, amt: int | None = None) -> bytes: - """ - Read a response with the thought that reading the number of bytes - larger than can fit in a 32-bit int at a time via SSL in some - known cases leads to an overflow error that has to be prevented - if `amt` or `self.length_remaining` indicate that a problem may - happen. - - The known cases: - * 3.8 <= CPython < 3.9.7 because of a bug - https://github.com/urllib3/urllib3/issues/2513#issuecomment-1152559900. - * urllib3 injected with pyOpenSSL-backed SSL-support. - * CPython < 3.10 only when `amt` does not fit 32-bit int. - """ - assert self._fp - c_int_max = 2**31 - 1 - if ( - ( - (amt and amt > c_int_max) - or (self.length_remaining and self.length_remaining > c_int_max) - ) - and not util.IS_SECURETRANSPORT - and (util.IS_PYOPENSSL or sys.version_info < (3, 10)) - ): - buffer = io.BytesIO() - # Besides `max_chunk_amt` being a maximum chunk size, it - # affects memory overhead of reading a response by this - # method in CPython. - # `c_int_max` equal to 2 GiB - 1 byte is the actual maximum - # chunk size that does not lead to an overflow error, but - # 256 MiB is a compromise. - max_chunk_amt = 2**28 - while amt is None or amt != 0: - if amt is not None: - chunk_amt = min(amt, max_chunk_amt) - amt -= chunk_amt - else: - chunk_amt = max_chunk_amt - data = self._fp.read(chunk_amt) - if not data: - break - buffer.write(data) - del data # to reduce peak memory usage by `max_chunk_amt`. - return buffer.getvalue() - else: - # StringIO doesn't like amt=None - return self._fp.read(amt) if amt is not None else self._fp.read() - - def _raw_read( - self, - amt: int | None = None, - ) -> bytes: - """ - Reads `amt` of bytes from the socket. - """ - if self._fp is None: - return None # type: ignore[return-value] - - fp_closed = getattr(self._fp, "closed", False) - - with self._error_catcher(): - data = self._fp_read(amt) if not fp_closed else b"" - if amt is not None and amt != 0 and not data: - # Platform-specific: Buggy versions of Python. - # Close the connection when no data is returned - # - # This is redundant to what httplib/http.client _should_ - # already do. However, versions of python released before - # December 15, 2012 (http://bugs.python.org/issue16298) do - # not properly close the connection in all cases. There is - # no harm in redundantly calling close. - self._fp.close() - if ( - self.enforce_content_length - and self.length_remaining is not None - and self.length_remaining != 0 - ): - # This is an edge case that httplib failed to cover due - # to concerns of backward compatibility. We're - # addressing it here to make sure IncompleteRead is - # raised during streaming, so all calls with incorrect - # Content-Length are caught. - raise IncompleteRead(self._fp_bytes_read, self.length_remaining) - - if data: - self._fp_bytes_read += len(data) - if self.length_remaining is not None: - self.length_remaining -= len(data) - return data - - def read( - self, - amt: int | None = None, - decode_content: bool | None = None, - cache_content: bool = False, - ) -> bytes: - """ - Similar to :meth:`http.client.HTTPResponse.read`, but with two additional - parameters: ``decode_content`` and ``cache_content``. - - :param amt: - How much of the content to read. If specified, caching is skipped - because it doesn't make sense to cache partial content as the full - response. - - :param decode_content: - If True, will attempt to decode the body based on the - 'content-encoding' header. - - :param cache_content: - If True, will save the returned data such that the same result is - returned despite of the state of the underlying file object. This - is useful if you want the ``.data`` property to continue working - after having ``.read()`` the file object. (Overridden if ``amt`` is - set.) - """ - self._init_decoder() - if decode_content is None: - decode_content = self.decode_content - - if amt is not None: - cache_content = False - - if len(self._decoded_buffer) >= amt: - return self._decoded_buffer.get(amt) - - data = self._raw_read(amt) - - flush_decoder = amt is None or (amt != 0 and not data) - - if not data and len(self._decoded_buffer) == 0: - return data - - if amt is None: - data = self._decode(data, decode_content, flush_decoder) - if cache_content: - self._body = data - else: - # do not waste memory on buffer when not decoding - if not decode_content: - if self._has_decoded_content: - raise RuntimeError( - "Calling read(decode_content=False) is not supported after " - "read(decode_content=True) was called." - ) - return data - - decoded_data = self._decode(data, decode_content, flush_decoder) - self._decoded_buffer.put(decoded_data) - - while len(self._decoded_buffer) < amt and data: - # TODO make sure to initially read enough data to get past the headers - # For example, the GZ file header takes 10 bytes, we don't want to read - # it one byte at a time - data = self._raw_read(amt) - decoded_data = self._decode(data, decode_content, flush_decoder) - self._decoded_buffer.put(decoded_data) - data = self._decoded_buffer.get(amt) - - return data - - def stream( - self, amt: int | None = 2**16, decode_content: bool | None = None - ) -> typing.Generator[bytes, None, None]: - """ - A generator wrapper for the read() method. A call will block until - ``amt`` bytes have been read from the connection or until the - connection is closed. - - :param amt: - How much of the content to read. The generator will return up to - much data per iteration, but may return less. This is particularly - likely when using compressed data. However, the empty string will - never be returned. - - :param decode_content: - If True, will attempt to decode the body based on the - 'content-encoding' header. - """ - if self.chunked and self.supports_chunked_reads(): - yield from self.read_chunked(amt, decode_content=decode_content) - else: - while not is_fp_closed(self._fp) or len(self._decoded_buffer) > 0: - data = self.read(amt=amt, decode_content=decode_content) - - if data: - yield data - - # Overrides from io.IOBase - def readable(self) -> bool: - return True - - def close(self) -> None: - if not self.closed and self._fp: - self._fp.close() - - if self._connection: - self._connection.close() - - if not self.auto_close: - io.IOBase.close(self) - - @property - def closed(self) -> bool: - if not self.auto_close: - return io.IOBase.closed.__get__(self) # type: ignore[no-any-return] - elif self._fp is None: - return True - elif hasattr(self._fp, "isclosed"): - return self._fp.isclosed() - elif hasattr(self._fp, "closed"): - return self._fp.closed - else: - return True - - def fileno(self) -> int: - if self._fp is None: - raise OSError("HTTPResponse has no file to get a fileno from") - elif hasattr(self._fp, "fileno"): - return self._fp.fileno() - else: - raise OSError( - "The file-like object this HTTPResponse is wrapped " - "around has no file descriptor" - ) - - def flush(self) -> None: - if ( - self._fp is not None - and hasattr(self._fp, "flush") - and not getattr(self._fp, "closed", False) - ): - return self._fp.flush() - - def supports_chunked_reads(self) -> bool: - """ - Checks if the underlying file-like object looks like a - :class:`http.client.HTTPResponse` object. We do this by testing for - the fp attribute. If it is present we assume it returns raw chunks as - processed by read_chunked(). - """ - return hasattr(self._fp, "fp") - - def _update_chunk_length(self) -> None: - # First, we'll figure out length of a chunk and then - # we'll try to read it from socket. - if self.chunk_left is not None: - return None - line = self._fp.fp.readline() # type: ignore[union-attr] - line = line.split(b";", 1)[0] - try: - self.chunk_left = int(line, 16) - except ValueError: - # Invalid chunked protocol response, abort. - self.close() - raise InvalidChunkLength(self, line) from None - - def _handle_chunk(self, amt: int | None) -> bytes: - returned_chunk = None - if amt is None: - chunk = self._fp._safe_read(self.chunk_left) # type: ignore[union-attr] - returned_chunk = chunk - self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. - self.chunk_left = None - elif self.chunk_left is not None and amt < self.chunk_left: - value = self._fp._safe_read(amt) # type: ignore[union-attr] - self.chunk_left = self.chunk_left - amt - returned_chunk = value - elif amt == self.chunk_left: - value = self._fp._safe_read(amt) # type: ignore[union-attr] - self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. - self.chunk_left = None - returned_chunk = value - else: # amt > self.chunk_left - returned_chunk = self._fp._safe_read(self.chunk_left) # type: ignore[union-attr] - self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. - self.chunk_left = None - return returned_chunk # type: ignore[no-any-return] - - def read_chunked( - self, amt: int | None = None, decode_content: bool | None = None - ) -> typing.Generator[bytes, None, None]: - """ - Similar to :meth:`HTTPResponse.read`, but with an additional - parameter: ``decode_content``. - - :param amt: - How much of the content to read. If specified, caching is skipped - because it doesn't make sense to cache partial content as the full - response. - - :param decode_content: - If True, will attempt to decode the body based on the - 'content-encoding' header. - """ - self._init_decoder() - # FIXME: Rewrite this method and make it a class with a better structured logic. - if not self.chunked: - raise ResponseNotChunked( - "Response is not chunked. " - "Header 'transfer-encoding: chunked' is missing." - ) - if not self.supports_chunked_reads(): - raise BodyNotHttplibCompatible( - "Body should be http.client.HTTPResponse like. " - "It should have have an fp attribute which returns raw chunks." - ) - - with self._error_catcher(): - # Don't bother reading the body of a HEAD request. - if self._original_response and is_response_to_head(self._original_response): - self._original_response.close() - return None - - # If a response is already read and closed - # then return immediately. - if self._fp.fp is None: # type: ignore[union-attr] - return None - - while True: - self._update_chunk_length() - if self.chunk_left == 0: - break - chunk = self._handle_chunk(amt) - decoded = self._decode( - chunk, decode_content=decode_content, flush_decoder=False - ) - if decoded: - yield decoded - - if decode_content: - # On CPython and PyPy, we should never need to flush the - # decoder. However, on Jython we *might* need to, so - # lets defensively do it anyway. - decoded = self._flush_decoder() - if decoded: # Platform-specific: Jython. - yield decoded - - # Chunk content ends with \r\n: discard it. - while self._fp is not None: - line = self._fp.fp.readline() - if not line: - # Some sites may not end with '\r\n'. - break - if line == b"\r\n": - break - - # We read everything; close the "file". - if self._original_response: - self._original_response.close() - - @property - def url(self) -> str | None: - """ - Returns the URL that was the source of this response. - If the request that generated this response redirected, this method - will return the final redirect location. - """ - return self._request_url - - @url.setter - def url(self, url: str) -> None: - self._request_url = url - - def __iter__(self) -> typing.Iterator[bytes]: - buffer: list[bytes] = [] - for chunk in self.stream(decode_content=True): - if b"\n" in chunk: - chunks = chunk.split(b"\n") - yield b"".join(buffer) + chunks[0] + b"\n" - for x in chunks[1:-1]: - yield x + b"\n" - if chunks[-1]: - buffer = [chunks[-1]] - else: - buffer = [] - else: - buffer.append(chunk) - if buffer: - yield b"".join(buffer) diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__init__.py b/venv/lib/python3.8/site-packages/urllib3/util/__init__.py deleted file mode 100644 index ff56c55bae3059b2b4578b3f0220a1fcd80984d4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/__init__.py +++ /dev/null @@ -1,44 +0,0 @@ -# For backwards compatibility, provide imports that used to be here. -from __future__ import annotations - -from .connection import is_connection_dropped -from .request import SKIP_HEADER, SKIPPABLE_HEADERS, make_headers -from .response import is_fp_closed -from .retry import Retry -from .ssl_ import ( - ALPN_PROTOCOLS, - IS_PYOPENSSL, - IS_SECURETRANSPORT, - SSLContext, - assert_fingerprint, - create_urllib3_context, - resolve_cert_reqs, - resolve_ssl_version, - ssl_wrap_socket, -) -from .timeout import Timeout -from .url import Url, parse_url -from .wait import wait_for_read, wait_for_write - -__all__ = ( - "IS_PYOPENSSL", - "IS_SECURETRANSPORT", - "SSLContext", - "ALPN_PROTOCOLS", - "Retry", - "Timeout", - "Url", - "assert_fingerprint", - "create_urllib3_context", - "is_connection_dropped", - "is_fp_closed", - "parse_url", - "make_headers", - "resolve_cert_reqs", - "resolve_ssl_version", - "ssl_wrap_socket", - "wait_for_read", - "wait_for_write", - "SKIP_HEADER", - "SKIPPABLE_HEADERS", -) diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 54a4d045d832368a6c73e04f4241c4293fc58d8a..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/connection.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/connection.cpython-38.pyc deleted file mode 100644 index 7746c260ae084025a48bf60ba984828437347015..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/connection.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/proxy.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/proxy.cpython-38.pyc deleted file mode 100644 index 639aa1eaf196ccac91d6ea394857011a5134e0c0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/proxy.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/request.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/request.cpython-38.pyc deleted file mode 100644 index 5d942d5dedffb3c748be575d27244ea61e4b81ae..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/request.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/response.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/response.cpython-38.pyc deleted file mode 100644 index 32585976da08b7b0f92f34392151e421187de319..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/response.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/retry.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/retry.cpython-38.pyc deleted file mode 100644 index 9472c31a099dc195ac6b4f266dce956ce78d98f3..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/retry.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssl_.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssl_.cpython-38.pyc deleted file mode 100644 index 2c283ef4ac49bf45af7416ab72ca7437f745e766..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssl_.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssl_match_hostname.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssl_match_hostname.cpython-38.pyc deleted file mode 100644 index 2a570fbbb475da45b56f39ca0725b52d8b58c5cc..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssl_match_hostname.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssltransport.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssltransport.cpython-38.pyc deleted file mode 100644 index d21a71736cffb6f43f642bbc698b2862a264dd44..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/ssltransport.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/timeout.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/timeout.cpython-38.pyc deleted file mode 100644 index f2ddef059bac1c4a5b009dee2122dbafe14aae08..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/timeout.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/url.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/url.cpython-38.pyc deleted file mode 100644 index 440ca507b0e6138ce2b76bbbfab704e2d41387e6..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/url.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/util.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/util.cpython-38.pyc deleted file mode 100644 index 44d117605e17a7992d0881ac31f5cbd92e88bb56..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/util.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/wait.cpython-38.pyc b/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/wait.cpython-38.pyc deleted file mode 100644 index 5d5cb073f4d31aa3d3fd684f9ef074c31c575686..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/urllib3/util/__pycache__/wait.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/urllib3/util/connection.py b/venv/lib/python3.8/site-packages/urllib3/util/connection.py deleted file mode 100644 index 5c7da73f4e0e57cfe9074c50c2628300130fc94d..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/connection.py +++ /dev/null @@ -1,137 +0,0 @@ -from __future__ import annotations - -import socket -import typing - -from ..exceptions import LocationParseError -from .timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT - -_TYPE_SOCKET_OPTIONS = typing.Sequence[typing.Tuple[int, int, typing.Union[int, bytes]]] - -if typing.TYPE_CHECKING: - from .._base_connection import BaseHTTPConnection - - -def is_connection_dropped(conn: BaseHTTPConnection) -> bool: # Platform-specific - """ - Returns True if the connection is dropped and should be closed. - :param conn: :class:`urllib3.connection.HTTPConnection` object. - """ - return not conn.is_connected - - -# This function is copied from socket.py in the Python 2.7 standard -# library test suite. Added to its signature is only `socket_options`. -# One additional modification is that we avoid binding to IPv6 servers -# discovered in DNS if the system doesn't have IPv6 functionality. -def create_connection( - address: tuple[str, int], - timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - source_address: tuple[str, int] | None = None, - socket_options: _TYPE_SOCKET_OPTIONS | None = None, -) -> socket.socket: - """Connect to *address* and return the socket object. - - Convenience function. Connect to *address* (a 2-tuple ``(host, - port)``) and return the socket object. Passing the optional - *timeout* parameter will set the timeout on the socket instance - before attempting to connect. If no *timeout* is supplied, the - global default timeout setting returned by :func:`socket.getdefaulttimeout` - is used. If *source_address* is set it must be a tuple of (host, port) - for the socket to bind as a source address before making the connection. - An host of '' or port 0 tells the OS to use the default. - """ - - host, port = address - if host.startswith("["): - host = host.strip("[]") - err = None - - # Using the value from allowed_gai_family() in the context of getaddrinfo lets - # us select whether to work with IPv4 DNS records, IPv6 records, or both. - # The original create_connection function always returns all records. - family = allowed_gai_family() - - try: - host.encode("idna") - except UnicodeError: - raise LocationParseError(f"'{host}', label empty or too long") from None - - for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): - af, socktype, proto, canonname, sa = res - sock = None - try: - sock = socket.socket(af, socktype, proto) - - # If provided, set socket level options before connecting. - _set_socket_options(sock, socket_options) - - if timeout is not _DEFAULT_TIMEOUT: - sock.settimeout(timeout) - if source_address: - sock.bind(source_address) - sock.connect(sa) - # Break explicitly a reference cycle - err = None - return sock - - except OSError as _: - err = _ - if sock is not None: - sock.close() - - if err is not None: - try: - raise err - finally: - # Break explicitly a reference cycle - err = None - else: - raise OSError("getaddrinfo returns an empty list") - - -def _set_socket_options( - sock: socket.socket, options: _TYPE_SOCKET_OPTIONS | None -) -> None: - if options is None: - return - - for opt in options: - sock.setsockopt(*opt) - - -def allowed_gai_family() -> socket.AddressFamily: - """This function is designed to work in the context of - getaddrinfo, where family=socket.AF_UNSPEC is the default and - will perform a DNS search for both IPv6 and IPv4 records.""" - - family = socket.AF_INET - if HAS_IPV6: - family = socket.AF_UNSPEC - return family - - -def _has_ipv6(host: str) -> bool: - """Returns True if the system can bind an IPv6 address.""" - sock = None - has_ipv6 = False - - if socket.has_ipv6: - # has_ipv6 returns true if cPython was compiled with IPv6 support. - # It does not tell us if the system has IPv6 support enabled. To - # determine that we must bind to an IPv6 address. - # https://github.com/urllib3/urllib3/pull/611 - # https://bugs.python.org/issue658327 - try: - sock = socket.socket(socket.AF_INET6) - sock.bind((host, 0)) - has_ipv6 = True - except Exception: - pass - - if sock: - sock.close() - return has_ipv6 - - -HAS_IPV6 = _has_ipv6("::1") diff --git a/venv/lib/python3.8/site-packages/urllib3/util/proxy.py b/venv/lib/python3.8/site-packages/urllib3/util/proxy.py deleted file mode 100644 index 908fc6621d0afbed16bde2c1957a5cf28d3a84d8..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/proxy.py +++ /dev/null @@ -1,43 +0,0 @@ -from __future__ import annotations - -import typing - -from .url import Url - -if typing.TYPE_CHECKING: - from ..connection import ProxyConfig - - -def connection_requires_http_tunnel( - proxy_url: Url | None = None, - proxy_config: ProxyConfig | None = None, - destination_scheme: str | None = None, -) -> bool: - """ - Returns True if the connection requires an HTTP CONNECT through the proxy. - - :param URL proxy_url: - URL of the proxy. - :param ProxyConfig proxy_config: - Proxy configuration from poolmanager.py - :param str destination_scheme: - The scheme of the destination. (i.e https, http, etc) - """ - # If we're not using a proxy, no way to use a tunnel. - if proxy_url is None: - return False - - # HTTP destinations never require tunneling, we always forward. - if destination_scheme == "http": - return False - - # Support for forwarding with HTTPS proxies and HTTPS destinations. - if ( - proxy_url.scheme == "https" - and proxy_config - and proxy_config.use_forwarding_for_https - ): - return False - - # Otherwise always use a tunnel. - return True diff --git a/venv/lib/python3.8/site-packages/urllib3/util/request.py b/venv/lib/python3.8/site-packages/urllib3/util/request.py deleted file mode 100644 index 7d6866f3adbcf765068ce845657b40917b9c5b48..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/request.py +++ /dev/null @@ -1,256 +0,0 @@ -from __future__ import annotations - -import io -import typing -from base64 import b64encode -from enum import Enum - -from ..exceptions import UnrewindableBodyError -from .util import to_bytes - -if typing.TYPE_CHECKING: - from typing_extensions import Final - -# Pass as a value within ``headers`` to skip -# emitting some HTTP headers that are added automatically. -# The only headers that are supported are ``Accept-Encoding``, -# ``Host``, and ``User-Agent``. -SKIP_HEADER = "@@@SKIP_HEADER@@@" -SKIPPABLE_HEADERS = frozenset(["accept-encoding", "host", "user-agent"]) - -ACCEPT_ENCODING = "gzip,deflate" -try: - try: - import brotlicffi as _unused_module_brotli # type: ignore[import] # noqa: F401 - except ImportError: - import brotli as _unused_module_brotli # type: ignore[import] # noqa: F401 -except ImportError: - pass -else: - ACCEPT_ENCODING += ",br" -try: - import zstandard as _unused_module_zstd # type: ignore[import] # noqa: F401 -except ImportError: - pass -else: - ACCEPT_ENCODING += ",zstd" - - -class _TYPE_FAILEDTELL(Enum): - token = 0 - - -_FAILEDTELL: Final[_TYPE_FAILEDTELL] = _TYPE_FAILEDTELL.token - -_TYPE_BODY_POSITION = typing.Union[int, _TYPE_FAILEDTELL] - -# When sending a request with these methods we aren't expecting -# a body so don't need to set an explicit 'Content-Length: 0' -# The reason we do this in the negative instead of tracking methods -# which 'should' have a body is because unknown methods should be -# treated as if they were 'POST' which *does* expect a body. -_METHODS_NOT_EXPECTING_BODY = {"GET", "HEAD", "DELETE", "TRACE", "OPTIONS", "CONNECT"} - - -def make_headers( - keep_alive: bool | None = None, - accept_encoding: bool | list[str] | str | None = None, - user_agent: str | None = None, - basic_auth: str | None = None, - proxy_basic_auth: str | None = None, - disable_cache: bool | None = None, -) -> dict[str, str]: - """ - Shortcuts for generating request headers. - - :param keep_alive: - If ``True``, adds 'connection: keep-alive' header. - - :param accept_encoding: - Can be a boolean, list, or string. - ``True`` translates to 'gzip,deflate'. If either the ``brotli`` or - ``brotlicffi`` package is installed 'gzip,deflate,br' is used instead. - List will get joined by comma. - String will be used as provided. - - :param user_agent: - String representing the user-agent you want, such as - "python-urllib3/0.6" - - :param basic_auth: - Colon-separated username:password string for 'authorization: basic ...' - auth header. - - :param proxy_basic_auth: - Colon-separated username:password string for 'proxy-authorization: basic ...' - auth header. - - :param disable_cache: - If ``True``, adds 'cache-control: no-cache' header. - - Example: - - .. code-block:: python - - import urllib3 - - print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0")) - # {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'} - print(urllib3.util.make_headers(accept_encoding=True)) - # {'accept-encoding': 'gzip,deflate'} - """ - headers: dict[str, str] = {} - if accept_encoding: - if isinstance(accept_encoding, str): - pass - elif isinstance(accept_encoding, list): - accept_encoding = ",".join(accept_encoding) - else: - accept_encoding = ACCEPT_ENCODING - headers["accept-encoding"] = accept_encoding - - if user_agent: - headers["user-agent"] = user_agent - - if keep_alive: - headers["connection"] = "keep-alive" - - if basic_auth: - headers[ - "authorization" - ] = f"Basic {b64encode(basic_auth.encode('latin-1')).decode()}" - - if proxy_basic_auth: - headers[ - "proxy-authorization" - ] = f"Basic {b64encode(proxy_basic_auth.encode('latin-1')).decode()}" - - if disable_cache: - headers["cache-control"] = "no-cache" - - return headers - - -def set_file_position( - body: typing.Any, pos: _TYPE_BODY_POSITION | None -) -> _TYPE_BODY_POSITION | None: - """ - If a position is provided, move file to that point. - Otherwise, we'll attempt to record a position for future use. - """ - if pos is not None: - rewind_body(body, pos) - elif getattr(body, "tell", None) is not None: - try: - pos = body.tell() - except OSError: - # This differentiates from None, allowing us to catch - # a failed `tell()` later when trying to rewind the body. - pos = _FAILEDTELL - - return pos - - -def rewind_body(body: typing.IO[typing.AnyStr], body_pos: _TYPE_BODY_POSITION) -> None: - """ - Attempt to rewind body to a certain position. - Primarily used for request redirects and retries. - - :param body: - File-like object that supports seek. - - :param int pos: - Position to seek to in file. - """ - body_seek = getattr(body, "seek", None) - if body_seek is not None and isinstance(body_pos, int): - try: - body_seek(body_pos) - except OSError as e: - raise UnrewindableBodyError( - "An error occurred when rewinding request body for redirect/retry." - ) from e - elif body_pos is _FAILEDTELL: - raise UnrewindableBodyError( - "Unable to record file position for rewinding " - "request body during a redirect/retry." - ) - else: - raise ValueError( - f"body_pos must be of type integer, instead it was {type(body_pos)}." - ) - - -class ChunksAndContentLength(typing.NamedTuple): - chunks: typing.Iterable[bytes] | None - content_length: int | None - - -def body_to_chunks( - body: typing.Any | None, method: str, blocksize: int -) -> ChunksAndContentLength: - """Takes the HTTP request method, body, and blocksize and - transforms them into an iterable of chunks to pass to - socket.sendall() and an optional 'Content-Length' header. - - A 'Content-Length' of 'None' indicates the length of the body - can't be determined so should use 'Transfer-Encoding: chunked' - for framing instead. - """ - - chunks: typing.Iterable[bytes] | None - content_length: int | None - - # No body, we need to make a recommendation on 'Content-Length' - # based on whether that request method is expected to have - # a body or not. - if body is None: - chunks = None - if method.upper() not in _METHODS_NOT_EXPECTING_BODY: - content_length = 0 - else: - content_length = None - - # Bytes or strings become bytes - elif isinstance(body, (str, bytes)): - chunks = (to_bytes(body),) - content_length = len(chunks[0]) - - # File-like object, TODO: use seek() and tell() for length? - elif hasattr(body, "read"): - - def chunk_readable() -> typing.Iterable[bytes]: - nonlocal body, blocksize - encode = isinstance(body, io.TextIOBase) - while True: - datablock = body.read(blocksize) - if not datablock: - break - if encode: - datablock = datablock.encode("iso-8859-1") - yield datablock - - chunks = chunk_readable() - content_length = None - - # Otherwise we need to start checking via duck-typing. - else: - try: - # Check if the body implements the buffer API. - mv = memoryview(body) - except TypeError: - try: - # Check if the body is an iterable - chunks = iter(body) - content_length = None - except TypeError: - raise TypeError( - f"'body' must be a bytes-like object, file-like " - f"object, or iterable. Instead was {body!r}" - ) from None - else: - # Since it implements the buffer API can be passed directly to socket.sendall() - chunks = (body,) - content_length = mv.nbytes - - return ChunksAndContentLength(chunks=chunks, content_length=content_length) diff --git a/venv/lib/python3.8/site-packages/urllib3/util/response.py b/venv/lib/python3.8/site-packages/urllib3/util/response.py deleted file mode 100644 index 0f4578696fa2e17a900c6890ec26d65e860b0b72..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/response.py +++ /dev/null @@ -1,101 +0,0 @@ -from __future__ import annotations - -import http.client as httplib -from email.errors import MultipartInvariantViolationDefect, StartBoundaryNotFoundDefect - -from ..exceptions import HeaderParsingError - - -def is_fp_closed(obj: object) -> bool: - """ - Checks whether a given file-like object is closed. - - :param obj: - The file-like object to check. - """ - - try: - # Check `isclosed()` first, in case Python3 doesn't set `closed`. - # GH Issue #928 - return obj.isclosed() # type: ignore[no-any-return, attr-defined] - except AttributeError: - pass - - try: - # Check via the official file-like-object way. - return obj.closed # type: ignore[no-any-return, attr-defined] - except AttributeError: - pass - - try: - # Check if the object is a container for another file-like object that - # gets released on exhaustion (e.g. HTTPResponse). - return obj.fp is None # type: ignore[attr-defined] - except AttributeError: - pass - - raise ValueError("Unable to determine whether fp is closed.") - - -def assert_header_parsing(headers: httplib.HTTPMessage) -> None: - """ - Asserts whether all headers have been successfully parsed. - Extracts encountered errors from the result of parsing headers. - - Only works on Python 3. - - :param http.client.HTTPMessage headers: Headers to verify. - - :raises urllib3.exceptions.HeaderParsingError: - If parsing errors are found. - """ - - # This will fail silently if we pass in the wrong kind of parameter. - # To make debugging easier add an explicit check. - if not isinstance(headers, httplib.HTTPMessage): - raise TypeError(f"expected httplib.Message, got {type(headers)}.") - - unparsed_data = None - - # get_payload is actually email.message.Message.get_payload; - # we're only interested in the result if it's not a multipart message - if not headers.is_multipart(): - payload = headers.get_payload() - - if isinstance(payload, (bytes, str)): - unparsed_data = payload - - # httplib is assuming a response body is available - # when parsing headers even when httplib only sends - # header data to parse_headers() This results in - # defects on multipart responses in particular. - # See: https://github.com/urllib3/urllib3/issues/800 - - # So we ignore the following defects: - # - StartBoundaryNotFoundDefect: - # The claimed start boundary was never found. - # - MultipartInvariantViolationDefect: - # A message claimed to be a multipart but no subparts were found. - defects = [ - defect - for defect in headers.defects - if not isinstance( - defect, (StartBoundaryNotFoundDefect, MultipartInvariantViolationDefect) - ) - ] - - if defects or unparsed_data: - raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data) - - -def is_response_to_head(response: httplib.HTTPResponse) -> bool: - """ - Checks whether the request of a response has been a HEAD-request. - - :param http.client.HTTPResponse response: - Response to check if the originating request - used 'HEAD' as a method. - """ - # FIXME: Can we do this somehow without accessing private httplib _method? - method_str = response._method # type: str # type: ignore[attr-defined] - return method_str.upper() == "HEAD" diff --git a/venv/lib/python3.8/site-packages/urllib3/util/retry.py b/venv/lib/python3.8/site-packages/urllib3/util/retry.py deleted file mode 100644 index 7572bfd26ad87711d67c3418a6a0ac9921fed08c..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/retry.py +++ /dev/null @@ -1,529 +0,0 @@ -from __future__ import annotations - -import email -import logging -import random -import re -import time -import typing -from itertools import takewhile -from types import TracebackType - -from ..exceptions import ( - ConnectTimeoutError, - InvalidHeader, - MaxRetryError, - ProtocolError, - ProxyError, - ReadTimeoutError, - ResponseError, -) -from .util import reraise - -if typing.TYPE_CHECKING: - from ..connectionpool import ConnectionPool - from ..response import BaseHTTPResponse - -log = logging.getLogger(__name__) - - -# Data structure for representing the metadata of requests that result in a retry. -class RequestHistory(typing.NamedTuple): - method: str | None - url: str | None - error: Exception | None - status: int | None - redirect_location: str | None - - -class Retry: - """Retry configuration. - - Each retry attempt will create a new Retry object with updated values, so - they can be safely reused. - - Retries can be defined as a default for a pool: - - .. code-block:: python - - retries = Retry(connect=5, read=2, redirect=5) - http = PoolManager(retries=retries) - response = http.request("GET", "https://example.com/") - - Or per-request (which overrides the default for the pool): - - .. code-block:: python - - response = http.request("GET", "https://example.com/", retries=Retry(10)) - - Retries can be disabled by passing ``False``: - - .. code-block:: python - - response = http.request("GET", "https://example.com/", retries=False) - - Errors will be wrapped in :class:`~urllib3.exceptions.MaxRetryError` unless - retries are disabled, in which case the causing exception will be raised. - - :param int total: - Total number of retries to allow. Takes precedence over other counts. - - Set to ``None`` to remove this constraint and fall back on other - counts. - - Set to ``0`` to fail on the first retry. - - Set to ``False`` to disable and imply ``raise_on_redirect=False``. - - :param int connect: - How many connection-related errors to retry on. - - These are errors raised before the request is sent to the remote server, - which we assume has not triggered the server to process the request. - - Set to ``0`` to fail on the first retry of this type. - - :param int read: - How many times to retry on read errors. - - These errors are raised after the request was sent to the server, so the - request may have side-effects. - - Set to ``0`` to fail on the first retry of this type. - - :param int redirect: - How many redirects to perform. Limit this to avoid infinite redirect - loops. - - A redirect is a HTTP response with a status code 301, 302, 303, 307 or - 308. - - Set to ``0`` to fail on the first retry of this type. - - Set to ``False`` to disable and imply ``raise_on_redirect=False``. - - :param int status: - How many times to retry on bad status codes. - - These are retries made on responses, where status code matches - ``status_forcelist``. - - Set to ``0`` to fail on the first retry of this type. - - :param int other: - How many times to retry on other errors. - - Other errors are errors that are not connect, read, redirect or status errors. - These errors might be raised after the request was sent to the server, so the - request might have side-effects. - - Set to ``0`` to fail on the first retry of this type. - - If ``total`` is not set, it's a good idea to set this to 0 to account - for unexpected edge cases and avoid infinite retry loops. - - :param Collection allowed_methods: - Set of uppercased HTTP method verbs that we should retry on. - - By default, we only retry on methods which are considered to be - idempotent (multiple requests with the same parameters end with the - same state). See :attr:`Retry.DEFAULT_ALLOWED_METHODS`. - - Set to a ``None`` value to retry on any verb. - - :param Collection status_forcelist: - A set of integer HTTP status codes that we should force a retry on. - A retry is initiated if the request method is in ``allowed_methods`` - and the response status code is in ``status_forcelist``. - - By default, this is disabled with ``None``. - - :param float backoff_factor: - A backoff factor to apply between attempts after the second try - (most errors are resolved immediately by a second try without a - delay). urllib3 will sleep for:: - - {backoff factor} * (2 ** ({number of previous retries})) - - seconds. If `backoff_jitter` is non-zero, this sleep is extended by:: - - random.uniform(0, {backoff jitter}) - - seconds. For example, if the backoff_factor is 0.1, then :func:`Retry.sleep` will - sleep for [0.0s, 0.2s, 0.4s, 0.8s, ...] between retries. No backoff will ever - be longer than `backoff_max`. - - By default, backoff is disabled (factor set to 0). - - :param bool raise_on_redirect: Whether, if the number of redirects is - exhausted, to raise a MaxRetryError, or to return a response with a - response code in the 3xx range. - - :param bool raise_on_status: Similar meaning to ``raise_on_redirect``: - whether we should raise an exception, or return a response, - if status falls in ``status_forcelist`` range and retries have - been exhausted. - - :param tuple history: The history of the request encountered during - each call to :meth:`~Retry.increment`. The list is in the order - the requests occurred. Each list item is of class :class:`RequestHistory`. - - :param bool respect_retry_after_header: - Whether to respect Retry-After header on status codes defined as - :attr:`Retry.RETRY_AFTER_STATUS_CODES` or not. - - :param Collection remove_headers_on_redirect: - Sequence of headers to remove from the request when a response - indicating a redirect is returned before firing off the redirected - request. - """ - - #: Default methods to be used for ``allowed_methods`` - DEFAULT_ALLOWED_METHODS = frozenset( - ["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"] - ) - - #: Default status codes to be used for ``status_forcelist`` - RETRY_AFTER_STATUS_CODES = frozenset([413, 429, 503]) - - #: Default headers to be used for ``remove_headers_on_redirect`` - DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(["Cookie", "Authorization"]) - - #: Default maximum backoff time. - DEFAULT_BACKOFF_MAX = 120 - - # Backward compatibility; assigned outside of the class. - DEFAULT: typing.ClassVar[Retry] - - def __init__( - self, - total: bool | int | None = 10, - connect: int | None = None, - read: int | None = None, - redirect: bool | int | None = None, - status: int | None = None, - other: int | None = None, - allowed_methods: typing.Collection[str] | None = DEFAULT_ALLOWED_METHODS, - status_forcelist: typing.Collection[int] | None = None, - backoff_factor: float = 0, - backoff_max: float = DEFAULT_BACKOFF_MAX, - raise_on_redirect: bool = True, - raise_on_status: bool = True, - history: tuple[RequestHistory, ...] | None = None, - respect_retry_after_header: bool = True, - remove_headers_on_redirect: typing.Collection[ - str - ] = DEFAULT_REMOVE_HEADERS_ON_REDIRECT, - backoff_jitter: float = 0.0, - ) -> None: - self.total = total - self.connect = connect - self.read = read - self.status = status - self.other = other - - if redirect is False or total is False: - redirect = 0 - raise_on_redirect = False - - self.redirect = redirect - self.status_forcelist = status_forcelist or set() - self.allowed_methods = allowed_methods - self.backoff_factor = backoff_factor - self.backoff_max = backoff_max - self.raise_on_redirect = raise_on_redirect - self.raise_on_status = raise_on_status - self.history = history or () - self.respect_retry_after_header = respect_retry_after_header - self.remove_headers_on_redirect = frozenset( - h.lower() for h in remove_headers_on_redirect - ) - self.backoff_jitter = backoff_jitter - - def new(self, **kw: typing.Any) -> Retry: - params = dict( - total=self.total, - connect=self.connect, - read=self.read, - redirect=self.redirect, - status=self.status, - other=self.other, - allowed_methods=self.allowed_methods, - status_forcelist=self.status_forcelist, - backoff_factor=self.backoff_factor, - backoff_max=self.backoff_max, - raise_on_redirect=self.raise_on_redirect, - raise_on_status=self.raise_on_status, - history=self.history, - remove_headers_on_redirect=self.remove_headers_on_redirect, - respect_retry_after_header=self.respect_retry_after_header, - backoff_jitter=self.backoff_jitter, - ) - - params.update(kw) - return type(self)(**params) # type: ignore[arg-type] - - @classmethod - def from_int( - cls, - retries: Retry | bool | int | None, - redirect: bool | int | None = True, - default: Retry | bool | int | None = None, - ) -> Retry: - """Backwards-compatibility for the old retries format.""" - if retries is None: - retries = default if default is not None else cls.DEFAULT - - if isinstance(retries, Retry): - return retries - - redirect = bool(redirect) and None - new_retries = cls(retries, redirect=redirect) - log.debug("Converted retries value: %r -> %r", retries, new_retries) - return new_retries - - def get_backoff_time(self) -> float: - """Formula for computing the current backoff - - :rtype: float - """ - # We want to consider only the last consecutive errors sequence (Ignore redirects). - consecutive_errors_len = len( - list( - takewhile(lambda x: x.redirect_location is None, reversed(self.history)) - ) - ) - if consecutive_errors_len <= 1: - return 0 - - backoff_value = self.backoff_factor * (2 ** (consecutive_errors_len - 1)) - if self.backoff_jitter != 0.0: - backoff_value += random.random() * self.backoff_jitter - return float(max(0, min(self.backoff_max, backoff_value))) - - def parse_retry_after(self, retry_after: str) -> float: - seconds: float - # Whitespace: https://tools.ietf.org/html/rfc7230#section-3.2.4 - if re.match(r"^\s*[0-9]+\s*$", retry_after): - seconds = int(retry_after) - else: - retry_date_tuple = email.utils.parsedate_tz(retry_after) - if retry_date_tuple is None: - raise InvalidHeader(f"Invalid Retry-After header: {retry_after}") - - retry_date = email.utils.mktime_tz(retry_date_tuple) - seconds = retry_date - time.time() - - seconds = max(seconds, 0) - - return seconds - - def get_retry_after(self, response: BaseHTTPResponse) -> float | None: - """Get the value of Retry-After in seconds.""" - - retry_after = response.headers.get("Retry-After") - - if retry_after is None: - return None - - return self.parse_retry_after(retry_after) - - def sleep_for_retry(self, response: BaseHTTPResponse) -> bool: - retry_after = self.get_retry_after(response) - if retry_after: - time.sleep(retry_after) - return True - - return False - - def _sleep_backoff(self) -> None: - backoff = self.get_backoff_time() - if backoff <= 0: - return - time.sleep(backoff) - - def sleep(self, response: BaseHTTPResponse | None = None) -> None: - """Sleep between retry attempts. - - This method will respect a server's ``Retry-After`` response header - and sleep the duration of the time requested. If that is not present, it - will use an exponential backoff. By default, the backoff factor is 0 and - this method will return immediately. - """ - - if self.respect_retry_after_header and response: - slept = self.sleep_for_retry(response) - if slept: - return - - self._sleep_backoff() - - def _is_connection_error(self, err: Exception) -> bool: - """Errors when we're fairly sure that the server did not receive the - request, so it should be safe to retry. - """ - if isinstance(err, ProxyError): - err = err.original_error - return isinstance(err, ConnectTimeoutError) - - def _is_read_error(self, err: Exception) -> bool: - """Errors that occur after the request has been started, so we should - assume that the server began processing it. - """ - return isinstance(err, (ReadTimeoutError, ProtocolError)) - - def _is_method_retryable(self, method: str) -> bool: - """Checks if a given HTTP method should be retried upon, depending if - it is included in the allowed_methods - """ - if self.allowed_methods and method.upper() not in self.allowed_methods: - return False - return True - - def is_retry( - self, method: str, status_code: int, has_retry_after: bool = False - ) -> bool: - """Is this method/status code retryable? (Based on allowlists and control - variables such as the number of total retries to allow, whether to - respect the Retry-After header, whether this header is present, and - whether the returned status code is on the list of status codes to - be retried upon on the presence of the aforementioned header) - """ - if not self._is_method_retryable(method): - return False - - if self.status_forcelist and status_code in self.status_forcelist: - return True - - return bool( - self.total - and self.respect_retry_after_header - and has_retry_after - and (status_code in self.RETRY_AFTER_STATUS_CODES) - ) - - def is_exhausted(self) -> bool: - """Are we out of retries?""" - retry_counts = [ - x - for x in ( - self.total, - self.connect, - self.read, - self.redirect, - self.status, - self.other, - ) - if x - ] - if not retry_counts: - return False - - return min(retry_counts) < 0 - - def increment( - self, - method: str | None = None, - url: str | None = None, - response: BaseHTTPResponse | None = None, - error: Exception | None = None, - _pool: ConnectionPool | None = None, - _stacktrace: TracebackType | None = None, - ) -> Retry: - """Return a new Retry object with incremented retry counters. - - :param response: A response object, or None, if the server did not - return a response. - :type response: :class:`~urllib3.response.BaseHTTPResponse` - :param Exception error: An error encountered during the request, or - None if the response was received successfully. - - :return: A new ``Retry`` object. - """ - if self.total is False and error: - # Disabled, indicate to re-raise the error. - raise reraise(type(error), error, _stacktrace) - - total = self.total - if total is not None: - total -= 1 - - connect = self.connect - read = self.read - redirect = self.redirect - status_count = self.status - other = self.other - cause = "unknown" - status = None - redirect_location = None - - if error and self._is_connection_error(error): - # Connect retry? - if connect is False: - raise reraise(type(error), error, _stacktrace) - elif connect is not None: - connect -= 1 - - elif error and self._is_read_error(error): - # Read retry? - if read is False or method is None or not self._is_method_retryable(method): - raise reraise(type(error), error, _stacktrace) - elif read is not None: - read -= 1 - - elif error: - # Other retry? - if other is not None: - other -= 1 - - elif response and response.get_redirect_location(): - # Redirect retry? - if redirect is not None: - redirect -= 1 - cause = "too many redirects" - response_redirect_location = response.get_redirect_location() - if response_redirect_location: - redirect_location = response_redirect_location - status = response.status - - else: - # Incrementing because of a server error like a 500 in - # status_forcelist and the given method is in the allowed_methods - cause = ResponseError.GENERIC_ERROR - if response and response.status: - if status_count is not None: - status_count -= 1 - cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) - status = response.status - - history = self.history + ( - RequestHistory(method, url, error, status, redirect_location), - ) - - new_retry = self.new( - total=total, - connect=connect, - read=read, - redirect=redirect, - status=status_count, - other=other, - history=history, - ) - - if new_retry.is_exhausted(): - reason = error or ResponseError(cause) - raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] - - log.debug("Incremented Retry for (url='%s'): %r", url, new_retry) - - return new_retry - - def __repr__(self) -> str: - return ( - f"{type(self).__name__}(total={self.total}, connect={self.connect}, " - f"read={self.read}, redirect={self.redirect}, status={self.status})" - ) - - -# For backwards compatibility (equivalent to pre-v1.9): -Retry.DEFAULT = Retry(3) diff --git a/venv/lib/python3.8/site-packages/urllib3/util/ssl_.py b/venv/lib/python3.8/site-packages/urllib3/util/ssl_.py deleted file mode 100644 index 7762803267f45231bd7b04aebbab51775847ae57..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/ssl_.py +++ /dev/null @@ -1,513 +0,0 @@ -from __future__ import annotations - -import hmac -import os -import socket -import sys -import typing -import warnings -from binascii import unhexlify -from hashlib import md5, sha1, sha256 - -from ..exceptions import ProxySchemeUnsupported, SSLError -from .url import _BRACELESS_IPV6_ADDRZ_RE, _IPV4_RE - -SSLContext = None -SSLTransport = None -HAS_NEVER_CHECK_COMMON_NAME = False -IS_PYOPENSSL = False -IS_SECURETRANSPORT = False -ALPN_PROTOCOLS = ["http/1.1"] - -_TYPE_VERSION_INFO = typing.Tuple[int, int, int, str, int] - -# Maps the length of a digest to a possible hash function producing this digest -HASHFUNC_MAP = {32: md5, 40: sha1, 64: sha256} - - -def _is_bpo_43522_fixed( - implementation_name: str, - version_info: _TYPE_VERSION_INFO, - pypy_version_info: _TYPE_VERSION_INFO | None, -) -> bool: - """Return True for CPython 3.8.9+, 3.9.3+ or 3.10+ and PyPy 7.3.8+ where - setting SSLContext.hostname_checks_common_name to False works. - - Outside of CPython and PyPy we don't know which implementations work - or not so we conservatively use our hostname matching as we know that works - on all implementations. - - https://github.com/urllib3/urllib3/issues/2192#issuecomment-821832963 - https://foss.heptapod.net/pypy/pypy/-/issues/3539 - """ - if implementation_name == "pypy": - # https://foss.heptapod.net/pypy/pypy/-/issues/3129 - return pypy_version_info >= (7, 3, 8) and version_info >= (3, 8) # type: ignore[operator] - elif implementation_name == "cpython": - major_minor = version_info[:2] - micro = version_info[2] - return ( - (major_minor == (3, 8) and micro >= 9) - or (major_minor == (3, 9) and micro >= 3) - or major_minor >= (3, 10) - ) - else: # Defensive: - return False - - -def _is_has_never_check_common_name_reliable( - openssl_version: str, - openssl_version_number: int, - implementation_name: str, - version_info: _TYPE_VERSION_INFO, - pypy_version_info: _TYPE_VERSION_INFO | None, -) -> bool: - # As of May 2023, all released versions of LibreSSL fail to reject certificates with - # only common names, see https://github.com/urllib3/urllib3/pull/3024 - is_openssl = openssl_version.startswith("OpenSSL ") - # Before fixing OpenSSL issue #14579, the SSL_new() API was not copying hostflags - # like X509_CHECK_FLAG_NEVER_CHECK_SUBJECT, which tripped up CPython. - # https://github.com/openssl/openssl/issues/14579 - # This was released in OpenSSL 1.1.1l+ (>=0x101010cf) - is_openssl_issue_14579_fixed = openssl_version_number >= 0x101010CF - - return is_openssl and ( - is_openssl_issue_14579_fixed - or _is_bpo_43522_fixed(implementation_name, version_info, pypy_version_info) - ) - - -if typing.TYPE_CHECKING: - from ssl import VerifyMode - - from typing_extensions import Literal, TypedDict - - from .ssltransport import SSLTransport as SSLTransportType - - class _TYPE_PEER_CERT_RET_DICT(TypedDict, total=False): - subjectAltName: tuple[tuple[str, str], ...] - subject: tuple[tuple[tuple[str, str], ...], ...] - serialNumber: str - - -# Mapping from 'ssl.PROTOCOL_TLSX' to 'TLSVersion.X' -_SSL_VERSION_TO_TLS_VERSION: dict[int, int] = {} - -try: # Do we have ssl at all? - import ssl - from ssl import ( # type: ignore[assignment] - CERT_REQUIRED, - HAS_NEVER_CHECK_COMMON_NAME, - OP_NO_COMPRESSION, - OP_NO_TICKET, - OPENSSL_VERSION, - OPENSSL_VERSION_NUMBER, - PROTOCOL_TLS, - PROTOCOL_TLS_CLIENT, - OP_NO_SSLv2, - OP_NO_SSLv3, - SSLContext, - TLSVersion, - ) - - PROTOCOL_SSLv23 = PROTOCOL_TLS - - # Setting SSLContext.hostname_checks_common_name = False didn't work before CPython - # 3.8.9, 3.9.3, and 3.10 (but OK on PyPy) or OpenSSL 1.1.1l+ - if HAS_NEVER_CHECK_COMMON_NAME and not _is_has_never_check_common_name_reliable( - OPENSSL_VERSION, - OPENSSL_VERSION_NUMBER, - sys.implementation.name, - sys.version_info, - sys.pypy_version_info if sys.implementation.name == "pypy" else None, # type: ignore[attr-defined] - ): - HAS_NEVER_CHECK_COMMON_NAME = False - - # Need to be careful here in case old TLS versions get - # removed in future 'ssl' module implementations. - for attr in ("TLSv1", "TLSv1_1", "TLSv1_2"): - try: - _SSL_VERSION_TO_TLS_VERSION[getattr(ssl, f"PROTOCOL_{attr}")] = getattr( - TLSVersion, attr - ) - except AttributeError: # Defensive: - continue - - from .ssltransport import SSLTransport # type: ignore[assignment] -except ImportError: - OP_NO_COMPRESSION = 0x20000 # type: ignore[assignment] - OP_NO_TICKET = 0x4000 # type: ignore[assignment] - OP_NO_SSLv2 = 0x1000000 # type: ignore[assignment] - OP_NO_SSLv3 = 0x2000000 # type: ignore[assignment] - PROTOCOL_SSLv23 = PROTOCOL_TLS = 2 # type: ignore[assignment] - PROTOCOL_TLS_CLIENT = 16 # type: ignore[assignment] - - -_TYPE_PEER_CERT_RET = typing.Union["_TYPE_PEER_CERT_RET_DICT", bytes, None] - - -def assert_fingerprint(cert: bytes | None, fingerprint: str) -> None: - """ - Checks if given fingerprint matches the supplied certificate. - - :param cert: - Certificate as bytes object. - :param fingerprint: - Fingerprint as string of hexdigits, can be interspersed by colons. - """ - - if cert is None: - raise SSLError("No certificate for the peer.") - - fingerprint = fingerprint.replace(":", "").lower() - digest_length = len(fingerprint) - hashfunc = HASHFUNC_MAP.get(digest_length) - if not hashfunc: - raise SSLError(f"Fingerprint of invalid length: {fingerprint}") - - # We need encode() here for py32; works on py2 and p33. - fingerprint_bytes = unhexlify(fingerprint.encode()) - - cert_digest = hashfunc(cert).digest() - - if not hmac.compare_digest(cert_digest, fingerprint_bytes): - raise SSLError( - f'Fingerprints did not match. Expected "{fingerprint}", got "{cert_digest.hex()}"' - ) - - -def resolve_cert_reqs(candidate: None | int | str) -> VerifyMode: - """ - Resolves the argument to a numeric constant, which can be passed to - the wrap_socket function/method from the ssl module. - Defaults to :data:`ssl.CERT_REQUIRED`. - If given a string it is assumed to be the name of the constant in the - :mod:`ssl` module or its abbreviation. - (So you can specify `REQUIRED` instead of `CERT_REQUIRED`. - If it's neither `None` nor a string we assume it is already the numeric - constant which can directly be passed to wrap_socket. - """ - if candidate is None: - return CERT_REQUIRED - - if isinstance(candidate, str): - res = getattr(ssl, candidate, None) - if res is None: - res = getattr(ssl, "CERT_" + candidate) - return res # type: ignore[no-any-return] - - return candidate # type: ignore[return-value] - - -def resolve_ssl_version(candidate: None | int | str) -> int: - """ - like resolve_cert_reqs - """ - if candidate is None: - return PROTOCOL_TLS - - if isinstance(candidate, str): - res = getattr(ssl, candidate, None) - if res is None: - res = getattr(ssl, "PROTOCOL_" + candidate) - return typing.cast(int, res) - - return candidate - - -def create_urllib3_context( - ssl_version: int | None = None, - cert_reqs: int | None = None, - options: int | None = None, - ciphers: str | None = None, - ssl_minimum_version: int | None = None, - ssl_maximum_version: int | None = None, -) -> ssl.SSLContext: - """Creates and configures an :class:`ssl.SSLContext` instance for use with urllib3. - - :param ssl_version: - The desired protocol version to use. This will default to - PROTOCOL_SSLv23 which will negotiate the highest protocol that both - the server and your installation of OpenSSL support. - - This parameter is deprecated instead use 'ssl_minimum_version'. - :param ssl_minimum_version: - The minimum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value. - :param ssl_maximum_version: - The maximum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value. - Not recommended to set to anything other than 'ssl.TLSVersion.MAXIMUM_SUPPORTED' which is the - default value. - :param cert_reqs: - Whether to require the certificate verification. This defaults to - ``ssl.CERT_REQUIRED``. - :param options: - Specific OpenSSL options. These default to ``ssl.OP_NO_SSLv2``, - ``ssl.OP_NO_SSLv3``, ``ssl.OP_NO_COMPRESSION``, and ``ssl.OP_NO_TICKET``. - :param ciphers: - Which cipher suites to allow the server to select. Defaults to either system configured - ciphers if OpenSSL 1.1.1+, otherwise uses a secure default set of ciphers. - :returns: - Constructed SSLContext object with specified options - :rtype: SSLContext - """ - if SSLContext is None: - raise TypeError("Can't create an SSLContext object without an ssl module") - - # This means 'ssl_version' was specified as an exact value. - if ssl_version not in (None, PROTOCOL_TLS, PROTOCOL_TLS_CLIENT): - # Disallow setting 'ssl_version' and 'ssl_minimum|maximum_version' - # to avoid conflicts. - if ssl_minimum_version is not None or ssl_maximum_version is not None: - raise ValueError( - "Can't specify both 'ssl_version' and either " - "'ssl_minimum_version' or 'ssl_maximum_version'" - ) - - # 'ssl_version' is deprecated and will be removed in the future. - else: - # Use 'ssl_minimum_version' and 'ssl_maximum_version' instead. - ssl_minimum_version = _SSL_VERSION_TO_TLS_VERSION.get( - ssl_version, TLSVersion.MINIMUM_SUPPORTED - ) - ssl_maximum_version = _SSL_VERSION_TO_TLS_VERSION.get( - ssl_version, TLSVersion.MAXIMUM_SUPPORTED - ) - - # This warning message is pushing users to use 'ssl_minimum_version' - # instead of both min/max. Best practice is to only set the minimum version and - # keep the maximum version to be it's default value: 'TLSVersion.MAXIMUM_SUPPORTED' - warnings.warn( - "'ssl_version' option is deprecated and will be " - "removed in urllib3 v2.1.0. Instead use 'ssl_minimum_version'", - category=DeprecationWarning, - stacklevel=2, - ) - - # PROTOCOL_TLS is deprecated in Python 3.10 so we always use PROTOCOL_TLS_CLIENT - context = SSLContext(PROTOCOL_TLS_CLIENT) - - if ssl_minimum_version is not None: - context.minimum_version = ssl_minimum_version - else: # Python <3.10 defaults to 'MINIMUM_SUPPORTED' so explicitly set TLSv1.2 here - context.minimum_version = TLSVersion.TLSv1_2 - - if ssl_maximum_version is not None: - context.maximum_version = ssl_maximum_version - - # Unless we're given ciphers defer to either system ciphers in - # the case of OpenSSL 1.1.1+ or use our own secure default ciphers. - if ciphers: - context.set_ciphers(ciphers) - - # Setting the default here, as we may have no ssl module on import - cert_reqs = ssl.CERT_REQUIRED if cert_reqs is None else cert_reqs - - if options is None: - options = 0 - # SSLv2 is easily broken and is considered harmful and dangerous - options |= OP_NO_SSLv2 - # SSLv3 has several problems and is now dangerous - options |= OP_NO_SSLv3 - # Disable compression to prevent CRIME attacks for OpenSSL 1.0+ - # (issue #309) - options |= OP_NO_COMPRESSION - # TLSv1.2 only. Unless set explicitly, do not request tickets. - # This may save some bandwidth on wire, and although the ticket is encrypted, - # there is a risk associated with it being on wire, - # if the server is not rotating its ticketing keys properly. - options |= OP_NO_TICKET - - context.options |= options - - # Enable post-handshake authentication for TLS 1.3, see GH #1634. PHA is - # necessary for conditional client cert authentication with TLS 1.3. - # The attribute is None for OpenSSL <= 1.1.0 or does not exist in older - # versions of Python. We only enable on Python 3.7.4+ or if certificate - # verification is enabled to work around Python issue #37428 - # See: https://bugs.python.org/issue37428 - if (cert_reqs == ssl.CERT_REQUIRED or sys.version_info >= (3, 7, 4)) and getattr( - context, "post_handshake_auth", None - ) is not None: - context.post_handshake_auth = True - - # The order of the below lines setting verify_mode and check_hostname - # matter due to safe-guards SSLContext has to prevent an SSLContext with - # check_hostname=True, verify_mode=NONE/OPTIONAL. - # We always set 'check_hostname=False' for pyOpenSSL so we rely on our own - # 'ssl.match_hostname()' implementation. - if cert_reqs == ssl.CERT_REQUIRED and not IS_PYOPENSSL: - context.verify_mode = cert_reqs - context.check_hostname = True - else: - context.check_hostname = False - context.verify_mode = cert_reqs - - try: - context.hostname_checks_common_name = False - except AttributeError: # Defensive: for CPython < 3.8.9 and 3.9.3; for PyPy < 7.3.8 - pass - - # Enable logging of TLS session keys via defacto standard environment variable - # 'SSLKEYLOGFILE', if the feature is available (Python 3.8+). Skip empty values. - if hasattr(context, "keylog_filename"): - sslkeylogfile = os.environ.get("SSLKEYLOGFILE") - if sslkeylogfile: - context.keylog_filename = sslkeylogfile - - return context - - -@typing.overload -def ssl_wrap_socket( - sock: socket.socket, - keyfile: str | None = ..., - certfile: str | None = ..., - cert_reqs: int | None = ..., - ca_certs: str | None = ..., - server_hostname: str | None = ..., - ssl_version: int | None = ..., - ciphers: str | None = ..., - ssl_context: ssl.SSLContext | None = ..., - ca_cert_dir: str | None = ..., - key_password: str | None = ..., - ca_cert_data: None | str | bytes = ..., - tls_in_tls: Literal[False] = ..., -) -> ssl.SSLSocket: - ... - - -@typing.overload -def ssl_wrap_socket( - sock: socket.socket, - keyfile: str | None = ..., - certfile: str | None = ..., - cert_reqs: int | None = ..., - ca_certs: str | None = ..., - server_hostname: str | None = ..., - ssl_version: int | None = ..., - ciphers: str | None = ..., - ssl_context: ssl.SSLContext | None = ..., - ca_cert_dir: str | None = ..., - key_password: str | None = ..., - ca_cert_data: None | str | bytes = ..., - tls_in_tls: bool = ..., -) -> ssl.SSLSocket | SSLTransportType: - ... - - -def ssl_wrap_socket( - sock: socket.socket, - keyfile: str | None = None, - certfile: str | None = None, - cert_reqs: int | None = None, - ca_certs: str | None = None, - server_hostname: str | None = None, - ssl_version: int | None = None, - ciphers: str | None = None, - ssl_context: ssl.SSLContext | None = None, - ca_cert_dir: str | None = None, - key_password: str | None = None, - ca_cert_data: None | str | bytes = None, - tls_in_tls: bool = False, -) -> ssl.SSLSocket | SSLTransportType: - """ - All arguments except for server_hostname, ssl_context, and ca_cert_dir have - the same meaning as they do when using :func:`ssl.wrap_socket`. - - :param server_hostname: - When SNI is supported, the expected hostname of the certificate - :param ssl_context: - A pre-made :class:`SSLContext` object. If none is provided, one will - be created using :func:`create_urllib3_context`. - :param ciphers: - A string of ciphers we wish the client to support. - :param ca_cert_dir: - A directory containing CA certificates in multiple separate files, as - supported by OpenSSL's -CApath flag or the capath argument to - SSLContext.load_verify_locations(). - :param key_password: - Optional password if the keyfile is encrypted. - :param ca_cert_data: - Optional string containing CA certificates in PEM format suitable for - passing as the cadata parameter to SSLContext.load_verify_locations() - :param tls_in_tls: - Use SSLTransport to wrap the existing socket. - """ - context = ssl_context - if context is None: - # Note: This branch of code and all the variables in it are only used in tests. - # We should consider deprecating and removing this code. - context = create_urllib3_context(ssl_version, cert_reqs, ciphers=ciphers) - - if ca_certs or ca_cert_dir or ca_cert_data: - try: - context.load_verify_locations(ca_certs, ca_cert_dir, ca_cert_data) - except OSError as e: - raise SSLError(e) from e - - elif ssl_context is None and hasattr(context, "load_default_certs"): - # try to load OS default certs; works well on Windows. - context.load_default_certs() - - # Attempt to detect if we get the goofy behavior of the - # keyfile being encrypted and OpenSSL asking for the - # passphrase via the terminal and instead error out. - if keyfile and key_password is None and _is_key_file_encrypted(keyfile): - raise SSLError("Client private key is encrypted, password is required") - - if certfile: - if key_password is None: - context.load_cert_chain(certfile, keyfile) - else: - context.load_cert_chain(certfile, keyfile, key_password) - - try: - context.set_alpn_protocols(ALPN_PROTOCOLS) - except NotImplementedError: # Defensive: in CI, we always have set_alpn_protocols - pass - - ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) - return ssl_sock - - -def is_ipaddress(hostname: str | bytes) -> bool: - """Detects whether the hostname given is an IPv4 or IPv6 address. - Also detects IPv6 addresses with Zone IDs. - - :param str hostname: Hostname to examine. - :return: True if the hostname is an IP address, False otherwise. - """ - if isinstance(hostname, bytes): - # IDN A-label bytes are ASCII compatible. - hostname = hostname.decode("ascii") - return bool(_IPV4_RE.match(hostname) or _BRACELESS_IPV6_ADDRZ_RE.match(hostname)) - - -def _is_key_file_encrypted(key_file: str) -> bool: - """Detects if a key file is encrypted or not.""" - with open(key_file) as f: - for line in f: - # Look for Proc-Type: 4,ENCRYPTED - if "ENCRYPTED" in line: - return True - - return False - - -def _ssl_wrap_socket_impl( - sock: socket.socket, - ssl_context: ssl.SSLContext, - tls_in_tls: bool, - server_hostname: str | None = None, -) -> ssl.SSLSocket | SSLTransportType: - if tls_in_tls: - if not SSLTransport: - # Import error, ssl is not available. - raise ProxySchemeUnsupported( - "TLS in TLS requires support for the 'ssl' module" - ) - - SSLTransport._validate_ssl_context_for_tls_in_tls(ssl_context) - return SSLTransport(sock, ssl_context, server_hostname) - - return ssl_context.wrap_socket(sock, server_hostname=server_hostname) diff --git a/venv/lib/python3.8/site-packages/urllib3/util/ssl_match_hostname.py b/venv/lib/python3.8/site-packages/urllib3/util/ssl_match_hostname.py deleted file mode 100644 index 453cfd420d835be58b5af581c3065e7b37079ecf..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/ssl_match_hostname.py +++ /dev/null @@ -1,159 +0,0 @@ -"""The match_hostname() function from Python 3.5, essential when using SSL.""" - -# Note: This file is under the PSF license as the code comes from the python -# stdlib. http://docs.python.org/3/license.html -# It is modified to remove commonName support. - -from __future__ import annotations - -import ipaddress -import re -import typing -from ipaddress import IPv4Address, IPv6Address - -if typing.TYPE_CHECKING: - from .ssl_ import _TYPE_PEER_CERT_RET_DICT - -__version__ = "3.5.0.1" - - -class CertificateError(ValueError): - pass - - -def _dnsname_match( - dn: typing.Any, hostname: str, max_wildcards: int = 1 -) -> typing.Match[str] | None | bool: - """Matching according to RFC 6125, section 6.4.3 - - http://tools.ietf.org/html/rfc6125#section-6.4.3 - """ - pats = [] - if not dn: - return False - - # Ported from python3-syntax: - # leftmost, *remainder = dn.split(r'.') - parts = dn.split(r".") - leftmost = parts[0] - remainder = parts[1:] - - wildcards = leftmost.count("*") - if wildcards > max_wildcards: - # Issue #17980: avoid denials of service by refusing more - # than one wildcard per fragment. A survey of established - # policy among SSL implementations showed it to be a - # reasonable choice. - raise CertificateError( - "too many wildcards in certificate DNS name: " + repr(dn) - ) - - # speed up common case w/o wildcards - if not wildcards: - return bool(dn.lower() == hostname.lower()) - - # RFC 6125, section 6.4.3, subitem 1. - # The client SHOULD NOT attempt to match a presented identifier in which - # the wildcard character comprises a label other than the left-most label. - if leftmost == "*": - # When '*' is a fragment by itself, it matches a non-empty dotless - # fragment. - pats.append("[^.]+") - elif leftmost.startswith("xn--") or hostname.startswith("xn--"): - # RFC 6125, section 6.4.3, subitem 3. - # The client SHOULD NOT attempt to match a presented identifier - # where the wildcard character is embedded within an A-label or - # U-label of an internationalized domain name. - pats.append(re.escape(leftmost)) - else: - # Otherwise, '*' matches any dotless string, e.g. www* - pats.append(re.escape(leftmost).replace(r"\*", "[^.]*")) - - # add the remaining fragments, ignore any wildcards - for frag in remainder: - pats.append(re.escape(frag)) - - pat = re.compile(r"\A" + r"\.".join(pats) + r"\Z", re.IGNORECASE) - return pat.match(hostname) - - -def _ipaddress_match(ipname: str, host_ip: IPv4Address | IPv6Address) -> bool: - """Exact matching of IP addresses. - - RFC 9110 section 4.3.5: "A reference identity of IP-ID contains the decoded - bytes of the IP address. An IP version 4 address is 4 octets, and an IP - version 6 address is 16 octets. [...] A reference identity of type IP-ID - matches if the address is identical to an iPAddress value of the - subjectAltName extension of the certificate." - """ - # OpenSSL may add a trailing newline to a subjectAltName's IP address - # Divergence from upstream: ipaddress can't handle byte str - ip = ipaddress.ip_address(ipname.rstrip()) - return bool(ip.packed == host_ip.packed) - - -def match_hostname( - cert: _TYPE_PEER_CERT_RET_DICT | None, - hostname: str, - hostname_checks_common_name: bool = False, -) -> None: - """Verify that *cert* (in decoded format as returned by - SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 - rules are followed, but IP addresses are not accepted for *hostname*. - - CertificateError is raised on failure. On success, the function - returns nothing. - """ - if not cert: - raise ValueError( - "empty or no certificate, match_hostname needs a " - "SSL socket or SSL context with either " - "CERT_OPTIONAL or CERT_REQUIRED" - ) - try: - # Divergence from upstream: ipaddress can't handle byte str - # - # The ipaddress module shipped with Python < 3.9 does not support - # scoped IPv6 addresses so we unconditionally strip the Zone IDs for - # now. Once we drop support for Python 3.9 we can remove this branch. - if "%" in hostname: - host_ip = ipaddress.ip_address(hostname[: hostname.rfind("%")]) - else: - host_ip = ipaddress.ip_address(hostname) - - except ValueError: - # Not an IP address (common case) - host_ip = None - dnsnames = [] - san: tuple[tuple[str, str], ...] = cert.get("subjectAltName", ()) - key: str - value: str - for key, value in san: - if key == "DNS": - if host_ip is None and _dnsname_match(value, hostname): - return - dnsnames.append(value) - elif key == "IP Address": - if host_ip is not None and _ipaddress_match(value, host_ip): - return - dnsnames.append(value) - - # We only check 'commonName' if it's enabled and we're not verifying - # an IP address. IP addresses aren't valid within 'commonName'. - if hostname_checks_common_name and host_ip is None and not dnsnames: - for sub in cert.get("subject", ()): - for key, value in sub: - if key == "commonName": - if _dnsname_match(value, hostname): - return - dnsnames.append(value) - - if len(dnsnames) > 1: - raise CertificateError( - "hostname %r " - "doesn't match either of %s" % (hostname, ", ".join(map(repr, dnsnames))) - ) - elif len(dnsnames) == 1: - raise CertificateError(f"hostname {hostname!r} doesn't match {dnsnames[0]!r}") - else: - raise CertificateError("no appropriate subjectAltName fields were found") diff --git a/venv/lib/python3.8/site-packages/urllib3/util/ssltransport.py b/venv/lib/python3.8/site-packages/urllib3/util/ssltransport.py deleted file mode 100644 index 5ec86473b47b0d07ee6dc9eab4e02abaf6dc7ee1..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/ssltransport.py +++ /dev/null @@ -1,280 +0,0 @@ -from __future__ import annotations - -import io -import socket -import ssl -import typing - -from ..exceptions import ProxySchemeUnsupported - -if typing.TYPE_CHECKING: - from typing_extensions import Literal - - from .ssl_ import _TYPE_PEER_CERT_RET, _TYPE_PEER_CERT_RET_DICT - - -_SelfT = typing.TypeVar("_SelfT", bound="SSLTransport") -_WriteBuffer = typing.Union[bytearray, memoryview] -_ReturnValue = typing.TypeVar("_ReturnValue") - -SSL_BLOCKSIZE = 16384 - - -class SSLTransport: - """ - The SSLTransport wraps an existing socket and establishes an SSL connection. - - Contrary to Python's implementation of SSLSocket, it allows you to chain - multiple TLS connections together. It's particularly useful if you need to - implement TLS within TLS. - - The class supports most of the socket API operations. - """ - - @staticmethod - def _validate_ssl_context_for_tls_in_tls(ssl_context: ssl.SSLContext) -> None: - """ - Raises a ProxySchemeUnsupported if the provided ssl_context can't be used - for TLS in TLS. - - The only requirement is that the ssl_context provides the 'wrap_bio' - methods. - """ - - if not hasattr(ssl_context, "wrap_bio"): - raise ProxySchemeUnsupported( - "TLS in TLS requires SSLContext.wrap_bio() which isn't " - "available on non-native SSLContext" - ) - - def __init__( - self, - socket: socket.socket, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - suppress_ragged_eofs: bool = True, - ) -> None: - """ - Create an SSLTransport around socket using the provided ssl_context. - """ - self.incoming = ssl.MemoryBIO() - self.outgoing = ssl.MemoryBIO() - - self.suppress_ragged_eofs = suppress_ragged_eofs - self.socket = socket - - self.sslobj = ssl_context.wrap_bio( - self.incoming, self.outgoing, server_hostname=server_hostname - ) - - # Perform initial handshake. - self._ssl_io_loop(self.sslobj.do_handshake) - - def __enter__(self: _SelfT) -> _SelfT: - return self - - def __exit__(self, *_: typing.Any) -> None: - self.close() - - def fileno(self) -> int: - return self.socket.fileno() - - def read(self, len: int = 1024, buffer: typing.Any | None = None) -> int | bytes: - return self._wrap_ssl_read(len, buffer) - - def recv(self, buflen: int = 1024, flags: int = 0) -> int | bytes: - if flags != 0: - raise ValueError("non-zero flags not allowed in calls to recv") - return self._wrap_ssl_read(buflen) - - def recv_into( - self, - buffer: _WriteBuffer, - nbytes: int | None = None, - flags: int = 0, - ) -> None | int | bytes: - if flags != 0: - raise ValueError("non-zero flags not allowed in calls to recv_into") - if nbytes is None: - nbytes = len(buffer) - return self.read(nbytes, buffer) - - def sendall(self, data: bytes, flags: int = 0) -> None: - if flags != 0: - raise ValueError("non-zero flags not allowed in calls to sendall") - count = 0 - with memoryview(data) as view, view.cast("B") as byte_view: - amount = len(byte_view) - while count < amount: - v = self.send(byte_view[count:]) - count += v - - def send(self, data: bytes, flags: int = 0) -> int: - if flags != 0: - raise ValueError("non-zero flags not allowed in calls to send") - return self._ssl_io_loop(self.sslobj.write, data) - - def makefile( - self, - mode: str, - buffering: int | None = None, - *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> typing.BinaryIO | typing.TextIO | socket.SocketIO: - """ - Python's httpclient uses makefile and buffered io when reading HTTP - messages and we need to support it. - - This is unfortunately a copy and paste of socket.py makefile with small - changes to point to the socket directly. - """ - if not set(mode) <= {"r", "w", "b"}: - raise ValueError(f"invalid mode {mode!r} (only r, w, b allowed)") - - writing = "w" in mode - reading = "r" in mode or not writing - assert reading or writing - binary = "b" in mode - rawmode = "" - if reading: - rawmode += "r" - if writing: - rawmode += "w" - raw = socket.SocketIO(self, rawmode) # type: ignore[arg-type] - self.socket._io_refs += 1 # type: ignore[attr-defined] - if buffering is None: - buffering = -1 - if buffering < 0: - buffering = io.DEFAULT_BUFFER_SIZE - if buffering == 0: - if not binary: - raise ValueError("unbuffered streams must be binary") - return raw - buffer: typing.BinaryIO - if reading and writing: - buffer = io.BufferedRWPair(raw, raw, buffering) # type: ignore[assignment] - elif reading: - buffer = io.BufferedReader(raw, buffering) - else: - assert writing - buffer = io.BufferedWriter(raw, buffering) - if binary: - return buffer - text = io.TextIOWrapper(buffer, encoding, errors, newline) - text.mode = mode # type: ignore[misc] - return text - - def unwrap(self) -> None: - self._ssl_io_loop(self.sslobj.unwrap) - - def close(self) -> None: - self.socket.close() - - @typing.overload - def getpeercert( - self, binary_form: Literal[False] = ... - ) -> _TYPE_PEER_CERT_RET_DICT | None: - ... - - @typing.overload - def getpeercert(self, binary_form: Literal[True]) -> bytes | None: - ... - - def getpeercert(self, binary_form: bool = False) -> _TYPE_PEER_CERT_RET: - return self.sslobj.getpeercert(binary_form) # type: ignore[return-value] - - def version(self) -> str | None: - return self.sslobj.version() - - def cipher(self) -> tuple[str, str, int] | None: - return self.sslobj.cipher() - - def selected_alpn_protocol(self) -> str | None: - return self.sslobj.selected_alpn_protocol() - - def selected_npn_protocol(self) -> str | None: - return self.sslobj.selected_npn_protocol() - - def shared_ciphers(self) -> list[tuple[str, str, int]] | None: - return self.sslobj.shared_ciphers() - - def compression(self) -> str | None: - return self.sslobj.compression() - - def settimeout(self, value: float | None) -> None: - self.socket.settimeout(value) - - def gettimeout(self) -> float | None: - return self.socket.gettimeout() - - def _decref_socketios(self) -> None: - self.socket._decref_socketios() # type: ignore[attr-defined] - - def _wrap_ssl_read(self, len: int, buffer: bytearray | None = None) -> int | bytes: - try: - return self._ssl_io_loop(self.sslobj.read, len, buffer) - except ssl.SSLError as e: - if e.errno == ssl.SSL_ERROR_EOF and self.suppress_ragged_eofs: - return 0 # eof, return 0. - else: - raise - - # func is sslobj.do_handshake or sslobj.unwrap - @typing.overload - def _ssl_io_loop(self, func: typing.Callable[[], None]) -> None: - ... - - # func is sslobj.write, arg1 is data - @typing.overload - def _ssl_io_loop(self, func: typing.Callable[[bytes], int], arg1: bytes) -> int: - ... - - # func is sslobj.read, arg1 is len, arg2 is buffer - @typing.overload - def _ssl_io_loop( - self, - func: typing.Callable[[int, bytearray | None], bytes], - arg1: int, - arg2: bytearray | None, - ) -> bytes: - ... - - def _ssl_io_loop( - self, - func: typing.Callable[..., _ReturnValue], - arg1: None | bytes | int = None, - arg2: bytearray | None = None, - ) -> _ReturnValue: - """Performs an I/O loop between incoming/outgoing and the socket.""" - should_loop = True - ret = None - - while should_loop: - errno = None - try: - if arg1 is None and arg2 is None: - ret = func() - elif arg2 is None: - ret = func(arg1) - else: - ret = func(arg1, arg2) - except ssl.SSLError as e: - if e.errno not in (ssl.SSL_ERROR_WANT_READ, ssl.SSL_ERROR_WANT_WRITE): - # WANT_READ, and WANT_WRITE are expected, others are not. - raise e - errno = e.errno - - buf = self.outgoing.read() - self.socket.sendall(buf) - - if errno is None: - should_loop = False - elif errno == ssl.SSL_ERROR_WANT_READ: - buf = self.socket.recv(SSL_BLOCKSIZE) - if buf: - self.incoming.write(buf) - else: - self.incoming.write_eof() - return typing.cast(_ReturnValue, ret) diff --git a/venv/lib/python3.8/site-packages/urllib3/util/timeout.py b/venv/lib/python3.8/site-packages/urllib3/util/timeout.py deleted file mode 100644 index ec090f69cc96810c35e6c50cdc179a4a83c982b7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/timeout.py +++ /dev/null @@ -1,279 +0,0 @@ -from __future__ import annotations - -import time -import typing -from enum import Enum -from socket import getdefaulttimeout - -from ..exceptions import TimeoutStateError - -if typing.TYPE_CHECKING: - from typing_extensions import Final - - -class _TYPE_DEFAULT(Enum): - # This value should never be passed to socket.settimeout() so for safety we use a -1. - # socket.settimout() raises a ValueError for negative values. - token = -1 - - -_DEFAULT_TIMEOUT: Final[_TYPE_DEFAULT] = _TYPE_DEFAULT.token - -_TYPE_TIMEOUT = typing.Optional[typing.Union[float, _TYPE_DEFAULT]] - - -class Timeout: - """Timeout configuration. - - Timeouts can be defined as a default for a pool: - - .. code-block:: python - - import urllib3 - - timeout = urllib3.util.Timeout(connect=2.0, read=7.0) - - http = urllib3.PoolManager(timeout=timeout) - - resp = http.request("GET", "https://example.com/") - - print(resp.status) - - Or per-request (which overrides the default for the pool): - - .. code-block:: python - - response = http.request("GET", "https://example.com/", timeout=Timeout(10)) - - Timeouts can be disabled by setting all the parameters to ``None``: - - .. code-block:: python - - no_timeout = Timeout(connect=None, read=None) - response = http.request("GET", "https://example.com/", timeout=no_timeout) - - - :param total: - This combines the connect and read timeouts into one; the read timeout - will be set to the time leftover from the connect attempt. In the - event that both a connect timeout and a total are specified, or a read - timeout and a total are specified, the shorter timeout will be applied. - - Defaults to None. - - :type total: int, float, or None - - :param connect: - The maximum amount of time (in seconds) to wait for a connection - attempt to a server to succeed. Omitting the parameter will default the - connect timeout to the system default, probably `the global default - timeout in socket.py - `_. - None will set an infinite timeout for connection attempts. - - :type connect: int, float, or None - - :param read: - The maximum amount of time (in seconds) to wait between consecutive - read operations for a response from the server. Omitting the parameter - will default the read timeout to the system default, probably `the - global default timeout in socket.py - `_. - None will set an infinite timeout. - - :type read: int, float, or None - - .. note:: - - Many factors can affect the total amount of time for urllib3 to return - an HTTP response. - - For example, Python's DNS resolver does not obey the timeout specified - on the socket. Other factors that can affect total request time include - high CPU load, high swap, the program running at a low priority level, - or other behaviors. - - In addition, the read and total timeouts only measure the time between - read operations on the socket connecting the client and the server, - not the total amount of time for the request to return a complete - response. For most requests, the timeout is raised because the server - has not sent the first byte in the specified time. This is not always - the case; if a server streams one byte every fifteen seconds, a timeout - of 20 seconds will not trigger, even though the request will take - several minutes to complete. - - If your goal is to cut off any request after a set amount of wall clock - time, consider having a second "watcher" thread to cut off a slow - request. - """ - - #: A sentinel object representing the default timeout value - DEFAULT_TIMEOUT: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT - - def __init__( - self, - total: _TYPE_TIMEOUT = None, - connect: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - read: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, - ) -> None: - self._connect = self._validate_timeout(connect, "connect") - self._read = self._validate_timeout(read, "read") - self.total = self._validate_timeout(total, "total") - self._start_connect: float | None = None - - def __repr__(self) -> str: - return f"{type(self).__name__}(connect={self._connect!r}, read={self._read!r}, total={self.total!r})" - - # __str__ provided for backwards compatibility - __str__ = __repr__ - - @staticmethod - def resolve_default_timeout(timeout: _TYPE_TIMEOUT) -> float | None: - return getdefaulttimeout() if timeout is _DEFAULT_TIMEOUT else timeout - - @classmethod - def _validate_timeout(cls, value: _TYPE_TIMEOUT, name: str) -> _TYPE_TIMEOUT: - """Check that a timeout attribute is valid. - - :param value: The timeout value to validate - :param name: The name of the timeout attribute to validate. This is - used to specify in error messages. - :return: The validated and casted version of the given value. - :raises ValueError: If it is a numeric value less than or equal to - zero, or the type is not an integer, float, or None. - """ - if value is None or value is _DEFAULT_TIMEOUT: - return value - - if isinstance(value, bool): - raise ValueError( - "Timeout cannot be a boolean value. It must " - "be an int, float or None." - ) - try: - float(value) - except (TypeError, ValueError): - raise ValueError( - "Timeout value %s was %s, but it must be an " - "int, float or None." % (name, value) - ) from None - - try: - if value <= 0: - raise ValueError( - "Attempted to set %s timeout to %s, but the " - "timeout cannot be set to a value less " - "than or equal to 0." % (name, value) - ) - except TypeError: - raise ValueError( - "Timeout value %s was %s, but it must be an " - "int, float or None." % (name, value) - ) from None - - return value - - @classmethod - def from_float(cls, timeout: _TYPE_TIMEOUT) -> Timeout: - """Create a new Timeout from a legacy timeout value. - - The timeout value used by httplib.py sets the same timeout on the - connect(), and recv() socket requests. This creates a :class:`Timeout` - object that sets the individual timeouts to the ``timeout`` value - passed to this function. - - :param timeout: The legacy timeout value. - :type timeout: integer, float, :attr:`urllib3.util.Timeout.DEFAULT_TIMEOUT`, or None - :return: Timeout object - :rtype: :class:`Timeout` - """ - return Timeout(read=timeout, connect=timeout) - - def clone(self) -> Timeout: - """Create a copy of the timeout object - - Timeout properties are stored per-pool but each request needs a fresh - Timeout object to ensure each one has its own start/stop configured. - - :return: a copy of the timeout object - :rtype: :class:`Timeout` - """ - # We can't use copy.deepcopy because that will also create a new object - # for _GLOBAL_DEFAULT_TIMEOUT, which socket.py uses as a sentinel to - # detect the user default. - return Timeout(connect=self._connect, read=self._read, total=self.total) - - def start_connect(self) -> float: - """Start the timeout clock, used during a connect() attempt - - :raises urllib3.exceptions.TimeoutStateError: if you attempt - to start a timer that has been started already. - """ - if self._start_connect is not None: - raise TimeoutStateError("Timeout timer has already been started.") - self._start_connect = time.monotonic() - return self._start_connect - - def get_connect_duration(self) -> float: - """Gets the time elapsed since the call to :meth:`start_connect`. - - :return: Elapsed time in seconds. - :rtype: float - :raises urllib3.exceptions.TimeoutStateError: if you attempt - to get duration for a timer that hasn't been started. - """ - if self._start_connect is None: - raise TimeoutStateError( - "Can't get connect duration for timer that has not started." - ) - return time.monotonic() - self._start_connect - - @property - def connect_timeout(self) -> _TYPE_TIMEOUT: - """Get the value to use when setting a connection timeout. - - This will be a positive float or integer, the value None - (never timeout), or the default system timeout. - - :return: Connect timeout. - :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None - """ - if self.total is None: - return self._connect - - if self._connect is None or self._connect is _DEFAULT_TIMEOUT: - return self.total - - return min(self._connect, self.total) # type: ignore[type-var] - - @property - def read_timeout(self) -> float | None: - """Get the value for the read timeout. - - This assumes some time has elapsed in the connection timeout and - computes the read timeout appropriately. - - If self.total is set, the read timeout is dependent on the amount of - time taken by the connect timeout. If the connection time has not been - established, a :exc:`~urllib3.exceptions.TimeoutStateError` will be - raised. - - :return: Value to use for the read timeout. - :rtype: int, float or None - :raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect` - has not yet been called on this object. - """ - if ( - self.total is not None - and self.total is not _DEFAULT_TIMEOUT - and self._read is not None - and self._read is not _DEFAULT_TIMEOUT - ): - # In case the connect timeout has not yet been established. - if self._start_connect is None: - return self._read - return max(0, min(self.total - self.get_connect_duration(), self._read)) - elif self.total is not None and self.total is not _DEFAULT_TIMEOUT: - return max(0, self.total - self.get_connect_duration()) - else: - return self.resolve_default_timeout(self._read) diff --git a/venv/lib/python3.8/site-packages/urllib3/util/url.py b/venv/lib/python3.8/site-packages/urllib3/util/url.py deleted file mode 100644 index d53ea932a0309181a4e07596c773f3765eb36977..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/url.py +++ /dev/null @@ -1,471 +0,0 @@ -from __future__ import annotations - -import re -import typing - -from ..exceptions import LocationParseError -from .util import to_str - -# We only want to normalize urls with an HTTP(S) scheme. -# urllib3 infers URLs without a scheme (None) to be http. -_NORMALIZABLE_SCHEMES = ("http", "https", None) - -# Almost all of these patterns were derived from the -# 'rfc3986' module: https://github.com/python-hyper/rfc3986 -_PERCENT_RE = re.compile(r"%[a-fA-F0-9]{2}") -_SCHEME_RE = re.compile(r"^(?:[a-zA-Z][a-zA-Z0-9+-]*:|/)") -_URI_RE = re.compile( - r"^(?:([a-zA-Z][a-zA-Z0-9+.-]*):)?" - r"(?://([^\\/?#]*))?" - r"([^?#]*)" - r"(?:\?([^#]*))?" - r"(?:#(.*))?$", - re.UNICODE | re.DOTALL, -) - -_IPV4_PAT = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" -_HEX_PAT = "[0-9A-Fa-f]{1,4}" -_LS32_PAT = "(?:{hex}:{hex}|{ipv4})".format(hex=_HEX_PAT, ipv4=_IPV4_PAT) -_subs = {"hex": _HEX_PAT, "ls32": _LS32_PAT} -_variations = [ - # 6( h16 ":" ) ls32 - "(?:%(hex)s:){6}%(ls32)s", - # "::" 5( h16 ":" ) ls32 - "::(?:%(hex)s:){5}%(ls32)s", - # [ h16 ] "::" 4( h16 ":" ) ls32 - "(?:%(hex)s)?::(?:%(hex)s:){4}%(ls32)s", - # [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 - "(?:(?:%(hex)s:)?%(hex)s)?::(?:%(hex)s:){3}%(ls32)s", - # [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 - "(?:(?:%(hex)s:){0,2}%(hex)s)?::(?:%(hex)s:){2}%(ls32)s", - # [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 - "(?:(?:%(hex)s:){0,3}%(hex)s)?::%(hex)s:%(ls32)s", - # [ *4( h16 ":" ) h16 ] "::" ls32 - "(?:(?:%(hex)s:){0,4}%(hex)s)?::%(ls32)s", - # [ *5( h16 ":" ) h16 ] "::" h16 - "(?:(?:%(hex)s:){0,5}%(hex)s)?::%(hex)s", - # [ *6( h16 ":" ) h16 ] "::" - "(?:(?:%(hex)s:){0,6}%(hex)s)?::", -] - -_UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~" -_IPV6_PAT = "(?:" + "|".join([x % _subs for x in _variations]) + ")" -_ZONE_ID_PAT = "(?:%25|%)(?:[" + _UNRESERVED_PAT + "]|%[a-fA-F0-9]{2})+" -_IPV6_ADDRZ_PAT = r"\[" + _IPV6_PAT + r"(?:" + _ZONE_ID_PAT + r")?\]" -_REG_NAME_PAT = r"(?:[^\[\]%:/?#]|%[a-fA-F0-9]{2})*" -_TARGET_RE = re.compile(r"^(/[^?#]*)(?:\?([^#]*))?(?:#.*)?$") - -_IPV4_RE = re.compile("^" + _IPV4_PAT + "$") -_IPV6_RE = re.compile("^" + _IPV6_PAT + "$") -_IPV6_ADDRZ_RE = re.compile("^" + _IPV6_ADDRZ_PAT + "$") -_BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + _IPV6_ADDRZ_PAT[2:-2] + "$") -_ZONE_ID_RE = re.compile("(" + _ZONE_ID_PAT + r")\]$") - -_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*?(|0|[1-9][0-9]{0,4}))?$") % ( - _REG_NAME_PAT, - _IPV4_PAT, - _IPV6_ADDRZ_PAT, -) -_HOST_PORT_RE = re.compile(_HOST_PORT_PAT, re.UNICODE | re.DOTALL) - -_UNRESERVED_CHARS = set( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~" -) -_SUB_DELIM_CHARS = set("!$&'()*+,;=") -_USERINFO_CHARS = _UNRESERVED_CHARS | _SUB_DELIM_CHARS | {":"} -_PATH_CHARS = _USERINFO_CHARS | {"@", "/"} -_QUERY_CHARS = _FRAGMENT_CHARS = _PATH_CHARS | {"?"} - - -class Url( - typing.NamedTuple( - "Url", - [ - ("scheme", typing.Optional[str]), - ("auth", typing.Optional[str]), - ("host", typing.Optional[str]), - ("port", typing.Optional[int]), - ("path", typing.Optional[str]), - ("query", typing.Optional[str]), - ("fragment", typing.Optional[str]), - ], - ) -): - """ - Data structure for representing an HTTP URL. Used as a return value for - :func:`parse_url`. Both the scheme and host are normalized as they are - both case-insensitive according to RFC 3986. - """ - - def __new__( # type: ignore[no-untyped-def] - cls, - scheme: str | None = None, - auth: str | None = None, - host: str | None = None, - port: int | None = None, - path: str | None = None, - query: str | None = None, - fragment: str | None = None, - ): - if path and not path.startswith("/"): - path = "/" + path - if scheme is not None: - scheme = scheme.lower() - return super().__new__(cls, scheme, auth, host, port, path, query, fragment) - - @property - def hostname(self) -> str | None: - """For backwards-compatibility with urlparse. We're nice like that.""" - return self.host - - @property - def request_uri(self) -> str: - """Absolute path including the query string.""" - uri = self.path or "/" - - if self.query is not None: - uri += "?" + self.query - - return uri - - @property - def authority(self) -> str | None: - """ - Authority component as defined in RFC 3986 3.2. - This includes userinfo (auth), host and port. - - i.e. - userinfo@host:port - """ - userinfo = self.auth - netloc = self.netloc - if netloc is None or userinfo is None: - return netloc - else: - return f"{userinfo}@{netloc}" - - @property - def netloc(self) -> str | None: - """ - Network location including host and port. - - If you need the equivalent of urllib.parse's ``netloc``, - use the ``authority`` property instead. - """ - if self.host is None: - return None - if self.port: - return f"{self.host}:{self.port}" - return self.host - - @property - def url(self) -> str: - """ - Convert self into a url - - This function should more or less round-trip with :func:`.parse_url`. The - returned url may not be exactly the same as the url inputted to - :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls - with a blank port will have : removed). - - Example: - - .. code-block:: python - - import urllib3 - - U = urllib3.util.parse_url("https://google.com/mail/") - - print(U.url) - # "https://google.com/mail/" - - print( urllib3.util.Url("https", "username:password", - "host.com", 80, "/path", "query", "fragment" - ).url - ) - # "https://username:password@host.com:80/path?query#fragment" - """ - scheme, auth, host, port, path, query, fragment = self - url = "" - - # We use "is not None" we want things to happen with empty strings (or 0 port) - if scheme is not None: - url += scheme + "://" - if auth is not None: - url += auth + "@" - if host is not None: - url += host - if port is not None: - url += ":" + str(port) - if path is not None: - url += path - if query is not None: - url += "?" + query - if fragment is not None: - url += "#" + fragment - - return url - - def __str__(self) -> str: - return self.url - - -@typing.overload -def _encode_invalid_chars( - component: str, allowed_chars: typing.Container[str] -) -> str: # Abstract - ... - - -@typing.overload -def _encode_invalid_chars( - component: None, allowed_chars: typing.Container[str] -) -> None: # Abstract - ... - - -def _encode_invalid_chars( - component: str | None, allowed_chars: typing.Container[str] -) -> str | None: - """Percent-encodes a URI component without reapplying - onto an already percent-encoded component. - """ - if component is None: - return component - - component = to_str(component) - - # Normalize existing percent-encoded bytes. - # Try to see if the component we're encoding is already percent-encoded - # so we can skip all '%' characters but still encode all others. - component, percent_encodings = _PERCENT_RE.subn( - lambda match: match.group(0).upper(), component - ) - - uri_bytes = component.encode("utf-8", "surrogatepass") - is_percent_encoded = percent_encodings == uri_bytes.count(b"%") - encoded_component = bytearray() - - for i in range(0, len(uri_bytes)): - # Will return a single character bytestring - byte = uri_bytes[i : i + 1] - byte_ord = ord(byte) - if (is_percent_encoded and byte == b"%") or ( - byte_ord < 128 and byte.decode() in allowed_chars - ): - encoded_component += byte - continue - encoded_component.extend(b"%" + (hex(byte_ord)[2:].encode().zfill(2).upper())) - - return encoded_component.decode() - - -def _remove_path_dot_segments(path: str) -> str: - # See http://tools.ietf.org/html/rfc3986#section-5.2.4 for pseudo-code - segments = path.split("/") # Turn the path into a list of segments - output = [] # Initialize the variable to use to store output - - for segment in segments: - # '.' is the current directory, so ignore it, it is superfluous - if segment == ".": - continue - # Anything other than '..', should be appended to the output - if segment != "..": - output.append(segment) - # In this case segment == '..', if we can, we should pop the last - # element - elif output: - output.pop() - - # If the path starts with '/' and the output is empty or the first string - # is non-empty - if path.startswith("/") and (not output or output[0]): - output.insert(0, "") - - # If the path starts with '/.' or '/..' ensure we add one more empty - # string to add a trailing '/' - if path.endswith(("/.", "/..")): - output.append("") - - return "/".join(output) - - -@typing.overload -def _normalize_host(host: None, scheme: str | None) -> None: - ... - - -@typing.overload -def _normalize_host(host: str, scheme: str | None) -> str: - ... - - -def _normalize_host(host: str | None, scheme: str | None) -> str | None: - if host: - if scheme in _NORMALIZABLE_SCHEMES: - is_ipv6 = _IPV6_ADDRZ_RE.match(host) - if is_ipv6: - # IPv6 hosts of the form 'a::b%zone' are encoded in a URL as - # such per RFC 6874: 'a::b%25zone'. Unquote the ZoneID - # separator as necessary to return a valid RFC 4007 scoped IP. - match = _ZONE_ID_RE.search(host) - if match: - start, end = match.span(1) - zone_id = host[start:end] - - if zone_id.startswith("%25") and zone_id != "%25": - zone_id = zone_id[3:] - else: - zone_id = zone_id[1:] - zone_id = _encode_invalid_chars(zone_id, _UNRESERVED_CHARS) - return f"{host[:start].lower()}%{zone_id}{host[end:]}" - else: - return host.lower() - elif not _IPV4_RE.match(host): - return to_str( - b".".join([_idna_encode(label) for label in host.split(".")]), - "ascii", - ) - return host - - -def _idna_encode(name: str) -> bytes: - if not name.isascii(): - try: - import idna - except ImportError: - raise LocationParseError( - "Unable to parse URL without the 'idna' module" - ) from None - - try: - return idna.encode(name.lower(), strict=True, std3_rules=True) - except idna.IDNAError: - raise LocationParseError( - f"Name '{name}' is not a valid IDNA label" - ) from None - - return name.lower().encode("ascii") - - -def _encode_target(target: str) -> str: - """Percent-encodes a request target so that there are no invalid characters - - Pre-condition for this function is that 'target' must start with '/'. - If that is the case then _TARGET_RE will always produce a match. - """ - match = _TARGET_RE.match(target) - if not match: # Defensive: - raise LocationParseError(f"{target!r} is not a valid request URI") - - path, query = match.groups() - encoded_target = _encode_invalid_chars(path, _PATH_CHARS) - if query is not None: - query = _encode_invalid_chars(query, _QUERY_CHARS) - encoded_target += "?" + query - return encoded_target - - -def parse_url(url: str) -> Url: - """ - Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is - performed to parse incomplete urls. Fields not provided will be None. - This parser is RFC 3986 and RFC 6874 compliant. - - The parser logic and helper functions are based heavily on - work done in the ``rfc3986`` module. - - :param str url: URL to parse into a :class:`.Url` namedtuple. - - Partly backwards-compatible with :mod:`urllib.parse`. - - Example: - - .. code-block:: python - - import urllib3 - - print( urllib3.util.parse_url('http://google.com/mail/')) - # Url(scheme='http', host='google.com', port=None, path='/mail/', ...) - - print( urllib3.util.parse_url('google.com:80')) - # Url(scheme=None, host='google.com', port=80, path=None, ...) - - print( urllib3.util.parse_url('/foo?bar')) - # Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...) - """ - if not url: - # Empty - return Url() - - source_url = url - if not _SCHEME_RE.search(url): - url = "//" + url - - scheme: str | None - authority: str | None - auth: str | None - host: str | None - port: str | None - port_int: int | None - path: str | None - query: str | None - fragment: str | None - - try: - scheme, authority, path, query, fragment = _URI_RE.match(url).groups() # type: ignore[union-attr] - normalize_uri = scheme is None or scheme.lower() in _NORMALIZABLE_SCHEMES - - if scheme: - scheme = scheme.lower() - - if authority: - auth, _, host_port = authority.rpartition("@") - auth = auth or None - host, port = _HOST_PORT_RE.match(host_port).groups() # type: ignore[union-attr] - if auth and normalize_uri: - auth = _encode_invalid_chars(auth, _USERINFO_CHARS) - if port == "": - port = None - else: - auth, host, port = None, None, None - - if port is not None: - port_int = int(port) - if not (0 <= port_int <= 65535): - raise LocationParseError(url) - else: - port_int = None - - host = _normalize_host(host, scheme) - - if normalize_uri and path: - path = _remove_path_dot_segments(path) - path = _encode_invalid_chars(path, _PATH_CHARS) - if normalize_uri and query: - query = _encode_invalid_chars(query, _QUERY_CHARS) - if normalize_uri and fragment: - fragment = _encode_invalid_chars(fragment, _FRAGMENT_CHARS) - - except (ValueError, AttributeError) as e: - raise LocationParseError(source_url) from e - - # For the sake of backwards compatibility we put empty - # string values for path if there are any defined values - # beyond the path in the URL. - # TODO: Remove this when we break backwards compatibility. - if not path: - if query is not None or fragment is not None: - path = "" - else: - path = None - - return Url( - scheme=scheme, - auth=auth, - host=host, - port=port_int, - path=path, - query=query, - fragment=fragment, - ) diff --git a/venv/lib/python3.8/site-packages/urllib3/util/util.py b/venv/lib/python3.8/site-packages/urllib3/util/util.py deleted file mode 100644 index 35c77e4025842f548565334a3c04cba90f9283d6..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/util.py +++ /dev/null @@ -1,42 +0,0 @@ -from __future__ import annotations - -import typing -from types import TracebackType - - -def to_bytes( - x: str | bytes, encoding: str | None = None, errors: str | None = None -) -> bytes: - if isinstance(x, bytes): - return x - elif not isinstance(x, str): - raise TypeError(f"not expecting type {type(x).__name__}") - if encoding or errors: - return x.encode(encoding or "utf-8", errors=errors or "strict") - return x.encode() - - -def to_str( - x: str | bytes, encoding: str | None = None, errors: str | None = None -) -> str: - if isinstance(x, str): - return x - elif not isinstance(x, bytes): - raise TypeError(f"not expecting type {type(x).__name__}") - if encoding or errors: - return x.decode(encoding or "utf-8", errors=errors or "strict") - return x.decode() - - -def reraise( - tp: type[BaseException] | None, - value: BaseException, - tb: TracebackType | None = None, -) -> typing.NoReturn: - try: - if value.__traceback__ is not tb: - raise value.with_traceback(tb) - raise value - finally: - value = None # type: ignore[assignment] - tb = None diff --git a/venv/lib/python3.8/site-packages/urllib3/util/wait.py b/venv/lib/python3.8/site-packages/urllib3/util/wait.py deleted file mode 100644 index aeca0c7ad5b232eeb1ad9c43d315bd1d74eaed9a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/urllib3/util/wait.py +++ /dev/null @@ -1,124 +0,0 @@ -from __future__ import annotations - -import select -import socket -from functools import partial - -__all__ = ["wait_for_read", "wait_for_write"] - - -# How should we wait on sockets? -# -# There are two types of APIs you can use for waiting on sockets: the fancy -# modern stateful APIs like epoll/kqueue, and the older stateless APIs like -# select/poll. The stateful APIs are more efficient when you have a lots of -# sockets to keep track of, because you can set them up once and then use them -# lots of times. But we only ever want to wait on a single socket at a time -# and don't want to keep track of state, so the stateless APIs are actually -# more efficient. So we want to use select() or poll(). -# -# Now, how do we choose between select() and poll()? On traditional Unixes, -# select() has a strange calling convention that makes it slow, or fail -# altogether, for high-numbered file descriptors. The point of poll() is to fix -# that, so on Unixes, we prefer poll(). -# -# On Windows, there is no poll() (or at least Python doesn't provide a wrapper -# for it), but that's OK, because on Windows, select() doesn't have this -# strange calling convention; plain select() works fine. -# -# So: on Windows we use select(), and everywhere else we use poll(). We also -# fall back to select() in case poll() is somehow broken or missing. - - -def select_wait_for_socket( - sock: socket.socket, - read: bool = False, - write: bool = False, - timeout: float | None = None, -) -> bool: - if not read and not write: - raise RuntimeError("must specify at least one of read=True, write=True") - rcheck = [] - wcheck = [] - if read: - rcheck.append(sock) - if write: - wcheck.append(sock) - # When doing a non-blocking connect, most systems signal success by - # marking the socket writable. Windows, though, signals success by marked - # it as "exceptional". We paper over the difference by checking the write - # sockets for both conditions. (The stdlib selectors module does the same - # thing.) - fn = partial(select.select, rcheck, wcheck, wcheck) - rready, wready, xready = fn(timeout) - return bool(rready or wready or xready) - - -def poll_wait_for_socket( - sock: socket.socket, - read: bool = False, - write: bool = False, - timeout: float | None = None, -) -> bool: - if not read and not write: - raise RuntimeError("must specify at least one of read=True, write=True") - mask = 0 - if read: - mask |= select.POLLIN - if write: - mask |= select.POLLOUT - poll_obj = select.poll() - poll_obj.register(sock, mask) - - # For some reason, poll() takes timeout in milliseconds - def do_poll(t: float | None) -> list[tuple[int, int]]: - if t is not None: - t *= 1000 - return poll_obj.poll(t) - - return bool(do_poll(timeout)) - - -def _have_working_poll() -> bool: - # Apparently some systems have a select.poll that fails as soon as you try - # to use it, either due to strange configuration or broken monkeypatching - # from libraries like eventlet/greenlet. - try: - poll_obj = select.poll() - poll_obj.poll(0) - except (AttributeError, OSError): - return False - else: - return True - - -def wait_for_socket( - sock: socket.socket, - read: bool = False, - write: bool = False, - timeout: float | None = None, -) -> bool: - # We delay choosing which implementation to use until the first time we're - # called. We could do it at import time, but then we might make the wrong - # decision if someone goes wild with monkeypatching select.poll after - # we're imported. - global wait_for_socket - if _have_working_poll(): - wait_for_socket = poll_wait_for_socket - elif hasattr(select, "select"): - wait_for_socket = select_wait_for_socket - return wait_for_socket(sock, read, write, timeout) - - -def wait_for_read(sock: socket.socket, timeout: float | None = None) -> bool: - """Waits for reading to be available on a given socket. - Returns True if the socket is readable, or False if the timeout expired. - """ - return wait_for_socket(sock, read=True, timeout=timeout) - - -def wait_for_write(sock: socket.socket, timeout: float | None = None) -> bool: - """Waits for writing to be available on a given socket. - Returns True if the socket is readable, or False if the timeout expired. - """ - return wait_for_socket(sock, write=True, timeout=timeout) diff --git a/venv/lib/python3.8/site-packages/yaml/__init__.py b/venv/lib/python3.8/site-packages/yaml/__init__.py deleted file mode 100644 index 824936194774d34cd5e7816e519d00517612e7b4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/__init__.py +++ /dev/null @@ -1,390 +0,0 @@ - -from .error import * - -from .tokens import * -from .events import * -from .nodes import * - -from .loader import * -from .dumper import * - -__version__ = '6.0.1' -try: - from .cyaml import * - __with_libyaml__ = True -except ImportError: - __with_libyaml__ = False - -import io - -#------------------------------------------------------------------------------ -# XXX "Warnings control" is now deprecated. Leaving in the API function to not -# break code that uses it. -#------------------------------------------------------------------------------ -def warnings(settings=None): - if settings is None: - return {} - -#------------------------------------------------------------------------------ -def scan(stream, Loader=Loader): - """ - Scan a YAML stream and produce scanning tokens. - """ - loader = Loader(stream) - try: - while loader.check_token(): - yield loader.get_token() - finally: - loader.dispose() - -def parse(stream, Loader=Loader): - """ - Parse a YAML stream and produce parsing events. - """ - loader = Loader(stream) - try: - while loader.check_event(): - yield loader.get_event() - finally: - loader.dispose() - -def compose(stream, Loader=Loader): - """ - Parse the first YAML document in a stream - and produce the corresponding representation tree. - """ - loader = Loader(stream) - try: - return loader.get_single_node() - finally: - loader.dispose() - -def compose_all(stream, Loader=Loader): - """ - Parse all YAML documents in a stream - and produce corresponding representation trees. - """ - loader = Loader(stream) - try: - while loader.check_node(): - yield loader.get_node() - finally: - loader.dispose() - -def load(stream, Loader): - """ - Parse the first YAML document in a stream - and produce the corresponding Python object. - """ - loader = Loader(stream) - try: - return loader.get_single_data() - finally: - loader.dispose() - -def load_all(stream, Loader): - """ - Parse all YAML documents in a stream - and produce corresponding Python objects. - """ - loader = Loader(stream) - try: - while loader.check_data(): - yield loader.get_data() - finally: - loader.dispose() - -def full_load(stream): - """ - Parse the first YAML document in a stream - and produce the corresponding Python object. - - Resolve all tags except those known to be - unsafe on untrusted input. - """ - return load(stream, FullLoader) - -def full_load_all(stream): - """ - Parse all YAML documents in a stream - and produce corresponding Python objects. - - Resolve all tags except those known to be - unsafe on untrusted input. - """ - return load_all(stream, FullLoader) - -def safe_load(stream): - """ - Parse the first YAML document in a stream - and produce the corresponding Python object. - - Resolve only basic YAML tags. This is known - to be safe for untrusted input. - """ - return load(stream, SafeLoader) - -def safe_load_all(stream): - """ - Parse all YAML documents in a stream - and produce corresponding Python objects. - - Resolve only basic YAML tags. This is known - to be safe for untrusted input. - """ - return load_all(stream, SafeLoader) - -def unsafe_load(stream): - """ - Parse the first YAML document in a stream - and produce the corresponding Python object. - - Resolve all tags, even those known to be - unsafe on untrusted input. - """ - return load(stream, UnsafeLoader) - -def unsafe_load_all(stream): - """ - Parse all YAML documents in a stream - and produce corresponding Python objects. - - Resolve all tags, even those known to be - unsafe on untrusted input. - """ - return load_all(stream, UnsafeLoader) - -def emit(events, stream=None, Dumper=Dumper, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None): - """ - Emit YAML parsing events into a stream. - If stream is None, return the produced string instead. - """ - getvalue = None - if stream is None: - stream = io.StringIO() - getvalue = stream.getvalue - dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, - allow_unicode=allow_unicode, line_break=line_break) - try: - for event in events: - dumper.emit(event) - finally: - dumper.dispose() - if getvalue: - return getvalue() - -def serialize_all(nodes, stream=None, Dumper=Dumper, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None, - encoding=None, explicit_start=None, explicit_end=None, - version=None, tags=None): - """ - Serialize a sequence of representation trees into a YAML stream. - If stream is None, return the produced string instead. - """ - getvalue = None - if stream is None: - if encoding is None: - stream = io.StringIO() - else: - stream = io.BytesIO() - getvalue = stream.getvalue - dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, - allow_unicode=allow_unicode, line_break=line_break, - encoding=encoding, version=version, tags=tags, - explicit_start=explicit_start, explicit_end=explicit_end) - try: - dumper.open() - for node in nodes: - dumper.serialize(node) - dumper.close() - finally: - dumper.dispose() - if getvalue: - return getvalue() - -def serialize(node, stream=None, Dumper=Dumper, **kwds): - """ - Serialize a representation tree into a YAML stream. - If stream is None, return the produced string instead. - """ - return serialize_all([node], stream, Dumper=Dumper, **kwds) - -def dump_all(documents, stream=None, Dumper=Dumper, - default_style=None, default_flow_style=False, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None, - encoding=None, explicit_start=None, explicit_end=None, - version=None, tags=None, sort_keys=True): - """ - Serialize a sequence of Python objects into a YAML stream. - If stream is None, return the produced string instead. - """ - getvalue = None - if stream is None: - if encoding is None: - stream = io.StringIO() - else: - stream = io.BytesIO() - getvalue = stream.getvalue - dumper = Dumper(stream, default_style=default_style, - default_flow_style=default_flow_style, - canonical=canonical, indent=indent, width=width, - allow_unicode=allow_unicode, line_break=line_break, - encoding=encoding, version=version, tags=tags, - explicit_start=explicit_start, explicit_end=explicit_end, sort_keys=sort_keys) - try: - dumper.open() - for data in documents: - dumper.represent(data) - dumper.close() - finally: - dumper.dispose() - if getvalue: - return getvalue() - -def dump(data, stream=None, Dumper=Dumper, **kwds): - """ - Serialize a Python object into a YAML stream. - If stream is None, return the produced string instead. - """ - return dump_all([data], stream, Dumper=Dumper, **kwds) - -def safe_dump_all(documents, stream=None, **kwds): - """ - Serialize a sequence of Python objects into a YAML stream. - Produce only basic YAML tags. - If stream is None, return the produced string instead. - """ - return dump_all(documents, stream, Dumper=SafeDumper, **kwds) - -def safe_dump(data, stream=None, **kwds): - """ - Serialize a Python object into a YAML stream. - Produce only basic YAML tags. - If stream is None, return the produced string instead. - """ - return dump_all([data], stream, Dumper=SafeDumper, **kwds) - -def add_implicit_resolver(tag, regexp, first=None, - Loader=None, Dumper=Dumper): - """ - Add an implicit scalar detector. - If an implicit scalar value matches the given regexp, - the corresponding tag is assigned to the scalar. - first is a sequence of possible initial characters or None. - """ - if Loader is None: - loader.Loader.add_implicit_resolver(tag, regexp, first) - loader.FullLoader.add_implicit_resolver(tag, regexp, first) - loader.UnsafeLoader.add_implicit_resolver(tag, regexp, first) - else: - Loader.add_implicit_resolver(tag, regexp, first) - Dumper.add_implicit_resolver(tag, regexp, first) - -def add_path_resolver(tag, path, kind=None, Loader=None, Dumper=Dumper): - """ - Add a path based resolver for the given tag. - A path is a list of keys that forms a path - to a node in the representation tree. - Keys can be string values, integers, or None. - """ - if Loader is None: - loader.Loader.add_path_resolver(tag, path, kind) - loader.FullLoader.add_path_resolver(tag, path, kind) - loader.UnsafeLoader.add_path_resolver(tag, path, kind) - else: - Loader.add_path_resolver(tag, path, kind) - Dumper.add_path_resolver(tag, path, kind) - -def add_constructor(tag, constructor, Loader=None): - """ - Add a constructor for the given tag. - Constructor is a function that accepts a Loader instance - and a node object and produces the corresponding Python object. - """ - if Loader is None: - loader.Loader.add_constructor(tag, constructor) - loader.FullLoader.add_constructor(tag, constructor) - loader.UnsafeLoader.add_constructor(tag, constructor) - else: - Loader.add_constructor(tag, constructor) - -def add_multi_constructor(tag_prefix, multi_constructor, Loader=None): - """ - Add a multi-constructor for the given tag prefix. - Multi-constructor is called for a node if its tag starts with tag_prefix. - Multi-constructor accepts a Loader instance, a tag suffix, - and a node object and produces the corresponding Python object. - """ - if Loader is None: - loader.Loader.add_multi_constructor(tag_prefix, multi_constructor) - loader.FullLoader.add_multi_constructor(tag_prefix, multi_constructor) - loader.UnsafeLoader.add_multi_constructor(tag_prefix, multi_constructor) - else: - Loader.add_multi_constructor(tag_prefix, multi_constructor) - -def add_representer(data_type, representer, Dumper=Dumper): - """ - Add a representer for the given type. - Representer is a function accepting a Dumper instance - and an instance of the given data type - and producing the corresponding representation node. - """ - Dumper.add_representer(data_type, representer) - -def add_multi_representer(data_type, multi_representer, Dumper=Dumper): - """ - Add a representer for the given type. - Multi-representer is a function accepting a Dumper instance - and an instance of the given data type or subtype - and producing the corresponding representation node. - """ - Dumper.add_multi_representer(data_type, multi_representer) - -class YAMLObjectMetaclass(type): - """ - The metaclass for YAMLObject. - """ - def __init__(cls, name, bases, kwds): - super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds) - if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None: - if isinstance(cls.yaml_loader, list): - for loader in cls.yaml_loader: - loader.add_constructor(cls.yaml_tag, cls.from_yaml) - else: - cls.yaml_loader.add_constructor(cls.yaml_tag, cls.from_yaml) - - cls.yaml_dumper.add_representer(cls, cls.to_yaml) - -class YAMLObject(metaclass=YAMLObjectMetaclass): - """ - An object that can dump itself to a YAML stream - and load itself from a YAML stream. - """ - - __slots__ = () # no direct instantiation, so allow immutable subclasses - - yaml_loader = [Loader, FullLoader, UnsafeLoader] - yaml_dumper = Dumper - - yaml_tag = None - yaml_flow_style = None - - @classmethod - def from_yaml(cls, loader, node): - """ - Convert a representation node to a Python object. - """ - return loader.construct_yaml_object(node, cls) - - @classmethod - def to_yaml(cls, dumper, data): - """ - Convert a Python object to a representation node. - """ - return dumper.represent_yaml_object(cls.yaml_tag, data, cls, - flow_style=cls.yaml_flow_style) - diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/__init__.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 2d3b73bf014c8e2793408866faf52fea73fd2881..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/composer.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/composer.cpython-38.pyc deleted file mode 100644 index ea1a9fed0c73528974b3456ae459b0ce1eca5c29..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/composer.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/constructor.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/constructor.cpython-38.pyc deleted file mode 100644 index 4fcc22c0bb6427893ed84205002431030be0fab8..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/constructor.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/cyaml.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/cyaml.cpython-38.pyc deleted file mode 100644 index 92735db6c0527785f199641d82862f8848dfb882..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/cyaml.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/dumper.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/dumper.cpython-38.pyc deleted file mode 100644 index 5edeb253c4a656b1ebc71bc2b2058d148cf06daf..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/dumper.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/emitter.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/emitter.cpython-38.pyc deleted file mode 100644 index f78f831e4f66e18c8ecff1b752be3f7a9fbe7057..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/emitter.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/error.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/error.cpython-38.pyc deleted file mode 100644 index 1658f63afeb42245b7d2b79f8af558623f67a249..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/error.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/events.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/events.cpython-38.pyc deleted file mode 100644 index e81f26273fff2ae215097981e579992c6ea683b4..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/events.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/loader.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/loader.cpython-38.pyc deleted file mode 100644 index cdbbc7bc7aa0b5dbbacdc326344caa615e3e3fa0..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/loader.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/nodes.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/nodes.cpython-38.pyc deleted file mode 100644 index 175a72e86e97fdd22c9f5c546b22843bc0e40127..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/nodes.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/parser.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/parser.cpython-38.pyc deleted file mode 100644 index ea091d53eff9f36e8d279ea6ad42b023b40ee8ad..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/parser.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/reader.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/reader.cpython-38.pyc deleted file mode 100644 index 3ebeb2c8671fd5f50471a2e51f3e77d153f9cea5..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/reader.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/representer.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/representer.cpython-38.pyc deleted file mode 100644 index c0e9247b4beade8c7f8043ef07709db997760c63..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/representer.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/resolver.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/resolver.cpython-38.pyc deleted file mode 100644 index 388ebc4d09856f21d1d804575b39bcd447bc9a5d..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/resolver.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/scanner.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/scanner.cpython-38.pyc deleted file mode 100644 index 1a9e78daa151af46252d1a4daae9a12d1cc8a185..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/scanner.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/serializer.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/serializer.cpython-38.pyc deleted file mode 100644 index f0fbc2d9927589e9dcc48b8642cca63f84c8f237..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/serializer.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/__pycache__/tokens.cpython-38.pyc b/venv/lib/python3.8/site-packages/yaml/__pycache__/tokens.cpython-38.pyc deleted file mode 100644 index 698c37c3121b257b90932149206a737a850d9225..0000000000000000000000000000000000000000 Binary files a/venv/lib/python3.8/site-packages/yaml/__pycache__/tokens.cpython-38.pyc and /dev/null differ diff --git a/venv/lib/python3.8/site-packages/yaml/_yaml.cpython-38-x86_64-linux-gnu.so b/venv/lib/python3.8/site-packages/yaml/_yaml.cpython-38-x86_64-linux-gnu.so deleted file mode 100644 index 36a173e132418c4885ced303e49c0ee3aa6a35b4..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/_yaml.cpython-38-x86_64-linux-gnu.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2d84b6d7259c454b9f4df1f12c6a45ddec44d0f8c6c700cdb666066acb2a5099 -size 2397464 diff --git a/venv/lib/python3.8/site-packages/yaml/composer.py b/venv/lib/python3.8/site-packages/yaml/composer.py deleted file mode 100644 index 6d15cb40e3b4198819c91c6f8d8b32807fcf53b2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/composer.py +++ /dev/null @@ -1,139 +0,0 @@ - -__all__ = ['Composer', 'ComposerError'] - -from .error import MarkedYAMLError -from .events import * -from .nodes import * - -class ComposerError(MarkedYAMLError): - pass - -class Composer: - - def __init__(self): - self.anchors = {} - - def check_node(self): - # Drop the STREAM-START event. - if self.check_event(StreamStartEvent): - self.get_event() - - # If there are more documents available? - return not self.check_event(StreamEndEvent) - - def get_node(self): - # Get the root node of the next document. - if not self.check_event(StreamEndEvent): - return self.compose_document() - - def get_single_node(self): - # Drop the STREAM-START event. - self.get_event() - - # Compose a document if the stream is not empty. - document = None - if not self.check_event(StreamEndEvent): - document = self.compose_document() - - # Ensure that the stream contains no more documents. - if not self.check_event(StreamEndEvent): - event = self.get_event() - raise ComposerError("expected a single document in the stream", - document.start_mark, "but found another document", - event.start_mark) - - # Drop the STREAM-END event. - self.get_event() - - return document - - def compose_document(self): - # Drop the DOCUMENT-START event. - self.get_event() - - # Compose the root node. - node = self.compose_node(None, None) - - # Drop the DOCUMENT-END event. - self.get_event() - - self.anchors = {} - return node - - def compose_node(self, parent, index): - if self.check_event(AliasEvent): - event = self.get_event() - anchor = event.anchor - if anchor not in self.anchors: - raise ComposerError(None, None, "found undefined alias %r" - % anchor, event.start_mark) - return self.anchors[anchor] - event = self.peek_event() - anchor = event.anchor - if anchor is not None: - if anchor in self.anchors: - raise ComposerError("found duplicate anchor %r; first occurrence" - % anchor, self.anchors[anchor].start_mark, - "second occurrence", event.start_mark) - self.descend_resolver(parent, index) - if self.check_event(ScalarEvent): - node = self.compose_scalar_node(anchor) - elif self.check_event(SequenceStartEvent): - node = self.compose_sequence_node(anchor) - elif self.check_event(MappingStartEvent): - node = self.compose_mapping_node(anchor) - self.ascend_resolver() - return node - - def compose_scalar_node(self, anchor): - event = self.get_event() - tag = event.tag - if tag is None or tag == '!': - tag = self.resolve(ScalarNode, event.value, event.implicit) - node = ScalarNode(tag, event.value, - event.start_mark, event.end_mark, style=event.style) - if anchor is not None: - self.anchors[anchor] = node - return node - - def compose_sequence_node(self, anchor): - start_event = self.get_event() - tag = start_event.tag - if tag is None or tag == '!': - tag = self.resolve(SequenceNode, None, start_event.implicit) - node = SequenceNode(tag, [], - start_event.start_mark, None, - flow_style=start_event.flow_style) - if anchor is not None: - self.anchors[anchor] = node - index = 0 - while not self.check_event(SequenceEndEvent): - node.value.append(self.compose_node(node, index)) - index += 1 - end_event = self.get_event() - node.end_mark = end_event.end_mark - return node - - def compose_mapping_node(self, anchor): - start_event = self.get_event() - tag = start_event.tag - if tag is None or tag == '!': - tag = self.resolve(MappingNode, None, start_event.implicit) - node = MappingNode(tag, [], - start_event.start_mark, None, - flow_style=start_event.flow_style) - if anchor is not None: - self.anchors[anchor] = node - while not self.check_event(MappingEndEvent): - #key_event = self.peek_event() - item_key = self.compose_node(node, None) - #if item_key in node.value: - # raise ComposerError("while composing a mapping", start_event.start_mark, - # "found duplicate key", key_event.start_mark) - item_value = self.compose_node(node, item_key) - #node.value[item_key] = item_value - node.value.append((item_key, item_value)) - end_event = self.get_event() - node.end_mark = end_event.end_mark - return node - diff --git a/venv/lib/python3.8/site-packages/yaml/constructor.py b/venv/lib/python3.8/site-packages/yaml/constructor.py deleted file mode 100644 index 619acd3070a4845c653fcf22a626e05158035bc2..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/constructor.py +++ /dev/null @@ -1,748 +0,0 @@ - -__all__ = [ - 'BaseConstructor', - 'SafeConstructor', - 'FullConstructor', - 'UnsafeConstructor', - 'Constructor', - 'ConstructorError' -] - -from .error import * -from .nodes import * - -import collections.abc, datetime, base64, binascii, re, sys, types - -class ConstructorError(MarkedYAMLError): - pass - -class BaseConstructor: - - yaml_constructors = {} - yaml_multi_constructors = {} - - def __init__(self): - self.constructed_objects = {} - self.recursive_objects = {} - self.state_generators = [] - self.deep_construct = False - - def check_data(self): - # If there are more documents available? - return self.check_node() - - def check_state_key(self, key): - """Block special attributes/methods from being set in a newly created - object, to prevent user-controlled methods from being called during - deserialization""" - if self.get_state_keys_blacklist_regexp().match(key): - raise ConstructorError(None, None, - "blacklisted key '%s' in instance state found" % (key,), None) - - def get_data(self): - # Construct and return the next document. - if self.check_node(): - return self.construct_document(self.get_node()) - - def get_single_data(self): - # Ensure that the stream contains a single document and construct it. - node = self.get_single_node() - if node is not None: - return self.construct_document(node) - return None - - def construct_document(self, node): - data = self.construct_object(node) - while self.state_generators: - state_generators = self.state_generators - self.state_generators = [] - for generator in state_generators: - for dummy in generator: - pass - self.constructed_objects = {} - self.recursive_objects = {} - self.deep_construct = False - return data - - def construct_object(self, node, deep=False): - if node in self.constructed_objects: - return self.constructed_objects[node] - if deep: - old_deep = self.deep_construct - self.deep_construct = True - if node in self.recursive_objects: - raise ConstructorError(None, None, - "found unconstructable recursive node", node.start_mark) - self.recursive_objects[node] = None - constructor = None - tag_suffix = None - if node.tag in self.yaml_constructors: - constructor = self.yaml_constructors[node.tag] - else: - for tag_prefix in self.yaml_multi_constructors: - if tag_prefix is not None and node.tag.startswith(tag_prefix): - tag_suffix = node.tag[len(tag_prefix):] - constructor = self.yaml_multi_constructors[tag_prefix] - break - else: - if None in self.yaml_multi_constructors: - tag_suffix = node.tag - constructor = self.yaml_multi_constructors[None] - elif None in self.yaml_constructors: - constructor = self.yaml_constructors[None] - elif isinstance(node, ScalarNode): - constructor = self.__class__.construct_scalar - elif isinstance(node, SequenceNode): - constructor = self.__class__.construct_sequence - elif isinstance(node, MappingNode): - constructor = self.__class__.construct_mapping - if tag_suffix is None: - data = constructor(self, node) - else: - data = constructor(self, tag_suffix, node) - if isinstance(data, types.GeneratorType): - generator = data - data = next(generator) - if self.deep_construct: - for dummy in generator: - pass - else: - self.state_generators.append(generator) - self.constructed_objects[node] = data - del self.recursive_objects[node] - if deep: - self.deep_construct = old_deep - return data - - def construct_scalar(self, node): - if not isinstance(node, ScalarNode): - raise ConstructorError(None, None, - "expected a scalar node, but found %s" % node.id, - node.start_mark) - return node.value - - def construct_sequence(self, node, deep=False): - if not isinstance(node, SequenceNode): - raise ConstructorError(None, None, - "expected a sequence node, but found %s" % node.id, - node.start_mark) - return [self.construct_object(child, deep=deep) - for child in node.value] - - def construct_mapping(self, node, deep=False): - if not isinstance(node, MappingNode): - raise ConstructorError(None, None, - "expected a mapping node, but found %s" % node.id, - node.start_mark) - mapping = {} - for key_node, value_node in node.value: - key = self.construct_object(key_node, deep=deep) - if not isinstance(key, collections.abc.Hashable): - raise ConstructorError("while constructing a mapping", node.start_mark, - "found unhashable key", key_node.start_mark) - value = self.construct_object(value_node, deep=deep) - mapping[key] = value - return mapping - - def construct_pairs(self, node, deep=False): - if not isinstance(node, MappingNode): - raise ConstructorError(None, None, - "expected a mapping node, but found %s" % node.id, - node.start_mark) - pairs = [] - for key_node, value_node in node.value: - key = self.construct_object(key_node, deep=deep) - value = self.construct_object(value_node, deep=deep) - pairs.append((key, value)) - return pairs - - @classmethod - def add_constructor(cls, tag, constructor): - if not 'yaml_constructors' in cls.__dict__: - cls.yaml_constructors = cls.yaml_constructors.copy() - cls.yaml_constructors[tag] = constructor - - @classmethod - def add_multi_constructor(cls, tag_prefix, multi_constructor): - if not 'yaml_multi_constructors' in cls.__dict__: - cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy() - cls.yaml_multi_constructors[tag_prefix] = multi_constructor - -class SafeConstructor(BaseConstructor): - - def construct_scalar(self, node): - if isinstance(node, MappingNode): - for key_node, value_node in node.value: - if key_node.tag == 'tag:yaml.org,2002:value': - return self.construct_scalar(value_node) - return super().construct_scalar(node) - - def flatten_mapping(self, node): - merge = [] - index = 0 - while index < len(node.value): - key_node, value_node = node.value[index] - if key_node.tag == 'tag:yaml.org,2002:merge': - del node.value[index] - if isinstance(value_node, MappingNode): - self.flatten_mapping(value_node) - merge.extend(value_node.value) - elif isinstance(value_node, SequenceNode): - submerge = [] - for subnode in value_node.value: - if not isinstance(subnode, MappingNode): - raise ConstructorError("while constructing a mapping", - node.start_mark, - "expected a mapping for merging, but found %s" - % subnode.id, subnode.start_mark) - self.flatten_mapping(subnode) - submerge.append(subnode.value) - submerge.reverse() - for value in submerge: - merge.extend(value) - else: - raise ConstructorError("while constructing a mapping", node.start_mark, - "expected a mapping or list of mappings for merging, but found %s" - % value_node.id, value_node.start_mark) - elif key_node.tag == 'tag:yaml.org,2002:value': - key_node.tag = 'tag:yaml.org,2002:str' - index += 1 - else: - index += 1 - if merge: - node.value = merge + node.value - - def construct_mapping(self, node, deep=False): - if isinstance(node, MappingNode): - self.flatten_mapping(node) - return super().construct_mapping(node, deep=deep) - - def construct_yaml_null(self, node): - self.construct_scalar(node) - return None - - bool_values = { - 'yes': True, - 'no': False, - 'true': True, - 'false': False, - 'on': True, - 'off': False, - } - - def construct_yaml_bool(self, node): - value = self.construct_scalar(node) - return self.bool_values[value.lower()] - - def construct_yaml_int(self, node): - value = self.construct_scalar(node) - value = value.replace('_', '') - sign = +1 - if value[0] == '-': - sign = -1 - if value[0] in '+-': - value = value[1:] - if value == '0': - return 0 - elif value.startswith('0b'): - return sign*int(value[2:], 2) - elif value.startswith('0x'): - return sign*int(value[2:], 16) - elif value[0] == '0': - return sign*int(value, 8) - elif ':' in value: - digits = [int(part) for part in value.split(':')] - digits.reverse() - base = 1 - value = 0 - for digit in digits: - value += digit*base - base *= 60 - return sign*value - else: - return sign*int(value) - - inf_value = 1e300 - while inf_value != inf_value*inf_value: - inf_value *= inf_value - nan_value = -inf_value/inf_value # Trying to make a quiet NaN (like C99). - - def construct_yaml_float(self, node): - value = self.construct_scalar(node) - value = value.replace('_', '').lower() - sign = +1 - if value[0] == '-': - sign = -1 - if value[0] in '+-': - value = value[1:] - if value == '.inf': - return sign*self.inf_value - elif value == '.nan': - return self.nan_value - elif ':' in value: - digits = [float(part) for part in value.split(':')] - digits.reverse() - base = 1 - value = 0.0 - for digit in digits: - value += digit*base - base *= 60 - return sign*value - else: - return sign*float(value) - - def construct_yaml_binary(self, node): - try: - value = self.construct_scalar(node).encode('ascii') - except UnicodeEncodeError as exc: - raise ConstructorError(None, None, - "failed to convert base64 data into ascii: %s" % exc, - node.start_mark) - try: - if hasattr(base64, 'decodebytes'): - return base64.decodebytes(value) - else: - return base64.decodestring(value) - except binascii.Error as exc: - raise ConstructorError(None, None, - "failed to decode base64 data: %s" % exc, node.start_mark) - - timestamp_regexp = re.compile( - r'''^(?P[0-9][0-9][0-9][0-9]) - -(?P[0-9][0-9]?) - -(?P[0-9][0-9]?) - (?:(?:[Tt]|[ \t]+) - (?P[0-9][0-9]?) - :(?P[0-9][0-9]) - :(?P[0-9][0-9]) - (?:\.(?P[0-9]*))? - (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) - (?::(?P[0-9][0-9]))?))?)?$''', re.X) - - def construct_yaml_timestamp(self, node): - value = self.construct_scalar(node) - match = self.timestamp_regexp.match(node.value) - values = match.groupdict() - year = int(values['year']) - month = int(values['month']) - day = int(values['day']) - if not values['hour']: - return datetime.date(year, month, day) - hour = int(values['hour']) - minute = int(values['minute']) - second = int(values['second']) - fraction = 0 - tzinfo = None - if values['fraction']: - fraction = values['fraction'][:6] - while len(fraction) < 6: - fraction += '0' - fraction = int(fraction) - if values['tz_sign']: - tz_hour = int(values['tz_hour']) - tz_minute = int(values['tz_minute'] or 0) - delta = datetime.timedelta(hours=tz_hour, minutes=tz_minute) - if values['tz_sign'] == '-': - delta = -delta - tzinfo = datetime.timezone(delta) - elif values['tz']: - tzinfo = datetime.timezone.utc - return datetime.datetime(year, month, day, hour, minute, second, fraction, - tzinfo=tzinfo) - - def construct_yaml_omap(self, node): - # Note: we do not check for duplicate keys, because it's too - # CPU-expensive. - omap = [] - yield omap - if not isinstance(node, SequenceNode): - raise ConstructorError("while constructing an ordered map", node.start_mark, - "expected a sequence, but found %s" % node.id, node.start_mark) - for subnode in node.value: - if not isinstance(subnode, MappingNode): - raise ConstructorError("while constructing an ordered map", node.start_mark, - "expected a mapping of length 1, but found %s" % subnode.id, - subnode.start_mark) - if len(subnode.value) != 1: - raise ConstructorError("while constructing an ordered map", node.start_mark, - "expected a single mapping item, but found %d items" % len(subnode.value), - subnode.start_mark) - key_node, value_node = subnode.value[0] - key = self.construct_object(key_node) - value = self.construct_object(value_node) - omap.append((key, value)) - - def construct_yaml_pairs(self, node): - # Note: the same code as `construct_yaml_omap`. - pairs = [] - yield pairs - if not isinstance(node, SequenceNode): - raise ConstructorError("while constructing pairs", node.start_mark, - "expected a sequence, but found %s" % node.id, node.start_mark) - for subnode in node.value: - if not isinstance(subnode, MappingNode): - raise ConstructorError("while constructing pairs", node.start_mark, - "expected a mapping of length 1, but found %s" % subnode.id, - subnode.start_mark) - if len(subnode.value) != 1: - raise ConstructorError("while constructing pairs", node.start_mark, - "expected a single mapping item, but found %d items" % len(subnode.value), - subnode.start_mark) - key_node, value_node = subnode.value[0] - key = self.construct_object(key_node) - value = self.construct_object(value_node) - pairs.append((key, value)) - - def construct_yaml_set(self, node): - data = set() - yield data - value = self.construct_mapping(node) - data.update(value) - - def construct_yaml_str(self, node): - return self.construct_scalar(node) - - def construct_yaml_seq(self, node): - data = [] - yield data - data.extend(self.construct_sequence(node)) - - def construct_yaml_map(self, node): - data = {} - yield data - value = self.construct_mapping(node) - data.update(value) - - def construct_yaml_object(self, node, cls): - data = cls.__new__(cls) - yield data - if hasattr(data, '__setstate__'): - state = self.construct_mapping(node, deep=True) - data.__setstate__(state) - else: - state = self.construct_mapping(node) - data.__dict__.update(state) - - def construct_undefined(self, node): - raise ConstructorError(None, None, - "could not determine a constructor for the tag %r" % node.tag, - node.start_mark) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:null', - SafeConstructor.construct_yaml_null) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:bool', - SafeConstructor.construct_yaml_bool) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:int', - SafeConstructor.construct_yaml_int) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:float', - SafeConstructor.construct_yaml_float) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:binary', - SafeConstructor.construct_yaml_binary) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:timestamp', - SafeConstructor.construct_yaml_timestamp) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:omap', - SafeConstructor.construct_yaml_omap) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:pairs', - SafeConstructor.construct_yaml_pairs) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:set', - SafeConstructor.construct_yaml_set) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:str', - SafeConstructor.construct_yaml_str) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:seq', - SafeConstructor.construct_yaml_seq) - -SafeConstructor.add_constructor( - 'tag:yaml.org,2002:map', - SafeConstructor.construct_yaml_map) - -SafeConstructor.add_constructor(None, - SafeConstructor.construct_undefined) - -class FullConstructor(SafeConstructor): - # 'extend' is blacklisted because it is used by - # construct_python_object_apply to add `listitems` to a newly generate - # python instance - def get_state_keys_blacklist(self): - return ['^extend$', '^__.*__$'] - - def get_state_keys_blacklist_regexp(self): - if not hasattr(self, 'state_keys_blacklist_regexp'): - self.state_keys_blacklist_regexp = re.compile('(' + '|'.join(self.get_state_keys_blacklist()) + ')') - return self.state_keys_blacklist_regexp - - def construct_python_str(self, node): - return self.construct_scalar(node) - - def construct_python_unicode(self, node): - return self.construct_scalar(node) - - def construct_python_bytes(self, node): - try: - value = self.construct_scalar(node).encode('ascii') - except UnicodeEncodeError as exc: - raise ConstructorError(None, None, - "failed to convert base64 data into ascii: %s" % exc, - node.start_mark) - try: - if hasattr(base64, 'decodebytes'): - return base64.decodebytes(value) - else: - return base64.decodestring(value) - except binascii.Error as exc: - raise ConstructorError(None, None, - "failed to decode base64 data: %s" % exc, node.start_mark) - - def construct_python_long(self, node): - return self.construct_yaml_int(node) - - def construct_python_complex(self, node): - return complex(self.construct_scalar(node)) - - def construct_python_tuple(self, node): - return tuple(self.construct_sequence(node)) - - def find_python_module(self, name, mark, unsafe=False): - if not name: - raise ConstructorError("while constructing a Python module", mark, - "expected non-empty name appended to the tag", mark) - if unsafe: - try: - __import__(name) - except ImportError as exc: - raise ConstructorError("while constructing a Python module", mark, - "cannot find module %r (%s)" % (name, exc), mark) - if name not in sys.modules: - raise ConstructorError("while constructing a Python module", mark, - "module %r is not imported" % name, mark) - return sys.modules[name] - - def find_python_name(self, name, mark, unsafe=False): - if not name: - raise ConstructorError("while constructing a Python object", mark, - "expected non-empty name appended to the tag", mark) - if '.' in name: - module_name, object_name = name.rsplit('.', 1) - else: - module_name = 'builtins' - object_name = name - if unsafe: - try: - __import__(module_name) - except ImportError as exc: - raise ConstructorError("while constructing a Python object", mark, - "cannot find module %r (%s)" % (module_name, exc), mark) - if module_name not in sys.modules: - raise ConstructorError("while constructing a Python object", mark, - "module %r is not imported" % module_name, mark) - module = sys.modules[module_name] - if not hasattr(module, object_name): - raise ConstructorError("while constructing a Python object", mark, - "cannot find %r in the module %r" - % (object_name, module.__name__), mark) - return getattr(module, object_name) - - def construct_python_name(self, suffix, node): - value = self.construct_scalar(node) - if value: - raise ConstructorError("while constructing a Python name", node.start_mark, - "expected the empty value, but found %r" % value, node.start_mark) - return self.find_python_name(suffix, node.start_mark) - - def construct_python_module(self, suffix, node): - value = self.construct_scalar(node) - if value: - raise ConstructorError("while constructing a Python module", node.start_mark, - "expected the empty value, but found %r" % value, node.start_mark) - return self.find_python_module(suffix, node.start_mark) - - def make_python_instance(self, suffix, node, - args=None, kwds=None, newobj=False, unsafe=False): - if not args: - args = [] - if not kwds: - kwds = {} - cls = self.find_python_name(suffix, node.start_mark) - if not (unsafe or isinstance(cls, type)): - raise ConstructorError("while constructing a Python instance", node.start_mark, - "expected a class, but found %r" % type(cls), - node.start_mark) - if newobj and isinstance(cls, type): - return cls.__new__(cls, *args, **kwds) - else: - return cls(*args, **kwds) - - def set_python_instance_state(self, instance, state, unsafe=False): - if hasattr(instance, '__setstate__'): - instance.__setstate__(state) - else: - slotstate = {} - if isinstance(state, tuple) and len(state) == 2: - state, slotstate = state - if hasattr(instance, '__dict__'): - if not unsafe and state: - for key in state.keys(): - self.check_state_key(key) - instance.__dict__.update(state) - elif state: - slotstate.update(state) - for key, value in slotstate.items(): - if not unsafe: - self.check_state_key(key) - setattr(instance, key, value) - - def construct_python_object(self, suffix, node): - # Format: - # !!python/object:module.name { ... state ... } - instance = self.make_python_instance(suffix, node, newobj=True) - yield instance - deep = hasattr(instance, '__setstate__') - state = self.construct_mapping(node, deep=deep) - self.set_python_instance_state(instance, state) - - def construct_python_object_apply(self, suffix, node, newobj=False): - # Format: - # !!python/object/apply # (or !!python/object/new) - # args: [ ... arguments ... ] - # kwds: { ... keywords ... } - # state: ... state ... - # listitems: [ ... listitems ... ] - # dictitems: { ... dictitems ... } - # or short format: - # !!python/object/apply [ ... arguments ... ] - # The difference between !!python/object/apply and !!python/object/new - # is how an object is created, check make_python_instance for details. - if isinstance(node, SequenceNode): - args = self.construct_sequence(node, deep=True) - kwds = {} - state = {} - listitems = [] - dictitems = {} - else: - value = self.construct_mapping(node, deep=True) - args = value.get('args', []) - kwds = value.get('kwds', {}) - state = value.get('state', {}) - listitems = value.get('listitems', []) - dictitems = value.get('dictitems', {}) - instance = self.make_python_instance(suffix, node, args, kwds, newobj) - if state: - self.set_python_instance_state(instance, state) - if listitems: - instance.extend(listitems) - if dictitems: - for key in dictitems: - instance[key] = dictitems[key] - return instance - - def construct_python_object_new(self, suffix, node): - return self.construct_python_object_apply(suffix, node, newobj=True) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/none', - FullConstructor.construct_yaml_null) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/bool', - FullConstructor.construct_yaml_bool) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/str', - FullConstructor.construct_python_str) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/unicode', - FullConstructor.construct_python_unicode) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/bytes', - FullConstructor.construct_python_bytes) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/int', - FullConstructor.construct_yaml_int) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/long', - FullConstructor.construct_python_long) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/float', - FullConstructor.construct_yaml_float) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/complex', - FullConstructor.construct_python_complex) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/list', - FullConstructor.construct_yaml_seq) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/tuple', - FullConstructor.construct_python_tuple) - -FullConstructor.add_constructor( - 'tag:yaml.org,2002:python/dict', - FullConstructor.construct_yaml_map) - -FullConstructor.add_multi_constructor( - 'tag:yaml.org,2002:python/name:', - FullConstructor.construct_python_name) - -class UnsafeConstructor(FullConstructor): - - def find_python_module(self, name, mark): - return super(UnsafeConstructor, self).find_python_module(name, mark, unsafe=True) - - def find_python_name(self, name, mark): - return super(UnsafeConstructor, self).find_python_name(name, mark, unsafe=True) - - def make_python_instance(self, suffix, node, args=None, kwds=None, newobj=False): - return super(UnsafeConstructor, self).make_python_instance( - suffix, node, args, kwds, newobj, unsafe=True) - - def set_python_instance_state(self, instance, state): - return super(UnsafeConstructor, self).set_python_instance_state( - instance, state, unsafe=True) - -UnsafeConstructor.add_multi_constructor( - 'tag:yaml.org,2002:python/module:', - UnsafeConstructor.construct_python_module) - -UnsafeConstructor.add_multi_constructor( - 'tag:yaml.org,2002:python/object:', - UnsafeConstructor.construct_python_object) - -UnsafeConstructor.add_multi_constructor( - 'tag:yaml.org,2002:python/object/new:', - UnsafeConstructor.construct_python_object_new) - -UnsafeConstructor.add_multi_constructor( - 'tag:yaml.org,2002:python/object/apply:', - UnsafeConstructor.construct_python_object_apply) - -# Constructor is same as UnsafeConstructor. Need to leave this in place in case -# people have extended it directly. -class Constructor(UnsafeConstructor): - pass diff --git a/venv/lib/python3.8/site-packages/yaml/cyaml.py b/venv/lib/python3.8/site-packages/yaml/cyaml.py deleted file mode 100644 index 0c21345879b298bb8668201bebe7d289586b17f9..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/cyaml.py +++ /dev/null @@ -1,101 +0,0 @@ - -__all__ = [ - 'CBaseLoader', 'CSafeLoader', 'CFullLoader', 'CUnsafeLoader', 'CLoader', - 'CBaseDumper', 'CSafeDumper', 'CDumper' -] - -from yaml._yaml import CParser, CEmitter - -from .constructor import * - -from .serializer import * -from .representer import * - -from .resolver import * - -class CBaseLoader(CParser, BaseConstructor, BaseResolver): - - def __init__(self, stream): - CParser.__init__(self, stream) - BaseConstructor.__init__(self) - BaseResolver.__init__(self) - -class CSafeLoader(CParser, SafeConstructor, Resolver): - - def __init__(self, stream): - CParser.__init__(self, stream) - SafeConstructor.__init__(self) - Resolver.__init__(self) - -class CFullLoader(CParser, FullConstructor, Resolver): - - def __init__(self, stream): - CParser.__init__(self, stream) - FullConstructor.__init__(self) - Resolver.__init__(self) - -class CUnsafeLoader(CParser, UnsafeConstructor, Resolver): - - def __init__(self, stream): - CParser.__init__(self, stream) - UnsafeConstructor.__init__(self) - Resolver.__init__(self) - -class CLoader(CParser, Constructor, Resolver): - - def __init__(self, stream): - CParser.__init__(self, stream) - Constructor.__init__(self) - Resolver.__init__(self) - -class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): - - def __init__(self, stream, - default_style=None, default_flow_style=False, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None, - encoding=None, explicit_start=None, explicit_end=None, - version=None, tags=None, sort_keys=True): - CEmitter.__init__(self, stream, canonical=canonical, - indent=indent, width=width, encoding=encoding, - allow_unicode=allow_unicode, line_break=line_break, - explicit_start=explicit_start, explicit_end=explicit_end, - version=version, tags=tags) - Representer.__init__(self, default_style=default_style, - default_flow_style=default_flow_style, sort_keys=sort_keys) - Resolver.__init__(self) - -class CSafeDumper(CEmitter, SafeRepresenter, Resolver): - - def __init__(self, stream, - default_style=None, default_flow_style=False, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None, - encoding=None, explicit_start=None, explicit_end=None, - version=None, tags=None, sort_keys=True): - CEmitter.__init__(self, stream, canonical=canonical, - indent=indent, width=width, encoding=encoding, - allow_unicode=allow_unicode, line_break=line_break, - explicit_start=explicit_start, explicit_end=explicit_end, - version=version, tags=tags) - SafeRepresenter.__init__(self, default_style=default_style, - default_flow_style=default_flow_style, sort_keys=sort_keys) - Resolver.__init__(self) - -class CDumper(CEmitter, Serializer, Representer, Resolver): - - def __init__(self, stream, - default_style=None, default_flow_style=False, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None, - encoding=None, explicit_start=None, explicit_end=None, - version=None, tags=None, sort_keys=True): - CEmitter.__init__(self, stream, canonical=canonical, - indent=indent, width=width, encoding=encoding, - allow_unicode=allow_unicode, line_break=line_break, - explicit_start=explicit_start, explicit_end=explicit_end, - version=version, tags=tags) - Representer.__init__(self, default_style=default_style, - default_flow_style=default_flow_style, sort_keys=sort_keys) - Resolver.__init__(self) - diff --git a/venv/lib/python3.8/site-packages/yaml/dumper.py b/venv/lib/python3.8/site-packages/yaml/dumper.py deleted file mode 100644 index 6aadba551f3836b02f4752277f4b3027073defad..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/dumper.py +++ /dev/null @@ -1,62 +0,0 @@ - -__all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] - -from .emitter import * -from .serializer import * -from .representer import * -from .resolver import * - -class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): - - def __init__(self, stream, - default_style=None, default_flow_style=False, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None, - encoding=None, explicit_start=None, explicit_end=None, - version=None, tags=None, sort_keys=True): - Emitter.__init__(self, stream, canonical=canonical, - indent=indent, width=width, - allow_unicode=allow_unicode, line_break=line_break) - Serializer.__init__(self, encoding=encoding, - explicit_start=explicit_start, explicit_end=explicit_end, - version=version, tags=tags) - Representer.__init__(self, default_style=default_style, - default_flow_style=default_flow_style, sort_keys=sort_keys) - Resolver.__init__(self) - -class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): - - def __init__(self, stream, - default_style=None, default_flow_style=False, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None, - encoding=None, explicit_start=None, explicit_end=None, - version=None, tags=None, sort_keys=True): - Emitter.__init__(self, stream, canonical=canonical, - indent=indent, width=width, - allow_unicode=allow_unicode, line_break=line_break) - Serializer.__init__(self, encoding=encoding, - explicit_start=explicit_start, explicit_end=explicit_end, - version=version, tags=tags) - SafeRepresenter.__init__(self, default_style=default_style, - default_flow_style=default_flow_style, sort_keys=sort_keys) - Resolver.__init__(self) - -class Dumper(Emitter, Serializer, Representer, Resolver): - - def __init__(self, stream, - default_style=None, default_flow_style=False, - canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None, - encoding=None, explicit_start=None, explicit_end=None, - version=None, tags=None, sort_keys=True): - Emitter.__init__(self, stream, canonical=canonical, - indent=indent, width=width, - allow_unicode=allow_unicode, line_break=line_break) - Serializer.__init__(self, encoding=encoding, - explicit_start=explicit_start, explicit_end=explicit_end, - version=version, tags=tags) - Representer.__init__(self, default_style=default_style, - default_flow_style=default_flow_style, sort_keys=sort_keys) - Resolver.__init__(self) - diff --git a/venv/lib/python3.8/site-packages/yaml/emitter.py b/venv/lib/python3.8/site-packages/yaml/emitter.py deleted file mode 100644 index a664d011162af69184df2f8e59ab7feec818f7c7..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/emitter.py +++ /dev/null @@ -1,1137 +0,0 @@ - -# Emitter expects events obeying the following grammar: -# stream ::= STREAM-START document* STREAM-END -# document ::= DOCUMENT-START node DOCUMENT-END -# node ::= SCALAR | sequence | mapping -# sequence ::= SEQUENCE-START node* SEQUENCE-END -# mapping ::= MAPPING-START (node node)* MAPPING-END - -__all__ = ['Emitter', 'EmitterError'] - -from .error import YAMLError -from .events import * - -class EmitterError(YAMLError): - pass - -class ScalarAnalysis: - def __init__(self, scalar, empty, multiline, - allow_flow_plain, allow_block_plain, - allow_single_quoted, allow_double_quoted, - allow_block): - self.scalar = scalar - self.empty = empty - self.multiline = multiline - self.allow_flow_plain = allow_flow_plain - self.allow_block_plain = allow_block_plain - self.allow_single_quoted = allow_single_quoted - self.allow_double_quoted = allow_double_quoted - self.allow_block = allow_block - -class Emitter: - - DEFAULT_TAG_PREFIXES = { - '!' : '!', - 'tag:yaml.org,2002:' : '!!', - } - - def __init__(self, stream, canonical=None, indent=None, width=None, - allow_unicode=None, line_break=None): - - # The stream should have the methods `write` and possibly `flush`. - self.stream = stream - - # Encoding can be overridden by STREAM-START. - self.encoding = None - - # Emitter is a state machine with a stack of states to handle nested - # structures. - self.states = [] - self.state = self.expect_stream_start - - # Current event and the event queue. - self.events = [] - self.event = None - - # The current indentation level and the stack of previous indents. - self.indents = [] - self.indent = None - - # Flow level. - self.flow_level = 0 - - # Contexts. - self.root_context = False - self.sequence_context = False - self.mapping_context = False - self.simple_key_context = False - - # Characteristics of the last emitted character: - # - current position. - # - is it a whitespace? - # - is it an indention character - # (indentation space, '-', '?', or ':')? - self.line = 0 - self.column = 0 - self.whitespace = True - self.indention = True - - # Whether the document requires an explicit document indicator - self.open_ended = False - - # Formatting details. - self.canonical = canonical - self.allow_unicode = allow_unicode - self.best_indent = 2 - if indent and 1 < indent < 10: - self.best_indent = indent - self.best_width = 80 - if width and width > self.best_indent*2: - self.best_width = width - self.best_line_break = '\n' - if line_break in ['\r', '\n', '\r\n']: - self.best_line_break = line_break - - # Tag prefixes. - self.tag_prefixes = None - - # Prepared anchor and tag. - self.prepared_anchor = None - self.prepared_tag = None - - # Scalar analysis and style. - self.analysis = None - self.style = None - - def dispose(self): - # Reset the state attributes (to clear self-references) - self.states = [] - self.state = None - - def emit(self, event): - self.events.append(event) - while not self.need_more_events(): - self.event = self.events.pop(0) - self.state() - self.event = None - - # In some cases, we wait for a few next events before emitting. - - def need_more_events(self): - if not self.events: - return True - event = self.events[0] - if isinstance(event, DocumentStartEvent): - return self.need_events(1) - elif isinstance(event, SequenceStartEvent): - return self.need_events(2) - elif isinstance(event, MappingStartEvent): - return self.need_events(3) - else: - return False - - def need_events(self, count): - level = 0 - for event in self.events[1:]: - if isinstance(event, (DocumentStartEvent, CollectionStartEvent)): - level += 1 - elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)): - level -= 1 - elif isinstance(event, StreamEndEvent): - level = -1 - if level < 0: - return False - return (len(self.events) < count+1) - - def increase_indent(self, flow=False, indentless=False): - self.indents.append(self.indent) - if self.indent is None: - if flow: - self.indent = self.best_indent - else: - self.indent = 0 - elif not indentless: - self.indent += self.best_indent - - # States. - - # Stream handlers. - - def expect_stream_start(self): - if isinstance(self.event, StreamStartEvent): - if self.event.encoding and not hasattr(self.stream, 'encoding'): - self.encoding = self.event.encoding - self.write_stream_start() - self.state = self.expect_first_document_start - else: - raise EmitterError("expected StreamStartEvent, but got %s" - % self.event) - - def expect_nothing(self): - raise EmitterError("expected nothing, but got %s" % self.event) - - # Document handlers. - - def expect_first_document_start(self): - return self.expect_document_start(first=True) - - def expect_document_start(self, first=False): - if isinstance(self.event, DocumentStartEvent): - if (self.event.version or self.event.tags) and self.open_ended: - self.write_indicator('...', True) - self.write_indent() - if self.event.version: - version_text = self.prepare_version(self.event.version) - self.write_version_directive(version_text) - self.tag_prefixes = self.DEFAULT_TAG_PREFIXES.copy() - if self.event.tags: - handles = sorted(self.event.tags.keys()) - for handle in handles: - prefix = self.event.tags[handle] - self.tag_prefixes[prefix] = handle - handle_text = self.prepare_tag_handle(handle) - prefix_text = self.prepare_tag_prefix(prefix) - self.write_tag_directive(handle_text, prefix_text) - implicit = (first and not self.event.explicit and not self.canonical - and not self.event.version and not self.event.tags - and not self.check_empty_document()) - if not implicit: - self.write_indent() - self.write_indicator('---', True) - if self.canonical: - self.write_indent() - self.state = self.expect_document_root - elif isinstance(self.event, StreamEndEvent): - if self.open_ended: - self.write_indicator('...', True) - self.write_indent() - self.write_stream_end() - self.state = self.expect_nothing - else: - raise EmitterError("expected DocumentStartEvent, but got %s" - % self.event) - - def expect_document_end(self): - if isinstance(self.event, DocumentEndEvent): - self.write_indent() - if self.event.explicit: - self.write_indicator('...', True) - self.write_indent() - self.flush_stream() - self.state = self.expect_document_start - else: - raise EmitterError("expected DocumentEndEvent, but got %s" - % self.event) - - def expect_document_root(self): - self.states.append(self.expect_document_end) - self.expect_node(root=True) - - # Node handlers. - - def expect_node(self, root=False, sequence=False, mapping=False, - simple_key=False): - self.root_context = root - self.sequence_context = sequence - self.mapping_context = mapping - self.simple_key_context = simple_key - if isinstance(self.event, AliasEvent): - self.expect_alias() - elif isinstance(self.event, (ScalarEvent, CollectionStartEvent)): - self.process_anchor('&') - self.process_tag() - if isinstance(self.event, ScalarEvent): - self.expect_scalar() - elif isinstance(self.event, SequenceStartEvent): - if self.flow_level or self.canonical or self.event.flow_style \ - or self.check_empty_sequence(): - self.expect_flow_sequence() - else: - self.expect_block_sequence() - elif isinstance(self.event, MappingStartEvent): - if self.flow_level or self.canonical or self.event.flow_style \ - or self.check_empty_mapping(): - self.expect_flow_mapping() - else: - self.expect_block_mapping() - else: - raise EmitterError("expected NodeEvent, but got %s" % self.event) - - def expect_alias(self): - if self.event.anchor is None: - raise EmitterError("anchor is not specified for alias") - self.process_anchor('*') - self.state = self.states.pop() - - def expect_scalar(self): - self.increase_indent(flow=True) - self.process_scalar() - self.indent = self.indents.pop() - self.state = self.states.pop() - - # Flow sequence handlers. - - def expect_flow_sequence(self): - self.write_indicator('[', True, whitespace=True) - self.flow_level += 1 - self.increase_indent(flow=True) - self.state = self.expect_first_flow_sequence_item - - def expect_first_flow_sequence_item(self): - if isinstance(self.event, SequenceEndEvent): - self.indent = self.indents.pop() - self.flow_level -= 1 - self.write_indicator(']', False) - self.state = self.states.pop() - else: - if self.canonical or self.column > self.best_width: - self.write_indent() - self.states.append(self.expect_flow_sequence_item) - self.expect_node(sequence=True) - - def expect_flow_sequence_item(self): - if isinstance(self.event, SequenceEndEvent): - self.indent = self.indents.pop() - self.flow_level -= 1 - if self.canonical: - self.write_indicator(',', False) - self.write_indent() - self.write_indicator(']', False) - self.state = self.states.pop() - else: - self.write_indicator(',', False) - if self.canonical or self.column > self.best_width: - self.write_indent() - self.states.append(self.expect_flow_sequence_item) - self.expect_node(sequence=True) - - # Flow mapping handlers. - - def expect_flow_mapping(self): - self.write_indicator('{', True, whitespace=True) - self.flow_level += 1 - self.increase_indent(flow=True) - self.state = self.expect_first_flow_mapping_key - - def expect_first_flow_mapping_key(self): - if isinstance(self.event, MappingEndEvent): - self.indent = self.indents.pop() - self.flow_level -= 1 - self.write_indicator('}', False) - self.state = self.states.pop() - else: - if self.canonical or self.column > self.best_width: - self.write_indent() - if not self.canonical and self.check_simple_key(): - self.states.append(self.expect_flow_mapping_simple_value) - self.expect_node(mapping=True, simple_key=True) - else: - self.write_indicator('?', True) - self.states.append(self.expect_flow_mapping_value) - self.expect_node(mapping=True) - - def expect_flow_mapping_key(self): - if isinstance(self.event, MappingEndEvent): - self.indent = self.indents.pop() - self.flow_level -= 1 - if self.canonical: - self.write_indicator(',', False) - self.write_indent() - self.write_indicator('}', False) - self.state = self.states.pop() - else: - self.write_indicator(',', False) - if self.canonical or self.column > self.best_width: - self.write_indent() - if not self.canonical and self.check_simple_key(): - self.states.append(self.expect_flow_mapping_simple_value) - self.expect_node(mapping=True, simple_key=True) - else: - self.write_indicator('?', True) - self.states.append(self.expect_flow_mapping_value) - self.expect_node(mapping=True) - - def expect_flow_mapping_simple_value(self): - self.write_indicator(':', False) - self.states.append(self.expect_flow_mapping_key) - self.expect_node(mapping=True) - - def expect_flow_mapping_value(self): - if self.canonical or self.column > self.best_width: - self.write_indent() - self.write_indicator(':', True) - self.states.append(self.expect_flow_mapping_key) - self.expect_node(mapping=True) - - # Block sequence handlers. - - def expect_block_sequence(self): - indentless = (self.mapping_context and not self.indention) - self.increase_indent(flow=False, indentless=indentless) - self.state = self.expect_first_block_sequence_item - - def expect_first_block_sequence_item(self): - return self.expect_block_sequence_item(first=True) - - def expect_block_sequence_item(self, first=False): - if not first and isinstance(self.event, SequenceEndEvent): - self.indent = self.indents.pop() - self.state = self.states.pop() - else: - self.write_indent() - self.write_indicator('-', True, indention=True) - self.states.append(self.expect_block_sequence_item) - self.expect_node(sequence=True) - - # Block mapping handlers. - - def expect_block_mapping(self): - self.increase_indent(flow=False) - self.state = self.expect_first_block_mapping_key - - def expect_first_block_mapping_key(self): - return self.expect_block_mapping_key(first=True) - - def expect_block_mapping_key(self, first=False): - if not first and isinstance(self.event, MappingEndEvent): - self.indent = self.indents.pop() - self.state = self.states.pop() - else: - self.write_indent() - if self.check_simple_key(): - self.states.append(self.expect_block_mapping_simple_value) - self.expect_node(mapping=True, simple_key=True) - else: - self.write_indicator('?', True, indention=True) - self.states.append(self.expect_block_mapping_value) - self.expect_node(mapping=True) - - def expect_block_mapping_simple_value(self): - self.write_indicator(':', False) - self.states.append(self.expect_block_mapping_key) - self.expect_node(mapping=True) - - def expect_block_mapping_value(self): - self.write_indent() - self.write_indicator(':', True, indention=True) - self.states.append(self.expect_block_mapping_key) - self.expect_node(mapping=True) - - # Checkers. - - def check_empty_sequence(self): - return (isinstance(self.event, SequenceStartEvent) and self.events - and isinstance(self.events[0], SequenceEndEvent)) - - def check_empty_mapping(self): - return (isinstance(self.event, MappingStartEvent) and self.events - and isinstance(self.events[0], MappingEndEvent)) - - def check_empty_document(self): - if not isinstance(self.event, DocumentStartEvent) or not self.events: - return False - event = self.events[0] - return (isinstance(event, ScalarEvent) and event.anchor is None - and event.tag is None and event.implicit and event.value == '') - - def check_simple_key(self): - length = 0 - if isinstance(self.event, NodeEvent) and self.event.anchor is not None: - if self.prepared_anchor is None: - self.prepared_anchor = self.prepare_anchor(self.event.anchor) - length += len(self.prepared_anchor) - if isinstance(self.event, (ScalarEvent, CollectionStartEvent)) \ - and self.event.tag is not None: - if self.prepared_tag is None: - self.prepared_tag = self.prepare_tag(self.event.tag) - length += len(self.prepared_tag) - if isinstance(self.event, ScalarEvent): - if self.analysis is None: - self.analysis = self.analyze_scalar(self.event.value) - length += len(self.analysis.scalar) - return (length < 128 and (isinstance(self.event, AliasEvent) - or (isinstance(self.event, ScalarEvent) - and not self.analysis.empty and not self.analysis.multiline) - or self.check_empty_sequence() or self.check_empty_mapping())) - - # Anchor, Tag, and Scalar processors. - - def process_anchor(self, indicator): - if self.event.anchor is None: - self.prepared_anchor = None - return - if self.prepared_anchor is None: - self.prepared_anchor = self.prepare_anchor(self.event.anchor) - if self.prepared_anchor: - self.write_indicator(indicator+self.prepared_anchor, True) - self.prepared_anchor = None - - def process_tag(self): - tag = self.event.tag - if isinstance(self.event, ScalarEvent): - if self.style is None: - self.style = self.choose_scalar_style() - if ((not self.canonical or tag is None) and - ((self.style == '' and self.event.implicit[0]) - or (self.style != '' and self.event.implicit[1]))): - self.prepared_tag = None - return - if self.event.implicit[0] and tag is None: - tag = '!' - self.prepared_tag = None - else: - if (not self.canonical or tag is None) and self.event.implicit: - self.prepared_tag = None - return - if tag is None: - raise EmitterError("tag is not specified") - if self.prepared_tag is None: - self.prepared_tag = self.prepare_tag(tag) - if self.prepared_tag: - self.write_indicator(self.prepared_tag, True) - self.prepared_tag = None - - def choose_scalar_style(self): - if self.analysis is None: - self.analysis = self.analyze_scalar(self.event.value) - if self.event.style == '"' or self.canonical: - return '"' - if not self.event.style and self.event.implicit[0]: - if (not (self.simple_key_context and - (self.analysis.empty or self.analysis.multiline)) - and (self.flow_level and self.analysis.allow_flow_plain - or (not self.flow_level and self.analysis.allow_block_plain))): - return '' - if self.event.style and self.event.style in '|>': - if (not self.flow_level and not self.simple_key_context - and self.analysis.allow_block): - return self.event.style - if not self.event.style or self.event.style == '\'': - if (self.analysis.allow_single_quoted and - not (self.simple_key_context and self.analysis.multiline)): - return '\'' - return '"' - - def process_scalar(self): - if self.analysis is None: - self.analysis = self.analyze_scalar(self.event.value) - if self.style is None: - self.style = self.choose_scalar_style() - split = (not self.simple_key_context) - #if self.analysis.multiline and split \ - # and (not self.style or self.style in '\'\"'): - # self.write_indent() - if self.style == '"': - self.write_double_quoted(self.analysis.scalar, split) - elif self.style == '\'': - self.write_single_quoted(self.analysis.scalar, split) - elif self.style == '>': - self.write_folded(self.analysis.scalar) - elif self.style == '|': - self.write_literal(self.analysis.scalar) - else: - self.write_plain(self.analysis.scalar, split) - self.analysis = None - self.style = None - - # Analyzers. - - def prepare_version(self, version): - major, minor = version - if major != 1: - raise EmitterError("unsupported YAML version: %d.%d" % (major, minor)) - return '%d.%d' % (major, minor) - - def prepare_tag_handle(self, handle): - if not handle: - raise EmitterError("tag handle must not be empty") - if handle[0] != '!' or handle[-1] != '!': - raise EmitterError("tag handle must start and end with '!': %r" % handle) - for ch in handle[1:-1]: - if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ - or ch in '-_'): - raise EmitterError("invalid character %r in the tag handle: %r" - % (ch, handle)) - return handle - - def prepare_tag_prefix(self, prefix): - if not prefix: - raise EmitterError("tag prefix must not be empty") - chunks = [] - start = end = 0 - if prefix[0] == '!': - end = 1 - while end < len(prefix): - ch = prefix[end] - if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ - or ch in '-;/?!:@&=+$,_.~*\'()[]': - end += 1 - else: - if start < end: - chunks.append(prefix[start:end]) - start = end = end+1 - data = ch.encode('utf-8') - for ch in data: - chunks.append('%%%02X' % ord(ch)) - if start < end: - chunks.append(prefix[start:end]) - return ''.join(chunks) - - def prepare_tag(self, tag): - if not tag: - raise EmitterError("tag must not be empty") - if tag == '!': - return tag - handle = None - suffix = tag - prefixes = sorted(self.tag_prefixes.keys()) - for prefix in prefixes: - if tag.startswith(prefix) \ - and (prefix == '!' or len(prefix) < len(tag)): - handle = self.tag_prefixes[prefix] - suffix = tag[len(prefix):] - chunks = [] - start = end = 0 - while end < len(suffix): - ch = suffix[end] - if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ - or ch in '-;/?:@&=+$,_.~*\'()[]' \ - or (ch == '!' and handle != '!'): - end += 1 - else: - if start < end: - chunks.append(suffix[start:end]) - start = end = end+1 - data = ch.encode('utf-8') - for ch in data: - chunks.append('%%%02X' % ch) - if start < end: - chunks.append(suffix[start:end]) - suffix_text = ''.join(chunks) - if handle: - return '%s%s' % (handle, suffix_text) - else: - return '!<%s>' % suffix_text - - def prepare_anchor(self, anchor): - if not anchor: - raise EmitterError("anchor must not be empty") - for ch in anchor: - if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ - or ch in '-_'): - raise EmitterError("invalid character %r in the anchor: %r" - % (ch, anchor)) - return anchor - - def analyze_scalar(self, scalar): - - # Empty scalar is a special case. - if not scalar: - return ScalarAnalysis(scalar=scalar, empty=True, multiline=False, - allow_flow_plain=False, allow_block_plain=True, - allow_single_quoted=True, allow_double_quoted=True, - allow_block=False) - - # Indicators and special characters. - block_indicators = False - flow_indicators = False - line_breaks = False - special_characters = False - - # Important whitespace combinations. - leading_space = False - leading_break = False - trailing_space = False - trailing_break = False - break_space = False - space_break = False - - # Check document indicators. - if scalar.startswith('---') or scalar.startswith('...'): - block_indicators = True - flow_indicators = True - - # First character or preceded by a whitespace. - preceded_by_whitespace = True - - # Last character or followed by a whitespace. - followed_by_whitespace = (len(scalar) == 1 or - scalar[1] in '\0 \t\r\n\x85\u2028\u2029') - - # The previous character is a space. - previous_space = False - - # The previous character is a break. - previous_break = False - - index = 0 - while index < len(scalar): - ch = scalar[index] - - # Check for indicators. - if index == 0: - # Leading indicators are special characters. - if ch in '#,[]{}&*!|>\'\"%@`': - flow_indicators = True - block_indicators = True - if ch in '?:': - flow_indicators = True - if followed_by_whitespace: - block_indicators = True - if ch == '-' and followed_by_whitespace: - flow_indicators = True - block_indicators = True - else: - # Some indicators cannot appear within a scalar as well. - if ch in ',?[]{}': - flow_indicators = True - if ch == ':': - flow_indicators = True - if followed_by_whitespace: - block_indicators = True - if ch == '#' and preceded_by_whitespace: - flow_indicators = True - block_indicators = True - - # Check for line breaks, special, and unicode characters. - if ch in '\n\x85\u2028\u2029': - line_breaks = True - if not (ch == '\n' or '\x20' <= ch <= '\x7E'): - if (ch == '\x85' or '\xA0' <= ch <= '\uD7FF' - or '\uE000' <= ch <= '\uFFFD' - or '\U00010000' <= ch < '\U0010ffff') and ch != '\uFEFF': - unicode_characters = True - if not self.allow_unicode: - special_characters = True - else: - special_characters = True - - # Detect important whitespace combinations. - if ch == ' ': - if index == 0: - leading_space = True - if index == len(scalar)-1: - trailing_space = True - if previous_break: - break_space = True - previous_space = True - previous_break = False - elif ch in '\n\x85\u2028\u2029': - if index == 0: - leading_break = True - if index == len(scalar)-1: - trailing_break = True - if previous_space: - space_break = True - previous_space = False - previous_break = True - else: - previous_space = False - previous_break = False - - # Prepare for the next character. - index += 1 - preceded_by_whitespace = (ch in '\0 \t\r\n\x85\u2028\u2029') - followed_by_whitespace = (index+1 >= len(scalar) or - scalar[index+1] in '\0 \t\r\n\x85\u2028\u2029') - - # Let's decide what styles are allowed. - allow_flow_plain = True - allow_block_plain = True - allow_single_quoted = True - allow_double_quoted = True - allow_block = True - - # Leading and trailing whitespaces are bad for plain scalars. - if (leading_space or leading_break - or trailing_space or trailing_break): - allow_flow_plain = allow_block_plain = False - - # We do not permit trailing spaces for block scalars. - if trailing_space: - allow_block = False - - # Spaces at the beginning of a new line are only acceptable for block - # scalars. - if break_space: - allow_flow_plain = allow_block_plain = allow_single_quoted = False - - # Spaces followed by breaks, as well as special character are only - # allowed for double quoted scalars. - if space_break or special_characters: - allow_flow_plain = allow_block_plain = \ - allow_single_quoted = allow_block = False - - # Although the plain scalar writer supports breaks, we never emit - # multiline plain scalars. - if line_breaks: - allow_flow_plain = allow_block_plain = False - - # Flow indicators are forbidden for flow plain scalars. - if flow_indicators: - allow_flow_plain = False - - # Block indicators are forbidden for block plain scalars. - if block_indicators: - allow_block_plain = False - - return ScalarAnalysis(scalar=scalar, - empty=False, multiline=line_breaks, - allow_flow_plain=allow_flow_plain, - allow_block_plain=allow_block_plain, - allow_single_quoted=allow_single_quoted, - allow_double_quoted=allow_double_quoted, - allow_block=allow_block) - - # Writers. - - def flush_stream(self): - if hasattr(self.stream, 'flush'): - self.stream.flush() - - def write_stream_start(self): - # Write BOM if needed. - if self.encoding and self.encoding.startswith('utf-16'): - self.stream.write('\uFEFF'.encode(self.encoding)) - - def write_stream_end(self): - self.flush_stream() - - def write_indicator(self, indicator, need_whitespace, - whitespace=False, indention=False): - if self.whitespace or not need_whitespace: - data = indicator - else: - data = ' '+indicator - self.whitespace = whitespace - self.indention = self.indention and indention - self.column += len(data) - self.open_ended = False - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - - def write_indent(self): - indent = self.indent or 0 - if not self.indention or self.column > indent \ - or (self.column == indent and not self.whitespace): - self.write_line_break() - if self.column < indent: - self.whitespace = True - data = ' '*(indent-self.column) - self.column = indent - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - - def write_line_break(self, data=None): - if data is None: - data = self.best_line_break - self.whitespace = True - self.indention = True - self.line += 1 - self.column = 0 - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - - def write_version_directive(self, version_text): - data = '%%YAML %s' % version_text - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - self.write_line_break() - - def write_tag_directive(self, handle_text, prefix_text): - data = '%%TAG %s %s' % (handle_text, prefix_text) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - self.write_line_break() - - # Scalar streams. - - def write_single_quoted(self, text, split=True): - self.write_indicator('\'', True) - spaces = False - breaks = False - start = end = 0 - while end <= len(text): - ch = None - if end < len(text): - ch = text[end] - if spaces: - if ch is None or ch != ' ': - if start+1 == end and self.column > self.best_width and split \ - and start != 0 and end != len(text): - self.write_indent() - else: - data = text[start:end] - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - start = end - elif breaks: - if ch is None or ch not in '\n\x85\u2028\u2029': - if text[start] == '\n': - self.write_line_break() - for br in text[start:end]: - if br == '\n': - self.write_line_break() - else: - self.write_line_break(br) - self.write_indent() - start = end - else: - if ch is None or ch in ' \n\x85\u2028\u2029' or ch == '\'': - if start < end: - data = text[start:end] - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - start = end - if ch == '\'': - data = '\'\'' - self.column += 2 - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - start = end + 1 - if ch is not None: - spaces = (ch == ' ') - breaks = (ch in '\n\x85\u2028\u2029') - end += 1 - self.write_indicator('\'', False) - - ESCAPE_REPLACEMENTS = { - '\0': '0', - '\x07': 'a', - '\x08': 'b', - '\x09': 't', - '\x0A': 'n', - '\x0B': 'v', - '\x0C': 'f', - '\x0D': 'r', - '\x1B': 'e', - '\"': '\"', - '\\': '\\', - '\x85': 'N', - '\xA0': '_', - '\u2028': 'L', - '\u2029': 'P', - } - - def write_double_quoted(self, text, split=True): - self.write_indicator('"', True) - start = end = 0 - while end <= len(text): - ch = None - if end < len(text): - ch = text[end] - if ch is None or ch in '"\\\x85\u2028\u2029\uFEFF' \ - or not ('\x20' <= ch <= '\x7E' - or (self.allow_unicode - and ('\xA0' <= ch <= '\uD7FF' - or '\uE000' <= ch <= '\uFFFD'))): - if start < end: - data = text[start:end] - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - start = end - if ch is not None: - if ch in self.ESCAPE_REPLACEMENTS: - data = '\\'+self.ESCAPE_REPLACEMENTS[ch] - elif ch <= '\xFF': - data = '\\x%02X' % ord(ch) - elif ch <= '\uFFFF': - data = '\\u%04X' % ord(ch) - else: - data = '\\U%08X' % ord(ch) - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - start = end+1 - if 0 < end < len(text)-1 and (ch == ' ' or start >= end) \ - and self.column+(end-start) > self.best_width and split: - data = text[start:end]+'\\' - if start < end: - start = end - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - self.write_indent() - self.whitespace = False - self.indention = False - if text[start] == ' ': - data = '\\' - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - end += 1 - self.write_indicator('"', False) - - def determine_block_hints(self, text): - hints = '' - if text: - if text[0] in ' \n\x85\u2028\u2029': - hints += str(self.best_indent) - if text[-1] not in '\n\x85\u2028\u2029': - hints += '-' - elif len(text) == 1 or text[-2] in '\n\x85\u2028\u2029': - hints += '+' - return hints - - def write_folded(self, text): - hints = self.determine_block_hints(text) - self.write_indicator('>'+hints, True) - if hints[-1:] == '+': - self.open_ended = True - self.write_line_break() - leading_space = True - spaces = False - breaks = True - start = end = 0 - while end <= len(text): - ch = None - if end < len(text): - ch = text[end] - if breaks: - if ch is None or ch not in '\n\x85\u2028\u2029': - if not leading_space and ch is not None and ch != ' ' \ - and text[start] == '\n': - self.write_line_break() - leading_space = (ch == ' ') - for br in text[start:end]: - if br == '\n': - self.write_line_break() - else: - self.write_line_break(br) - if ch is not None: - self.write_indent() - start = end - elif spaces: - if ch != ' ': - if start+1 == end and self.column > self.best_width: - self.write_indent() - else: - data = text[start:end] - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - start = end - else: - if ch is None or ch in ' \n\x85\u2028\u2029': - data = text[start:end] - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - if ch is None: - self.write_line_break() - start = end - if ch is not None: - breaks = (ch in '\n\x85\u2028\u2029') - spaces = (ch == ' ') - end += 1 - - def write_literal(self, text): - hints = self.determine_block_hints(text) - self.write_indicator('|'+hints, True) - if hints[-1:] == '+': - self.open_ended = True - self.write_line_break() - breaks = True - start = end = 0 - while end <= len(text): - ch = None - if end < len(text): - ch = text[end] - if breaks: - if ch is None or ch not in '\n\x85\u2028\u2029': - for br in text[start:end]: - if br == '\n': - self.write_line_break() - else: - self.write_line_break(br) - if ch is not None: - self.write_indent() - start = end - else: - if ch is None or ch in '\n\x85\u2028\u2029': - data = text[start:end] - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - if ch is None: - self.write_line_break() - start = end - if ch is not None: - breaks = (ch in '\n\x85\u2028\u2029') - end += 1 - - def write_plain(self, text, split=True): - if self.root_context: - self.open_ended = True - if not text: - return - if not self.whitespace: - data = ' ' - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - self.whitespace = False - self.indention = False - spaces = False - breaks = False - start = end = 0 - while end <= len(text): - ch = None - if end < len(text): - ch = text[end] - if spaces: - if ch != ' ': - if start+1 == end and self.column > self.best_width and split: - self.write_indent() - self.whitespace = False - self.indention = False - else: - data = text[start:end] - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - start = end - elif breaks: - if ch not in '\n\x85\u2028\u2029': - if text[start] == '\n': - self.write_line_break() - for br in text[start:end]: - if br == '\n': - self.write_line_break() - else: - self.write_line_break(br) - self.write_indent() - self.whitespace = False - self.indention = False - start = end - else: - if ch is None or ch in ' \n\x85\u2028\u2029': - data = text[start:end] - self.column += len(data) - if self.encoding: - data = data.encode(self.encoding) - self.stream.write(data) - start = end - if ch is not None: - spaces = (ch == ' ') - breaks = (ch in '\n\x85\u2028\u2029') - end += 1 diff --git a/venv/lib/python3.8/site-packages/yaml/error.py b/venv/lib/python3.8/site-packages/yaml/error.py deleted file mode 100644 index b796b4dc519512c4825ff539a2e6aa20f4d370d0..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/error.py +++ /dev/null @@ -1,75 +0,0 @@ - -__all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] - -class Mark: - - def __init__(self, name, index, line, column, buffer, pointer): - self.name = name - self.index = index - self.line = line - self.column = column - self.buffer = buffer - self.pointer = pointer - - def get_snippet(self, indent=4, max_length=75): - if self.buffer is None: - return None - head = '' - start = self.pointer - while start > 0 and self.buffer[start-1] not in '\0\r\n\x85\u2028\u2029': - start -= 1 - if self.pointer-start > max_length/2-1: - head = ' ... ' - start += 5 - break - tail = '' - end = self.pointer - while end < len(self.buffer) and self.buffer[end] not in '\0\r\n\x85\u2028\u2029': - end += 1 - if end-self.pointer > max_length/2-1: - tail = ' ... ' - end -= 5 - break - snippet = self.buffer[start:end] - return ' '*indent + head + snippet + tail + '\n' \ - + ' '*(indent+self.pointer-start+len(head)) + '^' - - def __str__(self): - snippet = self.get_snippet() - where = " in \"%s\", line %d, column %d" \ - % (self.name, self.line+1, self.column+1) - if snippet is not None: - where += ":\n"+snippet - return where - -class YAMLError(Exception): - pass - -class MarkedYAMLError(YAMLError): - - def __init__(self, context=None, context_mark=None, - problem=None, problem_mark=None, note=None): - self.context = context - self.context_mark = context_mark - self.problem = problem - self.problem_mark = problem_mark - self.note = note - - def __str__(self): - lines = [] - if self.context is not None: - lines.append(self.context) - if self.context_mark is not None \ - and (self.problem is None or self.problem_mark is None - or self.context_mark.name != self.problem_mark.name - or self.context_mark.line != self.problem_mark.line - or self.context_mark.column != self.problem_mark.column): - lines.append(str(self.context_mark)) - if self.problem is not None: - lines.append(self.problem) - if self.problem_mark is not None: - lines.append(str(self.problem_mark)) - if self.note is not None: - lines.append(self.note) - return '\n'.join(lines) - diff --git a/venv/lib/python3.8/site-packages/yaml/events.py b/venv/lib/python3.8/site-packages/yaml/events.py deleted file mode 100644 index f79ad389cb6c9517e391dcd25534866bc9ccd36a..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/events.py +++ /dev/null @@ -1,86 +0,0 @@ - -# Abstract classes. - -class Event(object): - def __init__(self, start_mark=None, end_mark=None): - self.start_mark = start_mark - self.end_mark = end_mark - def __repr__(self): - attributes = [key for key in ['anchor', 'tag', 'implicit', 'value'] - if hasattr(self, key)] - arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) - for key in attributes]) - return '%s(%s)' % (self.__class__.__name__, arguments) - -class NodeEvent(Event): - def __init__(self, anchor, start_mark=None, end_mark=None): - self.anchor = anchor - self.start_mark = start_mark - self.end_mark = end_mark - -class CollectionStartEvent(NodeEvent): - def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None, - flow_style=None): - self.anchor = anchor - self.tag = tag - self.implicit = implicit - self.start_mark = start_mark - self.end_mark = end_mark - self.flow_style = flow_style - -class CollectionEndEvent(Event): - pass - -# Implementations. - -class StreamStartEvent(Event): - def __init__(self, start_mark=None, end_mark=None, encoding=None): - self.start_mark = start_mark - self.end_mark = end_mark - self.encoding = encoding - -class StreamEndEvent(Event): - pass - -class DocumentStartEvent(Event): - def __init__(self, start_mark=None, end_mark=None, - explicit=None, version=None, tags=None): - self.start_mark = start_mark - self.end_mark = end_mark - self.explicit = explicit - self.version = version - self.tags = tags - -class DocumentEndEvent(Event): - def __init__(self, start_mark=None, end_mark=None, - explicit=None): - self.start_mark = start_mark - self.end_mark = end_mark - self.explicit = explicit - -class AliasEvent(NodeEvent): - pass - -class ScalarEvent(NodeEvent): - def __init__(self, anchor, tag, implicit, value, - start_mark=None, end_mark=None, style=None): - self.anchor = anchor - self.tag = tag - self.implicit = implicit - self.value = value - self.start_mark = start_mark - self.end_mark = end_mark - self.style = style - -class SequenceStartEvent(CollectionStartEvent): - pass - -class SequenceEndEvent(CollectionEndEvent): - pass - -class MappingStartEvent(CollectionStartEvent): - pass - -class MappingEndEvent(CollectionEndEvent): - pass - diff --git a/venv/lib/python3.8/site-packages/yaml/loader.py b/venv/lib/python3.8/site-packages/yaml/loader.py deleted file mode 100644 index e90c11224c38e559cdf0cb205f0692ebd4fb8681..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/loader.py +++ /dev/null @@ -1,63 +0,0 @@ - -__all__ = ['BaseLoader', 'FullLoader', 'SafeLoader', 'Loader', 'UnsafeLoader'] - -from .reader import * -from .scanner import * -from .parser import * -from .composer import * -from .constructor import * -from .resolver import * - -class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): - - def __init__(self, stream): - Reader.__init__(self, stream) - Scanner.__init__(self) - Parser.__init__(self) - Composer.__init__(self) - BaseConstructor.__init__(self) - BaseResolver.__init__(self) - -class FullLoader(Reader, Scanner, Parser, Composer, FullConstructor, Resolver): - - def __init__(self, stream): - Reader.__init__(self, stream) - Scanner.__init__(self) - Parser.__init__(self) - Composer.__init__(self) - FullConstructor.__init__(self) - Resolver.__init__(self) - -class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver): - - def __init__(self, stream): - Reader.__init__(self, stream) - Scanner.__init__(self) - Parser.__init__(self) - Composer.__init__(self) - SafeConstructor.__init__(self) - Resolver.__init__(self) - -class Loader(Reader, Scanner, Parser, Composer, Constructor, Resolver): - - def __init__(self, stream): - Reader.__init__(self, stream) - Scanner.__init__(self) - Parser.__init__(self) - Composer.__init__(self) - Constructor.__init__(self) - Resolver.__init__(self) - -# UnsafeLoader is the same as Loader (which is and was always unsafe on -# untrusted input). Use of either Loader or UnsafeLoader should be rare, since -# FullLoad should be able to load almost all YAML safely. Loader is left intact -# to ensure backwards compatibility. -class UnsafeLoader(Reader, Scanner, Parser, Composer, Constructor, Resolver): - - def __init__(self, stream): - Reader.__init__(self, stream) - Scanner.__init__(self) - Parser.__init__(self) - Composer.__init__(self) - Constructor.__init__(self) - Resolver.__init__(self) diff --git a/venv/lib/python3.8/site-packages/yaml/nodes.py b/venv/lib/python3.8/site-packages/yaml/nodes.py deleted file mode 100644 index c4f070c41e1fb1bc01af27d69329e92dded38908..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/nodes.py +++ /dev/null @@ -1,49 +0,0 @@ - -class Node(object): - def __init__(self, tag, value, start_mark, end_mark): - self.tag = tag - self.value = value - self.start_mark = start_mark - self.end_mark = end_mark - def __repr__(self): - value = self.value - #if isinstance(value, list): - # if len(value) == 0: - # value = '' - # elif len(value) == 1: - # value = '<1 item>' - # else: - # value = '<%d items>' % len(value) - #else: - # if len(value) > 75: - # value = repr(value[:70]+u' ... ') - # else: - # value = repr(value) - value = repr(value) - return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) - -class ScalarNode(Node): - id = 'scalar' - def __init__(self, tag, value, - start_mark=None, end_mark=None, style=None): - self.tag = tag - self.value = value - self.start_mark = start_mark - self.end_mark = end_mark - self.style = style - -class CollectionNode(Node): - def __init__(self, tag, value, - start_mark=None, end_mark=None, flow_style=None): - self.tag = tag - self.value = value - self.start_mark = start_mark - self.end_mark = end_mark - self.flow_style = flow_style - -class SequenceNode(CollectionNode): - id = 'sequence' - -class MappingNode(CollectionNode): - id = 'mapping' - diff --git a/venv/lib/python3.8/site-packages/yaml/parser.py b/venv/lib/python3.8/site-packages/yaml/parser.py deleted file mode 100644 index 13a5995d292045d0f865a99abf692bd35dc87814..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/parser.py +++ /dev/null @@ -1,589 +0,0 @@ - -# The following YAML grammar is LL(1) and is parsed by a recursive descent -# parser. -# -# stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -# implicit_document ::= block_node DOCUMENT-END* -# explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -# block_node_or_indentless_sequence ::= -# ALIAS -# | properties (block_content | indentless_block_sequence)? -# | block_content -# | indentless_block_sequence -# block_node ::= ALIAS -# | properties block_content? -# | block_content -# flow_node ::= ALIAS -# | properties flow_content? -# | flow_content -# properties ::= TAG ANCHOR? | ANCHOR TAG? -# block_content ::= block_collection | flow_collection | SCALAR -# flow_content ::= flow_collection | SCALAR -# block_collection ::= block_sequence | block_mapping -# flow_collection ::= flow_sequence | flow_mapping -# block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -# indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -# block_mapping ::= BLOCK-MAPPING_START -# ((KEY block_node_or_indentless_sequence?)? -# (VALUE block_node_or_indentless_sequence?)?)* -# BLOCK-END -# flow_sequence ::= FLOW-SEQUENCE-START -# (flow_sequence_entry FLOW-ENTRY)* -# flow_sequence_entry? -# FLOW-SEQUENCE-END -# flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -# flow_mapping ::= FLOW-MAPPING-START -# (flow_mapping_entry FLOW-ENTRY)* -# flow_mapping_entry? -# FLOW-MAPPING-END -# flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -# -# FIRST sets: -# -# stream: { STREAM-START } -# explicit_document: { DIRECTIVE DOCUMENT-START } -# implicit_document: FIRST(block_node) -# block_node: { ALIAS TAG ANCHOR SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START } -# flow_node: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START } -# block_content: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } -# flow_content: { FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } -# block_collection: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START } -# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } -# block_sequence: { BLOCK-SEQUENCE-START } -# block_mapping: { BLOCK-MAPPING-START } -# block_node_or_indentless_sequence: { ALIAS ANCHOR TAG SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START BLOCK-ENTRY } -# indentless_sequence: { ENTRY } -# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } -# flow_sequence: { FLOW-SEQUENCE-START } -# flow_mapping: { FLOW-MAPPING-START } -# flow_sequence_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY } -# flow_mapping_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY } - -__all__ = ['Parser', 'ParserError'] - -from .error import MarkedYAMLError -from .tokens import * -from .events import * -from .scanner import * - -class ParserError(MarkedYAMLError): - pass - -class Parser: - # Since writing a recursive-descendant parser is a straightforward task, we - # do not give many comments here. - - DEFAULT_TAGS = { - '!': '!', - '!!': 'tag:yaml.org,2002:', - } - - def __init__(self): - self.current_event = None - self.yaml_version = None - self.tag_handles = {} - self.states = [] - self.marks = [] - self.state = self.parse_stream_start - - def dispose(self): - # Reset the state attributes (to clear self-references) - self.states = [] - self.state = None - - def check_event(self, *choices): - # Check the type of the next event. - if self.current_event is None: - if self.state: - self.current_event = self.state() - if self.current_event is not None: - if not choices: - return True - for choice in choices: - if isinstance(self.current_event, choice): - return True - return False - - def peek_event(self): - # Get the next event. - if self.current_event is None: - if self.state: - self.current_event = self.state() - return self.current_event - - def get_event(self): - # Get the next event and proceed further. - if self.current_event is None: - if self.state: - self.current_event = self.state() - value = self.current_event - self.current_event = None - return value - - # stream ::= STREAM-START implicit_document? explicit_document* STREAM-END - # implicit_document ::= block_node DOCUMENT-END* - # explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* - - def parse_stream_start(self): - - # Parse the stream start. - token = self.get_token() - event = StreamStartEvent(token.start_mark, token.end_mark, - encoding=token.encoding) - - # Prepare the next state. - self.state = self.parse_implicit_document_start - - return event - - def parse_implicit_document_start(self): - - # Parse an implicit document. - if not self.check_token(DirectiveToken, DocumentStartToken, - StreamEndToken): - self.tag_handles = self.DEFAULT_TAGS - token = self.peek_token() - start_mark = end_mark = token.start_mark - event = DocumentStartEvent(start_mark, end_mark, - explicit=False) - - # Prepare the next state. - self.states.append(self.parse_document_end) - self.state = self.parse_block_node - - return event - - else: - return self.parse_document_start() - - def parse_document_start(self): - - # Parse any extra document end indicators. - while self.check_token(DocumentEndToken): - self.get_token() - - # Parse an explicit document. - if not self.check_token(StreamEndToken): - token = self.peek_token() - start_mark = token.start_mark - version, tags = self.process_directives() - if not self.check_token(DocumentStartToken): - raise ParserError(None, None, - "expected '', but found %r" - % self.peek_token().id, - self.peek_token().start_mark) - token = self.get_token() - end_mark = token.end_mark - event = DocumentStartEvent(start_mark, end_mark, - explicit=True, version=version, tags=tags) - self.states.append(self.parse_document_end) - self.state = self.parse_document_content - else: - # Parse the end of the stream. - token = self.get_token() - event = StreamEndEvent(token.start_mark, token.end_mark) - assert not self.states - assert not self.marks - self.state = None - return event - - def parse_document_end(self): - - # Parse the document end. - token = self.peek_token() - start_mark = end_mark = token.start_mark - explicit = False - if self.check_token(DocumentEndToken): - token = self.get_token() - end_mark = token.end_mark - explicit = True - event = DocumentEndEvent(start_mark, end_mark, - explicit=explicit) - - # Prepare the next state. - self.state = self.parse_document_start - - return event - - def parse_document_content(self): - if self.check_token(DirectiveToken, - DocumentStartToken, DocumentEndToken, StreamEndToken): - event = self.process_empty_scalar(self.peek_token().start_mark) - self.state = self.states.pop() - return event - else: - return self.parse_block_node() - - def process_directives(self): - self.yaml_version = None - self.tag_handles = {} - while self.check_token(DirectiveToken): - token = self.get_token() - if token.name == 'YAML': - if self.yaml_version is not None: - raise ParserError(None, None, - "found duplicate YAML directive", token.start_mark) - major, minor = token.value - if major != 1: - raise ParserError(None, None, - "found incompatible YAML document (version 1.* is required)", - token.start_mark) - self.yaml_version = token.value - elif token.name == 'TAG': - handle, prefix = token.value - if handle in self.tag_handles: - raise ParserError(None, None, - "duplicate tag handle %r" % handle, - token.start_mark) - self.tag_handles[handle] = prefix - if self.tag_handles: - value = self.yaml_version, self.tag_handles.copy() - else: - value = self.yaml_version, None - for key in self.DEFAULT_TAGS: - if key not in self.tag_handles: - self.tag_handles[key] = self.DEFAULT_TAGS[key] - return value - - # block_node_or_indentless_sequence ::= ALIAS - # | properties (block_content | indentless_block_sequence)? - # | block_content - # | indentless_block_sequence - # block_node ::= ALIAS - # | properties block_content? - # | block_content - # flow_node ::= ALIAS - # | properties flow_content? - # | flow_content - # properties ::= TAG ANCHOR? | ANCHOR TAG? - # block_content ::= block_collection | flow_collection | SCALAR - # flow_content ::= flow_collection | SCALAR - # block_collection ::= block_sequence | block_mapping - # flow_collection ::= flow_sequence | flow_mapping - - def parse_block_node(self): - return self.parse_node(block=True) - - def parse_flow_node(self): - return self.parse_node() - - def parse_block_node_or_indentless_sequence(self): - return self.parse_node(block=True, indentless_sequence=True) - - def parse_node(self, block=False, indentless_sequence=False): - if self.check_token(AliasToken): - token = self.get_token() - event = AliasEvent(token.value, token.start_mark, token.end_mark) - self.state = self.states.pop() - else: - anchor = None - tag = None - start_mark = end_mark = tag_mark = None - if self.check_token(AnchorToken): - token = self.get_token() - start_mark = token.start_mark - end_mark = token.end_mark - anchor = token.value - if self.check_token(TagToken): - token = self.get_token() - tag_mark = token.start_mark - end_mark = token.end_mark - tag = token.value - elif self.check_token(TagToken): - token = self.get_token() - start_mark = tag_mark = token.start_mark - end_mark = token.end_mark - tag = token.value - if self.check_token(AnchorToken): - token = self.get_token() - end_mark = token.end_mark - anchor = token.value - if tag is not None: - handle, suffix = tag - if handle is not None: - if handle not in self.tag_handles: - raise ParserError("while parsing a node", start_mark, - "found undefined tag handle %r" % handle, - tag_mark) - tag = self.tag_handles[handle]+suffix - else: - tag = suffix - #if tag == '!': - # raise ParserError("while parsing a node", start_mark, - # "found non-specific tag '!'", tag_mark, - # "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' and share your opinion.") - if start_mark is None: - start_mark = end_mark = self.peek_token().start_mark - event = None - implicit = (tag is None or tag == '!') - if indentless_sequence and self.check_token(BlockEntryToken): - end_mark = self.peek_token().end_mark - event = SequenceStartEvent(anchor, tag, implicit, - start_mark, end_mark) - self.state = self.parse_indentless_sequence_entry - else: - if self.check_token(ScalarToken): - token = self.get_token() - end_mark = token.end_mark - if (token.plain and tag is None) or tag == '!': - implicit = (True, False) - elif tag is None: - implicit = (False, True) - else: - implicit = (False, False) - event = ScalarEvent(anchor, tag, implicit, token.value, - start_mark, end_mark, style=token.style) - self.state = self.states.pop() - elif self.check_token(FlowSequenceStartToken): - end_mark = self.peek_token().end_mark - event = SequenceStartEvent(anchor, tag, implicit, - start_mark, end_mark, flow_style=True) - self.state = self.parse_flow_sequence_first_entry - elif self.check_token(FlowMappingStartToken): - end_mark = self.peek_token().end_mark - event = MappingStartEvent(anchor, tag, implicit, - start_mark, end_mark, flow_style=True) - self.state = self.parse_flow_mapping_first_key - elif block and self.check_token(BlockSequenceStartToken): - end_mark = self.peek_token().start_mark - event = SequenceStartEvent(anchor, tag, implicit, - start_mark, end_mark, flow_style=False) - self.state = self.parse_block_sequence_first_entry - elif block and self.check_token(BlockMappingStartToken): - end_mark = self.peek_token().start_mark - event = MappingStartEvent(anchor, tag, implicit, - start_mark, end_mark, flow_style=False) - self.state = self.parse_block_mapping_first_key - elif anchor is not None or tag is not None: - # Empty scalars are allowed even if a tag or an anchor is - # specified. - event = ScalarEvent(anchor, tag, (implicit, False), '', - start_mark, end_mark) - self.state = self.states.pop() - else: - if block: - node = 'block' - else: - node = 'flow' - token = self.peek_token() - raise ParserError("while parsing a %s node" % node, start_mark, - "expected the node content, but found %r" % token.id, - token.start_mark) - return event - - # block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END - - def parse_block_sequence_first_entry(self): - token = self.get_token() - self.marks.append(token.start_mark) - return self.parse_block_sequence_entry() - - def parse_block_sequence_entry(self): - if self.check_token(BlockEntryToken): - token = self.get_token() - if not self.check_token(BlockEntryToken, BlockEndToken): - self.states.append(self.parse_block_sequence_entry) - return self.parse_block_node() - else: - self.state = self.parse_block_sequence_entry - return self.process_empty_scalar(token.end_mark) - if not self.check_token(BlockEndToken): - token = self.peek_token() - raise ParserError("while parsing a block collection", self.marks[-1], - "expected , but found %r" % token.id, token.start_mark) - token = self.get_token() - event = SequenceEndEvent(token.start_mark, token.end_mark) - self.state = self.states.pop() - self.marks.pop() - return event - - # indentless_sequence ::= (BLOCK-ENTRY block_node?)+ - - def parse_indentless_sequence_entry(self): - if self.check_token(BlockEntryToken): - token = self.get_token() - if not self.check_token(BlockEntryToken, - KeyToken, ValueToken, BlockEndToken): - self.states.append(self.parse_indentless_sequence_entry) - return self.parse_block_node() - else: - self.state = self.parse_indentless_sequence_entry - return self.process_empty_scalar(token.end_mark) - token = self.peek_token() - event = SequenceEndEvent(token.start_mark, token.start_mark) - self.state = self.states.pop() - return event - - # block_mapping ::= BLOCK-MAPPING_START - # ((KEY block_node_or_indentless_sequence?)? - # (VALUE block_node_or_indentless_sequence?)?)* - # BLOCK-END - - def parse_block_mapping_first_key(self): - token = self.get_token() - self.marks.append(token.start_mark) - return self.parse_block_mapping_key() - - def parse_block_mapping_key(self): - if self.check_token(KeyToken): - token = self.get_token() - if not self.check_token(KeyToken, ValueToken, BlockEndToken): - self.states.append(self.parse_block_mapping_value) - return self.parse_block_node_or_indentless_sequence() - else: - self.state = self.parse_block_mapping_value - return self.process_empty_scalar(token.end_mark) - if not self.check_token(BlockEndToken): - token = self.peek_token() - raise ParserError("while parsing a block mapping", self.marks[-1], - "expected , but found %r" % token.id, token.start_mark) - token = self.get_token() - event = MappingEndEvent(token.start_mark, token.end_mark) - self.state = self.states.pop() - self.marks.pop() - return event - - def parse_block_mapping_value(self): - if self.check_token(ValueToken): - token = self.get_token() - if not self.check_token(KeyToken, ValueToken, BlockEndToken): - self.states.append(self.parse_block_mapping_key) - return self.parse_block_node_or_indentless_sequence() - else: - self.state = self.parse_block_mapping_key - return self.process_empty_scalar(token.end_mark) - else: - self.state = self.parse_block_mapping_key - token = self.peek_token() - return self.process_empty_scalar(token.start_mark) - - # flow_sequence ::= FLOW-SEQUENCE-START - # (flow_sequence_entry FLOW-ENTRY)* - # flow_sequence_entry? - # FLOW-SEQUENCE-END - # flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? - # - # Note that while production rules for both flow_sequence_entry and - # flow_mapping_entry are equal, their interpretations are different. - # For `flow_sequence_entry`, the part `KEY flow_node? (VALUE flow_node?)?` - # generate an inline mapping (set syntax). - - def parse_flow_sequence_first_entry(self): - token = self.get_token() - self.marks.append(token.start_mark) - return self.parse_flow_sequence_entry(first=True) - - def parse_flow_sequence_entry(self, first=False): - if not self.check_token(FlowSequenceEndToken): - if not first: - if self.check_token(FlowEntryToken): - self.get_token() - else: - token = self.peek_token() - raise ParserError("while parsing a flow sequence", self.marks[-1], - "expected ',' or ']', but got %r" % token.id, token.start_mark) - - if self.check_token(KeyToken): - token = self.peek_token() - event = MappingStartEvent(None, None, True, - token.start_mark, token.end_mark, - flow_style=True) - self.state = self.parse_flow_sequence_entry_mapping_key - return event - elif not self.check_token(FlowSequenceEndToken): - self.states.append(self.parse_flow_sequence_entry) - return self.parse_flow_node() - token = self.get_token() - event = SequenceEndEvent(token.start_mark, token.end_mark) - self.state = self.states.pop() - self.marks.pop() - return event - - def parse_flow_sequence_entry_mapping_key(self): - token = self.get_token() - if not self.check_token(ValueToken, - FlowEntryToken, FlowSequenceEndToken): - self.states.append(self.parse_flow_sequence_entry_mapping_value) - return self.parse_flow_node() - else: - self.state = self.parse_flow_sequence_entry_mapping_value - return self.process_empty_scalar(token.end_mark) - - def parse_flow_sequence_entry_mapping_value(self): - if self.check_token(ValueToken): - token = self.get_token() - if not self.check_token(FlowEntryToken, FlowSequenceEndToken): - self.states.append(self.parse_flow_sequence_entry_mapping_end) - return self.parse_flow_node() - else: - self.state = self.parse_flow_sequence_entry_mapping_end - return self.process_empty_scalar(token.end_mark) - else: - self.state = self.parse_flow_sequence_entry_mapping_end - token = self.peek_token() - return self.process_empty_scalar(token.start_mark) - - def parse_flow_sequence_entry_mapping_end(self): - self.state = self.parse_flow_sequence_entry - token = self.peek_token() - return MappingEndEvent(token.start_mark, token.start_mark) - - # flow_mapping ::= FLOW-MAPPING-START - # (flow_mapping_entry FLOW-ENTRY)* - # flow_mapping_entry? - # FLOW-MAPPING-END - # flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? - - def parse_flow_mapping_first_key(self): - token = self.get_token() - self.marks.append(token.start_mark) - return self.parse_flow_mapping_key(first=True) - - def parse_flow_mapping_key(self, first=False): - if not self.check_token(FlowMappingEndToken): - if not first: - if self.check_token(FlowEntryToken): - self.get_token() - else: - token = self.peek_token() - raise ParserError("while parsing a flow mapping", self.marks[-1], - "expected ',' or '}', but got %r" % token.id, token.start_mark) - if self.check_token(KeyToken): - token = self.get_token() - if not self.check_token(ValueToken, - FlowEntryToken, FlowMappingEndToken): - self.states.append(self.parse_flow_mapping_value) - return self.parse_flow_node() - else: - self.state = self.parse_flow_mapping_value - return self.process_empty_scalar(token.end_mark) - elif not self.check_token(FlowMappingEndToken): - self.states.append(self.parse_flow_mapping_empty_value) - return self.parse_flow_node() - token = self.get_token() - event = MappingEndEvent(token.start_mark, token.end_mark) - self.state = self.states.pop() - self.marks.pop() - return event - - def parse_flow_mapping_value(self): - if self.check_token(ValueToken): - token = self.get_token() - if not self.check_token(FlowEntryToken, FlowMappingEndToken): - self.states.append(self.parse_flow_mapping_key) - return self.parse_flow_node() - else: - self.state = self.parse_flow_mapping_key - return self.process_empty_scalar(token.end_mark) - else: - self.state = self.parse_flow_mapping_key - token = self.peek_token() - return self.process_empty_scalar(token.start_mark) - - def parse_flow_mapping_empty_value(self): - self.state = self.parse_flow_mapping_key - return self.process_empty_scalar(self.peek_token().start_mark) - - def process_empty_scalar(self, mark): - return ScalarEvent(None, None, (True, False), '', mark, mark) - diff --git a/venv/lib/python3.8/site-packages/yaml/reader.py b/venv/lib/python3.8/site-packages/yaml/reader.py deleted file mode 100644 index 774b0219b5932a0ee1c27e637371de5ba8d9cb16..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/reader.py +++ /dev/null @@ -1,185 +0,0 @@ -# This module contains abstractions for the input stream. You don't have to -# looks further, there are no pretty code. -# -# We define two classes here. -# -# Mark(source, line, column) -# It's just a record and its only use is producing nice error messages. -# Parser does not use it for any other purposes. -# -# Reader(source, data) -# Reader determines the encoding of `data` and converts it to unicode. -# Reader provides the following methods and attributes: -# reader.peek(length=1) - return the next `length` characters -# reader.forward(length=1) - move the current position to `length` characters. -# reader.index - the number of the current character. -# reader.line, stream.column - the line and the column of the current character. - -__all__ = ['Reader', 'ReaderError'] - -from .error import YAMLError, Mark - -import codecs, re - -class ReaderError(YAMLError): - - def __init__(self, name, position, character, encoding, reason): - self.name = name - self.character = character - self.position = position - self.encoding = encoding - self.reason = reason - - def __str__(self): - if isinstance(self.character, bytes): - return "'%s' codec can't decode byte #x%02x: %s\n" \ - " in \"%s\", position %d" \ - % (self.encoding, ord(self.character), self.reason, - self.name, self.position) - else: - return "unacceptable character #x%04x: %s\n" \ - " in \"%s\", position %d" \ - % (self.character, self.reason, - self.name, self.position) - -class Reader(object): - # Reader: - # - determines the data encoding and converts it to a unicode string, - # - checks if characters are in allowed range, - # - adds '\0' to the end. - - # Reader accepts - # - a `bytes` object, - # - a `str` object, - # - a file-like object with its `read` method returning `str`, - # - a file-like object with its `read` method returning `unicode`. - - # Yeah, it's ugly and slow. - - def __init__(self, stream): - self.name = None - self.stream = None - self.stream_pointer = 0 - self.eof = True - self.buffer = '' - self.pointer = 0 - self.raw_buffer = None - self.raw_decode = None - self.encoding = None - self.index = 0 - self.line = 0 - self.column = 0 - if isinstance(stream, str): - self.name = "" - self.check_printable(stream) - self.buffer = stream+'\0' - elif isinstance(stream, bytes): - self.name = "" - self.raw_buffer = stream - self.determine_encoding() - else: - self.stream = stream - self.name = getattr(stream, 'name', "") - self.eof = False - self.raw_buffer = None - self.determine_encoding() - - def peek(self, index=0): - try: - return self.buffer[self.pointer+index] - except IndexError: - self.update(index+1) - return self.buffer[self.pointer+index] - - def prefix(self, length=1): - if self.pointer+length >= len(self.buffer): - self.update(length) - return self.buffer[self.pointer:self.pointer+length] - - def forward(self, length=1): - if self.pointer+length+1 >= len(self.buffer): - self.update(length+1) - while length: - ch = self.buffer[self.pointer] - self.pointer += 1 - self.index += 1 - if ch in '\n\x85\u2028\u2029' \ - or (ch == '\r' and self.buffer[self.pointer] != '\n'): - self.line += 1 - self.column = 0 - elif ch != '\uFEFF': - self.column += 1 - length -= 1 - - def get_mark(self): - if self.stream is None: - return Mark(self.name, self.index, self.line, self.column, - self.buffer, self.pointer) - else: - return Mark(self.name, self.index, self.line, self.column, - None, None) - - def determine_encoding(self): - while not self.eof and (self.raw_buffer is None or len(self.raw_buffer) < 2): - self.update_raw() - if isinstance(self.raw_buffer, bytes): - if self.raw_buffer.startswith(codecs.BOM_UTF16_LE): - self.raw_decode = codecs.utf_16_le_decode - self.encoding = 'utf-16-le' - elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE): - self.raw_decode = codecs.utf_16_be_decode - self.encoding = 'utf-16-be' - else: - self.raw_decode = codecs.utf_8_decode - self.encoding = 'utf-8' - self.update(1) - - NON_PRINTABLE = re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]') - def check_printable(self, data): - match = self.NON_PRINTABLE.search(data) - if match: - character = match.group() - position = self.index+(len(self.buffer)-self.pointer)+match.start() - raise ReaderError(self.name, position, ord(character), - 'unicode', "special characters are not allowed") - - def update(self, length): - if self.raw_buffer is None: - return - self.buffer = self.buffer[self.pointer:] - self.pointer = 0 - while len(self.buffer) < length: - if not self.eof: - self.update_raw() - if self.raw_decode is not None: - try: - data, converted = self.raw_decode(self.raw_buffer, - 'strict', self.eof) - except UnicodeDecodeError as exc: - character = self.raw_buffer[exc.start] - if self.stream is not None: - position = self.stream_pointer-len(self.raw_buffer)+exc.start - else: - position = exc.start - raise ReaderError(self.name, position, character, - exc.encoding, exc.reason) - else: - data = self.raw_buffer - converted = len(data) - self.check_printable(data) - self.buffer += data - self.raw_buffer = self.raw_buffer[converted:] - if self.eof: - self.buffer += '\0' - self.raw_buffer = None - break - - def update_raw(self, size=4096): - data = self.stream.read(size) - if self.raw_buffer is None: - self.raw_buffer = data - else: - self.raw_buffer += data - self.stream_pointer += len(data) - if not data: - self.eof = True diff --git a/venv/lib/python3.8/site-packages/yaml/representer.py b/venv/lib/python3.8/site-packages/yaml/representer.py deleted file mode 100644 index 808ca06dfbd60c9a23eb079151b74a82ef688749..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/representer.py +++ /dev/null @@ -1,389 +0,0 @@ - -__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', - 'RepresenterError'] - -from .error import * -from .nodes import * - -import datetime, copyreg, types, base64, collections - -class RepresenterError(YAMLError): - pass - -class BaseRepresenter: - - yaml_representers = {} - yaml_multi_representers = {} - - def __init__(self, default_style=None, default_flow_style=False, sort_keys=True): - self.default_style = default_style - self.sort_keys = sort_keys - self.default_flow_style = default_flow_style - self.represented_objects = {} - self.object_keeper = [] - self.alias_key = None - - def represent(self, data): - node = self.represent_data(data) - self.serialize(node) - self.represented_objects = {} - self.object_keeper = [] - self.alias_key = None - - def represent_data(self, data): - if self.ignore_aliases(data): - self.alias_key = None - else: - self.alias_key = id(data) - if self.alias_key is not None: - if self.alias_key in self.represented_objects: - node = self.represented_objects[self.alias_key] - #if node is None: - # raise RepresenterError("recursive objects are not allowed: %r" % data) - return node - #self.represented_objects[alias_key] = None - self.object_keeper.append(data) - data_types = type(data).__mro__ - if data_types[0] in self.yaml_representers: - node = self.yaml_representers[data_types[0]](self, data) - else: - for data_type in data_types: - if data_type in self.yaml_multi_representers: - node = self.yaml_multi_representers[data_type](self, data) - break - else: - if None in self.yaml_multi_representers: - node = self.yaml_multi_representers[None](self, data) - elif None in self.yaml_representers: - node = self.yaml_representers[None](self, data) - else: - node = ScalarNode(None, str(data)) - #if alias_key is not None: - # self.represented_objects[alias_key] = node - return node - - @classmethod - def add_representer(cls, data_type, representer): - if not 'yaml_representers' in cls.__dict__: - cls.yaml_representers = cls.yaml_representers.copy() - cls.yaml_representers[data_type] = representer - - @classmethod - def add_multi_representer(cls, data_type, representer): - if not 'yaml_multi_representers' in cls.__dict__: - cls.yaml_multi_representers = cls.yaml_multi_representers.copy() - cls.yaml_multi_representers[data_type] = representer - - def represent_scalar(self, tag, value, style=None): - if style is None: - style = self.default_style - node = ScalarNode(tag, value, style=style) - if self.alias_key is not None: - self.represented_objects[self.alias_key] = node - return node - - def represent_sequence(self, tag, sequence, flow_style=None): - value = [] - node = SequenceNode(tag, value, flow_style=flow_style) - if self.alias_key is not None: - self.represented_objects[self.alias_key] = node - best_style = True - for item in sequence: - node_item = self.represent_data(item) - if not (isinstance(node_item, ScalarNode) and not node_item.style): - best_style = False - value.append(node_item) - if flow_style is None: - if self.default_flow_style is not None: - node.flow_style = self.default_flow_style - else: - node.flow_style = best_style - return node - - def represent_mapping(self, tag, mapping, flow_style=None): - value = [] - node = MappingNode(tag, value, flow_style=flow_style) - if self.alias_key is not None: - self.represented_objects[self.alias_key] = node - best_style = True - if hasattr(mapping, 'items'): - mapping = list(mapping.items()) - if self.sort_keys: - try: - mapping = sorted(mapping) - except TypeError: - pass - for item_key, item_value in mapping: - node_key = self.represent_data(item_key) - node_value = self.represent_data(item_value) - if not (isinstance(node_key, ScalarNode) and not node_key.style): - best_style = False - if not (isinstance(node_value, ScalarNode) and not node_value.style): - best_style = False - value.append((node_key, node_value)) - if flow_style is None: - if self.default_flow_style is not None: - node.flow_style = self.default_flow_style - else: - node.flow_style = best_style - return node - - def ignore_aliases(self, data): - return False - -class SafeRepresenter(BaseRepresenter): - - def ignore_aliases(self, data): - if data is None: - return True - if isinstance(data, tuple) and data == (): - return True - if isinstance(data, (str, bytes, bool, int, float)): - return True - - def represent_none(self, data): - return self.represent_scalar('tag:yaml.org,2002:null', 'null') - - def represent_str(self, data): - return self.represent_scalar('tag:yaml.org,2002:str', data) - - def represent_binary(self, data): - if hasattr(base64, 'encodebytes'): - data = base64.encodebytes(data).decode('ascii') - else: - data = base64.encodestring(data).decode('ascii') - return self.represent_scalar('tag:yaml.org,2002:binary', data, style='|') - - def represent_bool(self, data): - if data: - value = 'true' - else: - value = 'false' - return self.represent_scalar('tag:yaml.org,2002:bool', value) - - def represent_int(self, data): - return self.represent_scalar('tag:yaml.org,2002:int', str(data)) - - inf_value = 1e300 - while repr(inf_value) != repr(inf_value*inf_value): - inf_value *= inf_value - - def represent_float(self, data): - if data != data or (data == 0.0 and data == 1.0): - value = '.nan' - elif data == self.inf_value: - value = '.inf' - elif data == -self.inf_value: - value = '-.inf' - else: - value = repr(data).lower() - # Note that in some cases `repr(data)` represents a float number - # without the decimal parts. For instance: - # >>> repr(1e17) - # '1e17' - # Unfortunately, this is not a valid float representation according - # to the definition of the `!!float` tag. We fix this by adding - # '.0' before the 'e' symbol. - if '.' not in value and 'e' in value: - value = value.replace('e', '.0e', 1) - return self.represent_scalar('tag:yaml.org,2002:float', value) - - def represent_list(self, data): - #pairs = (len(data) > 0 and isinstance(data, list)) - #if pairs: - # for item in data: - # if not isinstance(item, tuple) or len(item) != 2: - # pairs = False - # break - #if not pairs: - return self.represent_sequence('tag:yaml.org,2002:seq', data) - #value = [] - #for item_key, item_value in data: - # value.append(self.represent_mapping(u'tag:yaml.org,2002:map', - # [(item_key, item_value)])) - #return SequenceNode(u'tag:yaml.org,2002:pairs', value) - - def represent_dict(self, data): - return self.represent_mapping('tag:yaml.org,2002:map', data) - - def represent_set(self, data): - value = {} - for key in data: - value[key] = None - return self.represent_mapping('tag:yaml.org,2002:set', value) - - def represent_date(self, data): - value = data.isoformat() - return self.represent_scalar('tag:yaml.org,2002:timestamp', value) - - def represent_datetime(self, data): - value = data.isoformat(' ') - return self.represent_scalar('tag:yaml.org,2002:timestamp', value) - - def represent_yaml_object(self, tag, data, cls, flow_style=None): - if hasattr(data, '__getstate__'): - state = data.__getstate__() - else: - state = data.__dict__.copy() - return self.represent_mapping(tag, state, flow_style=flow_style) - - def represent_undefined(self, data): - raise RepresenterError("cannot represent an object", data) - -SafeRepresenter.add_representer(type(None), - SafeRepresenter.represent_none) - -SafeRepresenter.add_representer(str, - SafeRepresenter.represent_str) - -SafeRepresenter.add_representer(bytes, - SafeRepresenter.represent_binary) - -SafeRepresenter.add_representer(bool, - SafeRepresenter.represent_bool) - -SafeRepresenter.add_representer(int, - SafeRepresenter.represent_int) - -SafeRepresenter.add_representer(float, - SafeRepresenter.represent_float) - -SafeRepresenter.add_representer(list, - SafeRepresenter.represent_list) - -SafeRepresenter.add_representer(tuple, - SafeRepresenter.represent_list) - -SafeRepresenter.add_representer(dict, - SafeRepresenter.represent_dict) - -SafeRepresenter.add_representer(set, - SafeRepresenter.represent_set) - -SafeRepresenter.add_representer(datetime.date, - SafeRepresenter.represent_date) - -SafeRepresenter.add_representer(datetime.datetime, - SafeRepresenter.represent_datetime) - -SafeRepresenter.add_representer(None, - SafeRepresenter.represent_undefined) - -class Representer(SafeRepresenter): - - def represent_complex(self, data): - if data.imag == 0.0: - data = '%r' % data.real - elif data.real == 0.0: - data = '%rj' % data.imag - elif data.imag > 0: - data = '%r+%rj' % (data.real, data.imag) - else: - data = '%r%rj' % (data.real, data.imag) - return self.represent_scalar('tag:yaml.org,2002:python/complex', data) - - def represent_tuple(self, data): - return self.represent_sequence('tag:yaml.org,2002:python/tuple', data) - - def represent_name(self, data): - name = '%s.%s' % (data.__module__, data.__name__) - return self.represent_scalar('tag:yaml.org,2002:python/name:'+name, '') - - def represent_module(self, data): - return self.represent_scalar( - 'tag:yaml.org,2002:python/module:'+data.__name__, '') - - def represent_object(self, data): - # We use __reduce__ API to save the data. data.__reduce__ returns - # a tuple of length 2-5: - # (function, args, state, listitems, dictitems) - - # For reconstructing, we calls function(*args), then set its state, - # listitems, and dictitems if they are not None. - - # A special case is when function.__name__ == '__newobj__'. In this - # case we create the object with args[0].__new__(*args). - - # Another special case is when __reduce__ returns a string - we don't - # support it. - - # We produce a !!python/object, !!python/object/new or - # !!python/object/apply node. - - cls = type(data) - if cls in copyreg.dispatch_table: - reduce = copyreg.dispatch_table[cls](data) - elif hasattr(data, '__reduce_ex__'): - reduce = data.__reduce_ex__(2) - elif hasattr(data, '__reduce__'): - reduce = data.__reduce__() - else: - raise RepresenterError("cannot represent an object", data) - reduce = (list(reduce)+[None]*5)[:5] - function, args, state, listitems, dictitems = reduce - args = list(args) - if state is None: - state = {} - if listitems is not None: - listitems = list(listitems) - if dictitems is not None: - dictitems = dict(dictitems) - if function.__name__ == '__newobj__': - function = args[0] - args = args[1:] - tag = 'tag:yaml.org,2002:python/object/new:' - newobj = True - else: - tag = 'tag:yaml.org,2002:python/object/apply:' - newobj = False - function_name = '%s.%s' % (function.__module__, function.__name__) - if not args and not listitems and not dictitems \ - and isinstance(state, dict) and newobj: - return self.represent_mapping( - 'tag:yaml.org,2002:python/object:'+function_name, state) - if not listitems and not dictitems \ - and isinstance(state, dict) and not state: - return self.represent_sequence(tag+function_name, args) - value = {} - if args: - value['args'] = args - if state or not isinstance(state, dict): - value['state'] = state - if listitems: - value['listitems'] = listitems - if dictitems: - value['dictitems'] = dictitems - return self.represent_mapping(tag+function_name, value) - - def represent_ordered_dict(self, data): - # Provide uniform representation across different Python versions. - data_type = type(data) - tag = 'tag:yaml.org,2002:python/object/apply:%s.%s' \ - % (data_type.__module__, data_type.__name__) - items = [[key, value] for key, value in data.items()] - return self.represent_sequence(tag, [items]) - -Representer.add_representer(complex, - Representer.represent_complex) - -Representer.add_representer(tuple, - Representer.represent_tuple) - -Representer.add_multi_representer(type, - Representer.represent_name) - -Representer.add_representer(collections.OrderedDict, - Representer.represent_ordered_dict) - -Representer.add_representer(types.FunctionType, - Representer.represent_name) - -Representer.add_representer(types.BuiltinFunctionType, - Representer.represent_name) - -Representer.add_representer(types.ModuleType, - Representer.represent_module) - -Representer.add_multi_representer(object, - Representer.represent_object) - diff --git a/venv/lib/python3.8/site-packages/yaml/resolver.py b/venv/lib/python3.8/site-packages/yaml/resolver.py deleted file mode 100644 index 3522bdaaf6358110b608f4e6503b9d314c82d887..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/resolver.py +++ /dev/null @@ -1,227 +0,0 @@ - -__all__ = ['BaseResolver', 'Resolver'] - -from .error import * -from .nodes import * - -import re - -class ResolverError(YAMLError): - pass - -class BaseResolver: - - DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str' - DEFAULT_SEQUENCE_TAG = 'tag:yaml.org,2002:seq' - DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map' - - yaml_implicit_resolvers = {} - yaml_path_resolvers = {} - - def __init__(self): - self.resolver_exact_paths = [] - self.resolver_prefix_paths = [] - - @classmethod - def add_implicit_resolver(cls, tag, regexp, first): - if not 'yaml_implicit_resolvers' in cls.__dict__: - implicit_resolvers = {} - for key in cls.yaml_implicit_resolvers: - implicit_resolvers[key] = cls.yaml_implicit_resolvers[key][:] - cls.yaml_implicit_resolvers = implicit_resolvers - if first is None: - first = [None] - for ch in first: - cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, regexp)) - - @classmethod - def add_path_resolver(cls, tag, path, kind=None): - # Note: `add_path_resolver` is experimental. The API could be changed. - # `new_path` is a pattern that is matched against the path from the - # root to the node that is being considered. `node_path` elements are - # tuples `(node_check, index_check)`. `node_check` is a node class: - # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`. `None` - # matches any kind of a node. `index_check` could be `None`, a boolean - # value, a string value, or a number. `None` and `False` match against - # any _value_ of sequence and mapping nodes. `True` matches against - # any _key_ of a mapping node. A string `index_check` matches against - # a mapping value that corresponds to a scalar key which content is - # equal to the `index_check` value. An integer `index_check` matches - # against a sequence value with the index equal to `index_check`. - if not 'yaml_path_resolvers' in cls.__dict__: - cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy() - new_path = [] - for element in path: - if isinstance(element, (list, tuple)): - if len(element) == 2: - node_check, index_check = element - elif len(element) == 1: - node_check = element[0] - index_check = True - else: - raise ResolverError("Invalid path element: %s" % element) - else: - node_check = None - index_check = element - if node_check is str: - node_check = ScalarNode - elif node_check is list: - node_check = SequenceNode - elif node_check is dict: - node_check = MappingNode - elif node_check not in [ScalarNode, SequenceNode, MappingNode] \ - and not isinstance(node_check, str) \ - and node_check is not None: - raise ResolverError("Invalid node checker: %s" % node_check) - if not isinstance(index_check, (str, int)) \ - and index_check is not None: - raise ResolverError("Invalid index checker: %s" % index_check) - new_path.append((node_check, index_check)) - if kind is str: - kind = ScalarNode - elif kind is list: - kind = SequenceNode - elif kind is dict: - kind = MappingNode - elif kind not in [ScalarNode, SequenceNode, MappingNode] \ - and kind is not None: - raise ResolverError("Invalid node kind: %s" % kind) - cls.yaml_path_resolvers[tuple(new_path), kind] = tag - - def descend_resolver(self, current_node, current_index): - if not self.yaml_path_resolvers: - return - exact_paths = {} - prefix_paths = [] - if current_node: - depth = len(self.resolver_prefix_paths) - for path, kind in self.resolver_prefix_paths[-1]: - if self.check_resolver_prefix(depth, path, kind, - current_node, current_index): - if len(path) > depth: - prefix_paths.append((path, kind)) - else: - exact_paths[kind] = self.yaml_path_resolvers[path, kind] - else: - for path, kind in self.yaml_path_resolvers: - if not path: - exact_paths[kind] = self.yaml_path_resolvers[path, kind] - else: - prefix_paths.append((path, kind)) - self.resolver_exact_paths.append(exact_paths) - self.resolver_prefix_paths.append(prefix_paths) - - def ascend_resolver(self): - if not self.yaml_path_resolvers: - return - self.resolver_exact_paths.pop() - self.resolver_prefix_paths.pop() - - def check_resolver_prefix(self, depth, path, kind, - current_node, current_index): - node_check, index_check = path[depth-1] - if isinstance(node_check, str): - if current_node.tag != node_check: - return - elif node_check is not None: - if not isinstance(current_node, node_check): - return - if index_check is True and current_index is not None: - return - if (index_check is False or index_check is None) \ - and current_index is None: - return - if isinstance(index_check, str): - if not (isinstance(current_index, ScalarNode) - and index_check == current_index.value): - return - elif isinstance(index_check, int) and not isinstance(index_check, bool): - if index_check != current_index: - return - return True - - def resolve(self, kind, value, implicit): - if kind is ScalarNode and implicit[0]: - if value == '': - resolvers = self.yaml_implicit_resolvers.get('', []) - else: - resolvers = self.yaml_implicit_resolvers.get(value[0], []) - wildcard_resolvers = self.yaml_implicit_resolvers.get(None, []) - for tag, regexp in resolvers + wildcard_resolvers: - if regexp.match(value): - return tag - implicit = implicit[1] - if self.yaml_path_resolvers: - exact_paths = self.resolver_exact_paths[-1] - if kind in exact_paths: - return exact_paths[kind] - if None in exact_paths: - return exact_paths[None] - if kind is ScalarNode: - return self.DEFAULT_SCALAR_TAG - elif kind is SequenceNode: - return self.DEFAULT_SEQUENCE_TAG - elif kind is MappingNode: - return self.DEFAULT_MAPPING_TAG - -class Resolver(BaseResolver): - pass - -Resolver.add_implicit_resolver( - 'tag:yaml.org,2002:bool', - re.compile(r'''^(?:yes|Yes|YES|no|No|NO - |true|True|TRUE|false|False|FALSE - |on|On|ON|off|Off|OFF)$''', re.X), - list('yYnNtTfFoO')) - -Resolver.add_implicit_resolver( - 'tag:yaml.org,2002:float', - re.compile(r'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)? - |\.[0-9][0-9_]*(?:[eE][-+][0-9]+)? - |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]* - |[-+]?\.(?:inf|Inf|INF) - |\.(?:nan|NaN|NAN))$''', re.X), - list('-+0123456789.')) - -Resolver.add_implicit_resolver( - 'tag:yaml.org,2002:int', - re.compile(r'''^(?:[-+]?0b[0-1_]+ - |[-+]?0[0-7_]+ - |[-+]?(?:0|[1-9][0-9_]*) - |[-+]?0x[0-9a-fA-F_]+ - |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X), - list('-+0123456789')) - -Resolver.add_implicit_resolver( - 'tag:yaml.org,2002:merge', - re.compile(r'^(?:<<)$'), - ['<']) - -Resolver.add_implicit_resolver( - 'tag:yaml.org,2002:null', - re.compile(r'''^(?: ~ - |null|Null|NULL - | )$''', re.X), - ['~', 'n', 'N', '']) - -Resolver.add_implicit_resolver( - 'tag:yaml.org,2002:timestamp', - re.compile(r'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] - |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? - (?:[Tt]|[ \t]+)[0-9][0-9]? - :[0-9][0-9] :[0-9][0-9] (?:\.[0-9]*)? - (?:[ \t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$''', re.X), - list('0123456789')) - -Resolver.add_implicit_resolver( - 'tag:yaml.org,2002:value', - re.compile(r'^(?:=)$'), - ['=']) - -# The following resolver is only for documentation purposes. It cannot work -# because plain scalars cannot start with '!', '&', or '*'. -Resolver.add_implicit_resolver( - 'tag:yaml.org,2002:yaml', - re.compile(r'^(?:!|&|\*)$'), - list('!&*')) - diff --git a/venv/lib/python3.8/site-packages/yaml/scanner.py b/venv/lib/python3.8/site-packages/yaml/scanner.py deleted file mode 100644 index de925b07f1eaec33c9c305a8a69f9eb7ac5983c5..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/scanner.py +++ /dev/null @@ -1,1435 +0,0 @@ - -# Scanner produces tokens of the following types: -# STREAM-START -# STREAM-END -# DIRECTIVE(name, value) -# DOCUMENT-START -# DOCUMENT-END -# BLOCK-SEQUENCE-START -# BLOCK-MAPPING-START -# BLOCK-END -# FLOW-SEQUENCE-START -# FLOW-MAPPING-START -# FLOW-SEQUENCE-END -# FLOW-MAPPING-END -# BLOCK-ENTRY -# FLOW-ENTRY -# KEY -# VALUE -# ALIAS(value) -# ANCHOR(value) -# TAG(value) -# SCALAR(value, plain, style) -# -# Read comments in the Scanner code for more details. -# - -__all__ = ['Scanner', 'ScannerError'] - -from .error import MarkedYAMLError -from .tokens import * - -class ScannerError(MarkedYAMLError): - pass - -class SimpleKey: - # See below simple keys treatment. - - def __init__(self, token_number, required, index, line, column, mark): - self.token_number = token_number - self.required = required - self.index = index - self.line = line - self.column = column - self.mark = mark - -class Scanner: - - def __init__(self): - """Initialize the scanner.""" - # It is assumed that Scanner and Reader will have a common descendant. - # Reader do the dirty work of checking for BOM and converting the - # input data to Unicode. It also adds NUL to the end. - # - # Reader supports the following methods - # self.peek(i=0) # peek the next i-th character - # self.prefix(l=1) # peek the next l characters - # self.forward(l=1) # read the next l characters and move the pointer. - - # Had we reached the end of the stream? - self.done = False - - # The number of unclosed '{' and '['. `flow_level == 0` means block - # context. - self.flow_level = 0 - - # List of processed tokens that are not yet emitted. - self.tokens = [] - - # Add the STREAM-START token. - self.fetch_stream_start() - - # Number of tokens that were emitted through the `get_token` method. - self.tokens_taken = 0 - - # The current indentation level. - self.indent = -1 - - # Past indentation levels. - self.indents = [] - - # Variables related to simple keys treatment. - - # A simple key is a key that is not denoted by the '?' indicator. - # Example of simple keys: - # --- - # block simple key: value - # ? not a simple key: - # : { flow simple key: value } - # We emit the KEY token before all keys, so when we find a potential - # simple key, we try to locate the corresponding ':' indicator. - # Simple keys should be limited to a single line and 1024 characters. - - # Can a simple key start at the current position? A simple key may - # start: - # - at the beginning of the line, not counting indentation spaces - # (in block context), - # - after '{', '[', ',' (in the flow context), - # - after '?', ':', '-' (in the block context). - # In the block context, this flag also signifies if a block collection - # may start at the current position. - self.allow_simple_key = True - - # Keep track of possible simple keys. This is a dictionary. The key - # is `flow_level`; there can be no more that one possible simple key - # for each level. The value is a SimpleKey record: - # (token_number, required, index, line, column, mark) - # A simple key may start with ALIAS, ANCHOR, TAG, SCALAR(flow), - # '[', or '{' tokens. - self.possible_simple_keys = {} - - # Public methods. - - def check_token(self, *choices): - # Check if the next token is one of the given types. - while self.need_more_tokens(): - self.fetch_more_tokens() - if self.tokens: - if not choices: - return True - for choice in choices: - if isinstance(self.tokens[0], choice): - return True - return False - - def peek_token(self): - # Return the next token, but do not delete if from the queue. - # Return None if no more tokens. - while self.need_more_tokens(): - self.fetch_more_tokens() - if self.tokens: - return self.tokens[0] - else: - return None - - def get_token(self): - # Return the next token. - while self.need_more_tokens(): - self.fetch_more_tokens() - if self.tokens: - self.tokens_taken += 1 - return self.tokens.pop(0) - - # Private methods. - - def need_more_tokens(self): - if self.done: - return False - if not self.tokens: - return True - # The current token may be a potential simple key, so we - # need to look further. - self.stale_possible_simple_keys() - if self.next_possible_simple_key() == self.tokens_taken: - return True - - def fetch_more_tokens(self): - - # Eat whitespaces and comments until we reach the next token. - self.scan_to_next_token() - - # Remove obsolete possible simple keys. - self.stale_possible_simple_keys() - - # Compare the current indentation and column. It may add some tokens - # and decrease the current indentation level. - self.unwind_indent(self.column) - - # Peek the next character. - ch = self.peek() - - # Is it the end of stream? - if ch == '\0': - return self.fetch_stream_end() - - # Is it a directive? - if ch == '%' and self.check_directive(): - return self.fetch_directive() - - # Is it the document start? - if ch == '-' and self.check_document_start(): - return self.fetch_document_start() - - # Is it the document end? - if ch == '.' and self.check_document_end(): - return self.fetch_document_end() - - # TODO: support for BOM within a stream. - #if ch == '\uFEFF': - # return self.fetch_bom() <-- issue BOMToken - - # Note: the order of the following checks is NOT significant. - - # Is it the flow sequence start indicator? - if ch == '[': - return self.fetch_flow_sequence_start() - - # Is it the flow mapping start indicator? - if ch == '{': - return self.fetch_flow_mapping_start() - - # Is it the flow sequence end indicator? - if ch == ']': - return self.fetch_flow_sequence_end() - - # Is it the flow mapping end indicator? - if ch == '}': - return self.fetch_flow_mapping_end() - - # Is it the flow entry indicator? - if ch == ',': - return self.fetch_flow_entry() - - # Is it the block entry indicator? - if ch == '-' and self.check_block_entry(): - return self.fetch_block_entry() - - # Is it the key indicator? - if ch == '?' and self.check_key(): - return self.fetch_key() - - # Is it the value indicator? - if ch == ':' and self.check_value(): - return self.fetch_value() - - # Is it an alias? - if ch == '*': - return self.fetch_alias() - - # Is it an anchor? - if ch == '&': - return self.fetch_anchor() - - # Is it a tag? - if ch == '!': - return self.fetch_tag() - - # Is it a literal scalar? - if ch == '|' and not self.flow_level: - return self.fetch_literal() - - # Is it a folded scalar? - if ch == '>' and not self.flow_level: - return self.fetch_folded() - - # Is it a single quoted scalar? - if ch == '\'': - return self.fetch_single() - - # Is it a double quoted scalar? - if ch == '\"': - return self.fetch_double() - - # It must be a plain scalar then. - if self.check_plain(): - return self.fetch_plain() - - # No? It's an error. Let's produce a nice error message. - raise ScannerError("while scanning for the next token", None, - "found character %r that cannot start any token" % ch, - self.get_mark()) - - # Simple keys treatment. - - def next_possible_simple_key(self): - # Return the number of the nearest possible simple key. Actually we - # don't need to loop through the whole dictionary. We may replace it - # with the following code: - # if not self.possible_simple_keys: - # return None - # return self.possible_simple_keys[ - # min(self.possible_simple_keys.keys())].token_number - min_token_number = None - for level in self.possible_simple_keys: - key = self.possible_simple_keys[level] - if min_token_number is None or key.token_number < min_token_number: - min_token_number = key.token_number - return min_token_number - - def stale_possible_simple_keys(self): - # Remove entries that are no longer possible simple keys. According to - # the YAML specification, simple keys - # - should be limited to a single line, - # - should be no longer than 1024 characters. - # Disabling this procedure will allow simple keys of any length and - # height (may cause problems if indentation is broken though). - for level in list(self.possible_simple_keys): - key = self.possible_simple_keys[level] - if key.line != self.line \ - or self.index-key.index > 1024: - if key.required: - raise ScannerError("while scanning a simple key", key.mark, - "could not find expected ':'", self.get_mark()) - del self.possible_simple_keys[level] - - def save_possible_simple_key(self): - # The next token may start a simple key. We check if it's possible - # and save its position. This function is called for - # ALIAS, ANCHOR, TAG, SCALAR(flow), '[', and '{'. - - # Check if a simple key is required at the current position. - required = not self.flow_level and self.indent == self.column - - # The next token might be a simple key. Let's save it's number and - # position. - if self.allow_simple_key: - self.remove_possible_simple_key() - token_number = self.tokens_taken+len(self.tokens) - key = SimpleKey(token_number, required, - self.index, self.line, self.column, self.get_mark()) - self.possible_simple_keys[self.flow_level] = key - - def remove_possible_simple_key(self): - # Remove the saved possible key position at the current flow level. - if self.flow_level in self.possible_simple_keys: - key = self.possible_simple_keys[self.flow_level] - - if key.required: - raise ScannerError("while scanning a simple key", key.mark, - "could not find expected ':'", self.get_mark()) - - del self.possible_simple_keys[self.flow_level] - - # Indentation functions. - - def unwind_indent(self, column): - - ## In flow context, tokens should respect indentation. - ## Actually the condition should be `self.indent >= column` according to - ## the spec. But this condition will prohibit intuitively correct - ## constructions such as - ## key : { - ## } - #if self.flow_level and self.indent > column: - # raise ScannerError(None, None, - # "invalid indentation or unclosed '[' or '{'", - # self.get_mark()) - - # In the flow context, indentation is ignored. We make the scanner less - # restrictive then specification requires. - if self.flow_level: - return - - # In block context, we may need to issue the BLOCK-END tokens. - while self.indent > column: - mark = self.get_mark() - self.indent = self.indents.pop() - self.tokens.append(BlockEndToken(mark, mark)) - - def add_indent(self, column): - # Check if we need to increase indentation. - if self.indent < column: - self.indents.append(self.indent) - self.indent = column - return True - return False - - # Fetchers. - - def fetch_stream_start(self): - # We always add STREAM-START as the first token and STREAM-END as the - # last token. - - # Read the token. - mark = self.get_mark() - - # Add STREAM-START. - self.tokens.append(StreamStartToken(mark, mark, - encoding=self.encoding)) - - - def fetch_stream_end(self): - - # Set the current indentation to -1. - self.unwind_indent(-1) - - # Reset simple keys. - self.remove_possible_simple_key() - self.allow_simple_key = False - self.possible_simple_keys = {} - - # Read the token. - mark = self.get_mark() - - # Add STREAM-END. - self.tokens.append(StreamEndToken(mark, mark)) - - # The steam is finished. - self.done = True - - def fetch_directive(self): - - # Set the current indentation to -1. - self.unwind_indent(-1) - - # Reset simple keys. - self.remove_possible_simple_key() - self.allow_simple_key = False - - # Scan and add DIRECTIVE. - self.tokens.append(self.scan_directive()) - - def fetch_document_start(self): - self.fetch_document_indicator(DocumentStartToken) - - def fetch_document_end(self): - self.fetch_document_indicator(DocumentEndToken) - - def fetch_document_indicator(self, TokenClass): - - # Set the current indentation to -1. - self.unwind_indent(-1) - - # Reset simple keys. Note that there could not be a block collection - # after '---'. - self.remove_possible_simple_key() - self.allow_simple_key = False - - # Add DOCUMENT-START or DOCUMENT-END. - start_mark = self.get_mark() - self.forward(3) - end_mark = self.get_mark() - self.tokens.append(TokenClass(start_mark, end_mark)) - - def fetch_flow_sequence_start(self): - self.fetch_flow_collection_start(FlowSequenceStartToken) - - def fetch_flow_mapping_start(self): - self.fetch_flow_collection_start(FlowMappingStartToken) - - def fetch_flow_collection_start(self, TokenClass): - - # '[' and '{' may start a simple key. - self.save_possible_simple_key() - - # Increase the flow level. - self.flow_level += 1 - - # Simple keys are allowed after '[' and '{'. - self.allow_simple_key = True - - # Add FLOW-SEQUENCE-START or FLOW-MAPPING-START. - start_mark = self.get_mark() - self.forward() - end_mark = self.get_mark() - self.tokens.append(TokenClass(start_mark, end_mark)) - - def fetch_flow_sequence_end(self): - self.fetch_flow_collection_end(FlowSequenceEndToken) - - def fetch_flow_mapping_end(self): - self.fetch_flow_collection_end(FlowMappingEndToken) - - def fetch_flow_collection_end(self, TokenClass): - - # Reset possible simple key on the current level. - self.remove_possible_simple_key() - - # Decrease the flow level. - self.flow_level -= 1 - - # No simple keys after ']' or '}'. - self.allow_simple_key = False - - # Add FLOW-SEQUENCE-END or FLOW-MAPPING-END. - start_mark = self.get_mark() - self.forward() - end_mark = self.get_mark() - self.tokens.append(TokenClass(start_mark, end_mark)) - - def fetch_flow_entry(self): - - # Simple keys are allowed after ','. - self.allow_simple_key = True - - # Reset possible simple key on the current level. - self.remove_possible_simple_key() - - # Add FLOW-ENTRY. - start_mark = self.get_mark() - self.forward() - end_mark = self.get_mark() - self.tokens.append(FlowEntryToken(start_mark, end_mark)) - - def fetch_block_entry(self): - - # Block context needs additional checks. - if not self.flow_level: - - # Are we allowed to start a new entry? - if not self.allow_simple_key: - raise ScannerError(None, None, - "sequence entries are not allowed here", - self.get_mark()) - - # We may need to add BLOCK-SEQUENCE-START. - if self.add_indent(self.column): - mark = self.get_mark() - self.tokens.append(BlockSequenceStartToken(mark, mark)) - - # It's an error for the block entry to occur in the flow context, - # but we let the parser detect this. - else: - pass - - # Simple keys are allowed after '-'. - self.allow_simple_key = True - - # Reset possible simple key on the current level. - self.remove_possible_simple_key() - - # Add BLOCK-ENTRY. - start_mark = self.get_mark() - self.forward() - end_mark = self.get_mark() - self.tokens.append(BlockEntryToken(start_mark, end_mark)) - - def fetch_key(self): - - # Block context needs additional checks. - if not self.flow_level: - - # Are we allowed to start a key (not necessary a simple)? - if not self.allow_simple_key: - raise ScannerError(None, None, - "mapping keys are not allowed here", - self.get_mark()) - - # We may need to add BLOCK-MAPPING-START. - if self.add_indent(self.column): - mark = self.get_mark() - self.tokens.append(BlockMappingStartToken(mark, mark)) - - # Simple keys are allowed after '?' in the block context. - self.allow_simple_key = not self.flow_level - - # Reset possible simple key on the current level. - self.remove_possible_simple_key() - - # Add KEY. - start_mark = self.get_mark() - self.forward() - end_mark = self.get_mark() - self.tokens.append(KeyToken(start_mark, end_mark)) - - def fetch_value(self): - - # Do we determine a simple key? - if self.flow_level in self.possible_simple_keys: - - # Add KEY. - key = self.possible_simple_keys[self.flow_level] - del self.possible_simple_keys[self.flow_level] - self.tokens.insert(key.token_number-self.tokens_taken, - KeyToken(key.mark, key.mark)) - - # If this key starts a new block mapping, we need to add - # BLOCK-MAPPING-START. - if not self.flow_level: - if self.add_indent(key.column): - self.tokens.insert(key.token_number-self.tokens_taken, - BlockMappingStartToken(key.mark, key.mark)) - - # There cannot be two simple keys one after another. - self.allow_simple_key = False - - # It must be a part of a complex key. - else: - - # Block context needs additional checks. - # (Do we really need them? They will be caught by the parser - # anyway.) - if not self.flow_level: - - # We are allowed to start a complex value if and only if - # we can start a simple key. - if not self.allow_simple_key: - raise ScannerError(None, None, - "mapping values are not allowed here", - self.get_mark()) - - # If this value starts a new block mapping, we need to add - # BLOCK-MAPPING-START. It will be detected as an error later by - # the parser. - if not self.flow_level: - if self.add_indent(self.column): - mark = self.get_mark() - self.tokens.append(BlockMappingStartToken(mark, mark)) - - # Simple keys are allowed after ':' in the block context. - self.allow_simple_key = not self.flow_level - - # Reset possible simple key on the current level. - self.remove_possible_simple_key() - - # Add VALUE. - start_mark = self.get_mark() - self.forward() - end_mark = self.get_mark() - self.tokens.append(ValueToken(start_mark, end_mark)) - - def fetch_alias(self): - - # ALIAS could be a simple key. - self.save_possible_simple_key() - - # No simple keys after ALIAS. - self.allow_simple_key = False - - # Scan and add ALIAS. - self.tokens.append(self.scan_anchor(AliasToken)) - - def fetch_anchor(self): - - # ANCHOR could start a simple key. - self.save_possible_simple_key() - - # No simple keys after ANCHOR. - self.allow_simple_key = False - - # Scan and add ANCHOR. - self.tokens.append(self.scan_anchor(AnchorToken)) - - def fetch_tag(self): - - # TAG could start a simple key. - self.save_possible_simple_key() - - # No simple keys after TAG. - self.allow_simple_key = False - - # Scan and add TAG. - self.tokens.append(self.scan_tag()) - - def fetch_literal(self): - self.fetch_block_scalar(style='|') - - def fetch_folded(self): - self.fetch_block_scalar(style='>') - - def fetch_block_scalar(self, style): - - # A simple key may follow a block scalar. - self.allow_simple_key = True - - # Reset possible simple key on the current level. - self.remove_possible_simple_key() - - # Scan and add SCALAR. - self.tokens.append(self.scan_block_scalar(style)) - - def fetch_single(self): - self.fetch_flow_scalar(style='\'') - - def fetch_double(self): - self.fetch_flow_scalar(style='"') - - def fetch_flow_scalar(self, style): - - # A flow scalar could be a simple key. - self.save_possible_simple_key() - - # No simple keys after flow scalars. - self.allow_simple_key = False - - # Scan and add SCALAR. - self.tokens.append(self.scan_flow_scalar(style)) - - def fetch_plain(self): - - # A plain scalar could be a simple key. - self.save_possible_simple_key() - - # No simple keys after plain scalars. But note that `scan_plain` will - # change this flag if the scan is finished at the beginning of the - # line. - self.allow_simple_key = False - - # Scan and add SCALAR. May change `allow_simple_key`. - self.tokens.append(self.scan_plain()) - - # Checkers. - - def check_directive(self): - - # DIRECTIVE: ^ '%' ... - # The '%' indicator is already checked. - if self.column == 0: - return True - - def check_document_start(self): - - # DOCUMENT-START: ^ '---' (' '|'\n') - if self.column == 0: - if self.prefix(3) == '---' \ - and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': - return True - - def check_document_end(self): - - # DOCUMENT-END: ^ '...' (' '|'\n') - if self.column == 0: - if self.prefix(3) == '...' \ - and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': - return True - - def check_block_entry(self): - - # BLOCK-ENTRY: '-' (' '|'\n') - return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' - - def check_key(self): - - # KEY(flow context): '?' - if self.flow_level: - return True - - # KEY(block context): '?' (' '|'\n') - else: - return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' - - def check_value(self): - - # VALUE(flow context): ':' - if self.flow_level: - return True - - # VALUE(block context): ':' (' '|'\n') - else: - return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' - - def check_plain(self): - - # A plain scalar may start with any non-space character except: - # '-', '?', ':', ',', '[', ']', '{', '}', - # '#', '&', '*', '!', '|', '>', '\'', '\"', - # '%', '@', '`'. - # - # It may also start with - # '-', '?', ':' - # if it is followed by a non-space character. - # - # Note that we limit the last rule to the block context (except the - # '-' character) because we want the flow context to be space - # independent. - ch = self.peek() - return ch not in '\0 \t\r\n\x85\u2028\u2029-?:,[]{}#&*!|>\'\"%@`' \ - or (self.peek(1) not in '\0 \t\r\n\x85\u2028\u2029' - and (ch == '-' or (not self.flow_level and ch in '?:'))) - - # Scanners. - - def scan_to_next_token(self): - # We ignore spaces, line breaks and comments. - # If we find a line break in the block context, we set the flag - # `allow_simple_key` on. - # The byte order mark is stripped if it's the first character in the - # stream. We do not yet support BOM inside the stream as the - # specification requires. Any such mark will be considered as a part - # of the document. - # - # TODO: We need to make tab handling rules more sane. A good rule is - # Tabs cannot precede tokens - # BLOCK-SEQUENCE-START, BLOCK-MAPPING-START, BLOCK-END, - # KEY(block), VALUE(block), BLOCK-ENTRY - # So the checking code is - # if : - # self.allow_simple_keys = False - # We also need to add the check for `allow_simple_keys == True` to - # `unwind_indent` before issuing BLOCK-END. - # Scanners for block, flow, and plain scalars need to be modified. - - if self.index == 0 and self.peek() == '\uFEFF': - self.forward() - found = False - while not found: - while self.peek() == ' ': - self.forward() - if self.peek() == '#': - while self.peek() not in '\0\r\n\x85\u2028\u2029': - self.forward() - if self.scan_line_break(): - if not self.flow_level: - self.allow_simple_key = True - else: - found = True - - def scan_directive(self): - # See the specification for details. - start_mark = self.get_mark() - self.forward() - name = self.scan_directive_name(start_mark) - value = None - if name == 'YAML': - value = self.scan_yaml_directive_value(start_mark) - end_mark = self.get_mark() - elif name == 'TAG': - value = self.scan_tag_directive_value(start_mark) - end_mark = self.get_mark() - else: - end_mark = self.get_mark() - while self.peek() not in '\0\r\n\x85\u2028\u2029': - self.forward() - self.scan_directive_ignored_line(start_mark) - return DirectiveToken(name, value, start_mark, end_mark) - - def scan_directive_name(self, start_mark): - # See the specification for details. - length = 0 - ch = self.peek(length) - while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ - or ch in '-_': - length += 1 - ch = self.peek(length) - if not length: - raise ScannerError("while scanning a directive", start_mark, - "expected alphabetic or numeric character, but found %r" - % ch, self.get_mark()) - value = self.prefix(length) - self.forward(length) - ch = self.peek() - if ch not in '\0 \r\n\x85\u2028\u2029': - raise ScannerError("while scanning a directive", start_mark, - "expected alphabetic or numeric character, but found %r" - % ch, self.get_mark()) - return value - - def scan_yaml_directive_value(self, start_mark): - # See the specification for details. - while self.peek() == ' ': - self.forward() - major = self.scan_yaml_directive_number(start_mark) - if self.peek() != '.': - raise ScannerError("while scanning a directive", start_mark, - "expected a digit or '.', but found %r" % self.peek(), - self.get_mark()) - self.forward() - minor = self.scan_yaml_directive_number(start_mark) - if self.peek() not in '\0 \r\n\x85\u2028\u2029': - raise ScannerError("while scanning a directive", start_mark, - "expected a digit or ' ', but found %r" % self.peek(), - self.get_mark()) - return (major, minor) - - def scan_yaml_directive_number(self, start_mark): - # See the specification for details. - ch = self.peek() - if not ('0' <= ch <= '9'): - raise ScannerError("while scanning a directive", start_mark, - "expected a digit, but found %r" % ch, self.get_mark()) - length = 0 - while '0' <= self.peek(length) <= '9': - length += 1 - value = int(self.prefix(length)) - self.forward(length) - return value - - def scan_tag_directive_value(self, start_mark): - # See the specification for details. - while self.peek() == ' ': - self.forward() - handle = self.scan_tag_directive_handle(start_mark) - while self.peek() == ' ': - self.forward() - prefix = self.scan_tag_directive_prefix(start_mark) - return (handle, prefix) - - def scan_tag_directive_handle(self, start_mark): - # See the specification for details. - value = self.scan_tag_handle('directive', start_mark) - ch = self.peek() - if ch != ' ': - raise ScannerError("while scanning a directive", start_mark, - "expected ' ', but found %r" % ch, self.get_mark()) - return value - - def scan_tag_directive_prefix(self, start_mark): - # See the specification for details. - value = self.scan_tag_uri('directive', start_mark) - ch = self.peek() - if ch not in '\0 \r\n\x85\u2028\u2029': - raise ScannerError("while scanning a directive", start_mark, - "expected ' ', but found %r" % ch, self.get_mark()) - return value - - def scan_directive_ignored_line(self, start_mark): - # See the specification for details. - while self.peek() == ' ': - self.forward() - if self.peek() == '#': - while self.peek() not in '\0\r\n\x85\u2028\u2029': - self.forward() - ch = self.peek() - if ch not in '\0\r\n\x85\u2028\u2029': - raise ScannerError("while scanning a directive", start_mark, - "expected a comment or a line break, but found %r" - % ch, self.get_mark()) - self.scan_line_break() - - def scan_anchor(self, TokenClass): - # The specification does not restrict characters for anchors and - # aliases. This may lead to problems, for instance, the document: - # [ *alias, value ] - # can be interpreted in two ways, as - # [ "value" ] - # and - # [ *alias , "value" ] - # Therefore we restrict aliases to numbers and ASCII letters. - start_mark = self.get_mark() - indicator = self.peek() - if indicator == '*': - name = 'alias' - else: - name = 'anchor' - self.forward() - length = 0 - ch = self.peek(length) - while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ - or ch in '-_': - length += 1 - ch = self.peek(length) - if not length: - raise ScannerError("while scanning an %s" % name, start_mark, - "expected alphabetic or numeric character, but found %r" - % ch, self.get_mark()) - value = self.prefix(length) - self.forward(length) - ch = self.peek() - if ch not in '\0 \t\r\n\x85\u2028\u2029?:,]}%@`': - raise ScannerError("while scanning an %s" % name, start_mark, - "expected alphabetic or numeric character, but found %r" - % ch, self.get_mark()) - end_mark = self.get_mark() - return TokenClass(value, start_mark, end_mark) - - def scan_tag(self): - # See the specification for details. - start_mark = self.get_mark() - ch = self.peek(1) - if ch == '<': - handle = None - self.forward(2) - suffix = self.scan_tag_uri('tag', start_mark) - if self.peek() != '>': - raise ScannerError("while parsing a tag", start_mark, - "expected '>', but found %r" % self.peek(), - self.get_mark()) - self.forward() - elif ch in '\0 \t\r\n\x85\u2028\u2029': - handle = None - suffix = '!' - self.forward() - else: - length = 1 - use_handle = False - while ch not in '\0 \r\n\x85\u2028\u2029': - if ch == '!': - use_handle = True - break - length += 1 - ch = self.peek(length) - handle = '!' - if use_handle: - handle = self.scan_tag_handle('tag', start_mark) - else: - handle = '!' - self.forward() - suffix = self.scan_tag_uri('tag', start_mark) - ch = self.peek() - if ch not in '\0 \r\n\x85\u2028\u2029': - raise ScannerError("while scanning a tag", start_mark, - "expected ' ', but found %r" % ch, self.get_mark()) - value = (handle, suffix) - end_mark = self.get_mark() - return TagToken(value, start_mark, end_mark) - - def scan_block_scalar(self, style): - # See the specification for details. - - if style == '>': - folded = True - else: - folded = False - - chunks = [] - start_mark = self.get_mark() - - # Scan the header. - self.forward() - chomping, increment = self.scan_block_scalar_indicators(start_mark) - self.scan_block_scalar_ignored_line(start_mark) - - # Determine the indentation level and go to the first non-empty line. - min_indent = self.indent+1 - if min_indent < 1: - min_indent = 1 - if increment is None: - breaks, max_indent, end_mark = self.scan_block_scalar_indentation() - indent = max(min_indent, max_indent) - else: - indent = min_indent+increment-1 - breaks, end_mark = self.scan_block_scalar_breaks(indent) - line_break = '' - - # Scan the inner part of the block scalar. - while self.column == indent and self.peek() != '\0': - chunks.extend(breaks) - leading_non_space = self.peek() not in ' \t' - length = 0 - while self.peek(length) not in '\0\r\n\x85\u2028\u2029': - length += 1 - chunks.append(self.prefix(length)) - self.forward(length) - line_break = self.scan_line_break() - breaks, end_mark = self.scan_block_scalar_breaks(indent) - if self.column == indent and self.peek() != '\0': - - # Unfortunately, folding rules are ambiguous. - # - # This is the folding according to the specification: - - if folded and line_break == '\n' \ - and leading_non_space and self.peek() not in ' \t': - if not breaks: - chunks.append(' ') - else: - chunks.append(line_break) - - # This is Clark Evans's interpretation (also in the spec - # examples): - # - #if folded and line_break == '\n': - # if not breaks: - # if self.peek() not in ' \t': - # chunks.append(' ') - # else: - # chunks.append(line_break) - #else: - # chunks.append(line_break) - else: - break - - # Chomp the tail. - if chomping is not False: - chunks.append(line_break) - if chomping is True: - chunks.extend(breaks) - - # We are done. - return ScalarToken(''.join(chunks), False, start_mark, end_mark, - style) - - def scan_block_scalar_indicators(self, start_mark): - # See the specification for details. - chomping = None - increment = None - ch = self.peek() - if ch in '+-': - if ch == '+': - chomping = True - else: - chomping = False - self.forward() - ch = self.peek() - if ch in '0123456789': - increment = int(ch) - if increment == 0: - raise ScannerError("while scanning a block scalar", start_mark, - "expected indentation indicator in the range 1-9, but found 0", - self.get_mark()) - self.forward() - elif ch in '0123456789': - increment = int(ch) - if increment == 0: - raise ScannerError("while scanning a block scalar", start_mark, - "expected indentation indicator in the range 1-9, but found 0", - self.get_mark()) - self.forward() - ch = self.peek() - if ch in '+-': - if ch == '+': - chomping = True - else: - chomping = False - self.forward() - ch = self.peek() - if ch not in '\0 \r\n\x85\u2028\u2029': - raise ScannerError("while scanning a block scalar", start_mark, - "expected chomping or indentation indicators, but found %r" - % ch, self.get_mark()) - return chomping, increment - - def scan_block_scalar_ignored_line(self, start_mark): - # See the specification for details. - while self.peek() == ' ': - self.forward() - if self.peek() == '#': - while self.peek() not in '\0\r\n\x85\u2028\u2029': - self.forward() - ch = self.peek() - if ch not in '\0\r\n\x85\u2028\u2029': - raise ScannerError("while scanning a block scalar", start_mark, - "expected a comment or a line break, but found %r" % ch, - self.get_mark()) - self.scan_line_break() - - def scan_block_scalar_indentation(self): - # See the specification for details. - chunks = [] - max_indent = 0 - end_mark = self.get_mark() - while self.peek() in ' \r\n\x85\u2028\u2029': - if self.peek() != ' ': - chunks.append(self.scan_line_break()) - end_mark = self.get_mark() - else: - self.forward() - if self.column > max_indent: - max_indent = self.column - return chunks, max_indent, end_mark - - def scan_block_scalar_breaks(self, indent): - # See the specification for details. - chunks = [] - end_mark = self.get_mark() - while self.column < indent and self.peek() == ' ': - self.forward() - while self.peek() in '\r\n\x85\u2028\u2029': - chunks.append(self.scan_line_break()) - end_mark = self.get_mark() - while self.column < indent and self.peek() == ' ': - self.forward() - return chunks, end_mark - - def scan_flow_scalar(self, style): - # See the specification for details. - # Note that we loose indentation rules for quoted scalars. Quoted - # scalars don't need to adhere indentation because " and ' clearly - # mark the beginning and the end of them. Therefore we are less - # restrictive then the specification requires. We only need to check - # that document separators are not included in scalars. - if style == '"': - double = True - else: - double = False - chunks = [] - start_mark = self.get_mark() - quote = self.peek() - self.forward() - chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) - while self.peek() != quote: - chunks.extend(self.scan_flow_scalar_spaces(double, start_mark)) - chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) - self.forward() - end_mark = self.get_mark() - return ScalarToken(''.join(chunks), False, start_mark, end_mark, - style) - - ESCAPE_REPLACEMENTS = { - '0': '\0', - 'a': '\x07', - 'b': '\x08', - 't': '\x09', - '\t': '\x09', - 'n': '\x0A', - 'v': '\x0B', - 'f': '\x0C', - 'r': '\x0D', - 'e': '\x1B', - ' ': '\x20', - '\"': '\"', - '\\': '\\', - '/': '/', - 'N': '\x85', - '_': '\xA0', - 'L': '\u2028', - 'P': '\u2029', - } - - ESCAPE_CODES = { - 'x': 2, - 'u': 4, - 'U': 8, - } - - def scan_flow_scalar_non_spaces(self, double, start_mark): - # See the specification for details. - chunks = [] - while True: - length = 0 - while self.peek(length) not in '\'\"\\\0 \t\r\n\x85\u2028\u2029': - length += 1 - if length: - chunks.append(self.prefix(length)) - self.forward(length) - ch = self.peek() - if not double and ch == '\'' and self.peek(1) == '\'': - chunks.append('\'') - self.forward(2) - elif (double and ch == '\'') or (not double and ch in '\"\\'): - chunks.append(ch) - self.forward() - elif double and ch == '\\': - self.forward() - ch = self.peek() - if ch in self.ESCAPE_REPLACEMENTS: - chunks.append(self.ESCAPE_REPLACEMENTS[ch]) - self.forward() - elif ch in self.ESCAPE_CODES: - length = self.ESCAPE_CODES[ch] - self.forward() - for k in range(length): - if self.peek(k) not in '0123456789ABCDEFabcdef': - raise ScannerError("while scanning a double-quoted scalar", start_mark, - "expected escape sequence of %d hexadecimal numbers, but found %r" % - (length, self.peek(k)), self.get_mark()) - code = int(self.prefix(length), 16) - chunks.append(chr(code)) - self.forward(length) - elif ch in '\r\n\x85\u2028\u2029': - self.scan_line_break() - chunks.extend(self.scan_flow_scalar_breaks(double, start_mark)) - else: - raise ScannerError("while scanning a double-quoted scalar", start_mark, - "found unknown escape character %r" % ch, self.get_mark()) - else: - return chunks - - def scan_flow_scalar_spaces(self, double, start_mark): - # See the specification for details. - chunks = [] - length = 0 - while self.peek(length) in ' \t': - length += 1 - whitespaces = self.prefix(length) - self.forward(length) - ch = self.peek() - if ch == '\0': - raise ScannerError("while scanning a quoted scalar", start_mark, - "found unexpected end of stream", self.get_mark()) - elif ch in '\r\n\x85\u2028\u2029': - line_break = self.scan_line_break() - breaks = self.scan_flow_scalar_breaks(double, start_mark) - if line_break != '\n': - chunks.append(line_break) - elif not breaks: - chunks.append(' ') - chunks.extend(breaks) - else: - chunks.append(whitespaces) - return chunks - - def scan_flow_scalar_breaks(self, double, start_mark): - # See the specification for details. - chunks = [] - while True: - # Instead of checking indentation, we check for document - # separators. - prefix = self.prefix(3) - if (prefix == '---' or prefix == '...') \ - and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': - raise ScannerError("while scanning a quoted scalar", start_mark, - "found unexpected document separator", self.get_mark()) - while self.peek() in ' \t': - self.forward() - if self.peek() in '\r\n\x85\u2028\u2029': - chunks.append(self.scan_line_break()) - else: - return chunks - - def scan_plain(self): - # See the specification for details. - # We add an additional restriction for the flow context: - # plain scalars in the flow context cannot contain ',' or '?'. - # We also keep track of the `allow_simple_key` flag here. - # Indentation rules are loosed for the flow context. - chunks = [] - start_mark = self.get_mark() - end_mark = start_mark - indent = self.indent+1 - # We allow zero indentation for scalars, but then we need to check for - # document separators at the beginning of the line. - #if indent == 0: - # indent = 1 - spaces = [] - while True: - length = 0 - if self.peek() == '#': - break - while True: - ch = self.peek(length) - if ch in '\0 \t\r\n\x85\u2028\u2029' \ - or (ch == ':' and - self.peek(length+1) in '\0 \t\r\n\x85\u2028\u2029' - + (u',[]{}' if self.flow_level else u''))\ - or (self.flow_level and ch in ',?[]{}'): - break - length += 1 - if length == 0: - break - self.allow_simple_key = False - chunks.extend(spaces) - chunks.append(self.prefix(length)) - self.forward(length) - end_mark = self.get_mark() - spaces = self.scan_plain_spaces(indent, start_mark) - if not spaces or self.peek() == '#' \ - or (not self.flow_level and self.column < indent): - break - return ScalarToken(''.join(chunks), True, start_mark, end_mark) - - def scan_plain_spaces(self, indent, start_mark): - # See the specification for details. - # The specification is really confusing about tabs in plain scalars. - # We just forbid them completely. Do not use tabs in YAML! - chunks = [] - length = 0 - while self.peek(length) in ' ': - length += 1 - whitespaces = self.prefix(length) - self.forward(length) - ch = self.peek() - if ch in '\r\n\x85\u2028\u2029': - line_break = self.scan_line_break() - self.allow_simple_key = True - prefix = self.prefix(3) - if (prefix == '---' or prefix == '...') \ - and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': - return - breaks = [] - while self.peek() in ' \r\n\x85\u2028\u2029': - if self.peek() == ' ': - self.forward() - else: - breaks.append(self.scan_line_break()) - prefix = self.prefix(3) - if (prefix == '---' or prefix == '...') \ - and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': - return - if line_break != '\n': - chunks.append(line_break) - elif not breaks: - chunks.append(' ') - chunks.extend(breaks) - elif whitespaces: - chunks.append(whitespaces) - return chunks - - def scan_tag_handle(self, name, start_mark): - # See the specification for details. - # For some strange reasons, the specification does not allow '_' in - # tag handles. I have allowed it anyway. - ch = self.peek() - if ch != '!': - raise ScannerError("while scanning a %s" % name, start_mark, - "expected '!', but found %r" % ch, self.get_mark()) - length = 1 - ch = self.peek(length) - if ch != ' ': - while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ - or ch in '-_': - length += 1 - ch = self.peek(length) - if ch != '!': - self.forward(length) - raise ScannerError("while scanning a %s" % name, start_mark, - "expected '!', but found %r" % ch, self.get_mark()) - length += 1 - value = self.prefix(length) - self.forward(length) - return value - - def scan_tag_uri(self, name, start_mark): - # See the specification for details. - # Note: we do not check if URI is well-formed. - chunks = [] - length = 0 - ch = self.peek(length) - while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ - or ch in '-;/?:@&=+$,_.!~*\'()[]%': - if ch == '%': - chunks.append(self.prefix(length)) - self.forward(length) - length = 0 - chunks.append(self.scan_uri_escapes(name, start_mark)) - else: - length += 1 - ch = self.peek(length) - if length: - chunks.append(self.prefix(length)) - self.forward(length) - length = 0 - if not chunks: - raise ScannerError("while parsing a %s" % name, start_mark, - "expected URI, but found %r" % ch, self.get_mark()) - return ''.join(chunks) - - def scan_uri_escapes(self, name, start_mark): - # See the specification for details. - codes = [] - mark = self.get_mark() - while self.peek() == '%': - self.forward() - for k in range(2): - if self.peek(k) not in '0123456789ABCDEFabcdef': - raise ScannerError("while scanning a %s" % name, start_mark, - "expected URI escape sequence of 2 hexadecimal numbers, but found %r" - % self.peek(k), self.get_mark()) - codes.append(int(self.prefix(2), 16)) - self.forward(2) - try: - value = bytes(codes).decode('utf-8') - except UnicodeDecodeError as exc: - raise ScannerError("while scanning a %s" % name, start_mark, str(exc), mark) - return value - - def scan_line_break(self): - # Transforms: - # '\r\n' : '\n' - # '\r' : '\n' - # '\n' : '\n' - # '\x85' : '\n' - # '\u2028' : '\u2028' - # '\u2029 : '\u2029' - # default : '' - ch = self.peek() - if ch in '\r\n\x85': - if self.prefix(2) == '\r\n': - self.forward(2) - else: - self.forward() - return '\n' - elif ch in '\u2028\u2029': - self.forward() - return ch - return '' diff --git a/venv/lib/python3.8/site-packages/yaml/serializer.py b/venv/lib/python3.8/site-packages/yaml/serializer.py deleted file mode 100644 index fe911e67ae7a739abb491fbbc6834b9c37bbda4b..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/serializer.py +++ /dev/null @@ -1,111 +0,0 @@ - -__all__ = ['Serializer', 'SerializerError'] - -from .error import YAMLError -from .events import * -from .nodes import * - -class SerializerError(YAMLError): - pass - -class Serializer: - - ANCHOR_TEMPLATE = 'id%03d' - - def __init__(self, encoding=None, - explicit_start=None, explicit_end=None, version=None, tags=None): - self.use_encoding = encoding - self.use_explicit_start = explicit_start - self.use_explicit_end = explicit_end - self.use_version = version - self.use_tags = tags - self.serialized_nodes = {} - self.anchors = {} - self.last_anchor_id = 0 - self.closed = None - - def open(self): - if self.closed is None: - self.emit(StreamStartEvent(encoding=self.use_encoding)) - self.closed = False - elif self.closed: - raise SerializerError("serializer is closed") - else: - raise SerializerError("serializer is already opened") - - def close(self): - if self.closed is None: - raise SerializerError("serializer is not opened") - elif not self.closed: - self.emit(StreamEndEvent()) - self.closed = True - - #def __del__(self): - # self.close() - - def serialize(self, node): - if self.closed is None: - raise SerializerError("serializer is not opened") - elif self.closed: - raise SerializerError("serializer is closed") - self.emit(DocumentStartEvent(explicit=self.use_explicit_start, - version=self.use_version, tags=self.use_tags)) - self.anchor_node(node) - self.serialize_node(node, None, None) - self.emit(DocumentEndEvent(explicit=self.use_explicit_end)) - self.serialized_nodes = {} - self.anchors = {} - self.last_anchor_id = 0 - - def anchor_node(self, node): - if node in self.anchors: - if self.anchors[node] is None: - self.anchors[node] = self.generate_anchor(node) - else: - self.anchors[node] = None - if isinstance(node, SequenceNode): - for item in node.value: - self.anchor_node(item) - elif isinstance(node, MappingNode): - for key, value in node.value: - self.anchor_node(key) - self.anchor_node(value) - - def generate_anchor(self, node): - self.last_anchor_id += 1 - return self.ANCHOR_TEMPLATE % self.last_anchor_id - - def serialize_node(self, node, parent, index): - alias = self.anchors[node] - if node in self.serialized_nodes: - self.emit(AliasEvent(alias)) - else: - self.serialized_nodes[node] = True - self.descend_resolver(parent, index) - if isinstance(node, ScalarNode): - detected_tag = self.resolve(ScalarNode, node.value, (True, False)) - default_tag = self.resolve(ScalarNode, node.value, (False, True)) - implicit = (node.tag == detected_tag), (node.tag == default_tag) - self.emit(ScalarEvent(alias, node.tag, implicit, node.value, - style=node.style)) - elif isinstance(node, SequenceNode): - implicit = (node.tag - == self.resolve(SequenceNode, node.value, True)) - self.emit(SequenceStartEvent(alias, node.tag, implicit, - flow_style=node.flow_style)) - index = 0 - for item in node.value: - self.serialize_node(item, node, index) - index += 1 - self.emit(SequenceEndEvent()) - elif isinstance(node, MappingNode): - implicit = (node.tag - == self.resolve(MappingNode, node.value, True)) - self.emit(MappingStartEvent(alias, node.tag, implicit, - flow_style=node.flow_style)) - for key, value in node.value: - self.serialize_node(key, node, None) - self.serialize_node(value, node, key) - self.emit(MappingEndEvent()) - self.ascend_resolver() - diff --git a/venv/lib/python3.8/site-packages/yaml/tokens.py b/venv/lib/python3.8/site-packages/yaml/tokens.py deleted file mode 100644 index 4d0b48a394ac8c019b401516a12f688df361cf90..0000000000000000000000000000000000000000 --- a/venv/lib/python3.8/site-packages/yaml/tokens.py +++ /dev/null @@ -1,104 +0,0 @@ - -class Token(object): - def __init__(self, start_mark, end_mark): - self.start_mark = start_mark - self.end_mark = end_mark - def __repr__(self): - attributes = [key for key in self.__dict__ - if not key.endswith('_mark')] - attributes.sort() - arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) - for key in attributes]) - return '%s(%s)' % (self.__class__.__name__, arguments) - -#class BOMToken(Token): -# id = '' - -class DirectiveToken(Token): - id = '' - def __init__(self, name, value, start_mark, end_mark): - self.name = name - self.value = value - self.start_mark = start_mark - self.end_mark = end_mark - -class DocumentStartToken(Token): - id = '' - -class DocumentEndToken(Token): - id = '' - -class StreamStartToken(Token): - id = '' - def __init__(self, start_mark=None, end_mark=None, - encoding=None): - self.start_mark = start_mark - self.end_mark = end_mark - self.encoding = encoding - -class StreamEndToken(Token): - id = '' - -class BlockSequenceStartToken(Token): - id = '' - -class BlockMappingStartToken(Token): - id = '' - -class BlockEndToken(Token): - id = '' - -class FlowSequenceStartToken(Token): - id = '[' - -class FlowMappingStartToken(Token): - id = '{' - -class FlowSequenceEndToken(Token): - id = ']' - -class FlowMappingEndToken(Token): - id = '}' - -class KeyToken(Token): - id = '?' - -class ValueToken(Token): - id = ':' - -class BlockEntryToken(Token): - id = '-' - -class FlowEntryToken(Token): - id = ',' - -class AliasToken(Token): - id = '' - def __init__(self, value, start_mark, end_mark): - self.value = value - self.start_mark = start_mark - self.end_mark = end_mark - -class AnchorToken(Token): - id = '' - def __init__(self, value, start_mark, end_mark): - self.value = value - self.start_mark = start_mark - self.end_mark = end_mark - -class TagToken(Token): - id = '' - def __init__(self, value, start_mark, end_mark): - self.value = value - self.start_mark = start_mark - self.end_mark = end_mark - -class ScalarToken(Token): - id = '' - def __init__(self, value, plain, start_mark, end_mark, style=None): - self.value = value - self.plain = plain - self.start_mark = start_mark - self.end_mark = end_mark - self.style = style - diff --git a/venv/pyvenv.cfg b/venv/pyvenv.cfg deleted file mode 100644 index 853404e23c0366b53610217d8f603a2f9dd1feeb..0000000000000000000000000000000000000000 --- a/venv/pyvenv.cfg +++ /dev/null @@ -1,3 +0,0 @@ -home = /usr/bin -include-system-site-packages = false -version = 3.8.10 diff --git a/venv/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl b/venv/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl deleted file mode 100644 index 3f3a89504d8c216ed142ca8b3f0e511f3d12cc90..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/appdirs-1.4.3-py2.py3-none-any.whl b/venv/share/python-wheels/appdirs-1.4.3-py2.py3-none-any.whl deleted file mode 100644 index 629bdcc5cb9380a9a0a1dbe562d2b8d3e353d2c6..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/appdirs-1.4.3-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/certifi-2019.11.28-py2.py3-none-any.whl b/venv/share/python-wheels/certifi-2019.11.28-py2.py3-none-any.whl deleted file mode 100644 index cc1145339fdd7ba331b762076af38c07eb77bf08..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/certifi-2019.11.28-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/chardet-3.0.4-py2.py3-none-any.whl b/venv/share/python-wheels/chardet-3.0.4-py2.py3-none-any.whl deleted file mode 100644 index 3d27d991b93657fcb06519ec295710b126da84cf..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/chardet-3.0.4-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/colorama-0.4.3-py2.py3-none-any.whl b/venv/share/python-wheels/colorama-0.4.3-py2.py3-none-any.whl deleted file mode 100644 index 96b3fb126da2a87897ed71abd54d383587cf181e..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/colorama-0.4.3-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/contextlib2-0.6.0-py2.py3-none-any.whl b/venv/share/python-wheels/contextlib2-0.6.0-py2.py3-none-any.whl deleted file mode 100644 index d10bcdeb0cee2eaed9cb1b92f42ab34bc48af346..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/contextlib2-0.6.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/distlib-0.3.0-py2.py3-none-any.whl b/venv/share/python-wheels/distlib-0.3.0-py2.py3-none-any.whl deleted file mode 100644 index 193b6ac4028cfdba42146b225db0d952ffc05104..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/distlib-0.3.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl b/venv/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl deleted file mode 100644 index 9c7ccf1eb245b1c0e0d8a31f4821c781ae5ad908..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/html5lib-1.0.1-py2.py3-none-any.whl b/venv/share/python-wheels/html5lib-1.0.1-py2.py3-none-any.whl deleted file mode 100644 index 92806672ef623bb4117f012785c62b4ebbdbdf9f..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/html5lib-1.0.1-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/idna-2.8-py2.py3-none-any.whl b/venv/share/python-wheels/idna-2.8-py2.py3-none-any.whl deleted file mode 100644 index 925157560ee235e866b2539b37d30b570089e84b..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/idna-2.8-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl b/venv/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl deleted file mode 100644 index dd676316cd0045c70a9dd510f8b3d875684e4a22..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl b/venv/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl deleted file mode 100644 index d9efa3f1be68c5604028b009974d0a4ab5e178ea..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/msgpack-0.6.2-py2.py3-none-any.whl b/venv/share/python-wheels/msgpack-0.6.2-py2.py3-none-any.whl deleted file mode 100644 index 638f215f21e81da9b71402c04d716025456e5dfb..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/msgpack-0.6.2-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/packaging-20.3-py2.py3-none-any.whl b/venv/share/python-wheels/packaging-20.3-py2.py3-none-any.whl deleted file mode 100644 index 7285070132a20da3e9a6a14b490c1077e10ec5d1..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/packaging-20.3-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl b/venv/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl deleted file mode 100644 index 2d3bc05015c5732c3820afd79aa06b6f20c6700a..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/pip-20.0.2-py2.py3-none-any.whl b/venv/share/python-wheels/pip-20.0.2-py2.py3-none-any.whl deleted file mode 100644 index 6f88203f5f1f7c910596fb76e518e42bfe1aeca7..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/pip-20.0.2-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl b/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl deleted file mode 100644 index 22081cd9d5236168edf809c232474a32d8a60dfe..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/progress-1.5-py2.py3-none-any.whl b/venv/share/python-wheels/progress-1.5-py2.py3-none-any.whl deleted file mode 100644 index d4ce42d50c24180578cbaf895e9f6ec6b0172494..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/progress-1.5-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/pyparsing-2.4.6-py2.py3-none-any.whl b/venv/share/python-wheels/pyparsing-2.4.6-py2.py3-none-any.whl deleted file mode 100644 index 97c72f19db3921e09757cac22dace4f64a6efb15..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/pyparsing-2.4.6-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl b/venv/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl deleted file mode 100644 index 0936e56b1c7ff22834f5da57e4d7104cb960a69f..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl b/venv/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl deleted file mode 100644 index 7c98727cf8f23b3b8e3ddc0b1cb401effc454a8d..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/setuptools-44.0.0-py2.py3-none-any.whl b/venv/share/python-wheels/setuptools-44.0.0-py2.py3-none-any.whl deleted file mode 100644 index adc27761239ac8d526a6d1d132d1e6b876d704f9..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/setuptools-44.0.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/six-1.14.0-py2.py3-none-any.whl b/venv/share/python-wheels/six-1.14.0-py2.py3-none-any.whl deleted file mode 100644 index f66dca602f0cb5719a6642cf8d98af17c0625c74..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/six-1.14.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl b/venv/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl deleted file mode 100644 index 4c505473165a2703fbd597654777ac2cd676d72c..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/toml-0.10.0-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl b/venv/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl deleted file mode 100644 index df00d69e2ac2a9eab7a437f4cdf6dfe90f15117e..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl b/venv/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl deleted file mode 100644 index a82791f816cf16dcd3e3fc7278ab4982b2126b5f..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl and /dev/null differ diff --git a/venv/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl b/venv/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl deleted file mode 100644 index 4d476be01c858425b85740dd1aac3aaf4b965bf1..0000000000000000000000000000000000000000 Binary files a/venv/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl and /dev/null differ